blob: e27ebead5a3da067a207f59ae9b02ba3bcc39f03 [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 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005729 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5730 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005731 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5732 }
5733 }
5734 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305735 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005736 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005737 return;
5738}
5739
5740
5741/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005742\fn limDeleteBASessions
5743\brief Deletes all the exisitng BA sessions for given session
5744 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005745\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005746\param tpPESession pSessionEntry
5747\param tANI_U32 baDirection
5748\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005749-------------------------------------------------------------*/
5750
5751void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005752limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305753 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005754{
5755 tANI_U32 i;
5756 tANI_U8 tid;
5757 tpDphHashNode pSta;
5758
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005759 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005760 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005761 limLog(pMac, LOGE, FL("Session does not exist"));
5762 }
5763 else
5764 {
5765 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005766 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005767 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5768 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5769 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5770 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005772 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005773 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005774 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5775 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005776 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005777 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5778 (baDirection & BA_INITIATOR))
5779 {
5780 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305781 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005782 pSessionEntry);
5783 }
5784 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5785 (baDirection & BA_RECIPIENT))
5786 {
5787 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305788 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005789 pSessionEntry);
5790 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005791 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 }
5793 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005794 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5795 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5796 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005797 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005798 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5799 &pSessionEntry->dph.dphHashTable);
5800 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005801 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005802 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5803 (baDirection & BA_INITIATOR))
5804 {
5805 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305806 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005807 pSessionEntry);
5808 }
5809 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5810 (baDirection & BA_RECIPIENT))
5811 {
5812 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305813 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005814 pSessionEntry);
5815 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005816 }
5817 }
5818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 }
5820}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005821
5822/** -------------------------------------------------------------
5823\fn limDelAllBASessions
5824\brief Deletes all the exisitng BA sessions.
5825\param tpAniSirGlobal pMac
5826\return None
5827-------------------------------------------------------------*/
5828
5829void limDelAllBASessions(tpAniSirGlobal pMac)
5830{
5831 tANI_U32 i;
5832 tpPESession pSessionEntry;
5833
5834 for (i = 0; i < pMac->lim.maxBssId; i++)
5835 {
5836 pSessionEntry = peFindSessionBySessionId(pMac, i);
5837 if (pSessionEntry)
5838 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305839 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5840 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005841 }
5842 }
5843}
5844
5845/** -------------------------------------------------------------
5846\fn limDelAllBASessionsBtc
5847\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5848 band.
5849\param tpAniSirGlobal pMac
5850\return None
5851-------------------------------------------------------------*/
5852
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005853void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005854{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005855 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005856 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005857 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5858 &sessionId);
5859 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005860 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005861 PELOGW(limLog(pMac, LOGW,
5862 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305863 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305864 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005865 }
5866}
5867
Jeff Johnson295189b2012-06-20 16:38:30 -07005868/** -------------------------------------------------------------
5869\fn limProcessDelTsInd
5870\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5871 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5872\param tpAniSirGlobal pMac
5873\param tSirMsgQ limMsg
5874\return None
5875-------------------------------------------------------------*/
5876void
5877limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5878{
5879 tpDphHashNode pSta;
5880 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5881 tpSirDeltsReq pDelTsReq = NULL;
5882 tSirMacAddr peerMacAddr;
5883 tpSirDeltsReqInfo pDelTsReqInfo;
5884 tpLimTspecInfo pTspecInfo;
5885 tpPESession psessionEntry;
5886 tANI_U8 sessionId;
5887
5888if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005890 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305891 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005892 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005893 return;
5894 }
5895
5896 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5897 if(pTspecInfo->inuse == false)
5898 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005899 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005900 goto error1;
5901 }
5902
5903 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5904 if(pSta == NULL)
5905 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005906 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005907 pTspecInfo->assocId);
5908 goto error1;
5909 }
5910
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305911 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5912 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005913 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305914 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 goto error1;
5916 }
5917
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305918 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005919
5920 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305921 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005922 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305923 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005924
5925
5926 //validate the req
5927 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5928 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005929 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 goto error2;
5931 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305932 limLog(pMac, LOG1, "Sent DELTS request to station with "
5933 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5934 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005935
5936 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5937 psessionEntry);
5938
5939 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305940 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5941 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305943 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005944 goto error3;
5945 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005947
5948 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305949 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005950 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305951 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005952
5953 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5954
5955error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305956 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005957error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305958 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005959error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305960 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005961 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 return;
5963}
5964
5965/**
5966 * \brief Setup an A-MPDU/BA session
5967 *
5968 * \sa limPostMlmAddBAReq
5969 *
5970 * \param pMac The global tpAniSirGlobal object
5971 *
5972 * \param pStaDs DPH Hash Node object of peer STA
5973 *
5974 * \param tid TID for which a BA is being setup.
5975 * If this is set to 0xFFFF, then we retrieve
5976 * the default TID from the CFG
5977 *
5978 * \return eSIR_SUCCESS if setup completes successfully
5979 * eSIR_FAILURE is some problem is encountered
5980 */
5981tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5982 tpDphHashNode pStaDs,
5983 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5984{
5985 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005986 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005987 tpDialogueToken dialogueTokenNode;
5988 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005989
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 // Check if the peer is a 11n capable STA
5991 // FIXME - Need a 11n peer indication in DPH.
5992 // For now, using the taurusPeer attribute
5993 //if( 0 == pStaDs->taurusPeer == )
5994 //return eSIR_SUCCESS;
5995
5996 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305997 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5998 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005999 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306000 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006001 status = eSIR_MEM_ALLOC_FAILED;
6002 goto returnFailure;
6003 }
6004
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306005 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006006
6007 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306008 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006009 pMlmAddBAReq->peerMacAddr,
6010 pStaDs->staAddr,
6011 sizeof( tSirMacAddr ));
6012
6013 // Update the TID
6014 pMlmAddBAReq->baTID = tid;
6015
6016 // Determine the supported BA policy of local STA
6017 // for the TID of interest
6018 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6019
6020 // BA Buffer Size
6021 // Requesting the ADDBA recipient to populate the size.
6022 // If ADDBA is accepted, a non-zero buffer size should
6023 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306024 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6025 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6026 {
6027 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6028 causing very low throughput in HT40 case */
6029 limLog( pMac, LOGW,
6030 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6031 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6032 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306033 else if (pMac->miracastVendorConfig)
6034 {
6035 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6036 {
6037 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6038 status = eSIR_FAILURE;
6039 goto returnFailure;
6040 }
6041
6042 pMlmAddBAReq->baBufferSize = val;
6043 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306044 else
6045 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006046
6047 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306048 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 -07006049 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6050 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306051 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006052
6053 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006054 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006055 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006056 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006057 status = eSIR_FAILURE;
6058 goto returnFailure;
6059 }
6060 pMlmAddBAReq->baTimeout = val; // In TU's
6061
6062 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006063 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006064 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6065 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6066
6067 // BA Starting Sequence Number
6068 pMlmAddBAReq->baSSN = startingSeqNum;
6069
6070 /* Update PE session Id*/
6071 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6072
6073 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6074
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006075 dialogueTokenNode = limAssignDialogueToken(pMac);
6076 if (NULL == dialogueTokenNode)
6077 {
6078 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6079 status = eSIR_FAILURE;
6080 goto returnFailure;
6081 }
6082
Jeff Johnson295189b2012-06-20 16:38:30 -07006083 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006084 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006085 dialogueTokenNode->assocId = pStaDs->assocId;
6086 dialogueTokenNode->tid = tid;
6087 // Send ADDBA Req to MLME
6088 limPostMlmMessage( pMac,
6089 LIM_MLM_ADDBA_REQ,
6090 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006091 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006092
6093returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306094 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006095 return status;
6096}
6097
6098/**
6099 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6100 * will then send an ADDBA Rsp to peer MAC entity
6101 * with the appropriate ADDBA status code
6102 *
6103 * \sa limPostMlmAddBARsp
6104 *
6105 * \param pMac The global tpAniSirGlobal object
6106 *
6107 * \param peerMacAddr MAC address of peer entity that will
6108 * be the recipient of this ADDBA Rsp
6109 *
6110 * \param baStatusCode ADDBA Rsp status code
6111 *
6112 * \param baDialogToken ADDBA Rsp dialog token
6113 *
6114 * \param baTID TID of interest
6115 *
6116 * \param baPolicy The BA policy
6117 *
6118 * \param baBufferSize The BA buffer size
6119 *
6120 * \param baTimeout BA timeout in TU's
6121 *
6122 * \return eSIR_SUCCESS if setup completes successfully
6123 * eSIR_FAILURE is some problem is encountered
6124 */
6125tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6126 tSirMacAddr peerMacAddr,
6127 tSirMacStatusCodes baStatusCode,
6128 tANI_U8 baDialogToken,
6129 tANI_U8 baTID,
6130 tANI_U8 baPolicy,
6131 tANI_U16 baBufferSize,
6132 tANI_U16 baTimeout,
6133 tpPESession psessionEntry)
6134{
6135tSirRetStatus status = eSIR_SUCCESS;
6136tpLimMlmAddBARsp pMlmAddBARsp;
6137
6138 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306139 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6140 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006141 {
6142 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306143 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006144 status );
6145
6146 status = eSIR_MEM_ALLOC_FAILED;
6147 goto returnFailure;
6148 }
6149
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306150 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006151
6152 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306153 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006154 pMlmAddBARsp->peerMacAddr,
6155 peerMacAddr,
6156 sizeof( tSirMacAddr ));
6157
6158 pMlmAddBARsp->baDialogToken = baDialogToken;
6159 pMlmAddBARsp->addBAResultCode = baStatusCode;
6160 pMlmAddBARsp->baTID = baTID;
6161 pMlmAddBARsp->baPolicy = baPolicy;
6162 pMlmAddBARsp->baBufferSize = baBufferSize;
6163 pMlmAddBARsp->baTimeout = baTimeout;
6164
6165 /* UPdate PE session ID*/
6166 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6167
6168 // Send ADDBA Rsp to MLME
6169 limPostMlmMessage( pMac,
6170 LIM_MLM_ADDBA_RSP,
6171 (tANI_U32 *) pMlmAddBARsp );
6172
6173returnFailure:
6174
6175 return status;
6176}
6177
6178/**
6179 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6180 * will then send an DELBA Ind to peer MAC entity
6181 * with the appropriate DELBA status code
6182 *
6183 * \sa limPostMlmDelBAReq
6184 *
6185 * \param pMac The global tpAniSirGlobal object
6186 *
6187 * \param pSta DPH Hash Node object of peer MAC entity
6188 * for which the BA session is being deleted
6189 *
6190 * \param baDirection DELBA direction
6191 *
6192 * \param baTID TID for which the BA session is being deleted
6193 *
6194 * \param baReasonCode DELBA Req reason code
6195 *
6196 * \return eSIR_SUCCESS if setup completes successfully
6197 * eSIR_FAILURE is some problem is encountered
6198 */
6199tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6200 tpDphHashNode pSta,
6201 tANI_U8 baDirection,
6202 tANI_U8 baTID,
6203 tSirMacReasonCodes baReasonCode,
6204 tpPESession psessionEntry)
6205{
6206tSirRetStatus status = eSIR_SUCCESS;
6207tpLimMlmDelBAReq pMlmDelBAReq;
6208tLimBAState curBaState;
6209
6210if(NULL == pSta)
6211 return eSIR_FAILURE;
6212
6213LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6214
6215 // Need to validate the current BA State.
6216 if( eLIM_BA_STATE_IDLE != curBaState)
6217 {
6218 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006219 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006220 baTID,
6221 curBaState);
6222
6223 status = eSIR_FAILURE;
6224 goto returnFailure;
6225 }
6226
6227 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306228 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6229 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006230 {
6231 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306232 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006233 status );
6234
6235 status = eSIR_MEM_ALLOC_FAILED;
6236 goto returnFailure;
6237 }
6238
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306239 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006240
6241 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306242 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006243 pMlmDelBAReq->peerMacAddr,
6244 pSta->staAddr,
6245 sizeof( tSirMacAddr ));
6246
6247 pMlmDelBAReq->baDirection = baDirection;
6248 pMlmDelBAReq->baTID = baTID;
6249 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6250
6251 /* Update PE session ID*/
6252 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6253
6254 //we don't have valid BA session for the given direction.
6255 // HDD wants to get the BA session deleted on PEER in this case.
6256 // in this case we just need to send DelBA to the peer.
6257 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6258 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6259 {
6260 // Send DELBA Ind over the air
6261 if( eSIR_SUCCESS !=
6262 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6263 status = eSIR_FAILURE;
6264
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306265 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006266 return status;
6267 }
6268
6269
6270 // Update the BA state in STA
6271 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6272
6273 // Send DELBA Req to MLME
6274 limPostMlmMessage( pMac,
6275 LIM_MLM_DELBA_REQ,
6276 (tANI_U32 *) pMlmDelBAReq );
6277
6278returnFailure:
6279
6280 return status;
6281}
6282
6283/**
6284 * \brief Send WDA_ADDBA_REQ to HAL, in order
6285 * to setup a new BA session with a peer
6286 *
6287 * \sa limPostMsgAddBAReq
6288 *
6289 * \param pMac The global tpAniSirGlobal object
6290 *
6291 * \param pSta Runtime, STA-related configuration cached
6292 * in the HashNode object
6293 *
6294 * \param baDialogToken The Action Frame dialog token
6295 *
6296 * \param baTID TID for which the BA session is being setup
6297 *
6298 * \param baPolicy BA Policy
6299 *
6300 * \param baBufferSize The requested BA buffer size
6301 *
6302 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6303 *
6304 * \param baSSN Starting Sequence Number for this BA session
6305 *
6306 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6307 *
6308 * \return none
6309 *
6310 */
6311tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6312 tpDphHashNode pSta,
6313 tANI_U8 baDialogToken,
6314 tANI_U8 baTID,
6315 tANI_U8 baPolicy,
6316 tANI_U16 baBufferSize,
6317 tANI_U16 baTimeout,
6318 tANI_U16 baSSN,
6319 tANI_U8 baDirection,
6320 tpPESession psessionEntry)
6321{
6322tpAddBAParams pAddBAParams = NULL;
6323tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006324tSirMsgQ msgQ;
6325
6326#ifdef WLAN_SOFTAP_VSTA_FEATURE
6327 // we can only do BA on "hard" STAs
6328 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6329 {
6330 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306331 limLog( pMac, LOGE,
6332 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006333 goto returnFailure;
6334 }
6335#endif //WLAN_SOFTAP_VSTA_FEATURE
6336
6337 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306338 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6339 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 {
6341 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306342 FL("AllocateMemory failed")
6343 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006344
6345 retCode = eSIR_MEM_ALLOC_FAILED;
6346 goto returnFailure;
6347 }
6348
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306349 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006350
6351 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306352 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006353 (void *) pAddBAParams->peerMacAddr,
6354 (void *) pSta->staAddr,
6355 sizeof( tSirMacAddr ));
6356
6357 // Populate the REQ parameters
6358 pAddBAParams->staIdx = pSta->staIndex;
6359 pAddBAParams->baDialogToken = baDialogToken;
6360 pAddBAParams->baTID = baTID;
6361 pAddBAParams->baPolicy = baPolicy;
6362 pAddBAParams->baBufferSize = baBufferSize;
6363 pAddBAParams->baTimeout = baTimeout;
6364 pAddBAParams->baSSN = baSSN;
6365 pAddBAParams->baDirection = baDirection;
6366 pAddBAParams->respReqd = 1;
6367
6368 /* UPdate PE session ID */
6369 pAddBAParams->sessionId = psessionEntry->peSessionId;
6370
6371 // Post WDA_ADDBA_REQ to HAL.
6372 msgQ.type = WDA_ADDBA_REQ;
6373 //
6374 // FIXME_AMPDU
6375 // A global counter (dialog token) is required to keep track of
6376 // all PE <-> HAL communication(s)
6377 //
6378 msgQ.reserved = 0;
6379 msgQ.bodyptr = pAddBAParams;
6380 msgQ.bodyval = 0;
6381
6382 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306383 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6384 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6385 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6386 pAddBAParams->baTimeout, pAddBAParams->baTID,
6387 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6388 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006389
6390 //defer any other message until we get response back.
6391 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6392
Jeff Johnsone7245742012-09-05 17:12:55 -07006393 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006394#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6395 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6396#endif //FEATURE_WLAN_DIAG_SUPPORT
6397
6398 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6399 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006400 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006401 retCode );
6402 else
6403 return retCode;
6404
6405returnFailure:
6406
6407 // Clean-up...
6408 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306409 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006410
6411 return retCode;
6412
6413}
6414
6415/**
6416 * \brief Send WDA_DELBA_IND to HAL, in order
6417 * to delete an existing BA session with peer
6418 *
6419 * \sa limPostMsgDelBAInd
6420 *
6421 * \param pMac The global tpAniSirGlobal object
6422 *
6423 * \param pSta Runtime, STA-related configuration cached
6424 * in the HashNode object
6425 *
6426 * \param baTID TID for which the BA session is being setup
6427 *
6428 * \param baDirection Identifies whether the DELBA Ind was
6429 * sent by the BA initiator or recipient
6430 *
6431 * \return none
6432 *
6433 */
6434tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6435 tpDphHashNode pSta,
6436 tANI_U8 baTID,
6437 tANI_U8 baDirection,
6438 tpPESession psessionEntry)
6439{
6440tpDelBAParams pDelBAParams = NULL;
6441tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006442tSirMsgQ msgQ;
6443
6444 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306445 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6446 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006447 {
6448 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306449 FL("AllocateMemory failed")
6450 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006451
6452 retCode = eSIR_MEM_ALLOC_FAILED;
6453 goto returnFailure;
6454 }
6455
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306456 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006457
6458 // Populate the REQ parameters
6459 pDelBAParams->staIdx = pSta->staIndex;
6460 pDelBAParams->baTID = baTID;
6461 pDelBAParams->baDirection = baDirection;
6462
6463 /* Update PE session ID */
6464
6465
6466 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6467 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6468
6469 // Post WDA_DELBA_IND to HAL.
6470 msgQ.type = WDA_DELBA_IND;
6471 //
6472 // FIXME:
6473 // A global counter (dialog token) is required to keep track of
6474 // all PE <-> HAL communication(s)
6475 //
6476 msgQ.reserved = 0;
6477 msgQ.bodyptr = pDelBAParams;
6478 msgQ.bodyval = 0;
6479
6480 limLog( pMac, LOGW,
6481 FL( "Sending SIR_HAL_DELBA_IND..." ));
6482
Jeff Johnsone7245742012-09-05 17:12:55 -07006483 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006484#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6485 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6486#endif //FEATURE_WLAN_DIAG_SUPPORT
6487
6488 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6489 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006490 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006491 retCode );
6492 else
6493 {
6494 // Update LIM's internal cache...
6495 if( eBA_INITIATOR == baDirection)
6496 {
6497 pSta->tcCfg[baTID].fUseBATx = 0;
6498 pSta->tcCfg[baTID].txBufSize = 0;
6499 }
6500 else
6501 {
6502 pSta->tcCfg[baTID].fUseBARx = 0;
6503 pSta->tcCfg[baTID].rxBufSize = 0;
6504 }
6505
6506 return retCode;
6507 }
6508
6509returnFailure:
6510
6511 // Clean-up...
6512 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306513 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006514
6515 return retCode;
6516
6517}
6518
6519/**
6520 * @function : limPostSMStateUpdate()
6521 *
6522 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6523 *
6524 * LOGIC:
6525 *
6526 * ASSUMPTIONS:
6527 * NA
6528 *
6529 * NOTE:
6530 * NA
6531 *
6532 * @param pMac - Pointer to Global MAC structure
6533 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6534 * @return None
6535 */
6536tSirRetStatus
6537limPostSMStateUpdate(tpAniSirGlobal pMac,
6538 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6539{
6540 tSirRetStatus retCode = eSIR_SUCCESS;
6541 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006542 tpSetMIMOPS pMIMO_PSParams;
6543
6544 msgQ.reserved = 0;
6545 msgQ.type = WDA_SET_MIMOPS_REQ;
6546
6547 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306548 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6549 if ( NULL == pMIMO_PSParams )
6550 {
6551 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006552 return eSIR_MEM_ALLOC_FAILED;
6553 }
6554
6555 pMIMO_PSParams->htMIMOPSState = state;
6556 pMIMO_PSParams->staIdx = staIdx;
6557 pMIMO_PSParams->fsendRsp = true;
6558 msgQ.bodyptr = pMIMO_PSParams;
6559 msgQ.bodyval = 0;
6560
6561 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6562
Jeff Johnsone7245742012-09-05 17:12:55 -07006563 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006564 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6565 if (eSIR_SUCCESS != retCode)
6566 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006567 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306568 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006569 return retCode;
6570 }
6571
6572 return retCode;
6573}
6574
6575void limPktFree (
6576 tpAniSirGlobal pMac,
6577 eFrameType frmType,
6578 tANI_U8 *pRxPacketInfo,
6579 void *pBody)
6580{
6581 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006582}
6583
6584/**
6585 * limGetBDfromRxPacket()
6586 *
6587 *FUNCTION:
6588 * This function is called to get pointer to Polaris
6589 * Buffer Descriptor containing MAC header & other control
6590 * info from the body of the message posted to LIM.
6591 *
6592 *LOGIC:
6593 * NA
6594 *
6595 *ASSUMPTIONS:
6596 * NA
6597 *
6598 *NOTE:
6599 * NA
6600 *
6601 * @param body - Received message body
6602 * @param pRxPacketInfo - Pointer to received BD
6603 * @return None
6604 */
6605
6606void
6607limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6608{
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006610} /*** end limGetBDfromRxPacket() ***/
6611
6612
6613
6614
6615
6616void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6617{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306618 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006619}
6620
6621
6622void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6623{
6624 tANI_U8 i;
6625 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6626
6627 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6628 {
6629 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6630 {
6631 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6632 fFound = eANI_BOOLEAN_TRUE;
6633 break;
6634 }
6635 }
6636 if(eANI_BOOLEAN_FALSE == fFound)
6637 {
6638 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6639 {
6640 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6641 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6642 }
6643 else
6644 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006645 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006646 }
6647 }
6648}
6649
6650
6651/**
6652 * @function : limIsChannelValidForChannelSwitch()
6653 *
6654 * @brief : This function checks if the channel to which AP
6655 * is expecting us to switch, is a valid channel for us.
6656 * LOGIC:
6657 *
6658 * ASSUMPTIONS:
6659 * NA
6660 *
6661 * NOTE:
6662 * NA
6663 *
6664 * @param pMac - Pointer to Global MAC structure
6665 * @param channel - New channel to which we are expected to move
6666 * @return None
6667 */
6668tAniBool
6669limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6670{
6671 tANI_U8 index;
6672 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6673 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6674
6675 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6676 (tANI_U8 *)validChannelList,
6677 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6678 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006679 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006680 return (eSIR_FALSE);
6681 }
6682
6683 for(index = 0; index < validChannelListLen; index++)
6684 {
6685 if(validChannelList[index] == channel)
6686 return (eSIR_TRUE);
6687 }
6688
6689 /* channel does not belong to list of valid channels */
6690 return (eSIR_FALSE);
6691}
6692
6693/**------------------------------------------------------
6694\fn __limFillTxControlParams
6695\brief Fill the message for stopping/resuming tx.
6696
6697\param pMac
6698\param pTxCtrlMsg - Pointer to tx control message.
6699\param type - Which way we want to stop/ resume tx.
6700\param mode - To stop/resume.
6701 -------------------------------------------------------*/
6702static eHalStatus
6703__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6704 tLimQuietTxMode type, tLimControlTx mode)
6705{
6706
6707 //TBD-RAJESH HOW TO GET sessionEntry?????
6708 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6709
6710 if (mode == eLIM_STOP_TX)
6711 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6712 else
6713 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6714
6715 switch (type)
6716 {
6717 case eLIM_TX_ALL:
6718 /** Stops/resumes transmission completely */
6719 pTxCtrlMsg->fCtrlGlobal = 1;
6720 break;
6721
6722 case eLIM_TX_BSS_BUT_BEACON:
6723 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6724 * stop beacon transmission.
6725 */
6726 pTxCtrlMsg->ctrlBss = 1;
6727 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6728 break;
6729
6730 case eLIM_TX_STA:
6731 /** Memory for station bitmap is allocated dynamically in caller of this
6732 * so decode properly here and fill the bitmap. Now not implemented,
6733 * fall through.
6734 */
6735 case eLIM_TX_BSS:
6736 //Fall thru...
6737 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006738 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 return eHAL_STATUS_FAILURE;
6740 }
6741
6742 return eHAL_STATUS_SUCCESS;
6743}
6744
6745/**
6746 * @function : limFrameTransmissionControl()
6747 *
6748 * @brief : This API is called by the user to halt/resume any frame
6749 * transmission from the device. If stopped, all frames will be
6750 * queued starting from hardware. Then back-pressure
6751 * is built till the driver.
6752 * LOGIC:
6753 *
6754 * ASSUMPTIONS:
6755 * NA
6756 *
6757 * NOTE:
6758 * NA
6759 *
6760 * @param pMac - Pointer to Global MAC structure
6761 * @return None
6762 */
6763void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6764{
6765
6766 eHalStatus status = eHAL_STATUS_FAILURE;
6767 tpTxControlParams pTxCtrlMsg;
6768 tSirMsgQ msgQ;
6769 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6770
6771 /** Allocate only required number of bytes for station bitmap
6772 * Make it to align to 4 byte boundary */
6773 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6774
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306775 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6776 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006777 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306778 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006779 return;
6780 }
6781
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306782 vos_mem_set((void *) pTxCtrlMsg,
6783 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006784 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6785 if (status != eHAL_STATUS_SUCCESS)
6786 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306787 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006788 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006789 return;
6790 }
6791
6792 msgQ.bodyptr = (void *) pTxCtrlMsg;
6793 msgQ.bodyval = 0;
6794 msgQ.reserved = 0;
6795 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6796
Jeff Johnsone7245742012-09-05 17:12:55 -07006797 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006798 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6799 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306800 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006801 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006802 return;
6803 }
6804
6805 if (mode == eLIM_STOP_TX)
6806 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306807 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 }
6809 else
6810 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306811 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 }
6813 return;
6814}
6815
6816
6817/**
6818 * @function : limRestorePreChannelSwitchState()
6819 *
6820 * @brief : This API is called by the user to undo any
6821 * specific changes done on the device during
6822 * channel switch.
6823 * LOGIC:
6824 *
6825 * ASSUMPTIONS:
6826 * NA
6827 *
6828 * NOTE:
6829 * NA
6830 *
6831 * @param pMac - Pointer to Global MAC structure
6832 * @return None
6833 */
6834
6835tSirRetStatus
6836limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6837{
6838
6839 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006840 tANI_U32 val = 0;
6841
6842 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6843 return retCode;
6844
6845 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006846 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006847
6848 /* Restore the frame transmission, all the time. */
6849 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6850
6851 /* Free to enter BMPS */
6852 limSendSmePostChannelSwitchInd(pMac);
6853
6854 //Background scan is now enabled by SME
6855 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6856 {
6857 /* Enable background scan if already enabled, else don't bother */
6858 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6859 &val)) != eSIR_SUCCESS)
6860
6861 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006862 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006863 return (retCode);
6864 }
6865
6866 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6867 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006868 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6869 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006870 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6871 {
6872 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6873 return (eSIR_FAILURE);
6874 }
6875
6876 }
6877 }
6878
6879 /* Enable heartbeat timer */
6880 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6881 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006882 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6883 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6884 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6885 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006886 {
6887 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6888 return (eSIR_FAILURE);
6889 }
6890 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006891 return (retCode);
6892}
6893
6894
6895/**--------------------------------------------
6896\fn limRestorePreQuietState
6897\brief Restore the pre quiet state
6898
6899\param pMac
6900\return NONE
6901---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006902tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006903{
6904
6905 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006906 tANI_U32 val = 0;
6907
6908 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6909 return retCode;
6910
6911 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006912 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006913
6914 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006915 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6917
6918
6919 //Background scan is now enabled by SME
6920 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6921 {
6922 /* Enable background scan if already enabled, else don't bother */
6923 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6924 &val)) != eSIR_SUCCESS)
6925
6926 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006927 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006928 return (retCode);
6929 }
6930
6931 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6932 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006933 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006934 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6935 {
6936 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6937 return (eSIR_FAILURE);
6938 }
6939
6940 }
6941 }
6942
6943 /* Enable heartbeat timer */
6944 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6945 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006946 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006947 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006948 {
6949 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6950 return (eSIR_FAILURE);
6951 }
6952 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006953 return (retCode);
6954}
6955
6956
6957/**
6958 * @function: limPrepareFor11hChannelSwitch()
6959 *
6960 * @brief : This API is called by the user to prepare for
6961 * 11h channel switch. As of now, the API does
6962 * very minimal work. User can add more into the
6963 * same API if needed.
6964 * LOGIC:
6965 *
6966 * ASSUMPTIONS:
6967 * NA
6968 *
6969 * NOTE:
6970 * NA
6971 *
6972 * @param pMac - Pointer to Global MAC structure
6973 * @param psessionEntry
6974 * @return None
6975 */
6976void
6977limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6978{
Jeff Johnson295189b2012-06-20 16:38:30 -07006979 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6980 return;
6981
6982 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006983 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006984
6985 /* Disable, Stop background scan if enabled and running */
6986 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6987
6988 /* Stop heart-beat timer to stop heartbeat disassociation */
6989 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6990
6991 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6992 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6993 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006994 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006995 /* Stop ongoing scanning if any */
6996 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6997 {
6998 //Set the resume channel to Any valid channel (invalid).
6999 //This will instruct HAL to set it to any previous valid channel.
7000 peSetResumeChannel(pMac, 0, 0);
7001 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7002 }
7003 else
7004 {
7005 limRestorePreChannelSwitchState(pMac, psessionEntry);
7006 }
7007 return;
7008 }
7009 else
7010 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007011 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007012 /** We are safe to switch channel at this point */
7013 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7014 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007015}
7016
7017
7018
7019/**----------------------------------------------------
7020\fn limGetNwType
7021
7022\brief Get type of the network from data packet or beacon
7023\param pMac
7024\param channelNum - Channel number
7025\param type - Type of packet.
7026\param pBeacon - Pointer to beacon or probe response
7027
7028\return Network type a/b/g.
7029-----------------------------------------------------*/
7030tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7031{
7032 tSirNwType nwType = eSIR_11B_NW_TYPE;
7033
7034 if (type == SIR_MAC_DATA_FRAME)
7035 {
7036 if ((channelNum > 0) && (channelNum < 15))
7037 {
7038 nwType = eSIR_11G_NW_TYPE;
7039 }
7040 else
7041 {
7042 nwType = eSIR_11A_NW_TYPE;
7043 }
7044 }
7045 else
7046 {
7047 if ((channelNum > 0) && (channelNum < 15))
7048 {
7049 int i;
7050 // 11b or 11g packet
7051 // 11g iff extended Rate IE is present or
7052 // if there is an A rate in suppRate IE
7053 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7054 {
7055 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7056 {
7057 nwType = eSIR_11G_NW_TYPE;
7058 break;
7059 }
7060 }
7061 if (pBeacon->extendedRatesPresent)
7062 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007063 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007064 nwType = eSIR_11G_NW_TYPE;
7065 }
7066 }
7067 else
7068 {
7069 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007070 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007071 nwType = eSIR_11A_NW_TYPE;
7072 }
7073 }
7074 return nwType;
7075}
7076
7077
7078/**---------------------------------------------------------
7079\fn limGetChannelFromBeacon
7080\brief To extract channel number from beacon
7081
7082\param pMac
7083\param pBeacon - Pointer to beacon or probe rsp
7084\return channel number
7085-----------------------------------------------------------*/
7086tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7087{
7088 tANI_U8 channelNum = 0;
7089
7090 if (pBeacon->dsParamsPresent)
7091 channelNum = pBeacon->channelNumber;
7092 else if(pBeacon->HTInfo.present)
7093 channelNum = pBeacon->HTInfo.primaryChannel;
7094 else
7095 channelNum = pBeacon->channelNumber;
7096
7097 return channelNum;
7098}
7099
7100
7101/** ---------------------------------------------------------
7102\fn limSetTspecUapsdMask
7103\brief This function sets the PE global variable:
7104\ 1) gUapsdPerAcTriggerEnableMask and
7105\ 2) gUapsdPerAcDeliveryEnableMask
7106\ based on the user priority field and direction field
7107\ in the TS Info Fields.
7108\
7109\ An AC is a trigger-enabled AC if the PSB subfield
7110\ is set to 1 in the uplink direction.
7111\ An AC is a delivery-enabled AC if the PSB subfield
7112\ is set to 1 in the down-link direction.
7113\
7114\param tpAniSirGlobal pMac
7115\param tSirMacTSInfo pTsInfo
7116\param tANI_U32 action
7117\return None
7118 ------------------------------------------------------------*/
7119void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7120{
7121 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7122 tANI_U16 direction = pTsInfo->traffic.direction;
7123 tANI_U8 ac = upToAc(userPrio);
7124
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307125 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 -07007126
7127 /* Converting AC to appropriate Uapsd Bit Mask
7128 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7129 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7130 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7131 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7132 */
7133 ac = ((~ac) & 0x3);
7134
7135 if (action == CLEAR_UAPSD_MASK)
7136 {
7137 if (direction == SIR_MAC_DIRECTION_UPLINK)
7138 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7139 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7140 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7141 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7142 {
7143 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7144 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7145 }
7146 }
7147 else if (action == SET_UAPSD_MASK)
7148 {
7149 if (direction == SIR_MAC_DIRECTION_UPLINK)
7150 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7151 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7152 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7153 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7154 {
7155 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7156 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7157 }
7158 }
7159
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007160 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7161 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007162
7163 return;
7164}
7165
7166
7167
7168void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7169{
7170
7171 tANI_U8 i;
7172 for(i =0;i < pMac->lim.maxBssId;i++)
7173 {
7174 if(pMac->lim.gpSession[i].valid == TRUE )
7175 {
7176 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7177 {
7178 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7179 break;
7180 }
7181
7182 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7183 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7184 {
7185 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7186 }
7187 }
7188 }
7189 for(i=0; i< pMac->lim.maxBssId; i++)
7190 {
7191 if(pMac->lim.gpSession[i].valid == TRUE )
7192 {
7193 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7194 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7195 {
7196 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7197 {
7198 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007199 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007200 i);)
7201 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7202 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7203 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7204 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007205 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007206 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7207 }
7208 break;
7209 }
7210 }
7211 }
7212 }
7213}
7214
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007215void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7216{
7217 if(psessionEntry->valid == TRUE )
7218 {
7219 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7220 {
7221 limIbssHeartBeatHandle(pMac,psessionEntry);
7222 }
7223 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7224 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7225 {
7226 limHandleHeartBeatFailure(pMac,psessionEntry);
7227 }
7228 }
7229 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7230 and the other things again */
7231 if(psessionEntry->valid == TRUE )
7232 {
7233 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7234 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7235 {
7236 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7237 {
7238 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7239 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7240 psessionEntry->bssIdx);)
7241 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7242 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7243 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7244 {
7245 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7246 limReactivateHeartBeatTimer(pMac, psessionEntry);
7247 }
7248 }
7249 }
7250 }
7251}
7252
7253
Jeff Johnson295189b2012-06-20 16:38:30 -07007254tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7255{
7256 tANI_U8 i;
7257 for(i =0;i < pMac->lim.maxBssId;i++)
7258 {
7259 if(pMac->lim.gpSession[i].valid == TRUE )
7260 {
7261 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7262 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7263 {
7264 return pMac->lim.gpSession[i].currentOperChannel;
7265 }
7266 }
7267 }
7268 return 0;
7269}
7270
7271void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7272{
7273
7274 tpPESession psessionEntry;
7275// tANI_U8 sessionId;
7276 tpAddStaParams pAddStaParams;
7277
7278 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7279
7280 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7281 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007282 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307283 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007284 return;
7285 }
7286 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7287 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007288#ifdef FEATURE_WLAN_TDLS
7289 else if(pMac->lim.gLimAddStaTdls)
7290 {
7291 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7292 pMac->lim.gLimAddStaTdls = FALSE ;
7293 }
7294#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007295 else
7296 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7297
7298}
7299
7300
7301void limUpdateBeacon(tpAniSirGlobal pMac)
7302{
7303 tANI_U8 i;
7304
7305 for(i =0;i < pMac->lim.maxBssId;i++)
7306 {
7307 if(pMac->lim.gpSession[i].valid == TRUE )
7308 {
7309 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7310 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7311 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7312 )
7313 {
7314 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7315 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7316 }
7317 else
7318 {
7319 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7320 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7321 {
7322
7323 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7324 {
7325 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7326 }
7327 }
7328 }
7329 }
7330 }
7331}
7332
7333void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7334{
7335 tANI_U8 i;
7336 tpPESession psessionEntry;
7337 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7338 for(i =0; i < pMac->lim.maxBssId; i++)
7339 {
7340 if(pMac->lim.gpSession[i].valid == TRUE)
7341 {
7342 psessionEntry = &pMac->lim.gpSession[i];
7343 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7344 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307345 limLog(pMac, LOGE,
7346 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7347 psessionEntry->limSmeState, psessionEntry->limMlmState,
7348 psessionEntry->LimRxedBeaconCntDuringHB,
7349 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007350#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7351 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7352#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007353 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7354 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307355 /* Disconnect even if we have not received a single beacon
7356 * after connection.
7357 */
7358 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7359 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307360 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7361 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007362 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007363 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007364 /* AP did not respond to Probe Request. Tear down link with it.*/
7365 limTearDownLinkWithAp(pMac,
7366 psessionEntry->peSessionId,
7367 eSIR_BEACON_MISSED);
7368 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7369 }
7370 else // restart heartbeat timer
7371 {
7372 limReactivateHeartBeatTimer(pMac, psessionEntry);
7373 }
7374 }
7375 else
7376 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007377 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007378 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7379 limReactivateHeartBeatTimer(pMac, psessionEntry);
7380 }
7381
7382 }
7383 }
7384 }
7385 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7386 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7387}
7388
7389
7390/*
7391* This function assumes there will not be more than one IBSS session active at any time.
7392*/
7393tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7394{
7395 tANI_U8 i;
7396
7397 for(i =0;i < pMac->lim.maxBssId;i++)
7398 {
7399 if( (pMac->lim.gpSession[i].valid) &&
7400 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7401 return (&pMac->lim.gpSession[i]);
7402 }
7403
7404 return NULL;
7405}
7406
7407tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7408{
7409 tANI_U8 i;
7410
7411 for(i =0;i < pMac->lim.maxBssId;i++)
7412 {
7413 if( (pMac->lim.gpSession[i].valid) &&
7414 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7415 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7416 return (&pMac->lim.gpSession[i]);
7417 }
7418
7419 return NULL;
7420}
7421
7422/**---------------------------------------------------------
7423\fn limHandleDeferMsgError
7424\brief handles error scenario, when the msg can not be deferred.
7425\param pMac
7426\param pLimMsg LIM msg, which could not be deferred.
7427\return void
7428-----------------------------------------------------------*/
7429
7430void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7431{
7432 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7433 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307434 /*Decrement the Pending count before droping */
7435 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007436 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7437 }
7438 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007439 {
7440 vos_mem_free( pLimMsg->bodyptr);
7441 pLimMsg->bodyptr = NULL;
7442 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007443}
7444
7445
7446#ifdef FEATURE_WLAN_DIAG_SUPPORT
7447/**---------------------------------------------------------
7448\fn limDiagEventReport
7449\brief This function reports Diag event
7450\param pMac
7451\param eventType
7452\param bssid
7453\param status
7454\param reasonCode
7455\return void
7456-----------------------------------------------------------*/
7457void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7458{
7459 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7460 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7461
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307462 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007463
7464 if (NULL == pSessionEntry)
7465 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307466 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007467 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7468 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7469
7470 }
7471 else
7472 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307473 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007474 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7475 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7476 }
7477 peEvent.event_type = eventType;
7478 peEvent.status = status;
7479 peEvent.reason_code = reasonCode;
7480
7481 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7482 return;
7483}
7484
7485#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7486
7487void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7488{
7489
7490 tpAddStaSelfParams pAddStaSelfParams;
7491 tSirMsgQ mmhMsg;
7492 tpSirSmeAddStaSelfRsp pRsp;
7493
7494
7495 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7496
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7498 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007499 {
7500 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307501 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7502 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007503 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 return;
7505 }
7506
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307507 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007508
7509 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7510 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7511 pRsp->status = pAddStaSelfParams->status;
7512
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307513 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007514
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307515 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007516 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007517
7518 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7519 mmhMsg.bodyptr = pRsp;
7520 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307521 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007522 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7523
7524}
7525
7526void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7527{
7528
7529 tpDelStaSelfParams pDelStaSelfParams;
7530 tSirMsgQ mmhMsg;
7531 tpSirSmeDelStaSelfRsp pRsp;
7532
7533
7534 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7535
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307536 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7537 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007538 {
7539 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307540 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7541 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007542 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007543 return;
7544 }
7545
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307546 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007547
7548 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7549 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7550 pRsp->status = pDelStaSelfParams->status;
7551
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307552 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007553
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307554 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007555 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007556
7557 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7558 mmhMsg.bodyptr = pRsp;
7559 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307560 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007561 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7562
7563}
7564
7565/***************************************************************
7566* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7567* To unmap the channel to reverse the effect of mapping
7568* a band channel in hal .Mapping was done hal to overcome the
7569* limitation of the rxbd which use only 4 bit for channel number.
7570*****************************************************************/
7571tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7572{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007573#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007574 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007575 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7576 return aUnsortedChannelList[mapChannel -1];
7577 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007578#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007579 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007580#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007581 return abChannel[mapChannel -1];
7582 else
7583 return 0;
7584}
7585
7586
7587v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7588{
7589 int left = length;
7590 v_U8_t *ptr = pIes;
7591 v_U8_t elem_id;
7592 v_U16_t elem_len;
7593
7594 while(left >= (size_of_len_field+1))
7595 {
7596 elem_id = ptr[0];
7597 if (size_of_len_field == TWO_BYTE)
7598 {
7599 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7600 }
7601 else
7602 {
7603 elem_len = ptr[1];
7604 }
7605
7606
7607 left -= (size_of_len_field+1);
7608 if(elem_len > left)
7609 {
7610 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007611 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007612 eid,elem_len,left);
7613 return NULL;
7614 }
7615 if (elem_id == eid)
7616 {
7617 return ptr;
7618 }
7619
7620 left -= elem_len;
7621 ptr += (elem_len + (size_of_len_field+1));
7622 }
7623 return NULL;
7624}
7625
7626/* return NULL if oui is not found in ie
7627 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7628 */
7629v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7630{
7631 int left = ie_len;
7632 v_U8_t *ptr = ie;
7633 v_U8_t elem_id, elem_len;
7634
7635 while(left >= 2)
7636 {
7637 elem_id = ptr[0];
7638 elem_len = ptr[1];
7639 left -= 2;
7640 if(elem_len > left)
7641 {
7642 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007643 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007644 elem_id,elem_len,left);
7645 return NULL;
7646 }
7647 if (SIR_MAC_EID_VENDOR == elem_id)
7648 {
7649 if(memcmp(&ptr[2], oui, oui_size)==0)
7650 return ptr;
7651 }
7652
7653 left -= elem_len;
7654 ptr += (elem_len + 2);
7655 }
7656 return NULL;
7657}
7658
Jeff Johnson295189b2012-06-20 16:38:30 -07007659//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7660
7661v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7662{
7663 int length = 0;
7664 tANI_U8 *ptr = ie;
7665
7666 ptr[length++] = SIR_MAC_EID_VENDOR;
7667 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307668 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7669 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007670 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7671}
7672
7673//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7674
7675v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7676{
7677 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007678
7679 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7680 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7681 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307682 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007683 noaStream + noaLen - overFlowLen, overFlowLen);
7684 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7685 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307686 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007687 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307688 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7689 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007690 }
7691
Jeff Johnson295189b2012-06-20 16:38:30 -07007692 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7693
7694}
7695
7696//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7697v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7698{
7699 v_U8_t len=0;
7700
7701 v_U8_t *pBody = pNoaStream;
7702
7703
7704 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7705 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7706 {
7707 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7708 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7709 )
7710 return 0; //No NoA Descriptor then return 0
7711
7712
7713 pBody[0] = SIR_P2P_NOA_ATTR;
7714
7715 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7716 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7717 len = 5;
7718 pBody += len;
7719
7720
7721 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7722 {
7723 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7724 pBody += 1;
7725 len +=1;
7726
7727 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7728 pBody += sizeof(tANI_U32);
7729 len +=4;
7730
7731 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7732 pBody += sizeof(tANI_U32);
7733 len +=4;
7734
7735 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7736 pBody += sizeof(tANI_U32);
7737 len +=4;
7738
7739 }
7740
7741 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7742 {
7743 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7744 pBody += 1;
7745 len +=1;
7746
7747 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7748 pBody += sizeof(tANI_U32);
7749 len +=4;
7750
7751 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7752 pBody += sizeof(tANI_U32);
7753 len +=4;
7754
7755 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7756 pBody += sizeof(tANI_U32);
7757 len +=4;
7758
7759 }
7760
7761
7762 pBody = pNoaStream + 1;
7763 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7764
7765 return (len);
7766
7767 }
7768 return 0;
7769
7770}
Jeff Johnsone7245742012-09-05 17:12:55 -07007771
7772void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007773{
7774
7775 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007776 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007777}
Jeff Johnsone7245742012-09-05 17:12:55 -07007778
Jeff Johnson295189b2012-06-20 16:38:30 -07007779/*--------------------------------------------------------------------------
7780
7781 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7782
Jeff Johnsone7245742012-09-05 17:12:55 -07007783 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7784 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007785
7786 \param pMac - pointer to global adapter context
7787 \return - channel to scan from valid session else zero.
7788
7789 \sa
7790
7791 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007792void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007793{
7794
7795 //Rationale - this could be the suspend/resume for assoc and it is essential that
7796 //the new BSS is active for some time. Other BSS was anyway suspended.
7797 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7798 //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 -07007799 //and hence should be ok. Need to discuss this further
7800 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007801 {
7802 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007803 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007804 }
7805 else
7806 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007807 *resumeChannel = pMac->lim.gResumeChannel;
7808 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007809 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007810 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007811}
7812
Viral Modid86bde22012-12-10 13:09:21 -08007813tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7814{
7815 tANI_U8 i;
7816 for(i =0; i < pMac->lim.maxBssId; i++)
7817 {
7818 if(pMac->lim.gpSession[i].valid == TRUE)
7819 {
7820 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7821 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7822 )
7823 {
7824 return TRUE;
7825 }
7826 }
7827 }
7828 return FALSE;
7829}
Jeff Johnsone7245742012-09-05 17:12:55 -07007830
Jeff Johnson295189b2012-06-20 16:38:30 -07007831
7832tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7833{
7834 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7835 {
7836 return eANI_BOOLEAN_TRUE;
7837 }
7838 else
7839 {
7840 return eANI_BOOLEAN_FALSE;
7841 }
7842}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007843
Sandeep Puligilla60342762014-01-30 21:05:37 +05307844/**
7845 * \brief verify the changes in channel bonding
7846 *
7847 * \param pMac Pointer to the global MAC structure
7848 *
7849 * \param psessionEntry session entry
7850 * beaconSecChanWidth Secondary channel width
7851 * advertized in beacon
7852 * currentSecChanWidth Current configured width
7853 * staId Station Id
7854 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7855 */
7856tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7857 tpPESession psessionEntry,
7858 tANI_U8 beaconSecChanWidth,
7859 tANI_U8 currentSecChanWidth,
7860 tANI_U8 staId)
7861{
7862 tUpdateVHTOpMode tempParam;
7863 tANI_BOOLEAN fCbMode24G = FALSE;
7864 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7865
7866 /* Moving from HT40 to HT20 operation*/
7867 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7868 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7869 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7870 {
7871 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7872 tempParam.staId = staId;
7873 fCbMode24G = TRUE;
7874 }
7875
7876 /* Moving from HT20 to HT40 operation*/
7877 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7878 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7879 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7880 {
7881 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7882 tempParam.staId = staId;
7883 fCbMode24G = TRUE;
7884 }
7885
7886 if (TRUE == fCbMode24G)
7887 {
7888 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7889 "Changing CBMODE to = %d staId = %d",
7890 tempParam.opMode, tempParam.staId );
7891 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7892 status = eANI_BOOLEAN_TRUE;
7893 }
7894 return status;
7895}
7896
Mohit Khanna4a70d262012-09-11 16:30:12 -07007897#ifdef WLAN_FEATURE_11AC
7898tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7899{
7900 tUpdateVHTOpMode tempParam;
7901
7902 tempParam.opMode = chanWidth;
7903 tempParam.staId = staId;
7904
7905 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7906
7907 return eANI_BOOLEAN_TRUE;
7908}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007909#endif
7910
krunal soni45b9eb62014-03-26 12:54:25 -07007911void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7912 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007913{
7914 tANI_U8 val=0;
7915
krunal soni45b9eb62014-03-26 12:54:25 -07007916 //only 2.4G band should have short slot enable, rest it should be default
7917 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007918 {
krunal soni45b9eb62014-03-26 12:54:25 -07007919 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007920 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007921 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007922 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7923 {
7924 val = true;
7925 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007926 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007927 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007928 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007929 // Joining BSS.
7930 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007931 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007932 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007933 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007934 // Reassociating with AP.
7935 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007936 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007937 }
krunal soni45b9eb62014-03-26 12:54:25 -07007938 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007939 {
krunal soni45b9eb62014-03-26 12:54:25 -07007940 /*
7941 * 11B does not short slot and short slot is default
7942 * for 11A mode. Hence, not need to set this bit
7943 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007944 val = false;
7945 }
krunal soni45b9eb62014-03-26 12:54:25 -07007946
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007947 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007948 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007949}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307950
Kalikinkar dhara205da782014-03-21 15:49:32 -07007951void limUtilsframeshtons(tpAniSirGlobal pCtx,
7952 tANI_U8 *pOut,
7953 tANI_U16 pIn,
7954 tANI_U8 fMsb)
7955{
7956 (void)pCtx;
7957#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7958 if ( !fMsb )
7959 {
7960 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7961 }
7962 else
7963 {
7964 *pOut = ( pIn & 0xff00 ) >> 8;
7965 *( pOut + 1 ) = pIn & 0xff;
7966 }
7967#else
7968 if ( !fMsb )
7969 {
7970 *pOut = pIn & 0xff;
7971 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7972 }
7973 else
7974 {
7975 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7976 }
7977#endif
7978}
7979
7980void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7981 tANI_U8 *pOut,
7982 tANI_U32 pIn,
7983 tANI_U8 fMsb)
7984{
7985 (void)pCtx;
7986#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7987 if ( !fMsb )
7988 {
7989 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7990 }
7991 else
7992 {
7993 *pOut = ( pIn & 0xff000000 ) >> 24;
7994 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7995 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7996 *( pOut + 3 ) = ( pIn & 0x000000ff );
7997 }
7998#else
7999 if ( !fMsb )
8000 {
8001 *( pOut ) = ( pIn & 0x000000ff );
8002 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8003 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8004 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8005 }
8006 else
8007 {
8008 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8009 }
8010#endif
8011}
8012
8013
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308014/**--------------------------------------------
8015\fn limUpdateOBSSScanParams
8016\brief Updates OBSS SCAN IE parameters to session
8017
8018\param psessionEntry - Session Entry
8019\return NONE
8020---------------------------------------------*/
8021void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8022 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8023{
8024 /*If the recieved value is not in the range specified by the Specification
8025 then it will be the default value configured through cfg */
8026 if (( pOBSSScanParameters->obssScanActiveDwell >
8027 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8028 ( pOBSSScanParameters->obssScanActiveDwell <
8029 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8030 {
8031 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8032 pOBSSScanParameters->obssScanActiveDwell;
8033 }
8034 if((pOBSSScanParameters->obssScanPassiveDwell >
8035 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8036 (pOBSSScanParameters->obssScanPassiveDwell <
8037 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8038 {
8039 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8040 pOBSSScanParameters->obssScanPassiveDwell;
8041 }
8042 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8043 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8044 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8045 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8046 {
8047 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8048 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8049 }
8050 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8051 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8052 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8053 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8054 {
8055 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8056 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8057 }
8058 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8059 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8060 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8061 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8062 {
8063 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8064 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8065 }
8066 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8067 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8068 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8069 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8070 {
8071 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8072 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8073 }
8074 if((pOBSSScanParameters->obssScanActivityThreshold >
8075 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8076 (pOBSSScanParameters->obssScanActivityThreshold <
8077 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8078 {
8079 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8080 pOBSSScanParameters->obssScanActivityThreshold;
8081 }
8082}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008083
8084#ifdef WLAN_FEATURE_11W
8085void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8086{
8087 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8088 tPmfSaQueryTimerId timerId;
8089 tpPESession psessionEntry;
8090 tpDphHashNode pSta;
8091 tANI_U32 maxRetries;
8092
8093 limLog(pMac, LOG1, FL("SA Query timer fires"));
8094 timerId.value = param;
8095
8096 // Check that SA Query is in progress
8097 if ((psessionEntry = peFindSessionBySessionId(
8098 pMac, timerId.fields.sessionId)) == NULL)
8099 {
8100 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8101 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008102 return;
8103 }
8104 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8105 &psessionEntry->dph.dphHashTable)) == NULL)
8106 {
8107 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8108 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008109 return;
8110 }
8111 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8112 return;
8113
8114 // Increment the retry count, check if reached maximum
8115 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8116 &maxRetries) != eSIR_SUCCESS)
8117 {
8118 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8119 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8120 return;
8121 }
8122 pSta->pmfSaQueryRetryCount++;
8123 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8124 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308125 limLog(pMac, LOGE,
8126 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8127 MAC_ADDR_ARRAY(pSta->staAddr));
8128 limSendDisassocMgmtFrame(pMac,
8129 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8130 pSta->staAddr, psessionEntry, FALSE);
8131 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008132 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8133 return;
8134 }
8135
8136 // Retry SA Query
8137 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8138 pSta->staAddr, psessionEntry);
8139 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008140 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8141 {
8142 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8143 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8144 }
8145}
8146#endif
8147
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008148/** ---------------------------------------------------------
8149\fn limProcessChannelSwitchSuspendLink
8150\brief This function call channel switch functions based on
8151 the gLimChannelSwitch.state. After function return it
8152 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8153 If gLimChannelSwitch.state is non-identified then
8154 print error log as well as restore back the
8155 pre-channelSwitch.
8156\param tpAniSirGlobal pMac
8157\param eHalStatus status
8158\param tANI_U32 *ctx
8159\return None
8160 ------------------------------------------------------------*/
8161static void
8162limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8163 eHalStatus status,
8164 tANI_U32 *ctx)
8165{
8166 tpPESession pSessionEntry = (tpPESession)ctx;
8167
8168 if ( eHAL_STATUS_SUCCESS != status )
8169 {
8170 limLog(pMac, LOGE,
8171 FL("Suspend link failed. still proceeding "));
8172 }
8173 if (NULL == pSessionEntry )
8174 {
8175 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8176 return;
8177 }
8178
8179 switch(pSessionEntry->gLimChannelSwitch.state)
8180 {
8181 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8182 PELOGW(limLog(pMac, LOGW,
8183 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8184 limSwitchPrimaryChannel(pMac,
8185 pSessionEntry->gLimChannelSwitch.primaryChannel,
8186 pSessionEntry);
8187 pSessionEntry->gLimChannelSwitch.state =
8188 eLIM_CHANNEL_SWITCH_IDLE;
8189 break;
8190
8191 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8192 PELOGW(limLog(pMac, LOGW,
8193 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8194 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8195 pSessionEntry->gLimChannelSwitch.primaryChannel,
8196 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8197 pSessionEntry->gLimChannelSwitch.state =
8198 eLIM_CHANNEL_SWITCH_IDLE;
8199 break;
8200
8201 default:
8202 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8203 pSessionEntry->gLimChannelSwitch.state);)
8204 if (limRestorePreChannelSwitchState(pMac,
8205 pSessionEntry) != eSIR_SUCCESS)
8206 {
8207 limLog(pMac, LOGE,
8208 FL("Could not restore pre-channelSwitch "
8209 "(11h) state, resetting the system"));
8210 }
8211 }
8212}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308213
8214/** ---------------------------------------------------------
8215\fn limInitOBSSScanParams
8216\brief This function Initializes the OBSS Scan Parameters
8217\param tpAniSirGlobal pMac
8218\param tpPESession pSessionEntry
8219\return None
8220 ------------------------------------------------------------*/
8221
8222void limInitOBSSScanParams(tpAniSirGlobal pMac,
8223 tpPESession psessionEntry)
8224{
8225 tANI_U32 cfgValue;
8226
8227 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8228 &cfgValue) != eSIR_SUCCESS)
8229 {
8230 limLog(pMac, LOGE, FL("Fail to retrieve "
8231 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8232 return ;
8233 }
8234 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8235
8236 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8237 &cfgValue) != eSIR_SUCCESS)
8238 {
8239 limLog(pMac, LOGE, FL("Fail to retrieve "
8240 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8241 return ;
8242 }
8243 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8244
8245 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8246 &cfgValue) != eSIR_SUCCESS)
8247 {
8248 limLog(pMac, LOGE, FL("Fail to retrieve "
8249 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8250 return ;
8251 }
8252 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8253 = cfgValue;
8254 if (wlan_cfgGetInt(pMac,
8255 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8256 &cfgValue) != eSIR_SUCCESS)
8257 {
8258 limLog(pMac, LOGE, FL("Fail to retrieve"
8259 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8260 return ;
8261 }
8262 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8263 cfgValue;
8264 if (wlan_cfgGetInt(pMac,
8265 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8266 != eSIR_SUCCESS)
8267 {
8268 limLog(pMac, LOGE, FL("Fail to retrieve"
8269 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8270 return ;
8271 }
8272 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8273 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308274
8275 if (wlan_cfgGetInt(pMac,
8276 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8277 != eSIR_SUCCESS)
8278 {
8279 limLog(pMac, LOGE, FL("Fail to retrieve"
8280 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8281 return ;
8282 }
8283 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8284 cfgValue;
8285
8286
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308287 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8288 &cfgValue) != eSIR_SUCCESS)
8289 {
8290 limLog(pMac, LOGE, FL("Fail to retrieve "
8291 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8292 return ;
8293 }
8294 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308295}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308296
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308297const char * lim_ScanTypetoString(const v_U8_t scanType)
8298{
8299 switch (scanType)
8300 {
8301 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8302 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8303 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8304 default:
8305 return "Unknown ScanType";
8306 }
8307}
8308
8309const char * lim_BssTypetoString(const v_U8_t bssType)
8310{
8311 switch (bssType)
8312 {
8313 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8314 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8315 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8316 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8317 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8318 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8319 default:
8320 return "Unknown BssType";
8321 }
8322}
8323
8324const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8325{
8326 switch (mode)
8327 {
8328 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8329 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8330 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8331 default:
8332 return "Unknown BgScanMode";
8333 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308334}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308335
8336#ifdef WLAN_FEATURE_11W
8337/**
8338 *
8339 * \brief This function is called by various LIM modules to correctly set
8340 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8341 *
8342 *
8343 * \param pMac Pointer to Global MAC structure
8344 *
8345 * \param psessionEntry Pointer to session corresponding to the connection
8346 *
8347 * \param peer Peer address of the STA to which the frame is to be sent
8348 *
8349 * \param pMacHdr Pointer to the frame MAC header
8350 *
8351 * \return nothing
8352 *
8353 *
8354 */
8355void
8356limSetProtectedBit(tpAniSirGlobal pMac,
8357 tpPESession psessionEntry,
8358 tSirMacAddr peer,
8359 tpSirMacMgmtHdr pMacHdr)
8360{
8361 tANI_U16 aid;
8362 tpDphHashNode pStaDs;
8363
8364 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8365 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8366 {
8367
8368 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8369 &psessionEntry->dph.dphHashTable );
8370 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308371 /* rmfenabled will be set at the time of addbss.
8372 * but sometimes EAP auth fails and keys are not
8373 * installed then if we send any management frame
8374 * like deauth/disassoc with this bit set then
8375 * firmware crashes. so check for keys are
8376 * installed or not also before setting the bit
8377 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308378 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308379 pMacHdr->fc.wep = 1;
8380 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308381 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308382 pMacHdr->fc.wep = 1;
8383} /*** end limSetProtectedBit() ***/
8384#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308385
8386tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8387{
8388 int left = length;
8389 tANI_U8 *ptr = pIes;
8390 tANI_U8 elem_id,elem_len;
8391
8392 while (left >= 2)
8393 {
8394 elem_id = ptr[0];
8395 elem_len = ptr[1];
8396 left -= 2;
8397
8398 if (elem_len > left)
8399 {
8400 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8401 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8402 eid,elem_len,left);
8403 return NULL;
8404 }
8405 if (elem_id == eid)
8406 {
8407 return ptr;
8408 }
8409
8410 left -= elem_len;
8411 ptr += (elem_len + 2);
8412 }
8413 return NULL;
8414}
8415
8416
8417void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8418{
8419
8420 tANI_U32 nPayload;
8421 tANI_U8 *pPayload;
8422 tANI_U8 *ieptr;
8423 tSirMacTim *tim;
8424
8425 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8426 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8427
8428 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8429 {
8430 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8431 return;
8432 }
8433
8434 if (NULL !=
8435 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8436 nPayload, SIR_MAC_TIM_EID)))
8437 {
8438 /* Ignore EID and Length field*/
8439 tim = (tSirMacTim *)(ieptr + 2);
8440
8441 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8442 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8443 if (tim->dtimCount >= MAX_DTIM_COUNT)
8444 tim->dtimCount = DTIM_COUNT_DEFAULT;
8445 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8446 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8447 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8448 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8449 psessionEntry->currentBssBeaconCnt++;
8450
8451 limLog(pMac, LOG1,
8452 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8453 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8454 psessionEntry->lastBeaconDtimPeriod);
8455
8456 }
8457 return;
8458}
Girish Gowlia95daca2015-02-04 20:31:31 +05308459
8460void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8461 tANI_U8 smeSessionId,
8462 tANI_U32 maxRateFlag)
8463{
8464 tpSirSmeUpdateMaxRateParams pRsp;
8465 tSirMsgQ msg;
8466
8467 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8468 if (NULL == pRsp)
8469 {
8470 limLog(pMac, LOGP, FL("Memory allocation failed"));
8471 return;
8472 }
8473 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8474 pRsp->maxRateFlag = maxRateFlag;
8475 pRsp->smeSessionId = smeSessionId;
8476 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8477 msg.bodyptr = pRsp;
8478 msg.bodyval = 0;
8479 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8480 return;
8481}
Abhishek Singh5d765712015-03-12 14:04:16 +05308482
8483void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8484{
8485 if( pMac->sys.gSysBbtPendingMgmtCount )
8486 {
8487 vos_spin_lock_acquire( &pMac->sys.lock );
8488 pMac->sys.gSysBbtPendingMgmtCount--;
8489 vos_spin_lock_release( &pMac->sys.lock );
8490 }
8491 else
8492 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8493}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308494
8495eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8496{
8497 tpSirTxBdStatus pTxBdStatus;
8498
8499 if (!pData)
8500 {
8501 limLog(pMac, LOGE, FL("pData is NULL"));
8502 return eHAL_STATUS_FAILURE;
8503 }
8504
8505 pTxBdStatus = (tpSirTxBdStatus) pData;
8506
8507 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8508 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8509 return eHAL_STATUS_SUCCESS;
8510}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308511
8512/**
8513 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8514 * robust action frame
8515 * @action_catagory: Action frame catagory.
8516 *
8517 * This function is used to check if given action catagory is robust
8518 * action frame.
8519 *
8520 * Return: bool
8521 */
8522bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8523{
8524 switch (action_catagory) {
8525 /*
8526 * NOTE: This function doesn't take care of the DMG
8527 * (Directional Multi-Gigatbit) BSS case as 8011ad
8528 * support is not yet added. In future, if the support
8529 * is required then this function need few more arguments
8530 * and little change in logic.
8531 */
8532 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8533 case SIR_MAC_ACTION_QOS_MGMT:
8534 case SIR_MAC_ACTION_DLP:
8535 case SIR_MAC_ACTION_BLKACK:
8536 case SIR_MAC_ACTION_RRM:
8537 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8538 case SIR_MAC_ACTION_SA_QUERY:
8539 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8540 case SIR_MAC_ACTION_WNM:
8541 case SIR_MAC_ACITON_MESH:
8542 case SIR_MAC_ACTION_MHF:
8543 case SIR_MAC_ACTION_FST:
8544 return true;
8545 default:
8546 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8547 FL("non-PMF action category[%d] "),
8548 action_catagory);
8549 break;
8550 }
8551 return false;
8552}