blob: 7c3e59c0335c8060d97839171823c9e352f7b2c9 [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 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001918 PELOG1(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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002897 PELOG1(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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003018 PELOG1(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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003301 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 psessionEntry->currentOperChannel, newChannel);)
3303 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
3357
Jeff Johnson295189b2012-06-20 16:38:30 -07003358#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003359 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003360#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003361 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003362#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003363
Jeff Johnsone7245742012-09-05 17:12:55 -07003364 // Store the new primary and secondary channel in session entries if different
3365 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 {
3367 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003368 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003370 psessionEntry->currentOperChannel = newChannel;
3371 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003372 if (psessionEntry->htSecondaryChannelOffset != subband)
3373 {
3374 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003375 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003376 psessionEntry->htSecondaryChannelOffset, subband);
3377 psessionEntry->htSecondaryChannelOffset = subband;
3378 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3379 {
3380 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3381 }
3382 else
3383 {
3384 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3385 }
3386 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3387 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003388
3389 return;
3390}
3391
3392
3393/**
3394 * limActiveScanAllowed()
3395 *
3396 *FUNCTION:
3397 * Checks if active scans are permitted on the given channel
3398 *
3399 *LOGIC:
3400 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3401 * Need to check if the channelNum matches, then depending on the corresponding
3402 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3403 *
3404 *ASSUMPTIONS:
3405 *
3406 *NOTE:
3407 *
3408 * @param pMac Pointer to Global MAC structure
3409 * @param channelNum channel number
3410 * @return None
3411 */
3412
3413tANI_U8 limActiveScanAllowed(
3414 tpAniSirGlobal pMac,
3415 tANI_U8 channelNum)
3416{
3417 tANI_U32 i;
3418 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3419 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3420 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3421 != eSIR_SUCCESS)
3422 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003423 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 return false;
3425 }
3426
3427 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3428 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003429 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 len);
3431 return false;
3432 }
3433
3434 for (i=0; (i+1) < len; i+=2)
3435 {
3436 if (channelPair[i] == channelNum)
3437 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3438 }
3439 return false;
3440}
3441
3442/**
3443 * limTriggerBackgroundScanDuringQuietBss()
3444 *
3445 *FUNCTION:
3446 * This function is applicable to the STA only.
3447 * This function is called by limProcessQuietTimeout(),
3448 * when it is time to honor the Quiet BSS IE from the AP.
3449 *
3450 *LOGIC:
3451 * If 11H is enabled:
3452 * We cannot trigger a background scan. The STA needs to
3453 * shut-off Tx/Rx.
3454 * If 11 is not enabled:
3455 * Determine if the next channel that we are going to
3456 * scan is NOT the same channel (or not) on which the
3457 * Quiet BSS was requested.
3458 * If yes, then we cannot trigger a background scan on
3459 * this channel. Return with a false.
3460 * If no, then trigger a background scan. Return with
3461 * a true.
3462 *
3463 *ASSUMPTIONS:
3464 *
3465 *NOTE:
3466 * This API is redundant if the existing API,
3467 * limTriggerBackgroundScan(), were to return a valid
3468 * response instead of returning void.
3469 * If possible, try to revisit this API
3470 *
3471 * @param pMac Pointer to Global MAC structure
3472 * @return eSIR_TRUE, if a background scan was attempted
3473 * eSIR_FALSE, if not
3474 */
3475tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3476{
3477 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003478
3479
3480
3481 //TBD-RAJESH HOW TO GET sessionEntry?????
3482 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3483
3484 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3485 return bScanTriggered;
3486
Jeff Johnsone7245742012-09-05 17:12:55 -07003487 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 {
3489 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3490 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3491
3492 // Determine the next scan channel
3493
3494 // Get background scan channel list from CFG
3495 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3496 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3497 (tANI_U8 *) bgScanChannelList,
3498 (tANI_U32 *) &len ))
3499 {
3500 // Ensure that we do not go off scanning on the same
3501 // channel on which the Quiet BSS was requested
3502 if( psessionEntry->currentOperChannel!=
3503 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3504 {
3505 // For now, try and attempt a background scan. It will
3506 // be ideal if this API actually returns a success or
3507 // failure instead of having a void return type
3508 limTriggerBackgroundScan( pMac );
3509
3510 bScanTriggered = eSIR_TRUE;
3511 }
3512 else
3513 {
3514 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003515 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 -07003516 }
3517 }
3518 else
3519 {
3520 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003521 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 -07003522 }
3523 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 return bScanTriggered;
3525}
3526
3527
3528/**
3529 * limGetHTCapability()
3530 *
3531 *FUNCTION:
3532 * A utility function that returns the "current HT capability state" for the HT
3533 * capability of interest (as requested in the API)
3534 *
3535 *LOGIC:
3536 * This routine will return with the "current" setting of a requested HT
3537 * capability. This state info could be retrieved from -
3538 * a) CFG (for static entries)
3539 * b) Run time info
3540 * - Dynamic state maintained by LIM
3541 * - Configured at radio init time by SME
3542 *
3543 *
3544 *ASSUMPTIONS:
3545 * NA
3546 *
3547 *NOTE:
3548 *
3549 * @param pMac Pointer to Global MAC structure
3550 * @param htCap The HT capability being queried
3551 * @return tANI_U8 The current state of the requested HT capability is returned in a
3552 * tANI_U8 variable
3553 */
3554
Jeff Johnson295189b2012-06-20 16:38:30 -07003555tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3556 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003557{
3558tANI_U8 retVal = 0;
3559tANI_U8 *ptr;
3560tANI_U32 cfgValue;
3561tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3562tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3563tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3564tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3565
3566 //
3567 // Determine which CFG to read from. Not ALL of the HT
3568 // related CFG's need to be read each time this API is
3569 // accessed
3570 //
3571 if( htCap >= eHT_ANTENNA_SELECTION &&
3572 htCap < eHT_SI_GRANULARITY )
3573 {
3574 // Get Antenna Seletion HT Capabilities
3575 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3576 cfgValue = 0;
3577 ptr = (tANI_U8 *) &macASCapabilityInfo;
3578 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3579 }
3580 else
3581 {
3582 if( htCap >= eHT_TX_BEAMFORMING &&
3583 htCap < eHT_ANTENNA_SELECTION )
3584 {
3585 // Get Transmit Beam Forming HT Capabilities
3586 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3587 cfgValue = 0;
3588 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3589 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3590 }
3591 else
3592 {
3593 if( htCap >= eHT_PCO &&
3594 htCap < eHT_TX_BEAMFORMING )
3595 {
3596 // Get Extended HT Capabilities
3597 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3598 cfgValue = 0;
3599 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3600 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3601 }
3602 else
3603 {
3604 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3605 {
3606 // Get HT Capabilities
3607 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3608 cfgValue = 0;
3609 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3610 // 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
3611 *ptr++ = cfgValue & 0xff;
3612 *ptr = (cfgValue >> 8) & 0xff;
3613 }
3614 }
3615 }
3616 }
3617
3618 switch( htCap )
3619 {
3620 case eHT_LSIG_TXOP_PROTECTION:
3621 retVal = pMac->lim.gHTLsigTXOPProtection;
3622 break;
3623
3624 case eHT_STBC_CONTROL_FRAME:
3625 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3626 break;
3627
3628 case eHT_PSMP:
3629 retVal = pMac->lim.gHTPSMPSupport;
3630 break;
3631
3632 case eHT_DSSS_CCK_MODE_40MHZ:
3633 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3634 break;
3635
3636 case eHT_MAX_AMSDU_LENGTH:
3637 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3638 break;
3639
3640 case eHT_DELAYED_BA:
3641 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3642 break;
3643
3644 case eHT_RX_STBC:
3645 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3646 break;
3647
3648 case eHT_TX_STBC:
3649 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3650 break;
3651
3652 case eHT_SHORT_GI_40MHZ:
3653 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3654 break;
3655
3656 case eHT_SHORT_GI_20MHZ:
3657 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3658 break;
3659
3660 case eHT_GREENFIELD:
3661 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3662 break;
3663
3664 case eHT_MIMO_POWER_SAVE:
3665 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3666 break;
3667
3668 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003669 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 break;
3671
3672 case eHT_ADVANCED_CODING:
3673 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3674 break;
3675
3676 case eHT_MAX_RX_AMPDU_FACTOR:
3677 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3678 break;
3679
3680 case eHT_MPDU_DENSITY:
3681 retVal = pMac->lim.gHTAMpduDensity;
3682 break;
3683
3684 case eHT_PCO:
3685 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3686 break;
3687
3688 case eHT_TRANSITION_TIME:
3689 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3690 break;
3691
3692 case eHT_MCS_FEEDBACK:
3693 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3694 break;
3695
3696 case eHT_TX_BEAMFORMING:
3697 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3698 break;
3699
3700 case eHT_ANTENNA_SELECTION:
3701 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3702 break;
3703
3704 case eHT_SI_GRANULARITY:
3705 retVal = pMac->lim.gHTServiceIntervalGranularity;
3706 break;
3707
3708 case eHT_CONTROLLED_ACCESS:
3709 retVal = pMac->lim.gHTControlledAccessOnly;
3710 break;
3711
3712 case eHT_RIFS_MODE:
3713 retVal = psessionEntry->beaconParams.fRIFSMode;
3714 break;
3715
3716 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003717 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 break;
3719
3720 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003721 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003722 break;
3723
3724 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3726 retVal = psessionEntry->htOperMode;
3727 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 retVal = pMac->lim.gHTOperMode;
3729 break;
3730
3731 case eHT_BASIC_STBC_MCS:
3732 retVal = pMac->lim.gHTSTBCBasicMCS;
3733 break;
3734
3735 case eHT_DUAL_CTS_PROTECTION:
3736 retVal = pMac->lim.gHTDualCTSProtection;
3737 break;
3738
3739 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3740 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3741 break;
3742
3743 case eHT_PCO_ACTIVE:
3744 retVal = pMac->lim.gHTPCOActive;
3745 break;
3746
3747 case eHT_PCO_PHASE:
3748 retVal = pMac->lim.gHTPCOPhase;
3749 break;
3750
3751 default:
3752 break;
3753 }
3754
3755 return retVal;
3756}
3757
Jeff Johnson295189b2012-06-20 16:38:30 -07003758void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3759{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303760 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 return;
3762}
3763
3764
3765
3766
3767/** -------------------------------------------------------------
3768\fn limEnable11aProtection
3769\brief based on config setting enables\disables 11a protection.
3770\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3771\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3772\param tpUpdateBeaconParams pBeaconParams
3773\return None
3774 -------------------------------------------------------------*/
3775tSirRetStatus
3776limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3777 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3778{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003779 if(NULL == psessionEntry)
3780 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003781 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003782 return eSIR_FAILURE;
3783 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 //overlapping protection configuration check.
3785 if(overlap)
3786 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 }
3788 else
3789 {
3790 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003791 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003792 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 {
3794 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003795 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 return eSIR_SUCCESS;
3797 }
3798 }
3799
3800 if (enable)
3801 {
3802 //If we are AP and HT capable, we need to set the HT OP mode
3803 //appropriately.
3804 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003805 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 {
3807 if(overlap)
3808 {
3809 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3810 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3811 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3812 {
3813 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3814 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3815 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3816 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3817 }
3818 }
3819 else
3820 {
3821 psessionEntry->gLim11aParams.protectionEnabled = true;
3822 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3823 {
3824 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003825 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3827 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3828
3829 }
3830 }
3831 }
3832
3833 //This part is common for staiton as well.
3834 if(false == psessionEntry->beaconParams.llaCoexist)
3835 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003836 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3838 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3839 }
3840 }
3841 else if (true == psessionEntry->beaconParams.llaCoexist)
3842 {
3843 //for AP role.
3844 //we need to take care of HT OP mode change if needed.
3845 //We need to take care of Overlap cases.
3846 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3847 {
3848 if(overlap)
3849 {
3850 //Overlap Legacy protection disabled.
3851 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3852
3853 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003854 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 {
3856 // no HT op mode change if any of the overlap protection enabled.
3857 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3858 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3859 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3860
3861 {
3862 //Check if there is a need to change HT OP mode.
3863 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3864 {
3865 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3866 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3867
3868 if(psessionEntry->gLimHt20Params.protectionEnabled)
3869 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3870 else
3871 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3872 }
3873 }
3874 }
3875 }
3876 else
3877 {
3878 //Disable protection from 11A stations.
3879 psessionEntry->gLim11aParams.protectionEnabled = false;
3880 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3881
3882 //Check if any other non-HT protection enabled.
3883 //Right now we are in HT OP Mixed mode.
3884 //Change HT op mode appropriately.
3885
3886 //Change HT OP mode to 01 if any overlap protection enabled
3887 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3888 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3889 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3890
3891 {
3892 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003893 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003894 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3895 }
3896 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3897 {
3898 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003899 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3901 }
3902 else
3903 {
3904 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003905 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3907 }
3908 }
3909 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3910 !psessionEntry->gLim11aParams.protectionEnabled)
3911 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003912 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003913 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3914 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3915 }
3916 }
3917 //for station role
3918 else
3919 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003920 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003921 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3922 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3923 }
3924 }
3925
3926 return eSIR_SUCCESS;
3927}
3928
3929/** -------------------------------------------------------------
3930\fn limEnable11gProtection
3931\brief based on config setting enables\disables 11g protection.
3932\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3933\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3934\param tpUpdateBeaconParams pBeaconParams
3935\return None
3936 -------------------------------------------------------------*/
3937
3938tSirRetStatus
3939limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3940 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3941{
3942
3943 //overlapping protection configuration check.
3944 if(overlap)
3945 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 }
3947 else
3948 {
3949 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3951 !psessionEntry->cfgProtection.fromllb)
3952 {
3953 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003954 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 return eSIR_SUCCESS;
3956 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 {
3958 if(!pMac->lim.cfgProtection.fromllb)
3959 {
3960 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003961 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003962 return eSIR_SUCCESS;
3963 }
3964 }
3965 }
3966
3967 if (enable)
3968 {
3969 //If we are AP and HT capable, we need to set the HT OP mode
3970 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3972 {
3973 if(overlap)
3974 {
3975 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003976 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003977 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 {
3979 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3980 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3981 {
3982 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3983 }
3984 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3985 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3986 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3987 //Not processing OBSS bit from other APs, as we are already taking care
3988 //of Protection from overlapping BSS based on erp IE or useProtection bit
3989 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3990 }
3991 }
3992 else
3993 {
3994 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003995 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003996 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 {
3998 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3999 {
4000 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4001 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4002 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4003 }
4004 }
4005 }
4006 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004007 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004008 {
4009 if(overlap)
4010 {
4011 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4012 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4013 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4014 {
4015 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4016 }
4017 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4018 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4019 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4020 //Not processing OBSS bit from other APs, as we are already taking care
4021 //of Protection from overlapping BSS based on erp IE or useProtection bit
4022 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4023 }
4024 else
4025 {
4026 psessionEntry->gLim11bParams.protectionEnabled = true;
4027 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4028 {
4029 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4030 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4031 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4032 }
4033 }
4034 }
4035
4036 //This part is common for staiton as well.
4037 if(false == psessionEntry->beaconParams.llbCoexist)
4038 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004039 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4041 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4042 }
4043 }
4044 else if (true == psessionEntry->beaconParams.llbCoexist)
4045 {
4046 //for AP role.
4047 //we need to take care of HT OP mode change if needed.
4048 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4050 {
4051 if(overlap)
4052 {
4053 //Overlap Legacy protection disabled.
4054 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4055
4056 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004057 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004058 {
4059 // no HT op mode change if any of the overlap protection enabled.
4060 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4061 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4062 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4063 {
4064 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004065 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 {
4067 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4068 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4069 if(psessionEntry->gLimHt20Params.protectionEnabled){
4070 //Commenting out beacuse of CR 258588 WFA cert
4071 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4072 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4073 }
4074 else
4075 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4076 }
4077 }
4078 }
4079 }
4080 else
4081 {
4082 //Disable protection from 11B stations.
4083 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004084 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 //Check if any other non-HT protection enabled.
4086 if(!psessionEntry->gLim11gParams.protectionEnabled)
4087 {
4088 //Right now we are in HT OP Mixed mode.
4089 //Change HT op mode appropriately.
4090 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4091
4092 //Change HT OP mode to 01 if any overlap protection enabled
4093 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4094 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4095 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4096 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4097 {
4098 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004099 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4101 }
4102 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4103 {
4104 //Commenting because of CR 258588 WFA cert
4105 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4106 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004107 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4109 }
4110 else
4111 {
4112 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4113 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4114 }
4115 }
4116 }
4117 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4118 !psessionEntry->gLim11bParams.protectionEnabled)
4119 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004120 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4122 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4123 }
4124 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004125 {
4126 if(overlap)
4127 {
4128 //Overlap Legacy protection disabled.
4129 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4130
4131 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004132 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 {
4134 // no HT op mode change if any of the overlap protection enabled.
4135 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4136 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4137 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4138
4139 {
4140 //Check if there is a need to change HT OP mode.
4141 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4142 {
4143 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4144 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4145 if(psessionEntry->gLimHt20Params.protectionEnabled)
4146 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4147 else
4148 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4149 }
4150 }
4151 }
4152 }
4153 else
4154 {
4155 //Disable protection from 11B stations.
4156 psessionEntry->gLim11bParams.protectionEnabled = false;
4157 //Check if any other non-HT protection enabled.
4158 if(!psessionEntry->gLim11gParams.protectionEnabled)
4159 {
4160 //Right now we are in HT OP Mixed mode.
4161 //Change HT op mode appropriately.
4162 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4163
4164 //Change HT OP mode to 01 if any overlap protection enabled
4165 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4166 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4167 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4168 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4169
4170 {
4171 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4172 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4173 }
4174 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4175 {
4176 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4177 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4178 }
4179 else
4180 {
4181 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4182 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4183 }
4184 }
4185 }
4186 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4187 !psessionEntry->gLim11bParams.protectionEnabled)
4188 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004189 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4191 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4192 }
4193 }
4194 //for station role
4195 else
4196 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004197 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4199 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4200 }
4201 }
4202 return eSIR_SUCCESS;
4203}
4204
4205/** -------------------------------------------------------------
4206\fn limEnableHtProtectionFrom11g
4207\brief based on cofig enables\disables protection from 11g.
4208\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4209\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4210\param tpUpdateBeaconParams pBeaconParams
4211\return None
4212 -------------------------------------------------------------*/
4213tSirRetStatus
4214limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4215 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4216{
Jeff Johnsone7245742012-09-05 17:12:55 -07004217 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4219
4220 //overlapping protection configuration check.
4221 if(overlap)
4222 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4224 {
4225 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004226 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 return eSIR_SUCCESS;
4228 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 {
4230 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004231 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 return eSIR_SUCCESS;
4233 }
4234 }
4235 else
4236 {
4237 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4239 !psessionEntry->cfgProtection.fromllg){
4240 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004241 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 return eSIR_SUCCESS;
4243 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 {
4245 if(!pMac->lim.cfgProtection.fromllg)
4246 {
4247 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004248 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 return eSIR_SUCCESS;
4250 }
4251 }
4252 }
4253 if (enable)
4254 {
4255 //If we are AP and HT capable, we need to set the HT OP mode
4256 //appropriately.
4257
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4259 {
4260 if(overlap)
4261 {
4262 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4263 //11g exists in overlap BSS.
4264 //need not to change the operating mode to overlap_legacy
4265 //if higher or same protection operating mode is enabled right now.
4266 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4267 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4268 {
4269 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4270 }
4271 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304272 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 }
4274 else
4275 {
4276 //11g is associated to an AP operating in 11n mode.
4277 //Change the HT operating mode to 'mixed mode'.
4278 psessionEntry->gLim11gParams.protectionEnabled = true;
4279 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4280 {
4281 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4282 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304283 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 }
4285 }
4286 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 {
4288 if(overlap)
4289 {
4290 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4291 //11g exists in overlap BSS.
4292 //need not to change the operating mode to overlap_legacy
4293 //if higher or same protection operating mode is enabled right now.
4294 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4295 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4296 {
4297 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4298 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4299 }
4300 }
4301 else
4302 {
4303 //11g is associated to an AP operating in 11n mode.
4304 //Change the HT operating mode to 'mixed mode'.
4305 psessionEntry->gLim11gParams.protectionEnabled = true;
4306 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4307 {
4308 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4309 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304310 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 }
4312 }
4313 }
4314
4315 //This part is common for staiton as well.
4316 if(false == psessionEntry->beaconParams.llgCoexist)
4317 {
4318 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4319 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4320 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4322 {
4323 // As operating mode changed after G station assoc some way to update beacon
4324 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4325 //pMac->sch.schObject.fBeaconChanged = 1;
4326 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4327 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 }
4329 else if (true == psessionEntry->beaconParams.llgCoexist)
4330 {
4331 //for AP role.
4332 //we need to take care of HT OP mode change if needed.
4333 //We need to take care of Overlap cases.
4334
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4336 {
4337 if(overlap)
4338 {
4339 //Overlap Legacy protection disabled.
4340 if (psessionEntry->gLim11gParams.numSta == 0)
4341 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4342
4343 // no HT op mode change if any of the overlap protection enabled.
4344 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4345 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4346 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4347 {
4348 //Check if there is a need to change HT OP mode.
4349 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4350 {
4351 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4352 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4353
4354 if(psessionEntry->gLimHt20Params.protectionEnabled){
4355 //Commenting because of CR 258588 WFA cert
4356 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4357 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4358 }
4359 else
4360 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4361 }
4362 }
4363 }
4364 else
4365 {
4366 //Disable protection from 11G stations.
4367 psessionEntry->gLim11gParams.protectionEnabled = false;
4368 //Check if any other non-HT protection enabled.
4369 if(!psessionEntry->gLim11bParams.protectionEnabled)
4370 {
4371
4372 //Right now we are in HT OP Mixed mode.
4373 //Change HT op mode appropriately.
4374 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4375
4376 //Change HT OP mode to 01 if any overlap protection enabled
4377 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4378 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4379 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4380 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4381
4382 {
4383 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4384 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4385 }
4386 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4387 {
4388 //Commenting because of CR 258588 WFA cert
4389 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4390 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4391 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4392 }
4393 else
4394 {
4395 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4396 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4397 }
4398 }
4399 }
4400 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4401 !psessionEntry->gLim11gParams.protectionEnabled)
4402 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004403 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4405 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4406 }
4407 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004408 {
4409 if(overlap)
4410 {
4411 //Overlap Legacy protection disabled.
4412 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4413
4414 // no HT op mode change if any of the overlap protection enabled.
4415 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4416 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4417 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4418 {
4419 //Check if there is a need to change HT OP mode.
4420 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4421 {
4422 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4423 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4424
4425 if(psessionEntry->gLimHt20Params.protectionEnabled)
4426 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4427 else
4428 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4429 }
4430 }
4431 }
4432 else
4433 {
4434 //Disable protection from 11G stations.
4435 psessionEntry->gLim11gParams.protectionEnabled = false;
4436 //Check if any other non-HT protection enabled.
4437 if(!psessionEntry->gLim11bParams.protectionEnabled)
4438 {
4439
4440 //Right now we are in HT OP Mixed mode.
4441 //Change HT op mode appropriately.
4442 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4443
4444 //Change HT OP mode to 01 if any overlap protection enabled
4445 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4446 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4447 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4448 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4449
4450 {
4451 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4452 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4453 }
4454 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4455 {
4456 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4457 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4458 }
4459 else
4460 {
4461 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4462 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4463 }
4464 }
4465 }
4466 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4467 !psessionEntry->gLim11gParams.protectionEnabled)
4468 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004469 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004470 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4471 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4472 }
4473 }
4474 //for station role
4475 else
4476 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004477 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4479 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4480 }
4481 }
4482 return eSIR_SUCCESS;
4483}
4484//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4485//This check will be done at the caller.
4486
4487/** -------------------------------------------------------------
4488\fn limEnableHtObssProtection
4489\brief based on cofig enables\disables obss protection.
4490\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4491\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4492\param tpUpdateBeaconParams pBeaconParams
4493\return None
4494 -------------------------------------------------------------*/
4495tSirRetStatus
4496limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4497 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4498{
4499
4500
Jeff Johnsone7245742012-09-05 17:12:55 -07004501 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 return eSIR_SUCCESS; // this protection is only for HT stations.
4503
4504 //overlapping protection configuration check.
4505 if(overlap)
4506 {
4507 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 }
4509 else
4510 {
4511 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4513 { //ToDo Update this field
4514 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004515 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 return eSIR_SUCCESS;
4517 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 {
4519 if(!pMac->lim.cfgProtection.obss)
4520 { //ToDo Update this field
4521 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004522 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004523 return eSIR_SUCCESS;
4524 }
4525 }
4526 }
4527
4528
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4530 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4531 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004532 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 psessionEntry->beaconParams.gHTObssMode = true;
4534 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4535
4536 }
4537 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4538 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004539 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 psessionEntry->beaconParams.gHTObssMode = false;
4541 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4542
4543 }
4544//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4545 if (!enable && !overlap)
4546 {
4547 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4548 }
4549 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 {
4551 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4552 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004553 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 psessionEntry->beaconParams.gHTObssMode = true;
4555 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4556
4557 }
4558 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4559 {
4560
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004561 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 psessionEntry->beaconParams.gHTObssMode = false;
4563 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4564
4565 }
4566 }
4567 return eSIR_SUCCESS;
4568}
4569/** -------------------------------------------------------------
4570\fn limEnableHT20Protection
4571\brief based on cofig enables\disables protection from Ht20.
4572\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4573\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4574\param tpUpdateBeaconParams pBeaconParams
4575\return None
4576 -------------------------------------------------------------*/
4577tSirRetStatus
4578limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4579 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4580{
Jeff Johnsone7245742012-09-05 17:12:55 -07004581 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 return eSIR_SUCCESS; // this protection is only for HT stations.
4583
4584 //overlapping protection configuration check.
4585 if(overlap)
4586 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004587 }
4588 else
4589 {
4590 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004591 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4592 !psessionEntry->cfgProtection.ht20)
4593 {
4594 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004595 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 return eSIR_SUCCESS;
4597 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 {
4599 if(!pMac->lim.cfgProtection.ht20)
4600 {
4601 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004602 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 return eSIR_SUCCESS;
4604 }
4605 }
4606 }
4607
4608 if (enable)
4609 {
4610 //If we are AP and HT capable, we need to set the HT OP mode
4611 //appropriately.
4612
Jeff Johnson295189b2012-06-20 16:38:30 -07004613 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4614 if(overlap)
4615 {
4616 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4617 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4618 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4619 {
4620 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4621 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4622 }
4623 }
4624 else
4625 {
4626 psessionEntry->gLimHt20Params.protectionEnabled = true;
4627 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4628 {
4629 //Commenting because of CR 258588 WFA cert
4630 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4631 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4632 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4633 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4634 }
4635 }
4636 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004637 {
4638 if(overlap)
4639 {
4640 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4641 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4642 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4643 {
4644 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4645 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4646 }
4647 }
4648 else
4649 {
4650 psessionEntry->gLimHt20Params.protectionEnabled = true;
4651 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4652 {
4653 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4654 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4655 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4656 }
4657 }
4658 }
4659
4660 //This part is common for staiton as well.
4661 if(false == psessionEntry->beaconParams.ht20Coexist)
4662 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004663 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4665 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4666 }
4667 }
4668 else if (true == psessionEntry->beaconParams.ht20Coexist)
4669 {
4670 //for AP role.
4671 //we need to take care of HT OP mode change if needed.
4672 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4674 if(overlap)
4675 {
4676 //Overlap Legacy protection disabled.
4677 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4678
4679 // no HT op mode change if any of the overlap protection enabled.
4680 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4681 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4682 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4683 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4684 {
4685
4686 //Check if there is a need to change HT OP mode.
4687 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4688 {
4689 if(psessionEntry->gLimHt20Params.protectionEnabled)
4690 {
4691 //Commented beacuse of CR 258588 for WFA Cert
4692 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4693 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4694 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4695 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4696 }
4697 else
4698 {
4699 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4700 }
4701 }
4702 }
4703 }
4704 else
4705 {
4706 //Disable protection from 11G stations.
4707 psessionEntry->gLimHt20Params.protectionEnabled = false;
4708
4709 //Change HT op mode appropriately.
4710 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4711 {
4712 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4713 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4714 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4715 }
4716 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004717 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004718 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4719 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4720 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004721 {
4722 if(overlap)
4723 {
4724 //Overlap Legacy protection disabled.
4725 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4726
4727 // no HT op mode change if any of the overlap protection enabled.
4728 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4729 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4730 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4731 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4732 {
4733
4734 //Check if there is a need to change HT OP mode.
4735 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4736 {
4737 if(psessionEntry->gLimHt20Params.protectionEnabled)
4738 {
4739 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4740 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4741 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4742 }
4743 else
4744 {
4745 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4746 }
4747 }
4748 }
4749 }
4750 else
4751 {
4752 //Disable protection from 11G stations.
4753 psessionEntry->gLimHt20Params.protectionEnabled = false;
4754
4755 //Change HT op mode appropriately.
4756 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4757 {
4758 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4759 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4760 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4761 }
4762 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004763 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004764 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4765 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4766 }
4767 //for station role
4768 else
4769 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004770 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004771 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4772 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4773 }
4774 }
4775
4776 return eSIR_SUCCESS;
4777}
4778
4779/** -------------------------------------------------------------
4780\fn limEnableHTNonGfProtection
4781\brief based on cofig enables\disables protection from NonGf.
4782\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4783\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4784\param tpUpdateBeaconParams pBeaconParams
4785\return None
4786 -------------------------------------------------------------*/
4787tSirRetStatus
4788limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4789 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4790{
Jeff Johnsone7245742012-09-05 17:12:55 -07004791 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 return eSIR_SUCCESS; // this protection is only for HT stations.
4793
4794 //overlapping protection configuration check.
4795 if(overlap)
4796 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 }
4798 else
4799 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 //normal protection config check
4801 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4802 !psessionEntry->cfgProtection.nonGf)
4803 {
4804 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004805 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 return eSIR_SUCCESS;
4807 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004808 {
4809 //normal protection config check
4810 if(!pMac->lim.cfgProtection.nonGf)
4811 {
4812 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004813 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 return eSIR_SUCCESS;
4815 }
4816 }
4817 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4819 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004821 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4823 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4824 }
4825 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4826 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004827 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4829 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4830 }
4831 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004832 {
4833 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4834 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004835 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004836 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4837 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4838 }
4839 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4840 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004841 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4843 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4844 }
4845 }
4846
4847 return eSIR_SUCCESS;
4848}
4849
4850/** -------------------------------------------------------------
4851\fn limEnableHTLsigTxopProtection
4852\brief based on cofig enables\disables LsigTxop protection.
4853\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4854\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4855\param tpUpdateBeaconParams pBeaconParams
4856\return None
4857 -------------------------------------------------------------*/
4858tSirRetStatus
4859limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4860 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4861{
Jeff Johnsone7245742012-09-05 17:12:55 -07004862 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 return eSIR_SUCCESS; // this protection is only for HT stations.
4864
4865 //overlapping protection configuration check.
4866 if(overlap)
4867 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004868 }
4869 else
4870 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 //normal protection config check
4872 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4873 !psessionEntry->cfgProtection.lsigTxop)
4874 {
4875 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004876 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 return eSIR_SUCCESS;
4878 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004879 {
4880 //normal protection config check
4881 if(!pMac->lim.cfgProtection.lsigTxop)
4882 {
4883 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004884 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 return eSIR_SUCCESS;
4886 }
4887 }
4888 }
4889
4890
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4892 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004894 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4896 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4897 }
4898 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4899 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004900 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4902 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4903 }
4904 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004905 {
4906 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4907 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004908 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4910 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4911 }
4912 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4913 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004914 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004915 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4916 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4917 }
4918 }
4919 return eSIR_SUCCESS;
4920}
4921//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4922//This check will be done at the caller.
4923/** -------------------------------------------------------------
4924\fn limEnableHtRifsProtection
4925\brief based on cofig enables\disables Rifs protection.
4926\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4927\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4928\param tpUpdateBeaconParams pBeaconParams
4929\return None
4930 -------------------------------------------------------------*/
4931tSirRetStatus
4932limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4933 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4934{
Jeff Johnsone7245742012-09-05 17:12:55 -07004935 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 return eSIR_SUCCESS; // this protection is only for HT stations.
4937
4938
4939 //overlapping protection configuration check.
4940 if(overlap)
4941 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004942 }
4943 else
4944 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 //normal protection config check
4946 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4947 !psessionEntry->cfgProtection.rifs)
4948 {
4949 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004950 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 return eSIR_SUCCESS;
4952 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004953 {
4954 //normal protection config check
4955 if(!pMac->lim.cfgProtection.rifs)
4956 {
4957 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004958 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 return eSIR_SUCCESS;
4960 }
4961 }
4962 }
4963
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4965 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4966 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4967 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004968 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004969 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4970 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4971 }
4972 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4973 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4974 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004975 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4977 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4978 }
4979 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004980 {
4981 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4982 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4983 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004984 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4986 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4987 }
4988 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4989 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4990 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004991 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4993 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4994 }
4995 }
4996 return eSIR_SUCCESS;
4997}
4998
4999// ---------------------------------------------------------------------
5000/**
5001 * limEnableShortPreamble
5002 *
5003 * FUNCTION:
5004 * Enable/Disable short preamble
5005 *
5006 * LOGIC:
5007 *
5008 * ASSUMPTIONS:
5009 *
5010 * NOTE:
5011 *
5012 * @param enable Flag to enable/disable short preamble
5013 * @return None
5014 */
5015
5016tSirRetStatus
5017limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5018{
5019 tANI_U32 val;
5020
5021 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5022 {
5023 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005024 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 return eSIR_FAILURE;
5026 }
5027
5028 if (!val)
5029 return eSIR_SUCCESS;
5030
5031 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5032 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005033 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005034 return eSIR_FAILURE;
5035 }
5036
5037 if (!val) // 11G short preamble switching is disabled.
5038 return eSIR_SUCCESS;
5039
5040 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5041 {
5042 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5043 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005044 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005045 psessionEntry->beaconParams.fShortPreamble = true;
5046 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5047 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5048 }
5049 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5050 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005051 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 psessionEntry->beaconParams.fShortPreamble = false;
5053 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5054 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5055 }
5056 }
5057
5058 return eSIR_SUCCESS;
5059 }
5060
5061/**
5062 * limTxComplete
5063 *
5064 * Function:
5065 * This is LIM's very own "TX MGMT frame complete" completion routine.
5066 *
5067 * Logic:
5068 * LIM wants to send a MGMT frame (broadcast or unicast)
5069 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5070 * LIM transmits the MGMT frame using the API:
5071 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5072 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5073 * HDD, if it determines that a TX completion routine (in this case
5074 * limTxComplete) has been provided, will invoke this callback
5075 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5076 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5077 *
5078 * Assumptions:
5079 * Presently, this is ONLY being used for MGMT frames/packets
5080 * TODO:
5081 * Would it do good for LIM to have some sort of "signature" validation to
5082 * ensure that the pData argument passed in was a buffer that was actually
5083 * allocated by LIM and/or is not corrupted?
5084 *
5085 * Note: FIXME and TODO
5086 * Looks like palPktFree() is interested in pPacket. But, when this completion
5087 * routine is called, only pData is made available to LIM!!
5088 *
5089 * @param void A pointer to pData. Shouldn't it be pPacket?!
5090 *
5091 * @return none
5092 */
5093void limTxComplete( tHalHandle hHal, void *pData )
5094{
5095 tpAniSirGlobal pMac;
5096 pMac = (tpAniSirGlobal)hHal;
5097
5098#ifdef FIXME_PRIMA
5099 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5100#ifdef TRACE_RECORD
5101 {
5102 tpSirMacMgmtHdr mHdr;
5103 v_U8_t *pRxBd;
5104 vos_pkt_t *pVosPkt;
5105 VOS_STATUS vosStatus;
5106
5107
5108
5109 pVosPkt = (vos_pkt_t *)pData;
5110 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5111
5112 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5113 {
5114 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005115
5116 }
5117 }
5118#endif
5119#endif
5120
5121 palPktFree( pMac->hHdd,
5122 HAL_TXRX_FRM_802_11_MGMT,
5123 (void *) NULL, // this is ignored and will likely be removed from this API
5124 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5125}
5126
5127/**
5128 * \brief This function updates lim global structure, if CB parameters in the BSS
5129 * have changed, and sends an indication to HAL also with the
5130 * updated HT Parameters.
5131 * This function does not detect the change in the primary channel, that is done as part
5132 * of channel Swtich IE processing.
5133 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5134 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5135 *
5136 *
5137 * \param pMac Pointer to global MAC structure
5138 *
5139 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5140 * Probe Response
5141 *
5142 * \param bssIdx BSS Index of the Bss to which Station is associated.
5143 *
5144 *
5145 */
5146
5147void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5148 tDot11fIEHTInfo *pHTInfo,
5149 tANI_U8 bssIdx,
5150 tpPESession psessionEntry)
5151{
Jeff Johnsone7245742012-09-05 17:12:55 -07005152 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005153#if !defined WLAN_FEATURE_VOWIFI
5154 tANI_U32 localPwrConstraint;
5155#endif
5156
5157 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005158 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 return;
5160
5161#if !defined WLAN_FEATURE_VOWIFI
5162 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005163 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005164 return;
5165 }
5166#endif
5167
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305168 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5169 {
5170 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5171 return;
5172 }
5173
Mihir Shetebc160b72014-08-22 14:10:39 +05305174 /*
5175 * Do not try to switch channel if RoC is in progress. RoC code path uses
5176 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5177 * has started listening on the channel requested as part of RoC, if we set
5178 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5179 * upper layers will think that the channel change is not successful and the
5180 * RoC from the upper layer perspective will never end...
5181 */
5182 if (pMac->lim.gpLimRemainOnChanReq)
5183 {
5184 limLog( pMac, LOGE, FL( "RoC is in progress"));
5185 return;
5186 }
5187
Jeff Johnsone7245742012-09-05 17:12:55 -07005188 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5189 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005190 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005191 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5192 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5193 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5194 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005195
5196 // Notify HAL
5197 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005198 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005199 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005200 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005201 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005202 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005203 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5204 pMac->lim.gpchangeChannelCallback = NULL;
5205 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005206
5207#if defined WLAN_FEATURE_VOWIFI
5208 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5209 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5210#else
5211 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5212 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5213#endif
5214
5215 //In case of IBSS, if STA should update HT Info IE in its beacons.
5216 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5217 {
5218 schSetFixedBeaconFields(pMac,psessionEntry);
5219 }
5220
5221 }
5222} // End limUpdateStaRunTimeHTParams.
5223
5224/**
5225 * \brief This function updates the lim global structure, if any of the
5226 * HT Capabilities have changed.
5227 *
5228 *
5229 * \param pMac Pointer to Global MAC structure
5230 *
5231 * \param pHTCapability Pointer to HT Capability Information Element
5232 * obtained from a Beacon or Probe Response
5233 *
5234 *
5235 *
5236 */
5237
5238void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5239 tDot11fIEHTCaps *pHTCaps )
5240{
5241
5242 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5243 {
5244 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5245 // Send change notification to HAL
5246 }
5247
5248 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5249 {
5250 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5251 // Send change notification to HAL
5252 }
5253
5254 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5255 {
5256 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5257 // Send change notification to HAL
5258 }
5259
5260
5261} // End limUpdateStaRunTimeHTCapability.
5262
5263/**
5264 * \brief This function updates lim global structure, if any of the HT
5265 * Info Parameters have changed.
5266 *
5267 *
5268 * \param pMac Pointer to the global MAC structure
5269 *
5270 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5271 * Probe Response
5272 *
5273 *
5274 */
5275
5276void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305277 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005278{
Jeff Johnsone7245742012-09-05 17:12:55 -07005279 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005280 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005281 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005282 // Send change notification to HAL
5283 }
5284
5285 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5286 {
5287 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5288 // Send change notification to HAL
5289 }
5290
5291 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5292 {
5293 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5294 // Send change notification to HAL
5295 }
5296
5297 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5298 {
5299 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5300 // Send change notification to HAL
5301 }
5302
5303 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5304 {
5305 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5306 }
5307
5308 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5309 {
5310 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5311 // Send change notification to HAL
5312 }
5313
5314 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5315 {
5316 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5317 // Send change notification to HAL
5318 }
5319
5320 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5321 {
5322 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5323 // Send change notification to HAL
5324 }
5325
5326 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5327 {
5328 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5329 // Send change notification to HAL
5330 }
5331
5332 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5333 {
5334 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5335 // Send change notification to HAL
5336 }
5337
5338 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5339 {
5340 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5341 // Send change notification to HAL
5342 }
5343
5344} // End limUpdateStaRunTimeHTInfo.
5345
5346
5347/** -------------------------------------------------------------
5348\fn limProcessHalIndMessages
5349\brief callback function for HAL indication
5350\param tpAniSirGlobal pMac
5351\param tANI_U32 mesgId
5352\param void *mesgParam
5353\return tSirRetStatu - status
5354 -------------------------------------------------------------*/
5355
5356tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5357{
5358 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5359 tSirMsgQ msg;
5360
5361 switch(msgId)
5362 {
5363 case SIR_LIM_DEL_TS_IND:
5364 case SIR_LIM_ADD_BA_IND:
5365 case SIR_LIM_DEL_BA_ALL_IND:
5366 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5367 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305368 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005369 msg.type = (tANI_U16) msgId;
5370 msg.bodyptr = msgParam;
5371 msg.bodyval = 0;
5372 break;
5373
5374 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305375 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005376 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005377 return eSIR_FAILURE;
5378 }
5379
5380 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5381 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305382 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005383 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5384 return eSIR_FAILURE;
5385 }
5386 return eSIR_SUCCESS;
5387}
5388
5389/** -------------------------------------------------------------
5390\fn limValidateDeltsReq
5391\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5392\param tpAniSirGlobal pMac
5393\param tpSirDeltsReq pDeltsReq
5394\param tSirMacAddr peerMacAddr
5395\return eSirRetStatus - status
5396 -------------------------------------------------------------*/
5397
5398tSirRetStatus
5399limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5400{
5401 tpDphHashNode pSta;
5402 tANI_U8 tsStatus;
5403 tSirMacTSInfo *tsinfo;
5404 tANI_U32 i;
5405 tANI_U8 tspecIdx;
5406 /* if sta
5407 * - verify assoc state
5408 * - del tspec locally
5409 * if ap,
5410 * - verify sta is in assoc state
5411 * - del sta tspec locally
5412 */
5413 if(pDeltsReq == NULL)
5414 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005415 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005416 return eSIR_FAILURE;
5417 }
5418
5419 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5420 {
5421 tANI_U32 val;
5422
5423 // station always talks to the AP
5424 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5425
5426 val = sizeof(tSirMacAddr);
5427 #if 0
5428 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5429 {
5430 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005431 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005432 return eSIR_FAILURE;
5433 }
5434 #endif// TO SUPPORT BT-AMP
5435 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5436
5437 }
5438 else
5439 {
5440 tANI_U16 assocId;
5441 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5442
5443 assocId = pDeltsReq->aid;
5444 if (assocId != 0)
5445 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5446 else
5447 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5448
5449 if (pSta != NULL)
5450 // TBD: check sta assoc state as well
5451 for (i =0; i < sizeof(tSirMacAddr); i++)
5452 macaddr[i] = pSta->staAddr[i];
5453 }
5454
5455 if (pSta == NULL)
5456 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005457 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005458 return eSIR_FAILURE;
5459 }
5460
5461 if ((! pSta->valid) ||
5462 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5463 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005464 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005465 return eSIR_FAILURE;
5466 }
5467
5468 pDeltsReq->req.wsmTspecPresent = 0;
5469 pDeltsReq->req.wmeTspecPresent = 0;
5470 pDeltsReq->req.lleTspecPresent = 0;
5471
5472 if ((pSta->wsmEnabled) &&
5473 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5474 pDeltsReq->req.wsmTspecPresent = 1;
5475 else if (pSta->wmeEnabled)
5476 pDeltsReq->req.wmeTspecPresent = 1;
5477 else if (pSta->lleEnabled)
5478 pDeltsReq->req.lleTspecPresent = 1;
5479 else
5480 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005481 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 return eSIR_FAILURE;
5483 }
5484
5485 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5486 : &pDeltsReq->req.tsinfo;
5487 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005488 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005489 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5490 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5491
5492 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005493
5494 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5495 != eSIR_SUCCESS)
5496 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005497 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5499 return eSIR_FAILURE;
5500 }
5501 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5502 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5503 {
5504 //edca only now.
5505 }
5506 else
5507 {
5508 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5509 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5510 {
5511 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305512 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5513 pSta->staIndex,
5514 tspecIdx,
5515 pDeltsReq->req,
5516 psessionEntry->peSessionId,
5517 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005519 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 tsinfo->traffic.userPrio);
5521 return eSIR_FAILURE;
5522 }
5523 }
5524 }
5525 return eSIR_SUCCESS;
5526}
5527
5528/** -------------------------------------------------------------
5529\fn limRegisterHalIndCallBack
5530\brief registers callback function to HAL for any indication.
5531\param tpAniSirGlobal pMac
5532\return none.
5533 -------------------------------------------------------------*/
5534void
5535limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5536{
5537 tSirMsgQ msg;
5538 tpHalIndCB pHalCB;
5539
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305540 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5541 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005542 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305543 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005544 return;
5545 }
5546
5547 pHalCB->pHalIndCB = limProcessHalIndMessages;
5548
5549 msg.type = WDA_REGISTER_PE_CALLBACK;
5550 msg.bodyptr = pHalCB;
5551 msg.bodyval = 0;
5552
Jeff Johnsone7245742012-09-05 17:12:55 -07005553 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005554 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5555 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305556 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005557 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 }
5559
5560 return;
5561}
5562
5563
5564/** -------------------------------------------------------------
5565\fn limProcessAddBaInd
5566
5567\brief handles the BA activity check timeout indication coming from HAL.
5568 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5569\param tpAniSirGlobal pMac
5570\param tSirMsgQ limMsg
5571\return None
5572-------------------------------------------------------------*/
5573void
5574limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5575{
5576 tANI_U8 i;
5577 tANI_U8 tid;
5578 tANI_U16 assocId;
5579 tpDphHashNode pSta;
5580 tpAddBaCandidate pBaCandidate;
5581 tANI_U32 baCandidateCnt;
5582 tpBaActivityInd pBaActivityInd;
5583 tpPESession psessionEntry;
5584 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005585#ifdef FEATURE_WLAN_TDLS
5586 boolean htCapable = FALSE;
5587#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005588
5589
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005590 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005591 return;
5592
5593 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5594 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5595
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005596 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005597 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005598 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305599 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005600 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005601 return;
5602 }
5603
5604 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005605#ifdef FEATURE_WLAN_TDLS
5606 if ((baCandidateCnt > pMac->lim.maxStation))
5607#else
5608 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5609#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005610 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305611 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005612 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005613 return;
5614 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005615
5616#ifdef FEATURE_WLAN_TDLS
5617 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5618 //AP capability
5619 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5620
5621 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5622 {
5623 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5624 if ((NULL == pSta) || (!pSta->valid))
5625 continue;
5626
5627 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5628 htCapable = pSta->mlmStaContext.htCapability;
5629 else
5630 htCapable = psessionEntry->htCapability;
5631
5632 if (htCapable)
5633 break;
5634 }
5635 if (!htCapable)
5636 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305637 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005638 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005639 return;
5640 }
5641#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005642
5643 //delete the complete dialoguetoken linked list
5644 limDeleteDialogueTokenList(pMac);
5645 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5646
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005647 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005648 {
5649 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005650 if ((NULL == pSta) || (!pSta->valid))
5651 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005652
5653 for (tid=0; tid<STACFG_MAX_TC; tid++)
5654 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005655 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 (pBaCandidate->baInfo[tid].fBaEnable))
5657 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005658 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5659 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5661 }
5662 }
5663 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305664 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005665 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005666 return;
5667}
5668
5669
5670/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005671\fn limDeleteBASessions
5672\brief Deletes all the exisitng BA sessions for given session
5673 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005674\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005675\param tpPESession pSessionEntry
5676\param tANI_U32 baDirection
5677\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005678-------------------------------------------------------------*/
5679
5680void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005681limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305682 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005683{
5684 tANI_U32 i;
5685 tANI_U8 tid;
5686 tpDphHashNode pSta;
5687
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005688 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005689 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005690 limLog(pMac, LOGE, FL("Session does not exist"));
5691 }
5692 else
5693 {
5694 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005695 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005696 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5697 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5698 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5699 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005700 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005701 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005702 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005703 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5704 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005705 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005706 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5707 (baDirection & BA_INITIATOR))
5708 {
5709 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305710 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005711 pSessionEntry);
5712 }
5713 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5714 (baDirection & BA_RECIPIENT))
5715 {
5716 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305717 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005718 pSessionEntry);
5719 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005721 }
5722 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005723 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5724 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5725 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005726 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005727 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5728 &pSessionEntry->dph.dphHashTable);
5729 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005730 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005731 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5732 (baDirection & BA_INITIATOR))
5733 {
5734 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305735 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005736 pSessionEntry);
5737 }
5738 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5739 (baDirection & BA_RECIPIENT))
5740 {
5741 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305742 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743 pSessionEntry);
5744 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005745 }
5746 }
5747 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005748 }
5749}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005750
5751/** -------------------------------------------------------------
5752\fn limDelAllBASessions
5753\brief Deletes all the exisitng BA sessions.
5754\param tpAniSirGlobal pMac
5755\return None
5756-------------------------------------------------------------*/
5757
5758void limDelAllBASessions(tpAniSirGlobal pMac)
5759{
5760 tANI_U32 i;
5761 tpPESession pSessionEntry;
5762
5763 for (i = 0; i < pMac->lim.maxBssId; i++)
5764 {
5765 pSessionEntry = peFindSessionBySessionId(pMac, i);
5766 if (pSessionEntry)
5767 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305768 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5769 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005770 }
5771 }
5772}
5773
5774/** -------------------------------------------------------------
5775\fn limDelAllBASessionsBtc
5776\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5777 band.
5778\param tpAniSirGlobal pMac
5779\return None
5780-------------------------------------------------------------*/
5781
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005782void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005783{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005784 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005785 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005786 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5787 &sessionId);
5788 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005789 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005790 PELOGW(limLog(pMac, LOGW,
5791 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305792 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305793 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005794 }
5795}
5796
Jeff Johnson295189b2012-06-20 16:38:30 -07005797/** -------------------------------------------------------------
5798\fn limProcessDelTsInd
5799\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5800 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5801\param tpAniSirGlobal pMac
5802\param tSirMsgQ limMsg
5803\return None
5804-------------------------------------------------------------*/
5805void
5806limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5807{
5808 tpDphHashNode pSta;
5809 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5810 tpSirDeltsReq pDelTsReq = NULL;
5811 tSirMacAddr peerMacAddr;
5812 tpSirDeltsReqInfo pDelTsReqInfo;
5813 tpLimTspecInfo pTspecInfo;
5814 tpPESession psessionEntry;
5815 tANI_U8 sessionId;
5816
5817if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5818 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005819 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305820 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005821 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005822 return;
5823 }
5824
5825 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5826 if(pTspecInfo->inuse == false)
5827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005828 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005829 goto error1;
5830 }
5831
5832 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5833 if(pSta == NULL)
5834 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005835 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 pTspecInfo->assocId);
5837 goto error1;
5838 }
5839
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305840 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5841 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005842 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305843 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005844 goto error1;
5845 }
5846
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305847 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005848
5849 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305850 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305852 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005853
5854
5855 //validate the req
5856 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5857 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005858 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005859 goto error2;
5860 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005861 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5862 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5863 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005864
5865 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5866 psessionEntry);
5867
5868 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305869 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5870 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005871 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305872 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005873 goto error3;
5874 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305875 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005876
5877 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305878 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305880 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005881
5882 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5883
5884error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305885 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005886error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305887 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005888error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005890 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005891 return;
5892}
5893
5894/**
5895 * \brief Setup an A-MPDU/BA session
5896 *
5897 * \sa limPostMlmAddBAReq
5898 *
5899 * \param pMac The global tpAniSirGlobal object
5900 *
5901 * \param pStaDs DPH Hash Node object of peer STA
5902 *
5903 * \param tid TID for which a BA is being setup.
5904 * If this is set to 0xFFFF, then we retrieve
5905 * the default TID from the CFG
5906 *
5907 * \return eSIR_SUCCESS if setup completes successfully
5908 * eSIR_FAILURE is some problem is encountered
5909 */
5910tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5911 tpDphHashNode pStaDs,
5912 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5913{
5914 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005915 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005916 tpDialogueToken dialogueTokenNode;
5917 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005918
Jeff Johnson295189b2012-06-20 16:38:30 -07005919 // Check if the peer is a 11n capable STA
5920 // FIXME - Need a 11n peer indication in DPH.
5921 // For now, using the taurusPeer attribute
5922 //if( 0 == pStaDs->taurusPeer == )
5923 //return eSIR_SUCCESS;
5924
5925 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305926 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5927 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005928 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305929 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 status = eSIR_MEM_ALLOC_FAILED;
5931 goto returnFailure;
5932 }
5933
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305934 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005935
5936 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305937 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 pMlmAddBAReq->peerMacAddr,
5939 pStaDs->staAddr,
5940 sizeof( tSirMacAddr ));
5941
5942 // Update the TID
5943 pMlmAddBAReq->baTID = tid;
5944
5945 // Determine the supported BA policy of local STA
5946 // for the TID of interest
5947 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5948
5949 // BA Buffer Size
5950 // Requesting the ADDBA recipient to populate the size.
5951 // If ADDBA is accepted, a non-zero buffer size should
5952 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305953 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5954 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5955 {
5956 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5957 causing very low throughput in HT40 case */
5958 limLog( pMac, LOGW,
5959 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5960 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5961 }
5962 else
5963 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005964
5965 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005966 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005967 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5968 pStaDs->staIndex,
5969 tid );
5970
5971 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005972 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005974 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005975 status = eSIR_FAILURE;
5976 goto returnFailure;
5977 }
5978 pMlmAddBAReq->baTimeout = val; // In TU's
5979
5980 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005981 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5983 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5984
5985 // BA Starting Sequence Number
5986 pMlmAddBAReq->baSSN = startingSeqNum;
5987
5988 /* Update PE session Id*/
5989 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5990
5991 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5992
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005993 dialogueTokenNode = limAssignDialogueToken(pMac);
5994 if (NULL == dialogueTokenNode)
5995 {
5996 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5997 status = eSIR_FAILURE;
5998 goto returnFailure;
5999 }
6000
Jeff Johnson295189b2012-06-20 16:38:30 -07006001 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006002 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006003 dialogueTokenNode->assocId = pStaDs->assocId;
6004 dialogueTokenNode->tid = tid;
6005 // Send ADDBA Req to MLME
6006 limPostMlmMessage( pMac,
6007 LIM_MLM_ADDBA_REQ,
6008 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006009 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006010
6011returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306012 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006013 return status;
6014}
6015
6016/**
6017 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6018 * will then send an ADDBA Rsp to peer MAC entity
6019 * with the appropriate ADDBA status code
6020 *
6021 * \sa limPostMlmAddBARsp
6022 *
6023 * \param pMac The global tpAniSirGlobal object
6024 *
6025 * \param peerMacAddr MAC address of peer entity that will
6026 * be the recipient of this ADDBA Rsp
6027 *
6028 * \param baStatusCode ADDBA Rsp status code
6029 *
6030 * \param baDialogToken ADDBA Rsp dialog token
6031 *
6032 * \param baTID TID of interest
6033 *
6034 * \param baPolicy The BA policy
6035 *
6036 * \param baBufferSize The BA buffer size
6037 *
6038 * \param baTimeout BA timeout in TU's
6039 *
6040 * \return eSIR_SUCCESS if setup completes successfully
6041 * eSIR_FAILURE is some problem is encountered
6042 */
6043tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6044 tSirMacAddr peerMacAddr,
6045 tSirMacStatusCodes baStatusCode,
6046 tANI_U8 baDialogToken,
6047 tANI_U8 baTID,
6048 tANI_U8 baPolicy,
6049 tANI_U16 baBufferSize,
6050 tANI_U16 baTimeout,
6051 tpPESession psessionEntry)
6052{
6053tSirRetStatus status = eSIR_SUCCESS;
6054tpLimMlmAddBARsp pMlmAddBARsp;
6055
6056 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306057 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6058 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006059 {
6060 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306061 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006062 status );
6063
6064 status = eSIR_MEM_ALLOC_FAILED;
6065 goto returnFailure;
6066 }
6067
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306068 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006069
6070 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306071 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006072 pMlmAddBARsp->peerMacAddr,
6073 peerMacAddr,
6074 sizeof( tSirMacAddr ));
6075
6076 pMlmAddBARsp->baDialogToken = baDialogToken;
6077 pMlmAddBARsp->addBAResultCode = baStatusCode;
6078 pMlmAddBARsp->baTID = baTID;
6079 pMlmAddBARsp->baPolicy = baPolicy;
6080 pMlmAddBARsp->baBufferSize = baBufferSize;
6081 pMlmAddBARsp->baTimeout = baTimeout;
6082
6083 /* UPdate PE session ID*/
6084 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6085
6086 // Send ADDBA Rsp to MLME
6087 limPostMlmMessage( pMac,
6088 LIM_MLM_ADDBA_RSP,
6089 (tANI_U32 *) pMlmAddBARsp );
6090
6091returnFailure:
6092
6093 return status;
6094}
6095
6096/**
6097 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6098 * will then send an DELBA Ind to peer MAC entity
6099 * with the appropriate DELBA status code
6100 *
6101 * \sa limPostMlmDelBAReq
6102 *
6103 * \param pMac The global tpAniSirGlobal object
6104 *
6105 * \param pSta DPH Hash Node object of peer MAC entity
6106 * for which the BA session is being deleted
6107 *
6108 * \param baDirection DELBA direction
6109 *
6110 * \param baTID TID for which the BA session is being deleted
6111 *
6112 * \param baReasonCode DELBA Req reason code
6113 *
6114 * \return eSIR_SUCCESS if setup completes successfully
6115 * eSIR_FAILURE is some problem is encountered
6116 */
6117tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6118 tpDphHashNode pSta,
6119 tANI_U8 baDirection,
6120 tANI_U8 baTID,
6121 tSirMacReasonCodes baReasonCode,
6122 tpPESession psessionEntry)
6123{
6124tSirRetStatus status = eSIR_SUCCESS;
6125tpLimMlmDelBAReq pMlmDelBAReq;
6126tLimBAState curBaState;
6127
6128if(NULL == pSta)
6129 return eSIR_FAILURE;
6130
6131LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6132
6133 // Need to validate the current BA State.
6134 if( eLIM_BA_STATE_IDLE != curBaState)
6135 {
6136 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006137 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006138 baTID,
6139 curBaState);
6140
6141 status = eSIR_FAILURE;
6142 goto returnFailure;
6143 }
6144
6145 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306146 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6147 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006148 {
6149 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306150 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006151 status );
6152
6153 status = eSIR_MEM_ALLOC_FAILED;
6154 goto returnFailure;
6155 }
6156
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306157 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006158
6159 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306160 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006161 pMlmDelBAReq->peerMacAddr,
6162 pSta->staAddr,
6163 sizeof( tSirMacAddr ));
6164
6165 pMlmDelBAReq->baDirection = baDirection;
6166 pMlmDelBAReq->baTID = baTID;
6167 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6168
6169 /* Update PE session ID*/
6170 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6171
6172 //we don't have valid BA session for the given direction.
6173 // HDD wants to get the BA session deleted on PEER in this case.
6174 // in this case we just need to send DelBA to the peer.
6175 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6176 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6177 {
6178 // Send DELBA Ind over the air
6179 if( eSIR_SUCCESS !=
6180 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6181 status = eSIR_FAILURE;
6182
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306183 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006184 return status;
6185 }
6186
6187
6188 // Update the BA state in STA
6189 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6190
6191 // Send DELBA Req to MLME
6192 limPostMlmMessage( pMac,
6193 LIM_MLM_DELBA_REQ,
6194 (tANI_U32 *) pMlmDelBAReq );
6195
6196returnFailure:
6197
6198 return status;
6199}
6200
6201/**
6202 * \brief Send WDA_ADDBA_REQ to HAL, in order
6203 * to setup a new BA session with a peer
6204 *
6205 * \sa limPostMsgAddBAReq
6206 *
6207 * \param pMac The global tpAniSirGlobal object
6208 *
6209 * \param pSta Runtime, STA-related configuration cached
6210 * in the HashNode object
6211 *
6212 * \param baDialogToken The Action Frame dialog token
6213 *
6214 * \param baTID TID for which the BA session is being setup
6215 *
6216 * \param baPolicy BA Policy
6217 *
6218 * \param baBufferSize The requested BA buffer size
6219 *
6220 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6221 *
6222 * \param baSSN Starting Sequence Number for this BA session
6223 *
6224 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6225 *
6226 * \return none
6227 *
6228 */
6229tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6230 tpDphHashNode pSta,
6231 tANI_U8 baDialogToken,
6232 tANI_U8 baTID,
6233 tANI_U8 baPolicy,
6234 tANI_U16 baBufferSize,
6235 tANI_U16 baTimeout,
6236 tANI_U16 baSSN,
6237 tANI_U8 baDirection,
6238 tpPESession psessionEntry)
6239{
6240tpAddBAParams pAddBAParams = NULL;
6241tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006242tSirMsgQ msgQ;
6243
6244#ifdef WLAN_SOFTAP_VSTA_FEATURE
6245 // we can only do BA on "hard" STAs
6246 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6247 {
6248 retCode = eHAL_STATUS_FAILURE;
6249 goto returnFailure;
6250 }
6251#endif //WLAN_SOFTAP_VSTA_FEATURE
6252
6253 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306254 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6255 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006256 {
6257 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306258 FL("AllocateMemory failed")
6259 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006260
6261 retCode = eSIR_MEM_ALLOC_FAILED;
6262 goto returnFailure;
6263 }
6264
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306265 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006266
6267 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306268 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006269 (void *) pAddBAParams->peerMacAddr,
6270 (void *) pSta->staAddr,
6271 sizeof( tSirMacAddr ));
6272
6273 // Populate the REQ parameters
6274 pAddBAParams->staIdx = pSta->staIndex;
6275 pAddBAParams->baDialogToken = baDialogToken;
6276 pAddBAParams->baTID = baTID;
6277 pAddBAParams->baPolicy = baPolicy;
6278 pAddBAParams->baBufferSize = baBufferSize;
6279 pAddBAParams->baTimeout = baTimeout;
6280 pAddBAParams->baSSN = baSSN;
6281 pAddBAParams->baDirection = baDirection;
6282 pAddBAParams->respReqd = 1;
6283
6284 /* UPdate PE session ID */
6285 pAddBAParams->sessionId = psessionEntry->peSessionId;
6286
6287 // Post WDA_ADDBA_REQ to HAL.
6288 msgQ.type = WDA_ADDBA_REQ;
6289 //
6290 // FIXME_AMPDU
6291 // A global counter (dialog token) is required to keep track of
6292 // all PE <-> HAL communication(s)
6293 //
6294 msgQ.reserved = 0;
6295 msgQ.bodyptr = pAddBAParams;
6296 msgQ.bodyval = 0;
6297
6298 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306299 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6300 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6301 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6302 pAddBAParams->baTimeout, pAddBAParams->baTID,
6303 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6304 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006305
6306 //defer any other message until we get response back.
6307 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6308
Jeff Johnsone7245742012-09-05 17:12:55 -07006309 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006310#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6311 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6312#endif //FEATURE_WLAN_DIAG_SUPPORT
6313
6314 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6315 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006316 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006317 retCode );
6318 else
6319 return retCode;
6320
6321returnFailure:
6322
6323 // Clean-up...
6324 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306325 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006326
6327 return retCode;
6328
6329}
6330
6331/**
6332 * \brief Send WDA_DELBA_IND to HAL, in order
6333 * to delete an existing BA session with peer
6334 *
6335 * \sa limPostMsgDelBAInd
6336 *
6337 * \param pMac The global tpAniSirGlobal object
6338 *
6339 * \param pSta Runtime, STA-related configuration cached
6340 * in the HashNode object
6341 *
6342 * \param baTID TID for which the BA session is being setup
6343 *
6344 * \param baDirection Identifies whether the DELBA Ind was
6345 * sent by the BA initiator or recipient
6346 *
6347 * \return none
6348 *
6349 */
6350tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6351 tpDphHashNode pSta,
6352 tANI_U8 baTID,
6353 tANI_U8 baDirection,
6354 tpPESession psessionEntry)
6355{
6356tpDelBAParams pDelBAParams = NULL;
6357tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006358tSirMsgQ msgQ;
6359
6360 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306361 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6362 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006363 {
6364 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306365 FL("AllocateMemory failed")
6366 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006367
6368 retCode = eSIR_MEM_ALLOC_FAILED;
6369 goto returnFailure;
6370 }
6371
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306372 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006373
6374 // Populate the REQ parameters
6375 pDelBAParams->staIdx = pSta->staIndex;
6376 pDelBAParams->baTID = baTID;
6377 pDelBAParams->baDirection = baDirection;
6378
6379 /* Update PE session ID */
6380
6381
6382 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6383 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6384
6385 // Post WDA_DELBA_IND to HAL.
6386 msgQ.type = WDA_DELBA_IND;
6387 //
6388 // FIXME:
6389 // A global counter (dialog token) is required to keep track of
6390 // all PE <-> HAL communication(s)
6391 //
6392 msgQ.reserved = 0;
6393 msgQ.bodyptr = pDelBAParams;
6394 msgQ.bodyval = 0;
6395
6396 limLog( pMac, LOGW,
6397 FL( "Sending SIR_HAL_DELBA_IND..." ));
6398
Jeff Johnsone7245742012-09-05 17:12:55 -07006399 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006400#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6401 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6402#endif //FEATURE_WLAN_DIAG_SUPPORT
6403
6404 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6405 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006406 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006407 retCode );
6408 else
6409 {
6410 // Update LIM's internal cache...
6411 if( eBA_INITIATOR == baDirection)
6412 {
6413 pSta->tcCfg[baTID].fUseBATx = 0;
6414 pSta->tcCfg[baTID].txBufSize = 0;
6415 }
6416 else
6417 {
6418 pSta->tcCfg[baTID].fUseBARx = 0;
6419 pSta->tcCfg[baTID].rxBufSize = 0;
6420 }
6421
6422 return retCode;
6423 }
6424
6425returnFailure:
6426
6427 // Clean-up...
6428 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306429 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006430
6431 return retCode;
6432
6433}
6434
6435/**
6436 * @function : limPostSMStateUpdate()
6437 *
6438 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6439 *
6440 * LOGIC:
6441 *
6442 * ASSUMPTIONS:
6443 * NA
6444 *
6445 * NOTE:
6446 * NA
6447 *
6448 * @param pMac - Pointer to Global MAC structure
6449 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6450 * @return None
6451 */
6452tSirRetStatus
6453limPostSMStateUpdate(tpAniSirGlobal pMac,
6454 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6455{
6456 tSirRetStatus retCode = eSIR_SUCCESS;
6457 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006458 tpSetMIMOPS pMIMO_PSParams;
6459
6460 msgQ.reserved = 0;
6461 msgQ.type = WDA_SET_MIMOPS_REQ;
6462
6463 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306464 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6465 if ( NULL == pMIMO_PSParams )
6466 {
6467 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006468 return eSIR_MEM_ALLOC_FAILED;
6469 }
6470
6471 pMIMO_PSParams->htMIMOPSState = state;
6472 pMIMO_PSParams->staIdx = staIdx;
6473 pMIMO_PSParams->fsendRsp = true;
6474 msgQ.bodyptr = pMIMO_PSParams;
6475 msgQ.bodyval = 0;
6476
6477 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6478
Jeff Johnsone7245742012-09-05 17:12:55 -07006479 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006480 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6481 if (eSIR_SUCCESS != retCode)
6482 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006483 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306484 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006485 return retCode;
6486 }
6487
6488 return retCode;
6489}
6490
6491void limPktFree (
6492 tpAniSirGlobal pMac,
6493 eFrameType frmType,
6494 tANI_U8 *pRxPacketInfo,
6495 void *pBody)
6496{
6497 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006498}
6499
6500/**
6501 * limGetBDfromRxPacket()
6502 *
6503 *FUNCTION:
6504 * This function is called to get pointer to Polaris
6505 * Buffer Descriptor containing MAC header & other control
6506 * info from the body of the message posted to LIM.
6507 *
6508 *LOGIC:
6509 * NA
6510 *
6511 *ASSUMPTIONS:
6512 * NA
6513 *
6514 *NOTE:
6515 * NA
6516 *
6517 * @param body - Received message body
6518 * @param pRxPacketInfo - Pointer to received BD
6519 * @return None
6520 */
6521
6522void
6523limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6524{
Jeff Johnson295189b2012-06-20 16:38:30 -07006525 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006526} /*** end limGetBDfromRxPacket() ***/
6527
6528
6529
6530
6531
6532void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6533{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306534 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006535}
6536
6537
6538void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6539{
6540 tANI_U8 i;
6541 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6542
6543 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6544 {
6545 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6546 {
6547 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6548 fFound = eANI_BOOLEAN_TRUE;
6549 break;
6550 }
6551 }
6552 if(eANI_BOOLEAN_FALSE == fFound)
6553 {
6554 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6555 {
6556 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6557 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6558 }
6559 else
6560 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006561 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006562 }
6563 }
6564}
6565
6566
6567/**
6568 * @function : limIsChannelValidForChannelSwitch()
6569 *
6570 * @brief : This function checks if the channel to which AP
6571 * is expecting us to switch, is a valid channel for us.
6572 * LOGIC:
6573 *
6574 * ASSUMPTIONS:
6575 * NA
6576 *
6577 * NOTE:
6578 * NA
6579 *
6580 * @param pMac - Pointer to Global MAC structure
6581 * @param channel - New channel to which we are expected to move
6582 * @return None
6583 */
6584tAniBool
6585limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6586{
6587 tANI_U8 index;
6588 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6589 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6590
6591 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6592 (tANI_U8 *)validChannelList,
6593 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6594 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006595 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006596 return (eSIR_FALSE);
6597 }
6598
6599 for(index = 0; index < validChannelListLen; index++)
6600 {
6601 if(validChannelList[index] == channel)
6602 return (eSIR_TRUE);
6603 }
6604
6605 /* channel does not belong to list of valid channels */
6606 return (eSIR_FALSE);
6607}
6608
6609/**------------------------------------------------------
6610\fn __limFillTxControlParams
6611\brief Fill the message for stopping/resuming tx.
6612
6613\param pMac
6614\param pTxCtrlMsg - Pointer to tx control message.
6615\param type - Which way we want to stop/ resume tx.
6616\param mode - To stop/resume.
6617 -------------------------------------------------------*/
6618static eHalStatus
6619__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6620 tLimQuietTxMode type, tLimControlTx mode)
6621{
6622
6623 //TBD-RAJESH HOW TO GET sessionEntry?????
6624 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6625
6626 if (mode == eLIM_STOP_TX)
6627 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6628 else
6629 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6630
6631 switch (type)
6632 {
6633 case eLIM_TX_ALL:
6634 /** Stops/resumes transmission completely */
6635 pTxCtrlMsg->fCtrlGlobal = 1;
6636 break;
6637
6638 case eLIM_TX_BSS_BUT_BEACON:
6639 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6640 * stop beacon transmission.
6641 */
6642 pTxCtrlMsg->ctrlBss = 1;
6643 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6644 break;
6645
6646 case eLIM_TX_STA:
6647 /** Memory for station bitmap is allocated dynamically in caller of this
6648 * so decode properly here and fill the bitmap. Now not implemented,
6649 * fall through.
6650 */
6651 case eLIM_TX_BSS:
6652 //Fall thru...
6653 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006654 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 return eHAL_STATUS_FAILURE;
6656 }
6657
6658 return eHAL_STATUS_SUCCESS;
6659}
6660
6661/**
6662 * @function : limFrameTransmissionControl()
6663 *
6664 * @brief : This API is called by the user to halt/resume any frame
6665 * transmission from the device. If stopped, all frames will be
6666 * queued starting from hardware. Then back-pressure
6667 * is built till the driver.
6668 * LOGIC:
6669 *
6670 * ASSUMPTIONS:
6671 * NA
6672 *
6673 * NOTE:
6674 * NA
6675 *
6676 * @param pMac - Pointer to Global MAC structure
6677 * @return None
6678 */
6679void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6680{
6681
6682 eHalStatus status = eHAL_STATUS_FAILURE;
6683 tpTxControlParams pTxCtrlMsg;
6684 tSirMsgQ msgQ;
6685 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6686
6687 /** Allocate only required number of bytes for station bitmap
6688 * Make it to align to 4 byte boundary */
6689 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6690
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306691 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6692 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006693 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306694 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006695 return;
6696 }
6697
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306698 vos_mem_set((void *) pTxCtrlMsg,
6699 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006700 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6701 if (status != eHAL_STATUS_SUCCESS)
6702 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306703 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006704 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 return;
6706 }
6707
6708 msgQ.bodyptr = (void *) pTxCtrlMsg;
6709 msgQ.bodyval = 0;
6710 msgQ.reserved = 0;
6711 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6712
Jeff Johnsone7245742012-09-05 17:12:55 -07006713 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006714 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6715 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306716 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006717 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006718 return;
6719 }
6720
6721 if (mode == eLIM_STOP_TX)
6722 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006723 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006724 }
6725 else
6726 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006727 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006728 }
6729 return;
6730}
6731
6732
6733/**
6734 * @function : limRestorePreChannelSwitchState()
6735 *
6736 * @brief : This API is called by the user to undo any
6737 * specific changes done on the device during
6738 * channel switch.
6739 * LOGIC:
6740 *
6741 * ASSUMPTIONS:
6742 * NA
6743 *
6744 * NOTE:
6745 * NA
6746 *
6747 * @param pMac - Pointer to Global MAC structure
6748 * @return None
6749 */
6750
6751tSirRetStatus
6752limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6753{
6754
6755 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 tANI_U32 val = 0;
6757
6758 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6759 return retCode;
6760
6761 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006762 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006763
6764 /* Restore the frame transmission, all the time. */
6765 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6766
6767 /* Free to enter BMPS */
6768 limSendSmePostChannelSwitchInd(pMac);
6769
6770 //Background scan is now enabled by SME
6771 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6772 {
6773 /* Enable background scan if already enabled, else don't bother */
6774 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6775 &val)) != eSIR_SUCCESS)
6776
6777 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006778 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006779 return (retCode);
6780 }
6781
6782 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6783 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006784 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6785 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6787 {
6788 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6789 return (eSIR_FAILURE);
6790 }
6791
6792 }
6793 }
6794
6795 /* Enable heartbeat timer */
6796 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6797 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006798 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6799 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6800 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6801 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006802 {
6803 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6804 return (eSIR_FAILURE);
6805 }
6806 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006807 return (retCode);
6808}
6809
6810
6811/**--------------------------------------------
6812\fn limRestorePreQuietState
6813\brief Restore the pre quiet state
6814
6815\param pMac
6816\return NONE
6817---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006818tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006819{
6820
6821 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006822 tANI_U32 val = 0;
6823
6824 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6825 return retCode;
6826
6827 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006828 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006829
6830 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006831 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006832 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6833
6834
6835 //Background scan is now enabled by SME
6836 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6837 {
6838 /* Enable background scan if already enabled, else don't bother */
6839 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6840 &val)) != eSIR_SUCCESS)
6841
6842 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006843 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006844 return (retCode);
6845 }
6846
6847 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6848 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006849 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006850 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6851 {
6852 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6853 return (eSIR_FAILURE);
6854 }
6855
6856 }
6857 }
6858
6859 /* Enable heartbeat timer */
6860 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6861 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006862 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006863 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006864 {
6865 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6866 return (eSIR_FAILURE);
6867 }
6868 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006869 return (retCode);
6870}
6871
6872
6873/**
6874 * @function: limPrepareFor11hChannelSwitch()
6875 *
6876 * @brief : This API is called by the user to prepare for
6877 * 11h channel switch. As of now, the API does
6878 * very minimal work. User can add more into the
6879 * same API if needed.
6880 * LOGIC:
6881 *
6882 * ASSUMPTIONS:
6883 * NA
6884 *
6885 * NOTE:
6886 * NA
6887 *
6888 * @param pMac - Pointer to Global MAC structure
6889 * @param psessionEntry
6890 * @return None
6891 */
6892void
6893limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6894{
Jeff Johnson295189b2012-06-20 16:38:30 -07006895 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6896 return;
6897
6898 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006899 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006900
6901 /* Disable, Stop background scan if enabled and running */
6902 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6903
6904 /* Stop heart-beat timer to stop heartbeat disassociation */
6905 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6906
6907 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6908 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6909 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006910 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 /* Stop ongoing scanning if any */
6912 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6913 {
6914 //Set the resume channel to Any valid channel (invalid).
6915 //This will instruct HAL to set it to any previous valid channel.
6916 peSetResumeChannel(pMac, 0, 0);
6917 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6918 }
6919 else
6920 {
6921 limRestorePreChannelSwitchState(pMac, psessionEntry);
6922 }
6923 return;
6924 }
6925 else
6926 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006927 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006928 /** We are safe to switch channel at this point */
6929 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6930 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006931}
6932
6933
6934
6935/**----------------------------------------------------
6936\fn limGetNwType
6937
6938\brief Get type of the network from data packet or beacon
6939\param pMac
6940\param channelNum - Channel number
6941\param type - Type of packet.
6942\param pBeacon - Pointer to beacon or probe response
6943
6944\return Network type a/b/g.
6945-----------------------------------------------------*/
6946tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6947{
6948 tSirNwType nwType = eSIR_11B_NW_TYPE;
6949
6950 if (type == SIR_MAC_DATA_FRAME)
6951 {
6952 if ((channelNum > 0) && (channelNum < 15))
6953 {
6954 nwType = eSIR_11G_NW_TYPE;
6955 }
6956 else
6957 {
6958 nwType = eSIR_11A_NW_TYPE;
6959 }
6960 }
6961 else
6962 {
6963 if ((channelNum > 0) && (channelNum < 15))
6964 {
6965 int i;
6966 // 11b or 11g packet
6967 // 11g iff extended Rate IE is present or
6968 // if there is an A rate in suppRate IE
6969 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6970 {
6971 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6972 {
6973 nwType = eSIR_11G_NW_TYPE;
6974 break;
6975 }
6976 }
6977 if (pBeacon->extendedRatesPresent)
6978 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006979 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006980 nwType = eSIR_11G_NW_TYPE;
6981 }
6982 }
6983 else
6984 {
6985 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006986 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006987 nwType = eSIR_11A_NW_TYPE;
6988 }
6989 }
6990 return nwType;
6991}
6992
6993
6994/**---------------------------------------------------------
6995\fn limGetChannelFromBeacon
6996\brief To extract channel number from beacon
6997
6998\param pMac
6999\param pBeacon - Pointer to beacon or probe rsp
7000\return channel number
7001-----------------------------------------------------------*/
7002tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7003{
7004 tANI_U8 channelNum = 0;
7005
7006 if (pBeacon->dsParamsPresent)
7007 channelNum = pBeacon->channelNumber;
7008 else if(pBeacon->HTInfo.present)
7009 channelNum = pBeacon->HTInfo.primaryChannel;
7010 else
7011 channelNum = pBeacon->channelNumber;
7012
7013 return channelNum;
7014}
7015
7016
7017/** ---------------------------------------------------------
7018\fn limSetTspecUapsdMask
7019\brief This function sets the PE global variable:
7020\ 1) gUapsdPerAcTriggerEnableMask and
7021\ 2) gUapsdPerAcDeliveryEnableMask
7022\ based on the user priority field and direction field
7023\ in the TS Info Fields.
7024\
7025\ An AC is a trigger-enabled AC if the PSB subfield
7026\ is set to 1 in the uplink direction.
7027\ An AC is a delivery-enabled AC if the PSB subfield
7028\ is set to 1 in the down-link direction.
7029\
7030\param tpAniSirGlobal pMac
7031\param tSirMacTSInfo pTsInfo
7032\param tANI_U32 action
7033\return None
7034 ------------------------------------------------------------*/
7035void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7036{
7037 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7038 tANI_U16 direction = pTsInfo->traffic.direction;
7039 tANI_U8 ac = upToAc(userPrio);
7040
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007041 PELOG1(limLog(pMac, LOG1, FL(" Set UAPSD mask for AC %d, direction %d, action=%d (1=set,0=clear) "),ac, direction, action );)
Jeff Johnson295189b2012-06-20 16:38:30 -07007042
7043 /* Converting AC to appropriate Uapsd Bit Mask
7044 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7045 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7046 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7047 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7048 */
7049 ac = ((~ac) & 0x3);
7050
7051 if (action == CLEAR_UAPSD_MASK)
7052 {
7053 if (direction == SIR_MAC_DIRECTION_UPLINK)
7054 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7055 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7056 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7057 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7058 {
7059 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7060 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7061 }
7062 }
7063 else if (action == SET_UAPSD_MASK)
7064 {
7065 if (direction == SIR_MAC_DIRECTION_UPLINK)
7066 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7067 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7068 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7069 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7070 {
7071 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7072 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7073 }
7074 }
7075
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007076 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7077 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007078
7079 return;
7080}
7081
7082
7083
7084void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7085{
7086
7087 tANI_U8 i;
7088 for(i =0;i < pMac->lim.maxBssId;i++)
7089 {
7090 if(pMac->lim.gpSession[i].valid == TRUE )
7091 {
7092 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7093 {
7094 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7095 break;
7096 }
7097
7098 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7099 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7100 {
7101 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7102 }
7103 }
7104 }
7105 for(i=0; i< pMac->lim.maxBssId; i++)
7106 {
7107 if(pMac->lim.gpSession[i].valid == TRUE )
7108 {
7109 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7110 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7111 {
7112 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7113 {
7114 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007115 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007116 i);)
7117 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7118 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7119 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7120 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007121 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007122 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7123 }
7124 break;
7125 }
7126 }
7127 }
7128 }
7129}
7130
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007131void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7132{
7133 if(psessionEntry->valid == TRUE )
7134 {
7135 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7136 {
7137 limIbssHeartBeatHandle(pMac,psessionEntry);
7138 }
7139 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7140 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7141 {
7142 limHandleHeartBeatFailure(pMac,psessionEntry);
7143 }
7144 }
7145 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7146 and the other things again */
7147 if(psessionEntry->valid == TRUE )
7148 {
7149 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7150 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7151 {
7152 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7153 {
7154 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7155 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7156 psessionEntry->bssIdx);)
7157 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7158 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7159 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7160 {
7161 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7162 limReactivateHeartBeatTimer(pMac, psessionEntry);
7163 }
7164 }
7165 }
7166 }
7167}
7168
7169
Jeff Johnson295189b2012-06-20 16:38:30 -07007170tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7171{
7172 tANI_U8 i;
7173 for(i =0;i < pMac->lim.maxBssId;i++)
7174 {
7175 if(pMac->lim.gpSession[i].valid == TRUE )
7176 {
7177 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7178 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7179 {
7180 return pMac->lim.gpSession[i].currentOperChannel;
7181 }
7182 }
7183 }
7184 return 0;
7185}
7186
7187void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7188{
7189
7190 tpPESession psessionEntry;
7191// tANI_U8 sessionId;
7192 tpAddStaParams pAddStaParams;
7193
7194 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7195
7196 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7197 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007198 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307199 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007200 return;
7201 }
7202 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7203 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007204#ifdef FEATURE_WLAN_TDLS
7205 else if(pMac->lim.gLimAddStaTdls)
7206 {
7207 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7208 pMac->lim.gLimAddStaTdls = FALSE ;
7209 }
7210#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007211 else
7212 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7213
7214}
7215
7216
7217void limUpdateBeacon(tpAniSirGlobal pMac)
7218{
7219 tANI_U8 i;
7220
7221 for(i =0;i < pMac->lim.maxBssId;i++)
7222 {
7223 if(pMac->lim.gpSession[i].valid == TRUE )
7224 {
7225 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7226 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7227 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7228 )
7229 {
7230 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7231 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7232 }
7233 else
7234 {
7235 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7236 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7237 {
7238
7239 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7240 {
7241 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7242 }
7243 }
7244 }
7245 }
7246 }
7247}
7248
7249void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7250{
7251 tANI_U8 i;
7252 tpPESession psessionEntry;
7253 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7254 for(i =0; i < pMac->lim.maxBssId; i++)
7255 {
7256 if(pMac->lim.gpSession[i].valid == TRUE)
7257 {
7258 psessionEntry = &pMac->lim.gpSession[i];
7259 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7260 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007261 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007262 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007263#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7264 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7265#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007266 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7267 {
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307268 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) &&
7269 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7270 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007271 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007272 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007273 /* AP did not respond to Probe Request. Tear down link with it.*/
7274 limTearDownLinkWithAp(pMac,
7275 psessionEntry->peSessionId,
7276 eSIR_BEACON_MISSED);
7277 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7278 }
7279 else // restart heartbeat timer
7280 {
7281 limReactivateHeartBeatTimer(pMac, psessionEntry);
7282 }
7283 }
7284 else
7285 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007286 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007287 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7288 limReactivateHeartBeatTimer(pMac, psessionEntry);
7289 }
7290
7291 }
7292 }
7293 }
7294 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7295 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7296}
7297
7298
7299/*
7300* This function assumes there will not be more than one IBSS session active at any time.
7301*/
7302tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7303{
7304 tANI_U8 i;
7305
7306 for(i =0;i < pMac->lim.maxBssId;i++)
7307 {
7308 if( (pMac->lim.gpSession[i].valid) &&
7309 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7310 return (&pMac->lim.gpSession[i]);
7311 }
7312
7313 return NULL;
7314}
7315
7316tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7317{
7318 tANI_U8 i;
7319
7320 for(i =0;i < pMac->lim.maxBssId;i++)
7321 {
7322 if( (pMac->lim.gpSession[i].valid) &&
7323 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7324 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7325 return (&pMac->lim.gpSession[i]);
7326 }
7327
7328 return NULL;
7329}
7330
7331/**---------------------------------------------------------
7332\fn limHandleDeferMsgError
7333\brief handles error scenario, when the msg can not be deferred.
7334\param pMac
7335\param pLimMsg LIM msg, which could not be deferred.
7336\return void
7337-----------------------------------------------------------*/
7338
7339void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7340{
7341 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7342 {
7343 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7344 }
7345 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007346 {
7347 vos_mem_free( pLimMsg->bodyptr);
7348 pLimMsg->bodyptr = NULL;
7349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007350}
7351
7352
7353#ifdef FEATURE_WLAN_DIAG_SUPPORT
7354/**---------------------------------------------------------
7355\fn limDiagEventReport
7356\brief This function reports Diag event
7357\param pMac
7358\param eventType
7359\param bssid
7360\param status
7361\param reasonCode
7362\return void
7363-----------------------------------------------------------*/
7364void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7365{
7366 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7367 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7368
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307369 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007370
7371 if (NULL == pSessionEntry)
7372 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307373 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007374 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7375 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7376
7377 }
7378 else
7379 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307380 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7382 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7383 }
7384 peEvent.event_type = eventType;
7385 peEvent.status = status;
7386 peEvent.reason_code = reasonCode;
7387
7388 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7389 return;
7390}
7391
7392#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7393
7394void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7395{
7396
7397 tpAddStaSelfParams pAddStaSelfParams;
7398 tSirMsgQ mmhMsg;
7399 tpSirSmeAddStaSelfRsp pRsp;
7400
7401
7402 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7403
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307404 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7405 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007406 {
7407 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307408 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7409 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007410 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007411 return;
7412 }
7413
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307414 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007415
7416 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7417 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7418 pRsp->status = pAddStaSelfParams->status;
7419
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307420 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007421
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307422 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007423 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007424
7425 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7426 mmhMsg.bodyptr = pRsp;
7427 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007428 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007429 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7430
7431}
7432
7433void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7434{
7435
7436 tpDelStaSelfParams pDelStaSelfParams;
7437 tSirMsgQ mmhMsg;
7438 tpSirSmeDelStaSelfRsp pRsp;
7439
7440
7441 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7442
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307443 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7444 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007445 {
7446 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307447 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7448 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007449 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007450 return;
7451 }
7452
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307453 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007454
7455 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7456 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7457 pRsp->status = pDelStaSelfParams->status;
7458
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307459 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007460
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307461 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007462 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007463
7464 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7465 mmhMsg.bodyptr = pRsp;
7466 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007467 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7469
7470}
7471
7472/***************************************************************
7473* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7474* To unmap the channel to reverse the effect of mapping
7475* a band channel in hal .Mapping was done hal to overcome the
7476* limitation of the rxbd which use only 4 bit for channel number.
7477*****************************************************************/
7478tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7479{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007480#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007481 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007482 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7483 return aUnsortedChannelList[mapChannel -1];
7484 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007485#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007486 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007487#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007488 return abChannel[mapChannel -1];
7489 else
7490 return 0;
7491}
7492
7493
7494v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7495{
7496 int left = length;
7497 v_U8_t *ptr = pIes;
7498 v_U8_t elem_id;
7499 v_U16_t elem_len;
7500
7501 while(left >= (size_of_len_field+1))
7502 {
7503 elem_id = ptr[0];
7504 if (size_of_len_field == TWO_BYTE)
7505 {
7506 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7507 }
7508 else
7509 {
7510 elem_len = ptr[1];
7511 }
7512
7513
7514 left -= (size_of_len_field+1);
7515 if(elem_len > left)
7516 {
7517 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007518 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007519 eid,elem_len,left);
7520 return NULL;
7521 }
7522 if (elem_id == eid)
7523 {
7524 return ptr;
7525 }
7526
7527 left -= elem_len;
7528 ptr += (elem_len + (size_of_len_field+1));
7529 }
7530 return NULL;
7531}
7532
7533/* return NULL if oui is not found in ie
7534 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7535 */
7536v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7537{
7538 int left = ie_len;
7539 v_U8_t *ptr = ie;
7540 v_U8_t elem_id, elem_len;
7541
7542 while(left >= 2)
7543 {
7544 elem_id = ptr[0];
7545 elem_len = ptr[1];
7546 left -= 2;
7547 if(elem_len > left)
7548 {
7549 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007550 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007551 elem_id,elem_len,left);
7552 return NULL;
7553 }
7554 if (SIR_MAC_EID_VENDOR == elem_id)
7555 {
7556 if(memcmp(&ptr[2], oui, oui_size)==0)
7557 return ptr;
7558 }
7559
7560 left -= elem_len;
7561 ptr += (elem_len + 2);
7562 }
7563 return NULL;
7564}
7565
Jeff Johnson295189b2012-06-20 16:38:30 -07007566//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7567
7568v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7569{
7570 int length = 0;
7571 tANI_U8 *ptr = ie;
7572
7573 ptr[length++] = SIR_MAC_EID_VENDOR;
7574 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307575 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7576 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007577 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7578}
7579
7580//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7581
7582v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7583{
7584 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007585
7586 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7587 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7588 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307589 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007590 noaStream + noaLen - overFlowLen, overFlowLen);
7591 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7592 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307593 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007594 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307595 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7596 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007597 }
7598
Jeff Johnson295189b2012-06-20 16:38:30 -07007599 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7600
7601}
7602
7603//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7604v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7605{
7606 v_U8_t len=0;
7607
7608 v_U8_t *pBody = pNoaStream;
7609
7610
7611 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7612 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7613 {
7614 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7615 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7616 )
7617 return 0; //No NoA Descriptor then return 0
7618
7619
7620 pBody[0] = SIR_P2P_NOA_ATTR;
7621
7622 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7623 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7624 len = 5;
7625 pBody += len;
7626
7627
7628 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7629 {
7630 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7631 pBody += 1;
7632 len +=1;
7633
7634 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7635 pBody += sizeof(tANI_U32);
7636 len +=4;
7637
7638 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7639 pBody += sizeof(tANI_U32);
7640 len +=4;
7641
7642 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7643 pBody += sizeof(tANI_U32);
7644 len +=4;
7645
7646 }
7647
7648 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7649 {
7650 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7651 pBody += 1;
7652 len +=1;
7653
7654 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7655 pBody += sizeof(tANI_U32);
7656 len +=4;
7657
7658 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7659 pBody += sizeof(tANI_U32);
7660 len +=4;
7661
7662 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7663 pBody += sizeof(tANI_U32);
7664 len +=4;
7665
7666 }
7667
7668
7669 pBody = pNoaStream + 1;
7670 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7671
7672 return (len);
7673
7674 }
7675 return 0;
7676
7677}
Jeff Johnsone7245742012-09-05 17:12:55 -07007678
7679void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007680{
7681
7682 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007683 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007684}
Jeff Johnsone7245742012-09-05 17:12:55 -07007685
Jeff Johnson295189b2012-06-20 16:38:30 -07007686/*--------------------------------------------------------------------------
7687
7688 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7689
Jeff Johnsone7245742012-09-05 17:12:55 -07007690 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7691 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007692
7693 \param pMac - pointer to global adapter context
7694 \return - channel to scan from valid session else zero.
7695
7696 \sa
7697
7698 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007699void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007700{
7701
7702 //Rationale - this could be the suspend/resume for assoc and it is essential that
7703 //the new BSS is active for some time. Other BSS was anyway suspended.
7704 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7705 //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 -07007706 //and hence should be ok. Need to discuss this further
7707 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007708 {
7709 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007710 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007711 }
7712 else
7713 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007714 *resumeChannel = pMac->lim.gResumeChannel;
7715 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007716 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007717 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007718}
7719
Viral Modid86bde22012-12-10 13:09:21 -08007720tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7721{
7722 tANI_U8 i;
7723 for(i =0; i < pMac->lim.maxBssId; i++)
7724 {
7725 if(pMac->lim.gpSession[i].valid == TRUE)
7726 {
7727 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7728 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7729 )
7730 {
7731 return TRUE;
7732 }
7733 }
7734 }
7735 return FALSE;
7736}
Jeff Johnsone7245742012-09-05 17:12:55 -07007737
Jeff Johnson295189b2012-06-20 16:38:30 -07007738
7739tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7740{
7741 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7742 {
7743 return eANI_BOOLEAN_TRUE;
7744 }
7745 else
7746 {
7747 return eANI_BOOLEAN_FALSE;
7748 }
7749}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007750
Sandeep Puligilla60342762014-01-30 21:05:37 +05307751/**
7752 * \brief verify the changes in channel bonding
7753 *
7754 * \param pMac Pointer to the global MAC structure
7755 *
7756 * \param psessionEntry session entry
7757 * beaconSecChanWidth Secondary channel width
7758 * advertized in beacon
7759 * currentSecChanWidth Current configured width
7760 * staId Station Id
7761 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7762 */
7763tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7764 tpPESession psessionEntry,
7765 tANI_U8 beaconSecChanWidth,
7766 tANI_U8 currentSecChanWidth,
7767 tANI_U8 staId)
7768{
7769 tUpdateVHTOpMode tempParam;
7770 tANI_BOOLEAN fCbMode24G = FALSE;
7771 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7772
7773 /* Moving from HT40 to HT20 operation*/
7774 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7775 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7776 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7777 {
7778 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7779 tempParam.staId = staId;
7780 fCbMode24G = TRUE;
7781 }
7782
7783 /* Moving from HT20 to HT40 operation*/
7784 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7785 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7786 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7787 {
7788 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7789 tempParam.staId = staId;
7790 fCbMode24G = TRUE;
7791 }
7792
7793 if (TRUE == fCbMode24G)
7794 {
7795 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7796 "Changing CBMODE to = %d staId = %d",
7797 tempParam.opMode, tempParam.staId );
7798 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7799 status = eANI_BOOLEAN_TRUE;
7800 }
7801 return status;
7802}
7803
Mohit Khanna4a70d262012-09-11 16:30:12 -07007804#ifdef WLAN_FEATURE_11AC
7805tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7806{
7807 tUpdateVHTOpMode tempParam;
7808
7809 tempParam.opMode = chanWidth;
7810 tempParam.staId = staId;
7811
7812 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7813
7814 return eANI_BOOLEAN_TRUE;
7815}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007816#endif
7817
krunal soni45b9eb62014-03-26 12:54:25 -07007818void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7819 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007820{
7821 tANI_U8 val=0;
7822
krunal soni45b9eb62014-03-26 12:54:25 -07007823 //only 2.4G band should have short slot enable, rest it should be default
7824 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007825 {
krunal soni45b9eb62014-03-26 12:54:25 -07007826 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007827 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007828 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007829 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7830 {
7831 val = true;
7832 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007833 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007834 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007835 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007836 // Joining BSS.
7837 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007838 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007839 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007840 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007841 // Reassociating with AP.
7842 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007843 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007844 }
krunal soni45b9eb62014-03-26 12:54:25 -07007845 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007846 {
krunal soni45b9eb62014-03-26 12:54:25 -07007847 /*
7848 * 11B does not short slot and short slot is default
7849 * for 11A mode. Hence, not need to set this bit
7850 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007851 val = false;
7852 }
krunal soni45b9eb62014-03-26 12:54:25 -07007853
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007854 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007855 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007856}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307857
Kalikinkar dhara205da782014-03-21 15:49:32 -07007858void limUtilsframeshtons(tpAniSirGlobal pCtx,
7859 tANI_U8 *pOut,
7860 tANI_U16 pIn,
7861 tANI_U8 fMsb)
7862{
7863 (void)pCtx;
7864#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7865 if ( !fMsb )
7866 {
7867 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7868 }
7869 else
7870 {
7871 *pOut = ( pIn & 0xff00 ) >> 8;
7872 *( pOut + 1 ) = pIn & 0xff;
7873 }
7874#else
7875 if ( !fMsb )
7876 {
7877 *pOut = pIn & 0xff;
7878 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7879 }
7880 else
7881 {
7882 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7883 }
7884#endif
7885}
7886
7887void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7888 tANI_U8 *pOut,
7889 tANI_U32 pIn,
7890 tANI_U8 fMsb)
7891{
7892 (void)pCtx;
7893#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7894 if ( !fMsb )
7895 {
7896 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7897 }
7898 else
7899 {
7900 *pOut = ( pIn & 0xff000000 ) >> 24;
7901 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7902 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7903 *( pOut + 3 ) = ( pIn & 0x000000ff );
7904 }
7905#else
7906 if ( !fMsb )
7907 {
7908 *( pOut ) = ( pIn & 0x000000ff );
7909 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7910 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7911 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7912 }
7913 else
7914 {
7915 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7916 }
7917#endif
7918}
7919
7920
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307921/**--------------------------------------------
7922\fn limUpdateOBSSScanParams
7923\brief Updates OBSS SCAN IE parameters to session
7924
7925\param psessionEntry - Session Entry
7926\return NONE
7927---------------------------------------------*/
7928void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7929 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7930{
7931 /*If the recieved value is not in the range specified by the Specification
7932 then it will be the default value configured through cfg */
7933 if (( pOBSSScanParameters->obssScanActiveDwell >
7934 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7935 ( pOBSSScanParameters->obssScanActiveDwell <
7936 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7937 {
7938 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7939 pOBSSScanParameters->obssScanActiveDwell;
7940 }
7941 if((pOBSSScanParameters->obssScanPassiveDwell >
7942 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7943 (pOBSSScanParameters->obssScanPassiveDwell <
7944 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7945 {
7946 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7947 pOBSSScanParameters->obssScanPassiveDwell;
7948 }
7949 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7950 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7951 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7952 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7953 {
7954 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7955 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7956 }
7957 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7958 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7959 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7960 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7961 {
7962 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7963 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7964 }
7965 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7966 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7967 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7968 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7969 {
7970 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7971 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7972 }
7973 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7974 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7975 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7976 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7977 {
7978 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7979 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7980 }
7981 if((pOBSSScanParameters->obssScanActivityThreshold >
7982 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7983 (pOBSSScanParameters->obssScanActivityThreshold <
7984 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7985 {
7986 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7987 pOBSSScanParameters->obssScanActivityThreshold;
7988 }
7989}
Chet Lanctot8cecea22014-02-11 19:09:36 -08007990
7991#ifdef WLAN_FEATURE_11W
7992void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
7993{
7994 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
7995 tPmfSaQueryTimerId timerId;
7996 tpPESession psessionEntry;
7997 tpDphHashNode pSta;
7998 tANI_U32 maxRetries;
7999
8000 limLog(pMac, LOG1, FL("SA Query timer fires"));
8001 timerId.value = param;
8002
8003 // Check that SA Query is in progress
8004 if ((psessionEntry = peFindSessionBySessionId(
8005 pMac, timerId.fields.sessionId)) == NULL)
8006 {
8007 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8008 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008009 return;
8010 }
8011 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8012 &psessionEntry->dph.dphHashTable)) == NULL)
8013 {
8014 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8015 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008016 return;
8017 }
8018 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8019 return;
8020
8021 // Increment the retry count, check if reached maximum
8022 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8023 &maxRetries) != eSIR_SUCCESS)
8024 {
8025 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8026 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8027 return;
8028 }
8029 pSta->pmfSaQueryRetryCount++;
8030 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8031 {
8032 limLog(pMac, LOG1, FL("SA Query timed out"));
Chet Lanctot8cecea22014-02-11 19:09:36 -08008033 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8034 return;
8035 }
8036
8037 // Retry SA Query
8038 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8039 pSta->staAddr, psessionEntry);
8040 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008041 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8042 {
8043 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8044 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8045 }
8046}
8047#endif
8048
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008049/** ---------------------------------------------------------
8050\fn limProcessChannelSwitchSuspendLink
8051\brief This function call channel switch functions based on
8052 the gLimChannelSwitch.state. After function return it
8053 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8054 If gLimChannelSwitch.state is non-identified then
8055 print error log as well as restore back the
8056 pre-channelSwitch.
8057\param tpAniSirGlobal pMac
8058\param eHalStatus status
8059\param tANI_U32 *ctx
8060\return None
8061 ------------------------------------------------------------*/
8062static void
8063limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8064 eHalStatus status,
8065 tANI_U32 *ctx)
8066{
8067 tpPESession pSessionEntry = (tpPESession)ctx;
8068
8069 if ( eHAL_STATUS_SUCCESS != status )
8070 {
8071 limLog(pMac, LOGE,
8072 FL("Suspend link failed. still proceeding "));
8073 }
8074 if (NULL == pSessionEntry )
8075 {
8076 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8077 return;
8078 }
8079
8080 switch(pSessionEntry->gLimChannelSwitch.state)
8081 {
8082 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8083 PELOGW(limLog(pMac, LOGW,
8084 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8085 limSwitchPrimaryChannel(pMac,
8086 pSessionEntry->gLimChannelSwitch.primaryChannel,
8087 pSessionEntry);
8088 pSessionEntry->gLimChannelSwitch.state =
8089 eLIM_CHANNEL_SWITCH_IDLE;
8090 break;
8091
8092 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8093 PELOGW(limLog(pMac, LOGW,
8094 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8095 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8096 pSessionEntry->gLimChannelSwitch.primaryChannel,
8097 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8098 pSessionEntry->gLimChannelSwitch.state =
8099 eLIM_CHANNEL_SWITCH_IDLE;
8100 break;
8101
8102 default:
8103 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8104 pSessionEntry->gLimChannelSwitch.state);)
8105 if (limRestorePreChannelSwitchState(pMac,
8106 pSessionEntry) != eSIR_SUCCESS)
8107 {
8108 limLog(pMac, LOGE,
8109 FL("Could not restore pre-channelSwitch "
8110 "(11h) state, resetting the system"));
8111 }
8112 }
8113}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308114
8115/** ---------------------------------------------------------
8116\fn limInitOBSSScanParams
8117\brief This function Initializes the OBSS Scan Parameters
8118\param tpAniSirGlobal pMac
8119\param tpPESession pSessionEntry
8120\return None
8121 ------------------------------------------------------------*/
8122
8123void limInitOBSSScanParams(tpAniSirGlobal pMac,
8124 tpPESession psessionEntry)
8125{
8126 tANI_U32 cfgValue;
8127
8128 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8129 &cfgValue) != eSIR_SUCCESS)
8130 {
8131 limLog(pMac, LOGE, FL("Fail to retrieve "
8132 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8133 return ;
8134 }
8135 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8136
8137 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8138 &cfgValue) != eSIR_SUCCESS)
8139 {
8140 limLog(pMac, LOGE, FL("Fail to retrieve "
8141 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8142 return ;
8143 }
8144 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8145
8146 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8147 &cfgValue) != eSIR_SUCCESS)
8148 {
8149 limLog(pMac, LOGE, FL("Fail to retrieve "
8150 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8151 return ;
8152 }
8153 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8154 = cfgValue;
8155 if (wlan_cfgGetInt(pMac,
8156 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8157 &cfgValue) != eSIR_SUCCESS)
8158 {
8159 limLog(pMac, LOGE, FL("Fail to retrieve"
8160 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8161 return ;
8162 }
8163 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8164 cfgValue;
8165 if (wlan_cfgGetInt(pMac,
8166 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8167 != eSIR_SUCCESS)
8168 {
8169 limLog(pMac, LOGE, FL("Fail to retrieve"
8170 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8171 return ;
8172 }
8173 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8174 cfgValue;
8175 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8176 &cfgValue) != eSIR_SUCCESS)
8177 {
8178 limLog(pMac, LOGE, FL("Fail to retrieve "
8179 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8180 return ;
8181 }
8182 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308183}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308184
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308185const char * lim_ScanTypetoString(const v_U8_t scanType)
8186{
8187 switch (scanType)
8188 {
8189 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8190 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8191 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8192 default:
8193 return "Unknown ScanType";
8194 }
8195}
8196
8197const char * lim_BssTypetoString(const v_U8_t bssType)
8198{
8199 switch (bssType)
8200 {
8201 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8202 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8203 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8204 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8205 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8206 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8207 default:
8208 return "Unknown BssType";
8209 }
8210}
8211
8212const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8213{
8214 switch (mode)
8215 {
8216 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8217 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8218 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8219 default:
8220 return "Unknown BgScanMode";
8221 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308222}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308223
8224#ifdef WLAN_FEATURE_11W
8225/**
8226 *
8227 * \brief This function is called by various LIM modules to correctly set
8228 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8229 *
8230 *
8231 * \param pMac Pointer to Global MAC structure
8232 *
8233 * \param psessionEntry Pointer to session corresponding to the connection
8234 *
8235 * \param peer Peer address of the STA to which the frame is to be sent
8236 *
8237 * \param pMacHdr Pointer to the frame MAC header
8238 *
8239 * \return nothing
8240 *
8241 *
8242 */
8243void
8244limSetProtectedBit(tpAniSirGlobal pMac,
8245 tpPESession psessionEntry,
8246 tSirMacAddr peer,
8247 tpSirMacMgmtHdr pMacHdr)
8248{
8249 tANI_U16 aid;
8250 tpDphHashNode pStaDs;
8251
8252 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8253 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8254 {
8255
8256 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8257 &psessionEntry->dph.dphHashTable );
8258 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308259 /* rmfenabled will be set at the time of addbss.
8260 * but sometimes EAP auth fails and keys are not
8261 * installed then if we send any management frame
8262 * like deauth/disassoc with this bit set then
8263 * firmware crashes. so check for keys are
8264 * installed or not also before setting the bit
8265 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308266 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308267 pMacHdr->fc.wep = 1;
8268 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308269 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308270 pMacHdr->fc.wep = 1;
8271} /*** end limSetProtectedBit() ***/
8272#endif