blob: 62905ede4d9d788577857313080fa6cb564e3b77 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05302 * Copyright (c) 2011-2016. 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
Abhishek Singh6f09e702016-01-28 15:15:04 +0530167 /* if the list is empty */
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 if(NULL == pCurrNode)
169 return eSIR_FAILURE;
170
Abhishek Singh6f09e702016-01-28 15:15:04 +0530171 /* If the matching node is the first node.*/
172 if ((token == pCurrNode->token) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 (assocId == pCurrNode->assocId) &&
Abhishek Singh6f09e702016-01-28 15:15:04 +0530174 (tid == pCurrNode->tid)) {
175 pMac->lim.pDialogueTokenHead = pCurrNode->next;
176 /* There was only one node in the list.
177 * So tail pointer also needs to be adjusted.
178 */
179 if (NULL == pMac->lim.pDialogueTokenHead)
Jeff Johnson295189b2012-06-20 16:38:30 -0700180 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530181 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 return eSIR_SUCCESS;
183 }
184
Abhishek Singh6f09e702016-01-28 15:15:04 +0530185 /* first node did not match. so move to the next one. */
Jeff Johnson295189b2012-06-20 16:38:30 -0700186 pCurrNode = pCurrNode->next;
Jeff Johnson295189b2012-06-20 16:38:30 -0700187
Abhishek Singh6f09e702016-01-28 15:15:04 +0530188 while (NULL != pCurrNode) {
189 if ((token == pCurrNode->token) &&
190 (assocId == pCurrNode->assocId) &&
191 (tid == pCurrNode->tid)) {
192 break;
193 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 pPrevNode = pCurrNode;
195 pCurrNode = pCurrNode->next;
196 }
197
Abhishek Singh6f09e702016-01-28 15:15:04 +0530198 if (pCurrNode) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700199 pPrevNode->next = pCurrNode->next;
Abhishek Singh6f09e702016-01-28 15:15:04 +0530200 /* if the node being deleted is the last one
201 * then we also need to move the tail pointer
202 * to the prevNode.
203 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700204 if(NULL == pCurrNode->next)
205 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530206 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 return eSIR_SUCCESS;
208 }
209
Abhishek Singh6f09e702016-01-28 15:15:04 +0530210 limLog(pMac, LOGW,
211 FL("LIM does not have matching dialogue token node"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700213}
214
215
216/** -------------------------------------------------------------
217\fn limDeleteDialogueTokenList
218\brief deletes the complete lim dialogue token linked list.
219\param tpAniSirGlobal pMac
220\return None
221 -------------------------------------------------------------*/
222void
223limDeleteDialogueTokenList(tpAniSirGlobal pMac)
224{
225 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
226
227 while(NULL != pMac->lim.pDialogueTokenHead)
228 {
229 pCurrNode = pMac->lim.pDialogueTokenHead;
230 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530231 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 pCurrNode = NULL;
233 }
234 pMac->lim.pDialogueTokenTail = NULL;
235}
236
237void
238limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
239{
240 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
241 *pIgnore = 0;
242
243 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
244 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530245 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700246 *pIgnore = 1;
247 }
248 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
249 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530250 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 *pIgnore = 1;
252 }
253 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
254 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530255 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 *pIgnore = 0;
257 }
258 else
259 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530260 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 *pIgnore = 1;
262 }
263}
264
265char *
266limMlmStateStr(tLimMlmStates state)
267{
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 switch (state)
269 {
270 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700271 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700273 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700275 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700279 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700281 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700283 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700285 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700287 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700289 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700291 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700295 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
299 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
300 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700301 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700303 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700305 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700307 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700309 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700311 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700313 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700315 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700317 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
319 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
320 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700321 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700323 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700325 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700327 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700329}
330
331void
332limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
333{
334 limLog(pMac, logLevel, limMlmStateStr(state));
335}
336
337char *
338limSmeStateStr(tLimSmeStates state)
339{
340#ifdef FIXME_GEN6
341 switch (state)
342 {
343 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700344 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700348 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700352 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700354 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700356 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700358 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700360 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700362 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700366 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700368 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700370 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700372 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700374 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700376 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700378 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700380 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700382 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700384 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700386 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700388 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 }
390#endif
391return "";
392}
393
394
395char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
396{
397#ifdef FIXME_GEN6
398
399 switch(dot11Mode)
400 {
401 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700402 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700404 return "11A";
405 case WNI_CFG_DOT11_MODE_11B:
406 return "11B";
407 case WNI_CFG_DOT11_MODE_11G:
408 return "11G";
409 case WNI_CFG_DOT11_MODE_11N:
410 return "11N";
411 case WNI_CFG_DOT11_MODE_POLARIS:
412 return "Polaris";
413 case WNI_CFG_DOT11_MODE_TITAN:
414 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700416 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700418 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 }
420#endif
421return "";
422}
423
424
425char* limStaOpRateModeStr(tStaRateMode opRateMode)
426{
427#ifdef FIXME_GEN6
428
429 switch(opRateMode)
430 {
431 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700432 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700434 return "11A";
435 case eSTA_11b:
436 return "11B";
437 case eSTA_11bg:
438 return "11G";
439 case eSTA_11n:
440 return "11N";
441 case eSTA_POLARIS:
442 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700444 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700446 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 }
448#endif
449return "";
450}
451
452char* limBssTypeStr(tSirBssType bssType)
453{
454 switch(bssType)
455 {
456 case eSIR_INFRASTRUCTURE_MODE:
457 return "eSIR_INFRASTRUCTURE_MODE";
458 case eSIR_IBSS_MODE:
459 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700460 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700462 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700464 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 return "eSIR_AUTO_MODE";
466 default:
467 return "Invalid BSS Type";
468 }
469}
470
471void
472limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
473{
474 limLog(pMac, logLevel, limSmeStateStr(state));
475}
476
477char *limMsgStr(tANI_U32 msgType)
478{
479#ifdef FIXME_GEN6
480 switch (msgType)
481 {
482 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700483 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700485 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700487 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700490#ifdef FEATURE_OEM_DATA_SUPPORT
491 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700493 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700495#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700497 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700499 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700501 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700503 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700505 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700507 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700509 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700511 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700513 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700515 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700519 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700521 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700523 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700525 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700527 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700529 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700533 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700535 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700537 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700539 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700541 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700543 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700545 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700549 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700551 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700553 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700555 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700557 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700559 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700561 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700563 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700565 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700567 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700569 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700571 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700573 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700575 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700577 return "eWNI_SME_MIC_FAILURE_IND";
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530578 case eWNI_SME_LOST_LINK_PARAMS_IND:
579 return "eWNI_SME_LOST_LINK_PARAMS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700581 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700583 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800594#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800595 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800597 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800599#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700602 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700604 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700608 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700610 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700612 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700614 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700616 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700618 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700620 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700622 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700624 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700628 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700632 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643#ifdef WLAN_FEATURE_VOWIFI_11R
644 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700645 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700646#endif
647
648 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700649 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700651 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666
667 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700668 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700670 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700672 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700674 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700676 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700680 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700686 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700690 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700692 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700694 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700696 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700698 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700700 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700704 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700706 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700708 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800709 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700710 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800711#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700712 case eWNI_SME_GET_TSM_STATS_REQ:
713 return "eWNI_SME_GET_TSM_STATS_REQ";
714 case eWNI_SME_GET_TSM_STATS_RSP:
715 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800716#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 }
720#endif
721return "";
722}
723
724
725
726char *limResultCodeStr(tSirResultCodes resultCode)
727{
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 switch (resultCode)
729 {
730 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700731 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700733 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700735 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700739 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700827 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700833 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700837 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700851 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856#ifdef GEN4_SCAN
857 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700858 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700860 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700862 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700864 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700866 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700868 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700869#else // GEN4_SCAN
870 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700871 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700873 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700874#endif // GEN4_SCAN
875
876 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700877 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700879}
880
881void
882limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
883{
884 limLog(pMac, logLevel, limMsgStr(msgType));
885}
886
Jeff Johnson295189b2012-06-20 16:38:30 -0700887void
888limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
889{
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
891 {
892 switch (msg->type)
893 {
894 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 break;
897 default:
898 limPrintMsgName(pMac, logLevel,msg->type);
899 break;
900 }
901 }
902}
903
904/**
905 * limInitMlm()
906 *
907 *FUNCTION:
908 * This function is called by limProcessSmeMessages() to
909 * initialize MLM state machine on STA
910 *
911 *PARAMS:
912 *
913 *LOGIC:
914 *
915 *ASSUMPTIONS:
916 * NA
917 *
918 *NOTE:
919 * NA
920 *
921 * @param pMac Pointer to Global MAC structure
922 * @return None
923 */
924void
925limInitMlm(tpAniSirGlobal pMac)
926{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700927 tANI_U32 retVal;
928
929 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700930
Jeff Johnsone7245742012-09-05 17:12:55 -0700931 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700932
933 /// Initialize scan result hash table
934 limReInitScanResults(pMac); //sep26th review
935
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700936#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
937 /// Initialize lfr scan result hash table
938 // Could there be a problem in multisession with SAP/P2P GO, when in the
939 // middle of FW bg scan, SAP started; Again that could be a problem even on
940 // infra + SAP/P2P GO too - TBD
941 limReInitLfrScanResults(pMac);
942#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700943
944 /// Initialize number of pre-auth contexts
945 pMac->lim.gLimNumPreAuthContexts = 0;
946
947 /// Initialize MAC based Authentication STA list
948 limInitPreAuthList(pMac);
949
950 //pMac->lim.gpLimMlmJoinReq = NULL;
951
952 if (pMac->lim.gLimTimersCreated)
953 return;
954
955 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700956 retVal = limCreateTimers(pMac);
957 if(retVal == TX_SUCCESS)
958 {
959 pMac->lim.gLimTimersCreated = 1;
960 }
961 else
962 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700963 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700964 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700965} /*** end limInitMlm() ***/
966
967
968
969/**
970 * limCleanupMlm()
971 *
972 *FUNCTION:
973 * This function is called to cleanup any resources
974 * allocated by the MLM state machine.
975 *
976 *PARAMS:
977 *
978 *LOGIC:
979 *
980 *ASSUMPTIONS:
981 * NA
982 *
983 *NOTE:
984 * It is assumed that BSS is already informed that we're leaving it
985 * before this function is called.
986 *
987 * @param pMac Pointer to Global MAC structure
988 * @param None
989 * @return None
990 */
991void
992limCleanupMlm(tpAniSirGlobal pMac)
993{
994 tANI_U32 n;
995 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530996#ifdef WLAN_FEATURE_11W
997 tANI_U32 bss_entry, sta_entry;
998 tpDphHashNode pStaDs = NULL;
999 tpPESession psessionEntry = NULL;
1000#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002 if (pMac->lim.gLimTimersCreated == 1)
1003 {
1004 // Deactivate and delete MIN/MAX channel timers.
1005 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1006 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1007 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1008 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1009 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1010 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1011
1012
1013 // Deactivate and delete channel switch timer.
1014 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1015 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1016
1017
1018 // Deactivate and delete addts response timer.
1019 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1020 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1021
1022 // Deactivate and delete Join failure timer.
1023 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1024 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1025
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001026 // Deactivate and delete Periodic Join Probe Request timer.
1027 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1028 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1029
Sushant Kaushik9e923872015-04-02 17:09:31 +05301030 // Deactivate and delete Auth Retry timer.
1031 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1032 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1033
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 // Deactivate and delete Association failure timer.
1035 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1036 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1037
1038 // Deactivate and delete Reassociation failure timer.
1039 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1040 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1041
1042 // Deactivate and delete Authentication failure timer.
1043 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1044 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1045
1046 // Deactivate and delete Heartbeat timer.
1047 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1048 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1049
1050 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1051 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1052 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1053
1054 // Deactivate and delete Quiet timer.
1055 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1056 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1057
1058 // Deactivate and delete Quiet BSS timer.
1059 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1060 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1061
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 // Deactivate and delete LIM background scan timer.
1063 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1064 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001065
1066
1067 // Deactivate and delete cnf wait timer
1068 for (n = 0; n < pMac->lim.maxStation; n++)
1069 {
1070 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1071 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1072 }
1073
1074 // Deactivate and delete keepalive timer
1075 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1076 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1077
1078 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1079
1080 //Deactivate any Authentication response timers
1081 limDeletePreAuthList(pMac);
1082
1083 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1084 {
1085 // Delete any Authentication response
1086 // timers, which might have been started.
1087 tx_timer_delete(&pAuthNode->timer);
1088 }
1089
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1091 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1092 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1093 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1094
1095#if 0 // The WPS PBC clean up timer is disabled
1096 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1097 {
1098 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1099 {
1100 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1101 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1102 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1103 }
1104 }
1105#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001106#ifdef WLAN_FEATURE_VOWIFI_11R
1107 // Deactivate and delete FT Preauth response timer
1108 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1109 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1110#endif
1111
Jeff Johnson295189b2012-06-20 16:38:30 -07001112
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001113#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001115 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1116 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1117#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001118
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001119 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1120 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1121
1122 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1123 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1124
Hoonki Leef63df0d2013-01-16 19:29:14 -08001125 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1126 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001127
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301128 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1129 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1130
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 pMac->lim.gLimTimersCreated = 0;
1132 }
1133
Agarwal Ashish888ca022014-11-05 14:25:56 +05301134#ifdef WLAN_FEATURE_11W
1135 /*
1136 * When SSR is triggered, we need to loop through
1137 * each STA associated per BSSId and deactivate/delete
1138 * the pmfSaQueryTimer for it
1139 */
1140 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1141 {
1142 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1143 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1144 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1145 {
1146 if (pMac->lim.gpSession[bss_entry].valid)
1147 {
1148 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1149 sta_entry++)
1150 {
1151 psessionEntry = &pMac->lim.gpSession[bss_entry];
1152 pStaDs = dphGetHashEntry(pMac, sta_entry,
1153 &psessionEntry->dph.dphHashTable);
1154 if (NULL == pStaDs)
1155 {
1156 continue;
1157 }
1158 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1159 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1160 pStaDs->staIndex) ;
1161 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1162 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1163 }
1164 }
1165 }
1166 }
1167#endif
1168
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 /// Cleanup cached scan list
1170 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001171#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1172 /// Cleanup cached scan list
1173 limReInitLfrScanResults(pMac);
1174#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001175
1176} /*** end limCleanupMlm() ***/
1177
1178
1179
1180/**
1181 * limCleanupLmm()
1182 *
1183 *FUNCTION:
1184 * This function is called to cleanup any resources
1185 * allocated by LMM sub-module.
1186 *
1187 *PARAMS:
1188 *
1189 *LOGIC:
1190 *
1191 *ASSUMPTIONS:
1192 * NA
1193 *
1194 *NOTE:
1195 * NA
1196 *
1197 * @param pMac Pointer to Global MAC structure
1198 * @return None
1199 */
1200
1201void
1202limCleanupLmm(tpAniSirGlobal pMac)
1203{
Jeff Johnson295189b2012-06-20 16:38:30 -07001204} /*** end limCleanupLmm() ***/
1205
1206
1207
1208/**
1209 * limIsAddrBC()
1210 *
1211 *FUNCTION:
1212 * This function is called in various places within LIM code
1213 * to determine whether passed MAC address is a broadcast or not
1214 *
1215 *LOGIC:
1216 *
1217 *ASSUMPTIONS:
1218 * NA
1219 *
1220 *NOTE:
1221 * NA
1222 *
1223 * @param macAddr Indicates MAC address that need to be determined
1224 * whether it is Broadcast address or not
1225 *
1226 * @return true if passed address is Broadcast address else false
1227 */
1228
1229tANI_U8
1230limIsAddrBC(tSirMacAddr macAddr)
1231{
1232 int i;
1233 for (i = 0; i < 6; i++)
1234 {
1235 if ((macAddr[i] & 0xFF) != 0xFF)
1236 return false;
1237 }
1238
1239 return true;
1240} /****** end limIsAddrBC() ******/
1241
1242
1243
1244/**
1245 * limIsGroupAddr()
1246 *
1247 *FUNCTION:
1248 * This function is called in various places within LIM code
1249 * to determine whether passed MAC address is a group address or not
1250 *
1251 *LOGIC:
1252 * If least significant bit of first octet of the MAC address is
1253 * set to 1, it is a Group address.
1254 *
1255 *ASSUMPTIONS:
1256 * NA
1257 *
1258 *NOTE:
1259 * NA
1260 *
1261 * @param macAddr Indicates MAC address that need to be determined
1262 * whether it is Group address or not
1263 *
1264 * @return true if passed address is Group address else false
1265 */
1266
1267tANI_U8
1268limIsGroupAddr(tSirMacAddr macAddr)
1269{
1270 if ((macAddr[0] & 0x01) == 0x01)
1271 return true;
1272 else
1273 return false;
1274} /****** end limIsGroupAddr() ******/
1275
1276/**
1277 * limPostMsgApiNoWait()
1278 *
1279 *FUNCTION:
1280 * This function is called from other thread while posting a
1281 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1282 *
1283 *LOGIC:
1284 * NA
1285 *
1286 *ASSUMPTIONS:
1287 * NA
1288 *
1289 *NOTE:
1290 * NA
1291 *
1292 * @param pMsg - Pointer to the Global MAC structure
1293 * @param pMsg - Pointer to the message structure
1294 * @return None
1295 */
1296
1297tANI_U32
1298limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1299{
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 limProcessMessages(pMac, pMsg);
1301 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001302} /*** end limPostMsgApiNoWait() ***/
1303
1304
1305
1306/**
1307 * limPrintMacAddr()
1308 *
1309 *FUNCTION:
1310 * This function is called to print passed MAC address
1311 * in : format.
1312 *
1313 *LOGIC:
1314 *
1315 *ASSUMPTIONS:
1316 * NA
1317 *
1318 *NOTE:
1319 * @param macAddr - MacAddr to be printed
1320 * @param logLevel - Loglevel to be used
1321 *
1322 * @return None.
1323 */
1324
1325void
1326limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1327{
1328 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001329 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001330} /****** end limPrintMacAddr() ******/
1331
1332
Jeff Johnson295189b2012-06-20 16:38:30 -07001333/*
1334 * limResetDeferredMsgQ()
1335 *
1336 *FUNCTION:
1337 * This function resets the deferred message queue parameters.
1338 *
1339 *PARAMS:
1340 * @param pMac - Pointer to Global MAC structure
1341 *
1342 *LOGIC:
1343 *
1344 *ASSUMPTIONS:
1345 * NA
1346 *
1347 *NOTE:
1348 * NA
1349 *
1350 *RETURNS:
1351 * None
1352 */
1353
1354void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1355{
1356 pMac->lim.gLimDeferredMsgQ.size =
1357 pMac->lim.gLimDeferredMsgQ.write =
1358 pMac->lim.gLimDeferredMsgQ.read = 0;
1359
1360}
1361
1362
1363#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1364#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1365
1366/*
1367 * limWriteDeferredMsgQ()
1368 *
1369 *FUNCTION:
1370 * This function queues up a deferred message for later processing on the
1371 * STA side.
1372 *
1373 *PARAMS:
1374 * @param pMac - Pointer to Global MAC structure
1375 * @param limMsg - a LIM message
1376 *
1377 *LOGIC:
1378 *
1379 *ASSUMPTIONS:
1380 * NA
1381 *
1382 *NOTE:
1383 * NA
1384 *
1385 *RETURNS:
1386 * None
1387 */
1388
1389tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1390{
1391 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001392 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1394 limMsg->type);)
1395
1396 /*
1397 ** check if the deferred message queue is full
1398 **/
1399 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1400 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301401 if (!(pMac->lim.deferredMsgCnt & 0xF))
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001402 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301403 limLog(pMac, LOGE,
1404 FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
1405 limMsg->type, ++pMac->lim.deferredMsgCnt);
1406 vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
1407 WLAN_LOG_INDICATOR_HOST_DRIVER,
1408 WLAN_LOG_REASON_QUEUE_FULL,
1409 FALSE, TRUE);
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001410 }
1411 else
1412 {
1413 pMac->lim.deferredMsgCnt++;
1414 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 return TX_QUEUE_FULL;
1416 }
1417
1418 /*
1419 ** In the application, there should not be more than 1 message get
1420 ** queued up. If happens, flags a warning. In the future, this can
1421 ** happen.
1422 **/
1423 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1424 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001425 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 -07001426 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1427 limIsSystemInScanState(pMac),
1428 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1429 pMac->lim.gLimAddtsSent);)
1430 }
1431
1432 /*
1433 ** To prevent the deferred Q is full of management frames, only give them certain space
1434 **/
1435 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1436 {
1437 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1438 {
1439 tANI_U16 idx, count = 0;
1440 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1441 {
1442 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1443 {
1444 count++;
1445 }
1446 }
1447 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1448 {
1449 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001450 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 //Return error, caller knows what to do
1452 return TX_QUEUE_FULL;
1453 }
1454 }
1455 }
1456
1457 ++pMac->lim.gLimDeferredMsgQ.size;
1458
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001459 /* reset the count here since we are able to defer the message */
1460 if(pMac->lim.deferredMsgCnt != 0)
1461 {
1462 pMac->lim.deferredMsgCnt = 0;
1463 }
1464
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 /*
1466 ** if the write pointer hits the end of the queue, rewind it
1467 **/
1468 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1469 pMac->lim.gLimDeferredMsgQ.write = 0;
1470
1471 /*
1472 ** save the message to the queue and advanced the write pointer
1473 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301474 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1475 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 (tANI_U8 *)limMsg,
1477 sizeof(tSirMsgQ));
1478 return TX_SUCCESS;
1479
1480}
1481
1482/*
1483 * limReadDeferredMsgQ()
1484 *
1485 *FUNCTION:
1486 * This function dequeues a deferred message for processing on the
1487 * STA side.
1488 *
1489 *PARAMS:
1490 * @param pMac - Pointer to Global MAC structure
1491 *
1492 *LOGIC:
1493 *
1494 *ASSUMPTIONS:
1495 * NA
1496 *
1497 *NOTE:
1498 *
1499 *
1500 *RETURNS:
1501 * Returns the message at the head of the deferred message queue
1502 */
1503
1504tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1505{
1506 tSirMsgQ *msg;
1507
1508 /*
1509 ** check any messages left. If no, return
1510 **/
1511 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1512 return NULL;
1513
1514 /*
1515 ** decrement the queue size
1516 **/
1517 pMac->lim.gLimDeferredMsgQ.size--;
1518
1519 /*
1520 ** retrieve the message from the head of the queue
1521 **/
1522 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1523
1524 /*
1525 ** advance the read pointer
1526 **/
1527 pMac->lim.gLimDeferredMsgQ.read++;
1528
1529 /*
1530 ** if the read pointer hits the end of the queue, rewind it
1531 **/
1532 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1533 pMac->lim.gLimDeferredMsgQ.read = 0;
1534
1535 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001536 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1538 msg->type);)
1539
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001540 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 limIsSystemInScanState(pMac),
1542 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1543 pMac->lim.gLimAddtsSent);)
1544
1545 return(msg);
1546}
1547
1548tSirRetStatus
1549limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1550 tSirMsgQ *pMsg,
1551 tANI_U8 qType)
1552{
1553// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 SysProcessMmhMsg(pMac, pMsg);
1555 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001556}
1557
1558char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1559{
1560#ifdef FIXME_GEN6
1561
1562 if (type == SIR_MAC_MGMT_FRAME)
1563 {
1564 switch (subType)
1565 {
1566 case SIR_MAC_MGMT_ASSOC_REQ:
1567 return "MAC_MGMT_ASSOC_REQ";
1568 case SIR_MAC_MGMT_ASSOC_RSP:
1569 return "MAC_MGMT_ASSOC_RSP";
1570 case SIR_MAC_MGMT_REASSOC_REQ:
1571 return "MAC_MGMT_REASSOC_REQ";
1572 case SIR_MAC_MGMT_REASSOC_RSP:
1573 return "MAC_MGMT_REASSOC_RSP";
1574 case SIR_MAC_MGMT_PROBE_REQ:
1575 return "MAC_MGMT_PROBE_REQ";
1576 case SIR_MAC_MGMT_PROBE_RSP:
1577 return "MAC_MGMT_PROBE_RSP";
1578 case SIR_MAC_MGMT_BEACON:
1579 return "MAC_MGMT_BEACON";
1580 case SIR_MAC_MGMT_ATIM:
1581 return "MAC_MGMT_ATIM";
1582 case SIR_MAC_MGMT_DISASSOC:
1583 return "MAC_MGMT_DISASSOC";
1584 case SIR_MAC_MGMT_AUTH:
1585 return "MAC_MGMT_AUTH";
1586 case SIR_MAC_MGMT_DEAUTH:
1587 return "MAC_MGMT_DEAUTH";
1588 case SIR_MAC_MGMT_ACTION:
1589 return "MAC_MGMT_ACTION";
1590 case SIR_MAC_MGMT_RESERVED15:
1591 return "MAC_MGMT_RESERVED15";
1592 default:
1593 return "Unknown MGMT Frame";
1594 }
1595 }
1596
1597 else if (type == SIR_MAC_CTRL_FRAME)
1598 {
1599 switch (subType)
1600 {
1601 case SIR_MAC_CTRL_RR:
1602 return "MAC_CTRL_RR";
1603 case SIR_MAC_CTRL_BAR:
1604 return "MAC_CTRL_BAR";
1605 case SIR_MAC_CTRL_BA:
1606 return "MAC_CTRL_BA";
1607 case SIR_MAC_CTRL_PS_POLL:
1608 return "MAC_CTRL_PS_POLL";
1609 case SIR_MAC_CTRL_RTS:
1610 return "MAC_CTRL_RTS";
1611 case SIR_MAC_CTRL_CTS:
1612 return "MAC_CTRL_CTS";
1613 case SIR_MAC_CTRL_ACK:
1614 return "MAC_CTRL_ACK";
1615 case SIR_MAC_CTRL_CF_END:
1616 return "MAC_CTRL_CF_END";
1617 case SIR_MAC_CTRL_CF_END_ACK:
1618 return "MAC_CTRL_CF_END_ACK";
1619 default:
1620 return "Unknown CTRL Frame";
1621 }
1622 }
1623
1624 else if (type == SIR_MAC_DATA_FRAME)
1625 {
1626 switch (subType)
1627 {
1628 case SIR_MAC_DATA_DATA:
1629 return "MAC_DATA_DATA";
1630 case SIR_MAC_DATA_DATA_ACK:
1631 return "MAC_DATA_DATA_ACK";
1632 case SIR_MAC_DATA_DATA_POLL:
1633 return "MAC_DATA_DATA_POLL";
1634 case SIR_MAC_DATA_DATA_ACK_POLL:
1635 return "MAC_DATA_DATA_ACK_POLL";
1636 case SIR_MAC_DATA_NULL:
1637 return "MAC_DATA_NULL";
1638 case SIR_MAC_DATA_NULL_ACK:
1639 return "MAC_DATA_NULL_ACK";
1640 case SIR_MAC_DATA_NULL_POLL:
1641 return "MAC_DATA_NULL_POLL";
1642 case SIR_MAC_DATA_NULL_ACK_POLL:
1643 return "MAC_DATA_NULL_ACK_POLL";
1644 case SIR_MAC_DATA_QOS_DATA:
1645 return "MAC_DATA_QOS_DATA";
1646 case SIR_MAC_DATA_QOS_DATA_ACK:
1647 return "MAC_DATA_QOS_DATA_ACK";
1648 case SIR_MAC_DATA_QOS_DATA_POLL:
1649 return "MAC_DATA_QOS_DATA_POLL";
1650 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1651 return "MAC_DATA_QOS_DATA_ACK_POLL";
1652 case SIR_MAC_DATA_QOS_NULL:
1653 return "MAC_DATA_QOS_NULL";
1654 case SIR_MAC_DATA_QOS_NULL_ACK:
1655 return "MAC_DATA_QOS_NULL_ACK";
1656 case SIR_MAC_DATA_QOS_NULL_POLL:
1657 return "MAC_DATA_QOS_NULL_POLL";
1658 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1659 return "MAC_DATA_QOS_NULL_ACK_POLL";
1660 default:
1661 return "Unknown Data Frame";
1662 }
1663 }
1664 else
1665 return "Unknown";
1666#endif
1667return "";
1668}
1669
Jeff Johnson295189b2012-06-20 16:38:30 -07001670void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1671{
1672 int i;
1673 static int enable;
1674 tUpdateBeaconParams beaconParams;
1675
1676 tpPESession psessionEntry = limIsApSessionActive(pMac);
1677
1678 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001679 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001680 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001682 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301683
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301684 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001685 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001686
1687 beaconParams.paramChangeBitmap = 0;
1688 /*
1689 ** This is doing a 2 pass check. The first pass is to invalidate
1690 ** all the cache entries. The second pass is to decide whether to
1691 ** disable protection.
1692 **/
1693 if (!enable)
1694 {
1695
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001696 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 psessionEntry->gLimOlbcParams.numSta = 0;
1698 psessionEntry->gLimOverlap11gParams.numSta = 0;
1699 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1700 psessionEntry->gLimNonGfParams.numSta = 0;
1701 psessionEntry->gLimLsigTxopParams.numSta = 0;
1702
1703 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1704 pMac->lim.protStaOverlapCache[i].active = false;
1705
1706 enable = 1;
1707 }
1708 else
1709 {
1710
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001711 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 {
1713 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1714 {
1715 if (!psessionEntry->gLim11bParams.protectionEnabled)
1716 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001717 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1719 }
1720 }
1721 }
1722
1723 if (!psessionEntry->gLimOverlap11gParams.numSta)
1724 {
1725 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1726 {
1727 if (!psessionEntry->gLim11gParams.protectionEnabled)
1728 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001729 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1731 }
1732 }
1733 }
1734
1735 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1736 {
1737 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1738 {
1739 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1740 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001741 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1743 }
1744 }
1745 }
1746
1747 enable = 0;
1748 }
1749
1750 if(beaconParams.paramChangeBitmap)
1751 {
1752 schSetFixedBeaconFields(pMac,psessionEntry);
1753 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1754 }
1755
1756 // Start OLBC timer
1757 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1758 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001759 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001760 }
1761}
Jeff Johnson295189b2012-06-20 16:38:30 -07001762
1763/**
1764 * limIsNullSsid()
1765 *
1766 *FUNCTION:
1767 * This function checks if Ssid supplied is Null SSID
1768 *
1769 *
1770 *LOGIC:
1771 *
1772 *ASSUMPTIONS:
1773 * NA
1774 *
1775 *NOTE:
1776 * NA
1777 *
1778 * @param tSirMacSSid *
1779 *
1780 *
1781 * @return true if SSID is Null SSID else false
1782 */
1783
1784tANI_U8
1785limIsNullSsid( tSirMacSSid *pSsid )
1786{
1787 tANI_U8 fNullSsid = false;
1788 tANI_U32 SsidLength;
1789 tANI_U8 *pSsidStr;
1790
1791 do
1792 {
1793 if ( 0 == pSsid->length )
1794 {
1795 fNullSsid = true;
1796 break;
1797 }
1798
1799#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301800 /* If the first charactes is space and SSID length is 1
1801 * then consider it as NULL SSID*/
1802 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1803 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301805 fNullSsid = true;
1806 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 }
1808 else
1809 {
1810 /* check if all the charactes in SSID are NULL*/
1811 SsidLength = pSsid->length;
1812 pSsidStr = pSsid->ssId;
1813
1814 while ( SsidLength )
1815 {
1816 if( *pSsidStr )
1817 break;
1818
1819 pSsidStr++;
1820 SsidLength--;
1821 }
1822
1823 if( 0 == SsidLength )
1824 {
1825 fNullSsid = true;
1826 break;
1827 }
1828 }
1829 }
1830 while( 0 );
1831
1832 return fNullSsid;
1833} /****** end limIsNullSsid() ******/
1834
1835
1836
Jeff Johnson295189b2012-06-20 16:38:30 -07001837
1838/** -------------------------------------------------------------
1839\fn limUpdateProtStaParams
1840\brief updates protection related counters.
1841\param tpAniSirGlobal pMac
1842\param tSirMacAddr peerMacAddr
1843\param tLimProtStaCacheType protStaCacheType
1844\param tHalBitVal gfSupported
1845\param tHalBitVal lsigTxopSupported
1846\return None
1847 -------------------------------------------------------------*/
1848void
1849limUpdateProtStaParams(tpAniSirGlobal pMac,
1850tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1851tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1852tpPESession psessionEntry)
1853{
1854 tANI_U32 i;
1855
1856 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1857 limLog(pMac,LOG1, FL("Addr : "));
1858 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1859
1860 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1861 {
1862 if (psessionEntry->protStaCache[i].active)
1863 {
1864 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1865 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1866
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301867 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 psessionEntry->protStaCache[i].addr,
1869 peerMacAddr, sizeof(tSirMacAddr)))
1870 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001871 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 return;
1873 }
1874 }
1875 }
1876
1877 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1878 {
1879 if (!psessionEntry->protStaCache[i].active)
1880 break;
1881 }
1882
1883 if (i >= LIM_PROT_STA_CACHE_SIZE)
1884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001885 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 return;
1887 }
1888
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301889 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 peerMacAddr,
1891 sizeof(tSirMacAddr));
1892
1893 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1894 psessionEntry->protStaCache[i].active = true;
1895 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1896 {
1897 psessionEntry->gLim11bParams.numSta++;
1898 limLog(pMac,LOG1, FL("11B, "));
1899 }
1900 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1901 {
1902 psessionEntry->gLim11gParams.numSta++;
1903 limLog(pMac,LOG1, FL("11G, "));
1904 }
1905 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1906 {
1907 psessionEntry->gLimHt20Params.numSta++;
1908 limLog(pMac,LOG1, FL("HT20, "));
1909 }
1910
1911 if(!gfSupported)
1912 {
1913 psessionEntry->gLimNonGfParams.numSta++;
1914 limLog(pMac,LOG1, FL("NonGf, "));
1915 }
1916 if(!lsigTxopSupported)
1917 {
1918 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001919 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 }
1921}// ---------------------------------------------------------------------
1922
1923/** -------------------------------------------------------------
1924\fn limDecideApProtection
1925\brief Decides all the protection related staiton coexistence and also sets
1926\ short preamble and short slot appropriately. This function will be called
1927\ when AP is ready to send assocRsp tp the station joining right now.
1928\param tpAniSirGlobal pMac
1929\param tSirMacAddr peerMacAddr
1930\return None
1931 -------------------------------------------------------------*/
1932void
1933limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1934{
1935 tANI_U16 tmpAid;
1936 tpDphHashNode pStaDs;
1937 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1938 tANI_U32 phyMode;
1939 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1940 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1941
1942 pBeaconParams->paramChangeBitmap = 0;
1943 // check whether to enable protection or not
1944 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1945 if(NULL == pStaDs)
1946 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301947 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 return;
1949 }
1950 limGetRfBand(pMac, &rfBand, psessionEntry);
1951 //if we are in 5 GHZ band
1952 if(SIR_BAND_5_GHZ == rfBand)
1953 {
1954 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1955 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001956 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 {
1958 //we are 11N and 11A station is joining.
1959 //protection from 11A required.
1960 if(false == pStaDs->mlmStaContext.htCapability)
1961 {
1962 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1963 return;
1964 }
1965 }
1966 }
1967 else if(SIR_BAND_2_4_GHZ== rfBand)
1968 {
1969 limGetPhyMode(pMac, &phyMode, psessionEntry);
1970
1971 //We are 11G. Check if we need protection from 11b Stations.
1972 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001973 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 {
1975
1976 if (pStaDs->erpEnabled== eHAL_CLEAR)
1977 {
1978 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1979 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001980 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1982 }
1983 }
1984
1985 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001986 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 {
1988 //check if we need protection from 11b station
1989 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1990 (!pStaDs->mlmStaContext.htCapability))
1991 {
1992 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1993 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001994 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001995 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1996 }
1997 //station being joined is non-11b and non-ht ==> 11g device
1998 else if(!pStaDs->mlmStaContext.htCapability)
1999 {
2000 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
2001 //enable protection
2002 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
2003 }
2004 //ERP mode is enabled for the latest station joined
2005 //latest station joined is HT capable
2006 //This case is being handled in common code (commn between both the bands) below.
2007 }
2008 }
2009
2010 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002011 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 (true == pStaDs->mlmStaContext.htCapability))
2013 {
2014 if(!pStaDs->htGreenfield)
2015 {
2016 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2017 gfSupported = eHAL_CLEAR;
2018 }
2019 //Station joining is HT 20Mhz
2020 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2021 {
2022 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2023 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2024 }
2025 //Station joining does not support LSIG TXOP Protection
2026 if(!pStaDs->htLsigTXOPProtection)
2027 {
2028 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2029 lsigTxopSupported = eHAL_CLEAR;
2030 }
2031 }
2032
2033 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2034 gfSupported, lsigTxopSupported, psessionEntry);
2035
2036 return;
2037}
Jeff Johnson295189b2012-06-20 16:38:30 -07002038
2039
2040/** -------------------------------------------------------------
2041\fn limEnableOverlap11gProtection
2042\brief wrapper function for setting overlap 11g protection.
2043\param tpAniSirGlobal pMac
2044\param tpUpdateBeaconParams pBeaconParams
2045\param tpSirMacMgmtHdr pMh
2046\return None
2047 -------------------------------------------------------------*/
2048void
2049limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2050tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2051{
2052 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2053
2054 if (psessionEntry->gLimOlbcParams.numSta &&
2055 !psessionEntry->gLimOlbcParams.protectionEnabled)
2056 {
2057 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002058 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2060 }
2061}
2062
2063
2064/** -------------------------------------------------------------
2065\fn limUpdateShortPreamble
2066\brief Updates short preamble if needed when a new station joins.
2067\param tpAniSirGlobal pMac
2068\param tSirMacAddr peerMacAddr
2069\param tpUpdateBeaconParams pBeaconParams
2070\return None
2071 -------------------------------------------------------------*/
2072void
2073limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2074 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2075{
2076 tANI_U16 tmpAid;
2077 tpDphHashNode pStaDs;
2078 tANI_U32 phyMode;
2079 tANI_U16 i;
2080
2081 // check whether to enable protection or not
2082 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2083
2084 limGetPhyMode(pMac, &phyMode, psessionEntry);
2085
2086 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2087
2088 {
2089 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2090 {
2091 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2092 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2093
2094 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2095 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2097 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2098 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302099 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2101 peerMacAddr, sizeof(tSirMacAddr)))
2102 return;
2103 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 {
2105 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2106 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302107 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2109 peerMacAddr, sizeof(tSirMacAddr)))
2110 return;
2111 }
2112 }
2113 }
2114
2115
2116 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2117 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2119 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2120 break;
2121 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 {
2123 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2124 break;
2125 }
2126 }
2127
2128 if (i >= LIM_PROT_STA_CACHE_SIZE)
2129 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2131 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2132 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2133 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2134 return;
2135 }
2136 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 {
2138 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2139 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2140 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2141 return;
2142 }
2143
2144 }
2145
2146
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302147 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2148 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 peerMacAddr, sizeof(tSirMacAddr));
2150 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2151 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2152 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302154 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 peerMacAddr, sizeof(tSirMacAddr));
2156 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2157 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2158 }
2159
2160
2161 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002162 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002163
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002165 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 }
2167 }
2168}
2169
2170/** -------------------------------------------------------------
2171\fn limUpdateShortSlotTime
2172\brief Updates short slot time if needed when a new station joins.
2173\param tpAniSirGlobal pMac
2174\param tSirMacAddr peerMacAddr
2175\param tpUpdateBeaconParams pBeaconParams
2176\return None
2177 -------------------------------------------------------------*/
2178
2179void
2180limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2181 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2182{
2183 tANI_U16 tmpAid;
2184 tpDphHashNode pStaDs;
2185 tANI_U32 phyMode;
2186 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 tANI_U16 i;
2188
2189 // check whether to enable protection or not
2190 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2191 limGetPhyMode(pMac, &phyMode, psessionEntry);
2192
Jeff Johnsone7245742012-09-05 17:12:55 -07002193 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2194 * be always 1 and in 11b case, it should be always 0
2195 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2197 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002198 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2199 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2200 * it in limDecideShortSlot
2201 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2203 {
2204 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2205 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2206 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2207 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2209 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2210 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302211 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2213 peerMacAddr, sizeof(tSirMacAddr)))
2214 return;
2215 }
2216 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 {
2218 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2219 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302220 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2222 peerMacAddr, sizeof(tSirMacAddr)))
2223 return;
2224 }
2225 }
2226 }
2227
2228 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2229 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2231 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2232 break;
2233 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
2235 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2236 break;
2237 }
2238 }
2239
2240 if (i >= LIM_PROT_STA_CACHE_SIZE)
2241 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2243 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2244 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2245 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2246 return;
2247 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
2249 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2250 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2251 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2252 return;
2253 }
2254 }
2255
2256
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302258 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 peerMacAddr, sizeof(tSirMacAddr));
2260 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2261 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2262 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302264 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 peerMacAddr, sizeof(tSirMacAddr));
2266 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2267 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2268 }
2269 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2270
Jeff Johnsone7245742012-09-05 17:12:55 -07002271 /* 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
2272 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2273 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002275 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 {
2277 // enable long slot time
2278 pBeaconParams->fShortSlotTime = false;
2279 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002280 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002281 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 }
2283 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002285 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 {
2287 // enable long slot time
2288 pBeaconParams->fShortSlotTime = false;
2289 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002290 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002291 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293 }
2294 }
2295 }
2296}
2297
Jeff Johnson295189b2012-06-20 16:38:30 -07002298
2299/** -------------------------------------------------------------
2300\fn limDecideStaProtectionOnAssoc
2301\brief Decide protection related settings on Sta while association.
2302\param tpAniSirGlobal pMac
2303\param tpSchBeaconStruct pBeaconStruct
2304\return None
2305 -------------------------------------------------------------*/
2306void
2307limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2308 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2309{
2310 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2311 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2312
2313 limGetRfBand(pMac, &rfBand, psessionEntry);
2314 limGetPhyMode(pMac, &phyMode, psessionEntry);
2315
2316 if(SIR_BAND_5_GHZ == rfBand)
2317 {
2318 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2319 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2320 {
2321 if(pMac->lim.cfgProtection.fromlla)
2322 psessionEntry->beaconParams.llaCoexist = true;
2323 }
2324 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2325 {
2326 if(pMac->lim.cfgProtection.ht20)
2327 psessionEntry->beaconParams.ht20Coexist = true;
2328 }
2329
2330 }
2331 else if(SIR_BAND_2_4_GHZ == rfBand)
2332 {
2333 //spec 7.3.2.13
2334 //UseProtection will be set when nonERP STA is associated.
2335 //NonERPPresent bit will be set when:
2336 //--nonERP Sta is associated OR
2337 //--nonERP Sta exists in overlapping BSS
2338 //when useProtection is not set then protection from nonERP stations is optional.
2339
2340 //CFG protection from 11b is enabled and
2341 //11B device in the BSS
2342 /* TODO, This is not sessionized */
2343 if (phyMode != WNI_CFG_PHY_MODE_11B)
2344 {
2345 if (pMac->lim.cfgProtection.fromllb &&
2346 pBeaconStruct->erpPresent &&
2347 (pBeaconStruct->erpIEInfo.useProtection ||
2348 pBeaconStruct->erpIEInfo.nonErpPresent))
2349 {
2350 psessionEntry->beaconParams.llbCoexist = true;
2351 }
2352 //AP has no 11b station associated.
2353 else
2354 {
2355 psessionEntry->beaconParams.llbCoexist = false;
2356 }
2357 }
2358 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002359 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 (pBeaconStruct->HTInfo.present))
2361 {
2362 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2363
2364 //Obss Non HT STA present mode
2365 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2366
2367
2368 //CFG protection from 11G is enabled and
2369 //our AP has at least one 11G station associated.
2370 if(pMac->lim.cfgProtection.fromllg &&
2371 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2372 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2373 (!psessionEntry->beaconParams.llbCoexist))
2374 {
2375 if(pMac->lim.cfgProtection.fromllg)
2376 psessionEntry->beaconParams.llgCoexist = true;
2377 }
2378
2379 //AP has only HT stations associated and at least one station is HT 20
2380 //disable protection from any non-HT devices.
2381 //decision for disabling protection from 11b has already been taken above.
2382 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2383 {
2384 //Disable protection from 11G station.
2385 psessionEntry->beaconParams.llgCoexist = false;
2386 //CFG protection from HT 20 is enabled.
2387 if(pMac->lim.cfgProtection.ht20)
2388 psessionEntry->beaconParams.ht20Coexist = true;
2389 }
2390 //Disable protection from non-HT and HT20 devices.
2391 //decision for disabling protection from 11b has already been taken above.
2392 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2393 {
2394 psessionEntry->beaconParams.llgCoexist = false;
2395 psessionEntry->beaconParams.ht20Coexist = false;
2396 }
2397
2398 }
2399 }
2400
2401 //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 -07002402 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 (pBeaconStruct->HTInfo.present))
2404 {
2405 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2406 psessionEntry->beaconParams.fRIFSMode =
2407 ( tANI_U8 ) htInfo.rifsMode;
2408 psessionEntry->beaconParams.llnNonGFCoexist =
2409 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2410 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2411 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2412 }
2413}
2414
2415
2416/** -------------------------------------------------------------
2417\fn limDecideStaProtection
2418\brief Decides protection related settings on Sta while processing beacon.
2419\param tpAniSirGlobal pMac
2420\param tpUpdateBeaconParams pBeaconParams
2421\return None
2422 -------------------------------------------------------------*/
2423void
2424limDecideStaProtection(tpAniSirGlobal pMac,
2425 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2426{
2427
2428 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2429 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2430
2431 limGetRfBand(pMac, &rfBand, psessionEntry);
2432 limGetPhyMode(pMac, &phyMode, psessionEntry);
2433
2434 if(SIR_BAND_5_GHZ == rfBand)
2435 {
2436 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002437 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 (pBeaconStruct->HTInfo.present))
2439 {
2440 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2441 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2442 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2443 {
2444 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2445 }
2446 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2447 //protection from HT20 if needed.
2448 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2449 {
2450 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2451 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2452 }
2453 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2454 {
2455 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2456 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2457 }
2458 }
2459 }
2460 else if(SIR_BAND_2_4_GHZ == rfBand)
2461 {
2462 /* spec 7.3.2.13
2463 * UseProtection will be set when nonERP STA is associated.
2464 * NonERPPresent bit will be set when:
2465 * --nonERP Sta is associated OR
2466 * --nonERP Sta exists in overlapping BSS
2467 * when useProtection is not set then protection from nonERP stations is optional.
2468 */
2469
2470 if (phyMode != WNI_CFG_PHY_MODE_11B)
2471 {
2472 if (pBeaconStruct->erpPresent &&
2473 (pBeaconStruct->erpIEInfo.useProtection ||
2474 pBeaconStruct->erpIEInfo.nonErpPresent))
2475 {
2476 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2477 }
2478 //AP has no 11b station associated.
2479 else
2480 {
2481 //disable protection from 11b station
2482 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2483 }
2484 }
2485
2486 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002487 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 (pBeaconStruct->HTInfo.present))
2489 {
2490
2491 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2492 //AP has at least one 11G station associated.
2493 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2494 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2495 (!psessionEntry->beaconParams.llbCoexist))
2496 {
2497 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2498
2499 }
2500
2501 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2502 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2503 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2504 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2505 {
2506 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2507
2508 //AP has only HT stations associated and at least one station is HT 20
2509 //disable protection from any non-HT devices.
2510 //decision for disabling protection from 11b has already been taken above.
2511 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2512 {
2513 //Disable protection from 11G station.
2514 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2515
2516 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2517 }
2518 //Disable protection from non-HT and HT20 devices.
2519 //decision for disabling protection from 11b has already been taken above.
2520 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2521 {
2522 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2523 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2524
2525 }
2526 }
2527 }
2528 }
2529
2530 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002531 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 (pBeaconStruct->HTInfo.present))
2533 {
2534 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2535 //Check for changes in protection related factors other than HT operating mode.
2536 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2537 if ( psessionEntry->beaconParams.fRIFSMode !=
2538 ( tANI_U8 ) htInfo.rifsMode )
2539 {
2540 pBeaconParams->fRIFSMode =
2541 psessionEntry->beaconParams.fRIFSMode =
2542 ( tANI_U8 ) htInfo.rifsMode;
2543 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2544 }
2545
2546 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2547 htInfo.nonGFDevicesPresent )
2548 {
2549 pBeaconParams->llnNonGFCoexist =
2550 psessionEntry->beaconParams.llnNonGFCoexist =
2551 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2552 pBeaconParams->paramChangeBitmap |=
2553 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2554 }
2555
2556 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2557 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2558 {
2559 pBeaconParams->fLsigTXOPProtectionFullSupport =
2560 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2561 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2562 pBeaconParams->paramChangeBitmap |=
2563 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2564 }
2565
2566 // For Station just update the global lim variable, no need to send message to HAL
2567 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2568 //stations in overlapping BSS.
2569 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2570 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2571
2572 }
2573}
2574
2575
2576/**
2577 * limProcessChannelSwitchTimeout()
2578 *
2579 *FUNCTION:
2580 * This function is invoked when Channel Switch Timer expires at
2581 * the STA. Now, STA must stop traffic, and then change/disable
2582 * primary or secondary channel.
2583 *
2584 *
2585 *NOTE:
2586 * @param pMac - Pointer to Global MAC structure
2587 * @return None
2588 */
2589void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2590{
2591 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002592 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002593
2594 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2595 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002596 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 return;
2598 }
2599
2600 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2601 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002602 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 -07002603 return;
2604 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302606
2607 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 * This potentially can create issues if the function tries to set
2609 * channel while device is in power-save, hence putting an extra check
2610 * to verify if the device is in power-save or not
2611 */
2612 if(!limIsSystemInActiveState(pMac))
2613 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002614 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 return;
2616 }
2617
2618 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002619 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002620
2621 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002622 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Abhishek Singhcb255b82015-10-01 12:37:57 +05302623
2624 /*
2625 * If Lim allows Switch channel on same channel on which preauth
2626 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2627 * during preauth rsp handling hence firmware may crash on ENTER/
2628 * EXIT BMPS request.
2629 */
2630 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2631 {
2632 limLog(pMac, LOGE,
2633 FL("Avoid Switch Channel req during pre auth"));
2634 return;
2635 }
2636 /* If link is already suspended mean some off
2637 * channel operation or scan is in progress, Allowing
2638 * Change channel here will lead to either Init Scan
2639 * sent twice or missing Finish scan when change
2640 * channel is completed, this may lead
2641 * to driver in invalid state and crash.
2642 */
2643 if (limIsLinkSuspended(pMac))
2644 {
2645 limLog(pMac, LOGE, FL("Link is already suspended for "
2646 "some other reason. Return here for sessionId:%d"),
2647 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2648 return;
2649 }
2650
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 /* Check if the AP is switching to a channel that we support.
2652 * Else, just don't bother to switch. Indicate HDD to look for a
2653 * better AP to associate
2654 */
2655 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2656 {
2657 /* We need to restore pre-channelSwitch state on the STA */
2658 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2659 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002660 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 return;
2662 }
2663
2664 /* If the channel-list that AP is asking us to switch is invalid,
2665 * then we cannot switch the channel. Just disassociate from AP.
2666 * We will find a better AP !!!
2667 */
2668 limTearDownLinkWithAp(pMac,
2669 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2670 eSIR_MAC_UNSPEC_FAILURE_REASON);
2671 return;
2672 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002673 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2674 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002675 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 {
2677 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002678 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2679 if ( isLimSessionOffChannel(pMac,
2680 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2681 {
2682 limSuspendLink(pMac,
2683 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2684 limProcessChannelSwitchSuspendLink,
2685 (tANI_U32*)psessionEntry );
2686 }
2687 else
2688 {
2689 limProcessChannelSwitchSuspendLink(pMac,
2690 eHAL_STATUS_SUCCESS,
2691 (tANI_U32*)psessionEntry);
2692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 break;
2694
2695 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002696 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002697 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002699 psessionEntry->gLimChannelSwitch.secondarySubBand);
2700 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 case eLIM_CHANNEL_SWITCH_IDLE:
2703 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002704 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2706 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002707 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 }
2709 return; /* Please note, this is 'return' and not 'break' */
2710 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002711}
Jeff Johnson295189b2012-06-20 16:38:30 -07002712
2713/**
2714 * limUpdateChannelSwitch()
2715 *
2716 *FUNCTION:
2717 * This function is invoked whenever Station receives
2718 * either 802.11h channel switch IE or airgo proprietary
2719 * channel switch IE.
2720 *
2721 *NOTE:
2722 * @param pMac - Pointer to Global MAC structure
2723 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2724 * @param psessionentry
2725 */
2726void
2727limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2728{
2729
2730 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2732 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002733#ifdef WLAN_FEATURE_11AC
2734 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2735#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002736
Jeff Johnsone7245742012-09-05 17:12:55 -07002737 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002738
2739 /* STA either received proprietary channel switch IE or 802.11h
2740 * standard channel switch IE.
2741 */
2742 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2743 {
2744 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2745
2746 /* Add logic to determine which change this is: */
2747 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002748 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2749 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2750 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2751 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2752 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002754 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 }
2756 else
2757 {
2758 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002759 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2760 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2761 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002763 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002764#ifdef WLAN_FEATURE_11AC
2765 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2766 if(pBeacon->WiderBWChanSwitchAnnPresent)
2767 {
2768 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2769 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2770 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2771 }
2772#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002773
2774 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002775 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2776 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002777
2778 /* Do not bother to look and operate on extended channel switch element
2779 * if our own channel-bonding state is not enabled
2780 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 {
2783 if (pBeacon->extChannelSwitchPresent)
2784 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002785 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2786 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002788 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2789 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002791#ifdef WLAN_FEATURE_11AC
2792 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2793 {
2794 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2795 {
2796 if(pBeacon->extChannelSwitchPresent)
2797 {
2798 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2799 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2800 {
2801 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2802 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2803 psessionEntry->gLimChannelSwitch.primaryChannel,
2804 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2805 pWiderChnlSwitch->newCenterChanFreq0,
2806 psessionEntry);
2807 }
2808 }
2809 }
2810 }
2811#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002812 }
2813 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002814 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002815
2816
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2818 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002819 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 }
2821
2822 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002823 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002824 psessionEntry->peSessionId,
2825 psessionEntry->gLimChannelSwitch.primaryChannel,
2826 psessionEntry->gLimChannelSwitch.secondarySubBand,
2827 psessionEntry->gLimChannelSwitch.switchCount,
2828 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 return;
2830}
2831
2832/**
2833 * limCancelDot11hChannelSwitch
2834 *
2835 *FUNCTION:
2836 * This function is called when STA does not send updated channel-swith IE
2837 * after indicating channel-switch start. This will cancel the channel-swith
2838 * timer which is already running.
2839 *
2840 *LOGIC:
2841 *
2842 *ASSUMPTIONS:
2843 *
2844 *NOTE:
2845 *
2846 * @param pMac - Pointer to Global MAC structure
2847 *
2848 * @return None
2849 */
2850void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2851{
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2853 return;
2854
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002855 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002856 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002857
2858 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2859 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002860 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 }
2862
2863 /* We need to restore pre-channelSwitch state on the STA */
2864 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2865 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002866 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002867
2868 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002869}
2870
2871/**----------------------------------------------
2872\fn limCancelDot11hQuiet
2873\brief Cancel the quieting on Station if latest
2874 beacon doesn't contain quiet IE in it.
2875
2876\param pMac
2877\return NONE
2878-----------------------------------------------*/
2879void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2880{
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2882 return;
2883
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002886 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2888 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002889 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002890 }
2891 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002892 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002894 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2896 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002897 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002898 }
2899 /**
2900 * If the channel switch is already running in silent mode, dont resume the
2901 * transmission. Channel switch timer when timeout, transmission will be resumed.
2902 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002903 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2904 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 {
2906 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002907 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 }
2909 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002910 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002911}
2912
2913/**
2914 * limProcessQuietTimeout
2915 *
2916 * FUNCTION:
2917 * This function is active only on the STA.
2918 * Handles SIR_LIM_QUIET_TIMEOUT
2919 *
2920 * LOGIC:
2921 * This timeout can occur under only one circumstance:
2922 *
2923 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2924 * This indicates that the timeout "interval" has
2925 * expired. This is a trigger for the STA to now
2926 * shut-off Tx/Rx for the specified gLimQuietDuration
2927 * -> The TIMER object gLimQuietBssTimer is
2928 * activated
2929 * -> With timeout = gLimQuietDuration
2930 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2931 *
2932 * ASSUMPTIONS:
2933 * Using two TIMER objects -
2934 * gLimQuietTimer & gLimQuietBssTimer
2935 *
2936 * NOTE:
2937 *
2938 * @param pMac - Pointer to Global MAC structure
2939 *
2940 * @return None
2941 */
2942void limProcessQuietTimeout(tpAniSirGlobal pMac)
2943{
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 //fetch the sessionEntry based on the sessionId
2945 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002946 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002947
Jeff Johnsone7245742012-09-05 17:12:55 -07002948 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002949 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002950 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002951 return;
2952 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002953
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302954 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002955 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002956 {
2957 case eLIM_QUIET_BEGIN:
2958 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002959 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2960 if (TX_SUCCESS !=
2961 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2962 {
2963 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002964 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002965 }
2966
2967 // gLimQuietDuration appears to be in units of ticks
2968 // Use it as is
2969 if (TX_SUCCESS !=
2970 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2971 psessionEntry->gLimSpecMgmt.quietDuration,
2972 0))
2973 {
2974 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002975 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002976 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002977 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002978#ifdef GEN6_TODO
2979 /* revisit this piece of code to assign the appropriate sessionId below
2980 * priority - HIGH
2981 */
2982 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2983#endif
2984 if( TX_SUCCESS !=
2985 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2986 {
2987 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002988 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 }
2990 else
2991 {
2992 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002993 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002994
2995 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2996 /* print message, otherwise, stop data traffic and stay quiet */
2997 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2998 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2999 {
3000 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003001 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 }
3003 else
3004 {
3005 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3006 /* freeze the transmission */
3007 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3008
3009 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003010 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003011 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003012 }
3013 }
3014 break;
3015
3016 case eLIM_QUIET_RUNNING:
3017 case eLIM_QUIET_INIT:
3018 case eLIM_QUIET_END:
3019 default:
3020 //
3021 // As of now, nothing to be done
3022 //
3023 break;
3024 }
3025}
3026
3027/**
3028 * limProcessQuietBssTimeout
3029 *
3030 * FUNCTION:
3031 * This function is active on the AP and STA.
3032 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3033 *
3034 * LOGIC:
3035 * On the AP -
3036 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3037 * an indication for the AP to START sending out the
3038 * Quiet BSS IE.
3039 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3040 * the 11H spec
3041 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3042 * a Proprietary IE. This will be understood by all the
3043 * TITAN STA's
3044 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3045 * initiate the SCH to include the Quiet BSS IE in all
3046 * its subsequent Beacons/PR's.
3047 * The Quiet BSS IE will be included in all the Beacons
3048 * & PR's until the next DTIM period
3049 *
3050 * On the STA -
3051 * When gLimQuietState = eLIM_QUIET_RUNNING
3052 * This indicates that the STA was successfully shut-off
3053 * for the specified gLimQuietDuration. This is a trigger
3054 * for the STA to now resume data traffic.
3055 * -> gLimQuietState is set to eLIM_QUIET_INIT
3056 *
3057 * ASSUMPTIONS:
3058 *
3059 * NOTE:
3060 *
3061 * @param pMac - Pointer to Global MAC structure
3062 *
3063 * @return None
3064 */
3065void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3066{
Jeff Johnsone7245742012-09-05 17:12:55 -07003067 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003068
Jeff Johnsone7245742012-09-05 17:12:55 -07003069 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003071 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 return;
3073 }
3074
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303075 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003076 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003077 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 }
3079 else
3080 {
3081 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003082 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 {
3084 case eLIM_QUIET_RUNNING:
3085 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003086 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003087
3088 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3089 {
3090 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003091 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3092 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 {
3094 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003095 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 }
3097
3098 /* Reset status flag */
3099 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3100 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3101
3102 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003103 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003104 }
3105 else
3106 {
3107 //
3108 // Nothing specific to be done in this case
3109 // A background scan that was triggered during
3110 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3111 //
3112 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003113 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003114 }
3115 break;
3116
3117 case eLIM_QUIET_INIT:
3118 case eLIM_QUIET_BEGIN:
3119 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003120 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 /* If the quiet period has ended, then resume the frame transmission */
3122 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003123 limRestorePreQuietState(pMac, psessionEntry);
3124 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 break;
3126
3127 default:
3128 //
3129 // As of now, nothing to be done
3130 //
3131 break;
3132 }
3133 }
3134}
Jeff Johnson295189b2012-06-20 16:38:30 -07003135/**
3136 * limProcessWPSOverlapTimeout
3137 *
3138 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3139 *
3140 * LOGIC:
3141 *
3142 * ASSUMPTIONS:
3143 *
3144 * NOTE:
3145 *
3146 * @param pMac - Pointer to Global MAC structure
3147 *
3148 * @return None
3149 */
3150#if 0
3151void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3152{
3153
3154 tpPESession psessionEntry;
3155 tANI_U32 sessionId;
3156
3157 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3158 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003159 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 }
3161
3162 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3163
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003164 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003165
3166 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3167 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003168 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 return;
3170 }
3171
3172 limWPSPBCTimeout(pMac, psessionEntry);
3173}
3174#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003175
Jeff Johnson295189b2012-06-20 16:38:30 -07003176/**----------------------------------------------
3177\fn limStartQuietTimer
3178\brief Starts the quiet timer.
3179
3180\param pMac
3181\return NONE
3182-----------------------------------------------*/
3183void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3184{
3185 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303186 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003187
3188 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003189 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 return;
3191 }
3192
Jeff Johnson295189b2012-06-20 16:38:30 -07003193
3194 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3195 return;
3196 // First, de-activate Timer, if its already active
3197 limCancelDot11hQuiet(pMac, psessionEntry);
3198
Jeff Johnsone7245742012-09-05 17:12:55 -07003199 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3200 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3201 {
3202 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003203 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003204 }
3205
3206 // Set the NEW timeout value, in ticks
3207 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3208 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3209 {
3210 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003211 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003212 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003213
3214 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3215 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3216 {
3217 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003218 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003219 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003220
Jeff Johnsone7245742012-09-05 17:12:55 -07003221 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003222 return;
3223 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003224}
3225
Jeff Johnson295189b2012-06-20 16:38:30 -07003226
3227/** ------------------------------------------------------------------------ **/
3228/**
3229 * keep track of the number of ANI peers associated in the BSS
3230 * For the first and last ANI peer, we have to update EDCA params as needed
3231 *
3232 * When the first ANI peer joins the BSS, we notify SCH
3233 * When the last ANI peer leaves the BSS, we notfiy SCH
3234 */
3235void
3236limUtilCountStaAdd(
3237 tpAniSirGlobal pMac,
3238 tpDphHashNode pSta,
3239 tpPESession psessionEntry)
3240{
3241
3242 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3243 return;
3244
3245 pSta->fAniCount = 1;
3246
3247 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3248 return;
3249
3250 // get here only if this is the first ANI peer in the BSS
3251 schEdcaProfileUpdate(pMac, psessionEntry);
3252}
3253
3254void
3255limUtilCountStaDel(
3256 tpAniSirGlobal pMac,
3257 tpDphHashNode pSta,
3258 tpPESession psessionEntry)
3259{
3260
3261 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3262 return;
3263
3264 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3265 * then go ahead and update the count and profiles. This ensures
3266 * that the "number of ani station" count is properly incremented/decremented.
3267 */
3268 if (pSta->valid == 1)
3269 return;
3270
3271 pSta->fAniCount = 0;
3272
3273 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3274 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003275 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 pMac->lim.gLimNumOfAniSTAs);
3277 return;
3278 }
3279
3280 pMac->lim.gLimNumOfAniSTAs--;
3281
3282 if (pMac->lim.gLimNumOfAniSTAs != 0)
3283 return;
3284
3285 // get here only if this is the last ANI peer in the BSS
3286 schEdcaProfileUpdate(pMac, psessionEntry);
3287}
3288
Jeff Johnson295189b2012-06-20 16:38:30 -07003289/**
3290 * limSwitchChannelCback()
3291 *
3292 *FUNCTION:
3293 * This is the callback function registered while requesting to switch channel
3294 * after AP indicates a channel switch for spectrum management (11h).
3295 *
3296 *NOTE:
3297 * @param pMac Pointer to Global MAC structure
3298 * @param status Status of channel switch request
3299 * @param data User data
3300 * @param psessionEntry Session information
3301 * @return NONE
3302 */
3303void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3304 tANI_U32 *data, tpPESession psessionEntry)
3305{
3306 tSirMsgQ mmhMsg = {0};
3307 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3308
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3310
3311 /* We need to restore pre-channelSwitch state on the STA */
3312 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3313 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003314 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 return;
3316 }
3317
3318 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303319 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3320 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003322 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 return;
3324 }
3325
3326 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3327 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003328 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3330 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303331 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3333 mmhMsg.bodyval = 0;
3334
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303335 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3336 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003338}
3339
3340/**
3341 * limSwitchPrimaryChannel()
3342 *
3343 *FUNCTION:
3344 * This function changes the current operating channel
3345 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3346 *
3347 *NOTE:
3348 * @param pMac Pointer to Global MAC structure
3349 * @param newChannel new chnannel ID
3350 * @return NONE
3351 */
3352void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3353{
3354#if !defined WLAN_FEATURE_VOWIFI
3355 tANI_U32 localPwrConstraint;
3356#endif
3357
Abhishek Singh127a8442014-12-15 17:31:27 +05303358 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3359 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 psessionEntry->currentReqChannel = newChannel;
3361 psessionEntry->limRFBand = limGetRFBand(newChannel);
3362
3363 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3364
3365 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3366 pMac->lim.gpchangeChannelData = NULL;
3367
3368#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003369 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003370 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3371#else
3372 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3373 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003374 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 return;
3376 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003377 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3379#endif
3380 return;
3381}
3382
3383/**
3384 * limSwitchPrimarySecondaryChannel()
3385 *
3386 *FUNCTION:
3387 * This function changes the primary and secondary channel.
3388 * If 11h is enabled and user provides a "new channel ID"
3389 * that is different from the current operating channel,
3390 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3391 * assign notify LIM of such change.
3392 *
3393 *NOTE:
3394 * @param pMac Pointer to Global MAC structure
3395 * @param newChannel New chnannel ID (or current channel ID)
3396 * @param subband CB secondary info:
3397 * - eANI_CB_SECONDARY_NONE
3398 * - eANI_CB_SECONDARY_UP
3399 * - eANI_CB_SECONDARY_DOWN
3400 * @return NONE
3401 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003402void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003403{
3404#if !defined WLAN_FEATURE_VOWIFI
3405 tANI_U32 localPwrConstraint;
3406#endif
3407
Jeff Johnson295189b2012-06-20 16:38:30 -07003408#if !defined WLAN_FEATURE_VOWIFI
3409 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003410 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003411 return;
3412 }
3413#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303414 /* Assign the callback to resume TX once channel is changed.
3415 */
3416 psessionEntry->currentReqChannel = newChannel;
3417 psessionEntry->limRFBand = limGetRFBand(newChannel);
3418
3419 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3420
3421 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3422 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003423
Jeff Johnson295189b2012-06-20 16:38:30 -07003424#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003425 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003426#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003427 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003428#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003429
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303430#ifdef FEATURE_WLAN_DIAG_SUPPORT
3431 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3432 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3433#endif
3434
Jeff Johnsone7245742012-09-05 17:12:55 -07003435 // Store the new primary and secondary channel in session entries if different
3436 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 {
3438 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003439 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003441 psessionEntry->currentOperChannel = newChannel;
3442 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003443 if (psessionEntry->htSecondaryChannelOffset != subband)
3444 {
3445 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003446 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 psessionEntry->htSecondaryChannelOffset, subband);
3448 psessionEntry->htSecondaryChannelOffset = subband;
3449 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3450 {
3451 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3452 }
3453 else
3454 {
3455 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3456 }
3457 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3458 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003459
3460 return;
3461}
3462
3463
3464/**
3465 * limActiveScanAllowed()
3466 *
3467 *FUNCTION:
3468 * Checks if active scans are permitted on the given channel
3469 *
3470 *LOGIC:
3471 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3472 * Need to check if the channelNum matches, then depending on the corresponding
3473 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3474 *
3475 *ASSUMPTIONS:
3476 *
3477 *NOTE:
3478 *
3479 * @param pMac Pointer to Global MAC structure
3480 * @param channelNum channel number
3481 * @return None
3482 */
3483
3484tANI_U8 limActiveScanAllowed(
3485 tpAniSirGlobal pMac,
3486 tANI_U8 channelNum)
3487{
3488 tANI_U32 i;
3489 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3490 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3491 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3492 != eSIR_SUCCESS)
3493 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003494 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 return false;
3496 }
3497
3498 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3499 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003500 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 len);
3502 return false;
3503 }
3504
3505 for (i=0; (i+1) < len; i+=2)
3506 {
3507 if (channelPair[i] == channelNum)
3508 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3509 }
3510 return false;
3511}
3512
3513/**
3514 * limTriggerBackgroundScanDuringQuietBss()
3515 *
3516 *FUNCTION:
3517 * This function is applicable to the STA only.
3518 * This function is called by limProcessQuietTimeout(),
3519 * when it is time to honor the Quiet BSS IE from the AP.
3520 *
3521 *LOGIC:
3522 * If 11H is enabled:
3523 * We cannot trigger a background scan. The STA needs to
3524 * shut-off Tx/Rx.
3525 * If 11 is not enabled:
3526 * Determine if the next channel that we are going to
3527 * scan is NOT the same channel (or not) on which the
3528 * Quiet BSS was requested.
3529 * If yes, then we cannot trigger a background scan on
3530 * this channel. Return with a false.
3531 * If no, then trigger a background scan. Return with
3532 * a true.
3533 *
3534 *ASSUMPTIONS:
3535 *
3536 *NOTE:
3537 * This API is redundant if the existing API,
3538 * limTriggerBackgroundScan(), were to return a valid
3539 * response instead of returning void.
3540 * If possible, try to revisit this API
3541 *
3542 * @param pMac Pointer to Global MAC structure
3543 * @return eSIR_TRUE, if a background scan was attempted
3544 * eSIR_FALSE, if not
3545 */
3546tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3547{
3548 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003549
3550
3551
3552 //TBD-RAJESH HOW TO GET sessionEntry?????
3553 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3554
3555 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3556 return bScanTriggered;
3557
Jeff Johnsone7245742012-09-05 17:12:55 -07003558 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003559 {
3560 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3561 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3562
3563 // Determine the next scan channel
3564
3565 // Get background scan channel list from CFG
3566 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3567 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3568 (tANI_U8 *) bgScanChannelList,
3569 (tANI_U32 *) &len ))
3570 {
3571 // Ensure that we do not go off scanning on the same
3572 // channel on which the Quiet BSS was requested
3573 if( psessionEntry->currentOperChannel!=
3574 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3575 {
3576 // For now, try and attempt a background scan. It will
3577 // be ideal if this API actually returns a success or
3578 // failure instead of having a void return type
3579 limTriggerBackgroundScan( pMac );
3580
3581 bScanTriggered = eSIR_TRUE;
3582 }
3583 else
3584 {
3585 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003586 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 -07003587 }
3588 }
3589 else
3590 {
3591 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003592 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 -07003593 }
3594 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 return bScanTriggered;
3596}
3597
3598
3599/**
3600 * limGetHTCapability()
3601 *
3602 *FUNCTION:
3603 * A utility function that returns the "current HT capability state" for the HT
3604 * capability of interest (as requested in the API)
3605 *
3606 *LOGIC:
3607 * This routine will return with the "current" setting of a requested HT
3608 * capability. This state info could be retrieved from -
3609 * a) CFG (for static entries)
3610 * b) Run time info
3611 * - Dynamic state maintained by LIM
3612 * - Configured at radio init time by SME
3613 *
3614 *
3615 *ASSUMPTIONS:
3616 * NA
3617 *
3618 *NOTE:
3619 *
3620 * @param pMac Pointer to Global MAC structure
3621 * @param htCap The HT capability being queried
3622 * @return tANI_U8 The current state of the requested HT capability is returned in a
3623 * tANI_U8 variable
3624 */
3625
Jeff Johnson295189b2012-06-20 16:38:30 -07003626tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3627 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003628{
3629tANI_U8 retVal = 0;
3630tANI_U8 *ptr;
3631tANI_U32 cfgValue;
3632tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3633tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3634tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3635tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3636
3637 //
3638 // Determine which CFG to read from. Not ALL of the HT
3639 // related CFG's need to be read each time this API is
3640 // accessed
3641 //
3642 if( htCap >= eHT_ANTENNA_SELECTION &&
3643 htCap < eHT_SI_GRANULARITY )
3644 {
3645 // Get Antenna Seletion HT Capabilities
3646 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3647 cfgValue = 0;
3648 ptr = (tANI_U8 *) &macASCapabilityInfo;
3649 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3650 }
3651 else
3652 {
3653 if( htCap >= eHT_TX_BEAMFORMING &&
3654 htCap < eHT_ANTENNA_SELECTION )
3655 {
3656 // Get Transmit Beam Forming HT Capabilities
3657 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3658 cfgValue = 0;
3659 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3660 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3661 }
3662 else
3663 {
3664 if( htCap >= eHT_PCO &&
3665 htCap < eHT_TX_BEAMFORMING )
3666 {
3667 // Get Extended HT Capabilities
3668 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3669 cfgValue = 0;
3670 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3671 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3672 }
3673 else
3674 {
3675 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3676 {
3677 // Get HT Capabilities
3678 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3679 cfgValue = 0;
3680 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3681 // 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
3682 *ptr++ = cfgValue & 0xff;
3683 *ptr = (cfgValue >> 8) & 0xff;
3684 }
3685 }
3686 }
3687 }
3688
3689 switch( htCap )
3690 {
3691 case eHT_LSIG_TXOP_PROTECTION:
3692 retVal = pMac->lim.gHTLsigTXOPProtection;
3693 break;
3694
3695 case eHT_STBC_CONTROL_FRAME:
3696 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3697 break;
3698
3699 case eHT_PSMP:
3700 retVal = pMac->lim.gHTPSMPSupport;
3701 break;
3702
3703 case eHT_DSSS_CCK_MODE_40MHZ:
3704 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3705 break;
3706
3707 case eHT_MAX_AMSDU_LENGTH:
3708 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3709 break;
3710
3711 case eHT_DELAYED_BA:
3712 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3713 break;
3714
3715 case eHT_RX_STBC:
3716 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3717 break;
3718
3719 case eHT_TX_STBC:
3720 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3721 break;
3722
3723 case eHT_SHORT_GI_40MHZ:
3724 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3725 break;
3726
3727 case eHT_SHORT_GI_20MHZ:
3728 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3729 break;
3730
3731 case eHT_GREENFIELD:
3732 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3733 break;
3734
3735 case eHT_MIMO_POWER_SAVE:
3736 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3737 break;
3738
3739 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003740 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 break;
3742
3743 case eHT_ADVANCED_CODING:
3744 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3745 break;
3746
3747 case eHT_MAX_RX_AMPDU_FACTOR:
3748 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3749 break;
3750
3751 case eHT_MPDU_DENSITY:
3752 retVal = pMac->lim.gHTAMpduDensity;
3753 break;
3754
3755 case eHT_PCO:
3756 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3757 break;
3758
3759 case eHT_TRANSITION_TIME:
3760 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3761 break;
3762
3763 case eHT_MCS_FEEDBACK:
3764 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3765 break;
3766
3767 case eHT_TX_BEAMFORMING:
3768 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3769 break;
3770
3771 case eHT_ANTENNA_SELECTION:
3772 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3773 break;
3774
3775 case eHT_SI_GRANULARITY:
3776 retVal = pMac->lim.gHTServiceIntervalGranularity;
3777 break;
3778
3779 case eHT_CONTROLLED_ACCESS:
3780 retVal = pMac->lim.gHTControlledAccessOnly;
3781 break;
3782
3783 case eHT_RIFS_MODE:
3784 retVal = psessionEntry->beaconParams.fRIFSMode;
3785 break;
3786
3787 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003788 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 break;
3790
3791 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003792 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 break;
3794
3795 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3797 retVal = psessionEntry->htOperMode;
3798 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 retVal = pMac->lim.gHTOperMode;
3800 break;
3801
3802 case eHT_BASIC_STBC_MCS:
3803 retVal = pMac->lim.gHTSTBCBasicMCS;
3804 break;
3805
3806 case eHT_DUAL_CTS_PROTECTION:
3807 retVal = pMac->lim.gHTDualCTSProtection;
3808 break;
3809
3810 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3811 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3812 break;
3813
3814 case eHT_PCO_ACTIVE:
3815 retVal = pMac->lim.gHTPCOActive;
3816 break;
3817
3818 case eHT_PCO_PHASE:
3819 retVal = pMac->lim.gHTPCOPhase;
3820 break;
3821
3822 default:
3823 break;
3824 }
3825
3826 return retVal;
3827}
3828
Jeff Johnson295189b2012-06-20 16:38:30 -07003829void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3830{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303831 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 return;
3833}
3834
3835
3836
3837
3838/** -------------------------------------------------------------
3839\fn limEnable11aProtection
3840\brief based on config setting enables\disables 11a protection.
3841\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3842\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3843\param tpUpdateBeaconParams pBeaconParams
3844\return None
3845 -------------------------------------------------------------*/
3846tSirRetStatus
3847limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3848 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3849{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003850 if(NULL == psessionEntry)
3851 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003852 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003853 return eSIR_FAILURE;
3854 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 //overlapping protection configuration check.
3856 if(overlap)
3857 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003858 }
3859 else
3860 {
3861 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003862 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003863 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 {
3865 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003866 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 return eSIR_SUCCESS;
3868 }
3869 }
3870
3871 if (enable)
3872 {
3873 //If we are AP and HT capable, we need to set the HT OP mode
3874 //appropriately.
3875 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003876 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 {
3878 if(overlap)
3879 {
3880 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3881 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3882 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3883 {
3884 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3885 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3886 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3887 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3888 }
3889 }
3890 else
3891 {
3892 psessionEntry->gLim11aParams.protectionEnabled = true;
3893 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3894 {
3895 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003896 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003897 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3898 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3899
3900 }
3901 }
3902 }
3903
3904 //This part is common for staiton as well.
3905 if(false == psessionEntry->beaconParams.llaCoexist)
3906 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003907 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3909 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3910 }
3911 }
3912 else if (true == psessionEntry->beaconParams.llaCoexist)
3913 {
3914 //for AP role.
3915 //we need to take care of HT OP mode change if needed.
3916 //We need to take care of Overlap cases.
3917 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3918 {
3919 if(overlap)
3920 {
3921 //Overlap Legacy protection disabled.
3922 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3923
3924 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003925 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 {
3927 // no HT op mode change if any of the overlap protection enabled.
3928 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3929 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3930 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3931
3932 {
3933 //Check if there is a need to change HT OP mode.
3934 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3935 {
3936 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3937 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3938
3939 if(psessionEntry->gLimHt20Params.protectionEnabled)
3940 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3941 else
3942 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3943 }
3944 }
3945 }
3946 }
3947 else
3948 {
3949 //Disable protection from 11A stations.
3950 psessionEntry->gLim11aParams.protectionEnabled = false;
3951 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3952
3953 //Check if any other non-HT protection enabled.
3954 //Right now we are in HT OP Mixed mode.
3955 //Change HT op mode appropriately.
3956
3957 //Change HT OP mode to 01 if any overlap protection enabled
3958 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3959 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3960 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3961
3962 {
3963 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003964 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003965 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3966 }
3967 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3968 {
3969 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003970 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3972 }
3973 else
3974 {
3975 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003976 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3978 }
3979 }
3980 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3981 !psessionEntry->gLim11aParams.protectionEnabled)
3982 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003983 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003984 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3985 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3986 }
3987 }
3988 //for station role
3989 else
3990 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003991 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3993 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3994 }
3995 }
3996
3997 return eSIR_SUCCESS;
3998}
3999
4000/** -------------------------------------------------------------
4001\fn limEnable11gProtection
4002\brief based on config setting enables\disables 11g protection.
4003\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4004\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4005\param tpUpdateBeaconParams pBeaconParams
4006\return None
4007 -------------------------------------------------------------*/
4008
4009tSirRetStatus
4010limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4011 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4012{
4013
4014 //overlapping protection configuration check.
4015 if(overlap)
4016 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 }
4018 else
4019 {
4020 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004021 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4022 !psessionEntry->cfgProtection.fromllb)
4023 {
4024 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004025 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 return eSIR_SUCCESS;
4027 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 {
4029 if(!pMac->lim.cfgProtection.fromllb)
4030 {
4031 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004032 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 return eSIR_SUCCESS;
4034 }
4035 }
4036 }
4037
4038 if (enable)
4039 {
4040 //If we are AP and HT capable, we need to set the HT OP mode
4041 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4043 {
4044 if(overlap)
4045 {
4046 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004047 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004048 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 {
4050 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4051 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4052 {
4053 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4054 }
4055 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4056 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4057 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4058 //Not processing OBSS bit from other APs, as we are already taking care
4059 //of Protection from overlapping BSS based on erp IE or useProtection bit
4060 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4061 }
4062 }
4063 else
4064 {
4065 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004067 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 {
4069 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4070 {
4071 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4072 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4073 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4074 }
4075 }
4076 }
4077 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004078 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004079 {
4080 if(overlap)
4081 {
4082 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4083 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4084 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4085 {
4086 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4087 }
4088 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4089 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4090 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4091 //Not processing OBSS bit from other APs, as we are already taking care
4092 //of Protection from overlapping BSS based on erp IE or useProtection bit
4093 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4094 }
4095 else
4096 {
4097 psessionEntry->gLim11bParams.protectionEnabled = true;
4098 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4099 {
4100 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4101 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4102 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4103 }
4104 }
4105 }
4106
4107 //This part is common for staiton as well.
4108 if(false == psessionEntry->beaconParams.llbCoexist)
4109 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004110 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4112 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4113 }
4114 }
4115 else if (true == psessionEntry->beaconParams.llbCoexist)
4116 {
4117 //for AP role.
4118 //we need to take care of HT OP mode change if needed.
4119 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004120 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4121 {
4122 if(overlap)
4123 {
4124 //Overlap Legacy protection disabled.
4125 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4126
4127 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004128 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004129 {
4130 // no HT op mode change if any of the overlap protection enabled.
4131 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4132 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4133 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4134 {
4135 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004136 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 {
4138 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4139 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4140 if(psessionEntry->gLimHt20Params.protectionEnabled){
4141 //Commenting out beacuse of CR 258588 WFA cert
4142 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4143 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4144 }
4145 else
4146 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4147 }
4148 }
4149 }
4150 }
4151 else
4152 {
4153 //Disable protection from 11B stations.
4154 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004155 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 //Check if any other non-HT protection enabled.
4157 if(!psessionEntry->gLim11gParams.protectionEnabled)
4158 {
4159 //Right now we are in HT OP Mixed mode.
4160 //Change HT op mode appropriately.
4161 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4162
4163 //Change HT OP mode to 01 if any overlap protection enabled
4164 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4165 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4166 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4167 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4168 {
4169 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004170 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004171 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4172 }
4173 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4174 {
4175 //Commenting because of CR 258588 WFA cert
4176 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4177 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004178 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4180 }
4181 else
4182 {
4183 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4184 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4185 }
4186 }
4187 }
4188 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4189 !psessionEntry->gLim11bParams.protectionEnabled)
4190 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004191 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4193 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4194 }
4195 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 {
4197 if(overlap)
4198 {
4199 //Overlap Legacy protection disabled.
4200 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4201
4202 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004203 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 {
4205 // no HT op mode change if any of the overlap protection enabled.
4206 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4207 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4208 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4209
4210 {
4211 //Check if there is a need to change HT OP mode.
4212 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4213 {
4214 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4215 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4216 if(psessionEntry->gLimHt20Params.protectionEnabled)
4217 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4218 else
4219 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4220 }
4221 }
4222 }
4223 }
4224 else
4225 {
4226 //Disable protection from 11B stations.
4227 psessionEntry->gLim11bParams.protectionEnabled = false;
4228 //Check if any other non-HT protection enabled.
4229 if(!psessionEntry->gLim11gParams.protectionEnabled)
4230 {
4231 //Right now we are in HT OP Mixed mode.
4232 //Change HT op mode appropriately.
4233 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4234
4235 //Change HT OP mode to 01 if any overlap protection enabled
4236 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4237 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4238 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4239 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4240
4241 {
4242 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4243 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4244 }
4245 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4246 {
4247 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4248 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4249 }
4250 else
4251 {
4252 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4253 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4254 }
4255 }
4256 }
4257 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4258 !psessionEntry->gLim11bParams.protectionEnabled)
4259 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004260 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4262 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4263 }
4264 }
4265 //for station role
4266 else
4267 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004268 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4270 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4271 }
4272 }
4273 return eSIR_SUCCESS;
4274}
4275
4276/** -------------------------------------------------------------
4277\fn limEnableHtProtectionFrom11g
4278\brief based on cofig enables\disables protection from 11g.
4279\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4280\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4281\param tpUpdateBeaconParams pBeaconParams
4282\return None
4283 -------------------------------------------------------------*/
4284tSirRetStatus
4285limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4286 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4287{
Jeff Johnsone7245742012-09-05 17:12:55 -07004288 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4290
4291 //overlapping protection configuration check.
4292 if(overlap)
4293 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004294 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4295 {
4296 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004297 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 return eSIR_SUCCESS;
4299 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 {
4301 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004302 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 return eSIR_SUCCESS;
4304 }
4305 }
4306 else
4307 {
4308 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4310 !psessionEntry->cfgProtection.fromllg){
4311 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004312 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 return eSIR_SUCCESS;
4314 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 {
4316 if(!pMac->lim.cfgProtection.fromllg)
4317 {
4318 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004319 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 return eSIR_SUCCESS;
4321 }
4322 }
4323 }
4324 if (enable)
4325 {
4326 //If we are AP and HT capable, we need to set the HT OP mode
4327 //appropriately.
4328
Jeff Johnson295189b2012-06-20 16:38:30 -07004329 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4330 {
4331 if(overlap)
4332 {
4333 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4334 //11g exists in overlap BSS.
4335 //need not to change the operating mode to overlap_legacy
4336 //if higher or same protection operating mode is enabled right now.
4337 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4338 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4339 {
4340 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4341 }
4342 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304343 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 }
4345 else
4346 {
4347 //11g is associated to an AP operating in 11n mode.
4348 //Change the HT operating mode to 'mixed mode'.
4349 psessionEntry->gLim11gParams.protectionEnabled = true;
4350 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4351 {
4352 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4353 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304354 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 }
4356 }
4357 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004358 {
4359 if(overlap)
4360 {
4361 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4362 //11g exists in overlap BSS.
4363 //need not to change the operating mode to overlap_legacy
4364 //if higher or same protection operating mode is enabled right now.
4365 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4366 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4367 {
4368 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4369 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4370 }
4371 }
4372 else
4373 {
4374 //11g is associated to an AP operating in 11n mode.
4375 //Change the HT operating mode to 'mixed mode'.
4376 psessionEntry->gLim11gParams.protectionEnabled = true;
4377 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4378 {
4379 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4380 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304381 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 }
4383 }
4384 }
4385
4386 //This part is common for staiton as well.
4387 if(false == psessionEntry->beaconParams.llgCoexist)
4388 {
4389 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4390 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4391 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4393 {
4394 // As operating mode changed after G station assoc some way to update beacon
4395 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4396 //pMac->sch.schObject.fBeaconChanged = 1;
4397 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4398 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 }
4400 else if (true == psessionEntry->beaconParams.llgCoexist)
4401 {
4402 //for AP role.
4403 //we need to take care of HT OP mode change if needed.
4404 //We need to take care of Overlap cases.
4405
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4407 {
4408 if(overlap)
4409 {
4410 //Overlap Legacy protection disabled.
4411 if (psessionEntry->gLim11gParams.numSta == 0)
4412 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4413
4414 // no HT op mode change if any of the overlap protection enabled.
4415 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4416 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4417 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4418 {
4419 //Check if there is a need to change HT OP mode.
4420 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4421 {
4422 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4423 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4424
4425 if(psessionEntry->gLimHt20Params.protectionEnabled){
4426 //Commenting because of CR 258588 WFA cert
4427 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4428 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4429 }
4430 else
4431 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4432 }
4433 }
4434 }
4435 else
4436 {
4437 //Disable protection from 11G stations.
4438 psessionEntry->gLim11gParams.protectionEnabled = false;
4439 //Check if any other non-HT protection enabled.
4440 if(!psessionEntry->gLim11bParams.protectionEnabled)
4441 {
4442
4443 //Right now we are in HT OP Mixed mode.
4444 //Change HT op mode appropriately.
4445 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4446
4447 //Change HT OP mode to 01 if any overlap protection enabled
4448 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4449 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4450 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4451 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4452
4453 {
4454 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4455 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4456 }
4457 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4458 {
4459 //Commenting because of CR 258588 WFA cert
4460 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4461 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4462 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4463 }
4464 else
4465 {
4466 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4467 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4468 }
4469 }
4470 }
4471 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4472 !psessionEntry->gLim11gParams.protectionEnabled)
4473 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004474 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4476 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4477 }
4478 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 {
4480 if(overlap)
4481 {
4482 //Overlap Legacy protection disabled.
4483 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4484
4485 // no HT op mode change if any of the overlap protection enabled.
4486 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4487 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4488 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4489 {
4490 //Check if there is a need to change HT OP mode.
4491 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4492 {
4493 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4494 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4495
4496 if(psessionEntry->gLimHt20Params.protectionEnabled)
4497 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4498 else
4499 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4500 }
4501 }
4502 }
4503 else
4504 {
4505 //Disable protection from 11G stations.
4506 psessionEntry->gLim11gParams.protectionEnabled = false;
4507 //Check if any other non-HT protection enabled.
4508 if(!psessionEntry->gLim11bParams.protectionEnabled)
4509 {
4510
4511 //Right now we are in HT OP Mixed mode.
4512 //Change HT op mode appropriately.
4513 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4514
4515 //Change HT OP mode to 01 if any overlap protection enabled
4516 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4517 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4518 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4519 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4520
4521 {
4522 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4523 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4524 }
4525 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4526 {
4527 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4528 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4529 }
4530 else
4531 {
4532 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4533 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4534 }
4535 }
4536 }
4537 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4538 !psessionEntry->gLim11gParams.protectionEnabled)
4539 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004540 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4542 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4543 }
4544 }
4545 //for station role
4546 else
4547 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004548 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004549 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4550 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4551 }
4552 }
4553 return eSIR_SUCCESS;
4554}
4555//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4556//This check will be done at the caller.
4557
4558/** -------------------------------------------------------------
4559\fn limEnableHtObssProtection
4560\brief based on cofig enables\disables obss protection.
4561\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4562\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4563\param tpUpdateBeaconParams pBeaconParams
4564\return None
4565 -------------------------------------------------------------*/
4566tSirRetStatus
4567limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4568 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4569{
4570
4571
Jeff Johnsone7245742012-09-05 17:12:55 -07004572 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 return eSIR_SUCCESS; // this protection is only for HT stations.
4574
4575 //overlapping protection configuration check.
4576 if(overlap)
4577 {
4578 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 }
4580 else
4581 {
4582 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4584 { //ToDo Update this field
4585 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004586 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004587 return eSIR_SUCCESS;
4588 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 {
4590 if(!pMac->lim.cfgProtection.obss)
4591 { //ToDo Update this field
4592 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004593 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 return eSIR_SUCCESS;
4595 }
4596 }
4597 }
4598
4599
Jeff Johnson295189b2012-06-20 16:38:30 -07004600 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4601 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4602 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004603 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 psessionEntry->beaconParams.gHTObssMode = true;
4605 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4606
4607 }
4608 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4609 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004610 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 psessionEntry->beaconParams.gHTObssMode = false;
4612 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4613
4614 }
4615//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4616 if (!enable && !overlap)
4617 {
4618 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4619 }
4620 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 {
4622 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4623 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004624 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 psessionEntry->beaconParams.gHTObssMode = true;
4626 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4627
4628 }
4629 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4630 {
4631
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004632 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 psessionEntry->beaconParams.gHTObssMode = false;
4634 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4635
4636 }
4637 }
4638 return eSIR_SUCCESS;
4639}
4640/** -------------------------------------------------------------
4641\fn limEnableHT20Protection
4642\brief based on cofig enables\disables protection from Ht20.
4643\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4644\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4645\param tpUpdateBeaconParams pBeaconParams
4646\return None
4647 -------------------------------------------------------------*/
4648tSirRetStatus
4649limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4650 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4651{
Jeff Johnsone7245742012-09-05 17:12:55 -07004652 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 return eSIR_SUCCESS; // this protection is only for HT stations.
4654
4655 //overlapping protection configuration check.
4656 if(overlap)
4657 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004658 }
4659 else
4660 {
4661 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004662 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4663 !psessionEntry->cfgProtection.ht20)
4664 {
4665 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004666 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004667 return eSIR_SUCCESS;
4668 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 {
4670 if(!pMac->lim.cfgProtection.ht20)
4671 {
4672 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004673 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004674 return eSIR_SUCCESS;
4675 }
4676 }
4677 }
4678
4679 if (enable)
4680 {
4681 //If we are AP and HT capable, we need to set the HT OP mode
4682 //appropriately.
4683
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4685 if(overlap)
4686 {
4687 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4688 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4689 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4690 {
4691 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4692 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4693 }
4694 }
4695 else
4696 {
4697 psessionEntry->gLimHt20Params.protectionEnabled = true;
4698 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4699 {
4700 //Commenting because of CR 258588 WFA cert
4701 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4702 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4703 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4704 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4705 }
4706 }
4707 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 {
4709 if(overlap)
4710 {
4711 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4712 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4713 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4714 {
4715 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4716 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4717 }
4718 }
4719 else
4720 {
4721 psessionEntry->gLimHt20Params.protectionEnabled = true;
4722 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4723 {
4724 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4725 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4726 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 }
4728 }
4729 }
4730
4731 //This part is common for staiton as well.
4732 if(false == psessionEntry->beaconParams.ht20Coexist)
4733 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004734 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004735 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4736 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4737 }
4738 }
4739 else if (true == psessionEntry->beaconParams.ht20Coexist)
4740 {
4741 //for AP role.
4742 //we need to take care of HT OP mode change if needed.
4743 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004744 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4745 if(overlap)
4746 {
4747 //Overlap Legacy protection disabled.
4748 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4749
4750 // no HT op mode change if any of the overlap protection enabled.
4751 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4752 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4753 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4754 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4755 {
4756
4757 //Check if there is a need to change HT OP mode.
4758 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4759 {
4760 if(psessionEntry->gLimHt20Params.protectionEnabled)
4761 {
4762 //Commented beacuse of CR 258588 for WFA Cert
4763 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4764 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4765 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4766 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4767 }
4768 else
4769 {
4770 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4771 }
4772 }
4773 }
4774 }
4775 else
4776 {
4777 //Disable protection from 11G stations.
4778 psessionEntry->gLimHt20Params.protectionEnabled = false;
4779
4780 //Change HT op mode appropriately.
4781 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4782 {
4783 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4784 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4785 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4786 }
4787 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004788 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4790 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4791 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 {
4793 if(overlap)
4794 {
4795 //Overlap Legacy protection disabled.
4796 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4797
4798 // no HT op mode change if any of the overlap protection enabled.
4799 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4800 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4801 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4802 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4803 {
4804
4805 //Check if there is a need to change HT OP mode.
4806 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4807 {
4808 if(psessionEntry->gLimHt20Params.protectionEnabled)
4809 {
4810 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4811 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4812 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4813 }
4814 else
4815 {
4816 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4817 }
4818 }
4819 }
4820 }
4821 else
4822 {
4823 //Disable protection from 11G stations.
4824 psessionEntry->gLimHt20Params.protectionEnabled = false;
4825
4826 //Change HT op mode appropriately.
4827 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4828 {
4829 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4830 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4831 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4832 }
4833 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004834 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4836 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4837 }
4838 //for station role
4839 else
4840 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004841 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4843 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4844 }
4845 }
4846
4847 return eSIR_SUCCESS;
4848}
4849
4850/** -------------------------------------------------------------
4851\fn limEnableHTNonGfProtection
4852\brief based on cofig enables\disables protection from NonGf.
4853\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4854\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4855\param tpUpdateBeaconParams pBeaconParams
4856\return None
4857 -------------------------------------------------------------*/
4858tSirRetStatus
4859limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4860 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4861{
Jeff Johnsone7245742012-09-05 17:12:55 -07004862 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 return eSIR_SUCCESS; // this protection is only for HT stations.
4864
4865 //overlapping protection configuration check.
4866 if(overlap)
4867 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004868 }
4869 else
4870 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 //normal protection config check
4872 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4873 !psessionEntry->cfgProtection.nonGf)
4874 {
4875 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004876 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 return eSIR_SUCCESS;
4878 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004879 {
4880 //normal protection config check
4881 if(!pMac->lim.cfgProtection.nonGf)
4882 {
4883 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004884 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 return eSIR_SUCCESS;
4886 }
4887 }
4888 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4890 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4891 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004892 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004893 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4894 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4895 }
4896 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4897 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004898 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004899 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4900 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4901 }
4902 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004903 {
4904 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4905 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004906 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004907 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4908 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4909 }
4910 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4911 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004912 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004913 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4914 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4915 }
4916 }
4917
4918 return eSIR_SUCCESS;
4919}
4920
4921/** -------------------------------------------------------------
4922\fn limEnableHTLsigTxopProtection
4923\brief based on cofig enables\disables LsigTxop protection.
4924\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4925\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4926\param tpUpdateBeaconParams pBeaconParams
4927\return None
4928 -------------------------------------------------------------*/
4929tSirRetStatus
4930limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4931 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4932{
Jeff Johnsone7245742012-09-05 17:12:55 -07004933 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 return eSIR_SUCCESS; // this protection is only for HT stations.
4935
4936 //overlapping protection configuration check.
4937 if(overlap)
4938 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 }
4940 else
4941 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004942 //normal protection config check
4943 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4944 !psessionEntry->cfgProtection.lsigTxop)
4945 {
4946 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004947 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 return eSIR_SUCCESS;
4949 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 {
4951 //normal protection config check
4952 if(!pMac->lim.cfgProtection.lsigTxop)
4953 {
4954 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004955 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004956 return eSIR_SUCCESS;
4957 }
4958 }
4959 }
4960
4961
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4963 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4964 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004965 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4967 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4968 }
4969 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4970 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004971 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004972 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4973 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4974 }
4975 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 {
4977 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4978 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004979 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004980 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4981 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4982 }
4983 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4984 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004985 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4987 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4988 }
4989 }
4990 return eSIR_SUCCESS;
4991}
4992//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4993//This check will be done at the caller.
4994/** -------------------------------------------------------------
4995\fn limEnableHtRifsProtection
4996\brief based on cofig enables\disables Rifs protection.
4997\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4998\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4999\param tpUpdateBeaconParams pBeaconParams
5000\return None
5001 -------------------------------------------------------------*/
5002tSirRetStatus
5003limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5004 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5005{
Jeff Johnsone7245742012-09-05 17:12:55 -07005006 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 return eSIR_SUCCESS; // this protection is only for HT stations.
5008
5009
5010 //overlapping protection configuration check.
5011 if(overlap)
5012 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 }
5014 else
5015 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005016 //normal protection config check
5017 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5018 !psessionEntry->cfgProtection.rifs)
5019 {
5020 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005021 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005022 return eSIR_SUCCESS;
5023 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005024 {
5025 //normal protection config check
5026 if(!pMac->lim.cfgProtection.rifs)
5027 {
5028 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005029 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005030 return eSIR_SUCCESS;
5031 }
5032 }
5033 }
5034
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5036 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5037 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5038 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005039 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005040 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5041 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5042 }
5043 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5044 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5045 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005046 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5048 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5049 }
5050 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005051 {
5052 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5053 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5054 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005055 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5057 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5058 }
5059 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5060 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5061 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005062 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5064 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5065 }
5066 }
5067 return eSIR_SUCCESS;
5068}
5069
5070// ---------------------------------------------------------------------
5071/**
5072 * limEnableShortPreamble
5073 *
5074 * FUNCTION:
5075 * Enable/Disable short preamble
5076 *
5077 * LOGIC:
5078 *
5079 * ASSUMPTIONS:
5080 *
5081 * NOTE:
5082 *
5083 * @param enable Flag to enable/disable short preamble
5084 * @return None
5085 */
5086
5087tSirRetStatus
5088limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5089{
5090 tANI_U32 val;
5091
5092 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5093 {
5094 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005095 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 return eSIR_FAILURE;
5097 }
5098
5099 if (!val)
5100 return eSIR_SUCCESS;
5101
5102 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5103 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005104 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005105 return eSIR_FAILURE;
5106 }
5107
5108 if (!val) // 11G short preamble switching is disabled.
5109 return eSIR_SUCCESS;
5110
5111 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5112 {
5113 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5114 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005115 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005116 psessionEntry->beaconParams.fShortPreamble = true;
5117 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5118 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5119 }
5120 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5121 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005122 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005123 psessionEntry->beaconParams.fShortPreamble = false;
5124 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5125 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5126 }
5127 }
5128
5129 return eSIR_SUCCESS;
5130 }
5131
5132/**
5133 * limTxComplete
5134 *
5135 * Function:
5136 * This is LIM's very own "TX MGMT frame complete" completion routine.
5137 *
5138 * Logic:
5139 * LIM wants to send a MGMT frame (broadcast or unicast)
5140 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5141 * LIM transmits the MGMT frame using the API:
5142 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5143 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5144 * HDD, if it determines that a TX completion routine (in this case
5145 * limTxComplete) has been provided, will invoke this callback
5146 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5147 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5148 *
5149 * Assumptions:
5150 * Presently, this is ONLY being used for MGMT frames/packets
5151 * TODO:
5152 * Would it do good for LIM to have some sort of "signature" validation to
5153 * ensure that the pData argument passed in was a buffer that was actually
5154 * allocated by LIM and/or is not corrupted?
5155 *
5156 * Note: FIXME and TODO
5157 * Looks like palPktFree() is interested in pPacket. But, when this completion
5158 * routine is called, only pData is made available to LIM!!
5159 *
5160 * @param void A pointer to pData. Shouldn't it be pPacket?!
5161 *
5162 * @return none
5163 */
5164void limTxComplete( tHalHandle hHal, void *pData )
5165{
5166 tpAniSirGlobal pMac;
5167 pMac = (tpAniSirGlobal)hHal;
5168
5169#ifdef FIXME_PRIMA
5170 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5171#ifdef TRACE_RECORD
5172 {
5173 tpSirMacMgmtHdr mHdr;
5174 v_U8_t *pRxBd;
5175 vos_pkt_t *pVosPkt;
5176 VOS_STATUS vosStatus;
5177
5178
5179
5180 pVosPkt = (vos_pkt_t *)pData;
5181 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5182
5183 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5184 {
5185 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005186
5187 }
5188 }
5189#endif
5190#endif
5191
5192 palPktFree( pMac->hHdd,
5193 HAL_TXRX_FRM_802_11_MGMT,
5194 (void *) NULL, // this is ignored and will likely be removed from this API
5195 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5196}
5197
5198/**
5199 * \brief This function updates lim global structure, if CB parameters in the BSS
5200 * have changed, and sends an indication to HAL also with the
5201 * updated HT Parameters.
5202 * This function does not detect the change in the primary channel, that is done as part
5203 * of channel Swtich IE processing.
5204 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5205 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5206 *
5207 *
5208 * \param pMac Pointer to global MAC structure
5209 *
5210 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5211 * Probe Response
5212 *
5213 * \param bssIdx BSS Index of the Bss to which Station is associated.
5214 *
5215 *
5216 */
5217
5218void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5219 tDot11fIEHTInfo *pHTInfo,
5220 tANI_U8 bssIdx,
5221 tpPESession psessionEntry)
5222{
Jeff Johnsone7245742012-09-05 17:12:55 -07005223 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005224#if !defined WLAN_FEATURE_VOWIFI
5225 tANI_U32 localPwrConstraint;
5226#endif
5227
5228 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005230 return;
5231
5232#if !defined WLAN_FEATURE_VOWIFI
5233 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005234 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 return;
5236 }
5237#endif
5238
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305239 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5240 {
5241 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5242 return;
5243 }
5244
Mihir Shetebc160b72014-08-22 14:10:39 +05305245 /*
5246 * Do not try to switch channel if RoC is in progress. RoC code path uses
5247 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5248 * has started listening on the channel requested as part of RoC, if we set
5249 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5250 * upper layers will think that the channel change is not successful and the
5251 * RoC from the upper layer perspective will never end...
5252 */
5253 if (pMac->lim.gpLimRemainOnChanReq)
5254 {
5255 limLog( pMac, LOGE, FL( "RoC is in progress"));
5256 return;
5257 }
5258
Jeff Johnsone7245742012-09-05 17:12:55 -07005259 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5260 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005261 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005262 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5263 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5264 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5265 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005266
5267 // Notify HAL
5268 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005269 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005270 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005271 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005272 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005273 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005274 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5275 pMac->lim.gpchangeChannelCallback = NULL;
5276 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005277
5278#if defined WLAN_FEATURE_VOWIFI
5279 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5280 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5281#else
5282 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5283 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5284#endif
5285
5286 //In case of IBSS, if STA should update HT Info IE in its beacons.
5287 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5288 {
5289 schSetFixedBeaconFields(pMac,psessionEntry);
5290 }
5291
5292 }
5293} // End limUpdateStaRunTimeHTParams.
5294
5295/**
5296 * \brief This function updates the lim global structure, if any of the
5297 * HT Capabilities have changed.
5298 *
5299 *
5300 * \param pMac Pointer to Global MAC structure
5301 *
5302 * \param pHTCapability Pointer to HT Capability Information Element
5303 * obtained from a Beacon or Probe Response
5304 *
5305 *
5306 *
5307 */
5308
5309void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5310 tDot11fIEHTCaps *pHTCaps )
5311{
5312
5313 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5314 {
5315 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5316 // Send change notification to HAL
5317 }
5318
5319 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5320 {
5321 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5322 // Send change notification to HAL
5323 }
5324
5325 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5326 {
5327 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5328 // Send change notification to HAL
5329 }
5330
5331
5332} // End limUpdateStaRunTimeHTCapability.
5333
5334/**
5335 * \brief This function updates lim global structure, if any of the HT
5336 * Info Parameters have changed.
5337 *
5338 *
5339 * \param pMac Pointer to the global MAC structure
5340 *
5341 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5342 * Probe Response
5343 *
5344 *
5345 */
5346
5347void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305348 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005349{
Jeff Johnsone7245742012-09-05 17:12:55 -07005350 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005351 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005352 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005353 // Send change notification to HAL
5354 }
5355
5356 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5357 {
5358 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5359 // Send change notification to HAL
5360 }
5361
5362 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5363 {
5364 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5365 // Send change notification to HAL
5366 }
5367
5368 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5369 {
5370 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5371 // Send change notification to HAL
5372 }
5373
5374 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5375 {
5376 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5377 }
5378
5379 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5380 {
5381 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5382 // Send change notification to HAL
5383 }
5384
5385 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5386 {
5387 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5388 // Send change notification to HAL
5389 }
5390
5391 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5392 {
5393 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5394 // Send change notification to HAL
5395 }
5396
5397 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5398 {
5399 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5400 // Send change notification to HAL
5401 }
5402
5403 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5404 {
5405 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5406 // Send change notification to HAL
5407 }
5408
5409 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5410 {
5411 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5412 // Send change notification to HAL
5413 }
5414
5415} // End limUpdateStaRunTimeHTInfo.
5416
5417
5418/** -------------------------------------------------------------
5419\fn limProcessHalIndMessages
5420\brief callback function for HAL indication
5421\param tpAniSirGlobal pMac
5422\param tANI_U32 mesgId
5423\param void *mesgParam
5424\return tSirRetStatu - status
5425 -------------------------------------------------------------*/
5426
5427tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5428{
5429 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5430 tSirMsgQ msg;
5431
5432 switch(msgId)
5433 {
5434 case SIR_LIM_DEL_TS_IND:
5435 case SIR_LIM_ADD_BA_IND:
5436 case SIR_LIM_DEL_BA_ALL_IND:
5437 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5438 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305439 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005440 msg.type = (tANI_U16) msgId;
5441 msg.bodyptr = msgParam;
5442 msg.bodyval = 0;
5443 break;
5444
5445 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305446 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005447 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005448 return eSIR_FAILURE;
5449 }
5450
5451 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5452 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305453 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005454 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5455 return eSIR_FAILURE;
5456 }
5457 return eSIR_SUCCESS;
5458}
5459
5460/** -------------------------------------------------------------
5461\fn limValidateDeltsReq
5462\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5463\param tpAniSirGlobal pMac
5464\param tpSirDeltsReq pDeltsReq
5465\param tSirMacAddr peerMacAddr
5466\return eSirRetStatus - status
5467 -------------------------------------------------------------*/
5468
5469tSirRetStatus
5470limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5471{
5472 tpDphHashNode pSta;
5473 tANI_U8 tsStatus;
5474 tSirMacTSInfo *tsinfo;
5475 tANI_U32 i;
5476 tANI_U8 tspecIdx;
5477 /* if sta
5478 * - verify assoc state
5479 * - del tspec locally
5480 * if ap,
5481 * - verify sta is in assoc state
5482 * - del sta tspec locally
5483 */
5484 if(pDeltsReq == NULL)
5485 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005486 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005487 return eSIR_FAILURE;
5488 }
5489
5490 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5491 {
5492 tANI_U32 val;
5493
5494 // station always talks to the AP
5495 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5496
5497 val = sizeof(tSirMacAddr);
5498 #if 0
5499 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5500 {
5501 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005502 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 return eSIR_FAILURE;
5504 }
5505 #endif// TO SUPPORT BT-AMP
5506 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5507
5508 }
5509 else
5510 {
5511 tANI_U16 assocId;
5512 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5513
5514 assocId = pDeltsReq->aid;
5515 if (assocId != 0)
5516 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5517 else
5518 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5519
5520 if (pSta != NULL)
5521 // TBD: check sta assoc state as well
5522 for (i =0; i < sizeof(tSirMacAddr); i++)
5523 macaddr[i] = pSta->staAddr[i];
5524 }
5525
5526 if (pSta == NULL)
5527 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005528 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005529 return eSIR_FAILURE;
5530 }
5531
5532 if ((! pSta->valid) ||
5533 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5534 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005535 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005536 return eSIR_FAILURE;
5537 }
5538
5539 pDeltsReq->req.wsmTspecPresent = 0;
5540 pDeltsReq->req.wmeTspecPresent = 0;
5541 pDeltsReq->req.lleTspecPresent = 0;
5542
5543 if ((pSta->wsmEnabled) &&
5544 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5545 pDeltsReq->req.wsmTspecPresent = 1;
5546 else if (pSta->wmeEnabled)
5547 pDeltsReq->req.wmeTspecPresent = 1;
5548 else if (pSta->lleEnabled)
5549 pDeltsReq->req.lleTspecPresent = 1;
5550 else
5551 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005552 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 return eSIR_FAILURE;
5554 }
5555
5556 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5557 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305558 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005559 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305561 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005562
5563 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005564
5565 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5566 != eSIR_SUCCESS)
5567 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005568 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5570 return eSIR_FAILURE;
5571 }
5572 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5573 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5574 {
5575 //edca only now.
5576 }
5577 else
5578 {
5579 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5580 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5581 {
5582 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305583 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5584 pSta->staIndex,
5585 tspecIdx,
5586 pDeltsReq->req,
5587 psessionEntry->peSessionId,
5588 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005590 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005591 tsinfo->traffic.userPrio);
5592 return eSIR_FAILURE;
5593 }
5594 }
5595 }
5596 return eSIR_SUCCESS;
5597}
5598
5599/** -------------------------------------------------------------
5600\fn limRegisterHalIndCallBack
5601\brief registers callback function to HAL for any indication.
5602\param tpAniSirGlobal pMac
5603\return none.
5604 -------------------------------------------------------------*/
5605void
5606limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5607{
5608 tSirMsgQ msg;
5609 tpHalIndCB pHalCB;
5610
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305611 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5612 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005613 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305614 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005615 return;
5616 }
5617
5618 pHalCB->pHalIndCB = limProcessHalIndMessages;
5619
5620 msg.type = WDA_REGISTER_PE_CALLBACK;
5621 msg.bodyptr = pHalCB;
5622 msg.bodyval = 0;
5623
Jeff Johnsone7245742012-09-05 17:12:55 -07005624 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005625 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5626 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305627 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005628 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005629 }
5630
5631 return;
5632}
5633
5634
5635/** -------------------------------------------------------------
5636\fn limProcessAddBaInd
5637
5638\brief handles the BA activity check timeout indication coming from HAL.
5639 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5640\param tpAniSirGlobal pMac
5641\param tSirMsgQ limMsg
5642\return None
5643-------------------------------------------------------------*/
5644void
5645limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5646{
5647 tANI_U8 i;
5648 tANI_U8 tid;
5649 tANI_U16 assocId;
5650 tpDphHashNode pSta;
5651 tpAddBaCandidate pBaCandidate;
5652 tANI_U32 baCandidateCnt;
5653 tpBaActivityInd pBaActivityInd;
5654 tpPESession psessionEntry;
5655 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005656#ifdef FEATURE_WLAN_TDLS
5657 boolean htCapable = FALSE;
5658#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005659
5660
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005661 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005662 return;
5663
5664 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5665 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5666
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005667 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005668 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005669 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305670 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005671 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005672 return;
5673 }
5674
5675 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005676#ifdef FEATURE_WLAN_TDLS
5677 if ((baCandidateCnt > pMac->lim.maxStation))
5678#else
5679 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5680#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005681 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305682 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005683 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 return;
5685 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005686
5687#ifdef FEATURE_WLAN_TDLS
5688 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5689 //AP capability
5690 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5691
5692 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5693 {
5694 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5695 if ((NULL == pSta) || (!pSta->valid))
5696 continue;
5697
5698 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5699 htCapable = pSta->mlmStaContext.htCapability;
5700 else
5701 htCapable = psessionEntry->htCapability;
5702
5703 if (htCapable)
5704 break;
5705 }
5706 if (!htCapable)
5707 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305708 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005709 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005710 return;
5711 }
5712#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005713
5714 //delete the complete dialoguetoken linked list
5715 limDeleteDialogueTokenList(pMac);
5716 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5717
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005718 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005719 {
5720 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005721 if ((NULL == pSta) || (!pSta->valid))
5722 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005723
5724 for (tid=0; tid<STACFG_MAX_TC; tid++)
5725 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005726 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005727 (pBaCandidate->baInfo[tid].fBaEnable))
5728 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305729 limLog(pMac, LOG1,
5730 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5731 pSta->staIndex, tid,
5732 pBaCandidate->baInfo[tid].startingSeqNum);
5733 limPostMlmAddBAReq(pMac, pSta, tid,
5734 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005735 }
5736 }
5737 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305738 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005739 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005740 return;
5741}
5742
5743
5744/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745\fn limDeleteBASessions
5746\brief Deletes all the exisitng BA sessions for given session
5747 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005748\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749\param tpPESession pSessionEntry
5750\param tANI_U32 baDirection
5751\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005752-------------------------------------------------------------*/
5753
5754void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005755limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305756 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005757{
5758 tANI_U32 i;
5759 tANI_U8 tid;
5760 tpDphHashNode pSta;
5761
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005762 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005763 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005764 limLog(pMac, LOGE, FL("Session does not exist"));
5765 }
5766 else
5767 {
5768 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005770 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5771 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5772 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5773 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005774 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005775 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005776 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005777 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5778 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005779 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005780 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5781 (baDirection & BA_INITIATOR))
5782 {
5783 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305784 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005785 pSessionEntry);
5786 }
5787 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5788 (baDirection & BA_RECIPIENT))
5789 {
5790 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305791 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005792 pSessionEntry);
5793 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005794 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005795 }
5796 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005797 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5798 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5799 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005800 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005801 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5802 &pSessionEntry->dph.dphHashTable);
5803 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005804 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005805 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5806 (baDirection & BA_INITIATOR))
5807 {
5808 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305809 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005810 pSessionEntry);
5811 }
5812 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5813 (baDirection & BA_RECIPIENT))
5814 {
5815 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305816 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005817 pSessionEntry);
5818 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005819 }
5820 }
5821 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005822 }
5823}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005824
5825/** -------------------------------------------------------------
5826\fn limDelAllBASessions
5827\brief Deletes all the exisitng BA sessions.
5828\param tpAniSirGlobal pMac
5829\return None
5830-------------------------------------------------------------*/
5831
5832void limDelAllBASessions(tpAniSirGlobal pMac)
5833{
5834 tANI_U32 i;
5835 tpPESession pSessionEntry;
5836
5837 for (i = 0; i < pMac->lim.maxBssId; i++)
5838 {
5839 pSessionEntry = peFindSessionBySessionId(pMac, i);
5840 if (pSessionEntry)
5841 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305842 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5843 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005844 }
5845 }
5846}
5847
5848/** -------------------------------------------------------------
5849\fn limDelAllBASessionsBtc
5850\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5851 band.
5852\param tpAniSirGlobal pMac
5853\return None
5854-------------------------------------------------------------*/
5855
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005856void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005857{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005858 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005859 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005860 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5861 &sessionId);
5862 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005863 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005864 PELOGW(limLog(pMac, LOGW,
5865 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305866 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305867 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005868 }
5869}
5870
Jeff Johnson295189b2012-06-20 16:38:30 -07005871/** -------------------------------------------------------------
5872\fn limProcessDelTsInd
5873\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5874 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5875\param tpAniSirGlobal pMac
5876\param tSirMsgQ limMsg
5877\return None
5878-------------------------------------------------------------*/
5879void
5880limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5881{
5882 tpDphHashNode pSta;
5883 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5884 tpSirDeltsReq pDelTsReq = NULL;
5885 tSirMacAddr peerMacAddr;
5886 tpSirDeltsReqInfo pDelTsReqInfo;
5887 tpLimTspecInfo pTspecInfo;
5888 tpPESession psessionEntry;
5889 tANI_U8 sessionId;
5890
5891if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005893 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305894 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005895 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005896 return;
5897 }
5898
5899 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5900 if(pTspecInfo->inuse == false)
5901 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005902 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005903 goto error1;
5904 }
5905
5906 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5907 if(pSta == NULL)
5908 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005909 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005910 pTspecInfo->assocId);
5911 goto error1;
5912 }
5913
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305914 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5915 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005916 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305917 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005918 goto error1;
5919 }
5920
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305921 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005922
5923 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305924 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305926 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005927
5928
5929 //validate the req
5930 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5931 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005932 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005933 goto error2;
5934 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305935 limLog(pMac, LOG1, "Sent DELTS request to station with "
5936 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5937 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005938
5939 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5940 psessionEntry);
5941
5942 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305943 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5944 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 goto error3;
5948 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305949 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005950
5951 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305952 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305954 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005955
5956 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5957
5958error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305959 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005960error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305961 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005962error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305963 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005964 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 return;
5966}
5967
5968/**
5969 * \brief Setup an A-MPDU/BA session
5970 *
5971 * \sa limPostMlmAddBAReq
5972 *
5973 * \param pMac The global tpAniSirGlobal object
5974 *
5975 * \param pStaDs DPH Hash Node object of peer STA
5976 *
5977 * \param tid TID for which a BA is being setup.
5978 * If this is set to 0xFFFF, then we retrieve
5979 * the default TID from the CFG
5980 *
5981 * \return eSIR_SUCCESS if setup completes successfully
5982 * eSIR_FAILURE is some problem is encountered
5983 */
5984tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5985 tpDphHashNode pStaDs,
5986 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5987{
5988 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005989 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 tpDialogueToken dialogueTokenNode;
5991 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005992
Jeff Johnson295189b2012-06-20 16:38:30 -07005993 // Check if the peer is a 11n capable STA
5994 // FIXME - Need a 11n peer indication in DPH.
5995 // For now, using the taurusPeer attribute
5996 //if( 0 == pStaDs->taurusPeer == )
5997 //return eSIR_SUCCESS;
5998
5999 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306000 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6001 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006002 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306003 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006004 status = eSIR_MEM_ALLOC_FAILED;
6005 goto returnFailure;
6006 }
6007
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306008 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006009
6010 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306011 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006012 pMlmAddBAReq->peerMacAddr,
6013 pStaDs->staAddr,
6014 sizeof( tSirMacAddr ));
6015
6016 // Update the TID
6017 pMlmAddBAReq->baTID = tid;
6018
6019 // Determine the supported BA policy of local STA
6020 // for the TID of interest
6021 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6022
6023 // BA Buffer Size
6024 // Requesting the ADDBA recipient to populate the size.
6025 // If ADDBA is accepted, a non-zero buffer size should
6026 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306027 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6028 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6029 {
6030 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6031 causing very low throughput in HT40 case */
6032 limLog( pMac, LOGW,
6033 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6034 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6035 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306036 else if (pMac->miracastVendorConfig)
6037 {
6038 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6039 {
6040 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6041 status = eSIR_FAILURE;
6042 goto returnFailure;
6043 }
6044
6045 pMlmAddBAReq->baBufferSize = val;
6046 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306047 else
6048 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006049
6050 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306051 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 -07006052 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6053 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306054 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006055
6056 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006057 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006058 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006059 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006060 status = eSIR_FAILURE;
6061 goto returnFailure;
6062 }
6063 pMlmAddBAReq->baTimeout = val; // In TU's
6064
6065 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006066 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006067 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6068 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6069
6070 // BA Starting Sequence Number
6071 pMlmAddBAReq->baSSN = startingSeqNum;
6072
6073 /* Update PE session Id*/
6074 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6075
6076 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6077
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006078 dialogueTokenNode = limAssignDialogueToken(pMac);
6079 if (NULL == dialogueTokenNode)
6080 {
6081 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6082 status = eSIR_FAILURE;
6083 goto returnFailure;
6084 }
6085
Jeff Johnson295189b2012-06-20 16:38:30 -07006086 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006087 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006088 dialogueTokenNode->assocId = pStaDs->assocId;
6089 dialogueTokenNode->tid = tid;
6090 // Send ADDBA Req to MLME
6091 limPostMlmMessage( pMac,
6092 LIM_MLM_ADDBA_REQ,
6093 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006094 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006095
6096returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306097 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006098 return status;
6099}
6100
6101/**
6102 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6103 * will then send an ADDBA Rsp to peer MAC entity
6104 * with the appropriate ADDBA status code
6105 *
6106 * \sa limPostMlmAddBARsp
6107 *
6108 * \param pMac The global tpAniSirGlobal object
6109 *
6110 * \param peerMacAddr MAC address of peer entity that will
6111 * be the recipient of this ADDBA Rsp
6112 *
6113 * \param baStatusCode ADDBA Rsp status code
6114 *
6115 * \param baDialogToken ADDBA Rsp dialog token
6116 *
6117 * \param baTID TID of interest
6118 *
6119 * \param baPolicy The BA policy
6120 *
6121 * \param baBufferSize The BA buffer size
6122 *
6123 * \param baTimeout BA timeout in TU's
6124 *
6125 * \return eSIR_SUCCESS if setup completes successfully
6126 * eSIR_FAILURE is some problem is encountered
6127 */
6128tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6129 tSirMacAddr peerMacAddr,
6130 tSirMacStatusCodes baStatusCode,
6131 tANI_U8 baDialogToken,
6132 tANI_U8 baTID,
6133 tANI_U8 baPolicy,
6134 tANI_U16 baBufferSize,
6135 tANI_U16 baTimeout,
6136 tpPESession psessionEntry)
6137{
6138tSirRetStatus status = eSIR_SUCCESS;
6139tpLimMlmAddBARsp pMlmAddBARsp;
6140
6141 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306142 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6143 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006144 {
6145 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306146 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006147 status );
6148
6149 status = eSIR_MEM_ALLOC_FAILED;
6150 goto returnFailure;
6151 }
6152
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306153 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006154
6155 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306156 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006157 pMlmAddBARsp->peerMacAddr,
6158 peerMacAddr,
6159 sizeof( tSirMacAddr ));
6160
6161 pMlmAddBARsp->baDialogToken = baDialogToken;
6162 pMlmAddBARsp->addBAResultCode = baStatusCode;
6163 pMlmAddBARsp->baTID = baTID;
6164 pMlmAddBARsp->baPolicy = baPolicy;
6165 pMlmAddBARsp->baBufferSize = baBufferSize;
6166 pMlmAddBARsp->baTimeout = baTimeout;
6167
6168 /* UPdate PE session ID*/
6169 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6170
6171 // Send ADDBA Rsp to MLME
6172 limPostMlmMessage( pMac,
6173 LIM_MLM_ADDBA_RSP,
6174 (tANI_U32 *) pMlmAddBARsp );
6175
6176returnFailure:
6177
6178 return status;
6179}
6180
6181/**
6182 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6183 * will then send an DELBA Ind to peer MAC entity
6184 * with the appropriate DELBA status code
6185 *
6186 * \sa limPostMlmDelBAReq
6187 *
6188 * \param pMac The global tpAniSirGlobal object
6189 *
6190 * \param pSta DPH Hash Node object of peer MAC entity
6191 * for which the BA session is being deleted
6192 *
6193 * \param baDirection DELBA direction
6194 *
6195 * \param baTID TID for which the BA session is being deleted
6196 *
6197 * \param baReasonCode DELBA Req reason code
6198 *
6199 * \return eSIR_SUCCESS if setup completes successfully
6200 * eSIR_FAILURE is some problem is encountered
6201 */
6202tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6203 tpDphHashNode pSta,
6204 tANI_U8 baDirection,
6205 tANI_U8 baTID,
6206 tSirMacReasonCodes baReasonCode,
6207 tpPESession psessionEntry)
6208{
6209tSirRetStatus status = eSIR_SUCCESS;
6210tpLimMlmDelBAReq pMlmDelBAReq;
6211tLimBAState curBaState;
6212
6213if(NULL == pSta)
6214 return eSIR_FAILURE;
6215
6216LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6217
6218 // Need to validate the current BA State.
6219 if( eLIM_BA_STATE_IDLE != curBaState)
6220 {
6221 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006222 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006223 baTID,
6224 curBaState);
6225
6226 status = eSIR_FAILURE;
6227 goto returnFailure;
6228 }
6229
6230 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306231 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6232 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006233 {
6234 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306235 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006236 status );
6237
6238 status = eSIR_MEM_ALLOC_FAILED;
6239 goto returnFailure;
6240 }
6241
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306242 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006243
6244 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306245 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006246 pMlmDelBAReq->peerMacAddr,
6247 pSta->staAddr,
6248 sizeof( tSirMacAddr ));
6249
6250 pMlmDelBAReq->baDirection = baDirection;
6251 pMlmDelBAReq->baTID = baTID;
6252 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6253
6254 /* Update PE session ID*/
6255 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6256
6257 //we don't have valid BA session for the given direction.
6258 // HDD wants to get the BA session deleted on PEER in this case.
6259 // in this case we just need to send DelBA to the peer.
6260 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6261 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6262 {
6263 // Send DELBA Ind over the air
6264 if( eSIR_SUCCESS !=
6265 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6266 status = eSIR_FAILURE;
6267
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306268 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006269 return status;
6270 }
6271
6272
6273 // Update the BA state in STA
6274 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6275
6276 // Send DELBA Req to MLME
6277 limPostMlmMessage( pMac,
6278 LIM_MLM_DELBA_REQ,
6279 (tANI_U32 *) pMlmDelBAReq );
6280
6281returnFailure:
6282
6283 return status;
6284}
6285
6286/**
6287 * \brief Send WDA_ADDBA_REQ to HAL, in order
6288 * to setup a new BA session with a peer
6289 *
6290 * \sa limPostMsgAddBAReq
6291 *
6292 * \param pMac The global tpAniSirGlobal object
6293 *
6294 * \param pSta Runtime, STA-related configuration cached
6295 * in the HashNode object
6296 *
6297 * \param baDialogToken The Action Frame dialog token
6298 *
6299 * \param baTID TID for which the BA session is being setup
6300 *
6301 * \param baPolicy BA Policy
6302 *
6303 * \param baBufferSize The requested BA buffer size
6304 *
6305 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6306 *
6307 * \param baSSN Starting Sequence Number for this BA session
6308 *
6309 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6310 *
6311 * \return none
6312 *
6313 */
6314tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6315 tpDphHashNode pSta,
6316 tANI_U8 baDialogToken,
6317 tANI_U8 baTID,
6318 tANI_U8 baPolicy,
6319 tANI_U16 baBufferSize,
6320 tANI_U16 baTimeout,
6321 tANI_U16 baSSN,
6322 tANI_U8 baDirection,
6323 tpPESession psessionEntry)
6324{
6325tpAddBAParams pAddBAParams = NULL;
6326tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006327tSirMsgQ msgQ;
6328
6329#ifdef WLAN_SOFTAP_VSTA_FEATURE
6330 // we can only do BA on "hard" STAs
6331 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6332 {
6333 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306334 limLog( pMac, LOGE,
6335 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006336 goto returnFailure;
6337 }
6338#endif //WLAN_SOFTAP_VSTA_FEATURE
6339
6340 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306341 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6342 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006343 {
6344 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306345 FL("AllocateMemory failed")
6346 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006347
6348 retCode = eSIR_MEM_ALLOC_FAILED;
6349 goto returnFailure;
6350 }
6351
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306352 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006353
6354 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306355 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006356 (void *) pAddBAParams->peerMacAddr,
6357 (void *) pSta->staAddr,
6358 sizeof( tSirMacAddr ));
6359
6360 // Populate the REQ parameters
6361 pAddBAParams->staIdx = pSta->staIndex;
6362 pAddBAParams->baDialogToken = baDialogToken;
6363 pAddBAParams->baTID = baTID;
6364 pAddBAParams->baPolicy = baPolicy;
6365 pAddBAParams->baBufferSize = baBufferSize;
6366 pAddBAParams->baTimeout = baTimeout;
6367 pAddBAParams->baSSN = baSSN;
6368 pAddBAParams->baDirection = baDirection;
6369 pAddBAParams->respReqd = 1;
6370
6371 /* UPdate PE session ID */
6372 pAddBAParams->sessionId = psessionEntry->peSessionId;
6373
6374 // Post WDA_ADDBA_REQ to HAL.
6375 msgQ.type = WDA_ADDBA_REQ;
6376 //
6377 // FIXME_AMPDU
6378 // A global counter (dialog token) is required to keep track of
6379 // all PE <-> HAL communication(s)
6380 //
6381 msgQ.reserved = 0;
6382 msgQ.bodyptr = pAddBAParams;
6383 msgQ.bodyval = 0;
6384
6385 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306386 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6387 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6388 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6389 pAddBAParams->baTimeout, pAddBAParams->baTID,
6390 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6391 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006392
6393 //defer any other message until we get response back.
6394 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6395
Jeff Johnsone7245742012-09-05 17:12:55 -07006396 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006397#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6398 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6399#endif //FEATURE_WLAN_DIAG_SUPPORT
6400
6401 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6402 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006403 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006404 retCode );
6405 else
6406 return retCode;
6407
6408returnFailure:
6409
6410 // Clean-up...
6411 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306412 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006413
6414 return retCode;
6415
6416}
6417
6418/**
6419 * \brief Send WDA_DELBA_IND to HAL, in order
6420 * to delete an existing BA session with peer
6421 *
6422 * \sa limPostMsgDelBAInd
6423 *
6424 * \param pMac The global tpAniSirGlobal object
6425 *
6426 * \param pSta Runtime, STA-related configuration cached
6427 * in the HashNode object
6428 *
6429 * \param baTID TID for which the BA session is being setup
6430 *
6431 * \param baDirection Identifies whether the DELBA Ind was
6432 * sent by the BA initiator or recipient
6433 *
6434 * \return none
6435 *
6436 */
6437tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6438 tpDphHashNode pSta,
6439 tANI_U8 baTID,
6440 tANI_U8 baDirection,
6441 tpPESession psessionEntry)
6442{
6443tpDelBAParams pDelBAParams = NULL;
6444tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006445tSirMsgQ msgQ;
6446
6447 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306448 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6449 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006450 {
6451 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306452 FL("AllocateMemory failed")
6453 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006454
6455 retCode = eSIR_MEM_ALLOC_FAILED;
6456 goto returnFailure;
6457 }
6458
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306459 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006460
6461 // Populate the REQ parameters
6462 pDelBAParams->staIdx = pSta->staIndex;
6463 pDelBAParams->baTID = baTID;
6464 pDelBAParams->baDirection = baDirection;
6465
6466 /* Update PE session ID */
6467
6468
6469 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6470 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6471
6472 // Post WDA_DELBA_IND to HAL.
6473 msgQ.type = WDA_DELBA_IND;
6474 //
6475 // FIXME:
6476 // A global counter (dialog token) is required to keep track of
6477 // all PE <-> HAL communication(s)
6478 //
6479 msgQ.reserved = 0;
6480 msgQ.bodyptr = pDelBAParams;
6481 msgQ.bodyval = 0;
6482
6483 limLog( pMac, LOGW,
6484 FL( "Sending SIR_HAL_DELBA_IND..." ));
6485
Jeff Johnsone7245742012-09-05 17:12:55 -07006486 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006487#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6488 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6489#endif //FEATURE_WLAN_DIAG_SUPPORT
6490
6491 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6492 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006493 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006494 retCode );
6495 else
6496 {
6497 // Update LIM's internal cache...
6498 if( eBA_INITIATOR == baDirection)
6499 {
6500 pSta->tcCfg[baTID].fUseBATx = 0;
6501 pSta->tcCfg[baTID].txBufSize = 0;
6502 }
6503 else
6504 {
6505 pSta->tcCfg[baTID].fUseBARx = 0;
6506 pSta->tcCfg[baTID].rxBufSize = 0;
6507 }
6508
6509 return retCode;
6510 }
6511
6512returnFailure:
6513
6514 // Clean-up...
6515 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306516 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006517
6518 return retCode;
6519
6520}
6521
6522/**
6523 * @function : limPostSMStateUpdate()
6524 *
6525 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6526 *
6527 * LOGIC:
6528 *
6529 * ASSUMPTIONS:
6530 * NA
6531 *
6532 * NOTE:
6533 * NA
6534 *
6535 * @param pMac - Pointer to Global MAC structure
6536 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6537 * @return None
6538 */
6539tSirRetStatus
6540limPostSMStateUpdate(tpAniSirGlobal pMac,
6541 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6542{
6543 tSirRetStatus retCode = eSIR_SUCCESS;
6544 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006545 tpSetMIMOPS pMIMO_PSParams;
6546
6547 msgQ.reserved = 0;
6548 msgQ.type = WDA_SET_MIMOPS_REQ;
6549
6550 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306551 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6552 if ( NULL == pMIMO_PSParams )
6553 {
6554 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006555 return eSIR_MEM_ALLOC_FAILED;
6556 }
6557
6558 pMIMO_PSParams->htMIMOPSState = state;
6559 pMIMO_PSParams->staIdx = staIdx;
6560 pMIMO_PSParams->fsendRsp = true;
6561 msgQ.bodyptr = pMIMO_PSParams;
6562 msgQ.bodyval = 0;
6563
6564 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6565
Jeff Johnsone7245742012-09-05 17:12:55 -07006566 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006567 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6568 if (eSIR_SUCCESS != retCode)
6569 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006570 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306571 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006572 return retCode;
6573 }
6574
6575 return retCode;
6576}
6577
6578void limPktFree (
6579 tpAniSirGlobal pMac,
6580 eFrameType frmType,
6581 tANI_U8 *pRxPacketInfo,
6582 void *pBody)
6583{
6584 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006585}
6586
6587/**
6588 * limGetBDfromRxPacket()
6589 *
6590 *FUNCTION:
6591 * This function is called to get pointer to Polaris
6592 * Buffer Descriptor containing MAC header & other control
6593 * info from the body of the message posted to LIM.
6594 *
6595 *LOGIC:
6596 * NA
6597 *
6598 *ASSUMPTIONS:
6599 * NA
6600 *
6601 *NOTE:
6602 * NA
6603 *
6604 * @param body - Received message body
6605 * @param pRxPacketInfo - Pointer to received BD
6606 * @return None
6607 */
6608
6609void
6610limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6611{
Jeff Johnson295189b2012-06-20 16:38:30 -07006612 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006613} /*** end limGetBDfromRxPacket() ***/
6614
6615
6616
6617
6618
6619void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6620{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306621 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006622}
6623
6624
6625void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6626{
6627 tANI_U8 i;
6628 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6629
6630 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6631 {
6632 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6633 {
6634 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6635 fFound = eANI_BOOLEAN_TRUE;
6636 break;
6637 }
6638 }
6639 if(eANI_BOOLEAN_FALSE == fFound)
6640 {
6641 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6642 {
6643 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6644 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6645 }
6646 else
6647 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006648 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 }
6650 }
6651}
6652
6653
6654/**
6655 * @function : limIsChannelValidForChannelSwitch()
6656 *
6657 * @brief : This function checks if the channel to which AP
6658 * is expecting us to switch, is a valid channel for us.
6659 * LOGIC:
6660 *
6661 * ASSUMPTIONS:
6662 * NA
6663 *
6664 * NOTE:
6665 * NA
6666 *
6667 * @param pMac - Pointer to Global MAC structure
6668 * @param channel - New channel to which we are expected to move
6669 * @return None
6670 */
6671tAniBool
6672limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6673{
6674 tANI_U8 index;
6675 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6676 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6677
6678 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6679 (tANI_U8 *)validChannelList,
6680 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6681 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006682 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006683 return (eSIR_FALSE);
6684 }
6685
6686 for(index = 0; index < validChannelListLen; index++)
6687 {
6688 if(validChannelList[index] == channel)
6689 return (eSIR_TRUE);
6690 }
6691
6692 /* channel does not belong to list of valid channels */
6693 return (eSIR_FALSE);
6694}
6695
6696/**------------------------------------------------------
6697\fn __limFillTxControlParams
6698\brief Fill the message for stopping/resuming tx.
6699
6700\param pMac
6701\param pTxCtrlMsg - Pointer to tx control message.
6702\param type - Which way we want to stop/ resume tx.
6703\param mode - To stop/resume.
6704 -------------------------------------------------------*/
6705static eHalStatus
6706__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6707 tLimQuietTxMode type, tLimControlTx mode)
6708{
6709
6710 //TBD-RAJESH HOW TO GET sessionEntry?????
6711 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6712
6713 if (mode == eLIM_STOP_TX)
6714 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6715 else
6716 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6717
6718 switch (type)
6719 {
6720 case eLIM_TX_ALL:
6721 /** Stops/resumes transmission completely */
6722 pTxCtrlMsg->fCtrlGlobal = 1;
6723 break;
6724
6725 case eLIM_TX_BSS_BUT_BEACON:
6726 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6727 * stop beacon transmission.
6728 */
6729 pTxCtrlMsg->ctrlBss = 1;
6730 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6731 break;
6732
6733 case eLIM_TX_STA:
6734 /** Memory for station bitmap is allocated dynamically in caller of this
6735 * so decode properly here and fill the bitmap. Now not implemented,
6736 * fall through.
6737 */
6738 case eLIM_TX_BSS:
6739 //Fall thru...
6740 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006741 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006742 return eHAL_STATUS_FAILURE;
6743 }
6744
6745 return eHAL_STATUS_SUCCESS;
6746}
6747
6748/**
6749 * @function : limFrameTransmissionControl()
6750 *
6751 * @brief : This API is called by the user to halt/resume any frame
6752 * transmission from the device. If stopped, all frames will be
6753 * queued starting from hardware. Then back-pressure
6754 * is built till the driver.
6755 * LOGIC:
6756 *
6757 * ASSUMPTIONS:
6758 * NA
6759 *
6760 * NOTE:
6761 * NA
6762 *
6763 * @param pMac - Pointer to Global MAC structure
6764 * @return None
6765 */
6766void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6767{
6768
6769 eHalStatus status = eHAL_STATUS_FAILURE;
6770 tpTxControlParams pTxCtrlMsg;
6771 tSirMsgQ msgQ;
6772 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6773
6774 /** Allocate only required number of bytes for station bitmap
6775 * Make it to align to 4 byte boundary */
6776 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6777
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306778 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6779 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306781 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 return;
6783 }
6784
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306785 vos_mem_set((void *) pTxCtrlMsg,
6786 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006787 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6788 if (status != eHAL_STATUS_SUCCESS)
6789 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306790 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006791 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006792 return;
6793 }
6794
6795 msgQ.bodyptr = (void *) pTxCtrlMsg;
6796 msgQ.bodyval = 0;
6797 msgQ.reserved = 0;
6798 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6799
Jeff Johnsone7245742012-09-05 17:12:55 -07006800 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006801 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6802 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306803 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006804 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 return;
6806 }
6807
6808 if (mode == eLIM_STOP_TX)
6809 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306810 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 }
6812 else
6813 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306814 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006815 }
6816 return;
6817}
6818
6819
6820/**
6821 * @function : limRestorePreChannelSwitchState()
6822 *
6823 * @brief : This API is called by the user to undo any
6824 * specific changes done on the device during
6825 * channel switch.
6826 * LOGIC:
6827 *
6828 * ASSUMPTIONS:
6829 * NA
6830 *
6831 * NOTE:
6832 * NA
6833 *
6834 * @param pMac - Pointer to Global MAC structure
6835 * @return None
6836 */
6837
6838tSirRetStatus
6839limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6840{
6841
6842 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006843 tANI_U32 val = 0;
6844
6845 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6846 return retCode;
6847
6848 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006849 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006850
6851 /* Restore the frame transmission, all the time. */
6852 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6853
6854 /* Free to enter BMPS */
6855 limSendSmePostChannelSwitchInd(pMac);
6856
6857 //Background scan is now enabled by SME
6858 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6859 {
6860 /* Enable background scan if already enabled, else don't bother */
6861 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6862 &val)) != eSIR_SUCCESS)
6863
6864 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006865 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006866 return (retCode);
6867 }
6868
6869 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6870 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006871 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6872 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006873 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6874 {
6875 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6876 return (eSIR_FAILURE);
6877 }
6878
6879 }
6880 }
6881
6882 /* Enable heartbeat timer */
6883 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6884 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006885 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6886 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6887 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6888 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006889 {
6890 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6891 return (eSIR_FAILURE);
6892 }
6893 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006894 return (retCode);
6895}
6896
6897
6898/**--------------------------------------------
6899\fn limRestorePreQuietState
6900\brief Restore the pre quiet state
6901
6902\param pMac
6903\return NONE
6904---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006905tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006906{
6907
6908 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006909 tANI_U32 val = 0;
6910
6911 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6912 return retCode;
6913
6914 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006915 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006916
6917 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006918 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006919 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6920
6921
6922 //Background scan is now enabled by SME
6923 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6924 {
6925 /* Enable background scan if already enabled, else don't bother */
6926 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6927 &val)) != eSIR_SUCCESS)
6928
6929 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006930 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 return (retCode);
6932 }
6933
6934 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6935 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006936 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006937 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6938 {
6939 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6940 return (eSIR_FAILURE);
6941 }
6942
6943 }
6944 }
6945
6946 /* Enable heartbeat timer */
6947 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6948 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006949 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006950 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 {
6952 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6953 return (eSIR_FAILURE);
6954 }
6955 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006956 return (retCode);
6957}
6958
6959
6960/**
6961 * @function: limPrepareFor11hChannelSwitch()
6962 *
6963 * @brief : This API is called by the user to prepare for
6964 * 11h channel switch. As of now, the API does
6965 * very minimal work. User can add more into the
6966 * same API if needed.
6967 * LOGIC:
6968 *
6969 * ASSUMPTIONS:
6970 * NA
6971 *
6972 * NOTE:
6973 * NA
6974 *
6975 * @param pMac - Pointer to Global MAC structure
6976 * @param psessionEntry
6977 * @return None
6978 */
6979void
6980limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6981{
Jeff Johnson295189b2012-06-20 16:38:30 -07006982 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6983 return;
6984
6985 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006986 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006987
6988 /* Disable, Stop background scan if enabled and running */
6989 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6990
6991 /* Stop heart-beat timer to stop heartbeat disassociation */
6992 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6993
6994 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6995 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6996 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006997 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006998 /* Stop ongoing scanning if any */
6999 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7000 {
7001 //Set the resume channel to Any valid channel (invalid).
7002 //This will instruct HAL to set it to any previous valid channel.
7003 peSetResumeChannel(pMac, 0, 0);
7004 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7005 }
7006 else
7007 {
7008 limRestorePreChannelSwitchState(pMac, psessionEntry);
7009 }
7010 return;
7011 }
7012 else
7013 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007014 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007015 /** We are safe to switch channel at this point */
7016 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7017 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007018}
7019
7020
7021
7022/**----------------------------------------------------
7023\fn limGetNwType
7024
7025\brief Get type of the network from data packet or beacon
7026\param pMac
7027\param channelNum - Channel number
7028\param type - Type of packet.
7029\param pBeacon - Pointer to beacon or probe response
7030
7031\return Network type a/b/g.
7032-----------------------------------------------------*/
7033tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7034{
7035 tSirNwType nwType = eSIR_11B_NW_TYPE;
7036
7037 if (type == SIR_MAC_DATA_FRAME)
7038 {
7039 if ((channelNum > 0) && (channelNum < 15))
7040 {
7041 nwType = eSIR_11G_NW_TYPE;
7042 }
7043 else
7044 {
7045 nwType = eSIR_11A_NW_TYPE;
7046 }
7047 }
7048 else
7049 {
7050 if ((channelNum > 0) && (channelNum < 15))
7051 {
7052 int i;
7053 // 11b or 11g packet
7054 // 11g iff extended Rate IE is present or
7055 // if there is an A rate in suppRate IE
7056 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7057 {
7058 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7059 {
7060 nwType = eSIR_11G_NW_TYPE;
7061 break;
7062 }
7063 }
7064 if (pBeacon->extendedRatesPresent)
7065 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007066 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007067 nwType = eSIR_11G_NW_TYPE;
7068 }
7069 }
7070 else
7071 {
7072 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007073 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007074 nwType = eSIR_11A_NW_TYPE;
7075 }
7076 }
7077 return nwType;
7078}
7079
7080
7081/**---------------------------------------------------------
7082\fn limGetChannelFromBeacon
7083\brief To extract channel number from beacon
7084
7085\param pMac
7086\param pBeacon - Pointer to beacon or probe rsp
7087\return channel number
7088-----------------------------------------------------------*/
7089tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7090{
7091 tANI_U8 channelNum = 0;
7092
7093 if (pBeacon->dsParamsPresent)
7094 channelNum = pBeacon->channelNumber;
7095 else if(pBeacon->HTInfo.present)
7096 channelNum = pBeacon->HTInfo.primaryChannel;
7097 else
7098 channelNum = pBeacon->channelNumber;
7099
7100 return channelNum;
7101}
7102
7103
7104/** ---------------------------------------------------------
7105\fn limSetTspecUapsdMask
7106\brief This function sets the PE global variable:
7107\ 1) gUapsdPerAcTriggerEnableMask and
7108\ 2) gUapsdPerAcDeliveryEnableMask
7109\ based on the user priority field and direction field
7110\ in the TS Info Fields.
7111\
7112\ An AC is a trigger-enabled AC if the PSB subfield
7113\ is set to 1 in the uplink direction.
7114\ An AC is a delivery-enabled AC if the PSB subfield
7115\ is set to 1 in the down-link direction.
7116\
7117\param tpAniSirGlobal pMac
7118\param tSirMacTSInfo pTsInfo
7119\param tANI_U32 action
7120\return None
7121 ------------------------------------------------------------*/
7122void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7123{
7124 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7125 tANI_U16 direction = pTsInfo->traffic.direction;
7126 tANI_U8 ac = upToAc(userPrio);
7127
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307128 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 -07007129
7130 /* Converting AC to appropriate Uapsd Bit Mask
7131 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7132 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7133 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7134 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7135 */
7136 ac = ((~ac) & 0x3);
7137
7138 if (action == CLEAR_UAPSD_MASK)
7139 {
7140 if (direction == SIR_MAC_DIRECTION_UPLINK)
7141 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7142 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7143 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7144 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7145 {
7146 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7147 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7148 }
7149 }
7150 else if (action == SET_UAPSD_MASK)
7151 {
7152 if (direction == SIR_MAC_DIRECTION_UPLINK)
7153 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7154 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7155 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7156 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7157 {
7158 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7159 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7160 }
7161 }
7162
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007163 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7164 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007165
7166 return;
7167}
7168
7169
7170
7171void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7172{
7173
7174 tANI_U8 i;
7175 for(i =0;i < pMac->lim.maxBssId;i++)
7176 {
7177 if(pMac->lim.gpSession[i].valid == TRUE )
7178 {
7179 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7180 {
7181 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7182 break;
7183 }
7184
7185 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7186 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7187 {
7188 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7189 }
7190 }
7191 }
7192 for(i=0; i< pMac->lim.maxBssId; i++)
7193 {
7194 if(pMac->lim.gpSession[i].valid == TRUE )
7195 {
7196 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7197 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7198 {
7199 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7200 {
7201 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007202 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007203 i);)
7204 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7205 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7206 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7207 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007208 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007209 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7210 }
7211 break;
7212 }
7213 }
7214 }
7215 }
7216}
7217
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007218void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7219{
7220 if(psessionEntry->valid == TRUE )
7221 {
7222 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7223 {
7224 limIbssHeartBeatHandle(pMac,psessionEntry);
7225 }
7226 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7227 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7228 {
7229 limHandleHeartBeatFailure(pMac,psessionEntry);
7230 }
7231 }
7232 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7233 and the other things again */
7234 if(psessionEntry->valid == TRUE )
7235 {
7236 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7237 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7238 {
7239 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7240 {
7241 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7242 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7243 psessionEntry->bssIdx);)
7244 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7245 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7246 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7247 {
7248 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7249 limReactivateHeartBeatTimer(pMac, psessionEntry);
7250 }
7251 }
7252 }
7253 }
7254}
7255
7256
Jeff Johnson295189b2012-06-20 16:38:30 -07007257tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7258{
7259 tANI_U8 i;
7260 for(i =0;i < pMac->lim.maxBssId;i++)
7261 {
7262 if(pMac->lim.gpSession[i].valid == TRUE )
7263 {
7264 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7265 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7266 {
7267 return pMac->lim.gpSession[i].currentOperChannel;
7268 }
7269 }
7270 }
7271 return 0;
7272}
7273
7274void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7275{
7276
7277 tpPESession psessionEntry;
7278// tANI_U8 sessionId;
7279 tpAddStaParams pAddStaParams;
7280
7281 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7282
7283 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7284 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007285 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307286 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007287 return;
7288 }
7289 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7290 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007291#ifdef FEATURE_WLAN_TDLS
7292 else if(pMac->lim.gLimAddStaTdls)
7293 {
7294 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7295 pMac->lim.gLimAddStaTdls = FALSE ;
7296 }
7297#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007298 else
7299 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7300
7301}
7302
7303
7304void limUpdateBeacon(tpAniSirGlobal pMac)
7305{
7306 tANI_U8 i;
7307
7308 for(i =0;i < pMac->lim.maxBssId;i++)
7309 {
7310 if(pMac->lim.gpSession[i].valid == TRUE )
7311 {
7312 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7313 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7314 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7315 )
7316 {
7317 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7318 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7319 }
7320 else
7321 {
7322 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7323 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7324 {
7325
7326 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7327 {
7328 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7329 }
7330 }
7331 }
7332 }
7333 }
7334}
7335
7336void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7337{
7338 tANI_U8 i;
7339 tpPESession psessionEntry;
7340 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7341 for(i =0; i < pMac->lim.maxBssId; i++)
7342 {
7343 if(pMac->lim.gpSession[i].valid == TRUE)
7344 {
7345 psessionEntry = &pMac->lim.gpSession[i];
7346 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7347 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307348 limLog(pMac, LOGE,
7349 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7350 psessionEntry->limSmeState, psessionEntry->limMlmState,
7351 psessionEntry->LimRxedBeaconCntDuringHB,
7352 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007353#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7354 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007356 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7357 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307358 /* Disconnect even if we have not received a single beacon
7359 * after connection.
7360 */
7361 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7362 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307363 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7364 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007365 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007366 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007367 /* AP did not respond to Probe Request. Tear down link with it.*/
7368 limTearDownLinkWithAp(pMac,
7369 psessionEntry->peSessionId,
7370 eSIR_BEACON_MISSED);
7371 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7372 }
7373 else // restart heartbeat timer
7374 {
7375 limReactivateHeartBeatTimer(pMac, psessionEntry);
7376 }
7377 }
7378 else
7379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007380 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7382 limReactivateHeartBeatTimer(pMac, psessionEntry);
7383 }
7384
7385 }
7386 }
7387 }
7388 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7389 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7390}
7391
7392
7393/*
7394* This function assumes there will not be more than one IBSS session active at any time.
7395*/
7396tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7397{
7398 tANI_U8 i;
7399
7400 for(i =0;i < pMac->lim.maxBssId;i++)
7401 {
7402 if( (pMac->lim.gpSession[i].valid) &&
7403 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7404 return (&pMac->lim.gpSession[i]);
7405 }
7406
7407 return NULL;
7408}
7409
7410tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7411{
7412 tANI_U8 i;
7413
7414 for(i =0;i < pMac->lim.maxBssId;i++)
7415 {
7416 if( (pMac->lim.gpSession[i].valid) &&
7417 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7418 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7419 return (&pMac->lim.gpSession[i]);
7420 }
7421
7422 return NULL;
7423}
7424
7425/**---------------------------------------------------------
7426\fn limHandleDeferMsgError
7427\brief handles error scenario, when the msg can not be deferred.
7428\param pMac
7429\param pLimMsg LIM msg, which could not be deferred.
7430\return void
7431-----------------------------------------------------------*/
7432
7433void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7434{
7435 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7436 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307437 /*Decrement the Pending count before droping */
7438 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007439 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7440 }
7441 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007442 {
7443 vos_mem_free( pLimMsg->bodyptr);
7444 pLimMsg->bodyptr = NULL;
7445 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007446}
7447
7448
7449#ifdef FEATURE_WLAN_DIAG_SUPPORT
7450/**---------------------------------------------------------
7451\fn limDiagEventReport
7452\brief This function reports Diag event
7453\param pMac
7454\param eventType
7455\param bssid
7456\param status
7457\param reasonCode
7458\return void
7459-----------------------------------------------------------*/
7460void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7461{
7462 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7463 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7464
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307465 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007466
7467 if (NULL == pSessionEntry)
7468 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307469 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007470 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7471 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7472
7473 }
7474 else
7475 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307476 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007477 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7478 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7479 }
7480 peEvent.event_type = eventType;
7481 peEvent.status = status;
7482 peEvent.reason_code = reasonCode;
7483
7484 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7485 return;
7486}
7487
7488#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7489
7490void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7491{
7492
7493 tpAddStaSelfParams pAddStaSelfParams;
7494 tSirMsgQ mmhMsg;
7495 tpSirSmeAddStaSelfRsp pRsp;
7496
7497
7498 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7499
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307500 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7501 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007502 {
7503 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307504 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7505 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007506 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007507 return;
7508 }
7509
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307510 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007511
7512 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7513 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7514 pRsp->status = pAddStaSelfParams->status;
7515
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307516 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007517
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307518 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007519 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007520
7521 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7522 mmhMsg.bodyptr = pRsp;
7523 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307524 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007525 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7526
7527}
7528
7529void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7530{
7531
7532 tpDelStaSelfParams pDelStaSelfParams;
7533 tSirMsgQ mmhMsg;
7534 tpSirSmeDelStaSelfRsp pRsp;
7535
7536
7537 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7538
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307539 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7540 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007541 {
7542 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307543 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7544 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007545 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007546 return;
7547 }
7548
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307549 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007550
7551 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7552 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7553 pRsp->status = pDelStaSelfParams->status;
7554
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307555 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007556
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307557 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007558 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007559
7560 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7561 mmhMsg.bodyptr = pRsp;
7562 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307563 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007564 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7565
7566}
7567
7568/***************************************************************
7569* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7570* To unmap the channel to reverse the effect of mapping
7571* a band channel in hal .Mapping was done hal to overcome the
7572* limitation of the rxbd which use only 4 bit for channel number.
7573*****************************************************************/
7574tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7575{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007576#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007577 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007578 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7579 return aUnsortedChannelList[mapChannel -1];
7580 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007581#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007582 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007583#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007584 return abChannel[mapChannel -1];
7585 else
7586 return 0;
7587}
7588
7589
7590v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7591{
7592 int left = length;
7593 v_U8_t *ptr = pIes;
7594 v_U8_t elem_id;
7595 v_U16_t elem_len;
7596
7597 while(left >= (size_of_len_field+1))
7598 {
7599 elem_id = ptr[0];
7600 if (size_of_len_field == TWO_BYTE)
7601 {
7602 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7603 }
7604 else
7605 {
7606 elem_len = ptr[1];
7607 }
7608
7609
7610 left -= (size_of_len_field+1);
7611 if(elem_len > left)
7612 {
7613 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007614 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007615 eid,elem_len,left);
7616 return NULL;
7617 }
7618 if (elem_id == eid)
7619 {
7620 return ptr;
7621 }
7622
7623 left -= elem_len;
7624 ptr += (elem_len + (size_of_len_field+1));
7625 }
7626 return NULL;
7627}
7628
7629/* return NULL if oui is not found in ie
7630 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7631 */
7632v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7633{
7634 int left = ie_len;
7635 v_U8_t *ptr = ie;
7636 v_U8_t elem_id, elem_len;
7637
7638 while(left >= 2)
7639 {
7640 elem_id = ptr[0];
7641 elem_len = ptr[1];
7642 left -= 2;
7643 if(elem_len > left)
7644 {
7645 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007646 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007647 elem_id,elem_len,left);
7648 return NULL;
7649 }
7650 if (SIR_MAC_EID_VENDOR == elem_id)
7651 {
7652 if(memcmp(&ptr[2], oui, oui_size)==0)
7653 return ptr;
7654 }
7655
7656 left -= elem_len;
7657 ptr += (elem_len + 2);
7658 }
7659 return NULL;
7660}
7661
Jeff Johnson295189b2012-06-20 16:38:30 -07007662//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7663
7664v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7665{
7666 int length = 0;
7667 tANI_U8 *ptr = ie;
7668
7669 ptr[length++] = SIR_MAC_EID_VENDOR;
7670 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307671 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7672 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007673 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7674}
7675
7676//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7677
7678v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7679{
7680 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007681
7682 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7683 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7684 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307685 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007686 noaStream + noaLen - overFlowLen, overFlowLen);
7687 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7688 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307689 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007690 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307691 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7692 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007693 }
7694
Jeff Johnson295189b2012-06-20 16:38:30 -07007695 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7696
7697}
7698
7699//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7700v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7701{
7702 v_U8_t len=0;
7703
7704 v_U8_t *pBody = pNoaStream;
7705
7706
7707 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7708 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7709 {
7710 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7711 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7712 )
7713 return 0; //No NoA Descriptor then return 0
7714
7715
7716 pBody[0] = SIR_P2P_NOA_ATTR;
7717
7718 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7719 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7720 len = 5;
7721 pBody += len;
7722
7723
7724 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7725 {
7726 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7727 pBody += 1;
7728 len +=1;
7729
7730 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7731 pBody += sizeof(tANI_U32);
7732 len +=4;
7733
7734 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7735 pBody += sizeof(tANI_U32);
7736 len +=4;
7737
7738 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7739 pBody += sizeof(tANI_U32);
7740 len +=4;
7741
7742 }
7743
7744 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7745 {
7746 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7747 pBody += 1;
7748 len +=1;
7749
7750 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7751 pBody += sizeof(tANI_U32);
7752 len +=4;
7753
7754 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7755 pBody += sizeof(tANI_U32);
7756 len +=4;
7757
7758 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7759 pBody += sizeof(tANI_U32);
7760 len +=4;
7761
7762 }
7763
7764
7765 pBody = pNoaStream + 1;
7766 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7767
7768 return (len);
7769
7770 }
7771 return 0;
7772
7773}
Jeff Johnsone7245742012-09-05 17:12:55 -07007774
7775void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007776{
7777
7778 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007779 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007780}
Jeff Johnsone7245742012-09-05 17:12:55 -07007781
Jeff Johnson295189b2012-06-20 16:38:30 -07007782/*--------------------------------------------------------------------------
7783
7784 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7785
Jeff Johnsone7245742012-09-05 17:12:55 -07007786 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7787 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007788
7789 \param pMac - pointer to global adapter context
7790 \return - channel to scan from valid session else zero.
7791
7792 \sa
7793
7794 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007795void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007796{
7797
7798 //Rationale - this could be the suspend/resume for assoc and it is essential that
7799 //the new BSS is active for some time. Other BSS was anyway suspended.
7800 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7801 //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 -07007802 //and hence should be ok. Need to discuss this further
7803 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007804 {
7805 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007806 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007807 }
7808 else
7809 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007810 *resumeChannel = pMac->lim.gResumeChannel;
7811 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007812 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007813 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007814}
7815
Viral Modid86bde22012-12-10 13:09:21 -08007816tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7817{
7818 tANI_U8 i;
7819 for(i =0; i < pMac->lim.maxBssId; i++)
7820 {
7821 if(pMac->lim.gpSession[i].valid == TRUE)
7822 {
7823 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7824 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7825 )
7826 {
7827 return TRUE;
7828 }
7829 }
7830 }
7831 return FALSE;
7832}
Jeff Johnsone7245742012-09-05 17:12:55 -07007833
Jeff Johnson295189b2012-06-20 16:38:30 -07007834
7835tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7836{
7837 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7838 {
7839 return eANI_BOOLEAN_TRUE;
7840 }
7841 else
7842 {
7843 return eANI_BOOLEAN_FALSE;
7844 }
7845}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007846
Sandeep Puligilla60342762014-01-30 21:05:37 +05307847/**
7848 * \brief verify the changes in channel bonding
7849 *
7850 * \param pMac Pointer to the global MAC structure
7851 *
7852 * \param psessionEntry session entry
7853 * beaconSecChanWidth Secondary channel width
7854 * advertized in beacon
7855 * currentSecChanWidth Current configured width
7856 * staId Station Id
7857 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7858 */
7859tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7860 tpPESession psessionEntry,
7861 tANI_U8 beaconSecChanWidth,
7862 tANI_U8 currentSecChanWidth,
7863 tANI_U8 staId)
7864{
7865 tUpdateVHTOpMode tempParam;
7866 tANI_BOOLEAN fCbMode24G = FALSE;
7867 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7868
7869 /* Moving from HT40 to HT20 operation*/
7870 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7871 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7872 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7873 {
7874 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7875 tempParam.staId = staId;
7876 fCbMode24G = TRUE;
7877 }
7878
7879 /* Moving from HT20 to HT40 operation*/
7880 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7881 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7882 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7883 {
7884 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7885 tempParam.staId = staId;
7886 fCbMode24G = TRUE;
7887 }
7888
7889 if (TRUE == fCbMode24G)
7890 {
7891 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7892 "Changing CBMODE to = %d staId = %d",
7893 tempParam.opMode, tempParam.staId );
7894 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7895 status = eANI_BOOLEAN_TRUE;
7896 }
7897 return status;
7898}
7899
Mohit Khanna4a70d262012-09-11 16:30:12 -07007900#ifdef WLAN_FEATURE_11AC
7901tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7902{
7903 tUpdateVHTOpMode tempParam;
7904
7905 tempParam.opMode = chanWidth;
7906 tempParam.staId = staId;
7907
7908 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7909
7910 return eANI_BOOLEAN_TRUE;
7911}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007912#endif
7913
krunal soni45b9eb62014-03-26 12:54:25 -07007914void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7915 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007916{
7917 tANI_U8 val=0;
7918
krunal soni45b9eb62014-03-26 12:54:25 -07007919 //only 2.4G band should have short slot enable, rest it should be default
7920 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007921 {
krunal soni45b9eb62014-03-26 12:54:25 -07007922 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007923 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007924 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007925 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7926 {
7927 val = true;
7928 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007929 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007930 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007931 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007932 // Joining BSS.
7933 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007934 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007935 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007936 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007937 // Reassociating with AP.
7938 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007939 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007940 }
krunal soni45b9eb62014-03-26 12:54:25 -07007941 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007942 {
krunal soni45b9eb62014-03-26 12:54:25 -07007943 /*
7944 * 11B does not short slot and short slot is default
7945 * for 11A mode. Hence, not need to set this bit
7946 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007947 val = false;
7948 }
krunal soni45b9eb62014-03-26 12:54:25 -07007949
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007950 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007951 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007952}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307953
Kalikinkar dhara205da782014-03-21 15:49:32 -07007954void limUtilsframeshtons(tpAniSirGlobal pCtx,
7955 tANI_U8 *pOut,
7956 tANI_U16 pIn,
7957 tANI_U8 fMsb)
7958{
7959 (void)pCtx;
7960#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7961 if ( !fMsb )
7962 {
7963 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7964 }
7965 else
7966 {
7967 *pOut = ( pIn & 0xff00 ) >> 8;
7968 *( pOut + 1 ) = pIn & 0xff;
7969 }
7970#else
7971 if ( !fMsb )
7972 {
7973 *pOut = pIn & 0xff;
7974 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7975 }
7976 else
7977 {
7978 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7979 }
7980#endif
7981}
7982
7983void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7984 tANI_U8 *pOut,
7985 tANI_U32 pIn,
7986 tANI_U8 fMsb)
7987{
7988 (void)pCtx;
7989#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7990 if ( !fMsb )
7991 {
7992 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7993 }
7994 else
7995 {
7996 *pOut = ( pIn & 0xff000000 ) >> 24;
7997 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7998 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7999 *( pOut + 3 ) = ( pIn & 0x000000ff );
8000 }
8001#else
8002 if ( !fMsb )
8003 {
8004 *( pOut ) = ( pIn & 0x000000ff );
8005 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8006 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8007 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8008 }
8009 else
8010 {
8011 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8012 }
8013#endif
8014}
8015
8016
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308017/**--------------------------------------------
8018\fn limUpdateOBSSScanParams
8019\brief Updates OBSS SCAN IE parameters to session
8020
8021\param psessionEntry - Session Entry
8022\return NONE
8023---------------------------------------------*/
8024void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8025 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8026{
8027 /*If the recieved value is not in the range specified by the Specification
8028 then it will be the default value configured through cfg */
8029 if (( pOBSSScanParameters->obssScanActiveDwell >
8030 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8031 ( pOBSSScanParameters->obssScanActiveDwell <
8032 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8033 {
8034 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8035 pOBSSScanParameters->obssScanActiveDwell;
8036 }
8037 if((pOBSSScanParameters->obssScanPassiveDwell >
8038 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8039 (pOBSSScanParameters->obssScanPassiveDwell <
8040 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8041 {
8042 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8043 pOBSSScanParameters->obssScanPassiveDwell;
8044 }
8045 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8046 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8047 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8048 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8049 {
8050 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8051 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8052 }
8053 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8054 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8055 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8056 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8057 {
8058 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8059 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8060 }
8061 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8062 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8063 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8064 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8065 {
8066 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8067 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8068 }
8069 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8070 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8071 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8072 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8073 {
8074 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8075 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8076 }
8077 if((pOBSSScanParameters->obssScanActivityThreshold >
8078 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8079 (pOBSSScanParameters->obssScanActivityThreshold <
8080 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8081 {
8082 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8083 pOBSSScanParameters->obssScanActivityThreshold;
8084 }
8085}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008086
8087#ifdef WLAN_FEATURE_11W
8088void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8089{
8090 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8091 tPmfSaQueryTimerId timerId;
8092 tpPESession psessionEntry;
8093 tpDphHashNode pSta;
8094 tANI_U32 maxRetries;
8095
8096 limLog(pMac, LOG1, FL("SA Query timer fires"));
8097 timerId.value = param;
8098
8099 // Check that SA Query is in progress
8100 if ((psessionEntry = peFindSessionBySessionId(
8101 pMac, timerId.fields.sessionId)) == NULL)
8102 {
8103 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8104 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008105 return;
8106 }
8107 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8108 &psessionEntry->dph.dphHashTable)) == NULL)
8109 {
8110 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8111 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008112 return;
8113 }
8114 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8115 return;
8116
8117 // Increment the retry count, check if reached maximum
8118 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8119 &maxRetries) != eSIR_SUCCESS)
8120 {
8121 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8122 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8123 return;
8124 }
8125 pSta->pmfSaQueryRetryCount++;
8126 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8127 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308128 limLog(pMac, LOGE,
8129 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8130 MAC_ADDR_ARRAY(pSta->staAddr));
8131 limSendDisassocMgmtFrame(pMac,
8132 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8133 pSta->staAddr, psessionEntry, FALSE);
8134 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008135 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8136 return;
8137 }
8138
8139 // Retry SA Query
8140 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8141 pSta->staAddr, psessionEntry);
8142 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008143 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8144 {
8145 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8146 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8147 }
8148}
8149#endif
8150
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008151/** ---------------------------------------------------------
8152\fn limProcessChannelSwitchSuspendLink
8153\brief This function call channel switch functions based on
8154 the gLimChannelSwitch.state. After function return it
8155 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8156 If gLimChannelSwitch.state is non-identified then
8157 print error log as well as restore back the
8158 pre-channelSwitch.
8159\param tpAniSirGlobal pMac
8160\param eHalStatus status
8161\param tANI_U32 *ctx
8162\return None
8163 ------------------------------------------------------------*/
8164static void
8165limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8166 eHalStatus status,
8167 tANI_U32 *ctx)
8168{
8169 tpPESession pSessionEntry = (tpPESession)ctx;
8170
8171 if ( eHAL_STATUS_SUCCESS != status )
8172 {
8173 limLog(pMac, LOGE,
8174 FL("Suspend link failed. still proceeding "));
8175 }
8176 if (NULL == pSessionEntry )
8177 {
8178 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8179 return;
8180 }
8181
8182 switch(pSessionEntry->gLimChannelSwitch.state)
8183 {
8184 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8185 PELOGW(limLog(pMac, LOGW,
8186 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8187 limSwitchPrimaryChannel(pMac,
8188 pSessionEntry->gLimChannelSwitch.primaryChannel,
8189 pSessionEntry);
8190 pSessionEntry->gLimChannelSwitch.state =
8191 eLIM_CHANNEL_SWITCH_IDLE;
8192 break;
8193
8194 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8195 PELOGW(limLog(pMac, LOGW,
8196 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8197 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8198 pSessionEntry->gLimChannelSwitch.primaryChannel,
8199 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8200 pSessionEntry->gLimChannelSwitch.state =
8201 eLIM_CHANNEL_SWITCH_IDLE;
8202 break;
8203
8204 default:
8205 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8206 pSessionEntry->gLimChannelSwitch.state);)
8207 if (limRestorePreChannelSwitchState(pMac,
8208 pSessionEntry) != eSIR_SUCCESS)
8209 {
8210 limLog(pMac, LOGE,
8211 FL("Could not restore pre-channelSwitch "
8212 "(11h) state, resetting the system"));
8213 }
8214 }
8215}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308216
8217/** ---------------------------------------------------------
8218\fn limInitOBSSScanParams
8219\brief This function Initializes the OBSS Scan Parameters
8220\param tpAniSirGlobal pMac
8221\param tpPESession pSessionEntry
8222\return None
8223 ------------------------------------------------------------*/
8224
8225void limInitOBSSScanParams(tpAniSirGlobal pMac,
8226 tpPESession psessionEntry)
8227{
8228 tANI_U32 cfgValue;
8229
8230 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8231 &cfgValue) != eSIR_SUCCESS)
8232 {
8233 limLog(pMac, LOGE, FL("Fail to retrieve "
8234 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8235 return ;
8236 }
8237 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8238
8239 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8240 &cfgValue) != eSIR_SUCCESS)
8241 {
8242 limLog(pMac, LOGE, FL("Fail to retrieve "
8243 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8244 return ;
8245 }
8246 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8247
8248 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8249 &cfgValue) != eSIR_SUCCESS)
8250 {
8251 limLog(pMac, LOGE, FL("Fail to retrieve "
8252 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8253 return ;
8254 }
8255 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8256 = cfgValue;
8257 if (wlan_cfgGetInt(pMac,
8258 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8259 &cfgValue) != eSIR_SUCCESS)
8260 {
8261 limLog(pMac, LOGE, FL("Fail to retrieve"
8262 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8263 return ;
8264 }
8265 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8266 cfgValue;
8267 if (wlan_cfgGetInt(pMac,
8268 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8269 != eSIR_SUCCESS)
8270 {
8271 limLog(pMac, LOGE, FL("Fail to retrieve"
8272 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8273 return ;
8274 }
8275 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8276 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308277
8278 if (wlan_cfgGetInt(pMac,
8279 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8280 != eSIR_SUCCESS)
8281 {
8282 limLog(pMac, LOGE, FL("Fail to retrieve"
8283 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8284 return ;
8285 }
8286 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8287 cfgValue;
8288
8289
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308290 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8291 &cfgValue) != eSIR_SUCCESS)
8292 {
8293 limLog(pMac, LOGE, FL("Fail to retrieve "
8294 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8295 return ;
8296 }
8297 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308298}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308299
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308300const char * lim_ScanTypetoString(const v_U8_t scanType)
8301{
8302 switch (scanType)
8303 {
8304 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8305 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8306 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8307 default:
8308 return "Unknown ScanType";
8309 }
8310}
8311
8312const char * lim_BssTypetoString(const v_U8_t bssType)
8313{
8314 switch (bssType)
8315 {
8316 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8317 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8318 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8319 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8320 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8321 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8322 default:
8323 return "Unknown BssType";
8324 }
8325}
8326
8327const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8328{
8329 switch (mode)
8330 {
8331 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8332 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8333 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8334 default:
8335 return "Unknown BgScanMode";
8336 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308337}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308338
8339#ifdef WLAN_FEATURE_11W
8340/**
8341 *
8342 * \brief This function is called by various LIM modules to correctly set
8343 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8344 *
8345 *
8346 * \param pMac Pointer to Global MAC structure
8347 *
8348 * \param psessionEntry Pointer to session corresponding to the connection
8349 *
8350 * \param peer Peer address of the STA to which the frame is to be sent
8351 *
8352 * \param pMacHdr Pointer to the frame MAC header
8353 *
8354 * \return nothing
8355 *
8356 *
8357 */
8358void
8359limSetProtectedBit(tpAniSirGlobal pMac,
8360 tpPESession psessionEntry,
8361 tSirMacAddr peer,
8362 tpSirMacMgmtHdr pMacHdr)
8363{
8364 tANI_U16 aid;
8365 tpDphHashNode pStaDs;
8366
8367 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8368 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8369 {
8370
8371 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8372 &psessionEntry->dph.dphHashTable );
8373 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308374 /* rmfenabled will be set at the time of addbss.
8375 * but sometimes EAP auth fails and keys are not
8376 * installed then if we send any management frame
8377 * like deauth/disassoc with this bit set then
8378 * firmware crashes. so check for keys are
8379 * installed or not also before setting the bit
8380 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308381 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308382 pMacHdr->fc.wep = 1;
8383 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308384 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308385 pMacHdr->fc.wep = 1;
8386} /*** end limSetProtectedBit() ***/
8387#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308388
8389tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8390{
8391 int left = length;
8392 tANI_U8 *ptr = pIes;
8393 tANI_U8 elem_id,elem_len;
8394
8395 while (left >= 2)
8396 {
8397 elem_id = ptr[0];
8398 elem_len = ptr[1];
8399 left -= 2;
8400
8401 if (elem_len > left)
8402 {
8403 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8404 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8405 eid,elem_len,left);
8406 return NULL;
8407 }
8408 if (elem_id == eid)
8409 {
8410 return ptr;
8411 }
8412
8413 left -= elem_len;
8414 ptr += (elem_len + 2);
8415 }
8416 return NULL;
8417}
8418
8419
8420void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8421{
8422
8423 tANI_U32 nPayload;
8424 tANI_U8 *pPayload;
8425 tANI_U8 *ieptr;
8426 tSirMacTim *tim;
8427
8428 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8429 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8430
8431 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8432 {
8433 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8434 return;
8435 }
8436
8437 if (NULL !=
8438 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8439 nPayload, SIR_MAC_TIM_EID)))
8440 {
8441 /* Ignore EID and Length field*/
8442 tim = (tSirMacTim *)(ieptr + 2);
8443
8444 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8445 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8446 if (tim->dtimCount >= MAX_DTIM_COUNT)
8447 tim->dtimCount = DTIM_COUNT_DEFAULT;
8448 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8449 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8450 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8451 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8452 psessionEntry->currentBssBeaconCnt++;
8453
8454 limLog(pMac, LOG1,
8455 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8456 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8457 psessionEntry->lastBeaconDtimPeriod);
8458
8459 }
8460 return;
8461}
Girish Gowlia95daca2015-02-04 20:31:31 +05308462
8463void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8464 tANI_U8 smeSessionId,
8465 tANI_U32 maxRateFlag)
8466{
8467 tpSirSmeUpdateMaxRateParams pRsp;
8468 tSirMsgQ msg;
8469
8470 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8471 if (NULL == pRsp)
8472 {
8473 limLog(pMac, LOGP, FL("Memory allocation failed"));
8474 return;
8475 }
8476 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8477 pRsp->maxRateFlag = maxRateFlag;
8478 pRsp->smeSessionId = smeSessionId;
8479 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8480 msg.bodyptr = pRsp;
8481 msg.bodyval = 0;
8482 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8483 return;
8484}
Abhishek Singh5d765712015-03-12 14:04:16 +05308485
8486void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8487{
8488 if( pMac->sys.gSysBbtPendingMgmtCount )
8489 {
8490 vos_spin_lock_acquire( &pMac->sys.lock );
8491 pMac->sys.gSysBbtPendingMgmtCount--;
8492 vos_spin_lock_release( &pMac->sys.lock );
8493 }
8494 else
8495 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8496}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308497
8498eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8499{
8500 tpSirTxBdStatus pTxBdStatus;
8501
8502 if (!pData)
8503 {
8504 limLog(pMac, LOGE, FL("pData is NULL"));
8505 return eHAL_STATUS_FAILURE;
8506 }
8507
8508 pTxBdStatus = (tpSirTxBdStatus) pData;
8509
8510 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8511 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8512 return eHAL_STATUS_SUCCESS;
8513}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308514
8515/**
8516 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8517 * robust action frame
8518 * @action_catagory: Action frame catagory.
8519 *
8520 * This function is used to check if given action catagory is robust
8521 * action frame.
8522 *
8523 * Return: bool
8524 */
8525bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8526{
8527 switch (action_catagory) {
8528 /*
8529 * NOTE: This function doesn't take care of the DMG
8530 * (Directional Multi-Gigatbit) BSS case as 8011ad
8531 * support is not yet added. In future, if the support
8532 * is required then this function need few more arguments
8533 * and little change in logic.
8534 */
8535 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8536 case SIR_MAC_ACTION_QOS_MGMT:
8537 case SIR_MAC_ACTION_DLP:
8538 case SIR_MAC_ACTION_BLKACK:
8539 case SIR_MAC_ACTION_RRM:
8540 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8541 case SIR_MAC_ACTION_SA_QUERY:
8542 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8543 case SIR_MAC_ACTION_WNM:
8544 case SIR_MAC_ACITON_MESH:
8545 case SIR_MAC_ACTION_MHF:
8546 case SIR_MAC_ACTION_FST:
8547 return true;
8548 default:
8549 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8550 FL("non-PMF action category[%d] "),
8551 action_catagory);
8552 break;
8553 }
8554 return false;
8555}