blob: 661b5885d55c2e37d6e71210b00ada9dddffa296 [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
5254#if !defined WLAN_FEATURE_VOWIFI
5255 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005256 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005257 return;
5258 }
5259#endif
5260
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305261 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5262 {
5263 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5264 return;
5265 }
5266
Mihir Shetebc160b72014-08-22 14:10:39 +05305267 /*
5268 * Do not try to switch channel if RoC is in progress. RoC code path uses
5269 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5270 * has started listening on the channel requested as part of RoC, if we set
5271 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5272 * upper layers will think that the channel change is not successful and the
5273 * RoC from the upper layer perspective will never end...
5274 */
5275 if (pMac->lim.gpLimRemainOnChanReq)
5276 {
5277 limLog( pMac, LOGE, FL( "RoC is in progress"));
5278 return;
5279 }
5280
Jeff Johnsone7245742012-09-05 17:12:55 -07005281 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5282 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005283 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005284 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5285 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5286 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5287 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005288
5289 // Notify HAL
5290 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005291 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005292 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005293 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005294 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005295 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005296 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5297 pMac->lim.gpchangeChannelCallback = NULL;
5298 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005299
5300#if defined WLAN_FEATURE_VOWIFI
5301 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5302 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5303#else
5304 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5305 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5306#endif
5307
5308 //In case of IBSS, if STA should update HT Info IE in its beacons.
5309 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5310 {
5311 schSetFixedBeaconFields(pMac,psessionEntry);
5312 }
5313
5314 }
5315} // End limUpdateStaRunTimeHTParams.
5316
5317/**
5318 * \brief This function updates the lim global structure, if any of the
5319 * HT Capabilities have changed.
5320 *
5321 *
5322 * \param pMac Pointer to Global MAC structure
5323 *
5324 * \param pHTCapability Pointer to HT Capability Information Element
5325 * obtained from a Beacon or Probe Response
5326 *
5327 *
5328 *
5329 */
5330
5331void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5332 tDot11fIEHTCaps *pHTCaps )
5333{
5334
5335 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5336 {
5337 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5338 // Send change notification to HAL
5339 }
5340
5341 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5342 {
5343 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5344 // Send change notification to HAL
5345 }
5346
5347 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5348 {
5349 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5350 // Send change notification to HAL
5351 }
5352
5353
5354} // End limUpdateStaRunTimeHTCapability.
5355
5356/**
5357 * \brief This function updates lim global structure, if any of the HT
5358 * Info Parameters have changed.
5359 *
5360 *
5361 * \param pMac Pointer to the global MAC structure
5362 *
5363 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5364 * Probe Response
5365 *
5366 *
5367 */
5368
5369void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305370 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005371{
Jeff Johnsone7245742012-09-05 17:12:55 -07005372 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005373 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005374 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005375 // Send change notification to HAL
5376 }
5377
5378 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5379 {
5380 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5381 // Send change notification to HAL
5382 }
5383
5384 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5385 {
5386 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5387 // Send change notification to HAL
5388 }
5389
5390 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5391 {
5392 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5393 // Send change notification to HAL
5394 }
5395
5396 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5397 {
5398 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5399 }
5400
5401 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5402 {
5403 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5404 // Send change notification to HAL
5405 }
5406
5407 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5408 {
5409 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5410 // Send change notification to HAL
5411 }
5412
5413 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5414 {
5415 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5416 // Send change notification to HAL
5417 }
5418
5419 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5420 {
5421 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5422 // Send change notification to HAL
5423 }
5424
5425 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5426 {
5427 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5428 // Send change notification to HAL
5429 }
5430
5431 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5432 {
5433 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5434 // Send change notification to HAL
5435 }
5436
5437} // End limUpdateStaRunTimeHTInfo.
5438
5439
5440/** -------------------------------------------------------------
5441\fn limProcessHalIndMessages
5442\brief callback function for HAL indication
5443\param tpAniSirGlobal pMac
5444\param tANI_U32 mesgId
5445\param void *mesgParam
5446\return tSirRetStatu - status
5447 -------------------------------------------------------------*/
5448
5449tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5450{
5451 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5452 tSirMsgQ msg;
5453
5454 switch(msgId)
5455 {
5456 case SIR_LIM_DEL_TS_IND:
5457 case SIR_LIM_ADD_BA_IND:
5458 case SIR_LIM_DEL_BA_ALL_IND:
5459 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5460 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305461 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 msg.type = (tANI_U16) msgId;
5463 msg.bodyptr = msgParam;
5464 msg.bodyval = 0;
5465 break;
5466
5467 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305468 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005469 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005470 return eSIR_FAILURE;
5471 }
5472
5473 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5474 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305475 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005476 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5477 return eSIR_FAILURE;
5478 }
5479 return eSIR_SUCCESS;
5480}
5481
5482/** -------------------------------------------------------------
5483\fn limValidateDeltsReq
5484\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5485\param tpAniSirGlobal pMac
5486\param tpSirDeltsReq pDeltsReq
5487\param tSirMacAddr peerMacAddr
5488\return eSirRetStatus - status
5489 -------------------------------------------------------------*/
5490
5491tSirRetStatus
5492limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5493{
5494 tpDphHashNode pSta;
5495 tANI_U8 tsStatus;
5496 tSirMacTSInfo *tsinfo;
5497 tANI_U32 i;
5498 tANI_U8 tspecIdx;
5499 /* if sta
5500 * - verify assoc state
5501 * - del tspec locally
5502 * if ap,
5503 * - verify sta is in assoc state
5504 * - del sta tspec locally
5505 */
5506 if(pDeltsReq == NULL)
5507 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005508 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 return eSIR_FAILURE;
5510 }
5511
5512 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5513 {
5514 tANI_U32 val;
5515
5516 // station always talks to the AP
5517 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5518
5519 val = sizeof(tSirMacAddr);
5520 #if 0
5521 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5522 {
5523 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005524 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005525 return eSIR_FAILURE;
5526 }
5527 #endif// TO SUPPORT BT-AMP
5528 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5529
5530 }
5531 else
5532 {
5533 tANI_U16 assocId;
5534 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5535
5536 assocId = pDeltsReq->aid;
5537 if (assocId != 0)
5538 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5539 else
5540 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5541
5542 if (pSta != NULL)
5543 // TBD: check sta assoc state as well
5544 for (i =0; i < sizeof(tSirMacAddr); i++)
5545 macaddr[i] = pSta->staAddr[i];
5546 }
5547
5548 if (pSta == NULL)
5549 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005550 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 return eSIR_FAILURE;
5552 }
5553
5554 if ((! pSta->valid) ||
5555 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005557 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 return eSIR_FAILURE;
5559 }
5560
5561 pDeltsReq->req.wsmTspecPresent = 0;
5562 pDeltsReq->req.wmeTspecPresent = 0;
5563 pDeltsReq->req.lleTspecPresent = 0;
5564
5565 if ((pSta->wsmEnabled) &&
5566 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5567 pDeltsReq->req.wsmTspecPresent = 1;
5568 else if (pSta->wmeEnabled)
5569 pDeltsReq->req.wmeTspecPresent = 1;
5570 else if (pSta->lleEnabled)
5571 pDeltsReq->req.lleTspecPresent = 1;
5572 else
5573 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005574 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 return eSIR_FAILURE;
5576 }
5577
5578 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5579 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305580 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005581 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305583 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005584
5585 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005586
5587 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5588 != eSIR_SUCCESS)
5589 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005590 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005591 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5592 return eSIR_FAILURE;
5593 }
5594 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5595 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5596 {
5597 //edca only now.
5598 }
5599 else
5600 {
5601 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5602 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5603 {
5604 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305605 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5606 pSta->staIndex,
5607 tspecIdx,
5608 pDeltsReq->req,
5609 psessionEntry->peSessionId,
5610 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005612 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005613 tsinfo->traffic.userPrio);
5614 return eSIR_FAILURE;
5615 }
5616 }
5617 }
5618 return eSIR_SUCCESS;
5619}
5620
5621/** -------------------------------------------------------------
5622\fn limRegisterHalIndCallBack
5623\brief registers callback function to HAL for any indication.
5624\param tpAniSirGlobal pMac
5625\return none.
5626 -------------------------------------------------------------*/
5627void
5628limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5629{
5630 tSirMsgQ msg;
5631 tpHalIndCB pHalCB;
5632
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305633 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5634 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005635 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305636 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 return;
5638 }
5639
5640 pHalCB->pHalIndCB = limProcessHalIndMessages;
5641
5642 msg.type = WDA_REGISTER_PE_CALLBACK;
5643 msg.bodyptr = pHalCB;
5644 msg.bodyval = 0;
5645
Jeff Johnsone7245742012-09-05 17:12:55 -07005646 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5648 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305649 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005650 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005651 }
5652
5653 return;
5654}
5655
5656
5657/** -------------------------------------------------------------
5658\fn limProcessAddBaInd
5659
5660\brief handles the BA activity check timeout indication coming from HAL.
5661 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5662\param tpAniSirGlobal pMac
5663\param tSirMsgQ limMsg
5664\return None
5665-------------------------------------------------------------*/
5666void
5667limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5668{
5669 tANI_U8 i;
5670 tANI_U8 tid;
5671 tANI_U16 assocId;
5672 tpDphHashNode pSta;
5673 tpAddBaCandidate pBaCandidate;
5674 tANI_U32 baCandidateCnt;
5675 tpBaActivityInd pBaActivityInd;
5676 tpPESession psessionEntry;
5677 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005678#ifdef FEATURE_WLAN_TDLS
5679 boolean htCapable = FALSE;
5680#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005681
5682
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005683 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 return;
5685
5686 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5687 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5688
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005689 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005690 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005691 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305692 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005693 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005694 return;
5695 }
5696
5697 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005698#ifdef FEATURE_WLAN_TDLS
5699 if ((baCandidateCnt > pMac->lim.maxStation))
5700#else
5701 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5702#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305704 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005705 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005706 return;
5707 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005708
5709#ifdef FEATURE_WLAN_TDLS
5710 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5711 //AP capability
5712 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5713
5714 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5715 {
5716 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5717 if ((NULL == pSta) || (!pSta->valid))
5718 continue;
5719
5720 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5721 htCapable = pSta->mlmStaContext.htCapability;
5722 else
5723 htCapable = psessionEntry->htCapability;
5724
5725 if (htCapable)
5726 break;
5727 }
5728 if (!htCapable)
5729 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305730 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005731 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005732 return;
5733 }
5734#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005735
5736 //delete the complete dialoguetoken linked list
5737 limDeleteDialogueTokenList(pMac);
5738 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5739
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005740 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005741 {
5742 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005743 if ((NULL == pSta) || (!pSta->valid))
5744 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005745
5746 for (tid=0; tid<STACFG_MAX_TC; tid++)
5747 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005748 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005749 (pBaCandidate->baInfo[tid].fBaEnable))
5750 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305751 limLog(pMac, LOG1,
5752 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5753 pSta->staIndex, tid,
5754 pBaCandidate->baInfo[tid].startingSeqNum);
5755 limPostMlmAddBAReq(pMac, pSta, tid,
5756 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 }
5758 }
5759 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305760 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005761 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005762 return;
5763}
5764
5765
5766/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005767\fn limDeleteBASessions
5768\brief Deletes all the exisitng BA sessions for given session
5769 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005770\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005771\param tpPESession pSessionEntry
5772\param tANI_U32 baDirection
5773\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005774-------------------------------------------------------------*/
5775
5776void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005777limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305778 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005779{
5780 tANI_U32 i;
5781 tANI_U8 tid;
5782 tpDphHashNode pSta;
5783
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005784 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005785 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005786 limLog(pMac, LOGE, FL("Session does not exist"));
5787 }
5788 else
5789 {
5790 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005791 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005792 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5793 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5794 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5795 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005797 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005798 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005799 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5800 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005801 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005802 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5803 (baDirection & BA_INITIATOR))
5804 {
5805 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305806 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005807 pSessionEntry);
5808 }
5809 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5810 (baDirection & BA_RECIPIENT))
5811 {
5812 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305813 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005814 pSessionEntry);
5815 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005816 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005817 }
5818 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005819 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5820 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5821 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005822 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005823 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5824 &pSessionEntry->dph.dphHashTable);
5825 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005826 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005827 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5828 (baDirection & BA_INITIATOR))
5829 {
5830 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305831 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005832 pSessionEntry);
5833 }
5834 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5835 (baDirection & BA_RECIPIENT))
5836 {
5837 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305838 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005839 pSessionEntry);
5840 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005841 }
5842 }
5843 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005844 }
5845}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005846
5847/** -------------------------------------------------------------
5848\fn limDelAllBASessions
5849\brief Deletes all the exisitng BA sessions.
5850\param tpAniSirGlobal pMac
5851\return None
5852-------------------------------------------------------------*/
5853
5854void limDelAllBASessions(tpAniSirGlobal pMac)
5855{
5856 tANI_U32 i;
5857 tpPESession pSessionEntry;
5858
5859 for (i = 0; i < pMac->lim.maxBssId; i++)
5860 {
5861 pSessionEntry = peFindSessionBySessionId(pMac, i);
5862 if (pSessionEntry)
5863 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305864 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5865 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005866 }
5867 }
5868}
5869
5870/** -------------------------------------------------------------
5871\fn limDelAllBASessionsBtc
5872\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5873 band.
5874\param tpAniSirGlobal pMac
5875\return None
5876-------------------------------------------------------------*/
5877
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005878void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005879{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005880 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005881 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005882 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5883 &sessionId);
5884 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005885 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005886 PELOGW(limLog(pMac, LOGW,
5887 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305888 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305889 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005890 }
5891}
5892
Jeff Johnson295189b2012-06-20 16:38:30 -07005893/** -------------------------------------------------------------
5894\fn limProcessDelTsInd
5895\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5896 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5897\param tpAniSirGlobal pMac
5898\param tSirMsgQ limMsg
5899\return None
5900-------------------------------------------------------------*/
5901void
5902limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5903{
5904 tpDphHashNode pSta;
5905 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5906 tpSirDeltsReq pDelTsReq = NULL;
5907 tSirMacAddr peerMacAddr;
5908 tpSirDeltsReqInfo pDelTsReqInfo;
5909 tpLimTspecInfo pTspecInfo;
5910 tpPESession psessionEntry;
5911 tANI_U8 sessionId;
5912
5913if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5914 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005915 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305916 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005917 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005918 return;
5919 }
5920
5921 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5922 if(pTspecInfo->inuse == false)
5923 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005924 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 goto error1;
5926 }
5927
5928 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5929 if(pSta == NULL)
5930 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005931 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 pTspecInfo->assocId);
5933 goto error1;
5934 }
5935
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305936 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5937 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305939 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005940 goto error1;
5941 }
5942
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305943 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005944
5945 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305948 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005949
5950
5951 //validate the req
5952 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005954 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005955 goto error2;
5956 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305957 limLog(pMac, LOG1, "Sent DELTS request to station with "
5958 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5959 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005960
5961 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5962 psessionEntry);
5963
5964 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305965 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5966 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005967 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305968 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005969 goto error3;
5970 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305971 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005972
5973 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305974 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005975 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305976 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005977
5978 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5979
5980error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305981 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005982error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305983 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005984error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305985 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005986 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005987 return;
5988}
5989
5990/**
5991 * \brief Setup an A-MPDU/BA session
5992 *
5993 * \sa limPostMlmAddBAReq
5994 *
5995 * \param pMac The global tpAniSirGlobal object
5996 *
5997 * \param pStaDs DPH Hash Node object of peer STA
5998 *
5999 * \param tid TID for which a BA is being setup.
6000 * If this is set to 0xFFFF, then we retrieve
6001 * the default TID from the CFG
6002 *
6003 * \return eSIR_SUCCESS if setup completes successfully
6004 * eSIR_FAILURE is some problem is encountered
6005 */
6006tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6007 tpDphHashNode pStaDs,
6008 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6009{
6010 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006011 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006012 tpDialogueToken dialogueTokenNode;
6013 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006014
Jeff Johnson295189b2012-06-20 16:38:30 -07006015 // Check if the peer is a 11n capable STA
6016 // FIXME - Need a 11n peer indication in DPH.
6017 // For now, using the taurusPeer attribute
6018 //if( 0 == pStaDs->taurusPeer == )
6019 //return eSIR_SUCCESS;
6020
6021 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306022 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6023 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006024 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306025 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006026 status = eSIR_MEM_ALLOC_FAILED;
6027 goto returnFailure;
6028 }
6029
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306030 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006031
6032 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306033 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 pMlmAddBAReq->peerMacAddr,
6035 pStaDs->staAddr,
6036 sizeof( tSirMacAddr ));
6037
6038 // Update the TID
6039 pMlmAddBAReq->baTID = tid;
6040
6041 // Determine the supported BA policy of local STA
6042 // for the TID of interest
6043 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6044
6045 // BA Buffer Size
6046 // Requesting the ADDBA recipient to populate the size.
6047 // If ADDBA is accepted, a non-zero buffer size should
6048 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306049 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6050 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6051 {
6052 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6053 causing very low throughput in HT40 case */
6054 limLog( pMac, LOGW,
6055 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6056 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6057 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306058 else if (pMac->miracastVendorConfig)
6059 {
6060 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6061 {
6062 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6063 status = eSIR_FAILURE;
6064 goto returnFailure;
6065 }
6066
6067 pMlmAddBAReq->baBufferSize = val;
6068 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306069 else
6070 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006071
6072 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306073 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 -07006074 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6075 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306076 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006077
6078 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006079 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006081 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006082 status = eSIR_FAILURE;
6083 goto returnFailure;
6084 }
6085 pMlmAddBAReq->baTimeout = val; // In TU's
6086
6087 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006088 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6090 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6091
6092 // BA Starting Sequence Number
6093 pMlmAddBAReq->baSSN = startingSeqNum;
6094
6095 /* Update PE session Id*/
6096 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6097
6098 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6099
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006100 dialogueTokenNode = limAssignDialogueToken(pMac);
6101 if (NULL == dialogueTokenNode)
6102 {
6103 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6104 status = eSIR_FAILURE;
6105 goto returnFailure;
6106 }
6107
Jeff Johnson295189b2012-06-20 16:38:30 -07006108 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006109 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006110 dialogueTokenNode->assocId = pStaDs->assocId;
6111 dialogueTokenNode->tid = tid;
6112 // Send ADDBA Req to MLME
6113 limPostMlmMessage( pMac,
6114 LIM_MLM_ADDBA_REQ,
6115 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006116 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006117
6118returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306119 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006120 return status;
6121}
6122
6123/**
6124 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6125 * will then send an ADDBA Rsp to peer MAC entity
6126 * with the appropriate ADDBA status code
6127 *
6128 * \sa limPostMlmAddBARsp
6129 *
6130 * \param pMac The global tpAniSirGlobal object
6131 *
6132 * \param peerMacAddr MAC address of peer entity that will
6133 * be the recipient of this ADDBA Rsp
6134 *
6135 * \param baStatusCode ADDBA Rsp status code
6136 *
6137 * \param baDialogToken ADDBA Rsp dialog token
6138 *
6139 * \param baTID TID of interest
6140 *
6141 * \param baPolicy The BA policy
6142 *
6143 * \param baBufferSize The BA buffer size
6144 *
6145 * \param baTimeout BA timeout in TU's
6146 *
6147 * \return eSIR_SUCCESS if setup completes successfully
6148 * eSIR_FAILURE is some problem is encountered
6149 */
6150tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6151 tSirMacAddr peerMacAddr,
6152 tSirMacStatusCodes baStatusCode,
6153 tANI_U8 baDialogToken,
6154 tANI_U8 baTID,
6155 tANI_U8 baPolicy,
6156 tANI_U16 baBufferSize,
6157 tANI_U16 baTimeout,
6158 tpPESession psessionEntry)
6159{
6160tSirRetStatus status = eSIR_SUCCESS;
6161tpLimMlmAddBARsp pMlmAddBARsp;
6162
6163 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306164 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6165 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006166 {
6167 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306168 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006169 status );
6170
6171 status = eSIR_MEM_ALLOC_FAILED;
6172 goto returnFailure;
6173 }
6174
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306175 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006176
6177 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306178 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006179 pMlmAddBARsp->peerMacAddr,
6180 peerMacAddr,
6181 sizeof( tSirMacAddr ));
6182
6183 pMlmAddBARsp->baDialogToken = baDialogToken;
6184 pMlmAddBARsp->addBAResultCode = baStatusCode;
6185 pMlmAddBARsp->baTID = baTID;
6186 pMlmAddBARsp->baPolicy = baPolicy;
6187 pMlmAddBARsp->baBufferSize = baBufferSize;
6188 pMlmAddBARsp->baTimeout = baTimeout;
6189
6190 /* UPdate PE session ID*/
6191 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6192
6193 // Send ADDBA Rsp to MLME
6194 limPostMlmMessage( pMac,
6195 LIM_MLM_ADDBA_RSP,
6196 (tANI_U32 *) pMlmAddBARsp );
6197
6198returnFailure:
6199
6200 return status;
6201}
6202
6203/**
6204 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6205 * will then send an DELBA Ind to peer MAC entity
6206 * with the appropriate DELBA status code
6207 *
6208 * \sa limPostMlmDelBAReq
6209 *
6210 * \param pMac The global tpAniSirGlobal object
6211 *
6212 * \param pSta DPH Hash Node object of peer MAC entity
6213 * for which the BA session is being deleted
6214 *
6215 * \param baDirection DELBA direction
6216 *
6217 * \param baTID TID for which the BA session is being deleted
6218 *
6219 * \param baReasonCode DELBA Req reason code
6220 *
6221 * \return eSIR_SUCCESS if setup completes successfully
6222 * eSIR_FAILURE is some problem is encountered
6223 */
6224tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6225 tpDphHashNode pSta,
6226 tANI_U8 baDirection,
6227 tANI_U8 baTID,
6228 tSirMacReasonCodes baReasonCode,
6229 tpPESession psessionEntry)
6230{
6231tSirRetStatus status = eSIR_SUCCESS;
6232tpLimMlmDelBAReq pMlmDelBAReq;
6233tLimBAState curBaState;
6234
6235if(NULL == pSta)
6236 return eSIR_FAILURE;
6237
6238LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6239
6240 // Need to validate the current BA State.
6241 if( eLIM_BA_STATE_IDLE != curBaState)
6242 {
6243 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006244 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006245 baTID,
6246 curBaState);
6247
6248 status = eSIR_FAILURE;
6249 goto returnFailure;
6250 }
6251
6252 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306253 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6254 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006255 {
6256 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306257 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006258 status );
6259
6260 status = eSIR_MEM_ALLOC_FAILED;
6261 goto returnFailure;
6262 }
6263
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306264 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006265
6266 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306267 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006268 pMlmDelBAReq->peerMacAddr,
6269 pSta->staAddr,
6270 sizeof( tSirMacAddr ));
6271
6272 pMlmDelBAReq->baDirection = baDirection;
6273 pMlmDelBAReq->baTID = baTID;
6274 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6275
6276 /* Update PE session ID*/
6277 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6278
6279 //we don't have valid BA session for the given direction.
6280 // HDD wants to get the BA session deleted on PEER in this case.
6281 // in this case we just need to send DelBA to the peer.
6282 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6283 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6284 {
6285 // Send DELBA Ind over the air
6286 if( eSIR_SUCCESS !=
6287 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6288 status = eSIR_FAILURE;
6289
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306290 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006291 return status;
6292 }
6293
6294
6295 // Update the BA state in STA
6296 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6297
6298 // Send DELBA Req to MLME
6299 limPostMlmMessage( pMac,
6300 LIM_MLM_DELBA_REQ,
6301 (tANI_U32 *) pMlmDelBAReq );
6302
6303returnFailure:
6304
6305 return status;
6306}
6307
6308/**
6309 * \brief Send WDA_ADDBA_REQ to HAL, in order
6310 * to setup a new BA session with a peer
6311 *
6312 * \sa limPostMsgAddBAReq
6313 *
6314 * \param pMac The global tpAniSirGlobal object
6315 *
6316 * \param pSta Runtime, STA-related configuration cached
6317 * in the HashNode object
6318 *
6319 * \param baDialogToken The Action Frame dialog token
6320 *
6321 * \param baTID TID for which the BA session is being setup
6322 *
6323 * \param baPolicy BA Policy
6324 *
6325 * \param baBufferSize The requested BA buffer size
6326 *
6327 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6328 *
6329 * \param baSSN Starting Sequence Number for this BA session
6330 *
6331 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6332 *
6333 * \return none
6334 *
6335 */
6336tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6337 tpDphHashNode pSta,
6338 tANI_U8 baDialogToken,
6339 tANI_U8 baTID,
6340 tANI_U8 baPolicy,
6341 tANI_U16 baBufferSize,
6342 tANI_U16 baTimeout,
6343 tANI_U16 baSSN,
6344 tANI_U8 baDirection,
6345 tpPESession psessionEntry)
6346{
6347tpAddBAParams pAddBAParams = NULL;
6348tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006349tSirMsgQ msgQ;
6350
6351#ifdef WLAN_SOFTAP_VSTA_FEATURE
6352 // we can only do BA on "hard" STAs
6353 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6354 {
6355 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306356 limLog( pMac, LOGE,
6357 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006358 goto returnFailure;
6359 }
6360#endif //WLAN_SOFTAP_VSTA_FEATURE
6361
6362 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306363 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6364 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006365 {
6366 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306367 FL("AllocateMemory failed")
6368 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006369
6370 retCode = eSIR_MEM_ALLOC_FAILED;
6371 goto returnFailure;
6372 }
6373
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306374 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006375
6376 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306377 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006378 (void *) pAddBAParams->peerMacAddr,
6379 (void *) pSta->staAddr,
6380 sizeof( tSirMacAddr ));
6381
6382 // Populate the REQ parameters
6383 pAddBAParams->staIdx = pSta->staIndex;
6384 pAddBAParams->baDialogToken = baDialogToken;
6385 pAddBAParams->baTID = baTID;
6386 pAddBAParams->baPolicy = baPolicy;
6387 pAddBAParams->baBufferSize = baBufferSize;
6388 pAddBAParams->baTimeout = baTimeout;
6389 pAddBAParams->baSSN = baSSN;
6390 pAddBAParams->baDirection = baDirection;
6391 pAddBAParams->respReqd = 1;
6392
6393 /* UPdate PE session ID */
6394 pAddBAParams->sessionId = psessionEntry->peSessionId;
6395
6396 // Post WDA_ADDBA_REQ to HAL.
6397 msgQ.type = WDA_ADDBA_REQ;
6398 //
6399 // FIXME_AMPDU
6400 // A global counter (dialog token) is required to keep track of
6401 // all PE <-> HAL communication(s)
6402 //
6403 msgQ.reserved = 0;
6404 msgQ.bodyptr = pAddBAParams;
6405 msgQ.bodyval = 0;
6406
6407 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306408 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6409 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6410 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6411 pAddBAParams->baTimeout, pAddBAParams->baTID,
6412 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6413 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006414
6415 //defer any other message until we get response back.
6416 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6417
Jeff Johnsone7245742012-09-05 17:12:55 -07006418 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006419#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6420 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6421#endif //FEATURE_WLAN_DIAG_SUPPORT
6422
6423 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6424 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006425 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006426 retCode );
6427 else
6428 return retCode;
6429
6430returnFailure:
6431
6432 // Clean-up...
6433 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306434 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006435
6436 return retCode;
6437
6438}
6439
6440/**
6441 * \brief Send WDA_DELBA_IND to HAL, in order
6442 * to delete an existing BA session with peer
6443 *
6444 * \sa limPostMsgDelBAInd
6445 *
6446 * \param pMac The global tpAniSirGlobal object
6447 *
6448 * \param pSta Runtime, STA-related configuration cached
6449 * in the HashNode object
6450 *
6451 * \param baTID TID for which the BA session is being setup
6452 *
6453 * \param baDirection Identifies whether the DELBA Ind was
6454 * sent by the BA initiator or recipient
6455 *
6456 * \return none
6457 *
6458 */
6459tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6460 tpDphHashNode pSta,
6461 tANI_U8 baTID,
6462 tANI_U8 baDirection,
6463 tpPESession psessionEntry)
6464{
6465tpDelBAParams pDelBAParams = NULL;
6466tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006467tSirMsgQ msgQ;
6468
6469 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306470 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6471 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006472 {
6473 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306474 FL("AllocateMemory failed")
6475 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006476
6477 retCode = eSIR_MEM_ALLOC_FAILED;
6478 goto returnFailure;
6479 }
6480
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306481 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006482
6483 // Populate the REQ parameters
6484 pDelBAParams->staIdx = pSta->staIndex;
6485 pDelBAParams->baTID = baTID;
6486 pDelBAParams->baDirection = baDirection;
6487
6488 /* Update PE session ID */
6489
6490
6491 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6492 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6493
6494 // Post WDA_DELBA_IND to HAL.
6495 msgQ.type = WDA_DELBA_IND;
6496 //
6497 // FIXME:
6498 // A global counter (dialog token) is required to keep track of
6499 // all PE <-> HAL communication(s)
6500 //
6501 msgQ.reserved = 0;
6502 msgQ.bodyptr = pDelBAParams;
6503 msgQ.bodyval = 0;
6504
6505 limLog( pMac, LOGW,
6506 FL( "Sending SIR_HAL_DELBA_IND..." ));
6507
Jeff Johnsone7245742012-09-05 17:12:55 -07006508 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006509#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6510 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6511#endif //FEATURE_WLAN_DIAG_SUPPORT
6512
6513 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6514 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006515 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006516 retCode );
6517 else
6518 {
6519 // Update LIM's internal cache...
6520 if( eBA_INITIATOR == baDirection)
6521 {
6522 pSta->tcCfg[baTID].fUseBATx = 0;
6523 pSta->tcCfg[baTID].txBufSize = 0;
6524 }
6525 else
6526 {
6527 pSta->tcCfg[baTID].fUseBARx = 0;
6528 pSta->tcCfg[baTID].rxBufSize = 0;
6529 }
6530
6531 return retCode;
6532 }
6533
6534returnFailure:
6535
6536 // Clean-up...
6537 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306538 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006539
6540 return retCode;
6541
6542}
6543
6544/**
6545 * @function : limPostSMStateUpdate()
6546 *
6547 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6548 *
6549 * LOGIC:
6550 *
6551 * ASSUMPTIONS:
6552 * NA
6553 *
6554 * NOTE:
6555 * NA
6556 *
6557 * @param pMac - Pointer to Global MAC structure
6558 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6559 * @return None
6560 */
6561tSirRetStatus
6562limPostSMStateUpdate(tpAniSirGlobal pMac,
6563 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6564{
6565 tSirRetStatus retCode = eSIR_SUCCESS;
6566 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006567 tpSetMIMOPS pMIMO_PSParams;
6568
6569 msgQ.reserved = 0;
6570 msgQ.type = WDA_SET_MIMOPS_REQ;
6571
6572 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306573 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6574 if ( NULL == pMIMO_PSParams )
6575 {
6576 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006577 return eSIR_MEM_ALLOC_FAILED;
6578 }
6579
6580 pMIMO_PSParams->htMIMOPSState = state;
6581 pMIMO_PSParams->staIdx = staIdx;
6582 pMIMO_PSParams->fsendRsp = true;
6583 msgQ.bodyptr = pMIMO_PSParams;
6584 msgQ.bodyval = 0;
6585
6586 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6587
Jeff Johnsone7245742012-09-05 17:12:55 -07006588 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006589 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6590 if (eSIR_SUCCESS != retCode)
6591 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006592 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306593 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006594 return retCode;
6595 }
6596
6597 return retCode;
6598}
6599
6600void limPktFree (
6601 tpAniSirGlobal pMac,
6602 eFrameType frmType,
6603 tANI_U8 *pRxPacketInfo,
6604 void *pBody)
6605{
6606 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006607}
6608
6609/**
6610 * limGetBDfromRxPacket()
6611 *
6612 *FUNCTION:
6613 * This function is called to get pointer to Polaris
6614 * Buffer Descriptor containing MAC header & other control
6615 * info from the body of the message posted to LIM.
6616 *
6617 *LOGIC:
6618 * NA
6619 *
6620 *ASSUMPTIONS:
6621 * NA
6622 *
6623 *NOTE:
6624 * NA
6625 *
6626 * @param body - Received message body
6627 * @param pRxPacketInfo - Pointer to received BD
6628 * @return None
6629 */
6630
6631void
6632limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6633{
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006635} /*** end limGetBDfromRxPacket() ***/
6636
6637
6638
6639
6640
6641void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6642{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306643 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006644}
6645
6646
6647void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6648{
6649 tANI_U8 i;
6650 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6651
6652 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6653 {
6654 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6655 {
6656 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6657 fFound = eANI_BOOLEAN_TRUE;
6658 break;
6659 }
6660 }
6661 if(eANI_BOOLEAN_FALSE == fFound)
6662 {
6663 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6664 {
6665 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6666 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6667 }
6668 else
6669 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006670 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006671 }
6672 }
6673}
6674
6675
6676/**
6677 * @function : limIsChannelValidForChannelSwitch()
6678 *
6679 * @brief : This function checks if the channel to which AP
6680 * is expecting us to switch, is a valid channel for us.
6681 * LOGIC:
6682 *
6683 * ASSUMPTIONS:
6684 * NA
6685 *
6686 * NOTE:
6687 * NA
6688 *
6689 * @param pMac - Pointer to Global MAC structure
6690 * @param channel - New channel to which we are expected to move
6691 * @return None
6692 */
6693tAniBool
6694limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6695{
6696 tANI_U8 index;
6697 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6698 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6699
6700 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6701 (tANI_U8 *)validChannelList,
6702 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6703 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006704 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 return (eSIR_FALSE);
6706 }
6707
6708 for(index = 0; index < validChannelListLen; index++)
6709 {
6710 if(validChannelList[index] == channel)
6711 return (eSIR_TRUE);
6712 }
6713
6714 /* channel does not belong to list of valid channels */
6715 return (eSIR_FALSE);
6716}
6717
6718/**------------------------------------------------------
6719\fn __limFillTxControlParams
6720\brief Fill the message for stopping/resuming tx.
6721
6722\param pMac
6723\param pTxCtrlMsg - Pointer to tx control message.
6724\param type - Which way we want to stop/ resume tx.
6725\param mode - To stop/resume.
6726 -------------------------------------------------------*/
6727static eHalStatus
6728__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6729 tLimQuietTxMode type, tLimControlTx mode)
6730{
6731
6732 //TBD-RAJESH HOW TO GET sessionEntry?????
6733 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6734
6735 if (mode == eLIM_STOP_TX)
6736 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6737 else
6738 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6739
6740 switch (type)
6741 {
6742 case eLIM_TX_ALL:
6743 /** Stops/resumes transmission completely */
6744 pTxCtrlMsg->fCtrlGlobal = 1;
6745 break;
6746
6747 case eLIM_TX_BSS_BUT_BEACON:
6748 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6749 * stop beacon transmission.
6750 */
6751 pTxCtrlMsg->ctrlBss = 1;
6752 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6753 break;
6754
6755 case eLIM_TX_STA:
6756 /** Memory for station bitmap is allocated dynamically in caller of this
6757 * so decode properly here and fill the bitmap. Now not implemented,
6758 * fall through.
6759 */
6760 case eLIM_TX_BSS:
6761 //Fall thru...
6762 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006763 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006764 return eHAL_STATUS_FAILURE;
6765 }
6766
6767 return eHAL_STATUS_SUCCESS;
6768}
6769
6770/**
6771 * @function : limFrameTransmissionControl()
6772 *
6773 * @brief : This API is called by the user to halt/resume any frame
6774 * transmission from the device. If stopped, all frames will be
6775 * queued starting from hardware. Then back-pressure
6776 * is built till the driver.
6777 * LOGIC:
6778 *
6779 * ASSUMPTIONS:
6780 * NA
6781 *
6782 * NOTE:
6783 * NA
6784 *
6785 * @param pMac - Pointer to Global MAC structure
6786 * @return None
6787 */
6788void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6789{
6790
6791 eHalStatus status = eHAL_STATUS_FAILURE;
6792 tpTxControlParams pTxCtrlMsg;
6793 tSirMsgQ msgQ;
6794 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6795
6796 /** Allocate only required number of bytes for station bitmap
6797 * Make it to align to 4 byte boundary */
6798 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6799
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306800 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6801 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006802 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306803 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006804 return;
6805 }
6806
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306807 vos_mem_set((void *) pTxCtrlMsg,
6808 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006809 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6810 if (status != eHAL_STATUS_SUCCESS)
6811 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306812 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006813 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006814 return;
6815 }
6816
6817 msgQ.bodyptr = (void *) pTxCtrlMsg;
6818 msgQ.bodyval = 0;
6819 msgQ.reserved = 0;
6820 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6821
Jeff Johnsone7245742012-09-05 17:12:55 -07006822 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006823 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6824 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306825 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006826 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006827 return;
6828 }
6829
6830 if (mode == eLIM_STOP_TX)
6831 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306832 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 }
6834 else
6835 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306836 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006837 }
6838 return;
6839}
6840
6841
6842/**
6843 * @function : limRestorePreChannelSwitchState()
6844 *
6845 * @brief : This API is called by the user to undo any
6846 * specific changes done on the device during
6847 * channel switch.
6848 * LOGIC:
6849 *
6850 * ASSUMPTIONS:
6851 * NA
6852 *
6853 * NOTE:
6854 * NA
6855 *
6856 * @param pMac - Pointer to Global MAC structure
6857 * @return None
6858 */
6859
6860tSirRetStatus
6861limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6862{
6863
6864 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006865 tANI_U32 val = 0;
6866
6867 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6868 return retCode;
6869
6870 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006871 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006872
6873 /* Restore the frame transmission, all the time. */
6874 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6875
6876 /* Free to enter BMPS */
6877 limSendSmePostChannelSwitchInd(pMac);
6878
6879 //Background scan is now enabled by SME
6880 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6881 {
6882 /* Enable background scan if already enabled, else don't bother */
6883 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6884 &val)) != eSIR_SUCCESS)
6885
6886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006887 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006888 return (retCode);
6889 }
6890
6891 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6892 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006893 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6894 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006895 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6896 {
6897 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6898 return (eSIR_FAILURE);
6899 }
6900
6901 }
6902 }
6903
6904 /* Enable heartbeat timer */
6905 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6906 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006907 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6908 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6909 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6910 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 {
6912 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6913 return (eSIR_FAILURE);
6914 }
6915 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 return (retCode);
6917}
6918
6919
6920/**--------------------------------------------
6921\fn limRestorePreQuietState
6922\brief Restore the pre quiet state
6923
6924\param pMac
6925\return NONE
6926---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006927tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006928{
6929
6930 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 tANI_U32 val = 0;
6932
6933 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6934 return retCode;
6935
6936 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006937 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006938
6939 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006940 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006941 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6942
6943
6944 //Background scan is now enabled by SME
6945 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6946 {
6947 /* Enable background scan if already enabled, else don't bother */
6948 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6949 &val)) != eSIR_SUCCESS)
6950
6951 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006952 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006953 return (retCode);
6954 }
6955
6956 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6957 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006958 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006959 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6960 {
6961 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6962 return (eSIR_FAILURE);
6963 }
6964
6965 }
6966 }
6967
6968 /* Enable heartbeat timer */
6969 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6970 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006971 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006972 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006973 {
6974 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6975 return (eSIR_FAILURE);
6976 }
6977 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006978 return (retCode);
6979}
6980
6981
6982/**
6983 * @function: limPrepareFor11hChannelSwitch()
6984 *
6985 * @brief : This API is called by the user to prepare for
6986 * 11h channel switch. As of now, the API does
6987 * very minimal work. User can add more into the
6988 * same API if needed.
6989 * LOGIC:
6990 *
6991 * ASSUMPTIONS:
6992 * NA
6993 *
6994 * NOTE:
6995 * NA
6996 *
6997 * @param pMac - Pointer to Global MAC structure
6998 * @param psessionEntry
6999 * @return None
7000 */
7001void
7002limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7003{
Jeff Johnson295189b2012-06-20 16:38:30 -07007004 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7005 return;
7006
7007 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007008 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007009
7010 /* Disable, Stop background scan if enabled and running */
7011 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7012
7013 /* Stop heart-beat timer to stop heartbeat disassociation */
7014 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7015
7016 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7017 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7018 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007019 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007020 /* Stop ongoing scanning if any */
7021 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7022 {
7023 //Set the resume channel to Any valid channel (invalid).
7024 //This will instruct HAL to set it to any previous valid channel.
7025 peSetResumeChannel(pMac, 0, 0);
7026 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7027 }
7028 else
7029 {
7030 limRestorePreChannelSwitchState(pMac, psessionEntry);
7031 }
7032 return;
7033 }
7034 else
7035 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007036 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007037 /** We are safe to switch channel at this point */
7038 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007040}
7041
7042
7043
7044/**----------------------------------------------------
7045\fn limGetNwType
7046
7047\brief Get type of the network from data packet or beacon
7048\param pMac
7049\param channelNum - Channel number
7050\param type - Type of packet.
7051\param pBeacon - Pointer to beacon or probe response
7052
7053\return Network type a/b/g.
7054-----------------------------------------------------*/
7055tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7056{
7057 tSirNwType nwType = eSIR_11B_NW_TYPE;
7058
7059 if (type == SIR_MAC_DATA_FRAME)
7060 {
7061 if ((channelNum > 0) && (channelNum < 15))
7062 {
7063 nwType = eSIR_11G_NW_TYPE;
7064 }
7065 else
7066 {
7067 nwType = eSIR_11A_NW_TYPE;
7068 }
7069 }
7070 else
7071 {
7072 if ((channelNum > 0) && (channelNum < 15))
7073 {
7074 int i;
7075 // 11b or 11g packet
7076 // 11g iff extended Rate IE is present or
7077 // if there is an A rate in suppRate IE
7078 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7079 {
7080 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7081 {
7082 nwType = eSIR_11G_NW_TYPE;
7083 break;
7084 }
7085 }
7086 if (pBeacon->extendedRatesPresent)
7087 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007088 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007089 nwType = eSIR_11G_NW_TYPE;
7090 }
7091 }
7092 else
7093 {
7094 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007095 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007096 nwType = eSIR_11A_NW_TYPE;
7097 }
7098 }
7099 return nwType;
7100}
7101
7102
7103/**---------------------------------------------------------
7104\fn limGetChannelFromBeacon
7105\brief To extract channel number from beacon
7106
7107\param pMac
7108\param pBeacon - Pointer to beacon or probe rsp
7109\return channel number
7110-----------------------------------------------------------*/
7111tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7112{
7113 tANI_U8 channelNum = 0;
7114
7115 if (pBeacon->dsParamsPresent)
7116 channelNum = pBeacon->channelNumber;
7117 else if(pBeacon->HTInfo.present)
7118 channelNum = pBeacon->HTInfo.primaryChannel;
7119 else
7120 channelNum = pBeacon->channelNumber;
7121
7122 return channelNum;
7123}
7124
7125
7126/** ---------------------------------------------------------
7127\fn limSetTspecUapsdMask
7128\brief This function sets the PE global variable:
7129\ 1) gUapsdPerAcTriggerEnableMask and
7130\ 2) gUapsdPerAcDeliveryEnableMask
7131\ based on the user priority field and direction field
7132\ in the TS Info Fields.
7133\
7134\ An AC is a trigger-enabled AC if the PSB subfield
7135\ is set to 1 in the uplink direction.
7136\ An AC is a delivery-enabled AC if the PSB subfield
7137\ is set to 1 in the down-link direction.
7138\
7139\param tpAniSirGlobal pMac
7140\param tSirMacTSInfo pTsInfo
7141\param tANI_U32 action
7142\return None
7143 ------------------------------------------------------------*/
7144void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7145{
7146 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7147 tANI_U16 direction = pTsInfo->traffic.direction;
7148 tANI_U8 ac = upToAc(userPrio);
7149
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307150 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 -07007151
7152 /* Converting AC to appropriate Uapsd Bit Mask
7153 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7154 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7155 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7156 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7157 */
7158 ac = ((~ac) & 0x3);
7159
7160 if (action == CLEAR_UAPSD_MASK)
7161 {
7162 if (direction == SIR_MAC_DIRECTION_UPLINK)
7163 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7164 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7165 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7166 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7167 {
7168 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7169 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7170 }
7171 }
7172 else if (action == SET_UAPSD_MASK)
7173 {
7174 if (direction == SIR_MAC_DIRECTION_UPLINK)
7175 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7176 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7177 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7178 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7179 {
7180 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7181 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7182 }
7183 }
7184
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007185 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7186 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007187
7188 return;
7189}
7190
7191
7192
7193void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7194{
7195
7196 tANI_U8 i;
7197 for(i =0;i < pMac->lim.maxBssId;i++)
7198 {
7199 if(pMac->lim.gpSession[i].valid == TRUE )
7200 {
7201 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7202 {
7203 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7204 break;
7205 }
7206
7207 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7208 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7209 {
7210 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7211 }
7212 }
7213 }
7214 for(i=0; i< pMac->lim.maxBssId; i++)
7215 {
7216 if(pMac->lim.gpSession[i].valid == TRUE )
7217 {
7218 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7219 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7220 {
7221 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7222 {
7223 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007224 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007225 i);)
7226 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7227 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7228 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7229 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007230 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007231 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7232 }
7233 break;
7234 }
7235 }
7236 }
7237 }
7238}
7239
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007240void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7241{
7242 if(psessionEntry->valid == TRUE )
7243 {
7244 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7245 {
7246 limIbssHeartBeatHandle(pMac,psessionEntry);
7247 }
7248 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7249 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7250 {
7251 limHandleHeartBeatFailure(pMac,psessionEntry);
7252 }
7253 }
7254 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7255 and the other things again */
7256 if(psessionEntry->valid == TRUE )
7257 {
7258 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7259 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7260 {
7261 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7262 {
7263 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7264 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7265 psessionEntry->bssIdx);)
7266 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7267 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7268 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7269 {
7270 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7271 limReactivateHeartBeatTimer(pMac, psessionEntry);
7272 }
7273 }
7274 }
7275 }
7276}
7277
7278
Jeff Johnson295189b2012-06-20 16:38:30 -07007279tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7280{
7281 tANI_U8 i;
7282 for(i =0;i < pMac->lim.maxBssId;i++)
7283 {
7284 if(pMac->lim.gpSession[i].valid == TRUE )
7285 {
7286 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7287 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7288 {
7289 return pMac->lim.gpSession[i].currentOperChannel;
7290 }
7291 }
7292 }
7293 return 0;
7294}
7295
7296void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7297{
7298
7299 tpPESession psessionEntry;
7300// tANI_U8 sessionId;
7301 tpAddStaParams pAddStaParams;
7302
7303 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7304
7305 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7306 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007307 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307308 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007309 return;
7310 }
7311 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7312 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007313#ifdef FEATURE_WLAN_TDLS
7314 else if(pMac->lim.gLimAddStaTdls)
7315 {
7316 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7317 pMac->lim.gLimAddStaTdls = FALSE ;
7318 }
7319#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007320 else
7321 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7322
7323}
7324
7325
7326void limUpdateBeacon(tpAniSirGlobal pMac)
7327{
7328 tANI_U8 i;
7329
7330 for(i =0;i < pMac->lim.maxBssId;i++)
7331 {
7332 if(pMac->lim.gpSession[i].valid == TRUE )
7333 {
7334 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7335 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7336 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7337 )
7338 {
7339 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7340 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7341 }
7342 else
7343 {
7344 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7345 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7346 {
7347
7348 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7349 {
7350 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7351 }
7352 }
7353 }
7354 }
7355 }
7356}
7357
7358void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7359{
7360 tANI_U8 i;
7361 tpPESession psessionEntry;
7362 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7363 for(i =0; i < pMac->lim.maxBssId; i++)
7364 {
7365 if(pMac->lim.gpSession[i].valid == TRUE)
7366 {
7367 psessionEntry = &pMac->lim.gpSession[i];
7368 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7369 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307370 limLog(pMac, LOGE,
7371 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7372 psessionEntry->limSmeState, psessionEntry->limMlmState,
7373 psessionEntry->LimRxedBeaconCntDuringHB,
7374 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007375#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7376 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7377#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007378 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7379 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307380 /* Disconnect even if we have not received a single beacon
7381 * after connection.
7382 */
7383 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7384 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307385 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7386 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007387 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007388 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007389 /* AP did not respond to Probe Request. Tear down link with it.*/
7390 limTearDownLinkWithAp(pMac,
7391 psessionEntry->peSessionId,
7392 eSIR_BEACON_MISSED);
7393 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7394 }
7395 else // restart heartbeat timer
7396 {
7397 limReactivateHeartBeatTimer(pMac, psessionEntry);
7398 }
7399 }
7400 else
7401 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007402 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007403 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7404 limReactivateHeartBeatTimer(pMac, psessionEntry);
7405 }
7406
7407 }
7408 }
7409 }
7410 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7411 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7412}
7413
7414
7415/*
7416* This function assumes there will not be more than one IBSS session active at any time.
7417*/
7418tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7419{
7420 tANI_U8 i;
7421
7422 for(i =0;i < pMac->lim.maxBssId;i++)
7423 {
7424 if( (pMac->lim.gpSession[i].valid) &&
7425 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7426 return (&pMac->lim.gpSession[i]);
7427 }
7428
7429 return NULL;
7430}
7431
7432tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7433{
7434 tANI_U8 i;
7435
7436 for(i =0;i < pMac->lim.maxBssId;i++)
7437 {
7438 if( (pMac->lim.gpSession[i].valid) &&
7439 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7440 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7441 return (&pMac->lim.gpSession[i]);
7442 }
7443
7444 return NULL;
7445}
7446
7447/**---------------------------------------------------------
7448\fn limHandleDeferMsgError
7449\brief handles error scenario, when the msg can not be deferred.
7450\param pMac
7451\param pLimMsg LIM msg, which could not be deferred.
7452\return void
7453-----------------------------------------------------------*/
7454
7455void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7456{
7457 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7458 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307459 /*Decrement the Pending count before droping */
7460 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007461 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7462 }
7463 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007464 {
7465 vos_mem_free( pLimMsg->bodyptr);
7466 pLimMsg->bodyptr = NULL;
7467 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007468}
7469
7470
7471#ifdef FEATURE_WLAN_DIAG_SUPPORT
7472/**---------------------------------------------------------
7473\fn limDiagEventReport
7474\brief This function reports Diag event
7475\param pMac
7476\param eventType
7477\param bssid
7478\param status
7479\param reasonCode
7480\return void
7481-----------------------------------------------------------*/
7482void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7483{
7484 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7485 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7486
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307487 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007488
7489 if (NULL == pSessionEntry)
7490 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307491 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007492 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7493 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7494
7495 }
7496 else
7497 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307498 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007499 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7500 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7501 }
7502 peEvent.event_type = eventType;
7503 peEvent.status = status;
7504 peEvent.reason_code = reasonCode;
7505
7506 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7507 return;
7508}
7509
7510#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7511
7512void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7513{
7514
7515 tpAddStaSelfParams pAddStaSelfParams;
7516 tSirMsgQ mmhMsg;
7517 tpSirSmeAddStaSelfRsp pRsp;
7518
7519
7520 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7521
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307522 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7523 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007524 {
7525 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307526 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7527 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007528 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007529 return;
7530 }
7531
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307532 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007533
7534 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7535 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7536 pRsp->status = pAddStaSelfParams->status;
7537
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307538 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007539
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307540 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007541 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007542
7543 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7544 mmhMsg.bodyptr = pRsp;
7545 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307546 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007547 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7548
7549}
7550
7551void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7552{
7553
7554 tpDelStaSelfParams pDelStaSelfParams;
7555 tSirMsgQ mmhMsg;
7556 tpSirSmeDelStaSelfRsp pRsp;
7557
7558
7559 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7560
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307561 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7562 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007563 {
7564 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307565 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7566 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007567 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007568 return;
7569 }
7570
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307571 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007572
7573 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7574 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7575 pRsp->status = pDelStaSelfParams->status;
7576
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307577 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007578
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307579 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007580 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007581
7582 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7583 mmhMsg.bodyptr = pRsp;
7584 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307585 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007586 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7587
7588}
7589
7590/***************************************************************
7591* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7592* To unmap the channel to reverse the effect of mapping
7593* a band channel in hal .Mapping was done hal to overcome the
7594* limitation of the rxbd which use only 4 bit for channel number.
7595*****************************************************************/
7596tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7597{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007598#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007599 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007600 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7601 return aUnsortedChannelList[mapChannel -1];
7602 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007603#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007604 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007605#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007606 return abChannel[mapChannel -1];
7607 else
7608 return 0;
7609}
7610
7611
7612v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7613{
7614 int left = length;
7615 v_U8_t *ptr = pIes;
7616 v_U8_t elem_id;
7617 v_U16_t elem_len;
7618
7619 while(left >= (size_of_len_field+1))
7620 {
7621 elem_id = ptr[0];
7622 if (size_of_len_field == TWO_BYTE)
7623 {
7624 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7625 }
7626 else
7627 {
7628 elem_len = ptr[1];
7629 }
7630
7631
7632 left -= (size_of_len_field+1);
7633 if(elem_len > left)
7634 {
7635 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007636 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007637 eid,elem_len,left);
7638 return NULL;
7639 }
7640 if (elem_id == eid)
7641 {
7642 return ptr;
7643 }
7644
7645 left -= elem_len;
7646 ptr += (elem_len + (size_of_len_field+1));
7647 }
7648 return NULL;
7649}
7650
7651/* return NULL if oui is not found in ie
7652 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7653 */
7654v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7655{
7656 int left = ie_len;
7657 v_U8_t *ptr = ie;
7658 v_U8_t elem_id, elem_len;
7659
7660 while(left >= 2)
7661 {
7662 elem_id = ptr[0];
7663 elem_len = ptr[1];
7664 left -= 2;
7665 if(elem_len > left)
7666 {
7667 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007668 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007669 elem_id,elem_len,left);
7670 return NULL;
7671 }
7672 if (SIR_MAC_EID_VENDOR == elem_id)
7673 {
7674 if(memcmp(&ptr[2], oui, oui_size)==0)
7675 return ptr;
7676 }
7677
7678 left -= elem_len;
7679 ptr += (elem_len + 2);
7680 }
7681 return NULL;
7682}
7683
Jeff Johnson295189b2012-06-20 16:38:30 -07007684//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7685
7686v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7687{
7688 int length = 0;
7689 tANI_U8 *ptr = ie;
7690
7691 ptr[length++] = SIR_MAC_EID_VENDOR;
7692 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307693 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7694 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007695 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7696}
7697
7698//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7699
7700v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7701{
7702 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007703
7704 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7705 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7706 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307707 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007708 noaStream + noaLen - overFlowLen, overFlowLen);
7709 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7710 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307711 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007712 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307713 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7714 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007715 }
7716
Jeff Johnson295189b2012-06-20 16:38:30 -07007717 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7718
7719}
7720
7721//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7722v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7723{
7724 v_U8_t len=0;
7725
7726 v_U8_t *pBody = pNoaStream;
7727
7728
7729 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7730 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7731 {
7732 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7733 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7734 )
7735 return 0; //No NoA Descriptor then return 0
7736
7737
7738 pBody[0] = SIR_P2P_NOA_ATTR;
7739
7740 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7741 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7742 len = 5;
7743 pBody += len;
7744
7745
7746 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7747 {
7748 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7749 pBody += 1;
7750 len +=1;
7751
7752 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7753 pBody += sizeof(tANI_U32);
7754 len +=4;
7755
7756 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7757 pBody += sizeof(tANI_U32);
7758 len +=4;
7759
7760 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7761 pBody += sizeof(tANI_U32);
7762 len +=4;
7763
7764 }
7765
7766 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7767 {
7768 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7769 pBody += 1;
7770 len +=1;
7771
7772 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7773 pBody += sizeof(tANI_U32);
7774 len +=4;
7775
7776 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7777 pBody += sizeof(tANI_U32);
7778 len +=4;
7779
7780 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7781 pBody += sizeof(tANI_U32);
7782 len +=4;
7783
7784 }
7785
7786
7787 pBody = pNoaStream + 1;
7788 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7789
7790 return (len);
7791
7792 }
7793 return 0;
7794
7795}
Jeff Johnsone7245742012-09-05 17:12:55 -07007796
7797void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007798{
7799
7800 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007801 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007802}
Jeff Johnsone7245742012-09-05 17:12:55 -07007803
Jeff Johnson295189b2012-06-20 16:38:30 -07007804/*--------------------------------------------------------------------------
7805
7806 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7807
Jeff Johnsone7245742012-09-05 17:12:55 -07007808 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7809 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007810
7811 \param pMac - pointer to global adapter context
7812 \return - channel to scan from valid session else zero.
7813
7814 \sa
7815
7816 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007817void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007818{
7819
7820 //Rationale - this could be the suspend/resume for assoc and it is essential that
7821 //the new BSS is active for some time. Other BSS was anyway suspended.
7822 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7823 //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 -07007824 //and hence should be ok. Need to discuss this further
7825 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007826 {
7827 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007828 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007829 }
7830 else
7831 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007832 *resumeChannel = pMac->lim.gResumeChannel;
7833 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007834 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007835 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007836}
7837
Viral Modid86bde22012-12-10 13:09:21 -08007838tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7839{
7840 tANI_U8 i;
7841 for(i =0; i < pMac->lim.maxBssId; i++)
7842 {
7843 if(pMac->lim.gpSession[i].valid == TRUE)
7844 {
7845 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7846 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7847 )
7848 {
7849 return TRUE;
7850 }
7851 }
7852 }
7853 return FALSE;
7854}
Jeff Johnsone7245742012-09-05 17:12:55 -07007855
Jeff Johnson295189b2012-06-20 16:38:30 -07007856
7857tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7858{
7859 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7860 {
7861 return eANI_BOOLEAN_TRUE;
7862 }
7863 else
7864 {
7865 return eANI_BOOLEAN_FALSE;
7866 }
7867}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007868
Sandeep Puligilla60342762014-01-30 21:05:37 +05307869/**
7870 * \brief verify the changes in channel bonding
7871 *
7872 * \param pMac Pointer to the global MAC structure
7873 *
7874 * \param psessionEntry session entry
7875 * beaconSecChanWidth Secondary channel width
7876 * advertized in beacon
7877 * currentSecChanWidth Current configured width
7878 * staId Station Id
7879 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7880 */
7881tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7882 tpPESession psessionEntry,
7883 tANI_U8 beaconSecChanWidth,
7884 tANI_U8 currentSecChanWidth,
7885 tANI_U8 staId)
7886{
7887 tUpdateVHTOpMode tempParam;
7888 tANI_BOOLEAN fCbMode24G = FALSE;
7889 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7890
7891 /* Moving from HT40 to HT20 operation*/
7892 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7893 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7894 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7895 {
7896 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7897 tempParam.staId = staId;
7898 fCbMode24G = TRUE;
7899 }
7900
7901 /* Moving from HT20 to HT40 operation*/
7902 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7903 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7904 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7905 {
7906 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7907 tempParam.staId = staId;
7908 fCbMode24G = TRUE;
7909 }
7910
7911 if (TRUE == fCbMode24G)
7912 {
7913 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7914 "Changing CBMODE to = %d staId = %d",
7915 tempParam.opMode, tempParam.staId );
7916 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7917 status = eANI_BOOLEAN_TRUE;
7918 }
7919 return status;
7920}
7921
Mohit Khanna4a70d262012-09-11 16:30:12 -07007922#ifdef WLAN_FEATURE_11AC
7923tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7924{
7925 tUpdateVHTOpMode tempParam;
7926
7927 tempParam.opMode = chanWidth;
7928 tempParam.staId = staId;
7929
7930 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7931
7932 return eANI_BOOLEAN_TRUE;
7933}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007934#endif
7935
krunal soni45b9eb62014-03-26 12:54:25 -07007936void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7937 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007938{
7939 tANI_U8 val=0;
7940
krunal soni45b9eb62014-03-26 12:54:25 -07007941 //only 2.4G band should have short slot enable, rest it should be default
7942 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007943 {
krunal soni45b9eb62014-03-26 12:54:25 -07007944 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007945 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007946 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007947 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7948 {
7949 val = true;
7950 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007951 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007952 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007953 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007954 // Joining BSS.
7955 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007956 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007957 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007958 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007959 // Reassociating with AP.
7960 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007961 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007962 }
krunal soni45b9eb62014-03-26 12:54:25 -07007963 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007964 {
krunal soni45b9eb62014-03-26 12:54:25 -07007965 /*
7966 * 11B does not short slot and short slot is default
7967 * for 11A mode. Hence, not need to set this bit
7968 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007969 val = false;
7970 }
krunal soni45b9eb62014-03-26 12:54:25 -07007971
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007972 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007973 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007974}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307975
Kalikinkar dhara205da782014-03-21 15:49:32 -07007976void limUtilsframeshtons(tpAniSirGlobal pCtx,
7977 tANI_U8 *pOut,
7978 tANI_U16 pIn,
7979 tANI_U8 fMsb)
7980{
7981 (void)pCtx;
7982#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7983 if ( !fMsb )
7984 {
7985 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7986 }
7987 else
7988 {
7989 *pOut = ( pIn & 0xff00 ) >> 8;
7990 *( pOut + 1 ) = pIn & 0xff;
7991 }
7992#else
7993 if ( !fMsb )
7994 {
7995 *pOut = pIn & 0xff;
7996 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7997 }
7998 else
7999 {
8000 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8001 }
8002#endif
8003}
8004
8005void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8006 tANI_U8 *pOut,
8007 tANI_U32 pIn,
8008 tANI_U8 fMsb)
8009{
8010 (void)pCtx;
8011#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8012 if ( !fMsb )
8013 {
8014 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8015 }
8016 else
8017 {
8018 *pOut = ( pIn & 0xff000000 ) >> 24;
8019 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8020 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8021 *( pOut + 3 ) = ( pIn & 0x000000ff );
8022 }
8023#else
8024 if ( !fMsb )
8025 {
8026 *( pOut ) = ( pIn & 0x000000ff );
8027 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8028 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8029 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8030 }
8031 else
8032 {
8033 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8034 }
8035#endif
8036}
8037
8038
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308039/**--------------------------------------------
8040\fn limUpdateOBSSScanParams
8041\brief Updates OBSS SCAN IE parameters to session
8042
8043\param psessionEntry - Session Entry
8044\return NONE
8045---------------------------------------------*/
8046void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8047 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8048{
8049 /*If the recieved value is not in the range specified by the Specification
8050 then it will be the default value configured through cfg */
8051 if (( pOBSSScanParameters->obssScanActiveDwell >
8052 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8053 ( pOBSSScanParameters->obssScanActiveDwell <
8054 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8055 {
8056 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8057 pOBSSScanParameters->obssScanActiveDwell;
8058 }
8059 if((pOBSSScanParameters->obssScanPassiveDwell >
8060 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8061 (pOBSSScanParameters->obssScanPassiveDwell <
8062 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8063 {
8064 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8065 pOBSSScanParameters->obssScanPassiveDwell;
8066 }
8067 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8068 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8069 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8070 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8071 {
8072 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8073 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8074 }
8075 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8076 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8077 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8078 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8079 {
8080 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8081 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8082 }
8083 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8084 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8085 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8086 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8087 {
8088 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8089 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8090 }
8091 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8092 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8093 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8094 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8095 {
8096 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8097 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8098 }
8099 if((pOBSSScanParameters->obssScanActivityThreshold >
8100 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8101 (pOBSSScanParameters->obssScanActivityThreshold <
8102 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8103 {
8104 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8105 pOBSSScanParameters->obssScanActivityThreshold;
8106 }
8107}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008108
8109#ifdef WLAN_FEATURE_11W
8110void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8111{
8112 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8113 tPmfSaQueryTimerId timerId;
8114 tpPESession psessionEntry;
8115 tpDphHashNode pSta;
8116 tANI_U32 maxRetries;
8117
8118 limLog(pMac, LOG1, FL("SA Query timer fires"));
8119 timerId.value = param;
8120
8121 // Check that SA Query is in progress
8122 if ((psessionEntry = peFindSessionBySessionId(
8123 pMac, timerId.fields.sessionId)) == NULL)
8124 {
8125 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8126 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008127 return;
8128 }
8129 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8130 &psessionEntry->dph.dphHashTable)) == NULL)
8131 {
8132 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8133 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008134 return;
8135 }
8136 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8137 return;
8138
8139 // Increment the retry count, check if reached maximum
8140 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8141 &maxRetries) != eSIR_SUCCESS)
8142 {
8143 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8144 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8145 return;
8146 }
8147 pSta->pmfSaQueryRetryCount++;
8148 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8149 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308150 limLog(pMac, LOGE,
8151 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8152 MAC_ADDR_ARRAY(pSta->staAddr));
8153 limSendDisassocMgmtFrame(pMac,
8154 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8155 pSta->staAddr, psessionEntry, FALSE);
8156 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008157 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8158 return;
8159 }
8160
8161 // Retry SA Query
8162 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8163 pSta->staAddr, psessionEntry);
8164 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008165 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8166 {
8167 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8168 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8169 }
8170}
8171#endif
8172
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008173/** ---------------------------------------------------------
8174\fn limProcessChannelSwitchSuspendLink
8175\brief This function call channel switch functions based on
8176 the gLimChannelSwitch.state. After function return it
8177 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8178 If gLimChannelSwitch.state is non-identified then
8179 print error log as well as restore back the
8180 pre-channelSwitch.
8181\param tpAniSirGlobal pMac
8182\param eHalStatus status
8183\param tANI_U32 *ctx
8184\return None
8185 ------------------------------------------------------------*/
8186static void
8187limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8188 eHalStatus status,
8189 tANI_U32 *ctx)
8190{
8191 tpPESession pSessionEntry = (tpPESession)ctx;
8192
8193 if ( eHAL_STATUS_SUCCESS != status )
8194 {
8195 limLog(pMac, LOGE,
8196 FL("Suspend link failed. still proceeding "));
8197 }
8198 if (NULL == pSessionEntry )
8199 {
8200 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8201 return;
8202 }
8203
8204 switch(pSessionEntry->gLimChannelSwitch.state)
8205 {
8206 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8207 PELOGW(limLog(pMac, LOGW,
8208 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8209 limSwitchPrimaryChannel(pMac,
8210 pSessionEntry->gLimChannelSwitch.primaryChannel,
8211 pSessionEntry);
8212 pSessionEntry->gLimChannelSwitch.state =
8213 eLIM_CHANNEL_SWITCH_IDLE;
8214 break;
8215
8216 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8217 PELOGW(limLog(pMac, LOGW,
8218 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8219 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8220 pSessionEntry->gLimChannelSwitch.primaryChannel,
8221 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8222 pSessionEntry->gLimChannelSwitch.state =
8223 eLIM_CHANNEL_SWITCH_IDLE;
8224 break;
8225
8226 default:
8227 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8228 pSessionEntry->gLimChannelSwitch.state);)
8229 if (limRestorePreChannelSwitchState(pMac,
8230 pSessionEntry) != eSIR_SUCCESS)
8231 {
8232 limLog(pMac, LOGE,
8233 FL("Could not restore pre-channelSwitch "
8234 "(11h) state, resetting the system"));
8235 }
8236 }
8237}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308238
8239/** ---------------------------------------------------------
8240\fn limInitOBSSScanParams
8241\brief This function Initializes the OBSS Scan Parameters
8242\param tpAniSirGlobal pMac
8243\param tpPESession pSessionEntry
8244\return None
8245 ------------------------------------------------------------*/
8246
8247void limInitOBSSScanParams(tpAniSirGlobal pMac,
8248 tpPESession psessionEntry)
8249{
8250 tANI_U32 cfgValue;
8251
8252 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8253 &cfgValue) != eSIR_SUCCESS)
8254 {
8255 limLog(pMac, LOGE, FL("Fail to retrieve "
8256 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8257 return ;
8258 }
8259 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8260
8261 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8262 &cfgValue) != eSIR_SUCCESS)
8263 {
8264 limLog(pMac, LOGE, FL("Fail to retrieve "
8265 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8266 return ;
8267 }
8268 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8269
8270 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8271 &cfgValue) != eSIR_SUCCESS)
8272 {
8273 limLog(pMac, LOGE, FL("Fail to retrieve "
8274 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8275 return ;
8276 }
8277 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8278 = cfgValue;
8279 if (wlan_cfgGetInt(pMac,
8280 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8281 &cfgValue) != eSIR_SUCCESS)
8282 {
8283 limLog(pMac, LOGE, FL("Fail to retrieve"
8284 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8285 return ;
8286 }
8287 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8288 cfgValue;
8289 if (wlan_cfgGetInt(pMac,
8290 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8291 != eSIR_SUCCESS)
8292 {
8293 limLog(pMac, LOGE, FL("Fail to retrieve"
8294 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8295 return ;
8296 }
8297 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8298 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308299
8300 if (wlan_cfgGetInt(pMac,
8301 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8302 != eSIR_SUCCESS)
8303 {
8304 limLog(pMac, LOGE, FL("Fail to retrieve"
8305 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8306 return ;
8307 }
8308 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8309 cfgValue;
8310
8311
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308312 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8313 &cfgValue) != eSIR_SUCCESS)
8314 {
8315 limLog(pMac, LOGE, FL("Fail to retrieve "
8316 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8317 return ;
8318 }
8319 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308320}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308321
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308322const char * lim_ScanTypetoString(const v_U8_t scanType)
8323{
8324 switch (scanType)
8325 {
8326 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8327 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8328 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8329 default:
8330 return "Unknown ScanType";
8331 }
8332}
8333
8334const char * lim_BssTypetoString(const v_U8_t bssType)
8335{
8336 switch (bssType)
8337 {
8338 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8339 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8340 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8341 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8342 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8343 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8344 default:
8345 return "Unknown BssType";
8346 }
8347}
8348
8349const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8350{
8351 switch (mode)
8352 {
8353 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8354 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8355 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8356 default:
8357 return "Unknown BgScanMode";
8358 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308359}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308360
8361#ifdef WLAN_FEATURE_11W
8362/**
8363 *
8364 * \brief This function is called by various LIM modules to correctly set
8365 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8366 *
8367 *
8368 * \param pMac Pointer to Global MAC structure
8369 *
8370 * \param psessionEntry Pointer to session corresponding to the connection
8371 *
8372 * \param peer Peer address of the STA to which the frame is to be sent
8373 *
8374 * \param pMacHdr Pointer to the frame MAC header
8375 *
8376 * \return nothing
8377 *
8378 *
8379 */
8380void
8381limSetProtectedBit(tpAniSirGlobal pMac,
8382 tpPESession psessionEntry,
8383 tSirMacAddr peer,
8384 tpSirMacMgmtHdr pMacHdr)
8385{
8386 tANI_U16 aid;
8387 tpDphHashNode pStaDs;
8388
8389 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8390 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8391 {
8392
8393 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8394 &psessionEntry->dph.dphHashTable );
8395 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308396 /* rmfenabled will be set at the time of addbss.
8397 * but sometimes EAP auth fails and keys are not
8398 * installed then if we send any management frame
8399 * like deauth/disassoc with this bit set then
8400 * firmware crashes. so check for keys are
8401 * installed or not also before setting the bit
8402 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308403 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308404 pMacHdr->fc.wep = 1;
8405 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308406 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308407 pMacHdr->fc.wep = 1;
8408} /*** end limSetProtectedBit() ***/
8409#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308410
8411tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8412{
8413 int left = length;
8414 tANI_U8 *ptr = pIes;
8415 tANI_U8 elem_id,elem_len;
8416
8417 while (left >= 2)
8418 {
8419 elem_id = ptr[0];
8420 elem_len = ptr[1];
8421 left -= 2;
8422
8423 if (elem_len > left)
8424 {
8425 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8426 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8427 eid,elem_len,left);
8428 return NULL;
8429 }
8430 if (elem_id == eid)
8431 {
8432 return ptr;
8433 }
8434
8435 left -= elem_len;
8436 ptr += (elem_len + 2);
8437 }
8438 return NULL;
8439}
8440
8441
8442void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8443{
8444
8445 tANI_U32 nPayload;
8446 tANI_U8 *pPayload;
8447 tANI_U8 *ieptr;
8448 tSirMacTim *tim;
8449
8450 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8451 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8452
8453 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8454 {
8455 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8456 return;
8457 }
8458
8459 if (NULL !=
8460 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8461 nPayload, SIR_MAC_TIM_EID)))
8462 {
8463 /* Ignore EID and Length field*/
8464 tim = (tSirMacTim *)(ieptr + 2);
8465
8466 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8467 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8468 if (tim->dtimCount >= MAX_DTIM_COUNT)
8469 tim->dtimCount = DTIM_COUNT_DEFAULT;
8470 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8471 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8472 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8473 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8474 psessionEntry->currentBssBeaconCnt++;
8475
8476 limLog(pMac, LOG1,
8477 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8478 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8479 psessionEntry->lastBeaconDtimPeriod);
8480
8481 }
8482 return;
8483}
Girish Gowlia95daca2015-02-04 20:31:31 +05308484
8485void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8486 tANI_U8 smeSessionId,
8487 tANI_U32 maxRateFlag)
8488{
8489 tpSirSmeUpdateMaxRateParams pRsp;
8490 tSirMsgQ msg;
8491
8492 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8493 if (NULL == pRsp)
8494 {
8495 limLog(pMac, LOGP, FL("Memory allocation failed"));
8496 return;
8497 }
8498 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8499 pRsp->maxRateFlag = maxRateFlag;
8500 pRsp->smeSessionId = smeSessionId;
8501 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8502 msg.bodyptr = pRsp;
8503 msg.bodyval = 0;
8504 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8505 return;
8506}
Abhishek Singh5d765712015-03-12 14:04:16 +05308507
8508void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8509{
8510 if( pMac->sys.gSysBbtPendingMgmtCount )
8511 {
8512 vos_spin_lock_acquire( &pMac->sys.lock );
8513 pMac->sys.gSysBbtPendingMgmtCount--;
8514 vos_spin_lock_release( &pMac->sys.lock );
8515 }
8516 else
8517 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8518}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308519
8520eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8521{
8522 tpSirTxBdStatus pTxBdStatus;
8523
8524 if (!pData)
8525 {
8526 limLog(pMac, LOGE, FL("pData is NULL"));
8527 return eHAL_STATUS_FAILURE;
8528 }
8529
8530 pTxBdStatus = (tpSirTxBdStatus) pData;
8531
8532 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8533 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8534 return eHAL_STATUS_SUCCESS;
8535}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308536
Kapil Gupta956c0c42017-06-16 19:24:31 +05308537eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8538{
8539 tpSirTxBdStatus pTxBdStatus;
8540 tpDphHashNode pStaDs;
8541 tpPESession psessionEntry;
8542 VOS_STATUS vosStatus;
8543 vos_list_node_t *pNode= NULL, *pNext = NULL;
8544 assoc_rsp_tx_context *tmp_tx_context = NULL;
8545
8546 if (!pData)
8547 {
8548 limLog(pMac, LOGE, FL("pData is NULL"));
8549 return eHAL_STATUS_FAILURE;
8550 }
8551
8552 pTxBdStatus = (tpSirTxBdStatus) pData;
8553
8554 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8555 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8556
8557 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8558 &pNode);
8559
8560 while(pNode)
8561 {
8562 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8563 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8564 {
8565 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8566 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8567
8568 vosStatus = vos_list_peek_next (
8569 &pMac->assoc_rsp_completion_list,
8570 pNode, &pNext );
8571 pNode = pNext;
8572 pNext = NULL;
8573 }
8574 else
8575 {
8576 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8577 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8578 break;
8579 }
8580 }
8581
8582 if (!tmp_tx_context) {
8583 limLog(pMac, LOGE, FL("context is NULL"));
8584 return eHAL_STATUS_SUCCESS;
8585 }
8586 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8587 if (!psessionEntry) {
8588 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8589 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8590 pNode);
8591 vos_mem_free(tmp_tx_context);
8592 return eHAL_STATUS_SUCCESS;
8593 }
8594 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8595 &psessionEntry->dph.dphHashTable);
8596 if (pStaDs == NULL)
8597 {
8598 limLog(pMac, LOGW,
8599 FL("STA context not found"));
8600 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8601 pNode);
8602 vos_mem_free(tmp_tx_context);
8603
8604 return eHAL_STATUS_SUCCESS;
8605 }
8606
8607 /* Receive path cleanup */
8608 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8609 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8610 pNode);
8611 vos_mem_free(tmp_tx_context);
8612
8613 return eHAL_STATUS_SUCCESS;
8614}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308615/**
8616 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8617 * robust action frame
8618 * @action_catagory: Action frame catagory.
8619 *
8620 * This function is used to check if given action catagory is robust
8621 * action frame.
8622 *
8623 * Return: bool
8624 */
8625bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8626{
8627 switch (action_catagory) {
8628 /*
8629 * NOTE: This function doesn't take care of the DMG
8630 * (Directional Multi-Gigatbit) BSS case as 8011ad
8631 * support is not yet added. In future, if the support
8632 * is required then this function need few more arguments
8633 * and little change in logic.
8634 */
8635 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8636 case SIR_MAC_ACTION_QOS_MGMT:
8637 case SIR_MAC_ACTION_DLP:
8638 case SIR_MAC_ACTION_BLKACK:
8639 case SIR_MAC_ACTION_RRM:
8640 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8641 case SIR_MAC_ACTION_SA_QUERY:
8642 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8643 case SIR_MAC_ACTION_WNM:
8644 case SIR_MAC_ACITON_MESH:
8645 case SIR_MAC_ACTION_MHF:
8646 case SIR_MAC_ACTION_FST:
8647 return true;
8648 default:
8649 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8650 FL("non-PMF action category[%d] "),
8651 action_catagory);
8652 break;
8653 }
8654 return false;
8655}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308656
8657/**
Hu Wangc12631c2016-08-11 09:57:03 +08008658 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8659 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308660 * @ext_cap: extended IEs structure
8661 *
Hu Wangc12631c2016-08-11 09:57:03 +08008662 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308663 */
Hu Wangc12631c2016-08-11 09:57:03 +08008664tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8665 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308666
Hu Wangc12631c2016-08-11 09:57:03 +08008667 while (i) {
8668 if (ext_cap->bytes[i-1]) {
8669 break;
8670 }
8671 i --;
8672 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308673
Hu Wangc12631c2016-08-11 09:57:03 +08008674 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308675}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308676
8677/**
8678 * lim_update_caps_info_for_bss - Update capability info for this BSS
8679 *
8680 * @mac_ctx: mac context
8681 * @caps: Pointer to capability info to be updated
8682 * @bss_caps: Capability info of the BSS
8683 *
8684 * Update the capability info in Assoc/Reassoc request frames and reset
8685 * the spectrum management, short preamble, immediate block ack bits
8686 * if the BSS doesnot support it
8687 *
8688 * Return: None
8689 */
8690void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8691 uint16_t *caps, uint16_t bss_caps)
8692{
8693 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8694 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8695 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8696 }
8697
8698 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8699 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8700 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8701 }
8702
8703 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8704 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8705 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8706 }
8707}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308708#ifdef SAP_AUTH_OFFLOAD
8709/**
8710 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8711 *
8712 * @pmac: mac context
8713 * @assoc_req: Assoc request
8714 * @add_sta_req: Add Sta request
8715 *
8716 * This function process recieved add sta message and store it as
8717 * sta ds entry. This function will add this sta entry to DPH as well.
8718 *
8719 * Return: DPH hash node
8720 */
8721static tpDphHashNode
8722_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8723 tpSirAssocReq assoc_req,
8724 tSapOfldAddStaIndMsg *add_sta_req)
8725{
8726 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8727 tpSirAssocReq temp_assoc_req;
8728 tSirRetStatus status;
8729 tpDphHashNode sta_ds = NULL;
8730 uint8_t *frame_body = NULL;
8731
8732 tpPESession session_entry = limIsApSessionActive(pmac);
8733
8734 if (session_entry == NULL)
8735 {
8736 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8737 return NULL;
8738 }
8739
8740 /* Update Attribute and Remove IE for
8741 * Software AP Authentication Offload
8742 */
8743 frame_body = (tANI_U8 *)add_sta_req->bufp;
8744 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8745 mac_assoc_req->capabilityInfo.privacy = 0;
8746
8747 status = sirConvertAssocReqFrame2Struct(pmac,
8748 frame_body,
8749 add_sta_req->data_len,
8750 assoc_req);
8751 if (status != eSIR_SUCCESS)
8752 {
8753 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8754 goto error;
8755 }
8756 /* For software AP Auth Offload feature
8757 * Host will take it as none security station
8758 * Force change to none security
8759 */
8760 assoc_req->rsnPresent = 0;
8761 assoc_req->wpaPresent = 0;
8762
8763 sta_ds = dphAddHashEntry(pmac,
8764 add_sta_req->peer_macaddr,
8765 add_sta_req->assoc_id,
8766 &session_entry->dph.dphHashTable);
8767 if (sta_ds == NULL)
8768 {
8769 /* Could not add hash table entry at DPH */
8770 limLog(pmac, LOGE,
8771 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8772 MAC_ADDRESS_STR),
8773 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8774 goto error;
8775 }
8776
8777 if (session_entry->parsedAssocReq != NULL)
8778 {
8779 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8780 if (temp_assoc_req != NULL)
8781 {
8782 if (temp_assoc_req->assocReqFrame)
8783 {
8784 vos_mem_free(temp_assoc_req->assocReqFrame);
8785 temp_assoc_req->assocReqFrame = NULL;
8786 temp_assoc_req->assocReqFrameLength = 0;
8787 }
8788 vos_mem_free(temp_assoc_req);
8789 temp_assoc_req = NULL;
8790 }
8791 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8792 }
8793error:
8794 return sta_ds;
8795}
8796
8797/**
8798 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8799 *
8800 * @sta_ds: STA state node
8801 * @assoc_req: Assoc request
8802 * @add_sta_req: Add Sta request
8803 *
8804 * This function process recieved add sta message and store station's caps
8805 * in station ds entry.
8806 *
8807 * Return: none
8808 */
8809static void
8810_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
8811 tpSirAssocReq assoc_req,
8812 tSapOfldAddStaIndMsg *add_sta_req)
8813
8814{
8815
8816 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
8817#ifdef WLAN_FEATURE_11AC
8818 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
8819#endif
8820 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
8821 sta_ds->qos.addts = assoc_req->addtsReq;
8822 sta_ds->qos.capability = assoc_req->qosCapability;
8823 sta_ds->versionPresent = 0;
8824 /* short slot and short preamble should be
8825 * updated before doing limaddsta
8826 */
8827 sta_ds->shortPreambleEnabled =
8828 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
8829 sta_ds->shortSlotTimeEnabled =
8830 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
8831
8832 sta_ds->valid = 0;
8833 /* The Auth Type of Software AP Authentication Offload
8834 * is always Open System is host side
8835 */
8836 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
8837 sta_ds->staType = STA_ENTRY_PEER;
8838
8839 /* Assoc Response frame to requesting STA */
8840 sta_ds->mlmStaContext.subType = 0;
8841
8842 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
8843 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
8844
8845 /* The following count will be used to knock-off the station
8846 * if it doesn't come back to receive the buffered data.
8847 * The AP will wait for numTimSent number of beacons after
8848 * sending TIM information for the station, before assuming that
8849 * the station is no more associated and disassociates it
8850 */
8851
8852 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
8853 sta_ds->timWaitCount =
8854 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
8855
8856 /* Initialise the Current successful
8857 * MPDU's tranfered to this STA count as 0
8858 */
8859 sta_ds->curTxMpduCnt = 0;
8860}
8861
8862/**
8863 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
8864 *
8865 * @pmac: mac context
8866 * @sta_ds: STA state node
8867 * @assoc_req: Assoc request
8868 *
8869 * This function process recieved add sta message and store station's HT and
8870 * and VHT caps and store them in station ds entry.
8871 *
8872 * Return: tSirRetStatus
8873 */
8874static tSirRetStatus
8875_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
8876 tpDphHashNode sta_ds,
8877 tpSirAssocReq assoc_req)
8878{
8879 tpPESession session_entry = limIsApSessionActive(pmac);
8880
8881 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
8882 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
8883 {
8884 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
8885 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
8886 sta_ds->htDsssCckRate40MHzSupport =
8887 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
8888 sta_ds->htLsigTXOPProtection =
8889 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
8890 sta_ds->htMaxAmsduLength =
8891 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
8892 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
8893 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
8894 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
8895 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
8896 sta_ds->htSupportedChannelWidthSet =
8897 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
8898 /* peer just follows AP; so when we are softAP/GO,
8899 * we just store our session entry's secondary channel offset here
8900 * in peer INFRA STA. However, if peer's 40MHz channel width support
8901 * is disabled then secondary channel will be zero
8902 */
8903 sta_ds->htSecondaryChannelOffset =
8904 (sta_ds->htSupportedChannelWidthSet) ?
8905 session_entry->htSecondaryChannelOffset : 0;
8906#ifdef WLAN_FEATURE_11AC
8907 if (assoc_req->operMode.present)
8908 {
8909 sta_ds->vhtSupportedChannelWidthSet =
8910 (tANI_U8)((assoc_req->operMode.chanWidth ==
8911 eHT_CHANNEL_WIDTH_80MHZ) ?
8912 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
8913 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
8914 sta_ds->htSupportedChannelWidthSet =
8915 (tANI_U8)(assoc_req->operMode.chanWidth ?
8916 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
8917 }
8918 else if (assoc_req->VHTCaps.present)
8919 {
8920 /* Check if STA has enabled it's channel bonding mode.
8921 * If channel bonding mode is enabled, we decide based on
8922 * SAP's current configuration else, we set it to VHT20.
8923 */
8924 sta_ds->vhtSupportedChannelWidthSet =
8925 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
8926 eHT_CHANNEL_WIDTH_20MHZ) ?
8927 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
8928 session_entry->vhtTxChannelWidthSet );
8929 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
8930 }
8931
8932 /* Lesser among the AP and STA bandwidth of operation. */
8933 sta_ds->htSupportedChannelWidthSet =
8934 (sta_ds->htSupportedChannelWidthSet <
8935 session_entry->htSupportedChannelWidthSet) ?
8936 sta_ds->htSupportedChannelWidthSet :
8937 session_entry->htSupportedChannelWidthSet ;
8938#endif
8939 sta_ds->baPolicyFlag = 0xFF;
8940 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
8941 }
8942
8943 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
8944 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
8945
8946 if (!assoc_req->wmeInfoPresent)
8947 {
8948 sta_ds->mlmStaContext.htCapability = 0;
8949#ifdef WLAN_FEATURE_11AC
8950 sta_ds->mlmStaContext.vhtCapability = 0;
8951#endif
8952 }
8953#ifdef WLAN_FEATURE_11AC
8954 if (limPopulateMatchingRateSet(pmac,
8955 sta_ds,
8956 &(assoc_req->supportedRates),
8957 &(assoc_req->extendedRates),
8958 assoc_req->HTCaps.supportedMCSSet,
8959 &(assoc_req->propIEinfo.propRates),
8960 session_entry , &assoc_req->VHTCaps)
8961 != eSIR_SUCCESS)
8962 {
8963#else
8964 if (limPopulateMatchingRateSet(pmac,
8965 sta_ds,
8966 &(assoc_req->supportedRates),
8967 &(assoc_req->extendedRates),
8968 assoc_req->HTCaps.supportedMCSSet,
8969 &(assoc_req->propIEinfo.propRates),
8970 session_entry) != eSIR_SUCCESS)
8971 {
8972#endif
8973 limLog(pmac, LOGE,
8974 FL("Rate set mismatched for aid=%d, MacAddr: "
8975 MAC_ADDRESS_STR),
8976 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
8977 goto error;
8978 }
8979 return eSIR_SUCCESS;
8980error:
8981 return eSIR_FAILURE;
8982}
8983
8984/**
8985 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
8986 *
8987 * @pmac: mac context
8988 * @sta_ds: STA state node
8989 * @assoc_req: Assoc request
8990 *
8991 * This function process recieved add sta message and store station's QOS
8992 * store them in station ds entry.
8993 *
8994 * Return: none
8995 */
8996static void
8997 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
8998 tpDphHashNode sta_ds,
8999 tpSirAssocReq assoc_req)
9000{
9001 tHalBitVal qos_mode;
9002 tHalBitVal wsm_mode, wme_mode;
9003 tpPESession session_entry = limIsApSessionActive(pmac);
9004
9005 limGetQosMode(session_entry, &qos_mode);
9006 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9007 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9008
9009 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9010 {
9011 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9012 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9013 }
9014
9015 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9016 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9017 limGetWmeMode(session_entry, &wme_mode);
9018 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9019 (wme_mode == eHAL_SET))
9020 {
9021 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9022 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9023 limGetWsmMode(session_entry, &wsm_mode);
9024 /* WMM_APSD - WMM_SA related processing should be
9025 * separate; WMM_SA and WMM_APSD can coexist
9026 */
9027 if (assoc_req->WMMInfoStation.present)
9028 {
9029 /* check whether AP supports or not */
9030 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9031 && (session_entry->apUapsdEnable == 0) &&
9032 (assoc_req->WMMInfoStation.acbe_uapsd
9033 || assoc_req->WMMInfoStation.acbk_uapsd
9034 || assoc_req->WMMInfoStation.acvo_uapsd
9035 || assoc_req->WMMInfoStation.acvi_uapsd))
9036 {
9037 /*
9038 * Received Re/Association Request from
9039 * STA when UPASD is not supported
9040 */
9041 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9042 "to STA accordingly" ));
9043 /* update UAPSD and send it to LIM to add STA */
9044 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9045 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9046 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9047 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9048 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9049 }
9050 else
9051 {
9052 /* update UAPSD and send it to LIM to add STA */
9053 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9054 assoc_req->WMMInfoStation.acbe_uapsd;
9055 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9056 assoc_req->WMMInfoStation.acbk_uapsd;
9057 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9058 assoc_req->WMMInfoStation.acvo_uapsd;
9059 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9060 assoc_req->WMMInfoStation.acvi_uapsd;
9061 sta_ds->qos.capability.qosInfo.maxSpLen =
9062 assoc_req->WMMInfoStation.max_sp_length;
9063 }
9064 }
9065 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9066 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9067 }
9068}
9069
9070/**
9071 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9072 *
9073 * @pmac: mac context
9074 * @lim_msgq: Add Sta indication buffer
9075 *
9076 * This function will recieve buffer from firmware. This buffer will store
9077 * information about connected client. driver will process this buffer and
9078 * will register this client with driver. Driver will call limAddSta
9079 *
9080 * Return: none
9081 */
9082void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9083 tSapOfldAddStaIndMsg *lim_msgq)
9084{
9085 tpSirAssocReq assoc_req = NULL;
9086 tpDphHashNode sta_ds = NULL;
9087
9088 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9089 tpPESession session_entry = limIsApSessionActive(pmac);
9090
9091 if (session_entry == NULL)
9092 {
9093 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9094 return;
9095 }
9096 add_sta_req = lim_msgq;
9097 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9098 if (NULL == assoc_req) {
9099 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9100 return;
9101 }
9102 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9103
9104 /* parse Assoc req frame for station information */
9105 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9106 if (sta_ds == NULL)
9107 {
9108 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9109 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9110 vos_mem_free(assoc_req);
9111 goto error;
9112 }
9113
9114 /* Parse Station Capability */
9115 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9116
9117 /* Parse Station HT/VHT information */
9118 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9119 == eSIR_FAILURE)
9120 {
9121 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9122 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9123 vos_mem_free(assoc_req);
9124 goto error;
9125
9126 }
9127
9128 /* Parse Station QOS information */
9129 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9130
9131 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9132 sta_ds->staIndex = add_sta_req->staIdx;
9133 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9134 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9135 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9136 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9137 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9138 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309139 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309140
Agrawal Ashishce67f362017-01-05 20:10:58 +05309141 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9142 sta_ds->staIndex,
9143 sta_ds->bssId,
9144 sta_ds->dpuIndex,
9145 sta_ds->bcastDpuIndex,
9146 sta_ds->bcastMgmtDpuIdx,
9147 sta_ds->ucUcastSig,
9148 sta_ds->ucBcastSig,
9149 sta_ds->ucMgmtSig,
9150 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309151
9152 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9153 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9154 sta_ds->assocId);
9155 }
9156
9157error:
9158 return;
9159}
9160
9161/**
9162 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9163 *
9164 * @pmac: mac context
9165 * @lim_msgq: Del Sta indication buffer
9166 *
9167 * This function will recieve buffer from firmware. This buffer will
9168 * have information about clinet to remove with reason code.
9169 * This function will call limSendSmeDisassocInd to do cleanup
9170 * for station entry
9171 *
9172 * Return: none
9173 */
9174void
9175lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9176{
9177 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9178 tpDphHashNode sta_ds = NULL;
9179 tANI_U16 assoc_id = 0;
9180 tpPESession psession_entry = limIsApSessionActive(pmac);
9181
9182 if (psession_entry == NULL)
9183 {
9184 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9185 goto error;
9186 }
9187
9188 del_sta_req = lim_msgq;
9189 sta_ds = dphLookupHashEntry(pmac,
9190 del_sta_req->peer_macaddr,
9191 &assoc_id,
9192 &psession_entry->dph.dphHashTable);
9193 if (sta_ds == NULL)
9194 {
9195 /*
9196 * Disassociating STA is not associated.
9197 * Log error
9198 */
9199 PELOGE(limLog(pmac, LOGE,
9200 FL("received del sta event that sta not exist in table "
9201 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9202 del_sta_req->reason,
9203 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9204 goto error;
9205 }
9206
9207 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9208 {
9209 /*
9210 * Associate Id mismatch
9211 * Log error
9212 */
9213 PELOGE(limLog(pmac, LOGE,
9214 FL("received del sta event that sta assoc Id mismatch"));)
9215 goto error;
9216 }
9217
9218 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9219 sta_ds->mlmStaContext.disassocReason =
9220 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309221
9222 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9223
9224error:
9225 return;
9226}
9227#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309228
9229int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9230{
9231 tANI_U8 i;
9232 tpPESession psessionEntry = NULL;
9233
9234 for(i =0; i < pMac->lim.maxBssId; i++)
9235 {
9236 /* If BSSID matches return corresponding tables address*/
9237 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9238 {
9239 psessionEntry = (&pMac->lim.gpSession[i]);
9240 return psessionEntry->bssIdx;
9241 }
9242 }
9243
9244 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9245 return(0xFF);
9246}