blob: a10d23a6bc1d2966a8efba848cd0ce58971af185 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sushant Kaushik02c866d2015-01-16 15:24:25 +05302 * Copyright (c) 2011-2015. The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080028
Kiet Lam842dad02014-02-18 18:44:02 -080029/*
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limUtils.cc contains the utility functions
31 * LIM uses.
32 * Author: Chandra Modumudi
33 * Date: 02/13/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 */
38
39#include "schApi.h"
40#include "limUtils.h"
41#include "limTypes.h"
42#include "limSecurityUtils.h"
43#include "limPropExtsUtils.h"
44#include "limSendMessages.h"
45#include "limSerDesUtils.h"
46#include "limAdmitControl.h"
47#include "limStaHashApi.h"
48#include "dot11f.h"
Kalikinkar dhara205da782014-03-21 15:49:32 -070049#include "dot11fdefs.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070050#include "wmmApsd.h"
51#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080052#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070053#include "vos_diag_core_event.h"
54#endif //FEATURE_WLAN_DIAG_SUPPORT
55#include "limIbssPeerMgmt.h"
56#include "limSessionUtils.h"
57#include "limSession.h"
58#include "vos_nvitem.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080059#ifdef WLAN_FEATURE_11W
Satyanarayana Dash6f438272015-03-03 18:01:06 +053060#include "wniCfg.h"
Chet Lanctot8cecea22014-02-11 19:09:36 -080061#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
64 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
65 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
66 * this information. */
67static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
68
69/* 11A Channel list to decode RX BD channel information */
70static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070071 120,124,128,132,136,140,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080072#define abChannelSize (sizeof(abChannel)/ \
73 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070074
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070075#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
76static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070077 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080078#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
79 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070080#endif
81
Arif Hussain6af38622014-03-12 12:39:57 -070082//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070083#define SUCCESS 1 //defined temporarily for BT-AMP
84
Agarwal Ashish87039eb2014-01-15 14:13:15 +053085#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Sushant Kaushik02c866d2015-01-16 15:24:25 +053086#define MAX_DTIM_PERIOD 15
87#define MAX_DTIM_COUNT 15
88#define DTIM_PERIOD_DEFAULT 1
89#define DTIM_COUNT_DEFAULT 1
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080090static void
91limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
92 eHalStatus status,
93 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070094/** -------------------------------------------------------------
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +053095\fn limCheck11BRateBitmap
96\brief Verifies if basic rates are set.
97\param tANI_U16 pRateBitmap
98\return tANI_BOOLEAN - true or false
99 -------------------------------------------------------------*/
100
101tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 pRateBitmap)
102{
103 return ( ( pRateBitmap & ( 1 << 0 ) ) || ( pRateBitmap & ( 1 << 1 ) ) ||
104 ( pRateBitmap & ( 1 << 2 ) ) ||
105 ( pRateBitmap & ( 1 << 3 ) ) ? 1 : 0 ) ;
106}
107
108/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700109\fn limAssignDialogueToken
110\brief Assigns dialogue token.
111\param tpAniSirGlobal pMac
112\return tpDialogueToken - dialogueToken data structure.
113 -------------------------------------------------------------*/
114
115tpDialogueToken
116limAssignDialogueToken(tpAniSirGlobal pMac)
117{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700118 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530120 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
121 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530123 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 return NULL;
125 }
126
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530127 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 //first node in the list is being added.
129 if(NULL == pMac->lim.pDialogueTokenHead)
130 {
131 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
132 }
133 else
134 {
135 pMac->lim.pDialogueTokenTail->next = pCurrNode;
136 pMac->lim.pDialogueTokenTail = pCurrNode;
137 }
138 //assocId and tid of the node will be filled in by caller.
139 pCurrNode->next = NULL;
140 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700141
142 /* Dialog token should be a non-zero value */
143 if (0 == pCurrNode->token)
144 pCurrNode->token = token;
145
146 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 return pCurrNode;
148}
149
150/** -------------------------------------------------------------
151\fn limSearchAndDeleteDialogueToken
152\brief search dialogue token in the list and deletes it if found. returns failure if not found.
153\param tpAniSirGlobal pMac
154\param tANI_U8 token
155\param tANI_U16 assocId
156\param tANI_U16 tid
157\return eSirRetStatus - status of the search
158 -------------------------------------------------------------*/
159
160
161tSirRetStatus
162limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
163{
164 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
165 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
166
167 //if the list is empty
168 if(NULL == pCurrNode)
169 return eSIR_FAILURE;
170
171 // if the matching node is the first node.
172 if(pCurrNode &&
173 (assocId == pCurrNode->assocId) &&
174 (tid == pCurrNode->tid))
175 {
176 pMac->lim.pDialogueTokenHead = pCurrNode->next;
177 //there was only one node in the list. So tail pointer also needs to be adjusted.
178 if(NULL == pMac->lim.pDialogueTokenHead)
179 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530180 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800181 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 return eSIR_SUCCESS;
183 }
184
185 //first node did not match. so move to the next one.
186 pCurrNode = pCurrNode->next;
187 while(NULL != pCurrNode )
188 {
189 if(token == pCurrNode->token)
190 {
191 break;
192 }
193
194 pPrevNode = pCurrNode;
195 pCurrNode = pCurrNode->next;
196 }
197
198 if(pCurrNode &&
199 (assocId == pCurrNode->assocId) &&
200 (tid == pCurrNode->tid))
201 {
202 pPrevNode->next = pCurrNode->next;
203 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
204 if(NULL == pCurrNode->next)
205 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530206 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800207 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 return eSIR_SUCCESS;
209 }
210
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700211 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 return eSIR_FAILURE;
213
214}
215
216
217/** -------------------------------------------------------------
218\fn limDeleteDialogueTokenList
219\brief deletes the complete lim dialogue token linked list.
220\param tpAniSirGlobal pMac
221\return None
222 -------------------------------------------------------------*/
223void
224limDeleteDialogueTokenList(tpAniSirGlobal pMac)
225{
226 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
227
228 while(NULL != pMac->lim.pDialogueTokenHead)
229 {
230 pCurrNode = pMac->lim.pDialogueTokenHead;
231 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530232 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 pCurrNode = NULL;
234 }
235 pMac->lim.pDialogueTokenTail = NULL;
236}
237
238void
239limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
240{
241 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
242 *pIgnore = 0;
243
244 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
245 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530246 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 *pIgnore = 1;
248 }
249 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
250 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530251 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 *pIgnore = 1;
253 }
254 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
255 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530256 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 *pIgnore = 0;
258 }
259 else
260 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530261 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 *pIgnore = 1;
263 }
264}
265
266char *
267limMlmStateStr(tLimMlmStates state)
268{
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 switch (state)
270 {
271 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
300 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
301 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700316 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
320 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
321 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700324 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700330}
331
332void
333limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
334{
335 limLog(pMac, logLevel, limMlmStateStr(state));
336}
337
338char *
339limSmeStateStr(tLimSmeStates state)
340{
341#ifdef FIXME_GEN6
342 switch (state)
343 {
344 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700377 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700381 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 }
391#endif
392return "";
393}
394
395
396char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
397{
398#ifdef FIXME_GEN6
399
400 switch(dot11Mode)
401 {
402 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700403 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700405 return "11A";
406 case WNI_CFG_DOT11_MODE_11B:
407 return "11B";
408 case WNI_CFG_DOT11_MODE_11G:
409 return "11G";
410 case WNI_CFG_DOT11_MODE_11N:
411 return "11N";
412 case WNI_CFG_DOT11_MODE_POLARIS:
413 return "Polaris";
414 case WNI_CFG_DOT11_MODE_TITAN:
415 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700419 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 }
421#endif
422return "";
423}
424
425
426char* limStaOpRateModeStr(tStaRateMode opRateMode)
427{
428#ifdef FIXME_GEN6
429
430 switch(opRateMode)
431 {
432 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700433 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 return "11A";
436 case eSTA_11b:
437 return "11B";
438 case eSTA_11bg:
439 return "11G";
440 case eSTA_11n:
441 return "11N";
442 case eSTA_POLARIS:
443 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 }
449#endif
450return "";
451}
452
453char* limBssTypeStr(tSirBssType bssType)
454{
455 switch(bssType)
456 {
457 case eSIR_INFRASTRUCTURE_MODE:
458 return "eSIR_INFRASTRUCTURE_MODE";
459 case eSIR_IBSS_MODE:
460 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700461 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700463 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return "eSIR_AUTO_MODE";
467 default:
468 return "Invalid BSS Type";
469 }
470}
471
472void
473limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
474{
475 limLog(pMac, logLevel, limSmeStateStr(state));
476}
477
478char *limMsgStr(tANI_U32 msgType)
479{
480#ifdef FIXME_GEN6
481 switch (msgType)
482 {
483 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700491#ifdef FEATURE_OEM_DATA_SUPPORT
492 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700494 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700496#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800593#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800594 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800596 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800598#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642#ifdef WLAN_FEATURE_VOWIFI_11R
643 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645#endif
646
647 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665
666 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700697 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700705 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700707 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800708 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700709 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800710#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700711 case eWNI_SME_GET_TSM_STATS_REQ:
712 return "eWNI_SME_GET_TSM_STATS_REQ";
713 case eWNI_SME_GET_TSM_STATS_RSP:
714 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800715#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 }
719#endif
720return "";
721}
722
723
724
725char *limResultCodeStr(tSirResultCodes resultCode)
726{
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 switch (resultCode)
728 {
729 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700854 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700855#ifdef GEN4_SCAN
856 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700863 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700865 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700867 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700868#else // GEN4_SCAN
869 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700870 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700872 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700873#endif // GEN4_SCAN
874
875 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700876 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700878}
879
880void
881limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
882{
883 limLog(pMac, logLevel, limMsgStr(msgType));
884}
885
Jeff Johnson295189b2012-06-20 16:38:30 -0700886void
887limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
888{
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
890 {
891 switch (msg->type)
892 {
893 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 break;
896 default:
897 limPrintMsgName(pMac, logLevel,msg->type);
898 break;
899 }
900 }
901}
902
903/**
904 * limInitMlm()
905 *
906 *FUNCTION:
907 * This function is called by limProcessSmeMessages() to
908 * initialize MLM state machine on STA
909 *
910 *PARAMS:
911 *
912 *LOGIC:
913 *
914 *ASSUMPTIONS:
915 * NA
916 *
917 *NOTE:
918 * NA
919 *
920 * @param pMac Pointer to Global MAC structure
921 * @return None
922 */
923void
924limInitMlm(tpAniSirGlobal pMac)
925{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700926 tANI_U32 retVal;
927
928 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700929
Jeff Johnsone7245742012-09-05 17:12:55 -0700930 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700931
932 /// Initialize scan result hash table
933 limReInitScanResults(pMac); //sep26th review
934
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700935#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
936 /// Initialize lfr scan result hash table
937 // Could there be a problem in multisession with SAP/P2P GO, when in the
938 // middle of FW bg scan, SAP started; Again that could be a problem even on
939 // infra + SAP/P2P GO too - TBD
940 limReInitLfrScanResults(pMac);
941#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700942
943 /// Initialize number of pre-auth contexts
944 pMac->lim.gLimNumPreAuthContexts = 0;
945
946 /// Initialize MAC based Authentication STA list
947 limInitPreAuthList(pMac);
948
949 //pMac->lim.gpLimMlmJoinReq = NULL;
950
951 if (pMac->lim.gLimTimersCreated)
952 return;
953
954 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700955 retVal = limCreateTimers(pMac);
956 if(retVal == TX_SUCCESS)
957 {
958 pMac->lim.gLimTimersCreated = 1;
959 }
960 else
961 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700962 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700963 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700964} /*** end limInitMlm() ***/
965
966
967
968/**
969 * limCleanupMlm()
970 *
971 *FUNCTION:
972 * This function is called to cleanup any resources
973 * allocated by the MLM state machine.
974 *
975 *PARAMS:
976 *
977 *LOGIC:
978 *
979 *ASSUMPTIONS:
980 * NA
981 *
982 *NOTE:
983 * It is assumed that BSS is already informed that we're leaving it
984 * before this function is called.
985 *
986 * @param pMac Pointer to Global MAC structure
987 * @param None
988 * @return None
989 */
990void
991limCleanupMlm(tpAniSirGlobal pMac)
992{
993 tANI_U32 n;
994 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530995#ifdef WLAN_FEATURE_11W
996 tANI_U32 bss_entry, sta_entry;
997 tpDphHashNode pStaDs = NULL;
998 tpPESession psessionEntry = NULL;
999#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001000
1001 if (pMac->lim.gLimTimersCreated == 1)
1002 {
1003 // Deactivate and delete MIN/MAX channel timers.
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1006 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1007 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1008 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1009 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1010
1011
1012 // Deactivate and delete channel switch timer.
1013 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1014 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1015
1016
1017 // Deactivate and delete addts response timer.
1018 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1019 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1020
1021 // Deactivate and delete Join failure timer.
1022 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1023 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1024
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001025 // Deactivate and delete Periodic Join Probe Request timer.
1026 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1027 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1028
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 // Deactivate and delete Association failure timer.
1030 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1031 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1032
1033 // Deactivate and delete Reassociation failure timer.
1034 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1035 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1036
1037 // Deactivate and delete Authentication failure timer.
1038 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1039 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1040
1041 // Deactivate and delete Heartbeat timer.
1042 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1043 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1044
1045 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1046 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1047 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1048
1049 // Deactivate and delete Quiet timer.
1050 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1051 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1052
1053 // Deactivate and delete Quiet BSS timer.
1054 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1055 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1056
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 // Deactivate and delete LIM background scan timer.
1058 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1059 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001060
1061
1062 // Deactivate and delete cnf wait timer
1063 for (n = 0; n < pMac->lim.maxStation; n++)
1064 {
1065 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1066 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1067 }
1068
1069 // Deactivate and delete keepalive timer
1070 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1071 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1072
1073 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1074
1075 //Deactivate any Authentication response timers
1076 limDeletePreAuthList(pMac);
1077
1078 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1079 {
1080 // Delete any Authentication response
1081 // timers, which might have been started.
1082 tx_timer_delete(&pAuthNode->timer);
1083 }
1084
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1086 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1087 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1088 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1089
1090#if 0 // The WPS PBC clean up timer is disabled
1091 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1092 {
1093 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1094 {
1095 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1096 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1097 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1098 }
1099 }
1100#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001101#ifdef WLAN_FEATURE_VOWIFI_11R
1102 // Deactivate and delete FT Preauth response timer
1103 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1104 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1105#endif
1106
Jeff Johnson295189b2012-06-20 16:38:30 -07001107
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001108#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001110 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1112#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001113
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001114 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1115 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1116
1117 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1118 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1119
Hoonki Leef63df0d2013-01-16 19:29:14 -08001120 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1121 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001122
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301123 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1124 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1125
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 pMac->lim.gLimTimersCreated = 0;
1127 }
1128
Agarwal Ashish888ca022014-11-05 14:25:56 +05301129#ifdef WLAN_FEATURE_11W
1130 /*
1131 * When SSR is triggered, we need to loop through
1132 * each STA associated per BSSId and deactivate/delete
1133 * the pmfSaQueryTimer for it
1134 */
1135 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1136 {
1137 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1138 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1139 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1140 {
1141 if (pMac->lim.gpSession[bss_entry].valid)
1142 {
1143 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1144 sta_entry++)
1145 {
1146 psessionEntry = &pMac->lim.gpSession[bss_entry];
1147 pStaDs = dphGetHashEntry(pMac, sta_entry,
1148 &psessionEntry->dph.dphHashTable);
1149 if (NULL == pStaDs)
1150 {
1151 continue;
1152 }
1153 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1154 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1155 pStaDs->staIndex) ;
1156 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1157 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1158 }
1159 }
1160 }
1161 }
1162#endif
1163
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 /// Cleanup cached scan list
1165 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001166#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1167 /// Cleanup cached scan list
1168 limReInitLfrScanResults(pMac);
1169#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001170
1171} /*** end limCleanupMlm() ***/
1172
1173
1174
1175/**
1176 * limCleanupLmm()
1177 *
1178 *FUNCTION:
1179 * This function is called to cleanup any resources
1180 * allocated by LMM sub-module.
1181 *
1182 *PARAMS:
1183 *
1184 *LOGIC:
1185 *
1186 *ASSUMPTIONS:
1187 * NA
1188 *
1189 *NOTE:
1190 * NA
1191 *
1192 * @param pMac Pointer to Global MAC structure
1193 * @return None
1194 */
1195
1196void
1197limCleanupLmm(tpAniSirGlobal pMac)
1198{
Jeff Johnson295189b2012-06-20 16:38:30 -07001199} /*** end limCleanupLmm() ***/
1200
1201
1202
1203/**
1204 * limIsAddrBC()
1205 *
1206 *FUNCTION:
1207 * This function is called in various places within LIM code
1208 * to determine whether passed MAC address is a broadcast or not
1209 *
1210 *LOGIC:
1211 *
1212 *ASSUMPTIONS:
1213 * NA
1214 *
1215 *NOTE:
1216 * NA
1217 *
1218 * @param macAddr Indicates MAC address that need to be determined
1219 * whether it is Broadcast address or not
1220 *
1221 * @return true if passed address is Broadcast address else false
1222 */
1223
1224tANI_U8
1225limIsAddrBC(tSirMacAddr macAddr)
1226{
1227 int i;
1228 for (i = 0; i < 6; i++)
1229 {
1230 if ((macAddr[i] & 0xFF) != 0xFF)
1231 return false;
1232 }
1233
1234 return true;
1235} /****** end limIsAddrBC() ******/
1236
1237
1238
1239/**
1240 * limIsGroupAddr()
1241 *
1242 *FUNCTION:
1243 * This function is called in various places within LIM code
1244 * to determine whether passed MAC address is a group address or not
1245 *
1246 *LOGIC:
1247 * If least significant bit of first octet of the MAC address is
1248 * set to 1, it is a Group address.
1249 *
1250 *ASSUMPTIONS:
1251 * NA
1252 *
1253 *NOTE:
1254 * NA
1255 *
1256 * @param macAddr Indicates MAC address that need to be determined
1257 * whether it is Group address or not
1258 *
1259 * @return true if passed address is Group address else false
1260 */
1261
1262tANI_U8
1263limIsGroupAddr(tSirMacAddr macAddr)
1264{
1265 if ((macAddr[0] & 0x01) == 0x01)
1266 return true;
1267 else
1268 return false;
1269} /****** end limIsGroupAddr() ******/
1270
1271/**
1272 * limPostMsgApiNoWait()
1273 *
1274 *FUNCTION:
1275 * This function is called from other thread while posting a
1276 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1277 *
1278 *LOGIC:
1279 * NA
1280 *
1281 *ASSUMPTIONS:
1282 * NA
1283 *
1284 *NOTE:
1285 * NA
1286 *
1287 * @param pMsg - Pointer to the Global MAC structure
1288 * @param pMsg - Pointer to the message structure
1289 * @return None
1290 */
1291
1292tANI_U32
1293limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1294{
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 limProcessMessages(pMac, pMsg);
1296 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001297} /*** end limPostMsgApiNoWait() ***/
1298
1299
1300
1301/**
1302 * limPrintMacAddr()
1303 *
1304 *FUNCTION:
1305 * This function is called to print passed MAC address
1306 * in : format.
1307 *
1308 *LOGIC:
1309 *
1310 *ASSUMPTIONS:
1311 * NA
1312 *
1313 *NOTE:
1314 * @param macAddr - MacAddr to be printed
1315 * @param logLevel - Loglevel to be used
1316 *
1317 * @return None.
1318 */
1319
1320void
1321limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1322{
1323 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001324 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001325} /****** end limPrintMacAddr() ******/
1326
1327
Jeff Johnson295189b2012-06-20 16:38:30 -07001328/*
1329 * limResetDeferredMsgQ()
1330 *
1331 *FUNCTION:
1332 * This function resets the deferred message queue parameters.
1333 *
1334 *PARAMS:
1335 * @param pMac - Pointer to Global MAC structure
1336 *
1337 *LOGIC:
1338 *
1339 *ASSUMPTIONS:
1340 * NA
1341 *
1342 *NOTE:
1343 * NA
1344 *
1345 *RETURNS:
1346 * None
1347 */
1348
1349void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1350{
1351 pMac->lim.gLimDeferredMsgQ.size =
1352 pMac->lim.gLimDeferredMsgQ.write =
1353 pMac->lim.gLimDeferredMsgQ.read = 0;
1354
1355}
1356
1357
1358#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1359#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1360
1361/*
1362 * limWriteDeferredMsgQ()
1363 *
1364 *FUNCTION:
1365 * This function queues up a deferred message for later processing on the
1366 * STA side.
1367 *
1368 *PARAMS:
1369 * @param pMac - Pointer to Global MAC structure
1370 * @param limMsg - a LIM message
1371 *
1372 *LOGIC:
1373 *
1374 *ASSUMPTIONS:
1375 * NA
1376 *
1377 *NOTE:
1378 * NA
1379 *
1380 *RETURNS:
1381 * None
1382 */
1383
1384tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1385{
1386 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001387 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1389 limMsg->type);)
1390
1391 /*
1392 ** check if the deferred message queue is full
1393 **/
1394 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1395 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001396 if(!(pMac->lim.deferredMsgCnt & 0xF))
1397 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001398 PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), limMsg->type, ++pMac->lim.deferredMsgCnt);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001399 }
1400 else
1401 {
1402 pMac->lim.deferredMsgCnt++;
1403 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001404 return TX_QUEUE_FULL;
1405 }
1406
1407 /*
1408 ** In the application, there should not be more than 1 message get
1409 ** queued up. If happens, flags a warning. In the future, this can
1410 ** happen.
1411 **/
1412 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1413 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001414 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 -07001415 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1416 limIsSystemInScanState(pMac),
1417 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1418 pMac->lim.gLimAddtsSent);)
1419 }
1420
1421 /*
1422 ** To prevent the deferred Q is full of management frames, only give them certain space
1423 **/
1424 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1425 {
1426 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1427 {
1428 tANI_U16 idx, count = 0;
1429 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1430 {
1431 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1432 {
1433 count++;
1434 }
1435 }
1436 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1437 {
1438 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001439 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 //Return error, caller knows what to do
1441 return TX_QUEUE_FULL;
1442 }
1443 }
1444 }
1445
1446 ++pMac->lim.gLimDeferredMsgQ.size;
1447
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001448 /* reset the count here since we are able to defer the message */
1449 if(pMac->lim.deferredMsgCnt != 0)
1450 {
1451 pMac->lim.deferredMsgCnt = 0;
1452 }
1453
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 /*
1455 ** if the write pointer hits the end of the queue, rewind it
1456 **/
1457 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1458 pMac->lim.gLimDeferredMsgQ.write = 0;
1459
1460 /*
1461 ** save the message to the queue and advanced the write pointer
1462 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301463 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1464 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 (tANI_U8 *)limMsg,
1466 sizeof(tSirMsgQ));
1467 return TX_SUCCESS;
1468
1469}
1470
1471/*
1472 * limReadDeferredMsgQ()
1473 *
1474 *FUNCTION:
1475 * This function dequeues a deferred message for processing on the
1476 * STA side.
1477 *
1478 *PARAMS:
1479 * @param pMac - Pointer to Global MAC structure
1480 *
1481 *LOGIC:
1482 *
1483 *ASSUMPTIONS:
1484 * NA
1485 *
1486 *NOTE:
1487 *
1488 *
1489 *RETURNS:
1490 * Returns the message at the head of the deferred message queue
1491 */
1492
1493tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1494{
1495 tSirMsgQ *msg;
1496
1497 /*
1498 ** check any messages left. If no, return
1499 **/
1500 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1501 return NULL;
1502
1503 /*
1504 ** decrement the queue size
1505 **/
1506 pMac->lim.gLimDeferredMsgQ.size--;
1507
1508 /*
1509 ** retrieve the message from the head of the queue
1510 **/
1511 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1512
1513 /*
1514 ** advance the read pointer
1515 **/
1516 pMac->lim.gLimDeferredMsgQ.read++;
1517
1518 /*
1519 ** if the read pointer hits the end of the queue, rewind it
1520 **/
1521 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1522 pMac->lim.gLimDeferredMsgQ.read = 0;
1523
1524 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001525 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1527 msg->type);)
1528
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001529 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 limIsSystemInScanState(pMac),
1531 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1532 pMac->lim.gLimAddtsSent);)
1533
1534 return(msg);
1535}
1536
1537tSirRetStatus
1538limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1539 tSirMsgQ *pMsg,
1540 tANI_U8 qType)
1541{
1542// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 SysProcessMmhMsg(pMac, pMsg);
1544 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001545}
1546
1547char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1548{
1549#ifdef FIXME_GEN6
1550
1551 if (type == SIR_MAC_MGMT_FRAME)
1552 {
1553 switch (subType)
1554 {
1555 case SIR_MAC_MGMT_ASSOC_REQ:
1556 return "MAC_MGMT_ASSOC_REQ";
1557 case SIR_MAC_MGMT_ASSOC_RSP:
1558 return "MAC_MGMT_ASSOC_RSP";
1559 case SIR_MAC_MGMT_REASSOC_REQ:
1560 return "MAC_MGMT_REASSOC_REQ";
1561 case SIR_MAC_MGMT_REASSOC_RSP:
1562 return "MAC_MGMT_REASSOC_RSP";
1563 case SIR_MAC_MGMT_PROBE_REQ:
1564 return "MAC_MGMT_PROBE_REQ";
1565 case SIR_MAC_MGMT_PROBE_RSP:
1566 return "MAC_MGMT_PROBE_RSP";
1567 case SIR_MAC_MGMT_BEACON:
1568 return "MAC_MGMT_BEACON";
1569 case SIR_MAC_MGMT_ATIM:
1570 return "MAC_MGMT_ATIM";
1571 case SIR_MAC_MGMT_DISASSOC:
1572 return "MAC_MGMT_DISASSOC";
1573 case SIR_MAC_MGMT_AUTH:
1574 return "MAC_MGMT_AUTH";
1575 case SIR_MAC_MGMT_DEAUTH:
1576 return "MAC_MGMT_DEAUTH";
1577 case SIR_MAC_MGMT_ACTION:
1578 return "MAC_MGMT_ACTION";
1579 case SIR_MAC_MGMT_RESERVED15:
1580 return "MAC_MGMT_RESERVED15";
1581 default:
1582 return "Unknown MGMT Frame";
1583 }
1584 }
1585
1586 else if (type == SIR_MAC_CTRL_FRAME)
1587 {
1588 switch (subType)
1589 {
1590 case SIR_MAC_CTRL_RR:
1591 return "MAC_CTRL_RR";
1592 case SIR_MAC_CTRL_BAR:
1593 return "MAC_CTRL_BAR";
1594 case SIR_MAC_CTRL_BA:
1595 return "MAC_CTRL_BA";
1596 case SIR_MAC_CTRL_PS_POLL:
1597 return "MAC_CTRL_PS_POLL";
1598 case SIR_MAC_CTRL_RTS:
1599 return "MAC_CTRL_RTS";
1600 case SIR_MAC_CTRL_CTS:
1601 return "MAC_CTRL_CTS";
1602 case SIR_MAC_CTRL_ACK:
1603 return "MAC_CTRL_ACK";
1604 case SIR_MAC_CTRL_CF_END:
1605 return "MAC_CTRL_CF_END";
1606 case SIR_MAC_CTRL_CF_END_ACK:
1607 return "MAC_CTRL_CF_END_ACK";
1608 default:
1609 return "Unknown CTRL Frame";
1610 }
1611 }
1612
1613 else if (type == SIR_MAC_DATA_FRAME)
1614 {
1615 switch (subType)
1616 {
1617 case SIR_MAC_DATA_DATA:
1618 return "MAC_DATA_DATA";
1619 case SIR_MAC_DATA_DATA_ACK:
1620 return "MAC_DATA_DATA_ACK";
1621 case SIR_MAC_DATA_DATA_POLL:
1622 return "MAC_DATA_DATA_POLL";
1623 case SIR_MAC_DATA_DATA_ACK_POLL:
1624 return "MAC_DATA_DATA_ACK_POLL";
1625 case SIR_MAC_DATA_NULL:
1626 return "MAC_DATA_NULL";
1627 case SIR_MAC_DATA_NULL_ACK:
1628 return "MAC_DATA_NULL_ACK";
1629 case SIR_MAC_DATA_NULL_POLL:
1630 return "MAC_DATA_NULL_POLL";
1631 case SIR_MAC_DATA_NULL_ACK_POLL:
1632 return "MAC_DATA_NULL_ACK_POLL";
1633 case SIR_MAC_DATA_QOS_DATA:
1634 return "MAC_DATA_QOS_DATA";
1635 case SIR_MAC_DATA_QOS_DATA_ACK:
1636 return "MAC_DATA_QOS_DATA_ACK";
1637 case SIR_MAC_DATA_QOS_DATA_POLL:
1638 return "MAC_DATA_QOS_DATA_POLL";
1639 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1640 return "MAC_DATA_QOS_DATA_ACK_POLL";
1641 case SIR_MAC_DATA_QOS_NULL:
1642 return "MAC_DATA_QOS_NULL";
1643 case SIR_MAC_DATA_QOS_NULL_ACK:
1644 return "MAC_DATA_QOS_NULL_ACK";
1645 case SIR_MAC_DATA_QOS_NULL_POLL:
1646 return "MAC_DATA_QOS_NULL_POLL";
1647 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1648 return "MAC_DATA_QOS_NULL_ACK_POLL";
1649 default:
1650 return "Unknown Data Frame";
1651 }
1652 }
1653 else
1654 return "Unknown";
1655#endif
1656return "";
1657}
1658
Jeff Johnson295189b2012-06-20 16:38:30 -07001659void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1660{
1661 int i;
1662 static int enable;
1663 tUpdateBeaconParams beaconParams;
1664
1665 tpPESession psessionEntry = limIsApSessionActive(pMac);
1666
1667 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001668 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001669 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001671 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301672
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301673 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001674 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675
1676 beaconParams.paramChangeBitmap = 0;
1677 /*
1678 ** This is doing a 2 pass check. The first pass is to invalidate
1679 ** all the cache entries. The second pass is to decide whether to
1680 ** disable protection.
1681 **/
1682 if (!enable)
1683 {
1684
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001685 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 psessionEntry->gLimOlbcParams.numSta = 0;
1687 psessionEntry->gLimOverlap11gParams.numSta = 0;
1688 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1689 psessionEntry->gLimNonGfParams.numSta = 0;
1690 psessionEntry->gLimLsigTxopParams.numSta = 0;
1691
1692 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1693 pMac->lim.protStaOverlapCache[i].active = false;
1694
1695 enable = 1;
1696 }
1697 else
1698 {
1699
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001700 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 {
1702 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1703 {
1704 if (!psessionEntry->gLim11bParams.protectionEnabled)
1705 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001706 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1708 }
1709 }
1710 }
1711
1712 if (!psessionEntry->gLimOverlap11gParams.numSta)
1713 {
1714 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1715 {
1716 if (!psessionEntry->gLim11gParams.protectionEnabled)
1717 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001718 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1720 }
1721 }
1722 }
1723
1724 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1725 {
1726 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1727 {
1728 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001730 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1732 }
1733 }
1734 }
1735
1736 enable = 0;
1737 }
1738
1739 if(beaconParams.paramChangeBitmap)
1740 {
1741 schSetFixedBeaconFields(pMac,psessionEntry);
1742 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1743 }
1744
1745 // Start OLBC timer
1746 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1747 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001748 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 }
1750}
Jeff Johnson295189b2012-06-20 16:38:30 -07001751
1752/**
1753 * limIsNullSsid()
1754 *
1755 *FUNCTION:
1756 * This function checks if Ssid supplied is Null SSID
1757 *
1758 *
1759 *LOGIC:
1760 *
1761 *ASSUMPTIONS:
1762 * NA
1763 *
1764 *NOTE:
1765 * NA
1766 *
1767 * @param tSirMacSSid *
1768 *
1769 *
1770 * @return true if SSID is Null SSID else false
1771 */
1772
1773tANI_U8
1774limIsNullSsid( tSirMacSSid *pSsid )
1775{
1776 tANI_U8 fNullSsid = false;
1777 tANI_U32 SsidLength;
1778 tANI_U8 *pSsidStr;
1779
1780 do
1781 {
1782 if ( 0 == pSsid->length )
1783 {
1784 fNullSsid = true;
1785 break;
1786 }
1787
1788#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301789 /* If the first charactes is space and SSID length is 1
1790 * then consider it as NULL SSID*/
1791 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1792 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301794 fNullSsid = true;
1795 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 }
1797 else
1798 {
1799 /* check if all the charactes in SSID are NULL*/
1800 SsidLength = pSsid->length;
1801 pSsidStr = pSsid->ssId;
1802
1803 while ( SsidLength )
1804 {
1805 if( *pSsidStr )
1806 break;
1807
1808 pSsidStr++;
1809 SsidLength--;
1810 }
1811
1812 if( 0 == SsidLength )
1813 {
1814 fNullSsid = true;
1815 break;
1816 }
1817 }
1818 }
1819 while( 0 );
1820
1821 return fNullSsid;
1822} /****** end limIsNullSsid() ******/
1823
1824
1825
Jeff Johnson295189b2012-06-20 16:38:30 -07001826
1827/** -------------------------------------------------------------
1828\fn limUpdateProtStaParams
1829\brief updates protection related counters.
1830\param tpAniSirGlobal pMac
1831\param tSirMacAddr peerMacAddr
1832\param tLimProtStaCacheType protStaCacheType
1833\param tHalBitVal gfSupported
1834\param tHalBitVal lsigTxopSupported
1835\return None
1836 -------------------------------------------------------------*/
1837void
1838limUpdateProtStaParams(tpAniSirGlobal pMac,
1839tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1840tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1841tpPESession psessionEntry)
1842{
1843 tANI_U32 i;
1844
1845 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1846 limLog(pMac,LOG1, FL("Addr : "));
1847 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1848
1849 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1850 {
1851 if (psessionEntry->protStaCache[i].active)
1852 {
1853 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1854 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1855
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301856 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 psessionEntry->protStaCache[i].addr,
1858 peerMacAddr, sizeof(tSirMacAddr)))
1859 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001860 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 return;
1862 }
1863 }
1864 }
1865
1866 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1867 {
1868 if (!psessionEntry->protStaCache[i].active)
1869 break;
1870 }
1871
1872 if (i >= LIM_PROT_STA_CACHE_SIZE)
1873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001874 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 return;
1876 }
1877
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301878 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 peerMacAddr,
1880 sizeof(tSirMacAddr));
1881
1882 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1883 psessionEntry->protStaCache[i].active = true;
1884 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1885 {
1886 psessionEntry->gLim11bParams.numSta++;
1887 limLog(pMac,LOG1, FL("11B, "));
1888 }
1889 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1890 {
1891 psessionEntry->gLim11gParams.numSta++;
1892 limLog(pMac,LOG1, FL("11G, "));
1893 }
1894 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1895 {
1896 psessionEntry->gLimHt20Params.numSta++;
1897 limLog(pMac,LOG1, FL("HT20, "));
1898 }
1899
1900 if(!gfSupported)
1901 {
1902 psessionEntry->gLimNonGfParams.numSta++;
1903 limLog(pMac,LOG1, FL("NonGf, "));
1904 }
1905 if(!lsigTxopSupported)
1906 {
1907 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001908 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 }
1910}// ---------------------------------------------------------------------
1911
1912/** -------------------------------------------------------------
1913\fn limDecideApProtection
1914\brief Decides all the protection related staiton coexistence and also sets
1915\ short preamble and short slot appropriately. This function will be called
1916\ when AP is ready to send assocRsp tp the station joining right now.
1917\param tpAniSirGlobal pMac
1918\param tSirMacAddr peerMacAddr
1919\return None
1920 -------------------------------------------------------------*/
1921void
1922limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1923{
1924 tANI_U16 tmpAid;
1925 tpDphHashNode pStaDs;
1926 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1927 tANI_U32 phyMode;
1928 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1929 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1930
1931 pBeaconParams->paramChangeBitmap = 0;
1932 // check whether to enable protection or not
1933 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1934 if(NULL == pStaDs)
1935 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301936 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 return;
1938 }
1939 limGetRfBand(pMac, &rfBand, psessionEntry);
1940 //if we are in 5 GHZ band
1941 if(SIR_BAND_5_GHZ == rfBand)
1942 {
1943 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1944 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001945 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 {
1947 //we are 11N and 11A station is joining.
1948 //protection from 11A required.
1949 if(false == pStaDs->mlmStaContext.htCapability)
1950 {
1951 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1952 return;
1953 }
1954 }
1955 }
1956 else if(SIR_BAND_2_4_GHZ== rfBand)
1957 {
1958 limGetPhyMode(pMac, &phyMode, psessionEntry);
1959
1960 //We are 11G. Check if we need protection from 11b Stations.
1961 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001962 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 {
1964
1965 if (pStaDs->erpEnabled== eHAL_CLEAR)
1966 {
1967 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1968 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001969 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1971 }
1972 }
1973
1974 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001975 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 {
1977 //check if we need protection from 11b station
1978 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1979 (!pStaDs->mlmStaContext.htCapability))
1980 {
1981 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1982 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001983 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1985 }
1986 //station being joined is non-11b and non-ht ==> 11g device
1987 else if(!pStaDs->mlmStaContext.htCapability)
1988 {
1989 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1990 //enable protection
1991 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1992 }
1993 //ERP mode is enabled for the latest station joined
1994 //latest station joined is HT capable
1995 //This case is being handled in common code (commn between both the bands) below.
1996 }
1997 }
1998
1999 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002000 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 (true == pStaDs->mlmStaContext.htCapability))
2002 {
2003 if(!pStaDs->htGreenfield)
2004 {
2005 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2006 gfSupported = eHAL_CLEAR;
2007 }
2008 //Station joining is HT 20Mhz
2009 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2010 {
2011 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2012 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2013 }
2014 //Station joining does not support LSIG TXOP Protection
2015 if(!pStaDs->htLsigTXOPProtection)
2016 {
2017 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2018 lsigTxopSupported = eHAL_CLEAR;
2019 }
2020 }
2021
2022 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2023 gfSupported, lsigTxopSupported, psessionEntry);
2024
2025 return;
2026}
Jeff Johnson295189b2012-06-20 16:38:30 -07002027
2028
2029/** -------------------------------------------------------------
2030\fn limEnableOverlap11gProtection
2031\brief wrapper function for setting overlap 11g protection.
2032\param tpAniSirGlobal pMac
2033\param tpUpdateBeaconParams pBeaconParams
2034\param tpSirMacMgmtHdr pMh
2035\return None
2036 -------------------------------------------------------------*/
2037void
2038limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2039tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2040{
2041 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2042
2043 if (psessionEntry->gLimOlbcParams.numSta &&
2044 !psessionEntry->gLimOlbcParams.protectionEnabled)
2045 {
2046 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002047 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2049 }
2050}
2051
2052
2053/** -------------------------------------------------------------
2054\fn limUpdateShortPreamble
2055\brief Updates short preamble if needed when a new station joins.
2056\param tpAniSirGlobal pMac
2057\param tSirMacAddr peerMacAddr
2058\param tpUpdateBeaconParams pBeaconParams
2059\return None
2060 -------------------------------------------------------------*/
2061void
2062limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2063 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2064{
2065 tANI_U16 tmpAid;
2066 tpDphHashNode pStaDs;
2067 tANI_U32 phyMode;
2068 tANI_U16 i;
2069
2070 // check whether to enable protection or not
2071 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2072
2073 limGetPhyMode(pMac, &phyMode, psessionEntry);
2074
2075 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2076
2077 {
2078 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2079 {
2080 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2081 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2082
2083 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2084 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2086 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2087 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302088 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2090 peerMacAddr, sizeof(tSirMacAddr)))
2091 return;
2092 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 {
2094 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2095 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302096 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2098 peerMacAddr, sizeof(tSirMacAddr)))
2099 return;
2100 }
2101 }
2102 }
2103
2104
2105 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2106 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2108 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2109 break;
2110 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 {
2112 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2113 break;
2114 }
2115 }
2116
2117 if (i >= LIM_PROT_STA_CACHE_SIZE)
2118 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2120 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2121 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2122 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2123 return;
2124 }
2125 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 {
2127 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2128 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2129 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2130 return;
2131 }
2132
2133 }
2134
2135
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302136 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2137 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 peerMacAddr, sizeof(tSirMacAddr));
2139 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2140 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2141 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302143 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 peerMacAddr, sizeof(tSirMacAddr));
2145 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2146 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2147 }
2148
2149
2150 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002151 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002152
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002154 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 }
2156 }
2157}
2158
2159/** -------------------------------------------------------------
2160\fn limUpdateShortSlotTime
2161\brief Updates short slot time if needed when a new station joins.
2162\param tpAniSirGlobal pMac
2163\param tSirMacAddr peerMacAddr
2164\param tpUpdateBeaconParams pBeaconParams
2165\return None
2166 -------------------------------------------------------------*/
2167
2168void
2169limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2170 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2171{
2172 tANI_U16 tmpAid;
2173 tpDphHashNode pStaDs;
2174 tANI_U32 phyMode;
2175 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 tANI_U16 i;
2177
2178 // check whether to enable protection or not
2179 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2180 limGetPhyMode(pMac, &phyMode, psessionEntry);
2181
Jeff Johnsone7245742012-09-05 17:12:55 -07002182 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2183 * be always 1 and in 11b case, it should be always 0
2184 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2186 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002187 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2188 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2189 * it in limDecideShortSlot
2190 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2192 {
2193 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2194 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2195 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2196 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2198 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2199 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302200 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2202 peerMacAddr, sizeof(tSirMacAddr)))
2203 return;
2204 }
2205 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 {
2207 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2208 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302209 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2211 peerMacAddr, sizeof(tSirMacAddr)))
2212 return;
2213 }
2214 }
2215 }
2216
2217 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2218 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2220 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2221 break;
2222 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 {
2224 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2225 break;
2226 }
2227 }
2228
2229 if (i >= LIM_PROT_STA_CACHE_SIZE)
2230 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2232 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2233 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2234 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2235 return;
2236 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 {
2238 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2239 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2240 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2241 return;
2242 }
2243 }
2244
2245
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302247 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 peerMacAddr, sizeof(tSirMacAddr));
2249 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2250 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2251 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302253 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 peerMacAddr, sizeof(tSirMacAddr));
2255 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2256 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2257 }
2258 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2259
Jeff Johnsone7245742012-09-05 17:12:55 -07002260 /* 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
2261 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2262 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002264 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 {
2266 // enable long slot time
2267 pBeaconParams->fShortSlotTime = false;
2268 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002269 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002270 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 }
2272 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002274 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 {
2276 // enable long slot time
2277 pBeaconParams->fShortSlotTime = false;
2278 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002279 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002280 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 }
2282 }
2283 }
2284 }
2285}
2286
Jeff Johnson295189b2012-06-20 16:38:30 -07002287
2288/** -------------------------------------------------------------
2289\fn limDecideStaProtectionOnAssoc
2290\brief Decide protection related settings on Sta while association.
2291\param tpAniSirGlobal pMac
2292\param tpSchBeaconStruct pBeaconStruct
2293\return None
2294 -------------------------------------------------------------*/
2295void
2296limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2297 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2298{
2299 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2300 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2301
2302 limGetRfBand(pMac, &rfBand, psessionEntry);
2303 limGetPhyMode(pMac, &phyMode, psessionEntry);
2304
2305 if(SIR_BAND_5_GHZ == rfBand)
2306 {
2307 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2308 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2309 {
2310 if(pMac->lim.cfgProtection.fromlla)
2311 psessionEntry->beaconParams.llaCoexist = true;
2312 }
2313 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2314 {
2315 if(pMac->lim.cfgProtection.ht20)
2316 psessionEntry->beaconParams.ht20Coexist = true;
2317 }
2318
2319 }
2320 else if(SIR_BAND_2_4_GHZ == rfBand)
2321 {
2322 //spec 7.3.2.13
2323 //UseProtection will be set when nonERP STA is associated.
2324 //NonERPPresent bit will be set when:
2325 //--nonERP Sta is associated OR
2326 //--nonERP Sta exists in overlapping BSS
2327 //when useProtection is not set then protection from nonERP stations is optional.
2328
2329 //CFG protection from 11b is enabled and
2330 //11B device in the BSS
2331 /* TODO, This is not sessionized */
2332 if (phyMode != WNI_CFG_PHY_MODE_11B)
2333 {
2334 if (pMac->lim.cfgProtection.fromllb &&
2335 pBeaconStruct->erpPresent &&
2336 (pBeaconStruct->erpIEInfo.useProtection ||
2337 pBeaconStruct->erpIEInfo.nonErpPresent))
2338 {
2339 psessionEntry->beaconParams.llbCoexist = true;
2340 }
2341 //AP has no 11b station associated.
2342 else
2343 {
2344 psessionEntry->beaconParams.llbCoexist = false;
2345 }
2346 }
2347 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002348 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 (pBeaconStruct->HTInfo.present))
2350 {
2351 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2352
2353 //Obss Non HT STA present mode
2354 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2355
2356
2357 //CFG protection from 11G is enabled and
2358 //our AP has at least one 11G station associated.
2359 if(pMac->lim.cfgProtection.fromllg &&
2360 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2361 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2362 (!psessionEntry->beaconParams.llbCoexist))
2363 {
2364 if(pMac->lim.cfgProtection.fromllg)
2365 psessionEntry->beaconParams.llgCoexist = true;
2366 }
2367
2368 //AP has only HT stations associated and at least one station is HT 20
2369 //disable protection from any non-HT devices.
2370 //decision for disabling protection from 11b has already been taken above.
2371 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2372 {
2373 //Disable protection from 11G station.
2374 psessionEntry->beaconParams.llgCoexist = false;
2375 //CFG protection from HT 20 is enabled.
2376 if(pMac->lim.cfgProtection.ht20)
2377 psessionEntry->beaconParams.ht20Coexist = true;
2378 }
2379 //Disable protection from non-HT and HT20 devices.
2380 //decision for disabling protection from 11b has already been taken above.
2381 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2382 {
2383 psessionEntry->beaconParams.llgCoexist = false;
2384 psessionEntry->beaconParams.ht20Coexist = false;
2385 }
2386
2387 }
2388 }
2389
2390 //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 -07002391 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 (pBeaconStruct->HTInfo.present))
2393 {
2394 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2395 psessionEntry->beaconParams.fRIFSMode =
2396 ( tANI_U8 ) htInfo.rifsMode;
2397 psessionEntry->beaconParams.llnNonGFCoexist =
2398 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2399 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2400 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2401 }
2402}
2403
2404
2405/** -------------------------------------------------------------
2406\fn limDecideStaProtection
2407\brief Decides protection related settings on Sta while processing beacon.
2408\param tpAniSirGlobal pMac
2409\param tpUpdateBeaconParams pBeaconParams
2410\return None
2411 -------------------------------------------------------------*/
2412void
2413limDecideStaProtection(tpAniSirGlobal pMac,
2414 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2415{
2416
2417 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2418 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2419
2420 limGetRfBand(pMac, &rfBand, psessionEntry);
2421 limGetPhyMode(pMac, &phyMode, psessionEntry);
2422
2423 if(SIR_BAND_5_GHZ == rfBand)
2424 {
2425 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002426 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 (pBeaconStruct->HTInfo.present))
2428 {
2429 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2430 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2431 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2432 {
2433 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2434 }
2435 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2436 //protection from HT20 if needed.
2437 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2438 {
2439 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2440 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2441 }
2442 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2443 {
2444 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2445 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2446 }
2447 }
2448 }
2449 else if(SIR_BAND_2_4_GHZ == rfBand)
2450 {
2451 /* spec 7.3.2.13
2452 * UseProtection will be set when nonERP STA is associated.
2453 * NonERPPresent bit will be set when:
2454 * --nonERP Sta is associated OR
2455 * --nonERP Sta exists in overlapping BSS
2456 * when useProtection is not set then protection from nonERP stations is optional.
2457 */
2458
2459 if (phyMode != WNI_CFG_PHY_MODE_11B)
2460 {
2461 if (pBeaconStruct->erpPresent &&
2462 (pBeaconStruct->erpIEInfo.useProtection ||
2463 pBeaconStruct->erpIEInfo.nonErpPresent))
2464 {
2465 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2466 }
2467 //AP has no 11b station associated.
2468 else
2469 {
2470 //disable protection from 11b station
2471 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2472 }
2473 }
2474
2475 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002476 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 (pBeaconStruct->HTInfo.present))
2478 {
2479
2480 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2481 //AP has at least one 11G station associated.
2482 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2483 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2484 (!psessionEntry->beaconParams.llbCoexist))
2485 {
2486 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2487
2488 }
2489
2490 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2491 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2492 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2493 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2494 {
2495 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2496
2497 //AP has only HT stations associated and at least one station is HT 20
2498 //disable protection from any non-HT devices.
2499 //decision for disabling protection from 11b has already been taken above.
2500 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2501 {
2502 //Disable protection from 11G station.
2503 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2504
2505 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2506 }
2507 //Disable protection from non-HT and HT20 devices.
2508 //decision for disabling protection from 11b has already been taken above.
2509 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2510 {
2511 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2512 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2513
2514 }
2515 }
2516 }
2517 }
2518
2519 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002520 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 (pBeaconStruct->HTInfo.present))
2522 {
2523 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2524 //Check for changes in protection related factors other than HT operating mode.
2525 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2526 if ( psessionEntry->beaconParams.fRIFSMode !=
2527 ( tANI_U8 ) htInfo.rifsMode )
2528 {
2529 pBeaconParams->fRIFSMode =
2530 psessionEntry->beaconParams.fRIFSMode =
2531 ( tANI_U8 ) htInfo.rifsMode;
2532 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2533 }
2534
2535 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2536 htInfo.nonGFDevicesPresent )
2537 {
2538 pBeaconParams->llnNonGFCoexist =
2539 psessionEntry->beaconParams.llnNonGFCoexist =
2540 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2541 pBeaconParams->paramChangeBitmap |=
2542 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2543 }
2544
2545 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2546 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2547 {
2548 pBeaconParams->fLsigTXOPProtectionFullSupport =
2549 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2550 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2551 pBeaconParams->paramChangeBitmap |=
2552 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2553 }
2554
2555 // For Station just update the global lim variable, no need to send message to HAL
2556 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2557 //stations in overlapping BSS.
2558 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2559 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2560
2561 }
2562}
2563
2564
2565/**
2566 * limProcessChannelSwitchTimeout()
2567 *
2568 *FUNCTION:
2569 * This function is invoked when Channel Switch Timer expires at
2570 * the STA. Now, STA must stop traffic, and then change/disable
2571 * primary or secondary channel.
2572 *
2573 *
2574 *NOTE:
2575 * @param pMac - Pointer to Global MAC structure
2576 * @return None
2577 */
2578void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2579{
2580 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002581 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002582
2583 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2584 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002585 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 return;
2587 }
2588
2589 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2590 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002591 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 -07002592 return;
2593 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002594 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 /*
2596 * This potentially can create issues if the function tries to set
2597 * channel while device is in power-save, hence putting an extra check
2598 * to verify if the device is in power-save or not
2599 */
2600 if(!limIsSystemInActiveState(pMac))
2601 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002602 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 return;
2604 }
2605
2606 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002607 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002608
2609 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002610 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002611
2612 /* Check if the AP is switching to a channel that we support.
2613 * Else, just don't bother to switch. Indicate HDD to look for a
2614 * better AP to associate
2615 */
2616 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2617 {
2618 /* We need to restore pre-channelSwitch state on the STA */
2619 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2620 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002621 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 return;
2623 }
2624
2625 /* If the channel-list that AP is asking us to switch is invalid,
2626 * then we cannot switch the channel. Just disassociate from AP.
2627 * We will find a better AP !!!
2628 */
2629 limTearDownLinkWithAp(pMac,
2630 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2631 eSIR_MAC_UNSPEC_FAILURE_REASON);
2632 return;
2633 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002634 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2635 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002636 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 {
2638 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002639 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2640 if ( isLimSessionOffChannel(pMac,
2641 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2642 {
2643 limSuspendLink(pMac,
2644 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2645 limProcessChannelSwitchSuspendLink,
2646 (tANI_U32*)psessionEntry );
2647 }
2648 else
2649 {
2650 limProcessChannelSwitchSuspendLink(pMac,
2651 eHAL_STATUS_SUCCESS,
2652 (tANI_U32*)psessionEntry);
2653 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 break;
2655
2656 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002657 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002658 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002660 psessionEntry->gLimChannelSwitch.secondarySubBand);
2661 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002663 case eLIM_CHANNEL_SWITCH_IDLE:
2664 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002665 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2667 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002668 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 }
2670 return; /* Please note, this is 'return' and not 'break' */
2671 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002672}
Jeff Johnson295189b2012-06-20 16:38:30 -07002673
2674/**
2675 * limUpdateChannelSwitch()
2676 *
2677 *FUNCTION:
2678 * This function is invoked whenever Station receives
2679 * either 802.11h channel switch IE or airgo proprietary
2680 * channel switch IE.
2681 *
2682 *NOTE:
2683 * @param pMac - Pointer to Global MAC structure
2684 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2685 * @param psessionentry
2686 */
2687void
2688limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2689{
2690
2691 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2693 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002694#ifdef WLAN_FEATURE_11AC
2695 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2696#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002697
Jeff Johnsone7245742012-09-05 17:12:55 -07002698 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002699
2700 /* STA either received proprietary channel switch IE or 802.11h
2701 * standard channel switch IE.
2702 */
2703 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2704 {
2705 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2706
2707 /* Add logic to determine which change this is: */
2708 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002709 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2710 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2711 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2712 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2713 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002715 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 }
2717 else
2718 {
2719 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002720 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2721 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2722 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002725#ifdef WLAN_FEATURE_11AC
2726 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2727 if(pBeacon->WiderBWChanSwitchAnnPresent)
2728 {
2729 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2730 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2731 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2732 }
2733#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002734
2735 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002736 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2737 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002738
2739 /* Do not bother to look and operate on extended channel switch element
2740 * if our own channel-bonding state is not enabled
2741 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002742 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 {
2744 if (pBeacon->extChannelSwitchPresent)
2745 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002746 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2747 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002749 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2750 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002752#ifdef WLAN_FEATURE_11AC
2753 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2754 {
2755 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2756 {
2757 if(pBeacon->extChannelSwitchPresent)
2758 {
2759 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2760 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2761 {
2762 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2763 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2764 psessionEntry->gLimChannelSwitch.primaryChannel,
2765 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2766 pWiderChnlSwitch->newCenterChanFreq0,
2767 psessionEntry);
2768 }
2769 }
2770 }
2771 }
2772#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002773 }
2774 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002775 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002776
2777
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2779 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002780 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002781 }
2782
2783 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002784 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002785 psessionEntry->peSessionId,
2786 psessionEntry->gLimChannelSwitch.primaryChannel,
2787 psessionEntry->gLimChannelSwitch.secondarySubBand,
2788 psessionEntry->gLimChannelSwitch.switchCount,
2789 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 return;
2791}
2792
2793/**
2794 * limCancelDot11hChannelSwitch
2795 *
2796 *FUNCTION:
2797 * This function is called when STA does not send updated channel-swith IE
2798 * after indicating channel-switch start. This will cancel the channel-swith
2799 * timer which is already running.
2800 *
2801 *LOGIC:
2802 *
2803 *ASSUMPTIONS:
2804 *
2805 *NOTE:
2806 *
2807 * @param pMac - Pointer to Global MAC structure
2808 *
2809 * @return None
2810 */
2811void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2812{
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2814 return;
2815
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002816 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002817 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002818
2819 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002821 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 }
2823
2824 /* We need to restore pre-channelSwitch state on the STA */
2825 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2826 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002827 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002828
2829 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002830}
2831
2832/**----------------------------------------------
2833\fn limCancelDot11hQuiet
2834\brief Cancel the quieting on Station if latest
2835 beacon doesn't contain quiet IE in it.
2836
2837\param pMac
2838\return NONE
2839-----------------------------------------------*/
2840void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2841{
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2843 return;
2844
Jeff Johnsone7245742012-09-05 17:12:55 -07002845 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002847 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2849 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002850 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 }
2852 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002853 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002855 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2857 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002858 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 }
2860 /**
2861 * If the channel switch is already running in silent mode, dont resume the
2862 * transmission. Channel switch timer when timeout, transmission will be resumed.
2863 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002864 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2865 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 {
2867 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002868 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 }
2870 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002872}
2873
2874/**
2875 * limProcessQuietTimeout
2876 *
2877 * FUNCTION:
2878 * This function is active only on the STA.
2879 * Handles SIR_LIM_QUIET_TIMEOUT
2880 *
2881 * LOGIC:
2882 * This timeout can occur under only one circumstance:
2883 *
2884 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2885 * This indicates that the timeout "interval" has
2886 * expired. This is a trigger for the STA to now
2887 * shut-off Tx/Rx for the specified gLimQuietDuration
2888 * -> The TIMER object gLimQuietBssTimer is
2889 * activated
2890 * -> With timeout = gLimQuietDuration
2891 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2892 *
2893 * ASSUMPTIONS:
2894 * Using two TIMER objects -
2895 * gLimQuietTimer & gLimQuietBssTimer
2896 *
2897 * NOTE:
2898 *
2899 * @param pMac - Pointer to Global MAC structure
2900 *
2901 * @return None
2902 */
2903void limProcessQuietTimeout(tpAniSirGlobal pMac)
2904{
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 //fetch the sessionEntry based on the sessionId
2906 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002907 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002908
Jeff Johnsone7245742012-09-05 17:12:55 -07002909 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002911 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 return;
2913 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002914
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302915 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002916 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 {
2918 case eLIM_QUIET_BEGIN:
2919 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002920 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2921 if (TX_SUCCESS !=
2922 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2923 {
2924 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002925 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002926 }
2927
2928 // gLimQuietDuration appears to be in units of ticks
2929 // Use it as is
2930 if (TX_SUCCESS !=
2931 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2932 psessionEntry->gLimSpecMgmt.quietDuration,
2933 0))
2934 {
2935 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002936 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002937 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002938 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002939#ifdef GEN6_TODO
2940 /* revisit this piece of code to assign the appropriate sessionId below
2941 * priority - HIGH
2942 */
2943 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2944#endif
2945 if( TX_SUCCESS !=
2946 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2947 {
2948 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002949 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002950 }
2951 else
2952 {
2953 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002954 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002955
2956 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2957 /* print message, otherwise, stop data traffic and stay quiet */
2958 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2959 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2960 {
2961 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002962 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 }
2964 else
2965 {
2966 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2967 /* freeze the transmission */
2968 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2969
2970 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002971 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002972 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 }
2974 }
2975 break;
2976
2977 case eLIM_QUIET_RUNNING:
2978 case eLIM_QUIET_INIT:
2979 case eLIM_QUIET_END:
2980 default:
2981 //
2982 // As of now, nothing to be done
2983 //
2984 break;
2985 }
2986}
2987
2988/**
2989 * limProcessQuietBssTimeout
2990 *
2991 * FUNCTION:
2992 * This function is active on the AP and STA.
2993 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2994 *
2995 * LOGIC:
2996 * On the AP -
2997 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2998 * an indication for the AP to START sending out the
2999 * Quiet BSS IE.
3000 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3001 * the 11H spec
3002 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3003 * a Proprietary IE. This will be understood by all the
3004 * TITAN STA's
3005 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3006 * initiate the SCH to include the Quiet BSS IE in all
3007 * its subsequent Beacons/PR's.
3008 * The Quiet BSS IE will be included in all the Beacons
3009 * & PR's until the next DTIM period
3010 *
3011 * On the STA -
3012 * When gLimQuietState = eLIM_QUIET_RUNNING
3013 * This indicates that the STA was successfully shut-off
3014 * for the specified gLimQuietDuration. This is a trigger
3015 * for the STA to now resume data traffic.
3016 * -> gLimQuietState is set to eLIM_QUIET_INIT
3017 *
3018 * ASSUMPTIONS:
3019 *
3020 * NOTE:
3021 *
3022 * @param pMac - Pointer to Global MAC structure
3023 *
3024 * @return None
3025 */
3026void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3027{
Jeff Johnsone7245742012-09-05 17:12:55 -07003028 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003029
Jeff Johnsone7245742012-09-05 17:12:55 -07003030 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003032 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 return;
3034 }
3035
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303036 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003037 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 }
3040 else
3041 {
3042 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003043 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003044 {
3045 case eLIM_QUIET_RUNNING:
3046 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003047 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003048
3049 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3050 {
3051 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003052 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3053 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 {
3055 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003056 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 }
3058
3059 /* Reset status flag */
3060 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3061 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3062
3063 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003064 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 }
3066 else
3067 {
3068 //
3069 // Nothing specific to be done in this case
3070 // A background scan that was triggered during
3071 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3072 //
3073 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003074 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 }
3076 break;
3077
3078 case eLIM_QUIET_INIT:
3079 case eLIM_QUIET_BEGIN:
3080 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003081 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 /* If the quiet period has ended, then resume the frame transmission */
3083 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003084 limRestorePreQuietState(pMac, psessionEntry);
3085 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003086 break;
3087
3088 default:
3089 //
3090 // As of now, nothing to be done
3091 //
3092 break;
3093 }
3094 }
3095}
Jeff Johnson295189b2012-06-20 16:38:30 -07003096/**
3097 * limProcessWPSOverlapTimeout
3098 *
3099 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3100 *
3101 * LOGIC:
3102 *
3103 * ASSUMPTIONS:
3104 *
3105 * NOTE:
3106 *
3107 * @param pMac - Pointer to Global MAC structure
3108 *
3109 * @return None
3110 */
3111#if 0
3112void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3113{
3114
3115 tpPESession psessionEntry;
3116 tANI_U32 sessionId;
3117
3118 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3119 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003120 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 }
3122
3123 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3124
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003126
3127 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3128 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003129 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 return;
3131 }
3132
3133 limWPSPBCTimeout(pMac, psessionEntry);
3134}
3135#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003136
Jeff Johnson295189b2012-06-20 16:38:30 -07003137/**----------------------------------------------
3138\fn limStartQuietTimer
3139\brief Starts the quiet timer.
3140
3141\param pMac
3142\return NONE
3143-----------------------------------------------*/
3144void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3145{
3146 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303147 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003148
3149 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003150 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003151 return;
3152 }
3153
Jeff Johnson295189b2012-06-20 16:38:30 -07003154
3155 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3156 return;
3157 // First, de-activate Timer, if its already active
3158 limCancelDot11hQuiet(pMac, psessionEntry);
3159
Jeff Johnsone7245742012-09-05 17:12:55 -07003160 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3161 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3162 {
3163 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003164 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003165 }
3166
3167 // Set the NEW timeout value, in ticks
3168 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3169 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3170 {
3171 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003172 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003173 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003174
3175 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3176 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3177 {
3178 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003179 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003180 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003181
Jeff Johnsone7245742012-09-05 17:12:55 -07003182 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003183 return;
3184 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003185}
3186
Jeff Johnson295189b2012-06-20 16:38:30 -07003187
3188/** ------------------------------------------------------------------------ **/
3189/**
3190 * keep track of the number of ANI peers associated in the BSS
3191 * For the first and last ANI peer, we have to update EDCA params as needed
3192 *
3193 * When the first ANI peer joins the BSS, we notify SCH
3194 * When the last ANI peer leaves the BSS, we notfiy SCH
3195 */
3196void
3197limUtilCountStaAdd(
3198 tpAniSirGlobal pMac,
3199 tpDphHashNode pSta,
3200 tpPESession psessionEntry)
3201{
3202
3203 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3204 return;
3205
3206 pSta->fAniCount = 1;
3207
3208 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3209 return;
3210
3211 // get here only if this is the first ANI peer in the BSS
3212 schEdcaProfileUpdate(pMac, psessionEntry);
3213}
3214
3215void
3216limUtilCountStaDel(
3217 tpAniSirGlobal pMac,
3218 tpDphHashNode pSta,
3219 tpPESession psessionEntry)
3220{
3221
3222 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3223 return;
3224
3225 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3226 * then go ahead and update the count and profiles. This ensures
3227 * that the "number of ani station" count is properly incremented/decremented.
3228 */
3229 if (pSta->valid == 1)
3230 return;
3231
3232 pSta->fAniCount = 0;
3233
3234 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003236 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 pMac->lim.gLimNumOfAniSTAs);
3238 return;
3239 }
3240
3241 pMac->lim.gLimNumOfAniSTAs--;
3242
3243 if (pMac->lim.gLimNumOfAniSTAs != 0)
3244 return;
3245
3246 // get here only if this is the last ANI peer in the BSS
3247 schEdcaProfileUpdate(pMac, psessionEntry);
3248}
3249
Jeff Johnson295189b2012-06-20 16:38:30 -07003250/**
3251 * limSwitchChannelCback()
3252 *
3253 *FUNCTION:
3254 * This is the callback function registered while requesting to switch channel
3255 * after AP indicates a channel switch for spectrum management (11h).
3256 *
3257 *NOTE:
3258 * @param pMac Pointer to Global MAC structure
3259 * @param status Status of channel switch request
3260 * @param data User data
3261 * @param psessionEntry Session information
3262 * @return NONE
3263 */
3264void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3265 tANI_U32 *data, tpPESession psessionEntry)
3266{
3267 tSirMsgQ mmhMsg = {0};
3268 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3269
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3271
3272 /* We need to restore pre-channelSwitch state on the STA */
3273 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3274 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003275 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 return;
3277 }
3278
3279 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303280 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3281 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003283 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 return;
3285 }
3286
3287 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3288 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003289 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3291 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303292 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3294 mmhMsg.bodyval = 0;
3295
Jeff Johnsone7245742012-09-05 17:12:55 -07003296 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003297
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003299}
3300
3301/**
3302 * limSwitchPrimaryChannel()
3303 *
3304 *FUNCTION:
3305 * This function changes the current operating channel
3306 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3307 *
3308 *NOTE:
3309 * @param pMac Pointer to Global MAC structure
3310 * @param newChannel new chnannel ID
3311 * @return NONE
3312 */
3313void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3314{
3315#if !defined WLAN_FEATURE_VOWIFI
3316 tANI_U32 localPwrConstraint;
3317#endif
3318
Abhishek Singh127a8442014-12-15 17:31:27 +05303319 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3320 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 psessionEntry->currentReqChannel = newChannel;
3322 psessionEntry->limRFBand = limGetRFBand(newChannel);
3323
3324 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3325
3326 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3327 pMac->lim.gpchangeChannelData = NULL;
3328
3329#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003330 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3332#else
3333 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3334 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 return;
3337 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003338 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3340#endif
3341 return;
3342}
3343
3344/**
3345 * limSwitchPrimarySecondaryChannel()
3346 *
3347 *FUNCTION:
3348 * This function changes the primary and secondary channel.
3349 * If 11h is enabled and user provides a "new channel ID"
3350 * that is different from the current operating channel,
3351 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3352 * assign notify LIM of such change.
3353 *
3354 *NOTE:
3355 * @param pMac Pointer to Global MAC structure
3356 * @param newChannel New chnannel ID (or current channel ID)
3357 * @param subband CB secondary info:
3358 * - eANI_CB_SECONDARY_NONE
3359 * - eANI_CB_SECONDARY_UP
3360 * - eANI_CB_SECONDARY_DOWN
3361 * @return NONE
3362 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003363void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003364{
3365#if !defined WLAN_FEATURE_VOWIFI
3366 tANI_U32 localPwrConstraint;
3367#endif
3368
Jeff Johnson295189b2012-06-20 16:38:30 -07003369#if !defined WLAN_FEATURE_VOWIFI
3370 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003371 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 return;
3373 }
3374#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303375 /* Assign the callback to resume TX once channel is changed.
3376 */
3377 psessionEntry->currentReqChannel = newChannel;
3378 psessionEntry->limRFBand = limGetRFBand(newChannel);
3379
3380 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3381
3382 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3383 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003384
Jeff Johnson295189b2012-06-20 16:38:30 -07003385#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003386 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003387#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003388 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003389#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003390
Jeff Johnsone7245742012-09-05 17:12:55 -07003391 // Store the new primary and secondary channel in session entries if different
3392 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 {
3394 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003395 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003396 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 psessionEntry->currentOperChannel = newChannel;
3398 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 if (psessionEntry->htSecondaryChannelOffset != subband)
3400 {
3401 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003402 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003403 psessionEntry->htSecondaryChannelOffset, subband);
3404 psessionEntry->htSecondaryChannelOffset = subband;
3405 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3406 {
3407 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3408 }
3409 else
3410 {
3411 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3412 }
3413 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3414 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003415
3416 return;
3417}
3418
3419
3420/**
3421 * limActiveScanAllowed()
3422 *
3423 *FUNCTION:
3424 * Checks if active scans are permitted on the given channel
3425 *
3426 *LOGIC:
3427 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3428 * Need to check if the channelNum matches, then depending on the corresponding
3429 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3430 *
3431 *ASSUMPTIONS:
3432 *
3433 *NOTE:
3434 *
3435 * @param pMac Pointer to Global MAC structure
3436 * @param channelNum channel number
3437 * @return None
3438 */
3439
3440tANI_U8 limActiveScanAllowed(
3441 tpAniSirGlobal pMac,
3442 tANI_U8 channelNum)
3443{
3444 tANI_U32 i;
3445 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3446 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3447 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3448 != eSIR_SUCCESS)
3449 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003450 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 return false;
3452 }
3453
3454 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3455 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003456 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003457 len);
3458 return false;
3459 }
3460
3461 for (i=0; (i+1) < len; i+=2)
3462 {
3463 if (channelPair[i] == channelNum)
3464 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3465 }
3466 return false;
3467}
3468
3469/**
3470 * limTriggerBackgroundScanDuringQuietBss()
3471 *
3472 *FUNCTION:
3473 * This function is applicable to the STA only.
3474 * This function is called by limProcessQuietTimeout(),
3475 * when it is time to honor the Quiet BSS IE from the AP.
3476 *
3477 *LOGIC:
3478 * If 11H is enabled:
3479 * We cannot trigger a background scan. The STA needs to
3480 * shut-off Tx/Rx.
3481 * If 11 is not enabled:
3482 * Determine if the next channel that we are going to
3483 * scan is NOT the same channel (or not) on which the
3484 * Quiet BSS was requested.
3485 * If yes, then we cannot trigger a background scan on
3486 * this channel. Return with a false.
3487 * If no, then trigger a background scan. Return with
3488 * a true.
3489 *
3490 *ASSUMPTIONS:
3491 *
3492 *NOTE:
3493 * This API is redundant if the existing API,
3494 * limTriggerBackgroundScan(), were to return a valid
3495 * response instead of returning void.
3496 * If possible, try to revisit this API
3497 *
3498 * @param pMac Pointer to Global MAC structure
3499 * @return eSIR_TRUE, if a background scan was attempted
3500 * eSIR_FALSE, if not
3501 */
3502tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3503{
3504 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003505
3506
3507
3508 //TBD-RAJESH HOW TO GET sessionEntry?????
3509 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3510
3511 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3512 return bScanTriggered;
3513
Jeff Johnsone7245742012-09-05 17:12:55 -07003514 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 {
3516 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3517 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3518
3519 // Determine the next scan channel
3520
3521 // Get background scan channel list from CFG
3522 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3523 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3524 (tANI_U8 *) bgScanChannelList,
3525 (tANI_U32 *) &len ))
3526 {
3527 // Ensure that we do not go off scanning on the same
3528 // channel on which the Quiet BSS was requested
3529 if( psessionEntry->currentOperChannel!=
3530 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3531 {
3532 // For now, try and attempt a background scan. It will
3533 // be ideal if this API actually returns a success or
3534 // failure instead of having a void return type
3535 limTriggerBackgroundScan( pMac );
3536
3537 bScanTriggered = eSIR_TRUE;
3538 }
3539 else
3540 {
3541 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003542 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 -07003543 }
3544 }
3545 else
3546 {
3547 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003548 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 -07003549 }
3550 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 return bScanTriggered;
3552}
3553
3554
3555/**
3556 * limGetHTCapability()
3557 *
3558 *FUNCTION:
3559 * A utility function that returns the "current HT capability state" for the HT
3560 * capability of interest (as requested in the API)
3561 *
3562 *LOGIC:
3563 * This routine will return with the "current" setting of a requested HT
3564 * capability. This state info could be retrieved from -
3565 * a) CFG (for static entries)
3566 * b) Run time info
3567 * - Dynamic state maintained by LIM
3568 * - Configured at radio init time by SME
3569 *
3570 *
3571 *ASSUMPTIONS:
3572 * NA
3573 *
3574 *NOTE:
3575 *
3576 * @param pMac Pointer to Global MAC structure
3577 * @param htCap The HT capability being queried
3578 * @return tANI_U8 The current state of the requested HT capability is returned in a
3579 * tANI_U8 variable
3580 */
3581
Jeff Johnson295189b2012-06-20 16:38:30 -07003582tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3583 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003584{
3585tANI_U8 retVal = 0;
3586tANI_U8 *ptr;
3587tANI_U32 cfgValue;
3588tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3589tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3590tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3591tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3592
3593 //
3594 // Determine which CFG to read from. Not ALL of the HT
3595 // related CFG's need to be read each time this API is
3596 // accessed
3597 //
3598 if( htCap >= eHT_ANTENNA_SELECTION &&
3599 htCap < eHT_SI_GRANULARITY )
3600 {
3601 // Get Antenna Seletion HT Capabilities
3602 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3603 cfgValue = 0;
3604 ptr = (tANI_U8 *) &macASCapabilityInfo;
3605 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3606 }
3607 else
3608 {
3609 if( htCap >= eHT_TX_BEAMFORMING &&
3610 htCap < eHT_ANTENNA_SELECTION )
3611 {
3612 // Get Transmit Beam Forming HT Capabilities
3613 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3614 cfgValue = 0;
3615 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3616 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3617 }
3618 else
3619 {
3620 if( htCap >= eHT_PCO &&
3621 htCap < eHT_TX_BEAMFORMING )
3622 {
3623 // Get Extended HT Capabilities
3624 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3625 cfgValue = 0;
3626 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3627 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3628 }
3629 else
3630 {
3631 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3632 {
3633 // Get HT Capabilities
3634 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3635 cfgValue = 0;
3636 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3637 // 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
3638 *ptr++ = cfgValue & 0xff;
3639 *ptr = (cfgValue >> 8) & 0xff;
3640 }
3641 }
3642 }
3643 }
3644
3645 switch( htCap )
3646 {
3647 case eHT_LSIG_TXOP_PROTECTION:
3648 retVal = pMac->lim.gHTLsigTXOPProtection;
3649 break;
3650
3651 case eHT_STBC_CONTROL_FRAME:
3652 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3653 break;
3654
3655 case eHT_PSMP:
3656 retVal = pMac->lim.gHTPSMPSupport;
3657 break;
3658
3659 case eHT_DSSS_CCK_MODE_40MHZ:
3660 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3661 break;
3662
3663 case eHT_MAX_AMSDU_LENGTH:
3664 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3665 break;
3666
3667 case eHT_DELAYED_BA:
3668 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3669 break;
3670
3671 case eHT_RX_STBC:
3672 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3673 break;
3674
3675 case eHT_TX_STBC:
3676 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3677 break;
3678
3679 case eHT_SHORT_GI_40MHZ:
3680 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3681 break;
3682
3683 case eHT_SHORT_GI_20MHZ:
3684 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3685 break;
3686
3687 case eHT_GREENFIELD:
3688 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3689 break;
3690
3691 case eHT_MIMO_POWER_SAVE:
3692 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3693 break;
3694
3695 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003696 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003697 break;
3698
3699 case eHT_ADVANCED_CODING:
3700 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3701 break;
3702
3703 case eHT_MAX_RX_AMPDU_FACTOR:
3704 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3705 break;
3706
3707 case eHT_MPDU_DENSITY:
3708 retVal = pMac->lim.gHTAMpduDensity;
3709 break;
3710
3711 case eHT_PCO:
3712 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3713 break;
3714
3715 case eHT_TRANSITION_TIME:
3716 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3717 break;
3718
3719 case eHT_MCS_FEEDBACK:
3720 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3721 break;
3722
3723 case eHT_TX_BEAMFORMING:
3724 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3725 break;
3726
3727 case eHT_ANTENNA_SELECTION:
3728 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3729 break;
3730
3731 case eHT_SI_GRANULARITY:
3732 retVal = pMac->lim.gHTServiceIntervalGranularity;
3733 break;
3734
3735 case eHT_CONTROLLED_ACCESS:
3736 retVal = pMac->lim.gHTControlledAccessOnly;
3737 break;
3738
3739 case eHT_RIFS_MODE:
3740 retVal = psessionEntry->beaconParams.fRIFSMode;
3741 break;
3742
3743 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003744 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 break;
3746
3747 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003748 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 break;
3750
3751 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003752 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3753 retVal = psessionEntry->htOperMode;
3754 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003755 retVal = pMac->lim.gHTOperMode;
3756 break;
3757
3758 case eHT_BASIC_STBC_MCS:
3759 retVal = pMac->lim.gHTSTBCBasicMCS;
3760 break;
3761
3762 case eHT_DUAL_CTS_PROTECTION:
3763 retVal = pMac->lim.gHTDualCTSProtection;
3764 break;
3765
3766 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3767 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3768 break;
3769
3770 case eHT_PCO_ACTIVE:
3771 retVal = pMac->lim.gHTPCOActive;
3772 break;
3773
3774 case eHT_PCO_PHASE:
3775 retVal = pMac->lim.gHTPCOPhase;
3776 break;
3777
3778 default:
3779 break;
3780 }
3781
3782 return retVal;
3783}
3784
Jeff Johnson295189b2012-06-20 16:38:30 -07003785void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3786{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303787 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 return;
3789}
3790
3791
3792
3793
3794/** -------------------------------------------------------------
3795\fn limEnable11aProtection
3796\brief based on config setting enables\disables 11a protection.
3797\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3798\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3799\param tpUpdateBeaconParams pBeaconParams
3800\return None
3801 -------------------------------------------------------------*/
3802tSirRetStatus
3803limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3804 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3805{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003806 if(NULL == psessionEntry)
3807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003808 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003809 return eSIR_FAILURE;
3810 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 //overlapping protection configuration check.
3812 if(overlap)
3813 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 }
3815 else
3816 {
3817 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003818 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003819 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 {
3821 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003822 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003823 return eSIR_SUCCESS;
3824 }
3825 }
3826
3827 if (enable)
3828 {
3829 //If we are AP and HT capable, we need to set the HT OP mode
3830 //appropriately.
3831 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003832 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 {
3834 if(overlap)
3835 {
3836 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3837 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3838 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3839 {
3840 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3841 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3842 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3843 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3844 }
3845 }
3846 else
3847 {
3848 psessionEntry->gLim11aParams.protectionEnabled = true;
3849 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3850 {
3851 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003852 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003853 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3854 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3855
3856 }
3857 }
3858 }
3859
3860 //This part is common for staiton as well.
3861 if(false == psessionEntry->beaconParams.llaCoexist)
3862 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003863 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3865 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3866 }
3867 }
3868 else if (true == psessionEntry->beaconParams.llaCoexist)
3869 {
3870 //for AP role.
3871 //we need to take care of HT OP mode change if needed.
3872 //We need to take care of Overlap cases.
3873 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3874 {
3875 if(overlap)
3876 {
3877 //Overlap Legacy protection disabled.
3878 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3879
3880 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003881 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 {
3883 // no HT op mode change if any of the overlap protection enabled.
3884 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3885 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3886 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3887
3888 {
3889 //Check if there is a need to change HT OP mode.
3890 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3891 {
3892 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3893 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3894
3895 if(psessionEntry->gLimHt20Params.protectionEnabled)
3896 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3897 else
3898 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3899 }
3900 }
3901 }
3902 }
3903 else
3904 {
3905 //Disable protection from 11A stations.
3906 psessionEntry->gLim11aParams.protectionEnabled = false;
3907 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3908
3909 //Check if any other non-HT protection enabled.
3910 //Right now we are in HT OP Mixed mode.
3911 //Change HT op mode appropriately.
3912
3913 //Change HT OP mode to 01 if any overlap protection enabled
3914 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3915 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3916 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3917
3918 {
3919 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003920 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003921 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3922 }
3923 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3924 {
3925 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003926 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003927 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3928 }
3929 else
3930 {
3931 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003932 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3934 }
3935 }
3936 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3937 !psessionEntry->gLim11aParams.protectionEnabled)
3938 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003939 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3941 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3942 }
3943 }
3944 //for station role
3945 else
3946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003947 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3949 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3950 }
3951 }
3952
3953 return eSIR_SUCCESS;
3954}
3955
3956/** -------------------------------------------------------------
3957\fn limEnable11gProtection
3958\brief based on config setting enables\disables 11g protection.
3959\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3960\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3961\param tpUpdateBeaconParams pBeaconParams
3962\return None
3963 -------------------------------------------------------------*/
3964
3965tSirRetStatus
3966limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3967 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3968{
3969
3970 //overlapping protection configuration check.
3971 if(overlap)
3972 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 }
3974 else
3975 {
3976 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3978 !psessionEntry->cfgProtection.fromllb)
3979 {
3980 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003981 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 return eSIR_SUCCESS;
3983 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003984 {
3985 if(!pMac->lim.cfgProtection.fromllb)
3986 {
3987 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003988 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 return eSIR_SUCCESS;
3990 }
3991 }
3992 }
3993
3994 if (enable)
3995 {
3996 //If we are AP and HT capable, we need to set the HT OP mode
3997 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3999 {
4000 if(overlap)
4001 {
4002 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004003 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004004 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 {
4006 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4007 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4008 {
4009 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4010 }
4011 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4012 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4013 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4014 //Not processing OBSS bit from other APs, as we are already taking care
4015 //of Protection from overlapping BSS based on erp IE or useProtection bit
4016 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4017 }
4018 }
4019 else
4020 {
4021 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004022 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004023 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004024 {
4025 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4026 {
4027 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4028 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4029 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4030 }
4031 }
4032 }
4033 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004034 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 {
4036 if(overlap)
4037 {
4038 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4039 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4040 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4041 {
4042 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4043 }
4044 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4045 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4046 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4047 //Not processing OBSS bit from other APs, as we are already taking care
4048 //of Protection from overlapping BSS based on erp IE or useProtection bit
4049 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4050 }
4051 else
4052 {
4053 psessionEntry->gLim11bParams.protectionEnabled = true;
4054 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4055 {
4056 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4057 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4058 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4059 }
4060 }
4061 }
4062
4063 //This part is common for staiton as well.
4064 if(false == psessionEntry->beaconParams.llbCoexist)
4065 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4068 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4069 }
4070 }
4071 else if (true == psessionEntry->beaconParams.llbCoexist)
4072 {
4073 //for AP role.
4074 //we need to take care of HT OP mode change if needed.
4075 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004076 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4077 {
4078 if(overlap)
4079 {
4080 //Overlap Legacy protection disabled.
4081 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4082
4083 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004084 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 {
4086 // no HT op mode change if any of the overlap protection enabled.
4087 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4088 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4089 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4090 {
4091 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004092 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 {
4094 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4095 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4096 if(psessionEntry->gLimHt20Params.protectionEnabled){
4097 //Commenting out beacuse of CR 258588 WFA cert
4098 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4099 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4100 }
4101 else
4102 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4103 }
4104 }
4105 }
4106 }
4107 else
4108 {
4109 //Disable protection from 11B stations.
4110 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004111 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 //Check if any other non-HT protection enabled.
4113 if(!psessionEntry->gLim11gParams.protectionEnabled)
4114 {
4115 //Right now we are in HT OP Mixed mode.
4116 //Change HT op mode appropriately.
4117 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4118
4119 //Change HT OP mode to 01 if any overlap protection enabled
4120 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4121 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4122 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4123 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4124 {
4125 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004126 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4128 }
4129 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4130 {
4131 //Commenting because of CR 258588 WFA cert
4132 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4133 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004134 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004135 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4136 }
4137 else
4138 {
4139 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4140 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4141 }
4142 }
4143 }
4144 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4145 !psessionEntry->gLim11bParams.protectionEnabled)
4146 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004147 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004148 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4149 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4150 }
4151 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004152 {
4153 if(overlap)
4154 {
4155 //Overlap Legacy protection disabled.
4156 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4157
4158 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004159 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 {
4161 // no HT op mode change if any of the overlap protection enabled.
4162 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4163 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4164 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4165
4166 {
4167 //Check if there is a need to change HT OP mode.
4168 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4169 {
4170 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4171 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4172 if(psessionEntry->gLimHt20Params.protectionEnabled)
4173 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4174 else
4175 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4176 }
4177 }
4178 }
4179 }
4180 else
4181 {
4182 //Disable protection from 11B stations.
4183 psessionEntry->gLim11bParams.protectionEnabled = false;
4184 //Check if any other non-HT protection enabled.
4185 if(!psessionEntry->gLim11gParams.protectionEnabled)
4186 {
4187 //Right now we are in HT OP Mixed mode.
4188 //Change HT op mode appropriately.
4189 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4190
4191 //Change HT OP mode to 01 if any overlap protection enabled
4192 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4193 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4194 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4195 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4196
4197 {
4198 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4199 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4200 }
4201 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4202 {
4203 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4204 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4205 }
4206 else
4207 {
4208 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4209 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4210 }
4211 }
4212 }
4213 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4214 !psessionEntry->gLim11bParams.protectionEnabled)
4215 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004216 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4218 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4219 }
4220 }
4221 //for station role
4222 else
4223 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004224 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4226 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4227 }
4228 }
4229 return eSIR_SUCCESS;
4230}
4231
4232/** -------------------------------------------------------------
4233\fn limEnableHtProtectionFrom11g
4234\brief based on cofig enables\disables protection from 11g.
4235\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4236\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4237\param tpUpdateBeaconParams pBeaconParams
4238\return None
4239 -------------------------------------------------------------*/
4240tSirRetStatus
4241limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4242 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4243{
Jeff Johnsone7245742012-09-05 17:12:55 -07004244 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4246
4247 //overlapping protection configuration check.
4248 if(overlap)
4249 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004250 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4251 {
4252 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004253 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 return eSIR_SUCCESS;
4255 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004256 {
4257 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004258 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 return eSIR_SUCCESS;
4260 }
4261 }
4262 else
4263 {
4264 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4266 !psessionEntry->cfgProtection.fromllg){
4267 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004268 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 return eSIR_SUCCESS;
4270 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 {
4272 if(!pMac->lim.cfgProtection.fromllg)
4273 {
4274 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004275 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 return eSIR_SUCCESS;
4277 }
4278 }
4279 }
4280 if (enable)
4281 {
4282 //If we are AP and HT capable, we need to set the HT OP mode
4283 //appropriately.
4284
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4286 {
4287 if(overlap)
4288 {
4289 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4290 //11g exists in overlap BSS.
4291 //need not to change the operating mode to overlap_legacy
4292 //if higher or same protection operating mode is enabled right now.
4293 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4294 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4295 {
4296 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4297 }
4298 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304299 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 }
4301 else
4302 {
4303 //11g is associated to an AP operating in 11n mode.
4304 //Change the HT operating mode to 'mixed mode'.
4305 psessionEntry->gLim11gParams.protectionEnabled = true;
4306 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4307 {
4308 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4309 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304310 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 }
4312 }
4313 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 {
4315 if(overlap)
4316 {
4317 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4318 //11g exists in overlap BSS.
4319 //need not to change the operating mode to overlap_legacy
4320 //if higher or same protection operating mode is enabled right now.
4321 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4322 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4323 {
4324 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4325 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4326 }
4327 }
4328 else
4329 {
4330 //11g is associated to an AP operating in 11n mode.
4331 //Change the HT operating mode to 'mixed mode'.
4332 psessionEntry->gLim11gParams.protectionEnabled = true;
4333 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4334 {
4335 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4336 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304337 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 }
4339 }
4340 }
4341
4342 //This part is common for staiton as well.
4343 if(false == psessionEntry->beaconParams.llgCoexist)
4344 {
4345 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4346 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4349 {
4350 // As operating mode changed after G station assoc some way to update beacon
4351 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4352 //pMac->sch.schObject.fBeaconChanged = 1;
4353 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 }
4356 else if (true == psessionEntry->beaconParams.llgCoexist)
4357 {
4358 //for AP role.
4359 //we need to take care of HT OP mode change if needed.
4360 //We need to take care of Overlap cases.
4361
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4363 {
4364 if(overlap)
4365 {
4366 //Overlap Legacy protection disabled.
4367 if (psessionEntry->gLim11gParams.numSta == 0)
4368 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4369
4370 // no HT op mode change if any of the overlap protection enabled.
4371 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4372 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4373 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4374 {
4375 //Check if there is a need to change HT OP mode.
4376 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4377 {
4378 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4379 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4380
4381 if(psessionEntry->gLimHt20Params.protectionEnabled){
4382 //Commenting because of CR 258588 WFA cert
4383 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4384 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4385 }
4386 else
4387 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4388 }
4389 }
4390 }
4391 else
4392 {
4393 //Disable protection from 11G stations.
4394 psessionEntry->gLim11gParams.protectionEnabled = false;
4395 //Check if any other non-HT protection enabled.
4396 if(!psessionEntry->gLim11bParams.protectionEnabled)
4397 {
4398
4399 //Right now we are in HT OP Mixed mode.
4400 //Change HT op mode appropriately.
4401 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4402
4403 //Change HT OP mode to 01 if any overlap protection enabled
4404 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4405 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4406 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4407 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4408
4409 {
4410 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4411 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4412 }
4413 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4414 {
4415 //Commenting because of CR 258588 WFA cert
4416 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4417 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4418 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4419 }
4420 else
4421 {
4422 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4423 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4424 }
4425 }
4426 }
4427 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4428 !psessionEntry->gLim11gParams.protectionEnabled)
4429 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004430 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4432 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4433 }
4434 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 {
4436 if(overlap)
4437 {
4438 //Overlap Legacy protection disabled.
4439 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4440
4441 // no HT op mode change if any of the overlap protection enabled.
4442 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4443 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4444 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4445 {
4446 //Check if there is a need to change HT OP mode.
4447 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4448 {
4449 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4450 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4451
4452 if(psessionEntry->gLimHt20Params.protectionEnabled)
4453 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4454 else
4455 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4456 }
4457 }
4458 }
4459 else
4460 {
4461 //Disable protection from 11G stations.
4462 psessionEntry->gLim11gParams.protectionEnabled = false;
4463 //Check if any other non-HT protection enabled.
4464 if(!psessionEntry->gLim11bParams.protectionEnabled)
4465 {
4466
4467 //Right now we are in HT OP Mixed mode.
4468 //Change HT op mode appropriately.
4469 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4470
4471 //Change HT OP mode to 01 if any overlap protection enabled
4472 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4473 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4474 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4475 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4476
4477 {
4478 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4479 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4480 }
4481 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4482 {
4483 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4484 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4485 }
4486 else
4487 {
4488 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4489 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4490 }
4491 }
4492 }
4493 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4494 !psessionEntry->gLim11gParams.protectionEnabled)
4495 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004496 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4498 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4499 }
4500 }
4501 //for station role
4502 else
4503 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004504 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4506 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4507 }
4508 }
4509 return eSIR_SUCCESS;
4510}
4511//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4512//This check will be done at the caller.
4513
4514/** -------------------------------------------------------------
4515\fn limEnableHtObssProtection
4516\brief based on cofig enables\disables obss protection.
4517\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4518\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4519\param tpUpdateBeaconParams pBeaconParams
4520\return None
4521 -------------------------------------------------------------*/
4522tSirRetStatus
4523limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4524 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4525{
4526
4527
Jeff Johnsone7245742012-09-05 17:12:55 -07004528 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 return eSIR_SUCCESS; // this protection is only for HT stations.
4530
4531 //overlapping protection configuration check.
4532 if(overlap)
4533 {
4534 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 }
4536 else
4537 {
4538 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4540 { //ToDo Update this field
4541 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004542 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 return eSIR_SUCCESS;
4544 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 {
4546 if(!pMac->lim.cfgProtection.obss)
4547 { //ToDo Update this field
4548 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004549 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 return eSIR_SUCCESS;
4551 }
4552 }
4553 }
4554
4555
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4557 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4558 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004559 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 psessionEntry->beaconParams.gHTObssMode = true;
4561 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4562
4563 }
4564 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4565 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004566 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 psessionEntry->beaconParams.gHTObssMode = false;
4568 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4569
4570 }
4571//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4572 if (!enable && !overlap)
4573 {
4574 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4575 }
4576 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 {
4578 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4579 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004580 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 psessionEntry->beaconParams.gHTObssMode = true;
4582 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4583
4584 }
4585 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4586 {
4587
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004588 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 psessionEntry->beaconParams.gHTObssMode = false;
4590 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4591
4592 }
4593 }
4594 return eSIR_SUCCESS;
4595}
4596/** -------------------------------------------------------------
4597\fn limEnableHT20Protection
4598\brief based on cofig enables\disables protection from Ht20.
4599\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4600\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4601\param tpUpdateBeaconParams pBeaconParams
4602\return None
4603 -------------------------------------------------------------*/
4604tSirRetStatus
4605limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4606 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4607{
Jeff Johnsone7245742012-09-05 17:12:55 -07004608 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004609 return eSIR_SUCCESS; // this protection is only for HT stations.
4610
4611 //overlapping protection configuration check.
4612 if(overlap)
4613 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 }
4615 else
4616 {
4617 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4619 !psessionEntry->cfgProtection.ht20)
4620 {
4621 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004622 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 return eSIR_SUCCESS;
4624 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 {
4626 if(!pMac->lim.cfgProtection.ht20)
4627 {
4628 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004629 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 return eSIR_SUCCESS;
4631 }
4632 }
4633 }
4634
4635 if (enable)
4636 {
4637 //If we are AP and HT capable, we need to set the HT OP mode
4638 //appropriately.
4639
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4641 if(overlap)
4642 {
4643 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4644 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4645 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4646 {
4647 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4648 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4649 }
4650 }
4651 else
4652 {
4653 psessionEntry->gLimHt20Params.protectionEnabled = true;
4654 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4655 {
4656 //Commenting because of CR 258588 WFA cert
4657 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4658 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4659 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4660 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4661 }
4662 }
4663 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 {
4665 if(overlap)
4666 {
4667 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4668 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4669 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4670 {
4671 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4672 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4673 }
4674 }
4675 else
4676 {
4677 psessionEntry->gLimHt20Params.protectionEnabled = true;
4678 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4679 {
4680 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4681 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4682 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4683 }
4684 }
4685 }
4686
4687 //This part is common for staiton as well.
4688 if(false == psessionEntry->beaconParams.ht20Coexist)
4689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004690 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4692 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4693 }
4694 }
4695 else if (true == psessionEntry->beaconParams.ht20Coexist)
4696 {
4697 //for AP role.
4698 //we need to take care of HT OP mode change if needed.
4699 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4701 if(overlap)
4702 {
4703 //Overlap Legacy protection disabled.
4704 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4705
4706 // no HT op mode change if any of the overlap protection enabled.
4707 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4708 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4709 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4710 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4711 {
4712
4713 //Check if there is a need to change HT OP mode.
4714 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4715 {
4716 if(psessionEntry->gLimHt20Params.protectionEnabled)
4717 {
4718 //Commented beacuse of CR 258588 for WFA Cert
4719 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4720 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4721 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4722 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4723 }
4724 else
4725 {
4726 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4727 }
4728 }
4729 }
4730 }
4731 else
4732 {
4733 //Disable protection from 11G stations.
4734 psessionEntry->gLimHt20Params.protectionEnabled = false;
4735
4736 //Change HT op mode appropriately.
4737 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4738 {
4739 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4740 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4741 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4742 }
4743 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004744 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4746 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4747 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004748 {
4749 if(overlap)
4750 {
4751 //Overlap Legacy protection disabled.
4752 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4753
4754 // no HT op mode change if any of the overlap protection enabled.
4755 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4756 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4757 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4758 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4759 {
4760
4761 //Check if there is a need to change HT OP mode.
4762 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4763 {
4764 if(psessionEntry->gLimHt20Params.protectionEnabled)
4765 {
4766 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4767 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4768 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4769 }
4770 else
4771 {
4772 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4773 }
4774 }
4775 }
4776 }
4777 else
4778 {
4779 //Disable protection from 11G stations.
4780 psessionEntry->gLimHt20Params.protectionEnabled = false;
4781
4782 //Change HT op mode appropriately.
4783 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4784 {
4785 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4786 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4787 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4788 }
4789 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004790 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4792 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4793 }
4794 //for station role
4795 else
4796 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004797 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004798 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4799 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4800 }
4801 }
4802
4803 return eSIR_SUCCESS;
4804}
4805
4806/** -------------------------------------------------------------
4807\fn limEnableHTNonGfProtection
4808\brief based on cofig enables\disables protection from NonGf.
4809\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4810\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4811\param tpUpdateBeaconParams pBeaconParams
4812\return None
4813 -------------------------------------------------------------*/
4814tSirRetStatus
4815limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4816 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4817{
Jeff Johnsone7245742012-09-05 17:12:55 -07004818 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004819 return eSIR_SUCCESS; // this protection is only for HT stations.
4820
4821 //overlapping protection configuration check.
4822 if(overlap)
4823 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 }
4825 else
4826 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004827 //normal protection config check
4828 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4829 !psessionEntry->cfgProtection.nonGf)
4830 {
4831 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004832 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 return eSIR_SUCCESS;
4834 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 {
4836 //normal protection config check
4837 if(!pMac->lim.cfgProtection.nonGf)
4838 {
4839 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004840 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 return eSIR_SUCCESS;
4842 }
4843 }
4844 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4846 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4847 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004848 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4850 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4851 }
4852 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4853 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004854 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4856 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4857 }
4858 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 {
4860 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4861 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004862 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4864 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4865 }
4866 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004868 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4870 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4871 }
4872 }
4873
4874 return eSIR_SUCCESS;
4875}
4876
4877/** -------------------------------------------------------------
4878\fn limEnableHTLsigTxopProtection
4879\brief based on cofig enables\disables LsigTxop protection.
4880\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4881\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4882\param tpUpdateBeaconParams pBeaconParams
4883\return None
4884 -------------------------------------------------------------*/
4885tSirRetStatus
4886limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4887 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4888{
Jeff Johnsone7245742012-09-05 17:12:55 -07004889 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004890 return eSIR_SUCCESS; // this protection is only for HT stations.
4891
4892 //overlapping protection configuration check.
4893 if(overlap)
4894 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 }
4896 else
4897 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 //normal protection config check
4899 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4900 !psessionEntry->cfgProtection.lsigTxop)
4901 {
4902 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004903 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004904 return eSIR_SUCCESS;
4905 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 {
4907 //normal protection config check
4908 if(!pMac->lim.cfgProtection.lsigTxop)
4909 {
4910 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004911 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 return eSIR_SUCCESS;
4913 }
4914 }
4915 }
4916
4917
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4919 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4920 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004921 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4923 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4924 }
4925 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4926 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004927 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4929 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4930 }
4931 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 {
4933 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4934 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004935 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4937 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4938 }
4939 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4940 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004941 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004942 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4943 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4944 }
4945 }
4946 return eSIR_SUCCESS;
4947}
4948//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4949//This check will be done at the caller.
4950/** -------------------------------------------------------------
4951\fn limEnableHtRifsProtection
4952\brief based on cofig enables\disables Rifs protection.
4953\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4954\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4955\param tpUpdateBeaconParams pBeaconParams
4956\return None
4957 -------------------------------------------------------------*/
4958tSirRetStatus
4959limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4960 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4961{
Jeff Johnsone7245742012-09-05 17:12:55 -07004962 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004963 return eSIR_SUCCESS; // this protection is only for HT stations.
4964
4965
4966 //overlapping protection configuration check.
4967 if(overlap)
4968 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004969 }
4970 else
4971 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004972 //normal protection config check
4973 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4974 !psessionEntry->cfgProtection.rifs)
4975 {
4976 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 return eSIR_SUCCESS;
4979 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004980 {
4981 //normal protection config check
4982 if(!pMac->lim.cfgProtection.rifs)
4983 {
4984 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004985 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 return eSIR_SUCCESS;
4987 }
4988 }
4989 }
4990
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4992 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4993 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4994 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004995 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004996 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4997 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4998 }
4999 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5000 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5001 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005002 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005003 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5004 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5005 }
5006 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 {
5008 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5009 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5010 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005011 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5013 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5014 }
5015 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5016 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5017 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005018 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5020 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5021 }
5022 }
5023 return eSIR_SUCCESS;
5024}
5025
5026// ---------------------------------------------------------------------
5027/**
5028 * limEnableShortPreamble
5029 *
5030 * FUNCTION:
5031 * Enable/Disable short preamble
5032 *
5033 * LOGIC:
5034 *
5035 * ASSUMPTIONS:
5036 *
5037 * NOTE:
5038 *
5039 * @param enable Flag to enable/disable short preamble
5040 * @return None
5041 */
5042
5043tSirRetStatus
5044limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5045{
5046 tANI_U32 val;
5047
5048 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5049 {
5050 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005051 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 return eSIR_FAILURE;
5053 }
5054
5055 if (!val)
5056 return eSIR_SUCCESS;
5057
5058 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5059 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005060 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 return eSIR_FAILURE;
5062 }
5063
5064 if (!val) // 11G short preamble switching is disabled.
5065 return eSIR_SUCCESS;
5066
5067 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5068 {
5069 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5070 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005071 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 psessionEntry->beaconParams.fShortPreamble = true;
5073 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5074 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5075 }
5076 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5077 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005078 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 psessionEntry->beaconParams.fShortPreamble = false;
5080 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5081 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5082 }
5083 }
5084
5085 return eSIR_SUCCESS;
5086 }
5087
5088/**
5089 * limTxComplete
5090 *
5091 * Function:
5092 * This is LIM's very own "TX MGMT frame complete" completion routine.
5093 *
5094 * Logic:
5095 * LIM wants to send a MGMT frame (broadcast or unicast)
5096 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5097 * LIM transmits the MGMT frame using the API:
5098 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5099 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5100 * HDD, if it determines that a TX completion routine (in this case
5101 * limTxComplete) has been provided, will invoke this callback
5102 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5103 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5104 *
5105 * Assumptions:
5106 * Presently, this is ONLY being used for MGMT frames/packets
5107 * TODO:
5108 * Would it do good for LIM to have some sort of "signature" validation to
5109 * ensure that the pData argument passed in was a buffer that was actually
5110 * allocated by LIM and/or is not corrupted?
5111 *
5112 * Note: FIXME and TODO
5113 * Looks like palPktFree() is interested in pPacket. But, when this completion
5114 * routine is called, only pData is made available to LIM!!
5115 *
5116 * @param void A pointer to pData. Shouldn't it be pPacket?!
5117 *
5118 * @return none
5119 */
5120void limTxComplete( tHalHandle hHal, void *pData )
5121{
5122 tpAniSirGlobal pMac;
5123 pMac = (tpAniSirGlobal)hHal;
5124
5125#ifdef FIXME_PRIMA
5126 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5127#ifdef TRACE_RECORD
5128 {
5129 tpSirMacMgmtHdr mHdr;
5130 v_U8_t *pRxBd;
5131 vos_pkt_t *pVosPkt;
5132 VOS_STATUS vosStatus;
5133
5134
5135
5136 pVosPkt = (vos_pkt_t *)pData;
5137 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5138
5139 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5140 {
5141 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005142
5143 }
5144 }
5145#endif
5146#endif
5147
5148 palPktFree( pMac->hHdd,
5149 HAL_TXRX_FRM_802_11_MGMT,
5150 (void *) NULL, // this is ignored and will likely be removed from this API
5151 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5152}
5153
5154/**
5155 * \brief This function updates lim global structure, if CB parameters in the BSS
5156 * have changed, and sends an indication to HAL also with the
5157 * updated HT Parameters.
5158 * This function does not detect the change in the primary channel, that is done as part
5159 * of channel Swtich IE processing.
5160 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5161 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5162 *
5163 *
5164 * \param pMac Pointer to global MAC structure
5165 *
5166 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5167 * Probe Response
5168 *
5169 * \param bssIdx BSS Index of the Bss to which Station is associated.
5170 *
5171 *
5172 */
5173
5174void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5175 tDot11fIEHTInfo *pHTInfo,
5176 tANI_U8 bssIdx,
5177 tpPESession psessionEntry)
5178{
Jeff Johnsone7245742012-09-05 17:12:55 -07005179 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005180#if !defined WLAN_FEATURE_VOWIFI
5181 tANI_U32 localPwrConstraint;
5182#endif
5183
5184 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005185 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005186 return;
5187
5188#if !defined WLAN_FEATURE_VOWIFI
5189 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005190 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005191 return;
5192 }
5193#endif
5194
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305195 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5196 {
5197 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5198 return;
5199 }
5200
Mihir Shetebc160b72014-08-22 14:10:39 +05305201 /*
5202 * Do not try to switch channel if RoC is in progress. RoC code path uses
5203 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5204 * has started listening on the channel requested as part of RoC, if we set
5205 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5206 * upper layers will think that the channel change is not successful and the
5207 * RoC from the upper layer perspective will never end...
5208 */
5209 if (pMac->lim.gpLimRemainOnChanReq)
5210 {
5211 limLog( pMac, LOGE, FL( "RoC is in progress"));
5212 return;
5213 }
5214
Jeff Johnsone7245742012-09-05 17:12:55 -07005215 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5216 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005217 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005218 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5219 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5220 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5221 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005222
5223 // Notify HAL
5224 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005225 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005226 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005227 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005229 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005230 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5231 pMac->lim.gpchangeChannelCallback = NULL;
5232 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005233
5234#if defined WLAN_FEATURE_VOWIFI
5235 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5236 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5237#else
5238 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5239 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5240#endif
5241
5242 //In case of IBSS, if STA should update HT Info IE in its beacons.
5243 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5244 {
5245 schSetFixedBeaconFields(pMac,psessionEntry);
5246 }
5247
5248 }
5249} // End limUpdateStaRunTimeHTParams.
5250
5251/**
5252 * \brief This function updates the lim global structure, if any of the
5253 * HT Capabilities have changed.
5254 *
5255 *
5256 * \param pMac Pointer to Global MAC structure
5257 *
5258 * \param pHTCapability Pointer to HT Capability Information Element
5259 * obtained from a Beacon or Probe Response
5260 *
5261 *
5262 *
5263 */
5264
5265void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5266 tDot11fIEHTCaps *pHTCaps )
5267{
5268
5269 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5270 {
5271 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5272 // Send change notification to HAL
5273 }
5274
5275 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5276 {
5277 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5278 // Send change notification to HAL
5279 }
5280
5281 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5282 {
5283 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5284 // Send change notification to HAL
5285 }
5286
5287
5288} // End limUpdateStaRunTimeHTCapability.
5289
5290/**
5291 * \brief This function updates lim global structure, if any of the HT
5292 * Info Parameters have changed.
5293 *
5294 *
5295 * \param pMac Pointer to the global MAC structure
5296 *
5297 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5298 * Probe Response
5299 *
5300 *
5301 */
5302
5303void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305304 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005305{
Jeff Johnsone7245742012-09-05 17:12:55 -07005306 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005307 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005308 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005309 // Send change notification to HAL
5310 }
5311
5312 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5313 {
5314 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5315 // Send change notification to HAL
5316 }
5317
5318 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5319 {
5320 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5321 // Send change notification to HAL
5322 }
5323
5324 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5325 {
5326 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5327 // Send change notification to HAL
5328 }
5329
5330 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5331 {
5332 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5333 }
5334
5335 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5336 {
5337 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5338 // Send change notification to HAL
5339 }
5340
5341 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5342 {
5343 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5344 // Send change notification to HAL
5345 }
5346
5347 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5348 {
5349 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5350 // Send change notification to HAL
5351 }
5352
5353 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5354 {
5355 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5356 // Send change notification to HAL
5357 }
5358
5359 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5360 {
5361 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5362 // Send change notification to HAL
5363 }
5364
5365 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5366 {
5367 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5368 // Send change notification to HAL
5369 }
5370
5371} // End limUpdateStaRunTimeHTInfo.
5372
5373
5374/** -------------------------------------------------------------
5375\fn limProcessHalIndMessages
5376\brief callback function for HAL indication
5377\param tpAniSirGlobal pMac
5378\param tANI_U32 mesgId
5379\param void *mesgParam
5380\return tSirRetStatu - status
5381 -------------------------------------------------------------*/
5382
5383tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5384{
5385 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5386 tSirMsgQ msg;
5387
5388 switch(msgId)
5389 {
5390 case SIR_LIM_DEL_TS_IND:
5391 case SIR_LIM_ADD_BA_IND:
5392 case SIR_LIM_DEL_BA_ALL_IND:
5393 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5394 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305395 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005396 msg.type = (tANI_U16) msgId;
5397 msg.bodyptr = msgParam;
5398 msg.bodyval = 0;
5399 break;
5400
5401 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305402 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005403 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005404 return eSIR_FAILURE;
5405 }
5406
5407 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5408 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305409 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005410 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5411 return eSIR_FAILURE;
5412 }
5413 return eSIR_SUCCESS;
5414}
5415
5416/** -------------------------------------------------------------
5417\fn limValidateDeltsReq
5418\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5419\param tpAniSirGlobal pMac
5420\param tpSirDeltsReq pDeltsReq
5421\param tSirMacAddr peerMacAddr
5422\return eSirRetStatus - status
5423 -------------------------------------------------------------*/
5424
5425tSirRetStatus
5426limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5427{
5428 tpDphHashNode pSta;
5429 tANI_U8 tsStatus;
5430 tSirMacTSInfo *tsinfo;
5431 tANI_U32 i;
5432 tANI_U8 tspecIdx;
5433 /* if sta
5434 * - verify assoc state
5435 * - del tspec locally
5436 * if ap,
5437 * - verify sta is in assoc state
5438 * - del sta tspec locally
5439 */
5440 if(pDeltsReq == NULL)
5441 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005442 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005443 return eSIR_FAILURE;
5444 }
5445
5446 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5447 {
5448 tANI_U32 val;
5449
5450 // station always talks to the AP
5451 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5452
5453 val = sizeof(tSirMacAddr);
5454 #if 0
5455 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5456 {
5457 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005458 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005459 return eSIR_FAILURE;
5460 }
5461 #endif// TO SUPPORT BT-AMP
5462 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5463
5464 }
5465 else
5466 {
5467 tANI_U16 assocId;
5468 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5469
5470 assocId = pDeltsReq->aid;
5471 if (assocId != 0)
5472 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5473 else
5474 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5475
5476 if (pSta != NULL)
5477 // TBD: check sta assoc state as well
5478 for (i =0; i < sizeof(tSirMacAddr); i++)
5479 macaddr[i] = pSta->staAddr[i];
5480 }
5481
5482 if (pSta == NULL)
5483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005484 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 return eSIR_FAILURE;
5486 }
5487
5488 if ((! pSta->valid) ||
5489 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5490 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005491 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005492 return eSIR_FAILURE;
5493 }
5494
5495 pDeltsReq->req.wsmTspecPresent = 0;
5496 pDeltsReq->req.wmeTspecPresent = 0;
5497 pDeltsReq->req.lleTspecPresent = 0;
5498
5499 if ((pSta->wsmEnabled) &&
5500 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5501 pDeltsReq->req.wsmTspecPresent = 1;
5502 else if (pSta->wmeEnabled)
5503 pDeltsReq->req.wmeTspecPresent = 1;
5504 else if (pSta->lleEnabled)
5505 pDeltsReq->req.lleTspecPresent = 1;
5506 else
5507 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005508 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 return eSIR_FAILURE;
5510 }
5511
5512 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5513 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305514 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005515 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005516 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305517 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005518
5519 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005520
5521 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5522 != eSIR_SUCCESS)
5523 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005524 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005525 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5526 return eSIR_FAILURE;
5527 }
5528 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5529 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5530 {
5531 //edca only now.
5532 }
5533 else
5534 {
5535 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5536 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5537 {
5538 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305539 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5540 pSta->staIndex,
5541 tspecIdx,
5542 pDeltsReq->req,
5543 psessionEntry->peSessionId,
5544 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005545 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005546 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005547 tsinfo->traffic.userPrio);
5548 return eSIR_FAILURE;
5549 }
5550 }
5551 }
5552 return eSIR_SUCCESS;
5553}
5554
5555/** -------------------------------------------------------------
5556\fn limRegisterHalIndCallBack
5557\brief registers callback function to HAL for any indication.
5558\param tpAniSirGlobal pMac
5559\return none.
5560 -------------------------------------------------------------*/
5561void
5562limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5563{
5564 tSirMsgQ msg;
5565 tpHalIndCB pHalCB;
5566
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305567 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5568 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305570 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005571 return;
5572 }
5573
5574 pHalCB->pHalIndCB = limProcessHalIndMessages;
5575
5576 msg.type = WDA_REGISTER_PE_CALLBACK;
5577 msg.bodyptr = pHalCB;
5578 msg.bodyval = 0;
5579
Jeff Johnsone7245742012-09-05 17:12:55 -07005580 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005581 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5582 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305583 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005584 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 }
5586
5587 return;
5588}
5589
5590
5591/** -------------------------------------------------------------
5592\fn limProcessAddBaInd
5593
5594\brief handles the BA activity check timeout indication coming from HAL.
5595 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5596\param tpAniSirGlobal pMac
5597\param tSirMsgQ limMsg
5598\return None
5599-------------------------------------------------------------*/
5600void
5601limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5602{
5603 tANI_U8 i;
5604 tANI_U8 tid;
5605 tANI_U16 assocId;
5606 tpDphHashNode pSta;
5607 tpAddBaCandidate pBaCandidate;
5608 tANI_U32 baCandidateCnt;
5609 tpBaActivityInd pBaActivityInd;
5610 tpPESession psessionEntry;
5611 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005612#ifdef FEATURE_WLAN_TDLS
5613 boolean htCapable = FALSE;
5614#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005615
5616
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005617 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005618 return;
5619
5620 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5621 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5622
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005623 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005624 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005625 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305626 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005627 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005628 return;
5629 }
5630
5631 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005632#ifdef FEATURE_WLAN_TDLS
5633 if ((baCandidateCnt > pMac->lim.maxStation))
5634#else
5635 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5636#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305638 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005639 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 return;
5641 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005642
5643#ifdef FEATURE_WLAN_TDLS
5644 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5645 //AP capability
5646 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5647
5648 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5649 {
5650 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5651 if ((NULL == pSta) || (!pSta->valid))
5652 continue;
5653
5654 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5655 htCapable = pSta->mlmStaContext.htCapability;
5656 else
5657 htCapable = psessionEntry->htCapability;
5658
5659 if (htCapable)
5660 break;
5661 }
5662 if (!htCapable)
5663 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305664 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005665 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005666 return;
5667 }
5668#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005669
5670 //delete the complete dialoguetoken linked list
5671 limDeleteDialogueTokenList(pMac);
5672 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5673
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005674 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005675 {
5676 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005677 if ((NULL == pSta) || (!pSta->valid))
5678 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005679
5680 for (tid=0; tid<STACFG_MAX_TC; tid++)
5681 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005682 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 (pBaCandidate->baInfo[tid].fBaEnable))
5684 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005685 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5686 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005687 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5688 }
5689 }
5690 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305691 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005692 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005693 return;
5694}
5695
5696
5697/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005698\fn limDeleteBASessions
5699\brief Deletes all the exisitng BA sessions for given session
5700 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005701\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005702\param tpPESession pSessionEntry
5703\param tANI_U32 baDirection
5704\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005705-------------------------------------------------------------*/
5706
5707void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005708limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305709 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005710{
5711 tANI_U32 i;
5712 tANI_U8 tid;
5713 tpDphHashNode pSta;
5714
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005715 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005716 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005717 limLog(pMac, LOGE, FL("Session does not exist"));
5718 }
5719 else
5720 {
5721 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005722 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005723 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5724 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5725 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5726 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005727 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005728 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005729 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005730 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5731 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005732 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005733 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5734 (baDirection & BA_INITIATOR))
5735 {
5736 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305737 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005738 pSessionEntry);
5739 }
5740 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5741 (baDirection & BA_RECIPIENT))
5742 {
5743 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305744 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 pSessionEntry);
5746 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005747 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005748 }
5749 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005750 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5751 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5752 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005753 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5755 &pSessionEntry->dph.dphHashTable);
5756 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005757 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005758 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5759 (baDirection & BA_INITIATOR))
5760 {
5761 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305762 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005763 pSessionEntry);
5764 }
5765 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5766 (baDirection & BA_RECIPIENT))
5767 {
5768 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305769 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005770 pSessionEntry);
5771 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005772 }
5773 }
5774 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005775 }
5776}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005777
5778/** -------------------------------------------------------------
5779\fn limDelAllBASessions
5780\brief Deletes all the exisitng BA sessions.
5781\param tpAniSirGlobal pMac
5782\return None
5783-------------------------------------------------------------*/
5784
5785void limDelAllBASessions(tpAniSirGlobal pMac)
5786{
5787 tANI_U32 i;
5788 tpPESession pSessionEntry;
5789
5790 for (i = 0; i < pMac->lim.maxBssId; i++)
5791 {
5792 pSessionEntry = peFindSessionBySessionId(pMac, i);
5793 if (pSessionEntry)
5794 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305795 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5796 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005797 }
5798 }
5799}
5800
5801/** -------------------------------------------------------------
5802\fn limDelAllBASessionsBtc
5803\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5804 band.
5805\param tpAniSirGlobal pMac
5806\return None
5807-------------------------------------------------------------*/
5808
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005809void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005810{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005811 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005812 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005813 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5814 &sessionId);
5815 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005816 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005817 PELOGW(limLog(pMac, LOGW,
5818 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305819 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305820 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005821 }
5822}
5823
Jeff Johnson295189b2012-06-20 16:38:30 -07005824/** -------------------------------------------------------------
5825\fn limProcessDelTsInd
5826\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5827 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5828\param tpAniSirGlobal pMac
5829\param tSirMsgQ limMsg
5830\return None
5831-------------------------------------------------------------*/
5832void
5833limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5834{
5835 tpDphHashNode pSta;
5836 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5837 tpSirDeltsReq pDelTsReq = NULL;
5838 tSirMacAddr peerMacAddr;
5839 tpSirDeltsReqInfo pDelTsReqInfo;
5840 tpLimTspecInfo pTspecInfo;
5841 tpPESession psessionEntry;
5842 tANI_U8 sessionId;
5843
5844if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5845 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005846 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305847 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005848 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005849 return;
5850 }
5851
5852 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5853 if(pTspecInfo->inuse == false)
5854 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005855 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005856 goto error1;
5857 }
5858
5859 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5860 if(pSta == NULL)
5861 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005862 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005863 pTspecInfo->assocId);
5864 goto error1;
5865 }
5866
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305867 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5868 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005869 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305870 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005871 goto error1;
5872 }
5873
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305874 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005875
5876 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305877 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005878 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305879 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005880
5881
5882 //validate the req
5883 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005885 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005886 goto error2;
5887 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305888 limLog(pMac, LOG1, "Sent DELTS request to station with "
5889 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5890 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005891
5892 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5893 psessionEntry);
5894
5895 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305896 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5897 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005898 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305899 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005900 goto error3;
5901 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305902 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005903
5904 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305905 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005906 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305907 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005908
5909 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5910
5911error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305912 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005913error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305914 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005915error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305916 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005917 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005918 return;
5919}
5920
5921/**
5922 * \brief Setup an A-MPDU/BA session
5923 *
5924 * \sa limPostMlmAddBAReq
5925 *
5926 * \param pMac The global tpAniSirGlobal object
5927 *
5928 * \param pStaDs DPH Hash Node object of peer STA
5929 *
5930 * \param tid TID for which a BA is being setup.
5931 * If this is set to 0xFFFF, then we retrieve
5932 * the default TID from the CFG
5933 *
5934 * \return eSIR_SUCCESS if setup completes successfully
5935 * eSIR_FAILURE is some problem is encountered
5936 */
5937tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5938 tpDphHashNode pStaDs,
5939 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5940{
5941 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005942 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005943 tpDialogueToken dialogueTokenNode;
5944 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005945
Jeff Johnson295189b2012-06-20 16:38:30 -07005946 // Check if the peer is a 11n capable STA
5947 // FIXME - Need a 11n peer indication in DPH.
5948 // For now, using the taurusPeer attribute
5949 //if( 0 == pStaDs->taurusPeer == )
5950 //return eSIR_SUCCESS;
5951
5952 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305953 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5954 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005955 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305956 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005957 status = eSIR_MEM_ALLOC_FAILED;
5958 goto returnFailure;
5959 }
5960
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305961 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005962
5963 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305964 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 pMlmAddBAReq->peerMacAddr,
5966 pStaDs->staAddr,
5967 sizeof( tSirMacAddr ));
5968
5969 // Update the TID
5970 pMlmAddBAReq->baTID = tid;
5971
5972 // Determine the supported BA policy of local STA
5973 // for the TID of interest
5974 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5975
5976 // BA Buffer Size
5977 // Requesting the ADDBA recipient to populate the size.
5978 // If ADDBA is accepted, a non-zero buffer size should
5979 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305980 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5981 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5982 {
5983 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5984 causing very low throughput in HT40 case */
5985 limLog( pMac, LOGW,
5986 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5987 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5988 }
5989 else
5990 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005991
5992 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005993 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5995 pStaDs->staIndex,
5996 tid );
5997
5998 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005999 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006000 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006001 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006002 status = eSIR_FAILURE;
6003 goto returnFailure;
6004 }
6005 pMlmAddBAReq->baTimeout = val; // In TU's
6006
6007 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006008 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006009 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6010 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6011
6012 // BA Starting Sequence Number
6013 pMlmAddBAReq->baSSN = startingSeqNum;
6014
6015 /* Update PE session Id*/
6016 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6017
6018 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6019
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006020 dialogueTokenNode = limAssignDialogueToken(pMac);
6021 if (NULL == dialogueTokenNode)
6022 {
6023 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6024 status = eSIR_FAILURE;
6025 goto returnFailure;
6026 }
6027
Jeff Johnson295189b2012-06-20 16:38:30 -07006028 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006029 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006030 dialogueTokenNode->assocId = pStaDs->assocId;
6031 dialogueTokenNode->tid = tid;
6032 // Send ADDBA Req to MLME
6033 limPostMlmMessage( pMac,
6034 LIM_MLM_ADDBA_REQ,
6035 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006036 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006037
6038returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306039 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006040 return status;
6041}
6042
6043/**
6044 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6045 * will then send an ADDBA Rsp to peer MAC entity
6046 * with the appropriate ADDBA status code
6047 *
6048 * \sa limPostMlmAddBARsp
6049 *
6050 * \param pMac The global tpAniSirGlobal object
6051 *
6052 * \param peerMacAddr MAC address of peer entity that will
6053 * be the recipient of this ADDBA Rsp
6054 *
6055 * \param baStatusCode ADDBA Rsp status code
6056 *
6057 * \param baDialogToken ADDBA Rsp dialog token
6058 *
6059 * \param baTID TID of interest
6060 *
6061 * \param baPolicy The BA policy
6062 *
6063 * \param baBufferSize The BA buffer size
6064 *
6065 * \param baTimeout BA timeout in TU's
6066 *
6067 * \return eSIR_SUCCESS if setup completes successfully
6068 * eSIR_FAILURE is some problem is encountered
6069 */
6070tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6071 tSirMacAddr peerMacAddr,
6072 tSirMacStatusCodes baStatusCode,
6073 tANI_U8 baDialogToken,
6074 tANI_U8 baTID,
6075 tANI_U8 baPolicy,
6076 tANI_U16 baBufferSize,
6077 tANI_U16 baTimeout,
6078 tpPESession psessionEntry)
6079{
6080tSirRetStatus status = eSIR_SUCCESS;
6081tpLimMlmAddBARsp pMlmAddBARsp;
6082
6083 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306084 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6085 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006086 {
6087 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306088 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 status );
6090
6091 status = eSIR_MEM_ALLOC_FAILED;
6092 goto returnFailure;
6093 }
6094
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306095 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006096
6097 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 pMlmAddBARsp->peerMacAddr,
6100 peerMacAddr,
6101 sizeof( tSirMacAddr ));
6102
6103 pMlmAddBARsp->baDialogToken = baDialogToken;
6104 pMlmAddBARsp->addBAResultCode = baStatusCode;
6105 pMlmAddBARsp->baTID = baTID;
6106 pMlmAddBARsp->baPolicy = baPolicy;
6107 pMlmAddBARsp->baBufferSize = baBufferSize;
6108 pMlmAddBARsp->baTimeout = baTimeout;
6109
6110 /* UPdate PE session ID*/
6111 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6112
6113 // Send ADDBA Rsp to MLME
6114 limPostMlmMessage( pMac,
6115 LIM_MLM_ADDBA_RSP,
6116 (tANI_U32 *) pMlmAddBARsp );
6117
6118returnFailure:
6119
6120 return status;
6121}
6122
6123/**
6124 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6125 * will then send an DELBA Ind to peer MAC entity
6126 * with the appropriate DELBA status code
6127 *
6128 * \sa limPostMlmDelBAReq
6129 *
6130 * \param pMac The global tpAniSirGlobal object
6131 *
6132 * \param pSta DPH Hash Node object of peer MAC entity
6133 * for which the BA session is being deleted
6134 *
6135 * \param baDirection DELBA direction
6136 *
6137 * \param baTID TID for which the BA session is being deleted
6138 *
6139 * \param baReasonCode DELBA Req reason code
6140 *
6141 * \return eSIR_SUCCESS if setup completes successfully
6142 * eSIR_FAILURE is some problem is encountered
6143 */
6144tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6145 tpDphHashNode pSta,
6146 tANI_U8 baDirection,
6147 tANI_U8 baTID,
6148 tSirMacReasonCodes baReasonCode,
6149 tpPESession psessionEntry)
6150{
6151tSirRetStatus status = eSIR_SUCCESS;
6152tpLimMlmDelBAReq pMlmDelBAReq;
6153tLimBAState curBaState;
6154
6155if(NULL == pSta)
6156 return eSIR_FAILURE;
6157
6158LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6159
6160 // Need to validate the current BA State.
6161 if( eLIM_BA_STATE_IDLE != curBaState)
6162 {
6163 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006164 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006165 baTID,
6166 curBaState);
6167
6168 status = eSIR_FAILURE;
6169 goto returnFailure;
6170 }
6171
6172 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306173 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6174 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006175 {
6176 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306177 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006178 status );
6179
6180 status = eSIR_MEM_ALLOC_FAILED;
6181 goto returnFailure;
6182 }
6183
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306184 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006185
6186 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306187 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006188 pMlmDelBAReq->peerMacAddr,
6189 pSta->staAddr,
6190 sizeof( tSirMacAddr ));
6191
6192 pMlmDelBAReq->baDirection = baDirection;
6193 pMlmDelBAReq->baTID = baTID;
6194 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6195
6196 /* Update PE session ID*/
6197 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6198
6199 //we don't have valid BA session for the given direction.
6200 // HDD wants to get the BA session deleted on PEER in this case.
6201 // in this case we just need to send DelBA to the peer.
6202 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6203 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6204 {
6205 // Send DELBA Ind over the air
6206 if( eSIR_SUCCESS !=
6207 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6208 status = eSIR_FAILURE;
6209
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306210 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006211 return status;
6212 }
6213
6214
6215 // Update the BA state in STA
6216 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6217
6218 // Send DELBA Req to MLME
6219 limPostMlmMessage( pMac,
6220 LIM_MLM_DELBA_REQ,
6221 (tANI_U32 *) pMlmDelBAReq );
6222
6223returnFailure:
6224
6225 return status;
6226}
6227
6228/**
6229 * \brief Send WDA_ADDBA_REQ to HAL, in order
6230 * to setup a new BA session with a peer
6231 *
6232 * \sa limPostMsgAddBAReq
6233 *
6234 * \param pMac The global tpAniSirGlobal object
6235 *
6236 * \param pSta Runtime, STA-related configuration cached
6237 * in the HashNode object
6238 *
6239 * \param baDialogToken The Action Frame dialog token
6240 *
6241 * \param baTID TID for which the BA session is being setup
6242 *
6243 * \param baPolicy BA Policy
6244 *
6245 * \param baBufferSize The requested BA buffer size
6246 *
6247 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6248 *
6249 * \param baSSN Starting Sequence Number for this BA session
6250 *
6251 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6252 *
6253 * \return none
6254 *
6255 */
6256tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6257 tpDphHashNode pSta,
6258 tANI_U8 baDialogToken,
6259 tANI_U8 baTID,
6260 tANI_U8 baPolicy,
6261 tANI_U16 baBufferSize,
6262 tANI_U16 baTimeout,
6263 tANI_U16 baSSN,
6264 tANI_U8 baDirection,
6265 tpPESession psessionEntry)
6266{
6267tpAddBAParams pAddBAParams = NULL;
6268tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006269tSirMsgQ msgQ;
6270
6271#ifdef WLAN_SOFTAP_VSTA_FEATURE
6272 // we can only do BA on "hard" STAs
6273 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6274 {
6275 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306276 limLog( pMac, LOGE,
6277 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006278 goto returnFailure;
6279 }
6280#endif //WLAN_SOFTAP_VSTA_FEATURE
6281
6282 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306283 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6284 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 {
6286 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306287 FL("AllocateMemory failed")
6288 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006289
6290 retCode = eSIR_MEM_ALLOC_FAILED;
6291 goto returnFailure;
6292 }
6293
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306294 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006295
6296 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306297 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006298 (void *) pAddBAParams->peerMacAddr,
6299 (void *) pSta->staAddr,
6300 sizeof( tSirMacAddr ));
6301
6302 // Populate the REQ parameters
6303 pAddBAParams->staIdx = pSta->staIndex;
6304 pAddBAParams->baDialogToken = baDialogToken;
6305 pAddBAParams->baTID = baTID;
6306 pAddBAParams->baPolicy = baPolicy;
6307 pAddBAParams->baBufferSize = baBufferSize;
6308 pAddBAParams->baTimeout = baTimeout;
6309 pAddBAParams->baSSN = baSSN;
6310 pAddBAParams->baDirection = baDirection;
6311 pAddBAParams->respReqd = 1;
6312
6313 /* UPdate PE session ID */
6314 pAddBAParams->sessionId = psessionEntry->peSessionId;
6315
6316 // Post WDA_ADDBA_REQ to HAL.
6317 msgQ.type = WDA_ADDBA_REQ;
6318 //
6319 // FIXME_AMPDU
6320 // A global counter (dialog token) is required to keep track of
6321 // all PE <-> HAL communication(s)
6322 //
6323 msgQ.reserved = 0;
6324 msgQ.bodyptr = pAddBAParams;
6325 msgQ.bodyval = 0;
6326
6327 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306328 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6329 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6330 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6331 pAddBAParams->baTimeout, pAddBAParams->baTID,
6332 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6333 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006334
6335 //defer any other message until we get response back.
6336 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6337
Jeff Johnsone7245742012-09-05 17:12:55 -07006338 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006339#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6340 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6341#endif //FEATURE_WLAN_DIAG_SUPPORT
6342
6343 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6344 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006345 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006346 retCode );
6347 else
6348 return retCode;
6349
6350returnFailure:
6351
6352 // Clean-up...
6353 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306354 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006355
6356 return retCode;
6357
6358}
6359
6360/**
6361 * \brief Send WDA_DELBA_IND to HAL, in order
6362 * to delete an existing BA session with peer
6363 *
6364 * \sa limPostMsgDelBAInd
6365 *
6366 * \param pMac The global tpAniSirGlobal object
6367 *
6368 * \param pSta Runtime, STA-related configuration cached
6369 * in the HashNode object
6370 *
6371 * \param baTID TID for which the BA session is being setup
6372 *
6373 * \param baDirection Identifies whether the DELBA Ind was
6374 * sent by the BA initiator or recipient
6375 *
6376 * \return none
6377 *
6378 */
6379tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6380 tpDphHashNode pSta,
6381 tANI_U8 baTID,
6382 tANI_U8 baDirection,
6383 tpPESession psessionEntry)
6384{
6385tpDelBAParams pDelBAParams = NULL;
6386tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006387tSirMsgQ msgQ;
6388
6389 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306390 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6391 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006392 {
6393 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306394 FL("AllocateMemory failed")
6395 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006396
6397 retCode = eSIR_MEM_ALLOC_FAILED;
6398 goto returnFailure;
6399 }
6400
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306401 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006402
6403 // Populate the REQ parameters
6404 pDelBAParams->staIdx = pSta->staIndex;
6405 pDelBAParams->baTID = baTID;
6406 pDelBAParams->baDirection = baDirection;
6407
6408 /* Update PE session ID */
6409
6410
6411 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6412 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6413
6414 // Post WDA_DELBA_IND to HAL.
6415 msgQ.type = WDA_DELBA_IND;
6416 //
6417 // FIXME:
6418 // A global counter (dialog token) is required to keep track of
6419 // all PE <-> HAL communication(s)
6420 //
6421 msgQ.reserved = 0;
6422 msgQ.bodyptr = pDelBAParams;
6423 msgQ.bodyval = 0;
6424
6425 limLog( pMac, LOGW,
6426 FL( "Sending SIR_HAL_DELBA_IND..." ));
6427
Jeff Johnsone7245742012-09-05 17:12:55 -07006428 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006429#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6430 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6431#endif //FEATURE_WLAN_DIAG_SUPPORT
6432
6433 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6434 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006435 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006436 retCode );
6437 else
6438 {
6439 // Update LIM's internal cache...
6440 if( eBA_INITIATOR == baDirection)
6441 {
6442 pSta->tcCfg[baTID].fUseBATx = 0;
6443 pSta->tcCfg[baTID].txBufSize = 0;
6444 }
6445 else
6446 {
6447 pSta->tcCfg[baTID].fUseBARx = 0;
6448 pSta->tcCfg[baTID].rxBufSize = 0;
6449 }
6450
6451 return retCode;
6452 }
6453
6454returnFailure:
6455
6456 // Clean-up...
6457 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306458 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006459
6460 return retCode;
6461
6462}
6463
6464/**
6465 * @function : limPostSMStateUpdate()
6466 *
6467 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6468 *
6469 * LOGIC:
6470 *
6471 * ASSUMPTIONS:
6472 * NA
6473 *
6474 * NOTE:
6475 * NA
6476 *
6477 * @param pMac - Pointer to Global MAC structure
6478 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6479 * @return None
6480 */
6481tSirRetStatus
6482limPostSMStateUpdate(tpAniSirGlobal pMac,
6483 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6484{
6485 tSirRetStatus retCode = eSIR_SUCCESS;
6486 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006487 tpSetMIMOPS pMIMO_PSParams;
6488
6489 msgQ.reserved = 0;
6490 msgQ.type = WDA_SET_MIMOPS_REQ;
6491
6492 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306493 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6494 if ( NULL == pMIMO_PSParams )
6495 {
6496 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006497 return eSIR_MEM_ALLOC_FAILED;
6498 }
6499
6500 pMIMO_PSParams->htMIMOPSState = state;
6501 pMIMO_PSParams->staIdx = staIdx;
6502 pMIMO_PSParams->fsendRsp = true;
6503 msgQ.bodyptr = pMIMO_PSParams;
6504 msgQ.bodyval = 0;
6505
6506 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6507
Jeff Johnsone7245742012-09-05 17:12:55 -07006508 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006509 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6510 if (eSIR_SUCCESS != retCode)
6511 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006512 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306513 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006514 return retCode;
6515 }
6516
6517 return retCode;
6518}
6519
6520void limPktFree (
6521 tpAniSirGlobal pMac,
6522 eFrameType frmType,
6523 tANI_U8 *pRxPacketInfo,
6524 void *pBody)
6525{
6526 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006527}
6528
6529/**
6530 * limGetBDfromRxPacket()
6531 *
6532 *FUNCTION:
6533 * This function is called to get pointer to Polaris
6534 * Buffer Descriptor containing MAC header & other control
6535 * info from the body of the message posted to LIM.
6536 *
6537 *LOGIC:
6538 * NA
6539 *
6540 *ASSUMPTIONS:
6541 * NA
6542 *
6543 *NOTE:
6544 * NA
6545 *
6546 * @param body - Received message body
6547 * @param pRxPacketInfo - Pointer to received BD
6548 * @return None
6549 */
6550
6551void
6552limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6553{
Jeff Johnson295189b2012-06-20 16:38:30 -07006554 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006555} /*** end limGetBDfromRxPacket() ***/
6556
6557
6558
6559
6560
6561void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6562{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306563 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006564}
6565
6566
6567void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6568{
6569 tANI_U8 i;
6570 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6571
6572 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6573 {
6574 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6575 {
6576 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6577 fFound = eANI_BOOLEAN_TRUE;
6578 break;
6579 }
6580 }
6581 if(eANI_BOOLEAN_FALSE == fFound)
6582 {
6583 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6584 {
6585 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6586 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6587 }
6588 else
6589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006590 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006591 }
6592 }
6593}
6594
6595
6596/**
6597 * @function : limIsChannelValidForChannelSwitch()
6598 *
6599 * @brief : This function checks if the channel to which AP
6600 * is expecting us to switch, is a valid channel for us.
6601 * LOGIC:
6602 *
6603 * ASSUMPTIONS:
6604 * NA
6605 *
6606 * NOTE:
6607 * NA
6608 *
6609 * @param pMac - Pointer to Global MAC structure
6610 * @param channel - New channel to which we are expected to move
6611 * @return None
6612 */
6613tAniBool
6614limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6615{
6616 tANI_U8 index;
6617 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6618 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6619
6620 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6621 (tANI_U8 *)validChannelList,
6622 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6623 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006624 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006625 return (eSIR_FALSE);
6626 }
6627
6628 for(index = 0; index < validChannelListLen; index++)
6629 {
6630 if(validChannelList[index] == channel)
6631 return (eSIR_TRUE);
6632 }
6633
6634 /* channel does not belong to list of valid channels */
6635 return (eSIR_FALSE);
6636}
6637
6638/**------------------------------------------------------
6639\fn __limFillTxControlParams
6640\brief Fill the message for stopping/resuming tx.
6641
6642\param pMac
6643\param pTxCtrlMsg - Pointer to tx control message.
6644\param type - Which way we want to stop/ resume tx.
6645\param mode - To stop/resume.
6646 -------------------------------------------------------*/
6647static eHalStatus
6648__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6649 tLimQuietTxMode type, tLimControlTx mode)
6650{
6651
6652 //TBD-RAJESH HOW TO GET sessionEntry?????
6653 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6654
6655 if (mode == eLIM_STOP_TX)
6656 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6657 else
6658 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6659
6660 switch (type)
6661 {
6662 case eLIM_TX_ALL:
6663 /** Stops/resumes transmission completely */
6664 pTxCtrlMsg->fCtrlGlobal = 1;
6665 break;
6666
6667 case eLIM_TX_BSS_BUT_BEACON:
6668 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6669 * stop beacon transmission.
6670 */
6671 pTxCtrlMsg->ctrlBss = 1;
6672 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6673 break;
6674
6675 case eLIM_TX_STA:
6676 /** Memory for station bitmap is allocated dynamically in caller of this
6677 * so decode properly here and fill the bitmap. Now not implemented,
6678 * fall through.
6679 */
6680 case eLIM_TX_BSS:
6681 //Fall thru...
6682 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006683 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006684 return eHAL_STATUS_FAILURE;
6685 }
6686
6687 return eHAL_STATUS_SUCCESS;
6688}
6689
6690/**
6691 * @function : limFrameTransmissionControl()
6692 *
6693 * @brief : This API is called by the user to halt/resume any frame
6694 * transmission from the device. If stopped, all frames will be
6695 * queued starting from hardware. Then back-pressure
6696 * is built till the driver.
6697 * LOGIC:
6698 *
6699 * ASSUMPTIONS:
6700 * NA
6701 *
6702 * NOTE:
6703 * NA
6704 *
6705 * @param pMac - Pointer to Global MAC structure
6706 * @return None
6707 */
6708void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6709{
6710
6711 eHalStatus status = eHAL_STATUS_FAILURE;
6712 tpTxControlParams pTxCtrlMsg;
6713 tSirMsgQ msgQ;
6714 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6715
6716 /** Allocate only required number of bytes for station bitmap
6717 * Make it to align to 4 byte boundary */
6718 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6719
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306720 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6721 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006722 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306723 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006724 return;
6725 }
6726
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306727 vos_mem_set((void *) pTxCtrlMsg,
6728 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6730 if (status != eHAL_STATUS_SUCCESS)
6731 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306732 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006733 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006734 return;
6735 }
6736
6737 msgQ.bodyptr = (void *) pTxCtrlMsg;
6738 msgQ.bodyval = 0;
6739 msgQ.reserved = 0;
6740 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6741
Jeff Johnsone7245742012-09-05 17:12:55 -07006742 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6744 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306745 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006746 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006747 return;
6748 }
6749
6750 if (mode == eLIM_STOP_TX)
6751 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306752 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 }
6754 else
6755 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306756 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006757 }
6758 return;
6759}
6760
6761
6762/**
6763 * @function : limRestorePreChannelSwitchState()
6764 *
6765 * @brief : This API is called by the user to undo any
6766 * specific changes done on the device during
6767 * channel switch.
6768 * LOGIC:
6769 *
6770 * ASSUMPTIONS:
6771 * NA
6772 *
6773 * NOTE:
6774 * NA
6775 *
6776 * @param pMac - Pointer to Global MAC structure
6777 * @return None
6778 */
6779
6780tSirRetStatus
6781limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6782{
6783
6784 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006785 tANI_U32 val = 0;
6786
6787 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6788 return retCode;
6789
6790 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006791 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006792
6793 /* Restore the frame transmission, all the time. */
6794 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6795
6796 /* Free to enter BMPS */
6797 limSendSmePostChannelSwitchInd(pMac);
6798
6799 //Background scan is now enabled by SME
6800 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6801 {
6802 /* Enable background scan if already enabled, else don't bother */
6803 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6804 &val)) != eSIR_SUCCESS)
6805
6806 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006807 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 return (retCode);
6809 }
6810
6811 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6812 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006813 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6814 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006815 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6816 {
6817 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6818 return (eSIR_FAILURE);
6819 }
6820
6821 }
6822 }
6823
6824 /* Enable heartbeat timer */
6825 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6826 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006827 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6828 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6829 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6830 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006831 {
6832 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6833 return (eSIR_FAILURE);
6834 }
6835 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006836 return (retCode);
6837}
6838
6839
6840/**--------------------------------------------
6841\fn limRestorePreQuietState
6842\brief Restore the pre quiet state
6843
6844\param pMac
6845\return NONE
6846---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006847tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006848{
6849
6850 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 tANI_U32 val = 0;
6852
6853 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6854 return retCode;
6855
6856 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006857 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006858
6859 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006860 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006861 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6862
6863
6864 //Background scan is now enabled by SME
6865 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6866 {
6867 /* Enable background scan if already enabled, else don't bother */
6868 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6869 &val)) != eSIR_SUCCESS)
6870
6871 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006872 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006873 return (retCode);
6874 }
6875
6876 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6877 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006878 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006879 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6880 {
6881 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6882 return (eSIR_FAILURE);
6883 }
6884
6885 }
6886 }
6887
6888 /* Enable heartbeat timer */
6889 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6890 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006891 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006892 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006893 {
6894 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6895 return (eSIR_FAILURE);
6896 }
6897 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006898 return (retCode);
6899}
6900
6901
6902/**
6903 * @function: limPrepareFor11hChannelSwitch()
6904 *
6905 * @brief : This API is called by the user to prepare for
6906 * 11h channel switch. As of now, the API does
6907 * very minimal work. User can add more into the
6908 * same API if needed.
6909 * LOGIC:
6910 *
6911 * ASSUMPTIONS:
6912 * NA
6913 *
6914 * NOTE:
6915 * NA
6916 *
6917 * @param pMac - Pointer to Global MAC structure
6918 * @param psessionEntry
6919 * @return None
6920 */
6921void
6922limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6923{
Jeff Johnson295189b2012-06-20 16:38:30 -07006924 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6925 return;
6926
6927 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006928 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006929
6930 /* Disable, Stop background scan if enabled and running */
6931 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6932
6933 /* Stop heart-beat timer to stop heartbeat disassociation */
6934 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6935
6936 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6937 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6938 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006939 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006940 /* Stop ongoing scanning if any */
6941 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6942 {
6943 //Set the resume channel to Any valid channel (invalid).
6944 //This will instruct HAL to set it to any previous valid channel.
6945 peSetResumeChannel(pMac, 0, 0);
6946 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6947 }
6948 else
6949 {
6950 limRestorePreChannelSwitchState(pMac, psessionEntry);
6951 }
6952 return;
6953 }
6954 else
6955 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006956 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006957 /** We are safe to switch channel at this point */
6958 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6959 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006960}
6961
6962
6963
6964/**----------------------------------------------------
6965\fn limGetNwType
6966
6967\brief Get type of the network from data packet or beacon
6968\param pMac
6969\param channelNum - Channel number
6970\param type - Type of packet.
6971\param pBeacon - Pointer to beacon or probe response
6972
6973\return Network type a/b/g.
6974-----------------------------------------------------*/
6975tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6976{
6977 tSirNwType nwType = eSIR_11B_NW_TYPE;
6978
6979 if (type == SIR_MAC_DATA_FRAME)
6980 {
6981 if ((channelNum > 0) && (channelNum < 15))
6982 {
6983 nwType = eSIR_11G_NW_TYPE;
6984 }
6985 else
6986 {
6987 nwType = eSIR_11A_NW_TYPE;
6988 }
6989 }
6990 else
6991 {
6992 if ((channelNum > 0) && (channelNum < 15))
6993 {
6994 int i;
6995 // 11b or 11g packet
6996 // 11g iff extended Rate IE is present or
6997 // if there is an A rate in suppRate IE
6998 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6999 {
7000 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7001 {
7002 nwType = eSIR_11G_NW_TYPE;
7003 break;
7004 }
7005 }
7006 if (pBeacon->extendedRatesPresent)
7007 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007008 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007009 nwType = eSIR_11G_NW_TYPE;
7010 }
7011 }
7012 else
7013 {
7014 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007015 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007016 nwType = eSIR_11A_NW_TYPE;
7017 }
7018 }
7019 return nwType;
7020}
7021
7022
7023/**---------------------------------------------------------
7024\fn limGetChannelFromBeacon
7025\brief To extract channel number from beacon
7026
7027\param pMac
7028\param pBeacon - Pointer to beacon or probe rsp
7029\return channel number
7030-----------------------------------------------------------*/
7031tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7032{
7033 tANI_U8 channelNum = 0;
7034
7035 if (pBeacon->dsParamsPresent)
7036 channelNum = pBeacon->channelNumber;
7037 else if(pBeacon->HTInfo.present)
7038 channelNum = pBeacon->HTInfo.primaryChannel;
7039 else
7040 channelNum = pBeacon->channelNumber;
7041
7042 return channelNum;
7043}
7044
7045
7046/** ---------------------------------------------------------
7047\fn limSetTspecUapsdMask
7048\brief This function sets the PE global variable:
7049\ 1) gUapsdPerAcTriggerEnableMask and
7050\ 2) gUapsdPerAcDeliveryEnableMask
7051\ based on the user priority field and direction field
7052\ in the TS Info Fields.
7053\
7054\ An AC is a trigger-enabled AC if the PSB subfield
7055\ is set to 1 in the uplink direction.
7056\ An AC is a delivery-enabled AC if the PSB subfield
7057\ is set to 1 in the down-link direction.
7058\
7059\param tpAniSirGlobal pMac
7060\param tSirMacTSInfo pTsInfo
7061\param tANI_U32 action
7062\return None
7063 ------------------------------------------------------------*/
7064void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7065{
7066 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7067 tANI_U16 direction = pTsInfo->traffic.direction;
7068 tANI_U8 ac = upToAc(userPrio);
7069
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307070 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 -07007071
7072 /* Converting AC to appropriate Uapsd Bit Mask
7073 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7074 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7075 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7076 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7077 */
7078 ac = ((~ac) & 0x3);
7079
7080 if (action == CLEAR_UAPSD_MASK)
7081 {
7082 if (direction == SIR_MAC_DIRECTION_UPLINK)
7083 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7084 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7085 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7086 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7087 {
7088 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7089 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7090 }
7091 }
7092 else if (action == SET_UAPSD_MASK)
7093 {
7094 if (direction == SIR_MAC_DIRECTION_UPLINK)
7095 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7096 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7097 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7098 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7099 {
7100 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7101 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7102 }
7103 }
7104
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007105 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7106 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007107
7108 return;
7109}
7110
7111
7112
7113void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7114{
7115
7116 tANI_U8 i;
7117 for(i =0;i < pMac->lim.maxBssId;i++)
7118 {
7119 if(pMac->lim.gpSession[i].valid == TRUE )
7120 {
7121 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7122 {
7123 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7124 break;
7125 }
7126
7127 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7128 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7129 {
7130 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7131 }
7132 }
7133 }
7134 for(i=0; i< pMac->lim.maxBssId; i++)
7135 {
7136 if(pMac->lim.gpSession[i].valid == TRUE )
7137 {
7138 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7139 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7140 {
7141 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7142 {
7143 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007144 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 i);)
7146 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7147 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7148 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7149 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007150 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007151 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7152 }
7153 break;
7154 }
7155 }
7156 }
7157 }
7158}
7159
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007160void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7161{
7162 if(psessionEntry->valid == TRUE )
7163 {
7164 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7165 {
7166 limIbssHeartBeatHandle(pMac,psessionEntry);
7167 }
7168 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7169 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7170 {
7171 limHandleHeartBeatFailure(pMac,psessionEntry);
7172 }
7173 }
7174 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7175 and the other things again */
7176 if(psessionEntry->valid == TRUE )
7177 {
7178 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7179 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7180 {
7181 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7182 {
7183 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7184 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7185 psessionEntry->bssIdx);)
7186 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7187 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7188 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7189 {
7190 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7191 limReactivateHeartBeatTimer(pMac, psessionEntry);
7192 }
7193 }
7194 }
7195 }
7196}
7197
7198
Jeff Johnson295189b2012-06-20 16:38:30 -07007199tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7200{
7201 tANI_U8 i;
7202 for(i =0;i < pMac->lim.maxBssId;i++)
7203 {
7204 if(pMac->lim.gpSession[i].valid == TRUE )
7205 {
7206 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7207 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7208 {
7209 return pMac->lim.gpSession[i].currentOperChannel;
7210 }
7211 }
7212 }
7213 return 0;
7214}
7215
7216void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7217{
7218
7219 tpPESession psessionEntry;
7220// tANI_U8 sessionId;
7221 tpAddStaParams pAddStaParams;
7222
7223 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7224
7225 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7226 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007227 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307228 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007229 return;
7230 }
7231 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7232 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007233#ifdef FEATURE_WLAN_TDLS
7234 else if(pMac->lim.gLimAddStaTdls)
7235 {
7236 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7237 pMac->lim.gLimAddStaTdls = FALSE ;
7238 }
7239#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007240 else
7241 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7242
7243}
7244
7245
7246void limUpdateBeacon(tpAniSirGlobal pMac)
7247{
7248 tANI_U8 i;
7249
7250 for(i =0;i < pMac->lim.maxBssId;i++)
7251 {
7252 if(pMac->lim.gpSession[i].valid == TRUE )
7253 {
7254 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7255 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7256 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7257 )
7258 {
7259 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7260 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7261 }
7262 else
7263 {
7264 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7265 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7266 {
7267
7268 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7269 {
7270 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7271 }
7272 }
7273 }
7274 }
7275 }
7276}
7277
7278void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7279{
7280 tANI_U8 i;
7281 tpPESession psessionEntry;
7282 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7283 for(i =0; i < pMac->lim.maxBssId; i++)
7284 {
7285 if(pMac->lim.gpSession[i].valid == TRUE)
7286 {
7287 psessionEntry = &pMac->lim.gpSession[i];
7288 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7289 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307290 limLog(pMac, LOGE,
7291 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7292 psessionEntry->limSmeState, psessionEntry->limMlmState,
7293 psessionEntry->LimRxedBeaconCntDuringHB,
7294 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007295#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7296 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7297#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007298 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7299 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307300 /* Disconnect even if we have not received a single beacon
7301 * after connection.
7302 */
7303 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7304 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307305 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7306 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007307 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007308 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007309 /* AP did not respond to Probe Request. Tear down link with it.*/
7310 limTearDownLinkWithAp(pMac,
7311 psessionEntry->peSessionId,
7312 eSIR_BEACON_MISSED);
7313 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7314 }
7315 else // restart heartbeat timer
7316 {
7317 limReactivateHeartBeatTimer(pMac, psessionEntry);
7318 }
7319 }
7320 else
7321 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007322 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007323 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7324 limReactivateHeartBeatTimer(pMac, psessionEntry);
7325 }
7326
7327 }
7328 }
7329 }
7330 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7331 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7332}
7333
7334
7335/*
7336* This function assumes there will not be more than one IBSS session active at any time.
7337*/
7338tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7339{
7340 tANI_U8 i;
7341
7342 for(i =0;i < pMac->lim.maxBssId;i++)
7343 {
7344 if( (pMac->lim.gpSession[i].valid) &&
7345 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7346 return (&pMac->lim.gpSession[i]);
7347 }
7348
7349 return NULL;
7350}
7351
7352tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7353{
7354 tANI_U8 i;
7355
7356 for(i =0;i < pMac->lim.maxBssId;i++)
7357 {
7358 if( (pMac->lim.gpSession[i].valid) &&
7359 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7360 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7361 return (&pMac->lim.gpSession[i]);
7362 }
7363
7364 return NULL;
7365}
7366
7367/**---------------------------------------------------------
7368\fn limHandleDeferMsgError
7369\brief handles error scenario, when the msg can not be deferred.
7370\param pMac
7371\param pLimMsg LIM msg, which could not be deferred.
7372\return void
7373-----------------------------------------------------------*/
7374
7375void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7376{
7377 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7378 {
7379 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7380 }
7381 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007382 {
7383 vos_mem_free( pLimMsg->bodyptr);
7384 pLimMsg->bodyptr = NULL;
7385 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007386}
7387
7388
7389#ifdef FEATURE_WLAN_DIAG_SUPPORT
7390/**---------------------------------------------------------
7391\fn limDiagEventReport
7392\brief This function reports Diag event
7393\param pMac
7394\param eventType
7395\param bssid
7396\param status
7397\param reasonCode
7398\return void
7399-----------------------------------------------------------*/
7400void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7401{
7402 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7403 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7404
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307405 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007406
7407 if (NULL == pSessionEntry)
7408 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307409 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007410 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7411 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7412
7413 }
7414 else
7415 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307416 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007417 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7418 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7419 }
7420 peEvent.event_type = eventType;
7421 peEvent.status = status;
7422 peEvent.reason_code = reasonCode;
7423
7424 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7425 return;
7426}
7427
7428#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7429
7430void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7431{
7432
7433 tpAddStaSelfParams pAddStaSelfParams;
7434 tSirMsgQ mmhMsg;
7435 tpSirSmeAddStaSelfRsp pRsp;
7436
7437
7438 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7439
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307440 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7441 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007442 {
7443 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307444 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7445 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007446 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007447 return;
7448 }
7449
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307450 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007451
7452 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7453 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7454 pRsp->status = pAddStaSelfParams->status;
7455
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307456 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007457
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307458 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007459 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007460
7461 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7462 mmhMsg.bodyptr = pRsp;
7463 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007464 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007465 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7466
7467}
7468
7469void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7470{
7471
7472 tpDelStaSelfParams pDelStaSelfParams;
7473 tSirMsgQ mmhMsg;
7474 tpSirSmeDelStaSelfRsp pRsp;
7475
7476
7477 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7478
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307479 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7480 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007481 {
7482 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307483 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7484 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007485 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007486 return;
7487 }
7488
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307489 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007490
7491 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7492 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7493 pRsp->status = pDelStaSelfParams->status;
7494
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307495 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007496
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007498 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007499
7500 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7501 mmhMsg.bodyptr = pRsp;
7502 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007503 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007504 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7505
7506}
7507
7508/***************************************************************
7509* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7510* To unmap the channel to reverse the effect of mapping
7511* a band channel in hal .Mapping was done hal to overcome the
7512* limitation of the rxbd which use only 4 bit for channel number.
7513*****************************************************************/
7514tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7515{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007516#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007517 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007518 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7519 return aUnsortedChannelList[mapChannel -1];
7520 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007521#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007522 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007523#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007524 return abChannel[mapChannel -1];
7525 else
7526 return 0;
7527}
7528
7529
7530v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7531{
7532 int left = length;
7533 v_U8_t *ptr = pIes;
7534 v_U8_t elem_id;
7535 v_U16_t elem_len;
7536
7537 while(left >= (size_of_len_field+1))
7538 {
7539 elem_id = ptr[0];
7540 if (size_of_len_field == TWO_BYTE)
7541 {
7542 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7543 }
7544 else
7545 {
7546 elem_len = ptr[1];
7547 }
7548
7549
7550 left -= (size_of_len_field+1);
7551 if(elem_len > left)
7552 {
7553 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007554 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007555 eid,elem_len,left);
7556 return NULL;
7557 }
7558 if (elem_id == eid)
7559 {
7560 return ptr;
7561 }
7562
7563 left -= elem_len;
7564 ptr += (elem_len + (size_of_len_field+1));
7565 }
7566 return NULL;
7567}
7568
7569/* return NULL if oui is not found in ie
7570 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7571 */
7572v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7573{
7574 int left = ie_len;
7575 v_U8_t *ptr = ie;
7576 v_U8_t elem_id, elem_len;
7577
7578 while(left >= 2)
7579 {
7580 elem_id = ptr[0];
7581 elem_len = ptr[1];
7582 left -= 2;
7583 if(elem_len > left)
7584 {
7585 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007586 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007587 elem_id,elem_len,left);
7588 return NULL;
7589 }
7590 if (SIR_MAC_EID_VENDOR == elem_id)
7591 {
7592 if(memcmp(&ptr[2], oui, oui_size)==0)
7593 return ptr;
7594 }
7595
7596 left -= elem_len;
7597 ptr += (elem_len + 2);
7598 }
7599 return NULL;
7600}
7601
Jeff Johnson295189b2012-06-20 16:38:30 -07007602//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7603
7604v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7605{
7606 int length = 0;
7607 tANI_U8 *ptr = ie;
7608
7609 ptr[length++] = SIR_MAC_EID_VENDOR;
7610 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307611 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7612 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007613 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7614}
7615
7616//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7617
7618v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7619{
7620 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007621
7622 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7623 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7624 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307625 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007626 noaStream + noaLen - overFlowLen, overFlowLen);
7627 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7628 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307629 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007630 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307631 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7632 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007633 }
7634
Jeff Johnson295189b2012-06-20 16:38:30 -07007635 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7636
7637}
7638
7639//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7640v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7641{
7642 v_U8_t len=0;
7643
7644 v_U8_t *pBody = pNoaStream;
7645
7646
7647 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7648 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7649 {
7650 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7651 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7652 )
7653 return 0; //No NoA Descriptor then return 0
7654
7655
7656 pBody[0] = SIR_P2P_NOA_ATTR;
7657
7658 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7659 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7660 len = 5;
7661 pBody += len;
7662
7663
7664 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7665 {
7666 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7667 pBody += 1;
7668 len +=1;
7669
7670 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7671 pBody += sizeof(tANI_U32);
7672 len +=4;
7673
7674 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7675 pBody += sizeof(tANI_U32);
7676 len +=4;
7677
7678 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7679 pBody += sizeof(tANI_U32);
7680 len +=4;
7681
7682 }
7683
7684 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7685 {
7686 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7687 pBody += 1;
7688 len +=1;
7689
7690 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7691 pBody += sizeof(tANI_U32);
7692 len +=4;
7693
7694 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7695 pBody += sizeof(tANI_U32);
7696 len +=4;
7697
7698 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7699 pBody += sizeof(tANI_U32);
7700 len +=4;
7701
7702 }
7703
7704
7705 pBody = pNoaStream + 1;
7706 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7707
7708 return (len);
7709
7710 }
7711 return 0;
7712
7713}
Jeff Johnsone7245742012-09-05 17:12:55 -07007714
7715void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007716{
7717
7718 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007719 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007720}
Jeff Johnsone7245742012-09-05 17:12:55 -07007721
Jeff Johnson295189b2012-06-20 16:38:30 -07007722/*--------------------------------------------------------------------------
7723
7724 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7725
Jeff Johnsone7245742012-09-05 17:12:55 -07007726 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7727 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007728
7729 \param pMac - pointer to global adapter context
7730 \return - channel to scan from valid session else zero.
7731
7732 \sa
7733
7734 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007735void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007736{
7737
7738 //Rationale - this could be the suspend/resume for assoc and it is essential that
7739 //the new BSS is active for some time. Other BSS was anyway suspended.
7740 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7741 //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 -07007742 //and hence should be ok. Need to discuss this further
7743 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007744 {
7745 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007746 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007747 }
7748 else
7749 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007750 *resumeChannel = pMac->lim.gResumeChannel;
7751 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007752 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007753 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007754}
7755
Viral Modid86bde22012-12-10 13:09:21 -08007756tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7757{
7758 tANI_U8 i;
7759 for(i =0; i < pMac->lim.maxBssId; i++)
7760 {
7761 if(pMac->lim.gpSession[i].valid == TRUE)
7762 {
7763 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7764 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7765 )
7766 {
7767 return TRUE;
7768 }
7769 }
7770 }
7771 return FALSE;
7772}
Jeff Johnsone7245742012-09-05 17:12:55 -07007773
Jeff Johnson295189b2012-06-20 16:38:30 -07007774
7775tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7776{
7777 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7778 {
7779 return eANI_BOOLEAN_TRUE;
7780 }
7781 else
7782 {
7783 return eANI_BOOLEAN_FALSE;
7784 }
7785}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007786
Sandeep Puligilla60342762014-01-30 21:05:37 +05307787/**
7788 * \brief verify the changes in channel bonding
7789 *
7790 * \param pMac Pointer to the global MAC structure
7791 *
7792 * \param psessionEntry session entry
7793 * beaconSecChanWidth Secondary channel width
7794 * advertized in beacon
7795 * currentSecChanWidth Current configured width
7796 * staId Station Id
7797 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7798 */
7799tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7800 tpPESession psessionEntry,
7801 tANI_U8 beaconSecChanWidth,
7802 tANI_U8 currentSecChanWidth,
7803 tANI_U8 staId)
7804{
7805 tUpdateVHTOpMode tempParam;
7806 tANI_BOOLEAN fCbMode24G = FALSE;
7807 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7808
7809 /* Moving from HT40 to HT20 operation*/
7810 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7811 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7812 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7813 {
7814 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7815 tempParam.staId = staId;
7816 fCbMode24G = TRUE;
7817 }
7818
7819 /* Moving from HT20 to HT40 operation*/
7820 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7821 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7822 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7823 {
7824 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7825 tempParam.staId = staId;
7826 fCbMode24G = TRUE;
7827 }
7828
7829 if (TRUE == fCbMode24G)
7830 {
7831 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7832 "Changing CBMODE to = %d staId = %d",
7833 tempParam.opMode, tempParam.staId );
7834 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7835 status = eANI_BOOLEAN_TRUE;
7836 }
7837 return status;
7838}
7839
Mohit Khanna4a70d262012-09-11 16:30:12 -07007840#ifdef WLAN_FEATURE_11AC
7841tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7842{
7843 tUpdateVHTOpMode tempParam;
7844
7845 tempParam.opMode = chanWidth;
7846 tempParam.staId = staId;
7847
7848 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7849
7850 return eANI_BOOLEAN_TRUE;
7851}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007852#endif
7853
krunal soni45b9eb62014-03-26 12:54:25 -07007854void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7855 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007856{
7857 tANI_U8 val=0;
7858
krunal soni45b9eb62014-03-26 12:54:25 -07007859 //only 2.4G band should have short slot enable, rest it should be default
7860 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007861 {
krunal soni45b9eb62014-03-26 12:54:25 -07007862 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007863 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007864 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007865 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7866 {
7867 val = true;
7868 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007869 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007870 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007871 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007872 // Joining BSS.
7873 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007874 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007875 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007876 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007877 // Reassociating with AP.
7878 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007879 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007880 }
krunal soni45b9eb62014-03-26 12:54:25 -07007881 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007882 {
krunal soni45b9eb62014-03-26 12:54:25 -07007883 /*
7884 * 11B does not short slot and short slot is default
7885 * for 11A mode. Hence, not need to set this bit
7886 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007887 val = false;
7888 }
krunal soni45b9eb62014-03-26 12:54:25 -07007889
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007890 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007891 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007892}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307893
Kalikinkar dhara205da782014-03-21 15:49:32 -07007894void limUtilsframeshtons(tpAniSirGlobal pCtx,
7895 tANI_U8 *pOut,
7896 tANI_U16 pIn,
7897 tANI_U8 fMsb)
7898{
7899 (void)pCtx;
7900#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7901 if ( !fMsb )
7902 {
7903 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7904 }
7905 else
7906 {
7907 *pOut = ( pIn & 0xff00 ) >> 8;
7908 *( pOut + 1 ) = pIn & 0xff;
7909 }
7910#else
7911 if ( !fMsb )
7912 {
7913 *pOut = pIn & 0xff;
7914 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7915 }
7916 else
7917 {
7918 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7919 }
7920#endif
7921}
7922
7923void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7924 tANI_U8 *pOut,
7925 tANI_U32 pIn,
7926 tANI_U8 fMsb)
7927{
7928 (void)pCtx;
7929#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7930 if ( !fMsb )
7931 {
7932 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7933 }
7934 else
7935 {
7936 *pOut = ( pIn & 0xff000000 ) >> 24;
7937 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7938 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7939 *( pOut + 3 ) = ( pIn & 0x000000ff );
7940 }
7941#else
7942 if ( !fMsb )
7943 {
7944 *( pOut ) = ( pIn & 0x000000ff );
7945 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7946 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7947 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7948 }
7949 else
7950 {
7951 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7952 }
7953#endif
7954}
7955
7956
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307957/**--------------------------------------------
7958\fn limUpdateOBSSScanParams
7959\brief Updates OBSS SCAN IE parameters to session
7960
7961\param psessionEntry - Session Entry
7962\return NONE
7963---------------------------------------------*/
7964void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7965 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7966{
7967 /*If the recieved value is not in the range specified by the Specification
7968 then it will be the default value configured through cfg */
7969 if (( pOBSSScanParameters->obssScanActiveDwell >
7970 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7971 ( pOBSSScanParameters->obssScanActiveDwell <
7972 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7973 {
7974 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7975 pOBSSScanParameters->obssScanActiveDwell;
7976 }
7977 if((pOBSSScanParameters->obssScanPassiveDwell >
7978 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7979 (pOBSSScanParameters->obssScanPassiveDwell <
7980 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7981 {
7982 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7983 pOBSSScanParameters->obssScanPassiveDwell;
7984 }
7985 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7986 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7987 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7988 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7989 {
7990 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7991 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7992 }
7993 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7994 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7995 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7996 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7997 {
7998 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7999 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8000 }
8001 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8002 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8003 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8004 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8005 {
8006 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8007 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8008 }
8009 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8010 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8011 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8012 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8013 {
8014 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8015 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8016 }
8017 if((pOBSSScanParameters->obssScanActivityThreshold >
8018 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8019 (pOBSSScanParameters->obssScanActivityThreshold <
8020 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8021 {
8022 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8023 pOBSSScanParameters->obssScanActivityThreshold;
8024 }
8025}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008026
8027#ifdef WLAN_FEATURE_11W
8028void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8029{
8030 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8031 tPmfSaQueryTimerId timerId;
8032 tpPESession psessionEntry;
8033 tpDphHashNode pSta;
8034 tANI_U32 maxRetries;
8035
8036 limLog(pMac, LOG1, FL("SA Query timer fires"));
8037 timerId.value = param;
8038
8039 // Check that SA Query is in progress
8040 if ((psessionEntry = peFindSessionBySessionId(
8041 pMac, timerId.fields.sessionId)) == NULL)
8042 {
8043 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8044 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008045 return;
8046 }
8047 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8048 &psessionEntry->dph.dphHashTable)) == NULL)
8049 {
8050 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8051 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008052 return;
8053 }
8054 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8055 return;
8056
8057 // Increment the retry count, check if reached maximum
8058 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8059 &maxRetries) != eSIR_SUCCESS)
8060 {
8061 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8062 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8063 return;
8064 }
8065 pSta->pmfSaQueryRetryCount++;
8066 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8067 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308068 limLog(pMac, LOGE,
8069 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8070 MAC_ADDR_ARRAY(pSta->staAddr));
8071 limSendDisassocMgmtFrame(pMac,
8072 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8073 pSta->staAddr, psessionEntry, FALSE);
8074 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008075 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8076 return;
8077 }
8078
8079 // Retry SA Query
8080 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8081 pSta->staAddr, psessionEntry);
8082 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008083 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8084 {
8085 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8086 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8087 }
8088}
8089#endif
8090
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008091/** ---------------------------------------------------------
8092\fn limProcessChannelSwitchSuspendLink
8093\brief This function call channel switch functions based on
8094 the gLimChannelSwitch.state. After function return it
8095 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8096 If gLimChannelSwitch.state is non-identified then
8097 print error log as well as restore back the
8098 pre-channelSwitch.
8099\param tpAniSirGlobal pMac
8100\param eHalStatus status
8101\param tANI_U32 *ctx
8102\return None
8103 ------------------------------------------------------------*/
8104static void
8105limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8106 eHalStatus status,
8107 tANI_U32 *ctx)
8108{
8109 tpPESession pSessionEntry = (tpPESession)ctx;
8110
8111 if ( eHAL_STATUS_SUCCESS != status )
8112 {
8113 limLog(pMac, LOGE,
8114 FL("Suspend link failed. still proceeding "));
8115 }
8116 if (NULL == pSessionEntry )
8117 {
8118 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8119 return;
8120 }
8121
8122 switch(pSessionEntry->gLimChannelSwitch.state)
8123 {
8124 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8125 PELOGW(limLog(pMac, LOGW,
8126 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8127 limSwitchPrimaryChannel(pMac,
8128 pSessionEntry->gLimChannelSwitch.primaryChannel,
8129 pSessionEntry);
8130 pSessionEntry->gLimChannelSwitch.state =
8131 eLIM_CHANNEL_SWITCH_IDLE;
8132 break;
8133
8134 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8135 PELOGW(limLog(pMac, LOGW,
8136 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8137 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8138 pSessionEntry->gLimChannelSwitch.primaryChannel,
8139 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8140 pSessionEntry->gLimChannelSwitch.state =
8141 eLIM_CHANNEL_SWITCH_IDLE;
8142 break;
8143
8144 default:
8145 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8146 pSessionEntry->gLimChannelSwitch.state);)
8147 if (limRestorePreChannelSwitchState(pMac,
8148 pSessionEntry) != eSIR_SUCCESS)
8149 {
8150 limLog(pMac, LOGE,
8151 FL("Could not restore pre-channelSwitch "
8152 "(11h) state, resetting the system"));
8153 }
8154 }
8155}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308156
8157/** ---------------------------------------------------------
8158\fn limInitOBSSScanParams
8159\brief This function Initializes the OBSS Scan Parameters
8160\param tpAniSirGlobal pMac
8161\param tpPESession pSessionEntry
8162\return None
8163 ------------------------------------------------------------*/
8164
8165void limInitOBSSScanParams(tpAniSirGlobal pMac,
8166 tpPESession psessionEntry)
8167{
8168 tANI_U32 cfgValue;
8169
8170 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8171 &cfgValue) != eSIR_SUCCESS)
8172 {
8173 limLog(pMac, LOGE, FL("Fail to retrieve "
8174 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8175 return ;
8176 }
8177 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8178
8179 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8180 &cfgValue) != eSIR_SUCCESS)
8181 {
8182 limLog(pMac, LOGE, FL("Fail to retrieve "
8183 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8184 return ;
8185 }
8186 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8187
8188 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8189 &cfgValue) != eSIR_SUCCESS)
8190 {
8191 limLog(pMac, LOGE, FL("Fail to retrieve "
8192 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8193 return ;
8194 }
8195 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8196 = cfgValue;
8197 if (wlan_cfgGetInt(pMac,
8198 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8199 &cfgValue) != eSIR_SUCCESS)
8200 {
8201 limLog(pMac, LOGE, FL("Fail to retrieve"
8202 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8203 return ;
8204 }
8205 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8206 cfgValue;
8207 if (wlan_cfgGetInt(pMac,
8208 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8209 != eSIR_SUCCESS)
8210 {
8211 limLog(pMac, LOGE, FL("Fail to retrieve"
8212 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8213 return ;
8214 }
8215 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8216 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308217
8218 if (wlan_cfgGetInt(pMac,
8219 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8220 != eSIR_SUCCESS)
8221 {
8222 limLog(pMac, LOGE, FL("Fail to retrieve"
8223 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8224 return ;
8225 }
8226 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8227 cfgValue;
8228
8229
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308230 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8231 &cfgValue) != eSIR_SUCCESS)
8232 {
8233 limLog(pMac, LOGE, FL("Fail to retrieve "
8234 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8235 return ;
8236 }
8237 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308238}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308239
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308240const char * lim_ScanTypetoString(const v_U8_t scanType)
8241{
8242 switch (scanType)
8243 {
8244 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8245 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8246 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8247 default:
8248 return "Unknown ScanType";
8249 }
8250}
8251
8252const char * lim_BssTypetoString(const v_U8_t bssType)
8253{
8254 switch (bssType)
8255 {
8256 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8257 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8258 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8259 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8260 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8261 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8262 default:
8263 return "Unknown BssType";
8264 }
8265}
8266
8267const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8268{
8269 switch (mode)
8270 {
8271 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8272 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8273 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8274 default:
8275 return "Unknown BgScanMode";
8276 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308277}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308278
8279#ifdef WLAN_FEATURE_11W
8280/**
8281 *
8282 * \brief This function is called by various LIM modules to correctly set
8283 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8284 *
8285 *
8286 * \param pMac Pointer to Global MAC structure
8287 *
8288 * \param psessionEntry Pointer to session corresponding to the connection
8289 *
8290 * \param peer Peer address of the STA to which the frame is to be sent
8291 *
8292 * \param pMacHdr Pointer to the frame MAC header
8293 *
8294 * \return nothing
8295 *
8296 *
8297 */
8298void
8299limSetProtectedBit(tpAniSirGlobal pMac,
8300 tpPESession psessionEntry,
8301 tSirMacAddr peer,
8302 tpSirMacMgmtHdr pMacHdr)
8303{
8304 tANI_U16 aid;
8305 tpDphHashNode pStaDs;
8306
8307 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8308 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8309 {
8310
8311 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8312 &psessionEntry->dph.dphHashTable );
8313 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308314 /* rmfenabled will be set at the time of addbss.
8315 * but sometimes EAP auth fails and keys are not
8316 * installed then if we send any management frame
8317 * like deauth/disassoc with this bit set then
8318 * firmware crashes. so check for keys are
8319 * installed or not also before setting the bit
8320 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308321 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308322 pMacHdr->fc.wep = 1;
8323 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308324 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308325 pMacHdr->fc.wep = 1;
8326} /*** end limSetProtectedBit() ***/
8327#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308328
8329tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8330{
8331 int left = length;
8332 tANI_U8 *ptr = pIes;
8333 tANI_U8 elem_id,elem_len;
8334
8335 while (left >= 2)
8336 {
8337 elem_id = ptr[0];
8338 elem_len = ptr[1];
8339 left -= 2;
8340
8341 if (elem_len > left)
8342 {
8343 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8344 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8345 eid,elem_len,left);
8346 return NULL;
8347 }
8348 if (elem_id == eid)
8349 {
8350 return ptr;
8351 }
8352
8353 left -= elem_len;
8354 ptr += (elem_len + 2);
8355 }
8356 return NULL;
8357}
8358
8359
8360void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8361{
8362
8363 tANI_U32 nPayload;
8364 tANI_U8 *pPayload;
8365 tANI_U8 *ieptr;
8366 tSirMacTim *tim;
8367
8368 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8369 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8370
8371 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8372 {
8373 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8374 return;
8375 }
8376
8377 if (NULL !=
8378 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8379 nPayload, SIR_MAC_TIM_EID)))
8380 {
8381 /* Ignore EID and Length field*/
8382 tim = (tSirMacTim *)(ieptr + 2);
8383
8384 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8385 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8386 if (tim->dtimCount >= MAX_DTIM_COUNT)
8387 tim->dtimCount = DTIM_COUNT_DEFAULT;
8388 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8389 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8390 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8391 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8392 psessionEntry->currentBssBeaconCnt++;
8393
8394 limLog(pMac, LOG1,
8395 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8396 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8397 psessionEntry->lastBeaconDtimPeriod);
8398
8399 }
8400 return;
8401}
Girish Gowlia95daca2015-02-04 20:31:31 +05308402
8403void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8404 tANI_U8 smeSessionId,
8405 tANI_U32 maxRateFlag)
8406{
8407 tpSirSmeUpdateMaxRateParams pRsp;
8408 tSirMsgQ msg;
8409
8410 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8411 if (NULL == pRsp)
8412 {
8413 limLog(pMac, LOGP, FL("Memory allocation failed"));
8414 return;
8415 }
8416 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8417 pRsp->maxRateFlag = maxRateFlag;
8418 pRsp->smeSessionId = smeSessionId;
8419 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8420 msg.bodyptr = pRsp;
8421 msg.bodyval = 0;
8422 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8423 return;
8424}
Abhishek Singh5d765712015-03-12 14:04:16 +05308425
8426void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8427{
8428 if( pMac->sys.gSysBbtPendingMgmtCount )
8429 {
8430 vos_spin_lock_acquire( &pMac->sys.lock );
8431 pMac->sys.gSysBbtPendingMgmtCount--;
8432 vos_spin_lock_release( &pMac->sys.lock );
8433 }
8434 else
8435 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8436}