blob: 76e9e43f7ab6d49f6a8d324e91f586ec364871fa [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05302 * Copyright (c) 2011-2017 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
Agrawal Ashisha8e8a722016-10-18 19:07:45 +053062#ifdef SAP_AUTH_OFFLOAD
63#include "limAssocUtils.h"
64#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070065
66/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
67 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
68 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
69 * this information. */
70static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
71
72/* 11A Channel list to decode RX BD channel information */
73static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070074 120,124,128,132,136,140,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080075#define abChannelSize (sizeof(abChannel)/ \
76 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070077
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070078#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
79static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070080 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080081#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
82 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070083#endif
84
Arif Hussain6af38622014-03-12 12:39:57 -070085//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070086#define SUCCESS 1 //defined temporarily for BT-AMP
87
Agarwal Ashish87039eb2014-01-15 14:13:15 +053088#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Sushant Kaushik02c866d2015-01-16 15:24:25 +053089#define MAX_DTIM_PERIOD 15
90#define MAX_DTIM_COUNT 15
91#define DTIM_PERIOD_DEFAULT 1
92#define DTIM_COUNT_DEFAULT 1
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080093static void
94limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
95 eHalStatus status,
96 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070097/** -------------------------------------------------------------
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +053098\fn limCheck11BRateBitmap
99\brief Verifies if basic rates are set.
100\param tANI_U16 pRateBitmap
101\return tANI_BOOLEAN - true or false
102 -------------------------------------------------------------*/
103
104tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 pRateBitmap)
105{
106 return ( ( pRateBitmap & ( 1 << 0 ) ) || ( pRateBitmap & ( 1 << 1 ) ) ||
107 ( pRateBitmap & ( 1 << 2 ) ) ||
108 ( pRateBitmap & ( 1 << 3 ) ) ? 1 : 0 ) ;
109}
110
111/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700112\fn limAssignDialogueToken
113\brief Assigns dialogue token.
114\param tpAniSirGlobal pMac
115\return tpDialogueToken - dialogueToken data structure.
116 -------------------------------------------------------------*/
117
118tpDialogueToken
119limAssignDialogueToken(tpAniSirGlobal pMac)
120{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700121 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530123 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
124 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530126 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 return NULL;
128 }
129
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530130 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 //first node in the list is being added.
132 if(NULL == pMac->lim.pDialogueTokenHead)
133 {
134 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
135 }
136 else
137 {
138 pMac->lim.pDialogueTokenTail->next = pCurrNode;
139 pMac->lim.pDialogueTokenTail = pCurrNode;
140 }
141 //assocId and tid of the node will be filled in by caller.
142 pCurrNode->next = NULL;
143 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700144
145 /* Dialog token should be a non-zero value */
146 if (0 == pCurrNode->token)
147 pCurrNode->token = token;
148
149 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700150 return pCurrNode;
151}
152
153/** -------------------------------------------------------------
154\fn limSearchAndDeleteDialogueToken
155\brief search dialogue token in the list and deletes it if found. returns failure if not found.
156\param tpAniSirGlobal pMac
157\param tANI_U8 token
158\param tANI_U16 assocId
159\param tANI_U16 tid
160\return eSirRetStatus - status of the search
161 -------------------------------------------------------------*/
162
163
164tSirRetStatus
165limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
166{
167 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
168 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
169
Abhishek Singh6f09e702016-01-28 15:15:04 +0530170 /* if the list is empty */
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 if(NULL == pCurrNode)
172 return eSIR_FAILURE;
173
Abhishek Singh6f09e702016-01-28 15:15:04 +0530174 /* If the matching node is the first node.*/
175 if ((token == pCurrNode->token) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700176 (assocId == pCurrNode->assocId) &&
Abhishek Singh6f09e702016-01-28 15:15:04 +0530177 (tid == pCurrNode->tid)) {
178 pMac->lim.pDialogueTokenHead = pCurrNode->next;
179 /* There was only one node in the list.
180 * So tail pointer also needs to be adjusted.
181 */
182 if (NULL == pMac->lim.pDialogueTokenHead)
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530184 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700185 return eSIR_SUCCESS;
186 }
187
Abhishek Singh6f09e702016-01-28 15:15:04 +0530188 /* first node did not match. so move to the next one. */
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 pCurrNode = pCurrNode->next;
Jeff Johnson295189b2012-06-20 16:38:30 -0700190
Abhishek Singh6f09e702016-01-28 15:15:04 +0530191 while (NULL != pCurrNode) {
192 if ((token == pCurrNode->token) &&
193 (assocId == pCurrNode->assocId) &&
194 (tid == pCurrNode->tid)) {
195 break;
196 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 pPrevNode = pCurrNode;
198 pCurrNode = pCurrNode->next;
199 }
200
Abhishek Singh6f09e702016-01-28 15:15:04 +0530201 if (pCurrNode) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 pPrevNode->next = pCurrNode->next;
Abhishek Singh6f09e702016-01-28 15:15:04 +0530203 /* if the node being deleted is the last one
204 * then we also need to move the tail pointer
205 * to the prevNode.
206 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 if(NULL == pCurrNode->next)
208 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530209 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 return eSIR_SUCCESS;
211 }
212
Abhishek Singh6f09e702016-01-28 15:15:04 +0530213 limLog(pMac, LOGW,
214 FL("LIM does not have matching dialogue token node"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700215 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216}
217
218
219/** -------------------------------------------------------------
220\fn limDeleteDialogueTokenList
221\brief deletes the complete lim dialogue token linked list.
222\param tpAniSirGlobal pMac
223\return None
224 -------------------------------------------------------------*/
225void
226limDeleteDialogueTokenList(tpAniSirGlobal pMac)
227{
228 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
229
230 while(NULL != pMac->lim.pDialogueTokenHead)
231 {
232 pCurrNode = pMac->lim.pDialogueTokenHead;
233 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530234 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 pCurrNode = NULL;
236 }
237 pMac->lim.pDialogueTokenTail = NULL;
238}
239
240void
241limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
242{
243 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
244 *pIgnore = 0;
245
246 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
247 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530248 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 *pIgnore = 1;
250 }
251 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
252 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530253 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 *pIgnore = 1;
255 }
256 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
257 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530258 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 *pIgnore = 0;
260 }
261 else
262 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530263 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 *pIgnore = 1;
265 }
266}
267
268char *
269limMlmStateStr(tLimMlmStates state)
270{
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 switch (state)
272 {
273 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
302 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
303 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700316 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700320 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
322 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
323 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700324 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700330 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700332}
333
334void
335limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
336{
337 limLog(pMac, logLevel, limMlmStateStr(state));
338}
339
340char *
341limSmeStateStr(tLimSmeStates state)
342{
343#ifdef FIXME_GEN6
344 switch (state)
345 {
346 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700377 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700381 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700391 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 }
393#endif
394return "";
395}
396
397
398char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
399{
400#ifdef FIXME_GEN6
401
402 switch(dot11Mode)
403 {
404 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700405 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700407 return "11A";
408 case WNI_CFG_DOT11_MODE_11B:
409 return "11B";
410 case WNI_CFG_DOT11_MODE_11G:
411 return "11G";
412 case WNI_CFG_DOT11_MODE_11N:
413 return "11N";
414 case WNI_CFG_DOT11_MODE_POLARIS:
415 return "Polaris";
416 case WNI_CFG_DOT11_MODE_TITAN:
417 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700419 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700421 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700422 }
423#endif
424return "";
425}
426
427
428char* limStaOpRateModeStr(tStaRateMode opRateMode)
429{
430#ifdef FIXME_GEN6
431
432 switch(opRateMode)
433 {
434 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700437 return "11A";
438 case eSTA_11b:
439 return "11B";
440 case eSTA_11bg:
441 return "11G";
442 case eSTA_11n:
443 return "11N";
444 case eSTA_POLARIS:
445 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700449 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 }
451#endif
452return "";
453}
454
455char* limBssTypeStr(tSirBssType bssType)
456{
457 switch(bssType)
458 {
459 case eSIR_INFRASTRUCTURE_MODE:
460 return "eSIR_INFRASTRUCTURE_MODE";
461 case eSIR_IBSS_MODE:
462 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700463 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700465 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700467 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 return "eSIR_AUTO_MODE";
469 default:
470 return "Invalid BSS Type";
471 }
472}
473
474void
475limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
476{
477 limLog(pMac, logLevel, limSmeStateStr(state));
478}
479
480char *limMsgStr(tANI_U32 msgType)
481{
482#ifdef FIXME_GEN6
483 switch (msgType)
484 {
485 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700493#ifdef FEATURE_OEM_DATA_SUPPORT
494 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700496 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700497 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700498#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_MIC_FAILURE_IND";
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530581 case eWNI_SME_LOST_LINK_PARAMS_IND:
582 return "eWNI_SME_LOST_LINK_PARAMS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700594 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800597#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800598 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800600 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800602#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700603
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700643 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700645 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700646#ifdef WLAN_FEATURE_VOWIFI_11R
647 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649#endif
650
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530651#ifdef WLAN_FEATURE_LFR_MBB
652 case SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT:
653 return "SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT";
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530654 case SIR_LIM_REASSOC_MBB_RSP_TIMEOUT:
655 return "SIR_LIM_REASSOC_MBB_RSP_TIMEOUT";
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530656#endif
657
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676
677 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700680 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700686 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700690 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700692 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700694 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700696 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700698 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700700 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700704 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700706 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700708 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700710 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700714 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800719 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800721#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700722 case eWNI_SME_GET_TSM_STATS_REQ:
723 return "eWNI_SME_GET_TSM_STATS_REQ";
724 case eWNI_SME_GET_TSM_STATS_RSP:
725 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800726#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 }
730#endif
731return "";
732}
733
734
735
736char *limResultCodeStr(tSirResultCodes resultCode)
737{
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 switch (resultCode)
739 {
740 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700827 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700833 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700837 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700851 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700863 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700865 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700866#ifdef GEN4_SCAN
867 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700868 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700870 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700872 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700874 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700876 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700878 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700879#else // GEN4_SCAN
880 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700881 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700882 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700883 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700884#endif // GEN4_SCAN
885
886 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700887 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700889}
890
891void
892limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
893{
894 limLog(pMac, logLevel, limMsgStr(msgType));
895}
896
Jeff Johnson295189b2012-06-20 16:38:30 -0700897void
898limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
899{
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
901 {
902 switch (msg->type)
903 {
904 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 break;
907 default:
908 limPrintMsgName(pMac, logLevel,msg->type);
909 break;
910 }
911 }
912}
913
914/**
915 * limInitMlm()
916 *
917 *FUNCTION:
918 * This function is called by limProcessSmeMessages() to
919 * initialize MLM state machine on STA
920 *
921 *PARAMS:
922 *
923 *LOGIC:
924 *
925 *ASSUMPTIONS:
926 * NA
927 *
928 *NOTE:
929 * NA
930 *
931 * @param pMac Pointer to Global MAC structure
932 * @return None
933 */
934void
935limInitMlm(tpAniSirGlobal pMac)
936{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700937 tANI_U32 retVal;
938
939 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700940
Jeff Johnsone7245742012-09-05 17:12:55 -0700941 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700942
943 /// Initialize scan result hash table
944 limReInitScanResults(pMac); //sep26th review
945
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700946#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
947 /// Initialize lfr scan result hash table
948 // Could there be a problem in multisession with SAP/P2P GO, when in the
949 // middle of FW bg scan, SAP started; Again that could be a problem even on
950 // infra + SAP/P2P GO too - TBD
951 limReInitLfrScanResults(pMac);
952#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700953
954 /// Initialize number of pre-auth contexts
955 pMac->lim.gLimNumPreAuthContexts = 0;
956
957 /// Initialize MAC based Authentication STA list
958 limInitPreAuthList(pMac);
959
960 //pMac->lim.gpLimMlmJoinReq = NULL;
961
962 if (pMac->lim.gLimTimersCreated)
963 return;
964
965 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700966 retVal = limCreateTimers(pMac);
967 if(retVal == TX_SUCCESS)
968 {
969 pMac->lim.gLimTimersCreated = 1;
970 }
971 else
972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700973 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700974 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700975} /*** end limInitMlm() ***/
976
977
978
979/**
980 * limCleanupMlm()
981 *
982 *FUNCTION:
983 * This function is called to cleanup any resources
984 * allocated by the MLM state machine.
985 *
986 *PARAMS:
987 *
988 *LOGIC:
989 *
990 *ASSUMPTIONS:
991 * NA
992 *
993 *NOTE:
994 * It is assumed that BSS is already informed that we're leaving it
995 * before this function is called.
996 *
997 * @param pMac Pointer to Global MAC structure
998 * @param None
999 * @return None
1000 */
1001void
1002limCleanupMlm(tpAniSirGlobal pMac)
1003{
1004 tANI_U32 n;
1005 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +05301006#ifdef WLAN_FEATURE_11W
1007 tANI_U32 bss_entry, sta_entry;
1008 tpDphHashNode pStaDs = NULL;
1009 tpPESession psessionEntry = NULL;
1010#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001011
1012 if (pMac->lim.gLimTimersCreated == 1)
1013 {
1014 // Deactivate and delete MIN/MAX channel timers.
1015 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1016 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1017 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1018 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1019 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1020 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1021
1022
1023 // Deactivate and delete channel switch timer.
1024 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1025 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1026
1027
1028 // Deactivate and delete addts response timer.
1029 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1030 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1031
1032 // Deactivate and delete Join failure timer.
1033 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1034 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1035
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001036 // Deactivate and delete Periodic Join Probe Request timer.
1037 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1038 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1039
Sushant Kaushik9e923872015-04-02 17:09:31 +05301040 // Deactivate and delete Auth Retry timer.
1041 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1042 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
1043
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 // Deactivate and delete Association failure timer.
1045 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1046 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1047
1048 // Deactivate and delete Reassociation failure timer.
1049 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1050 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1051
1052 // Deactivate and delete Authentication failure timer.
1053 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1054 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1055
1056 // Deactivate and delete Heartbeat timer.
1057 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1058 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1059
1060 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1061 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1062 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1063
1064 // Deactivate and delete Quiet timer.
1065 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1066 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1067
1068 // Deactivate and delete Quiet BSS timer.
1069 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1070 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 // Deactivate and delete LIM background scan timer.
1073 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1074 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001075
1076
1077 // Deactivate and delete cnf wait timer
1078 for (n = 0; n < pMac->lim.maxStation; n++)
1079 {
1080 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1081 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1082 }
1083
1084 // Deactivate and delete keepalive timer
1085 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1086 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1087
1088 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1089
1090 //Deactivate any Authentication response timers
1091 limDeletePreAuthList(pMac);
1092
1093 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1094 {
1095 // Delete any Authentication response
1096 // timers, which might have been started.
1097 tx_timer_delete(&pAuthNode->timer);
1098 }
1099
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1101 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1102 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1103 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1104
1105#if 0 // The WPS PBC clean up timer is disabled
1106 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1107 {
1108 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1109 {
1110 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1112 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1113 }
1114 }
1115#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001116#ifdef WLAN_FEATURE_VOWIFI_11R
1117 // Deactivate and delete FT Preauth response timer
1118 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1119 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1120#endif
1121
Jeff Johnson295189b2012-06-20 16:38:30 -07001122
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001123#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001125 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1126 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1127#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001128
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001129 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1130 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1131
1132 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1133 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1134
Hoonki Leef63df0d2013-01-16 19:29:14 -08001135 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1136 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001137
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301138 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1139 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1140
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 pMac->lim.gLimTimersCreated = 0;
1142 }
1143
Agarwal Ashish888ca022014-11-05 14:25:56 +05301144#ifdef WLAN_FEATURE_11W
1145 /*
1146 * When SSR is triggered, we need to loop through
1147 * each STA associated per BSSId and deactivate/delete
1148 * the pmfSaQueryTimer for it
1149 */
1150 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1151 {
1152 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1153 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1154 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1155 {
1156 if (pMac->lim.gpSession[bss_entry].valid)
1157 {
1158 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1159 sta_entry++)
1160 {
1161 psessionEntry = &pMac->lim.gpSession[bss_entry];
1162 pStaDs = dphGetHashEntry(pMac, sta_entry,
1163 &psessionEntry->dph.dphHashTable);
1164 if (NULL == pStaDs)
1165 {
1166 continue;
1167 }
1168 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1169 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1170 pStaDs->staIndex) ;
1171 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1172 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1173 }
1174 }
1175 }
1176 }
1177#endif
1178
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 /// Cleanup cached scan list
1180 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001181#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1182 /// Cleanup cached scan list
1183 limReInitLfrScanResults(pMac);
1184#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186} /*** end limCleanupMlm() ***/
1187
1188
1189
1190/**
1191 * limCleanupLmm()
1192 *
1193 *FUNCTION:
1194 * This function is called to cleanup any resources
1195 * allocated by LMM sub-module.
1196 *
1197 *PARAMS:
1198 *
1199 *LOGIC:
1200 *
1201 *ASSUMPTIONS:
1202 * NA
1203 *
1204 *NOTE:
1205 * NA
1206 *
1207 * @param pMac Pointer to Global MAC structure
1208 * @return None
1209 */
1210
1211void
1212limCleanupLmm(tpAniSirGlobal pMac)
1213{
Jeff Johnson295189b2012-06-20 16:38:30 -07001214} /*** end limCleanupLmm() ***/
1215
1216
1217
1218/**
1219 * limIsAddrBC()
1220 *
1221 *FUNCTION:
1222 * This function is called in various places within LIM code
1223 * to determine whether passed MAC address is a broadcast or not
1224 *
1225 *LOGIC:
1226 *
1227 *ASSUMPTIONS:
1228 * NA
1229 *
1230 *NOTE:
1231 * NA
1232 *
1233 * @param macAddr Indicates MAC address that need to be determined
1234 * whether it is Broadcast address or not
1235 *
1236 * @return true if passed address is Broadcast address else false
1237 */
1238
1239tANI_U8
1240limIsAddrBC(tSirMacAddr macAddr)
1241{
1242 int i;
1243 for (i = 0; i < 6; i++)
1244 {
1245 if ((macAddr[i] & 0xFF) != 0xFF)
1246 return false;
1247 }
1248
1249 return true;
1250} /****** end limIsAddrBC() ******/
1251
1252
1253
1254/**
1255 * limIsGroupAddr()
1256 *
1257 *FUNCTION:
1258 * This function is called in various places within LIM code
1259 * to determine whether passed MAC address is a group address or not
1260 *
1261 *LOGIC:
1262 * If least significant bit of first octet of the MAC address is
1263 * set to 1, it is a Group address.
1264 *
1265 *ASSUMPTIONS:
1266 * NA
1267 *
1268 *NOTE:
1269 * NA
1270 *
1271 * @param macAddr Indicates MAC address that need to be determined
1272 * whether it is Group address or not
1273 *
1274 * @return true if passed address is Group address else false
1275 */
1276
1277tANI_U8
1278limIsGroupAddr(tSirMacAddr macAddr)
1279{
1280 if ((macAddr[0] & 0x01) == 0x01)
1281 return true;
1282 else
1283 return false;
1284} /****** end limIsGroupAddr() ******/
1285
1286/**
1287 * limPostMsgApiNoWait()
1288 *
1289 *FUNCTION:
1290 * This function is called from other thread while posting a
1291 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1292 *
1293 *LOGIC:
1294 * NA
1295 *
1296 *ASSUMPTIONS:
1297 * NA
1298 *
1299 *NOTE:
1300 * NA
1301 *
1302 * @param pMsg - Pointer to the Global MAC structure
1303 * @param pMsg - Pointer to the message structure
1304 * @return None
1305 */
1306
1307tANI_U32
1308limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1309{
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 limProcessMessages(pMac, pMsg);
1311 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001312} /*** end limPostMsgApiNoWait() ***/
1313
1314
1315
1316/**
1317 * limPrintMacAddr()
1318 *
1319 *FUNCTION:
1320 * This function is called to print passed MAC address
1321 * in : format.
1322 *
1323 *LOGIC:
1324 *
1325 *ASSUMPTIONS:
1326 * NA
1327 *
1328 *NOTE:
1329 * @param macAddr - MacAddr to be printed
1330 * @param logLevel - Loglevel to be used
1331 *
1332 * @return None.
1333 */
1334
1335void
1336limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1337{
1338 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001339 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001340} /****** end limPrintMacAddr() ******/
1341
1342
Jeff Johnson295189b2012-06-20 16:38:30 -07001343/*
1344 * limResetDeferredMsgQ()
1345 *
1346 *FUNCTION:
1347 * This function resets the deferred message queue parameters.
1348 *
1349 *PARAMS:
1350 * @param pMac - Pointer to Global MAC structure
1351 *
1352 *LOGIC:
1353 *
1354 *ASSUMPTIONS:
1355 * NA
1356 *
1357 *NOTE:
1358 * NA
1359 *
1360 *RETURNS:
1361 * None
1362 */
1363
1364void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1365{
1366 pMac->lim.gLimDeferredMsgQ.size =
1367 pMac->lim.gLimDeferredMsgQ.write =
1368 pMac->lim.gLimDeferredMsgQ.read = 0;
1369
1370}
1371
1372
1373#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1374#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1375
1376/*
1377 * limWriteDeferredMsgQ()
1378 *
1379 *FUNCTION:
1380 * This function queues up a deferred message for later processing on the
1381 * STA side.
1382 *
1383 *PARAMS:
1384 * @param pMac - Pointer to Global MAC structure
1385 * @param limMsg - a LIM message
1386 *
1387 *LOGIC:
1388 *
1389 *ASSUMPTIONS:
1390 * NA
1391 *
1392 *NOTE:
1393 * NA
1394 *
1395 *RETURNS:
1396 * None
1397 */
1398
1399tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1400{
1401 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001402 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1404 limMsg->type);)
1405
1406 /*
1407 ** check if the deferred message queue is full
1408 **/
1409 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1410 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301411 if (!(pMac->lim.deferredMsgCnt & 0xF))
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001412 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301413 limLog(pMac, LOGE,
1414 FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
1415 limMsg->type, ++pMac->lim.deferredMsgCnt);
1416 vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
1417 WLAN_LOG_INDICATOR_HOST_DRIVER,
1418 WLAN_LOG_REASON_QUEUE_FULL,
1419 FALSE, TRUE);
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001420 }
1421 else
1422 {
1423 pMac->lim.deferredMsgCnt++;
1424 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001425 return TX_QUEUE_FULL;
1426 }
1427
1428 /*
1429 ** In the application, there should not be more than 1 message get
1430 ** queued up. If happens, flags a warning. In the future, this can
1431 ** happen.
1432 **/
1433 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1434 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001435 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 -07001436 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1437 limIsSystemInScanState(pMac),
1438 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1439 pMac->lim.gLimAddtsSent);)
1440 }
1441
1442 /*
1443 ** To prevent the deferred Q is full of management frames, only give them certain space
1444 **/
1445 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1446 {
1447 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1448 {
1449 tANI_U16 idx, count = 0;
1450 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1451 {
1452 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1453 {
1454 count++;
1455 }
1456 }
1457 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1458 {
1459 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001460 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 //Return error, caller knows what to do
1462 return TX_QUEUE_FULL;
1463 }
1464 }
1465 }
1466
1467 ++pMac->lim.gLimDeferredMsgQ.size;
1468
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001469 /* reset the count here since we are able to defer the message */
1470 if(pMac->lim.deferredMsgCnt != 0)
1471 {
1472 pMac->lim.deferredMsgCnt = 0;
1473 }
1474
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 /*
1476 ** if the write pointer hits the end of the queue, rewind it
1477 **/
1478 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1479 pMac->lim.gLimDeferredMsgQ.write = 0;
1480
1481 /*
1482 ** save the message to the queue and advanced the write pointer
1483 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301484 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1485 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 (tANI_U8 *)limMsg,
1487 sizeof(tSirMsgQ));
1488 return TX_SUCCESS;
1489
1490}
1491
1492/*
1493 * limReadDeferredMsgQ()
1494 *
1495 *FUNCTION:
1496 * This function dequeues a deferred message for processing on the
1497 * STA side.
1498 *
1499 *PARAMS:
1500 * @param pMac - Pointer to Global MAC structure
1501 *
1502 *LOGIC:
1503 *
1504 *ASSUMPTIONS:
1505 * NA
1506 *
1507 *NOTE:
1508 *
1509 *
1510 *RETURNS:
1511 * Returns the message at the head of the deferred message queue
1512 */
1513
1514tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1515{
1516 tSirMsgQ *msg;
1517
1518 /*
1519 ** check any messages left. If no, return
1520 **/
1521 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1522 return NULL;
1523
1524 /*
1525 ** decrement the queue size
1526 **/
1527 pMac->lim.gLimDeferredMsgQ.size--;
1528
1529 /*
1530 ** retrieve the message from the head of the queue
1531 **/
1532 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1533
1534 /*
1535 ** advance the read pointer
1536 **/
1537 pMac->lim.gLimDeferredMsgQ.read++;
1538
1539 /*
1540 ** if the read pointer hits the end of the queue, rewind it
1541 **/
1542 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1543 pMac->lim.gLimDeferredMsgQ.read = 0;
1544
1545 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001546 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1548 msg->type);)
1549
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001550 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001551 limIsSystemInScanState(pMac),
1552 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1553 pMac->lim.gLimAddtsSent);)
1554
1555 return(msg);
1556}
1557
1558tSirRetStatus
1559limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1560 tSirMsgQ *pMsg,
1561 tANI_U8 qType)
1562{
1563// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 SysProcessMmhMsg(pMac, pMsg);
1565 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001566}
1567
1568char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1569{
1570#ifdef FIXME_GEN6
1571
1572 if (type == SIR_MAC_MGMT_FRAME)
1573 {
1574 switch (subType)
1575 {
1576 case SIR_MAC_MGMT_ASSOC_REQ:
1577 return "MAC_MGMT_ASSOC_REQ";
1578 case SIR_MAC_MGMT_ASSOC_RSP:
1579 return "MAC_MGMT_ASSOC_RSP";
1580 case SIR_MAC_MGMT_REASSOC_REQ:
1581 return "MAC_MGMT_REASSOC_REQ";
1582 case SIR_MAC_MGMT_REASSOC_RSP:
1583 return "MAC_MGMT_REASSOC_RSP";
1584 case SIR_MAC_MGMT_PROBE_REQ:
1585 return "MAC_MGMT_PROBE_REQ";
1586 case SIR_MAC_MGMT_PROBE_RSP:
1587 return "MAC_MGMT_PROBE_RSP";
1588 case SIR_MAC_MGMT_BEACON:
1589 return "MAC_MGMT_BEACON";
1590 case SIR_MAC_MGMT_ATIM:
1591 return "MAC_MGMT_ATIM";
1592 case SIR_MAC_MGMT_DISASSOC:
1593 return "MAC_MGMT_DISASSOC";
1594 case SIR_MAC_MGMT_AUTH:
1595 return "MAC_MGMT_AUTH";
1596 case SIR_MAC_MGMT_DEAUTH:
1597 return "MAC_MGMT_DEAUTH";
1598 case SIR_MAC_MGMT_ACTION:
1599 return "MAC_MGMT_ACTION";
1600 case SIR_MAC_MGMT_RESERVED15:
1601 return "MAC_MGMT_RESERVED15";
1602 default:
1603 return "Unknown MGMT Frame";
1604 }
1605 }
1606
1607 else if (type == SIR_MAC_CTRL_FRAME)
1608 {
1609 switch (subType)
1610 {
1611 case SIR_MAC_CTRL_RR:
1612 return "MAC_CTRL_RR";
1613 case SIR_MAC_CTRL_BAR:
1614 return "MAC_CTRL_BAR";
1615 case SIR_MAC_CTRL_BA:
1616 return "MAC_CTRL_BA";
1617 case SIR_MAC_CTRL_PS_POLL:
1618 return "MAC_CTRL_PS_POLL";
1619 case SIR_MAC_CTRL_RTS:
1620 return "MAC_CTRL_RTS";
1621 case SIR_MAC_CTRL_CTS:
1622 return "MAC_CTRL_CTS";
1623 case SIR_MAC_CTRL_ACK:
1624 return "MAC_CTRL_ACK";
1625 case SIR_MAC_CTRL_CF_END:
1626 return "MAC_CTRL_CF_END";
1627 case SIR_MAC_CTRL_CF_END_ACK:
1628 return "MAC_CTRL_CF_END_ACK";
1629 default:
1630 return "Unknown CTRL Frame";
1631 }
1632 }
1633
1634 else if (type == SIR_MAC_DATA_FRAME)
1635 {
1636 switch (subType)
1637 {
1638 case SIR_MAC_DATA_DATA:
1639 return "MAC_DATA_DATA";
1640 case SIR_MAC_DATA_DATA_ACK:
1641 return "MAC_DATA_DATA_ACK";
1642 case SIR_MAC_DATA_DATA_POLL:
1643 return "MAC_DATA_DATA_POLL";
1644 case SIR_MAC_DATA_DATA_ACK_POLL:
1645 return "MAC_DATA_DATA_ACK_POLL";
1646 case SIR_MAC_DATA_NULL:
1647 return "MAC_DATA_NULL";
1648 case SIR_MAC_DATA_NULL_ACK:
1649 return "MAC_DATA_NULL_ACK";
1650 case SIR_MAC_DATA_NULL_POLL:
1651 return "MAC_DATA_NULL_POLL";
1652 case SIR_MAC_DATA_NULL_ACK_POLL:
1653 return "MAC_DATA_NULL_ACK_POLL";
1654 case SIR_MAC_DATA_QOS_DATA:
1655 return "MAC_DATA_QOS_DATA";
1656 case SIR_MAC_DATA_QOS_DATA_ACK:
1657 return "MAC_DATA_QOS_DATA_ACK";
1658 case SIR_MAC_DATA_QOS_DATA_POLL:
1659 return "MAC_DATA_QOS_DATA_POLL";
1660 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1661 return "MAC_DATA_QOS_DATA_ACK_POLL";
1662 case SIR_MAC_DATA_QOS_NULL:
1663 return "MAC_DATA_QOS_NULL";
1664 case SIR_MAC_DATA_QOS_NULL_ACK:
1665 return "MAC_DATA_QOS_NULL_ACK";
1666 case SIR_MAC_DATA_QOS_NULL_POLL:
1667 return "MAC_DATA_QOS_NULL_POLL";
1668 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1669 return "MAC_DATA_QOS_NULL_ACK_POLL";
1670 default:
1671 return "Unknown Data Frame";
1672 }
1673 }
1674 else
1675 return "Unknown";
1676#endif
1677return "";
1678}
1679
Jeff Johnson295189b2012-06-20 16:38:30 -07001680void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1681{
1682 int i;
1683 static int enable;
1684 tUpdateBeaconParams beaconParams;
1685
1686 tpPESession psessionEntry = limIsApSessionActive(pMac);
1687
1688 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001690 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001692 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301693
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301694 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001695 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001696
1697 beaconParams.paramChangeBitmap = 0;
1698 /*
1699 ** This is doing a 2 pass check. The first pass is to invalidate
1700 ** all the cache entries. The second pass is to decide whether to
1701 ** disable protection.
1702 **/
1703 if (!enable)
1704 {
1705
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001706 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 psessionEntry->gLimOlbcParams.numSta = 0;
1708 psessionEntry->gLimOverlap11gParams.numSta = 0;
1709 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1710 psessionEntry->gLimNonGfParams.numSta = 0;
1711 psessionEntry->gLimLsigTxopParams.numSta = 0;
1712
1713 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1714 pMac->lim.protStaOverlapCache[i].active = false;
1715
1716 enable = 1;
1717 }
1718 else
1719 {
1720
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001721 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 {
1723 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1724 {
1725 if (!psessionEntry->gLim11bParams.protectionEnabled)
1726 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001727 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1729 }
1730 }
1731 }
1732
1733 if (!psessionEntry->gLimOverlap11gParams.numSta)
1734 {
1735 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1736 {
1737 if (!psessionEntry->gLim11gParams.protectionEnabled)
1738 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001739 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1741 }
1742 }
1743 }
1744
1745 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1746 {
1747 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1748 {
1749 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1750 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001751 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1753 }
1754 }
1755 }
1756
1757 enable = 0;
1758 }
1759
1760 if(beaconParams.paramChangeBitmap)
1761 {
1762 schSetFixedBeaconFields(pMac,psessionEntry);
1763 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1764 }
1765
1766 // Start OLBC timer
1767 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1768 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001769 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 }
1771}
Jeff Johnson295189b2012-06-20 16:38:30 -07001772
1773/**
1774 * limIsNullSsid()
1775 *
1776 *FUNCTION:
1777 * This function checks if Ssid supplied is Null SSID
1778 *
1779 *
1780 *LOGIC:
1781 *
1782 *ASSUMPTIONS:
1783 * NA
1784 *
1785 *NOTE:
1786 * NA
1787 *
1788 * @param tSirMacSSid *
1789 *
1790 *
1791 * @return true if SSID is Null SSID else false
1792 */
1793
1794tANI_U8
1795limIsNullSsid( tSirMacSSid *pSsid )
1796{
1797 tANI_U8 fNullSsid = false;
1798 tANI_U32 SsidLength;
1799 tANI_U8 *pSsidStr;
1800
1801 do
1802 {
1803 if ( 0 == pSsid->length )
1804 {
1805 fNullSsid = true;
1806 break;
1807 }
1808
1809#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301810 /* If the first charactes is space and SSID length is 1
1811 * then consider it as NULL SSID*/
1812 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1813 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301815 fNullSsid = true;
1816 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 }
1818 else
1819 {
1820 /* check if all the charactes in SSID are NULL*/
1821 SsidLength = pSsid->length;
1822 pSsidStr = pSsid->ssId;
1823
1824 while ( SsidLength )
1825 {
1826 if( *pSsidStr )
1827 break;
1828
1829 pSsidStr++;
1830 SsidLength--;
1831 }
1832
1833 if( 0 == SsidLength )
1834 {
1835 fNullSsid = true;
1836 break;
1837 }
1838 }
1839 }
1840 while( 0 );
1841
1842 return fNullSsid;
1843} /****** end limIsNullSsid() ******/
1844
1845
1846
Jeff Johnson295189b2012-06-20 16:38:30 -07001847
1848/** -------------------------------------------------------------
1849\fn limUpdateProtStaParams
1850\brief updates protection related counters.
1851\param tpAniSirGlobal pMac
1852\param tSirMacAddr peerMacAddr
1853\param tLimProtStaCacheType protStaCacheType
1854\param tHalBitVal gfSupported
1855\param tHalBitVal lsigTxopSupported
1856\return None
1857 -------------------------------------------------------------*/
1858void
1859limUpdateProtStaParams(tpAniSirGlobal pMac,
1860tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1861tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1862tpPESession psessionEntry)
1863{
1864 tANI_U32 i;
1865
1866 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1867 limLog(pMac,LOG1, FL("Addr : "));
1868 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1869
1870 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1871 {
1872 if (psessionEntry->protStaCache[i].active)
1873 {
1874 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1875 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1876
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301877 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 psessionEntry->protStaCache[i].addr,
1879 peerMacAddr, sizeof(tSirMacAddr)))
1880 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001881 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 return;
1883 }
1884 }
1885 }
1886
1887 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1888 {
1889 if (!psessionEntry->protStaCache[i].active)
1890 break;
1891 }
1892
1893 if (i >= LIM_PROT_STA_CACHE_SIZE)
1894 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001895 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 return;
1897 }
1898
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301899 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 peerMacAddr,
1901 sizeof(tSirMacAddr));
1902
1903 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1904 psessionEntry->protStaCache[i].active = true;
1905 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1906 {
1907 psessionEntry->gLim11bParams.numSta++;
1908 limLog(pMac,LOG1, FL("11B, "));
1909 }
1910 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1911 {
1912 psessionEntry->gLim11gParams.numSta++;
1913 limLog(pMac,LOG1, FL("11G, "));
1914 }
1915 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1916 {
1917 psessionEntry->gLimHt20Params.numSta++;
1918 limLog(pMac,LOG1, FL("HT20, "));
1919 }
1920
1921 if(!gfSupported)
1922 {
1923 psessionEntry->gLimNonGfParams.numSta++;
1924 limLog(pMac,LOG1, FL("NonGf, "));
1925 }
1926 if(!lsigTxopSupported)
1927 {
1928 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001929 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 }
1931}// ---------------------------------------------------------------------
1932
1933/** -------------------------------------------------------------
1934\fn limDecideApProtection
1935\brief Decides all the protection related staiton coexistence and also sets
1936\ short preamble and short slot appropriately. This function will be called
1937\ when AP is ready to send assocRsp tp the station joining right now.
1938\param tpAniSirGlobal pMac
1939\param tSirMacAddr peerMacAddr
1940\return None
1941 -------------------------------------------------------------*/
1942void
1943limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1944{
1945 tANI_U16 tmpAid;
1946 tpDphHashNode pStaDs;
1947 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1948 tANI_U32 phyMode;
1949 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1950 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1951
1952 pBeaconParams->paramChangeBitmap = 0;
1953 // check whether to enable protection or not
1954 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1955 if(NULL == pStaDs)
1956 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301957 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 return;
1959 }
1960 limGetRfBand(pMac, &rfBand, psessionEntry);
1961 //if we are in 5 GHZ band
1962 if(SIR_BAND_5_GHZ == rfBand)
1963 {
1964 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1965 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001966 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 {
1968 //we are 11N and 11A station is joining.
1969 //protection from 11A required.
1970 if(false == pStaDs->mlmStaContext.htCapability)
1971 {
1972 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1973 return;
1974 }
1975 }
1976 }
1977 else if(SIR_BAND_2_4_GHZ== rfBand)
1978 {
1979 limGetPhyMode(pMac, &phyMode, psessionEntry);
1980
1981 //We are 11G. Check if we need protection from 11b Stations.
1982 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001983 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 {
1985
1986 if (pStaDs->erpEnabled== eHAL_CLEAR)
1987 {
1988 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1989 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001990 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1992 }
1993 }
1994
1995 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001996 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 {
1998 //check if we need protection from 11b station
1999 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
2000 (!pStaDs->mlmStaContext.htCapability))
2001 {
2002 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
2003 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002004 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2006 }
2007 //station being joined is non-11b and non-ht ==> 11g device
2008 else if(!pStaDs->mlmStaContext.htCapability)
2009 {
2010 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
2011 //enable protection
2012 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
2013 }
2014 //ERP mode is enabled for the latest station joined
2015 //latest station joined is HT capable
2016 //This case is being handled in common code (commn between both the bands) below.
2017 }
2018 }
2019
2020 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002021 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 (true == pStaDs->mlmStaContext.htCapability))
2023 {
2024 if(!pStaDs->htGreenfield)
2025 {
2026 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2027 gfSupported = eHAL_CLEAR;
2028 }
2029 //Station joining is HT 20Mhz
2030 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2031 {
2032 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2033 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2034 }
2035 //Station joining does not support LSIG TXOP Protection
2036 if(!pStaDs->htLsigTXOPProtection)
2037 {
2038 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2039 lsigTxopSupported = eHAL_CLEAR;
2040 }
2041 }
2042
2043 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2044 gfSupported, lsigTxopSupported, psessionEntry);
2045
2046 return;
2047}
Jeff Johnson295189b2012-06-20 16:38:30 -07002048
2049
2050/** -------------------------------------------------------------
2051\fn limEnableOverlap11gProtection
2052\brief wrapper function for setting overlap 11g protection.
2053\param tpAniSirGlobal pMac
2054\param tpUpdateBeaconParams pBeaconParams
2055\param tpSirMacMgmtHdr pMh
2056\return None
2057 -------------------------------------------------------------*/
2058void
2059limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2060tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2061{
2062 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2063
2064 if (psessionEntry->gLimOlbcParams.numSta &&
2065 !psessionEntry->gLimOlbcParams.protectionEnabled)
2066 {
2067 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002068 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2070 }
2071}
2072
2073
2074/** -------------------------------------------------------------
2075\fn limUpdateShortPreamble
2076\brief Updates short preamble if needed when a new station joins.
2077\param tpAniSirGlobal pMac
2078\param tSirMacAddr peerMacAddr
2079\param tpUpdateBeaconParams pBeaconParams
2080\return None
2081 -------------------------------------------------------------*/
2082void
2083limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2084 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2085{
2086 tANI_U16 tmpAid;
2087 tpDphHashNode pStaDs;
2088 tANI_U32 phyMode;
2089 tANI_U16 i;
2090
2091 // check whether to enable protection or not
2092 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2093
2094 limGetPhyMode(pMac, &phyMode, psessionEntry);
2095
2096 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2097
2098 {
2099 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2100 {
2101 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2102 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2103
2104 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2105 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2107 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2108 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302109 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2111 peerMacAddr, sizeof(tSirMacAddr)))
2112 return;
2113 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 {
2115 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2116 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302117 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2119 peerMacAddr, sizeof(tSirMacAddr)))
2120 return;
2121 }
2122 }
2123 }
2124
2125
2126 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2127 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2129 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2130 break;
2131 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 {
2133 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2134 break;
2135 }
2136 }
2137
2138 if (i >= LIM_PROT_STA_CACHE_SIZE)
2139 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2141 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2142 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2143 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2144 return;
2145 }
2146 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 {
2148 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2149 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2150 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2151 return;
2152 }
2153
2154 }
2155
2156
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302157 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2158 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 peerMacAddr, sizeof(tSirMacAddr));
2160 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2161 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2162 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302164 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 peerMacAddr, sizeof(tSirMacAddr));
2166 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2167 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2168 }
2169
2170
2171 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002172 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002173
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002175 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 }
2177 }
2178}
2179
2180/** -------------------------------------------------------------
2181\fn limUpdateShortSlotTime
2182\brief Updates short slot time if needed when a new station joins.
2183\param tpAniSirGlobal pMac
2184\param tSirMacAddr peerMacAddr
2185\param tpUpdateBeaconParams pBeaconParams
2186\return None
2187 -------------------------------------------------------------*/
2188
2189void
2190limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2191 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2192{
2193 tANI_U16 tmpAid;
2194 tpDphHashNode pStaDs;
2195 tANI_U32 phyMode;
2196 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 tANI_U16 i;
2198
2199 // check whether to enable protection or not
2200 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2201 limGetPhyMode(pMac, &phyMode, psessionEntry);
2202
Jeff Johnsone7245742012-09-05 17:12:55 -07002203 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2204 * be always 1 and in 11b case, it should be always 0
2205 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2207 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002208 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2209 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2210 * it in limDecideShortSlot
2211 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2213 {
2214 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2215 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2216 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2217 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2219 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2220 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302221 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2223 peerMacAddr, sizeof(tSirMacAddr)))
2224 return;
2225 }
2226 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 {
2228 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2229 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302230 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2232 peerMacAddr, sizeof(tSirMacAddr)))
2233 return;
2234 }
2235 }
2236 }
2237
2238 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2239 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2241 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2242 break;
2243 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 {
2245 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2246 break;
2247 }
2248 }
2249
2250 if (i >= LIM_PROT_STA_CACHE_SIZE)
2251 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2253 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2254 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2255 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2256 return;
2257 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 {
2259 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2260 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2261 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2262 return;
2263 }
2264 }
2265
2266
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302268 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 peerMacAddr, sizeof(tSirMacAddr));
2270 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2271 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2272 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302274 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 peerMacAddr, sizeof(tSirMacAddr));
2276 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2277 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2278 }
2279 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2280
Jeff Johnsone7245742012-09-05 17:12:55 -07002281 /* 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
2282 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2283 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002285 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 {
2287 // enable long slot time
2288 pBeaconParams->fShortSlotTime = false;
2289 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002290 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002291 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002295 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 {
2297 // enable long slot time
2298 pBeaconParams->fShortSlotTime = false;
2299 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002300 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002301 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 }
2303 }
2304 }
2305 }
2306}
2307
Jeff Johnson295189b2012-06-20 16:38:30 -07002308
2309/** -------------------------------------------------------------
2310\fn limDecideStaProtectionOnAssoc
2311\brief Decide protection related settings on Sta while association.
2312\param tpAniSirGlobal pMac
2313\param tpSchBeaconStruct pBeaconStruct
2314\return None
2315 -------------------------------------------------------------*/
2316void
2317limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2318 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2319{
2320 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2321 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2322
2323 limGetRfBand(pMac, &rfBand, psessionEntry);
2324 limGetPhyMode(pMac, &phyMode, psessionEntry);
2325
2326 if(SIR_BAND_5_GHZ == rfBand)
2327 {
2328 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2329 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2330 {
2331 if(pMac->lim.cfgProtection.fromlla)
2332 psessionEntry->beaconParams.llaCoexist = true;
2333 }
2334 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2335 {
2336 if(pMac->lim.cfgProtection.ht20)
2337 psessionEntry->beaconParams.ht20Coexist = true;
2338 }
2339
2340 }
2341 else if(SIR_BAND_2_4_GHZ == rfBand)
2342 {
2343 //spec 7.3.2.13
2344 //UseProtection will be set when nonERP STA is associated.
2345 //NonERPPresent bit will be set when:
2346 //--nonERP Sta is associated OR
2347 //--nonERP Sta exists in overlapping BSS
2348 //when useProtection is not set then protection from nonERP stations is optional.
2349
2350 //CFG protection from 11b is enabled and
2351 //11B device in the BSS
2352 /* TODO, This is not sessionized */
2353 if (phyMode != WNI_CFG_PHY_MODE_11B)
2354 {
2355 if (pMac->lim.cfgProtection.fromllb &&
2356 pBeaconStruct->erpPresent &&
2357 (pBeaconStruct->erpIEInfo.useProtection ||
2358 pBeaconStruct->erpIEInfo.nonErpPresent))
2359 {
2360 psessionEntry->beaconParams.llbCoexist = true;
2361 }
2362 //AP has no 11b station associated.
2363 else
2364 {
2365 psessionEntry->beaconParams.llbCoexist = false;
2366 }
2367 }
2368 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002369 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 (pBeaconStruct->HTInfo.present))
2371 {
2372 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2373
2374 //Obss Non HT STA present mode
2375 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2376
2377
2378 //CFG protection from 11G is enabled and
2379 //our AP has at least one 11G station associated.
2380 if(pMac->lim.cfgProtection.fromllg &&
2381 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2382 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2383 (!psessionEntry->beaconParams.llbCoexist))
2384 {
2385 if(pMac->lim.cfgProtection.fromllg)
2386 psessionEntry->beaconParams.llgCoexist = true;
2387 }
2388
2389 //AP has only HT stations associated and at least one station is HT 20
2390 //disable protection from any non-HT devices.
2391 //decision for disabling protection from 11b has already been taken above.
2392 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2393 {
2394 //Disable protection from 11G station.
2395 psessionEntry->beaconParams.llgCoexist = false;
2396 //CFG protection from HT 20 is enabled.
2397 if(pMac->lim.cfgProtection.ht20)
2398 psessionEntry->beaconParams.ht20Coexist = true;
2399 }
2400 //Disable protection from non-HT and HT20 devices.
2401 //decision for disabling protection from 11b has already been taken above.
2402 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2403 {
2404 psessionEntry->beaconParams.llgCoexist = false;
2405 psessionEntry->beaconParams.ht20Coexist = false;
2406 }
2407
2408 }
2409 }
2410
2411 //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 -07002412 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 (pBeaconStruct->HTInfo.present))
2414 {
2415 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2416 psessionEntry->beaconParams.fRIFSMode =
2417 ( tANI_U8 ) htInfo.rifsMode;
2418 psessionEntry->beaconParams.llnNonGFCoexist =
2419 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2420 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2421 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2422 }
2423}
2424
2425
2426/** -------------------------------------------------------------
2427\fn limDecideStaProtection
2428\brief Decides protection related settings on Sta while processing beacon.
2429\param tpAniSirGlobal pMac
2430\param tpUpdateBeaconParams pBeaconParams
2431\return None
2432 -------------------------------------------------------------*/
2433void
2434limDecideStaProtection(tpAniSirGlobal pMac,
2435 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2436{
2437
2438 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2439 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2440
2441 limGetRfBand(pMac, &rfBand, psessionEntry);
2442 limGetPhyMode(pMac, &phyMode, psessionEntry);
2443
2444 if(SIR_BAND_5_GHZ == rfBand)
2445 {
2446 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002447 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 (pBeaconStruct->HTInfo.present))
2449 {
2450 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2451 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2452 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2453 {
2454 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2455 }
2456 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2457 //protection from HT20 if needed.
2458 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2459 {
2460 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2461 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2462 }
2463 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2464 {
2465 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2466 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2467 }
2468 }
2469 }
2470 else if(SIR_BAND_2_4_GHZ == rfBand)
2471 {
2472 /* spec 7.3.2.13
2473 * UseProtection will be set when nonERP STA is associated.
2474 * NonERPPresent bit will be set when:
2475 * --nonERP Sta is associated OR
2476 * --nonERP Sta exists in overlapping BSS
2477 * when useProtection is not set then protection from nonERP stations is optional.
2478 */
2479
2480 if (phyMode != WNI_CFG_PHY_MODE_11B)
2481 {
2482 if (pBeaconStruct->erpPresent &&
2483 (pBeaconStruct->erpIEInfo.useProtection ||
2484 pBeaconStruct->erpIEInfo.nonErpPresent))
2485 {
2486 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2487 }
2488 //AP has no 11b station associated.
2489 else
2490 {
2491 //disable protection from 11b station
2492 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2493 }
2494 }
2495
2496 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002497 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 (pBeaconStruct->HTInfo.present))
2499 {
2500
2501 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2502 //AP has at least one 11G station associated.
2503 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2504 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2505 (!psessionEntry->beaconParams.llbCoexist))
2506 {
2507 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2508
2509 }
2510
2511 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2512 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2513 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2514 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2515 {
2516 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2517
2518 //AP has only HT stations associated and at least one station is HT 20
2519 //disable protection from any non-HT devices.
2520 //decision for disabling protection from 11b has already been taken above.
2521 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2522 {
2523 //Disable protection from 11G station.
2524 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2525
2526 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2527 }
2528 //Disable protection from non-HT and HT20 devices.
2529 //decision for disabling protection from 11b has already been taken above.
2530 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2531 {
2532 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2533 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2534
2535 }
2536 }
2537 }
2538 }
2539
2540 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002541 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 (pBeaconStruct->HTInfo.present))
2543 {
2544 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2545 //Check for changes in protection related factors other than HT operating mode.
2546 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2547 if ( psessionEntry->beaconParams.fRIFSMode !=
2548 ( tANI_U8 ) htInfo.rifsMode )
2549 {
2550 pBeaconParams->fRIFSMode =
2551 psessionEntry->beaconParams.fRIFSMode =
2552 ( tANI_U8 ) htInfo.rifsMode;
2553 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2554 }
2555
2556 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2557 htInfo.nonGFDevicesPresent )
2558 {
2559 pBeaconParams->llnNonGFCoexist =
2560 psessionEntry->beaconParams.llnNonGFCoexist =
2561 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2562 pBeaconParams->paramChangeBitmap |=
2563 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2564 }
2565
2566 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2567 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2568 {
2569 pBeaconParams->fLsigTXOPProtectionFullSupport =
2570 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2571 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2572 pBeaconParams->paramChangeBitmap |=
2573 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2574 }
2575
2576 // For Station just update the global lim variable, no need to send message to HAL
2577 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2578 //stations in overlapping BSS.
2579 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2580 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2581
2582 }
2583}
2584
2585
2586/**
2587 * limProcessChannelSwitchTimeout()
2588 *
2589 *FUNCTION:
2590 * This function is invoked when Channel Switch Timer expires at
2591 * the STA. Now, STA must stop traffic, and then change/disable
2592 * primary or secondary channel.
2593 *
2594 *
2595 *NOTE:
2596 * @param pMac - Pointer to Global MAC structure
2597 * @return None
2598 */
2599void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2600{
2601 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002602 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002603
Abhishek Singh800d17a2016-08-26 17:00:49 +05302604 if ((psessionEntry = peFindSessionBySessionId(pMac,
2605 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) {
2606 limLog(pMac, LOGW,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 return;
2608 }
2609
2610 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2611 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002612 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 -07002613 return;
2614 }
Abhishek Singh800d17a2016-08-26 17:00:49 +05302615 if (psessionEntry->gLimSpecMgmt.dot11hChanSwState !=
2616 eLIM_11H_CHANSW_RUNNING) {
2617 limLog(pMac, LOGW,
2618 FL("Channel switch timer should not have been running in state %d"),
2619 psessionEntry->gLimSpecMgmt.dot11hChanSwState);
2620 return;
2621 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002622 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302623
2624 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 * This potentially can create issues if the function tries to set
2626 * channel while device is in power-save, hence putting an extra check
2627 * to verify if the device is in power-save or not
2628 */
2629 if(!limIsSystemInActiveState(pMac))
2630 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002631 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 return;
2633 }
2634
2635 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002636 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002637
2638 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002639 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Abhishek Singhcb255b82015-10-01 12:37:57 +05302640
2641 /*
2642 * If Lim allows Switch channel on same channel on which preauth
2643 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2644 * during preauth rsp handling hence firmware may crash on ENTER/
2645 * EXIT BMPS request.
2646 */
2647 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2648 {
2649 limLog(pMac, LOGE,
2650 FL("Avoid Switch Channel req during pre auth"));
2651 return;
2652 }
2653 /* If link is already suspended mean some off
2654 * channel operation or scan is in progress, Allowing
2655 * Change channel here will lead to either Init Scan
2656 * sent twice or missing Finish scan when change
2657 * channel is completed, this may lead
2658 * to driver in invalid state and crash.
2659 */
2660 if (limIsLinkSuspended(pMac))
2661 {
2662 limLog(pMac, LOGE, FL("Link is already suspended for "
2663 "some other reason. Return here for sessionId:%d"),
2664 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2665 return;
2666 }
2667
Jeff Johnson295189b2012-06-20 16:38:30 -07002668 /* Check if the AP is switching to a channel that we support.
2669 * Else, just don't bother to switch. Indicate HDD to look for a
2670 * better AP to associate
2671 */
2672 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2673 {
2674 /* We need to restore pre-channelSwitch state on the STA */
2675 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2676 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002677 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 return;
2679 }
2680
2681 /* If the channel-list that AP is asking us to switch is invalid,
2682 * then we cannot switch the channel. Just disassociate from AP.
2683 * We will find a better AP !!!
2684 */
Abhishek Singh800d17a2016-08-26 17:00:49 +05302685 if ((psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2686 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
2687 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) {
2688 limLog(pMac, LOGE, FL("Invalid channel!! Disconnect.."));
2689 limTearDownLinkWithAp(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2691 eSIR_MAC_UNSPEC_FAILURE_REASON);
Abhishek Singh800d17a2016-08-26 17:00:49 +05302692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 return;
2694 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002695 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2696 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002697 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 {
2699 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002700 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2701 if ( isLimSessionOffChannel(pMac,
2702 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2703 {
2704 limSuspendLink(pMac,
2705 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2706 limProcessChannelSwitchSuspendLink,
2707 (tANI_U32*)psessionEntry );
2708 }
2709 else
2710 {
2711 limProcessChannelSwitchSuspendLink(pMac,
2712 eHAL_STATUS_SUCCESS,
2713 (tANI_U32*)psessionEntry);
2714 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 break;
2716
2717 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002718 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002719 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002721 psessionEntry->gLimChannelSwitch.secondarySubBand);
2722 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 case eLIM_CHANNEL_SWITCH_IDLE:
2725 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002726 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2728 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002729 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 }
2731 return; /* Please note, this is 'return' and not 'break' */
2732 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002733}
Jeff Johnson295189b2012-06-20 16:38:30 -07002734
2735/**
2736 * limUpdateChannelSwitch()
2737 *
2738 *FUNCTION:
2739 * This function is invoked whenever Station receives
2740 * either 802.11h channel switch IE or airgo proprietary
2741 * channel switch IE.
2742 *
2743 *NOTE:
2744 * @param pMac - Pointer to Global MAC structure
2745 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2746 * @param psessionentry
2747 */
2748void
2749limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2750{
2751
2752 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2754 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002755#ifdef WLAN_FEATURE_11AC
2756 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2757#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002758
Jeff Johnsone7245742012-09-05 17:12:55 -07002759 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002760
2761 /* STA either received proprietary channel switch IE or 802.11h
2762 * standard channel switch IE.
2763 */
2764 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2765 {
2766 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2767
2768 /* Add logic to determine which change this is: */
2769 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002770 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2771 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2772 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2773 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2774 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002776 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 }
2778 else
2779 {
2780 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2782 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2783 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002785 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002786#ifdef WLAN_FEATURE_11AC
2787 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2788 if(pBeacon->WiderBWChanSwitchAnnPresent)
2789 {
2790 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2791 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2792 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2793 }
2794#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002795
2796 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002797 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2798 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002799
2800 /* Do not bother to look and operate on extended channel switch element
2801 * if our own channel-bonding state is not enabled
2802 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002803 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 {
2805 if (pBeacon->extChannelSwitchPresent)
2806 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002807 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2808 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002810 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2811 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002813#ifdef WLAN_FEATURE_11AC
2814 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2815 {
2816 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2817 {
2818 if(pBeacon->extChannelSwitchPresent)
2819 {
2820 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2821 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2822 {
2823 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2824 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2825 psessionEntry->gLimChannelSwitch.primaryChannel,
2826 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2827 pWiderChnlSwitch->newCenterChanFreq0,
2828 psessionEntry);
2829 }
2830 }
2831 }
2832 }
2833#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002834 }
2835 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002836 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002837
2838
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2840 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002841 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 }
2843
2844 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002845 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002846 psessionEntry->peSessionId,
2847 psessionEntry->gLimChannelSwitch.primaryChannel,
2848 psessionEntry->gLimChannelSwitch.secondarySubBand,
2849 psessionEntry->gLimChannelSwitch.switchCount,
2850 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 return;
2852}
2853
2854/**
2855 * limCancelDot11hChannelSwitch
2856 *
2857 *FUNCTION:
2858 * This function is called when STA does not send updated channel-swith IE
2859 * after indicating channel-switch start. This will cancel the channel-swith
2860 * timer which is already running.
2861 *
2862 *LOGIC:
2863 *
2864 *ASSUMPTIONS:
2865 *
2866 *NOTE:
2867 *
2868 * @param pMac - Pointer to Global MAC structure
2869 *
2870 * @return None
2871 */
2872void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2873{
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2875 return;
2876
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002877 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002878 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002879
2880 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002882 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002883 }
2884
2885 /* We need to restore pre-channelSwitch state on the STA */
2886 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2887 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002888 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002889
2890 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002891}
2892
2893/**----------------------------------------------
2894\fn limCancelDot11hQuiet
2895\brief Cancel the quieting on Station if latest
2896 beacon doesn't contain quiet IE in it.
2897
2898\param pMac
2899\return NONE
2900-----------------------------------------------*/
2901void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2902{
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2904 return;
2905
Jeff Johnsone7245742012-09-05 17:12:55 -07002906 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002907 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002908 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2910 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002911 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 }
2913 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002914 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002916 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2918 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002919 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 }
2921 /**
2922 * If the channel switch is already running in silent mode, dont resume the
2923 * transmission. Channel switch timer when timeout, transmission will be resumed.
2924 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002925 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2926 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 {
2928 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002929 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 }
2931 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002932 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002933}
2934
2935/**
2936 * limProcessQuietTimeout
2937 *
2938 * FUNCTION:
2939 * This function is active only on the STA.
2940 * Handles SIR_LIM_QUIET_TIMEOUT
2941 *
2942 * LOGIC:
2943 * This timeout can occur under only one circumstance:
2944 *
2945 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2946 * This indicates that the timeout "interval" has
2947 * expired. This is a trigger for the STA to now
2948 * shut-off Tx/Rx for the specified gLimQuietDuration
2949 * -> The TIMER object gLimQuietBssTimer is
2950 * activated
2951 * -> With timeout = gLimQuietDuration
2952 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2953 *
2954 * ASSUMPTIONS:
2955 * Using two TIMER objects -
2956 * gLimQuietTimer & gLimQuietBssTimer
2957 *
2958 * NOTE:
2959 *
2960 * @param pMac - Pointer to Global MAC structure
2961 *
2962 * @return None
2963 */
2964void limProcessQuietTimeout(tpAniSirGlobal pMac)
2965{
Jeff Johnson295189b2012-06-20 16:38:30 -07002966 //fetch the sessionEntry based on the sessionId
2967 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002968 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002969
Jeff Johnsone7245742012-09-05 17:12:55 -07002970 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002972 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 return;
2974 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002975
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302976 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002977 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 {
2979 case eLIM_QUIET_BEGIN:
2980 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002981 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2982 if (TX_SUCCESS !=
2983 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2984 {
2985 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002986 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002987 }
2988
2989 // gLimQuietDuration appears to be in units of ticks
2990 // Use it as is
2991 if (TX_SUCCESS !=
2992 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2993 psessionEntry->gLimSpecMgmt.quietDuration,
2994 0))
2995 {
2996 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002997 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002998 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002999 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003000#ifdef GEN6_TODO
3001 /* revisit this piece of code to assign the appropriate sessionId below
3002 * priority - HIGH
3003 */
3004 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3005#endif
3006 if( TX_SUCCESS !=
3007 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3008 {
3009 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003010 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 }
3012 else
3013 {
3014 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003015 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003016
3017 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3018 /* print message, otherwise, stop data traffic and stay quiet */
3019 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3020 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3021 {
3022 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003023 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003024 }
3025 else
3026 {
3027 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3028 /* freeze the transmission */
3029 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3030
3031 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003032 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003033 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 }
3035 }
3036 break;
3037
3038 case eLIM_QUIET_RUNNING:
3039 case eLIM_QUIET_INIT:
3040 case eLIM_QUIET_END:
3041 default:
3042 //
3043 // As of now, nothing to be done
3044 //
3045 break;
3046 }
3047}
3048
3049/**
3050 * limProcessQuietBssTimeout
3051 *
3052 * FUNCTION:
3053 * This function is active on the AP and STA.
3054 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3055 *
3056 * LOGIC:
3057 * On the AP -
3058 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3059 * an indication for the AP to START sending out the
3060 * Quiet BSS IE.
3061 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3062 * the 11H spec
3063 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3064 * a Proprietary IE. This will be understood by all the
3065 * TITAN STA's
3066 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3067 * initiate the SCH to include the Quiet BSS IE in all
3068 * its subsequent Beacons/PR's.
3069 * The Quiet BSS IE will be included in all the Beacons
3070 * & PR's until the next DTIM period
3071 *
3072 * On the STA -
3073 * When gLimQuietState = eLIM_QUIET_RUNNING
3074 * This indicates that the STA was successfully shut-off
3075 * for the specified gLimQuietDuration. This is a trigger
3076 * for the STA to now resume data traffic.
3077 * -> gLimQuietState is set to eLIM_QUIET_INIT
3078 *
3079 * ASSUMPTIONS:
3080 *
3081 * NOTE:
3082 *
3083 * @param pMac - Pointer to Global MAC structure
3084 *
3085 * @return None
3086 */
3087void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3088{
Jeff Johnsone7245742012-09-05 17:12:55 -07003089 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003090
Jeff Johnsone7245742012-09-05 17:12:55 -07003091 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003093 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003094 return;
3095 }
3096
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303097 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003098 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003100 }
3101 else
3102 {
3103 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003104 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 {
3106 case eLIM_QUIET_RUNNING:
3107 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003108 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003109
3110 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3111 {
3112 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003113 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3114 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 {
3116 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003117 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 }
3119
3120 /* Reset status flag */
3121 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3122 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3123
3124 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 }
3127 else
3128 {
3129 //
3130 // Nothing specific to be done in this case
3131 // A background scan that was triggered during
3132 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3133 //
3134 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003135 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003136 }
3137 break;
3138
3139 case eLIM_QUIET_INIT:
3140 case eLIM_QUIET_BEGIN:
3141 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003142 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 /* If the quiet period has ended, then resume the frame transmission */
3144 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003145 limRestorePreQuietState(pMac, psessionEntry);
3146 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 break;
3148
3149 default:
3150 //
3151 // As of now, nothing to be done
3152 //
3153 break;
3154 }
3155 }
3156}
Jeff Johnson295189b2012-06-20 16:38:30 -07003157/**
3158 * limProcessWPSOverlapTimeout
3159 *
3160 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3161 *
3162 * LOGIC:
3163 *
3164 * ASSUMPTIONS:
3165 *
3166 * NOTE:
3167 *
3168 * @param pMac - Pointer to Global MAC structure
3169 *
3170 * @return None
3171 */
3172#if 0
3173void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3174{
3175
3176 tpPESession psessionEntry;
3177 tANI_U32 sessionId;
3178
3179 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3180 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003181 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003182 }
3183
3184 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3185
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003186 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003187
3188 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3189 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003190 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 return;
3192 }
3193
3194 limWPSPBCTimeout(pMac, psessionEntry);
3195}
3196#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003197
Jeff Johnson295189b2012-06-20 16:38:30 -07003198/**----------------------------------------------
3199\fn limStartQuietTimer
3200\brief Starts the quiet timer.
3201
3202\param pMac
3203\return NONE
3204-----------------------------------------------*/
3205void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3206{
3207 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303208 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003209
3210 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003211 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003212 return;
3213 }
3214
Jeff Johnson295189b2012-06-20 16:38:30 -07003215
3216 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3217 return;
3218 // First, de-activate Timer, if its already active
3219 limCancelDot11hQuiet(pMac, psessionEntry);
3220
Jeff Johnsone7245742012-09-05 17:12:55 -07003221 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3222 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3223 {
3224 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003225 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003226 }
3227
3228 // Set the NEW timeout value, in ticks
3229 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3230 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3231 {
3232 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003233 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003234 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003235
3236 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3237 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3238 {
3239 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003240 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003241 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003242
Jeff Johnsone7245742012-09-05 17:12:55 -07003243 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003244 return;
3245 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003246}
3247
Jeff Johnson295189b2012-06-20 16:38:30 -07003248
3249/** ------------------------------------------------------------------------ **/
3250/**
3251 * keep track of the number of ANI peers associated in the BSS
3252 * For the first and last ANI peer, we have to update EDCA params as needed
3253 *
3254 * When the first ANI peer joins the BSS, we notify SCH
3255 * When the last ANI peer leaves the BSS, we notfiy SCH
3256 */
3257void
3258limUtilCountStaAdd(
3259 tpAniSirGlobal pMac,
3260 tpDphHashNode pSta,
3261 tpPESession psessionEntry)
3262{
3263
3264 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3265 return;
3266
3267 pSta->fAniCount = 1;
3268
3269 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3270 return;
3271
3272 // get here only if this is the first ANI peer in the BSS
3273 schEdcaProfileUpdate(pMac, psessionEntry);
3274}
3275
3276void
3277limUtilCountStaDel(
3278 tpAniSirGlobal pMac,
3279 tpDphHashNode pSta,
3280 tpPESession psessionEntry)
3281{
3282
3283 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3284 return;
3285
3286 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3287 * then go ahead and update the count and profiles. This ensures
3288 * that the "number of ani station" count is properly incremented/decremented.
3289 */
3290 if (pSta->valid == 1)
3291 return;
3292
3293 pSta->fAniCount = 0;
3294
3295 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3296 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003297 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 pMac->lim.gLimNumOfAniSTAs);
3299 return;
3300 }
3301
3302 pMac->lim.gLimNumOfAniSTAs--;
3303
3304 if (pMac->lim.gLimNumOfAniSTAs != 0)
3305 return;
3306
3307 // get here only if this is the last ANI peer in the BSS
3308 schEdcaProfileUpdate(pMac, psessionEntry);
3309}
3310
Jeff Johnson295189b2012-06-20 16:38:30 -07003311/**
3312 * limSwitchChannelCback()
3313 *
3314 *FUNCTION:
3315 * This is the callback function registered while requesting to switch channel
3316 * after AP indicates a channel switch for spectrum management (11h).
3317 *
3318 *NOTE:
3319 * @param pMac Pointer to Global MAC structure
3320 * @param status Status of channel switch request
3321 * @param data User data
3322 * @param psessionEntry Session information
3323 * @return NONE
3324 */
3325void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3326 tANI_U32 *data, tpPESession psessionEntry)
3327{
3328 tSirMsgQ mmhMsg = {0};
3329 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3330
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3332
3333 /* We need to restore pre-channelSwitch state on the STA */
3334 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3335 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003336 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 return;
3338 }
3339
3340 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303341 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3342 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003344 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 return;
3346 }
3347
3348 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3349 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003350 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3352 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303353 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3355 mmhMsg.bodyval = 0;
3356
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303357 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3358 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003360}
3361
3362/**
3363 * limSwitchPrimaryChannel()
3364 *
3365 *FUNCTION:
3366 * This function changes the current operating channel
3367 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3368 *
3369 *NOTE:
3370 * @param pMac Pointer to Global MAC structure
3371 * @param newChannel new chnannel ID
3372 * @return NONE
3373 */
3374void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3375{
3376#if !defined WLAN_FEATURE_VOWIFI
3377 tANI_U32 localPwrConstraint;
3378#endif
3379
Abhishek Singh127a8442014-12-15 17:31:27 +05303380 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3381 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 psessionEntry->currentReqChannel = newChannel;
3383 psessionEntry->limRFBand = limGetRFBand(newChannel);
3384
3385 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3386
3387 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3388 pMac->lim.gpchangeChannelData = NULL;
3389
3390#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003391 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3393#else
3394 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3395 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003396 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 return;
3398 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3401#endif
3402 return;
3403}
3404
3405/**
3406 * limSwitchPrimarySecondaryChannel()
3407 *
3408 *FUNCTION:
3409 * This function changes the primary and secondary channel.
3410 * If 11h is enabled and user provides a "new channel ID"
3411 * that is different from the current operating channel,
3412 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3413 * assign notify LIM of such change.
3414 *
3415 *NOTE:
3416 * @param pMac Pointer to Global MAC structure
3417 * @param newChannel New chnannel ID (or current channel ID)
3418 * @param subband CB secondary info:
3419 * - eANI_CB_SECONDARY_NONE
3420 * - eANI_CB_SECONDARY_UP
3421 * - eANI_CB_SECONDARY_DOWN
3422 * @return NONE
3423 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003424void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003425{
3426#if !defined WLAN_FEATURE_VOWIFI
3427 tANI_U32 localPwrConstraint;
3428#endif
3429
Jeff Johnson295189b2012-06-20 16:38:30 -07003430#if !defined WLAN_FEATURE_VOWIFI
3431 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003432 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 return;
3434 }
3435#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303436 /* Assign the callback to resume TX once channel is changed.
3437 */
3438 psessionEntry->currentReqChannel = newChannel;
3439 psessionEntry->limRFBand = limGetRFBand(newChannel);
3440
3441 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3442
3443 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3444 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003445
Jeff Johnson295189b2012-06-20 16:38:30 -07003446#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003448#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003449 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003450#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003451
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303452#ifdef FEATURE_WLAN_DIAG_SUPPORT
3453 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3454 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3455#endif
3456
Jeff Johnsone7245742012-09-05 17:12:55 -07003457 // Store the new primary and secondary channel in session entries if different
3458 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 {
3460 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003461 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 psessionEntry->currentOperChannel = newChannel;
3464 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003465 if (psessionEntry->htSecondaryChannelOffset != subband)
3466 {
3467 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003468 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003469 psessionEntry->htSecondaryChannelOffset, subband);
3470 psessionEntry->htSecondaryChannelOffset = subband;
3471 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3472 {
3473 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3474 }
3475 else
3476 {
3477 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3478 }
3479 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3480 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003481
3482 return;
3483}
3484
3485
3486/**
3487 * limActiveScanAllowed()
3488 *
3489 *FUNCTION:
3490 * Checks if active scans are permitted on the given channel
3491 *
3492 *LOGIC:
3493 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3494 * Need to check if the channelNum matches, then depending on the corresponding
3495 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3496 *
3497 *ASSUMPTIONS:
3498 *
3499 *NOTE:
3500 *
3501 * @param pMac Pointer to Global MAC structure
3502 * @param channelNum channel number
3503 * @return None
3504 */
3505
3506tANI_U8 limActiveScanAllowed(
3507 tpAniSirGlobal pMac,
3508 tANI_U8 channelNum)
3509{
3510 tANI_U32 i;
3511 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3512 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3513 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3514 != eSIR_SUCCESS)
3515 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003516 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 return false;
3518 }
3519
3520 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3521 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003522 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 len);
3524 return false;
3525 }
3526
3527 for (i=0; (i+1) < len; i+=2)
3528 {
3529 if (channelPair[i] == channelNum)
3530 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3531 }
3532 return false;
3533}
3534
3535/**
3536 * limTriggerBackgroundScanDuringQuietBss()
3537 *
3538 *FUNCTION:
3539 * This function is applicable to the STA only.
3540 * This function is called by limProcessQuietTimeout(),
3541 * when it is time to honor the Quiet BSS IE from the AP.
3542 *
3543 *LOGIC:
3544 * If 11H is enabled:
3545 * We cannot trigger a background scan. The STA needs to
3546 * shut-off Tx/Rx.
3547 * If 11 is not enabled:
3548 * Determine if the next channel that we are going to
3549 * scan is NOT the same channel (or not) on which the
3550 * Quiet BSS was requested.
3551 * If yes, then we cannot trigger a background scan on
3552 * this channel. Return with a false.
3553 * If no, then trigger a background scan. Return with
3554 * a true.
3555 *
3556 *ASSUMPTIONS:
3557 *
3558 *NOTE:
3559 * This API is redundant if the existing API,
3560 * limTriggerBackgroundScan(), were to return a valid
3561 * response instead of returning void.
3562 * If possible, try to revisit this API
3563 *
3564 * @param pMac Pointer to Global MAC structure
3565 * @return eSIR_TRUE, if a background scan was attempted
3566 * eSIR_FALSE, if not
3567 */
3568tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3569{
3570 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003571
3572
3573
3574 //TBD-RAJESH HOW TO GET sessionEntry?????
3575 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3576
3577 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3578 return bScanTriggered;
3579
Jeff Johnsone7245742012-09-05 17:12:55 -07003580 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 {
3582 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3583 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3584
3585 // Determine the next scan channel
3586
3587 // Get background scan channel list from CFG
3588 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3589 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3590 (tANI_U8 *) bgScanChannelList,
3591 (tANI_U32 *) &len ))
3592 {
3593 // Ensure that we do not go off scanning on the same
3594 // channel on which the Quiet BSS was requested
3595 if( psessionEntry->currentOperChannel!=
3596 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3597 {
3598 // For now, try and attempt a background scan. It will
3599 // be ideal if this API actually returns a success or
3600 // failure instead of having a void return type
3601 limTriggerBackgroundScan( pMac );
3602
3603 bScanTriggered = eSIR_TRUE;
3604 }
3605 else
3606 {
3607 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003608 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 -07003609 }
3610 }
3611 else
3612 {
3613 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003614 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 -07003615 }
3616 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 return bScanTriggered;
3618}
3619
3620
3621/**
3622 * limGetHTCapability()
3623 *
3624 *FUNCTION:
3625 * A utility function that returns the "current HT capability state" for the HT
3626 * capability of interest (as requested in the API)
3627 *
3628 *LOGIC:
3629 * This routine will return with the "current" setting of a requested HT
3630 * capability. This state info could be retrieved from -
3631 * a) CFG (for static entries)
3632 * b) Run time info
3633 * - Dynamic state maintained by LIM
3634 * - Configured at radio init time by SME
3635 *
3636 *
3637 *ASSUMPTIONS:
3638 * NA
3639 *
3640 *NOTE:
3641 *
3642 * @param pMac Pointer to Global MAC structure
3643 * @param htCap The HT capability being queried
3644 * @return tANI_U8 The current state of the requested HT capability is returned in a
3645 * tANI_U8 variable
3646 */
3647
Jeff Johnson295189b2012-06-20 16:38:30 -07003648tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3649 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003650{
3651tANI_U8 retVal = 0;
3652tANI_U8 *ptr;
3653tANI_U32 cfgValue;
3654tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3655tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3656tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3657tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3658
3659 //
3660 // Determine which CFG to read from. Not ALL of the HT
3661 // related CFG's need to be read each time this API is
3662 // accessed
3663 //
3664 if( htCap >= eHT_ANTENNA_SELECTION &&
3665 htCap < eHT_SI_GRANULARITY )
3666 {
3667 // Get Antenna Seletion HT Capabilities
3668 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3669 cfgValue = 0;
3670 ptr = (tANI_U8 *) &macASCapabilityInfo;
3671 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3672 }
3673 else
3674 {
3675 if( htCap >= eHT_TX_BEAMFORMING &&
3676 htCap < eHT_ANTENNA_SELECTION )
3677 {
3678 // Get Transmit Beam Forming HT Capabilities
3679 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3680 cfgValue = 0;
3681 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3682 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3683 }
3684 else
3685 {
3686 if( htCap >= eHT_PCO &&
3687 htCap < eHT_TX_BEAMFORMING )
3688 {
3689 // Get Extended HT Capabilities
3690 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3691 cfgValue = 0;
3692 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3693 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3694 }
3695 else
3696 {
3697 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3698 {
3699 // Get HT Capabilities
3700 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3701 cfgValue = 0;
3702 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3703 // 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
3704 *ptr++ = cfgValue & 0xff;
3705 *ptr = (cfgValue >> 8) & 0xff;
3706 }
3707 }
3708 }
3709 }
3710
3711 switch( htCap )
3712 {
3713 case eHT_LSIG_TXOP_PROTECTION:
3714 retVal = pMac->lim.gHTLsigTXOPProtection;
3715 break;
3716
3717 case eHT_STBC_CONTROL_FRAME:
3718 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3719 break;
3720
3721 case eHT_PSMP:
3722 retVal = pMac->lim.gHTPSMPSupport;
3723 break;
3724
3725 case eHT_DSSS_CCK_MODE_40MHZ:
3726 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3727 break;
3728
3729 case eHT_MAX_AMSDU_LENGTH:
3730 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3731 break;
3732
3733 case eHT_DELAYED_BA:
3734 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3735 break;
3736
3737 case eHT_RX_STBC:
3738 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3739 break;
3740
3741 case eHT_TX_STBC:
3742 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3743 break;
3744
3745 case eHT_SHORT_GI_40MHZ:
3746 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3747 break;
3748
3749 case eHT_SHORT_GI_20MHZ:
3750 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3751 break;
3752
3753 case eHT_GREENFIELD:
3754 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3755 break;
3756
3757 case eHT_MIMO_POWER_SAVE:
3758 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3759 break;
3760
3761 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003762 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 break;
3764
3765 case eHT_ADVANCED_CODING:
3766 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3767 break;
3768
3769 case eHT_MAX_RX_AMPDU_FACTOR:
3770 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3771 break;
3772
3773 case eHT_MPDU_DENSITY:
3774 retVal = pMac->lim.gHTAMpduDensity;
3775 break;
3776
3777 case eHT_PCO:
3778 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3779 break;
3780
3781 case eHT_TRANSITION_TIME:
3782 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3783 break;
3784
3785 case eHT_MCS_FEEDBACK:
3786 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3787 break;
3788
3789 case eHT_TX_BEAMFORMING:
3790 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3791 break;
3792
3793 case eHT_ANTENNA_SELECTION:
3794 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3795 break;
3796
3797 case eHT_SI_GRANULARITY:
3798 retVal = pMac->lim.gHTServiceIntervalGranularity;
3799 break;
3800
3801 case eHT_CONTROLLED_ACCESS:
3802 retVal = pMac->lim.gHTControlledAccessOnly;
3803 break;
3804
3805 case eHT_RIFS_MODE:
3806 retVal = psessionEntry->beaconParams.fRIFSMode;
3807 break;
3808
3809 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003810 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 break;
3812
3813 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003814 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 break;
3816
3817 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3819 retVal = psessionEntry->htOperMode;
3820 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 retVal = pMac->lim.gHTOperMode;
3822 break;
3823
3824 case eHT_BASIC_STBC_MCS:
3825 retVal = pMac->lim.gHTSTBCBasicMCS;
3826 break;
3827
3828 case eHT_DUAL_CTS_PROTECTION:
3829 retVal = pMac->lim.gHTDualCTSProtection;
3830 break;
3831
3832 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3833 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3834 break;
3835
3836 case eHT_PCO_ACTIVE:
3837 retVal = pMac->lim.gHTPCOActive;
3838 break;
3839
3840 case eHT_PCO_PHASE:
3841 retVal = pMac->lim.gHTPCOPhase;
3842 break;
3843
3844 default:
3845 break;
3846 }
3847
3848 return retVal;
3849}
3850
Jeff Johnson295189b2012-06-20 16:38:30 -07003851void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3852{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303853 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003854 return;
3855}
3856
3857
3858
3859
3860/** -------------------------------------------------------------
3861\fn limEnable11aProtection
3862\brief based on config setting enables\disables 11a protection.
3863\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3864\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3865\param tpUpdateBeaconParams pBeaconParams
3866\return None
3867 -------------------------------------------------------------*/
3868tSirRetStatus
3869limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3870 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3871{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003872 if(NULL == psessionEntry)
3873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003874 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003875 return eSIR_FAILURE;
3876 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 //overlapping protection configuration check.
3878 if(overlap)
3879 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 }
3881 else
3882 {
3883 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003884 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003885 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 {
3887 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003888 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 return eSIR_SUCCESS;
3890 }
3891 }
3892
3893 if (enable)
3894 {
3895 //If we are AP and HT capable, we need to set the HT OP mode
3896 //appropriately.
3897 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003898 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 {
3900 if(overlap)
3901 {
3902 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3903 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3904 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3905 {
3906 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3907 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3908 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3909 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3910 }
3911 }
3912 else
3913 {
3914 psessionEntry->gLim11aParams.protectionEnabled = true;
3915 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3916 {
3917 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003918 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3920 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3921
3922 }
3923 }
3924 }
3925
3926 //This part is common for staiton as well.
3927 if(false == psessionEntry->beaconParams.llaCoexist)
3928 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003929 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3931 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3932 }
3933 }
3934 else if (true == psessionEntry->beaconParams.llaCoexist)
3935 {
3936 //for AP role.
3937 //we need to take care of HT OP mode change if needed.
3938 //We need to take care of Overlap cases.
3939 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3940 {
3941 if(overlap)
3942 {
3943 //Overlap Legacy protection disabled.
3944 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3945
3946 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003947 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 {
3949 // no HT op mode change if any of the overlap protection enabled.
3950 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3951 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3952 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3953
3954 {
3955 //Check if there is a need to change HT OP mode.
3956 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3957 {
3958 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3959 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3960
3961 if(psessionEntry->gLimHt20Params.protectionEnabled)
3962 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3963 else
3964 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3965 }
3966 }
3967 }
3968 }
3969 else
3970 {
3971 //Disable protection from 11A stations.
3972 psessionEntry->gLim11aParams.protectionEnabled = false;
3973 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3974
3975 //Check if any other non-HT protection enabled.
3976 //Right now we are in HT OP Mixed mode.
3977 //Change HT op mode appropriately.
3978
3979 //Change HT OP mode to 01 if any overlap protection enabled
3980 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3981 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3982 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3983
3984 {
3985 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003986 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3988 }
3989 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3990 {
3991 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003992 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003993 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3994 }
3995 else
3996 {
3997 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003998 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4000 }
4001 }
4002 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4003 !psessionEntry->gLim11aParams.protectionEnabled)
4004 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004005 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4007 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4008 }
4009 }
4010 //for station role
4011 else
4012 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004013 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4015 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4016 }
4017 }
4018
4019 return eSIR_SUCCESS;
4020}
4021
4022/** -------------------------------------------------------------
4023\fn limEnable11gProtection
4024\brief based on config setting enables\disables 11g protection.
4025\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4026\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4027\param tpUpdateBeaconParams pBeaconParams
4028\return None
4029 -------------------------------------------------------------*/
4030
4031tSirRetStatus
4032limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4033 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4034{
4035
4036 //overlapping protection configuration check.
4037 if(overlap)
4038 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 }
4040 else
4041 {
4042 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4044 !psessionEntry->cfgProtection.fromllb)
4045 {
4046 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004047 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 return eSIR_SUCCESS;
4049 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004050 {
4051 if(!pMac->lim.cfgProtection.fromllb)
4052 {
4053 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004054 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 return eSIR_SUCCESS;
4056 }
4057 }
4058 }
4059
4060 if (enable)
4061 {
4062 //If we are AP and HT capable, we need to set the HT OP mode
4063 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4065 {
4066 if(overlap)
4067 {
4068 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004069 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004070 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 {
4072 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4073 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4074 {
4075 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4076 }
4077 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4078 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4079 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4080 //Not processing OBSS bit from other APs, as we are already taking care
4081 //of Protection from overlapping BSS based on erp IE or useProtection bit
4082 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4083 }
4084 }
4085 else
4086 {
4087 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004088 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004089 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 {
4091 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4092 {
4093 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4094 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4095 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4096 }
4097 }
4098 }
4099 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004100 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 {
4102 if(overlap)
4103 {
4104 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4105 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4106 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4107 {
4108 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4109 }
4110 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4111 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4112 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4113 //Not processing OBSS bit from other APs, as we are already taking care
4114 //of Protection from overlapping BSS based on erp IE or useProtection bit
4115 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4116 }
4117 else
4118 {
4119 psessionEntry->gLim11bParams.protectionEnabled = true;
4120 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4121 {
4122 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4123 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4124 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4125 }
4126 }
4127 }
4128
4129 //This part is common for staiton as well.
4130 if(false == psessionEntry->beaconParams.llbCoexist)
4131 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004132 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4134 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4135 }
4136 }
4137 else if (true == psessionEntry->beaconParams.llbCoexist)
4138 {
4139 //for AP role.
4140 //we need to take care of HT OP mode change if needed.
4141 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004142 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4143 {
4144 if(overlap)
4145 {
4146 //Overlap Legacy protection disabled.
4147 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4148
4149 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004150 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 {
4152 // no HT op mode change if any of the overlap protection enabled.
4153 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4154 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4155 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4156 {
4157 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004158 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 {
4160 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4161 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4162 if(psessionEntry->gLimHt20Params.protectionEnabled){
4163 //Commenting out beacuse of CR 258588 WFA cert
4164 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4165 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4166 }
4167 else
4168 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4169 }
4170 }
4171 }
4172 }
4173 else
4174 {
4175 //Disable protection from 11B stations.
4176 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004177 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 //Check if any other non-HT protection enabled.
4179 if(!psessionEntry->gLim11gParams.protectionEnabled)
4180 {
4181 //Right now we are in HT OP Mixed mode.
4182 //Change HT op mode appropriately.
4183 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4184
4185 //Change HT OP mode to 01 if any overlap protection enabled
4186 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4187 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4188 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4189 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4190 {
4191 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004192 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4194 }
4195 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4196 {
4197 //Commenting because of CR 258588 WFA cert
4198 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4199 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004200 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4202 }
4203 else
4204 {
4205 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4206 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4207 }
4208 }
4209 }
4210 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4211 !psessionEntry->gLim11bParams.protectionEnabled)
4212 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004213 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4215 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4216 }
4217 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 {
4219 if(overlap)
4220 {
4221 //Overlap Legacy protection disabled.
4222 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4223
4224 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004225 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 {
4227 // no HT op mode change if any of the overlap protection enabled.
4228 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4229 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4230 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4231
4232 {
4233 //Check if there is a need to change HT OP mode.
4234 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4235 {
4236 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4237 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4238 if(psessionEntry->gLimHt20Params.protectionEnabled)
4239 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4240 else
4241 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4242 }
4243 }
4244 }
4245 }
4246 else
4247 {
4248 //Disable protection from 11B stations.
4249 psessionEntry->gLim11bParams.protectionEnabled = false;
4250 //Check if any other non-HT protection enabled.
4251 if(!psessionEntry->gLim11gParams.protectionEnabled)
4252 {
4253 //Right now we are in HT OP Mixed mode.
4254 //Change HT op mode appropriately.
4255 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4256
4257 //Change HT OP mode to 01 if any overlap protection enabled
4258 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4259 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4260 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4261 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4262
4263 {
4264 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4265 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4266 }
4267 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4268 {
4269 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4270 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4271 }
4272 else
4273 {
4274 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4275 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4276 }
4277 }
4278 }
4279 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4280 !psessionEntry->gLim11bParams.protectionEnabled)
4281 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004282 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004283 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4284 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4285 }
4286 }
4287 //for station role
4288 else
4289 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004290 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4292 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4293 }
4294 }
4295 return eSIR_SUCCESS;
4296}
4297
4298/** -------------------------------------------------------------
4299\fn limEnableHtProtectionFrom11g
4300\brief based on cofig enables\disables protection from 11g.
4301\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4302\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4303\param tpUpdateBeaconParams pBeaconParams
4304\return None
4305 -------------------------------------------------------------*/
4306tSirRetStatus
4307limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4308 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4309{
Jeff Johnsone7245742012-09-05 17:12:55 -07004310 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4312
4313 //overlapping protection configuration check.
4314 if(overlap)
4315 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004316 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4317 {
4318 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004319 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 return eSIR_SUCCESS;
4321 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004322 {
4323 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004324 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 return eSIR_SUCCESS;
4326 }
4327 }
4328 else
4329 {
4330 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4332 !psessionEntry->cfgProtection.fromllg){
4333 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004334 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 return eSIR_SUCCESS;
4336 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 {
4338 if(!pMac->lim.cfgProtection.fromllg)
4339 {
4340 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004341 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004342 return eSIR_SUCCESS;
4343 }
4344 }
4345 }
4346 if (enable)
4347 {
4348 //If we are AP and HT capable, we need to set the HT OP mode
4349 //appropriately.
4350
Jeff Johnson295189b2012-06-20 16:38:30 -07004351 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4352 {
4353 if(overlap)
4354 {
4355 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4356 //11g exists in overlap BSS.
4357 //need not to change the operating mode to overlap_legacy
4358 //if higher or same protection operating mode is enabled right now.
4359 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4360 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4361 {
4362 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4363 }
4364 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304365 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 }
4367 else
4368 {
4369 //11g is associated to an AP operating in 11n mode.
4370 //Change the HT operating mode to 'mixed mode'.
4371 psessionEntry->gLim11gParams.protectionEnabled = true;
4372 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4373 {
4374 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4375 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304376 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 }
4378 }
4379 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 {
4381 if(overlap)
4382 {
4383 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4384 //11g exists in overlap BSS.
4385 //need not to change the operating mode to overlap_legacy
4386 //if higher or same protection operating mode is enabled right now.
4387 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4388 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4389 {
4390 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4391 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4392 }
4393 }
4394 else
4395 {
4396 //11g is associated to an AP operating in 11n mode.
4397 //Change the HT operating mode to 'mixed mode'.
4398 psessionEntry->gLim11gParams.protectionEnabled = true;
4399 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4400 {
4401 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4402 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304403 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 }
4405 }
4406 }
4407
4408 //This part is common for staiton as well.
4409 if(false == psessionEntry->beaconParams.llgCoexist)
4410 {
4411 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4412 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4413 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4415 {
4416 // As operating mode changed after G station assoc some way to update beacon
4417 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4418 //pMac->sch.schObject.fBeaconChanged = 1;
4419 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4420 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 }
4422 else if (true == psessionEntry->beaconParams.llgCoexist)
4423 {
4424 //for AP role.
4425 //we need to take care of HT OP mode change if needed.
4426 //We need to take care of Overlap cases.
4427
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4429 {
4430 if(overlap)
4431 {
4432 //Overlap Legacy protection disabled.
4433 if (psessionEntry->gLim11gParams.numSta == 0)
4434 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4435
4436 // no HT op mode change if any of the overlap protection enabled.
4437 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4438 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4439 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4440 {
4441 //Check if there is a need to change HT OP mode.
4442 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4443 {
4444 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4445 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4446
4447 if(psessionEntry->gLimHt20Params.protectionEnabled){
4448 //Commenting because of CR 258588 WFA cert
4449 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4450 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4451 }
4452 else
4453 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4454 }
4455 }
4456 }
4457 else
4458 {
4459 //Disable protection from 11G stations.
4460 psessionEntry->gLim11gParams.protectionEnabled = false;
4461 //Check if any other non-HT protection enabled.
4462 if(!psessionEntry->gLim11bParams.protectionEnabled)
4463 {
4464
4465 //Right now we are in HT OP Mixed mode.
4466 //Change HT op mode appropriately.
4467 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4468
4469 //Change HT OP mode to 01 if any overlap protection enabled
4470 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4471 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4472 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4473 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4474
4475 {
4476 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4477 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4478 }
4479 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4480 {
4481 //Commenting because of CR 258588 WFA cert
4482 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4483 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4484 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4485 }
4486 else
4487 {
4488 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4489 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4490 }
4491 }
4492 }
4493 if(!psessionEntry->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 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 {
4502 if(overlap)
4503 {
4504 //Overlap Legacy protection disabled.
4505 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4506
4507 // no HT op mode change if any of the overlap protection enabled.
4508 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4509 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4510 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4511 {
4512 //Check if there is a need to change HT OP mode.
4513 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4514 {
4515 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4516 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4517
4518 if(psessionEntry->gLimHt20Params.protectionEnabled)
4519 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4520 else
4521 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4522 }
4523 }
4524 }
4525 else
4526 {
4527 //Disable protection from 11G stations.
4528 psessionEntry->gLim11gParams.protectionEnabled = false;
4529 //Check if any other non-HT protection enabled.
4530 if(!psessionEntry->gLim11bParams.protectionEnabled)
4531 {
4532
4533 //Right now we are in HT OP Mixed mode.
4534 //Change HT op mode appropriately.
4535 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4536
4537 //Change HT OP mode to 01 if any overlap protection enabled
4538 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4539 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4540 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4541 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4542
4543 {
4544 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4545 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4546 }
4547 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4548 {
4549 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4550 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4551 }
4552 else
4553 {
4554 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4555 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4556 }
4557 }
4558 }
4559 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4560 !psessionEntry->gLim11gParams.protectionEnabled)
4561 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004562 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4564 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4565 }
4566 }
4567 //for station role
4568 else
4569 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004570 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4572 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4573 }
4574 }
4575 return eSIR_SUCCESS;
4576}
4577//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4578//This check will be done at the caller.
4579
4580/** -------------------------------------------------------------
4581\fn limEnableHtObssProtection
4582\brief based on cofig enables\disables obss protection.
4583\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4584\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4585\param tpUpdateBeaconParams pBeaconParams
4586\return None
4587 -------------------------------------------------------------*/
4588tSirRetStatus
4589limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4590 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4591{
4592
4593
Jeff Johnsone7245742012-09-05 17:12:55 -07004594 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 return eSIR_SUCCESS; // this protection is only for HT stations.
4596
4597 //overlapping protection configuration check.
4598 if(overlap)
4599 {
4600 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004601 }
4602 else
4603 {
4604 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4606 { //ToDo Update this field
4607 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004608 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004609 return eSIR_SUCCESS;
4610 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 {
4612 if(!pMac->lim.cfgProtection.obss)
4613 { //ToDo Update this field
4614 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004615 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 return eSIR_SUCCESS;
4617 }
4618 }
4619 }
4620
4621
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4623 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4624 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004625 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 psessionEntry->beaconParams.gHTObssMode = true;
4627 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4628
4629 }
4630 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4631 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004632 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 psessionEntry->beaconParams.gHTObssMode = false;
4634 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4635
4636 }
4637//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4638 if (!enable && !overlap)
4639 {
4640 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4641 }
4642 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 {
4644 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4645 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004646 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 psessionEntry->beaconParams.gHTObssMode = true;
4648 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4649
4650 }
4651 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4652 {
4653
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004654 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004655 psessionEntry->beaconParams.gHTObssMode = false;
4656 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4657
4658 }
4659 }
4660 return eSIR_SUCCESS;
4661}
4662/** -------------------------------------------------------------
4663\fn limEnableHT20Protection
4664\brief based on cofig enables\disables protection from Ht20.
4665\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4666\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4667\param tpUpdateBeaconParams pBeaconParams
4668\return None
4669 -------------------------------------------------------------*/
4670tSirRetStatus
4671limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4672 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4673{
Jeff Johnsone7245742012-09-05 17:12:55 -07004674 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004675 return eSIR_SUCCESS; // this protection is only for HT stations.
4676
4677 //overlapping protection configuration check.
4678 if(overlap)
4679 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 }
4681 else
4682 {
4683 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4685 !psessionEntry->cfgProtection.ht20)
4686 {
4687 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004688 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 return eSIR_SUCCESS;
4690 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 {
4692 if(!pMac->lim.cfgProtection.ht20)
4693 {
4694 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004695 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 return eSIR_SUCCESS;
4697 }
4698 }
4699 }
4700
4701 if (enable)
4702 {
4703 //If we are AP and HT capable, we need to set the HT OP mode
4704 //appropriately.
4705
Jeff Johnson295189b2012-06-20 16:38:30 -07004706 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4707 if(overlap)
4708 {
4709 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4710 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4711 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4712 {
4713 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4714 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4715 }
4716 }
4717 else
4718 {
4719 psessionEntry->gLimHt20Params.protectionEnabled = true;
4720 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4721 {
4722 //Commenting because of CR 258588 WFA cert
4723 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4724 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4725 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4726 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 }
4728 }
4729 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 {
4731 if(overlap)
4732 {
4733 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4734 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4735 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4736 {
4737 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4738 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4739 }
4740 }
4741 else
4742 {
4743 psessionEntry->gLimHt20Params.protectionEnabled = true;
4744 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4745 {
4746 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4747 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4748 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4749 }
4750 }
4751 }
4752
4753 //This part is common for staiton as well.
4754 if(false == psessionEntry->beaconParams.ht20Coexist)
4755 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004756 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4758 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4759 }
4760 }
4761 else if (true == psessionEntry->beaconParams.ht20Coexist)
4762 {
4763 //for AP role.
4764 //we need to take care of HT OP mode change if needed.
4765 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4767 if(overlap)
4768 {
4769 //Overlap Legacy protection disabled.
4770 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4771
4772 // no HT op mode change if any of the overlap protection enabled.
4773 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4774 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4775 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4776 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4777 {
4778
4779 //Check if there is a need to change HT OP mode.
4780 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4781 {
4782 if(psessionEntry->gLimHt20Params.protectionEnabled)
4783 {
4784 //Commented beacuse of CR 258588 for WFA Cert
4785 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4786 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4787 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4788 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4789 }
4790 else
4791 {
4792 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4793 }
4794 }
4795 }
4796 }
4797 else
4798 {
4799 //Disable protection from 11G stations.
4800 psessionEntry->gLimHt20Params.protectionEnabled = false;
4801
4802 //Change HT op mode appropriately.
4803 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4804 {
4805 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4806 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4807 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4808 }
4809 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004810 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4812 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4813 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 {
4815 if(overlap)
4816 {
4817 //Overlap Legacy protection disabled.
4818 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4819
4820 // no HT op mode change if any of the overlap protection enabled.
4821 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4822 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4823 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4824 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4825 {
4826
4827 //Check if there is a need to change HT OP mode.
4828 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4829 {
4830 if(psessionEntry->gLimHt20Params.protectionEnabled)
4831 {
4832 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4833 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4834 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4835 }
4836 else
4837 {
4838 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4839 }
4840 }
4841 }
4842 }
4843 else
4844 {
4845 //Disable protection from 11G stations.
4846 psessionEntry->gLimHt20Params.protectionEnabled = false;
4847
4848 //Change HT op mode appropriately.
4849 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4850 {
4851 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4852 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4853 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4854 }
4855 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004856 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4858 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4859 }
4860 //for station role
4861 else
4862 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004863 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4865 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4866 }
4867 }
4868
4869 return eSIR_SUCCESS;
4870}
4871
4872/** -------------------------------------------------------------
4873\fn limEnableHTNonGfProtection
4874\brief based on cofig enables\disables protection from NonGf.
4875\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4876\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4877\param tpUpdateBeaconParams pBeaconParams
4878\return None
4879 -------------------------------------------------------------*/
4880tSirRetStatus
4881limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4882 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4883{
Jeff Johnsone7245742012-09-05 17:12:55 -07004884 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 return eSIR_SUCCESS; // this protection is only for HT stations.
4886
4887 //overlapping protection configuration check.
4888 if(overlap)
4889 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004890 }
4891 else
4892 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004893 //normal protection config check
4894 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4895 !psessionEntry->cfgProtection.nonGf)
4896 {
4897 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004898 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004899 return eSIR_SUCCESS;
4900 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 {
4902 //normal protection config check
4903 if(!pMac->lim.cfgProtection.nonGf)
4904 {
4905 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004906 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004907 return eSIR_SUCCESS;
4908 }
4909 }
4910 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4912 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4913 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004914 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004915 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4916 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4917 }
4918 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4919 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004920 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4922 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4923 }
4924 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 {
4926 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4927 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004928 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004929 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4930 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4931 }
4932 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004934 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4936 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4937 }
4938 }
4939
4940 return eSIR_SUCCESS;
4941}
4942
4943/** -------------------------------------------------------------
4944\fn limEnableHTLsigTxopProtection
4945\brief based on cofig enables\disables LsigTxop protection.
4946\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4947\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4948\param tpUpdateBeaconParams pBeaconParams
4949\return None
4950 -------------------------------------------------------------*/
4951tSirRetStatus
4952limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4953 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4954{
Jeff Johnsone7245742012-09-05 17:12:55 -07004955 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004956 return eSIR_SUCCESS; // this protection is only for HT stations.
4957
4958 //overlapping protection configuration check.
4959 if(overlap)
4960 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 }
4962 else
4963 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 //normal protection config check
4965 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4966 !psessionEntry->cfgProtection.lsigTxop)
4967 {
4968 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004969 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 return eSIR_SUCCESS;
4971 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004972 {
4973 //normal protection config check
4974 if(!pMac->lim.cfgProtection.lsigTxop)
4975 {
4976 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 return eSIR_SUCCESS;
4979 }
4980 }
4981 }
4982
4983
Jeff Johnson295189b2012-06-20 16:38:30 -07004984 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4985 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4986 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004987 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004988 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4989 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4990 }
4991 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4992 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004993 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4995 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4996 }
4997 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004998 {
4999 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5000 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005001 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5003 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5004 }
5005 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5006 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005007 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5009 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5010 }
5011 }
5012 return eSIR_SUCCESS;
5013}
5014//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5015//This check will be done at the caller.
5016/** -------------------------------------------------------------
5017\fn limEnableHtRifsProtection
5018\brief based on cofig enables\disables Rifs protection.
5019\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5020\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5021\param tpUpdateBeaconParams pBeaconParams
5022\return None
5023 -------------------------------------------------------------*/
5024tSirRetStatus
5025limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5026 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5027{
Jeff Johnsone7245742012-09-05 17:12:55 -07005028 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 return eSIR_SUCCESS; // this protection is only for HT stations.
5030
5031
5032 //overlapping protection configuration check.
5033 if(overlap)
5034 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 }
5036 else
5037 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 //normal protection config check
5039 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5040 !psessionEntry->cfgProtection.rifs)
5041 {
5042 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005043 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005044 return eSIR_SUCCESS;
5045 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005046 {
5047 //normal protection config check
5048 if(!pMac->lim.cfgProtection.rifs)
5049 {
5050 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005051 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 return eSIR_SUCCESS;
5053 }
5054 }
5055 }
5056
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5058 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5059 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5060 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005061 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005062 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5063 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5064 }
5065 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5066 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5067 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005068 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005069 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5070 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5071 }
5072 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005073 {
5074 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5075 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5076 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005077 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5079 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5080 }
5081 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5082 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5083 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005084 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5086 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5087 }
5088 }
5089 return eSIR_SUCCESS;
5090}
5091
5092// ---------------------------------------------------------------------
5093/**
5094 * limEnableShortPreamble
5095 *
5096 * FUNCTION:
5097 * Enable/Disable short preamble
5098 *
5099 * LOGIC:
5100 *
5101 * ASSUMPTIONS:
5102 *
5103 * NOTE:
5104 *
5105 * @param enable Flag to enable/disable short preamble
5106 * @return None
5107 */
5108
5109tSirRetStatus
5110limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5111{
5112 tANI_U32 val;
5113
5114 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5115 {
5116 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005117 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005118 return eSIR_FAILURE;
5119 }
5120
5121 if (!val)
5122 return eSIR_SUCCESS;
5123
5124 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5125 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005126 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005127 return eSIR_FAILURE;
5128 }
5129
5130 if (!val) // 11G short preamble switching is disabled.
5131 return eSIR_SUCCESS;
5132
5133 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5134 {
5135 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5136 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005137 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 psessionEntry->beaconParams.fShortPreamble = true;
5139 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5140 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5141 }
5142 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5143 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005144 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 psessionEntry->beaconParams.fShortPreamble = false;
5146 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5147 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5148 }
5149 }
5150
5151 return eSIR_SUCCESS;
5152 }
5153
5154/**
5155 * limTxComplete
5156 *
5157 * Function:
5158 * This is LIM's very own "TX MGMT frame complete" completion routine.
5159 *
5160 * Logic:
5161 * LIM wants to send a MGMT frame (broadcast or unicast)
5162 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5163 * LIM transmits the MGMT frame using the API:
5164 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5165 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5166 * HDD, if it determines that a TX completion routine (in this case
5167 * limTxComplete) has been provided, will invoke this callback
5168 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5169 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5170 *
5171 * Assumptions:
5172 * Presently, this is ONLY being used for MGMT frames/packets
5173 * TODO:
5174 * Would it do good for LIM to have some sort of "signature" validation to
5175 * ensure that the pData argument passed in was a buffer that was actually
5176 * allocated by LIM and/or is not corrupted?
5177 *
5178 * Note: FIXME and TODO
5179 * Looks like palPktFree() is interested in pPacket. But, when this completion
5180 * routine is called, only pData is made available to LIM!!
5181 *
5182 * @param void A pointer to pData. Shouldn't it be pPacket?!
5183 *
5184 * @return none
5185 */
5186void limTxComplete( tHalHandle hHal, void *pData )
5187{
5188 tpAniSirGlobal pMac;
5189 pMac = (tpAniSirGlobal)hHal;
5190
5191#ifdef FIXME_PRIMA
5192 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5193#ifdef TRACE_RECORD
5194 {
5195 tpSirMacMgmtHdr mHdr;
5196 v_U8_t *pRxBd;
5197 vos_pkt_t *pVosPkt;
5198 VOS_STATUS vosStatus;
5199
5200
5201
5202 pVosPkt = (vos_pkt_t *)pData;
5203 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5204
5205 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5206 {
5207 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005208
5209 }
5210 }
5211#endif
5212#endif
5213
5214 palPktFree( pMac->hHdd,
5215 HAL_TXRX_FRM_802_11_MGMT,
5216 (void *) NULL, // this is ignored and will likely be removed from this API
5217 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5218}
5219
5220/**
5221 * \brief This function updates lim global structure, if CB parameters in the BSS
5222 * have changed, and sends an indication to HAL also with the
5223 * updated HT Parameters.
5224 * This function does not detect the change in the primary channel, that is done as part
5225 * of channel Swtich IE processing.
5226 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5227 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5228 *
5229 *
5230 * \param pMac Pointer to global MAC structure
5231 *
5232 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5233 * Probe Response
5234 *
5235 * \param bssIdx BSS Index of the Bss to which Station is associated.
5236 *
5237 *
5238 */
5239
5240void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5241 tDot11fIEHTInfo *pHTInfo,
5242 tANI_U8 bssIdx,
5243 tpPESession psessionEntry)
5244{
Jeff Johnsone7245742012-09-05 17:12:55 -07005245 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005246#if !defined WLAN_FEATURE_VOWIFI
5247 tANI_U32 localPwrConstraint;
5248#endif
5249
5250 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005251 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005252 return;
5253
Abhishek Singhe3beee22017-07-31 15:35:40 +05305254 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5255 psessionEntry->force_24ghz_in_ht20) {
5256 limLog(pMac, LOG1,
5257 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5258 return;
5259 }
5260
Jeff Johnson295189b2012-06-20 16:38:30 -07005261#if !defined WLAN_FEATURE_VOWIFI
5262 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005263 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005264 return;
5265 }
5266#endif
5267
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305268 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5269 {
5270 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5271 return;
5272 }
5273
Mihir Shetebc160b72014-08-22 14:10:39 +05305274 /*
5275 * Do not try to switch channel if RoC is in progress. RoC code path uses
5276 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5277 * has started listening on the channel requested as part of RoC, if we set
5278 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5279 * upper layers will think that the channel change is not successful and the
5280 * RoC from the upper layer perspective will never end...
5281 */
5282 if (pMac->lim.gpLimRemainOnChanReq)
5283 {
5284 limLog( pMac, LOGE, FL( "RoC is in progress"));
5285 return;
5286 }
5287
Jeff Johnsone7245742012-09-05 17:12:55 -07005288 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5289 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005290 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005291 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5292 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5293 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5294 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005295
5296 // Notify HAL
5297 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005298 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005299 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005300 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005301 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005302 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005303 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5304 pMac->lim.gpchangeChannelCallback = NULL;
5305 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005306
5307#if defined WLAN_FEATURE_VOWIFI
5308 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5309 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5310#else
5311 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5312 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5313#endif
5314
5315 //In case of IBSS, if STA should update HT Info IE in its beacons.
5316 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5317 {
5318 schSetFixedBeaconFields(pMac,psessionEntry);
5319 }
5320
5321 }
5322} // End limUpdateStaRunTimeHTParams.
5323
5324/**
5325 * \brief This function updates the lim global structure, if any of the
5326 * HT Capabilities have changed.
5327 *
5328 *
5329 * \param pMac Pointer to Global MAC structure
5330 *
5331 * \param pHTCapability Pointer to HT Capability Information Element
5332 * obtained from a Beacon or Probe Response
5333 *
5334 *
5335 *
5336 */
5337
5338void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5339 tDot11fIEHTCaps *pHTCaps )
5340{
5341
5342 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5343 {
5344 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5345 // Send change notification to HAL
5346 }
5347
5348 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5349 {
5350 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5351 // Send change notification to HAL
5352 }
5353
5354 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5355 {
5356 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5357 // Send change notification to HAL
5358 }
5359
5360
5361} // End limUpdateStaRunTimeHTCapability.
5362
5363/**
5364 * \brief This function updates lim global structure, if any of the HT
5365 * Info Parameters have changed.
5366 *
5367 *
5368 * \param pMac Pointer to the global MAC structure
5369 *
5370 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5371 * Probe Response
5372 *
5373 *
5374 */
5375
5376void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305377 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005378{
Jeff Johnsone7245742012-09-05 17:12:55 -07005379 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005380 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005381 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005382 // Send change notification to HAL
5383 }
5384
5385 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5386 {
5387 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5388 // Send change notification to HAL
5389 }
5390
5391 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5392 {
5393 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5394 // Send change notification to HAL
5395 }
5396
5397 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5398 {
5399 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5400 // Send change notification to HAL
5401 }
5402
5403 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5404 {
5405 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5406 }
5407
5408 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5409 {
5410 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5411 // Send change notification to HAL
5412 }
5413
5414 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5415 {
5416 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5417 // Send change notification to HAL
5418 }
5419
5420 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5421 {
5422 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5423 // Send change notification to HAL
5424 }
5425
5426 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5427 {
5428 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5429 // Send change notification to HAL
5430 }
5431
5432 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5433 {
5434 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5435 // Send change notification to HAL
5436 }
5437
5438 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5439 {
5440 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5441 // Send change notification to HAL
5442 }
5443
5444} // End limUpdateStaRunTimeHTInfo.
5445
5446
5447/** -------------------------------------------------------------
5448\fn limProcessHalIndMessages
5449\brief callback function for HAL indication
5450\param tpAniSirGlobal pMac
5451\param tANI_U32 mesgId
5452\param void *mesgParam
5453\return tSirRetStatu - status
5454 -------------------------------------------------------------*/
5455
5456tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5457{
5458 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5459 tSirMsgQ msg;
5460
5461 switch(msgId)
5462 {
5463 case SIR_LIM_DEL_TS_IND:
5464 case SIR_LIM_ADD_BA_IND:
5465 case SIR_LIM_DEL_BA_ALL_IND:
5466 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5467 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305468 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 msg.type = (tANI_U16) msgId;
5470 msg.bodyptr = msgParam;
5471 msg.bodyval = 0;
5472 break;
5473
5474 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305475 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005476 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005477 return eSIR_FAILURE;
5478 }
5479
5480 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5481 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305482 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5484 return eSIR_FAILURE;
5485 }
5486 return eSIR_SUCCESS;
5487}
5488
5489/** -------------------------------------------------------------
5490\fn limValidateDeltsReq
5491\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5492\param tpAniSirGlobal pMac
5493\param tpSirDeltsReq pDeltsReq
5494\param tSirMacAddr peerMacAddr
5495\return eSirRetStatus - status
5496 -------------------------------------------------------------*/
5497
5498tSirRetStatus
5499limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5500{
5501 tpDphHashNode pSta;
5502 tANI_U8 tsStatus;
5503 tSirMacTSInfo *tsinfo;
5504 tANI_U32 i;
5505 tANI_U8 tspecIdx;
5506 /* if sta
5507 * - verify assoc state
5508 * - del tspec locally
5509 * if ap,
5510 * - verify sta is in assoc state
5511 * - del sta tspec locally
5512 */
5513 if(pDeltsReq == NULL)
5514 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005515 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005516 return eSIR_FAILURE;
5517 }
5518
5519 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5520 {
5521 tANI_U32 val;
5522
5523 // station always talks to the AP
5524 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5525
5526 val = sizeof(tSirMacAddr);
5527 #if 0
5528 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5529 {
5530 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005531 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 return eSIR_FAILURE;
5533 }
5534 #endif// TO SUPPORT BT-AMP
5535 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5536
5537 }
5538 else
5539 {
5540 tANI_U16 assocId;
5541 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5542
5543 assocId = pDeltsReq->aid;
5544 if (assocId != 0)
5545 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5546 else
5547 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5548
5549 if (pSta != NULL)
5550 // TBD: check sta assoc state as well
5551 for (i =0; i < sizeof(tSirMacAddr); i++)
5552 macaddr[i] = pSta->staAddr[i];
5553 }
5554
5555 if (pSta == NULL)
5556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005557 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 return eSIR_FAILURE;
5559 }
5560
5561 if ((! pSta->valid) ||
5562 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5563 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005564 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005565 return eSIR_FAILURE;
5566 }
5567
5568 pDeltsReq->req.wsmTspecPresent = 0;
5569 pDeltsReq->req.wmeTspecPresent = 0;
5570 pDeltsReq->req.lleTspecPresent = 0;
5571
5572 if ((pSta->wsmEnabled) &&
5573 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5574 pDeltsReq->req.wsmTspecPresent = 1;
5575 else if (pSta->wmeEnabled)
5576 pDeltsReq->req.wmeTspecPresent = 1;
5577 else if (pSta->lleEnabled)
5578 pDeltsReq->req.lleTspecPresent = 1;
5579 else
5580 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005581 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 return eSIR_FAILURE;
5583 }
5584
5585 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5586 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305587 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005588 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305590 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005591
5592 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005593
5594 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5595 != eSIR_SUCCESS)
5596 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005597 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005598 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5599 return eSIR_FAILURE;
5600 }
5601 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5602 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5603 {
5604 //edca only now.
5605 }
5606 else
5607 {
5608 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5609 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5610 {
5611 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305612 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5613 pSta->staIndex,
5614 tspecIdx,
5615 pDeltsReq->req,
5616 psessionEntry->peSessionId,
5617 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005618 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005619 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005620 tsinfo->traffic.userPrio);
5621 return eSIR_FAILURE;
5622 }
5623 }
5624 }
5625 return eSIR_SUCCESS;
5626}
5627
5628/** -------------------------------------------------------------
5629\fn limRegisterHalIndCallBack
5630\brief registers callback function to HAL for any indication.
5631\param tpAniSirGlobal pMac
5632\return none.
5633 -------------------------------------------------------------*/
5634void
5635limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5636{
5637 tSirMsgQ msg;
5638 tpHalIndCB pHalCB;
5639
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305640 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5641 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005642 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305643 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 return;
5645 }
5646
5647 pHalCB->pHalIndCB = limProcessHalIndMessages;
5648
5649 msg.type = WDA_REGISTER_PE_CALLBACK;
5650 msg.bodyptr = pHalCB;
5651 msg.bodyval = 0;
5652
Jeff Johnsone7245742012-09-05 17:12:55 -07005653 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005654 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5655 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305656 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005657 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005658 }
5659
5660 return;
5661}
5662
5663
5664/** -------------------------------------------------------------
5665\fn limProcessAddBaInd
5666
5667\brief handles the BA activity check timeout indication coming from HAL.
5668 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5669\param tpAniSirGlobal pMac
5670\param tSirMsgQ limMsg
5671\return None
5672-------------------------------------------------------------*/
5673void
5674limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5675{
5676 tANI_U8 i;
5677 tANI_U8 tid;
5678 tANI_U16 assocId;
5679 tpDphHashNode pSta;
5680 tpAddBaCandidate pBaCandidate;
5681 tANI_U32 baCandidateCnt;
5682 tpBaActivityInd pBaActivityInd;
5683 tpPESession psessionEntry;
5684 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005685#ifdef FEATURE_WLAN_TDLS
5686 boolean htCapable = FALSE;
5687#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005688
5689
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005690 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005691 return;
5692
5693 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5694 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5695
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005696 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005697 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005698 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305699 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005700 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005701 return;
5702 }
5703
5704 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005705#ifdef FEATURE_WLAN_TDLS
5706 if ((baCandidateCnt > pMac->lim.maxStation))
5707#else
5708 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5709#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305711 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005712 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 return;
5714 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005715
5716#ifdef FEATURE_WLAN_TDLS
5717 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5718 //AP capability
5719 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5720
5721 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5722 {
5723 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5724 if ((NULL == pSta) || (!pSta->valid))
5725 continue;
5726
5727 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5728 htCapable = pSta->mlmStaContext.htCapability;
5729 else
5730 htCapable = psessionEntry->htCapability;
5731
5732 if (htCapable)
5733 break;
5734 }
5735 if (!htCapable)
5736 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305737 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005738 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005739 return;
5740 }
5741#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005742
5743 //delete the complete dialoguetoken linked list
5744 limDeleteDialogueTokenList(pMac);
5745 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5746
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005747 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005748 {
5749 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005750 if ((NULL == pSta) || (!pSta->valid))
5751 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005752
5753 for (tid=0; tid<STACFG_MAX_TC; tid++)
5754 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005755 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005756 (pBaCandidate->baInfo[tid].fBaEnable))
5757 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305758 limLog(pMac, LOG1,
5759 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5760 pSta->staIndex, tid,
5761 pBaCandidate->baInfo[tid].startingSeqNum);
5762 limPostMlmAddBAReq(pMac, pSta, tid,
5763 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005764 }
5765 }
5766 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305767 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005768 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 return;
5770}
5771
5772
5773/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005774\fn limDeleteBASessions
5775\brief Deletes all the exisitng BA sessions for given session
5776 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005777\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005778\param tpPESession pSessionEntry
5779\param tANI_U32 baDirection
5780\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005781-------------------------------------------------------------*/
5782
5783void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005784limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305785 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005786{
5787 tANI_U32 i;
5788 tANI_U8 tid;
5789 tpDphHashNode pSta;
5790
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005791 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005793 limLog(pMac, LOGE, FL("Session does not exist"));
5794 }
5795 else
5796 {
5797 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005798 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005799 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5800 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5801 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5802 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005803 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005804 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005805 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005806 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5807 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005808 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005809 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5810 (baDirection & BA_INITIATOR))
5811 {
5812 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305813 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005814 pSessionEntry);
5815 }
5816 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5817 (baDirection & BA_RECIPIENT))
5818 {
5819 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305820 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005821 pSessionEntry);
5822 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005823 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005824 }
5825 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005826 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5827 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5828 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005829 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005830 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5831 &pSessionEntry->dph.dphHashTable);
5832 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005833 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005834 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5835 (baDirection & BA_INITIATOR))
5836 {
5837 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305838 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005839 pSessionEntry);
5840 }
5841 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5842 (baDirection & BA_RECIPIENT))
5843 {
5844 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305845 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005846 pSessionEntry);
5847 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005848 }
5849 }
5850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 }
5852}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005853
5854/** -------------------------------------------------------------
5855\fn limDelAllBASessions
5856\brief Deletes all the exisitng BA sessions.
5857\param tpAniSirGlobal pMac
5858\return None
5859-------------------------------------------------------------*/
5860
5861void limDelAllBASessions(tpAniSirGlobal pMac)
5862{
5863 tANI_U32 i;
5864 tpPESession pSessionEntry;
5865
5866 for (i = 0; i < pMac->lim.maxBssId; i++)
5867 {
5868 pSessionEntry = peFindSessionBySessionId(pMac, i);
5869 if (pSessionEntry)
5870 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305871 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5872 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005873 }
5874 }
5875}
5876
5877/** -------------------------------------------------------------
5878\fn limDelAllBASessionsBtc
5879\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5880 band.
5881\param tpAniSirGlobal pMac
5882\return None
5883-------------------------------------------------------------*/
5884
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005885void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005886{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005887 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005888 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005889 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5890 &sessionId);
5891 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005892 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005893 PELOGW(limLog(pMac, LOGW,
5894 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305895 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305896 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005897 }
5898}
5899
Jeff Johnson295189b2012-06-20 16:38:30 -07005900/** -------------------------------------------------------------
5901\fn limProcessDelTsInd
5902\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5903 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5904\param tpAniSirGlobal pMac
5905\param tSirMsgQ limMsg
5906\return None
5907-------------------------------------------------------------*/
5908void
5909limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5910{
5911 tpDphHashNode pSta;
5912 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5913 tpSirDeltsReq pDelTsReq = NULL;
5914 tSirMacAddr peerMacAddr;
5915 tpSirDeltsReqInfo pDelTsReqInfo;
5916 tpLimTspecInfo pTspecInfo;
5917 tpPESession psessionEntry;
5918 tANI_U8 sessionId;
5919
5920if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5921 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005922 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305923 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005924 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 return;
5926 }
5927
5928 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5929 if(pTspecInfo->inuse == false)
5930 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005931 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 goto error1;
5933 }
5934
5935 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5936 if(pSta == NULL)
5937 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005938 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005939 pTspecInfo->assocId);
5940 goto error1;
5941 }
5942
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305943 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5944 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 goto error1;
5948 }
5949
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305950 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005951
5952 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305953 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005954 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305955 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005956
5957
5958 //validate the req
5959 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5960 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005961 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 goto error2;
5963 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305964 limLog(pMac, LOG1, "Sent DELTS request to station with "
5965 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5966 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005967
5968 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5969 psessionEntry);
5970
5971 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305972 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5973 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305975 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 goto error3;
5977 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305978 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005979
5980 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305981 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305983 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005984
5985 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5986
5987error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305988 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005989error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305990 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005991error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305992 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005993 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 return;
5995}
5996
5997/**
5998 * \brief Setup an A-MPDU/BA session
5999 *
6000 * \sa limPostMlmAddBAReq
6001 *
6002 * \param pMac The global tpAniSirGlobal object
6003 *
6004 * \param pStaDs DPH Hash Node object of peer STA
6005 *
6006 * \param tid TID for which a BA is being setup.
6007 * If this is set to 0xFFFF, then we retrieve
6008 * the default TID from the CFG
6009 *
6010 * \return eSIR_SUCCESS if setup completes successfully
6011 * eSIR_FAILURE is some problem is encountered
6012 */
6013tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6014 tpDphHashNode pStaDs,
6015 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6016{
6017 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006018 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 tpDialogueToken dialogueTokenNode;
6020 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006021
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 // Check if the peer is a 11n capable STA
6023 // FIXME - Need a 11n peer indication in DPH.
6024 // For now, using the taurusPeer attribute
6025 //if( 0 == pStaDs->taurusPeer == )
6026 //return eSIR_SUCCESS;
6027
6028 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306029 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6030 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006031 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306032 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006033 status = eSIR_MEM_ALLOC_FAILED;
6034 goto returnFailure;
6035 }
6036
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306037 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006038
6039 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306040 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006041 pMlmAddBAReq->peerMacAddr,
6042 pStaDs->staAddr,
6043 sizeof( tSirMacAddr ));
6044
6045 // Update the TID
6046 pMlmAddBAReq->baTID = tid;
6047
6048 // Determine the supported BA policy of local STA
6049 // for the TID of interest
6050 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6051
6052 // BA Buffer Size
6053 // Requesting the ADDBA recipient to populate the size.
6054 // If ADDBA is accepted, a non-zero buffer size should
6055 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306056 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6057 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6058 {
6059 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6060 causing very low throughput in HT40 case */
6061 limLog( pMac, LOGW,
6062 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6063 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6064 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306065 else if (pMac->miracastVendorConfig)
6066 {
6067 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6068 {
6069 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6070 status = eSIR_FAILURE;
6071 goto returnFailure;
6072 }
6073
6074 pMlmAddBAReq->baBufferSize = val;
6075 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306076 else
6077 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006078
6079 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306080 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d buff = %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006081 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6082 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306083 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006084
6085 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006086 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006087 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006088 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 status = eSIR_FAILURE;
6090 goto returnFailure;
6091 }
6092 pMlmAddBAReq->baTimeout = val; // In TU's
6093
6094 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006095 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006096 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6097 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6098
6099 // BA Starting Sequence Number
6100 pMlmAddBAReq->baSSN = startingSeqNum;
6101
6102 /* Update PE session Id*/
6103 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6104
6105 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6106
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006107 dialogueTokenNode = limAssignDialogueToken(pMac);
6108 if (NULL == dialogueTokenNode)
6109 {
6110 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6111 status = eSIR_FAILURE;
6112 goto returnFailure;
6113 }
6114
Jeff Johnson295189b2012-06-20 16:38:30 -07006115 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006116 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006117 dialogueTokenNode->assocId = pStaDs->assocId;
6118 dialogueTokenNode->tid = tid;
6119 // Send ADDBA Req to MLME
6120 limPostMlmMessage( pMac,
6121 LIM_MLM_ADDBA_REQ,
6122 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006123 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006124
6125returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306126 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006127 return status;
6128}
6129
6130/**
6131 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6132 * will then send an ADDBA Rsp to peer MAC entity
6133 * with the appropriate ADDBA status code
6134 *
6135 * \sa limPostMlmAddBARsp
6136 *
6137 * \param pMac The global tpAniSirGlobal object
6138 *
6139 * \param peerMacAddr MAC address of peer entity that will
6140 * be the recipient of this ADDBA Rsp
6141 *
6142 * \param baStatusCode ADDBA Rsp status code
6143 *
6144 * \param baDialogToken ADDBA Rsp dialog token
6145 *
6146 * \param baTID TID of interest
6147 *
6148 * \param baPolicy The BA policy
6149 *
6150 * \param baBufferSize The BA buffer size
6151 *
6152 * \param baTimeout BA timeout in TU's
6153 *
6154 * \return eSIR_SUCCESS if setup completes successfully
6155 * eSIR_FAILURE is some problem is encountered
6156 */
6157tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6158 tSirMacAddr peerMacAddr,
6159 tSirMacStatusCodes baStatusCode,
6160 tANI_U8 baDialogToken,
6161 tANI_U8 baTID,
6162 tANI_U8 baPolicy,
6163 tANI_U16 baBufferSize,
6164 tANI_U16 baTimeout,
6165 tpPESession psessionEntry)
6166{
6167tSirRetStatus status = eSIR_SUCCESS;
6168tpLimMlmAddBARsp pMlmAddBARsp;
6169
6170 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306171 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6172 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006173 {
6174 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306175 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 status );
6177
6178 status = eSIR_MEM_ALLOC_FAILED;
6179 goto returnFailure;
6180 }
6181
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306182 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006183
6184 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306185 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006186 pMlmAddBARsp->peerMacAddr,
6187 peerMacAddr,
6188 sizeof( tSirMacAddr ));
6189
6190 pMlmAddBARsp->baDialogToken = baDialogToken;
6191 pMlmAddBARsp->addBAResultCode = baStatusCode;
6192 pMlmAddBARsp->baTID = baTID;
6193 pMlmAddBARsp->baPolicy = baPolicy;
6194 pMlmAddBARsp->baBufferSize = baBufferSize;
6195 pMlmAddBARsp->baTimeout = baTimeout;
6196
6197 /* UPdate PE session ID*/
6198 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6199
6200 // Send ADDBA Rsp to MLME
6201 limPostMlmMessage( pMac,
6202 LIM_MLM_ADDBA_RSP,
6203 (tANI_U32 *) pMlmAddBARsp );
6204
6205returnFailure:
6206
6207 return status;
6208}
6209
6210/**
6211 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6212 * will then send an DELBA Ind to peer MAC entity
6213 * with the appropriate DELBA status code
6214 *
6215 * \sa limPostMlmDelBAReq
6216 *
6217 * \param pMac The global tpAniSirGlobal object
6218 *
6219 * \param pSta DPH Hash Node object of peer MAC entity
6220 * for which the BA session is being deleted
6221 *
6222 * \param baDirection DELBA direction
6223 *
6224 * \param baTID TID for which the BA session is being deleted
6225 *
6226 * \param baReasonCode DELBA Req reason code
6227 *
6228 * \return eSIR_SUCCESS if setup completes successfully
6229 * eSIR_FAILURE is some problem is encountered
6230 */
6231tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6232 tpDphHashNode pSta,
6233 tANI_U8 baDirection,
6234 tANI_U8 baTID,
6235 tSirMacReasonCodes baReasonCode,
6236 tpPESession psessionEntry)
6237{
6238tSirRetStatus status = eSIR_SUCCESS;
6239tpLimMlmDelBAReq pMlmDelBAReq;
6240tLimBAState curBaState;
6241
6242if(NULL == pSta)
6243 return eSIR_FAILURE;
6244
6245LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6246
6247 // Need to validate the current BA State.
6248 if( eLIM_BA_STATE_IDLE != curBaState)
6249 {
6250 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006251 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006252 baTID,
6253 curBaState);
6254
6255 status = eSIR_FAILURE;
6256 goto returnFailure;
6257 }
6258
6259 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306260 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6261 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 {
6263 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306264 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006265 status );
6266
6267 status = eSIR_MEM_ALLOC_FAILED;
6268 goto returnFailure;
6269 }
6270
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306271 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006272
6273 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306274 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006275 pMlmDelBAReq->peerMacAddr,
6276 pSta->staAddr,
6277 sizeof( tSirMacAddr ));
6278
6279 pMlmDelBAReq->baDirection = baDirection;
6280 pMlmDelBAReq->baTID = baTID;
6281 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6282
6283 /* Update PE session ID*/
6284 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6285
6286 //we don't have valid BA session for the given direction.
6287 // HDD wants to get the BA session deleted on PEER in this case.
6288 // in this case we just need to send DelBA to the peer.
6289 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6290 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6291 {
6292 // Send DELBA Ind over the air
6293 if( eSIR_SUCCESS !=
6294 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6295 status = eSIR_FAILURE;
6296
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306297 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006298 return status;
6299 }
6300
6301
6302 // Update the BA state in STA
6303 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6304
6305 // Send DELBA Req to MLME
6306 limPostMlmMessage( pMac,
6307 LIM_MLM_DELBA_REQ,
6308 (tANI_U32 *) pMlmDelBAReq );
6309
6310returnFailure:
6311
6312 return status;
6313}
6314
6315/**
6316 * \brief Send WDA_ADDBA_REQ to HAL, in order
6317 * to setup a new BA session with a peer
6318 *
6319 * \sa limPostMsgAddBAReq
6320 *
6321 * \param pMac The global tpAniSirGlobal object
6322 *
6323 * \param pSta Runtime, STA-related configuration cached
6324 * in the HashNode object
6325 *
6326 * \param baDialogToken The Action Frame dialog token
6327 *
6328 * \param baTID TID for which the BA session is being setup
6329 *
6330 * \param baPolicy BA Policy
6331 *
6332 * \param baBufferSize The requested BA buffer size
6333 *
6334 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6335 *
6336 * \param baSSN Starting Sequence Number for this BA session
6337 *
6338 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6339 *
6340 * \return none
6341 *
6342 */
6343tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6344 tpDphHashNode pSta,
6345 tANI_U8 baDialogToken,
6346 tANI_U8 baTID,
6347 tANI_U8 baPolicy,
6348 tANI_U16 baBufferSize,
6349 tANI_U16 baTimeout,
6350 tANI_U16 baSSN,
6351 tANI_U8 baDirection,
6352 tpPESession psessionEntry)
6353{
6354tpAddBAParams pAddBAParams = NULL;
6355tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006356tSirMsgQ msgQ;
6357
6358#ifdef WLAN_SOFTAP_VSTA_FEATURE
6359 // we can only do BA on "hard" STAs
6360 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6361 {
6362 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306363 limLog( pMac, LOGE,
6364 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006365 goto returnFailure;
6366 }
6367#endif //WLAN_SOFTAP_VSTA_FEATURE
6368
6369 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306370 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6371 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006372 {
6373 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306374 FL("AllocateMemory failed")
6375 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006376
6377 retCode = eSIR_MEM_ALLOC_FAILED;
6378 goto returnFailure;
6379 }
6380
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306381 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006382
6383 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306384 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006385 (void *) pAddBAParams->peerMacAddr,
6386 (void *) pSta->staAddr,
6387 sizeof( tSirMacAddr ));
6388
6389 // Populate the REQ parameters
6390 pAddBAParams->staIdx = pSta->staIndex;
6391 pAddBAParams->baDialogToken = baDialogToken;
6392 pAddBAParams->baTID = baTID;
6393 pAddBAParams->baPolicy = baPolicy;
6394 pAddBAParams->baBufferSize = baBufferSize;
6395 pAddBAParams->baTimeout = baTimeout;
6396 pAddBAParams->baSSN = baSSN;
6397 pAddBAParams->baDirection = baDirection;
6398 pAddBAParams->respReqd = 1;
6399
6400 /* UPdate PE session ID */
6401 pAddBAParams->sessionId = psessionEntry->peSessionId;
6402
6403 // Post WDA_ADDBA_REQ to HAL.
6404 msgQ.type = WDA_ADDBA_REQ;
6405 //
6406 // FIXME_AMPDU
6407 // A global counter (dialog token) is required to keep track of
6408 // all PE <-> HAL communication(s)
6409 //
6410 msgQ.reserved = 0;
6411 msgQ.bodyptr = pAddBAParams;
6412 msgQ.bodyval = 0;
6413
6414 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306415 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6416 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6417 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6418 pAddBAParams->baTimeout, pAddBAParams->baTID,
6419 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6420 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006421
6422 //defer any other message until we get response back.
6423 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6424
Jeff Johnsone7245742012-09-05 17:12:55 -07006425 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006426#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6427 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6428#endif //FEATURE_WLAN_DIAG_SUPPORT
6429
6430 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6431 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006432 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006433 retCode );
6434 else
6435 return retCode;
6436
6437returnFailure:
6438
6439 // Clean-up...
6440 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306441 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006442
6443 return retCode;
6444
6445}
6446
6447/**
6448 * \brief Send WDA_DELBA_IND to HAL, in order
6449 * to delete an existing BA session with peer
6450 *
6451 * \sa limPostMsgDelBAInd
6452 *
6453 * \param pMac The global tpAniSirGlobal object
6454 *
6455 * \param pSta Runtime, STA-related configuration cached
6456 * in the HashNode object
6457 *
6458 * \param baTID TID for which the BA session is being setup
6459 *
6460 * \param baDirection Identifies whether the DELBA Ind was
6461 * sent by the BA initiator or recipient
6462 *
6463 * \return none
6464 *
6465 */
6466tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6467 tpDphHashNode pSta,
6468 tANI_U8 baTID,
6469 tANI_U8 baDirection,
6470 tpPESession psessionEntry)
6471{
6472tpDelBAParams pDelBAParams = NULL;
6473tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006474tSirMsgQ msgQ;
6475
6476 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306477 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6478 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006479 {
6480 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306481 FL("AllocateMemory failed")
6482 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006483
6484 retCode = eSIR_MEM_ALLOC_FAILED;
6485 goto returnFailure;
6486 }
6487
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306488 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006489
6490 // Populate the REQ parameters
6491 pDelBAParams->staIdx = pSta->staIndex;
6492 pDelBAParams->baTID = baTID;
6493 pDelBAParams->baDirection = baDirection;
6494
6495 /* Update PE session ID */
6496
6497
6498 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6499 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6500
6501 // Post WDA_DELBA_IND to HAL.
6502 msgQ.type = WDA_DELBA_IND;
6503 //
6504 // FIXME:
6505 // A global counter (dialog token) is required to keep track of
6506 // all PE <-> HAL communication(s)
6507 //
6508 msgQ.reserved = 0;
6509 msgQ.bodyptr = pDelBAParams;
6510 msgQ.bodyval = 0;
6511
6512 limLog( pMac, LOGW,
6513 FL( "Sending SIR_HAL_DELBA_IND..." ));
6514
Jeff Johnsone7245742012-09-05 17:12:55 -07006515 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006516#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6517 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6518#endif //FEATURE_WLAN_DIAG_SUPPORT
6519
6520 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6521 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006522 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006523 retCode );
6524 else
6525 {
6526 // Update LIM's internal cache...
6527 if( eBA_INITIATOR == baDirection)
6528 {
6529 pSta->tcCfg[baTID].fUseBATx = 0;
6530 pSta->tcCfg[baTID].txBufSize = 0;
6531 }
6532 else
6533 {
6534 pSta->tcCfg[baTID].fUseBARx = 0;
6535 pSta->tcCfg[baTID].rxBufSize = 0;
6536 }
6537
6538 return retCode;
6539 }
6540
6541returnFailure:
6542
6543 // Clean-up...
6544 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306545 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006546
6547 return retCode;
6548
6549}
6550
6551/**
6552 * @function : limPostSMStateUpdate()
6553 *
6554 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6555 *
6556 * LOGIC:
6557 *
6558 * ASSUMPTIONS:
6559 * NA
6560 *
6561 * NOTE:
6562 * NA
6563 *
6564 * @param pMac - Pointer to Global MAC structure
6565 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6566 * @return None
6567 */
6568tSirRetStatus
6569limPostSMStateUpdate(tpAniSirGlobal pMac,
6570 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6571{
6572 tSirRetStatus retCode = eSIR_SUCCESS;
6573 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 tpSetMIMOPS pMIMO_PSParams;
6575
6576 msgQ.reserved = 0;
6577 msgQ.type = WDA_SET_MIMOPS_REQ;
6578
6579 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306580 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6581 if ( NULL == pMIMO_PSParams )
6582 {
6583 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006584 return eSIR_MEM_ALLOC_FAILED;
6585 }
6586
6587 pMIMO_PSParams->htMIMOPSState = state;
6588 pMIMO_PSParams->staIdx = staIdx;
6589 pMIMO_PSParams->fsendRsp = true;
6590 msgQ.bodyptr = pMIMO_PSParams;
6591 msgQ.bodyval = 0;
6592
6593 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6594
Jeff Johnsone7245742012-09-05 17:12:55 -07006595 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006596 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6597 if (eSIR_SUCCESS != retCode)
6598 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006599 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306600 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006601 return retCode;
6602 }
6603
6604 return retCode;
6605}
6606
6607void limPktFree (
6608 tpAniSirGlobal pMac,
6609 eFrameType frmType,
6610 tANI_U8 *pRxPacketInfo,
6611 void *pBody)
6612{
6613 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006614}
6615
6616/**
6617 * limGetBDfromRxPacket()
6618 *
6619 *FUNCTION:
6620 * This function is called to get pointer to Polaris
6621 * Buffer Descriptor containing MAC header & other control
6622 * info from the body of the message posted to LIM.
6623 *
6624 *LOGIC:
6625 * NA
6626 *
6627 *ASSUMPTIONS:
6628 * NA
6629 *
6630 *NOTE:
6631 * NA
6632 *
6633 * @param body - Received message body
6634 * @param pRxPacketInfo - Pointer to received BD
6635 * @return None
6636 */
6637
6638void
6639limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6640{
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006642} /*** end limGetBDfromRxPacket() ***/
6643
6644
6645
6646
6647
6648void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6649{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306650 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006651}
6652
6653
6654void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6655{
6656 tANI_U8 i;
6657 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6658
6659 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6660 {
6661 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6662 {
6663 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6664 fFound = eANI_BOOLEAN_TRUE;
6665 break;
6666 }
6667 }
6668 if(eANI_BOOLEAN_FALSE == fFound)
6669 {
6670 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6671 {
6672 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6673 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6674 }
6675 else
6676 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006677 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 }
6679 }
6680}
6681
6682
6683/**
6684 * @function : limIsChannelValidForChannelSwitch()
6685 *
6686 * @brief : This function checks if the channel to which AP
6687 * is expecting us to switch, is a valid channel for us.
6688 * LOGIC:
6689 *
6690 * ASSUMPTIONS:
6691 * NA
6692 *
6693 * NOTE:
6694 * NA
6695 *
6696 * @param pMac - Pointer to Global MAC structure
6697 * @param channel - New channel to which we are expected to move
6698 * @return None
6699 */
6700tAniBool
6701limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6702{
6703 tANI_U8 index;
6704 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6705 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6706
6707 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6708 (tANI_U8 *)validChannelList,
6709 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6710 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006711 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006712 return (eSIR_FALSE);
6713 }
6714
6715 for(index = 0; index < validChannelListLen; index++)
6716 {
6717 if(validChannelList[index] == channel)
6718 return (eSIR_TRUE);
6719 }
6720
6721 /* channel does not belong to list of valid channels */
6722 return (eSIR_FALSE);
6723}
6724
6725/**------------------------------------------------------
6726\fn __limFillTxControlParams
6727\brief Fill the message for stopping/resuming tx.
6728
6729\param pMac
6730\param pTxCtrlMsg - Pointer to tx control message.
6731\param type - Which way we want to stop/ resume tx.
6732\param mode - To stop/resume.
6733 -------------------------------------------------------*/
6734static eHalStatus
6735__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6736 tLimQuietTxMode type, tLimControlTx mode)
6737{
6738
6739 //TBD-RAJESH HOW TO GET sessionEntry?????
6740 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6741
6742 if (mode == eLIM_STOP_TX)
6743 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6744 else
6745 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6746
6747 switch (type)
6748 {
6749 case eLIM_TX_ALL:
6750 /** Stops/resumes transmission completely */
6751 pTxCtrlMsg->fCtrlGlobal = 1;
6752 break;
6753
6754 case eLIM_TX_BSS_BUT_BEACON:
6755 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6756 * stop beacon transmission.
6757 */
6758 pTxCtrlMsg->ctrlBss = 1;
6759 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6760 break;
6761
6762 case eLIM_TX_STA:
6763 /** Memory for station bitmap is allocated dynamically in caller of this
6764 * so decode properly here and fill the bitmap. Now not implemented,
6765 * fall through.
6766 */
6767 case eLIM_TX_BSS:
6768 //Fall thru...
6769 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006770 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006771 return eHAL_STATUS_FAILURE;
6772 }
6773
6774 return eHAL_STATUS_SUCCESS;
6775}
6776
6777/**
6778 * @function : limFrameTransmissionControl()
6779 *
6780 * @brief : This API is called by the user to halt/resume any frame
6781 * transmission from the device. If stopped, all frames will be
6782 * queued starting from hardware. Then back-pressure
6783 * is built till the driver.
6784 * LOGIC:
6785 *
6786 * ASSUMPTIONS:
6787 * NA
6788 *
6789 * NOTE:
6790 * NA
6791 *
6792 * @param pMac - Pointer to Global MAC structure
6793 * @return None
6794 */
6795void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6796{
6797
6798 eHalStatus status = eHAL_STATUS_FAILURE;
6799 tpTxControlParams pTxCtrlMsg;
6800 tSirMsgQ msgQ;
6801 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6802
6803 /** Allocate only required number of bytes for station bitmap
6804 * Make it to align to 4 byte boundary */
6805 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6806
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306807 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6808 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006809 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306810 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 return;
6812 }
6813
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306814 vos_mem_set((void *) pTxCtrlMsg,
6815 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006816 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6817 if (status != eHAL_STATUS_SUCCESS)
6818 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306819 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006820 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006821 return;
6822 }
6823
6824 msgQ.bodyptr = (void *) pTxCtrlMsg;
6825 msgQ.bodyval = 0;
6826 msgQ.reserved = 0;
6827 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6828
Jeff Johnsone7245742012-09-05 17:12:55 -07006829 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006830 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6831 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306832 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006833 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006834 return;
6835 }
6836
6837 if (mode == eLIM_STOP_TX)
6838 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306839 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006840 }
6841 else
6842 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306843 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006844 }
6845 return;
6846}
6847
6848
6849/**
6850 * @function : limRestorePreChannelSwitchState()
6851 *
6852 * @brief : This API is called by the user to undo any
6853 * specific changes done on the device during
6854 * channel switch.
6855 * LOGIC:
6856 *
6857 * ASSUMPTIONS:
6858 * NA
6859 *
6860 * NOTE:
6861 * NA
6862 *
6863 * @param pMac - Pointer to Global MAC structure
6864 * @return None
6865 */
6866
6867tSirRetStatus
6868limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6869{
6870
6871 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006872 tANI_U32 val = 0;
6873
6874 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6875 return retCode;
6876
6877 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006878 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006879
6880 /* Restore the frame transmission, all the time. */
6881 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6882
6883 /* Free to enter BMPS */
6884 limSendSmePostChannelSwitchInd(pMac);
6885
6886 //Background scan is now enabled by SME
6887 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6888 {
6889 /* Enable background scan if already enabled, else don't bother */
6890 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6891 &val)) != eSIR_SUCCESS)
6892
6893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006894 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006895 return (retCode);
6896 }
6897
6898 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6899 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006900 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6901 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006902 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6903 {
6904 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6905 return (eSIR_FAILURE);
6906 }
6907
6908 }
6909 }
6910
6911 /* Enable heartbeat timer */
6912 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6913 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006914 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6915 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6916 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6917 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006918 {
6919 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6920 return (eSIR_FAILURE);
6921 }
6922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006923 return (retCode);
6924}
6925
6926
6927/**--------------------------------------------
6928\fn limRestorePreQuietState
6929\brief Restore the pre quiet state
6930
6931\param pMac
6932\return NONE
6933---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006934tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006935{
6936
6937 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006938 tANI_U32 val = 0;
6939
6940 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6941 return retCode;
6942
6943 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006944 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006945
6946 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006947 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006948 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6949
6950
6951 //Background scan is now enabled by SME
6952 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6953 {
6954 /* Enable background scan if already enabled, else don't bother */
6955 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6956 &val)) != eSIR_SUCCESS)
6957
6958 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006959 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006960 return (retCode);
6961 }
6962
6963 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6964 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006965 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006966 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6967 {
6968 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6969 return (eSIR_FAILURE);
6970 }
6971
6972 }
6973 }
6974
6975 /* Enable heartbeat timer */
6976 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6977 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006978 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006979 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006980 {
6981 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6982 return (eSIR_FAILURE);
6983 }
6984 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006985 return (retCode);
6986}
6987
6988
6989/**
6990 * @function: limPrepareFor11hChannelSwitch()
6991 *
6992 * @brief : This API is called by the user to prepare for
6993 * 11h channel switch. As of now, the API does
6994 * very minimal work. User can add more into the
6995 * same API if needed.
6996 * LOGIC:
6997 *
6998 * ASSUMPTIONS:
6999 * NA
7000 *
7001 * NOTE:
7002 * NA
7003 *
7004 * @param pMac - Pointer to Global MAC structure
7005 * @param psessionEntry
7006 * @return None
7007 */
7008void
7009limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7010{
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7012 return;
7013
7014 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007015 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007016
7017 /* Disable, Stop background scan if enabled and running */
7018 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7019
7020 /* Stop heart-beat timer to stop heartbeat disassociation */
7021 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7022
7023 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7024 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7025 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007026 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007027 /* Stop ongoing scanning if any */
7028 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7029 {
7030 //Set the resume channel to Any valid channel (invalid).
7031 //This will instruct HAL to set it to any previous valid channel.
7032 peSetResumeChannel(pMac, 0, 0);
7033 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7034 }
7035 else
7036 {
7037 limRestorePreChannelSwitchState(pMac, psessionEntry);
7038 }
7039 return;
7040 }
7041 else
7042 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007043 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007044 /** We are safe to switch channel at this point */
7045 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7046 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007047}
7048
7049
7050
7051/**----------------------------------------------------
7052\fn limGetNwType
7053
7054\brief Get type of the network from data packet or beacon
7055\param pMac
7056\param channelNum - Channel number
7057\param type - Type of packet.
7058\param pBeacon - Pointer to beacon or probe response
7059
7060\return Network type a/b/g.
7061-----------------------------------------------------*/
7062tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7063{
7064 tSirNwType nwType = eSIR_11B_NW_TYPE;
7065
7066 if (type == SIR_MAC_DATA_FRAME)
7067 {
7068 if ((channelNum > 0) && (channelNum < 15))
7069 {
7070 nwType = eSIR_11G_NW_TYPE;
7071 }
7072 else
7073 {
7074 nwType = eSIR_11A_NW_TYPE;
7075 }
7076 }
7077 else
7078 {
7079 if ((channelNum > 0) && (channelNum < 15))
7080 {
7081 int i;
7082 // 11b or 11g packet
7083 // 11g iff extended Rate IE is present or
7084 // if there is an A rate in suppRate IE
7085 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7086 {
7087 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7088 {
7089 nwType = eSIR_11G_NW_TYPE;
7090 break;
7091 }
7092 }
7093 if (pBeacon->extendedRatesPresent)
7094 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007095 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007096 nwType = eSIR_11G_NW_TYPE;
7097 }
7098 }
7099 else
7100 {
7101 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007102 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007103 nwType = eSIR_11A_NW_TYPE;
7104 }
7105 }
7106 return nwType;
7107}
7108
7109
7110/**---------------------------------------------------------
7111\fn limGetChannelFromBeacon
7112\brief To extract channel number from beacon
7113
7114\param pMac
7115\param pBeacon - Pointer to beacon or probe rsp
7116\return channel number
7117-----------------------------------------------------------*/
7118tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7119{
7120 tANI_U8 channelNum = 0;
7121
7122 if (pBeacon->dsParamsPresent)
7123 channelNum = pBeacon->channelNumber;
7124 else if(pBeacon->HTInfo.present)
7125 channelNum = pBeacon->HTInfo.primaryChannel;
7126 else
7127 channelNum = pBeacon->channelNumber;
7128
7129 return channelNum;
7130}
7131
7132
7133/** ---------------------------------------------------------
7134\fn limSetTspecUapsdMask
7135\brief This function sets the PE global variable:
7136\ 1) gUapsdPerAcTriggerEnableMask and
7137\ 2) gUapsdPerAcDeliveryEnableMask
7138\ based on the user priority field and direction field
7139\ in the TS Info Fields.
7140\
7141\ An AC is a trigger-enabled AC if the PSB subfield
7142\ is set to 1 in the uplink direction.
7143\ An AC is a delivery-enabled AC if the PSB subfield
7144\ is set to 1 in the down-link direction.
7145\
7146\param tpAniSirGlobal pMac
7147\param tSirMacTSInfo pTsInfo
7148\param tANI_U32 action
7149\return None
7150 ------------------------------------------------------------*/
7151void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7152{
7153 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7154 tANI_U16 direction = pTsInfo->traffic.direction;
7155 tANI_U8 ac = upToAc(userPrio);
7156
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307157 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 -07007158
7159 /* Converting AC to appropriate Uapsd Bit Mask
7160 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7161 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7162 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7163 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7164 */
7165 ac = ((~ac) & 0x3);
7166
7167 if (action == CLEAR_UAPSD_MASK)
7168 {
7169 if (direction == SIR_MAC_DIRECTION_UPLINK)
7170 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7171 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7172 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7173 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7174 {
7175 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7176 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7177 }
7178 }
7179 else if (action == SET_UAPSD_MASK)
7180 {
7181 if (direction == SIR_MAC_DIRECTION_UPLINK)
7182 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7183 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7184 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7185 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7186 {
7187 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7188 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7189 }
7190 }
7191
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007192 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7193 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007194
7195 return;
7196}
7197
7198
7199
7200void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7201{
7202
7203 tANI_U8 i;
7204 for(i =0;i < pMac->lim.maxBssId;i++)
7205 {
7206 if(pMac->lim.gpSession[i].valid == TRUE )
7207 {
7208 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7209 {
7210 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7211 break;
7212 }
7213
7214 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7215 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7216 {
7217 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7218 }
7219 }
7220 }
7221 for(i=0; i< pMac->lim.maxBssId; i++)
7222 {
7223 if(pMac->lim.gpSession[i].valid == TRUE )
7224 {
7225 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7226 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7227 {
7228 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7229 {
7230 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007231 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007232 i);)
7233 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7234 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7235 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7236 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007237 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007238 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7239 }
7240 break;
7241 }
7242 }
7243 }
7244 }
7245}
7246
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007247void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7248{
7249 if(psessionEntry->valid == TRUE )
7250 {
7251 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7252 {
7253 limIbssHeartBeatHandle(pMac,psessionEntry);
7254 }
7255 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7256 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7257 {
7258 limHandleHeartBeatFailure(pMac,psessionEntry);
7259 }
7260 }
7261 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7262 and the other things again */
7263 if(psessionEntry->valid == TRUE )
7264 {
7265 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7266 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7267 {
7268 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7269 {
7270 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7271 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7272 psessionEntry->bssIdx);)
7273 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7274 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7275 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7276 {
7277 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7278 limReactivateHeartBeatTimer(pMac, psessionEntry);
7279 }
7280 }
7281 }
7282 }
7283}
7284
7285
Jeff Johnson295189b2012-06-20 16:38:30 -07007286tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7287{
7288 tANI_U8 i;
7289 for(i =0;i < pMac->lim.maxBssId;i++)
7290 {
7291 if(pMac->lim.gpSession[i].valid == TRUE )
7292 {
7293 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7294 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7295 {
7296 return pMac->lim.gpSession[i].currentOperChannel;
7297 }
7298 }
7299 }
7300 return 0;
7301}
7302
7303void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7304{
7305
7306 tpPESession psessionEntry;
7307// tANI_U8 sessionId;
7308 tpAddStaParams pAddStaParams;
7309
7310 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7311
7312 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7313 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007314 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307315 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007316 return;
7317 }
7318 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7319 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007320#ifdef FEATURE_WLAN_TDLS
7321 else if(pMac->lim.gLimAddStaTdls)
7322 {
7323 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7324 pMac->lim.gLimAddStaTdls = FALSE ;
7325 }
7326#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 else
7328 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7329
7330}
7331
7332
7333void limUpdateBeacon(tpAniSirGlobal pMac)
7334{
7335 tANI_U8 i;
7336
7337 for(i =0;i < pMac->lim.maxBssId;i++)
7338 {
7339 if(pMac->lim.gpSession[i].valid == TRUE )
7340 {
7341 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7342 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7343 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7344 )
7345 {
7346 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7347 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7348 }
7349 else
7350 {
7351 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7352 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7353 {
7354
7355 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7356 {
7357 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7358 }
7359 }
7360 }
7361 }
7362 }
7363}
7364
7365void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7366{
7367 tANI_U8 i;
7368 tpPESession psessionEntry;
7369 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7370 for(i =0; i < pMac->lim.maxBssId; i++)
7371 {
7372 if(pMac->lim.gpSession[i].valid == TRUE)
7373 {
7374 psessionEntry = &pMac->lim.gpSession[i];
7375 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7376 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307377 limLog(pMac, LOGE,
7378 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7379 psessionEntry->limSmeState, psessionEntry->limMlmState,
7380 psessionEntry->LimRxedBeaconCntDuringHB,
7381 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007382#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7383 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7384#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007385 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7386 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307387 /* Disconnect even if we have not received a single beacon
7388 * after connection.
7389 */
7390 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7391 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307392 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7393 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007394 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007395 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007396 /* AP did not respond to Probe Request. Tear down link with it.*/
7397 limTearDownLinkWithAp(pMac,
7398 psessionEntry->peSessionId,
7399 eSIR_BEACON_MISSED);
7400 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7401 }
7402 else // restart heartbeat timer
7403 {
7404 limReactivateHeartBeatTimer(pMac, psessionEntry);
7405 }
7406 }
7407 else
7408 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007409 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007410 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7411 limReactivateHeartBeatTimer(pMac, psessionEntry);
7412 }
7413
7414 }
7415 }
7416 }
7417 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7418 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7419}
7420
7421
7422/*
7423* This function assumes there will not be more than one IBSS session active at any time.
7424*/
7425tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7426{
7427 tANI_U8 i;
7428
7429 for(i =0;i < pMac->lim.maxBssId;i++)
7430 {
7431 if( (pMac->lim.gpSession[i].valid) &&
7432 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7433 return (&pMac->lim.gpSession[i]);
7434 }
7435
7436 return NULL;
7437}
7438
7439tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7440{
7441 tANI_U8 i;
7442
7443 for(i =0;i < pMac->lim.maxBssId;i++)
7444 {
7445 if( (pMac->lim.gpSession[i].valid) &&
7446 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7447 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7448 return (&pMac->lim.gpSession[i]);
7449 }
7450
7451 return NULL;
7452}
7453
7454/**---------------------------------------------------------
7455\fn limHandleDeferMsgError
7456\brief handles error scenario, when the msg can not be deferred.
7457\param pMac
7458\param pLimMsg LIM msg, which could not be deferred.
7459\return void
7460-----------------------------------------------------------*/
7461
7462void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7463{
7464 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7465 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307466 /*Decrement the Pending count before droping */
7467 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7469 }
7470 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007471 {
7472 vos_mem_free( pLimMsg->bodyptr);
7473 pLimMsg->bodyptr = NULL;
7474 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007475}
7476
7477
7478#ifdef FEATURE_WLAN_DIAG_SUPPORT
7479/**---------------------------------------------------------
7480\fn limDiagEventReport
7481\brief This function reports Diag event
7482\param pMac
7483\param eventType
7484\param bssid
7485\param status
7486\param reasonCode
7487\return void
7488-----------------------------------------------------------*/
7489void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7490{
7491 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7492 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7493
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307494 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007495
7496 if (NULL == pSessionEntry)
7497 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307498 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007499 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7500 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7501
7502 }
7503 else
7504 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307505 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007506 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7507 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7508 }
7509 peEvent.event_type = eventType;
7510 peEvent.status = status;
7511 peEvent.reason_code = reasonCode;
7512
7513 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7514 return;
7515}
7516
7517#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7518
7519void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7520{
7521
7522 tpAddStaSelfParams pAddStaSelfParams;
7523 tSirMsgQ mmhMsg;
7524 tpSirSmeAddStaSelfRsp pRsp;
7525
7526
7527 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7528
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307529 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7530 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007531 {
7532 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307533 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7534 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007535 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007536 return;
7537 }
7538
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307539 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007540
7541 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7542 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7543 pRsp->status = pAddStaSelfParams->status;
7544
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307545 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007546
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307547 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007548 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007549
7550 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7551 mmhMsg.bodyptr = pRsp;
7552 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307553 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007554 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7555
7556}
7557
7558void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7559{
7560
7561 tpDelStaSelfParams pDelStaSelfParams;
7562 tSirMsgQ mmhMsg;
7563 tpSirSmeDelStaSelfRsp pRsp;
7564
7565
7566 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7567
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307568 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7569 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007570 {
7571 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307572 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7573 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007574 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007575 return;
7576 }
7577
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307578 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007579
7580 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7581 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7582 pRsp->status = pDelStaSelfParams->status;
7583
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307584 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007585
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307586 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007587 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007588
7589 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7590 mmhMsg.bodyptr = pRsp;
7591 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307592 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007593 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7594
7595}
7596
7597/***************************************************************
7598* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7599* To unmap the channel to reverse the effect of mapping
7600* a band channel in hal .Mapping was done hal to overcome the
7601* limitation of the rxbd which use only 4 bit for channel number.
7602*****************************************************************/
7603tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7604{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007605#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007606 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007607 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7608 return aUnsortedChannelList[mapChannel -1];
7609 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007610#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007611 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007612#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007613 return abChannel[mapChannel -1];
7614 else
7615 return 0;
7616}
7617
7618
7619v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7620{
7621 int left = length;
7622 v_U8_t *ptr = pIes;
7623 v_U8_t elem_id;
7624 v_U16_t elem_len;
7625
7626 while(left >= (size_of_len_field+1))
7627 {
7628 elem_id = ptr[0];
7629 if (size_of_len_field == TWO_BYTE)
7630 {
7631 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7632 }
7633 else
7634 {
7635 elem_len = ptr[1];
7636 }
7637
7638
7639 left -= (size_of_len_field+1);
7640 if(elem_len > left)
7641 {
7642 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007643 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007644 eid,elem_len,left);
7645 return NULL;
7646 }
7647 if (elem_id == eid)
7648 {
7649 return ptr;
7650 }
7651
7652 left -= elem_len;
7653 ptr += (elem_len + (size_of_len_field+1));
7654 }
7655 return NULL;
7656}
7657
7658/* return NULL if oui is not found in ie
7659 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7660 */
7661v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7662{
7663 int left = ie_len;
7664 v_U8_t *ptr = ie;
7665 v_U8_t elem_id, elem_len;
7666
7667 while(left >= 2)
7668 {
7669 elem_id = ptr[0];
7670 elem_len = ptr[1];
7671 left -= 2;
7672 if(elem_len > left)
7673 {
7674 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007675 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 elem_id,elem_len,left);
7677 return NULL;
7678 }
7679 if (SIR_MAC_EID_VENDOR == elem_id)
7680 {
7681 if(memcmp(&ptr[2], oui, oui_size)==0)
7682 return ptr;
7683 }
7684
7685 left -= elem_len;
7686 ptr += (elem_len + 2);
7687 }
7688 return NULL;
7689}
7690
Jeff Johnson295189b2012-06-20 16:38:30 -07007691//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7692
7693v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7694{
7695 int length = 0;
7696 tANI_U8 *ptr = ie;
7697
7698 ptr[length++] = SIR_MAC_EID_VENDOR;
7699 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307700 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7701 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007702 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7703}
7704
7705//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7706
7707v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7708{
7709 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007710
7711 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7712 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7713 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307714 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007715 noaStream + noaLen - overFlowLen, overFlowLen);
7716 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7717 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307718 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007719 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307720 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7721 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007722 }
7723
Jeff Johnson295189b2012-06-20 16:38:30 -07007724 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7725
7726}
7727
7728//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7729v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7730{
7731 v_U8_t len=0;
7732
7733 v_U8_t *pBody = pNoaStream;
7734
7735
7736 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7737 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7738 {
7739 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7740 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7741 )
7742 return 0; //No NoA Descriptor then return 0
7743
7744
7745 pBody[0] = SIR_P2P_NOA_ATTR;
7746
7747 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7748 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7749 len = 5;
7750 pBody += len;
7751
7752
7753 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7754 {
7755 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7756 pBody += 1;
7757 len +=1;
7758
7759 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7760 pBody += sizeof(tANI_U32);
7761 len +=4;
7762
7763 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7764 pBody += sizeof(tANI_U32);
7765 len +=4;
7766
7767 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7768 pBody += sizeof(tANI_U32);
7769 len +=4;
7770
7771 }
7772
7773 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7774 {
7775 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7776 pBody += 1;
7777 len +=1;
7778
7779 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7780 pBody += sizeof(tANI_U32);
7781 len +=4;
7782
7783 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7784 pBody += sizeof(tANI_U32);
7785 len +=4;
7786
7787 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7788 pBody += sizeof(tANI_U32);
7789 len +=4;
7790
7791 }
7792
7793
7794 pBody = pNoaStream + 1;
7795 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7796
7797 return (len);
7798
7799 }
7800 return 0;
7801
7802}
Jeff Johnsone7245742012-09-05 17:12:55 -07007803
7804void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007805{
7806
7807 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007808 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007809}
Jeff Johnsone7245742012-09-05 17:12:55 -07007810
Jeff Johnson295189b2012-06-20 16:38:30 -07007811/*--------------------------------------------------------------------------
7812
7813 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7814
Jeff Johnsone7245742012-09-05 17:12:55 -07007815 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7816 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007817
7818 \param pMac - pointer to global adapter context
7819 \return - channel to scan from valid session else zero.
7820
7821 \sa
7822
7823 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007824void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007825{
7826
7827 //Rationale - this could be the suspend/resume for assoc and it is essential that
7828 //the new BSS is active for some time. Other BSS was anyway suspended.
7829 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7830 //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 -07007831 //and hence should be ok. Need to discuss this further
7832 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007833 {
7834 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007835 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 }
7837 else
7838 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007839 *resumeChannel = pMac->lim.gResumeChannel;
7840 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007841 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007842 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007843}
7844
Viral Modid86bde22012-12-10 13:09:21 -08007845tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7846{
7847 tANI_U8 i;
7848 for(i =0; i < pMac->lim.maxBssId; i++)
7849 {
7850 if(pMac->lim.gpSession[i].valid == TRUE)
7851 {
7852 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7853 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7854 )
7855 {
7856 return TRUE;
7857 }
7858 }
7859 }
7860 return FALSE;
7861}
Jeff Johnsone7245742012-09-05 17:12:55 -07007862
Jeff Johnson295189b2012-06-20 16:38:30 -07007863
7864tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7865{
7866 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7867 {
7868 return eANI_BOOLEAN_TRUE;
7869 }
7870 else
7871 {
7872 return eANI_BOOLEAN_FALSE;
7873 }
7874}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007875
Sandeep Puligilla60342762014-01-30 21:05:37 +05307876/**
7877 * \brief verify the changes in channel bonding
7878 *
7879 * \param pMac Pointer to the global MAC structure
7880 *
7881 * \param psessionEntry session entry
7882 * beaconSecChanWidth Secondary channel width
7883 * advertized in beacon
7884 * currentSecChanWidth Current configured width
7885 * staId Station Id
7886 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7887 */
7888tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7889 tpPESession psessionEntry,
7890 tANI_U8 beaconSecChanWidth,
7891 tANI_U8 currentSecChanWidth,
7892 tANI_U8 staId)
7893{
7894 tUpdateVHTOpMode tempParam;
7895 tANI_BOOLEAN fCbMode24G = FALSE;
7896 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7897
7898 /* Moving from HT40 to HT20 operation*/
7899 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7900 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7901 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7902 {
7903 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7904 tempParam.staId = staId;
7905 fCbMode24G = TRUE;
7906 }
7907
7908 /* Moving from HT20 to HT40 operation*/
7909 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7910 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7911 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7912 {
7913 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7914 tempParam.staId = staId;
7915 fCbMode24G = TRUE;
7916 }
7917
7918 if (TRUE == fCbMode24G)
7919 {
7920 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7921 "Changing CBMODE to = %d staId = %d",
7922 tempParam.opMode, tempParam.staId );
7923 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7924 status = eANI_BOOLEAN_TRUE;
7925 }
7926 return status;
7927}
7928
Mohit Khanna4a70d262012-09-11 16:30:12 -07007929#ifdef WLAN_FEATURE_11AC
7930tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7931{
7932 tUpdateVHTOpMode tempParam;
7933
7934 tempParam.opMode = chanWidth;
7935 tempParam.staId = staId;
7936
7937 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7938
7939 return eANI_BOOLEAN_TRUE;
7940}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007941#endif
7942
krunal soni45b9eb62014-03-26 12:54:25 -07007943void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7944 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007945{
7946 tANI_U8 val=0;
7947
krunal soni45b9eb62014-03-26 12:54:25 -07007948 //only 2.4G band should have short slot enable, rest it should be default
7949 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007950 {
krunal soni45b9eb62014-03-26 12:54:25 -07007951 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007952 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007953 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007954 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7955 {
7956 val = true;
7957 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007958 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007959 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007960 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007961 // Joining BSS.
7962 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007963 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007964 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007965 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007966 // Reassociating with AP.
7967 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007968 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007969 }
krunal soni45b9eb62014-03-26 12:54:25 -07007970 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007971 {
krunal soni45b9eb62014-03-26 12:54:25 -07007972 /*
7973 * 11B does not short slot and short slot is default
7974 * for 11A mode. Hence, not need to set this bit
7975 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007976 val = false;
7977 }
krunal soni45b9eb62014-03-26 12:54:25 -07007978
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007979 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007980 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007981}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307982
Kalikinkar dhara205da782014-03-21 15:49:32 -07007983void limUtilsframeshtons(tpAniSirGlobal pCtx,
7984 tANI_U8 *pOut,
7985 tANI_U16 pIn,
7986 tANI_U8 fMsb)
7987{
7988 (void)pCtx;
7989#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7990 if ( !fMsb )
7991 {
7992 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7993 }
7994 else
7995 {
7996 *pOut = ( pIn & 0xff00 ) >> 8;
7997 *( pOut + 1 ) = pIn & 0xff;
7998 }
7999#else
8000 if ( !fMsb )
8001 {
8002 *pOut = pIn & 0xff;
8003 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8004 }
8005 else
8006 {
8007 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8008 }
8009#endif
8010}
8011
8012void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8013 tANI_U8 *pOut,
8014 tANI_U32 pIn,
8015 tANI_U8 fMsb)
8016{
8017 (void)pCtx;
8018#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8019 if ( !fMsb )
8020 {
8021 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8022 }
8023 else
8024 {
8025 *pOut = ( pIn & 0xff000000 ) >> 24;
8026 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8027 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8028 *( pOut + 3 ) = ( pIn & 0x000000ff );
8029 }
8030#else
8031 if ( !fMsb )
8032 {
8033 *( pOut ) = ( pIn & 0x000000ff );
8034 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8035 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8036 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8037 }
8038 else
8039 {
8040 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8041 }
8042#endif
8043}
8044
8045
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308046/**--------------------------------------------
8047\fn limUpdateOBSSScanParams
8048\brief Updates OBSS SCAN IE parameters to session
8049
8050\param psessionEntry - Session Entry
8051\return NONE
8052---------------------------------------------*/
8053void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8054 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8055{
8056 /*If the recieved value is not in the range specified by the Specification
8057 then it will be the default value configured through cfg */
8058 if (( pOBSSScanParameters->obssScanActiveDwell >
8059 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8060 ( pOBSSScanParameters->obssScanActiveDwell <
8061 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8062 {
8063 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8064 pOBSSScanParameters->obssScanActiveDwell;
8065 }
8066 if((pOBSSScanParameters->obssScanPassiveDwell >
8067 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8068 (pOBSSScanParameters->obssScanPassiveDwell <
8069 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8070 {
8071 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8072 pOBSSScanParameters->obssScanPassiveDwell;
8073 }
8074 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8075 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8076 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8077 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8078 {
8079 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8080 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8081 }
8082 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8083 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8084 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8085 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8086 {
8087 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8088 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8089 }
8090 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8091 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8092 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8093 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8094 {
8095 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8096 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8097 }
8098 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8099 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8100 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8101 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8102 {
8103 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8104 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8105 }
8106 if((pOBSSScanParameters->obssScanActivityThreshold >
8107 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8108 (pOBSSScanParameters->obssScanActivityThreshold <
8109 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8110 {
8111 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8112 pOBSSScanParameters->obssScanActivityThreshold;
8113 }
8114}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008115
8116#ifdef WLAN_FEATURE_11W
8117void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8118{
8119 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8120 tPmfSaQueryTimerId timerId;
8121 tpPESession psessionEntry;
8122 tpDphHashNode pSta;
8123 tANI_U32 maxRetries;
8124
8125 limLog(pMac, LOG1, FL("SA Query timer fires"));
8126 timerId.value = param;
8127
8128 // Check that SA Query is in progress
8129 if ((psessionEntry = peFindSessionBySessionId(
8130 pMac, timerId.fields.sessionId)) == NULL)
8131 {
8132 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8133 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008134 return;
8135 }
8136 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8137 &psessionEntry->dph.dphHashTable)) == NULL)
8138 {
8139 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8140 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008141 return;
8142 }
8143 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8144 return;
8145
8146 // Increment the retry count, check if reached maximum
8147 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8148 &maxRetries) != eSIR_SUCCESS)
8149 {
8150 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8151 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8152 return;
8153 }
8154 pSta->pmfSaQueryRetryCount++;
8155 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8156 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308157 limLog(pMac, LOGE,
8158 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8159 MAC_ADDR_ARRAY(pSta->staAddr));
8160 limSendDisassocMgmtFrame(pMac,
8161 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8162 pSta->staAddr, psessionEntry, FALSE);
8163 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008164 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8165 return;
8166 }
8167
8168 // Retry SA Query
8169 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8170 pSta->staAddr, psessionEntry);
8171 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008172 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8173 {
8174 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8175 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8176 }
8177}
8178#endif
8179
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008180/** ---------------------------------------------------------
8181\fn limProcessChannelSwitchSuspendLink
8182\brief This function call channel switch functions based on
8183 the gLimChannelSwitch.state. After function return it
8184 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8185 If gLimChannelSwitch.state is non-identified then
8186 print error log as well as restore back the
8187 pre-channelSwitch.
8188\param tpAniSirGlobal pMac
8189\param eHalStatus status
8190\param tANI_U32 *ctx
8191\return None
8192 ------------------------------------------------------------*/
8193static void
8194limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8195 eHalStatus status,
8196 tANI_U32 *ctx)
8197{
8198 tpPESession pSessionEntry = (tpPESession)ctx;
8199
8200 if ( eHAL_STATUS_SUCCESS != status )
8201 {
8202 limLog(pMac, LOGE,
8203 FL("Suspend link failed. still proceeding "));
8204 }
8205 if (NULL == pSessionEntry )
8206 {
8207 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8208 return;
8209 }
8210
8211 switch(pSessionEntry->gLimChannelSwitch.state)
8212 {
8213 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8214 PELOGW(limLog(pMac, LOGW,
8215 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8216 limSwitchPrimaryChannel(pMac,
8217 pSessionEntry->gLimChannelSwitch.primaryChannel,
8218 pSessionEntry);
8219 pSessionEntry->gLimChannelSwitch.state =
8220 eLIM_CHANNEL_SWITCH_IDLE;
8221 break;
8222
8223 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8224 PELOGW(limLog(pMac, LOGW,
8225 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8226 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8227 pSessionEntry->gLimChannelSwitch.primaryChannel,
8228 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8229 pSessionEntry->gLimChannelSwitch.state =
8230 eLIM_CHANNEL_SWITCH_IDLE;
8231 break;
8232
8233 default:
8234 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8235 pSessionEntry->gLimChannelSwitch.state);)
8236 if (limRestorePreChannelSwitchState(pMac,
8237 pSessionEntry) != eSIR_SUCCESS)
8238 {
8239 limLog(pMac, LOGE,
8240 FL("Could not restore pre-channelSwitch "
8241 "(11h) state, resetting the system"));
8242 }
8243 }
8244}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308245
8246/** ---------------------------------------------------------
8247\fn limInitOBSSScanParams
8248\brief This function Initializes the OBSS Scan Parameters
8249\param tpAniSirGlobal pMac
8250\param tpPESession pSessionEntry
8251\return None
8252 ------------------------------------------------------------*/
8253
8254void limInitOBSSScanParams(tpAniSirGlobal pMac,
8255 tpPESession psessionEntry)
8256{
8257 tANI_U32 cfgValue;
8258
8259 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8260 &cfgValue) != eSIR_SUCCESS)
8261 {
8262 limLog(pMac, LOGE, FL("Fail to retrieve "
8263 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8264 return ;
8265 }
8266 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8267
8268 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8269 &cfgValue) != eSIR_SUCCESS)
8270 {
8271 limLog(pMac, LOGE, FL("Fail to retrieve "
8272 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8273 return ;
8274 }
8275 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8276
8277 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8278 &cfgValue) != eSIR_SUCCESS)
8279 {
8280 limLog(pMac, LOGE, FL("Fail to retrieve "
8281 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8282 return ;
8283 }
8284 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8285 = cfgValue;
8286 if (wlan_cfgGetInt(pMac,
8287 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8288 &cfgValue) != eSIR_SUCCESS)
8289 {
8290 limLog(pMac, LOGE, FL("Fail to retrieve"
8291 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8292 return ;
8293 }
8294 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8295 cfgValue;
8296 if (wlan_cfgGetInt(pMac,
8297 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8298 != eSIR_SUCCESS)
8299 {
8300 limLog(pMac, LOGE, FL("Fail to retrieve"
8301 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8302 return ;
8303 }
8304 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8305 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308306
8307 if (wlan_cfgGetInt(pMac,
8308 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8309 != eSIR_SUCCESS)
8310 {
8311 limLog(pMac, LOGE, FL("Fail to retrieve"
8312 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8313 return ;
8314 }
8315 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8316 cfgValue;
8317
8318
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308319 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8320 &cfgValue) != eSIR_SUCCESS)
8321 {
8322 limLog(pMac, LOGE, FL("Fail to retrieve "
8323 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8324 return ;
8325 }
8326 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308327}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308328
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308329const char * lim_ScanTypetoString(const v_U8_t scanType)
8330{
8331 switch (scanType)
8332 {
8333 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8334 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8335 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8336 default:
8337 return "Unknown ScanType";
8338 }
8339}
8340
8341const char * lim_BssTypetoString(const v_U8_t bssType)
8342{
8343 switch (bssType)
8344 {
8345 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8346 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8347 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8348 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8349 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8350 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8351 default:
8352 return "Unknown BssType";
8353 }
8354}
8355
8356const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8357{
8358 switch (mode)
8359 {
8360 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8361 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8362 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8363 default:
8364 return "Unknown BgScanMode";
8365 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308366}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308367
8368#ifdef WLAN_FEATURE_11W
8369/**
8370 *
8371 * \brief This function is called by various LIM modules to correctly set
8372 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8373 *
8374 *
8375 * \param pMac Pointer to Global MAC structure
8376 *
8377 * \param psessionEntry Pointer to session corresponding to the connection
8378 *
8379 * \param peer Peer address of the STA to which the frame is to be sent
8380 *
8381 * \param pMacHdr Pointer to the frame MAC header
8382 *
8383 * \return nothing
8384 *
8385 *
8386 */
8387void
8388limSetProtectedBit(tpAniSirGlobal pMac,
8389 tpPESession psessionEntry,
8390 tSirMacAddr peer,
8391 tpSirMacMgmtHdr pMacHdr)
8392{
8393 tANI_U16 aid;
8394 tpDphHashNode pStaDs;
8395
8396 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8397 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8398 {
8399
8400 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8401 &psessionEntry->dph.dphHashTable );
8402 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308403 /* rmfenabled will be set at the time of addbss.
8404 * but sometimes EAP auth fails and keys are not
8405 * installed then if we send any management frame
8406 * like deauth/disassoc with this bit set then
8407 * firmware crashes. so check for keys are
8408 * installed or not also before setting the bit
8409 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308410 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308411 pMacHdr->fc.wep = 1;
8412 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308413 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308414 pMacHdr->fc.wep = 1;
8415} /*** end limSetProtectedBit() ***/
8416#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308417
8418tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8419{
8420 int left = length;
8421 tANI_U8 *ptr = pIes;
8422 tANI_U8 elem_id,elem_len;
8423
8424 while (left >= 2)
8425 {
8426 elem_id = ptr[0];
8427 elem_len = ptr[1];
8428 left -= 2;
8429
8430 if (elem_len > left)
8431 {
8432 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8433 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8434 eid,elem_len,left);
8435 return NULL;
8436 }
8437 if (elem_id == eid)
8438 {
8439 return ptr;
8440 }
8441
8442 left -= elem_len;
8443 ptr += (elem_len + 2);
8444 }
8445 return NULL;
8446}
8447
8448
8449void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8450{
8451
8452 tANI_U32 nPayload;
8453 tANI_U8 *pPayload;
8454 tANI_U8 *ieptr;
8455 tSirMacTim *tim;
8456
8457 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8458 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8459
8460 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8461 {
8462 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8463 return;
8464 }
8465
8466 if (NULL !=
8467 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8468 nPayload, SIR_MAC_TIM_EID)))
8469 {
8470 /* Ignore EID and Length field*/
8471 tim = (tSirMacTim *)(ieptr + 2);
8472
8473 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8474 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8475 if (tim->dtimCount >= MAX_DTIM_COUNT)
8476 tim->dtimCount = DTIM_COUNT_DEFAULT;
8477 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8478 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8479 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8480 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8481 psessionEntry->currentBssBeaconCnt++;
8482
8483 limLog(pMac, LOG1,
8484 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8485 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8486 psessionEntry->lastBeaconDtimPeriod);
8487
8488 }
8489 return;
8490}
Girish Gowlia95daca2015-02-04 20:31:31 +05308491
8492void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8493 tANI_U8 smeSessionId,
8494 tANI_U32 maxRateFlag)
8495{
8496 tpSirSmeUpdateMaxRateParams pRsp;
8497 tSirMsgQ msg;
8498
8499 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8500 if (NULL == pRsp)
8501 {
8502 limLog(pMac, LOGP, FL("Memory allocation failed"));
8503 return;
8504 }
8505 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8506 pRsp->maxRateFlag = maxRateFlag;
8507 pRsp->smeSessionId = smeSessionId;
8508 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8509 msg.bodyptr = pRsp;
8510 msg.bodyval = 0;
8511 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8512 return;
8513}
Abhishek Singh5d765712015-03-12 14:04:16 +05308514
8515void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8516{
8517 if( pMac->sys.gSysBbtPendingMgmtCount )
8518 {
8519 vos_spin_lock_acquire( &pMac->sys.lock );
8520 pMac->sys.gSysBbtPendingMgmtCount--;
8521 vos_spin_lock_release( &pMac->sys.lock );
8522 }
8523 else
8524 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8525}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308526
8527eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8528{
8529 tpSirTxBdStatus pTxBdStatus;
8530
8531 if (!pData)
8532 {
8533 limLog(pMac, LOGE, FL("pData is NULL"));
8534 return eHAL_STATUS_FAILURE;
8535 }
8536
8537 pTxBdStatus = (tpSirTxBdStatus) pData;
8538
8539 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8540 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8541 return eHAL_STATUS_SUCCESS;
8542}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308543
Kapil Gupta956c0c42017-06-16 19:24:31 +05308544eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8545{
8546 tpSirTxBdStatus pTxBdStatus;
8547 tpDphHashNode pStaDs;
8548 tpPESession psessionEntry;
8549 VOS_STATUS vosStatus;
8550 vos_list_node_t *pNode= NULL, *pNext = NULL;
8551 assoc_rsp_tx_context *tmp_tx_context = NULL;
8552
8553 if (!pData)
8554 {
8555 limLog(pMac, LOGE, FL("pData is NULL"));
8556 return eHAL_STATUS_FAILURE;
8557 }
8558
8559 pTxBdStatus = (tpSirTxBdStatus) pData;
8560
8561 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8562 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8563
8564 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8565 &pNode);
8566
8567 while(pNode)
8568 {
8569 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8570 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8571 {
8572 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8573 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8574
8575 vosStatus = vos_list_peek_next (
8576 &pMac->assoc_rsp_completion_list,
8577 pNode, &pNext );
8578 pNode = pNext;
8579 pNext = NULL;
8580 }
8581 else
8582 {
8583 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8584 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8585 break;
8586 }
8587 }
8588
8589 if (!tmp_tx_context) {
8590 limLog(pMac, LOGE, FL("context is NULL"));
8591 return eHAL_STATUS_SUCCESS;
8592 }
8593 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8594 if (!psessionEntry) {
8595 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8596 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8597 pNode);
8598 vos_mem_free(tmp_tx_context);
8599 return eHAL_STATUS_SUCCESS;
8600 }
8601 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8602 &psessionEntry->dph.dphHashTable);
8603 if (pStaDs == NULL)
8604 {
8605 limLog(pMac, LOGW,
8606 FL("STA context not found"));
8607 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8608 pNode);
8609 vos_mem_free(tmp_tx_context);
8610
8611 return eHAL_STATUS_SUCCESS;
8612 }
8613
8614 /* Receive path cleanup */
8615 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8616 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8617 pNode);
8618 vos_mem_free(tmp_tx_context);
8619
8620 return eHAL_STATUS_SUCCESS;
8621}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308622/**
8623 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8624 * robust action frame
8625 * @action_catagory: Action frame catagory.
8626 *
8627 * This function is used to check if given action catagory is robust
8628 * action frame.
8629 *
8630 * Return: bool
8631 */
8632bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8633{
8634 switch (action_catagory) {
8635 /*
8636 * NOTE: This function doesn't take care of the DMG
8637 * (Directional Multi-Gigatbit) BSS case as 8011ad
8638 * support is not yet added. In future, if the support
8639 * is required then this function need few more arguments
8640 * and little change in logic.
8641 */
8642 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8643 case SIR_MAC_ACTION_QOS_MGMT:
8644 case SIR_MAC_ACTION_DLP:
8645 case SIR_MAC_ACTION_BLKACK:
8646 case SIR_MAC_ACTION_RRM:
8647 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8648 case SIR_MAC_ACTION_SA_QUERY:
8649 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8650 case SIR_MAC_ACTION_WNM:
8651 case SIR_MAC_ACITON_MESH:
8652 case SIR_MAC_ACTION_MHF:
8653 case SIR_MAC_ACTION_FST:
8654 return true;
8655 default:
8656 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8657 FL("non-PMF action category[%d] "),
8658 action_catagory);
8659 break;
8660 }
8661 return false;
8662}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308663
8664/**
Hu Wangc12631c2016-08-11 09:57:03 +08008665 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8666 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308667 * @ext_cap: extended IEs structure
8668 *
Hu Wangc12631c2016-08-11 09:57:03 +08008669 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308670 */
Hu Wangc12631c2016-08-11 09:57:03 +08008671tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8672 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308673
Hu Wangc12631c2016-08-11 09:57:03 +08008674 while (i) {
8675 if (ext_cap->bytes[i-1]) {
8676 break;
8677 }
8678 i --;
8679 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308680
Hu Wangc12631c2016-08-11 09:57:03 +08008681 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308682}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308683
8684/**
8685 * lim_update_caps_info_for_bss - Update capability info for this BSS
8686 *
8687 * @mac_ctx: mac context
8688 * @caps: Pointer to capability info to be updated
8689 * @bss_caps: Capability info of the BSS
8690 *
8691 * Update the capability info in Assoc/Reassoc request frames and reset
8692 * the spectrum management, short preamble, immediate block ack bits
8693 * if the BSS doesnot support it
8694 *
8695 * Return: None
8696 */
8697void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8698 uint16_t *caps, uint16_t bss_caps)
8699{
8700 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8701 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8702 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8703 }
8704
8705 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8706 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8707 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8708 }
8709
8710 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8711 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8712 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8713 }
8714}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308715#ifdef SAP_AUTH_OFFLOAD
8716/**
8717 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8718 *
8719 * @pmac: mac context
8720 * @assoc_req: Assoc request
8721 * @add_sta_req: Add Sta request
8722 *
8723 * This function process recieved add sta message and store it as
8724 * sta ds entry. This function will add this sta entry to DPH as well.
8725 *
8726 * Return: DPH hash node
8727 */
8728static tpDphHashNode
8729_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8730 tpSirAssocReq assoc_req,
8731 tSapOfldAddStaIndMsg *add_sta_req)
8732{
8733 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8734 tpSirAssocReq temp_assoc_req;
8735 tSirRetStatus status;
8736 tpDphHashNode sta_ds = NULL;
8737 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308738 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308739
8740 tpPESession session_entry = limIsApSessionActive(pmac);
8741
8742 if (session_entry == NULL)
8743 {
8744 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8745 return NULL;
8746 }
8747
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308748 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8749 {
8750 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8751 return NULL;
8752 }
8753
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308754 /* Update Attribute and Remove IE for
8755 * Software AP Authentication Offload
8756 */
8757 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308758
8759 /*
8760 * strip MAC mgmt header before passing buf to
8761 * sirConvertAssocReqFrame2Struct() as this API
8762 * expects buf starting from fixed parameters only.
8763 */
8764 frame_body += sizeof(tSirMacMgmtHdr);
8765 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8766
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308767 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8768 mac_assoc_req->capabilityInfo.privacy = 0;
8769
8770 status = sirConvertAssocReqFrame2Struct(pmac,
8771 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308772 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308773 assoc_req);
8774 if (status != eSIR_SUCCESS)
8775 {
8776 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8777 goto error;
8778 }
8779 /* For software AP Auth Offload feature
8780 * Host will take it as none security station
8781 * Force change to none security
8782 */
8783 assoc_req->rsnPresent = 0;
8784 assoc_req->wpaPresent = 0;
8785
8786 sta_ds = dphAddHashEntry(pmac,
8787 add_sta_req->peer_macaddr,
8788 add_sta_req->assoc_id,
8789 &session_entry->dph.dphHashTable);
8790 if (sta_ds == NULL)
8791 {
8792 /* Could not add hash table entry at DPH */
8793 limLog(pmac, LOGE,
8794 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8795 MAC_ADDRESS_STR),
8796 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8797 goto error;
8798 }
8799
8800 if (session_entry->parsedAssocReq != NULL)
8801 {
8802 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8803 if (temp_assoc_req != NULL)
8804 {
8805 if (temp_assoc_req->assocReqFrame)
8806 {
8807 vos_mem_free(temp_assoc_req->assocReqFrame);
8808 temp_assoc_req->assocReqFrame = NULL;
8809 temp_assoc_req->assocReqFrameLength = 0;
8810 }
8811 vos_mem_free(temp_assoc_req);
8812 temp_assoc_req = NULL;
8813 }
8814 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8815 }
8816error:
8817 return sta_ds;
8818}
8819
8820/**
8821 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8822 *
8823 * @sta_ds: STA state node
8824 * @assoc_req: Assoc request
8825 * @add_sta_req: Add Sta request
8826 *
8827 * This function process recieved add sta message and store station's caps
8828 * in station ds entry.
8829 *
8830 * Return: none
8831 */
8832static void
8833_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
8834 tpSirAssocReq assoc_req,
8835 tSapOfldAddStaIndMsg *add_sta_req)
8836
8837{
8838
8839 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
8840#ifdef WLAN_FEATURE_11AC
8841 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
8842#endif
8843 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
8844 sta_ds->qos.addts = assoc_req->addtsReq;
8845 sta_ds->qos.capability = assoc_req->qosCapability;
8846 sta_ds->versionPresent = 0;
8847 /* short slot and short preamble should be
8848 * updated before doing limaddsta
8849 */
8850 sta_ds->shortPreambleEnabled =
8851 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
8852 sta_ds->shortSlotTimeEnabled =
8853 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
8854
8855 sta_ds->valid = 0;
8856 /* The Auth Type of Software AP Authentication Offload
8857 * is always Open System is host side
8858 */
8859 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
8860 sta_ds->staType = STA_ENTRY_PEER;
8861
8862 /* Assoc Response frame to requesting STA */
8863 sta_ds->mlmStaContext.subType = 0;
8864
8865 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
8866 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
8867
8868 /* The following count will be used to knock-off the station
8869 * if it doesn't come back to receive the buffered data.
8870 * The AP will wait for numTimSent number of beacons after
8871 * sending TIM information for the station, before assuming that
8872 * the station is no more associated and disassociates it
8873 */
8874
8875 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
8876 sta_ds->timWaitCount =
8877 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
8878
8879 /* Initialise the Current successful
8880 * MPDU's tranfered to this STA count as 0
8881 */
8882 sta_ds->curTxMpduCnt = 0;
8883}
8884
8885/**
8886 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
8887 *
8888 * @pmac: mac context
8889 * @sta_ds: STA state node
8890 * @assoc_req: Assoc request
8891 *
8892 * This function process recieved add sta message and store station's HT and
8893 * and VHT caps and store them in station ds entry.
8894 *
8895 * Return: tSirRetStatus
8896 */
8897static tSirRetStatus
8898_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
8899 tpDphHashNode sta_ds,
8900 tpSirAssocReq assoc_req)
8901{
8902 tpPESession session_entry = limIsApSessionActive(pmac);
8903
8904 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
8905 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
8906 {
8907 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
8908 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
8909 sta_ds->htDsssCckRate40MHzSupport =
8910 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
8911 sta_ds->htLsigTXOPProtection =
8912 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
8913 sta_ds->htMaxAmsduLength =
8914 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
8915 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
8916 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
8917 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
8918 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
8919 sta_ds->htSupportedChannelWidthSet =
8920 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
8921 /* peer just follows AP; so when we are softAP/GO,
8922 * we just store our session entry's secondary channel offset here
8923 * in peer INFRA STA. However, if peer's 40MHz channel width support
8924 * is disabled then secondary channel will be zero
8925 */
8926 sta_ds->htSecondaryChannelOffset =
8927 (sta_ds->htSupportedChannelWidthSet) ?
8928 session_entry->htSecondaryChannelOffset : 0;
8929#ifdef WLAN_FEATURE_11AC
8930 if (assoc_req->operMode.present)
8931 {
8932 sta_ds->vhtSupportedChannelWidthSet =
8933 (tANI_U8)((assoc_req->operMode.chanWidth ==
8934 eHT_CHANNEL_WIDTH_80MHZ) ?
8935 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
8936 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
8937 sta_ds->htSupportedChannelWidthSet =
8938 (tANI_U8)(assoc_req->operMode.chanWidth ?
8939 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
8940 }
8941 else if (assoc_req->VHTCaps.present)
8942 {
8943 /* Check if STA has enabled it's channel bonding mode.
8944 * If channel bonding mode is enabled, we decide based on
8945 * SAP's current configuration else, we set it to VHT20.
8946 */
8947 sta_ds->vhtSupportedChannelWidthSet =
8948 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
8949 eHT_CHANNEL_WIDTH_20MHZ) ?
8950 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
8951 session_entry->vhtTxChannelWidthSet );
8952 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
8953 }
8954
8955 /* Lesser among the AP and STA bandwidth of operation. */
8956 sta_ds->htSupportedChannelWidthSet =
8957 (sta_ds->htSupportedChannelWidthSet <
8958 session_entry->htSupportedChannelWidthSet) ?
8959 sta_ds->htSupportedChannelWidthSet :
8960 session_entry->htSupportedChannelWidthSet ;
8961#endif
8962 sta_ds->baPolicyFlag = 0xFF;
8963 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
8964 }
8965
8966 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
8967 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
8968
8969 if (!assoc_req->wmeInfoPresent)
8970 {
8971 sta_ds->mlmStaContext.htCapability = 0;
8972#ifdef WLAN_FEATURE_11AC
8973 sta_ds->mlmStaContext.vhtCapability = 0;
8974#endif
8975 }
8976#ifdef WLAN_FEATURE_11AC
8977 if (limPopulateMatchingRateSet(pmac,
8978 sta_ds,
8979 &(assoc_req->supportedRates),
8980 &(assoc_req->extendedRates),
8981 assoc_req->HTCaps.supportedMCSSet,
8982 &(assoc_req->propIEinfo.propRates),
8983 session_entry , &assoc_req->VHTCaps)
8984 != eSIR_SUCCESS)
8985 {
8986#else
8987 if (limPopulateMatchingRateSet(pmac,
8988 sta_ds,
8989 &(assoc_req->supportedRates),
8990 &(assoc_req->extendedRates),
8991 assoc_req->HTCaps.supportedMCSSet,
8992 &(assoc_req->propIEinfo.propRates),
8993 session_entry) != eSIR_SUCCESS)
8994 {
8995#endif
8996 limLog(pmac, LOGE,
8997 FL("Rate set mismatched for aid=%d, MacAddr: "
8998 MAC_ADDRESS_STR),
8999 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9000 goto error;
9001 }
9002 return eSIR_SUCCESS;
9003error:
9004 return eSIR_FAILURE;
9005}
9006
9007/**
9008 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9009 *
9010 * @pmac: mac context
9011 * @sta_ds: STA state node
9012 * @assoc_req: Assoc request
9013 *
9014 * This function process recieved add sta message and store station's QOS
9015 * store them in station ds entry.
9016 *
9017 * Return: none
9018 */
9019static void
9020 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9021 tpDphHashNode sta_ds,
9022 tpSirAssocReq assoc_req)
9023{
9024 tHalBitVal qos_mode;
9025 tHalBitVal wsm_mode, wme_mode;
9026 tpPESession session_entry = limIsApSessionActive(pmac);
9027
9028 limGetQosMode(session_entry, &qos_mode);
9029 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9030 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9031
9032 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9033 {
9034 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9035 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9036 }
9037
9038 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9039 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9040 limGetWmeMode(session_entry, &wme_mode);
9041 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9042 (wme_mode == eHAL_SET))
9043 {
9044 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9045 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9046 limGetWsmMode(session_entry, &wsm_mode);
9047 /* WMM_APSD - WMM_SA related processing should be
9048 * separate; WMM_SA and WMM_APSD can coexist
9049 */
9050 if (assoc_req->WMMInfoStation.present)
9051 {
9052 /* check whether AP supports or not */
9053 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9054 && (session_entry->apUapsdEnable == 0) &&
9055 (assoc_req->WMMInfoStation.acbe_uapsd
9056 || assoc_req->WMMInfoStation.acbk_uapsd
9057 || assoc_req->WMMInfoStation.acvo_uapsd
9058 || assoc_req->WMMInfoStation.acvi_uapsd))
9059 {
9060 /*
9061 * Received Re/Association Request from
9062 * STA when UPASD is not supported
9063 */
9064 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9065 "to STA accordingly" ));
9066 /* update UAPSD and send it to LIM to add STA */
9067 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9068 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9069 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9070 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9071 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9072 }
9073 else
9074 {
9075 /* update UAPSD and send it to LIM to add STA */
9076 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9077 assoc_req->WMMInfoStation.acbe_uapsd;
9078 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9079 assoc_req->WMMInfoStation.acbk_uapsd;
9080 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9081 assoc_req->WMMInfoStation.acvo_uapsd;
9082 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9083 assoc_req->WMMInfoStation.acvi_uapsd;
9084 sta_ds->qos.capability.qosInfo.maxSpLen =
9085 assoc_req->WMMInfoStation.max_sp_length;
9086 }
9087 }
9088 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9089 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9090 }
9091}
9092
9093/**
9094 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9095 *
9096 * @pmac: mac context
9097 * @lim_msgq: Add Sta indication buffer
9098 *
9099 * This function will recieve buffer from firmware. This buffer will store
9100 * information about connected client. driver will process this buffer and
9101 * will register this client with driver. Driver will call limAddSta
9102 *
9103 * Return: none
9104 */
9105void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9106 tSapOfldAddStaIndMsg *lim_msgq)
9107{
9108 tpSirAssocReq assoc_req = NULL;
9109 tpDphHashNode sta_ds = NULL;
9110
9111 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9112 tpPESession session_entry = limIsApSessionActive(pmac);
9113
9114 if (session_entry == NULL)
9115 {
9116 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9117 return;
9118 }
9119 add_sta_req = lim_msgq;
9120 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9121 if (NULL == assoc_req) {
9122 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9123 return;
9124 }
9125 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9126
9127 /* parse Assoc req frame for station information */
9128 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9129 if (sta_ds == NULL)
9130 {
9131 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9132 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9133 vos_mem_free(assoc_req);
9134 goto error;
9135 }
9136
9137 /* Parse Station Capability */
9138 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9139
9140 /* Parse Station HT/VHT information */
9141 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9142 == eSIR_FAILURE)
9143 {
9144 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9145 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9146 vos_mem_free(assoc_req);
9147 goto error;
9148
9149 }
9150
9151 /* Parse Station QOS information */
9152 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9153
9154 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9155 sta_ds->staIndex = add_sta_req->staIdx;
9156 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9157 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9158 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9159 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9160 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9161 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309162 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309163
Agrawal Ashishce67f362017-01-05 20:10:58 +05309164 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9165 sta_ds->staIndex,
9166 sta_ds->bssId,
9167 sta_ds->dpuIndex,
9168 sta_ds->bcastDpuIndex,
9169 sta_ds->bcastMgmtDpuIdx,
9170 sta_ds->ucUcastSig,
9171 sta_ds->ucBcastSig,
9172 sta_ds->ucMgmtSig,
9173 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309174
9175 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9176 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9177 sta_ds->assocId);
9178 }
9179
9180error:
9181 return;
9182}
9183
9184/**
9185 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9186 *
9187 * @pmac: mac context
9188 * @lim_msgq: Del Sta indication buffer
9189 *
9190 * This function will recieve buffer from firmware. This buffer will
9191 * have information about clinet to remove with reason code.
9192 * This function will call limSendSmeDisassocInd to do cleanup
9193 * for station entry
9194 *
9195 * Return: none
9196 */
9197void
9198lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9199{
9200 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9201 tpDphHashNode sta_ds = NULL;
9202 tANI_U16 assoc_id = 0;
9203 tpPESession psession_entry = limIsApSessionActive(pmac);
9204
9205 if (psession_entry == NULL)
9206 {
9207 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9208 goto error;
9209 }
9210
9211 del_sta_req = lim_msgq;
9212 sta_ds = dphLookupHashEntry(pmac,
9213 del_sta_req->peer_macaddr,
9214 &assoc_id,
9215 &psession_entry->dph.dphHashTable);
9216 if (sta_ds == NULL)
9217 {
9218 /*
9219 * Disassociating STA is not associated.
9220 * Log error
9221 */
9222 PELOGE(limLog(pmac, LOGE,
9223 FL("received del sta event that sta not exist in table "
9224 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9225 del_sta_req->reason,
9226 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9227 goto error;
9228 }
9229
9230 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9231 {
9232 /*
9233 * Associate Id mismatch
9234 * Log error
9235 */
9236 PELOGE(limLog(pmac, LOGE,
9237 FL("received del sta event that sta assoc Id mismatch"));)
9238 goto error;
9239 }
9240
9241 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9242 sta_ds->mlmStaContext.disassocReason =
9243 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309244
9245 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9246
9247error:
9248 return;
9249}
9250#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309251
9252int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9253{
9254 tANI_U8 i;
9255 tpPESession psessionEntry = NULL;
9256
9257 for(i =0; i < pMac->lim.maxBssId; i++)
9258 {
9259 /* If BSSID matches return corresponding tables address*/
9260 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9261 {
9262 psessionEntry = (&pMac->lim.gpSession[i]);
9263 return psessionEntry->bssIdx;
9264 }
9265 }
9266
9267 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9268 return(0xFF);
9269}