blob: 9c7ff2e2e536a0462c42a9250edb4675c5030866 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sushant Kaushik02c866d2015-01-16 15:24:25 +05302 * Copyright (c) 2011-2015. 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
Satyanarayana Dash6f438272015-03-03 18:01:06 +053060#include "wniCfg.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080061#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
Sushant Kaushik02c866d2015-01-16 15:24:25 +053086#define MAX_DTIM_PERIOD 15
87#define MAX_DTIM_COUNT 15
88#define DTIM_PERIOD_DEFAULT 1
89#define DTIM_COUNT_DEFAULT 1
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080090static void
91limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
92 eHalStatus status,
93 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070094/** -------------------------------------------------------------
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +053095\fn limCheck11BRateBitmap
96\brief Verifies if basic rates are set.
97\param tANI_U16 pRateBitmap
98\return tANI_BOOLEAN - true or false
99 -------------------------------------------------------------*/
100
101tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 pRateBitmap)
102{
103 return ( ( pRateBitmap & ( 1 << 0 ) ) || ( pRateBitmap & ( 1 << 1 ) ) ||
104 ( pRateBitmap & ( 1 << 2 ) ) ||
105 ( pRateBitmap & ( 1 << 3 ) ) ? 1 : 0 ) ;
106}
107
108/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700109\fn limAssignDialogueToken
110\brief Assigns dialogue token.
111\param tpAniSirGlobal pMac
112\return tpDialogueToken - dialogueToken data structure.
113 -------------------------------------------------------------*/
114
115tpDialogueToken
116limAssignDialogueToken(tpAniSirGlobal pMac)
117{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700118 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530120 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
121 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530123 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 return NULL;
125 }
126
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530127 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 //first node in the list is being added.
129 if(NULL == pMac->lim.pDialogueTokenHead)
130 {
131 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
132 }
133 else
134 {
135 pMac->lim.pDialogueTokenTail->next = pCurrNode;
136 pMac->lim.pDialogueTokenTail = pCurrNode;
137 }
138 //assocId and tid of the node will be filled in by caller.
139 pCurrNode->next = NULL;
140 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700141
142 /* Dialog token should be a non-zero value */
143 if (0 == pCurrNode->token)
144 pCurrNode->token = token;
145
146 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 return pCurrNode;
148}
149
150/** -------------------------------------------------------------
151\fn limSearchAndDeleteDialogueToken
152\brief search dialogue token in the list and deletes it if found. returns failure if not found.
153\param tpAniSirGlobal pMac
154\param tANI_U8 token
155\param tANI_U16 assocId
156\param tANI_U16 tid
157\return eSirRetStatus - status of the search
158 -------------------------------------------------------------*/
159
160
161tSirRetStatus
162limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
163{
164 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
165 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
166
167 //if the list is empty
168 if(NULL == pCurrNode)
169 return eSIR_FAILURE;
170
171 // if the matching node is the first node.
172 if(pCurrNode &&
173 (assocId == pCurrNode->assocId) &&
174 (tid == pCurrNode->tid))
175 {
176 pMac->lim.pDialogueTokenHead = pCurrNode->next;
177 //there was only one node in the list. So tail pointer also needs to be adjusted.
178 if(NULL == pMac->lim.pDialogueTokenHead)
179 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530180 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800181 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 return eSIR_SUCCESS;
183 }
184
185 //first node did not match. so move to the next one.
186 pCurrNode = pCurrNode->next;
187 while(NULL != pCurrNode )
188 {
189 if(token == pCurrNode->token)
190 {
191 break;
192 }
193
194 pPrevNode = pCurrNode;
195 pCurrNode = pCurrNode->next;
196 }
197
198 if(pCurrNode &&
199 (assocId == pCurrNode->assocId) &&
200 (tid == pCurrNode->tid))
201 {
202 pPrevNode->next = pCurrNode->next;
203 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
204 if(NULL == pCurrNode->next)
205 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530206 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800207 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 return eSIR_SUCCESS;
209 }
210
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700211 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 return eSIR_FAILURE;
213
214}
215
216
217/** -------------------------------------------------------------
218\fn limDeleteDialogueTokenList
219\brief deletes the complete lim dialogue token linked list.
220\param tpAniSirGlobal pMac
221\return None
222 -------------------------------------------------------------*/
223void
224limDeleteDialogueTokenList(tpAniSirGlobal pMac)
225{
226 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
227
228 while(NULL != pMac->lim.pDialogueTokenHead)
229 {
230 pCurrNode = pMac->lim.pDialogueTokenHead;
231 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530232 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 pCurrNode = NULL;
234 }
235 pMac->lim.pDialogueTokenTail = NULL;
236}
237
238void
239limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
240{
241 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
242 *pIgnore = 0;
243
244 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
245 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530246 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 *pIgnore = 1;
248 }
249 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
250 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530251 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 *pIgnore = 1;
253 }
254 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
255 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530256 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 *pIgnore = 0;
258 }
259 else
260 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530261 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 *pIgnore = 1;
263 }
264}
265
266char *
267limMlmStateStr(tLimMlmStates state)
268{
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 switch (state)
270 {
271 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
300 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
301 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700316 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
320 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
321 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700324 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700330}
331
332void
333limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
334{
335 limLog(pMac, logLevel, limMlmStateStr(state));
336}
337
338char *
339limSmeStateStr(tLimSmeStates state)
340{
341#ifdef FIXME_GEN6
342 switch (state)
343 {
344 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700377 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700381 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 }
391#endif
392return "";
393}
394
395
396char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
397{
398#ifdef FIXME_GEN6
399
400 switch(dot11Mode)
401 {
402 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700403 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700405 return "11A";
406 case WNI_CFG_DOT11_MODE_11B:
407 return "11B";
408 case WNI_CFG_DOT11_MODE_11G:
409 return "11G";
410 case WNI_CFG_DOT11_MODE_11N:
411 return "11N";
412 case WNI_CFG_DOT11_MODE_POLARIS:
413 return "Polaris";
414 case WNI_CFG_DOT11_MODE_TITAN:
415 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700419 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 }
421#endif
422return "";
423}
424
425
426char* limStaOpRateModeStr(tStaRateMode opRateMode)
427{
428#ifdef FIXME_GEN6
429
430 switch(opRateMode)
431 {
432 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700433 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 return "11A";
436 case eSTA_11b:
437 return "11B";
438 case eSTA_11bg:
439 return "11G";
440 case eSTA_11n:
441 return "11N";
442 case eSTA_POLARIS:
443 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 }
449#endif
450return "";
451}
452
453char* limBssTypeStr(tSirBssType bssType)
454{
455 switch(bssType)
456 {
457 case eSIR_INFRASTRUCTURE_MODE:
458 return "eSIR_INFRASTRUCTURE_MODE";
459 case eSIR_IBSS_MODE:
460 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700461 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700463 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return "eSIR_AUTO_MODE";
467 default:
468 return "Invalid BSS Type";
469 }
470}
471
472void
473limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
474{
475 limLog(pMac, logLevel, limSmeStateStr(state));
476}
477
478char *limMsgStr(tANI_U32 msgType)
479{
480#ifdef FIXME_GEN6
481 switch (msgType)
482 {
483 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700491#ifdef FEATURE_OEM_DATA_SUPPORT
492 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700494 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700496#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_MIC_FAILURE_IND";
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530579 case eWNI_SME_LOST_LINK_PARAMS_IND:
580 return "eWNI_SME_LOST_LINK_PARAMS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700594 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800595#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800596 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800598 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800600#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700601
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700643 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700644#ifdef WLAN_FEATURE_VOWIFI_11R
645 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647#endif
648
649 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700666 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700667
668 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700697 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700705 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700707 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800710 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700711 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800712#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700713 case eWNI_SME_GET_TSM_STATS_REQ:
714 return "eWNI_SME_GET_TSM_STATS_REQ";
715 case eWNI_SME_GET_TSM_STATS_RSP:
716 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800717#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700719 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 }
721#endif
722return "";
723}
724
725
726
727char *limResultCodeStr(tSirResultCodes resultCode)
728{
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 switch (resultCode)
730 {
731 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700854 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700856 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700857#ifdef GEN4_SCAN
858 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700863 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700865 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700867 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700869 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700870#else // GEN4_SCAN
871 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700872 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700874 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700875#endif // GEN4_SCAN
876
877 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700878 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700880}
881
882void
883limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
884{
885 limLog(pMac, logLevel, limMsgStr(msgType));
886}
887
Jeff Johnson295189b2012-06-20 16:38:30 -0700888void
889limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
890{
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
892 {
893 switch (msg->type)
894 {
895 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 break;
898 default:
899 limPrintMsgName(pMac, logLevel,msg->type);
900 break;
901 }
902 }
903}
904
905/**
906 * limInitMlm()
907 *
908 *FUNCTION:
909 * This function is called by limProcessSmeMessages() to
910 * initialize MLM state machine on STA
911 *
912 *PARAMS:
913 *
914 *LOGIC:
915 *
916 *ASSUMPTIONS:
917 * NA
918 *
919 *NOTE:
920 * NA
921 *
922 * @param pMac Pointer to Global MAC structure
923 * @return None
924 */
925void
926limInitMlm(tpAniSirGlobal pMac)
927{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700928 tANI_U32 retVal;
929
930 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700931
Jeff Johnsone7245742012-09-05 17:12:55 -0700932 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700933
934 /// Initialize scan result hash table
935 limReInitScanResults(pMac); //sep26th review
936
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700937#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
938 /// Initialize lfr scan result hash table
939 // Could there be a problem in multisession with SAP/P2P GO, when in the
940 // middle of FW bg scan, SAP started; Again that could be a problem even on
941 // infra + SAP/P2P GO too - TBD
942 limReInitLfrScanResults(pMac);
943#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700944
945 /// Initialize number of pre-auth contexts
946 pMac->lim.gLimNumPreAuthContexts = 0;
947
948 /// Initialize MAC based Authentication STA list
949 limInitPreAuthList(pMac);
950
951 //pMac->lim.gpLimMlmJoinReq = NULL;
952
953 if (pMac->lim.gLimTimersCreated)
954 return;
955
956 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700957 retVal = limCreateTimers(pMac);
958 if(retVal == TX_SUCCESS)
959 {
960 pMac->lim.gLimTimersCreated = 1;
961 }
962 else
963 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700964 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700965 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700966} /*** end limInitMlm() ***/
967
968
969
970/**
971 * limCleanupMlm()
972 *
973 *FUNCTION:
974 * This function is called to cleanup any resources
975 * allocated by the MLM state machine.
976 *
977 *PARAMS:
978 *
979 *LOGIC:
980 *
981 *ASSUMPTIONS:
982 * NA
983 *
984 *NOTE:
985 * It is assumed that BSS is already informed that we're leaving it
986 * before this function is called.
987 *
988 * @param pMac Pointer to Global MAC structure
989 * @param None
990 * @return None
991 */
992void
993limCleanupMlm(tpAniSirGlobal pMac)
994{
995 tANI_U32 n;
996 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530997#ifdef WLAN_FEATURE_11W
998 tANI_U32 bss_entry, sta_entry;
999 tpDphHashNode pStaDs = NULL;
1000 tpPESession psessionEntry = NULL;
1001#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
1003 if (pMac->lim.gLimTimersCreated == 1)
1004 {
1005 // Deactivate and delete MIN/MAX channel timers.
1006 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1007 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1010 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1011 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1012
1013
1014 // Deactivate and delete channel switch timer.
1015 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1016 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1017
1018
1019 // Deactivate and delete addts response timer.
1020 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1021 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1022
1023 // Deactivate and delete Join failure timer.
1024 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1025 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1026
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001027 // Deactivate and delete Periodic Join Probe Request timer.
1028 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1029 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1030
Sushant Kaushik9e923872015-04-02 17:09:31 +05301031 // Deactivate and delete Auth Retry timer.
1032 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1033 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1034
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 // Deactivate and delete Association failure timer.
1036 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1037 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1038
1039 // Deactivate and delete Reassociation failure timer.
1040 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1041 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1042
1043 // Deactivate and delete Authentication failure timer.
1044 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1045 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1046
1047 // Deactivate and delete Heartbeat timer.
1048 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1049 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1050
1051 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1052 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1053 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1054
1055 // Deactivate and delete Quiet timer.
1056 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1057 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1058
1059 // Deactivate and delete Quiet BSS timer.
1060 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1061 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1062
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 // Deactivate and delete LIM background scan timer.
1064 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1065 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001066
1067
1068 // Deactivate and delete cnf wait timer
1069 for (n = 0; n < pMac->lim.maxStation; n++)
1070 {
1071 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1072 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1073 }
1074
1075 // Deactivate and delete keepalive timer
1076 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1077 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1078
1079 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1080
1081 //Deactivate any Authentication response timers
1082 limDeletePreAuthList(pMac);
1083
1084 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1085 {
1086 // Delete any Authentication response
1087 // timers, which might have been started.
1088 tx_timer_delete(&pAuthNode->timer);
1089 }
1090
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1092 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1093 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1094 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1095
1096#if 0 // The WPS PBC clean up timer is disabled
1097 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1098 {
1099 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1100 {
1101 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1102 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1103 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1104 }
1105 }
1106#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001107#ifdef WLAN_FEATURE_VOWIFI_11R
1108 // Deactivate and delete FT Preauth response timer
1109 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1110 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1111#endif
1112
Jeff Johnson295189b2012-06-20 16:38:30 -07001113
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001114#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001116 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1117 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1118#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001119
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001120 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1121 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1122
1123 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1124 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1125
Hoonki Leef63df0d2013-01-16 19:29:14 -08001126 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1127 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001128
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301129 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1130 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1131
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 pMac->lim.gLimTimersCreated = 0;
1133 }
1134
Agarwal Ashish888ca022014-11-05 14:25:56 +05301135#ifdef WLAN_FEATURE_11W
1136 /*
1137 * When SSR is triggered, we need to loop through
1138 * each STA associated per BSSId and deactivate/delete
1139 * the pmfSaQueryTimer for it
1140 */
1141 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1142 {
1143 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1144 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1145 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1146 {
1147 if (pMac->lim.gpSession[bss_entry].valid)
1148 {
1149 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1150 sta_entry++)
1151 {
1152 psessionEntry = &pMac->lim.gpSession[bss_entry];
1153 pStaDs = dphGetHashEntry(pMac, sta_entry,
1154 &psessionEntry->dph.dphHashTable);
1155 if (NULL == pStaDs)
1156 {
1157 continue;
1158 }
1159 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1160 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1161 pStaDs->staIndex) ;
1162 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1163 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1164 }
1165 }
1166 }
1167 }
1168#endif
1169
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 /// Cleanup cached scan list
1171 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001172#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1173 /// Cleanup cached scan list
1174 limReInitLfrScanResults(pMac);
1175#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001176
1177} /*** end limCleanupMlm() ***/
1178
1179
1180
1181/**
1182 * limCleanupLmm()
1183 *
1184 *FUNCTION:
1185 * This function is called to cleanup any resources
1186 * allocated by LMM sub-module.
1187 *
1188 *PARAMS:
1189 *
1190 *LOGIC:
1191 *
1192 *ASSUMPTIONS:
1193 * NA
1194 *
1195 *NOTE:
1196 * NA
1197 *
1198 * @param pMac Pointer to Global MAC structure
1199 * @return None
1200 */
1201
1202void
1203limCleanupLmm(tpAniSirGlobal pMac)
1204{
Jeff Johnson295189b2012-06-20 16:38:30 -07001205} /*** end limCleanupLmm() ***/
1206
1207
1208
1209/**
1210 * limIsAddrBC()
1211 *
1212 *FUNCTION:
1213 * This function is called in various places within LIM code
1214 * to determine whether passed MAC address is a broadcast or not
1215 *
1216 *LOGIC:
1217 *
1218 *ASSUMPTIONS:
1219 * NA
1220 *
1221 *NOTE:
1222 * NA
1223 *
1224 * @param macAddr Indicates MAC address that need to be determined
1225 * whether it is Broadcast address or not
1226 *
1227 * @return true if passed address is Broadcast address else false
1228 */
1229
1230tANI_U8
1231limIsAddrBC(tSirMacAddr macAddr)
1232{
1233 int i;
1234 for (i = 0; i < 6; i++)
1235 {
1236 if ((macAddr[i] & 0xFF) != 0xFF)
1237 return false;
1238 }
1239
1240 return true;
1241} /****** end limIsAddrBC() ******/
1242
1243
1244
1245/**
1246 * limIsGroupAddr()
1247 *
1248 *FUNCTION:
1249 * This function is called in various places within LIM code
1250 * to determine whether passed MAC address is a group address or not
1251 *
1252 *LOGIC:
1253 * If least significant bit of first octet of the MAC address is
1254 * set to 1, it is a Group address.
1255 *
1256 *ASSUMPTIONS:
1257 * NA
1258 *
1259 *NOTE:
1260 * NA
1261 *
1262 * @param macAddr Indicates MAC address that need to be determined
1263 * whether it is Group address or not
1264 *
1265 * @return true if passed address is Group address else false
1266 */
1267
1268tANI_U8
1269limIsGroupAddr(tSirMacAddr macAddr)
1270{
1271 if ((macAddr[0] & 0x01) == 0x01)
1272 return true;
1273 else
1274 return false;
1275} /****** end limIsGroupAddr() ******/
1276
1277/**
1278 * limPostMsgApiNoWait()
1279 *
1280 *FUNCTION:
1281 * This function is called from other thread while posting a
1282 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1283 *
1284 *LOGIC:
1285 * NA
1286 *
1287 *ASSUMPTIONS:
1288 * NA
1289 *
1290 *NOTE:
1291 * NA
1292 *
1293 * @param pMsg - Pointer to the Global MAC structure
1294 * @param pMsg - Pointer to the message structure
1295 * @return None
1296 */
1297
1298tANI_U32
1299limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1300{
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 limProcessMessages(pMac, pMsg);
1302 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001303} /*** end limPostMsgApiNoWait() ***/
1304
1305
1306
1307/**
1308 * limPrintMacAddr()
1309 *
1310 *FUNCTION:
1311 * This function is called to print passed MAC address
1312 * in : format.
1313 *
1314 *LOGIC:
1315 *
1316 *ASSUMPTIONS:
1317 * NA
1318 *
1319 *NOTE:
1320 * @param macAddr - MacAddr to be printed
1321 * @param logLevel - Loglevel to be used
1322 *
1323 * @return None.
1324 */
1325
1326void
1327limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1328{
1329 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001330 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001331} /****** end limPrintMacAddr() ******/
1332
1333
Jeff Johnson295189b2012-06-20 16:38:30 -07001334/*
1335 * limResetDeferredMsgQ()
1336 *
1337 *FUNCTION:
1338 * This function resets the deferred message queue parameters.
1339 *
1340 *PARAMS:
1341 * @param pMac - Pointer to Global MAC structure
1342 *
1343 *LOGIC:
1344 *
1345 *ASSUMPTIONS:
1346 * NA
1347 *
1348 *NOTE:
1349 * NA
1350 *
1351 *RETURNS:
1352 * None
1353 */
1354
1355void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1356{
1357 pMac->lim.gLimDeferredMsgQ.size =
1358 pMac->lim.gLimDeferredMsgQ.write =
1359 pMac->lim.gLimDeferredMsgQ.read = 0;
1360
1361}
1362
1363
1364#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1365#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1366
1367/*
1368 * limWriteDeferredMsgQ()
1369 *
1370 *FUNCTION:
1371 * This function queues up a deferred message for later processing on the
1372 * STA side.
1373 *
1374 *PARAMS:
1375 * @param pMac - Pointer to Global MAC structure
1376 * @param limMsg - a LIM message
1377 *
1378 *LOGIC:
1379 *
1380 *ASSUMPTIONS:
1381 * NA
1382 *
1383 *NOTE:
1384 * NA
1385 *
1386 *RETURNS:
1387 * None
1388 */
1389
1390tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1391{
1392 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001393 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1395 limMsg->type);)
1396
1397 /*
1398 ** check if the deferred message queue is full
1399 **/
1400 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1401 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001402 if(!(pMac->lim.deferredMsgCnt & 0xF))
1403 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001404 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 -07001405 }
1406 else
1407 {
1408 pMac->lim.deferredMsgCnt++;
1409 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 return TX_QUEUE_FULL;
1411 }
1412
1413 /*
1414 ** In the application, there should not be more than 1 message get
1415 ** queued up. If happens, flags a warning. In the future, this can
1416 ** happen.
1417 **/
1418 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1419 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001420 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 -07001421 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1422 limIsSystemInScanState(pMac),
1423 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1424 pMac->lim.gLimAddtsSent);)
1425 }
1426
1427 /*
1428 ** To prevent the deferred Q is full of management frames, only give them certain space
1429 **/
1430 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1431 {
1432 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1433 {
1434 tANI_U16 idx, count = 0;
1435 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1436 {
1437 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1438 {
1439 count++;
1440 }
1441 }
1442 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1443 {
1444 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001445 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 //Return error, caller knows what to do
1447 return TX_QUEUE_FULL;
1448 }
1449 }
1450 }
1451
1452 ++pMac->lim.gLimDeferredMsgQ.size;
1453
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001454 /* reset the count here since we are able to defer the message */
1455 if(pMac->lim.deferredMsgCnt != 0)
1456 {
1457 pMac->lim.deferredMsgCnt = 0;
1458 }
1459
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 /*
1461 ** if the write pointer hits the end of the queue, rewind it
1462 **/
1463 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1464 pMac->lim.gLimDeferredMsgQ.write = 0;
1465
1466 /*
1467 ** save the message to the queue and advanced the write pointer
1468 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301469 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1470 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001471 (tANI_U8 *)limMsg,
1472 sizeof(tSirMsgQ));
1473 return TX_SUCCESS;
1474
1475}
1476
1477/*
1478 * limReadDeferredMsgQ()
1479 *
1480 *FUNCTION:
1481 * This function dequeues a deferred message for processing on the
1482 * STA side.
1483 *
1484 *PARAMS:
1485 * @param pMac - Pointer to Global MAC structure
1486 *
1487 *LOGIC:
1488 *
1489 *ASSUMPTIONS:
1490 * NA
1491 *
1492 *NOTE:
1493 *
1494 *
1495 *RETURNS:
1496 * Returns the message at the head of the deferred message queue
1497 */
1498
1499tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1500{
1501 tSirMsgQ *msg;
1502
1503 /*
1504 ** check any messages left. If no, return
1505 **/
1506 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1507 return NULL;
1508
1509 /*
1510 ** decrement the queue size
1511 **/
1512 pMac->lim.gLimDeferredMsgQ.size--;
1513
1514 /*
1515 ** retrieve the message from the head of the queue
1516 **/
1517 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1518
1519 /*
1520 ** advance the read pointer
1521 **/
1522 pMac->lim.gLimDeferredMsgQ.read++;
1523
1524 /*
1525 ** if the read pointer hits the end of the queue, rewind it
1526 **/
1527 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1528 pMac->lim.gLimDeferredMsgQ.read = 0;
1529
1530 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001531 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1533 msg->type);)
1534
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001535 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 limIsSystemInScanState(pMac),
1537 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1538 pMac->lim.gLimAddtsSent);)
1539
1540 return(msg);
1541}
1542
1543tSirRetStatus
1544limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1545 tSirMsgQ *pMsg,
1546 tANI_U8 qType)
1547{
1548// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001549 SysProcessMmhMsg(pMac, pMsg);
1550 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001551}
1552
1553char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1554{
1555#ifdef FIXME_GEN6
1556
1557 if (type == SIR_MAC_MGMT_FRAME)
1558 {
1559 switch (subType)
1560 {
1561 case SIR_MAC_MGMT_ASSOC_REQ:
1562 return "MAC_MGMT_ASSOC_REQ";
1563 case SIR_MAC_MGMT_ASSOC_RSP:
1564 return "MAC_MGMT_ASSOC_RSP";
1565 case SIR_MAC_MGMT_REASSOC_REQ:
1566 return "MAC_MGMT_REASSOC_REQ";
1567 case SIR_MAC_MGMT_REASSOC_RSP:
1568 return "MAC_MGMT_REASSOC_RSP";
1569 case SIR_MAC_MGMT_PROBE_REQ:
1570 return "MAC_MGMT_PROBE_REQ";
1571 case SIR_MAC_MGMT_PROBE_RSP:
1572 return "MAC_MGMT_PROBE_RSP";
1573 case SIR_MAC_MGMT_BEACON:
1574 return "MAC_MGMT_BEACON";
1575 case SIR_MAC_MGMT_ATIM:
1576 return "MAC_MGMT_ATIM";
1577 case SIR_MAC_MGMT_DISASSOC:
1578 return "MAC_MGMT_DISASSOC";
1579 case SIR_MAC_MGMT_AUTH:
1580 return "MAC_MGMT_AUTH";
1581 case SIR_MAC_MGMT_DEAUTH:
1582 return "MAC_MGMT_DEAUTH";
1583 case SIR_MAC_MGMT_ACTION:
1584 return "MAC_MGMT_ACTION";
1585 case SIR_MAC_MGMT_RESERVED15:
1586 return "MAC_MGMT_RESERVED15";
1587 default:
1588 return "Unknown MGMT Frame";
1589 }
1590 }
1591
1592 else if (type == SIR_MAC_CTRL_FRAME)
1593 {
1594 switch (subType)
1595 {
1596 case SIR_MAC_CTRL_RR:
1597 return "MAC_CTRL_RR";
1598 case SIR_MAC_CTRL_BAR:
1599 return "MAC_CTRL_BAR";
1600 case SIR_MAC_CTRL_BA:
1601 return "MAC_CTRL_BA";
1602 case SIR_MAC_CTRL_PS_POLL:
1603 return "MAC_CTRL_PS_POLL";
1604 case SIR_MAC_CTRL_RTS:
1605 return "MAC_CTRL_RTS";
1606 case SIR_MAC_CTRL_CTS:
1607 return "MAC_CTRL_CTS";
1608 case SIR_MAC_CTRL_ACK:
1609 return "MAC_CTRL_ACK";
1610 case SIR_MAC_CTRL_CF_END:
1611 return "MAC_CTRL_CF_END";
1612 case SIR_MAC_CTRL_CF_END_ACK:
1613 return "MAC_CTRL_CF_END_ACK";
1614 default:
1615 return "Unknown CTRL Frame";
1616 }
1617 }
1618
1619 else if (type == SIR_MAC_DATA_FRAME)
1620 {
1621 switch (subType)
1622 {
1623 case SIR_MAC_DATA_DATA:
1624 return "MAC_DATA_DATA";
1625 case SIR_MAC_DATA_DATA_ACK:
1626 return "MAC_DATA_DATA_ACK";
1627 case SIR_MAC_DATA_DATA_POLL:
1628 return "MAC_DATA_DATA_POLL";
1629 case SIR_MAC_DATA_DATA_ACK_POLL:
1630 return "MAC_DATA_DATA_ACK_POLL";
1631 case SIR_MAC_DATA_NULL:
1632 return "MAC_DATA_NULL";
1633 case SIR_MAC_DATA_NULL_ACK:
1634 return "MAC_DATA_NULL_ACK";
1635 case SIR_MAC_DATA_NULL_POLL:
1636 return "MAC_DATA_NULL_POLL";
1637 case SIR_MAC_DATA_NULL_ACK_POLL:
1638 return "MAC_DATA_NULL_ACK_POLL";
1639 case SIR_MAC_DATA_QOS_DATA:
1640 return "MAC_DATA_QOS_DATA";
1641 case SIR_MAC_DATA_QOS_DATA_ACK:
1642 return "MAC_DATA_QOS_DATA_ACK";
1643 case SIR_MAC_DATA_QOS_DATA_POLL:
1644 return "MAC_DATA_QOS_DATA_POLL";
1645 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1646 return "MAC_DATA_QOS_DATA_ACK_POLL";
1647 case SIR_MAC_DATA_QOS_NULL:
1648 return "MAC_DATA_QOS_NULL";
1649 case SIR_MAC_DATA_QOS_NULL_ACK:
1650 return "MAC_DATA_QOS_NULL_ACK";
1651 case SIR_MAC_DATA_QOS_NULL_POLL:
1652 return "MAC_DATA_QOS_NULL_POLL";
1653 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1654 return "MAC_DATA_QOS_NULL_ACK_POLL";
1655 default:
1656 return "Unknown Data Frame";
1657 }
1658 }
1659 else
1660 return "Unknown";
1661#endif
1662return "";
1663}
1664
Jeff Johnson295189b2012-06-20 16:38:30 -07001665void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1666{
1667 int i;
1668 static int enable;
1669 tUpdateBeaconParams beaconParams;
1670
1671 tpPESession psessionEntry = limIsApSessionActive(pMac);
1672
1673 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001674 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001675 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001677 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301678
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301679 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001680 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001681
1682 beaconParams.paramChangeBitmap = 0;
1683 /*
1684 ** This is doing a 2 pass check. The first pass is to invalidate
1685 ** all the cache entries. The second pass is to decide whether to
1686 ** disable protection.
1687 **/
1688 if (!enable)
1689 {
1690
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001691 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 psessionEntry->gLimOlbcParams.numSta = 0;
1693 psessionEntry->gLimOverlap11gParams.numSta = 0;
1694 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1695 psessionEntry->gLimNonGfParams.numSta = 0;
1696 psessionEntry->gLimLsigTxopParams.numSta = 0;
1697
1698 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1699 pMac->lim.protStaOverlapCache[i].active = false;
1700
1701 enable = 1;
1702 }
1703 else
1704 {
1705
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001706 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 {
1708 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1709 {
1710 if (!psessionEntry->gLim11bParams.protectionEnabled)
1711 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001712 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1714 }
1715 }
1716 }
1717
1718 if (!psessionEntry->gLimOverlap11gParams.numSta)
1719 {
1720 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1721 {
1722 if (!psessionEntry->gLim11gParams.protectionEnabled)
1723 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001724 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1726 }
1727 }
1728 }
1729
1730 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1731 {
1732 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1733 {
1734 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1735 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001736 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1738 }
1739 }
1740 }
1741
1742 enable = 0;
1743 }
1744
1745 if(beaconParams.paramChangeBitmap)
1746 {
1747 schSetFixedBeaconFields(pMac,psessionEntry);
1748 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1749 }
1750
1751 // Start OLBC timer
1752 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1753 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001754 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 }
1756}
Jeff Johnson295189b2012-06-20 16:38:30 -07001757
1758/**
1759 * limIsNullSsid()
1760 *
1761 *FUNCTION:
1762 * This function checks if Ssid supplied is Null SSID
1763 *
1764 *
1765 *LOGIC:
1766 *
1767 *ASSUMPTIONS:
1768 * NA
1769 *
1770 *NOTE:
1771 * NA
1772 *
1773 * @param tSirMacSSid *
1774 *
1775 *
1776 * @return true if SSID is Null SSID else false
1777 */
1778
1779tANI_U8
1780limIsNullSsid( tSirMacSSid *pSsid )
1781{
1782 tANI_U8 fNullSsid = false;
1783 tANI_U32 SsidLength;
1784 tANI_U8 *pSsidStr;
1785
1786 do
1787 {
1788 if ( 0 == pSsid->length )
1789 {
1790 fNullSsid = true;
1791 break;
1792 }
1793
1794#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301795 /* If the first charactes is space and SSID length is 1
1796 * then consider it as NULL SSID*/
1797 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1798 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301800 fNullSsid = true;
1801 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 }
1803 else
1804 {
1805 /* check if all the charactes in SSID are NULL*/
1806 SsidLength = pSsid->length;
1807 pSsidStr = pSsid->ssId;
1808
1809 while ( SsidLength )
1810 {
1811 if( *pSsidStr )
1812 break;
1813
1814 pSsidStr++;
1815 SsidLength--;
1816 }
1817
1818 if( 0 == SsidLength )
1819 {
1820 fNullSsid = true;
1821 break;
1822 }
1823 }
1824 }
1825 while( 0 );
1826
1827 return fNullSsid;
1828} /****** end limIsNullSsid() ******/
1829
1830
1831
Jeff Johnson295189b2012-06-20 16:38:30 -07001832
1833/** -------------------------------------------------------------
1834\fn limUpdateProtStaParams
1835\brief updates protection related counters.
1836\param tpAniSirGlobal pMac
1837\param tSirMacAddr peerMacAddr
1838\param tLimProtStaCacheType protStaCacheType
1839\param tHalBitVal gfSupported
1840\param tHalBitVal lsigTxopSupported
1841\return None
1842 -------------------------------------------------------------*/
1843void
1844limUpdateProtStaParams(tpAniSirGlobal pMac,
1845tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1846tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1847tpPESession psessionEntry)
1848{
1849 tANI_U32 i;
1850
1851 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1852 limLog(pMac,LOG1, FL("Addr : "));
1853 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1854
1855 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1856 {
1857 if (psessionEntry->protStaCache[i].active)
1858 {
1859 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1860 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1861
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301862 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 psessionEntry->protStaCache[i].addr,
1864 peerMacAddr, sizeof(tSirMacAddr)))
1865 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001866 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 return;
1868 }
1869 }
1870 }
1871
1872 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1873 {
1874 if (!psessionEntry->protStaCache[i].active)
1875 break;
1876 }
1877
1878 if (i >= LIM_PROT_STA_CACHE_SIZE)
1879 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001880 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 return;
1882 }
1883
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301884 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 peerMacAddr,
1886 sizeof(tSirMacAddr));
1887
1888 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1889 psessionEntry->protStaCache[i].active = true;
1890 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1891 {
1892 psessionEntry->gLim11bParams.numSta++;
1893 limLog(pMac,LOG1, FL("11B, "));
1894 }
1895 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1896 {
1897 psessionEntry->gLim11gParams.numSta++;
1898 limLog(pMac,LOG1, FL("11G, "));
1899 }
1900 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1901 {
1902 psessionEntry->gLimHt20Params.numSta++;
1903 limLog(pMac,LOG1, FL("HT20, "));
1904 }
1905
1906 if(!gfSupported)
1907 {
1908 psessionEntry->gLimNonGfParams.numSta++;
1909 limLog(pMac,LOG1, FL("NonGf, "));
1910 }
1911 if(!lsigTxopSupported)
1912 {
1913 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001914 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 }
1916}// ---------------------------------------------------------------------
1917
1918/** -------------------------------------------------------------
1919\fn limDecideApProtection
1920\brief Decides all the protection related staiton coexistence and also sets
1921\ short preamble and short slot appropriately. This function will be called
1922\ when AP is ready to send assocRsp tp the station joining right now.
1923\param tpAniSirGlobal pMac
1924\param tSirMacAddr peerMacAddr
1925\return None
1926 -------------------------------------------------------------*/
1927void
1928limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1929{
1930 tANI_U16 tmpAid;
1931 tpDphHashNode pStaDs;
1932 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1933 tANI_U32 phyMode;
1934 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1935 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1936
1937 pBeaconParams->paramChangeBitmap = 0;
1938 // check whether to enable protection or not
1939 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1940 if(NULL == pStaDs)
1941 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301942 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 return;
1944 }
1945 limGetRfBand(pMac, &rfBand, psessionEntry);
1946 //if we are in 5 GHZ band
1947 if(SIR_BAND_5_GHZ == rfBand)
1948 {
1949 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1950 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001951 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 {
1953 //we are 11N and 11A station is joining.
1954 //protection from 11A required.
1955 if(false == pStaDs->mlmStaContext.htCapability)
1956 {
1957 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1958 return;
1959 }
1960 }
1961 }
1962 else if(SIR_BAND_2_4_GHZ== rfBand)
1963 {
1964 limGetPhyMode(pMac, &phyMode, psessionEntry);
1965
1966 //We are 11G. Check if we need protection from 11b Stations.
1967 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001968 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 {
1970
1971 if (pStaDs->erpEnabled== eHAL_CLEAR)
1972 {
1973 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1974 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001975 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1977 }
1978 }
1979
1980 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001981 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 {
1983 //check if we need protection from 11b station
1984 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1985 (!pStaDs->mlmStaContext.htCapability))
1986 {
1987 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1988 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001989 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1991 }
1992 //station being joined is non-11b and non-ht ==> 11g device
1993 else if(!pStaDs->mlmStaContext.htCapability)
1994 {
1995 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1996 //enable protection
1997 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1998 }
1999 //ERP mode is enabled for the latest station joined
2000 //latest station joined is HT capable
2001 //This case is being handled in common code (commn between both the bands) below.
2002 }
2003 }
2004
2005 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002006 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 (true == pStaDs->mlmStaContext.htCapability))
2008 {
2009 if(!pStaDs->htGreenfield)
2010 {
2011 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2012 gfSupported = eHAL_CLEAR;
2013 }
2014 //Station joining is HT 20Mhz
2015 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2016 {
2017 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2018 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2019 }
2020 //Station joining does not support LSIG TXOP Protection
2021 if(!pStaDs->htLsigTXOPProtection)
2022 {
2023 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2024 lsigTxopSupported = eHAL_CLEAR;
2025 }
2026 }
2027
2028 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2029 gfSupported, lsigTxopSupported, psessionEntry);
2030
2031 return;
2032}
Jeff Johnson295189b2012-06-20 16:38:30 -07002033
2034
2035/** -------------------------------------------------------------
2036\fn limEnableOverlap11gProtection
2037\brief wrapper function for setting overlap 11g protection.
2038\param tpAniSirGlobal pMac
2039\param tpUpdateBeaconParams pBeaconParams
2040\param tpSirMacMgmtHdr pMh
2041\return None
2042 -------------------------------------------------------------*/
2043void
2044limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2045tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2046{
2047 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2048
2049 if (psessionEntry->gLimOlbcParams.numSta &&
2050 !psessionEntry->gLimOlbcParams.protectionEnabled)
2051 {
2052 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002053 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2055 }
2056}
2057
2058
2059/** -------------------------------------------------------------
2060\fn limUpdateShortPreamble
2061\brief Updates short preamble if needed when a new station joins.
2062\param tpAniSirGlobal pMac
2063\param tSirMacAddr peerMacAddr
2064\param tpUpdateBeaconParams pBeaconParams
2065\return None
2066 -------------------------------------------------------------*/
2067void
2068limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2069 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2070{
2071 tANI_U16 tmpAid;
2072 tpDphHashNode pStaDs;
2073 tANI_U32 phyMode;
2074 tANI_U16 i;
2075
2076 // check whether to enable protection or not
2077 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2078
2079 limGetPhyMode(pMac, &phyMode, psessionEntry);
2080
2081 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2082
2083 {
2084 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2085 {
2086 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2087 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2088
2089 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2090 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2092 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2093 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302094 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2096 peerMacAddr, sizeof(tSirMacAddr)))
2097 return;
2098 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 {
2100 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2101 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302102 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2104 peerMacAddr, sizeof(tSirMacAddr)))
2105 return;
2106 }
2107 }
2108 }
2109
2110
2111 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2112 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2114 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2115 break;
2116 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 {
2118 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2119 break;
2120 }
2121 }
2122
2123 if (i >= LIM_PROT_STA_CACHE_SIZE)
2124 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2126 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2127 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2128 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2129 return;
2130 }
2131 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 {
2133 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2134 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2135 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2136 return;
2137 }
2138
2139 }
2140
2141
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302142 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2143 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 peerMacAddr, sizeof(tSirMacAddr));
2145 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2146 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2147 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302149 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 peerMacAddr, sizeof(tSirMacAddr));
2151 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2152 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2153 }
2154
2155
2156 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002157 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002158
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002160 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 }
2162 }
2163}
2164
2165/** -------------------------------------------------------------
2166\fn limUpdateShortSlotTime
2167\brief Updates short slot time if needed when a new station joins.
2168\param tpAniSirGlobal pMac
2169\param tSirMacAddr peerMacAddr
2170\param tpUpdateBeaconParams pBeaconParams
2171\return None
2172 -------------------------------------------------------------*/
2173
2174void
2175limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2176 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2177{
2178 tANI_U16 tmpAid;
2179 tpDphHashNode pStaDs;
2180 tANI_U32 phyMode;
2181 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 tANI_U16 i;
2183
2184 // check whether to enable protection or not
2185 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2186 limGetPhyMode(pMac, &phyMode, psessionEntry);
2187
Jeff Johnsone7245742012-09-05 17:12:55 -07002188 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2189 * be always 1 and in 11b case, it should be always 0
2190 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2192 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002193 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2194 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2195 * it in limDecideShortSlot
2196 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2198 {
2199 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2200 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2201 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2202 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2204 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2205 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302206 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2208 peerMacAddr, sizeof(tSirMacAddr)))
2209 return;
2210 }
2211 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 {
2213 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2214 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302215 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2217 peerMacAddr, sizeof(tSirMacAddr)))
2218 return;
2219 }
2220 }
2221 }
2222
2223 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2224 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2226 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2227 break;
2228 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 {
2230 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2231 break;
2232 }
2233 }
2234
2235 if (i >= LIM_PROT_STA_CACHE_SIZE)
2236 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2238 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2239 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2240 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2241 return;
2242 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 {
2244 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2245 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2246 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2247 return;
2248 }
2249 }
2250
2251
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302253 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 peerMacAddr, sizeof(tSirMacAddr));
2255 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2256 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2257 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302259 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 peerMacAddr, sizeof(tSirMacAddr));
2261 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2262 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2263 }
2264 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2265
Jeff Johnsone7245742012-09-05 17:12:55 -07002266 /* 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
2267 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2268 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002270 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 // enable long slot time
2273 pBeaconParams->fShortSlotTime = false;
2274 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002275 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002276 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 }
2278 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002280 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 {
2282 // enable long slot time
2283 pBeaconParams->fShortSlotTime = false;
2284 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002285 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002286 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288 }
2289 }
2290 }
2291}
2292
Jeff Johnson295189b2012-06-20 16:38:30 -07002293
2294/** -------------------------------------------------------------
2295\fn limDecideStaProtectionOnAssoc
2296\brief Decide protection related settings on Sta while association.
2297\param tpAniSirGlobal pMac
2298\param tpSchBeaconStruct pBeaconStruct
2299\return None
2300 -------------------------------------------------------------*/
2301void
2302limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2303 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2304{
2305 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2306 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2307
2308 limGetRfBand(pMac, &rfBand, psessionEntry);
2309 limGetPhyMode(pMac, &phyMode, psessionEntry);
2310
2311 if(SIR_BAND_5_GHZ == rfBand)
2312 {
2313 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2314 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2315 {
2316 if(pMac->lim.cfgProtection.fromlla)
2317 psessionEntry->beaconParams.llaCoexist = true;
2318 }
2319 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2320 {
2321 if(pMac->lim.cfgProtection.ht20)
2322 psessionEntry->beaconParams.ht20Coexist = true;
2323 }
2324
2325 }
2326 else if(SIR_BAND_2_4_GHZ == rfBand)
2327 {
2328 //spec 7.3.2.13
2329 //UseProtection will be set when nonERP STA is associated.
2330 //NonERPPresent bit will be set when:
2331 //--nonERP Sta is associated OR
2332 //--nonERP Sta exists in overlapping BSS
2333 //when useProtection is not set then protection from nonERP stations is optional.
2334
2335 //CFG protection from 11b is enabled and
2336 //11B device in the BSS
2337 /* TODO, This is not sessionized */
2338 if (phyMode != WNI_CFG_PHY_MODE_11B)
2339 {
2340 if (pMac->lim.cfgProtection.fromllb &&
2341 pBeaconStruct->erpPresent &&
2342 (pBeaconStruct->erpIEInfo.useProtection ||
2343 pBeaconStruct->erpIEInfo.nonErpPresent))
2344 {
2345 psessionEntry->beaconParams.llbCoexist = true;
2346 }
2347 //AP has no 11b station associated.
2348 else
2349 {
2350 psessionEntry->beaconParams.llbCoexist = false;
2351 }
2352 }
2353 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002354 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 (pBeaconStruct->HTInfo.present))
2356 {
2357 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2358
2359 //Obss Non HT STA present mode
2360 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2361
2362
2363 //CFG protection from 11G is enabled and
2364 //our AP has at least one 11G station associated.
2365 if(pMac->lim.cfgProtection.fromllg &&
2366 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2367 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2368 (!psessionEntry->beaconParams.llbCoexist))
2369 {
2370 if(pMac->lim.cfgProtection.fromllg)
2371 psessionEntry->beaconParams.llgCoexist = true;
2372 }
2373
2374 //AP has only HT stations associated and at least one station is HT 20
2375 //disable protection from any non-HT devices.
2376 //decision for disabling protection from 11b has already been taken above.
2377 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2378 {
2379 //Disable protection from 11G station.
2380 psessionEntry->beaconParams.llgCoexist = false;
2381 //CFG protection from HT 20 is enabled.
2382 if(pMac->lim.cfgProtection.ht20)
2383 psessionEntry->beaconParams.ht20Coexist = true;
2384 }
2385 //Disable protection from non-HT and HT20 devices.
2386 //decision for disabling protection from 11b has already been taken above.
2387 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2388 {
2389 psessionEntry->beaconParams.llgCoexist = false;
2390 psessionEntry->beaconParams.ht20Coexist = false;
2391 }
2392
2393 }
2394 }
2395
2396 //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 -07002397 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 (pBeaconStruct->HTInfo.present))
2399 {
2400 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2401 psessionEntry->beaconParams.fRIFSMode =
2402 ( tANI_U8 ) htInfo.rifsMode;
2403 psessionEntry->beaconParams.llnNonGFCoexist =
2404 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2405 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2406 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2407 }
2408}
2409
2410
2411/** -------------------------------------------------------------
2412\fn limDecideStaProtection
2413\brief Decides protection related settings on Sta while processing beacon.
2414\param tpAniSirGlobal pMac
2415\param tpUpdateBeaconParams pBeaconParams
2416\return None
2417 -------------------------------------------------------------*/
2418void
2419limDecideStaProtection(tpAniSirGlobal pMac,
2420 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2421{
2422
2423 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2424 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2425
2426 limGetRfBand(pMac, &rfBand, psessionEntry);
2427 limGetPhyMode(pMac, &phyMode, psessionEntry);
2428
2429 if(SIR_BAND_5_GHZ == rfBand)
2430 {
2431 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002432 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 (pBeaconStruct->HTInfo.present))
2434 {
2435 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2436 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2437 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2438 {
2439 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2440 }
2441 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2442 //protection from HT20 if needed.
2443 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2444 {
2445 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2446 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2447 }
2448 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2449 {
2450 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2451 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2452 }
2453 }
2454 }
2455 else if(SIR_BAND_2_4_GHZ == rfBand)
2456 {
2457 /* spec 7.3.2.13
2458 * UseProtection will be set when nonERP STA is associated.
2459 * NonERPPresent bit will be set when:
2460 * --nonERP Sta is associated OR
2461 * --nonERP Sta exists in overlapping BSS
2462 * when useProtection is not set then protection from nonERP stations is optional.
2463 */
2464
2465 if (phyMode != WNI_CFG_PHY_MODE_11B)
2466 {
2467 if (pBeaconStruct->erpPresent &&
2468 (pBeaconStruct->erpIEInfo.useProtection ||
2469 pBeaconStruct->erpIEInfo.nonErpPresent))
2470 {
2471 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2472 }
2473 //AP has no 11b station associated.
2474 else
2475 {
2476 //disable protection from 11b station
2477 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2478 }
2479 }
2480
2481 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002482 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 (pBeaconStruct->HTInfo.present))
2484 {
2485
2486 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2487 //AP has at least one 11G station associated.
2488 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2489 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2490 (!psessionEntry->beaconParams.llbCoexist))
2491 {
2492 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2493
2494 }
2495
2496 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2497 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2498 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2499 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2500 {
2501 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2502
2503 //AP has only HT stations associated and at least one station is HT 20
2504 //disable protection from any non-HT devices.
2505 //decision for disabling protection from 11b has already been taken above.
2506 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2507 {
2508 //Disable protection from 11G station.
2509 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2510
2511 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2512 }
2513 //Disable protection from non-HT and HT20 devices.
2514 //decision for disabling protection from 11b has already been taken above.
2515 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2516 {
2517 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2518 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2519
2520 }
2521 }
2522 }
2523 }
2524
2525 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002526 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 (pBeaconStruct->HTInfo.present))
2528 {
2529 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2530 //Check for changes in protection related factors other than HT operating mode.
2531 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2532 if ( psessionEntry->beaconParams.fRIFSMode !=
2533 ( tANI_U8 ) htInfo.rifsMode )
2534 {
2535 pBeaconParams->fRIFSMode =
2536 psessionEntry->beaconParams.fRIFSMode =
2537 ( tANI_U8 ) htInfo.rifsMode;
2538 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2539 }
2540
2541 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2542 htInfo.nonGFDevicesPresent )
2543 {
2544 pBeaconParams->llnNonGFCoexist =
2545 psessionEntry->beaconParams.llnNonGFCoexist =
2546 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2547 pBeaconParams->paramChangeBitmap |=
2548 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2549 }
2550
2551 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2552 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2553 {
2554 pBeaconParams->fLsigTXOPProtectionFullSupport =
2555 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2556 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2557 pBeaconParams->paramChangeBitmap |=
2558 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2559 }
2560
2561 // For Station just update the global lim variable, no need to send message to HAL
2562 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2563 //stations in overlapping BSS.
2564 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2565 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2566
2567 }
2568}
2569
2570
2571/**
2572 * limProcessChannelSwitchTimeout()
2573 *
2574 *FUNCTION:
2575 * This function is invoked when Channel Switch Timer expires at
2576 * the STA. Now, STA must stop traffic, and then change/disable
2577 * primary or secondary channel.
2578 *
2579 *
2580 *NOTE:
2581 * @param pMac - Pointer to Global MAC structure
2582 * @return None
2583 */
2584void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2585{
2586 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002587 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002588
2589 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2590 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002591 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 return;
2593 }
2594
2595 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2596 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002597 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 -07002598 return;
2599 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002600 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302601
2602 /*
2603 * If Lim allows Switch channel on same channel on which preauth
2604 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2605 * during preauth rsp handling hence firmware may crash on ENTER/
2606 * EXIT BMPS request.
2607 */
2608 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2609 {
2610 limLog(pMac, LOGE,
2611 FL("Avoid Switch Channel req during pre auth"));
2612 return;
2613 }
2614
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 /*
2616 * This potentially can create issues if the function tries to set
2617 * channel while device is in power-save, hence putting an extra check
2618 * to verify if the device is in power-save or not
2619 */
2620 if(!limIsSystemInActiveState(pMac))
2621 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002622 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 return;
2624 }
2625
2626 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002627 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002628
2629 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002630 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002631
2632 /* Check if the AP is switching to a channel that we support.
2633 * Else, just don't bother to switch. Indicate HDD to look for a
2634 * better AP to associate
2635 */
2636 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2637 {
2638 /* We need to restore pre-channelSwitch state on the STA */
2639 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2640 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002641 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 return;
2643 }
2644
2645 /* If the channel-list that AP is asking us to switch is invalid,
2646 * then we cannot switch the channel. Just disassociate from AP.
2647 * We will find a better AP !!!
2648 */
2649 limTearDownLinkWithAp(pMac,
2650 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2651 eSIR_MAC_UNSPEC_FAILURE_REASON);
2652 return;
2653 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002654 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2655 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002656 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 {
2658 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002659 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2660 if ( isLimSessionOffChannel(pMac,
2661 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2662 {
Kanchanapally, Vidyullatha35570872015-03-18 17:26:57 +05302663 if (limIsLinkSuspended(pMac))
2664 {
2665 limLog(pMac, LOGE, FL("Link is already suspended for "
2666 "some other reason. Return here for sessionId:%d"),
2667 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2668 return;
2669 }
2670
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002671 limSuspendLink(pMac,
2672 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2673 limProcessChannelSwitchSuspendLink,
2674 (tANI_U32*)psessionEntry );
2675 }
2676 else
2677 {
2678 limProcessChannelSwitchSuspendLink(pMac,
2679 eHAL_STATUS_SUCCESS,
2680 (tANI_U32*)psessionEntry);
2681 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 break;
2683
2684 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002685 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002686 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002688 psessionEntry->gLimChannelSwitch.secondarySubBand);
2689 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 case eLIM_CHANNEL_SWITCH_IDLE:
2692 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002693 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2695 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002696 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002697 }
2698 return; /* Please note, this is 'return' and not 'break' */
2699 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002700}
Jeff Johnson295189b2012-06-20 16:38:30 -07002701
2702/**
2703 * limUpdateChannelSwitch()
2704 *
2705 *FUNCTION:
2706 * This function is invoked whenever Station receives
2707 * either 802.11h channel switch IE or airgo proprietary
2708 * channel switch IE.
2709 *
2710 *NOTE:
2711 * @param pMac - Pointer to Global MAC structure
2712 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2713 * @param psessionentry
2714 */
2715void
2716limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2717{
2718
2719 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2721 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002722#ifdef WLAN_FEATURE_11AC
2723 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2724#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002725
Jeff Johnsone7245742012-09-05 17:12:55 -07002726 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002727
2728 /* STA either received proprietary channel switch IE or 802.11h
2729 * standard channel switch IE.
2730 */
2731 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2732 {
2733 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2734
2735 /* Add logic to determine which change this is: */
2736 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002737 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2738 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2739 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2740 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2741 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002743 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 }
2745 else
2746 {
2747 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002748 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2749 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2750 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002752 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002753#ifdef WLAN_FEATURE_11AC
2754 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2755 if(pBeacon->WiderBWChanSwitchAnnPresent)
2756 {
2757 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2758 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2759 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2760 }
2761#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002762
2763 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002764 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2765 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002766
2767 /* Do not bother to look and operate on extended channel switch element
2768 * if our own channel-bonding state is not enabled
2769 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002770 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 {
2772 if (pBeacon->extChannelSwitchPresent)
2773 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002774 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2775 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002776 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002777 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2778 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002780#ifdef WLAN_FEATURE_11AC
2781 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2782 {
2783 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2784 {
2785 if(pBeacon->extChannelSwitchPresent)
2786 {
2787 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2788 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2789 {
2790 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2791 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2792 psessionEntry->gLimChannelSwitch.primaryChannel,
2793 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2794 pWiderChnlSwitch->newCenterChanFreq0,
2795 psessionEntry);
2796 }
2797 }
2798 }
2799 }
2800#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002801 }
2802 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002803 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002804
2805
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002808 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 }
2810
2811 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002812 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002813 psessionEntry->peSessionId,
2814 psessionEntry->gLimChannelSwitch.primaryChannel,
2815 psessionEntry->gLimChannelSwitch.secondarySubBand,
2816 psessionEntry->gLimChannelSwitch.switchCount,
2817 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 return;
2819}
2820
2821/**
2822 * limCancelDot11hChannelSwitch
2823 *
2824 *FUNCTION:
2825 * This function is called when STA does not send updated channel-swith IE
2826 * after indicating channel-switch start. This will cancel the channel-swith
2827 * timer which is already running.
2828 *
2829 *LOGIC:
2830 *
2831 *ASSUMPTIONS:
2832 *
2833 *NOTE:
2834 *
2835 * @param pMac - Pointer to Global MAC structure
2836 *
2837 * @return None
2838 */
2839void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2840{
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2842 return;
2843
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002844 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002845 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002846
2847 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2848 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002849 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 }
2851
2852 /* We need to restore pre-channelSwitch state on the STA */
2853 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2854 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002855 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002856
2857 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002858}
2859
2860/**----------------------------------------------
2861\fn limCancelDot11hQuiet
2862\brief Cancel the quieting on Station if latest
2863 beacon doesn't contain quiet IE in it.
2864
2865\param pMac
2866\return NONE
2867-----------------------------------------------*/
2868void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2869{
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2871 return;
2872
Jeff Johnsone7245742012-09-05 17:12:55 -07002873 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002875 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002878 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 }
2880 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002881 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002882 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002883 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2885 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002886 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 }
2888 /**
2889 * If the channel switch is already running in silent mode, dont resume the
2890 * transmission. Channel switch timer when timeout, transmission will be resumed.
2891 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002892 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2893 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 {
2895 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002896 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002897 }
2898 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002899 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002900}
2901
2902/**
2903 * limProcessQuietTimeout
2904 *
2905 * FUNCTION:
2906 * This function is active only on the STA.
2907 * Handles SIR_LIM_QUIET_TIMEOUT
2908 *
2909 * LOGIC:
2910 * This timeout can occur under only one circumstance:
2911 *
2912 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2913 * This indicates that the timeout "interval" has
2914 * expired. This is a trigger for the STA to now
2915 * shut-off Tx/Rx for the specified gLimQuietDuration
2916 * -> The TIMER object gLimQuietBssTimer is
2917 * activated
2918 * -> With timeout = gLimQuietDuration
2919 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2920 *
2921 * ASSUMPTIONS:
2922 * Using two TIMER objects -
2923 * gLimQuietTimer & gLimQuietBssTimer
2924 *
2925 * NOTE:
2926 *
2927 * @param pMac - Pointer to Global MAC structure
2928 *
2929 * @return None
2930 */
2931void limProcessQuietTimeout(tpAniSirGlobal pMac)
2932{
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 //fetch the sessionEntry based on the sessionId
2934 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002935 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002936
Jeff Johnsone7245742012-09-05 17:12:55 -07002937 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002939 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002940 return;
2941 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002942
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302943 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002944 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002945 {
2946 case eLIM_QUIET_BEGIN:
2947 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002948 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2949 if (TX_SUCCESS !=
2950 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2951 {
2952 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002953 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002954 }
2955
2956 // gLimQuietDuration appears to be in units of ticks
2957 // Use it as is
2958 if (TX_SUCCESS !=
2959 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2960 psessionEntry->gLimSpecMgmt.quietDuration,
2961 0))
2962 {
2963 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002964 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002965 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002966 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002967#ifdef GEN6_TODO
2968 /* revisit this piece of code to assign the appropriate sessionId below
2969 * priority - HIGH
2970 */
2971 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2972#endif
2973 if( TX_SUCCESS !=
2974 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2975 {
2976 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002977 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 }
2979 else
2980 {
2981 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002982 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002983
2984 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2985 /* print message, otherwise, stop data traffic and stay quiet */
2986 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2987 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2988 {
2989 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002990 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 }
2992 else
2993 {
2994 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2995 /* freeze the transmission */
2996 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2997
2998 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002999 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003000 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 }
3002 }
3003 break;
3004
3005 case eLIM_QUIET_RUNNING:
3006 case eLIM_QUIET_INIT:
3007 case eLIM_QUIET_END:
3008 default:
3009 //
3010 // As of now, nothing to be done
3011 //
3012 break;
3013 }
3014}
3015
3016/**
3017 * limProcessQuietBssTimeout
3018 *
3019 * FUNCTION:
3020 * This function is active on the AP and STA.
3021 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3022 *
3023 * LOGIC:
3024 * On the AP -
3025 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3026 * an indication for the AP to START sending out the
3027 * Quiet BSS IE.
3028 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3029 * the 11H spec
3030 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3031 * a Proprietary IE. This will be understood by all the
3032 * TITAN STA's
3033 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3034 * initiate the SCH to include the Quiet BSS IE in all
3035 * its subsequent Beacons/PR's.
3036 * The Quiet BSS IE will be included in all the Beacons
3037 * & PR's until the next DTIM period
3038 *
3039 * On the STA -
3040 * When gLimQuietState = eLIM_QUIET_RUNNING
3041 * This indicates that the STA was successfully shut-off
3042 * for the specified gLimQuietDuration. This is a trigger
3043 * for the STA to now resume data traffic.
3044 * -> gLimQuietState is set to eLIM_QUIET_INIT
3045 *
3046 * ASSUMPTIONS:
3047 *
3048 * NOTE:
3049 *
3050 * @param pMac - Pointer to Global MAC structure
3051 *
3052 * @return None
3053 */
3054void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3055{
Jeff Johnsone7245742012-09-05 17:12:55 -07003056 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003057
Jeff Johnsone7245742012-09-05 17:12:55 -07003058 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003060 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 return;
3062 }
3063
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303064 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003065 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 }
3068 else
3069 {
3070 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003071 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 {
3073 case eLIM_QUIET_RUNNING:
3074 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003075 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003076
3077 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3078 {
3079 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003080 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3081 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 {
3083 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003084 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
3086
3087 /* Reset status flag */
3088 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3089 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3090
3091 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003092 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 }
3094 else
3095 {
3096 //
3097 // Nothing specific to be done in this case
3098 // A background scan that was triggered during
3099 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3100 //
3101 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003102 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003103 }
3104 break;
3105
3106 case eLIM_QUIET_INIT:
3107 case eLIM_QUIET_BEGIN:
3108 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003109 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003110 /* If the quiet period has ended, then resume the frame transmission */
3111 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003112 limRestorePreQuietState(pMac, psessionEntry);
3113 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003114 break;
3115
3116 default:
3117 //
3118 // As of now, nothing to be done
3119 //
3120 break;
3121 }
3122 }
3123}
Jeff Johnson295189b2012-06-20 16:38:30 -07003124/**
3125 * limProcessWPSOverlapTimeout
3126 *
3127 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3128 *
3129 * LOGIC:
3130 *
3131 * ASSUMPTIONS:
3132 *
3133 * NOTE:
3134 *
3135 * @param pMac - Pointer to Global MAC structure
3136 *
3137 * @return None
3138 */
3139#if 0
3140void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3141{
3142
3143 tpPESession psessionEntry;
3144 tANI_U32 sessionId;
3145
3146 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3147 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003148 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003149 }
3150
3151 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3152
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003153 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003154
3155 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3156 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003157 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003158 return;
3159 }
3160
3161 limWPSPBCTimeout(pMac, psessionEntry);
3162}
3163#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003164
Jeff Johnson295189b2012-06-20 16:38:30 -07003165/**----------------------------------------------
3166\fn limStartQuietTimer
3167\brief Starts the quiet timer.
3168
3169\param pMac
3170\return NONE
3171-----------------------------------------------*/
3172void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3173{
3174 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303175 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003176
3177 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003178 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 return;
3180 }
3181
Jeff Johnson295189b2012-06-20 16:38:30 -07003182
3183 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3184 return;
3185 // First, de-activate Timer, if its already active
3186 limCancelDot11hQuiet(pMac, psessionEntry);
3187
Jeff Johnsone7245742012-09-05 17:12:55 -07003188 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3189 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3190 {
3191 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003192 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003193 }
3194
3195 // Set the NEW timeout value, in ticks
3196 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3197 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3198 {
3199 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003200 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003201 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003202
3203 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3204 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3205 {
3206 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003207 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003208 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003209
Jeff Johnsone7245742012-09-05 17:12:55 -07003210 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003211 return;
3212 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003213}
3214
Jeff Johnson295189b2012-06-20 16:38:30 -07003215
3216/** ------------------------------------------------------------------------ **/
3217/**
3218 * keep track of the number of ANI peers associated in the BSS
3219 * For the first and last ANI peer, we have to update EDCA params as needed
3220 *
3221 * When the first ANI peer joins the BSS, we notify SCH
3222 * When the last ANI peer leaves the BSS, we notfiy SCH
3223 */
3224void
3225limUtilCountStaAdd(
3226 tpAniSirGlobal pMac,
3227 tpDphHashNode pSta,
3228 tpPESession psessionEntry)
3229{
3230
3231 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3232 return;
3233
3234 pSta->fAniCount = 1;
3235
3236 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3237 return;
3238
3239 // get here only if this is the first ANI peer in the BSS
3240 schEdcaProfileUpdate(pMac, psessionEntry);
3241}
3242
3243void
3244limUtilCountStaDel(
3245 tpAniSirGlobal pMac,
3246 tpDphHashNode pSta,
3247 tpPESession psessionEntry)
3248{
3249
3250 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3251 return;
3252
3253 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3254 * then go ahead and update the count and profiles. This ensures
3255 * that the "number of ani station" count is properly incremented/decremented.
3256 */
3257 if (pSta->valid == 1)
3258 return;
3259
3260 pSta->fAniCount = 0;
3261
3262 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3263 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003264 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 pMac->lim.gLimNumOfAniSTAs);
3266 return;
3267 }
3268
3269 pMac->lim.gLimNumOfAniSTAs--;
3270
3271 if (pMac->lim.gLimNumOfAniSTAs != 0)
3272 return;
3273
3274 // get here only if this is the last ANI peer in the BSS
3275 schEdcaProfileUpdate(pMac, psessionEntry);
3276}
3277
Jeff Johnson295189b2012-06-20 16:38:30 -07003278/**
3279 * limSwitchChannelCback()
3280 *
3281 *FUNCTION:
3282 * This is the callback function registered while requesting to switch channel
3283 * after AP indicates a channel switch for spectrum management (11h).
3284 *
3285 *NOTE:
3286 * @param pMac Pointer to Global MAC structure
3287 * @param status Status of channel switch request
3288 * @param data User data
3289 * @param psessionEntry Session information
3290 * @return NONE
3291 */
3292void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3293 tANI_U32 *data, tpPESession psessionEntry)
3294{
3295 tSirMsgQ mmhMsg = {0};
3296 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3297
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3299
3300 /* We need to restore pre-channelSwitch state on the STA */
3301 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3302 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003303 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003304 return;
3305 }
3306
3307 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303308 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3309 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003311 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 return;
3313 }
3314
3315 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3316 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003317 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3319 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303320 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3322 mmhMsg.bodyval = 0;
3323
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303324 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3325 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003327}
3328
3329/**
3330 * limSwitchPrimaryChannel()
3331 *
3332 *FUNCTION:
3333 * This function changes the current operating channel
3334 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3335 *
3336 *NOTE:
3337 * @param pMac Pointer to Global MAC structure
3338 * @param newChannel new chnannel ID
3339 * @return NONE
3340 */
3341void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3342{
3343#if !defined WLAN_FEATURE_VOWIFI
3344 tANI_U32 localPwrConstraint;
3345#endif
3346
Abhishek Singh127a8442014-12-15 17:31:27 +05303347 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3348 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 psessionEntry->currentReqChannel = newChannel;
3350 psessionEntry->limRFBand = limGetRFBand(newChannel);
3351
3352 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3353
3354 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3355 pMac->lim.gpchangeChannelData = NULL;
3356
3357#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003358 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3360#else
3361 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3362 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003363 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003364 return;
3365 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003366 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3368#endif
3369 return;
3370}
3371
3372/**
3373 * limSwitchPrimarySecondaryChannel()
3374 *
3375 *FUNCTION:
3376 * This function changes the primary and secondary channel.
3377 * If 11h is enabled and user provides a "new channel ID"
3378 * that is different from the current operating channel,
3379 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3380 * assign notify LIM of such change.
3381 *
3382 *NOTE:
3383 * @param pMac Pointer to Global MAC structure
3384 * @param newChannel New chnannel ID (or current channel ID)
3385 * @param subband CB secondary info:
3386 * - eANI_CB_SECONDARY_NONE
3387 * - eANI_CB_SECONDARY_UP
3388 * - eANI_CB_SECONDARY_DOWN
3389 * @return NONE
3390 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003391void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003392{
3393#if !defined WLAN_FEATURE_VOWIFI
3394 tANI_U32 localPwrConstraint;
3395#endif
3396
Jeff Johnson295189b2012-06-20 16:38:30 -07003397#if !defined WLAN_FEATURE_VOWIFI
3398 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003399 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 return;
3401 }
3402#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303403 /* Assign the callback to resume TX once channel is changed.
3404 */
3405 psessionEntry->currentReqChannel = newChannel;
3406 psessionEntry->limRFBand = limGetRFBand(newChannel);
3407
3408 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3409
3410 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3411 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003412
Jeff Johnson295189b2012-06-20 16:38:30 -07003413#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003414 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003415#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003416 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003417#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003418
Jeff Johnsone7245742012-09-05 17:12:55 -07003419 // Store the new primary and secondary channel in session entries if different
3420 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 {
3422 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003423 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003425 psessionEntry->currentOperChannel = newChannel;
3426 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003427 if (psessionEntry->htSecondaryChannelOffset != subband)
3428 {
3429 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003430 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003431 psessionEntry->htSecondaryChannelOffset, subband);
3432 psessionEntry->htSecondaryChannelOffset = subband;
3433 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3434 {
3435 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3436 }
3437 else
3438 {
3439 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3440 }
3441 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3442 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003443
3444 return;
3445}
3446
3447
3448/**
3449 * limActiveScanAllowed()
3450 *
3451 *FUNCTION:
3452 * Checks if active scans are permitted on the given channel
3453 *
3454 *LOGIC:
3455 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3456 * Need to check if the channelNum matches, then depending on the corresponding
3457 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3458 *
3459 *ASSUMPTIONS:
3460 *
3461 *NOTE:
3462 *
3463 * @param pMac Pointer to Global MAC structure
3464 * @param channelNum channel number
3465 * @return None
3466 */
3467
3468tANI_U8 limActiveScanAllowed(
3469 tpAniSirGlobal pMac,
3470 tANI_U8 channelNum)
3471{
3472 tANI_U32 i;
3473 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3474 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3475 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3476 != eSIR_SUCCESS)
3477 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003478 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003479 return false;
3480 }
3481
3482 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003484 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 len);
3486 return false;
3487 }
3488
3489 for (i=0; (i+1) < len; i+=2)
3490 {
3491 if (channelPair[i] == channelNum)
3492 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3493 }
3494 return false;
3495}
3496
3497/**
3498 * limTriggerBackgroundScanDuringQuietBss()
3499 *
3500 *FUNCTION:
3501 * This function is applicable to the STA only.
3502 * This function is called by limProcessQuietTimeout(),
3503 * when it is time to honor the Quiet BSS IE from the AP.
3504 *
3505 *LOGIC:
3506 * If 11H is enabled:
3507 * We cannot trigger a background scan. The STA needs to
3508 * shut-off Tx/Rx.
3509 * If 11 is not enabled:
3510 * Determine if the next channel that we are going to
3511 * scan is NOT the same channel (or not) on which the
3512 * Quiet BSS was requested.
3513 * If yes, then we cannot trigger a background scan on
3514 * this channel. Return with a false.
3515 * If no, then trigger a background scan. Return with
3516 * a true.
3517 *
3518 *ASSUMPTIONS:
3519 *
3520 *NOTE:
3521 * This API is redundant if the existing API,
3522 * limTriggerBackgroundScan(), were to return a valid
3523 * response instead of returning void.
3524 * If possible, try to revisit this API
3525 *
3526 * @param pMac Pointer to Global MAC structure
3527 * @return eSIR_TRUE, if a background scan was attempted
3528 * eSIR_FALSE, if not
3529 */
3530tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3531{
3532 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003533
3534
3535
3536 //TBD-RAJESH HOW TO GET sessionEntry?????
3537 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3538
3539 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3540 return bScanTriggered;
3541
Jeff Johnsone7245742012-09-05 17:12:55 -07003542 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003543 {
3544 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3545 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3546
3547 // Determine the next scan channel
3548
3549 // Get background scan channel list from CFG
3550 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3551 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3552 (tANI_U8 *) bgScanChannelList,
3553 (tANI_U32 *) &len ))
3554 {
3555 // Ensure that we do not go off scanning on the same
3556 // channel on which the Quiet BSS was requested
3557 if( psessionEntry->currentOperChannel!=
3558 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3559 {
3560 // For now, try and attempt a background scan. It will
3561 // be ideal if this API actually returns a success or
3562 // failure instead of having a void return type
3563 limTriggerBackgroundScan( pMac );
3564
3565 bScanTriggered = eSIR_TRUE;
3566 }
3567 else
3568 {
3569 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003570 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 -07003571 }
3572 }
3573 else
3574 {
3575 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003576 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 -07003577 }
3578 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 return bScanTriggered;
3580}
3581
3582
3583/**
3584 * limGetHTCapability()
3585 *
3586 *FUNCTION:
3587 * A utility function that returns the "current HT capability state" for the HT
3588 * capability of interest (as requested in the API)
3589 *
3590 *LOGIC:
3591 * This routine will return with the "current" setting of a requested HT
3592 * capability. This state info could be retrieved from -
3593 * a) CFG (for static entries)
3594 * b) Run time info
3595 * - Dynamic state maintained by LIM
3596 * - Configured at radio init time by SME
3597 *
3598 *
3599 *ASSUMPTIONS:
3600 * NA
3601 *
3602 *NOTE:
3603 *
3604 * @param pMac Pointer to Global MAC structure
3605 * @param htCap The HT capability being queried
3606 * @return tANI_U8 The current state of the requested HT capability is returned in a
3607 * tANI_U8 variable
3608 */
3609
Jeff Johnson295189b2012-06-20 16:38:30 -07003610tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3611 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003612{
3613tANI_U8 retVal = 0;
3614tANI_U8 *ptr;
3615tANI_U32 cfgValue;
3616tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3617tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3618tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3619tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3620
3621 //
3622 // Determine which CFG to read from. Not ALL of the HT
3623 // related CFG's need to be read each time this API is
3624 // accessed
3625 //
3626 if( htCap >= eHT_ANTENNA_SELECTION &&
3627 htCap < eHT_SI_GRANULARITY )
3628 {
3629 // Get Antenna Seletion HT Capabilities
3630 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3631 cfgValue = 0;
3632 ptr = (tANI_U8 *) &macASCapabilityInfo;
3633 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3634 }
3635 else
3636 {
3637 if( htCap >= eHT_TX_BEAMFORMING &&
3638 htCap < eHT_ANTENNA_SELECTION )
3639 {
3640 // Get Transmit Beam Forming HT Capabilities
3641 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3642 cfgValue = 0;
3643 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3644 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3645 }
3646 else
3647 {
3648 if( htCap >= eHT_PCO &&
3649 htCap < eHT_TX_BEAMFORMING )
3650 {
3651 // Get Extended HT Capabilities
3652 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3653 cfgValue = 0;
3654 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3655 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3656 }
3657 else
3658 {
3659 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3660 {
3661 // Get HT Capabilities
3662 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3663 cfgValue = 0;
3664 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3665 // 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
3666 *ptr++ = cfgValue & 0xff;
3667 *ptr = (cfgValue >> 8) & 0xff;
3668 }
3669 }
3670 }
3671 }
3672
3673 switch( htCap )
3674 {
3675 case eHT_LSIG_TXOP_PROTECTION:
3676 retVal = pMac->lim.gHTLsigTXOPProtection;
3677 break;
3678
3679 case eHT_STBC_CONTROL_FRAME:
3680 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3681 break;
3682
3683 case eHT_PSMP:
3684 retVal = pMac->lim.gHTPSMPSupport;
3685 break;
3686
3687 case eHT_DSSS_CCK_MODE_40MHZ:
3688 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3689 break;
3690
3691 case eHT_MAX_AMSDU_LENGTH:
3692 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3693 break;
3694
3695 case eHT_DELAYED_BA:
3696 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3697 break;
3698
3699 case eHT_RX_STBC:
3700 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3701 break;
3702
3703 case eHT_TX_STBC:
3704 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3705 break;
3706
3707 case eHT_SHORT_GI_40MHZ:
3708 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3709 break;
3710
3711 case eHT_SHORT_GI_20MHZ:
3712 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3713 break;
3714
3715 case eHT_GREENFIELD:
3716 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3717 break;
3718
3719 case eHT_MIMO_POWER_SAVE:
3720 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3721 break;
3722
3723 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003724 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 break;
3726
3727 case eHT_ADVANCED_CODING:
3728 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3729 break;
3730
3731 case eHT_MAX_RX_AMPDU_FACTOR:
3732 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3733 break;
3734
3735 case eHT_MPDU_DENSITY:
3736 retVal = pMac->lim.gHTAMpduDensity;
3737 break;
3738
3739 case eHT_PCO:
3740 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3741 break;
3742
3743 case eHT_TRANSITION_TIME:
3744 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3745 break;
3746
3747 case eHT_MCS_FEEDBACK:
3748 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3749 break;
3750
3751 case eHT_TX_BEAMFORMING:
3752 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3753 break;
3754
3755 case eHT_ANTENNA_SELECTION:
3756 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3757 break;
3758
3759 case eHT_SI_GRANULARITY:
3760 retVal = pMac->lim.gHTServiceIntervalGranularity;
3761 break;
3762
3763 case eHT_CONTROLLED_ACCESS:
3764 retVal = pMac->lim.gHTControlledAccessOnly;
3765 break;
3766
3767 case eHT_RIFS_MODE:
3768 retVal = psessionEntry->beaconParams.fRIFSMode;
3769 break;
3770
3771 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003772 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 break;
3774
3775 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003776 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003777 break;
3778
3779 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3781 retVal = psessionEntry->htOperMode;
3782 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 retVal = pMac->lim.gHTOperMode;
3784 break;
3785
3786 case eHT_BASIC_STBC_MCS:
3787 retVal = pMac->lim.gHTSTBCBasicMCS;
3788 break;
3789
3790 case eHT_DUAL_CTS_PROTECTION:
3791 retVal = pMac->lim.gHTDualCTSProtection;
3792 break;
3793
3794 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3795 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3796 break;
3797
3798 case eHT_PCO_ACTIVE:
3799 retVal = pMac->lim.gHTPCOActive;
3800 break;
3801
3802 case eHT_PCO_PHASE:
3803 retVal = pMac->lim.gHTPCOPhase;
3804 break;
3805
3806 default:
3807 break;
3808 }
3809
3810 return retVal;
3811}
3812
Jeff Johnson295189b2012-06-20 16:38:30 -07003813void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3814{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303815 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 return;
3817}
3818
3819
3820
3821
3822/** -------------------------------------------------------------
3823\fn limEnable11aProtection
3824\brief based on config setting enables\disables 11a protection.
3825\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3826\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3827\param tpUpdateBeaconParams pBeaconParams
3828\return None
3829 -------------------------------------------------------------*/
3830tSirRetStatus
3831limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3832 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3833{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003834 if(NULL == psessionEntry)
3835 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003836 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003837 return eSIR_FAILURE;
3838 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 //overlapping protection configuration check.
3840 if(overlap)
3841 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 }
3843 else
3844 {
3845 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003846 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003847 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003848 {
3849 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003850 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 return eSIR_SUCCESS;
3852 }
3853 }
3854
3855 if (enable)
3856 {
3857 //If we are AP and HT capable, we need to set the HT OP mode
3858 //appropriately.
3859 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003860 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 {
3862 if(overlap)
3863 {
3864 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3865 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3866 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3867 {
3868 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3869 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3870 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3871 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3872 }
3873 }
3874 else
3875 {
3876 psessionEntry->gLim11aParams.protectionEnabled = true;
3877 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3878 {
3879 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003880 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3882 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3883
3884 }
3885 }
3886 }
3887
3888 //This part is common for staiton as well.
3889 if(false == psessionEntry->beaconParams.llaCoexist)
3890 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003891 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3893 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3894 }
3895 }
3896 else if (true == psessionEntry->beaconParams.llaCoexist)
3897 {
3898 //for AP role.
3899 //we need to take care of HT OP mode change if needed.
3900 //We need to take care of Overlap cases.
3901 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3902 {
3903 if(overlap)
3904 {
3905 //Overlap Legacy protection disabled.
3906 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3907
3908 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003909 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 {
3911 // no HT op mode change if any of the overlap protection enabled.
3912 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3913 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3914 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3915
3916 {
3917 //Check if there is a need to change HT OP mode.
3918 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3919 {
3920 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3921 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3922
3923 if(psessionEntry->gLimHt20Params.protectionEnabled)
3924 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3925 else
3926 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3927 }
3928 }
3929 }
3930 }
3931 else
3932 {
3933 //Disable protection from 11A stations.
3934 psessionEntry->gLim11aParams.protectionEnabled = false;
3935 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3936
3937 //Check if any other non-HT protection enabled.
3938 //Right now we are in HT OP Mixed mode.
3939 //Change HT op mode appropriately.
3940
3941 //Change HT OP mode to 01 if any overlap protection enabled
3942 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3943 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3944 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3945
3946 {
3947 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003948 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3950 }
3951 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3952 {
3953 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003954 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3956 }
3957 else
3958 {
3959 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003960 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3962 }
3963 }
3964 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3965 !psessionEntry->gLim11aParams.protectionEnabled)
3966 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003967 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003968 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3969 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3970 }
3971 }
3972 //for station role
3973 else
3974 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003975 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003976 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3977 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3978 }
3979 }
3980
3981 return eSIR_SUCCESS;
3982}
3983
3984/** -------------------------------------------------------------
3985\fn limEnable11gProtection
3986\brief based on config setting enables\disables 11g protection.
3987\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3988\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3989\param tpUpdateBeaconParams pBeaconParams
3990\return None
3991 -------------------------------------------------------------*/
3992
3993tSirRetStatus
3994limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3995 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3996{
3997
3998 //overlapping protection configuration check.
3999 if(overlap)
4000 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 }
4002 else
4003 {
4004 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4006 !psessionEntry->cfgProtection.fromllb)
4007 {
4008 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004009 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 return eSIR_SUCCESS;
4011 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004012 {
4013 if(!pMac->lim.cfgProtection.fromllb)
4014 {
4015 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004016 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 return eSIR_SUCCESS;
4018 }
4019 }
4020 }
4021
4022 if (enable)
4023 {
4024 //If we are AP and HT capable, we need to set the HT OP mode
4025 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4027 {
4028 if(overlap)
4029 {
4030 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004031 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004032 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 {
4034 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4035 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4036 {
4037 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4038 }
4039 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4040 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4041 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4042 //Not processing OBSS bit from other APs, as we are already taking care
4043 //of Protection from overlapping BSS based on erp IE or useProtection bit
4044 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4045 }
4046 }
4047 else
4048 {
4049 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004050 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004051 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 {
4053 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4054 {
4055 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4056 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4057 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4058 }
4059 }
4060 }
4061 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004062 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 {
4064 if(overlap)
4065 {
4066 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4067 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4068 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4069 {
4070 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4071 }
4072 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4073 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4074 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4075 //Not processing OBSS bit from other APs, as we are already taking care
4076 //of Protection from overlapping BSS based on erp IE or useProtection bit
4077 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4078 }
4079 else
4080 {
4081 psessionEntry->gLim11bParams.protectionEnabled = true;
4082 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4083 {
4084 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4085 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4086 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4087 }
4088 }
4089 }
4090
4091 //This part is common for staiton as well.
4092 if(false == psessionEntry->beaconParams.llbCoexist)
4093 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004094 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4096 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4097 }
4098 }
4099 else if (true == psessionEntry->beaconParams.llbCoexist)
4100 {
4101 //for AP role.
4102 //we need to take care of HT OP mode change if needed.
4103 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4105 {
4106 if(overlap)
4107 {
4108 //Overlap Legacy protection disabled.
4109 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4110
4111 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004112 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 {
4114 // no HT op mode change if any of the overlap protection enabled.
4115 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4116 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4117 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4118 {
4119 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004120 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 {
4122 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4123 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4124 if(psessionEntry->gLimHt20Params.protectionEnabled){
4125 //Commenting out beacuse of CR 258588 WFA cert
4126 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4127 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4128 }
4129 else
4130 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4131 }
4132 }
4133 }
4134 }
4135 else
4136 {
4137 //Disable protection from 11B stations.
4138 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004139 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 //Check if any other non-HT protection enabled.
4141 if(!psessionEntry->gLim11gParams.protectionEnabled)
4142 {
4143 //Right now we are in HT OP Mixed mode.
4144 //Change HT op mode appropriately.
4145 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4146
4147 //Change HT OP mode to 01 if any overlap protection enabled
4148 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4149 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4150 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4151 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4152 {
4153 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004154 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4156 }
4157 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4158 {
4159 //Commenting because of CR 258588 WFA cert
4160 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4161 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004162 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004163 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4164 }
4165 else
4166 {
4167 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4168 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4169 }
4170 }
4171 }
4172 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4173 !psessionEntry->gLim11bParams.protectionEnabled)
4174 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004175 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4177 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4178 }
4179 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 {
4181 if(overlap)
4182 {
4183 //Overlap Legacy protection disabled.
4184 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4185
4186 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004187 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 {
4189 // no HT op mode change if any of the overlap protection enabled.
4190 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4191 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4192 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4193
4194 {
4195 //Check if there is a need to change HT OP mode.
4196 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4197 {
4198 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4199 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4200 if(psessionEntry->gLimHt20Params.protectionEnabled)
4201 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4202 else
4203 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4204 }
4205 }
4206 }
4207 }
4208 else
4209 {
4210 //Disable protection from 11B stations.
4211 psessionEntry->gLim11bParams.protectionEnabled = false;
4212 //Check if any other non-HT protection enabled.
4213 if(!psessionEntry->gLim11gParams.protectionEnabled)
4214 {
4215 //Right now we are in HT OP Mixed mode.
4216 //Change HT op mode appropriately.
4217 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4218
4219 //Change HT OP mode to 01 if any overlap protection enabled
4220 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4221 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4222 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4223 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4224
4225 {
4226 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4227 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4228 }
4229 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4230 {
4231 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4232 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4233 }
4234 else
4235 {
4236 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4237 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4238 }
4239 }
4240 }
4241 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4242 !psessionEntry->gLim11bParams.protectionEnabled)
4243 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004244 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4246 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4247 }
4248 }
4249 //for station role
4250 else
4251 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004252 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4254 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4255 }
4256 }
4257 return eSIR_SUCCESS;
4258}
4259
4260/** -------------------------------------------------------------
4261\fn limEnableHtProtectionFrom11g
4262\brief based on cofig enables\disables protection from 11g.
4263\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4264\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4265\param tpUpdateBeaconParams pBeaconParams
4266\return None
4267 -------------------------------------------------------------*/
4268tSirRetStatus
4269limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4270 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4271{
Jeff Johnsone7245742012-09-05 17:12:55 -07004272 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4274
4275 //overlapping protection configuration check.
4276 if(overlap)
4277 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004278 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4279 {
4280 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004281 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 return eSIR_SUCCESS;
4283 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 {
4285 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004286 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 return eSIR_SUCCESS;
4288 }
4289 }
4290 else
4291 {
4292 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4294 !psessionEntry->cfgProtection.fromllg){
4295 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004296 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 return eSIR_SUCCESS;
4298 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 {
4300 if(!pMac->lim.cfgProtection.fromllg)
4301 {
4302 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004303 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 return eSIR_SUCCESS;
4305 }
4306 }
4307 }
4308 if (enable)
4309 {
4310 //If we are AP and HT capable, we need to set the HT OP mode
4311 //appropriately.
4312
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4314 {
4315 if(overlap)
4316 {
4317 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4318 //11g exists in overlap BSS.
4319 //need not to change the operating mode to overlap_legacy
4320 //if higher or same protection operating mode is enabled right now.
4321 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4322 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4323 {
4324 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4325 }
4326 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304327 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 }
4329 else
4330 {
4331 //11g is associated to an AP operating in 11n mode.
4332 //Change the HT operating mode to 'mixed mode'.
4333 psessionEntry->gLim11gParams.protectionEnabled = true;
4334 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4335 {
4336 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4337 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304338 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 }
4340 }
4341 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004342 {
4343 if(overlap)
4344 {
4345 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4346 //11g exists in overlap BSS.
4347 //need not to change the operating mode to overlap_legacy
4348 //if higher or same protection operating mode is enabled right now.
4349 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4350 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4351 {
4352 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4353 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4354 }
4355 }
4356 else
4357 {
4358 //11g is associated to an AP operating in 11n mode.
4359 //Change the HT operating mode to 'mixed mode'.
4360 psessionEntry->gLim11gParams.protectionEnabled = true;
4361 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4362 {
4363 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4364 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304365 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 }
4367 }
4368 }
4369
4370 //This part is common for staiton as well.
4371 if(false == psessionEntry->beaconParams.llgCoexist)
4372 {
4373 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4374 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4375 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4377 {
4378 // As operating mode changed after G station assoc some way to update beacon
4379 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4380 //pMac->sch.schObject.fBeaconChanged = 1;
4381 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4382 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 }
4384 else if (true == psessionEntry->beaconParams.llgCoexist)
4385 {
4386 //for AP role.
4387 //we need to take care of HT OP mode change if needed.
4388 //We need to take care of Overlap cases.
4389
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4391 {
4392 if(overlap)
4393 {
4394 //Overlap Legacy protection disabled.
4395 if (psessionEntry->gLim11gParams.numSta == 0)
4396 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4397
4398 // no HT op mode change if any of the overlap protection enabled.
4399 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4400 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4401 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4402 {
4403 //Check if there is a need to change HT OP mode.
4404 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4405 {
4406 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4407 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4408
4409 if(psessionEntry->gLimHt20Params.protectionEnabled){
4410 //Commenting because of CR 258588 WFA cert
4411 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4412 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4413 }
4414 else
4415 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4416 }
4417 }
4418 }
4419 else
4420 {
4421 //Disable protection from 11G stations.
4422 psessionEntry->gLim11gParams.protectionEnabled = false;
4423 //Check if any other non-HT protection enabled.
4424 if(!psessionEntry->gLim11bParams.protectionEnabled)
4425 {
4426
4427 //Right now we are in HT OP Mixed mode.
4428 //Change HT op mode appropriately.
4429 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4430
4431 //Change HT OP mode to 01 if any overlap protection enabled
4432 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4433 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4434 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4435 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4436
4437 {
4438 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4439 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4440 }
4441 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4442 {
4443 //Commenting because of CR 258588 WFA cert
4444 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4445 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4446 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4447 }
4448 else
4449 {
4450 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4451 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4452 }
4453 }
4454 }
4455 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4456 !psessionEntry->gLim11gParams.protectionEnabled)
4457 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004458 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4460 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4461 }
4462 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 {
4464 if(overlap)
4465 {
4466 //Overlap Legacy protection disabled.
4467 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4468
4469 // no HT op mode change if any of the overlap protection enabled.
4470 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4471 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4472 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4473 {
4474 //Check if there is a need to change HT OP mode.
4475 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4476 {
4477 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4478 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4479
4480 if(psessionEntry->gLimHt20Params.protectionEnabled)
4481 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4482 else
4483 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4484 }
4485 }
4486 }
4487 else
4488 {
4489 //Disable protection from 11G stations.
4490 psessionEntry->gLim11gParams.protectionEnabled = false;
4491 //Check if any other non-HT protection enabled.
4492 if(!psessionEntry->gLim11bParams.protectionEnabled)
4493 {
4494
4495 //Right now we are in HT OP Mixed mode.
4496 //Change HT op mode appropriately.
4497 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4498
4499 //Change HT OP mode to 01 if any overlap protection enabled
4500 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4501 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4502 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4503 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4504
4505 {
4506 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4507 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4508 }
4509 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4510 {
4511 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4512 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4513 }
4514 else
4515 {
4516 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4517 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4518 }
4519 }
4520 }
4521 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4522 !psessionEntry->gLim11gParams.protectionEnabled)
4523 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004524 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4526 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4527 }
4528 }
4529 //for station role
4530 else
4531 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004532 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4534 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4535 }
4536 }
4537 return eSIR_SUCCESS;
4538}
4539//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4540//This check will be done at the caller.
4541
4542/** -------------------------------------------------------------
4543\fn limEnableHtObssProtection
4544\brief based on cofig enables\disables obss protection.
4545\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4546\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4547\param tpUpdateBeaconParams pBeaconParams
4548\return None
4549 -------------------------------------------------------------*/
4550tSirRetStatus
4551limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4552 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4553{
4554
4555
Jeff Johnsone7245742012-09-05 17:12:55 -07004556 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004557 return eSIR_SUCCESS; // this protection is only for HT stations.
4558
4559 //overlapping protection configuration check.
4560 if(overlap)
4561 {
4562 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 }
4564 else
4565 {
4566 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4568 { //ToDo Update this field
4569 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004570 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 return eSIR_SUCCESS;
4572 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 {
4574 if(!pMac->lim.cfgProtection.obss)
4575 { //ToDo Update this field
4576 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004577 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 return eSIR_SUCCESS;
4579 }
4580 }
4581 }
4582
4583
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4585 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4586 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004587 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 psessionEntry->beaconParams.gHTObssMode = true;
4589 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4590
4591 }
4592 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4593 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004594 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 psessionEntry->beaconParams.gHTObssMode = false;
4596 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4597
4598 }
4599//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4600 if (!enable && !overlap)
4601 {
4602 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4603 }
4604 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 {
4606 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4607 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004608 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004609 psessionEntry->beaconParams.gHTObssMode = true;
4610 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4611
4612 }
4613 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4614 {
4615
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004616 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004617 psessionEntry->beaconParams.gHTObssMode = false;
4618 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4619
4620 }
4621 }
4622 return eSIR_SUCCESS;
4623}
4624/** -------------------------------------------------------------
4625\fn limEnableHT20Protection
4626\brief based on cofig enables\disables protection from Ht20.
4627\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4628\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4629\param tpUpdateBeaconParams pBeaconParams
4630\return None
4631 -------------------------------------------------------------*/
4632tSirRetStatus
4633limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4634 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4635{
Jeff Johnsone7245742012-09-05 17:12:55 -07004636 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004637 return eSIR_SUCCESS; // this protection is only for HT stations.
4638
4639 //overlapping protection configuration check.
4640 if(overlap)
4641 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 }
4643 else
4644 {
4645 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4647 !psessionEntry->cfgProtection.ht20)
4648 {
4649 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004650 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 return eSIR_SUCCESS;
4652 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 {
4654 if(!pMac->lim.cfgProtection.ht20)
4655 {
4656 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004657 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004658 return eSIR_SUCCESS;
4659 }
4660 }
4661 }
4662
4663 if (enable)
4664 {
4665 //If we are AP and HT capable, we need to set the HT OP mode
4666 //appropriately.
4667
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4669 if(overlap)
4670 {
4671 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4672 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4673 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4674 {
4675 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4676 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4677 }
4678 }
4679 else
4680 {
4681 psessionEntry->gLimHt20Params.protectionEnabled = true;
4682 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4683 {
4684 //Commenting because of CR 258588 WFA cert
4685 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4686 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4687 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4688 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4689 }
4690 }
4691 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 {
4693 if(overlap)
4694 {
4695 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4696 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4697 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4698 {
4699 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4700 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4701 }
4702 }
4703 else
4704 {
4705 psessionEntry->gLimHt20Params.protectionEnabled = true;
4706 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4707 {
4708 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4709 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4710 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4711 }
4712 }
4713 }
4714
4715 //This part is common for staiton as well.
4716 if(false == psessionEntry->beaconParams.ht20Coexist)
4717 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004718 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004719 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4720 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4721 }
4722 }
4723 else if (true == psessionEntry->beaconParams.ht20Coexist)
4724 {
4725 //for AP role.
4726 //we need to take care of HT OP mode change if needed.
4727 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004728 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4729 if(overlap)
4730 {
4731 //Overlap Legacy protection disabled.
4732 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4733
4734 // no HT op mode change if any of the overlap protection enabled.
4735 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4736 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4737 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4738 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4739 {
4740
4741 //Check if there is a need to change HT OP mode.
4742 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4743 {
4744 if(psessionEntry->gLimHt20Params.protectionEnabled)
4745 {
4746 //Commented beacuse of CR 258588 for WFA Cert
4747 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4748 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4749 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4750 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4751 }
4752 else
4753 {
4754 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4755 }
4756 }
4757 }
4758 }
4759 else
4760 {
4761 //Disable protection from 11G stations.
4762 psessionEntry->gLimHt20Params.protectionEnabled = false;
4763
4764 //Change HT op mode appropriately.
4765 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4766 {
4767 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4768 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4769 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4770 }
4771 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004772 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4774 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4775 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 {
4777 if(overlap)
4778 {
4779 //Overlap Legacy protection disabled.
4780 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4781
4782 // no HT op mode change if any of the overlap protection enabled.
4783 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4784 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4785 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4786 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4787 {
4788
4789 //Check if there is a need to change HT OP mode.
4790 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4791 {
4792 if(psessionEntry->gLimHt20Params.protectionEnabled)
4793 {
4794 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4795 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4796 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4797 }
4798 else
4799 {
4800 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4801 }
4802 }
4803 }
4804 }
4805 else
4806 {
4807 //Disable protection from 11G stations.
4808 psessionEntry->gLimHt20Params.protectionEnabled = false;
4809
4810 //Change HT op mode appropriately.
4811 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4812 {
4813 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4814 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4815 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4816 }
4817 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004818 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004819 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4820 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4821 }
4822 //for station role
4823 else
4824 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004825 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004826 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4827 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4828 }
4829 }
4830
4831 return eSIR_SUCCESS;
4832}
4833
4834/** -------------------------------------------------------------
4835\fn limEnableHTNonGfProtection
4836\brief based on cofig enables\disables protection from NonGf.
4837\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4838\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4839\param tpUpdateBeaconParams pBeaconParams
4840\return None
4841 -------------------------------------------------------------*/
4842tSirRetStatus
4843limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4844 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4845{
Jeff Johnsone7245742012-09-05 17:12:55 -07004846 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 return eSIR_SUCCESS; // this protection is only for HT stations.
4848
4849 //overlapping protection configuration check.
4850 if(overlap)
4851 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 }
4853 else
4854 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 //normal protection config check
4856 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4857 !psessionEntry->cfgProtection.nonGf)
4858 {
4859 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004860 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 return eSIR_SUCCESS;
4862 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 {
4864 //normal protection config check
4865 if(!pMac->lim.cfgProtection.nonGf)
4866 {
4867 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004868 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 return eSIR_SUCCESS;
4870 }
4871 }
4872 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004873 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4874 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4875 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004876 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4878 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4879 }
4880 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004882 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4884 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4885 }
4886 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 {
4888 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004890 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4892 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4893 }
4894 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4895 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004896 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4898 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4899 }
4900 }
4901
4902 return eSIR_SUCCESS;
4903}
4904
4905/** -------------------------------------------------------------
4906\fn limEnableHTLsigTxopProtection
4907\brief based on cofig enables\disables LsigTxop protection.
4908\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4909\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4910\param tpUpdateBeaconParams pBeaconParams
4911\return None
4912 -------------------------------------------------------------*/
4913tSirRetStatus
4914limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4915 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4916{
Jeff Johnsone7245742012-09-05 17:12:55 -07004917 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 return eSIR_SUCCESS; // this protection is only for HT stations.
4919
4920 //overlapping protection configuration check.
4921 if(overlap)
4922 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004923 }
4924 else
4925 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 //normal protection config check
4927 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4928 !psessionEntry->cfgProtection.lsigTxop)
4929 {
4930 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004931 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 return eSIR_SUCCESS;
4933 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 {
4935 //normal protection config check
4936 if(!pMac->lim.cfgProtection.lsigTxop)
4937 {
4938 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004939 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004940 return eSIR_SUCCESS;
4941 }
4942 }
4943 }
4944
4945
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4947 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4948 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004949 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4951 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4952 }
4953 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4954 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004955 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004956 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4957 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4958 }
4959 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004960 {
4961 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4962 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004963 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4965 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4966 }
4967 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4968 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004969 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4971 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4972 }
4973 }
4974 return eSIR_SUCCESS;
4975}
4976//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4977//This check will be done at the caller.
4978/** -------------------------------------------------------------
4979\fn limEnableHtRifsProtection
4980\brief based on cofig enables\disables Rifs protection.
4981\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4982\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4983\param tpUpdateBeaconParams pBeaconParams
4984\return None
4985 -------------------------------------------------------------*/
4986tSirRetStatus
4987limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4988 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4989{
Jeff Johnsone7245742012-09-05 17:12:55 -07004990 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 return eSIR_SUCCESS; // this protection is only for HT stations.
4992
4993
4994 //overlapping protection configuration check.
4995 if(overlap)
4996 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004997 }
4998 else
4999 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005000 //normal protection config check
5001 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5002 !psessionEntry->cfgProtection.rifs)
5003 {
5004 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005005 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005006 return eSIR_SUCCESS;
5007 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 {
5009 //normal protection config check
5010 if(!pMac->lim.cfgProtection.rifs)
5011 {
5012 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005013 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005014 return eSIR_SUCCESS;
5015 }
5016 }
5017 }
5018
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5020 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5021 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5022 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005023 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005024 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5025 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5026 }
5027 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5028 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5029 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005030 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5032 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5033 }
5034 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 {
5036 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5037 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5038 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005039 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005040 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5041 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5042 }
5043 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5044 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5045 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005046 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5048 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5049 }
5050 }
5051 return eSIR_SUCCESS;
5052}
5053
5054// ---------------------------------------------------------------------
5055/**
5056 * limEnableShortPreamble
5057 *
5058 * FUNCTION:
5059 * Enable/Disable short preamble
5060 *
5061 * LOGIC:
5062 *
5063 * ASSUMPTIONS:
5064 *
5065 * NOTE:
5066 *
5067 * @param enable Flag to enable/disable short preamble
5068 * @return None
5069 */
5070
5071tSirRetStatus
5072limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5073{
5074 tANI_U32 val;
5075
5076 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5077 {
5078 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005079 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005080 return eSIR_FAILURE;
5081 }
5082
5083 if (!val)
5084 return eSIR_SUCCESS;
5085
5086 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5087 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005088 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005089 return eSIR_FAILURE;
5090 }
5091
5092 if (!val) // 11G short preamble switching is disabled.
5093 return eSIR_SUCCESS;
5094
5095 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5096 {
5097 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5098 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005099 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 psessionEntry->beaconParams.fShortPreamble = true;
5101 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5102 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5103 }
5104 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005106 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005107 psessionEntry->beaconParams.fShortPreamble = false;
5108 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5109 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5110 }
5111 }
5112
5113 return eSIR_SUCCESS;
5114 }
5115
5116/**
5117 * limTxComplete
5118 *
5119 * Function:
5120 * This is LIM's very own "TX MGMT frame complete" completion routine.
5121 *
5122 * Logic:
5123 * LIM wants to send a MGMT frame (broadcast or unicast)
5124 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5125 * LIM transmits the MGMT frame using the API:
5126 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5127 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5128 * HDD, if it determines that a TX completion routine (in this case
5129 * limTxComplete) has been provided, will invoke this callback
5130 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5131 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5132 *
5133 * Assumptions:
5134 * Presently, this is ONLY being used for MGMT frames/packets
5135 * TODO:
5136 * Would it do good for LIM to have some sort of "signature" validation to
5137 * ensure that the pData argument passed in was a buffer that was actually
5138 * allocated by LIM and/or is not corrupted?
5139 *
5140 * Note: FIXME and TODO
5141 * Looks like palPktFree() is interested in pPacket. But, when this completion
5142 * routine is called, only pData is made available to LIM!!
5143 *
5144 * @param void A pointer to pData. Shouldn't it be pPacket?!
5145 *
5146 * @return none
5147 */
5148void limTxComplete( tHalHandle hHal, void *pData )
5149{
5150 tpAniSirGlobal pMac;
5151 pMac = (tpAniSirGlobal)hHal;
5152
5153#ifdef FIXME_PRIMA
5154 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5155#ifdef TRACE_RECORD
5156 {
5157 tpSirMacMgmtHdr mHdr;
5158 v_U8_t *pRxBd;
5159 vos_pkt_t *pVosPkt;
5160 VOS_STATUS vosStatus;
5161
5162
5163
5164 pVosPkt = (vos_pkt_t *)pData;
5165 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5166
5167 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5168 {
5169 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005170
5171 }
5172 }
5173#endif
5174#endif
5175
5176 palPktFree( pMac->hHdd,
5177 HAL_TXRX_FRM_802_11_MGMT,
5178 (void *) NULL, // this is ignored and will likely be removed from this API
5179 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5180}
5181
5182/**
5183 * \brief This function updates lim global structure, if CB parameters in the BSS
5184 * have changed, and sends an indication to HAL also with the
5185 * updated HT Parameters.
5186 * This function does not detect the change in the primary channel, that is done as part
5187 * of channel Swtich IE processing.
5188 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5189 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5190 *
5191 *
5192 * \param pMac Pointer to global MAC structure
5193 *
5194 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5195 * Probe Response
5196 *
5197 * \param bssIdx BSS Index of the Bss to which Station is associated.
5198 *
5199 *
5200 */
5201
5202void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5203 tDot11fIEHTInfo *pHTInfo,
5204 tANI_U8 bssIdx,
5205 tpPESession psessionEntry)
5206{
Jeff Johnsone7245742012-09-05 17:12:55 -07005207 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005208#if !defined WLAN_FEATURE_VOWIFI
5209 tANI_U32 localPwrConstraint;
5210#endif
5211
5212 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005214 return;
5215
5216#if !defined WLAN_FEATURE_VOWIFI
5217 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005218 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005219 return;
5220 }
5221#endif
5222
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305223 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5224 {
5225 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5226 return;
5227 }
5228
Mihir Shetebc160b72014-08-22 14:10:39 +05305229 /*
5230 * Do not try to switch channel if RoC is in progress. RoC code path uses
5231 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5232 * has started listening on the channel requested as part of RoC, if we set
5233 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5234 * upper layers will think that the channel change is not successful and the
5235 * RoC from the upper layer perspective will never end...
5236 */
5237 if (pMac->lim.gpLimRemainOnChanReq)
5238 {
5239 limLog( pMac, LOGE, FL( "RoC is in progress"));
5240 return;
5241 }
5242
Jeff Johnsone7245742012-09-05 17:12:55 -07005243 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5244 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005245 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005246 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5247 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5248 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5249 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005250
5251 // Notify HAL
5252 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005253 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005255 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005256 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005257 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005258 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5259 pMac->lim.gpchangeChannelCallback = NULL;
5260 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005261
5262#if defined WLAN_FEATURE_VOWIFI
5263 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5264 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5265#else
5266 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5267 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5268#endif
5269
5270 //In case of IBSS, if STA should update HT Info IE in its beacons.
5271 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5272 {
5273 schSetFixedBeaconFields(pMac,psessionEntry);
5274 }
5275
5276 }
5277} // End limUpdateStaRunTimeHTParams.
5278
5279/**
5280 * \brief This function updates the lim global structure, if any of the
5281 * HT Capabilities have changed.
5282 *
5283 *
5284 * \param pMac Pointer to Global MAC structure
5285 *
5286 * \param pHTCapability Pointer to HT Capability Information Element
5287 * obtained from a Beacon or Probe Response
5288 *
5289 *
5290 *
5291 */
5292
5293void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5294 tDot11fIEHTCaps *pHTCaps )
5295{
5296
5297 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5298 {
5299 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5300 // Send change notification to HAL
5301 }
5302
5303 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5304 {
5305 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5306 // Send change notification to HAL
5307 }
5308
5309 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5310 {
5311 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5312 // Send change notification to HAL
5313 }
5314
5315
5316} // End limUpdateStaRunTimeHTCapability.
5317
5318/**
5319 * \brief This function updates lim global structure, if any of the HT
5320 * Info Parameters have changed.
5321 *
5322 *
5323 * \param pMac Pointer to the global MAC structure
5324 *
5325 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5326 * Probe Response
5327 *
5328 *
5329 */
5330
5331void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305332 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005333{
Jeff Johnsone7245742012-09-05 17:12:55 -07005334 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005335 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005336 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005337 // Send change notification to HAL
5338 }
5339
5340 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5341 {
5342 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5343 // Send change notification to HAL
5344 }
5345
5346 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5347 {
5348 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5349 // Send change notification to HAL
5350 }
5351
5352 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5353 {
5354 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5355 // Send change notification to HAL
5356 }
5357
5358 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5359 {
5360 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5361 }
5362
5363 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5364 {
5365 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5366 // Send change notification to HAL
5367 }
5368
5369 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5370 {
5371 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5372 // Send change notification to HAL
5373 }
5374
5375 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5376 {
5377 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5378 // Send change notification to HAL
5379 }
5380
5381 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5382 {
5383 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5384 // Send change notification to HAL
5385 }
5386
5387 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5388 {
5389 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5390 // Send change notification to HAL
5391 }
5392
5393 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5394 {
5395 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5396 // Send change notification to HAL
5397 }
5398
5399} // End limUpdateStaRunTimeHTInfo.
5400
5401
5402/** -------------------------------------------------------------
5403\fn limProcessHalIndMessages
5404\brief callback function for HAL indication
5405\param tpAniSirGlobal pMac
5406\param tANI_U32 mesgId
5407\param void *mesgParam
5408\return tSirRetStatu - status
5409 -------------------------------------------------------------*/
5410
5411tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5412{
5413 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5414 tSirMsgQ msg;
5415
5416 switch(msgId)
5417 {
5418 case SIR_LIM_DEL_TS_IND:
5419 case SIR_LIM_ADD_BA_IND:
5420 case SIR_LIM_DEL_BA_ALL_IND:
5421 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5422 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305423 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005424 msg.type = (tANI_U16) msgId;
5425 msg.bodyptr = msgParam;
5426 msg.bodyval = 0;
5427 break;
5428
5429 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305430 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005431 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005432 return eSIR_FAILURE;
5433 }
5434
5435 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5436 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305437 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5439 return eSIR_FAILURE;
5440 }
5441 return eSIR_SUCCESS;
5442}
5443
5444/** -------------------------------------------------------------
5445\fn limValidateDeltsReq
5446\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5447\param tpAniSirGlobal pMac
5448\param tpSirDeltsReq pDeltsReq
5449\param tSirMacAddr peerMacAddr
5450\return eSirRetStatus - status
5451 -------------------------------------------------------------*/
5452
5453tSirRetStatus
5454limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5455{
5456 tpDphHashNode pSta;
5457 tANI_U8 tsStatus;
5458 tSirMacTSInfo *tsinfo;
5459 tANI_U32 i;
5460 tANI_U8 tspecIdx;
5461 /* if sta
5462 * - verify assoc state
5463 * - del tspec locally
5464 * if ap,
5465 * - verify sta is in assoc state
5466 * - del sta tspec locally
5467 */
5468 if(pDeltsReq == NULL)
5469 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005470 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005471 return eSIR_FAILURE;
5472 }
5473
5474 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5475 {
5476 tANI_U32 val;
5477
5478 // station always talks to the AP
5479 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5480
5481 val = sizeof(tSirMacAddr);
5482 #if 0
5483 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5484 {
5485 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005486 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005487 return eSIR_FAILURE;
5488 }
5489 #endif// TO SUPPORT BT-AMP
5490 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5491
5492 }
5493 else
5494 {
5495 tANI_U16 assocId;
5496 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5497
5498 assocId = pDeltsReq->aid;
5499 if (assocId != 0)
5500 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5501 else
5502 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5503
5504 if (pSta != NULL)
5505 // TBD: check sta assoc state as well
5506 for (i =0; i < sizeof(tSirMacAddr); i++)
5507 macaddr[i] = pSta->staAddr[i];
5508 }
5509
5510 if (pSta == NULL)
5511 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005512 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005513 return eSIR_FAILURE;
5514 }
5515
5516 if ((! pSta->valid) ||
5517 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5518 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005519 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 return eSIR_FAILURE;
5521 }
5522
5523 pDeltsReq->req.wsmTspecPresent = 0;
5524 pDeltsReq->req.wmeTspecPresent = 0;
5525 pDeltsReq->req.lleTspecPresent = 0;
5526
5527 if ((pSta->wsmEnabled) &&
5528 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5529 pDeltsReq->req.wsmTspecPresent = 1;
5530 else if (pSta->wmeEnabled)
5531 pDeltsReq->req.wmeTspecPresent = 1;
5532 else if (pSta->lleEnabled)
5533 pDeltsReq->req.lleTspecPresent = 1;
5534 else
5535 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005536 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005537 return eSIR_FAILURE;
5538 }
5539
5540 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5541 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305542 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005543 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005544 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305545 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005546
5547 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005548
5549 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5550 != eSIR_SUCCESS)
5551 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005552 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5554 return eSIR_FAILURE;
5555 }
5556 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5557 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5558 {
5559 //edca only now.
5560 }
5561 else
5562 {
5563 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5564 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5565 {
5566 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305567 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5568 pSta->staIndex,
5569 tspecIdx,
5570 pDeltsReq->req,
5571 psessionEntry->peSessionId,
5572 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005573 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005574 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 tsinfo->traffic.userPrio);
5576 return eSIR_FAILURE;
5577 }
5578 }
5579 }
5580 return eSIR_SUCCESS;
5581}
5582
5583/** -------------------------------------------------------------
5584\fn limRegisterHalIndCallBack
5585\brief registers callback function to HAL for any indication.
5586\param tpAniSirGlobal pMac
5587\return none.
5588 -------------------------------------------------------------*/
5589void
5590limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5591{
5592 tSirMsgQ msg;
5593 tpHalIndCB pHalCB;
5594
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305595 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5596 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005597 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305598 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005599 return;
5600 }
5601
5602 pHalCB->pHalIndCB = limProcessHalIndMessages;
5603
5604 msg.type = WDA_REGISTER_PE_CALLBACK;
5605 msg.bodyptr = pHalCB;
5606 msg.bodyval = 0;
5607
Jeff Johnsone7245742012-09-05 17:12:55 -07005608 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005609 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5610 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305611 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005612 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005613 }
5614
5615 return;
5616}
5617
5618
5619/** -------------------------------------------------------------
5620\fn limProcessAddBaInd
5621
5622\brief handles the BA activity check timeout indication coming from HAL.
5623 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5624\param tpAniSirGlobal pMac
5625\param tSirMsgQ limMsg
5626\return None
5627-------------------------------------------------------------*/
5628void
5629limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5630{
5631 tANI_U8 i;
5632 tANI_U8 tid;
5633 tANI_U16 assocId;
5634 tpDphHashNode pSta;
5635 tpAddBaCandidate pBaCandidate;
5636 tANI_U32 baCandidateCnt;
5637 tpBaActivityInd pBaActivityInd;
5638 tpPESession psessionEntry;
5639 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005640#ifdef FEATURE_WLAN_TDLS
5641 boolean htCapable = FALSE;
5642#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005643
5644
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005645 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005646 return;
5647
5648 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5649 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5650
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005651 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005652 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005653 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305654 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005655 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 return;
5657 }
5658
5659 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005660#ifdef FEATURE_WLAN_TDLS
5661 if ((baCandidateCnt > pMac->lim.maxStation))
5662#else
5663 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5664#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005665 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305666 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005667 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005668 return;
5669 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005670
5671#ifdef FEATURE_WLAN_TDLS
5672 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5673 //AP capability
5674 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5675
5676 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5677 {
5678 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5679 if ((NULL == pSta) || (!pSta->valid))
5680 continue;
5681
5682 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5683 htCapable = pSta->mlmStaContext.htCapability;
5684 else
5685 htCapable = psessionEntry->htCapability;
5686
5687 if (htCapable)
5688 break;
5689 }
5690 if (!htCapable)
5691 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305692 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005693 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005694 return;
5695 }
5696#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005697
5698 //delete the complete dialoguetoken linked list
5699 limDeleteDialogueTokenList(pMac);
5700 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5701
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005702 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 {
5704 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005705 if ((NULL == pSta) || (!pSta->valid))
5706 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005707
5708 for (tid=0; tid<STACFG_MAX_TC; tid++)
5709 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005710 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005711 (pBaCandidate->baInfo[tid].fBaEnable))
5712 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005713 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5714 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005715 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5716 }
5717 }
5718 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305719 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005720 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005721 return;
5722}
5723
5724
5725/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005726\fn limDeleteBASessions
5727\brief Deletes all the exisitng BA sessions for given session
5728 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005729\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005730\param tpPESession pSessionEntry
5731\param tANI_U32 baDirection
5732\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005733-------------------------------------------------------------*/
5734
5735void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005736limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305737 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005738{
5739 tANI_U32 i;
5740 tANI_U8 tid;
5741 tpDphHashNode pSta;
5742
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005744 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 limLog(pMac, LOGE, FL("Session does not exist"));
5746 }
5747 else
5748 {
5749 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005750 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005751 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5752 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5753 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5754 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005755 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005756 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005758 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5759 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005760 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005761 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5762 (baDirection & BA_INITIATOR))
5763 {
5764 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305765 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005766 pSessionEntry);
5767 }
5768 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5769 (baDirection & BA_RECIPIENT))
5770 {
5771 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305772 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005773 pSessionEntry);
5774 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005775 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005776 }
5777 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005778 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5779 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5780 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005781 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005782 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5783 &pSessionEntry->dph.dphHashTable);
5784 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005785 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005786 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5787 (baDirection & BA_INITIATOR))
5788 {
5789 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305790 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005791 pSessionEntry);
5792 }
5793 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5794 (baDirection & BA_RECIPIENT))
5795 {
5796 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305797 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005798 pSessionEntry);
5799 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005800 }
5801 }
5802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005803 }
5804}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005805
5806/** -------------------------------------------------------------
5807\fn limDelAllBASessions
5808\brief Deletes all the exisitng BA sessions.
5809\param tpAniSirGlobal pMac
5810\return None
5811-------------------------------------------------------------*/
5812
5813void limDelAllBASessions(tpAniSirGlobal pMac)
5814{
5815 tANI_U32 i;
5816 tpPESession pSessionEntry;
5817
5818 for (i = 0; i < pMac->lim.maxBssId; i++)
5819 {
5820 pSessionEntry = peFindSessionBySessionId(pMac, i);
5821 if (pSessionEntry)
5822 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305823 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5824 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005825 }
5826 }
5827}
5828
5829/** -------------------------------------------------------------
5830\fn limDelAllBASessionsBtc
5831\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5832 band.
5833\param tpAniSirGlobal pMac
5834\return None
5835-------------------------------------------------------------*/
5836
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005837void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005838{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005839 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005840 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005841 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5842 &sessionId);
5843 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005844 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005845 PELOGW(limLog(pMac, LOGW,
5846 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305847 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305848 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005849 }
5850}
5851
Jeff Johnson295189b2012-06-20 16:38:30 -07005852/** -------------------------------------------------------------
5853\fn limProcessDelTsInd
5854\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5855 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5856\param tpAniSirGlobal pMac
5857\param tSirMsgQ limMsg
5858\return None
5859-------------------------------------------------------------*/
5860void
5861limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5862{
5863 tpDphHashNode pSta;
5864 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5865 tpSirDeltsReq pDelTsReq = NULL;
5866 tSirMacAddr peerMacAddr;
5867 tpSirDeltsReqInfo pDelTsReqInfo;
5868 tpLimTspecInfo pTspecInfo;
5869 tpPESession psessionEntry;
5870 tANI_U8 sessionId;
5871
5872if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005874 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305875 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005876 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005877 return;
5878 }
5879
5880 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5881 if(pTspecInfo->inuse == false)
5882 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005883 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005884 goto error1;
5885 }
5886
5887 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5888 if(pSta == NULL)
5889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005890 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005891 pTspecInfo->assocId);
5892 goto error1;
5893 }
5894
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305895 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5896 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305898 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005899 goto error1;
5900 }
5901
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305902 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005903
5904 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305905 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005906 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305907 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005908
5909
5910 //validate the req
5911 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5912 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005913 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005914 goto error2;
5915 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305916 limLog(pMac, LOG1, "Sent DELTS request to station with "
5917 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5918 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005919
5920 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5921 psessionEntry);
5922
5923 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305924 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5925 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005926 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305927 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005928 goto error3;
5929 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305930 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005931
5932 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305933 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305935 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005936
5937 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5938
5939error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305940 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005941error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305942 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005943error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305944 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005945 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005946 return;
5947}
5948
5949/**
5950 * \brief Setup an A-MPDU/BA session
5951 *
5952 * \sa limPostMlmAddBAReq
5953 *
5954 * \param pMac The global tpAniSirGlobal object
5955 *
5956 * \param pStaDs DPH Hash Node object of peer STA
5957 *
5958 * \param tid TID for which a BA is being setup.
5959 * If this is set to 0xFFFF, then we retrieve
5960 * the default TID from the CFG
5961 *
5962 * \return eSIR_SUCCESS if setup completes successfully
5963 * eSIR_FAILURE is some problem is encountered
5964 */
5965tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5966 tpDphHashNode pStaDs,
5967 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5968{
5969 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005970 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005971 tpDialogueToken dialogueTokenNode;
5972 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005973
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 // Check if the peer is a 11n capable STA
5975 // FIXME - Need a 11n peer indication in DPH.
5976 // For now, using the taurusPeer attribute
5977 //if( 0 == pStaDs->taurusPeer == )
5978 //return eSIR_SUCCESS;
5979
5980 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305981 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5982 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005983 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305984 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005985 status = eSIR_MEM_ALLOC_FAILED;
5986 goto returnFailure;
5987 }
5988
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305989 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005990
5991 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305992 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005993 pMlmAddBAReq->peerMacAddr,
5994 pStaDs->staAddr,
5995 sizeof( tSirMacAddr ));
5996
5997 // Update the TID
5998 pMlmAddBAReq->baTID = tid;
5999
6000 // Determine the supported BA policy of local STA
6001 // for the TID of interest
6002 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6003
6004 // BA Buffer Size
6005 // Requesting the ADDBA recipient to populate the size.
6006 // If ADDBA is accepted, a non-zero buffer size should
6007 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306008 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6009 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6010 {
6011 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6012 causing very low throughput in HT40 case */
6013 limLog( pMac, LOGW,
6014 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6015 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6016 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306017 else if (pMac->miracastVendorConfig)
6018 {
6019 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6020 {
6021 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6022 status = eSIR_FAILURE;
6023 goto returnFailure;
6024 }
6025
6026 pMlmAddBAReq->baBufferSize = val;
6027 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306028 else
6029 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006030
6031 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306032 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d buff = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006033 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6034 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306035 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006036
6037 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006038 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006039 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006040 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006041 status = eSIR_FAILURE;
6042 goto returnFailure;
6043 }
6044 pMlmAddBAReq->baTimeout = val; // In TU's
6045
6046 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006047 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006048 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6049 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6050
6051 // BA Starting Sequence Number
6052 pMlmAddBAReq->baSSN = startingSeqNum;
6053
6054 /* Update PE session Id*/
6055 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6056
6057 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6058
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006059 dialogueTokenNode = limAssignDialogueToken(pMac);
6060 if (NULL == dialogueTokenNode)
6061 {
6062 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6063 status = eSIR_FAILURE;
6064 goto returnFailure;
6065 }
6066
Jeff Johnson295189b2012-06-20 16:38:30 -07006067 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006068 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006069 dialogueTokenNode->assocId = pStaDs->assocId;
6070 dialogueTokenNode->tid = tid;
6071 // Send ADDBA Req to MLME
6072 limPostMlmMessage( pMac,
6073 LIM_MLM_ADDBA_REQ,
6074 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006075 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006076
6077returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306078 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006079 return status;
6080}
6081
6082/**
6083 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6084 * will then send an ADDBA Rsp to peer MAC entity
6085 * with the appropriate ADDBA status code
6086 *
6087 * \sa limPostMlmAddBARsp
6088 *
6089 * \param pMac The global tpAniSirGlobal object
6090 *
6091 * \param peerMacAddr MAC address of peer entity that will
6092 * be the recipient of this ADDBA Rsp
6093 *
6094 * \param baStatusCode ADDBA Rsp status code
6095 *
6096 * \param baDialogToken ADDBA Rsp dialog token
6097 *
6098 * \param baTID TID of interest
6099 *
6100 * \param baPolicy The BA policy
6101 *
6102 * \param baBufferSize The BA buffer size
6103 *
6104 * \param baTimeout BA timeout in TU's
6105 *
6106 * \return eSIR_SUCCESS if setup completes successfully
6107 * eSIR_FAILURE is some problem is encountered
6108 */
6109tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6110 tSirMacAddr peerMacAddr,
6111 tSirMacStatusCodes baStatusCode,
6112 tANI_U8 baDialogToken,
6113 tANI_U8 baTID,
6114 tANI_U8 baPolicy,
6115 tANI_U16 baBufferSize,
6116 tANI_U16 baTimeout,
6117 tpPESession psessionEntry)
6118{
6119tSirRetStatus status = eSIR_SUCCESS;
6120tpLimMlmAddBARsp pMlmAddBARsp;
6121
6122 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306123 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6124 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006125 {
6126 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306127 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006128 status );
6129
6130 status = eSIR_MEM_ALLOC_FAILED;
6131 goto returnFailure;
6132 }
6133
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306134 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006135
6136 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306137 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006138 pMlmAddBARsp->peerMacAddr,
6139 peerMacAddr,
6140 sizeof( tSirMacAddr ));
6141
6142 pMlmAddBARsp->baDialogToken = baDialogToken;
6143 pMlmAddBARsp->addBAResultCode = baStatusCode;
6144 pMlmAddBARsp->baTID = baTID;
6145 pMlmAddBARsp->baPolicy = baPolicy;
6146 pMlmAddBARsp->baBufferSize = baBufferSize;
6147 pMlmAddBARsp->baTimeout = baTimeout;
6148
6149 /* UPdate PE session ID*/
6150 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6151
6152 // Send ADDBA Rsp to MLME
6153 limPostMlmMessage( pMac,
6154 LIM_MLM_ADDBA_RSP,
6155 (tANI_U32 *) pMlmAddBARsp );
6156
6157returnFailure:
6158
6159 return status;
6160}
6161
6162/**
6163 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6164 * will then send an DELBA Ind to peer MAC entity
6165 * with the appropriate DELBA status code
6166 *
6167 * \sa limPostMlmDelBAReq
6168 *
6169 * \param pMac The global tpAniSirGlobal object
6170 *
6171 * \param pSta DPH Hash Node object of peer MAC entity
6172 * for which the BA session is being deleted
6173 *
6174 * \param baDirection DELBA direction
6175 *
6176 * \param baTID TID for which the BA session is being deleted
6177 *
6178 * \param baReasonCode DELBA Req reason code
6179 *
6180 * \return eSIR_SUCCESS if setup completes successfully
6181 * eSIR_FAILURE is some problem is encountered
6182 */
6183tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6184 tpDphHashNode pSta,
6185 tANI_U8 baDirection,
6186 tANI_U8 baTID,
6187 tSirMacReasonCodes baReasonCode,
6188 tpPESession psessionEntry)
6189{
6190tSirRetStatus status = eSIR_SUCCESS;
6191tpLimMlmDelBAReq pMlmDelBAReq;
6192tLimBAState curBaState;
6193
6194if(NULL == pSta)
6195 return eSIR_FAILURE;
6196
6197LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6198
6199 // Need to validate the current BA State.
6200 if( eLIM_BA_STATE_IDLE != curBaState)
6201 {
6202 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006203 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006204 baTID,
6205 curBaState);
6206
6207 status = eSIR_FAILURE;
6208 goto returnFailure;
6209 }
6210
6211 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306212 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6213 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006214 {
6215 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306216 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006217 status );
6218
6219 status = eSIR_MEM_ALLOC_FAILED;
6220 goto returnFailure;
6221 }
6222
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306223 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006224
6225 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306226 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006227 pMlmDelBAReq->peerMacAddr,
6228 pSta->staAddr,
6229 sizeof( tSirMacAddr ));
6230
6231 pMlmDelBAReq->baDirection = baDirection;
6232 pMlmDelBAReq->baTID = baTID;
6233 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6234
6235 /* Update PE session ID*/
6236 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6237
6238 //we don't have valid BA session for the given direction.
6239 // HDD wants to get the BA session deleted on PEER in this case.
6240 // in this case we just need to send DelBA to the peer.
6241 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6242 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6243 {
6244 // Send DELBA Ind over the air
6245 if( eSIR_SUCCESS !=
6246 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6247 status = eSIR_FAILURE;
6248
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306249 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006250 return status;
6251 }
6252
6253
6254 // Update the BA state in STA
6255 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6256
6257 // Send DELBA Req to MLME
6258 limPostMlmMessage( pMac,
6259 LIM_MLM_DELBA_REQ,
6260 (tANI_U32 *) pMlmDelBAReq );
6261
6262returnFailure:
6263
6264 return status;
6265}
6266
6267/**
6268 * \brief Send WDA_ADDBA_REQ to HAL, in order
6269 * to setup a new BA session with a peer
6270 *
6271 * \sa limPostMsgAddBAReq
6272 *
6273 * \param pMac The global tpAniSirGlobal object
6274 *
6275 * \param pSta Runtime, STA-related configuration cached
6276 * in the HashNode object
6277 *
6278 * \param baDialogToken The Action Frame dialog token
6279 *
6280 * \param baTID TID for which the BA session is being setup
6281 *
6282 * \param baPolicy BA Policy
6283 *
6284 * \param baBufferSize The requested BA buffer size
6285 *
6286 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6287 *
6288 * \param baSSN Starting Sequence Number for this BA session
6289 *
6290 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6291 *
6292 * \return none
6293 *
6294 */
6295tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6296 tpDphHashNode pSta,
6297 tANI_U8 baDialogToken,
6298 tANI_U8 baTID,
6299 tANI_U8 baPolicy,
6300 tANI_U16 baBufferSize,
6301 tANI_U16 baTimeout,
6302 tANI_U16 baSSN,
6303 tANI_U8 baDirection,
6304 tpPESession psessionEntry)
6305{
6306tpAddBAParams pAddBAParams = NULL;
6307tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006308tSirMsgQ msgQ;
6309
6310#ifdef WLAN_SOFTAP_VSTA_FEATURE
6311 // we can only do BA on "hard" STAs
6312 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6313 {
6314 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306315 limLog( pMac, LOGE,
6316 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006317 goto returnFailure;
6318 }
6319#endif //WLAN_SOFTAP_VSTA_FEATURE
6320
6321 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306322 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6323 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006324 {
6325 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306326 FL("AllocateMemory failed")
6327 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006328
6329 retCode = eSIR_MEM_ALLOC_FAILED;
6330 goto returnFailure;
6331 }
6332
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306333 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006334
6335 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306336 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006337 (void *) pAddBAParams->peerMacAddr,
6338 (void *) pSta->staAddr,
6339 sizeof( tSirMacAddr ));
6340
6341 // Populate the REQ parameters
6342 pAddBAParams->staIdx = pSta->staIndex;
6343 pAddBAParams->baDialogToken = baDialogToken;
6344 pAddBAParams->baTID = baTID;
6345 pAddBAParams->baPolicy = baPolicy;
6346 pAddBAParams->baBufferSize = baBufferSize;
6347 pAddBAParams->baTimeout = baTimeout;
6348 pAddBAParams->baSSN = baSSN;
6349 pAddBAParams->baDirection = baDirection;
6350 pAddBAParams->respReqd = 1;
6351
6352 /* UPdate PE session ID */
6353 pAddBAParams->sessionId = psessionEntry->peSessionId;
6354
6355 // Post WDA_ADDBA_REQ to HAL.
6356 msgQ.type = WDA_ADDBA_REQ;
6357 //
6358 // FIXME_AMPDU
6359 // A global counter (dialog token) is required to keep track of
6360 // all PE <-> HAL communication(s)
6361 //
6362 msgQ.reserved = 0;
6363 msgQ.bodyptr = pAddBAParams;
6364 msgQ.bodyval = 0;
6365
6366 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306367 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6368 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6369 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6370 pAddBAParams->baTimeout, pAddBAParams->baTID,
6371 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6372 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006373
6374 //defer any other message until we get response back.
6375 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6376
Jeff Johnsone7245742012-09-05 17:12:55 -07006377 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006378#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6379 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6380#endif //FEATURE_WLAN_DIAG_SUPPORT
6381
6382 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6383 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006384 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006385 retCode );
6386 else
6387 return retCode;
6388
6389returnFailure:
6390
6391 // Clean-up...
6392 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306393 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006394
6395 return retCode;
6396
6397}
6398
6399/**
6400 * \brief Send WDA_DELBA_IND to HAL, in order
6401 * to delete an existing BA session with peer
6402 *
6403 * \sa limPostMsgDelBAInd
6404 *
6405 * \param pMac The global tpAniSirGlobal object
6406 *
6407 * \param pSta Runtime, STA-related configuration cached
6408 * in the HashNode object
6409 *
6410 * \param baTID TID for which the BA session is being setup
6411 *
6412 * \param baDirection Identifies whether the DELBA Ind was
6413 * sent by the BA initiator or recipient
6414 *
6415 * \return none
6416 *
6417 */
6418tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6419 tpDphHashNode pSta,
6420 tANI_U8 baTID,
6421 tANI_U8 baDirection,
6422 tpPESession psessionEntry)
6423{
6424tpDelBAParams pDelBAParams = NULL;
6425tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006426tSirMsgQ msgQ;
6427
6428 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306429 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6430 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006431 {
6432 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306433 FL("AllocateMemory failed")
6434 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006435
6436 retCode = eSIR_MEM_ALLOC_FAILED;
6437 goto returnFailure;
6438 }
6439
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306440 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006441
6442 // Populate the REQ parameters
6443 pDelBAParams->staIdx = pSta->staIndex;
6444 pDelBAParams->baTID = baTID;
6445 pDelBAParams->baDirection = baDirection;
6446
6447 /* Update PE session ID */
6448
6449
6450 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6451 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6452
6453 // Post WDA_DELBA_IND to HAL.
6454 msgQ.type = WDA_DELBA_IND;
6455 //
6456 // FIXME:
6457 // A global counter (dialog token) is required to keep track of
6458 // all PE <-> HAL communication(s)
6459 //
6460 msgQ.reserved = 0;
6461 msgQ.bodyptr = pDelBAParams;
6462 msgQ.bodyval = 0;
6463
6464 limLog( pMac, LOGW,
6465 FL( "Sending SIR_HAL_DELBA_IND..." ));
6466
Jeff Johnsone7245742012-09-05 17:12:55 -07006467 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006468#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6469 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6470#endif //FEATURE_WLAN_DIAG_SUPPORT
6471
6472 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6473 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006474 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006475 retCode );
6476 else
6477 {
6478 // Update LIM's internal cache...
6479 if( eBA_INITIATOR == baDirection)
6480 {
6481 pSta->tcCfg[baTID].fUseBATx = 0;
6482 pSta->tcCfg[baTID].txBufSize = 0;
6483 }
6484 else
6485 {
6486 pSta->tcCfg[baTID].fUseBARx = 0;
6487 pSta->tcCfg[baTID].rxBufSize = 0;
6488 }
6489
6490 return retCode;
6491 }
6492
6493returnFailure:
6494
6495 // Clean-up...
6496 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306497 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006498
6499 return retCode;
6500
6501}
6502
6503/**
6504 * @function : limPostSMStateUpdate()
6505 *
6506 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6507 *
6508 * LOGIC:
6509 *
6510 * ASSUMPTIONS:
6511 * NA
6512 *
6513 * NOTE:
6514 * NA
6515 *
6516 * @param pMac - Pointer to Global MAC structure
6517 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6518 * @return None
6519 */
6520tSirRetStatus
6521limPostSMStateUpdate(tpAniSirGlobal pMac,
6522 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6523{
6524 tSirRetStatus retCode = eSIR_SUCCESS;
6525 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006526 tpSetMIMOPS pMIMO_PSParams;
6527
6528 msgQ.reserved = 0;
6529 msgQ.type = WDA_SET_MIMOPS_REQ;
6530
6531 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306532 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6533 if ( NULL == pMIMO_PSParams )
6534 {
6535 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006536 return eSIR_MEM_ALLOC_FAILED;
6537 }
6538
6539 pMIMO_PSParams->htMIMOPSState = state;
6540 pMIMO_PSParams->staIdx = staIdx;
6541 pMIMO_PSParams->fsendRsp = true;
6542 msgQ.bodyptr = pMIMO_PSParams;
6543 msgQ.bodyval = 0;
6544
6545 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6546
Jeff Johnsone7245742012-09-05 17:12:55 -07006547 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006548 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6549 if (eSIR_SUCCESS != retCode)
6550 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006551 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306552 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006553 return retCode;
6554 }
6555
6556 return retCode;
6557}
6558
6559void limPktFree (
6560 tpAniSirGlobal pMac,
6561 eFrameType frmType,
6562 tANI_U8 *pRxPacketInfo,
6563 void *pBody)
6564{
6565 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006566}
6567
6568/**
6569 * limGetBDfromRxPacket()
6570 *
6571 *FUNCTION:
6572 * This function is called to get pointer to Polaris
6573 * Buffer Descriptor containing MAC header & other control
6574 * info from the body of the message posted to LIM.
6575 *
6576 *LOGIC:
6577 * NA
6578 *
6579 *ASSUMPTIONS:
6580 * NA
6581 *
6582 *NOTE:
6583 * NA
6584 *
6585 * @param body - Received message body
6586 * @param pRxPacketInfo - Pointer to received BD
6587 * @return None
6588 */
6589
6590void
6591limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6592{
Jeff Johnson295189b2012-06-20 16:38:30 -07006593 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006594} /*** end limGetBDfromRxPacket() ***/
6595
6596
6597
6598
6599
6600void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6601{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306602 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006603}
6604
6605
6606void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6607{
6608 tANI_U8 i;
6609 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6610
6611 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6612 {
6613 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6614 {
6615 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6616 fFound = eANI_BOOLEAN_TRUE;
6617 break;
6618 }
6619 }
6620 if(eANI_BOOLEAN_FALSE == fFound)
6621 {
6622 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6623 {
6624 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6625 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6626 }
6627 else
6628 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006629 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006630 }
6631 }
6632}
6633
6634
6635/**
6636 * @function : limIsChannelValidForChannelSwitch()
6637 *
6638 * @brief : This function checks if the channel to which AP
6639 * is expecting us to switch, is a valid channel for us.
6640 * LOGIC:
6641 *
6642 * ASSUMPTIONS:
6643 * NA
6644 *
6645 * NOTE:
6646 * NA
6647 *
6648 * @param pMac - Pointer to Global MAC structure
6649 * @param channel - New channel to which we are expected to move
6650 * @return None
6651 */
6652tAniBool
6653limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6654{
6655 tANI_U8 index;
6656 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6657 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6658
6659 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6660 (tANI_U8 *)validChannelList,
6661 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6662 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006663 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 return (eSIR_FALSE);
6665 }
6666
6667 for(index = 0; index < validChannelListLen; index++)
6668 {
6669 if(validChannelList[index] == channel)
6670 return (eSIR_TRUE);
6671 }
6672
6673 /* channel does not belong to list of valid channels */
6674 return (eSIR_FALSE);
6675}
6676
6677/**------------------------------------------------------
6678\fn __limFillTxControlParams
6679\brief Fill the message for stopping/resuming tx.
6680
6681\param pMac
6682\param pTxCtrlMsg - Pointer to tx control message.
6683\param type - Which way we want to stop/ resume tx.
6684\param mode - To stop/resume.
6685 -------------------------------------------------------*/
6686static eHalStatus
6687__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6688 tLimQuietTxMode type, tLimControlTx mode)
6689{
6690
6691 //TBD-RAJESH HOW TO GET sessionEntry?????
6692 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6693
6694 if (mode == eLIM_STOP_TX)
6695 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6696 else
6697 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6698
6699 switch (type)
6700 {
6701 case eLIM_TX_ALL:
6702 /** Stops/resumes transmission completely */
6703 pTxCtrlMsg->fCtrlGlobal = 1;
6704 break;
6705
6706 case eLIM_TX_BSS_BUT_BEACON:
6707 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6708 * stop beacon transmission.
6709 */
6710 pTxCtrlMsg->ctrlBss = 1;
6711 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6712 break;
6713
6714 case eLIM_TX_STA:
6715 /** Memory for station bitmap is allocated dynamically in caller of this
6716 * so decode properly here and fill the bitmap. Now not implemented,
6717 * fall through.
6718 */
6719 case eLIM_TX_BSS:
6720 //Fall thru...
6721 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006722 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006723 return eHAL_STATUS_FAILURE;
6724 }
6725
6726 return eHAL_STATUS_SUCCESS;
6727}
6728
6729/**
6730 * @function : limFrameTransmissionControl()
6731 *
6732 * @brief : This API is called by the user to halt/resume any frame
6733 * transmission from the device. If stopped, all frames will be
6734 * queued starting from hardware. Then back-pressure
6735 * is built till the driver.
6736 * LOGIC:
6737 *
6738 * ASSUMPTIONS:
6739 * NA
6740 *
6741 * NOTE:
6742 * NA
6743 *
6744 * @param pMac - Pointer to Global MAC structure
6745 * @return None
6746 */
6747void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6748{
6749
6750 eHalStatus status = eHAL_STATUS_FAILURE;
6751 tpTxControlParams pTxCtrlMsg;
6752 tSirMsgQ msgQ;
6753 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6754
6755 /** Allocate only required number of bytes for station bitmap
6756 * Make it to align to 4 byte boundary */
6757 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6758
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306759 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6760 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006761 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306762 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 return;
6764 }
6765
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306766 vos_mem_set((void *) pTxCtrlMsg,
6767 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6769 if (status != eHAL_STATUS_SUCCESS)
6770 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306771 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006772 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006773 return;
6774 }
6775
6776 msgQ.bodyptr = (void *) pTxCtrlMsg;
6777 msgQ.bodyval = 0;
6778 msgQ.reserved = 0;
6779 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6780
Jeff Johnsone7245742012-09-05 17:12:55 -07006781 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6783 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306784 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006785 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 return;
6787 }
6788
6789 if (mode == eLIM_STOP_TX)
6790 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306791 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006792 }
6793 else
6794 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306795 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006796 }
6797 return;
6798}
6799
6800
6801/**
6802 * @function : limRestorePreChannelSwitchState()
6803 *
6804 * @brief : This API is called by the user to undo any
6805 * specific changes done on the device during
6806 * channel switch.
6807 * LOGIC:
6808 *
6809 * ASSUMPTIONS:
6810 * NA
6811 *
6812 * NOTE:
6813 * NA
6814 *
6815 * @param pMac - Pointer to Global MAC structure
6816 * @return None
6817 */
6818
6819tSirRetStatus
6820limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6821{
6822
6823 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006824 tANI_U32 val = 0;
6825
6826 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6827 return retCode;
6828
6829 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006830 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006831
6832 /* Restore the frame transmission, all the time. */
6833 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6834
6835 /* Free to enter BMPS */
6836 limSendSmePostChannelSwitchInd(pMac);
6837
6838 //Background scan is now enabled by SME
6839 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6840 {
6841 /* Enable background scan if already enabled, else don't bother */
6842 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6843 &val)) != eSIR_SUCCESS)
6844
6845 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006846 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 return (retCode);
6848 }
6849
6850 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6851 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006852 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6853 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006854 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6855 {
6856 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6857 return (eSIR_FAILURE);
6858 }
6859
6860 }
6861 }
6862
6863 /* Enable heartbeat timer */
6864 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6865 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006866 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6867 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6868 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6869 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006870 {
6871 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6872 return (eSIR_FAILURE);
6873 }
6874 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006875 return (retCode);
6876}
6877
6878
6879/**--------------------------------------------
6880\fn limRestorePreQuietState
6881\brief Restore the pre quiet state
6882
6883\param pMac
6884\return NONE
6885---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006886tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006887{
6888
6889 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006890 tANI_U32 val = 0;
6891
6892 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6893 return retCode;
6894
6895 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006896 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006897
6898 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006899 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006900 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6901
6902
6903 //Background scan is now enabled by SME
6904 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6905 {
6906 /* Enable background scan if already enabled, else don't bother */
6907 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6908 &val)) != eSIR_SUCCESS)
6909
6910 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006911 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006912 return (retCode);
6913 }
6914
6915 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6916 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006917 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006918 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6919 {
6920 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6921 return (eSIR_FAILURE);
6922 }
6923
6924 }
6925 }
6926
6927 /* Enable heartbeat timer */
6928 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6929 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006930 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006931 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006932 {
6933 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6934 return (eSIR_FAILURE);
6935 }
6936 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006937 return (retCode);
6938}
6939
6940
6941/**
6942 * @function: limPrepareFor11hChannelSwitch()
6943 *
6944 * @brief : This API is called by the user to prepare for
6945 * 11h channel switch. As of now, the API does
6946 * very minimal work. User can add more into the
6947 * same API if needed.
6948 * LOGIC:
6949 *
6950 * ASSUMPTIONS:
6951 * NA
6952 *
6953 * NOTE:
6954 * NA
6955 *
6956 * @param pMac - Pointer to Global MAC structure
6957 * @param psessionEntry
6958 * @return None
6959 */
6960void
6961limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6962{
Jeff Johnson295189b2012-06-20 16:38:30 -07006963 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6964 return;
6965
6966 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006967 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006968
6969 /* Disable, Stop background scan if enabled and running */
6970 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6971
6972 /* Stop heart-beat timer to stop heartbeat disassociation */
6973 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6974
6975 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6976 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6977 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006978 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006979 /* Stop ongoing scanning if any */
6980 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6981 {
6982 //Set the resume channel to Any valid channel (invalid).
6983 //This will instruct HAL to set it to any previous valid channel.
6984 peSetResumeChannel(pMac, 0, 0);
6985 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6986 }
6987 else
6988 {
6989 limRestorePreChannelSwitchState(pMac, psessionEntry);
6990 }
6991 return;
6992 }
6993 else
6994 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006995 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006996 /** We are safe to switch channel at this point */
6997 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6998 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006999}
7000
7001
7002
7003/**----------------------------------------------------
7004\fn limGetNwType
7005
7006\brief Get type of the network from data packet or beacon
7007\param pMac
7008\param channelNum - Channel number
7009\param type - Type of packet.
7010\param pBeacon - Pointer to beacon or probe response
7011
7012\return Network type a/b/g.
7013-----------------------------------------------------*/
7014tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7015{
7016 tSirNwType nwType = eSIR_11B_NW_TYPE;
7017
7018 if (type == SIR_MAC_DATA_FRAME)
7019 {
7020 if ((channelNum > 0) && (channelNum < 15))
7021 {
7022 nwType = eSIR_11G_NW_TYPE;
7023 }
7024 else
7025 {
7026 nwType = eSIR_11A_NW_TYPE;
7027 }
7028 }
7029 else
7030 {
7031 if ((channelNum > 0) && (channelNum < 15))
7032 {
7033 int i;
7034 // 11b or 11g packet
7035 // 11g iff extended Rate IE is present or
7036 // if there is an A rate in suppRate IE
7037 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7038 {
7039 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7040 {
7041 nwType = eSIR_11G_NW_TYPE;
7042 break;
7043 }
7044 }
7045 if (pBeacon->extendedRatesPresent)
7046 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007047 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007048 nwType = eSIR_11G_NW_TYPE;
7049 }
7050 }
7051 else
7052 {
7053 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007054 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007055 nwType = eSIR_11A_NW_TYPE;
7056 }
7057 }
7058 return nwType;
7059}
7060
7061
7062/**---------------------------------------------------------
7063\fn limGetChannelFromBeacon
7064\brief To extract channel number from beacon
7065
7066\param pMac
7067\param pBeacon - Pointer to beacon or probe rsp
7068\return channel number
7069-----------------------------------------------------------*/
7070tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7071{
7072 tANI_U8 channelNum = 0;
7073
7074 if (pBeacon->dsParamsPresent)
7075 channelNum = pBeacon->channelNumber;
7076 else if(pBeacon->HTInfo.present)
7077 channelNum = pBeacon->HTInfo.primaryChannel;
7078 else
7079 channelNum = pBeacon->channelNumber;
7080
7081 return channelNum;
7082}
7083
7084
7085/** ---------------------------------------------------------
7086\fn limSetTspecUapsdMask
7087\brief This function sets the PE global variable:
7088\ 1) gUapsdPerAcTriggerEnableMask and
7089\ 2) gUapsdPerAcDeliveryEnableMask
7090\ based on the user priority field and direction field
7091\ in the TS Info Fields.
7092\
7093\ An AC is a trigger-enabled AC if the PSB subfield
7094\ is set to 1 in the uplink direction.
7095\ An AC is a delivery-enabled AC if the PSB subfield
7096\ is set to 1 in the down-link direction.
7097\
7098\param tpAniSirGlobal pMac
7099\param tSirMacTSInfo pTsInfo
7100\param tANI_U32 action
7101\return None
7102 ------------------------------------------------------------*/
7103void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7104{
7105 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7106 tANI_U16 direction = pTsInfo->traffic.direction;
7107 tANI_U8 ac = upToAc(userPrio);
7108
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307109 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 -07007110
7111 /* Converting AC to appropriate Uapsd Bit Mask
7112 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7113 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7114 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7115 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7116 */
7117 ac = ((~ac) & 0x3);
7118
7119 if (action == CLEAR_UAPSD_MASK)
7120 {
7121 if (direction == SIR_MAC_DIRECTION_UPLINK)
7122 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7123 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7124 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7125 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7126 {
7127 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7128 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7129 }
7130 }
7131 else if (action == SET_UAPSD_MASK)
7132 {
7133 if (direction == SIR_MAC_DIRECTION_UPLINK)
7134 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7135 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7136 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7137 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7138 {
7139 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7140 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7141 }
7142 }
7143
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007144 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7145 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007146
7147 return;
7148}
7149
7150
7151
7152void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7153{
7154
7155 tANI_U8 i;
7156 for(i =0;i < pMac->lim.maxBssId;i++)
7157 {
7158 if(pMac->lim.gpSession[i].valid == TRUE )
7159 {
7160 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7161 {
7162 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7163 break;
7164 }
7165
7166 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7167 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7168 {
7169 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7170 }
7171 }
7172 }
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 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7181 {
7182 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007183 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007184 i);)
7185 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7186 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7187 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7188 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007189 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007190 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7191 }
7192 break;
7193 }
7194 }
7195 }
7196 }
7197}
7198
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007199void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7200{
7201 if(psessionEntry->valid == TRUE )
7202 {
7203 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7204 {
7205 limIbssHeartBeatHandle(pMac,psessionEntry);
7206 }
7207 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7208 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7209 {
7210 limHandleHeartBeatFailure(pMac,psessionEntry);
7211 }
7212 }
7213 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7214 and the other things again */
7215 if(psessionEntry->valid == TRUE )
7216 {
7217 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7218 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7219 {
7220 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7221 {
7222 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7223 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7224 psessionEntry->bssIdx);)
7225 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7226 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7227 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7228 {
7229 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7230 limReactivateHeartBeatTimer(pMac, psessionEntry);
7231 }
7232 }
7233 }
7234 }
7235}
7236
7237
Jeff Johnson295189b2012-06-20 16:38:30 -07007238tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7239{
7240 tANI_U8 i;
7241 for(i =0;i < pMac->lim.maxBssId;i++)
7242 {
7243 if(pMac->lim.gpSession[i].valid == TRUE )
7244 {
7245 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7246 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7247 {
7248 return pMac->lim.gpSession[i].currentOperChannel;
7249 }
7250 }
7251 }
7252 return 0;
7253}
7254
7255void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7256{
7257
7258 tpPESession psessionEntry;
7259// tANI_U8 sessionId;
7260 tpAddStaParams pAddStaParams;
7261
7262 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7263
7264 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7265 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007266 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307267 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007268 return;
7269 }
7270 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7271 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007272#ifdef FEATURE_WLAN_TDLS
7273 else if(pMac->lim.gLimAddStaTdls)
7274 {
7275 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7276 pMac->lim.gLimAddStaTdls = FALSE ;
7277 }
7278#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007279 else
7280 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7281
7282}
7283
7284
7285void limUpdateBeacon(tpAniSirGlobal pMac)
7286{
7287 tANI_U8 i;
7288
7289 for(i =0;i < pMac->lim.maxBssId;i++)
7290 {
7291 if(pMac->lim.gpSession[i].valid == TRUE )
7292 {
7293 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7294 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7295 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7296 )
7297 {
7298 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7299 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7300 }
7301 else
7302 {
7303 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7304 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7305 {
7306
7307 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7308 {
7309 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7310 }
7311 }
7312 }
7313 }
7314 }
7315}
7316
7317void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7318{
7319 tANI_U8 i;
7320 tpPESession psessionEntry;
7321 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7322 for(i =0; i < pMac->lim.maxBssId; i++)
7323 {
7324 if(pMac->lim.gpSession[i].valid == TRUE)
7325 {
7326 psessionEntry = &pMac->lim.gpSession[i];
7327 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7328 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307329 limLog(pMac, LOGE,
7330 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7331 psessionEntry->limSmeState, psessionEntry->limMlmState,
7332 psessionEntry->LimRxedBeaconCntDuringHB,
7333 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007334#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7335 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007337 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7338 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307339 /* Disconnect even if we have not received a single beacon
7340 * after connection.
7341 */
7342 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7343 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307344 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7345 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007346 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007347 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007348 /* AP did not respond to Probe Request. Tear down link with it.*/
7349 limTearDownLinkWithAp(pMac,
7350 psessionEntry->peSessionId,
7351 eSIR_BEACON_MISSED);
7352 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7353 }
7354 else // restart heartbeat timer
7355 {
7356 limReactivateHeartBeatTimer(pMac, psessionEntry);
7357 }
7358 }
7359 else
7360 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007361 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007362 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7363 limReactivateHeartBeatTimer(pMac, psessionEntry);
7364 }
7365
7366 }
7367 }
7368 }
7369 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7370 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7371}
7372
7373
7374/*
7375* This function assumes there will not be more than one IBSS session active at any time.
7376*/
7377tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7378{
7379 tANI_U8 i;
7380
7381 for(i =0;i < pMac->lim.maxBssId;i++)
7382 {
7383 if( (pMac->lim.gpSession[i].valid) &&
7384 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7385 return (&pMac->lim.gpSession[i]);
7386 }
7387
7388 return NULL;
7389}
7390
7391tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7392{
7393 tANI_U8 i;
7394
7395 for(i =0;i < pMac->lim.maxBssId;i++)
7396 {
7397 if( (pMac->lim.gpSession[i].valid) &&
7398 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7399 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7400 return (&pMac->lim.gpSession[i]);
7401 }
7402
7403 return NULL;
7404}
7405
7406/**---------------------------------------------------------
7407\fn limHandleDeferMsgError
7408\brief handles error scenario, when the msg can not be deferred.
7409\param pMac
7410\param pLimMsg LIM msg, which could not be deferred.
7411\return void
7412-----------------------------------------------------------*/
7413
7414void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7415{
7416 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7417 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307418 /*Decrement the Pending count before droping */
7419 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007420 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7421 }
7422 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007423 {
7424 vos_mem_free( pLimMsg->bodyptr);
7425 pLimMsg->bodyptr = NULL;
7426 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007427}
7428
7429
7430#ifdef FEATURE_WLAN_DIAG_SUPPORT
7431/**---------------------------------------------------------
7432\fn limDiagEventReport
7433\brief This function reports Diag event
7434\param pMac
7435\param eventType
7436\param bssid
7437\param status
7438\param reasonCode
7439\return void
7440-----------------------------------------------------------*/
7441void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7442{
7443 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7444 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7445
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307446 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007447
7448 if (NULL == pSessionEntry)
7449 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307450 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007451 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7452 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7453
7454 }
7455 else
7456 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307457 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007458 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7459 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7460 }
7461 peEvent.event_type = eventType;
7462 peEvent.status = status;
7463 peEvent.reason_code = reasonCode;
7464
7465 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7466 return;
7467}
7468
7469#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7470
7471void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7472{
7473
7474 tpAddStaSelfParams pAddStaSelfParams;
7475 tSirMsgQ mmhMsg;
7476 tpSirSmeAddStaSelfRsp pRsp;
7477
7478
7479 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7480
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307481 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7482 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 {
7484 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307485 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7486 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007487 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007488 return;
7489 }
7490
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307491 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007492
7493 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7494 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7495 pRsp->status = pAddStaSelfParams->status;
7496
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007498
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307499 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007500 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007501
7502 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7503 mmhMsg.bodyptr = pRsp;
7504 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307505 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007506 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7507
7508}
7509
7510void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7511{
7512
7513 tpDelStaSelfParams pDelStaSelfParams;
7514 tSirMsgQ mmhMsg;
7515 tpSirSmeDelStaSelfRsp pRsp;
7516
7517
7518 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7519
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307520 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7521 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007522 {
7523 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307524 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7525 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007526 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007527 return;
7528 }
7529
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307530 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007531
7532 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7533 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7534 pRsp->status = pDelStaSelfParams->status;
7535
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307536 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007537
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307538 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007539 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007540
7541 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7542 mmhMsg.bodyptr = pRsp;
7543 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307544 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007545 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7546
7547}
7548
7549/***************************************************************
7550* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7551* To unmap the channel to reverse the effect of mapping
7552* a band channel in hal .Mapping was done hal to overcome the
7553* limitation of the rxbd which use only 4 bit for channel number.
7554*****************************************************************/
7555tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7556{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007557#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007558 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007559 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7560 return aUnsortedChannelList[mapChannel -1];
7561 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007562#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007563 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007564#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007565 return abChannel[mapChannel -1];
7566 else
7567 return 0;
7568}
7569
7570
7571v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7572{
7573 int left = length;
7574 v_U8_t *ptr = pIes;
7575 v_U8_t elem_id;
7576 v_U16_t elem_len;
7577
7578 while(left >= (size_of_len_field+1))
7579 {
7580 elem_id = ptr[0];
7581 if (size_of_len_field == TWO_BYTE)
7582 {
7583 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7584 }
7585 else
7586 {
7587 elem_len = ptr[1];
7588 }
7589
7590
7591 left -= (size_of_len_field+1);
7592 if(elem_len > left)
7593 {
7594 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007595 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007596 eid,elem_len,left);
7597 return NULL;
7598 }
7599 if (elem_id == eid)
7600 {
7601 return ptr;
7602 }
7603
7604 left -= elem_len;
7605 ptr += (elem_len + (size_of_len_field+1));
7606 }
7607 return NULL;
7608}
7609
7610/* return NULL if oui is not found in ie
7611 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7612 */
7613v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7614{
7615 int left = ie_len;
7616 v_U8_t *ptr = ie;
7617 v_U8_t elem_id, elem_len;
7618
7619 while(left >= 2)
7620 {
7621 elem_id = ptr[0];
7622 elem_len = ptr[1];
7623 left -= 2;
7624 if(elem_len > left)
7625 {
7626 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007627 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007628 elem_id,elem_len,left);
7629 return NULL;
7630 }
7631 if (SIR_MAC_EID_VENDOR == elem_id)
7632 {
7633 if(memcmp(&ptr[2], oui, oui_size)==0)
7634 return ptr;
7635 }
7636
7637 left -= elem_len;
7638 ptr += (elem_len + 2);
7639 }
7640 return NULL;
7641}
7642
Jeff Johnson295189b2012-06-20 16:38:30 -07007643//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7644
7645v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7646{
7647 int length = 0;
7648 tANI_U8 *ptr = ie;
7649
7650 ptr[length++] = SIR_MAC_EID_VENDOR;
7651 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307652 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7653 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007654 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7655}
7656
7657//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7658
7659v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7660{
7661 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007662
7663 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7664 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7665 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307666 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007667 noaStream + noaLen - overFlowLen, overFlowLen);
7668 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7669 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307670 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007671 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307672 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7673 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007674 }
7675
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7677
7678}
7679
7680//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7681v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7682{
7683 v_U8_t len=0;
7684
7685 v_U8_t *pBody = pNoaStream;
7686
7687
7688 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7689 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7690 {
7691 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7692 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7693 )
7694 return 0; //No NoA Descriptor then return 0
7695
7696
7697 pBody[0] = SIR_P2P_NOA_ATTR;
7698
7699 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7700 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7701 len = 5;
7702 pBody += len;
7703
7704
7705 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7706 {
7707 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7708 pBody += 1;
7709 len +=1;
7710
7711 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7712 pBody += sizeof(tANI_U32);
7713 len +=4;
7714
7715 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7716 pBody += sizeof(tANI_U32);
7717 len +=4;
7718
7719 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7720 pBody += sizeof(tANI_U32);
7721 len +=4;
7722
7723 }
7724
7725 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7726 {
7727 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7728 pBody += 1;
7729 len +=1;
7730
7731 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7732 pBody += sizeof(tANI_U32);
7733 len +=4;
7734
7735 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7736 pBody += sizeof(tANI_U32);
7737 len +=4;
7738
7739 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7740 pBody += sizeof(tANI_U32);
7741 len +=4;
7742
7743 }
7744
7745
7746 pBody = pNoaStream + 1;
7747 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7748
7749 return (len);
7750
7751 }
7752 return 0;
7753
7754}
Jeff Johnsone7245742012-09-05 17:12:55 -07007755
7756void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007757{
7758
7759 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007760 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007761}
Jeff Johnsone7245742012-09-05 17:12:55 -07007762
Jeff Johnson295189b2012-06-20 16:38:30 -07007763/*--------------------------------------------------------------------------
7764
7765 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7766
Jeff Johnsone7245742012-09-05 17:12:55 -07007767 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7768 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007769
7770 \param pMac - pointer to global adapter context
7771 \return - channel to scan from valid session else zero.
7772
7773 \sa
7774
7775 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007776void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007777{
7778
7779 //Rationale - this could be the suspend/resume for assoc and it is essential that
7780 //the new BSS is active for some time. Other BSS was anyway suspended.
7781 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7782 //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 -07007783 //and hence should be ok. Need to discuss this further
7784 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007785 {
7786 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007787 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007788 }
7789 else
7790 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007791 *resumeChannel = pMac->lim.gResumeChannel;
7792 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007793 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007794 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007795}
7796
Viral Modid86bde22012-12-10 13:09:21 -08007797tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7798{
7799 tANI_U8 i;
7800 for(i =0; i < pMac->lim.maxBssId; i++)
7801 {
7802 if(pMac->lim.gpSession[i].valid == TRUE)
7803 {
7804 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7805 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7806 )
7807 {
7808 return TRUE;
7809 }
7810 }
7811 }
7812 return FALSE;
7813}
Jeff Johnsone7245742012-09-05 17:12:55 -07007814
Jeff Johnson295189b2012-06-20 16:38:30 -07007815
7816tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7817{
7818 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7819 {
7820 return eANI_BOOLEAN_TRUE;
7821 }
7822 else
7823 {
7824 return eANI_BOOLEAN_FALSE;
7825 }
7826}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007827
Sandeep Puligilla60342762014-01-30 21:05:37 +05307828/**
7829 * \brief verify the changes in channel bonding
7830 *
7831 * \param pMac Pointer to the global MAC structure
7832 *
7833 * \param psessionEntry session entry
7834 * beaconSecChanWidth Secondary channel width
7835 * advertized in beacon
7836 * currentSecChanWidth Current configured width
7837 * staId Station Id
7838 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7839 */
7840tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7841 tpPESession psessionEntry,
7842 tANI_U8 beaconSecChanWidth,
7843 tANI_U8 currentSecChanWidth,
7844 tANI_U8 staId)
7845{
7846 tUpdateVHTOpMode tempParam;
7847 tANI_BOOLEAN fCbMode24G = FALSE;
7848 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7849
7850 /* Moving from HT40 to HT20 operation*/
7851 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7852 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7853 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7854 {
7855 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7856 tempParam.staId = staId;
7857 fCbMode24G = TRUE;
7858 }
7859
7860 /* Moving from HT20 to HT40 operation*/
7861 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7862 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7863 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7864 {
7865 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7866 tempParam.staId = staId;
7867 fCbMode24G = TRUE;
7868 }
7869
7870 if (TRUE == fCbMode24G)
7871 {
7872 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7873 "Changing CBMODE to = %d staId = %d",
7874 tempParam.opMode, tempParam.staId );
7875 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7876 status = eANI_BOOLEAN_TRUE;
7877 }
7878 return status;
7879}
7880
Mohit Khanna4a70d262012-09-11 16:30:12 -07007881#ifdef WLAN_FEATURE_11AC
7882tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7883{
7884 tUpdateVHTOpMode tempParam;
7885
7886 tempParam.opMode = chanWidth;
7887 tempParam.staId = staId;
7888
7889 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7890
7891 return eANI_BOOLEAN_TRUE;
7892}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007893#endif
7894
krunal soni45b9eb62014-03-26 12:54:25 -07007895void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7896 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007897{
7898 tANI_U8 val=0;
7899
krunal soni45b9eb62014-03-26 12:54:25 -07007900 //only 2.4G band should have short slot enable, rest it should be default
7901 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007902 {
krunal soni45b9eb62014-03-26 12:54:25 -07007903 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007904 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007905 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007906 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7907 {
7908 val = true;
7909 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007910 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007911 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007912 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007913 // Joining BSS.
7914 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007915 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007916 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007917 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007918 // Reassociating with AP.
7919 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007920 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007921 }
krunal soni45b9eb62014-03-26 12:54:25 -07007922 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007923 {
krunal soni45b9eb62014-03-26 12:54:25 -07007924 /*
7925 * 11B does not short slot and short slot is default
7926 * for 11A mode. Hence, not need to set this bit
7927 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007928 val = false;
7929 }
krunal soni45b9eb62014-03-26 12:54:25 -07007930
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007931 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007932 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007933}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307934
Kalikinkar dhara205da782014-03-21 15:49:32 -07007935void limUtilsframeshtons(tpAniSirGlobal pCtx,
7936 tANI_U8 *pOut,
7937 tANI_U16 pIn,
7938 tANI_U8 fMsb)
7939{
7940 (void)pCtx;
7941#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7942 if ( !fMsb )
7943 {
7944 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7945 }
7946 else
7947 {
7948 *pOut = ( pIn & 0xff00 ) >> 8;
7949 *( pOut + 1 ) = pIn & 0xff;
7950 }
7951#else
7952 if ( !fMsb )
7953 {
7954 *pOut = pIn & 0xff;
7955 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7956 }
7957 else
7958 {
7959 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7960 }
7961#endif
7962}
7963
7964void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7965 tANI_U8 *pOut,
7966 tANI_U32 pIn,
7967 tANI_U8 fMsb)
7968{
7969 (void)pCtx;
7970#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7971 if ( !fMsb )
7972 {
7973 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7974 }
7975 else
7976 {
7977 *pOut = ( pIn & 0xff000000 ) >> 24;
7978 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7979 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7980 *( pOut + 3 ) = ( pIn & 0x000000ff );
7981 }
7982#else
7983 if ( !fMsb )
7984 {
7985 *( pOut ) = ( pIn & 0x000000ff );
7986 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7987 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7988 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7989 }
7990 else
7991 {
7992 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7993 }
7994#endif
7995}
7996
7997
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307998/**--------------------------------------------
7999\fn limUpdateOBSSScanParams
8000\brief Updates OBSS SCAN IE parameters to session
8001
8002\param psessionEntry - Session Entry
8003\return NONE
8004---------------------------------------------*/
8005void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8006 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8007{
8008 /*If the recieved value is not in the range specified by the Specification
8009 then it will be the default value configured through cfg */
8010 if (( pOBSSScanParameters->obssScanActiveDwell >
8011 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8012 ( pOBSSScanParameters->obssScanActiveDwell <
8013 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8014 {
8015 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8016 pOBSSScanParameters->obssScanActiveDwell;
8017 }
8018 if((pOBSSScanParameters->obssScanPassiveDwell >
8019 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8020 (pOBSSScanParameters->obssScanPassiveDwell <
8021 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8022 {
8023 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8024 pOBSSScanParameters->obssScanPassiveDwell;
8025 }
8026 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8027 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8028 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8029 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8030 {
8031 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8032 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8033 }
8034 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8035 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8036 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8037 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8038 {
8039 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8040 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8041 }
8042 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8043 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8044 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8045 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8046 {
8047 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8048 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8049 }
8050 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8051 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8052 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8053 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8054 {
8055 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8056 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8057 }
8058 if((pOBSSScanParameters->obssScanActivityThreshold >
8059 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8060 (pOBSSScanParameters->obssScanActivityThreshold <
8061 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8062 {
8063 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8064 pOBSSScanParameters->obssScanActivityThreshold;
8065 }
8066}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008067
8068#ifdef WLAN_FEATURE_11W
8069void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8070{
8071 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8072 tPmfSaQueryTimerId timerId;
8073 tpPESession psessionEntry;
8074 tpDphHashNode pSta;
8075 tANI_U32 maxRetries;
8076
8077 limLog(pMac, LOG1, FL("SA Query timer fires"));
8078 timerId.value = param;
8079
8080 // Check that SA Query is in progress
8081 if ((psessionEntry = peFindSessionBySessionId(
8082 pMac, timerId.fields.sessionId)) == NULL)
8083 {
8084 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8085 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008086 return;
8087 }
8088 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8089 &psessionEntry->dph.dphHashTable)) == NULL)
8090 {
8091 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8092 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008093 return;
8094 }
8095 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8096 return;
8097
8098 // Increment the retry count, check if reached maximum
8099 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8100 &maxRetries) != eSIR_SUCCESS)
8101 {
8102 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8103 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8104 return;
8105 }
8106 pSta->pmfSaQueryRetryCount++;
8107 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8108 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308109 limLog(pMac, LOGE,
8110 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8111 MAC_ADDR_ARRAY(pSta->staAddr));
8112 limSendDisassocMgmtFrame(pMac,
8113 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8114 pSta->staAddr, psessionEntry, FALSE);
8115 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008116 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8117 return;
8118 }
8119
8120 // Retry SA Query
8121 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8122 pSta->staAddr, psessionEntry);
8123 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008124 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8125 {
8126 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8127 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8128 }
8129}
8130#endif
8131
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008132/** ---------------------------------------------------------
8133\fn limProcessChannelSwitchSuspendLink
8134\brief This function call channel switch functions based on
8135 the gLimChannelSwitch.state. After function return it
8136 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8137 If gLimChannelSwitch.state is non-identified then
8138 print error log as well as restore back the
8139 pre-channelSwitch.
8140\param tpAniSirGlobal pMac
8141\param eHalStatus status
8142\param tANI_U32 *ctx
8143\return None
8144 ------------------------------------------------------------*/
8145static void
8146limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8147 eHalStatus status,
8148 tANI_U32 *ctx)
8149{
8150 tpPESession pSessionEntry = (tpPESession)ctx;
8151
8152 if ( eHAL_STATUS_SUCCESS != status )
8153 {
8154 limLog(pMac, LOGE,
8155 FL("Suspend link failed. still proceeding "));
8156 }
8157 if (NULL == pSessionEntry )
8158 {
8159 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8160 return;
8161 }
8162
8163 switch(pSessionEntry->gLimChannelSwitch.state)
8164 {
8165 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8166 PELOGW(limLog(pMac, LOGW,
8167 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8168 limSwitchPrimaryChannel(pMac,
8169 pSessionEntry->gLimChannelSwitch.primaryChannel,
8170 pSessionEntry);
8171 pSessionEntry->gLimChannelSwitch.state =
8172 eLIM_CHANNEL_SWITCH_IDLE;
8173 break;
8174
8175 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8176 PELOGW(limLog(pMac, LOGW,
8177 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8178 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8179 pSessionEntry->gLimChannelSwitch.primaryChannel,
8180 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8181 pSessionEntry->gLimChannelSwitch.state =
8182 eLIM_CHANNEL_SWITCH_IDLE;
8183 break;
8184
8185 default:
8186 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8187 pSessionEntry->gLimChannelSwitch.state);)
8188 if (limRestorePreChannelSwitchState(pMac,
8189 pSessionEntry) != eSIR_SUCCESS)
8190 {
8191 limLog(pMac, LOGE,
8192 FL("Could not restore pre-channelSwitch "
8193 "(11h) state, resetting the system"));
8194 }
8195 }
8196}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308197
8198/** ---------------------------------------------------------
8199\fn limInitOBSSScanParams
8200\brief This function Initializes the OBSS Scan Parameters
8201\param tpAniSirGlobal pMac
8202\param tpPESession pSessionEntry
8203\return None
8204 ------------------------------------------------------------*/
8205
8206void limInitOBSSScanParams(tpAniSirGlobal pMac,
8207 tpPESession psessionEntry)
8208{
8209 tANI_U32 cfgValue;
8210
8211 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8212 &cfgValue) != eSIR_SUCCESS)
8213 {
8214 limLog(pMac, LOGE, FL("Fail to retrieve "
8215 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8216 return ;
8217 }
8218 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8219
8220 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8221 &cfgValue) != eSIR_SUCCESS)
8222 {
8223 limLog(pMac, LOGE, FL("Fail to retrieve "
8224 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8225 return ;
8226 }
8227 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8228
8229 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8230 &cfgValue) != eSIR_SUCCESS)
8231 {
8232 limLog(pMac, LOGE, FL("Fail to retrieve "
8233 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8234 return ;
8235 }
8236 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8237 = cfgValue;
8238 if (wlan_cfgGetInt(pMac,
8239 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8240 &cfgValue) != eSIR_SUCCESS)
8241 {
8242 limLog(pMac, LOGE, FL("Fail to retrieve"
8243 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8244 return ;
8245 }
8246 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8247 cfgValue;
8248 if (wlan_cfgGetInt(pMac,
8249 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8250 != eSIR_SUCCESS)
8251 {
8252 limLog(pMac, LOGE, FL("Fail to retrieve"
8253 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8254 return ;
8255 }
8256 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8257 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308258
8259 if (wlan_cfgGetInt(pMac,
8260 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8261 != eSIR_SUCCESS)
8262 {
8263 limLog(pMac, LOGE, FL("Fail to retrieve"
8264 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8265 return ;
8266 }
8267 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8268 cfgValue;
8269
8270
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308271 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8272 &cfgValue) != eSIR_SUCCESS)
8273 {
8274 limLog(pMac, LOGE, FL("Fail to retrieve "
8275 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8276 return ;
8277 }
8278 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308279}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308280
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308281const char * lim_ScanTypetoString(const v_U8_t scanType)
8282{
8283 switch (scanType)
8284 {
8285 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8286 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8287 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8288 default:
8289 return "Unknown ScanType";
8290 }
8291}
8292
8293const char * lim_BssTypetoString(const v_U8_t bssType)
8294{
8295 switch (bssType)
8296 {
8297 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8298 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8299 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8300 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8301 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8302 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8303 default:
8304 return "Unknown BssType";
8305 }
8306}
8307
8308const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8309{
8310 switch (mode)
8311 {
8312 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8313 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8314 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8315 default:
8316 return "Unknown BgScanMode";
8317 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308318}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308319
8320#ifdef WLAN_FEATURE_11W
8321/**
8322 *
8323 * \brief This function is called by various LIM modules to correctly set
8324 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8325 *
8326 *
8327 * \param pMac Pointer to Global MAC structure
8328 *
8329 * \param psessionEntry Pointer to session corresponding to the connection
8330 *
8331 * \param peer Peer address of the STA to which the frame is to be sent
8332 *
8333 * \param pMacHdr Pointer to the frame MAC header
8334 *
8335 * \return nothing
8336 *
8337 *
8338 */
8339void
8340limSetProtectedBit(tpAniSirGlobal pMac,
8341 tpPESession psessionEntry,
8342 tSirMacAddr peer,
8343 tpSirMacMgmtHdr pMacHdr)
8344{
8345 tANI_U16 aid;
8346 tpDphHashNode pStaDs;
8347
8348 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8349 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8350 {
8351
8352 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8353 &psessionEntry->dph.dphHashTable );
8354 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308355 /* rmfenabled will be set at the time of addbss.
8356 * but sometimes EAP auth fails and keys are not
8357 * installed then if we send any management frame
8358 * like deauth/disassoc with this bit set then
8359 * firmware crashes. so check for keys are
8360 * installed or not also before setting the bit
8361 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308362 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308363 pMacHdr->fc.wep = 1;
8364 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308365 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308366 pMacHdr->fc.wep = 1;
8367} /*** end limSetProtectedBit() ***/
8368#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308369
8370tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8371{
8372 int left = length;
8373 tANI_U8 *ptr = pIes;
8374 tANI_U8 elem_id,elem_len;
8375
8376 while (left >= 2)
8377 {
8378 elem_id = ptr[0];
8379 elem_len = ptr[1];
8380 left -= 2;
8381
8382 if (elem_len > left)
8383 {
8384 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8385 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8386 eid,elem_len,left);
8387 return NULL;
8388 }
8389 if (elem_id == eid)
8390 {
8391 return ptr;
8392 }
8393
8394 left -= elem_len;
8395 ptr += (elem_len + 2);
8396 }
8397 return NULL;
8398}
8399
8400
8401void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8402{
8403
8404 tANI_U32 nPayload;
8405 tANI_U8 *pPayload;
8406 tANI_U8 *ieptr;
8407 tSirMacTim *tim;
8408
8409 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8410 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8411
8412 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8413 {
8414 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8415 return;
8416 }
8417
8418 if (NULL !=
8419 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8420 nPayload, SIR_MAC_TIM_EID)))
8421 {
8422 /* Ignore EID and Length field*/
8423 tim = (tSirMacTim *)(ieptr + 2);
8424
8425 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8426 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8427 if (tim->dtimCount >= MAX_DTIM_COUNT)
8428 tim->dtimCount = DTIM_COUNT_DEFAULT;
8429 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8430 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8431 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8432 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8433 psessionEntry->currentBssBeaconCnt++;
8434
8435 limLog(pMac, LOG1,
8436 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8437 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8438 psessionEntry->lastBeaconDtimPeriod);
8439
8440 }
8441 return;
8442}
Girish Gowlia95daca2015-02-04 20:31:31 +05308443
8444void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8445 tANI_U8 smeSessionId,
8446 tANI_U32 maxRateFlag)
8447{
8448 tpSirSmeUpdateMaxRateParams pRsp;
8449 tSirMsgQ msg;
8450
8451 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8452 if (NULL == pRsp)
8453 {
8454 limLog(pMac, LOGP, FL("Memory allocation failed"));
8455 return;
8456 }
8457 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8458 pRsp->maxRateFlag = maxRateFlag;
8459 pRsp->smeSessionId = smeSessionId;
8460 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8461 msg.bodyptr = pRsp;
8462 msg.bodyval = 0;
8463 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8464 return;
8465}
Abhishek Singh5d765712015-03-12 14:04:16 +05308466
8467void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8468{
8469 if( pMac->sys.gSysBbtPendingMgmtCount )
8470 {
8471 vos_spin_lock_acquire( &pMac->sys.lock );
8472 pMac->sys.gSysBbtPendingMgmtCount--;
8473 vos_spin_lock_release( &pMac->sys.lock );
8474 }
8475 else
8476 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8477}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308478
8479eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8480{
8481 tpSirTxBdStatus pTxBdStatus;
8482
8483 if (!pData)
8484 {
8485 limLog(pMac, LOGE, FL("pData is NULL"));
8486 return eHAL_STATUS_FAILURE;
8487 }
8488
8489 pTxBdStatus = (tpSirTxBdStatus) pData;
8490
8491 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8492 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8493 return eHAL_STATUS_SUCCESS;
8494}