blob: 8cc043ad09a2d53d003ea1aa30481f7110f8bd9a [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";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800593#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800594 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800596 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800598#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642#ifdef WLAN_FEATURE_VOWIFI_11R
643 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645#endif
646
647 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665
666 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700697 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700705 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700707 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800708 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800710#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700711 case eWNI_SME_GET_TSM_STATS_REQ:
712 return "eWNI_SME_GET_TSM_STATS_REQ";
713 case eWNI_SME_GET_TSM_STATS_RSP:
714 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800715#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 }
719#endif
720return "";
721}
722
723
724
725char *limResultCodeStr(tSirResultCodes resultCode)
726{
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 switch (resultCode)
728 {
729 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700854 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700855#ifdef GEN4_SCAN
856 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700863 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700865 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700867 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700868#else // GEN4_SCAN
869 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700870 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700872 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700873#endif // GEN4_SCAN
874
875 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700876 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700878}
879
880void
881limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
882{
883 limLog(pMac, logLevel, limMsgStr(msgType));
884}
885
Jeff Johnson295189b2012-06-20 16:38:30 -0700886void
887limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
888{
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
890 {
891 switch (msg->type)
892 {
893 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 break;
896 default:
897 limPrintMsgName(pMac, logLevel,msg->type);
898 break;
899 }
900 }
901}
902
903/**
904 * limInitMlm()
905 *
906 *FUNCTION:
907 * This function is called by limProcessSmeMessages() to
908 * initialize MLM state machine on STA
909 *
910 *PARAMS:
911 *
912 *LOGIC:
913 *
914 *ASSUMPTIONS:
915 * NA
916 *
917 *NOTE:
918 * NA
919 *
920 * @param pMac Pointer to Global MAC structure
921 * @return None
922 */
923void
924limInitMlm(tpAniSirGlobal pMac)
925{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700926 tANI_U32 retVal;
927
928 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700929
Jeff Johnsone7245742012-09-05 17:12:55 -0700930 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700931
932 /// Initialize scan result hash table
933 limReInitScanResults(pMac); //sep26th review
934
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700935#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
936 /// Initialize lfr scan result hash table
937 // Could there be a problem in multisession with SAP/P2P GO, when in the
938 // middle of FW bg scan, SAP started; Again that could be a problem even on
939 // infra + SAP/P2P GO too - TBD
940 limReInitLfrScanResults(pMac);
941#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700942
943 /// Initialize number of pre-auth contexts
944 pMac->lim.gLimNumPreAuthContexts = 0;
945
946 /// Initialize MAC based Authentication STA list
947 limInitPreAuthList(pMac);
948
949 //pMac->lim.gpLimMlmJoinReq = NULL;
950
951 if (pMac->lim.gLimTimersCreated)
952 return;
953
954 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700955 retVal = limCreateTimers(pMac);
956 if(retVal == TX_SUCCESS)
957 {
958 pMac->lim.gLimTimersCreated = 1;
959 }
960 else
961 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700962 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700963 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700964} /*** end limInitMlm() ***/
965
966
967
968/**
969 * limCleanupMlm()
970 *
971 *FUNCTION:
972 * This function is called to cleanup any resources
973 * allocated by the MLM state machine.
974 *
975 *PARAMS:
976 *
977 *LOGIC:
978 *
979 *ASSUMPTIONS:
980 * NA
981 *
982 *NOTE:
983 * It is assumed that BSS is already informed that we're leaving it
984 * before this function is called.
985 *
986 * @param pMac Pointer to Global MAC structure
987 * @param None
988 * @return None
989 */
990void
991limCleanupMlm(tpAniSirGlobal pMac)
992{
993 tANI_U32 n;
994 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530995#ifdef WLAN_FEATURE_11W
996 tANI_U32 bss_entry, sta_entry;
997 tpDphHashNode pStaDs = NULL;
998 tpPESession psessionEntry = NULL;
999#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001000
1001 if (pMac->lim.gLimTimersCreated == 1)
1002 {
1003 // Deactivate and delete MIN/MAX channel timers.
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1006 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1007 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1010
1011
1012 // Deactivate and delete channel switch timer.
1013 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1014 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1015
1016
1017 // Deactivate and delete addts response timer.
1018 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1019 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1020
1021 // Deactivate and delete Join failure timer.
1022 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1023 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1024
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001025 // Deactivate and delete Periodic Join Probe Request timer.
1026 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1027 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1028
Sushant Kaushik9e923872015-04-02 17:09:31 +05301029 // Deactivate and delete Auth Retry timer.
1030 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1031 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1032
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 // Deactivate and delete Association failure timer.
1034 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1035 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1036
1037 // Deactivate and delete Reassociation failure timer.
1038 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1039 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1040
1041 // Deactivate and delete Authentication failure timer.
1042 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1043 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1044
1045 // Deactivate and delete Heartbeat timer.
1046 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1047 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1048
1049 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1050 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1051 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1052
1053 // Deactivate and delete Quiet timer.
1054 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1055 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1056
1057 // Deactivate and delete Quiet BSS timer.
1058 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1059 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1060
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 // Deactivate and delete LIM background scan timer.
1062 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1063 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001064
1065
1066 // Deactivate and delete cnf wait timer
1067 for (n = 0; n < pMac->lim.maxStation; n++)
1068 {
1069 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1070 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1071 }
1072
1073 // Deactivate and delete keepalive timer
1074 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1075 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1076
1077 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1078
1079 //Deactivate any Authentication response timers
1080 limDeletePreAuthList(pMac);
1081
1082 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1083 {
1084 // Delete any Authentication response
1085 // timers, which might have been started.
1086 tx_timer_delete(&pAuthNode->timer);
1087 }
1088
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1090 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1091 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1092 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1093
1094#if 0 // The WPS PBC clean up timer is disabled
1095 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1096 {
1097 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1098 {
1099 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1100 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1101 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1102 }
1103 }
1104#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001105#ifdef WLAN_FEATURE_VOWIFI_11R
1106 // Deactivate and delete FT Preauth response timer
1107 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1108 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1109#endif
1110
Jeff Johnson295189b2012-06-20 16:38:30 -07001111
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001112#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001114 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1115 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1116#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001117
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001118 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1119 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1120
1121 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1122 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1123
Hoonki Leef63df0d2013-01-16 19:29:14 -08001124 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1125 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001126
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301127 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1128 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1129
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 pMac->lim.gLimTimersCreated = 0;
1131 }
1132
Agarwal Ashish888ca022014-11-05 14:25:56 +05301133#ifdef WLAN_FEATURE_11W
1134 /*
1135 * When SSR is triggered, we need to loop through
1136 * each STA associated per BSSId and deactivate/delete
1137 * the pmfSaQueryTimer for it
1138 */
1139 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1140 {
1141 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1142 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1143 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1144 {
1145 if (pMac->lim.gpSession[bss_entry].valid)
1146 {
1147 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1148 sta_entry++)
1149 {
1150 psessionEntry = &pMac->lim.gpSession[bss_entry];
1151 pStaDs = dphGetHashEntry(pMac, sta_entry,
1152 &psessionEntry->dph.dphHashTable);
1153 if (NULL == pStaDs)
1154 {
1155 continue;
1156 }
1157 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1158 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1159 pStaDs->staIndex) ;
1160 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1161 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1162 }
1163 }
1164 }
1165 }
1166#endif
1167
Jeff Johnson295189b2012-06-20 16:38:30 -07001168 /// Cleanup cached scan list
1169 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001170#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1171 /// Cleanup cached scan list
1172 limReInitLfrScanResults(pMac);
1173#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001174
1175} /*** end limCleanupMlm() ***/
1176
1177
1178
1179/**
1180 * limCleanupLmm()
1181 *
1182 *FUNCTION:
1183 * This function is called to cleanup any resources
1184 * allocated by LMM sub-module.
1185 *
1186 *PARAMS:
1187 *
1188 *LOGIC:
1189 *
1190 *ASSUMPTIONS:
1191 * NA
1192 *
1193 *NOTE:
1194 * NA
1195 *
1196 * @param pMac Pointer to Global MAC structure
1197 * @return None
1198 */
1199
1200void
1201limCleanupLmm(tpAniSirGlobal pMac)
1202{
Jeff Johnson295189b2012-06-20 16:38:30 -07001203} /*** end limCleanupLmm() ***/
1204
1205
1206
1207/**
1208 * limIsAddrBC()
1209 *
1210 *FUNCTION:
1211 * This function is called in various places within LIM code
1212 * to determine whether passed MAC address is a broadcast or not
1213 *
1214 *LOGIC:
1215 *
1216 *ASSUMPTIONS:
1217 * NA
1218 *
1219 *NOTE:
1220 * NA
1221 *
1222 * @param macAddr Indicates MAC address that need to be determined
1223 * whether it is Broadcast address or not
1224 *
1225 * @return true if passed address is Broadcast address else false
1226 */
1227
1228tANI_U8
1229limIsAddrBC(tSirMacAddr macAddr)
1230{
1231 int i;
1232 for (i = 0; i < 6; i++)
1233 {
1234 if ((macAddr[i] & 0xFF) != 0xFF)
1235 return false;
1236 }
1237
1238 return true;
1239} /****** end limIsAddrBC() ******/
1240
1241
1242
1243/**
1244 * limIsGroupAddr()
1245 *
1246 *FUNCTION:
1247 * This function is called in various places within LIM code
1248 * to determine whether passed MAC address is a group address or not
1249 *
1250 *LOGIC:
1251 * If least significant bit of first octet of the MAC address is
1252 * set to 1, it is a Group address.
1253 *
1254 *ASSUMPTIONS:
1255 * NA
1256 *
1257 *NOTE:
1258 * NA
1259 *
1260 * @param macAddr Indicates MAC address that need to be determined
1261 * whether it is Group address or not
1262 *
1263 * @return true if passed address is Group address else false
1264 */
1265
1266tANI_U8
1267limIsGroupAddr(tSirMacAddr macAddr)
1268{
1269 if ((macAddr[0] & 0x01) == 0x01)
1270 return true;
1271 else
1272 return false;
1273} /****** end limIsGroupAddr() ******/
1274
1275/**
1276 * limPostMsgApiNoWait()
1277 *
1278 *FUNCTION:
1279 * This function is called from other thread while posting a
1280 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1281 *
1282 *LOGIC:
1283 * NA
1284 *
1285 *ASSUMPTIONS:
1286 * NA
1287 *
1288 *NOTE:
1289 * NA
1290 *
1291 * @param pMsg - Pointer to the Global MAC structure
1292 * @param pMsg - Pointer to the message structure
1293 * @return None
1294 */
1295
1296tANI_U32
1297limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1298{
Jeff Johnson295189b2012-06-20 16:38:30 -07001299 limProcessMessages(pMac, pMsg);
1300 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001301} /*** end limPostMsgApiNoWait() ***/
1302
1303
1304
1305/**
1306 * limPrintMacAddr()
1307 *
1308 *FUNCTION:
1309 * This function is called to print passed MAC address
1310 * in : format.
1311 *
1312 *LOGIC:
1313 *
1314 *ASSUMPTIONS:
1315 * NA
1316 *
1317 *NOTE:
1318 * @param macAddr - MacAddr to be printed
1319 * @param logLevel - Loglevel to be used
1320 *
1321 * @return None.
1322 */
1323
1324void
1325limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1326{
1327 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001328 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001329} /****** end limPrintMacAddr() ******/
1330
1331
Jeff Johnson295189b2012-06-20 16:38:30 -07001332/*
1333 * limResetDeferredMsgQ()
1334 *
1335 *FUNCTION:
1336 * This function resets the deferred message queue parameters.
1337 *
1338 *PARAMS:
1339 * @param pMac - Pointer to Global MAC structure
1340 *
1341 *LOGIC:
1342 *
1343 *ASSUMPTIONS:
1344 * NA
1345 *
1346 *NOTE:
1347 * NA
1348 *
1349 *RETURNS:
1350 * None
1351 */
1352
1353void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1354{
1355 pMac->lim.gLimDeferredMsgQ.size =
1356 pMac->lim.gLimDeferredMsgQ.write =
1357 pMac->lim.gLimDeferredMsgQ.read = 0;
1358
1359}
1360
1361
1362#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1363#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1364
1365/*
1366 * limWriteDeferredMsgQ()
1367 *
1368 *FUNCTION:
1369 * This function queues up a deferred message for later processing on the
1370 * STA side.
1371 *
1372 *PARAMS:
1373 * @param pMac - Pointer to Global MAC structure
1374 * @param limMsg - a LIM message
1375 *
1376 *LOGIC:
1377 *
1378 *ASSUMPTIONS:
1379 * NA
1380 *
1381 *NOTE:
1382 * NA
1383 *
1384 *RETURNS:
1385 * None
1386 */
1387
1388tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1389{
1390 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001391 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1393 limMsg->type);)
1394
1395 /*
1396 ** check if the deferred message queue is full
1397 **/
1398 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1399 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001400 if(!(pMac->lim.deferredMsgCnt & 0xF))
1401 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001402 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 -07001403 }
1404 else
1405 {
1406 pMac->lim.deferredMsgCnt++;
1407 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 return TX_QUEUE_FULL;
1409 }
1410
1411 /*
1412 ** In the application, there should not be more than 1 message get
1413 ** queued up. If happens, flags a warning. In the future, this can
1414 ** happen.
1415 **/
1416 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1417 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001418 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 -07001419 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1420 limIsSystemInScanState(pMac),
1421 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1422 pMac->lim.gLimAddtsSent);)
1423 }
1424
1425 /*
1426 ** To prevent the deferred Q is full of management frames, only give them certain space
1427 **/
1428 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1429 {
1430 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1431 {
1432 tANI_U16 idx, count = 0;
1433 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1434 {
1435 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1436 {
1437 count++;
1438 }
1439 }
1440 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1441 {
1442 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001443 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 //Return error, caller knows what to do
1445 return TX_QUEUE_FULL;
1446 }
1447 }
1448 }
1449
1450 ++pMac->lim.gLimDeferredMsgQ.size;
1451
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001452 /* reset the count here since we are able to defer the message */
1453 if(pMac->lim.deferredMsgCnt != 0)
1454 {
1455 pMac->lim.deferredMsgCnt = 0;
1456 }
1457
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 /*
1459 ** if the write pointer hits the end of the queue, rewind it
1460 **/
1461 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1462 pMac->lim.gLimDeferredMsgQ.write = 0;
1463
1464 /*
1465 ** save the message to the queue and advanced the write pointer
1466 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301467 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1468 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 (tANI_U8 *)limMsg,
1470 sizeof(tSirMsgQ));
1471 return TX_SUCCESS;
1472
1473}
1474
1475/*
1476 * limReadDeferredMsgQ()
1477 *
1478 *FUNCTION:
1479 * This function dequeues a deferred message for processing on the
1480 * STA side.
1481 *
1482 *PARAMS:
1483 * @param pMac - Pointer to Global MAC structure
1484 *
1485 *LOGIC:
1486 *
1487 *ASSUMPTIONS:
1488 * NA
1489 *
1490 *NOTE:
1491 *
1492 *
1493 *RETURNS:
1494 * Returns the message at the head of the deferred message queue
1495 */
1496
1497tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1498{
1499 tSirMsgQ *msg;
1500
1501 /*
1502 ** check any messages left. If no, return
1503 **/
1504 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1505 return NULL;
1506
1507 /*
1508 ** decrement the queue size
1509 **/
1510 pMac->lim.gLimDeferredMsgQ.size--;
1511
1512 /*
1513 ** retrieve the message from the head of the queue
1514 **/
1515 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1516
1517 /*
1518 ** advance the read pointer
1519 **/
1520 pMac->lim.gLimDeferredMsgQ.read++;
1521
1522 /*
1523 ** if the read pointer hits the end of the queue, rewind it
1524 **/
1525 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1526 pMac->lim.gLimDeferredMsgQ.read = 0;
1527
1528 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001529 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1531 msg->type);)
1532
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001533 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 limIsSystemInScanState(pMac),
1535 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1536 pMac->lim.gLimAddtsSent);)
1537
1538 return(msg);
1539}
1540
1541tSirRetStatus
1542limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1543 tSirMsgQ *pMsg,
1544 tANI_U8 qType)
1545{
1546// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 SysProcessMmhMsg(pMac, pMsg);
1548 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001549}
1550
1551char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1552{
1553#ifdef FIXME_GEN6
1554
1555 if (type == SIR_MAC_MGMT_FRAME)
1556 {
1557 switch (subType)
1558 {
1559 case SIR_MAC_MGMT_ASSOC_REQ:
1560 return "MAC_MGMT_ASSOC_REQ";
1561 case SIR_MAC_MGMT_ASSOC_RSP:
1562 return "MAC_MGMT_ASSOC_RSP";
1563 case SIR_MAC_MGMT_REASSOC_REQ:
1564 return "MAC_MGMT_REASSOC_REQ";
1565 case SIR_MAC_MGMT_REASSOC_RSP:
1566 return "MAC_MGMT_REASSOC_RSP";
1567 case SIR_MAC_MGMT_PROBE_REQ:
1568 return "MAC_MGMT_PROBE_REQ";
1569 case SIR_MAC_MGMT_PROBE_RSP:
1570 return "MAC_MGMT_PROBE_RSP";
1571 case SIR_MAC_MGMT_BEACON:
1572 return "MAC_MGMT_BEACON";
1573 case SIR_MAC_MGMT_ATIM:
1574 return "MAC_MGMT_ATIM";
1575 case SIR_MAC_MGMT_DISASSOC:
1576 return "MAC_MGMT_DISASSOC";
1577 case SIR_MAC_MGMT_AUTH:
1578 return "MAC_MGMT_AUTH";
1579 case SIR_MAC_MGMT_DEAUTH:
1580 return "MAC_MGMT_DEAUTH";
1581 case SIR_MAC_MGMT_ACTION:
1582 return "MAC_MGMT_ACTION";
1583 case SIR_MAC_MGMT_RESERVED15:
1584 return "MAC_MGMT_RESERVED15";
1585 default:
1586 return "Unknown MGMT Frame";
1587 }
1588 }
1589
1590 else if (type == SIR_MAC_CTRL_FRAME)
1591 {
1592 switch (subType)
1593 {
1594 case SIR_MAC_CTRL_RR:
1595 return "MAC_CTRL_RR";
1596 case SIR_MAC_CTRL_BAR:
1597 return "MAC_CTRL_BAR";
1598 case SIR_MAC_CTRL_BA:
1599 return "MAC_CTRL_BA";
1600 case SIR_MAC_CTRL_PS_POLL:
1601 return "MAC_CTRL_PS_POLL";
1602 case SIR_MAC_CTRL_RTS:
1603 return "MAC_CTRL_RTS";
1604 case SIR_MAC_CTRL_CTS:
1605 return "MAC_CTRL_CTS";
1606 case SIR_MAC_CTRL_ACK:
1607 return "MAC_CTRL_ACK";
1608 case SIR_MAC_CTRL_CF_END:
1609 return "MAC_CTRL_CF_END";
1610 case SIR_MAC_CTRL_CF_END_ACK:
1611 return "MAC_CTRL_CF_END_ACK";
1612 default:
1613 return "Unknown CTRL Frame";
1614 }
1615 }
1616
1617 else if (type == SIR_MAC_DATA_FRAME)
1618 {
1619 switch (subType)
1620 {
1621 case SIR_MAC_DATA_DATA:
1622 return "MAC_DATA_DATA";
1623 case SIR_MAC_DATA_DATA_ACK:
1624 return "MAC_DATA_DATA_ACK";
1625 case SIR_MAC_DATA_DATA_POLL:
1626 return "MAC_DATA_DATA_POLL";
1627 case SIR_MAC_DATA_DATA_ACK_POLL:
1628 return "MAC_DATA_DATA_ACK_POLL";
1629 case SIR_MAC_DATA_NULL:
1630 return "MAC_DATA_NULL";
1631 case SIR_MAC_DATA_NULL_ACK:
1632 return "MAC_DATA_NULL_ACK";
1633 case SIR_MAC_DATA_NULL_POLL:
1634 return "MAC_DATA_NULL_POLL";
1635 case SIR_MAC_DATA_NULL_ACK_POLL:
1636 return "MAC_DATA_NULL_ACK_POLL";
1637 case SIR_MAC_DATA_QOS_DATA:
1638 return "MAC_DATA_QOS_DATA";
1639 case SIR_MAC_DATA_QOS_DATA_ACK:
1640 return "MAC_DATA_QOS_DATA_ACK";
1641 case SIR_MAC_DATA_QOS_DATA_POLL:
1642 return "MAC_DATA_QOS_DATA_POLL";
1643 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1644 return "MAC_DATA_QOS_DATA_ACK_POLL";
1645 case SIR_MAC_DATA_QOS_NULL:
1646 return "MAC_DATA_QOS_NULL";
1647 case SIR_MAC_DATA_QOS_NULL_ACK:
1648 return "MAC_DATA_QOS_NULL_ACK";
1649 case SIR_MAC_DATA_QOS_NULL_POLL:
1650 return "MAC_DATA_QOS_NULL_POLL";
1651 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1652 return "MAC_DATA_QOS_NULL_ACK_POLL";
1653 default:
1654 return "Unknown Data Frame";
1655 }
1656 }
1657 else
1658 return "Unknown";
1659#endif
1660return "";
1661}
1662
Jeff Johnson295189b2012-06-20 16:38:30 -07001663void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1664{
1665 int i;
1666 static int enable;
1667 tUpdateBeaconParams beaconParams;
1668
1669 tpPESession psessionEntry = limIsApSessionActive(pMac);
1670
1671 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001672 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001673 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001675 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301676
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301677 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001678 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001679
1680 beaconParams.paramChangeBitmap = 0;
1681 /*
1682 ** This is doing a 2 pass check. The first pass is to invalidate
1683 ** all the cache entries. The second pass is to decide whether to
1684 ** disable protection.
1685 **/
1686 if (!enable)
1687 {
1688
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001689 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 psessionEntry->gLimOlbcParams.numSta = 0;
1691 psessionEntry->gLimOverlap11gParams.numSta = 0;
1692 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1693 psessionEntry->gLimNonGfParams.numSta = 0;
1694 psessionEntry->gLimLsigTxopParams.numSta = 0;
1695
1696 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1697 pMac->lim.protStaOverlapCache[i].active = false;
1698
1699 enable = 1;
1700 }
1701 else
1702 {
1703
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001704 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 {
1706 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1707 {
1708 if (!psessionEntry->gLim11bParams.protectionEnabled)
1709 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001710 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1712 }
1713 }
1714 }
1715
1716 if (!psessionEntry->gLimOverlap11gParams.numSta)
1717 {
1718 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1719 {
1720 if (!psessionEntry->gLim11gParams.protectionEnabled)
1721 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001722 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001723 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1724 }
1725 }
1726 }
1727
1728 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1729 {
1730 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1731 {
1732 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1733 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001734 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1736 }
1737 }
1738 }
1739
1740 enable = 0;
1741 }
1742
1743 if(beaconParams.paramChangeBitmap)
1744 {
1745 schSetFixedBeaconFields(pMac,psessionEntry);
1746 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1747 }
1748
1749 // Start OLBC timer
1750 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1751 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001752 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 }
1754}
Jeff Johnson295189b2012-06-20 16:38:30 -07001755
1756/**
1757 * limIsNullSsid()
1758 *
1759 *FUNCTION:
1760 * This function checks if Ssid supplied is Null SSID
1761 *
1762 *
1763 *LOGIC:
1764 *
1765 *ASSUMPTIONS:
1766 * NA
1767 *
1768 *NOTE:
1769 * NA
1770 *
1771 * @param tSirMacSSid *
1772 *
1773 *
1774 * @return true if SSID is Null SSID else false
1775 */
1776
1777tANI_U8
1778limIsNullSsid( tSirMacSSid *pSsid )
1779{
1780 tANI_U8 fNullSsid = false;
1781 tANI_U32 SsidLength;
1782 tANI_U8 *pSsidStr;
1783
1784 do
1785 {
1786 if ( 0 == pSsid->length )
1787 {
1788 fNullSsid = true;
1789 break;
1790 }
1791
1792#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301793 /* If the first charactes is space and SSID length is 1
1794 * then consider it as NULL SSID*/
1795 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1796 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301798 fNullSsid = true;
1799 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 }
1801 else
1802 {
1803 /* check if all the charactes in SSID are NULL*/
1804 SsidLength = pSsid->length;
1805 pSsidStr = pSsid->ssId;
1806
1807 while ( SsidLength )
1808 {
1809 if( *pSsidStr )
1810 break;
1811
1812 pSsidStr++;
1813 SsidLength--;
1814 }
1815
1816 if( 0 == SsidLength )
1817 {
1818 fNullSsid = true;
1819 break;
1820 }
1821 }
1822 }
1823 while( 0 );
1824
1825 return fNullSsid;
1826} /****** end limIsNullSsid() ******/
1827
1828
1829
Jeff Johnson295189b2012-06-20 16:38:30 -07001830
1831/** -------------------------------------------------------------
1832\fn limUpdateProtStaParams
1833\brief updates protection related counters.
1834\param tpAniSirGlobal pMac
1835\param tSirMacAddr peerMacAddr
1836\param tLimProtStaCacheType protStaCacheType
1837\param tHalBitVal gfSupported
1838\param tHalBitVal lsigTxopSupported
1839\return None
1840 -------------------------------------------------------------*/
1841void
1842limUpdateProtStaParams(tpAniSirGlobal pMac,
1843tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1844tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1845tpPESession psessionEntry)
1846{
1847 tANI_U32 i;
1848
1849 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1850 limLog(pMac,LOG1, FL("Addr : "));
1851 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1852
1853 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1854 {
1855 if (psessionEntry->protStaCache[i].active)
1856 {
1857 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1858 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1859
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301860 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 psessionEntry->protStaCache[i].addr,
1862 peerMacAddr, sizeof(tSirMacAddr)))
1863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001864 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 return;
1866 }
1867 }
1868 }
1869
1870 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1871 {
1872 if (!psessionEntry->protStaCache[i].active)
1873 break;
1874 }
1875
1876 if (i >= LIM_PROT_STA_CACHE_SIZE)
1877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001878 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 return;
1880 }
1881
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301882 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 peerMacAddr,
1884 sizeof(tSirMacAddr));
1885
1886 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1887 psessionEntry->protStaCache[i].active = true;
1888 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1889 {
1890 psessionEntry->gLim11bParams.numSta++;
1891 limLog(pMac,LOG1, FL("11B, "));
1892 }
1893 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1894 {
1895 psessionEntry->gLim11gParams.numSta++;
1896 limLog(pMac,LOG1, FL("11G, "));
1897 }
1898 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1899 {
1900 psessionEntry->gLimHt20Params.numSta++;
1901 limLog(pMac,LOG1, FL("HT20, "));
1902 }
1903
1904 if(!gfSupported)
1905 {
1906 psessionEntry->gLimNonGfParams.numSta++;
1907 limLog(pMac,LOG1, FL("NonGf, "));
1908 }
1909 if(!lsigTxopSupported)
1910 {
1911 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001912 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 }
1914}// ---------------------------------------------------------------------
1915
1916/** -------------------------------------------------------------
1917\fn limDecideApProtection
1918\brief Decides all the protection related staiton coexistence and also sets
1919\ short preamble and short slot appropriately. This function will be called
1920\ when AP is ready to send assocRsp tp the station joining right now.
1921\param tpAniSirGlobal pMac
1922\param tSirMacAddr peerMacAddr
1923\return None
1924 -------------------------------------------------------------*/
1925void
1926limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1927{
1928 tANI_U16 tmpAid;
1929 tpDphHashNode pStaDs;
1930 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1931 tANI_U32 phyMode;
1932 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1933 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1934
1935 pBeaconParams->paramChangeBitmap = 0;
1936 // check whether to enable protection or not
1937 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1938 if(NULL == pStaDs)
1939 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301940 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 return;
1942 }
1943 limGetRfBand(pMac, &rfBand, psessionEntry);
1944 //if we are in 5 GHZ band
1945 if(SIR_BAND_5_GHZ == rfBand)
1946 {
1947 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1948 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001949 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 {
1951 //we are 11N and 11A station is joining.
1952 //protection from 11A required.
1953 if(false == pStaDs->mlmStaContext.htCapability)
1954 {
1955 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1956 return;
1957 }
1958 }
1959 }
1960 else if(SIR_BAND_2_4_GHZ== rfBand)
1961 {
1962 limGetPhyMode(pMac, &phyMode, psessionEntry);
1963
1964 //We are 11G. Check if we need protection from 11b Stations.
1965 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001966 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 {
1968
1969 if (pStaDs->erpEnabled== eHAL_CLEAR)
1970 {
1971 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1972 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001973 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1975 }
1976 }
1977
1978 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001979 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 {
1981 //check if we need protection from 11b station
1982 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1983 (!pStaDs->mlmStaContext.htCapability))
1984 {
1985 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1986 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001987 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1989 }
1990 //station being joined is non-11b and non-ht ==> 11g device
1991 else if(!pStaDs->mlmStaContext.htCapability)
1992 {
1993 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1994 //enable protection
1995 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1996 }
1997 //ERP mode is enabled for the latest station joined
1998 //latest station joined is HT capable
1999 //This case is being handled in common code (commn between both the bands) below.
2000 }
2001 }
2002
2003 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002004 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 (true == pStaDs->mlmStaContext.htCapability))
2006 {
2007 if(!pStaDs->htGreenfield)
2008 {
2009 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2010 gfSupported = eHAL_CLEAR;
2011 }
2012 //Station joining is HT 20Mhz
2013 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2014 {
2015 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2016 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2017 }
2018 //Station joining does not support LSIG TXOP Protection
2019 if(!pStaDs->htLsigTXOPProtection)
2020 {
2021 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2022 lsigTxopSupported = eHAL_CLEAR;
2023 }
2024 }
2025
2026 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2027 gfSupported, lsigTxopSupported, psessionEntry);
2028
2029 return;
2030}
Jeff Johnson295189b2012-06-20 16:38:30 -07002031
2032
2033/** -------------------------------------------------------------
2034\fn limEnableOverlap11gProtection
2035\brief wrapper function for setting overlap 11g protection.
2036\param tpAniSirGlobal pMac
2037\param tpUpdateBeaconParams pBeaconParams
2038\param tpSirMacMgmtHdr pMh
2039\return None
2040 -------------------------------------------------------------*/
2041void
2042limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2043tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2044{
2045 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2046
2047 if (psessionEntry->gLimOlbcParams.numSta &&
2048 !psessionEntry->gLimOlbcParams.protectionEnabled)
2049 {
2050 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002051 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2053 }
2054}
2055
2056
2057/** -------------------------------------------------------------
2058\fn limUpdateShortPreamble
2059\brief Updates short preamble if needed when a new station joins.
2060\param tpAniSirGlobal pMac
2061\param tSirMacAddr peerMacAddr
2062\param tpUpdateBeaconParams pBeaconParams
2063\return None
2064 -------------------------------------------------------------*/
2065void
2066limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2067 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2068{
2069 tANI_U16 tmpAid;
2070 tpDphHashNode pStaDs;
2071 tANI_U32 phyMode;
2072 tANI_U16 i;
2073
2074 // check whether to enable protection or not
2075 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2076
2077 limGetPhyMode(pMac, &phyMode, psessionEntry);
2078
2079 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2080
2081 {
2082 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2083 {
2084 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2085 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2086
2087 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2088 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2090 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2091 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302092 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2094 peerMacAddr, sizeof(tSirMacAddr)))
2095 return;
2096 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 {
2098 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2099 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302100 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2102 peerMacAddr, sizeof(tSirMacAddr)))
2103 return;
2104 }
2105 }
2106 }
2107
2108
2109 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2110 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2112 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2113 break;
2114 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 {
2116 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2117 break;
2118 }
2119 }
2120
2121 if (i >= LIM_PROT_STA_CACHE_SIZE)
2122 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2124 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2125 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2126 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2127 return;
2128 }
2129 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 {
2131 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2132 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2133 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2134 return;
2135 }
2136
2137 }
2138
2139
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302140 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2141 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 peerMacAddr, sizeof(tSirMacAddr));
2143 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2144 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2145 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302147 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 peerMacAddr, sizeof(tSirMacAddr));
2149 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2150 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2151 }
2152
2153
2154 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002155 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002156
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002158 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 }
2160 }
2161}
2162
2163/** -------------------------------------------------------------
2164\fn limUpdateShortSlotTime
2165\brief Updates short slot time if needed when a new station joins.
2166\param tpAniSirGlobal pMac
2167\param tSirMacAddr peerMacAddr
2168\param tpUpdateBeaconParams pBeaconParams
2169\return None
2170 -------------------------------------------------------------*/
2171
2172void
2173limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2174 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2175{
2176 tANI_U16 tmpAid;
2177 tpDphHashNode pStaDs;
2178 tANI_U32 phyMode;
2179 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 tANI_U16 i;
2181
2182 // check whether to enable protection or not
2183 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2184 limGetPhyMode(pMac, &phyMode, psessionEntry);
2185
Jeff Johnsone7245742012-09-05 17:12:55 -07002186 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2187 * be always 1 and in 11b case, it should be always 0
2188 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2190 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002191 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2192 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2193 * it in limDecideShortSlot
2194 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2196 {
2197 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2198 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2199 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2200 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2202 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2203 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302204 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2206 peerMacAddr, sizeof(tSirMacAddr)))
2207 return;
2208 }
2209 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 {
2211 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2212 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302213 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2215 peerMacAddr, sizeof(tSirMacAddr)))
2216 return;
2217 }
2218 }
2219 }
2220
2221 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2222 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2224 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2225 break;
2226 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 {
2228 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2229 break;
2230 }
2231 }
2232
2233 if (i >= LIM_PROT_STA_CACHE_SIZE)
2234 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2236 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2237 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2238 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2239 return;
2240 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 {
2242 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2243 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2244 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2245 return;
2246 }
2247 }
2248
2249
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302251 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 peerMacAddr, sizeof(tSirMacAddr));
2253 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2254 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2255 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302257 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 peerMacAddr, sizeof(tSirMacAddr));
2259 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2260 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2261 }
2262 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2263
Jeff Johnsone7245742012-09-05 17:12:55 -07002264 /* 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
2265 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2266 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002268 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 {
2270 // enable long slot time
2271 pBeaconParams->fShortSlotTime = false;
2272 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002273 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002274 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 }
2276 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002278 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
2280 // enable long slot time
2281 pBeaconParams->fShortSlotTime = false;
2282 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002283 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002284 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 }
2286 }
2287 }
2288 }
2289}
2290
Jeff Johnson295189b2012-06-20 16:38:30 -07002291
2292/** -------------------------------------------------------------
2293\fn limDecideStaProtectionOnAssoc
2294\brief Decide protection related settings on Sta while association.
2295\param tpAniSirGlobal pMac
2296\param tpSchBeaconStruct pBeaconStruct
2297\return None
2298 -------------------------------------------------------------*/
2299void
2300limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2301 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2302{
2303 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2304 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2305
2306 limGetRfBand(pMac, &rfBand, psessionEntry);
2307 limGetPhyMode(pMac, &phyMode, psessionEntry);
2308
2309 if(SIR_BAND_5_GHZ == rfBand)
2310 {
2311 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2312 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2313 {
2314 if(pMac->lim.cfgProtection.fromlla)
2315 psessionEntry->beaconParams.llaCoexist = true;
2316 }
2317 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2318 {
2319 if(pMac->lim.cfgProtection.ht20)
2320 psessionEntry->beaconParams.ht20Coexist = true;
2321 }
2322
2323 }
2324 else if(SIR_BAND_2_4_GHZ == rfBand)
2325 {
2326 //spec 7.3.2.13
2327 //UseProtection will be set when nonERP STA is associated.
2328 //NonERPPresent bit will be set when:
2329 //--nonERP Sta is associated OR
2330 //--nonERP Sta exists in overlapping BSS
2331 //when useProtection is not set then protection from nonERP stations is optional.
2332
2333 //CFG protection from 11b is enabled and
2334 //11B device in the BSS
2335 /* TODO, This is not sessionized */
2336 if (phyMode != WNI_CFG_PHY_MODE_11B)
2337 {
2338 if (pMac->lim.cfgProtection.fromllb &&
2339 pBeaconStruct->erpPresent &&
2340 (pBeaconStruct->erpIEInfo.useProtection ||
2341 pBeaconStruct->erpIEInfo.nonErpPresent))
2342 {
2343 psessionEntry->beaconParams.llbCoexist = true;
2344 }
2345 //AP has no 11b station associated.
2346 else
2347 {
2348 psessionEntry->beaconParams.llbCoexist = false;
2349 }
2350 }
2351 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002352 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 (pBeaconStruct->HTInfo.present))
2354 {
2355 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2356
2357 //Obss Non HT STA present mode
2358 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2359
2360
2361 //CFG protection from 11G is enabled and
2362 //our AP has at least one 11G station associated.
2363 if(pMac->lim.cfgProtection.fromllg &&
2364 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2365 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2366 (!psessionEntry->beaconParams.llbCoexist))
2367 {
2368 if(pMac->lim.cfgProtection.fromllg)
2369 psessionEntry->beaconParams.llgCoexist = true;
2370 }
2371
2372 //AP has only HT stations associated and at least one station is HT 20
2373 //disable protection from any non-HT devices.
2374 //decision for disabling protection from 11b has already been taken above.
2375 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2376 {
2377 //Disable protection from 11G station.
2378 psessionEntry->beaconParams.llgCoexist = false;
2379 //CFG protection from HT 20 is enabled.
2380 if(pMac->lim.cfgProtection.ht20)
2381 psessionEntry->beaconParams.ht20Coexist = true;
2382 }
2383 //Disable protection from non-HT and HT20 devices.
2384 //decision for disabling protection from 11b has already been taken above.
2385 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2386 {
2387 psessionEntry->beaconParams.llgCoexist = false;
2388 psessionEntry->beaconParams.ht20Coexist = false;
2389 }
2390
2391 }
2392 }
2393
2394 //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 -07002395 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 (pBeaconStruct->HTInfo.present))
2397 {
2398 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2399 psessionEntry->beaconParams.fRIFSMode =
2400 ( tANI_U8 ) htInfo.rifsMode;
2401 psessionEntry->beaconParams.llnNonGFCoexist =
2402 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2403 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2404 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2405 }
2406}
2407
2408
2409/** -------------------------------------------------------------
2410\fn limDecideStaProtection
2411\brief Decides protection related settings on Sta while processing beacon.
2412\param tpAniSirGlobal pMac
2413\param tpUpdateBeaconParams pBeaconParams
2414\return None
2415 -------------------------------------------------------------*/
2416void
2417limDecideStaProtection(tpAniSirGlobal pMac,
2418 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2419{
2420
2421 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2422 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2423
2424 limGetRfBand(pMac, &rfBand, psessionEntry);
2425 limGetPhyMode(pMac, &phyMode, psessionEntry);
2426
2427 if(SIR_BAND_5_GHZ == rfBand)
2428 {
2429 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002430 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 (pBeaconStruct->HTInfo.present))
2432 {
2433 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2434 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2435 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2436 {
2437 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2438 }
2439 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2440 //protection from HT20 if needed.
2441 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2442 {
2443 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2444 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2445 }
2446 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2447 {
2448 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2449 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2450 }
2451 }
2452 }
2453 else if(SIR_BAND_2_4_GHZ == rfBand)
2454 {
2455 /* spec 7.3.2.13
2456 * UseProtection will be set when nonERP STA is associated.
2457 * NonERPPresent bit will be set when:
2458 * --nonERP Sta is associated OR
2459 * --nonERP Sta exists in overlapping BSS
2460 * when useProtection is not set then protection from nonERP stations is optional.
2461 */
2462
2463 if (phyMode != WNI_CFG_PHY_MODE_11B)
2464 {
2465 if (pBeaconStruct->erpPresent &&
2466 (pBeaconStruct->erpIEInfo.useProtection ||
2467 pBeaconStruct->erpIEInfo.nonErpPresent))
2468 {
2469 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2470 }
2471 //AP has no 11b station associated.
2472 else
2473 {
2474 //disable protection from 11b station
2475 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2476 }
2477 }
2478
2479 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002480 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 (pBeaconStruct->HTInfo.present))
2482 {
2483
2484 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2485 //AP has at least one 11G station associated.
2486 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2487 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2488 (!psessionEntry->beaconParams.llbCoexist))
2489 {
2490 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2491
2492 }
2493
2494 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2495 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2496 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2497 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2498 {
2499 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2500
2501 //AP has only HT stations associated and at least one station is HT 20
2502 //disable protection from any non-HT devices.
2503 //decision for disabling protection from 11b has already been taken above.
2504 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2505 {
2506 //Disable protection from 11G station.
2507 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2508
2509 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2510 }
2511 //Disable protection from non-HT and HT20 devices.
2512 //decision for disabling protection from 11b has already been taken above.
2513 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2514 {
2515 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2516 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2517
2518 }
2519 }
2520 }
2521 }
2522
2523 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002524 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002525 (pBeaconStruct->HTInfo.present))
2526 {
2527 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2528 //Check for changes in protection related factors other than HT operating mode.
2529 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2530 if ( psessionEntry->beaconParams.fRIFSMode !=
2531 ( tANI_U8 ) htInfo.rifsMode )
2532 {
2533 pBeaconParams->fRIFSMode =
2534 psessionEntry->beaconParams.fRIFSMode =
2535 ( tANI_U8 ) htInfo.rifsMode;
2536 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2537 }
2538
2539 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2540 htInfo.nonGFDevicesPresent )
2541 {
2542 pBeaconParams->llnNonGFCoexist =
2543 psessionEntry->beaconParams.llnNonGFCoexist =
2544 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2545 pBeaconParams->paramChangeBitmap |=
2546 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2547 }
2548
2549 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2550 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2551 {
2552 pBeaconParams->fLsigTXOPProtectionFullSupport =
2553 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2554 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2555 pBeaconParams->paramChangeBitmap |=
2556 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2557 }
2558
2559 // For Station just update the global lim variable, no need to send message to HAL
2560 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2561 //stations in overlapping BSS.
2562 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2563 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2564
2565 }
2566}
2567
2568
2569/**
2570 * limProcessChannelSwitchTimeout()
2571 *
2572 *FUNCTION:
2573 * This function is invoked when Channel Switch Timer expires at
2574 * the STA. Now, STA must stop traffic, and then change/disable
2575 * primary or secondary channel.
2576 *
2577 *
2578 *NOTE:
2579 * @param pMac - Pointer to Global MAC structure
2580 * @return None
2581 */
2582void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2583{
2584 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002585 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002586
2587 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2588 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002589 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 return;
2591 }
2592
2593 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2594 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002595 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 -07002596 return;
2597 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002598 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302599
2600 /*
2601 * If Lim allows Switch channel on same channel on which preauth
2602 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2603 * during preauth rsp handling hence firmware may crash on ENTER/
2604 * EXIT BMPS request.
2605 */
2606 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2607 {
2608 limLog(pMac, LOGE,
2609 FL("Avoid Switch Channel req during pre auth"));
2610 return;
2611 }
2612
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 /*
2614 * This potentially can create issues if the function tries to set
2615 * channel while device is in power-save, hence putting an extra check
2616 * to verify if the device is in power-save or not
2617 */
2618 if(!limIsSystemInActiveState(pMac))
2619 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002620 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002621 return;
2622 }
2623
2624 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002625 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002626
2627 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002628 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002629
2630 /* Check if the AP is switching to a channel that we support.
2631 * Else, just don't bother to switch. Indicate HDD to look for a
2632 * better AP to associate
2633 */
2634 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2635 {
2636 /* We need to restore pre-channelSwitch state on the STA */
2637 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2638 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002639 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 return;
2641 }
2642
2643 /* If the channel-list that AP is asking us to switch is invalid,
2644 * then we cannot switch the channel. Just disassociate from AP.
2645 * We will find a better AP !!!
2646 */
2647 limTearDownLinkWithAp(pMac,
2648 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2649 eSIR_MAC_UNSPEC_FAILURE_REASON);
2650 return;
2651 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002652 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2653 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002654 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 {
2656 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002657 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2658 if ( isLimSessionOffChannel(pMac,
2659 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2660 {
Kanchanapally, Vidyullatha35570872015-03-18 17:26:57 +05302661 if (limIsLinkSuspended(pMac))
2662 {
2663 limLog(pMac, LOGE, FL("Link is already suspended for "
2664 "some other reason. Return here for sessionId:%d"),
2665 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2666 return;
2667 }
2668
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002669 limSuspendLink(pMac,
2670 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2671 limProcessChannelSwitchSuspendLink,
2672 (tANI_U32*)psessionEntry );
2673 }
2674 else
2675 {
2676 limProcessChannelSwitchSuspendLink(pMac,
2677 eHAL_STATUS_SUCCESS,
2678 (tANI_U32*)psessionEntry);
2679 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 break;
2681
2682 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002683 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002684 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002686 psessionEntry->gLimChannelSwitch.secondarySubBand);
2687 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 case eLIM_CHANNEL_SWITCH_IDLE:
2690 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002691 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2693 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002694 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 }
2696 return; /* Please note, this is 'return' and not 'break' */
2697 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002698}
Jeff Johnson295189b2012-06-20 16:38:30 -07002699
2700/**
2701 * limUpdateChannelSwitch()
2702 *
2703 *FUNCTION:
2704 * This function is invoked whenever Station receives
2705 * either 802.11h channel switch IE or airgo proprietary
2706 * channel switch IE.
2707 *
2708 *NOTE:
2709 * @param pMac - Pointer to Global MAC structure
2710 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2711 * @param psessionentry
2712 */
2713void
2714limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2715{
2716
2717 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2719 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002720#ifdef WLAN_FEATURE_11AC
2721 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2722#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002723
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002725
2726 /* STA either received proprietary channel switch IE or 802.11h
2727 * standard channel switch IE.
2728 */
2729 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2730 {
2731 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2732
2733 /* Add logic to determine which change this is: */
2734 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002735 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2736 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2737 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2738 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2739 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002741 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 }
2743 else
2744 {
2745 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002746 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2747 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2748 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002750 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002751#ifdef WLAN_FEATURE_11AC
2752 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2753 if(pBeacon->WiderBWChanSwitchAnnPresent)
2754 {
2755 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2756 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2757 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2758 }
2759#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002760
2761 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002762 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2763 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002764
2765 /* Do not bother to look and operate on extended channel switch element
2766 * if our own channel-bonding state is not enabled
2767 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002768 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 {
2770 if (pBeacon->extChannelSwitchPresent)
2771 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002772 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2773 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002775 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2776 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002778#ifdef WLAN_FEATURE_11AC
2779 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2780 {
2781 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2782 {
2783 if(pBeacon->extChannelSwitchPresent)
2784 {
2785 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2786 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2787 {
2788 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2789 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2790 psessionEntry->gLimChannelSwitch.primaryChannel,
2791 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2792 pWiderChnlSwitch->newCenterChanFreq0,
2793 psessionEntry);
2794 }
2795 }
2796 }
2797 }
2798#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002799 }
2800 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002801 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002802
2803
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2805 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002806 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 }
2808
2809 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002810 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002811 psessionEntry->peSessionId,
2812 psessionEntry->gLimChannelSwitch.primaryChannel,
2813 psessionEntry->gLimChannelSwitch.secondarySubBand,
2814 psessionEntry->gLimChannelSwitch.switchCount,
2815 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 return;
2817}
2818
2819/**
2820 * limCancelDot11hChannelSwitch
2821 *
2822 *FUNCTION:
2823 * This function is called when STA does not send updated channel-swith IE
2824 * after indicating channel-switch start. This will cancel the channel-swith
2825 * timer which is already running.
2826 *
2827 *LOGIC:
2828 *
2829 *ASSUMPTIONS:
2830 *
2831 *NOTE:
2832 *
2833 * @param pMac - Pointer to Global MAC structure
2834 *
2835 * @return None
2836 */
2837void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2838{
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2840 return;
2841
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002842 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002843 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002844
2845 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2846 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002847 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 }
2849
2850 /* We need to restore pre-channelSwitch state on the STA */
2851 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2852 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002853 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002854
2855 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002856}
2857
2858/**----------------------------------------------
2859\fn limCancelDot11hQuiet
2860\brief Cancel the quieting on Station if latest
2861 beacon doesn't contain quiet IE in it.
2862
2863\param pMac
2864\return NONE
2865-----------------------------------------------*/
2866void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2867{
Jeff Johnson295189b2012-06-20 16:38:30 -07002868 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2869 return;
2870
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002873 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2875 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002876 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 }
2878 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002879 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002881 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002882 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2883 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002884 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 }
2886 /**
2887 * If the channel switch is already running in silent mode, dont resume the
2888 * transmission. Channel switch timer when timeout, transmission will be resumed.
2889 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002890 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2891 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 {
2893 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002894 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 }
2896 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002897 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002898}
2899
2900/**
2901 * limProcessQuietTimeout
2902 *
2903 * FUNCTION:
2904 * This function is active only on the STA.
2905 * Handles SIR_LIM_QUIET_TIMEOUT
2906 *
2907 * LOGIC:
2908 * This timeout can occur under only one circumstance:
2909 *
2910 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2911 * This indicates that the timeout "interval" has
2912 * expired. This is a trigger for the STA to now
2913 * shut-off Tx/Rx for the specified gLimQuietDuration
2914 * -> The TIMER object gLimQuietBssTimer is
2915 * activated
2916 * -> With timeout = gLimQuietDuration
2917 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2918 *
2919 * ASSUMPTIONS:
2920 * Using two TIMER objects -
2921 * gLimQuietTimer & gLimQuietBssTimer
2922 *
2923 * NOTE:
2924 *
2925 * @param pMac - Pointer to Global MAC structure
2926 *
2927 * @return None
2928 */
2929void limProcessQuietTimeout(tpAniSirGlobal pMac)
2930{
Jeff Johnson295189b2012-06-20 16:38:30 -07002931 //fetch the sessionEntry based on the sessionId
2932 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002933 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002934
Jeff Johnsone7245742012-09-05 17:12:55 -07002935 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002937 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 return;
2939 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302941 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002942 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 {
2944 case eLIM_QUIET_BEGIN:
2945 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002946 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2947 if (TX_SUCCESS !=
2948 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2949 {
2950 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002951 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002952 }
2953
2954 // gLimQuietDuration appears to be in units of ticks
2955 // Use it as is
2956 if (TX_SUCCESS !=
2957 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2958 psessionEntry->gLimSpecMgmt.quietDuration,
2959 0))
2960 {
2961 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002962 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002963 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002964 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002965#ifdef GEN6_TODO
2966 /* revisit this piece of code to assign the appropriate sessionId below
2967 * priority - HIGH
2968 */
2969 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2970#endif
2971 if( TX_SUCCESS !=
2972 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2973 {
2974 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002975 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002976 }
2977 else
2978 {
2979 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002980 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002981
2982 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2983 /* print message, otherwise, stop data traffic and stay quiet */
2984 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2985 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2986 {
2987 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002988 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 }
2990 else
2991 {
2992 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2993 /* freeze the transmission */
2994 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2995
2996 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002997 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002998 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 }
3000 }
3001 break;
3002
3003 case eLIM_QUIET_RUNNING:
3004 case eLIM_QUIET_INIT:
3005 case eLIM_QUIET_END:
3006 default:
3007 //
3008 // As of now, nothing to be done
3009 //
3010 break;
3011 }
3012}
3013
3014/**
3015 * limProcessQuietBssTimeout
3016 *
3017 * FUNCTION:
3018 * This function is active on the AP and STA.
3019 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3020 *
3021 * LOGIC:
3022 * On the AP -
3023 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3024 * an indication for the AP to START sending out the
3025 * Quiet BSS IE.
3026 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3027 * the 11H spec
3028 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3029 * a Proprietary IE. This will be understood by all the
3030 * TITAN STA's
3031 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3032 * initiate the SCH to include the Quiet BSS IE in all
3033 * its subsequent Beacons/PR's.
3034 * The Quiet BSS IE will be included in all the Beacons
3035 * & PR's until the next DTIM period
3036 *
3037 * On the STA -
3038 * When gLimQuietState = eLIM_QUIET_RUNNING
3039 * This indicates that the STA was successfully shut-off
3040 * for the specified gLimQuietDuration. This is a trigger
3041 * for the STA to now resume data traffic.
3042 * -> gLimQuietState is set to eLIM_QUIET_INIT
3043 *
3044 * ASSUMPTIONS:
3045 *
3046 * NOTE:
3047 *
3048 * @param pMac - Pointer to Global MAC structure
3049 *
3050 * @return None
3051 */
3052void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3053{
Jeff Johnsone7245742012-09-05 17:12:55 -07003054 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003055
Jeff Johnsone7245742012-09-05 17:12:55 -07003056 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003058 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 return;
3060 }
3061
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303062 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003063 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 }
3066 else
3067 {
3068 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003069 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 {
3071 case eLIM_QUIET_RUNNING:
3072 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003073 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003074
3075 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3076 {
3077 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003078 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3079 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 {
3081 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003082 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 }
3084
3085 /* Reset status flag */
3086 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3087 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3088
3089 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003090 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 }
3092 else
3093 {
3094 //
3095 // Nothing specific to be done in this case
3096 // A background scan that was triggered during
3097 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3098 //
3099 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003100 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 }
3102 break;
3103
3104 case eLIM_QUIET_INIT:
3105 case eLIM_QUIET_BEGIN:
3106 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003107 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003108 /* If the quiet period has ended, then resume the frame transmission */
3109 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003110 limRestorePreQuietState(pMac, psessionEntry);
3111 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 break;
3113
3114 default:
3115 //
3116 // As of now, nothing to be done
3117 //
3118 break;
3119 }
3120 }
3121}
Jeff Johnson295189b2012-06-20 16:38:30 -07003122/**
3123 * limProcessWPSOverlapTimeout
3124 *
3125 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3126 *
3127 * LOGIC:
3128 *
3129 * ASSUMPTIONS:
3130 *
3131 * NOTE:
3132 *
3133 * @param pMac - Pointer to Global MAC structure
3134 *
3135 * @return None
3136 */
3137#if 0
3138void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3139{
3140
3141 tpPESession psessionEntry;
3142 tANI_U32 sessionId;
3143
3144 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3145 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003146 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 }
3148
3149 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3150
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003151 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003152
3153 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3154 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003155 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 return;
3157 }
3158
3159 limWPSPBCTimeout(pMac, psessionEntry);
3160}
3161#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003162
Jeff Johnson295189b2012-06-20 16:38:30 -07003163/**----------------------------------------------
3164\fn limStartQuietTimer
3165\brief Starts the quiet timer.
3166
3167\param pMac
3168\return NONE
3169-----------------------------------------------*/
3170void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3171{
3172 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303173 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003174
3175 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003176 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003177 return;
3178 }
3179
Jeff Johnson295189b2012-06-20 16:38:30 -07003180
3181 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3182 return;
3183 // First, de-activate Timer, if its already active
3184 limCancelDot11hQuiet(pMac, psessionEntry);
3185
Jeff Johnsone7245742012-09-05 17:12:55 -07003186 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3187 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3188 {
3189 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003190 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003191 }
3192
3193 // Set the NEW timeout value, in ticks
3194 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3195 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3196 {
3197 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003198 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003199 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003200
3201 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3202 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3203 {
3204 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003205 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003206 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003207
Jeff Johnsone7245742012-09-05 17:12:55 -07003208 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 return;
3210 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003211}
3212
Jeff Johnson295189b2012-06-20 16:38:30 -07003213
3214/** ------------------------------------------------------------------------ **/
3215/**
3216 * keep track of the number of ANI peers associated in the BSS
3217 * For the first and last ANI peer, we have to update EDCA params as needed
3218 *
3219 * When the first ANI peer joins the BSS, we notify SCH
3220 * When the last ANI peer leaves the BSS, we notfiy SCH
3221 */
3222void
3223limUtilCountStaAdd(
3224 tpAniSirGlobal pMac,
3225 tpDphHashNode pSta,
3226 tpPESession psessionEntry)
3227{
3228
3229 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3230 return;
3231
3232 pSta->fAniCount = 1;
3233
3234 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3235 return;
3236
3237 // get here only if this is the first ANI peer in the BSS
3238 schEdcaProfileUpdate(pMac, psessionEntry);
3239}
3240
3241void
3242limUtilCountStaDel(
3243 tpAniSirGlobal pMac,
3244 tpDphHashNode pSta,
3245 tpPESession psessionEntry)
3246{
3247
3248 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3249 return;
3250
3251 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3252 * then go ahead and update the count and profiles. This ensures
3253 * that the "number of ani station" count is properly incremented/decremented.
3254 */
3255 if (pSta->valid == 1)
3256 return;
3257
3258 pSta->fAniCount = 0;
3259
3260 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3261 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003262 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003263 pMac->lim.gLimNumOfAniSTAs);
3264 return;
3265 }
3266
3267 pMac->lim.gLimNumOfAniSTAs--;
3268
3269 if (pMac->lim.gLimNumOfAniSTAs != 0)
3270 return;
3271
3272 // get here only if this is the last ANI peer in the BSS
3273 schEdcaProfileUpdate(pMac, psessionEntry);
3274}
3275
Jeff Johnson295189b2012-06-20 16:38:30 -07003276/**
3277 * limSwitchChannelCback()
3278 *
3279 *FUNCTION:
3280 * This is the callback function registered while requesting to switch channel
3281 * after AP indicates a channel switch for spectrum management (11h).
3282 *
3283 *NOTE:
3284 * @param pMac Pointer to Global MAC structure
3285 * @param status Status of channel switch request
3286 * @param data User data
3287 * @param psessionEntry Session information
3288 * @return NONE
3289 */
3290void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3291 tANI_U32 *data, tpPESession psessionEntry)
3292{
3293 tSirMsgQ mmhMsg = {0};
3294 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3295
Jeff Johnson295189b2012-06-20 16:38:30 -07003296 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3297
3298 /* We need to restore pre-channelSwitch state on the STA */
3299 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3300 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003301 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 return;
3303 }
3304
3305 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303306 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3307 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003309 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 return;
3311 }
3312
3313 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3314 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003315 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3317 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303318 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3320 mmhMsg.bodyval = 0;
3321
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303322 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3323 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003324 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003325}
3326
3327/**
3328 * limSwitchPrimaryChannel()
3329 *
3330 *FUNCTION:
3331 * This function changes the current operating channel
3332 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3333 *
3334 *NOTE:
3335 * @param pMac Pointer to Global MAC structure
3336 * @param newChannel new chnannel ID
3337 * @return NONE
3338 */
3339void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3340{
3341#if !defined WLAN_FEATURE_VOWIFI
3342 tANI_U32 localPwrConstraint;
3343#endif
3344
Abhishek Singh127a8442014-12-15 17:31:27 +05303345 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3346 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 psessionEntry->currentReqChannel = newChannel;
3348 psessionEntry->limRFBand = limGetRFBand(newChannel);
3349
3350 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3351
3352 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3353 pMac->lim.gpchangeChannelData = NULL;
3354
3355#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003356 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003357 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3358#else
3359 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3360 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003361 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 return;
3363 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003364 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3366#endif
3367 return;
3368}
3369
3370/**
3371 * limSwitchPrimarySecondaryChannel()
3372 *
3373 *FUNCTION:
3374 * This function changes the primary and secondary channel.
3375 * If 11h is enabled and user provides a "new channel ID"
3376 * that is different from the current operating channel,
3377 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3378 * assign notify LIM of such change.
3379 *
3380 *NOTE:
3381 * @param pMac Pointer to Global MAC structure
3382 * @param newChannel New chnannel ID (or current channel ID)
3383 * @param subband CB secondary info:
3384 * - eANI_CB_SECONDARY_NONE
3385 * - eANI_CB_SECONDARY_UP
3386 * - eANI_CB_SECONDARY_DOWN
3387 * @return NONE
3388 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003389void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003390{
3391#if !defined WLAN_FEATURE_VOWIFI
3392 tANI_U32 localPwrConstraint;
3393#endif
3394
Jeff Johnson295189b2012-06-20 16:38:30 -07003395#if !defined WLAN_FEATURE_VOWIFI
3396 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003397 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 return;
3399 }
3400#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303401 /* Assign the callback to resume TX once channel is changed.
3402 */
3403 psessionEntry->currentReqChannel = newChannel;
3404 psessionEntry->limRFBand = limGetRFBand(newChannel);
3405
3406 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3407
3408 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3409 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003410
Jeff Johnson295189b2012-06-20 16:38:30 -07003411#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003412 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003413#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003414 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003415#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
Jeff Johnsone7245742012-09-05 17:12:55 -07003417 // Store the new primary and secondary channel in session entries if different
3418 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 {
3420 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003421 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 psessionEntry->currentOperChannel = newChannel;
3424 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003425 if (psessionEntry->htSecondaryChannelOffset != subband)
3426 {
3427 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003428 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003429 psessionEntry->htSecondaryChannelOffset, subband);
3430 psessionEntry->htSecondaryChannelOffset = subband;
3431 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3432 {
3433 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3434 }
3435 else
3436 {
3437 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3438 }
3439 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3440 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003441
3442 return;
3443}
3444
3445
3446/**
3447 * limActiveScanAllowed()
3448 *
3449 *FUNCTION:
3450 * Checks if active scans are permitted on the given channel
3451 *
3452 *LOGIC:
3453 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3454 * Need to check if the channelNum matches, then depending on the corresponding
3455 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3456 *
3457 *ASSUMPTIONS:
3458 *
3459 *NOTE:
3460 *
3461 * @param pMac Pointer to Global MAC structure
3462 * @param channelNum channel number
3463 * @return None
3464 */
3465
3466tANI_U8 limActiveScanAllowed(
3467 tpAniSirGlobal pMac,
3468 tANI_U8 channelNum)
3469{
3470 tANI_U32 i;
3471 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3472 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3473 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3474 != eSIR_SUCCESS)
3475 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003476 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 return false;
3478 }
3479
3480 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3481 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003482 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 len);
3484 return false;
3485 }
3486
3487 for (i=0; (i+1) < len; i+=2)
3488 {
3489 if (channelPair[i] == channelNum)
3490 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3491 }
3492 return false;
3493}
3494
3495/**
3496 * limTriggerBackgroundScanDuringQuietBss()
3497 *
3498 *FUNCTION:
3499 * This function is applicable to the STA only.
3500 * This function is called by limProcessQuietTimeout(),
3501 * when it is time to honor the Quiet BSS IE from the AP.
3502 *
3503 *LOGIC:
3504 * If 11H is enabled:
3505 * We cannot trigger a background scan. The STA needs to
3506 * shut-off Tx/Rx.
3507 * If 11 is not enabled:
3508 * Determine if the next channel that we are going to
3509 * scan is NOT the same channel (or not) on which the
3510 * Quiet BSS was requested.
3511 * If yes, then we cannot trigger a background scan on
3512 * this channel. Return with a false.
3513 * If no, then trigger a background scan. Return with
3514 * a true.
3515 *
3516 *ASSUMPTIONS:
3517 *
3518 *NOTE:
3519 * This API is redundant if the existing API,
3520 * limTriggerBackgroundScan(), were to return a valid
3521 * response instead of returning void.
3522 * If possible, try to revisit this API
3523 *
3524 * @param pMac Pointer to Global MAC structure
3525 * @return eSIR_TRUE, if a background scan was attempted
3526 * eSIR_FALSE, if not
3527 */
3528tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3529{
3530 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003531
3532
3533
3534 //TBD-RAJESH HOW TO GET sessionEntry?????
3535 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3536
3537 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3538 return bScanTriggered;
3539
Jeff Johnsone7245742012-09-05 17:12:55 -07003540 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 {
3542 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3543 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3544
3545 // Determine the next scan channel
3546
3547 // Get background scan channel list from CFG
3548 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3549 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3550 (tANI_U8 *) bgScanChannelList,
3551 (tANI_U32 *) &len ))
3552 {
3553 // Ensure that we do not go off scanning on the same
3554 // channel on which the Quiet BSS was requested
3555 if( psessionEntry->currentOperChannel!=
3556 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3557 {
3558 // For now, try and attempt a background scan. It will
3559 // be ideal if this API actually returns a success or
3560 // failure instead of having a void return type
3561 limTriggerBackgroundScan( pMac );
3562
3563 bScanTriggered = eSIR_TRUE;
3564 }
3565 else
3566 {
3567 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003568 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 -07003569 }
3570 }
3571 else
3572 {
3573 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003574 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 -07003575 }
3576 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 return bScanTriggered;
3578}
3579
3580
3581/**
3582 * limGetHTCapability()
3583 *
3584 *FUNCTION:
3585 * A utility function that returns the "current HT capability state" for the HT
3586 * capability of interest (as requested in the API)
3587 *
3588 *LOGIC:
3589 * This routine will return with the "current" setting of a requested HT
3590 * capability. This state info could be retrieved from -
3591 * a) CFG (for static entries)
3592 * b) Run time info
3593 * - Dynamic state maintained by LIM
3594 * - Configured at radio init time by SME
3595 *
3596 *
3597 *ASSUMPTIONS:
3598 * NA
3599 *
3600 *NOTE:
3601 *
3602 * @param pMac Pointer to Global MAC structure
3603 * @param htCap The HT capability being queried
3604 * @return tANI_U8 The current state of the requested HT capability is returned in a
3605 * tANI_U8 variable
3606 */
3607
Jeff Johnson295189b2012-06-20 16:38:30 -07003608tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3609 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003610{
3611tANI_U8 retVal = 0;
3612tANI_U8 *ptr;
3613tANI_U32 cfgValue;
3614tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3615tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3616tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3617tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3618
3619 //
3620 // Determine which CFG to read from. Not ALL of the HT
3621 // related CFG's need to be read each time this API is
3622 // accessed
3623 //
3624 if( htCap >= eHT_ANTENNA_SELECTION &&
3625 htCap < eHT_SI_GRANULARITY )
3626 {
3627 // Get Antenna Seletion HT Capabilities
3628 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3629 cfgValue = 0;
3630 ptr = (tANI_U8 *) &macASCapabilityInfo;
3631 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3632 }
3633 else
3634 {
3635 if( htCap >= eHT_TX_BEAMFORMING &&
3636 htCap < eHT_ANTENNA_SELECTION )
3637 {
3638 // Get Transmit Beam Forming HT Capabilities
3639 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3640 cfgValue = 0;
3641 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3642 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3643 }
3644 else
3645 {
3646 if( htCap >= eHT_PCO &&
3647 htCap < eHT_TX_BEAMFORMING )
3648 {
3649 // Get Extended HT Capabilities
3650 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3651 cfgValue = 0;
3652 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3653 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3654 }
3655 else
3656 {
3657 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3658 {
3659 // Get HT Capabilities
3660 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3661 cfgValue = 0;
3662 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3663 // 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
3664 *ptr++ = cfgValue & 0xff;
3665 *ptr = (cfgValue >> 8) & 0xff;
3666 }
3667 }
3668 }
3669 }
3670
3671 switch( htCap )
3672 {
3673 case eHT_LSIG_TXOP_PROTECTION:
3674 retVal = pMac->lim.gHTLsigTXOPProtection;
3675 break;
3676
3677 case eHT_STBC_CONTROL_FRAME:
3678 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3679 break;
3680
3681 case eHT_PSMP:
3682 retVal = pMac->lim.gHTPSMPSupport;
3683 break;
3684
3685 case eHT_DSSS_CCK_MODE_40MHZ:
3686 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3687 break;
3688
3689 case eHT_MAX_AMSDU_LENGTH:
3690 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3691 break;
3692
3693 case eHT_DELAYED_BA:
3694 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3695 break;
3696
3697 case eHT_RX_STBC:
3698 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3699 break;
3700
3701 case eHT_TX_STBC:
3702 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3703 break;
3704
3705 case eHT_SHORT_GI_40MHZ:
3706 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3707 break;
3708
3709 case eHT_SHORT_GI_20MHZ:
3710 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3711 break;
3712
3713 case eHT_GREENFIELD:
3714 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3715 break;
3716
3717 case eHT_MIMO_POWER_SAVE:
3718 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3719 break;
3720
3721 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003722 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 break;
3724
3725 case eHT_ADVANCED_CODING:
3726 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3727 break;
3728
3729 case eHT_MAX_RX_AMPDU_FACTOR:
3730 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3731 break;
3732
3733 case eHT_MPDU_DENSITY:
3734 retVal = pMac->lim.gHTAMpduDensity;
3735 break;
3736
3737 case eHT_PCO:
3738 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3739 break;
3740
3741 case eHT_TRANSITION_TIME:
3742 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3743 break;
3744
3745 case eHT_MCS_FEEDBACK:
3746 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3747 break;
3748
3749 case eHT_TX_BEAMFORMING:
3750 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3751 break;
3752
3753 case eHT_ANTENNA_SELECTION:
3754 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3755 break;
3756
3757 case eHT_SI_GRANULARITY:
3758 retVal = pMac->lim.gHTServiceIntervalGranularity;
3759 break;
3760
3761 case eHT_CONTROLLED_ACCESS:
3762 retVal = pMac->lim.gHTControlledAccessOnly;
3763 break;
3764
3765 case eHT_RIFS_MODE:
3766 retVal = psessionEntry->beaconParams.fRIFSMode;
3767 break;
3768
3769 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003770 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003771 break;
3772
3773 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003774 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 break;
3776
3777 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3779 retVal = psessionEntry->htOperMode;
3780 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003781 retVal = pMac->lim.gHTOperMode;
3782 break;
3783
3784 case eHT_BASIC_STBC_MCS:
3785 retVal = pMac->lim.gHTSTBCBasicMCS;
3786 break;
3787
3788 case eHT_DUAL_CTS_PROTECTION:
3789 retVal = pMac->lim.gHTDualCTSProtection;
3790 break;
3791
3792 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3793 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3794 break;
3795
3796 case eHT_PCO_ACTIVE:
3797 retVal = pMac->lim.gHTPCOActive;
3798 break;
3799
3800 case eHT_PCO_PHASE:
3801 retVal = pMac->lim.gHTPCOPhase;
3802 break;
3803
3804 default:
3805 break;
3806 }
3807
3808 return retVal;
3809}
3810
Jeff Johnson295189b2012-06-20 16:38:30 -07003811void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3812{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303813 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 return;
3815}
3816
3817
3818
3819
3820/** -------------------------------------------------------------
3821\fn limEnable11aProtection
3822\brief based on config setting enables\disables 11a protection.
3823\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3824\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3825\param tpUpdateBeaconParams pBeaconParams
3826\return None
3827 -------------------------------------------------------------*/
3828tSirRetStatus
3829limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3830 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3831{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003832 if(NULL == psessionEntry)
3833 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003834 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003835 return eSIR_FAILURE;
3836 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 //overlapping protection configuration check.
3838 if(overlap)
3839 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003840 }
3841 else
3842 {
3843 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003844 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003845 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 {
3847 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003848 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 return eSIR_SUCCESS;
3850 }
3851 }
3852
3853 if (enable)
3854 {
3855 //If we are AP and HT capable, we need to set the HT OP mode
3856 //appropriately.
3857 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003858 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 {
3860 if(overlap)
3861 {
3862 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3863 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3864 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3865 {
3866 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3867 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3868 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3869 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3870 }
3871 }
3872 else
3873 {
3874 psessionEntry->gLim11aParams.protectionEnabled = true;
3875 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3876 {
3877 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003878 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3880 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3881
3882 }
3883 }
3884 }
3885
3886 //This part is common for staiton as well.
3887 if(false == psessionEntry->beaconParams.llaCoexist)
3888 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003889 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3891 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3892 }
3893 }
3894 else if (true == psessionEntry->beaconParams.llaCoexist)
3895 {
3896 //for AP role.
3897 //we need to take care of HT OP mode change if needed.
3898 //We need to take care of Overlap cases.
3899 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3900 {
3901 if(overlap)
3902 {
3903 //Overlap Legacy protection disabled.
3904 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3905
3906 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003907 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 {
3909 // no HT op mode change if any of the overlap protection enabled.
3910 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3911 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3912 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3913
3914 {
3915 //Check if there is a need to change HT OP mode.
3916 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3917 {
3918 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3919 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3920
3921 if(psessionEntry->gLimHt20Params.protectionEnabled)
3922 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3923 else
3924 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3925 }
3926 }
3927 }
3928 }
3929 else
3930 {
3931 //Disable protection from 11A stations.
3932 psessionEntry->gLim11aParams.protectionEnabled = false;
3933 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3934
3935 //Check if any other non-HT protection enabled.
3936 //Right now we are in HT OP Mixed mode.
3937 //Change HT op mode appropriately.
3938
3939 //Change HT OP mode to 01 if any overlap protection enabled
3940 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3941 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3942 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3943
3944 {
3945 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003946 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3948 }
3949 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3950 {
3951 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003952 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3954 }
3955 else
3956 {
3957 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003958 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3960 }
3961 }
3962 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3963 !psessionEntry->gLim11aParams.protectionEnabled)
3964 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003965 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003966 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3967 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3968 }
3969 }
3970 //for station role
3971 else
3972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003973 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003974 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3975 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3976 }
3977 }
3978
3979 return eSIR_SUCCESS;
3980}
3981
3982/** -------------------------------------------------------------
3983\fn limEnable11gProtection
3984\brief based on config setting enables\disables 11g protection.
3985\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3986\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3987\param tpUpdateBeaconParams pBeaconParams
3988\return None
3989 -------------------------------------------------------------*/
3990
3991tSirRetStatus
3992limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3993 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3994{
3995
3996 //overlapping protection configuration check.
3997 if(overlap)
3998 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 }
4000 else
4001 {
4002 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4004 !psessionEntry->cfgProtection.fromllb)
4005 {
4006 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004007 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004008 return eSIR_SUCCESS;
4009 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 {
4011 if(!pMac->lim.cfgProtection.fromllb)
4012 {
4013 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004014 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004015 return eSIR_SUCCESS;
4016 }
4017 }
4018 }
4019
4020 if (enable)
4021 {
4022 //If we are AP and HT capable, we need to set the HT OP mode
4023 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004024 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4025 {
4026 if(overlap)
4027 {
4028 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004029 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004030 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 {
4032 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4033 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4034 {
4035 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4036 }
4037 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4038 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4039 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4040 //Not processing OBSS bit from other APs, as we are already taking care
4041 //of Protection from overlapping BSS based on erp IE or useProtection bit
4042 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4043 }
4044 }
4045 else
4046 {
4047 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004048 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004049 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004050 {
4051 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4052 {
4053 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4054 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4055 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4056 }
4057 }
4058 }
4059 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004060 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 {
4062 if(overlap)
4063 {
4064 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4065 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4066 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4067 {
4068 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4069 }
4070 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4071 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4072 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4073 //Not processing OBSS bit from other APs, as we are already taking care
4074 //of Protection from overlapping BSS based on erp IE or useProtection bit
4075 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4076 }
4077 else
4078 {
4079 psessionEntry->gLim11bParams.protectionEnabled = true;
4080 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4081 {
4082 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4083 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4084 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4085 }
4086 }
4087 }
4088
4089 //This part is common for staiton as well.
4090 if(false == psessionEntry->beaconParams.llbCoexist)
4091 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004092 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4094 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4095 }
4096 }
4097 else if (true == psessionEntry->beaconParams.llbCoexist)
4098 {
4099 //for AP role.
4100 //we need to take care of HT OP mode change if needed.
4101 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004102 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4103 {
4104 if(overlap)
4105 {
4106 //Overlap Legacy protection disabled.
4107 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4108
4109 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004110 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 {
4112 // no HT op mode change if any of the overlap protection enabled.
4113 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4114 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4115 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4116 {
4117 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004118 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 {
4120 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4121 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4122 if(psessionEntry->gLimHt20Params.protectionEnabled){
4123 //Commenting out beacuse of CR 258588 WFA cert
4124 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4125 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4126 }
4127 else
4128 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4129 }
4130 }
4131 }
4132 }
4133 else
4134 {
4135 //Disable protection from 11B stations.
4136 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004137 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004138 //Check if any other non-HT protection enabled.
4139 if(!psessionEntry->gLim11gParams.protectionEnabled)
4140 {
4141 //Right now we are in HT OP Mixed mode.
4142 //Change HT op mode appropriately.
4143 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4144
4145 //Change HT OP mode to 01 if any overlap protection enabled
4146 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4147 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4148 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4149 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4150 {
4151 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004152 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4154 }
4155 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4156 {
4157 //Commenting because of CR 258588 WFA cert
4158 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4159 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004160 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4162 }
4163 else
4164 {
4165 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4166 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4167 }
4168 }
4169 }
4170 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4171 !psessionEntry->gLim11bParams.protectionEnabled)
4172 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004173 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4175 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4176 }
4177 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 {
4179 if(overlap)
4180 {
4181 //Overlap Legacy protection disabled.
4182 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4183
4184 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004185 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004186 {
4187 // no HT op mode change if any of the overlap protection enabled.
4188 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4189 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4190 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4191
4192 {
4193 //Check if there is a need to change HT OP mode.
4194 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4195 {
4196 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4197 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4198 if(psessionEntry->gLimHt20Params.protectionEnabled)
4199 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4200 else
4201 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4202 }
4203 }
4204 }
4205 }
4206 else
4207 {
4208 //Disable protection from 11B stations.
4209 psessionEntry->gLim11bParams.protectionEnabled = false;
4210 //Check if any other non-HT protection enabled.
4211 if(!psessionEntry->gLim11gParams.protectionEnabled)
4212 {
4213 //Right now we are in HT OP Mixed mode.
4214 //Change HT op mode appropriately.
4215 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4216
4217 //Change HT OP mode to 01 if any overlap protection enabled
4218 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4219 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4220 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4221 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4222
4223 {
4224 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4225 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4226 }
4227 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4228 {
4229 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4230 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4231 }
4232 else
4233 {
4234 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4235 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4236 }
4237 }
4238 }
4239 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4240 !psessionEntry->gLim11bParams.protectionEnabled)
4241 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004242 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4244 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4245 }
4246 }
4247 //for station role
4248 else
4249 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004250 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4252 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4253 }
4254 }
4255 return eSIR_SUCCESS;
4256}
4257
4258/** -------------------------------------------------------------
4259\fn limEnableHtProtectionFrom11g
4260\brief based on cofig enables\disables protection from 11g.
4261\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4262\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4263\param tpUpdateBeaconParams pBeaconParams
4264\return None
4265 -------------------------------------------------------------*/
4266tSirRetStatus
4267limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4268 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4269{
Jeff Johnsone7245742012-09-05 17:12:55 -07004270 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4272
4273 //overlapping protection configuration check.
4274 if(overlap)
4275 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4277 {
4278 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004279 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 return eSIR_SUCCESS;
4281 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 {
4283 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004284 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 return eSIR_SUCCESS;
4286 }
4287 }
4288 else
4289 {
4290 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4292 !psessionEntry->cfgProtection.fromllg){
4293 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004294 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 return eSIR_SUCCESS;
4296 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 {
4298 if(!pMac->lim.cfgProtection.fromllg)
4299 {
4300 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004301 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 return eSIR_SUCCESS;
4303 }
4304 }
4305 }
4306 if (enable)
4307 {
4308 //If we are AP and HT capable, we need to set the HT OP mode
4309 //appropriately.
4310
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4312 {
4313 if(overlap)
4314 {
4315 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4316 //11g exists in overlap BSS.
4317 //need not to change the operating mode to overlap_legacy
4318 //if higher or same protection operating mode is enabled right now.
4319 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4320 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4321 {
4322 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4323 }
4324 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304325 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 }
4327 else
4328 {
4329 //11g is associated to an AP operating in 11n mode.
4330 //Change the HT operating mode to 'mixed mode'.
4331 psessionEntry->gLim11gParams.protectionEnabled = true;
4332 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4333 {
4334 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4335 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304336 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 }
4338 }
4339 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004340 {
4341 if(overlap)
4342 {
4343 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4344 //11g exists in overlap BSS.
4345 //need not to change the operating mode to overlap_legacy
4346 //if higher or same protection operating mode is enabled right now.
4347 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4348 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4349 {
4350 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4351 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4352 }
4353 }
4354 else
4355 {
4356 //11g is associated to an AP operating in 11n mode.
4357 //Change the HT operating mode to 'mixed mode'.
4358 psessionEntry->gLim11gParams.protectionEnabled = true;
4359 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4360 {
4361 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4362 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304363 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 }
4365 }
4366 }
4367
4368 //This part is common for staiton as well.
4369 if(false == psessionEntry->beaconParams.llgCoexist)
4370 {
4371 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4372 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4373 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4375 {
4376 // As operating mode changed after G station assoc some way to update beacon
4377 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4378 //pMac->sch.schObject.fBeaconChanged = 1;
4379 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4380 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 }
4382 else if (true == psessionEntry->beaconParams.llgCoexist)
4383 {
4384 //for AP role.
4385 //we need to take care of HT OP mode change if needed.
4386 //We need to take care of Overlap cases.
4387
Jeff Johnson295189b2012-06-20 16:38:30 -07004388 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4389 {
4390 if(overlap)
4391 {
4392 //Overlap Legacy protection disabled.
4393 if (psessionEntry->gLim11gParams.numSta == 0)
4394 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4395
4396 // no HT op mode change if any of the overlap protection enabled.
4397 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4398 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4399 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4400 {
4401 //Check if there is a need to change HT OP mode.
4402 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4403 {
4404 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4405 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4406
4407 if(psessionEntry->gLimHt20Params.protectionEnabled){
4408 //Commenting because of CR 258588 WFA cert
4409 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4410 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4411 }
4412 else
4413 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4414 }
4415 }
4416 }
4417 else
4418 {
4419 //Disable protection from 11G stations.
4420 psessionEntry->gLim11gParams.protectionEnabled = false;
4421 //Check if any other non-HT protection enabled.
4422 if(!psessionEntry->gLim11bParams.protectionEnabled)
4423 {
4424
4425 //Right now we are in HT OP Mixed mode.
4426 //Change HT op mode appropriately.
4427 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4428
4429 //Change HT OP mode to 01 if any overlap protection enabled
4430 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4431 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4432 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4433 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4434
4435 {
4436 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4437 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4438 }
4439 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4440 {
4441 //Commenting because of CR 258588 WFA cert
4442 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4443 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4444 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4445 }
4446 else
4447 {
4448 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4449 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4450 }
4451 }
4452 }
4453 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4454 !psessionEntry->gLim11gParams.protectionEnabled)
4455 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004456 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4458 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4459 }
4460 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004461 {
4462 if(overlap)
4463 {
4464 //Overlap Legacy protection disabled.
4465 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4466
4467 // no HT op mode change if any of the overlap protection enabled.
4468 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4469 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4470 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4471 {
4472 //Check if there is a need to change HT OP mode.
4473 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4474 {
4475 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4476 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4477
4478 if(psessionEntry->gLimHt20Params.protectionEnabled)
4479 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4480 else
4481 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4482 }
4483 }
4484 }
4485 else
4486 {
4487 //Disable protection from 11G stations.
4488 psessionEntry->gLim11gParams.protectionEnabled = false;
4489 //Check if any other non-HT protection enabled.
4490 if(!psessionEntry->gLim11bParams.protectionEnabled)
4491 {
4492
4493 //Right now we are in HT OP Mixed mode.
4494 //Change HT op mode appropriately.
4495 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4496
4497 //Change HT OP mode to 01 if any overlap protection enabled
4498 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4499 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4500 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4501 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4502
4503 {
4504 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4505 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4506 }
4507 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4508 {
4509 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4510 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4511 }
4512 else
4513 {
4514 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4515 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4516 }
4517 }
4518 }
4519 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4520 !psessionEntry->gLim11gParams.protectionEnabled)
4521 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004522 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004523 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4524 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4525 }
4526 }
4527 //for station role
4528 else
4529 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004530 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4532 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4533 }
4534 }
4535 return eSIR_SUCCESS;
4536}
4537//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4538//This check will be done at the caller.
4539
4540/** -------------------------------------------------------------
4541\fn limEnableHtObssProtection
4542\brief based on cofig enables\disables obss protection.
4543\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4544\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4545\param tpUpdateBeaconParams pBeaconParams
4546\return None
4547 -------------------------------------------------------------*/
4548tSirRetStatus
4549limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4550 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4551{
4552
4553
Jeff Johnsone7245742012-09-05 17:12:55 -07004554 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 return eSIR_SUCCESS; // this protection is only for HT stations.
4556
4557 //overlapping protection configuration check.
4558 if(overlap)
4559 {
4560 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 }
4562 else
4563 {
4564 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4566 { //ToDo Update this field
4567 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004568 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 return eSIR_SUCCESS;
4570 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 {
4572 if(!pMac->lim.cfgProtection.obss)
4573 { //ToDo Update this field
4574 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004575 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 return eSIR_SUCCESS;
4577 }
4578 }
4579 }
4580
4581
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4583 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4584 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004585 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004586 psessionEntry->beaconParams.gHTObssMode = true;
4587 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4588
4589 }
4590 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4591 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004592 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004593 psessionEntry->beaconParams.gHTObssMode = false;
4594 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4595
4596 }
4597//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4598 if (!enable && !overlap)
4599 {
4600 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4601 }
4602 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 {
4604 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4605 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004606 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 psessionEntry->beaconParams.gHTObssMode = true;
4608 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4609
4610 }
4611 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4612 {
4613
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004614 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 psessionEntry->beaconParams.gHTObssMode = false;
4616 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4617
4618 }
4619 }
4620 return eSIR_SUCCESS;
4621}
4622/** -------------------------------------------------------------
4623\fn limEnableHT20Protection
4624\brief based on cofig enables\disables protection from Ht20.
4625\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4626\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4627\param tpUpdateBeaconParams pBeaconParams
4628\return None
4629 -------------------------------------------------------------*/
4630tSirRetStatus
4631limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4632 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4633{
Jeff Johnsone7245742012-09-05 17:12:55 -07004634 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004635 return eSIR_SUCCESS; // this protection is only for HT stations.
4636
4637 //overlapping protection configuration check.
4638 if(overlap)
4639 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 }
4641 else
4642 {
4643 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004644 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4645 !psessionEntry->cfgProtection.ht20)
4646 {
4647 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004648 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 return eSIR_SUCCESS;
4650 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 {
4652 if(!pMac->lim.cfgProtection.ht20)
4653 {
4654 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004655 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 return eSIR_SUCCESS;
4657 }
4658 }
4659 }
4660
4661 if (enable)
4662 {
4663 //If we are AP and HT capable, we need to set the HT OP mode
4664 //appropriately.
4665
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4667 if(overlap)
4668 {
4669 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4670 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4671 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4672 {
4673 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4674 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4675 }
4676 }
4677 else
4678 {
4679 psessionEntry->gLimHt20Params.protectionEnabled = true;
4680 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4681 {
4682 //Commenting because of CR 258588 WFA cert
4683 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4684 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4685 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4686 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4687 }
4688 }
4689 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004690 {
4691 if(overlap)
4692 {
4693 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4694 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4695 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4696 {
4697 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4698 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4699 }
4700 }
4701 else
4702 {
4703 psessionEntry->gLimHt20Params.protectionEnabled = true;
4704 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4705 {
4706 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4707 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4708 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4709 }
4710 }
4711 }
4712
4713 //This part is common for staiton as well.
4714 if(false == psessionEntry->beaconParams.ht20Coexist)
4715 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004716 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004717 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4718 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4719 }
4720 }
4721 else if (true == psessionEntry->beaconParams.ht20Coexist)
4722 {
4723 //for AP role.
4724 //we need to take care of HT OP mode change if needed.
4725 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004726 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4727 if(overlap)
4728 {
4729 //Overlap Legacy protection disabled.
4730 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4731
4732 // no HT op mode change if any of the overlap protection enabled.
4733 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4734 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4735 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4736 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4737 {
4738
4739 //Check if there is a need to change HT OP mode.
4740 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4741 {
4742 if(psessionEntry->gLimHt20Params.protectionEnabled)
4743 {
4744 //Commented beacuse of CR 258588 for WFA Cert
4745 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4746 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4747 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4748 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4749 }
4750 else
4751 {
4752 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4753 }
4754 }
4755 }
4756 }
4757 else
4758 {
4759 //Disable protection from 11G stations.
4760 psessionEntry->gLimHt20Params.protectionEnabled = false;
4761
4762 //Change HT op mode appropriately.
4763 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4764 {
4765 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4766 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4767 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4768 }
4769 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004770 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004771 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4772 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4773 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 {
4775 if(overlap)
4776 {
4777 //Overlap Legacy protection disabled.
4778 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4779
4780 // no HT op mode change if any of the overlap protection enabled.
4781 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4782 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4783 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4784 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4785 {
4786
4787 //Check if there is a need to change HT OP mode.
4788 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4789 {
4790 if(psessionEntry->gLimHt20Params.protectionEnabled)
4791 {
4792 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4793 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4794 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4795 }
4796 else
4797 {
4798 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4799 }
4800 }
4801 }
4802 }
4803 else
4804 {
4805 //Disable protection from 11G stations.
4806 psessionEntry->gLimHt20Params.protectionEnabled = false;
4807
4808 //Change HT op mode appropriately.
4809 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4810 {
4811 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4812 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4813 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4814 }
4815 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004816 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4818 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4819 }
4820 //for station role
4821 else
4822 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004823 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4825 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4826 }
4827 }
4828
4829 return eSIR_SUCCESS;
4830}
4831
4832/** -------------------------------------------------------------
4833\fn limEnableHTNonGfProtection
4834\brief based on cofig enables\disables protection from NonGf.
4835\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4836\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4837\param tpUpdateBeaconParams pBeaconParams
4838\return None
4839 -------------------------------------------------------------*/
4840tSirRetStatus
4841limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4842 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4843{
Jeff Johnsone7245742012-09-05 17:12:55 -07004844 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 return eSIR_SUCCESS; // this protection is only for HT stations.
4846
4847 //overlapping protection configuration check.
4848 if(overlap)
4849 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 }
4851 else
4852 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 //normal protection config check
4854 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4855 !psessionEntry->cfgProtection.nonGf)
4856 {
4857 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004858 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 return eSIR_SUCCESS;
4860 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 {
4862 //normal protection config check
4863 if(!pMac->lim.cfgProtection.nonGf)
4864 {
4865 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004866 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 return eSIR_SUCCESS;
4868 }
4869 }
4870 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4872 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004874 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004875 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4876 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4877 }
4878 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4879 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004880 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004881 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4882 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4883 }
4884 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 {
4886 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4887 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004888 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4890 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4891 }
4892 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004894 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4896 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4897 }
4898 }
4899
4900 return eSIR_SUCCESS;
4901}
4902
4903/** -------------------------------------------------------------
4904\fn limEnableHTLsigTxopProtection
4905\brief based on cofig enables\disables LsigTxop protection.
4906\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4907\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4908\param tpUpdateBeaconParams pBeaconParams
4909\return None
4910 -------------------------------------------------------------*/
4911tSirRetStatus
4912limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4913 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4914{
Jeff Johnsone7245742012-09-05 17:12:55 -07004915 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004916 return eSIR_SUCCESS; // this protection is only for HT stations.
4917
4918 //overlapping protection configuration check.
4919 if(overlap)
4920 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 }
4922 else
4923 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 //normal protection config check
4925 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4926 !psessionEntry->cfgProtection.lsigTxop)
4927 {
4928 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004929 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004930 return eSIR_SUCCESS;
4931 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 {
4933 //normal protection config check
4934 if(!pMac->lim.cfgProtection.lsigTxop)
4935 {
4936 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004937 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 return eSIR_SUCCESS;
4939 }
4940 }
4941 }
4942
4943
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4945 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004947 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4949 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4950 }
4951 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4952 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004953 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4955 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4956 }
4957 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 {
4959 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4960 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004961 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4963 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4964 }
4965 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4966 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004967 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4969 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4970 }
4971 }
4972 return eSIR_SUCCESS;
4973}
4974//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4975//This check will be done at the caller.
4976/** -------------------------------------------------------------
4977\fn limEnableHtRifsProtection
4978\brief based on cofig enables\disables Rifs protection.
4979\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4980\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4981\param tpUpdateBeaconParams pBeaconParams
4982\return None
4983 -------------------------------------------------------------*/
4984tSirRetStatus
4985limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4986 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4987{
Jeff Johnsone7245742012-09-05 17:12:55 -07004988 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 return eSIR_SUCCESS; // this protection is only for HT stations.
4990
4991
4992 //overlapping protection configuration check.
4993 if(overlap)
4994 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004995 }
4996 else
4997 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004998 //normal protection config check
4999 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5000 !psessionEntry->cfgProtection.rifs)
5001 {
5002 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005003 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005004 return eSIR_SUCCESS;
5005 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005006 {
5007 //normal protection config check
5008 if(!pMac->lim.cfgProtection.rifs)
5009 {
5010 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005011 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 return eSIR_SUCCESS;
5013 }
5014 }
5015 }
5016
Jeff Johnson295189b2012-06-20 16:38:30 -07005017 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5018 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5019 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5020 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005021 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005022 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5023 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5024 }
5025 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5026 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5027 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005028 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5030 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5031 }
5032 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005033 {
5034 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5035 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5036 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005037 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5039 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5040 }
5041 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5042 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5043 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005044 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005045 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5046 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5047 }
5048 }
5049 return eSIR_SUCCESS;
5050}
5051
5052// ---------------------------------------------------------------------
5053/**
5054 * limEnableShortPreamble
5055 *
5056 * FUNCTION:
5057 * Enable/Disable short preamble
5058 *
5059 * LOGIC:
5060 *
5061 * ASSUMPTIONS:
5062 *
5063 * NOTE:
5064 *
5065 * @param enable Flag to enable/disable short preamble
5066 * @return None
5067 */
5068
5069tSirRetStatus
5070limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5071{
5072 tANI_U32 val;
5073
5074 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5075 {
5076 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005077 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 return eSIR_FAILURE;
5079 }
5080
5081 if (!val)
5082 return eSIR_SUCCESS;
5083
5084 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5085 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005086 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005087 return eSIR_FAILURE;
5088 }
5089
5090 if (!val) // 11G short preamble switching is disabled.
5091 return eSIR_SUCCESS;
5092
5093 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5094 {
5095 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5096 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005097 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005098 psessionEntry->beaconParams.fShortPreamble = true;
5099 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5100 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5101 }
5102 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5103 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005104 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005105 psessionEntry->beaconParams.fShortPreamble = false;
5106 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5107 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5108 }
5109 }
5110
5111 return eSIR_SUCCESS;
5112 }
5113
5114/**
5115 * limTxComplete
5116 *
5117 * Function:
5118 * This is LIM's very own "TX MGMT frame complete" completion routine.
5119 *
5120 * Logic:
5121 * LIM wants to send a MGMT frame (broadcast or unicast)
5122 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5123 * LIM transmits the MGMT frame using the API:
5124 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5125 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5126 * HDD, if it determines that a TX completion routine (in this case
5127 * limTxComplete) has been provided, will invoke this callback
5128 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5129 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5130 *
5131 * Assumptions:
5132 * Presently, this is ONLY being used for MGMT frames/packets
5133 * TODO:
5134 * Would it do good for LIM to have some sort of "signature" validation to
5135 * ensure that the pData argument passed in was a buffer that was actually
5136 * allocated by LIM and/or is not corrupted?
5137 *
5138 * Note: FIXME and TODO
5139 * Looks like palPktFree() is interested in pPacket. But, when this completion
5140 * routine is called, only pData is made available to LIM!!
5141 *
5142 * @param void A pointer to pData. Shouldn't it be pPacket?!
5143 *
5144 * @return none
5145 */
5146void limTxComplete( tHalHandle hHal, void *pData )
5147{
5148 tpAniSirGlobal pMac;
5149 pMac = (tpAniSirGlobal)hHal;
5150
5151#ifdef FIXME_PRIMA
5152 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5153#ifdef TRACE_RECORD
5154 {
5155 tpSirMacMgmtHdr mHdr;
5156 v_U8_t *pRxBd;
5157 vos_pkt_t *pVosPkt;
5158 VOS_STATUS vosStatus;
5159
5160
5161
5162 pVosPkt = (vos_pkt_t *)pData;
5163 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5164
5165 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5166 {
5167 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005168
5169 }
5170 }
5171#endif
5172#endif
5173
5174 palPktFree( pMac->hHdd,
5175 HAL_TXRX_FRM_802_11_MGMT,
5176 (void *) NULL, // this is ignored and will likely be removed from this API
5177 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5178}
5179
5180/**
5181 * \brief This function updates lim global structure, if CB parameters in the BSS
5182 * have changed, and sends an indication to HAL also with the
5183 * updated HT Parameters.
5184 * This function does not detect the change in the primary channel, that is done as part
5185 * of channel Swtich IE processing.
5186 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5187 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5188 *
5189 *
5190 * \param pMac Pointer to global MAC structure
5191 *
5192 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5193 * Probe Response
5194 *
5195 * \param bssIdx BSS Index of the Bss to which Station is associated.
5196 *
5197 *
5198 */
5199
5200void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5201 tDot11fIEHTInfo *pHTInfo,
5202 tANI_U8 bssIdx,
5203 tpPESession psessionEntry)
5204{
Jeff Johnsone7245742012-09-05 17:12:55 -07005205 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005206#if !defined WLAN_FEATURE_VOWIFI
5207 tANI_U32 localPwrConstraint;
5208#endif
5209
5210 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005211 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 return;
5213
5214#if !defined WLAN_FEATURE_VOWIFI
5215 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005216 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005217 return;
5218 }
5219#endif
5220
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305221 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5222 {
5223 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5224 return;
5225 }
5226
Mihir Shetebc160b72014-08-22 14:10:39 +05305227 /*
5228 * Do not try to switch channel if RoC is in progress. RoC code path uses
5229 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5230 * has started listening on the channel requested as part of RoC, if we set
5231 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5232 * upper layers will think that the channel change is not successful and the
5233 * RoC from the upper layer perspective will never end...
5234 */
5235 if (pMac->lim.gpLimRemainOnChanReq)
5236 {
5237 limLog( pMac, LOGE, FL( "RoC is in progress"));
5238 return;
5239 }
5240
Jeff Johnsone7245742012-09-05 17:12:55 -07005241 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5242 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005243 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005244 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5245 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5246 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5247 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005248
5249 // Notify HAL
5250 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005251 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005252 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005253 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005255 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005256 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5257 pMac->lim.gpchangeChannelCallback = NULL;
5258 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005259
5260#if defined WLAN_FEATURE_VOWIFI
5261 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5262 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5263#else
5264 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5265 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5266#endif
5267
5268 //In case of IBSS, if STA should update HT Info IE in its beacons.
5269 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5270 {
5271 schSetFixedBeaconFields(pMac,psessionEntry);
5272 }
5273
5274 }
5275} // End limUpdateStaRunTimeHTParams.
5276
5277/**
5278 * \brief This function updates the lim global structure, if any of the
5279 * HT Capabilities have changed.
5280 *
5281 *
5282 * \param pMac Pointer to Global MAC structure
5283 *
5284 * \param pHTCapability Pointer to HT Capability Information Element
5285 * obtained from a Beacon or Probe Response
5286 *
5287 *
5288 *
5289 */
5290
5291void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5292 tDot11fIEHTCaps *pHTCaps )
5293{
5294
5295 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5296 {
5297 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5298 // Send change notification to HAL
5299 }
5300
5301 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5302 {
5303 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5304 // Send change notification to HAL
5305 }
5306
5307 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5308 {
5309 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5310 // Send change notification to HAL
5311 }
5312
5313
5314} // End limUpdateStaRunTimeHTCapability.
5315
5316/**
5317 * \brief This function updates lim global structure, if any of the HT
5318 * Info Parameters have changed.
5319 *
5320 *
5321 * \param pMac Pointer to the global MAC structure
5322 *
5323 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5324 * Probe Response
5325 *
5326 *
5327 */
5328
5329void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305330 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005331{
Jeff Johnsone7245742012-09-05 17:12:55 -07005332 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005333 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005334 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005335 // Send change notification to HAL
5336 }
5337
5338 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5339 {
5340 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5341 // Send change notification to HAL
5342 }
5343
5344 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5345 {
5346 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5347 // Send change notification to HAL
5348 }
5349
5350 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5351 {
5352 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5353 // Send change notification to HAL
5354 }
5355
5356 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5357 {
5358 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5359 }
5360
5361 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5362 {
5363 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5364 // Send change notification to HAL
5365 }
5366
5367 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5368 {
5369 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5370 // Send change notification to HAL
5371 }
5372
5373 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5374 {
5375 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5376 // Send change notification to HAL
5377 }
5378
5379 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5380 {
5381 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5382 // Send change notification to HAL
5383 }
5384
5385 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5386 {
5387 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5388 // Send change notification to HAL
5389 }
5390
5391 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5392 {
5393 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5394 // Send change notification to HAL
5395 }
5396
5397} // End limUpdateStaRunTimeHTInfo.
5398
5399
5400/** -------------------------------------------------------------
5401\fn limProcessHalIndMessages
5402\brief callback function for HAL indication
5403\param tpAniSirGlobal pMac
5404\param tANI_U32 mesgId
5405\param void *mesgParam
5406\return tSirRetStatu - status
5407 -------------------------------------------------------------*/
5408
5409tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5410{
5411 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5412 tSirMsgQ msg;
5413
5414 switch(msgId)
5415 {
5416 case SIR_LIM_DEL_TS_IND:
5417 case SIR_LIM_ADD_BA_IND:
5418 case SIR_LIM_DEL_BA_ALL_IND:
5419 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5420 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305421 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005422 msg.type = (tANI_U16) msgId;
5423 msg.bodyptr = msgParam;
5424 msg.bodyval = 0;
5425 break;
5426
5427 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305428 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005429 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 return eSIR_FAILURE;
5431 }
5432
5433 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5434 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305435 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005436 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5437 return eSIR_FAILURE;
5438 }
5439 return eSIR_SUCCESS;
5440}
5441
5442/** -------------------------------------------------------------
5443\fn limValidateDeltsReq
5444\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5445\param tpAniSirGlobal pMac
5446\param tpSirDeltsReq pDeltsReq
5447\param tSirMacAddr peerMacAddr
5448\return eSirRetStatus - status
5449 -------------------------------------------------------------*/
5450
5451tSirRetStatus
5452limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5453{
5454 tpDphHashNode pSta;
5455 tANI_U8 tsStatus;
5456 tSirMacTSInfo *tsinfo;
5457 tANI_U32 i;
5458 tANI_U8 tspecIdx;
5459 /* if sta
5460 * - verify assoc state
5461 * - del tspec locally
5462 * if ap,
5463 * - verify sta is in assoc state
5464 * - del sta tspec locally
5465 */
5466 if(pDeltsReq == NULL)
5467 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005468 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 return eSIR_FAILURE;
5470 }
5471
5472 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5473 {
5474 tANI_U32 val;
5475
5476 // station always talks to the AP
5477 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5478
5479 val = sizeof(tSirMacAddr);
5480 #if 0
5481 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5482 {
5483 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005484 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 return eSIR_FAILURE;
5486 }
5487 #endif// TO SUPPORT BT-AMP
5488 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5489
5490 }
5491 else
5492 {
5493 tANI_U16 assocId;
5494 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5495
5496 assocId = pDeltsReq->aid;
5497 if (assocId != 0)
5498 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5499 else
5500 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5501
5502 if (pSta != NULL)
5503 // TBD: check sta assoc state as well
5504 for (i =0; i < sizeof(tSirMacAddr); i++)
5505 macaddr[i] = pSta->staAddr[i];
5506 }
5507
5508 if (pSta == NULL)
5509 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005510 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005511 return eSIR_FAILURE;
5512 }
5513
5514 if ((! pSta->valid) ||
5515 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5516 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005517 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 return eSIR_FAILURE;
5519 }
5520
5521 pDeltsReq->req.wsmTspecPresent = 0;
5522 pDeltsReq->req.wmeTspecPresent = 0;
5523 pDeltsReq->req.lleTspecPresent = 0;
5524
5525 if ((pSta->wsmEnabled) &&
5526 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5527 pDeltsReq->req.wsmTspecPresent = 1;
5528 else if (pSta->wmeEnabled)
5529 pDeltsReq->req.wmeTspecPresent = 1;
5530 else if (pSta->lleEnabled)
5531 pDeltsReq->req.lleTspecPresent = 1;
5532 else
5533 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005534 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005535 return eSIR_FAILURE;
5536 }
5537
5538 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5539 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305540 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005541 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005542 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305543 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005544
5545 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005546
5547 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5548 != eSIR_SUCCESS)
5549 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005550 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5552 return eSIR_FAILURE;
5553 }
5554 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5555 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5556 {
5557 //edca only now.
5558 }
5559 else
5560 {
5561 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5562 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5563 {
5564 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305565 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5566 pSta->staIndex,
5567 tspecIdx,
5568 pDeltsReq->req,
5569 psessionEntry->peSessionId,
5570 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005571 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005572 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005573 tsinfo->traffic.userPrio);
5574 return eSIR_FAILURE;
5575 }
5576 }
5577 }
5578 return eSIR_SUCCESS;
5579}
5580
5581/** -------------------------------------------------------------
5582\fn limRegisterHalIndCallBack
5583\brief registers callback function to HAL for any indication.
5584\param tpAniSirGlobal pMac
5585\return none.
5586 -------------------------------------------------------------*/
5587void
5588limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5589{
5590 tSirMsgQ msg;
5591 tpHalIndCB pHalCB;
5592
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305593 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5594 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005595 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305596 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005597 return;
5598 }
5599
5600 pHalCB->pHalIndCB = limProcessHalIndMessages;
5601
5602 msg.type = WDA_REGISTER_PE_CALLBACK;
5603 msg.bodyptr = pHalCB;
5604 msg.bodyval = 0;
5605
Jeff Johnsone7245742012-09-05 17:12:55 -07005606 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005607 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5608 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305609 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005610 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 }
5612
5613 return;
5614}
5615
5616
5617/** -------------------------------------------------------------
5618\fn limProcessAddBaInd
5619
5620\brief handles the BA activity check timeout indication coming from HAL.
5621 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5622\param tpAniSirGlobal pMac
5623\param tSirMsgQ limMsg
5624\return None
5625-------------------------------------------------------------*/
5626void
5627limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5628{
5629 tANI_U8 i;
5630 tANI_U8 tid;
5631 tANI_U16 assocId;
5632 tpDphHashNode pSta;
5633 tpAddBaCandidate pBaCandidate;
5634 tANI_U32 baCandidateCnt;
5635 tpBaActivityInd pBaActivityInd;
5636 tpPESession psessionEntry;
5637 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005638#ifdef FEATURE_WLAN_TDLS
5639 boolean htCapable = FALSE;
5640#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005641
5642
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005643 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 return;
5645
5646 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5647 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5648
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005649 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005651 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305652 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005653 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005654 return;
5655 }
5656
5657 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005658#ifdef FEATURE_WLAN_TDLS
5659 if ((baCandidateCnt > pMac->lim.maxStation))
5660#else
5661 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5662#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005663 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305664 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005665 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005666 return;
5667 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005668
5669#ifdef FEATURE_WLAN_TDLS
5670 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5671 //AP capability
5672 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5673
5674 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5675 {
5676 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5677 if ((NULL == pSta) || (!pSta->valid))
5678 continue;
5679
5680 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5681 htCapable = pSta->mlmStaContext.htCapability;
5682 else
5683 htCapable = psessionEntry->htCapability;
5684
5685 if (htCapable)
5686 break;
5687 }
5688 if (!htCapable)
5689 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305690 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005691 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005692 return;
5693 }
5694#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005695
5696 //delete the complete dialoguetoken linked list
5697 limDeleteDialogueTokenList(pMac);
5698 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5699
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005700 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005701 {
5702 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005703 if ((NULL == pSta) || (!pSta->valid))
5704 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005705
5706 for (tid=0; tid<STACFG_MAX_TC; tid++)
5707 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005708 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005709 (pBaCandidate->baInfo[tid].fBaEnable))
5710 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005711 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5712 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5714 }
5715 }
5716 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305717 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005718 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005719 return;
5720}
5721
5722
5723/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005724\fn limDeleteBASessions
5725\brief Deletes all the exisitng BA sessions for given session
5726 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005727\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005728\param tpPESession pSessionEntry
5729\param tANI_U32 baDirection
5730\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005731-------------------------------------------------------------*/
5732
5733void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005734limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305735 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005736{
5737 tANI_U32 i;
5738 tANI_U8 tid;
5739 tpDphHashNode pSta;
5740
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005741 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005742 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743 limLog(pMac, LOGE, FL("Session does not exist"));
5744 }
5745 else
5746 {
5747 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005748 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5750 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5751 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5752 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005753 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005755 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005756 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5757 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005758 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005759 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5760 (baDirection & BA_INITIATOR))
5761 {
5762 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305763 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005764 pSessionEntry);
5765 }
5766 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5767 (baDirection & BA_RECIPIENT))
5768 {
5769 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305770 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005771 pSessionEntry);
5772 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005773 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 }
5775 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005776 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5777 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5778 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005779 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005780 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5781 &pSessionEntry->dph.dphHashTable);
5782 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005783 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005784 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5785 (baDirection & BA_INITIATOR))
5786 {
5787 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305788 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005789 pSessionEntry);
5790 }
5791 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5792 (baDirection & BA_RECIPIENT))
5793 {
5794 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305795 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005796 pSessionEntry);
5797 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005798 }
5799 }
5800 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005801 }
5802}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005803
5804/** -------------------------------------------------------------
5805\fn limDelAllBASessions
5806\brief Deletes all the exisitng BA sessions.
5807\param tpAniSirGlobal pMac
5808\return None
5809-------------------------------------------------------------*/
5810
5811void limDelAllBASessions(tpAniSirGlobal pMac)
5812{
5813 tANI_U32 i;
5814 tpPESession pSessionEntry;
5815
5816 for (i = 0; i < pMac->lim.maxBssId; i++)
5817 {
5818 pSessionEntry = peFindSessionBySessionId(pMac, i);
5819 if (pSessionEntry)
5820 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305821 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5822 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005823 }
5824 }
5825}
5826
5827/** -------------------------------------------------------------
5828\fn limDelAllBASessionsBtc
5829\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5830 band.
5831\param tpAniSirGlobal pMac
5832\return None
5833-------------------------------------------------------------*/
5834
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005835void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005836{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005837 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005838 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005839 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5840 &sessionId);
5841 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005842 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005843 PELOGW(limLog(pMac, LOGW,
5844 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305845 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305846 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005847 }
5848}
5849
Jeff Johnson295189b2012-06-20 16:38:30 -07005850/** -------------------------------------------------------------
5851\fn limProcessDelTsInd
5852\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5853 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5854\param tpAniSirGlobal pMac
5855\param tSirMsgQ limMsg
5856\return None
5857-------------------------------------------------------------*/
5858void
5859limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5860{
5861 tpDphHashNode pSta;
5862 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5863 tpSirDeltsReq pDelTsReq = NULL;
5864 tSirMacAddr peerMacAddr;
5865 tpSirDeltsReqInfo pDelTsReqInfo;
5866 tpLimTspecInfo pTspecInfo;
5867 tpPESession psessionEntry;
5868 tANI_U8 sessionId;
5869
5870if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5871 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005872 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305873 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005874 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005875 return;
5876 }
5877
5878 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5879 if(pTspecInfo->inuse == false)
5880 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005881 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 goto error1;
5883 }
5884
5885 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5886 if(pSta == NULL)
5887 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005888 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005889 pTspecInfo->assocId);
5890 goto error1;
5891 }
5892
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305893 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5894 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005895 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305896 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 goto error1;
5898 }
5899
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305900 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005901
5902 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305903 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005904 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305905 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005906
5907
5908 //validate the req
5909 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5910 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005911 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005912 goto error2;
5913 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305914 limLog(pMac, LOG1, "Sent DELTS request to station with "
5915 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5916 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005917
5918 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5919 psessionEntry);
5920
5921 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305922 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5923 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005924 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305925 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005926 goto error3;
5927 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305928 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005929
5930 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305931 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305933 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005934
5935 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5936
5937error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305938 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005939error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305940 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005941error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305942 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005943 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005944 return;
5945}
5946
5947/**
5948 * \brief Setup an A-MPDU/BA session
5949 *
5950 * \sa limPostMlmAddBAReq
5951 *
5952 * \param pMac The global tpAniSirGlobal object
5953 *
5954 * \param pStaDs DPH Hash Node object of peer STA
5955 *
5956 * \param tid TID for which a BA is being setup.
5957 * If this is set to 0xFFFF, then we retrieve
5958 * the default TID from the CFG
5959 *
5960 * \return eSIR_SUCCESS if setup completes successfully
5961 * eSIR_FAILURE is some problem is encountered
5962 */
5963tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5964 tpDphHashNode pStaDs,
5965 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5966{
5967 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005968 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005969 tpDialogueToken dialogueTokenNode;
5970 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005971
Jeff Johnson295189b2012-06-20 16:38:30 -07005972 // Check if the peer is a 11n capable STA
5973 // FIXME - Need a 11n peer indication in DPH.
5974 // For now, using the taurusPeer attribute
5975 //if( 0 == pStaDs->taurusPeer == )
5976 //return eSIR_SUCCESS;
5977
5978 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305979 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5980 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005981 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305982 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005983 status = eSIR_MEM_ALLOC_FAILED;
5984 goto returnFailure;
5985 }
5986
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305987 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005988
5989 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305990 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005991 pMlmAddBAReq->peerMacAddr,
5992 pStaDs->staAddr,
5993 sizeof( tSirMacAddr ));
5994
5995 // Update the TID
5996 pMlmAddBAReq->baTID = tid;
5997
5998 // Determine the supported BA policy of local STA
5999 // for the TID of interest
6000 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6001
6002 // BA Buffer Size
6003 // Requesting the ADDBA recipient to populate the size.
6004 // If ADDBA is accepted, a non-zero buffer size should
6005 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306006 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6007 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6008 {
6009 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6010 causing very low throughput in HT40 case */
6011 limLog( pMac, LOGW,
6012 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6013 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6014 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306015 else if (pMac->miracastVendorConfig)
6016 {
6017 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6018 {
6019 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6020 status = eSIR_FAILURE;
6021 goto returnFailure;
6022 }
6023
6024 pMlmAddBAReq->baBufferSize = val;
6025 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306026 else
6027 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006028
6029 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306030 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 -07006031 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6032 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306033 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006034
6035 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006036 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006037 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006038 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006039 status = eSIR_FAILURE;
6040 goto returnFailure;
6041 }
6042 pMlmAddBAReq->baTimeout = val; // In TU's
6043
6044 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006045 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006046 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6047 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6048
6049 // BA Starting Sequence Number
6050 pMlmAddBAReq->baSSN = startingSeqNum;
6051
6052 /* Update PE session Id*/
6053 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6054
6055 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6056
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006057 dialogueTokenNode = limAssignDialogueToken(pMac);
6058 if (NULL == dialogueTokenNode)
6059 {
6060 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6061 status = eSIR_FAILURE;
6062 goto returnFailure;
6063 }
6064
Jeff Johnson295189b2012-06-20 16:38:30 -07006065 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006066 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006067 dialogueTokenNode->assocId = pStaDs->assocId;
6068 dialogueTokenNode->tid = tid;
6069 // Send ADDBA Req to MLME
6070 limPostMlmMessage( pMac,
6071 LIM_MLM_ADDBA_REQ,
6072 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006073 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006074
6075returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306076 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006077 return status;
6078}
6079
6080/**
6081 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6082 * will then send an ADDBA Rsp to peer MAC entity
6083 * with the appropriate ADDBA status code
6084 *
6085 * \sa limPostMlmAddBARsp
6086 *
6087 * \param pMac The global tpAniSirGlobal object
6088 *
6089 * \param peerMacAddr MAC address of peer entity that will
6090 * be the recipient of this ADDBA Rsp
6091 *
6092 * \param baStatusCode ADDBA Rsp status code
6093 *
6094 * \param baDialogToken ADDBA Rsp dialog token
6095 *
6096 * \param baTID TID of interest
6097 *
6098 * \param baPolicy The BA policy
6099 *
6100 * \param baBufferSize The BA buffer size
6101 *
6102 * \param baTimeout BA timeout in TU's
6103 *
6104 * \return eSIR_SUCCESS if setup completes successfully
6105 * eSIR_FAILURE is some problem is encountered
6106 */
6107tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6108 tSirMacAddr peerMacAddr,
6109 tSirMacStatusCodes baStatusCode,
6110 tANI_U8 baDialogToken,
6111 tANI_U8 baTID,
6112 tANI_U8 baPolicy,
6113 tANI_U16 baBufferSize,
6114 tANI_U16 baTimeout,
6115 tpPESession psessionEntry)
6116{
6117tSirRetStatus status = eSIR_SUCCESS;
6118tpLimMlmAddBARsp pMlmAddBARsp;
6119
6120 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306121 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6122 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006123 {
6124 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306125 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 status );
6127
6128 status = eSIR_MEM_ALLOC_FAILED;
6129 goto returnFailure;
6130 }
6131
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306132 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006133
6134 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306135 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006136 pMlmAddBARsp->peerMacAddr,
6137 peerMacAddr,
6138 sizeof( tSirMacAddr ));
6139
6140 pMlmAddBARsp->baDialogToken = baDialogToken;
6141 pMlmAddBARsp->addBAResultCode = baStatusCode;
6142 pMlmAddBARsp->baTID = baTID;
6143 pMlmAddBARsp->baPolicy = baPolicy;
6144 pMlmAddBARsp->baBufferSize = baBufferSize;
6145 pMlmAddBARsp->baTimeout = baTimeout;
6146
6147 /* UPdate PE session ID*/
6148 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6149
6150 // Send ADDBA Rsp to MLME
6151 limPostMlmMessage( pMac,
6152 LIM_MLM_ADDBA_RSP,
6153 (tANI_U32 *) pMlmAddBARsp );
6154
6155returnFailure:
6156
6157 return status;
6158}
6159
6160/**
6161 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6162 * will then send an DELBA Ind to peer MAC entity
6163 * with the appropriate DELBA status code
6164 *
6165 * \sa limPostMlmDelBAReq
6166 *
6167 * \param pMac The global tpAniSirGlobal object
6168 *
6169 * \param pSta DPH Hash Node object of peer MAC entity
6170 * for which the BA session is being deleted
6171 *
6172 * \param baDirection DELBA direction
6173 *
6174 * \param baTID TID for which the BA session is being deleted
6175 *
6176 * \param baReasonCode DELBA Req reason code
6177 *
6178 * \return eSIR_SUCCESS if setup completes successfully
6179 * eSIR_FAILURE is some problem is encountered
6180 */
6181tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6182 tpDphHashNode pSta,
6183 tANI_U8 baDirection,
6184 tANI_U8 baTID,
6185 tSirMacReasonCodes baReasonCode,
6186 tpPESession psessionEntry)
6187{
6188tSirRetStatus status = eSIR_SUCCESS;
6189tpLimMlmDelBAReq pMlmDelBAReq;
6190tLimBAState curBaState;
6191
6192if(NULL == pSta)
6193 return eSIR_FAILURE;
6194
6195LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6196
6197 // Need to validate the current BA State.
6198 if( eLIM_BA_STATE_IDLE != curBaState)
6199 {
6200 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006201 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006202 baTID,
6203 curBaState);
6204
6205 status = eSIR_FAILURE;
6206 goto returnFailure;
6207 }
6208
6209 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306210 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6211 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006212 {
6213 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306214 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006215 status );
6216
6217 status = eSIR_MEM_ALLOC_FAILED;
6218 goto returnFailure;
6219 }
6220
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306221 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006222
6223 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306224 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006225 pMlmDelBAReq->peerMacAddr,
6226 pSta->staAddr,
6227 sizeof( tSirMacAddr ));
6228
6229 pMlmDelBAReq->baDirection = baDirection;
6230 pMlmDelBAReq->baTID = baTID;
6231 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6232
6233 /* Update PE session ID*/
6234 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6235
6236 //we don't have valid BA session for the given direction.
6237 // HDD wants to get the BA session deleted on PEER in this case.
6238 // in this case we just need to send DelBA to the peer.
6239 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6240 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6241 {
6242 // Send DELBA Ind over the air
6243 if( eSIR_SUCCESS !=
6244 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6245 status = eSIR_FAILURE;
6246
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306247 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006248 return status;
6249 }
6250
6251
6252 // Update the BA state in STA
6253 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6254
6255 // Send DELBA Req to MLME
6256 limPostMlmMessage( pMac,
6257 LIM_MLM_DELBA_REQ,
6258 (tANI_U32 *) pMlmDelBAReq );
6259
6260returnFailure:
6261
6262 return status;
6263}
6264
6265/**
6266 * \brief Send WDA_ADDBA_REQ to HAL, in order
6267 * to setup a new BA session with a peer
6268 *
6269 * \sa limPostMsgAddBAReq
6270 *
6271 * \param pMac The global tpAniSirGlobal object
6272 *
6273 * \param pSta Runtime, STA-related configuration cached
6274 * in the HashNode object
6275 *
6276 * \param baDialogToken The Action Frame dialog token
6277 *
6278 * \param baTID TID for which the BA session is being setup
6279 *
6280 * \param baPolicy BA Policy
6281 *
6282 * \param baBufferSize The requested BA buffer size
6283 *
6284 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6285 *
6286 * \param baSSN Starting Sequence Number for this BA session
6287 *
6288 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6289 *
6290 * \return none
6291 *
6292 */
6293tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6294 tpDphHashNode pSta,
6295 tANI_U8 baDialogToken,
6296 tANI_U8 baTID,
6297 tANI_U8 baPolicy,
6298 tANI_U16 baBufferSize,
6299 tANI_U16 baTimeout,
6300 tANI_U16 baSSN,
6301 tANI_U8 baDirection,
6302 tpPESession psessionEntry)
6303{
6304tpAddBAParams pAddBAParams = NULL;
6305tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006306tSirMsgQ msgQ;
6307
6308#ifdef WLAN_SOFTAP_VSTA_FEATURE
6309 // we can only do BA on "hard" STAs
6310 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6311 {
6312 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306313 limLog( pMac, LOGE,
6314 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006315 goto returnFailure;
6316 }
6317#endif //WLAN_SOFTAP_VSTA_FEATURE
6318
6319 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306320 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6321 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006322 {
6323 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306324 FL("AllocateMemory failed")
6325 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006326
6327 retCode = eSIR_MEM_ALLOC_FAILED;
6328 goto returnFailure;
6329 }
6330
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306331 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006332
6333 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306334 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 (void *) pAddBAParams->peerMacAddr,
6336 (void *) pSta->staAddr,
6337 sizeof( tSirMacAddr ));
6338
6339 // Populate the REQ parameters
6340 pAddBAParams->staIdx = pSta->staIndex;
6341 pAddBAParams->baDialogToken = baDialogToken;
6342 pAddBAParams->baTID = baTID;
6343 pAddBAParams->baPolicy = baPolicy;
6344 pAddBAParams->baBufferSize = baBufferSize;
6345 pAddBAParams->baTimeout = baTimeout;
6346 pAddBAParams->baSSN = baSSN;
6347 pAddBAParams->baDirection = baDirection;
6348 pAddBAParams->respReqd = 1;
6349
6350 /* UPdate PE session ID */
6351 pAddBAParams->sessionId = psessionEntry->peSessionId;
6352
6353 // Post WDA_ADDBA_REQ to HAL.
6354 msgQ.type = WDA_ADDBA_REQ;
6355 //
6356 // FIXME_AMPDU
6357 // A global counter (dialog token) is required to keep track of
6358 // all PE <-> HAL communication(s)
6359 //
6360 msgQ.reserved = 0;
6361 msgQ.bodyptr = pAddBAParams;
6362 msgQ.bodyval = 0;
6363
6364 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306365 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6366 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6367 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6368 pAddBAParams->baTimeout, pAddBAParams->baTID,
6369 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6370 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006371
6372 //defer any other message until we get response back.
6373 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6374
Jeff Johnsone7245742012-09-05 17:12:55 -07006375 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006376#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6377 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6378#endif //FEATURE_WLAN_DIAG_SUPPORT
6379
6380 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6381 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006382 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006383 retCode );
6384 else
6385 return retCode;
6386
6387returnFailure:
6388
6389 // Clean-up...
6390 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306391 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006392
6393 return retCode;
6394
6395}
6396
6397/**
6398 * \brief Send WDA_DELBA_IND to HAL, in order
6399 * to delete an existing BA session with peer
6400 *
6401 * \sa limPostMsgDelBAInd
6402 *
6403 * \param pMac The global tpAniSirGlobal object
6404 *
6405 * \param pSta Runtime, STA-related configuration cached
6406 * in the HashNode object
6407 *
6408 * \param baTID TID for which the BA session is being setup
6409 *
6410 * \param baDirection Identifies whether the DELBA Ind was
6411 * sent by the BA initiator or recipient
6412 *
6413 * \return none
6414 *
6415 */
6416tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6417 tpDphHashNode pSta,
6418 tANI_U8 baTID,
6419 tANI_U8 baDirection,
6420 tpPESession psessionEntry)
6421{
6422tpDelBAParams pDelBAParams = NULL;
6423tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006424tSirMsgQ msgQ;
6425
6426 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306427 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6428 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 {
6430 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306431 FL("AllocateMemory failed")
6432 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006433
6434 retCode = eSIR_MEM_ALLOC_FAILED;
6435 goto returnFailure;
6436 }
6437
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306438 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006439
6440 // Populate the REQ parameters
6441 pDelBAParams->staIdx = pSta->staIndex;
6442 pDelBAParams->baTID = baTID;
6443 pDelBAParams->baDirection = baDirection;
6444
6445 /* Update PE session ID */
6446
6447
6448 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6449 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6450
6451 // Post WDA_DELBA_IND to HAL.
6452 msgQ.type = WDA_DELBA_IND;
6453 //
6454 // FIXME:
6455 // A global counter (dialog token) is required to keep track of
6456 // all PE <-> HAL communication(s)
6457 //
6458 msgQ.reserved = 0;
6459 msgQ.bodyptr = pDelBAParams;
6460 msgQ.bodyval = 0;
6461
6462 limLog( pMac, LOGW,
6463 FL( "Sending SIR_HAL_DELBA_IND..." ));
6464
Jeff Johnsone7245742012-09-05 17:12:55 -07006465 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006466#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6467 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6468#endif //FEATURE_WLAN_DIAG_SUPPORT
6469
6470 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6471 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006472 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006473 retCode );
6474 else
6475 {
6476 // Update LIM's internal cache...
6477 if( eBA_INITIATOR == baDirection)
6478 {
6479 pSta->tcCfg[baTID].fUseBATx = 0;
6480 pSta->tcCfg[baTID].txBufSize = 0;
6481 }
6482 else
6483 {
6484 pSta->tcCfg[baTID].fUseBARx = 0;
6485 pSta->tcCfg[baTID].rxBufSize = 0;
6486 }
6487
6488 return retCode;
6489 }
6490
6491returnFailure:
6492
6493 // Clean-up...
6494 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306495 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006496
6497 return retCode;
6498
6499}
6500
6501/**
6502 * @function : limPostSMStateUpdate()
6503 *
6504 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6505 *
6506 * LOGIC:
6507 *
6508 * ASSUMPTIONS:
6509 * NA
6510 *
6511 * NOTE:
6512 * NA
6513 *
6514 * @param pMac - Pointer to Global MAC structure
6515 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6516 * @return None
6517 */
6518tSirRetStatus
6519limPostSMStateUpdate(tpAniSirGlobal pMac,
6520 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6521{
6522 tSirRetStatus retCode = eSIR_SUCCESS;
6523 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006524 tpSetMIMOPS pMIMO_PSParams;
6525
6526 msgQ.reserved = 0;
6527 msgQ.type = WDA_SET_MIMOPS_REQ;
6528
6529 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306530 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6531 if ( NULL == pMIMO_PSParams )
6532 {
6533 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006534 return eSIR_MEM_ALLOC_FAILED;
6535 }
6536
6537 pMIMO_PSParams->htMIMOPSState = state;
6538 pMIMO_PSParams->staIdx = staIdx;
6539 pMIMO_PSParams->fsendRsp = true;
6540 msgQ.bodyptr = pMIMO_PSParams;
6541 msgQ.bodyval = 0;
6542
6543 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6544
Jeff Johnsone7245742012-09-05 17:12:55 -07006545 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006546 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6547 if (eSIR_SUCCESS != retCode)
6548 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006549 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306550 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006551 return retCode;
6552 }
6553
6554 return retCode;
6555}
6556
6557void limPktFree (
6558 tpAniSirGlobal pMac,
6559 eFrameType frmType,
6560 tANI_U8 *pRxPacketInfo,
6561 void *pBody)
6562{
6563 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006564}
6565
6566/**
6567 * limGetBDfromRxPacket()
6568 *
6569 *FUNCTION:
6570 * This function is called to get pointer to Polaris
6571 * Buffer Descriptor containing MAC header & other control
6572 * info from the body of the message posted to LIM.
6573 *
6574 *LOGIC:
6575 * NA
6576 *
6577 *ASSUMPTIONS:
6578 * NA
6579 *
6580 *NOTE:
6581 * NA
6582 *
6583 * @param body - Received message body
6584 * @param pRxPacketInfo - Pointer to received BD
6585 * @return None
6586 */
6587
6588void
6589limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6590{
Jeff Johnson295189b2012-06-20 16:38:30 -07006591 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006592} /*** end limGetBDfromRxPacket() ***/
6593
6594
6595
6596
6597
6598void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6599{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306600 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006601}
6602
6603
6604void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6605{
6606 tANI_U8 i;
6607 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6608
6609 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6610 {
6611 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6612 {
6613 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6614 fFound = eANI_BOOLEAN_TRUE;
6615 break;
6616 }
6617 }
6618 if(eANI_BOOLEAN_FALSE == fFound)
6619 {
6620 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6621 {
6622 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6623 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6624 }
6625 else
6626 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006627 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006628 }
6629 }
6630}
6631
6632
6633/**
6634 * @function : limIsChannelValidForChannelSwitch()
6635 *
6636 * @brief : This function checks if the channel to which AP
6637 * is expecting us to switch, is a valid channel for us.
6638 * LOGIC:
6639 *
6640 * ASSUMPTIONS:
6641 * NA
6642 *
6643 * NOTE:
6644 * NA
6645 *
6646 * @param pMac - Pointer to Global MAC structure
6647 * @param channel - New channel to which we are expected to move
6648 * @return None
6649 */
6650tAniBool
6651limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6652{
6653 tANI_U8 index;
6654 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6655 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6656
6657 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6658 (tANI_U8 *)validChannelList,
6659 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6660 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006661 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006662 return (eSIR_FALSE);
6663 }
6664
6665 for(index = 0; index < validChannelListLen; index++)
6666 {
6667 if(validChannelList[index] == channel)
6668 return (eSIR_TRUE);
6669 }
6670
6671 /* channel does not belong to list of valid channels */
6672 return (eSIR_FALSE);
6673}
6674
6675/**------------------------------------------------------
6676\fn __limFillTxControlParams
6677\brief Fill the message for stopping/resuming tx.
6678
6679\param pMac
6680\param pTxCtrlMsg - Pointer to tx control message.
6681\param type - Which way we want to stop/ resume tx.
6682\param mode - To stop/resume.
6683 -------------------------------------------------------*/
6684static eHalStatus
6685__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6686 tLimQuietTxMode type, tLimControlTx mode)
6687{
6688
6689 //TBD-RAJESH HOW TO GET sessionEntry?????
6690 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6691
6692 if (mode == eLIM_STOP_TX)
6693 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6694 else
6695 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6696
6697 switch (type)
6698 {
6699 case eLIM_TX_ALL:
6700 /** Stops/resumes transmission completely */
6701 pTxCtrlMsg->fCtrlGlobal = 1;
6702 break;
6703
6704 case eLIM_TX_BSS_BUT_BEACON:
6705 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6706 * stop beacon transmission.
6707 */
6708 pTxCtrlMsg->ctrlBss = 1;
6709 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6710 break;
6711
6712 case eLIM_TX_STA:
6713 /** Memory for station bitmap is allocated dynamically in caller of this
6714 * so decode properly here and fill the bitmap. Now not implemented,
6715 * fall through.
6716 */
6717 case eLIM_TX_BSS:
6718 //Fall thru...
6719 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006720 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006721 return eHAL_STATUS_FAILURE;
6722 }
6723
6724 return eHAL_STATUS_SUCCESS;
6725}
6726
6727/**
6728 * @function : limFrameTransmissionControl()
6729 *
6730 * @brief : This API is called by the user to halt/resume any frame
6731 * transmission from the device. If stopped, all frames will be
6732 * queued starting from hardware. Then back-pressure
6733 * is built till the driver.
6734 * LOGIC:
6735 *
6736 * ASSUMPTIONS:
6737 * NA
6738 *
6739 * NOTE:
6740 * NA
6741 *
6742 * @param pMac - Pointer to Global MAC structure
6743 * @return None
6744 */
6745void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6746{
6747
6748 eHalStatus status = eHAL_STATUS_FAILURE;
6749 tpTxControlParams pTxCtrlMsg;
6750 tSirMsgQ msgQ;
6751 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6752
6753 /** Allocate only required number of bytes for station bitmap
6754 * Make it to align to 4 byte boundary */
6755 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6756
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306757 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6758 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006759 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306760 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006761 return;
6762 }
6763
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306764 vos_mem_set((void *) pTxCtrlMsg,
6765 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006766 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6767 if (status != eHAL_STATUS_SUCCESS)
6768 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306769 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006770 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006771 return;
6772 }
6773
6774 msgQ.bodyptr = (void *) pTxCtrlMsg;
6775 msgQ.bodyval = 0;
6776 msgQ.reserved = 0;
6777 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6778
Jeff Johnsone7245742012-09-05 17:12:55 -07006779 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6781 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306782 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006783 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006784 return;
6785 }
6786
6787 if (mode == eLIM_STOP_TX)
6788 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306789 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006790 }
6791 else
6792 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306793 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006794 }
6795 return;
6796}
6797
6798
6799/**
6800 * @function : limRestorePreChannelSwitchState()
6801 *
6802 * @brief : This API is called by the user to undo any
6803 * specific changes done on the device during
6804 * channel switch.
6805 * LOGIC:
6806 *
6807 * ASSUMPTIONS:
6808 * NA
6809 *
6810 * NOTE:
6811 * NA
6812 *
6813 * @param pMac - Pointer to Global MAC structure
6814 * @return None
6815 */
6816
6817tSirRetStatus
6818limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6819{
6820
6821 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006822 tANI_U32 val = 0;
6823
6824 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6825 return retCode;
6826
6827 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006828 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006829
6830 /* Restore the frame transmission, all the time. */
6831 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6832
6833 /* Free to enter BMPS */
6834 limSendSmePostChannelSwitchInd(pMac);
6835
6836 //Background scan is now enabled by SME
6837 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6838 {
6839 /* Enable background scan if already enabled, else don't bother */
6840 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6841 &val)) != eSIR_SUCCESS)
6842
6843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006844 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006845 return (retCode);
6846 }
6847
6848 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6849 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006850 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6851 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006852 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6853 {
6854 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6855 return (eSIR_FAILURE);
6856 }
6857
6858 }
6859 }
6860
6861 /* Enable heartbeat timer */
6862 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6863 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006864 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6865 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6866 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6867 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006868 {
6869 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6870 return (eSIR_FAILURE);
6871 }
6872 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006873 return (retCode);
6874}
6875
6876
6877/**--------------------------------------------
6878\fn limRestorePreQuietState
6879\brief Restore the pre quiet state
6880
6881\param pMac
6882\return NONE
6883---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006884tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006885{
6886
6887 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006888 tANI_U32 val = 0;
6889
6890 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6891 return retCode;
6892
6893 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006894 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006895
6896 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006897 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006898 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6899
6900
6901 //Background scan is now enabled by SME
6902 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6903 {
6904 /* Enable background scan if already enabled, else don't bother */
6905 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6906 &val)) != eSIR_SUCCESS)
6907
6908 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006909 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006910 return (retCode);
6911 }
6912
6913 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6914 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006915 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6917 {
6918 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6919 return (eSIR_FAILURE);
6920 }
6921
6922 }
6923 }
6924
6925 /* Enable heartbeat timer */
6926 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6927 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006928 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006929 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006930 {
6931 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6932 return (eSIR_FAILURE);
6933 }
6934 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006935 return (retCode);
6936}
6937
6938
6939/**
6940 * @function: limPrepareFor11hChannelSwitch()
6941 *
6942 * @brief : This API is called by the user to prepare for
6943 * 11h channel switch. As of now, the API does
6944 * very minimal work. User can add more into the
6945 * same API if needed.
6946 * LOGIC:
6947 *
6948 * ASSUMPTIONS:
6949 * NA
6950 *
6951 * NOTE:
6952 * NA
6953 *
6954 * @param pMac - Pointer to Global MAC structure
6955 * @param psessionEntry
6956 * @return None
6957 */
6958void
6959limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6960{
Jeff Johnson295189b2012-06-20 16:38:30 -07006961 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6962 return;
6963
6964 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006965 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006966
6967 /* Disable, Stop background scan if enabled and running */
6968 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6969
6970 /* Stop heart-beat timer to stop heartbeat disassociation */
6971 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6972
6973 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6974 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6975 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006976 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006977 /* Stop ongoing scanning if any */
6978 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6979 {
6980 //Set the resume channel to Any valid channel (invalid).
6981 //This will instruct HAL to set it to any previous valid channel.
6982 peSetResumeChannel(pMac, 0, 0);
6983 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6984 }
6985 else
6986 {
6987 limRestorePreChannelSwitchState(pMac, psessionEntry);
6988 }
6989 return;
6990 }
6991 else
6992 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006993 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006994 /** We are safe to switch channel at this point */
6995 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6996 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006997}
6998
6999
7000
7001/**----------------------------------------------------
7002\fn limGetNwType
7003
7004\brief Get type of the network from data packet or beacon
7005\param pMac
7006\param channelNum - Channel number
7007\param type - Type of packet.
7008\param pBeacon - Pointer to beacon or probe response
7009
7010\return Network type a/b/g.
7011-----------------------------------------------------*/
7012tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7013{
7014 tSirNwType nwType = eSIR_11B_NW_TYPE;
7015
7016 if (type == SIR_MAC_DATA_FRAME)
7017 {
7018 if ((channelNum > 0) && (channelNum < 15))
7019 {
7020 nwType = eSIR_11G_NW_TYPE;
7021 }
7022 else
7023 {
7024 nwType = eSIR_11A_NW_TYPE;
7025 }
7026 }
7027 else
7028 {
7029 if ((channelNum > 0) && (channelNum < 15))
7030 {
7031 int i;
7032 // 11b or 11g packet
7033 // 11g iff extended Rate IE is present or
7034 // if there is an A rate in suppRate IE
7035 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7036 {
7037 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7038 {
7039 nwType = eSIR_11G_NW_TYPE;
7040 break;
7041 }
7042 }
7043 if (pBeacon->extendedRatesPresent)
7044 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007045 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007046 nwType = eSIR_11G_NW_TYPE;
7047 }
7048 }
7049 else
7050 {
7051 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007052 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007053 nwType = eSIR_11A_NW_TYPE;
7054 }
7055 }
7056 return nwType;
7057}
7058
7059
7060/**---------------------------------------------------------
7061\fn limGetChannelFromBeacon
7062\brief To extract channel number from beacon
7063
7064\param pMac
7065\param pBeacon - Pointer to beacon or probe rsp
7066\return channel number
7067-----------------------------------------------------------*/
7068tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7069{
7070 tANI_U8 channelNum = 0;
7071
7072 if (pBeacon->dsParamsPresent)
7073 channelNum = pBeacon->channelNumber;
7074 else if(pBeacon->HTInfo.present)
7075 channelNum = pBeacon->HTInfo.primaryChannel;
7076 else
7077 channelNum = pBeacon->channelNumber;
7078
7079 return channelNum;
7080}
7081
7082
7083/** ---------------------------------------------------------
7084\fn limSetTspecUapsdMask
7085\brief This function sets the PE global variable:
7086\ 1) gUapsdPerAcTriggerEnableMask and
7087\ 2) gUapsdPerAcDeliveryEnableMask
7088\ based on the user priority field and direction field
7089\ in the TS Info Fields.
7090\
7091\ An AC is a trigger-enabled AC if the PSB subfield
7092\ is set to 1 in the uplink direction.
7093\ An AC is a delivery-enabled AC if the PSB subfield
7094\ is set to 1 in the down-link direction.
7095\
7096\param tpAniSirGlobal pMac
7097\param tSirMacTSInfo pTsInfo
7098\param tANI_U32 action
7099\return None
7100 ------------------------------------------------------------*/
7101void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7102{
7103 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7104 tANI_U16 direction = pTsInfo->traffic.direction;
7105 tANI_U8 ac = upToAc(userPrio);
7106
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307107 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 -07007108
7109 /* Converting AC to appropriate Uapsd Bit Mask
7110 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7111 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7112 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7113 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7114 */
7115 ac = ((~ac) & 0x3);
7116
7117 if (action == CLEAR_UAPSD_MASK)
7118 {
7119 if (direction == SIR_MAC_DIRECTION_UPLINK)
7120 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7121 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7122 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7123 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7124 {
7125 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7126 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7127 }
7128 }
7129 else if (action == SET_UAPSD_MASK)
7130 {
7131 if (direction == SIR_MAC_DIRECTION_UPLINK)
7132 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7133 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7134 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7135 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7136 {
7137 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7138 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7139 }
7140 }
7141
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007142 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7143 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007144
7145 return;
7146}
7147
7148
7149
7150void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7151{
7152
7153 tANI_U8 i;
7154 for(i =0;i < pMac->lim.maxBssId;i++)
7155 {
7156 if(pMac->lim.gpSession[i].valid == TRUE )
7157 {
7158 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7159 {
7160 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7161 break;
7162 }
7163
7164 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7165 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7166 {
7167 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7168 }
7169 }
7170 }
7171 for(i=0; i< pMac->lim.maxBssId; i++)
7172 {
7173 if(pMac->lim.gpSession[i].valid == TRUE )
7174 {
7175 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7176 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7177 {
7178 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7179 {
7180 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007181 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007182 i);)
7183 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7184 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7185 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7186 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007187 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007188 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7189 }
7190 break;
7191 }
7192 }
7193 }
7194 }
7195}
7196
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007197void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7198{
7199 if(psessionEntry->valid == TRUE )
7200 {
7201 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7202 {
7203 limIbssHeartBeatHandle(pMac,psessionEntry);
7204 }
7205 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7206 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7207 {
7208 limHandleHeartBeatFailure(pMac,psessionEntry);
7209 }
7210 }
7211 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7212 and the other things again */
7213 if(psessionEntry->valid == TRUE )
7214 {
7215 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7216 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7217 {
7218 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7219 {
7220 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7221 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7222 psessionEntry->bssIdx);)
7223 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7224 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7225 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7226 {
7227 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7228 limReactivateHeartBeatTimer(pMac, psessionEntry);
7229 }
7230 }
7231 }
7232 }
7233}
7234
7235
Jeff Johnson295189b2012-06-20 16:38:30 -07007236tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7237{
7238 tANI_U8 i;
7239 for(i =0;i < pMac->lim.maxBssId;i++)
7240 {
7241 if(pMac->lim.gpSession[i].valid == TRUE )
7242 {
7243 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7244 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7245 {
7246 return pMac->lim.gpSession[i].currentOperChannel;
7247 }
7248 }
7249 }
7250 return 0;
7251}
7252
7253void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7254{
7255
7256 tpPESession psessionEntry;
7257// tANI_U8 sessionId;
7258 tpAddStaParams pAddStaParams;
7259
7260 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7261
7262 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7263 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007264 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307265 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007266 return;
7267 }
7268 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7269 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007270#ifdef FEATURE_WLAN_TDLS
7271 else if(pMac->lim.gLimAddStaTdls)
7272 {
7273 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7274 pMac->lim.gLimAddStaTdls = FALSE ;
7275 }
7276#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007277 else
7278 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7279
7280}
7281
7282
7283void limUpdateBeacon(tpAniSirGlobal pMac)
7284{
7285 tANI_U8 i;
7286
7287 for(i =0;i < pMac->lim.maxBssId;i++)
7288 {
7289 if(pMac->lim.gpSession[i].valid == TRUE )
7290 {
7291 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7292 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7293 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7294 )
7295 {
7296 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7297 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7298 }
7299 else
7300 {
7301 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7302 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7303 {
7304
7305 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7306 {
7307 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7308 }
7309 }
7310 }
7311 }
7312 }
7313}
7314
7315void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7316{
7317 tANI_U8 i;
7318 tpPESession psessionEntry;
7319 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7320 for(i =0; i < pMac->lim.maxBssId; i++)
7321 {
7322 if(pMac->lim.gpSession[i].valid == TRUE)
7323 {
7324 psessionEntry = &pMac->lim.gpSession[i];
7325 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7326 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307327 limLog(pMac, LOGE,
7328 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7329 psessionEntry->limSmeState, psessionEntry->limMlmState,
7330 psessionEntry->LimRxedBeaconCntDuringHB,
7331 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007332#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7333 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7334#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007335 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7336 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307337 /* Disconnect even if we have not received a single beacon
7338 * after connection.
7339 */
7340 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7341 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307342 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7343 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007344 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007345 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007346 /* AP did not respond to Probe Request. Tear down link with it.*/
7347 limTearDownLinkWithAp(pMac,
7348 psessionEntry->peSessionId,
7349 eSIR_BEACON_MISSED);
7350 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7351 }
7352 else // restart heartbeat timer
7353 {
7354 limReactivateHeartBeatTimer(pMac, psessionEntry);
7355 }
7356 }
7357 else
7358 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007359 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007360 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7361 limReactivateHeartBeatTimer(pMac, psessionEntry);
7362 }
7363
7364 }
7365 }
7366 }
7367 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7368 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7369}
7370
7371
7372/*
7373* This function assumes there will not be more than one IBSS session active at any time.
7374*/
7375tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7376{
7377 tANI_U8 i;
7378
7379 for(i =0;i < pMac->lim.maxBssId;i++)
7380 {
7381 if( (pMac->lim.gpSession[i].valid) &&
7382 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7383 return (&pMac->lim.gpSession[i]);
7384 }
7385
7386 return NULL;
7387}
7388
7389tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7390{
7391 tANI_U8 i;
7392
7393 for(i =0;i < pMac->lim.maxBssId;i++)
7394 {
7395 if( (pMac->lim.gpSession[i].valid) &&
7396 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7397 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7398 return (&pMac->lim.gpSession[i]);
7399 }
7400
7401 return NULL;
7402}
7403
7404/**---------------------------------------------------------
7405\fn limHandleDeferMsgError
7406\brief handles error scenario, when the msg can not be deferred.
7407\param pMac
7408\param pLimMsg LIM msg, which could not be deferred.
7409\return void
7410-----------------------------------------------------------*/
7411
7412void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7413{
7414 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7415 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307416 /*Decrement the Pending count before droping */
7417 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007418 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7419 }
7420 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007421 {
7422 vos_mem_free( pLimMsg->bodyptr);
7423 pLimMsg->bodyptr = NULL;
7424 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007425}
7426
7427
7428#ifdef FEATURE_WLAN_DIAG_SUPPORT
7429/**---------------------------------------------------------
7430\fn limDiagEventReport
7431\brief This function reports Diag event
7432\param pMac
7433\param eventType
7434\param bssid
7435\param status
7436\param reasonCode
7437\return void
7438-----------------------------------------------------------*/
7439void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7440{
7441 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7442 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7443
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307444 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007445
7446 if (NULL == pSessionEntry)
7447 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307448 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007449 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7450 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7451
7452 }
7453 else
7454 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307455 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007456 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7457 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7458 }
7459 peEvent.event_type = eventType;
7460 peEvent.status = status;
7461 peEvent.reason_code = reasonCode;
7462
7463 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7464 return;
7465}
7466
7467#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7468
7469void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7470{
7471
7472 tpAddStaSelfParams pAddStaSelfParams;
7473 tSirMsgQ mmhMsg;
7474 tpSirSmeAddStaSelfRsp pRsp;
7475
7476
7477 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7478
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307479 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7480 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007481 {
7482 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307483 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7484 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007485 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007486 return;
7487 }
7488
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307489 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007490
7491 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7492 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7493 pRsp->status = pAddStaSelfParams->status;
7494
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307495 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007496
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007498 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007499
7500 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7501 mmhMsg.bodyptr = pRsp;
7502 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307503 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7505
7506}
7507
7508void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7509{
7510
7511 tpDelStaSelfParams pDelStaSelfParams;
7512 tSirMsgQ mmhMsg;
7513 tpSirSmeDelStaSelfRsp pRsp;
7514
7515
7516 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7517
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307518 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7519 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007520 {
7521 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307522 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7523 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007524 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007525 return;
7526 }
7527
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307528 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007529
7530 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7531 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7532 pRsp->status = pDelStaSelfParams->status;
7533
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307534 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007535
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307536 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007537 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007538
7539 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7540 mmhMsg.bodyptr = pRsp;
7541 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307542 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007543 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7544
7545}
7546
7547/***************************************************************
7548* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7549* To unmap the channel to reverse the effect of mapping
7550* a band channel in hal .Mapping was done hal to overcome the
7551* limitation of the rxbd which use only 4 bit for channel number.
7552*****************************************************************/
7553tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7554{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007555#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007556 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007557 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7558 return aUnsortedChannelList[mapChannel -1];
7559 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007560#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007561 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007562#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007563 return abChannel[mapChannel -1];
7564 else
7565 return 0;
7566}
7567
7568
7569v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7570{
7571 int left = length;
7572 v_U8_t *ptr = pIes;
7573 v_U8_t elem_id;
7574 v_U16_t elem_len;
7575
7576 while(left >= (size_of_len_field+1))
7577 {
7578 elem_id = ptr[0];
7579 if (size_of_len_field == TWO_BYTE)
7580 {
7581 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7582 }
7583 else
7584 {
7585 elem_len = ptr[1];
7586 }
7587
7588
7589 left -= (size_of_len_field+1);
7590 if(elem_len > left)
7591 {
7592 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007593 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007594 eid,elem_len,left);
7595 return NULL;
7596 }
7597 if (elem_id == eid)
7598 {
7599 return ptr;
7600 }
7601
7602 left -= elem_len;
7603 ptr += (elem_len + (size_of_len_field+1));
7604 }
7605 return NULL;
7606}
7607
7608/* return NULL if oui is not found in ie
7609 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7610 */
7611v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7612{
7613 int left = ie_len;
7614 v_U8_t *ptr = ie;
7615 v_U8_t elem_id, elem_len;
7616
7617 while(left >= 2)
7618 {
7619 elem_id = ptr[0];
7620 elem_len = ptr[1];
7621 left -= 2;
7622 if(elem_len > left)
7623 {
7624 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007625 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007626 elem_id,elem_len,left);
7627 return NULL;
7628 }
7629 if (SIR_MAC_EID_VENDOR == elem_id)
7630 {
7631 if(memcmp(&ptr[2], oui, oui_size)==0)
7632 return ptr;
7633 }
7634
7635 left -= elem_len;
7636 ptr += (elem_len + 2);
7637 }
7638 return NULL;
7639}
7640
Jeff Johnson295189b2012-06-20 16:38:30 -07007641//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7642
7643v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7644{
7645 int length = 0;
7646 tANI_U8 *ptr = ie;
7647
7648 ptr[length++] = SIR_MAC_EID_VENDOR;
7649 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307650 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7651 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7653}
7654
7655//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7656
7657v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7658{
7659 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007660
7661 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7662 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7663 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307664 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007665 noaStream + noaLen - overFlowLen, overFlowLen);
7666 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7667 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307668 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007669 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307670 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7671 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007672 }
7673
Jeff Johnson295189b2012-06-20 16:38:30 -07007674 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7675
7676}
7677
7678//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7679v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7680{
7681 v_U8_t len=0;
7682
7683 v_U8_t *pBody = pNoaStream;
7684
7685
7686 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7687 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7688 {
7689 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7690 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7691 )
7692 return 0; //No NoA Descriptor then return 0
7693
7694
7695 pBody[0] = SIR_P2P_NOA_ATTR;
7696
7697 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7698 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7699 len = 5;
7700 pBody += len;
7701
7702
7703 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7704 {
7705 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7706 pBody += 1;
7707 len +=1;
7708
7709 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7710 pBody += sizeof(tANI_U32);
7711 len +=4;
7712
7713 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7714 pBody += sizeof(tANI_U32);
7715 len +=4;
7716
7717 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7718 pBody += sizeof(tANI_U32);
7719 len +=4;
7720
7721 }
7722
7723 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7724 {
7725 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7726 pBody += 1;
7727 len +=1;
7728
7729 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7730 pBody += sizeof(tANI_U32);
7731 len +=4;
7732
7733 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7734 pBody += sizeof(tANI_U32);
7735 len +=4;
7736
7737 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7738 pBody += sizeof(tANI_U32);
7739 len +=4;
7740
7741 }
7742
7743
7744 pBody = pNoaStream + 1;
7745 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7746
7747 return (len);
7748
7749 }
7750 return 0;
7751
7752}
Jeff Johnsone7245742012-09-05 17:12:55 -07007753
7754void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007755{
7756
7757 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007758 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007759}
Jeff Johnsone7245742012-09-05 17:12:55 -07007760
Jeff Johnson295189b2012-06-20 16:38:30 -07007761/*--------------------------------------------------------------------------
7762
7763 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7764
Jeff Johnsone7245742012-09-05 17:12:55 -07007765 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7766 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007767
7768 \param pMac - pointer to global adapter context
7769 \return - channel to scan from valid session else zero.
7770
7771 \sa
7772
7773 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007774void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007775{
7776
7777 //Rationale - this could be the suspend/resume for assoc and it is essential that
7778 //the new BSS is active for some time. Other BSS was anyway suspended.
7779 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7780 //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 -07007781 //and hence should be ok. Need to discuss this further
7782 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007783 {
7784 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007785 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007786 }
7787 else
7788 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007789 *resumeChannel = pMac->lim.gResumeChannel;
7790 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007791 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007792 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007793}
7794
Viral Modid86bde22012-12-10 13:09:21 -08007795tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7796{
7797 tANI_U8 i;
7798 for(i =0; i < pMac->lim.maxBssId; i++)
7799 {
7800 if(pMac->lim.gpSession[i].valid == TRUE)
7801 {
7802 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7803 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7804 )
7805 {
7806 return TRUE;
7807 }
7808 }
7809 }
7810 return FALSE;
7811}
Jeff Johnsone7245742012-09-05 17:12:55 -07007812
Jeff Johnson295189b2012-06-20 16:38:30 -07007813
7814tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7815{
7816 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7817 {
7818 return eANI_BOOLEAN_TRUE;
7819 }
7820 else
7821 {
7822 return eANI_BOOLEAN_FALSE;
7823 }
7824}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007825
Sandeep Puligilla60342762014-01-30 21:05:37 +05307826/**
7827 * \brief verify the changes in channel bonding
7828 *
7829 * \param pMac Pointer to the global MAC structure
7830 *
7831 * \param psessionEntry session entry
7832 * beaconSecChanWidth Secondary channel width
7833 * advertized in beacon
7834 * currentSecChanWidth Current configured width
7835 * staId Station Id
7836 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7837 */
7838tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7839 tpPESession psessionEntry,
7840 tANI_U8 beaconSecChanWidth,
7841 tANI_U8 currentSecChanWidth,
7842 tANI_U8 staId)
7843{
7844 tUpdateVHTOpMode tempParam;
7845 tANI_BOOLEAN fCbMode24G = FALSE;
7846 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7847
7848 /* Moving from HT40 to HT20 operation*/
7849 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7850 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7851 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7852 {
7853 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7854 tempParam.staId = staId;
7855 fCbMode24G = TRUE;
7856 }
7857
7858 /* Moving from HT20 to HT40 operation*/
7859 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7860 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7861 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7862 {
7863 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7864 tempParam.staId = staId;
7865 fCbMode24G = TRUE;
7866 }
7867
7868 if (TRUE == fCbMode24G)
7869 {
7870 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7871 "Changing CBMODE to = %d staId = %d",
7872 tempParam.opMode, tempParam.staId );
7873 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7874 status = eANI_BOOLEAN_TRUE;
7875 }
7876 return status;
7877}
7878
Mohit Khanna4a70d262012-09-11 16:30:12 -07007879#ifdef WLAN_FEATURE_11AC
7880tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7881{
7882 tUpdateVHTOpMode tempParam;
7883
7884 tempParam.opMode = chanWidth;
7885 tempParam.staId = staId;
7886
7887 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7888
7889 return eANI_BOOLEAN_TRUE;
7890}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007891#endif
7892
krunal soni45b9eb62014-03-26 12:54:25 -07007893void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7894 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007895{
7896 tANI_U8 val=0;
7897
krunal soni45b9eb62014-03-26 12:54:25 -07007898 //only 2.4G band should have short slot enable, rest it should be default
7899 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007900 {
krunal soni45b9eb62014-03-26 12:54:25 -07007901 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007902 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007903 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007904 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7905 {
7906 val = true;
7907 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007908 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007909 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007910 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007911 // Joining BSS.
7912 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007913 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007914 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007915 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007916 // Reassociating with AP.
7917 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007918 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007919 }
krunal soni45b9eb62014-03-26 12:54:25 -07007920 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007921 {
krunal soni45b9eb62014-03-26 12:54:25 -07007922 /*
7923 * 11B does not short slot and short slot is default
7924 * for 11A mode. Hence, not need to set this bit
7925 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007926 val = false;
7927 }
krunal soni45b9eb62014-03-26 12:54:25 -07007928
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007929 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007930 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007931}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307932
Kalikinkar dhara205da782014-03-21 15:49:32 -07007933void limUtilsframeshtons(tpAniSirGlobal pCtx,
7934 tANI_U8 *pOut,
7935 tANI_U16 pIn,
7936 tANI_U8 fMsb)
7937{
7938 (void)pCtx;
7939#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7940 if ( !fMsb )
7941 {
7942 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7943 }
7944 else
7945 {
7946 *pOut = ( pIn & 0xff00 ) >> 8;
7947 *( pOut + 1 ) = pIn & 0xff;
7948 }
7949#else
7950 if ( !fMsb )
7951 {
7952 *pOut = pIn & 0xff;
7953 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7954 }
7955 else
7956 {
7957 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7958 }
7959#endif
7960}
7961
7962void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7963 tANI_U8 *pOut,
7964 tANI_U32 pIn,
7965 tANI_U8 fMsb)
7966{
7967 (void)pCtx;
7968#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7969 if ( !fMsb )
7970 {
7971 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7972 }
7973 else
7974 {
7975 *pOut = ( pIn & 0xff000000 ) >> 24;
7976 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7977 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7978 *( pOut + 3 ) = ( pIn & 0x000000ff );
7979 }
7980#else
7981 if ( !fMsb )
7982 {
7983 *( pOut ) = ( pIn & 0x000000ff );
7984 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7985 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7986 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7987 }
7988 else
7989 {
7990 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7991 }
7992#endif
7993}
7994
7995
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307996/**--------------------------------------------
7997\fn limUpdateOBSSScanParams
7998\brief Updates OBSS SCAN IE parameters to session
7999
8000\param psessionEntry - Session Entry
8001\return NONE
8002---------------------------------------------*/
8003void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8004 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8005{
8006 /*If the recieved value is not in the range specified by the Specification
8007 then it will be the default value configured through cfg */
8008 if (( pOBSSScanParameters->obssScanActiveDwell >
8009 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8010 ( pOBSSScanParameters->obssScanActiveDwell <
8011 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8012 {
8013 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8014 pOBSSScanParameters->obssScanActiveDwell;
8015 }
8016 if((pOBSSScanParameters->obssScanPassiveDwell >
8017 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8018 (pOBSSScanParameters->obssScanPassiveDwell <
8019 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8020 {
8021 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8022 pOBSSScanParameters->obssScanPassiveDwell;
8023 }
8024 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8025 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8026 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8027 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8028 {
8029 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8030 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8031 }
8032 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8033 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8034 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8035 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8036 {
8037 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8038 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8039 }
8040 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8041 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8042 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8043 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8044 {
8045 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8046 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8047 }
8048 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8049 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8050 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8051 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8052 {
8053 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8054 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8055 }
8056 if((pOBSSScanParameters->obssScanActivityThreshold >
8057 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8058 (pOBSSScanParameters->obssScanActivityThreshold <
8059 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8060 {
8061 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8062 pOBSSScanParameters->obssScanActivityThreshold;
8063 }
8064}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008065
8066#ifdef WLAN_FEATURE_11W
8067void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8068{
8069 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8070 tPmfSaQueryTimerId timerId;
8071 tpPESession psessionEntry;
8072 tpDphHashNode pSta;
8073 tANI_U32 maxRetries;
8074
8075 limLog(pMac, LOG1, FL("SA Query timer fires"));
8076 timerId.value = param;
8077
8078 // Check that SA Query is in progress
8079 if ((psessionEntry = peFindSessionBySessionId(
8080 pMac, timerId.fields.sessionId)) == NULL)
8081 {
8082 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8083 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008084 return;
8085 }
8086 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8087 &psessionEntry->dph.dphHashTable)) == NULL)
8088 {
8089 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8090 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008091 return;
8092 }
8093 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8094 return;
8095
8096 // Increment the retry count, check if reached maximum
8097 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8098 &maxRetries) != eSIR_SUCCESS)
8099 {
8100 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8101 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8102 return;
8103 }
8104 pSta->pmfSaQueryRetryCount++;
8105 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8106 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308107 limLog(pMac, LOGE,
8108 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8109 MAC_ADDR_ARRAY(pSta->staAddr));
8110 limSendDisassocMgmtFrame(pMac,
8111 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8112 pSta->staAddr, psessionEntry, FALSE);
8113 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008114 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8115 return;
8116 }
8117
8118 // Retry SA Query
8119 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8120 pSta->staAddr, psessionEntry);
8121 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008122 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8123 {
8124 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8125 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8126 }
8127}
8128#endif
8129
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008130/** ---------------------------------------------------------
8131\fn limProcessChannelSwitchSuspendLink
8132\brief This function call channel switch functions based on
8133 the gLimChannelSwitch.state. After function return it
8134 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8135 If gLimChannelSwitch.state is non-identified then
8136 print error log as well as restore back the
8137 pre-channelSwitch.
8138\param tpAniSirGlobal pMac
8139\param eHalStatus status
8140\param tANI_U32 *ctx
8141\return None
8142 ------------------------------------------------------------*/
8143static void
8144limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8145 eHalStatus status,
8146 tANI_U32 *ctx)
8147{
8148 tpPESession pSessionEntry = (tpPESession)ctx;
8149
8150 if ( eHAL_STATUS_SUCCESS != status )
8151 {
8152 limLog(pMac, LOGE,
8153 FL("Suspend link failed. still proceeding "));
8154 }
8155 if (NULL == pSessionEntry )
8156 {
8157 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8158 return;
8159 }
8160
8161 switch(pSessionEntry->gLimChannelSwitch.state)
8162 {
8163 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8164 PELOGW(limLog(pMac, LOGW,
8165 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8166 limSwitchPrimaryChannel(pMac,
8167 pSessionEntry->gLimChannelSwitch.primaryChannel,
8168 pSessionEntry);
8169 pSessionEntry->gLimChannelSwitch.state =
8170 eLIM_CHANNEL_SWITCH_IDLE;
8171 break;
8172
8173 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8174 PELOGW(limLog(pMac, LOGW,
8175 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8176 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8177 pSessionEntry->gLimChannelSwitch.primaryChannel,
8178 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8179 pSessionEntry->gLimChannelSwitch.state =
8180 eLIM_CHANNEL_SWITCH_IDLE;
8181 break;
8182
8183 default:
8184 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8185 pSessionEntry->gLimChannelSwitch.state);)
8186 if (limRestorePreChannelSwitchState(pMac,
8187 pSessionEntry) != eSIR_SUCCESS)
8188 {
8189 limLog(pMac, LOGE,
8190 FL("Could not restore pre-channelSwitch "
8191 "(11h) state, resetting the system"));
8192 }
8193 }
8194}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308195
8196/** ---------------------------------------------------------
8197\fn limInitOBSSScanParams
8198\brief This function Initializes the OBSS Scan Parameters
8199\param tpAniSirGlobal pMac
8200\param tpPESession pSessionEntry
8201\return None
8202 ------------------------------------------------------------*/
8203
8204void limInitOBSSScanParams(tpAniSirGlobal pMac,
8205 tpPESession psessionEntry)
8206{
8207 tANI_U32 cfgValue;
8208
8209 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8210 &cfgValue) != eSIR_SUCCESS)
8211 {
8212 limLog(pMac, LOGE, FL("Fail to retrieve "
8213 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8214 return ;
8215 }
8216 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8217
8218 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8219 &cfgValue) != eSIR_SUCCESS)
8220 {
8221 limLog(pMac, LOGE, FL("Fail to retrieve "
8222 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8223 return ;
8224 }
8225 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8226
8227 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8228 &cfgValue) != eSIR_SUCCESS)
8229 {
8230 limLog(pMac, LOGE, FL("Fail to retrieve "
8231 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8232 return ;
8233 }
8234 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8235 = cfgValue;
8236 if (wlan_cfgGetInt(pMac,
8237 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8238 &cfgValue) != eSIR_SUCCESS)
8239 {
8240 limLog(pMac, LOGE, FL("Fail to retrieve"
8241 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8242 return ;
8243 }
8244 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8245 cfgValue;
8246 if (wlan_cfgGetInt(pMac,
8247 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8248 != eSIR_SUCCESS)
8249 {
8250 limLog(pMac, LOGE, FL("Fail to retrieve"
8251 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8252 return ;
8253 }
8254 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8255 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308256
8257 if (wlan_cfgGetInt(pMac,
8258 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8259 != eSIR_SUCCESS)
8260 {
8261 limLog(pMac, LOGE, FL("Fail to retrieve"
8262 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8263 return ;
8264 }
8265 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8266 cfgValue;
8267
8268
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308269 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8270 &cfgValue) != eSIR_SUCCESS)
8271 {
8272 limLog(pMac, LOGE, FL("Fail to retrieve "
8273 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8274 return ;
8275 }
8276 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308277}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308278
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308279const char * lim_ScanTypetoString(const v_U8_t scanType)
8280{
8281 switch (scanType)
8282 {
8283 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8284 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8285 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8286 default:
8287 return "Unknown ScanType";
8288 }
8289}
8290
8291const char * lim_BssTypetoString(const v_U8_t bssType)
8292{
8293 switch (bssType)
8294 {
8295 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8296 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8297 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8298 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8299 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8300 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8301 default:
8302 return "Unknown BssType";
8303 }
8304}
8305
8306const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8307{
8308 switch (mode)
8309 {
8310 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8311 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8312 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8313 default:
8314 return "Unknown BgScanMode";
8315 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308316}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308317
8318#ifdef WLAN_FEATURE_11W
8319/**
8320 *
8321 * \brief This function is called by various LIM modules to correctly set
8322 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8323 *
8324 *
8325 * \param pMac Pointer to Global MAC structure
8326 *
8327 * \param psessionEntry Pointer to session corresponding to the connection
8328 *
8329 * \param peer Peer address of the STA to which the frame is to be sent
8330 *
8331 * \param pMacHdr Pointer to the frame MAC header
8332 *
8333 * \return nothing
8334 *
8335 *
8336 */
8337void
8338limSetProtectedBit(tpAniSirGlobal pMac,
8339 tpPESession psessionEntry,
8340 tSirMacAddr peer,
8341 tpSirMacMgmtHdr pMacHdr)
8342{
8343 tANI_U16 aid;
8344 tpDphHashNode pStaDs;
8345
8346 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8347 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8348 {
8349
8350 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8351 &psessionEntry->dph.dphHashTable );
8352 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308353 /* rmfenabled will be set at the time of addbss.
8354 * but sometimes EAP auth fails and keys are not
8355 * installed then if we send any management frame
8356 * like deauth/disassoc with this bit set then
8357 * firmware crashes. so check for keys are
8358 * installed or not also before setting the bit
8359 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308360 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308361 pMacHdr->fc.wep = 1;
8362 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308363 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308364 pMacHdr->fc.wep = 1;
8365} /*** end limSetProtectedBit() ***/
8366#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308367
8368tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8369{
8370 int left = length;
8371 tANI_U8 *ptr = pIes;
8372 tANI_U8 elem_id,elem_len;
8373
8374 while (left >= 2)
8375 {
8376 elem_id = ptr[0];
8377 elem_len = ptr[1];
8378 left -= 2;
8379
8380 if (elem_len > left)
8381 {
8382 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8383 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8384 eid,elem_len,left);
8385 return NULL;
8386 }
8387 if (elem_id == eid)
8388 {
8389 return ptr;
8390 }
8391
8392 left -= elem_len;
8393 ptr += (elem_len + 2);
8394 }
8395 return NULL;
8396}
8397
8398
8399void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8400{
8401
8402 tANI_U32 nPayload;
8403 tANI_U8 *pPayload;
8404 tANI_U8 *ieptr;
8405 tSirMacTim *tim;
8406
8407 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8408 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8409
8410 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8411 {
8412 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8413 return;
8414 }
8415
8416 if (NULL !=
8417 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8418 nPayload, SIR_MAC_TIM_EID)))
8419 {
8420 /* Ignore EID and Length field*/
8421 tim = (tSirMacTim *)(ieptr + 2);
8422
8423 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8424 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8425 if (tim->dtimCount >= MAX_DTIM_COUNT)
8426 tim->dtimCount = DTIM_COUNT_DEFAULT;
8427 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8428 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8429 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8430 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8431 psessionEntry->currentBssBeaconCnt++;
8432
8433 limLog(pMac, LOG1,
8434 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8435 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8436 psessionEntry->lastBeaconDtimPeriod);
8437
8438 }
8439 return;
8440}
Girish Gowlia95daca2015-02-04 20:31:31 +05308441
8442void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8443 tANI_U8 smeSessionId,
8444 tANI_U32 maxRateFlag)
8445{
8446 tpSirSmeUpdateMaxRateParams pRsp;
8447 tSirMsgQ msg;
8448
8449 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8450 if (NULL == pRsp)
8451 {
8452 limLog(pMac, LOGP, FL("Memory allocation failed"));
8453 return;
8454 }
8455 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8456 pRsp->maxRateFlag = maxRateFlag;
8457 pRsp->smeSessionId = smeSessionId;
8458 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8459 msg.bodyptr = pRsp;
8460 msg.bodyval = 0;
8461 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8462 return;
8463}
Abhishek Singh5d765712015-03-12 14:04:16 +05308464
8465void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8466{
8467 if( pMac->sys.gSysBbtPendingMgmtCount )
8468 {
8469 vos_spin_lock_acquire( &pMac->sys.lock );
8470 pMac->sys.gSysBbtPendingMgmtCount--;
8471 vos_spin_lock_release( &pMac->sys.lock );
8472 }
8473 else
8474 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8475}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308476
8477eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8478{
8479 tpSirTxBdStatus pTxBdStatus;
8480
8481 if (!pData)
8482 {
8483 limLog(pMac, LOGE, FL("pData is NULL"));
8484 return eHAL_STATUS_FAILURE;
8485 }
8486
8487 pTxBdStatus = (tpSirTxBdStatus) pData;
8488
8489 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8490 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8491 return eHAL_STATUS_SUCCESS;
8492}