blob: 560e7f74b7ad7374f295e5c597bfacb62ee969d7 [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
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301141 tx_timer_deactivate(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1142 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1143
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 pMac->lim.gLimTimersCreated = 0;
1145 }
1146
Agarwal Ashish888ca022014-11-05 14:25:56 +05301147#ifdef WLAN_FEATURE_11W
1148 /*
1149 * When SSR is triggered, we need to loop through
1150 * each STA associated per BSSId and deactivate/delete
1151 * the pmfSaQueryTimer for it
1152 */
1153 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1154 {
1155 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1156 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1157 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1158 {
1159 if (pMac->lim.gpSession[bss_entry].valid)
1160 {
1161 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1162 sta_entry++)
1163 {
1164 psessionEntry = &pMac->lim.gpSession[bss_entry];
1165 pStaDs = dphGetHashEntry(pMac, sta_entry,
1166 &psessionEntry->dph.dphHashTable);
1167 if (NULL == pStaDs)
1168 {
1169 continue;
1170 }
1171 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1172 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1173 pStaDs->staIndex) ;
1174 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1175 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1176 }
1177 }
1178 }
1179 }
1180#endif
1181
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 /// Cleanup cached scan list
1183 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001184#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1185 /// Cleanup cached scan list
1186 limReInitLfrScanResults(pMac);
1187#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001188
1189} /*** end limCleanupMlm() ***/
1190
1191
1192
1193/**
1194 * limCleanupLmm()
1195 *
1196 *FUNCTION:
1197 * This function is called to cleanup any resources
1198 * allocated by LMM sub-module.
1199 *
1200 *PARAMS:
1201 *
1202 *LOGIC:
1203 *
1204 *ASSUMPTIONS:
1205 * NA
1206 *
1207 *NOTE:
1208 * NA
1209 *
1210 * @param pMac Pointer to Global MAC structure
1211 * @return None
1212 */
1213
1214void
1215limCleanupLmm(tpAniSirGlobal pMac)
1216{
Jeff Johnson295189b2012-06-20 16:38:30 -07001217} /*** end limCleanupLmm() ***/
1218
1219
1220
1221/**
1222 * limIsAddrBC()
1223 *
1224 *FUNCTION:
1225 * This function is called in various places within LIM code
1226 * to determine whether passed MAC address is a broadcast or not
1227 *
1228 *LOGIC:
1229 *
1230 *ASSUMPTIONS:
1231 * NA
1232 *
1233 *NOTE:
1234 * NA
1235 *
1236 * @param macAddr Indicates MAC address that need to be determined
1237 * whether it is Broadcast address or not
1238 *
1239 * @return true if passed address is Broadcast address else false
1240 */
1241
1242tANI_U8
1243limIsAddrBC(tSirMacAddr macAddr)
1244{
1245 int i;
1246 for (i = 0; i < 6; i++)
1247 {
1248 if ((macAddr[i] & 0xFF) != 0xFF)
1249 return false;
1250 }
1251
1252 return true;
1253} /****** end limIsAddrBC() ******/
1254
1255
1256
1257/**
1258 * limIsGroupAddr()
1259 *
1260 *FUNCTION:
1261 * This function is called in various places within LIM code
1262 * to determine whether passed MAC address is a group address or not
1263 *
1264 *LOGIC:
1265 * If least significant bit of first octet of the MAC address is
1266 * set to 1, it is a Group address.
1267 *
1268 *ASSUMPTIONS:
1269 * NA
1270 *
1271 *NOTE:
1272 * NA
1273 *
1274 * @param macAddr Indicates MAC address that need to be determined
1275 * whether it is Group address or not
1276 *
1277 * @return true if passed address is Group address else false
1278 */
1279
1280tANI_U8
1281limIsGroupAddr(tSirMacAddr macAddr)
1282{
1283 if ((macAddr[0] & 0x01) == 0x01)
1284 return true;
1285 else
1286 return false;
1287} /****** end limIsGroupAddr() ******/
1288
1289/**
1290 * limPostMsgApiNoWait()
1291 *
1292 *FUNCTION:
1293 * This function is called from other thread while posting a
1294 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1295 *
1296 *LOGIC:
1297 * NA
1298 *
1299 *ASSUMPTIONS:
1300 * NA
1301 *
1302 *NOTE:
1303 * NA
1304 *
1305 * @param pMsg - Pointer to the Global MAC structure
1306 * @param pMsg - Pointer to the message structure
1307 * @return None
1308 */
1309
1310tANI_U32
1311limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1312{
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 limProcessMessages(pMac, pMsg);
1314 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001315} /*** end limPostMsgApiNoWait() ***/
1316
1317
1318
1319/**
1320 * limPrintMacAddr()
1321 *
1322 *FUNCTION:
1323 * This function is called to print passed MAC address
1324 * in : format.
1325 *
1326 *LOGIC:
1327 *
1328 *ASSUMPTIONS:
1329 * NA
1330 *
1331 *NOTE:
1332 * @param macAddr - MacAddr to be printed
1333 * @param logLevel - Loglevel to be used
1334 *
1335 * @return None.
1336 */
1337
1338void
1339limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1340{
1341 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001342 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001343} /****** end limPrintMacAddr() ******/
1344
1345
Jeff Johnson295189b2012-06-20 16:38:30 -07001346/*
1347 * limResetDeferredMsgQ()
1348 *
1349 *FUNCTION:
1350 * This function resets the deferred message queue parameters.
1351 *
1352 *PARAMS:
1353 * @param pMac - Pointer to Global MAC structure
1354 *
1355 *LOGIC:
1356 *
1357 *ASSUMPTIONS:
1358 * NA
1359 *
1360 *NOTE:
1361 * NA
1362 *
1363 *RETURNS:
1364 * None
1365 */
1366
1367void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1368{
1369 pMac->lim.gLimDeferredMsgQ.size =
1370 pMac->lim.gLimDeferredMsgQ.write =
1371 pMac->lim.gLimDeferredMsgQ.read = 0;
1372
1373}
1374
1375
1376#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1377#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1378
1379/*
1380 * limWriteDeferredMsgQ()
1381 *
1382 *FUNCTION:
1383 * This function queues up a deferred message for later processing on the
1384 * STA side.
1385 *
1386 *PARAMS:
1387 * @param pMac - Pointer to Global MAC structure
1388 * @param limMsg - a LIM message
1389 *
1390 *LOGIC:
1391 *
1392 *ASSUMPTIONS:
1393 * NA
1394 *
1395 *NOTE:
1396 * NA
1397 *
1398 *RETURNS:
1399 * None
1400 */
1401
1402tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1403{
1404 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001405 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1407 limMsg->type);)
1408
1409 /*
1410 ** check if the deferred message queue is full
1411 **/
1412 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1413 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301414 if (!(pMac->lim.deferredMsgCnt & 0xF))
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001415 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301416 limLog(pMac, LOGE,
1417 FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
1418 limMsg->type, ++pMac->lim.deferredMsgCnt);
1419 vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
1420 WLAN_LOG_INDICATOR_HOST_DRIVER,
1421 WLAN_LOG_REASON_QUEUE_FULL,
1422 FALSE, TRUE);
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001423 }
1424 else
1425 {
1426 pMac->lim.deferredMsgCnt++;
1427 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001428 return TX_QUEUE_FULL;
1429 }
1430
1431 /*
1432 ** In the application, there should not be more than 1 message get
1433 ** queued up. If happens, flags a warning. In the future, this can
1434 ** happen.
1435 **/
1436 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1437 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001438 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 -07001439 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1440 limIsSystemInScanState(pMac),
1441 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1442 pMac->lim.gLimAddtsSent);)
1443 }
1444
1445 /*
1446 ** To prevent the deferred Q is full of management frames, only give them certain space
1447 **/
1448 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1449 {
1450 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1451 {
1452 tANI_U16 idx, count = 0;
1453 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1454 {
1455 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1456 {
1457 count++;
1458 }
1459 }
1460 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1461 {
1462 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001463 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 //Return error, caller knows what to do
1465 return TX_QUEUE_FULL;
1466 }
1467 }
1468 }
1469
1470 ++pMac->lim.gLimDeferredMsgQ.size;
1471
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001472 /* reset the count here since we are able to defer the message */
1473 if(pMac->lim.deferredMsgCnt != 0)
1474 {
1475 pMac->lim.deferredMsgCnt = 0;
1476 }
1477
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 /*
1479 ** if the write pointer hits the end of the queue, rewind it
1480 **/
1481 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1482 pMac->lim.gLimDeferredMsgQ.write = 0;
1483
1484 /*
1485 ** save the message to the queue and advanced the write pointer
1486 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301487 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1488 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 (tANI_U8 *)limMsg,
1490 sizeof(tSirMsgQ));
1491 return TX_SUCCESS;
1492
1493}
1494
1495/*
1496 * limReadDeferredMsgQ()
1497 *
1498 *FUNCTION:
1499 * This function dequeues a deferred message for processing on the
1500 * STA side.
1501 *
1502 *PARAMS:
1503 * @param pMac - Pointer to Global MAC structure
1504 *
1505 *LOGIC:
1506 *
1507 *ASSUMPTIONS:
1508 * NA
1509 *
1510 *NOTE:
1511 *
1512 *
1513 *RETURNS:
1514 * Returns the message at the head of the deferred message queue
1515 */
1516
1517tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1518{
1519 tSirMsgQ *msg;
1520
1521 /*
1522 ** check any messages left. If no, return
1523 **/
1524 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1525 return NULL;
1526
1527 /*
1528 ** decrement the queue size
1529 **/
1530 pMac->lim.gLimDeferredMsgQ.size--;
1531
1532 /*
1533 ** retrieve the message from the head of the queue
1534 **/
1535 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1536
1537 /*
1538 ** advance the read pointer
1539 **/
1540 pMac->lim.gLimDeferredMsgQ.read++;
1541
1542 /*
1543 ** if the read pointer hits the end of the queue, rewind it
1544 **/
1545 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1546 pMac->lim.gLimDeferredMsgQ.read = 0;
1547
1548 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001549 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1551 msg->type);)
1552
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001553 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 limIsSystemInScanState(pMac),
1555 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1556 pMac->lim.gLimAddtsSent);)
1557
1558 return(msg);
1559}
1560
1561tSirRetStatus
1562limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1563 tSirMsgQ *pMsg,
1564 tANI_U8 qType)
1565{
1566// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 SysProcessMmhMsg(pMac, pMsg);
1568 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001569}
1570
1571char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1572{
1573#ifdef FIXME_GEN6
1574
1575 if (type == SIR_MAC_MGMT_FRAME)
1576 {
1577 switch (subType)
1578 {
1579 case SIR_MAC_MGMT_ASSOC_REQ:
1580 return "MAC_MGMT_ASSOC_REQ";
1581 case SIR_MAC_MGMT_ASSOC_RSP:
1582 return "MAC_MGMT_ASSOC_RSP";
1583 case SIR_MAC_MGMT_REASSOC_REQ:
1584 return "MAC_MGMT_REASSOC_REQ";
1585 case SIR_MAC_MGMT_REASSOC_RSP:
1586 return "MAC_MGMT_REASSOC_RSP";
1587 case SIR_MAC_MGMT_PROBE_REQ:
1588 return "MAC_MGMT_PROBE_REQ";
1589 case SIR_MAC_MGMT_PROBE_RSP:
1590 return "MAC_MGMT_PROBE_RSP";
1591 case SIR_MAC_MGMT_BEACON:
1592 return "MAC_MGMT_BEACON";
1593 case SIR_MAC_MGMT_ATIM:
1594 return "MAC_MGMT_ATIM";
1595 case SIR_MAC_MGMT_DISASSOC:
1596 return "MAC_MGMT_DISASSOC";
1597 case SIR_MAC_MGMT_AUTH:
1598 return "MAC_MGMT_AUTH";
1599 case SIR_MAC_MGMT_DEAUTH:
1600 return "MAC_MGMT_DEAUTH";
1601 case SIR_MAC_MGMT_ACTION:
1602 return "MAC_MGMT_ACTION";
1603 case SIR_MAC_MGMT_RESERVED15:
1604 return "MAC_MGMT_RESERVED15";
1605 default:
1606 return "Unknown MGMT Frame";
1607 }
1608 }
1609
1610 else if (type == SIR_MAC_CTRL_FRAME)
1611 {
1612 switch (subType)
1613 {
1614 case SIR_MAC_CTRL_RR:
1615 return "MAC_CTRL_RR";
1616 case SIR_MAC_CTRL_BAR:
1617 return "MAC_CTRL_BAR";
1618 case SIR_MAC_CTRL_BA:
1619 return "MAC_CTRL_BA";
1620 case SIR_MAC_CTRL_PS_POLL:
1621 return "MAC_CTRL_PS_POLL";
1622 case SIR_MAC_CTRL_RTS:
1623 return "MAC_CTRL_RTS";
1624 case SIR_MAC_CTRL_CTS:
1625 return "MAC_CTRL_CTS";
1626 case SIR_MAC_CTRL_ACK:
1627 return "MAC_CTRL_ACK";
1628 case SIR_MAC_CTRL_CF_END:
1629 return "MAC_CTRL_CF_END";
1630 case SIR_MAC_CTRL_CF_END_ACK:
1631 return "MAC_CTRL_CF_END_ACK";
1632 default:
1633 return "Unknown CTRL Frame";
1634 }
1635 }
1636
1637 else if (type == SIR_MAC_DATA_FRAME)
1638 {
1639 switch (subType)
1640 {
1641 case SIR_MAC_DATA_DATA:
1642 return "MAC_DATA_DATA";
1643 case SIR_MAC_DATA_DATA_ACK:
1644 return "MAC_DATA_DATA_ACK";
1645 case SIR_MAC_DATA_DATA_POLL:
1646 return "MAC_DATA_DATA_POLL";
1647 case SIR_MAC_DATA_DATA_ACK_POLL:
1648 return "MAC_DATA_DATA_ACK_POLL";
1649 case SIR_MAC_DATA_NULL:
1650 return "MAC_DATA_NULL";
1651 case SIR_MAC_DATA_NULL_ACK:
1652 return "MAC_DATA_NULL_ACK";
1653 case SIR_MAC_DATA_NULL_POLL:
1654 return "MAC_DATA_NULL_POLL";
1655 case SIR_MAC_DATA_NULL_ACK_POLL:
1656 return "MAC_DATA_NULL_ACK_POLL";
1657 case SIR_MAC_DATA_QOS_DATA:
1658 return "MAC_DATA_QOS_DATA";
1659 case SIR_MAC_DATA_QOS_DATA_ACK:
1660 return "MAC_DATA_QOS_DATA_ACK";
1661 case SIR_MAC_DATA_QOS_DATA_POLL:
1662 return "MAC_DATA_QOS_DATA_POLL";
1663 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1664 return "MAC_DATA_QOS_DATA_ACK_POLL";
1665 case SIR_MAC_DATA_QOS_NULL:
1666 return "MAC_DATA_QOS_NULL";
1667 case SIR_MAC_DATA_QOS_NULL_ACK:
1668 return "MAC_DATA_QOS_NULL_ACK";
1669 case SIR_MAC_DATA_QOS_NULL_POLL:
1670 return "MAC_DATA_QOS_NULL_POLL";
1671 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1672 return "MAC_DATA_QOS_NULL_ACK_POLL";
1673 default:
1674 return "Unknown Data Frame";
1675 }
1676 }
1677 else
1678 return "Unknown";
1679#endif
1680return "";
1681}
1682
Jeff Johnson295189b2012-06-20 16:38:30 -07001683void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1684{
1685 int i;
1686 static int enable;
1687 tUpdateBeaconParams beaconParams;
1688
1689 tpPESession psessionEntry = limIsApSessionActive(pMac);
1690
1691 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001692 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001693 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001695 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301696
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301697 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001698 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001699
1700 beaconParams.paramChangeBitmap = 0;
1701 /*
1702 ** This is doing a 2 pass check. The first pass is to invalidate
1703 ** all the cache entries. The second pass is to decide whether to
1704 ** disable protection.
1705 **/
1706 if (!enable)
1707 {
1708
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001709 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 psessionEntry->gLimOlbcParams.numSta = 0;
1711 psessionEntry->gLimOverlap11gParams.numSta = 0;
1712 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1713 psessionEntry->gLimNonGfParams.numSta = 0;
1714 psessionEntry->gLimLsigTxopParams.numSta = 0;
1715
1716 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1717 pMac->lim.protStaOverlapCache[i].active = false;
1718
1719 enable = 1;
1720 }
1721 else
1722 {
1723
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001724 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 {
1726 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1727 {
1728 if (!psessionEntry->gLim11bParams.protectionEnabled)
1729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001730 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1732 }
1733 }
1734 }
1735
1736 if (!psessionEntry->gLimOverlap11gParams.numSta)
1737 {
1738 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1739 {
1740 if (!psessionEntry->gLim11gParams.protectionEnabled)
1741 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001742 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1744 }
1745 }
1746 }
1747
1748 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1749 {
1750 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1751 {
1752 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1753 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001754 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1756 }
1757 }
1758 }
1759
1760 enable = 0;
1761 }
1762
1763 if(beaconParams.paramChangeBitmap)
1764 {
1765 schSetFixedBeaconFields(pMac,psessionEntry);
1766 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1767 }
1768
1769 // Start OLBC timer
1770 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1771 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001772 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 }
1774}
Jeff Johnson295189b2012-06-20 16:38:30 -07001775
1776/**
1777 * limIsNullSsid()
1778 *
1779 *FUNCTION:
1780 * This function checks if Ssid supplied is Null SSID
1781 *
1782 *
1783 *LOGIC:
1784 *
1785 *ASSUMPTIONS:
1786 * NA
1787 *
1788 *NOTE:
1789 * NA
1790 *
1791 * @param tSirMacSSid *
1792 *
1793 *
1794 * @return true if SSID is Null SSID else false
1795 */
1796
1797tANI_U8
1798limIsNullSsid( tSirMacSSid *pSsid )
1799{
1800 tANI_U8 fNullSsid = false;
1801 tANI_U32 SsidLength;
1802 tANI_U8 *pSsidStr;
1803
1804 do
1805 {
1806 if ( 0 == pSsid->length )
1807 {
1808 fNullSsid = true;
1809 break;
1810 }
1811
1812#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301813 /* If the first charactes is space and SSID length is 1
1814 * then consider it as NULL SSID*/
1815 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1816 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301818 fNullSsid = true;
1819 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 }
1821 else
1822 {
1823 /* check if all the charactes in SSID are NULL*/
1824 SsidLength = pSsid->length;
1825 pSsidStr = pSsid->ssId;
1826
1827 while ( SsidLength )
1828 {
1829 if( *pSsidStr )
1830 break;
1831
1832 pSsidStr++;
1833 SsidLength--;
1834 }
1835
1836 if( 0 == SsidLength )
1837 {
1838 fNullSsid = true;
1839 break;
1840 }
1841 }
1842 }
1843 while( 0 );
1844
1845 return fNullSsid;
1846} /****** end limIsNullSsid() ******/
1847
1848
1849
Jeff Johnson295189b2012-06-20 16:38:30 -07001850
1851/** -------------------------------------------------------------
1852\fn limUpdateProtStaParams
1853\brief updates protection related counters.
1854\param tpAniSirGlobal pMac
1855\param tSirMacAddr peerMacAddr
1856\param tLimProtStaCacheType protStaCacheType
1857\param tHalBitVal gfSupported
1858\param tHalBitVal lsigTxopSupported
1859\return None
1860 -------------------------------------------------------------*/
1861void
1862limUpdateProtStaParams(tpAniSirGlobal pMac,
1863tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1864tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1865tpPESession psessionEntry)
1866{
1867 tANI_U32 i;
1868
1869 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1870 limLog(pMac,LOG1, FL("Addr : "));
1871 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1872
1873 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1874 {
1875 if (psessionEntry->protStaCache[i].active)
1876 {
1877 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1878 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1879
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301880 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 psessionEntry->protStaCache[i].addr,
1882 peerMacAddr, sizeof(tSirMacAddr)))
1883 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001884 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 return;
1886 }
1887 }
1888 }
1889
1890 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1891 {
1892 if (!psessionEntry->protStaCache[i].active)
1893 break;
1894 }
1895
1896 if (i >= LIM_PROT_STA_CACHE_SIZE)
1897 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001898 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 return;
1900 }
1901
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301902 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 peerMacAddr,
1904 sizeof(tSirMacAddr));
1905
1906 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1907 psessionEntry->protStaCache[i].active = true;
1908 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1909 {
1910 psessionEntry->gLim11bParams.numSta++;
1911 limLog(pMac,LOG1, FL("11B, "));
1912 }
1913 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1914 {
1915 psessionEntry->gLim11gParams.numSta++;
1916 limLog(pMac,LOG1, FL("11G, "));
1917 }
1918 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1919 {
1920 psessionEntry->gLimHt20Params.numSta++;
1921 limLog(pMac,LOG1, FL("HT20, "));
1922 }
1923
1924 if(!gfSupported)
1925 {
1926 psessionEntry->gLimNonGfParams.numSta++;
1927 limLog(pMac,LOG1, FL("NonGf, "));
1928 }
1929 if(!lsigTxopSupported)
1930 {
1931 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001932 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 }
1934}// ---------------------------------------------------------------------
1935
1936/** -------------------------------------------------------------
1937\fn limDecideApProtection
1938\brief Decides all the protection related staiton coexistence and also sets
1939\ short preamble and short slot appropriately. This function will be called
1940\ when AP is ready to send assocRsp tp the station joining right now.
1941\param tpAniSirGlobal pMac
1942\param tSirMacAddr peerMacAddr
1943\return None
1944 -------------------------------------------------------------*/
1945void
1946limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1947{
1948 tANI_U16 tmpAid;
1949 tpDphHashNode pStaDs;
1950 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1951 tANI_U32 phyMode;
1952 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1953 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1954
1955 pBeaconParams->paramChangeBitmap = 0;
1956 // check whether to enable protection or not
1957 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1958 if(NULL == pStaDs)
1959 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301960 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 return;
1962 }
1963 limGetRfBand(pMac, &rfBand, psessionEntry);
1964 //if we are in 5 GHZ band
1965 if(SIR_BAND_5_GHZ == rfBand)
1966 {
1967 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1968 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001969 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 {
1971 //we are 11N and 11A station is joining.
1972 //protection from 11A required.
1973 if(false == pStaDs->mlmStaContext.htCapability)
1974 {
1975 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1976 return;
1977 }
1978 }
1979 }
1980 else if(SIR_BAND_2_4_GHZ== rfBand)
1981 {
1982 limGetPhyMode(pMac, &phyMode, psessionEntry);
1983
1984 //We are 11G. Check if we need protection from 11b Stations.
1985 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001986 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 {
1988
1989 if (pStaDs->erpEnabled== eHAL_CLEAR)
1990 {
1991 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1992 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001993 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1995 }
1996 }
1997
1998 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001999 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 {
2001 //check if we need protection from 11b station
2002 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
2003 (!pStaDs->mlmStaContext.htCapability))
2004 {
2005 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
2006 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002007 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2009 }
2010 //station being joined is non-11b and non-ht ==> 11g device
2011 else if(!pStaDs->mlmStaContext.htCapability)
2012 {
2013 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
2014 //enable protection
2015 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
2016 }
2017 //ERP mode is enabled for the latest station joined
2018 //latest station joined is HT capable
2019 //This case is being handled in common code (commn between both the bands) below.
2020 }
2021 }
2022
2023 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002024 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 (true == pStaDs->mlmStaContext.htCapability))
2026 {
2027 if(!pStaDs->htGreenfield)
2028 {
2029 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2030 gfSupported = eHAL_CLEAR;
2031 }
2032 //Station joining is HT 20Mhz
2033 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2034 {
2035 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2036 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2037 }
2038 //Station joining does not support LSIG TXOP Protection
2039 if(!pStaDs->htLsigTXOPProtection)
2040 {
2041 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2042 lsigTxopSupported = eHAL_CLEAR;
2043 }
2044 }
2045
2046 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2047 gfSupported, lsigTxopSupported, psessionEntry);
2048
2049 return;
2050}
Jeff Johnson295189b2012-06-20 16:38:30 -07002051
2052
2053/** -------------------------------------------------------------
2054\fn limEnableOverlap11gProtection
2055\brief wrapper function for setting overlap 11g protection.
2056\param tpAniSirGlobal pMac
2057\param tpUpdateBeaconParams pBeaconParams
2058\param tpSirMacMgmtHdr pMh
2059\return None
2060 -------------------------------------------------------------*/
2061void
2062limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2063tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2064{
2065 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2066
2067 if (psessionEntry->gLimOlbcParams.numSta &&
2068 !psessionEntry->gLimOlbcParams.protectionEnabled)
2069 {
2070 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002071 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2073 }
2074}
2075
2076
2077/** -------------------------------------------------------------
2078\fn limUpdateShortPreamble
2079\brief Updates short preamble if needed when a new station joins.
2080\param tpAniSirGlobal pMac
2081\param tSirMacAddr peerMacAddr
2082\param tpUpdateBeaconParams pBeaconParams
2083\return None
2084 -------------------------------------------------------------*/
2085void
2086limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2087 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2088{
2089 tANI_U16 tmpAid;
2090 tpDphHashNode pStaDs;
2091 tANI_U32 phyMode;
2092 tANI_U16 i;
2093
2094 // check whether to enable protection or not
2095 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2096
2097 limGetPhyMode(pMac, &phyMode, psessionEntry);
2098
2099 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2100
2101 {
2102 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2103 {
2104 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2105 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2106
2107 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2108 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2110 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2111 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302112 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2114 peerMacAddr, sizeof(tSirMacAddr)))
2115 return;
2116 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 {
2118 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2119 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302120 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2122 peerMacAddr, sizeof(tSirMacAddr)))
2123 return;
2124 }
2125 }
2126 }
2127
2128
2129 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2130 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2132 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2133 break;
2134 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 {
2136 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2137 break;
2138 }
2139 }
2140
2141 if (i >= LIM_PROT_STA_CACHE_SIZE)
2142 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2144 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2145 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2146 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2147 return;
2148 }
2149 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 {
2151 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2152 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2153 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2154 return;
2155 }
2156
2157 }
2158
2159
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302160 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2161 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 peerMacAddr, sizeof(tSirMacAddr));
2163 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2164 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2165 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302167 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 peerMacAddr, sizeof(tSirMacAddr));
2169 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2170 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2171 }
2172
2173
2174 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002175 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002176
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002178 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 }
2180 }
2181}
2182
2183/** -------------------------------------------------------------
2184\fn limUpdateShortSlotTime
2185\brief Updates short slot time if needed when a new station joins.
2186\param tpAniSirGlobal pMac
2187\param tSirMacAddr peerMacAddr
2188\param tpUpdateBeaconParams pBeaconParams
2189\return None
2190 -------------------------------------------------------------*/
2191
2192void
2193limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2194 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2195{
2196 tANI_U16 tmpAid;
2197 tpDphHashNode pStaDs;
2198 tANI_U32 phyMode;
2199 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 tANI_U16 i;
2201
2202 // check whether to enable protection or not
2203 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2204 limGetPhyMode(pMac, &phyMode, psessionEntry);
2205
Jeff Johnsone7245742012-09-05 17:12:55 -07002206 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2207 * be always 1 and in 11b case, it should be always 0
2208 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2210 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002211 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2212 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2213 * it in limDecideShortSlot
2214 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2216 {
2217 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2218 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2219 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2220 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2222 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2223 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302224 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2226 peerMacAddr, sizeof(tSirMacAddr)))
2227 return;
2228 }
2229 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 {
2231 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2232 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302233 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2235 peerMacAddr, sizeof(tSirMacAddr)))
2236 return;
2237 }
2238 }
2239 }
2240
2241 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2242 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2244 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2245 break;
2246 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
2248 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2249 break;
2250 }
2251 }
2252
2253 if (i >= LIM_PROT_STA_CACHE_SIZE)
2254 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2256 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2257 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2258 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2259 return;
2260 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
2262 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2263 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2264 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2265 return;
2266 }
2267 }
2268
2269
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302271 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 peerMacAddr, sizeof(tSirMacAddr));
2273 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2274 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2275 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302277 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 peerMacAddr, sizeof(tSirMacAddr));
2279 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2280 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2281 }
2282 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2283
Jeff Johnsone7245742012-09-05 17:12:55 -07002284 /* 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
2285 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2286 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002288 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 {
2290 // enable long slot time
2291 pBeaconParams->fShortSlotTime = false;
2292 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002293 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002294 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 }
2296 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002298 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 {
2300 // enable long slot time
2301 pBeaconParams->fShortSlotTime = false;
2302 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002303 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002304 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 }
2306 }
2307 }
2308 }
2309}
2310
Jeff Johnson295189b2012-06-20 16:38:30 -07002311
2312/** -------------------------------------------------------------
2313\fn limDecideStaProtectionOnAssoc
2314\brief Decide protection related settings on Sta while association.
2315\param tpAniSirGlobal pMac
2316\param tpSchBeaconStruct pBeaconStruct
2317\return None
2318 -------------------------------------------------------------*/
2319void
2320limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2321 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2322{
2323 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2324 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2325
2326 limGetRfBand(pMac, &rfBand, psessionEntry);
2327 limGetPhyMode(pMac, &phyMode, psessionEntry);
2328
2329 if(SIR_BAND_5_GHZ == rfBand)
2330 {
2331 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2332 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2333 {
2334 if(pMac->lim.cfgProtection.fromlla)
2335 psessionEntry->beaconParams.llaCoexist = true;
2336 }
2337 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2338 {
2339 if(pMac->lim.cfgProtection.ht20)
2340 psessionEntry->beaconParams.ht20Coexist = true;
2341 }
2342
2343 }
2344 else if(SIR_BAND_2_4_GHZ == rfBand)
2345 {
2346 //spec 7.3.2.13
2347 //UseProtection will be set when nonERP STA is associated.
2348 //NonERPPresent bit will be set when:
2349 //--nonERP Sta is associated OR
2350 //--nonERP Sta exists in overlapping BSS
2351 //when useProtection is not set then protection from nonERP stations is optional.
2352
2353 //CFG protection from 11b is enabled and
2354 //11B device in the BSS
2355 /* TODO, This is not sessionized */
2356 if (phyMode != WNI_CFG_PHY_MODE_11B)
2357 {
2358 if (pMac->lim.cfgProtection.fromllb &&
2359 pBeaconStruct->erpPresent &&
2360 (pBeaconStruct->erpIEInfo.useProtection ||
2361 pBeaconStruct->erpIEInfo.nonErpPresent))
2362 {
2363 psessionEntry->beaconParams.llbCoexist = true;
2364 }
2365 //AP has no 11b station associated.
2366 else
2367 {
2368 psessionEntry->beaconParams.llbCoexist = false;
2369 }
2370 }
2371 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002372 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 (pBeaconStruct->HTInfo.present))
2374 {
2375 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2376
2377 //Obss Non HT STA present mode
2378 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2379
2380
2381 //CFG protection from 11G is enabled and
2382 //our AP has at least one 11G station associated.
2383 if(pMac->lim.cfgProtection.fromllg &&
2384 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2385 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2386 (!psessionEntry->beaconParams.llbCoexist))
2387 {
2388 if(pMac->lim.cfgProtection.fromllg)
2389 psessionEntry->beaconParams.llgCoexist = true;
2390 }
2391
2392 //AP has only HT stations associated and at least one station is HT 20
2393 //disable protection from any non-HT devices.
2394 //decision for disabling protection from 11b has already been taken above.
2395 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2396 {
2397 //Disable protection from 11G station.
2398 psessionEntry->beaconParams.llgCoexist = false;
2399 //CFG protection from HT 20 is enabled.
2400 if(pMac->lim.cfgProtection.ht20)
2401 psessionEntry->beaconParams.ht20Coexist = true;
2402 }
2403 //Disable protection from non-HT and HT20 devices.
2404 //decision for disabling protection from 11b has already been taken above.
2405 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2406 {
2407 psessionEntry->beaconParams.llgCoexist = false;
2408 psessionEntry->beaconParams.ht20Coexist = false;
2409 }
2410
2411 }
2412 }
2413
2414 //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 -07002415 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 (pBeaconStruct->HTInfo.present))
2417 {
2418 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2419 psessionEntry->beaconParams.fRIFSMode =
2420 ( tANI_U8 ) htInfo.rifsMode;
2421 psessionEntry->beaconParams.llnNonGFCoexist =
2422 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2423 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2424 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2425 }
2426}
2427
2428
2429/** -------------------------------------------------------------
2430\fn limDecideStaProtection
2431\brief Decides protection related settings on Sta while processing beacon.
2432\param tpAniSirGlobal pMac
2433\param tpUpdateBeaconParams pBeaconParams
2434\return None
2435 -------------------------------------------------------------*/
2436void
2437limDecideStaProtection(tpAniSirGlobal pMac,
2438 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2439{
2440
2441 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2442 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2443
2444 limGetRfBand(pMac, &rfBand, psessionEntry);
2445 limGetPhyMode(pMac, &phyMode, psessionEntry);
2446
2447 if(SIR_BAND_5_GHZ == rfBand)
2448 {
2449 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002450 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002451 (pBeaconStruct->HTInfo.present))
2452 {
2453 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2454 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2455 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2456 {
2457 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2458 }
2459 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2460 //protection from HT20 if needed.
2461 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2462 {
2463 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2464 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2465 }
2466 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2467 {
2468 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2469 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2470 }
2471 }
2472 }
2473 else if(SIR_BAND_2_4_GHZ == rfBand)
2474 {
2475 /* spec 7.3.2.13
2476 * UseProtection will be set when nonERP STA is associated.
2477 * NonERPPresent bit will be set when:
2478 * --nonERP Sta is associated OR
2479 * --nonERP Sta exists in overlapping BSS
2480 * when useProtection is not set then protection from nonERP stations is optional.
2481 */
2482
2483 if (phyMode != WNI_CFG_PHY_MODE_11B)
2484 {
2485 if (pBeaconStruct->erpPresent &&
2486 (pBeaconStruct->erpIEInfo.useProtection ||
2487 pBeaconStruct->erpIEInfo.nonErpPresent))
2488 {
2489 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2490 }
2491 //AP has no 11b station associated.
2492 else
2493 {
2494 //disable protection from 11b station
2495 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2496 }
2497 }
2498
2499 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002500 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 (pBeaconStruct->HTInfo.present))
2502 {
2503
2504 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2505 //AP has at least one 11G station associated.
2506 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2507 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2508 (!psessionEntry->beaconParams.llbCoexist))
2509 {
2510 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2511
2512 }
2513
2514 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2515 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2516 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2517 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2518 {
2519 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2520
2521 //AP has only HT stations associated and at least one station is HT 20
2522 //disable protection from any non-HT devices.
2523 //decision for disabling protection from 11b has already been taken above.
2524 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2525 {
2526 //Disable protection from 11G station.
2527 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2528
2529 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2530 }
2531 //Disable protection from non-HT and HT20 devices.
2532 //decision for disabling protection from 11b has already been taken above.
2533 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2534 {
2535 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2536 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2537
2538 }
2539 }
2540 }
2541 }
2542
2543 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002544 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 (pBeaconStruct->HTInfo.present))
2546 {
2547 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2548 //Check for changes in protection related factors other than HT operating mode.
2549 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2550 if ( psessionEntry->beaconParams.fRIFSMode !=
2551 ( tANI_U8 ) htInfo.rifsMode )
2552 {
2553 pBeaconParams->fRIFSMode =
2554 psessionEntry->beaconParams.fRIFSMode =
2555 ( tANI_U8 ) htInfo.rifsMode;
2556 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2557 }
2558
2559 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2560 htInfo.nonGFDevicesPresent )
2561 {
2562 pBeaconParams->llnNonGFCoexist =
2563 psessionEntry->beaconParams.llnNonGFCoexist =
2564 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2565 pBeaconParams->paramChangeBitmap |=
2566 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2567 }
2568
2569 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2570 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2571 {
2572 pBeaconParams->fLsigTXOPProtectionFullSupport =
2573 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2574 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2575 pBeaconParams->paramChangeBitmap |=
2576 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2577 }
2578
2579 // For Station just update the global lim variable, no need to send message to HAL
2580 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2581 //stations in overlapping BSS.
2582 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2583 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2584
2585 }
2586}
2587
2588
2589/**
2590 * limProcessChannelSwitchTimeout()
2591 *
2592 *FUNCTION:
2593 * This function is invoked when Channel Switch Timer expires at
2594 * the STA. Now, STA must stop traffic, and then change/disable
2595 * primary or secondary channel.
2596 *
2597 *
2598 *NOTE:
2599 * @param pMac - Pointer to Global MAC structure
2600 * @return None
2601 */
2602void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2603{
2604 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002606
Abhishek Singh800d17a2016-08-26 17:00:49 +05302607 if ((psessionEntry = peFindSessionBySessionId(pMac,
2608 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) {
2609 limLog(pMac, LOGW,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 return;
2611 }
2612
2613 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2614 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002615 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 -07002616 return;
2617 }
Abhishek Singh800d17a2016-08-26 17:00:49 +05302618 if (psessionEntry->gLimSpecMgmt.dot11hChanSwState !=
2619 eLIM_11H_CHANSW_RUNNING) {
2620 limLog(pMac, LOGW,
2621 FL("Channel switch timer should not have been running in state %d"),
2622 psessionEntry->gLimSpecMgmt.dot11hChanSwState);
2623 return;
2624 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002625 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302626
2627 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 * This potentially can create issues if the function tries to set
2629 * channel while device is in power-save, hence putting an extra check
2630 * to verify if the device is in power-save or not
2631 */
2632 if(!limIsSystemInActiveState(pMac))
2633 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002634 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 return;
2636 }
2637
2638 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002639 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002640
2641 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002642 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Abhishek Singhcb255b82015-10-01 12:37:57 +05302643
2644 /*
2645 * If Lim allows Switch channel on same channel on which preauth
2646 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2647 * during preauth rsp handling hence firmware may crash on ENTER/
2648 * EXIT BMPS request.
2649 */
2650 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2651 {
2652 limLog(pMac, LOGE,
2653 FL("Avoid Switch Channel req during pre auth"));
2654 return;
2655 }
2656 /* If link is already suspended mean some off
2657 * channel operation or scan is in progress, Allowing
2658 * Change channel here will lead to either Init Scan
2659 * sent twice or missing Finish scan when change
2660 * channel is completed, this may lead
2661 * to driver in invalid state and crash.
2662 */
2663 if (limIsLinkSuspended(pMac))
2664 {
2665 limLog(pMac, LOGE, FL("Link is already suspended for "
2666 "some other reason. Return here for sessionId:%d"),
2667 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2668 return;
2669 }
2670
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 /* Check if the AP is switching to a channel that we support.
2672 * Else, just don't bother to switch. Indicate HDD to look for a
2673 * better AP to associate
2674 */
2675 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2676 {
2677 /* We need to restore pre-channelSwitch state on the STA */
2678 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2679 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002680 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 return;
2682 }
2683
2684 /* If the channel-list that AP is asking us to switch is invalid,
2685 * then we cannot switch the channel. Just disassociate from AP.
2686 * We will find a better AP !!!
2687 */
Abhishek Singh800d17a2016-08-26 17:00:49 +05302688 if ((psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2689 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
2690 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) {
2691 limLog(pMac, LOGE, FL("Invalid channel!! Disconnect.."));
2692 limTearDownLinkWithAp(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2694 eSIR_MAC_UNSPEC_FAILURE_REASON);
Abhishek Singh800d17a2016-08-26 17:00:49 +05302695 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 return;
2697 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002698 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2699 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002700 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 {
2702 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002703 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2704 if ( isLimSessionOffChannel(pMac,
2705 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2706 {
2707 limSuspendLink(pMac,
2708 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2709 limProcessChannelSwitchSuspendLink,
2710 (tANI_U32*)psessionEntry );
2711 }
2712 else
2713 {
2714 limProcessChannelSwitchSuspendLink(pMac,
2715 eHAL_STATUS_SUCCESS,
2716 (tANI_U32*)psessionEntry);
2717 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 break;
2719
2720 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002721 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002722 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 psessionEntry->gLimChannelSwitch.secondarySubBand);
2725 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 case eLIM_CHANNEL_SWITCH_IDLE:
2728 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002729 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2731 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002732 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 }
2734 return; /* Please note, this is 'return' and not 'break' */
2735 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002736}
Jeff Johnson295189b2012-06-20 16:38:30 -07002737
2738/**
2739 * limUpdateChannelSwitch()
2740 *
2741 *FUNCTION:
2742 * This function is invoked whenever Station receives
2743 * either 802.11h channel switch IE or airgo proprietary
2744 * channel switch IE.
2745 *
2746 *NOTE:
2747 * @param pMac - Pointer to Global MAC structure
2748 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2749 * @param psessionentry
2750 */
2751void
2752limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2753{
2754
2755 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2757 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002758#ifdef WLAN_FEATURE_11AC
2759 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2760#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002761
Jeff Johnsone7245742012-09-05 17:12:55 -07002762 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002763
2764 /* STA either received proprietary channel switch IE or 802.11h
2765 * standard channel switch IE.
2766 */
2767 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2768 {
2769 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2770
2771 /* Add logic to determine which change this is: */
2772 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002773 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2774 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2775 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2776 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2777 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002779 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 }
2781 else
2782 {
2783 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002784 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2785 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2786 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002788 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002789#ifdef WLAN_FEATURE_11AC
2790 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2791 if(pBeacon->WiderBWChanSwitchAnnPresent)
2792 {
2793 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2794 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2795 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2796 }
2797#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002798
2799 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002800 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2801 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002802
2803 /* Do not bother to look and operate on extended channel switch element
2804 * if our own channel-bonding state is not enabled
2805 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002806 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 {
2808 if (pBeacon->extChannelSwitchPresent)
2809 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302810 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2811 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002813 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +05302814 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002816#ifdef WLAN_FEATURE_11AC
2817 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2818 {
2819 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2820 {
2821 if(pBeacon->extChannelSwitchPresent)
2822 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302823 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2824 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002825 {
2826 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2827 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2828 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +05302829 pBeacon->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002830 pWiderChnlSwitch->newCenterChanFreq0,
2831 psessionEntry);
2832 }
2833 }
2834 }
2835 }
2836#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002837 }
2838 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002839 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002840
2841
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002844 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002845 }
2846
2847 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002848 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002849 psessionEntry->peSessionId,
2850 psessionEntry->gLimChannelSwitch.primaryChannel,
2851 psessionEntry->gLimChannelSwitch.secondarySubBand,
2852 psessionEntry->gLimChannelSwitch.switchCount,
2853 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 return;
2855}
2856
2857/**
2858 * limCancelDot11hChannelSwitch
2859 *
2860 *FUNCTION:
2861 * This function is called when STA does not send updated channel-swith IE
2862 * after indicating channel-switch start. This will cancel the channel-swith
2863 * timer which is already running.
2864 *
2865 *LOGIC:
2866 *
2867 *ASSUMPTIONS:
2868 *
2869 *NOTE:
2870 *
2871 * @param pMac - Pointer to Global MAC structure
2872 *
2873 * @return None
2874 */
2875void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2876{
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2878 return;
2879
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002880 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002881 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002882
2883 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002885 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002886 }
2887
2888 /* We need to restore pre-channelSwitch state on the STA */
2889 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2890 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002891 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002892
2893 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002894}
2895
2896/**----------------------------------------------
2897\fn limCancelDot11hQuiet
2898\brief Cancel the quieting on Station if latest
2899 beacon doesn't contain quiet IE in it.
2900
2901\param pMac
2902\return NONE
2903-----------------------------------------------*/
2904void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2905{
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2907 return;
2908
Jeff Johnsone7245742012-09-05 17:12:55 -07002909 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002911 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2913 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002914 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 }
2916 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002917 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002918 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002919 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2921 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002922 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 }
2924 /**
2925 * If the channel switch is already running in silent mode, dont resume the
2926 * transmission. Channel switch timer when timeout, transmission will be resumed.
2927 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002928 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2929 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 {
2931 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002932 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 }
2934 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002935 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002936}
2937
2938/**
2939 * limProcessQuietTimeout
2940 *
2941 * FUNCTION:
2942 * This function is active only on the STA.
2943 * Handles SIR_LIM_QUIET_TIMEOUT
2944 *
2945 * LOGIC:
2946 * This timeout can occur under only one circumstance:
2947 *
2948 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2949 * This indicates that the timeout "interval" has
2950 * expired. This is a trigger for the STA to now
2951 * shut-off Tx/Rx for the specified gLimQuietDuration
2952 * -> The TIMER object gLimQuietBssTimer is
2953 * activated
2954 * -> With timeout = gLimQuietDuration
2955 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2956 *
2957 * ASSUMPTIONS:
2958 * Using two TIMER objects -
2959 * gLimQuietTimer & gLimQuietBssTimer
2960 *
2961 * NOTE:
2962 *
2963 * @param pMac - Pointer to Global MAC structure
2964 *
2965 * @return None
2966 */
2967void limProcessQuietTimeout(tpAniSirGlobal pMac)
2968{
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 //fetch the sessionEntry based on the sessionId
2970 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002971 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002972
Jeff Johnsone7245742012-09-05 17:12:55 -07002973 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002975 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002976 return;
2977 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002978
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302979 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002980 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 {
2982 case eLIM_QUIET_BEGIN:
2983 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002984 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2985 if (TX_SUCCESS !=
2986 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2987 {
2988 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002989 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002990 }
2991
2992 // gLimQuietDuration appears to be in units of ticks
2993 // Use it as is
2994 if (TX_SUCCESS !=
2995 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2996 psessionEntry->gLimSpecMgmt.quietDuration,
2997 0))
2998 {
2999 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003000 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003001 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003002 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003003#ifdef GEN6_TODO
3004 /* revisit this piece of code to assign the appropriate sessionId below
3005 * priority - HIGH
3006 */
3007 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3008#endif
3009 if( TX_SUCCESS !=
3010 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3011 {
3012 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003013 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 }
3015 else
3016 {
3017 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003018 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003019
3020 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3021 /* print message, otherwise, stop data traffic and stay quiet */
3022 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3023 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3024 {
3025 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003026 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 }
3028 else
3029 {
3030 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3031 /* freeze the transmission */
3032 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3033
3034 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003035 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003036 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 }
3038 }
3039 break;
3040
3041 case eLIM_QUIET_RUNNING:
3042 case eLIM_QUIET_INIT:
3043 case eLIM_QUIET_END:
3044 default:
3045 //
3046 // As of now, nothing to be done
3047 //
3048 break;
3049 }
3050}
3051
3052/**
3053 * limProcessQuietBssTimeout
3054 *
3055 * FUNCTION:
3056 * This function is active on the AP and STA.
3057 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3058 *
3059 * LOGIC:
3060 * On the AP -
3061 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3062 * an indication for the AP to START sending out the
3063 * Quiet BSS IE.
3064 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3065 * the 11H spec
3066 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3067 * a Proprietary IE. This will be understood by all the
3068 * TITAN STA's
3069 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3070 * initiate the SCH to include the Quiet BSS IE in all
3071 * its subsequent Beacons/PR's.
3072 * The Quiet BSS IE will be included in all the Beacons
3073 * & PR's until the next DTIM period
3074 *
3075 * On the STA -
3076 * When gLimQuietState = eLIM_QUIET_RUNNING
3077 * This indicates that the STA was successfully shut-off
3078 * for the specified gLimQuietDuration. This is a trigger
3079 * for the STA to now resume data traffic.
3080 * -> gLimQuietState is set to eLIM_QUIET_INIT
3081 *
3082 * ASSUMPTIONS:
3083 *
3084 * NOTE:
3085 *
3086 * @param pMac - Pointer to Global MAC structure
3087 *
3088 * @return None
3089 */
3090void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3091{
Jeff Johnsone7245742012-09-05 17:12:55 -07003092 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003093
Jeff Johnsone7245742012-09-05 17:12:55 -07003094 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003096 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003097 return;
3098 }
3099
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303100 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003101 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003103 }
3104 else
3105 {
3106 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003107 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003108 {
3109 case eLIM_QUIET_RUNNING:
3110 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003111 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003112
3113 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3114 {
3115 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003116 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3117 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 {
3119 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003120 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 }
3122
3123 /* Reset status flag */
3124 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3125 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3126
3127 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003128 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003129 }
3130 else
3131 {
3132 //
3133 // Nothing specific to be done in this case
3134 // A background scan that was triggered during
3135 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3136 //
3137 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003138 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 }
3140 break;
3141
3142 case eLIM_QUIET_INIT:
3143 case eLIM_QUIET_BEGIN:
3144 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003145 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 /* If the quiet period has ended, then resume the frame transmission */
3147 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003148 limRestorePreQuietState(pMac, psessionEntry);
3149 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 break;
3151
3152 default:
3153 //
3154 // As of now, nothing to be done
3155 //
3156 break;
3157 }
3158 }
3159}
Jeff Johnson295189b2012-06-20 16:38:30 -07003160/**
3161 * limProcessWPSOverlapTimeout
3162 *
3163 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3164 *
3165 * LOGIC:
3166 *
3167 * ASSUMPTIONS:
3168 *
3169 * NOTE:
3170 *
3171 * @param pMac - Pointer to Global MAC structure
3172 *
3173 * @return None
3174 */
3175#if 0
3176void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3177{
3178
3179 tpPESession psessionEntry;
3180 tANI_U32 sessionId;
3181
3182 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3183 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003184 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 }
3186
3187 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3188
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003189 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003190
3191 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3192 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003193 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003194 return;
3195 }
3196
3197 limWPSPBCTimeout(pMac, psessionEntry);
3198}
3199#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003200
Jeff Johnson295189b2012-06-20 16:38:30 -07003201/**----------------------------------------------
3202\fn limStartQuietTimer
3203\brief Starts the quiet timer.
3204
3205\param pMac
3206\return NONE
3207-----------------------------------------------*/
3208void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3209{
3210 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303211 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003212
3213 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003214 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 return;
3216 }
3217
Jeff Johnson295189b2012-06-20 16:38:30 -07003218
3219 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3220 return;
3221 // First, de-activate Timer, if its already active
3222 limCancelDot11hQuiet(pMac, psessionEntry);
3223
Jeff Johnsone7245742012-09-05 17:12:55 -07003224 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3225 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3226 {
3227 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003228 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003229 }
3230
3231 // Set the NEW timeout value, in ticks
3232 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3233 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3234 {
3235 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003236 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003237 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003238
3239 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3240 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3241 {
3242 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003243 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003244 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003245
Jeff Johnsone7245742012-09-05 17:12:55 -07003246 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 return;
3248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003249}
3250
Jeff Johnson295189b2012-06-20 16:38:30 -07003251
3252/** ------------------------------------------------------------------------ **/
3253/**
3254 * keep track of the number of ANI peers associated in the BSS
3255 * For the first and last ANI peer, we have to update EDCA params as needed
3256 *
3257 * When the first ANI peer joins the BSS, we notify SCH
3258 * When the last ANI peer leaves the BSS, we notfiy SCH
3259 */
3260void
3261limUtilCountStaAdd(
3262 tpAniSirGlobal pMac,
3263 tpDphHashNode pSta,
3264 tpPESession psessionEntry)
3265{
3266
3267 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3268 return;
3269
3270 pSta->fAniCount = 1;
3271
3272 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3273 return;
3274
3275 // get here only if this is the first ANI peer in the BSS
3276 schEdcaProfileUpdate(pMac, psessionEntry);
3277}
3278
3279void
3280limUtilCountStaDel(
3281 tpAniSirGlobal pMac,
3282 tpDphHashNode pSta,
3283 tpPESession psessionEntry)
3284{
3285
3286 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3287 return;
3288
3289 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3290 * then go ahead and update the count and profiles. This ensures
3291 * that the "number of ani station" count is properly incremented/decremented.
3292 */
3293 if (pSta->valid == 1)
3294 return;
3295
3296 pSta->fAniCount = 0;
3297
3298 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3299 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003300 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 pMac->lim.gLimNumOfAniSTAs);
3302 return;
3303 }
3304
3305 pMac->lim.gLimNumOfAniSTAs--;
3306
3307 if (pMac->lim.gLimNumOfAniSTAs != 0)
3308 return;
3309
3310 // get here only if this is the last ANI peer in the BSS
3311 schEdcaProfileUpdate(pMac, psessionEntry);
3312}
3313
Jeff Johnson295189b2012-06-20 16:38:30 -07003314/**
3315 * limSwitchChannelCback()
3316 *
3317 *FUNCTION:
3318 * This is the callback function registered while requesting to switch channel
3319 * after AP indicates a channel switch for spectrum management (11h).
3320 *
3321 *NOTE:
3322 * @param pMac Pointer to Global MAC structure
3323 * @param status Status of channel switch request
3324 * @param data User data
3325 * @param psessionEntry Session information
3326 * @return NONE
3327 */
3328void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3329 tANI_U32 *data, tpPESession psessionEntry)
3330{
3331 tSirMsgQ mmhMsg = {0};
3332 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3333
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3335
3336 /* We need to restore pre-channelSwitch state on the STA */
3337 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3338 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003339 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 return;
3341 }
3342
3343 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303344 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3345 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003347 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 return;
3349 }
3350
3351 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3352 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003353 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3355 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303356 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003357 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3358 mmhMsg.bodyval = 0;
3359
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303360 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3361 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363}
3364
3365/**
3366 * limSwitchPrimaryChannel()
3367 *
3368 *FUNCTION:
3369 * This function changes the current operating channel
3370 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3371 *
3372 *NOTE:
3373 * @param pMac Pointer to Global MAC structure
3374 * @param newChannel new chnannel ID
3375 * @return NONE
3376 */
3377void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3378{
3379#if !defined WLAN_FEATURE_VOWIFI
3380 tANI_U32 localPwrConstraint;
3381#endif
3382
Abhishek Singh127a8442014-12-15 17:31:27 +05303383 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3384 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 psessionEntry->currentReqChannel = newChannel;
3386 psessionEntry->limRFBand = limGetRFBand(newChannel);
3387
3388 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3389
3390 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3391 pMac->lim.gpchangeChannelData = NULL;
3392
3393#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003394 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3396#else
3397 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3398 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003399 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 return;
3401 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003402 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3404#endif
3405 return;
3406}
3407
3408/**
3409 * limSwitchPrimarySecondaryChannel()
3410 *
3411 *FUNCTION:
3412 * This function changes the primary and secondary channel.
3413 * If 11h is enabled and user provides a "new channel ID"
3414 * that is different from the current operating channel,
3415 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3416 * assign notify LIM of such change.
3417 *
3418 *NOTE:
3419 * @param pMac Pointer to Global MAC structure
3420 * @param newChannel New chnannel ID (or current channel ID)
3421 * @param subband CB secondary info:
3422 * - eANI_CB_SECONDARY_NONE
3423 * - eANI_CB_SECONDARY_UP
3424 * - eANI_CB_SECONDARY_DOWN
3425 * @return NONE
3426 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003427void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003428{
3429#if !defined WLAN_FEATURE_VOWIFI
3430 tANI_U32 localPwrConstraint;
3431#endif
3432
Jeff Johnson295189b2012-06-20 16:38:30 -07003433#if !defined WLAN_FEATURE_VOWIFI
3434 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003435 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 return;
3437 }
3438#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303439 /* Assign the callback to resume TX once channel is changed.
3440 */
3441 psessionEntry->currentReqChannel = newChannel;
3442 psessionEntry->limRFBand = limGetRFBand(newChannel);
3443
3444 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3445
3446 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3447 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003448
Jeff Johnson295189b2012-06-20 16:38:30 -07003449#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003450 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003451#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003452 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003453#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003454
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303455#ifdef FEATURE_WLAN_DIAG_SUPPORT
3456 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3457 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3458#endif
3459
Jeff Johnsone7245742012-09-05 17:12:55 -07003460 // Store the new primary and secondary channel in session entries if different
3461 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 {
3463 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003464 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003466 psessionEntry->currentOperChannel = newChannel;
3467 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003468 if (psessionEntry->htSecondaryChannelOffset != subband)
3469 {
3470 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003471 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003472 psessionEntry->htSecondaryChannelOffset, subband);
3473 psessionEntry->htSecondaryChannelOffset = subband;
3474 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3475 {
3476 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3477 }
3478 else
3479 {
3480 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3481 }
3482 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3483 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003484
3485 return;
3486}
3487
3488
3489/**
3490 * limActiveScanAllowed()
3491 *
3492 *FUNCTION:
3493 * Checks if active scans are permitted on the given channel
3494 *
3495 *LOGIC:
3496 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3497 * Need to check if the channelNum matches, then depending on the corresponding
3498 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3499 *
3500 *ASSUMPTIONS:
3501 *
3502 *NOTE:
3503 *
3504 * @param pMac Pointer to Global MAC structure
3505 * @param channelNum channel number
3506 * @return None
3507 */
3508
3509tANI_U8 limActiveScanAllowed(
3510 tpAniSirGlobal pMac,
3511 tANI_U8 channelNum)
3512{
3513 tANI_U32 i;
3514 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3515 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3516 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3517 != eSIR_SUCCESS)
3518 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003519 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003520 return false;
3521 }
3522
3523 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3524 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003525 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003526 len);
3527 return false;
3528 }
3529
3530 for (i=0; (i+1) < len; i+=2)
3531 {
3532 if (channelPair[i] == channelNum)
3533 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3534 }
3535 return false;
3536}
3537
3538/**
3539 * limTriggerBackgroundScanDuringQuietBss()
3540 *
3541 *FUNCTION:
3542 * This function is applicable to the STA only.
3543 * This function is called by limProcessQuietTimeout(),
3544 * when it is time to honor the Quiet BSS IE from the AP.
3545 *
3546 *LOGIC:
3547 * If 11H is enabled:
3548 * We cannot trigger a background scan. The STA needs to
3549 * shut-off Tx/Rx.
3550 * If 11 is not enabled:
3551 * Determine if the next channel that we are going to
3552 * scan is NOT the same channel (or not) on which the
3553 * Quiet BSS was requested.
3554 * If yes, then we cannot trigger a background scan on
3555 * this channel. Return with a false.
3556 * If no, then trigger a background scan. Return with
3557 * a true.
3558 *
3559 *ASSUMPTIONS:
3560 *
3561 *NOTE:
3562 * This API is redundant if the existing API,
3563 * limTriggerBackgroundScan(), were to return a valid
3564 * response instead of returning void.
3565 * If possible, try to revisit this API
3566 *
3567 * @param pMac Pointer to Global MAC structure
3568 * @return eSIR_TRUE, if a background scan was attempted
3569 * eSIR_FALSE, if not
3570 */
3571tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3572{
3573 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003574
3575
3576
3577 //TBD-RAJESH HOW TO GET sessionEntry?????
3578 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3579
3580 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3581 return bScanTriggered;
3582
Jeff Johnsone7245742012-09-05 17:12:55 -07003583 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003584 {
3585 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3586 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3587
3588 // Determine the next scan channel
3589
3590 // Get background scan channel list from CFG
3591 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3592 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3593 (tANI_U8 *) bgScanChannelList,
3594 (tANI_U32 *) &len ))
3595 {
3596 // Ensure that we do not go off scanning on the same
3597 // channel on which the Quiet BSS was requested
3598 if( psessionEntry->currentOperChannel!=
3599 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3600 {
3601 // For now, try and attempt a background scan. It will
3602 // be ideal if this API actually returns a success or
3603 // failure instead of having a void return type
3604 limTriggerBackgroundScan( pMac );
3605
3606 bScanTriggered = eSIR_TRUE;
3607 }
3608 else
3609 {
3610 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003611 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 -07003612 }
3613 }
3614 else
3615 {
3616 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003617 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 -07003618 }
3619 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 return bScanTriggered;
3621}
3622
3623
3624/**
3625 * limGetHTCapability()
3626 *
3627 *FUNCTION:
3628 * A utility function that returns the "current HT capability state" for the HT
3629 * capability of interest (as requested in the API)
3630 *
3631 *LOGIC:
3632 * This routine will return with the "current" setting of a requested HT
3633 * capability. This state info could be retrieved from -
3634 * a) CFG (for static entries)
3635 * b) Run time info
3636 * - Dynamic state maintained by LIM
3637 * - Configured at radio init time by SME
3638 *
3639 *
3640 *ASSUMPTIONS:
3641 * NA
3642 *
3643 *NOTE:
3644 *
3645 * @param pMac Pointer to Global MAC structure
3646 * @param htCap The HT capability being queried
3647 * @return tANI_U8 The current state of the requested HT capability is returned in a
3648 * tANI_U8 variable
3649 */
3650
Jeff Johnson295189b2012-06-20 16:38:30 -07003651tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3652 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003653{
3654tANI_U8 retVal = 0;
3655tANI_U8 *ptr;
3656tANI_U32 cfgValue;
3657tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3658tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3659tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3660tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3661
3662 //
3663 // Determine which CFG to read from. Not ALL of the HT
3664 // related CFG's need to be read each time this API is
3665 // accessed
3666 //
3667 if( htCap >= eHT_ANTENNA_SELECTION &&
3668 htCap < eHT_SI_GRANULARITY )
3669 {
3670 // Get Antenna Seletion HT Capabilities
3671 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3672 cfgValue = 0;
3673 ptr = (tANI_U8 *) &macASCapabilityInfo;
3674 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3675 }
3676 else
3677 {
3678 if( htCap >= eHT_TX_BEAMFORMING &&
3679 htCap < eHT_ANTENNA_SELECTION )
3680 {
3681 // Get Transmit Beam Forming HT Capabilities
3682 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3683 cfgValue = 0;
3684 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3685 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3686 }
3687 else
3688 {
3689 if( htCap >= eHT_PCO &&
3690 htCap < eHT_TX_BEAMFORMING )
3691 {
3692 // Get Extended HT Capabilities
3693 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3694 cfgValue = 0;
3695 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3696 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3697 }
3698 else
3699 {
3700 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3701 {
3702 // Get HT Capabilities
3703 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3704 cfgValue = 0;
3705 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3706 // 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
3707 *ptr++ = cfgValue & 0xff;
3708 *ptr = (cfgValue >> 8) & 0xff;
3709 }
3710 }
3711 }
3712 }
3713
3714 switch( htCap )
3715 {
3716 case eHT_LSIG_TXOP_PROTECTION:
3717 retVal = pMac->lim.gHTLsigTXOPProtection;
3718 break;
3719
3720 case eHT_STBC_CONTROL_FRAME:
3721 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3722 break;
3723
3724 case eHT_PSMP:
3725 retVal = pMac->lim.gHTPSMPSupport;
3726 break;
3727
3728 case eHT_DSSS_CCK_MODE_40MHZ:
3729 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3730 break;
3731
3732 case eHT_MAX_AMSDU_LENGTH:
3733 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3734 break;
3735
3736 case eHT_DELAYED_BA:
3737 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3738 break;
3739
3740 case eHT_RX_STBC:
3741 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3742 break;
3743
3744 case eHT_TX_STBC:
3745 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3746 break;
3747
3748 case eHT_SHORT_GI_40MHZ:
3749 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3750 break;
3751
3752 case eHT_SHORT_GI_20MHZ:
3753 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3754 break;
3755
3756 case eHT_GREENFIELD:
3757 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3758 break;
3759
3760 case eHT_MIMO_POWER_SAVE:
3761 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3762 break;
3763
3764 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003765 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 break;
3767
3768 case eHT_ADVANCED_CODING:
3769 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3770 break;
3771
3772 case eHT_MAX_RX_AMPDU_FACTOR:
3773 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3774 break;
3775
3776 case eHT_MPDU_DENSITY:
3777 retVal = pMac->lim.gHTAMpduDensity;
3778 break;
3779
3780 case eHT_PCO:
3781 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3782 break;
3783
3784 case eHT_TRANSITION_TIME:
3785 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3786 break;
3787
3788 case eHT_MCS_FEEDBACK:
3789 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3790 break;
3791
3792 case eHT_TX_BEAMFORMING:
3793 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3794 break;
3795
3796 case eHT_ANTENNA_SELECTION:
3797 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3798 break;
3799
3800 case eHT_SI_GRANULARITY:
3801 retVal = pMac->lim.gHTServiceIntervalGranularity;
3802 break;
3803
3804 case eHT_CONTROLLED_ACCESS:
3805 retVal = pMac->lim.gHTControlledAccessOnly;
3806 break;
3807
3808 case eHT_RIFS_MODE:
3809 retVal = psessionEntry->beaconParams.fRIFSMode;
3810 break;
3811
3812 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003813 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 break;
3815
3816 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003817 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 break;
3819
3820 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3822 retVal = psessionEntry->htOperMode;
3823 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003824 retVal = pMac->lim.gHTOperMode;
3825 break;
3826
3827 case eHT_BASIC_STBC_MCS:
3828 retVal = pMac->lim.gHTSTBCBasicMCS;
3829 break;
3830
3831 case eHT_DUAL_CTS_PROTECTION:
3832 retVal = pMac->lim.gHTDualCTSProtection;
3833 break;
3834
3835 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3836 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3837 break;
3838
3839 case eHT_PCO_ACTIVE:
3840 retVal = pMac->lim.gHTPCOActive;
3841 break;
3842
3843 case eHT_PCO_PHASE:
3844 retVal = pMac->lim.gHTPCOPhase;
3845 break;
3846
3847 default:
3848 break;
3849 }
3850
3851 return retVal;
3852}
3853
Jeff Johnson295189b2012-06-20 16:38:30 -07003854void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3855{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303856 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 return;
3858}
3859
3860
3861
3862
3863/** -------------------------------------------------------------
3864\fn limEnable11aProtection
3865\brief based on config setting enables\disables 11a protection.
3866\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3867\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3868\param tpUpdateBeaconParams pBeaconParams
3869\return None
3870 -------------------------------------------------------------*/
3871tSirRetStatus
3872limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3873 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3874{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003875 if(NULL == psessionEntry)
3876 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003877 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003878 return eSIR_FAILURE;
3879 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 //overlapping protection configuration check.
3881 if(overlap)
3882 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 }
3884 else
3885 {
3886 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003887 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003888 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 {
3890 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003891 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 return eSIR_SUCCESS;
3893 }
3894 }
3895
3896 if (enable)
3897 {
3898 //If we are AP and HT capable, we need to set the HT OP mode
3899 //appropriately.
3900 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003901 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003902 {
3903 if(overlap)
3904 {
3905 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3906 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3907 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3908 {
3909 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3910 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3911 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3912 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3913 }
3914 }
3915 else
3916 {
3917 psessionEntry->gLim11aParams.protectionEnabled = true;
3918 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3919 {
3920 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003921 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3923 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3924
3925 }
3926 }
3927 }
3928
3929 //This part is common for staiton as well.
3930 if(false == psessionEntry->beaconParams.llaCoexist)
3931 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003932 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3934 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3935 }
3936 }
3937 else if (true == psessionEntry->beaconParams.llaCoexist)
3938 {
3939 //for AP role.
3940 //we need to take care of HT OP mode change if needed.
3941 //We need to take care of Overlap cases.
3942 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3943 {
3944 if(overlap)
3945 {
3946 //Overlap Legacy protection disabled.
3947 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3948
3949 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003950 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 {
3952 // no HT op mode change if any of the overlap protection enabled.
3953 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3954 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3955 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3956
3957 {
3958 //Check if there is a need to change HT OP mode.
3959 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3960 {
3961 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3962 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3963
3964 if(psessionEntry->gLimHt20Params.protectionEnabled)
3965 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3966 else
3967 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3968 }
3969 }
3970 }
3971 }
3972 else
3973 {
3974 //Disable protection from 11A stations.
3975 psessionEntry->gLim11aParams.protectionEnabled = false;
3976 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3977
3978 //Check if any other non-HT protection enabled.
3979 //Right now we are in HT OP Mixed mode.
3980 //Change HT op mode appropriately.
3981
3982 //Change HT OP mode to 01 if any overlap protection enabled
3983 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3984 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3985 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3986
3987 {
3988 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3991 }
3992 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3993 {
3994 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003995 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3997 }
3998 else
3999 {
4000 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004001 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4003 }
4004 }
4005 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4006 !psessionEntry->gLim11aParams.protectionEnabled)
4007 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004008 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4010 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4011 }
4012 }
4013 //for station role
4014 else
4015 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004016 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4018 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4019 }
4020 }
4021
4022 return eSIR_SUCCESS;
4023}
4024
4025/** -------------------------------------------------------------
4026\fn limEnable11gProtection
4027\brief based on config setting enables\disables 11g protection.
4028\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4029\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4030\param tpUpdateBeaconParams pBeaconParams
4031\return None
4032 -------------------------------------------------------------*/
4033
4034tSirRetStatus
4035limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4036 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4037{
4038
4039 //overlapping protection configuration check.
4040 if(overlap)
4041 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 }
4043 else
4044 {
4045 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4047 !psessionEntry->cfgProtection.fromllb)
4048 {
4049 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004050 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 return eSIR_SUCCESS;
4052 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 {
4054 if(!pMac->lim.cfgProtection.fromllb)
4055 {
4056 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004057 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004058 return eSIR_SUCCESS;
4059 }
4060 }
4061 }
4062
4063 if (enable)
4064 {
4065 //If we are AP and HT capable, we need to set the HT OP mode
4066 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4068 {
4069 if(overlap)
4070 {
4071 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004072 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004073 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 {
4075 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4076 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4077 {
4078 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4079 }
4080 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4081 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4082 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4083 //Not processing OBSS bit from other APs, as we are already taking care
4084 //of Protection from overlapping BSS based on erp IE or useProtection bit
4085 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4086 }
4087 }
4088 else
4089 {
4090 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004091 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004092 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 {
4094 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4095 {
4096 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4097 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4098 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4099 }
4100 }
4101 }
4102 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004103 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 {
4105 if(overlap)
4106 {
4107 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4108 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4109 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4110 {
4111 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4112 }
4113 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4114 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4115 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4116 //Not processing OBSS bit from other APs, as we are already taking care
4117 //of Protection from overlapping BSS based on erp IE or useProtection bit
4118 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4119 }
4120 else
4121 {
4122 psessionEntry->gLim11bParams.protectionEnabled = true;
4123 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4124 {
4125 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4126 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4127 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4128 }
4129 }
4130 }
4131
4132 //This part is common for staiton as well.
4133 if(false == psessionEntry->beaconParams.llbCoexist)
4134 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004135 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004136 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4137 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4138 }
4139 }
4140 else if (true == psessionEntry->beaconParams.llbCoexist)
4141 {
4142 //for AP role.
4143 //we need to take care of HT OP mode change if needed.
4144 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4146 {
4147 if(overlap)
4148 {
4149 //Overlap Legacy protection disabled.
4150 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4151
4152 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004153 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 {
4155 // no HT op mode change if any of the overlap protection enabled.
4156 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4157 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4158 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4159 {
4160 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004161 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 {
4163 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4164 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4165 if(psessionEntry->gLimHt20Params.protectionEnabled){
4166 //Commenting out beacuse of CR 258588 WFA cert
4167 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4168 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4169 }
4170 else
4171 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4172 }
4173 }
4174 }
4175 }
4176 else
4177 {
4178 //Disable protection from 11B stations.
4179 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004180 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 //Check if any other non-HT protection enabled.
4182 if(!psessionEntry->gLim11gParams.protectionEnabled)
4183 {
4184 //Right now we are in HT OP Mixed mode.
4185 //Change HT op mode appropriately.
4186 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4187
4188 //Change HT OP mode to 01 if any overlap protection enabled
4189 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4190 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4191 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4192 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4193 {
4194 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004195 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4197 }
4198 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4199 {
4200 //Commenting because of CR 258588 WFA cert
4201 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4202 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004203 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4205 }
4206 else
4207 {
4208 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4209 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4210 }
4211 }
4212 }
4213 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4214 !psessionEntry->gLim11bParams.protectionEnabled)
4215 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004216 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4218 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4219 }
4220 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 {
4222 if(overlap)
4223 {
4224 //Overlap Legacy protection disabled.
4225 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4226
4227 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004228 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 {
4230 // no HT op mode change if any of the overlap protection enabled.
4231 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4232 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4233 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4234
4235 {
4236 //Check if there is a need to change HT OP mode.
4237 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4238 {
4239 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4240 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4241 if(psessionEntry->gLimHt20Params.protectionEnabled)
4242 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4243 else
4244 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4245 }
4246 }
4247 }
4248 }
4249 else
4250 {
4251 //Disable protection from 11B stations.
4252 psessionEntry->gLim11bParams.protectionEnabled = false;
4253 //Check if any other non-HT protection enabled.
4254 if(!psessionEntry->gLim11gParams.protectionEnabled)
4255 {
4256 //Right now we are in HT OP Mixed mode.
4257 //Change HT op mode appropriately.
4258 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4259
4260 //Change HT OP mode to 01 if any overlap protection enabled
4261 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4262 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4263 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4264 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4265
4266 {
4267 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4268 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4269 }
4270 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4271 {
4272 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4273 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4274 }
4275 else
4276 {
4277 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4278 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4279 }
4280 }
4281 }
4282 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4283 !psessionEntry->gLim11bParams.protectionEnabled)
4284 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004285 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004286 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4287 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4288 }
4289 }
4290 //for station role
4291 else
4292 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004293 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004294 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4295 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4296 }
4297 }
4298 return eSIR_SUCCESS;
4299}
4300
4301/** -------------------------------------------------------------
4302\fn limEnableHtProtectionFrom11g
4303\brief based on cofig enables\disables protection from 11g.
4304\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4305\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4306\param tpUpdateBeaconParams pBeaconParams
4307\return None
4308 -------------------------------------------------------------*/
4309tSirRetStatus
4310limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4311 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4312{
Jeff Johnsone7245742012-09-05 17:12:55 -07004313 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4315
4316 //overlapping protection configuration check.
4317 if(overlap)
4318 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4320 {
4321 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004322 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004323 return eSIR_SUCCESS;
4324 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 {
4326 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004327 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 return eSIR_SUCCESS;
4329 }
4330 }
4331 else
4332 {
4333 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4335 !psessionEntry->cfgProtection.fromllg){
4336 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004337 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 return eSIR_SUCCESS;
4339 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004340 {
4341 if(!pMac->lim.cfgProtection.fromllg)
4342 {
4343 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004344 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004345 return eSIR_SUCCESS;
4346 }
4347 }
4348 }
4349 if (enable)
4350 {
4351 //If we are AP and HT capable, we need to set the HT OP mode
4352 //appropriately.
4353
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4355 {
4356 if(overlap)
4357 {
4358 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4359 //11g exists in overlap BSS.
4360 //need not to change the operating mode to overlap_legacy
4361 //if higher or same protection operating mode is enabled right now.
4362 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4363 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4364 {
4365 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4366 }
4367 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304368 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 }
4370 else
4371 {
4372 //11g is associated to an AP operating in 11n mode.
4373 //Change the HT operating mode to 'mixed mode'.
4374 psessionEntry->gLim11gParams.protectionEnabled = true;
4375 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4376 {
4377 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4378 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304379 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 }
4381 }
4382 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 {
4384 if(overlap)
4385 {
4386 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4387 //11g exists in overlap BSS.
4388 //need not to change the operating mode to overlap_legacy
4389 //if higher or same protection operating mode is enabled right now.
4390 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4391 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4392 {
4393 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4394 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4395 }
4396 }
4397 else
4398 {
4399 //11g is associated to an AP operating in 11n mode.
4400 //Change the HT operating mode to 'mixed mode'.
4401 psessionEntry->gLim11gParams.protectionEnabled = true;
4402 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4403 {
4404 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4405 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304406 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004407 }
4408 }
4409 }
4410
4411 //This part is common for staiton as well.
4412 if(false == psessionEntry->beaconParams.llgCoexist)
4413 {
4414 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4415 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4416 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004417 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4418 {
4419 // As operating mode changed after G station assoc some way to update beacon
4420 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4421 //pMac->sch.schObject.fBeaconChanged = 1;
4422 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4423 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004424 }
4425 else if (true == psessionEntry->beaconParams.llgCoexist)
4426 {
4427 //for AP role.
4428 //we need to take care of HT OP mode change if needed.
4429 //We need to take care of Overlap cases.
4430
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4432 {
4433 if(overlap)
4434 {
4435 //Overlap Legacy protection disabled.
4436 if (psessionEntry->gLim11gParams.numSta == 0)
4437 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4438
4439 // no HT op mode change if any of the overlap protection enabled.
4440 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4441 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4442 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4443 {
4444 //Check if there is a need to change HT OP mode.
4445 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4446 {
4447 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4448 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4449
4450 if(psessionEntry->gLimHt20Params.protectionEnabled){
4451 //Commenting because of CR 258588 WFA cert
4452 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4453 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4454 }
4455 else
4456 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4457 }
4458 }
4459 }
4460 else
4461 {
4462 //Disable protection from 11G stations.
4463 psessionEntry->gLim11gParams.protectionEnabled = false;
4464 //Check if any other non-HT protection enabled.
4465 if(!psessionEntry->gLim11bParams.protectionEnabled)
4466 {
4467
4468 //Right now we are in HT OP Mixed mode.
4469 //Change HT op mode appropriately.
4470 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4471
4472 //Change HT OP mode to 01 if any overlap protection enabled
4473 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4474 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4475 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4476 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4477
4478 {
4479 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4480 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4481 }
4482 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4483 {
4484 //Commenting because of CR 258588 WFA cert
4485 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4486 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4487 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4488 }
4489 else
4490 {
4491 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4492 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4493 }
4494 }
4495 }
4496 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4497 !psessionEntry->gLim11gParams.protectionEnabled)
4498 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004499 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4501 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4502 }
4503 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 {
4505 if(overlap)
4506 {
4507 //Overlap Legacy protection disabled.
4508 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4509
4510 // no HT op mode change if any of the overlap protection enabled.
4511 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4512 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4513 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4514 {
4515 //Check if there is a need to change HT OP mode.
4516 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4517 {
4518 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4519 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4520
4521 if(psessionEntry->gLimHt20Params.protectionEnabled)
4522 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4523 else
4524 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4525 }
4526 }
4527 }
4528 else
4529 {
4530 //Disable protection from 11G stations.
4531 psessionEntry->gLim11gParams.protectionEnabled = false;
4532 //Check if any other non-HT protection enabled.
4533 if(!psessionEntry->gLim11bParams.protectionEnabled)
4534 {
4535
4536 //Right now we are in HT OP Mixed mode.
4537 //Change HT op mode appropriately.
4538 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4539
4540 //Change HT OP mode to 01 if any overlap protection enabled
4541 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4542 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4543 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4544 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4545
4546 {
4547 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4548 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4549 }
4550 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4551 {
4552 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4553 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4554 }
4555 else
4556 {
4557 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4558 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4559 }
4560 }
4561 }
4562 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4563 !psessionEntry->gLim11gParams.protectionEnabled)
4564 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004565 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4567 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4568 }
4569 }
4570 //for station role
4571 else
4572 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004573 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004574 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4575 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4576 }
4577 }
4578 return eSIR_SUCCESS;
4579}
4580//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4581//This check will be done at the caller.
4582
4583/** -------------------------------------------------------------
4584\fn limEnableHtObssProtection
4585\brief based on cofig enables\disables obss protection.
4586\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4587\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4588\param tpUpdateBeaconParams pBeaconParams
4589\return None
4590 -------------------------------------------------------------*/
4591tSirRetStatus
4592limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4593 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4594{
4595
4596
Jeff Johnsone7245742012-09-05 17:12:55 -07004597 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 return eSIR_SUCCESS; // this protection is only for HT stations.
4599
4600 //overlapping protection configuration check.
4601 if(overlap)
4602 {
4603 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 }
4605 else
4606 {
4607 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4609 { //ToDo Update this field
4610 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004611 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 return eSIR_SUCCESS;
4613 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 {
4615 if(!pMac->lim.cfgProtection.obss)
4616 { //ToDo Update this field
4617 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004618 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 return eSIR_SUCCESS;
4620 }
4621 }
4622 }
4623
4624
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4626 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4627 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004628 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004629 psessionEntry->beaconParams.gHTObssMode = true;
4630 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4631
4632 }
4633 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4634 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004635 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004636 psessionEntry->beaconParams.gHTObssMode = false;
4637 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4638
4639 }
4640//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4641 if (!enable && !overlap)
4642 {
4643 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4644 }
4645 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 {
4647 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004649 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 psessionEntry->beaconParams.gHTObssMode = true;
4651 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4652
4653 }
4654 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4655 {
4656
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004657 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004658 psessionEntry->beaconParams.gHTObssMode = false;
4659 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4660
4661 }
4662 }
4663 return eSIR_SUCCESS;
4664}
4665/** -------------------------------------------------------------
4666\fn limEnableHT20Protection
4667\brief based on cofig enables\disables protection from Ht20.
4668\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4669\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4670\param tpUpdateBeaconParams pBeaconParams
4671\return None
4672 -------------------------------------------------------------*/
4673tSirRetStatus
4674limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4675 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4676{
Jeff Johnsone7245742012-09-05 17:12:55 -07004677 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 return eSIR_SUCCESS; // this protection is only for HT stations.
4679
4680 //overlapping protection configuration check.
4681 if(overlap)
4682 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004683 }
4684 else
4685 {
4686 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004687 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4688 !psessionEntry->cfgProtection.ht20)
4689 {
4690 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004691 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 return eSIR_SUCCESS;
4693 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004694 {
4695 if(!pMac->lim.cfgProtection.ht20)
4696 {
4697 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004698 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 return eSIR_SUCCESS;
4700 }
4701 }
4702 }
4703
4704 if (enable)
4705 {
4706 //If we are AP and HT capable, we need to set the HT OP mode
4707 //appropriately.
4708
Jeff Johnson295189b2012-06-20 16:38:30 -07004709 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4710 if(overlap)
4711 {
4712 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4713 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4714 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4715 {
4716 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4717 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4718 }
4719 }
4720 else
4721 {
4722 psessionEntry->gLimHt20Params.protectionEnabled = true;
4723 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4724 {
4725 //Commenting because of CR 258588 WFA cert
4726 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4727 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4728 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4729 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4730 }
4731 }
4732 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004733 {
4734 if(overlap)
4735 {
4736 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4737 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4738 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4739 {
4740 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4741 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4742 }
4743 }
4744 else
4745 {
4746 psessionEntry->gLimHt20Params.protectionEnabled = true;
4747 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4748 {
4749 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4750 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4751 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4752 }
4753 }
4754 }
4755
4756 //This part is common for staiton as well.
4757 if(false == psessionEntry->beaconParams.ht20Coexist)
4758 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004759 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004760 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4761 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4762 }
4763 }
4764 else if (true == psessionEntry->beaconParams.ht20Coexist)
4765 {
4766 //for AP role.
4767 //we need to take care of HT OP mode change if needed.
4768 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004769 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4770 if(overlap)
4771 {
4772 //Overlap Legacy protection disabled.
4773 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4774
4775 // no HT op mode change if any of the overlap protection enabled.
4776 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4777 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4778 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4779 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4780 {
4781
4782 //Check if there is a need to change HT OP mode.
4783 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4784 {
4785 if(psessionEntry->gLimHt20Params.protectionEnabled)
4786 {
4787 //Commented beacuse of CR 258588 for WFA Cert
4788 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4789 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4790 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4791 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4792 }
4793 else
4794 {
4795 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4796 }
4797 }
4798 }
4799 }
4800 else
4801 {
4802 //Disable protection from 11G stations.
4803 psessionEntry->gLimHt20Params.protectionEnabled = false;
4804
4805 //Change HT op mode appropriately.
4806 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4807 {
4808 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4809 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4810 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4811 }
4812 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004813 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4815 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4816 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 {
4818 if(overlap)
4819 {
4820 //Overlap Legacy protection disabled.
4821 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4822
4823 // no HT op mode change if any of the overlap protection enabled.
4824 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4825 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4826 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4827 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4828 {
4829
4830 //Check if there is a need to change HT OP mode.
4831 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4832 {
4833 if(psessionEntry->gLimHt20Params.protectionEnabled)
4834 {
4835 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4836 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4837 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4838 }
4839 else
4840 {
4841 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4842 }
4843 }
4844 }
4845 }
4846 else
4847 {
4848 //Disable protection from 11G stations.
4849 psessionEntry->gLimHt20Params.protectionEnabled = false;
4850
4851 //Change HT op mode appropriately.
4852 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4853 {
4854 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4855 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4856 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4857 }
4858 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004859 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4861 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4862 }
4863 //for station role
4864 else
4865 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004866 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4868 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4869 }
4870 }
4871
4872 return eSIR_SUCCESS;
4873}
4874
4875/** -------------------------------------------------------------
4876\fn limEnableHTNonGfProtection
4877\brief based on cofig enables\disables protection from NonGf.
4878\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4879\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4880\param tpUpdateBeaconParams pBeaconParams
4881\return None
4882 -------------------------------------------------------------*/
4883tSirRetStatus
4884limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4885 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4886{
Jeff Johnsone7245742012-09-05 17:12:55 -07004887 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 return eSIR_SUCCESS; // this protection is only for HT stations.
4889
4890 //overlapping protection configuration check.
4891 if(overlap)
4892 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004893 }
4894 else
4895 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 //normal protection config check
4897 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4898 !psessionEntry->cfgProtection.nonGf)
4899 {
4900 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004901 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 return eSIR_SUCCESS;
4903 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004904 {
4905 //normal protection config check
4906 if(!pMac->lim.cfgProtection.nonGf)
4907 {
4908 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004909 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004910 return eSIR_SUCCESS;
4911 }
4912 }
4913 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4915 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4916 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004917 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4919 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4920 }
4921 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004923 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4925 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4926 }
4927 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 {
4929 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4930 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004931 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4933 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4934 }
4935 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004937 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4939 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4940 }
4941 }
4942
4943 return eSIR_SUCCESS;
4944}
4945
4946/** -------------------------------------------------------------
4947\fn limEnableHTLsigTxopProtection
4948\brief based on cofig enables\disables LsigTxop protection.
4949\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4950\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4951\param tpUpdateBeaconParams pBeaconParams
4952\return None
4953 -------------------------------------------------------------*/
4954tSirRetStatus
4955limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4956 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4957{
Jeff Johnsone7245742012-09-05 17:12:55 -07004958 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 return eSIR_SUCCESS; // this protection is only for HT stations.
4960
4961 //overlapping protection configuration check.
4962 if(overlap)
4963 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 }
4965 else
4966 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 //normal protection config check
4968 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4969 !psessionEntry->cfgProtection.lsigTxop)
4970 {
4971 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004972 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 return eSIR_SUCCESS;
4974 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004975 {
4976 //normal protection config check
4977 if(!pMac->lim.cfgProtection.lsigTxop)
4978 {
4979 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004980 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 return eSIR_SUCCESS;
4982 }
4983 }
4984 }
4985
4986
Jeff Johnson295189b2012-06-20 16:38:30 -07004987 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4988 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4989 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004990 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4992 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4993 }
4994 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4995 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004996 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004997 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4998 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4999 }
5000 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005001 {
5002 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5003 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005004 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005005 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5006 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5007 }
5008 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5009 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005010 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005011 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5012 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5013 }
5014 }
5015 return eSIR_SUCCESS;
5016}
5017//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5018//This check will be done at the caller.
5019/** -------------------------------------------------------------
5020\fn limEnableHtRifsProtection
5021\brief based on cofig enables\disables Rifs protection.
5022\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5023\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5024\param tpUpdateBeaconParams pBeaconParams
5025\return None
5026 -------------------------------------------------------------*/
5027tSirRetStatus
5028limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5029 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5030{
Jeff Johnsone7245742012-09-05 17:12:55 -07005031 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005032 return eSIR_SUCCESS; // this protection is only for HT stations.
5033
5034
5035 //overlapping protection configuration check.
5036 if(overlap)
5037 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 }
5039 else
5040 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005041 //normal protection config check
5042 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5043 !psessionEntry->cfgProtection.rifs)
5044 {
5045 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005046 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 return eSIR_SUCCESS;
5048 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005049 {
5050 //normal protection config check
5051 if(!pMac->lim.cfgProtection.rifs)
5052 {
5053 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005054 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005055 return eSIR_SUCCESS;
5056 }
5057 }
5058 }
5059
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5061 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5062 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5063 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005064 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5066 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5067 }
5068 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5069 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5070 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005071 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5073 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5074 }
5075 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005076 {
5077 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5078 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5079 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005080 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5082 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5083 }
5084 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5085 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5086 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005087 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005088 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5089 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5090 }
5091 }
5092 return eSIR_SUCCESS;
5093}
5094
5095// ---------------------------------------------------------------------
5096/**
5097 * limEnableShortPreamble
5098 *
5099 * FUNCTION:
5100 * Enable/Disable short preamble
5101 *
5102 * LOGIC:
5103 *
5104 * ASSUMPTIONS:
5105 *
5106 * NOTE:
5107 *
5108 * @param enable Flag to enable/disable short preamble
5109 * @return None
5110 */
5111
5112tSirRetStatus
5113limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5114{
5115 tANI_U32 val;
5116
5117 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5118 {
5119 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005120 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005121 return eSIR_FAILURE;
5122 }
5123
5124 if (!val)
5125 return eSIR_SUCCESS;
5126
5127 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5128 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005129 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005130 return eSIR_FAILURE;
5131 }
5132
5133 if (!val) // 11G short preamble switching is disabled.
5134 return eSIR_SUCCESS;
5135
5136 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5137 {
5138 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5139 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005140 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 psessionEntry->beaconParams.fShortPreamble = true;
5142 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5143 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5144 }
5145 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5146 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005147 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005148 psessionEntry->beaconParams.fShortPreamble = false;
5149 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5150 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5151 }
5152 }
5153
5154 return eSIR_SUCCESS;
5155 }
5156
5157/**
5158 * limTxComplete
5159 *
5160 * Function:
5161 * This is LIM's very own "TX MGMT frame complete" completion routine.
5162 *
5163 * Logic:
5164 * LIM wants to send a MGMT frame (broadcast or unicast)
5165 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5166 * LIM transmits the MGMT frame using the API:
5167 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5168 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5169 * HDD, if it determines that a TX completion routine (in this case
5170 * limTxComplete) has been provided, will invoke this callback
5171 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5172 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5173 *
5174 * Assumptions:
5175 * Presently, this is ONLY being used for MGMT frames/packets
5176 * TODO:
5177 * Would it do good for LIM to have some sort of "signature" validation to
5178 * ensure that the pData argument passed in was a buffer that was actually
5179 * allocated by LIM and/or is not corrupted?
5180 *
5181 * Note: FIXME and TODO
5182 * Looks like palPktFree() is interested in pPacket. But, when this completion
5183 * routine is called, only pData is made available to LIM!!
5184 *
5185 * @param void A pointer to pData. Shouldn't it be pPacket?!
5186 *
5187 * @return none
5188 */
5189void limTxComplete( tHalHandle hHal, void *pData )
5190{
5191 tpAniSirGlobal pMac;
5192 pMac = (tpAniSirGlobal)hHal;
5193
5194#ifdef FIXME_PRIMA
5195 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5196#ifdef TRACE_RECORD
5197 {
5198 tpSirMacMgmtHdr mHdr;
5199 v_U8_t *pRxBd;
5200 vos_pkt_t *pVosPkt;
5201 VOS_STATUS vosStatus;
5202
5203
5204
5205 pVosPkt = (vos_pkt_t *)pData;
5206 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5207
5208 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5209 {
5210 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005211
5212 }
5213 }
5214#endif
5215#endif
5216
5217 palPktFree( pMac->hHdd,
5218 HAL_TXRX_FRM_802_11_MGMT,
5219 (void *) NULL, // this is ignored and will likely be removed from this API
5220 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5221}
5222
5223/**
5224 * \brief This function updates lim global structure, if CB parameters in the BSS
5225 * have changed, and sends an indication to HAL also with the
5226 * updated HT Parameters.
5227 * This function does not detect the change in the primary channel, that is done as part
5228 * of channel Swtich IE processing.
5229 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5230 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5231 *
5232 *
5233 * \param pMac Pointer to global MAC structure
5234 *
5235 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5236 * Probe Response
5237 *
5238 * \param bssIdx BSS Index of the Bss to which Station is associated.
5239 *
5240 *
5241 */
5242
5243void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5244 tDot11fIEHTInfo *pHTInfo,
5245 tANI_U8 bssIdx,
5246 tpPESession psessionEntry)
5247{
Jeff Johnsone7245742012-09-05 17:12:55 -07005248 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005249#if !defined WLAN_FEATURE_VOWIFI
5250 tANI_U32 localPwrConstraint;
5251#endif
5252
5253 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005255 return;
5256
Abhishek Singhe3beee22017-07-31 15:35:40 +05305257 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5258 psessionEntry->force_24ghz_in_ht20) {
5259 limLog(pMac, LOG1,
5260 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5261 return;
5262 }
5263
Jeff Johnson295189b2012-06-20 16:38:30 -07005264#if !defined WLAN_FEATURE_VOWIFI
5265 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005266 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005267 return;
5268 }
5269#endif
5270
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305271 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5272 {
5273 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5274 return;
5275 }
5276
Mihir Shetebc160b72014-08-22 14:10:39 +05305277 /*
5278 * Do not try to switch channel if RoC is in progress. RoC code path uses
5279 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5280 * has started listening on the channel requested as part of RoC, if we set
5281 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5282 * upper layers will think that the channel change is not successful and the
5283 * RoC from the upper layer perspective will never end...
5284 */
5285 if (pMac->lim.gpLimRemainOnChanReq)
5286 {
5287 limLog( pMac, LOGE, FL( "RoC is in progress"));
5288 return;
5289 }
5290
Jeff Johnsone7245742012-09-05 17:12:55 -07005291 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5292 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005293 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005294 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5295 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5296 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5297 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005298
5299 // Notify HAL
5300 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005301 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005302 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005303 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005304 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005305 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005306 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5307 pMac->lim.gpchangeChannelCallback = NULL;
5308 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005309
5310#if defined WLAN_FEATURE_VOWIFI
5311 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5312 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5313#else
5314 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5315 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5316#endif
5317
5318 //In case of IBSS, if STA should update HT Info IE in its beacons.
5319 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5320 {
5321 schSetFixedBeaconFields(pMac,psessionEntry);
5322 }
5323
5324 }
5325} // End limUpdateStaRunTimeHTParams.
5326
5327/**
5328 * \brief This function updates the lim global structure, if any of the
5329 * HT Capabilities have changed.
5330 *
5331 *
5332 * \param pMac Pointer to Global MAC structure
5333 *
5334 * \param pHTCapability Pointer to HT Capability Information Element
5335 * obtained from a Beacon or Probe Response
5336 *
5337 *
5338 *
5339 */
5340
5341void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5342 tDot11fIEHTCaps *pHTCaps )
5343{
5344
5345 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5346 {
5347 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5348 // Send change notification to HAL
5349 }
5350
5351 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5352 {
5353 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5354 // Send change notification to HAL
5355 }
5356
5357 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5358 {
5359 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5360 // Send change notification to HAL
5361 }
5362
5363
5364} // End limUpdateStaRunTimeHTCapability.
5365
5366/**
5367 * \brief This function updates lim global structure, if any of the HT
5368 * Info Parameters have changed.
5369 *
5370 *
5371 * \param pMac Pointer to the global MAC structure
5372 *
5373 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5374 * Probe Response
5375 *
5376 *
5377 */
5378
5379void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305380 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005381{
Jeff Johnsone7245742012-09-05 17:12:55 -07005382 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005383 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005384 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005385 // Send change notification to HAL
5386 }
5387
5388 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5389 {
5390 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5391 // Send change notification to HAL
5392 }
5393
5394 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5395 {
5396 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5397 // Send change notification to HAL
5398 }
5399
5400 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5401 {
5402 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5403 // Send change notification to HAL
5404 }
5405
5406 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5407 {
5408 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5409 }
5410
5411 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5412 {
5413 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5414 // Send change notification to HAL
5415 }
5416
5417 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5418 {
5419 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5420 // Send change notification to HAL
5421 }
5422
5423 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5424 {
5425 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5426 // Send change notification to HAL
5427 }
5428
5429 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5430 {
5431 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5432 // Send change notification to HAL
5433 }
5434
5435 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5436 {
5437 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5438 // Send change notification to HAL
5439 }
5440
5441 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5442 {
5443 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5444 // Send change notification to HAL
5445 }
5446
5447} // End limUpdateStaRunTimeHTInfo.
5448
5449
5450/** -------------------------------------------------------------
5451\fn limProcessHalIndMessages
5452\brief callback function for HAL indication
5453\param tpAniSirGlobal pMac
5454\param tANI_U32 mesgId
5455\param void *mesgParam
5456\return tSirRetStatu - status
5457 -------------------------------------------------------------*/
5458
5459tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5460{
5461 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5462 tSirMsgQ msg;
5463
5464 switch(msgId)
5465 {
5466 case SIR_LIM_DEL_TS_IND:
5467 case SIR_LIM_ADD_BA_IND:
5468 case SIR_LIM_DEL_BA_ALL_IND:
5469 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5470 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305471 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005472 msg.type = (tANI_U16) msgId;
5473 msg.bodyptr = msgParam;
5474 msg.bodyval = 0;
5475 break;
5476
5477 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305478 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005479 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 return eSIR_FAILURE;
5481 }
5482
5483 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5484 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305485 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005486 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5487 return eSIR_FAILURE;
5488 }
5489 return eSIR_SUCCESS;
5490}
5491
5492/** -------------------------------------------------------------
5493\fn limValidateDeltsReq
5494\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5495\param tpAniSirGlobal pMac
5496\param tpSirDeltsReq pDeltsReq
5497\param tSirMacAddr peerMacAddr
5498\return eSirRetStatus - status
5499 -------------------------------------------------------------*/
5500
5501tSirRetStatus
5502limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5503{
5504 tpDphHashNode pSta;
5505 tANI_U8 tsStatus;
5506 tSirMacTSInfo *tsinfo;
5507 tANI_U32 i;
5508 tANI_U8 tspecIdx;
5509 /* if sta
5510 * - verify assoc state
5511 * - del tspec locally
5512 * if ap,
5513 * - verify sta is in assoc state
5514 * - del sta tspec locally
5515 */
5516 if(pDeltsReq == NULL)
5517 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005518 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 return eSIR_FAILURE;
5520 }
5521
5522 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5523 {
5524 tANI_U32 val;
5525
5526 // station always talks to the AP
5527 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5528
5529 val = sizeof(tSirMacAddr);
5530 #if 0
5531 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5532 {
5533 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005534 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005535 return eSIR_FAILURE;
5536 }
5537 #endif// TO SUPPORT BT-AMP
5538 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5539
5540 }
5541 else
5542 {
5543 tANI_U16 assocId;
5544 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5545
5546 assocId = pDeltsReq->aid;
5547 if (assocId != 0)
5548 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5549 else
5550 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5551
5552 if (pSta != NULL)
5553 // TBD: check sta assoc state as well
5554 for (i =0; i < sizeof(tSirMacAddr); i++)
5555 macaddr[i] = pSta->staAddr[i];
5556 }
5557
5558 if (pSta == NULL)
5559 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005560 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005561 return eSIR_FAILURE;
5562 }
5563
5564 if ((! pSta->valid) ||
5565 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5566 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005567 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005568 return eSIR_FAILURE;
5569 }
5570
5571 pDeltsReq->req.wsmTspecPresent = 0;
5572 pDeltsReq->req.wmeTspecPresent = 0;
5573 pDeltsReq->req.lleTspecPresent = 0;
5574
5575 if ((pSta->wsmEnabled) &&
5576 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5577 pDeltsReq->req.wsmTspecPresent = 1;
5578 else if (pSta->wmeEnabled)
5579 pDeltsReq->req.wmeTspecPresent = 1;
5580 else if (pSta->lleEnabled)
5581 pDeltsReq->req.lleTspecPresent = 1;
5582 else
5583 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005584 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 return eSIR_FAILURE;
5586 }
5587
5588 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5589 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305590 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005591 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005592 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305593 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005594
5595 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005596
5597 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5598 != eSIR_SUCCESS)
5599 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005600 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005601 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5602 return eSIR_FAILURE;
5603 }
5604 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5605 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5606 {
5607 //edca only now.
5608 }
5609 else
5610 {
5611 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5612 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5613 {
5614 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305615 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5616 pSta->staIndex,
5617 tspecIdx,
5618 pDeltsReq->req,
5619 psessionEntry->peSessionId,
5620 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005622 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005623 tsinfo->traffic.userPrio);
5624 return eSIR_FAILURE;
5625 }
5626 }
5627 }
5628 return eSIR_SUCCESS;
5629}
5630
5631/** -------------------------------------------------------------
5632\fn limRegisterHalIndCallBack
5633\brief registers callback function to HAL for any indication.
5634\param tpAniSirGlobal pMac
5635\return none.
5636 -------------------------------------------------------------*/
5637void
5638limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5639{
5640 tSirMsgQ msg;
5641 tpHalIndCB pHalCB;
5642
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305643 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5644 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005645 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305646 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 return;
5648 }
5649
5650 pHalCB->pHalIndCB = limProcessHalIndMessages;
5651
5652 msg.type = WDA_REGISTER_PE_CALLBACK;
5653 msg.bodyptr = pHalCB;
5654 msg.bodyval = 0;
5655
Jeff Johnsone7245742012-09-05 17:12:55 -07005656 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005657 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5658 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305659 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005660 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 }
5662
5663 return;
5664}
5665
5666
5667/** -------------------------------------------------------------
5668\fn limProcessAddBaInd
5669
5670\brief handles the BA activity check timeout indication coming from HAL.
5671 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5672\param tpAniSirGlobal pMac
5673\param tSirMsgQ limMsg
5674\return None
5675-------------------------------------------------------------*/
5676void
5677limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5678{
5679 tANI_U8 i;
5680 tANI_U8 tid;
5681 tANI_U16 assocId;
5682 tpDphHashNode pSta;
5683 tpAddBaCandidate pBaCandidate;
5684 tANI_U32 baCandidateCnt;
5685 tpBaActivityInd pBaActivityInd;
5686 tpPESession psessionEntry;
5687 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005688#ifdef FEATURE_WLAN_TDLS
5689 boolean htCapable = FALSE;
5690#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005691
5692
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005693 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005694 return;
5695
5696 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5697 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5698
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005699 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005700 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005701 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305702 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005703 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005704 return;
5705 }
5706
5707 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005708#ifdef FEATURE_WLAN_TDLS
5709 if ((baCandidateCnt > pMac->lim.maxStation))
5710#else
5711 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5712#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305714 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005715 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005716 return;
5717 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005718
5719#ifdef FEATURE_WLAN_TDLS
5720 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5721 //AP capability
5722 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5723
5724 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5725 {
5726 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5727 if ((NULL == pSta) || (!pSta->valid))
5728 continue;
5729
5730 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5731 htCapable = pSta->mlmStaContext.htCapability;
5732 else
5733 htCapable = psessionEntry->htCapability;
5734
5735 if (htCapable)
5736 break;
5737 }
5738 if (!htCapable)
5739 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305740 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005741 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005742 return;
5743 }
5744#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005745
5746 //delete the complete dialoguetoken linked list
5747 limDeleteDialogueTokenList(pMac);
5748 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5749
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005750 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005751 {
5752 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005753 if ((NULL == pSta) || (!pSta->valid))
5754 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005755
5756 for (tid=0; tid<STACFG_MAX_TC; tid++)
5757 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005758 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005759 (pBaCandidate->baInfo[tid].fBaEnable))
5760 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305761 limLog(pMac, LOG1,
5762 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5763 pSta->staIndex, tid,
5764 pBaCandidate->baInfo[tid].startingSeqNum);
5765 limPostMlmAddBAReq(pMac, pSta, tid,
5766 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005767 }
5768 }
5769 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305770 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005771 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005772 return;
5773}
5774
5775
5776/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005777\fn limDeleteBASessions
5778\brief Deletes all the exisitng BA sessions for given session
5779 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005780\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005781\param tpPESession pSessionEntry
5782\param tANI_U32 baDirection
5783\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005784-------------------------------------------------------------*/
5785
5786void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005787limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305788 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005789{
5790 tANI_U32 i;
5791 tANI_U8 tid;
5792 tpDphHashNode pSta;
5793
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005794 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005795 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005796 limLog(pMac, LOGE, FL("Session does not exist"));
5797 }
5798 else
5799 {
5800 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005801 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005802 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5803 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5804 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5805 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005806 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005807 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005808 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005809 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5810 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005811 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005812 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5813 (baDirection & BA_INITIATOR))
5814 {
5815 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305816 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005817 pSessionEntry);
5818 }
5819 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5820 (baDirection & BA_RECIPIENT))
5821 {
5822 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305823 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005824 pSessionEntry);
5825 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005826 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005827 }
5828 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005829 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5830 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5831 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005832 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005833 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5834 &pSessionEntry->dph.dphHashTable);
5835 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005836 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005837 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5838 (baDirection & BA_INITIATOR))
5839 {
5840 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305841 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005842 pSessionEntry);
5843 }
5844 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5845 (baDirection & BA_RECIPIENT))
5846 {
5847 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305848 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005849 pSessionEntry);
5850 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005851 }
5852 }
5853 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005854 }
5855}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005856
5857/** -------------------------------------------------------------
5858\fn limDelAllBASessions
5859\brief Deletes all the exisitng BA sessions.
5860\param tpAniSirGlobal pMac
5861\return None
5862-------------------------------------------------------------*/
5863
5864void limDelAllBASessions(tpAniSirGlobal pMac)
5865{
5866 tANI_U32 i;
5867 tpPESession pSessionEntry;
5868
5869 for (i = 0; i < pMac->lim.maxBssId; i++)
5870 {
5871 pSessionEntry = peFindSessionBySessionId(pMac, i);
5872 if (pSessionEntry)
5873 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305874 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5875 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005876 }
5877 }
5878}
5879
5880/** -------------------------------------------------------------
5881\fn limDelAllBASessionsBtc
5882\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5883 band.
5884\param tpAniSirGlobal pMac
5885\return None
5886-------------------------------------------------------------*/
5887
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005888void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005889{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005890 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005891 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005892 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5893 &sessionId);
5894 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005895 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005896 PELOGW(limLog(pMac, LOGW,
5897 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305898 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305899 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005900 }
5901}
5902
Jeff Johnson295189b2012-06-20 16:38:30 -07005903/** -------------------------------------------------------------
5904\fn limProcessDelTsInd
5905\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5906 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5907\param tpAniSirGlobal pMac
5908\param tSirMsgQ limMsg
5909\return None
5910-------------------------------------------------------------*/
5911void
5912limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5913{
5914 tpDphHashNode pSta;
5915 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5916 tpSirDeltsReq pDelTsReq = NULL;
5917 tSirMacAddr peerMacAddr;
5918 tpSirDeltsReqInfo pDelTsReqInfo;
5919 tpLimTspecInfo pTspecInfo;
5920 tpPESession psessionEntry;
5921 tANI_U8 sessionId;
5922
5923if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5924 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005925 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305926 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005927 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005928 return;
5929 }
5930
5931 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5932 if(pTspecInfo->inuse == false)
5933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005934 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005935 goto error1;
5936 }
5937
5938 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5939 if(pSta == NULL)
5940 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005941 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 pTspecInfo->assocId);
5943 goto error1;
5944 }
5945
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305946 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5947 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005948 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305949 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005950 goto error1;
5951 }
5952
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305953 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005954
5955 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305956 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005957 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305958 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005959
5960
5961 //validate the req
5962 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5963 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005964 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 goto error2;
5966 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305967 limLog(pMac, LOG1, "Sent DELTS request to station with "
5968 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5969 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005970
5971 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5972 psessionEntry);
5973
5974 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305975 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5976 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005977 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305978 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005979 goto error3;
5980 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305981 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005982
5983 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305984 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005985 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305986 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005987
5988 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5989
5990error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305991 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005992error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305993 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005994error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305995 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005996 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005997 return;
5998}
5999
6000/**
6001 * \brief Setup an A-MPDU/BA session
6002 *
6003 * \sa limPostMlmAddBAReq
6004 *
6005 * \param pMac The global tpAniSirGlobal object
6006 *
6007 * \param pStaDs DPH Hash Node object of peer STA
6008 *
6009 * \param tid TID for which a BA is being setup.
6010 * If this is set to 0xFFFF, then we retrieve
6011 * the default TID from the CFG
6012 *
6013 * \return eSIR_SUCCESS if setup completes successfully
6014 * eSIR_FAILURE is some problem is encountered
6015 */
6016tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6017 tpDphHashNode pStaDs,
6018 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6019{
6020 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006021 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 tpDialogueToken dialogueTokenNode;
6023 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006024
Jeff Johnson295189b2012-06-20 16:38:30 -07006025 // Check if the peer is a 11n capable STA
6026 // FIXME - Need a 11n peer indication in DPH.
6027 // For now, using the taurusPeer attribute
6028 //if( 0 == pStaDs->taurusPeer == )
6029 //return eSIR_SUCCESS;
6030
6031 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306032 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6033 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306035 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006036 status = eSIR_MEM_ALLOC_FAILED;
6037 goto returnFailure;
6038 }
6039
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306040 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006041
6042 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306043 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006044 pMlmAddBAReq->peerMacAddr,
6045 pStaDs->staAddr,
6046 sizeof( tSirMacAddr ));
6047
6048 // Update the TID
6049 pMlmAddBAReq->baTID = tid;
6050
6051 // Determine the supported BA policy of local STA
6052 // for the TID of interest
6053 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6054
6055 // BA Buffer Size
6056 // Requesting the ADDBA recipient to populate the size.
6057 // If ADDBA is accepted, a non-zero buffer size should
6058 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306059 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6060 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6061 {
6062 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6063 causing very low throughput in HT40 case */
6064 limLog( pMac, LOGW,
6065 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6066 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6067 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306068 else if (pMac->miracastVendorConfig)
6069 {
6070 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6071 {
6072 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6073 status = eSIR_FAILURE;
6074 goto returnFailure;
6075 }
6076
6077 pMlmAddBAReq->baBufferSize = val;
6078 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306079 else
6080 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006081
6082 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306083 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 -07006084 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6085 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306086 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006087
6088 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006089 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006090 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006091 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006092 status = eSIR_FAILURE;
6093 goto returnFailure;
6094 }
6095 pMlmAddBAReq->baTimeout = val; // In TU's
6096
6097 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006098 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6100 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6101
6102 // BA Starting Sequence Number
6103 pMlmAddBAReq->baSSN = startingSeqNum;
6104
6105 /* Update PE session Id*/
6106 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6107
6108 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6109
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006110 dialogueTokenNode = limAssignDialogueToken(pMac);
6111 if (NULL == dialogueTokenNode)
6112 {
6113 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6114 status = eSIR_FAILURE;
6115 goto returnFailure;
6116 }
6117
Jeff Johnson295189b2012-06-20 16:38:30 -07006118 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006119 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006120 dialogueTokenNode->assocId = pStaDs->assocId;
6121 dialogueTokenNode->tid = tid;
6122 // Send ADDBA Req to MLME
6123 limPostMlmMessage( pMac,
6124 LIM_MLM_ADDBA_REQ,
6125 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006126 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006127
6128returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306129 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006130 return status;
6131}
6132
6133/**
6134 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6135 * will then send an ADDBA Rsp to peer MAC entity
6136 * with the appropriate ADDBA status code
6137 *
6138 * \sa limPostMlmAddBARsp
6139 *
6140 * \param pMac The global tpAniSirGlobal object
6141 *
6142 * \param peerMacAddr MAC address of peer entity that will
6143 * be the recipient of this ADDBA Rsp
6144 *
6145 * \param baStatusCode ADDBA Rsp status code
6146 *
6147 * \param baDialogToken ADDBA Rsp dialog token
6148 *
6149 * \param baTID TID of interest
6150 *
6151 * \param baPolicy The BA policy
6152 *
6153 * \param baBufferSize The BA buffer size
6154 *
6155 * \param baTimeout BA timeout in TU's
6156 *
6157 * \return eSIR_SUCCESS if setup completes successfully
6158 * eSIR_FAILURE is some problem is encountered
6159 */
6160tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6161 tSirMacAddr peerMacAddr,
6162 tSirMacStatusCodes baStatusCode,
6163 tANI_U8 baDialogToken,
6164 tANI_U8 baTID,
6165 tANI_U8 baPolicy,
6166 tANI_U16 baBufferSize,
6167 tANI_U16 baTimeout,
6168 tpPESession psessionEntry)
6169{
6170tSirRetStatus status = eSIR_SUCCESS;
6171tpLimMlmAddBARsp pMlmAddBARsp;
6172
6173 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306174 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6175 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 {
6177 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306178 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006179 status );
6180
6181 status = eSIR_MEM_ALLOC_FAILED;
6182 goto returnFailure;
6183 }
6184
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306185 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006186
6187 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306188 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 pMlmAddBARsp->peerMacAddr,
6190 peerMacAddr,
6191 sizeof( tSirMacAddr ));
6192
6193 pMlmAddBARsp->baDialogToken = baDialogToken;
6194 pMlmAddBARsp->addBAResultCode = baStatusCode;
6195 pMlmAddBARsp->baTID = baTID;
6196 pMlmAddBARsp->baPolicy = baPolicy;
6197 pMlmAddBARsp->baBufferSize = baBufferSize;
6198 pMlmAddBARsp->baTimeout = baTimeout;
6199
6200 /* UPdate PE session ID*/
6201 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6202
6203 // Send ADDBA Rsp to MLME
6204 limPostMlmMessage( pMac,
6205 LIM_MLM_ADDBA_RSP,
6206 (tANI_U32 *) pMlmAddBARsp );
6207
6208returnFailure:
6209
6210 return status;
6211}
6212
6213/**
6214 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6215 * will then send an DELBA Ind to peer MAC entity
6216 * with the appropriate DELBA status code
6217 *
6218 * \sa limPostMlmDelBAReq
6219 *
6220 * \param pMac The global tpAniSirGlobal object
6221 *
6222 * \param pSta DPH Hash Node object of peer MAC entity
6223 * for which the BA session is being deleted
6224 *
6225 * \param baDirection DELBA direction
6226 *
6227 * \param baTID TID for which the BA session is being deleted
6228 *
6229 * \param baReasonCode DELBA Req reason code
6230 *
6231 * \return eSIR_SUCCESS if setup completes successfully
6232 * eSIR_FAILURE is some problem is encountered
6233 */
6234tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6235 tpDphHashNode pSta,
6236 tANI_U8 baDirection,
6237 tANI_U8 baTID,
6238 tSirMacReasonCodes baReasonCode,
6239 tpPESession psessionEntry)
6240{
6241tSirRetStatus status = eSIR_SUCCESS;
6242tpLimMlmDelBAReq pMlmDelBAReq;
6243tLimBAState curBaState;
6244
6245if(NULL == pSta)
6246 return eSIR_FAILURE;
6247
6248LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6249
6250 // Need to validate the current BA State.
6251 if( eLIM_BA_STATE_IDLE != curBaState)
6252 {
6253 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006254 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006255 baTID,
6256 curBaState);
6257
6258 status = eSIR_FAILURE;
6259 goto returnFailure;
6260 }
6261
6262 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306263 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6264 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006265 {
6266 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306267 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006268 status );
6269
6270 status = eSIR_MEM_ALLOC_FAILED;
6271 goto returnFailure;
6272 }
6273
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306274 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006275
6276 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306277 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006278 pMlmDelBAReq->peerMacAddr,
6279 pSta->staAddr,
6280 sizeof( tSirMacAddr ));
6281
6282 pMlmDelBAReq->baDirection = baDirection;
6283 pMlmDelBAReq->baTID = baTID;
6284 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6285
6286 /* Update PE session ID*/
6287 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6288
6289 //we don't have valid BA session for the given direction.
6290 // HDD wants to get the BA session deleted on PEER in this case.
6291 // in this case we just need to send DelBA to the peer.
6292 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6293 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6294 {
6295 // Send DELBA Ind over the air
6296 if( eSIR_SUCCESS !=
6297 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6298 status = eSIR_FAILURE;
6299
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306300 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006301 return status;
6302 }
6303
6304
6305 // Update the BA state in STA
6306 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6307
6308 // Send DELBA Req to MLME
6309 limPostMlmMessage( pMac,
6310 LIM_MLM_DELBA_REQ,
6311 (tANI_U32 *) pMlmDelBAReq );
6312
6313returnFailure:
6314
6315 return status;
6316}
6317
6318/**
6319 * \brief Send WDA_ADDBA_REQ to HAL, in order
6320 * to setup a new BA session with a peer
6321 *
6322 * \sa limPostMsgAddBAReq
6323 *
6324 * \param pMac The global tpAniSirGlobal object
6325 *
6326 * \param pSta Runtime, STA-related configuration cached
6327 * in the HashNode object
6328 *
6329 * \param baDialogToken The Action Frame dialog token
6330 *
6331 * \param baTID TID for which the BA session is being setup
6332 *
6333 * \param baPolicy BA Policy
6334 *
6335 * \param baBufferSize The requested BA buffer size
6336 *
6337 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6338 *
6339 * \param baSSN Starting Sequence Number for this BA session
6340 *
6341 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6342 *
6343 * \return none
6344 *
6345 */
6346tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6347 tpDphHashNode pSta,
6348 tANI_U8 baDialogToken,
6349 tANI_U8 baTID,
6350 tANI_U8 baPolicy,
6351 tANI_U16 baBufferSize,
6352 tANI_U16 baTimeout,
6353 tANI_U16 baSSN,
6354 tANI_U8 baDirection,
6355 tpPESession psessionEntry)
6356{
6357tpAddBAParams pAddBAParams = NULL;
6358tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006359tSirMsgQ msgQ;
6360
6361#ifdef WLAN_SOFTAP_VSTA_FEATURE
6362 // we can only do BA on "hard" STAs
6363 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6364 {
6365 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306366 limLog( pMac, LOGE,
6367 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006368 goto returnFailure;
6369 }
6370#endif //WLAN_SOFTAP_VSTA_FEATURE
6371
6372 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306373 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6374 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006375 {
6376 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306377 FL("AllocateMemory failed")
6378 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006379
6380 retCode = eSIR_MEM_ALLOC_FAILED;
6381 goto returnFailure;
6382 }
6383
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306384 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006385
6386 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306387 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 (void *) pAddBAParams->peerMacAddr,
6389 (void *) pSta->staAddr,
6390 sizeof( tSirMacAddr ));
6391
6392 // Populate the REQ parameters
6393 pAddBAParams->staIdx = pSta->staIndex;
6394 pAddBAParams->baDialogToken = baDialogToken;
6395 pAddBAParams->baTID = baTID;
6396 pAddBAParams->baPolicy = baPolicy;
6397 pAddBAParams->baBufferSize = baBufferSize;
6398 pAddBAParams->baTimeout = baTimeout;
6399 pAddBAParams->baSSN = baSSN;
6400 pAddBAParams->baDirection = baDirection;
6401 pAddBAParams->respReqd = 1;
6402
6403 /* UPdate PE session ID */
6404 pAddBAParams->sessionId = psessionEntry->peSessionId;
6405
6406 // Post WDA_ADDBA_REQ to HAL.
6407 msgQ.type = WDA_ADDBA_REQ;
6408 //
6409 // FIXME_AMPDU
6410 // A global counter (dialog token) is required to keep track of
6411 // all PE <-> HAL communication(s)
6412 //
6413 msgQ.reserved = 0;
6414 msgQ.bodyptr = pAddBAParams;
6415 msgQ.bodyval = 0;
6416
6417 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306418 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6419 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6420 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6421 pAddBAParams->baTimeout, pAddBAParams->baTID,
6422 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6423 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006424
6425 //defer any other message until we get response back.
6426 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6427
Jeff Johnsone7245742012-09-05 17:12:55 -07006428 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006429#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6430 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6431#endif //FEATURE_WLAN_DIAG_SUPPORT
6432
6433 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6434 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006435 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006436 retCode );
6437 else
6438 return retCode;
6439
6440returnFailure:
6441
6442 // Clean-up...
6443 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306444 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006445
6446 return retCode;
6447
6448}
6449
6450/**
6451 * \brief Send WDA_DELBA_IND to HAL, in order
6452 * to delete an existing BA session with peer
6453 *
6454 * \sa limPostMsgDelBAInd
6455 *
6456 * \param pMac The global tpAniSirGlobal object
6457 *
6458 * \param pSta Runtime, STA-related configuration cached
6459 * in the HashNode object
6460 *
6461 * \param baTID TID for which the BA session is being setup
6462 *
6463 * \param baDirection Identifies whether the DELBA Ind was
6464 * sent by the BA initiator or recipient
6465 *
6466 * \return none
6467 *
6468 */
6469tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6470 tpDphHashNode pSta,
6471 tANI_U8 baTID,
6472 tANI_U8 baDirection,
6473 tpPESession psessionEntry)
6474{
6475tpDelBAParams pDelBAParams = NULL;
6476tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006477tSirMsgQ msgQ;
6478
6479 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306480 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6481 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006482 {
6483 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306484 FL("AllocateMemory failed")
6485 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006486
6487 retCode = eSIR_MEM_ALLOC_FAILED;
6488 goto returnFailure;
6489 }
6490
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306491 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006492
6493 // Populate the REQ parameters
6494 pDelBAParams->staIdx = pSta->staIndex;
6495 pDelBAParams->baTID = baTID;
6496 pDelBAParams->baDirection = baDirection;
6497
6498 /* Update PE session ID */
6499
6500
6501 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6502 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6503
6504 // Post WDA_DELBA_IND to HAL.
6505 msgQ.type = WDA_DELBA_IND;
6506 //
6507 // FIXME:
6508 // A global counter (dialog token) is required to keep track of
6509 // all PE <-> HAL communication(s)
6510 //
6511 msgQ.reserved = 0;
6512 msgQ.bodyptr = pDelBAParams;
6513 msgQ.bodyval = 0;
6514
6515 limLog( pMac, LOGW,
6516 FL( "Sending SIR_HAL_DELBA_IND..." ));
6517
Jeff Johnsone7245742012-09-05 17:12:55 -07006518 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006519#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6520 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6521#endif //FEATURE_WLAN_DIAG_SUPPORT
6522
6523 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6524 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006525 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006526 retCode );
6527 else
6528 {
6529 // Update LIM's internal cache...
6530 if( eBA_INITIATOR == baDirection)
6531 {
6532 pSta->tcCfg[baTID].fUseBATx = 0;
6533 pSta->tcCfg[baTID].txBufSize = 0;
6534 }
6535 else
6536 {
6537 pSta->tcCfg[baTID].fUseBARx = 0;
6538 pSta->tcCfg[baTID].rxBufSize = 0;
6539 }
6540
6541 return retCode;
6542 }
6543
6544returnFailure:
6545
6546 // Clean-up...
6547 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306548 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006549
6550 return retCode;
6551
6552}
6553
6554/**
6555 * @function : limPostSMStateUpdate()
6556 *
6557 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6558 *
6559 * LOGIC:
6560 *
6561 * ASSUMPTIONS:
6562 * NA
6563 *
6564 * NOTE:
6565 * NA
6566 *
6567 * @param pMac - Pointer to Global MAC structure
6568 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6569 * @return None
6570 */
6571tSirRetStatus
6572limPostSMStateUpdate(tpAniSirGlobal pMac,
6573 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6574{
6575 tSirRetStatus retCode = eSIR_SUCCESS;
6576 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006577 tpSetMIMOPS pMIMO_PSParams;
6578
6579 msgQ.reserved = 0;
6580 msgQ.type = WDA_SET_MIMOPS_REQ;
6581
6582 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306583 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6584 if ( NULL == pMIMO_PSParams )
6585 {
6586 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 return eSIR_MEM_ALLOC_FAILED;
6588 }
6589
6590 pMIMO_PSParams->htMIMOPSState = state;
6591 pMIMO_PSParams->staIdx = staIdx;
6592 pMIMO_PSParams->fsendRsp = true;
6593 msgQ.bodyptr = pMIMO_PSParams;
6594 msgQ.bodyval = 0;
6595
6596 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6597
Jeff Johnsone7245742012-09-05 17:12:55 -07006598 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006599 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6600 if (eSIR_SUCCESS != retCode)
6601 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006602 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306603 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006604 return retCode;
6605 }
6606
6607 return retCode;
6608}
6609
6610void limPktFree (
6611 tpAniSirGlobal pMac,
6612 eFrameType frmType,
6613 tANI_U8 *pRxPacketInfo,
6614 void *pBody)
6615{
6616 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006617}
6618
6619/**
6620 * limGetBDfromRxPacket()
6621 *
6622 *FUNCTION:
6623 * This function is called to get pointer to Polaris
6624 * Buffer Descriptor containing MAC header & other control
6625 * info from the body of the message posted to LIM.
6626 *
6627 *LOGIC:
6628 * NA
6629 *
6630 *ASSUMPTIONS:
6631 * NA
6632 *
6633 *NOTE:
6634 * NA
6635 *
6636 * @param body - Received message body
6637 * @param pRxPacketInfo - Pointer to received BD
6638 * @return None
6639 */
6640
6641void
6642limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6643{
Jeff Johnson295189b2012-06-20 16:38:30 -07006644 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006645} /*** end limGetBDfromRxPacket() ***/
6646
6647
6648
6649
6650
6651void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6652{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306653 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006654}
6655
6656
6657void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6658{
6659 tANI_U8 i;
6660 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6661
6662 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6663 {
6664 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6665 {
6666 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6667 fFound = eANI_BOOLEAN_TRUE;
6668 break;
6669 }
6670 }
6671 if(eANI_BOOLEAN_FALSE == fFound)
6672 {
6673 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6674 {
6675 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6676 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6677 }
6678 else
6679 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006680 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006681 }
6682 }
6683}
6684
6685
6686/**
6687 * @function : limIsChannelValidForChannelSwitch()
6688 *
6689 * @brief : This function checks if the channel to which AP
6690 * is expecting us to switch, is a valid channel for us.
6691 * LOGIC:
6692 *
6693 * ASSUMPTIONS:
6694 * NA
6695 *
6696 * NOTE:
6697 * NA
6698 *
6699 * @param pMac - Pointer to Global MAC structure
6700 * @param channel - New channel to which we are expected to move
6701 * @return None
6702 */
6703tAniBool
6704limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6705{
6706 tANI_U8 index;
6707 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6708 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6709
6710 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6711 (tANI_U8 *)validChannelList,
6712 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6713 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006714 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006715 return (eSIR_FALSE);
6716 }
6717
6718 for(index = 0; index < validChannelListLen; index++)
6719 {
6720 if(validChannelList[index] == channel)
6721 return (eSIR_TRUE);
6722 }
6723
6724 /* channel does not belong to list of valid channels */
6725 return (eSIR_FALSE);
6726}
6727
6728/**------------------------------------------------------
6729\fn __limFillTxControlParams
6730\brief Fill the message for stopping/resuming tx.
6731
6732\param pMac
6733\param pTxCtrlMsg - Pointer to tx control message.
6734\param type - Which way we want to stop/ resume tx.
6735\param mode - To stop/resume.
6736 -------------------------------------------------------*/
6737static eHalStatus
6738__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6739 tLimQuietTxMode type, tLimControlTx mode)
6740{
6741
6742 //TBD-RAJESH HOW TO GET sessionEntry?????
6743 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6744
6745 if (mode == eLIM_STOP_TX)
6746 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6747 else
6748 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6749
6750 switch (type)
6751 {
6752 case eLIM_TX_ALL:
6753 /** Stops/resumes transmission completely */
6754 pTxCtrlMsg->fCtrlGlobal = 1;
6755 break;
6756
6757 case eLIM_TX_BSS_BUT_BEACON:
6758 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6759 * stop beacon transmission.
6760 */
6761 pTxCtrlMsg->ctrlBss = 1;
6762 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6763 break;
6764
6765 case eLIM_TX_STA:
6766 /** Memory for station bitmap is allocated dynamically in caller of this
6767 * so decode properly here and fill the bitmap. Now not implemented,
6768 * fall through.
6769 */
6770 case eLIM_TX_BSS:
6771 //Fall thru...
6772 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006773 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006774 return eHAL_STATUS_FAILURE;
6775 }
6776
6777 return eHAL_STATUS_SUCCESS;
6778}
6779
6780/**
6781 * @function : limFrameTransmissionControl()
6782 *
6783 * @brief : This API is called by the user to halt/resume any frame
6784 * transmission from the device. If stopped, all frames will be
6785 * queued starting from hardware. Then back-pressure
6786 * is built till the driver.
6787 * LOGIC:
6788 *
6789 * ASSUMPTIONS:
6790 * NA
6791 *
6792 * NOTE:
6793 * NA
6794 *
6795 * @param pMac - Pointer to Global MAC structure
6796 * @return None
6797 */
6798void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6799{
6800
6801 eHalStatus status = eHAL_STATUS_FAILURE;
6802 tpTxControlParams pTxCtrlMsg;
6803 tSirMsgQ msgQ;
6804 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6805
6806 /** Allocate only required number of bytes for station bitmap
6807 * Make it to align to 4 byte boundary */
6808 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6809
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306810 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6811 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306813 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006814 return;
6815 }
6816
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306817 vos_mem_set((void *) pTxCtrlMsg,
6818 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006819 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6820 if (status != eHAL_STATUS_SUCCESS)
6821 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306822 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006823 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006824 return;
6825 }
6826
6827 msgQ.bodyptr = (void *) pTxCtrlMsg;
6828 msgQ.bodyval = 0;
6829 msgQ.reserved = 0;
6830 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6831
Jeff Johnsone7245742012-09-05 17:12:55 -07006832 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6834 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306835 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006836 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006837 return;
6838 }
6839
6840 if (mode == eLIM_STOP_TX)
6841 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306842 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006843 }
6844 else
6845 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306846 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 }
6848 return;
6849}
6850
6851
6852/**
6853 * @function : limRestorePreChannelSwitchState()
6854 *
6855 * @brief : This API is called by the user to undo any
6856 * specific changes done on the device during
6857 * channel switch.
6858 * LOGIC:
6859 *
6860 * ASSUMPTIONS:
6861 * NA
6862 *
6863 * NOTE:
6864 * NA
6865 *
6866 * @param pMac - Pointer to Global MAC structure
6867 * @return None
6868 */
6869
6870tSirRetStatus
6871limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6872{
6873
6874 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006875 tANI_U32 val = 0;
6876
6877 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6878 return retCode;
6879
6880 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006881 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006882
6883 /* Restore the frame transmission, all the time. */
6884 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6885
6886 /* Free to enter BMPS */
6887 limSendSmePostChannelSwitchInd(pMac);
6888
6889 //Background scan is now enabled by SME
6890 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6891 {
6892 /* Enable background scan if already enabled, else don't bother */
6893 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6894 &val)) != eSIR_SUCCESS)
6895
6896 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006897 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006898 return (retCode);
6899 }
6900
6901 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6902 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006903 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6904 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006905 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6906 {
6907 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6908 return (eSIR_FAILURE);
6909 }
6910
6911 }
6912 }
6913
6914 /* Enable heartbeat timer */
6915 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6916 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006917 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6918 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6919 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6920 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006921 {
6922 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6923 return (eSIR_FAILURE);
6924 }
6925 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006926 return (retCode);
6927}
6928
6929
6930/**--------------------------------------------
6931\fn limRestorePreQuietState
6932\brief Restore the pre quiet state
6933
6934\param pMac
6935\return NONE
6936---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006937tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006938{
6939
6940 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006941 tANI_U32 val = 0;
6942
6943 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6944 return retCode;
6945
6946 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006947 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006948
6949 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006950 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6952
6953
6954 //Background scan is now enabled by SME
6955 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6956 {
6957 /* Enable background scan if already enabled, else don't bother */
6958 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6959 &val)) != eSIR_SUCCESS)
6960
6961 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006962 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006963 return (retCode);
6964 }
6965
6966 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6967 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006968 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006969 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6970 {
6971 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6972 return (eSIR_FAILURE);
6973 }
6974
6975 }
6976 }
6977
6978 /* Enable heartbeat timer */
6979 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6980 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006981 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006982 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006983 {
6984 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6985 return (eSIR_FAILURE);
6986 }
6987 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006988 return (retCode);
6989}
6990
6991
6992/**
6993 * @function: limPrepareFor11hChannelSwitch()
6994 *
6995 * @brief : This API is called by the user to prepare for
6996 * 11h channel switch. As of now, the API does
6997 * very minimal work. User can add more into the
6998 * same API if needed.
6999 * LOGIC:
7000 *
7001 * ASSUMPTIONS:
7002 * NA
7003 *
7004 * NOTE:
7005 * NA
7006 *
7007 * @param pMac - Pointer to Global MAC structure
7008 * @param psessionEntry
7009 * @return None
7010 */
7011void
7012limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7013{
Jeff Johnson295189b2012-06-20 16:38:30 -07007014 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7015 return;
7016
7017 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007018 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007019
7020 /* Disable, Stop background scan if enabled and running */
7021 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7022
7023 /* Stop heart-beat timer to stop heartbeat disassociation */
7024 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7025
7026 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7027 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7028 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007029 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 /* Stop ongoing scanning if any */
7031 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7032 {
7033 //Set the resume channel to Any valid channel (invalid).
7034 //This will instruct HAL to set it to any previous valid channel.
7035 peSetResumeChannel(pMac, 0, 0);
7036 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7037 }
7038 else
7039 {
7040 limRestorePreChannelSwitchState(pMac, psessionEntry);
7041 }
7042 return;
7043 }
7044 else
7045 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007046 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 /** We are safe to switch channel at this point */
7048 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7049 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007050}
7051
7052
7053
7054/**----------------------------------------------------
7055\fn limGetNwType
7056
7057\brief Get type of the network from data packet or beacon
7058\param pMac
7059\param channelNum - Channel number
7060\param type - Type of packet.
7061\param pBeacon - Pointer to beacon or probe response
7062
7063\return Network type a/b/g.
7064-----------------------------------------------------*/
7065tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7066{
7067 tSirNwType nwType = eSIR_11B_NW_TYPE;
7068
7069 if (type == SIR_MAC_DATA_FRAME)
7070 {
7071 if ((channelNum > 0) && (channelNum < 15))
7072 {
7073 nwType = eSIR_11G_NW_TYPE;
7074 }
7075 else
7076 {
7077 nwType = eSIR_11A_NW_TYPE;
7078 }
7079 }
7080 else
7081 {
7082 if ((channelNum > 0) && (channelNum < 15))
7083 {
7084 int i;
7085 // 11b or 11g packet
7086 // 11g iff extended Rate IE is present or
7087 // if there is an A rate in suppRate IE
7088 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7089 {
7090 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7091 {
7092 nwType = eSIR_11G_NW_TYPE;
7093 break;
7094 }
7095 }
7096 if (pBeacon->extendedRatesPresent)
7097 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007098 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007099 nwType = eSIR_11G_NW_TYPE;
7100 }
7101 }
7102 else
7103 {
7104 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007105 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007106 nwType = eSIR_11A_NW_TYPE;
7107 }
7108 }
7109 return nwType;
7110}
7111
7112
7113/**---------------------------------------------------------
7114\fn limGetChannelFromBeacon
7115\brief To extract channel number from beacon
7116
7117\param pMac
7118\param pBeacon - Pointer to beacon or probe rsp
7119\return channel number
7120-----------------------------------------------------------*/
7121tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7122{
7123 tANI_U8 channelNum = 0;
7124
7125 if (pBeacon->dsParamsPresent)
7126 channelNum = pBeacon->channelNumber;
7127 else if(pBeacon->HTInfo.present)
7128 channelNum = pBeacon->HTInfo.primaryChannel;
7129 else
7130 channelNum = pBeacon->channelNumber;
7131
7132 return channelNum;
7133}
7134
7135
7136/** ---------------------------------------------------------
7137\fn limSetTspecUapsdMask
7138\brief This function sets the PE global variable:
7139\ 1) gUapsdPerAcTriggerEnableMask and
7140\ 2) gUapsdPerAcDeliveryEnableMask
7141\ based on the user priority field and direction field
7142\ in the TS Info Fields.
7143\
7144\ An AC is a trigger-enabled AC if the PSB subfield
7145\ is set to 1 in the uplink direction.
7146\ An AC is a delivery-enabled AC if the PSB subfield
7147\ is set to 1 in the down-link direction.
7148\
7149\param tpAniSirGlobal pMac
7150\param tSirMacTSInfo pTsInfo
7151\param tANI_U32 action
7152\return None
7153 ------------------------------------------------------------*/
7154void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7155{
7156 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7157 tANI_U16 direction = pTsInfo->traffic.direction;
7158 tANI_U8 ac = upToAc(userPrio);
7159
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307160 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 -07007161
7162 /* Converting AC to appropriate Uapsd Bit Mask
7163 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7164 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7165 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7166 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7167 */
7168 ac = ((~ac) & 0x3);
7169
7170 if (action == CLEAR_UAPSD_MASK)
7171 {
7172 if (direction == SIR_MAC_DIRECTION_UPLINK)
7173 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7174 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7175 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7176 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7177 {
7178 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7179 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7180 }
7181 }
7182 else if (action == SET_UAPSD_MASK)
7183 {
7184 if (direction == SIR_MAC_DIRECTION_UPLINK)
7185 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7186 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7187 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7188 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7189 {
7190 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7191 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7192 }
7193 }
7194
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007195 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7196 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007197
7198 return;
7199}
7200
7201
7202
7203void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7204{
7205
7206 tANI_U8 i;
7207 for(i =0;i < pMac->lim.maxBssId;i++)
7208 {
7209 if(pMac->lim.gpSession[i].valid == TRUE )
7210 {
7211 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7212 {
7213 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7214 break;
7215 }
7216
7217 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7218 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7219 {
7220 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7221 }
7222 }
7223 }
7224 for(i=0; i< pMac->lim.maxBssId; i++)
7225 {
7226 if(pMac->lim.gpSession[i].valid == TRUE )
7227 {
7228 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7229 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7230 {
7231 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7232 {
7233 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007234 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007235 i);)
7236 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7237 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7238 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7239 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007240 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007241 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7242 }
7243 break;
7244 }
7245 }
7246 }
7247 }
7248}
7249
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007250void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7251{
7252 if(psessionEntry->valid == TRUE )
7253 {
7254 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7255 {
7256 limIbssHeartBeatHandle(pMac,psessionEntry);
7257 }
7258 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7259 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7260 {
7261 limHandleHeartBeatFailure(pMac,psessionEntry);
7262 }
7263 }
7264 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7265 and the other things again */
7266 if(psessionEntry->valid == TRUE )
7267 {
7268 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7269 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7270 {
7271 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7272 {
7273 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7274 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7275 psessionEntry->bssIdx);)
7276 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7277 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7278 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7279 {
7280 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7281 limReactivateHeartBeatTimer(pMac, psessionEntry);
7282 }
7283 }
7284 }
7285 }
7286}
7287
7288
Jeff Johnson295189b2012-06-20 16:38:30 -07007289tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7290{
7291 tANI_U8 i;
7292 for(i =0;i < pMac->lim.maxBssId;i++)
7293 {
7294 if(pMac->lim.gpSession[i].valid == TRUE )
7295 {
7296 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7297 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7298 {
7299 return pMac->lim.gpSession[i].currentOperChannel;
7300 }
7301 }
7302 }
7303 return 0;
7304}
7305
7306void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7307{
7308
7309 tpPESession psessionEntry;
7310// tANI_U8 sessionId;
7311 tpAddStaParams pAddStaParams;
7312
7313 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7314
7315 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7316 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007317 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307318 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007319 return;
7320 }
7321 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7322 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007323#ifdef FEATURE_WLAN_TDLS
7324 else if(pMac->lim.gLimAddStaTdls)
7325 {
7326 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7327 pMac->lim.gLimAddStaTdls = FALSE ;
7328 }
7329#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007330 else
7331 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7332
7333}
7334
7335
7336void limUpdateBeacon(tpAniSirGlobal pMac)
7337{
7338 tANI_U8 i;
7339
7340 for(i =0;i < pMac->lim.maxBssId;i++)
7341 {
7342 if(pMac->lim.gpSession[i].valid == TRUE )
7343 {
7344 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7345 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7346 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7347 )
7348 {
7349 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7350 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7351 }
7352 else
7353 {
7354 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7355 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7356 {
7357
7358 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7359 {
7360 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7361 }
7362 }
7363 }
7364 }
7365 }
7366}
7367
7368void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7369{
7370 tANI_U8 i;
7371 tpPESession psessionEntry;
7372 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7373 for(i =0; i < pMac->lim.maxBssId; i++)
7374 {
7375 if(pMac->lim.gpSession[i].valid == TRUE)
7376 {
7377 psessionEntry = &pMac->lim.gpSession[i];
7378 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7379 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307380 limLog(pMac, LOGE,
7381 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7382 psessionEntry->limSmeState, psessionEntry->limMlmState,
7383 psessionEntry->LimRxedBeaconCntDuringHB,
7384 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007385#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7386 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7387#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007388 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7389 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307390 /* Disconnect even if we have not received a single beacon
7391 * after connection.
7392 */
7393 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7394 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307395 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7396 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007397 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007398 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 /* AP did not respond to Probe Request. Tear down link with it.*/
7400 limTearDownLinkWithAp(pMac,
7401 psessionEntry->peSessionId,
7402 eSIR_BEACON_MISSED);
7403 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7404 }
7405 else // restart heartbeat timer
7406 {
7407 limReactivateHeartBeatTimer(pMac, psessionEntry);
7408 }
7409 }
7410 else
7411 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007412 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007413 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7414 limReactivateHeartBeatTimer(pMac, psessionEntry);
7415 }
7416
7417 }
7418 }
7419 }
7420 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7421 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7422}
7423
7424
7425/*
7426* This function assumes there will not be more than one IBSS session active at any time.
7427*/
7428tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7429{
7430 tANI_U8 i;
7431
7432 for(i =0;i < pMac->lim.maxBssId;i++)
7433 {
7434 if( (pMac->lim.gpSession[i].valid) &&
7435 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7436 return (&pMac->lim.gpSession[i]);
7437 }
7438
7439 return NULL;
7440}
7441
7442tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7443{
7444 tANI_U8 i;
7445
7446 for(i =0;i < pMac->lim.maxBssId;i++)
7447 {
7448 if( (pMac->lim.gpSession[i].valid) &&
7449 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7450 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7451 return (&pMac->lim.gpSession[i]);
7452 }
7453
7454 return NULL;
7455}
7456
7457/**---------------------------------------------------------
7458\fn limHandleDeferMsgError
7459\brief handles error scenario, when the msg can not be deferred.
7460\param pMac
7461\param pLimMsg LIM msg, which could not be deferred.
7462\return void
7463-----------------------------------------------------------*/
7464
7465void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7466{
7467 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7468 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307469 /*Decrement the Pending count before droping */
7470 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007471 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7472 }
7473 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007474 {
7475 vos_mem_free( pLimMsg->bodyptr);
7476 pLimMsg->bodyptr = NULL;
7477 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007478}
7479
7480
7481#ifdef FEATURE_WLAN_DIAG_SUPPORT
7482/**---------------------------------------------------------
7483\fn limDiagEventReport
7484\brief This function reports Diag event
7485\param pMac
7486\param eventType
7487\param bssid
7488\param status
7489\param reasonCode
7490\return void
7491-----------------------------------------------------------*/
7492void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7493{
7494 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7495 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7496
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007498
7499 if (NULL == pSessionEntry)
7500 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307501 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007502 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7503 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7504
7505 }
7506 else
7507 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307508 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007509 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7510 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7511 }
7512 peEvent.event_type = eventType;
7513 peEvent.status = status;
7514 peEvent.reason_code = reasonCode;
7515
7516 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7517 return;
7518}
7519
7520#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7521
7522void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7523{
7524
7525 tpAddStaSelfParams pAddStaSelfParams;
7526 tSirMsgQ mmhMsg;
7527 tpSirSmeAddStaSelfRsp pRsp;
7528
7529
7530 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7531
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307532 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7533 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007534 {
7535 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307536 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7537 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007538 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007539 return;
7540 }
7541
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307542 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007543
7544 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7545 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7546 pRsp->status = pAddStaSelfParams->status;
7547
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307548 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007549
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307550 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007551 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007552
7553 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7554 mmhMsg.bodyptr = pRsp;
7555 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307556 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007557 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7558
7559}
7560
7561void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7562{
7563
7564 tpDelStaSelfParams pDelStaSelfParams;
7565 tSirMsgQ mmhMsg;
7566 tpSirSmeDelStaSelfRsp pRsp;
7567
7568
7569 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7570
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307571 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7572 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007573 {
7574 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307575 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7576 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007577 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007578 return;
7579 }
7580
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307581 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007582
7583 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7584 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7585 pRsp->status = pDelStaSelfParams->status;
7586
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307587 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007588
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307589 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007590 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007591
7592 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7593 mmhMsg.bodyptr = pRsp;
7594 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307595 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007596 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7597
7598}
7599
7600/***************************************************************
7601* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7602* To unmap the channel to reverse the effect of mapping
7603* a band channel in hal .Mapping was done hal to overcome the
7604* limitation of the rxbd which use only 4 bit for channel number.
7605*****************************************************************/
7606tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7607{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007608#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007609 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007610 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7611 return aUnsortedChannelList[mapChannel -1];
7612 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007613#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007614 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007615#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007616 return abChannel[mapChannel -1];
7617 else
7618 return 0;
7619}
7620
7621
7622v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7623{
7624 int left = length;
7625 v_U8_t *ptr = pIes;
7626 v_U8_t elem_id;
7627 v_U16_t elem_len;
7628
7629 while(left >= (size_of_len_field+1))
7630 {
7631 elem_id = ptr[0];
7632 if (size_of_len_field == TWO_BYTE)
7633 {
7634 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7635 }
7636 else
7637 {
7638 elem_len = ptr[1];
7639 }
7640
7641
7642 left -= (size_of_len_field+1);
7643 if(elem_len > left)
7644 {
7645 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007646 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007647 eid,elem_len,left);
7648 return NULL;
7649 }
7650 if (elem_id == eid)
7651 {
7652 return ptr;
7653 }
7654
7655 left -= elem_len;
7656 ptr += (elem_len + (size_of_len_field+1));
7657 }
7658 return NULL;
7659}
7660
7661/* return NULL if oui is not found in ie
7662 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7663 */
7664v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7665{
7666 int left = ie_len;
7667 v_U8_t *ptr = ie;
7668 v_U8_t elem_id, elem_len;
7669
7670 while(left >= 2)
7671 {
7672 elem_id = ptr[0];
7673 elem_len = ptr[1];
7674 left -= 2;
7675 if(elem_len > left)
7676 {
7677 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007678 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007679 elem_id,elem_len,left);
7680 return NULL;
7681 }
7682 if (SIR_MAC_EID_VENDOR == elem_id)
7683 {
7684 if(memcmp(&ptr[2], oui, oui_size)==0)
7685 return ptr;
7686 }
7687
7688 left -= elem_len;
7689 ptr += (elem_len + 2);
7690 }
7691 return NULL;
7692}
7693
Jeff Johnson295189b2012-06-20 16:38:30 -07007694//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7695
7696v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7697{
7698 int length = 0;
7699 tANI_U8 *ptr = ie;
7700
7701 ptr[length++] = SIR_MAC_EID_VENDOR;
7702 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307703 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7704 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007705 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7706}
7707
7708//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7709
7710v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7711{
7712 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007713
7714 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7715 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7716 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307717 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007718 noaStream + noaLen - overFlowLen, overFlowLen);
7719 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7720 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307721 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007722 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307723 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7724 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007725 }
7726
Jeff Johnson295189b2012-06-20 16:38:30 -07007727 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7728
7729}
7730
7731//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7732v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7733{
7734 v_U8_t len=0;
7735
7736 v_U8_t *pBody = pNoaStream;
7737
7738
7739 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7740 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7741 {
7742 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7743 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7744 )
7745 return 0; //No NoA Descriptor then return 0
7746
7747
7748 pBody[0] = SIR_P2P_NOA_ATTR;
7749
7750 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7751 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7752 len = 5;
7753 pBody += len;
7754
7755
7756 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7757 {
7758 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7759 pBody += 1;
7760 len +=1;
7761
7762 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7763 pBody += sizeof(tANI_U32);
7764 len +=4;
7765
7766 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7767 pBody += sizeof(tANI_U32);
7768 len +=4;
7769
7770 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7771 pBody += sizeof(tANI_U32);
7772 len +=4;
7773
7774 }
7775
7776 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7777 {
7778 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7779 pBody += 1;
7780 len +=1;
7781
7782 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7783 pBody += sizeof(tANI_U32);
7784 len +=4;
7785
7786 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7787 pBody += sizeof(tANI_U32);
7788 len +=4;
7789
7790 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7791 pBody += sizeof(tANI_U32);
7792 len +=4;
7793
7794 }
7795
7796
7797 pBody = pNoaStream + 1;
7798 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7799
7800 return (len);
7801
7802 }
7803 return 0;
7804
7805}
Jeff Johnsone7245742012-09-05 17:12:55 -07007806
7807void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007808{
7809
7810 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007811 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007812}
Jeff Johnsone7245742012-09-05 17:12:55 -07007813
Jeff Johnson295189b2012-06-20 16:38:30 -07007814/*--------------------------------------------------------------------------
7815
7816 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7817
Jeff Johnsone7245742012-09-05 17:12:55 -07007818 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7819 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007820
7821 \param pMac - pointer to global adapter context
7822 \return - channel to scan from valid session else zero.
7823
7824 \sa
7825
7826 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007827void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007828{
7829
7830 //Rationale - this could be the suspend/resume for assoc and it is essential that
7831 //the new BSS is active for some time. Other BSS was anyway suspended.
7832 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7833 //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 -07007834 //and hence should be ok. Need to discuss this further
7835 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 {
7837 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007838 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007839 }
7840 else
7841 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007842 *resumeChannel = pMac->lim.gResumeChannel;
7843 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007844 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007845 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007846}
7847
Viral Modid86bde22012-12-10 13:09:21 -08007848tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7849{
7850 tANI_U8 i;
7851 for(i =0; i < pMac->lim.maxBssId; i++)
7852 {
7853 if(pMac->lim.gpSession[i].valid == TRUE)
7854 {
7855 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7856 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7857 )
7858 {
7859 return TRUE;
7860 }
7861 }
7862 }
7863 return FALSE;
7864}
Jeff Johnsone7245742012-09-05 17:12:55 -07007865
Jeff Johnson295189b2012-06-20 16:38:30 -07007866
7867tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7868{
7869 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7870 {
7871 return eANI_BOOLEAN_TRUE;
7872 }
7873 else
7874 {
7875 return eANI_BOOLEAN_FALSE;
7876 }
7877}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007878
Sandeep Puligilla60342762014-01-30 21:05:37 +05307879/**
7880 * \brief verify the changes in channel bonding
7881 *
7882 * \param pMac Pointer to the global MAC structure
7883 *
7884 * \param psessionEntry session entry
7885 * beaconSecChanWidth Secondary channel width
7886 * advertized in beacon
7887 * currentSecChanWidth Current configured width
7888 * staId Station Id
7889 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7890 */
7891tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7892 tpPESession psessionEntry,
7893 tANI_U8 beaconSecChanWidth,
7894 tANI_U8 currentSecChanWidth,
7895 tANI_U8 staId)
7896{
7897 tUpdateVHTOpMode tempParam;
7898 tANI_BOOLEAN fCbMode24G = FALSE;
7899 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7900
7901 /* Moving from HT40 to HT20 operation*/
7902 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7903 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7904 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7905 {
7906 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7907 tempParam.staId = staId;
7908 fCbMode24G = TRUE;
7909 }
7910
7911 /* Moving from HT20 to HT40 operation*/
7912 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7913 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7914 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7915 {
7916 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7917 tempParam.staId = staId;
7918 fCbMode24G = TRUE;
7919 }
7920
7921 if (TRUE == fCbMode24G)
7922 {
7923 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7924 "Changing CBMODE to = %d staId = %d",
7925 tempParam.opMode, tempParam.staId );
7926 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7927 status = eANI_BOOLEAN_TRUE;
7928 }
7929 return status;
7930}
7931
Mohit Khanna4a70d262012-09-11 16:30:12 -07007932#ifdef WLAN_FEATURE_11AC
7933tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7934{
7935 tUpdateVHTOpMode tempParam;
7936
7937 tempParam.opMode = chanWidth;
7938 tempParam.staId = staId;
7939
7940 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7941
7942 return eANI_BOOLEAN_TRUE;
7943}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007944#endif
7945
krunal soni45b9eb62014-03-26 12:54:25 -07007946void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7947 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007948{
7949 tANI_U8 val=0;
7950
krunal soni45b9eb62014-03-26 12:54:25 -07007951 //only 2.4G band should have short slot enable, rest it should be default
7952 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007953 {
krunal soni45b9eb62014-03-26 12:54:25 -07007954 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007955 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007956 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007957 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7958 {
7959 val = true;
7960 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007961 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007962 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007963 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007964 // Joining BSS.
7965 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007966 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007967 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007968 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007969 // Reassociating with AP.
7970 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007971 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007972 }
krunal soni45b9eb62014-03-26 12:54:25 -07007973 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007974 {
krunal soni45b9eb62014-03-26 12:54:25 -07007975 /*
7976 * 11B does not short slot and short slot is default
7977 * for 11A mode. Hence, not need to set this bit
7978 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007979 val = false;
7980 }
krunal soni45b9eb62014-03-26 12:54:25 -07007981
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007982 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007983 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007984}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307985
Kalikinkar dhara205da782014-03-21 15:49:32 -07007986void limUtilsframeshtons(tpAniSirGlobal pCtx,
7987 tANI_U8 *pOut,
7988 tANI_U16 pIn,
7989 tANI_U8 fMsb)
7990{
7991 (void)pCtx;
7992#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7993 if ( !fMsb )
7994 {
7995 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7996 }
7997 else
7998 {
7999 *pOut = ( pIn & 0xff00 ) >> 8;
8000 *( pOut + 1 ) = pIn & 0xff;
8001 }
8002#else
8003 if ( !fMsb )
8004 {
8005 *pOut = pIn & 0xff;
8006 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8007 }
8008 else
8009 {
8010 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8011 }
8012#endif
8013}
8014
8015void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8016 tANI_U8 *pOut,
8017 tANI_U32 pIn,
8018 tANI_U8 fMsb)
8019{
8020 (void)pCtx;
8021#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8022 if ( !fMsb )
8023 {
8024 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8025 }
8026 else
8027 {
8028 *pOut = ( pIn & 0xff000000 ) >> 24;
8029 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8030 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8031 *( pOut + 3 ) = ( pIn & 0x000000ff );
8032 }
8033#else
8034 if ( !fMsb )
8035 {
8036 *( pOut ) = ( pIn & 0x000000ff );
8037 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8038 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8039 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8040 }
8041 else
8042 {
8043 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8044 }
8045#endif
8046}
8047
8048
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308049/**--------------------------------------------
8050\fn limUpdateOBSSScanParams
8051\brief Updates OBSS SCAN IE parameters to session
8052
8053\param psessionEntry - Session Entry
8054\return NONE
8055---------------------------------------------*/
8056void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8057 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8058{
8059 /*If the recieved value is not in the range specified by the Specification
8060 then it will be the default value configured through cfg */
8061 if (( pOBSSScanParameters->obssScanActiveDwell >
8062 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8063 ( pOBSSScanParameters->obssScanActiveDwell <
8064 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8065 {
8066 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8067 pOBSSScanParameters->obssScanActiveDwell;
8068 }
8069 if((pOBSSScanParameters->obssScanPassiveDwell >
8070 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8071 (pOBSSScanParameters->obssScanPassiveDwell <
8072 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8073 {
8074 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8075 pOBSSScanParameters->obssScanPassiveDwell;
8076 }
8077 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8078 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8079 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8080 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8081 {
8082 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8083 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8084 }
8085 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8086 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8087 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8088 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8089 {
8090 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8091 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8092 }
8093 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8094 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8095 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8096 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8097 {
8098 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8099 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8100 }
8101 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8102 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8103 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8104 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8105 {
8106 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8107 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8108 }
8109 if((pOBSSScanParameters->obssScanActivityThreshold >
8110 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8111 (pOBSSScanParameters->obssScanActivityThreshold <
8112 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8113 {
8114 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8115 pOBSSScanParameters->obssScanActivityThreshold;
8116 }
8117}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008118
8119#ifdef WLAN_FEATURE_11W
8120void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8121{
8122 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8123 tPmfSaQueryTimerId timerId;
8124 tpPESession psessionEntry;
8125 tpDphHashNode pSta;
8126 tANI_U32 maxRetries;
8127
8128 limLog(pMac, LOG1, FL("SA Query timer fires"));
8129 timerId.value = param;
8130
8131 // Check that SA Query is in progress
8132 if ((psessionEntry = peFindSessionBySessionId(
8133 pMac, timerId.fields.sessionId)) == NULL)
8134 {
8135 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8136 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008137 return;
8138 }
8139 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8140 &psessionEntry->dph.dphHashTable)) == NULL)
8141 {
8142 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8143 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008144 return;
8145 }
8146 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8147 return;
8148
8149 // Increment the retry count, check if reached maximum
8150 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8151 &maxRetries) != eSIR_SUCCESS)
8152 {
8153 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8154 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8155 return;
8156 }
8157 pSta->pmfSaQueryRetryCount++;
8158 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8159 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308160 limLog(pMac, LOGE,
8161 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8162 MAC_ADDR_ARRAY(pSta->staAddr));
8163 limSendDisassocMgmtFrame(pMac,
8164 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8165 pSta->staAddr, psessionEntry, FALSE);
8166 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008167 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8168 return;
8169 }
8170
8171 // Retry SA Query
8172 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8173 pSta->staAddr, psessionEntry);
8174 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008175 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8176 {
8177 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8178 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8179 }
8180}
8181#endif
8182
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008183/** ---------------------------------------------------------
8184\fn limProcessChannelSwitchSuspendLink
8185\brief This function call channel switch functions based on
8186 the gLimChannelSwitch.state. After function return it
8187 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8188 If gLimChannelSwitch.state is non-identified then
8189 print error log as well as restore back the
8190 pre-channelSwitch.
8191\param tpAniSirGlobal pMac
8192\param eHalStatus status
8193\param tANI_U32 *ctx
8194\return None
8195 ------------------------------------------------------------*/
8196static void
8197limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8198 eHalStatus status,
8199 tANI_U32 *ctx)
8200{
8201 tpPESession pSessionEntry = (tpPESession)ctx;
8202
8203 if ( eHAL_STATUS_SUCCESS != status )
8204 {
8205 limLog(pMac, LOGE,
8206 FL("Suspend link failed. still proceeding "));
8207 }
8208 if (NULL == pSessionEntry )
8209 {
8210 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8211 return;
8212 }
8213
8214 switch(pSessionEntry->gLimChannelSwitch.state)
8215 {
8216 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8217 PELOGW(limLog(pMac, LOGW,
8218 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8219 limSwitchPrimaryChannel(pMac,
8220 pSessionEntry->gLimChannelSwitch.primaryChannel,
8221 pSessionEntry);
8222 pSessionEntry->gLimChannelSwitch.state =
8223 eLIM_CHANNEL_SWITCH_IDLE;
8224 break;
8225
8226 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8227 PELOGW(limLog(pMac, LOGW,
8228 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8229 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8230 pSessionEntry->gLimChannelSwitch.primaryChannel,
8231 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8232 pSessionEntry->gLimChannelSwitch.state =
8233 eLIM_CHANNEL_SWITCH_IDLE;
8234 break;
8235
8236 default:
8237 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8238 pSessionEntry->gLimChannelSwitch.state);)
8239 if (limRestorePreChannelSwitchState(pMac,
8240 pSessionEntry) != eSIR_SUCCESS)
8241 {
8242 limLog(pMac, LOGE,
8243 FL("Could not restore pre-channelSwitch "
8244 "(11h) state, resetting the system"));
8245 }
8246 }
8247}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308248
8249/** ---------------------------------------------------------
8250\fn limInitOBSSScanParams
8251\brief This function Initializes the OBSS Scan Parameters
8252\param tpAniSirGlobal pMac
8253\param tpPESession pSessionEntry
8254\return None
8255 ------------------------------------------------------------*/
8256
8257void limInitOBSSScanParams(tpAniSirGlobal pMac,
8258 tpPESession psessionEntry)
8259{
8260 tANI_U32 cfgValue;
8261
8262 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8263 &cfgValue) != eSIR_SUCCESS)
8264 {
8265 limLog(pMac, LOGE, FL("Fail to retrieve "
8266 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8267 return ;
8268 }
8269 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8270
8271 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8272 &cfgValue) != eSIR_SUCCESS)
8273 {
8274 limLog(pMac, LOGE, FL("Fail to retrieve "
8275 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8276 return ;
8277 }
8278 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8279
8280 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8281 &cfgValue) != eSIR_SUCCESS)
8282 {
8283 limLog(pMac, LOGE, FL("Fail to retrieve "
8284 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8285 return ;
8286 }
8287 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8288 = cfgValue;
8289 if (wlan_cfgGetInt(pMac,
8290 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8291 &cfgValue) != eSIR_SUCCESS)
8292 {
8293 limLog(pMac, LOGE, FL("Fail to retrieve"
8294 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8295 return ;
8296 }
8297 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8298 cfgValue;
8299 if (wlan_cfgGetInt(pMac,
8300 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8301 != eSIR_SUCCESS)
8302 {
8303 limLog(pMac, LOGE, FL("Fail to retrieve"
8304 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8305 return ;
8306 }
8307 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8308 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308309
8310 if (wlan_cfgGetInt(pMac,
8311 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8312 != eSIR_SUCCESS)
8313 {
8314 limLog(pMac, LOGE, FL("Fail to retrieve"
8315 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8316 return ;
8317 }
8318 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8319 cfgValue;
8320
8321
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308322 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8323 &cfgValue) != eSIR_SUCCESS)
8324 {
8325 limLog(pMac, LOGE, FL("Fail to retrieve "
8326 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8327 return ;
8328 }
8329 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308330}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308331
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308332const char * lim_ScanTypetoString(const v_U8_t scanType)
8333{
8334 switch (scanType)
8335 {
8336 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8337 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8338 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8339 default:
8340 return "Unknown ScanType";
8341 }
8342}
8343
8344const char * lim_BssTypetoString(const v_U8_t bssType)
8345{
8346 switch (bssType)
8347 {
8348 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8349 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8350 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8351 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8352 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8353 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8354 default:
8355 return "Unknown BssType";
8356 }
8357}
8358
8359const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8360{
8361 switch (mode)
8362 {
8363 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8364 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8365 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8366 default:
8367 return "Unknown BgScanMode";
8368 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308369}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308370
8371#ifdef WLAN_FEATURE_11W
8372/**
8373 *
8374 * \brief This function is called by various LIM modules to correctly set
8375 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8376 *
8377 *
8378 * \param pMac Pointer to Global MAC structure
8379 *
8380 * \param psessionEntry Pointer to session corresponding to the connection
8381 *
8382 * \param peer Peer address of the STA to which the frame is to be sent
8383 *
8384 * \param pMacHdr Pointer to the frame MAC header
8385 *
8386 * \return nothing
8387 *
8388 *
8389 */
8390void
8391limSetProtectedBit(tpAniSirGlobal pMac,
8392 tpPESession psessionEntry,
8393 tSirMacAddr peer,
8394 tpSirMacMgmtHdr pMacHdr)
8395{
8396 tANI_U16 aid;
8397 tpDphHashNode pStaDs;
8398
8399 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8400 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8401 {
8402
8403 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8404 &psessionEntry->dph.dphHashTable );
8405 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308406 /* rmfenabled will be set at the time of addbss.
8407 * but sometimes EAP auth fails and keys are not
8408 * installed then if we send any management frame
8409 * like deauth/disassoc with this bit set then
8410 * firmware crashes. so check for keys are
8411 * installed or not also before setting the bit
8412 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308413 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308414 pMacHdr->fc.wep = 1;
8415 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308416 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308417 pMacHdr->fc.wep = 1;
8418} /*** end limSetProtectedBit() ***/
8419#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308420
8421tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8422{
8423 int left = length;
8424 tANI_U8 *ptr = pIes;
8425 tANI_U8 elem_id,elem_len;
8426
8427 while (left >= 2)
8428 {
8429 elem_id = ptr[0];
8430 elem_len = ptr[1];
8431 left -= 2;
8432
8433 if (elem_len > left)
8434 {
8435 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8436 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8437 eid,elem_len,left);
8438 return NULL;
8439 }
8440 if (elem_id == eid)
8441 {
8442 return ptr;
8443 }
8444
8445 left -= elem_len;
8446 ptr += (elem_len + 2);
8447 }
8448 return NULL;
8449}
8450
8451
8452void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8453{
8454
8455 tANI_U32 nPayload;
8456 tANI_U8 *pPayload;
8457 tANI_U8 *ieptr;
8458 tSirMacTim *tim;
8459
8460 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8461 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8462
8463 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8464 {
8465 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8466 return;
8467 }
8468
8469 if (NULL !=
8470 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8471 nPayload, SIR_MAC_TIM_EID)))
8472 {
8473 /* Ignore EID and Length field*/
8474 tim = (tSirMacTim *)(ieptr + 2);
8475
8476 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8477 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8478 if (tim->dtimCount >= MAX_DTIM_COUNT)
8479 tim->dtimCount = DTIM_COUNT_DEFAULT;
8480 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8481 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8482 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8483 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8484 psessionEntry->currentBssBeaconCnt++;
8485
8486 limLog(pMac, LOG1,
8487 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8488 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8489 psessionEntry->lastBeaconDtimPeriod);
8490
8491 }
8492 return;
8493}
Girish Gowlia95daca2015-02-04 20:31:31 +05308494
8495void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8496 tANI_U8 smeSessionId,
8497 tANI_U32 maxRateFlag)
8498{
8499 tpSirSmeUpdateMaxRateParams pRsp;
8500 tSirMsgQ msg;
8501
8502 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8503 if (NULL == pRsp)
8504 {
8505 limLog(pMac, LOGP, FL("Memory allocation failed"));
8506 return;
8507 }
8508 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8509 pRsp->maxRateFlag = maxRateFlag;
8510 pRsp->smeSessionId = smeSessionId;
8511 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8512 msg.bodyptr = pRsp;
8513 msg.bodyval = 0;
8514 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8515 return;
8516}
Abhishek Singh5d765712015-03-12 14:04:16 +05308517
8518void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8519{
8520 if( pMac->sys.gSysBbtPendingMgmtCount )
8521 {
8522 vos_spin_lock_acquire( &pMac->sys.lock );
8523 pMac->sys.gSysBbtPendingMgmtCount--;
8524 vos_spin_lock_release( &pMac->sys.lock );
8525 }
8526 else
8527 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8528}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308529
8530eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8531{
8532 tpSirTxBdStatus pTxBdStatus;
8533
8534 if (!pData)
8535 {
8536 limLog(pMac, LOGE, FL("pData is NULL"));
8537 return eHAL_STATUS_FAILURE;
8538 }
8539
8540 pTxBdStatus = (tpSirTxBdStatus) pData;
8541
8542 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8543 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8544 return eHAL_STATUS_SUCCESS;
8545}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308546
Kapil Gupta956c0c42017-06-16 19:24:31 +05308547eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8548{
8549 tpSirTxBdStatus pTxBdStatus;
8550 tpDphHashNode pStaDs;
8551 tpPESession psessionEntry;
8552 VOS_STATUS vosStatus;
8553 vos_list_node_t *pNode= NULL, *pNext = NULL;
8554 assoc_rsp_tx_context *tmp_tx_context = NULL;
8555
8556 if (!pData)
8557 {
8558 limLog(pMac, LOGE, FL("pData is NULL"));
8559 return eHAL_STATUS_FAILURE;
8560 }
8561
8562 pTxBdStatus = (tpSirTxBdStatus) pData;
8563
8564 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8565 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8566
8567 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8568 &pNode);
8569
8570 while(pNode)
8571 {
8572 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8573 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8574 {
8575 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8576 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8577
8578 vosStatus = vos_list_peek_next (
8579 &pMac->assoc_rsp_completion_list,
8580 pNode, &pNext );
8581 pNode = pNext;
8582 pNext = NULL;
8583 }
8584 else
8585 {
8586 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8587 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8588 break;
8589 }
8590 }
8591
8592 if (!tmp_tx_context) {
8593 limLog(pMac, LOGE, FL("context is NULL"));
8594 return eHAL_STATUS_SUCCESS;
8595 }
8596 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8597 if (!psessionEntry) {
8598 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8599 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8600 pNode);
8601 vos_mem_free(tmp_tx_context);
8602 return eHAL_STATUS_SUCCESS;
8603 }
8604 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8605 &psessionEntry->dph.dphHashTable);
8606 if (pStaDs == NULL)
8607 {
8608 limLog(pMac, LOGW,
8609 FL("STA context not found"));
8610 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8611 pNode);
8612 vos_mem_free(tmp_tx_context);
8613
8614 return eHAL_STATUS_SUCCESS;
8615 }
8616
8617 /* Receive path cleanup */
8618 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8619 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8620 pNode);
8621 vos_mem_free(tmp_tx_context);
8622
8623 return eHAL_STATUS_SUCCESS;
8624}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308625/**
8626 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8627 * robust action frame
8628 * @action_catagory: Action frame catagory.
8629 *
8630 * This function is used to check if given action catagory is robust
8631 * action frame.
8632 *
8633 * Return: bool
8634 */
8635bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8636{
8637 switch (action_catagory) {
8638 /*
8639 * NOTE: This function doesn't take care of the DMG
8640 * (Directional Multi-Gigatbit) BSS case as 8011ad
8641 * support is not yet added. In future, if the support
8642 * is required then this function need few more arguments
8643 * and little change in logic.
8644 */
8645 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8646 case SIR_MAC_ACTION_QOS_MGMT:
8647 case SIR_MAC_ACTION_DLP:
8648 case SIR_MAC_ACTION_BLKACK:
8649 case SIR_MAC_ACTION_RRM:
8650 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8651 case SIR_MAC_ACTION_SA_QUERY:
8652 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8653 case SIR_MAC_ACTION_WNM:
8654 case SIR_MAC_ACITON_MESH:
8655 case SIR_MAC_ACTION_MHF:
8656 case SIR_MAC_ACTION_FST:
8657 return true;
8658 default:
8659 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8660 FL("non-PMF action category[%d] "),
8661 action_catagory);
8662 break;
8663 }
8664 return false;
8665}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308666
8667/**
Hu Wangc12631c2016-08-11 09:57:03 +08008668 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8669 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308670 * @ext_cap: extended IEs structure
8671 *
Hu Wangc12631c2016-08-11 09:57:03 +08008672 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308673 */
Hu Wangc12631c2016-08-11 09:57:03 +08008674tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8675 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308676
Hu Wangc12631c2016-08-11 09:57:03 +08008677 while (i) {
8678 if (ext_cap->bytes[i-1]) {
8679 break;
8680 }
8681 i --;
8682 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308683
Hu Wangc12631c2016-08-11 09:57:03 +08008684 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308685}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308686
8687/**
8688 * lim_update_caps_info_for_bss - Update capability info for this BSS
8689 *
8690 * @mac_ctx: mac context
8691 * @caps: Pointer to capability info to be updated
8692 * @bss_caps: Capability info of the BSS
8693 *
8694 * Update the capability info in Assoc/Reassoc request frames and reset
8695 * the spectrum management, short preamble, immediate block ack bits
8696 * if the BSS doesnot support it
8697 *
8698 * Return: None
8699 */
8700void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8701 uint16_t *caps, uint16_t bss_caps)
8702{
8703 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8704 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8705 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8706 }
8707
8708 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8709 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8710 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8711 }
8712
8713 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8714 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8715 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8716 }
8717}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308718#ifdef SAP_AUTH_OFFLOAD
8719/**
8720 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8721 *
8722 * @pmac: mac context
8723 * @assoc_req: Assoc request
8724 * @add_sta_req: Add Sta request
8725 *
8726 * This function process recieved add sta message and store it as
8727 * sta ds entry. This function will add this sta entry to DPH as well.
8728 *
8729 * Return: DPH hash node
8730 */
8731static tpDphHashNode
8732_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8733 tpSirAssocReq assoc_req,
8734 tSapOfldAddStaIndMsg *add_sta_req)
8735{
8736 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8737 tpSirAssocReq temp_assoc_req;
8738 tSirRetStatus status;
8739 tpDphHashNode sta_ds = NULL;
8740 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308741 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308742
8743 tpPESession session_entry = limIsApSessionActive(pmac);
8744
8745 if (session_entry == NULL)
8746 {
8747 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8748 return NULL;
8749 }
8750
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308751 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8752 {
8753 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8754 return NULL;
8755 }
8756
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308757 /* Update Attribute and Remove IE for
8758 * Software AP Authentication Offload
8759 */
8760 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308761
8762 /*
8763 * strip MAC mgmt header before passing buf to
8764 * sirConvertAssocReqFrame2Struct() as this API
8765 * expects buf starting from fixed parameters only.
8766 */
8767 frame_body += sizeof(tSirMacMgmtHdr);
8768 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8769
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308770 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8771 mac_assoc_req->capabilityInfo.privacy = 0;
8772
8773 status = sirConvertAssocReqFrame2Struct(pmac,
8774 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308775 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308776 assoc_req);
8777 if (status != eSIR_SUCCESS)
8778 {
8779 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8780 goto error;
8781 }
8782 /* For software AP Auth Offload feature
8783 * Host will take it as none security station
8784 * Force change to none security
8785 */
8786 assoc_req->rsnPresent = 0;
8787 assoc_req->wpaPresent = 0;
8788
8789 sta_ds = dphAddHashEntry(pmac,
8790 add_sta_req->peer_macaddr,
8791 add_sta_req->assoc_id,
8792 &session_entry->dph.dphHashTable);
8793 if (sta_ds == NULL)
8794 {
8795 /* Could not add hash table entry at DPH */
8796 limLog(pmac, LOGE,
8797 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8798 MAC_ADDRESS_STR),
8799 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8800 goto error;
8801 }
8802
8803 if (session_entry->parsedAssocReq != NULL)
8804 {
8805 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8806 if (temp_assoc_req != NULL)
8807 {
8808 if (temp_assoc_req->assocReqFrame)
8809 {
8810 vos_mem_free(temp_assoc_req->assocReqFrame);
8811 temp_assoc_req->assocReqFrame = NULL;
8812 temp_assoc_req->assocReqFrameLength = 0;
8813 }
8814 vos_mem_free(temp_assoc_req);
8815 temp_assoc_req = NULL;
8816 }
8817 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8818 }
8819error:
8820 return sta_ds;
8821}
8822
8823/**
8824 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8825 *
8826 * @sta_ds: STA state node
8827 * @assoc_req: Assoc request
8828 * @add_sta_req: Add Sta request
8829 *
8830 * This function process recieved add sta message and store station's caps
8831 * in station ds entry.
8832 *
8833 * Return: none
8834 */
8835static void
8836_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
8837 tpSirAssocReq assoc_req,
8838 tSapOfldAddStaIndMsg *add_sta_req)
8839
8840{
8841
8842 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
8843#ifdef WLAN_FEATURE_11AC
8844 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
8845#endif
8846 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
8847 sta_ds->qos.addts = assoc_req->addtsReq;
8848 sta_ds->qos.capability = assoc_req->qosCapability;
8849 sta_ds->versionPresent = 0;
8850 /* short slot and short preamble should be
8851 * updated before doing limaddsta
8852 */
8853 sta_ds->shortPreambleEnabled =
8854 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
8855 sta_ds->shortSlotTimeEnabled =
8856 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
8857
8858 sta_ds->valid = 0;
8859 /* The Auth Type of Software AP Authentication Offload
8860 * is always Open System is host side
8861 */
8862 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
8863 sta_ds->staType = STA_ENTRY_PEER;
8864
8865 /* Assoc Response frame to requesting STA */
8866 sta_ds->mlmStaContext.subType = 0;
8867
8868 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
8869 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
8870
8871 /* The following count will be used to knock-off the station
8872 * if it doesn't come back to receive the buffered data.
8873 * The AP will wait for numTimSent number of beacons after
8874 * sending TIM information for the station, before assuming that
8875 * the station is no more associated and disassociates it
8876 */
8877
8878 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
8879 sta_ds->timWaitCount =
8880 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
8881
8882 /* Initialise the Current successful
8883 * MPDU's tranfered to this STA count as 0
8884 */
8885 sta_ds->curTxMpduCnt = 0;
8886}
8887
8888/**
8889 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
8890 *
8891 * @pmac: mac context
8892 * @sta_ds: STA state node
8893 * @assoc_req: Assoc request
8894 *
8895 * This function process recieved add sta message and store station's HT and
8896 * and VHT caps and store them in station ds entry.
8897 *
8898 * Return: tSirRetStatus
8899 */
8900static tSirRetStatus
8901_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
8902 tpDphHashNode sta_ds,
8903 tpSirAssocReq assoc_req)
8904{
8905 tpPESession session_entry = limIsApSessionActive(pmac);
8906
8907 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
8908 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
8909 {
8910 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
8911 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
8912 sta_ds->htDsssCckRate40MHzSupport =
8913 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
8914 sta_ds->htLsigTXOPProtection =
8915 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
8916 sta_ds->htMaxAmsduLength =
8917 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
8918 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
8919 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
8920 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
8921 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
8922 sta_ds->htSupportedChannelWidthSet =
8923 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
8924 /* peer just follows AP; so when we are softAP/GO,
8925 * we just store our session entry's secondary channel offset here
8926 * in peer INFRA STA. However, if peer's 40MHz channel width support
8927 * is disabled then secondary channel will be zero
8928 */
8929 sta_ds->htSecondaryChannelOffset =
8930 (sta_ds->htSupportedChannelWidthSet) ?
8931 session_entry->htSecondaryChannelOffset : 0;
8932#ifdef WLAN_FEATURE_11AC
8933 if (assoc_req->operMode.present)
8934 {
8935 sta_ds->vhtSupportedChannelWidthSet =
8936 (tANI_U8)((assoc_req->operMode.chanWidth ==
8937 eHT_CHANNEL_WIDTH_80MHZ) ?
8938 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
8939 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
8940 sta_ds->htSupportedChannelWidthSet =
8941 (tANI_U8)(assoc_req->operMode.chanWidth ?
8942 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
8943 }
8944 else if (assoc_req->VHTCaps.present)
8945 {
8946 /* Check if STA has enabled it's channel bonding mode.
8947 * If channel bonding mode is enabled, we decide based on
8948 * SAP's current configuration else, we set it to VHT20.
8949 */
8950 sta_ds->vhtSupportedChannelWidthSet =
8951 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
8952 eHT_CHANNEL_WIDTH_20MHZ) ?
8953 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
8954 session_entry->vhtTxChannelWidthSet );
8955 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
8956 }
8957
8958 /* Lesser among the AP and STA bandwidth of operation. */
8959 sta_ds->htSupportedChannelWidthSet =
8960 (sta_ds->htSupportedChannelWidthSet <
8961 session_entry->htSupportedChannelWidthSet) ?
8962 sta_ds->htSupportedChannelWidthSet :
8963 session_entry->htSupportedChannelWidthSet ;
8964#endif
8965 sta_ds->baPolicyFlag = 0xFF;
8966 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
8967 }
8968
8969 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
8970 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
8971
8972 if (!assoc_req->wmeInfoPresent)
8973 {
8974 sta_ds->mlmStaContext.htCapability = 0;
8975#ifdef WLAN_FEATURE_11AC
8976 sta_ds->mlmStaContext.vhtCapability = 0;
8977#endif
8978 }
8979#ifdef WLAN_FEATURE_11AC
8980 if (limPopulateMatchingRateSet(pmac,
8981 sta_ds,
8982 &(assoc_req->supportedRates),
8983 &(assoc_req->extendedRates),
8984 assoc_req->HTCaps.supportedMCSSet,
8985 &(assoc_req->propIEinfo.propRates),
8986 session_entry , &assoc_req->VHTCaps)
8987 != eSIR_SUCCESS)
8988 {
8989#else
8990 if (limPopulateMatchingRateSet(pmac,
8991 sta_ds,
8992 &(assoc_req->supportedRates),
8993 &(assoc_req->extendedRates),
8994 assoc_req->HTCaps.supportedMCSSet,
8995 &(assoc_req->propIEinfo.propRates),
8996 session_entry) != eSIR_SUCCESS)
8997 {
8998#endif
8999 limLog(pmac, LOGE,
9000 FL("Rate set mismatched for aid=%d, MacAddr: "
9001 MAC_ADDRESS_STR),
9002 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9003 goto error;
9004 }
9005 return eSIR_SUCCESS;
9006error:
9007 return eSIR_FAILURE;
9008}
9009
9010/**
9011 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9012 *
9013 * @pmac: mac context
9014 * @sta_ds: STA state node
9015 * @assoc_req: Assoc request
9016 *
9017 * This function process recieved add sta message and store station's QOS
9018 * store them in station ds entry.
9019 *
9020 * Return: none
9021 */
9022static void
9023 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9024 tpDphHashNode sta_ds,
9025 tpSirAssocReq assoc_req)
9026{
9027 tHalBitVal qos_mode;
9028 tHalBitVal wsm_mode, wme_mode;
9029 tpPESession session_entry = limIsApSessionActive(pmac);
9030
9031 limGetQosMode(session_entry, &qos_mode);
9032 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9033 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9034
9035 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9036 {
9037 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9038 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9039 }
9040
9041 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9042 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9043 limGetWmeMode(session_entry, &wme_mode);
9044 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9045 (wme_mode == eHAL_SET))
9046 {
9047 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9048 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9049 limGetWsmMode(session_entry, &wsm_mode);
9050 /* WMM_APSD - WMM_SA related processing should be
9051 * separate; WMM_SA and WMM_APSD can coexist
9052 */
9053 if (assoc_req->WMMInfoStation.present)
9054 {
9055 /* check whether AP supports or not */
9056 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9057 && (session_entry->apUapsdEnable == 0) &&
9058 (assoc_req->WMMInfoStation.acbe_uapsd
9059 || assoc_req->WMMInfoStation.acbk_uapsd
9060 || assoc_req->WMMInfoStation.acvo_uapsd
9061 || assoc_req->WMMInfoStation.acvi_uapsd))
9062 {
9063 /*
9064 * Received Re/Association Request from
9065 * STA when UPASD is not supported
9066 */
9067 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9068 "to STA accordingly" ));
9069 /* update UAPSD and send it to LIM to add STA */
9070 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9071 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9072 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9073 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9074 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9075 }
9076 else
9077 {
9078 /* update UAPSD and send it to LIM to add STA */
9079 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9080 assoc_req->WMMInfoStation.acbe_uapsd;
9081 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9082 assoc_req->WMMInfoStation.acbk_uapsd;
9083 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9084 assoc_req->WMMInfoStation.acvo_uapsd;
9085 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9086 assoc_req->WMMInfoStation.acvi_uapsd;
9087 sta_ds->qos.capability.qosInfo.maxSpLen =
9088 assoc_req->WMMInfoStation.max_sp_length;
9089 }
9090 }
9091 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9092 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9093 }
9094}
9095
9096/**
9097 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9098 *
9099 * @pmac: mac context
9100 * @lim_msgq: Add Sta indication buffer
9101 *
9102 * This function will recieve buffer from firmware. This buffer will store
9103 * information about connected client. driver will process this buffer and
9104 * will register this client with driver. Driver will call limAddSta
9105 *
9106 * Return: none
9107 */
9108void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9109 tSapOfldAddStaIndMsg *lim_msgq)
9110{
9111 tpSirAssocReq assoc_req = NULL;
9112 tpDphHashNode sta_ds = NULL;
9113
9114 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9115 tpPESession session_entry = limIsApSessionActive(pmac);
9116
9117 if (session_entry == NULL)
9118 {
9119 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9120 return;
9121 }
9122 add_sta_req = lim_msgq;
9123 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9124 if (NULL == assoc_req) {
9125 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9126 return;
9127 }
9128 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9129
9130 /* parse Assoc req frame for station information */
9131 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9132 if (sta_ds == NULL)
9133 {
9134 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9135 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9136 vos_mem_free(assoc_req);
9137 goto error;
9138 }
9139
9140 /* Parse Station Capability */
9141 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9142
9143 /* Parse Station HT/VHT information */
9144 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9145 == eSIR_FAILURE)
9146 {
9147 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9148 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9149 vos_mem_free(assoc_req);
9150 goto error;
9151
9152 }
9153
9154 /* Parse Station QOS information */
9155 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9156
9157 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9158 sta_ds->staIndex = add_sta_req->staIdx;
9159 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9160 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9161 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9162 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9163 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9164 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309165 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309166
Agrawal Ashishce67f362017-01-05 20:10:58 +05309167 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9168 sta_ds->staIndex,
9169 sta_ds->bssId,
9170 sta_ds->dpuIndex,
9171 sta_ds->bcastDpuIndex,
9172 sta_ds->bcastMgmtDpuIdx,
9173 sta_ds->ucUcastSig,
9174 sta_ds->ucBcastSig,
9175 sta_ds->ucMgmtSig,
9176 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309177
9178 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9179 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9180 sta_ds->assocId);
9181 }
9182
9183error:
9184 return;
9185}
9186
9187/**
9188 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9189 *
9190 * @pmac: mac context
9191 * @lim_msgq: Del Sta indication buffer
9192 *
9193 * This function will recieve buffer from firmware. This buffer will
9194 * have information about clinet to remove with reason code.
9195 * This function will call limSendSmeDisassocInd to do cleanup
9196 * for station entry
9197 *
9198 * Return: none
9199 */
9200void
9201lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9202{
9203 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9204 tpDphHashNode sta_ds = NULL;
9205 tANI_U16 assoc_id = 0;
9206 tpPESession psession_entry = limIsApSessionActive(pmac);
9207
9208 if (psession_entry == NULL)
9209 {
9210 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9211 goto error;
9212 }
9213
9214 del_sta_req = lim_msgq;
9215 sta_ds = dphLookupHashEntry(pmac,
9216 del_sta_req->peer_macaddr,
9217 &assoc_id,
9218 &psession_entry->dph.dphHashTable);
9219 if (sta_ds == NULL)
9220 {
9221 /*
9222 * Disassociating STA is not associated.
9223 * Log error
9224 */
9225 PELOGE(limLog(pmac, LOGE,
9226 FL("received del sta event that sta not exist in table "
9227 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9228 del_sta_req->reason,
9229 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9230 goto error;
9231 }
9232
9233 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9234 {
9235 /*
9236 * Associate Id mismatch
9237 * Log error
9238 */
9239 PELOGE(limLog(pmac, LOGE,
9240 FL("received del sta event that sta assoc Id mismatch"));)
9241 goto error;
9242 }
9243
9244 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9245 sta_ds->mlmStaContext.disassocReason =
9246 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309247
9248 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9249
9250error:
9251 return;
9252}
9253#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309254
9255int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9256{
9257 tANI_U8 i;
9258 tpPESession psessionEntry = NULL;
9259
9260 for(i =0; i < pMac->lim.maxBssId; i++)
9261 {
9262 /* If BSSID matches return corresponding tables address*/
9263 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9264 {
9265 psessionEntry = (&pMac->lim.gpSession[i]);
9266 return psessionEntry->bssIdx;
9267 }
9268 }
9269
9270 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9271 return(0xFF);
9272}