blob: b8219c3f42866c74426a69b68db5a4849285193a [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/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302739 * lim_process_ecsa_ie()- Process ECSA IE in beacon/ probe resp
2740 * @mac_ctx: pointer to global mac structure
2741 * @ecsa_ie: ecsa ie
2742 * @session: Session entry.
2743 *
2744 * This function is called when ECSA IE is received on STA interface.
2745 *
2746 * Return: void
2747 */
2748static void
2749lim_process_ecsa_ie(tpAniSirGlobal mac_ctx,
2750 tDot11fIEext_chan_switch_ann *ecsa_ie, tpPESession session)
2751{
2752 struct ecsa_frame_params ecsa_req;
2753
2754 limLog(mac_ctx, LOG1, FL("Received ECSA IE in beacon/probe resp"));
2755
2756 if (session->currentOperChannel == ecsa_ie->new_channel) {
2757 limLog(mac_ctx, LOGE, FL("New channel %d is same as old channel ignore req"),
2758 ecsa_ie->new_channel);
2759 return;
2760 }
2761
2762 ecsa_req.new_channel = ecsa_ie->new_channel;
2763 ecsa_req.op_class = ecsa_ie->new_reg_class;
2764 ecsa_req.switch_mode = ecsa_ie->switch_mode;
2765 ecsa_req.switch_count = ecsa_ie->switch_count;
2766 limLog(mac_ctx, LOG1, FL("New channel %d op class %d switch mode %d switch count %d"),
2767 ecsa_req.new_channel, ecsa_req.op_class,
2768 ecsa_req.switch_mode, ecsa_req.switch_count);
2769
2770 lim_handle_ecsa_req(mac_ctx, &ecsa_req, session);
2771}
2772
2773
2774/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 * limUpdateChannelSwitch()
2776 *
2777 *FUNCTION:
2778 * This function is invoked whenever Station receives
2779 * either 802.11h channel switch IE or airgo proprietary
2780 * channel switch IE.
2781 *
2782 *NOTE:
2783 * @param pMac - Pointer to Global MAC structure
2784 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2785 * @param psessionentry
2786 */
2787void
2788limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2789{
2790
2791 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2793 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002794#ifdef WLAN_FEATURE_11AC
2795 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2796#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302797 if (pBeacon->ecsa_present)
2798 return lim_process_ecsa_ie(pMac,
2799 &pBeacon->ext_chan_switch_ann, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002800
Jeff Johnsone7245742012-09-05 17:12:55 -07002801 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002802
2803 /* STA either received proprietary channel switch IE or 802.11h
2804 * standard channel switch IE.
2805 */
2806 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2807 {
2808 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2809
2810 /* Add logic to determine which change this is: */
2811 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002812 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2813 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2814 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2815 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2816 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002818 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 }
2820 else
2821 {
2822 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002823 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2824 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2825 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002827 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002828#ifdef WLAN_FEATURE_11AC
2829 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2830 if(pBeacon->WiderBWChanSwitchAnnPresent)
2831 {
2832 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2833 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2834 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2835 }
2836#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002837
2838 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002839 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2840 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002841
2842 /* Do not bother to look and operate on extended channel switch element
2843 * if our own channel-bonding state is not enabled
2844 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002845 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302847 if (pBeacon->sec_chan_offset_present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302849 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2850 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002852 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +05302853 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002855#ifdef WLAN_FEATURE_11AC
2856 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2857 {
2858 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2859 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302860 if(pBeacon->sec_chan_offset_present)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002861 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302862 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2863 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002864 {
2865 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2866 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2867 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +05302868 pBeacon->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002869 pWiderChnlSwitch->newCenterChanFreq0,
2870 psessionEntry);
2871 }
2872 }
2873 }
2874 }
2875#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 }
2877 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002878 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002879
2880
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2882 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002883 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 }
2885
2886 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002887 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002888 psessionEntry->peSessionId,
2889 psessionEntry->gLimChannelSwitch.primaryChannel,
2890 psessionEntry->gLimChannelSwitch.secondarySubBand,
2891 psessionEntry->gLimChannelSwitch.switchCount,
2892 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 return;
2894}
2895
2896/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302897 * lim_select_cbmode()- select cb mode for the channel and BW
2898 * @sta_ds: peer sta
2899 * @channel: channel
2900 * @chan_bw: BW
2901 *
2902 * Return: cb mode for a channel and BW
2903 */
2904static inline int lim_select_cbmode(tDphHashNode *sta_ds, uint8_t channel,
2905 uint8_t chan_bw)
2906{
2907 if (sta_ds->mlmStaContext.vhtCapability && chan_bw) {
2908 if (channel== 36 || channel == 52 || channel == 100 ||
2909 channel == 116 || channel == 149)
2910 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
2911 else if (channel == 40 || channel == 56 || channel == 104 ||
2912 channel == 120 || channel == 153)
2913 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
2914 else if (channel == 44 || channel == 60 || channel == 108 ||
2915 channel == 124 || channel == 157)
2916 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
2917 else if (channel == 48 || channel == 64 || channel == 112 ||
2918 channel == 128 || channel == 161)
2919 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
2920 else if (channel == 165)
2921 return PHY_SINGLE_CHANNEL_CENTERED;
2922 } else if (sta_ds->mlmStaContext.htCapability) {
2923 if (channel== 40 || channel == 48 || channel == 56 ||
2924 channel == 64 || channel == 104 || channel == 112 ||
2925 channel == 120 || channel == 128 || channel == 136 ||
2926 channel == 144 || channel == 153 || channel == 161)
2927 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
2928 else if (channel== 36 || channel == 44 || channel == 52 ||
2929 channel == 60 || channel == 100 || channel == 108 ||
2930 channel == 116 || channel == 124 || channel == 132 ||
2931 channel == 140 || channel == 149 || channel == 157)
2932 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
2933 else if (channel == 165)
2934 return PHY_SINGLE_CHANNEL_CENTERED;
2935 }
2936 return PHY_SINGLE_CHANNEL_CENTERED;
2937}
2938
2939void lim_handle_ecsa_req(tpAniSirGlobal mac_ctx, struct ecsa_frame_params *ecsa_req,
2940 tpPESession session)
2941{
2942 offset_t ch_offset;
2943 tpDphHashNode sta_ds = NULL ;
2944 uint16_t aid = 0;
2945
2946 if (!LIM_IS_STA_ROLE(session)) {
2947 limLog(mac_ctx, LOGE, FL("Session not in sta role"));
2948 return;
2949 }
2950
2951 sta_ds = dphLookupHashEntry(mac_ctx, session->bssId, &aid,
2952 &session->dph.dphHashTable);
2953 if (!sta_ds) {
2954 limLog(mac_ctx, LOGE, FL("pStaDs does not exist for given sessionID"));
2955 return;
2956 }
2957
2958 session->gLimChannelSwitch.primaryChannel = ecsa_req->new_channel;
2959 session->gLimChannelSwitch.switchCount = ecsa_req->switch_count;
2960 session->gLimChannelSwitch.switchTimeoutValue =
2961 SYS_MS_TO_TICKS(session->beaconParams.beaconInterval) *
2962 ecsa_req->switch_count;
2963 session->gLimChannelSwitch.switchMode = ecsa_req->switch_mode;
2964
2965 /* Only primary channel switch element is present */
2966 session->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2967 session->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
2968 session->gLimWiderBWChannelSwitch.newChanWidth = 0;
2969
2970 ch_offset = limGetOffChMaxBwOffsetFromChannel(
2971 mac_ctx->scan.countryCodeCurrent,
2972 ecsa_req->new_channel,
2973 sta_ds->mlmStaContext.vhtCapability);
2974 if (ch_offset == BW80) {
2975 session->gLimWiderBWChannelSwitch.newChanWidth =
2976 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
2977 } else {
2978 session->gLimWiderBWChannelSwitch.newChanWidth =
2979 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
2980 }
2981
2982 /*
2983 * Do not bother to look and operate on extended channel switch element
2984 * if our own channel-bonding state is not enabled
2985 */
2986 if (session->htSupportedChannelWidthSet) {
2987 session->gLimChannelSwitch.secondarySubBand = lim_select_cbmode(sta_ds,
2988 ecsa_req->new_channel,
2989 session->gLimWiderBWChannelSwitch.newChanWidth);
2990 if (session->gLimChannelSwitch.secondarySubBand > 0)
2991 session->gLimChannelSwitch.state =
2992 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2993 }
2994
2995 if (eSIR_SUCCESS != limStartChannelSwitch(mac_ctx, session)) {
2996 limLog(mac_ctx, LOGW, FL("Could not start Channel Switch"));
2997 }
2998
2999 limLog(mac_ctx, LOG1,
3000 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
3001 session->peSessionId,
3002 session->gLimChannelSwitch.primaryChannel,
3003 session->gLimChannelSwitch.secondarySubBand,
3004 session->gLimChannelSwitch.switchCount,
3005 session->gLimChannelSwitch.switchTimeoutValue);
3006}
3007
3008/**
Jeff Johnson295189b2012-06-20 16:38:30 -07003009 * limCancelDot11hChannelSwitch
3010 *
3011 *FUNCTION:
3012 * This function is called when STA does not send updated channel-swith IE
3013 * after indicating channel-switch start. This will cancel the channel-swith
3014 * timer which is already running.
3015 *
3016 *LOGIC:
3017 *
3018 *ASSUMPTIONS:
3019 *
3020 *NOTE:
3021 *
3022 * @param pMac - Pointer to Global MAC structure
3023 *
3024 * @return None
3025 */
3026void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
3027{
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3029 return;
3030
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003031 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003032 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003033
3034 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
3035 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003036 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 }
3038
3039 /* We need to restore pre-channelSwitch state on the STA */
3040 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3041 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003042 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003043
3044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003045}
3046
3047/**----------------------------------------------
3048\fn limCancelDot11hQuiet
3049\brief Cancel the quieting on Station if latest
3050 beacon doesn't contain quiet IE in it.
3051
3052\param pMac
3053\return NONE
3054-----------------------------------------------*/
3055void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
3056{
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3058 return;
3059
Jeff Johnsone7245742012-09-05 17:12:55 -07003060 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003062 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
3064 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003065 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 }
3067 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003068 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07003069 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003070 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
3072 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003073 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 }
3075 /**
3076 * If the channel switch is already running in silent mode, dont resume the
3077 * transmission. Channel switch timer when timeout, transmission will be resumed.
3078 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003079 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3080 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 {
3082 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003083 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003084 }
3085 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003086 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003087}
3088
3089/**
3090 * limProcessQuietTimeout
3091 *
3092 * FUNCTION:
3093 * This function is active only on the STA.
3094 * Handles SIR_LIM_QUIET_TIMEOUT
3095 *
3096 * LOGIC:
3097 * This timeout can occur under only one circumstance:
3098 *
3099 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
3100 * This indicates that the timeout "interval" has
3101 * expired. This is a trigger for the STA to now
3102 * shut-off Tx/Rx for the specified gLimQuietDuration
3103 * -> The TIMER object gLimQuietBssTimer is
3104 * activated
3105 * -> With timeout = gLimQuietDuration
3106 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
3107 *
3108 * ASSUMPTIONS:
3109 * Using two TIMER objects -
3110 * gLimQuietTimer & gLimQuietBssTimer
3111 *
3112 * NOTE:
3113 *
3114 * @param pMac - Pointer to Global MAC structure
3115 *
3116 * @return None
3117 */
3118void limProcessQuietTimeout(tpAniSirGlobal pMac)
3119{
Jeff Johnson295189b2012-06-20 16:38:30 -07003120 //fetch the sessionEntry based on the sessionId
3121 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07003122 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003123
Jeff Johnsone7245742012-09-05 17:12:55 -07003124 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003126 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 return;
3128 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003129
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303130 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003131 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003132 {
3133 case eLIM_QUIET_BEGIN:
3134 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
3136 if (TX_SUCCESS !=
3137 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
3138 {
3139 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003140 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003141 }
3142
3143 // gLimQuietDuration appears to be in units of ticks
3144 // Use it as is
3145 if (TX_SUCCESS !=
3146 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
3147 psessionEntry->gLimSpecMgmt.quietDuration,
3148 0))
3149 {
3150 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003151 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003152 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003153 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003154#ifdef GEN6_TODO
3155 /* revisit this piece of code to assign the appropriate sessionId below
3156 * priority - HIGH
3157 */
3158 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3159#endif
3160 if( TX_SUCCESS !=
3161 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3162 {
3163 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003164 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003165 }
3166 else
3167 {
3168 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003169 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003170
3171 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3172 /* print message, otherwise, stop data traffic and stay quiet */
3173 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3174 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3175 {
3176 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003177 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003178 }
3179 else
3180 {
3181 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3182 /* freeze the transmission */
3183 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3184
3185 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003186 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003187 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 }
3189 }
3190 break;
3191
3192 case eLIM_QUIET_RUNNING:
3193 case eLIM_QUIET_INIT:
3194 case eLIM_QUIET_END:
3195 default:
3196 //
3197 // As of now, nothing to be done
3198 //
3199 break;
3200 }
3201}
3202
3203/**
3204 * limProcessQuietBssTimeout
3205 *
3206 * FUNCTION:
3207 * This function is active on the AP and STA.
3208 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3209 *
3210 * LOGIC:
3211 * On the AP -
3212 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3213 * an indication for the AP to START sending out the
3214 * Quiet BSS IE.
3215 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3216 * the 11H spec
3217 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3218 * a Proprietary IE. This will be understood by all the
3219 * TITAN STA's
3220 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3221 * initiate the SCH to include the Quiet BSS IE in all
3222 * its subsequent Beacons/PR's.
3223 * The Quiet BSS IE will be included in all the Beacons
3224 * & PR's until the next DTIM period
3225 *
3226 * On the STA -
3227 * When gLimQuietState = eLIM_QUIET_RUNNING
3228 * This indicates that the STA was successfully shut-off
3229 * for the specified gLimQuietDuration. This is a trigger
3230 * for the STA to now resume data traffic.
3231 * -> gLimQuietState is set to eLIM_QUIET_INIT
3232 *
3233 * ASSUMPTIONS:
3234 *
3235 * NOTE:
3236 *
3237 * @param pMac - Pointer to Global MAC structure
3238 *
3239 * @return None
3240 */
3241void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3242{
Jeff Johnsone7245742012-09-05 17:12:55 -07003243 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003244
Jeff Johnsone7245742012-09-05 17:12:55 -07003245 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003247 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return;
3249 }
3250
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303251 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003252 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 }
3255 else
3256 {
3257 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003258 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 {
3260 case eLIM_QUIET_RUNNING:
3261 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003262 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003263
3264 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3265 {
3266 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003267 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3268 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 {
3270 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 }
3273
3274 /* Reset status flag */
3275 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3276 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3277
3278 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003279 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 }
3281 else
3282 {
3283 //
3284 // Nothing specific to be done in this case
3285 // A background scan that was triggered during
3286 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3287 //
3288 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003289 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 }
3291 break;
3292
3293 case eLIM_QUIET_INIT:
3294 case eLIM_QUIET_BEGIN:
3295 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003296 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 /* If the quiet period has ended, then resume the frame transmission */
3298 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003299 limRestorePreQuietState(pMac, psessionEntry);
3300 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 break;
3302
3303 default:
3304 //
3305 // As of now, nothing to be done
3306 //
3307 break;
3308 }
3309 }
3310}
Jeff Johnson295189b2012-06-20 16:38:30 -07003311/**
3312 * limProcessWPSOverlapTimeout
3313 *
3314 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3315 *
3316 * LOGIC:
3317 *
3318 * ASSUMPTIONS:
3319 *
3320 * NOTE:
3321 *
3322 * @param pMac - Pointer to Global MAC structure
3323 *
3324 * @return None
3325 */
3326#if 0
3327void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3328{
3329
3330 tpPESession psessionEntry;
3331 tANI_U32 sessionId;
3332
3333 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3334 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 }
3337
3338 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3339
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003340 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003341
3342 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3343 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003344 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 return;
3346 }
3347
3348 limWPSPBCTimeout(pMac, psessionEntry);
3349}
3350#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003351
Jeff Johnson295189b2012-06-20 16:38:30 -07003352/**----------------------------------------------
3353\fn limStartQuietTimer
3354\brief Starts the quiet timer.
3355
3356\param pMac
3357\return NONE
3358-----------------------------------------------*/
3359void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3360{
3361 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303362 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363
3364 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003365 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 return;
3367 }
3368
Jeff Johnson295189b2012-06-20 16:38:30 -07003369
3370 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3371 return;
3372 // First, de-activate Timer, if its already active
3373 limCancelDot11hQuiet(pMac, psessionEntry);
3374
Jeff Johnsone7245742012-09-05 17:12:55 -07003375 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3376 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3377 {
3378 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003379 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003380 }
3381
3382 // Set the NEW timeout value, in ticks
3383 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3384 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3385 {
3386 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003387 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003388 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003389
3390 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3391 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3392 {
3393 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003394 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003395 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003396
Jeff Johnsone7245742012-09-05 17:12:55 -07003397 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 return;
3399 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003400}
3401
Jeff Johnson295189b2012-06-20 16:38:30 -07003402
3403/** ------------------------------------------------------------------------ **/
3404/**
3405 * keep track of the number of ANI peers associated in the BSS
3406 * For the first and last ANI peer, we have to update EDCA params as needed
3407 *
3408 * When the first ANI peer joins the BSS, we notify SCH
3409 * When the last ANI peer leaves the BSS, we notfiy SCH
3410 */
3411void
3412limUtilCountStaAdd(
3413 tpAniSirGlobal pMac,
3414 tpDphHashNode pSta,
3415 tpPESession psessionEntry)
3416{
3417
3418 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3419 return;
3420
3421 pSta->fAniCount = 1;
3422
3423 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3424 return;
3425
3426 // get here only if this is the first ANI peer in the BSS
3427 schEdcaProfileUpdate(pMac, psessionEntry);
3428}
3429
3430void
3431limUtilCountStaDel(
3432 tpAniSirGlobal pMac,
3433 tpDphHashNode pSta,
3434 tpPESession psessionEntry)
3435{
3436
3437 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3438 return;
3439
3440 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3441 * then go ahead and update the count and profiles. This ensures
3442 * that the "number of ani station" count is properly incremented/decremented.
3443 */
3444 if (pSta->valid == 1)
3445 return;
3446
3447 pSta->fAniCount = 0;
3448
3449 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3450 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003451 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 pMac->lim.gLimNumOfAniSTAs);
3453 return;
3454 }
3455
3456 pMac->lim.gLimNumOfAniSTAs--;
3457
3458 if (pMac->lim.gLimNumOfAniSTAs != 0)
3459 return;
3460
3461 // get here only if this is the last ANI peer in the BSS
3462 schEdcaProfileUpdate(pMac, psessionEntry);
3463}
3464
Jeff Johnson295189b2012-06-20 16:38:30 -07003465/**
3466 * limSwitchChannelCback()
3467 *
3468 *FUNCTION:
3469 * This is the callback function registered while requesting to switch channel
3470 * after AP indicates a channel switch for spectrum management (11h).
3471 *
3472 *NOTE:
3473 * @param pMac Pointer to Global MAC structure
3474 * @param status Status of channel switch request
3475 * @param data User data
3476 * @param psessionEntry Session information
3477 * @return NONE
3478 */
3479void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3480 tANI_U32 *data, tpPESession psessionEntry)
3481{
3482 tSirMsgQ mmhMsg = {0};
3483 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3484
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3486
3487 /* We need to restore pre-channelSwitch state on the STA */
3488 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3489 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003490 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 return;
3492 }
3493
3494 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303495 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3496 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003498 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 return;
3500 }
3501
3502 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3503 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003504 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3506 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303507 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3509 mmhMsg.bodyval = 0;
3510
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303511 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3512 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003514}
3515
3516/**
3517 * limSwitchPrimaryChannel()
3518 *
3519 *FUNCTION:
3520 * This function changes the current operating channel
3521 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3522 *
3523 *NOTE:
3524 * @param pMac Pointer to Global MAC structure
3525 * @param newChannel new chnannel ID
3526 * @return NONE
3527 */
3528void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3529{
3530#if !defined WLAN_FEATURE_VOWIFI
3531 tANI_U32 localPwrConstraint;
3532#endif
3533
Abhishek Singh127a8442014-12-15 17:31:27 +05303534 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3535 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003536 psessionEntry->currentReqChannel = newChannel;
3537 psessionEntry->limRFBand = limGetRFBand(newChannel);
3538
3539 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3540
3541 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3542 pMac->lim.gpchangeChannelData = NULL;
3543
3544#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003545 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3547#else
3548 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3549 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003550 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 return;
3552 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003553 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3555#endif
3556 return;
3557}
3558
3559/**
3560 * limSwitchPrimarySecondaryChannel()
3561 *
3562 *FUNCTION:
3563 * This function changes the primary and secondary channel.
3564 * If 11h is enabled and user provides a "new channel ID"
3565 * that is different from the current operating channel,
3566 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3567 * assign notify LIM of such change.
3568 *
3569 *NOTE:
3570 * @param pMac Pointer to Global MAC structure
3571 * @param newChannel New chnannel ID (or current channel ID)
3572 * @param subband CB secondary info:
3573 * - eANI_CB_SECONDARY_NONE
3574 * - eANI_CB_SECONDARY_UP
3575 * - eANI_CB_SECONDARY_DOWN
3576 * @return NONE
3577 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003578void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003579{
3580#if !defined WLAN_FEATURE_VOWIFI
3581 tANI_U32 localPwrConstraint;
3582#endif
3583
Jeff Johnson295189b2012-06-20 16:38:30 -07003584#if !defined WLAN_FEATURE_VOWIFI
3585 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003586 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 return;
3588 }
3589#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303590 /* Assign the callback to resume TX once channel is changed.
3591 */
3592 psessionEntry->currentReqChannel = newChannel;
3593 psessionEntry->limRFBand = limGetRFBand(newChannel);
3594
3595 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3596
3597 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3598 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003599
Jeff Johnson295189b2012-06-20 16:38:30 -07003600#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003601 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003602#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003603 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003604#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003605
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303606#ifdef FEATURE_WLAN_DIAG_SUPPORT
3607 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3608 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3609#endif
3610
Jeff Johnsone7245742012-09-05 17:12:55 -07003611 // Store the new primary and secondary channel in session entries if different
3612 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 {
3614 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003615 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 psessionEntry->currentOperChannel = newChannel;
3618 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303619 if (psessionEntry->htSecondaryChannelOffset != limGetHTCBState(subband))
Jeff Johnsone7245742012-09-05 17:12:55 -07003620 {
3621 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003622 FL("switch old sec chnl %d --> new sec chnl %d "),
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303623 psessionEntry->htSecondaryChannelOffset, limGetHTCBState(subband));
3624 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(subband);
Jeff Johnsone7245742012-09-05 17:12:55 -07003625 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3626 {
3627 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303628 psessionEntry->apCenterChan = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003629 }
3630 else
3631 {
3632 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3633 }
3634 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3635 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003636
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303637 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3638 return;
3639
3640 if (subband > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
3641 psessionEntry->apCenterChan =
3642 limGetCenterChannel(pMac, newChannel,
3643 subband, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
3644 else
3645 psessionEntry->apCenterChan =
3646 limGetCenterChannel(pMac, newChannel,
3647 subband, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
3648
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 return;
3650}
3651
3652
3653/**
3654 * limActiveScanAllowed()
3655 *
3656 *FUNCTION:
3657 * Checks if active scans are permitted on the given channel
3658 *
3659 *LOGIC:
3660 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3661 * Need to check if the channelNum matches, then depending on the corresponding
3662 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3663 *
3664 *ASSUMPTIONS:
3665 *
3666 *NOTE:
3667 *
3668 * @param pMac Pointer to Global MAC structure
3669 * @param channelNum channel number
3670 * @return None
3671 */
3672
3673tANI_U8 limActiveScanAllowed(
3674 tpAniSirGlobal pMac,
3675 tANI_U8 channelNum)
3676{
3677 tANI_U32 i;
3678 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3679 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3680 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3681 != eSIR_SUCCESS)
3682 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003683 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 return false;
3685 }
3686
3687 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3688 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003689 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 len);
3691 return false;
3692 }
3693
3694 for (i=0; (i+1) < len; i+=2)
3695 {
3696 if (channelPair[i] == channelNum)
3697 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3698 }
3699 return false;
3700}
3701
3702/**
3703 * limTriggerBackgroundScanDuringQuietBss()
3704 *
3705 *FUNCTION:
3706 * This function is applicable to the STA only.
3707 * This function is called by limProcessQuietTimeout(),
3708 * when it is time to honor the Quiet BSS IE from the AP.
3709 *
3710 *LOGIC:
3711 * If 11H is enabled:
3712 * We cannot trigger a background scan. The STA needs to
3713 * shut-off Tx/Rx.
3714 * If 11 is not enabled:
3715 * Determine if the next channel that we are going to
3716 * scan is NOT the same channel (or not) on which the
3717 * Quiet BSS was requested.
3718 * If yes, then we cannot trigger a background scan on
3719 * this channel. Return with a false.
3720 * If no, then trigger a background scan. Return with
3721 * a true.
3722 *
3723 *ASSUMPTIONS:
3724 *
3725 *NOTE:
3726 * This API is redundant if the existing API,
3727 * limTriggerBackgroundScan(), were to return a valid
3728 * response instead of returning void.
3729 * If possible, try to revisit this API
3730 *
3731 * @param pMac Pointer to Global MAC structure
3732 * @return eSIR_TRUE, if a background scan was attempted
3733 * eSIR_FALSE, if not
3734 */
3735tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3736{
3737 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003738
3739
3740
3741 //TBD-RAJESH HOW TO GET sessionEntry?????
3742 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3743
3744 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3745 return bScanTriggered;
3746
Jeff Johnsone7245742012-09-05 17:12:55 -07003747 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 {
3749 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3750 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3751
3752 // Determine the next scan channel
3753
3754 // Get background scan channel list from CFG
3755 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3756 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3757 (tANI_U8 *) bgScanChannelList,
3758 (tANI_U32 *) &len ))
3759 {
3760 // Ensure that we do not go off scanning on the same
3761 // channel on which the Quiet BSS was requested
3762 if( psessionEntry->currentOperChannel!=
3763 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3764 {
3765 // For now, try and attempt a background scan. It will
3766 // be ideal if this API actually returns a success or
3767 // failure instead of having a void return type
3768 limTriggerBackgroundScan( pMac );
3769
3770 bScanTriggered = eSIR_TRUE;
3771 }
3772 else
3773 {
3774 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003775 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 -07003776 }
3777 }
3778 else
3779 {
3780 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003781 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 -07003782 }
3783 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 return bScanTriggered;
3785}
3786
3787
3788/**
3789 * limGetHTCapability()
3790 *
3791 *FUNCTION:
3792 * A utility function that returns the "current HT capability state" for the HT
3793 * capability of interest (as requested in the API)
3794 *
3795 *LOGIC:
3796 * This routine will return with the "current" setting of a requested HT
3797 * capability. This state info could be retrieved from -
3798 * a) CFG (for static entries)
3799 * b) Run time info
3800 * - Dynamic state maintained by LIM
3801 * - Configured at radio init time by SME
3802 *
3803 *
3804 *ASSUMPTIONS:
3805 * NA
3806 *
3807 *NOTE:
3808 *
3809 * @param pMac Pointer to Global MAC structure
3810 * @param htCap The HT capability being queried
3811 * @return tANI_U8 The current state of the requested HT capability is returned in a
3812 * tANI_U8 variable
3813 */
3814
Jeff Johnson295189b2012-06-20 16:38:30 -07003815tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3816 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003817{
3818tANI_U8 retVal = 0;
3819tANI_U8 *ptr;
3820tANI_U32 cfgValue;
3821tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3822tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3823tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3824tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3825
3826 //
3827 // Determine which CFG to read from. Not ALL of the HT
3828 // related CFG's need to be read each time this API is
3829 // accessed
3830 //
3831 if( htCap >= eHT_ANTENNA_SELECTION &&
3832 htCap < eHT_SI_GRANULARITY )
3833 {
3834 // Get Antenna Seletion HT Capabilities
3835 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3836 cfgValue = 0;
3837 ptr = (tANI_U8 *) &macASCapabilityInfo;
3838 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3839 }
3840 else
3841 {
3842 if( htCap >= eHT_TX_BEAMFORMING &&
3843 htCap < eHT_ANTENNA_SELECTION )
3844 {
3845 // Get Transmit Beam Forming HT Capabilities
3846 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3847 cfgValue = 0;
3848 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3849 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3850 }
3851 else
3852 {
3853 if( htCap >= eHT_PCO &&
3854 htCap < eHT_TX_BEAMFORMING )
3855 {
3856 // Get Extended HT Capabilities
3857 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3858 cfgValue = 0;
3859 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3860 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3861 }
3862 else
3863 {
3864 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3865 {
3866 // Get HT Capabilities
3867 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3868 cfgValue = 0;
3869 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3870 // 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
3871 *ptr++ = cfgValue & 0xff;
3872 *ptr = (cfgValue >> 8) & 0xff;
3873 }
3874 }
3875 }
3876 }
3877
3878 switch( htCap )
3879 {
3880 case eHT_LSIG_TXOP_PROTECTION:
3881 retVal = pMac->lim.gHTLsigTXOPProtection;
3882 break;
3883
3884 case eHT_STBC_CONTROL_FRAME:
3885 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3886 break;
3887
3888 case eHT_PSMP:
3889 retVal = pMac->lim.gHTPSMPSupport;
3890 break;
3891
3892 case eHT_DSSS_CCK_MODE_40MHZ:
3893 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3894 break;
3895
3896 case eHT_MAX_AMSDU_LENGTH:
3897 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3898 break;
3899
3900 case eHT_DELAYED_BA:
3901 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3902 break;
3903
3904 case eHT_RX_STBC:
3905 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3906 break;
3907
3908 case eHT_TX_STBC:
3909 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3910 break;
3911
3912 case eHT_SHORT_GI_40MHZ:
3913 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3914 break;
3915
3916 case eHT_SHORT_GI_20MHZ:
3917 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3918 break;
3919
3920 case eHT_GREENFIELD:
3921 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3922 break;
3923
3924 case eHT_MIMO_POWER_SAVE:
3925 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3926 break;
3927
3928 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003929 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 break;
3931
3932 case eHT_ADVANCED_CODING:
3933 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3934 break;
3935
3936 case eHT_MAX_RX_AMPDU_FACTOR:
3937 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3938 break;
3939
3940 case eHT_MPDU_DENSITY:
3941 retVal = pMac->lim.gHTAMpduDensity;
3942 break;
3943
3944 case eHT_PCO:
3945 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3946 break;
3947
3948 case eHT_TRANSITION_TIME:
3949 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3950 break;
3951
3952 case eHT_MCS_FEEDBACK:
3953 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3954 break;
3955
3956 case eHT_TX_BEAMFORMING:
3957 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3958 break;
3959
3960 case eHT_ANTENNA_SELECTION:
3961 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3962 break;
3963
3964 case eHT_SI_GRANULARITY:
3965 retVal = pMac->lim.gHTServiceIntervalGranularity;
3966 break;
3967
3968 case eHT_CONTROLLED_ACCESS:
3969 retVal = pMac->lim.gHTControlledAccessOnly;
3970 break;
3971
3972 case eHT_RIFS_MODE:
3973 retVal = psessionEntry->beaconParams.fRIFSMode;
3974 break;
3975
3976 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003977 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 break;
3979
3980 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003981 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 break;
3983
3984 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3986 retVal = psessionEntry->htOperMode;
3987 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 retVal = pMac->lim.gHTOperMode;
3989 break;
3990
3991 case eHT_BASIC_STBC_MCS:
3992 retVal = pMac->lim.gHTSTBCBasicMCS;
3993 break;
3994
3995 case eHT_DUAL_CTS_PROTECTION:
3996 retVal = pMac->lim.gHTDualCTSProtection;
3997 break;
3998
3999 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
4000 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
4001 break;
4002
4003 case eHT_PCO_ACTIVE:
4004 retVal = pMac->lim.gHTPCOActive;
4005 break;
4006
4007 case eHT_PCO_PHASE:
4008 retVal = pMac->lim.gHTPCOPhase;
4009 break;
4010
4011 default:
4012 break;
4013 }
4014
4015 return retVal;
4016}
4017
Jeff Johnson295189b2012-06-20 16:38:30 -07004018void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
4019{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304020 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004021 return;
4022}
4023
4024
4025
4026
4027/** -------------------------------------------------------------
4028\fn limEnable11aProtection
4029\brief based on config setting enables\disables 11a protection.
4030\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4031\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4032\param tpUpdateBeaconParams pBeaconParams
4033\return None
4034 -------------------------------------------------------------*/
4035tSirRetStatus
4036limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4037 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4038{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004039 if(NULL == psessionEntry)
4040 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004041 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004042 return eSIR_FAILURE;
4043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 //overlapping protection configuration check.
4045 if(overlap)
4046 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 }
4048 else
4049 {
4050 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004051 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004052 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 {
4054 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004055 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004056 return eSIR_SUCCESS;
4057 }
4058 }
4059
4060 if (enable)
4061 {
4062 //If we are AP and HT capable, we need to set the HT OP mode
4063 //appropriately.
4064 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07004065 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 {
4067 if(overlap)
4068 {
4069 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
4070 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4071 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4072 {
4073 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4074 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4075 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4076 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4077 }
4078 }
4079 else
4080 {
4081 psessionEntry->gLim11aParams.protectionEnabled = true;
4082 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4083 {
4084 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07004085 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004086 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4087 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4088
4089 }
4090 }
4091 }
4092
4093 //This part is common for staiton as well.
4094 if(false == psessionEntry->beaconParams.llaCoexist)
4095 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004096 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
4098 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4099 }
4100 }
4101 else if (true == psessionEntry->beaconParams.llaCoexist)
4102 {
4103 //for AP role.
4104 //we need to take care of HT OP mode change if needed.
4105 //We need to take care of Overlap cases.
4106 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4107 {
4108 if(overlap)
4109 {
4110 //Overlap Legacy protection disabled.
4111 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
4112
4113 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004114 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004115 {
4116 // no HT op mode change if any of the overlap protection enabled.
4117 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4118 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4119 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4120
4121 {
4122 //Check if there is a need to change HT OP mode.
4123 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4124 {
4125 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4126 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4127
4128 if(psessionEntry->gLimHt20Params.protectionEnabled)
4129 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4130 else
4131 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4132 }
4133 }
4134 }
4135 }
4136 else
4137 {
4138 //Disable protection from 11A stations.
4139 psessionEntry->gLim11aParams.protectionEnabled = false;
4140 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4141
4142 //Check if any other non-HT protection enabled.
4143 //Right now we are in HT OP Mixed mode.
4144 //Change HT op mode appropriately.
4145
4146 //Change HT OP mode to 01 if any overlap protection enabled
4147 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4148 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4149 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4150
4151 {
4152 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07004153 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4155 }
4156 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4157 {
4158 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07004159 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4161 }
4162 else
4163 {
4164 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004165 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004166 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4167 }
4168 }
4169 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4170 !psessionEntry->gLim11aParams.protectionEnabled)
4171 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004172 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004173 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4174 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4175 }
4176 }
4177 //for station role
4178 else
4179 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004180 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4182 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4183 }
4184 }
4185
4186 return eSIR_SUCCESS;
4187}
4188
4189/** -------------------------------------------------------------
4190\fn limEnable11gProtection
4191\brief based on config setting enables\disables 11g protection.
4192\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4193\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4194\param tpUpdateBeaconParams pBeaconParams
4195\return None
4196 -------------------------------------------------------------*/
4197
4198tSirRetStatus
4199limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4200 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4201{
4202
4203 //overlapping protection configuration check.
4204 if(overlap)
4205 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004206 }
4207 else
4208 {
4209 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4211 !psessionEntry->cfgProtection.fromllb)
4212 {
4213 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004214 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 return eSIR_SUCCESS;
4216 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 {
4218 if(!pMac->lim.cfgProtection.fromllb)
4219 {
4220 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004221 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 return eSIR_SUCCESS;
4223 }
4224 }
4225 }
4226
4227 if (enable)
4228 {
4229 //If we are AP and HT capable, we need to set the HT OP mode
4230 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4232 {
4233 if(overlap)
4234 {
4235 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004236 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004237 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 {
4239 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4240 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4241 {
4242 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4243 }
4244 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4245 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4246 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4247 //Not processing OBSS bit from other APs, as we are already taking care
4248 //of Protection from overlapping BSS based on erp IE or useProtection bit
4249 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4250 }
4251 }
4252 else
4253 {
4254 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004255 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004256 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 {
4258 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4259 {
4260 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4261 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4262 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4263 }
4264 }
4265 }
4266 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004267 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 {
4269 if(overlap)
4270 {
4271 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4272 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4273 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4274 {
4275 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4276 }
4277 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4278 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4279 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4280 //Not processing OBSS bit from other APs, as we are already taking care
4281 //of Protection from overlapping BSS based on erp IE or useProtection bit
4282 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4283 }
4284 else
4285 {
4286 psessionEntry->gLim11bParams.protectionEnabled = true;
4287 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4288 {
4289 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4290 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4291 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4292 }
4293 }
4294 }
4295
4296 //This part is common for staiton as well.
4297 if(false == psessionEntry->beaconParams.llbCoexist)
4298 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004299 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4301 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4302 }
4303 }
4304 else if (true == psessionEntry->beaconParams.llbCoexist)
4305 {
4306 //for AP role.
4307 //we need to take care of HT OP mode change if needed.
4308 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4310 {
4311 if(overlap)
4312 {
4313 //Overlap Legacy protection disabled.
4314 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4315
4316 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004317 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004318 {
4319 // no HT op mode change if any of the overlap protection enabled.
4320 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4321 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4322 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4323 {
4324 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004325 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 {
4327 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4328 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4329 if(psessionEntry->gLimHt20Params.protectionEnabled){
4330 //Commenting out beacuse of CR 258588 WFA cert
4331 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4332 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4333 }
4334 else
4335 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4336 }
4337 }
4338 }
4339 }
4340 else
4341 {
4342 //Disable protection from 11B stations.
4343 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004344 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004345 //Check if any other non-HT protection enabled.
4346 if(!psessionEntry->gLim11gParams.protectionEnabled)
4347 {
4348 //Right now we are in HT OP Mixed mode.
4349 //Change HT op mode appropriately.
4350 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4351
4352 //Change HT OP mode to 01 if any overlap protection enabled
4353 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4354 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4355 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4356 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4357 {
4358 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004359 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004360 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4361 }
4362 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4363 {
4364 //Commenting because of CR 258588 WFA cert
4365 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4366 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004367 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004368 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4369 }
4370 else
4371 {
4372 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4373 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4374 }
4375 }
4376 }
4377 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4378 !psessionEntry->gLim11bParams.protectionEnabled)
4379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004380 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4382 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4383 }
4384 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 {
4386 if(overlap)
4387 {
4388 //Overlap Legacy protection disabled.
4389 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4390
4391 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004392 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 {
4394 // no HT op mode change if any of the overlap protection enabled.
4395 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4396 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4397 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4398
4399 {
4400 //Check if there is a need to change HT OP mode.
4401 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4402 {
4403 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4404 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4405 if(psessionEntry->gLimHt20Params.protectionEnabled)
4406 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4407 else
4408 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4409 }
4410 }
4411 }
4412 }
4413 else
4414 {
4415 //Disable protection from 11B stations.
4416 psessionEntry->gLim11bParams.protectionEnabled = false;
4417 //Check if any other non-HT protection enabled.
4418 if(!psessionEntry->gLim11gParams.protectionEnabled)
4419 {
4420 //Right now we are in HT OP Mixed mode.
4421 //Change HT op mode appropriately.
4422 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4423
4424 //Change HT OP mode to 01 if any overlap protection enabled
4425 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4426 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4427 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4428 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4429
4430 {
4431 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4432 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4433 }
4434 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4435 {
4436 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4437 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4438 }
4439 else
4440 {
4441 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4442 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4443 }
4444 }
4445 }
4446 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4447 !psessionEntry->gLim11bParams.protectionEnabled)
4448 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004449 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004450 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4451 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4452 }
4453 }
4454 //for station role
4455 else
4456 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004457 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4459 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4460 }
4461 }
4462 return eSIR_SUCCESS;
4463}
4464
4465/** -------------------------------------------------------------
4466\fn limEnableHtProtectionFrom11g
4467\brief based on cofig enables\disables protection from 11g.
4468\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4469\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4470\param tpUpdateBeaconParams pBeaconParams
4471\return None
4472 -------------------------------------------------------------*/
4473tSirRetStatus
4474limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4475 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4476{
Jeff Johnsone7245742012-09-05 17:12:55 -07004477 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4479
4480 //overlapping protection configuration check.
4481 if(overlap)
4482 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4484 {
4485 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004486 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 return eSIR_SUCCESS;
4488 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 {
4490 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004491 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004492 return eSIR_SUCCESS;
4493 }
4494 }
4495 else
4496 {
4497 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4499 !psessionEntry->cfgProtection.fromllg){
4500 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004501 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 return eSIR_SUCCESS;
4503 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 {
4505 if(!pMac->lim.cfgProtection.fromllg)
4506 {
4507 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004508 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 return eSIR_SUCCESS;
4510 }
4511 }
4512 }
4513 if (enable)
4514 {
4515 //If we are AP and HT capable, we need to set the HT OP mode
4516 //appropriately.
4517
Jeff Johnson295189b2012-06-20 16:38:30 -07004518 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4519 {
4520 if(overlap)
4521 {
4522 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4523 //11g exists in overlap BSS.
4524 //need not to change the operating mode to overlap_legacy
4525 //if higher or same protection operating mode is enabled right now.
4526 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4527 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4528 {
4529 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4530 }
4531 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304532 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 }
4534 else
4535 {
4536 //11g is associated to an AP operating in 11n mode.
4537 //Change the HT operating mode to 'mixed mode'.
4538 psessionEntry->gLim11gParams.protectionEnabled = true;
4539 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4540 {
4541 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4542 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304543 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 }
4545 }
4546 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 {
4548 if(overlap)
4549 {
4550 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4551 //11g exists in overlap BSS.
4552 //need not to change the operating mode to overlap_legacy
4553 //if higher or same protection operating mode is enabled right now.
4554 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4555 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4556 {
4557 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4558 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4559 }
4560 }
4561 else
4562 {
4563 //11g is associated to an AP operating in 11n mode.
4564 //Change the HT operating mode to 'mixed mode'.
4565 psessionEntry->gLim11gParams.protectionEnabled = true;
4566 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4567 {
4568 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4569 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304570 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 }
4572 }
4573 }
4574
4575 //This part is common for staiton as well.
4576 if(false == psessionEntry->beaconParams.llgCoexist)
4577 {
4578 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4579 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4580 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4582 {
4583 // As operating mode changed after G station assoc some way to update beacon
4584 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4585 //pMac->sch.schObject.fBeaconChanged = 1;
4586 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4587 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 }
4589 else if (true == psessionEntry->beaconParams.llgCoexist)
4590 {
4591 //for AP role.
4592 //we need to take care of HT OP mode change if needed.
4593 //We need to take care of Overlap cases.
4594
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4596 {
4597 if(overlap)
4598 {
4599 //Overlap Legacy protection disabled.
4600 if (psessionEntry->gLim11gParams.numSta == 0)
4601 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4602
4603 // no HT op mode change if any of the overlap protection enabled.
4604 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4605 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4606 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4607 {
4608 //Check if there is a need to change HT OP mode.
4609 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4610 {
4611 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4612 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4613
4614 if(psessionEntry->gLimHt20Params.protectionEnabled){
4615 //Commenting because of CR 258588 WFA cert
4616 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4617 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4618 }
4619 else
4620 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4621 }
4622 }
4623 }
4624 else
4625 {
4626 //Disable protection from 11G stations.
4627 psessionEntry->gLim11gParams.protectionEnabled = false;
4628 //Check if any other non-HT protection enabled.
4629 if(!psessionEntry->gLim11bParams.protectionEnabled)
4630 {
4631
4632 //Right now we are in HT OP Mixed mode.
4633 //Change HT op mode appropriately.
4634 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4635
4636 //Change HT OP mode to 01 if any overlap protection enabled
4637 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4638 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4639 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4640 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4641
4642 {
4643 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4644 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4645 }
4646 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4647 {
4648 //Commenting because of CR 258588 WFA cert
4649 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4650 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4651 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4652 }
4653 else
4654 {
4655 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4656 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4657 }
4658 }
4659 }
4660 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4661 !psessionEntry->gLim11gParams.protectionEnabled)
4662 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004663 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4665 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4666 }
4667 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 {
4669 if(overlap)
4670 {
4671 //Overlap Legacy protection disabled.
4672 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4673
4674 // no HT op mode change if any of the overlap protection enabled.
4675 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4676 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4677 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4678 {
4679 //Check if there is a need to change HT OP mode.
4680 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4681 {
4682 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4683 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4684
4685 if(psessionEntry->gLimHt20Params.protectionEnabled)
4686 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4687 else
4688 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4689 }
4690 }
4691 }
4692 else
4693 {
4694 //Disable protection from 11G stations.
4695 psessionEntry->gLim11gParams.protectionEnabled = false;
4696 //Check if any other non-HT protection enabled.
4697 if(!psessionEntry->gLim11bParams.protectionEnabled)
4698 {
4699
4700 //Right now we are in HT OP Mixed mode.
4701 //Change HT op mode appropriately.
4702 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4703
4704 //Change HT OP mode to 01 if any overlap protection enabled
4705 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4706 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4707 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4708 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4709
4710 {
4711 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4712 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4713 }
4714 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4715 {
4716 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4717 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4718 }
4719 else
4720 {
4721 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4722 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4723 }
4724 }
4725 }
4726 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4727 !psessionEntry->gLim11gParams.protectionEnabled)
4728 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004729 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4731 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4732 }
4733 }
4734 //for station role
4735 else
4736 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004737 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004738 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4739 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4740 }
4741 }
4742 return eSIR_SUCCESS;
4743}
4744//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4745//This check will be done at the caller.
4746
4747/** -------------------------------------------------------------
4748\fn limEnableHtObssProtection
4749\brief based on cofig enables\disables obss protection.
4750\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4751\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4752\param tpUpdateBeaconParams pBeaconParams
4753\return None
4754 -------------------------------------------------------------*/
4755tSirRetStatus
4756limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4757 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4758{
4759
4760
Jeff Johnsone7245742012-09-05 17:12:55 -07004761 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004762 return eSIR_SUCCESS; // this protection is only for HT stations.
4763
4764 //overlapping protection configuration check.
4765 if(overlap)
4766 {
4767 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004768 }
4769 else
4770 {
4771 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4773 { //ToDo Update this field
4774 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004775 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 return eSIR_SUCCESS;
4777 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 {
4779 if(!pMac->lim.cfgProtection.obss)
4780 { //ToDo Update this field
4781 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004782 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004783 return eSIR_SUCCESS;
4784 }
4785 }
4786 }
4787
4788
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4790 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4791 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004792 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 psessionEntry->beaconParams.gHTObssMode = true;
4794 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4795
4796 }
4797 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4798 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004799 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 psessionEntry->beaconParams.gHTObssMode = false;
4801 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4802
4803 }
4804//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4805 if (!enable && !overlap)
4806 {
4807 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4808 }
4809 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004810 {
4811 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4812 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004813 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 psessionEntry->beaconParams.gHTObssMode = true;
4815 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4816
4817 }
4818 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4819 {
4820
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004821 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 psessionEntry->beaconParams.gHTObssMode = false;
4823 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4824
4825 }
4826 }
4827 return eSIR_SUCCESS;
4828}
4829/** -------------------------------------------------------------
4830\fn limEnableHT20Protection
4831\brief based on cofig enables\disables protection from Ht20.
4832\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4833\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4834\param tpUpdateBeaconParams pBeaconParams
4835\return None
4836 -------------------------------------------------------------*/
4837tSirRetStatus
4838limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4839 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4840{
Jeff Johnsone7245742012-09-05 17:12:55 -07004841 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 return eSIR_SUCCESS; // this protection is only for HT stations.
4843
4844 //overlapping protection configuration check.
4845 if(overlap)
4846 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 }
4848 else
4849 {
4850 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4852 !psessionEntry->cfgProtection.ht20)
4853 {
4854 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004855 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 return eSIR_SUCCESS;
4857 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 {
4859 if(!pMac->lim.cfgProtection.ht20)
4860 {
4861 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004862 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 return eSIR_SUCCESS;
4864 }
4865 }
4866 }
4867
4868 if (enable)
4869 {
4870 //If we are AP and HT capable, we need to set the HT OP mode
4871 //appropriately.
4872
Jeff Johnson295189b2012-06-20 16:38:30 -07004873 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4874 if(overlap)
4875 {
4876 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4877 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4878 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4879 {
4880 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4881 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4882 }
4883 }
4884 else
4885 {
4886 psessionEntry->gLimHt20Params.protectionEnabled = true;
4887 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4888 {
4889 //Commenting because of CR 258588 WFA cert
4890 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4891 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4892 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4893 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4894 }
4895 }
4896 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 {
4898 if(overlap)
4899 {
4900 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4901 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4902 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4903 {
4904 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4905 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4906 }
4907 }
4908 else
4909 {
4910 psessionEntry->gLimHt20Params.protectionEnabled = true;
4911 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4912 {
4913 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4914 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4915 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4916 }
4917 }
4918 }
4919
4920 //This part is common for staiton as well.
4921 if(false == psessionEntry->beaconParams.ht20Coexist)
4922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004923 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4925 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4926 }
4927 }
4928 else if (true == psessionEntry->beaconParams.ht20Coexist)
4929 {
4930 //for AP role.
4931 //we need to take care of HT OP mode change if needed.
4932 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004933 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4934 if(overlap)
4935 {
4936 //Overlap Legacy protection disabled.
4937 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4938
4939 // no HT op mode change if any of the overlap protection enabled.
4940 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4941 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4942 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4943 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4944 {
4945
4946 //Check if there is a need to change HT OP mode.
4947 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4948 {
4949 if(psessionEntry->gLimHt20Params.protectionEnabled)
4950 {
4951 //Commented beacuse of CR 258588 for WFA Cert
4952 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4953 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4954 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4955 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4956 }
4957 else
4958 {
4959 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4960 }
4961 }
4962 }
4963 }
4964 else
4965 {
4966 //Disable protection from 11G stations.
4967 psessionEntry->gLimHt20Params.protectionEnabled = false;
4968
4969 //Change HT op mode appropriately.
4970 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4971 {
4972 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4973 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4974 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4975 }
4976 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4979 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4980 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 {
4982 if(overlap)
4983 {
4984 //Overlap Legacy protection disabled.
4985 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4986
4987 // no HT op mode change if any of the overlap protection enabled.
4988 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4989 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4990 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4991 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4992 {
4993
4994 //Check if there is a need to change HT OP mode.
4995 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4996 {
4997 if(psessionEntry->gLimHt20Params.protectionEnabled)
4998 {
4999 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
5000 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5001 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5002 }
5003 else
5004 {
5005 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5006 }
5007 }
5008 }
5009 }
5010 else
5011 {
5012 //Disable protection from 11G stations.
5013 psessionEntry->gLimHt20Params.protectionEnabled = false;
5014
5015 //Change HT op mode appropriately.
5016 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
5017 {
5018 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5019 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5020 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5021 }
5022 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005023 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005024 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5025 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5026 }
5027 //for station role
5028 else
5029 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005030 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5032 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5033 }
5034 }
5035
5036 return eSIR_SUCCESS;
5037}
5038
5039/** -------------------------------------------------------------
5040\fn limEnableHTNonGfProtection
5041\brief based on cofig enables\disables protection from NonGf.
5042\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5043\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5044\param tpUpdateBeaconParams pBeaconParams
5045\return None
5046 -------------------------------------------------------------*/
5047tSirRetStatus
5048limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5049 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5050{
Jeff Johnsone7245742012-09-05 17:12:55 -07005051 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 return eSIR_SUCCESS; // this protection is only for HT stations.
5053
5054 //overlapping protection configuration check.
5055 if(overlap)
5056 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 }
5058 else
5059 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 //normal protection config check
5061 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5062 !psessionEntry->cfgProtection.nonGf)
5063 {
5064 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005065 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005066 return eSIR_SUCCESS;
5067 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 {
5069 //normal protection config check
5070 if(!pMac->lim.cfgProtection.nonGf)
5071 {
5072 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005073 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005074 return eSIR_SUCCESS;
5075 }
5076 }
5077 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5079 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005081 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005082 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5083 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5084 }
5085 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5086 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005087 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005088 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5089 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5090 }
5091 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005092 {
5093 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5094 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005095 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5097 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5098 }
5099 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5100 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005101 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005102 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5103 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5104 }
5105 }
5106
5107 return eSIR_SUCCESS;
5108}
5109
5110/** -------------------------------------------------------------
5111\fn limEnableHTLsigTxopProtection
5112\brief based on cofig enables\disables LsigTxop protection.
5113\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5114\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5115\param tpUpdateBeaconParams pBeaconParams
5116\return None
5117 -------------------------------------------------------------*/
5118tSirRetStatus
5119limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5120 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5121{
Jeff Johnsone7245742012-09-05 17:12:55 -07005122 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005123 return eSIR_SUCCESS; // this protection is only for HT stations.
5124
5125 //overlapping protection configuration check.
5126 if(overlap)
5127 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005128 }
5129 else
5130 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005131 //normal protection config check
5132 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5133 !psessionEntry->cfgProtection.lsigTxop)
5134 {
5135 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005136 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005137 return eSIR_SUCCESS;
5138 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 {
5140 //normal protection config check
5141 if(!pMac->lim.cfgProtection.lsigTxop)
5142 {
5143 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005144 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 return eSIR_SUCCESS;
5146 }
5147 }
5148 }
5149
5150
Jeff Johnson295189b2012-06-20 16:38:30 -07005151 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5152 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5153 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005154 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005155 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5156 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5157 }
5158 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5159 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005160 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5162 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5163 }
5164 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 {
5166 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5167 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005168 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5170 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5171 }
5172 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5173 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005174 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005175 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5176 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5177 }
5178 }
5179 return eSIR_SUCCESS;
5180}
5181//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5182//This check will be done at the caller.
5183/** -------------------------------------------------------------
5184\fn limEnableHtRifsProtection
5185\brief based on cofig enables\disables Rifs protection.
5186\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5187\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5188\param tpUpdateBeaconParams pBeaconParams
5189\return None
5190 -------------------------------------------------------------*/
5191tSirRetStatus
5192limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5193 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5194{
Jeff Johnsone7245742012-09-05 17:12:55 -07005195 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005196 return eSIR_SUCCESS; // this protection is only for HT stations.
5197
5198
5199 //overlapping protection configuration check.
5200 if(overlap)
5201 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005202 }
5203 else
5204 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005205 //normal protection config check
5206 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5207 !psessionEntry->cfgProtection.rifs)
5208 {
5209 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005210 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005211 return eSIR_SUCCESS;
5212 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 {
5214 //normal protection config check
5215 if(!pMac->lim.cfgProtection.rifs)
5216 {
5217 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005218 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005219 return eSIR_SUCCESS;
5220 }
5221 }
5222 }
5223
Jeff Johnson295189b2012-06-20 16:38:30 -07005224 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5225 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5226 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5227 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005228 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5230 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5231 }
5232 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5233 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5234 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005235 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005236 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5237 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5238 }
5239 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 {
5241 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5242 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5243 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005244 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005245 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5246 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5247 }
5248 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5249 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5250 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005251 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005252 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5253 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5254 }
5255 }
5256 return eSIR_SUCCESS;
5257}
5258
5259// ---------------------------------------------------------------------
5260/**
5261 * limEnableShortPreamble
5262 *
5263 * FUNCTION:
5264 * Enable/Disable short preamble
5265 *
5266 * LOGIC:
5267 *
5268 * ASSUMPTIONS:
5269 *
5270 * NOTE:
5271 *
5272 * @param enable Flag to enable/disable short preamble
5273 * @return None
5274 */
5275
5276tSirRetStatus
5277limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5278{
5279 tANI_U32 val;
5280
5281 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5282 {
5283 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005284 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005285 return eSIR_FAILURE;
5286 }
5287
5288 if (!val)
5289 return eSIR_SUCCESS;
5290
5291 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5292 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005293 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005294 return eSIR_FAILURE;
5295 }
5296
5297 if (!val) // 11G short preamble switching is disabled.
5298 return eSIR_SUCCESS;
5299
5300 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5301 {
5302 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5303 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005304 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 psessionEntry->beaconParams.fShortPreamble = true;
5306 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5307 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5308 }
5309 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5310 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005311 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005312 psessionEntry->beaconParams.fShortPreamble = false;
5313 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5314 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5315 }
5316 }
5317
5318 return eSIR_SUCCESS;
5319 }
5320
5321/**
5322 * limTxComplete
5323 *
5324 * Function:
5325 * This is LIM's very own "TX MGMT frame complete" completion routine.
5326 *
5327 * Logic:
5328 * LIM wants to send a MGMT frame (broadcast or unicast)
5329 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5330 * LIM transmits the MGMT frame using the API:
5331 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5332 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5333 * HDD, if it determines that a TX completion routine (in this case
5334 * limTxComplete) has been provided, will invoke this callback
5335 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5336 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5337 *
5338 * Assumptions:
5339 * Presently, this is ONLY being used for MGMT frames/packets
5340 * TODO:
5341 * Would it do good for LIM to have some sort of "signature" validation to
5342 * ensure that the pData argument passed in was a buffer that was actually
5343 * allocated by LIM and/or is not corrupted?
5344 *
5345 * Note: FIXME and TODO
5346 * Looks like palPktFree() is interested in pPacket. But, when this completion
5347 * routine is called, only pData is made available to LIM!!
5348 *
5349 * @param void A pointer to pData. Shouldn't it be pPacket?!
5350 *
5351 * @return none
5352 */
5353void limTxComplete( tHalHandle hHal, void *pData )
5354{
5355 tpAniSirGlobal pMac;
5356 pMac = (tpAniSirGlobal)hHal;
5357
5358#ifdef FIXME_PRIMA
5359 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5360#ifdef TRACE_RECORD
5361 {
5362 tpSirMacMgmtHdr mHdr;
5363 v_U8_t *pRxBd;
5364 vos_pkt_t *pVosPkt;
5365 VOS_STATUS vosStatus;
5366
5367
5368
5369 pVosPkt = (vos_pkt_t *)pData;
5370 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5371
5372 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5373 {
5374 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005375
5376 }
5377 }
5378#endif
5379#endif
5380
5381 palPktFree( pMac->hHdd,
5382 HAL_TXRX_FRM_802_11_MGMT,
5383 (void *) NULL, // this is ignored and will likely be removed from this API
5384 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5385}
5386
5387/**
5388 * \brief This function updates lim global structure, if CB parameters in the BSS
5389 * have changed, and sends an indication to HAL also with the
5390 * updated HT Parameters.
5391 * This function does not detect the change in the primary channel, that is done as part
5392 * of channel Swtich IE processing.
5393 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5394 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5395 *
5396 *
5397 * \param pMac Pointer to global MAC structure
5398 *
5399 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5400 * Probe Response
5401 *
5402 * \param bssIdx BSS Index of the Bss to which Station is associated.
5403 *
5404 *
5405 */
5406
5407void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5408 tDot11fIEHTInfo *pHTInfo,
5409 tANI_U8 bssIdx,
5410 tpPESession psessionEntry)
5411{
Jeff Johnsone7245742012-09-05 17:12:55 -07005412 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005413#if !defined WLAN_FEATURE_VOWIFI
5414 tANI_U32 localPwrConstraint;
5415#endif
5416
5417 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005419 return;
5420
Abhishek Singhe3beee22017-07-31 15:35:40 +05305421 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5422 psessionEntry->force_24ghz_in_ht20) {
5423 limLog(pMac, LOG1,
5424 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5425 return;
5426 }
5427
Jeff Johnson295189b2012-06-20 16:38:30 -07005428#if !defined WLAN_FEATURE_VOWIFI
5429 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005430 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005431 return;
5432 }
5433#endif
5434
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305435 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5436 {
5437 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5438 return;
5439 }
5440
Mihir Shetebc160b72014-08-22 14:10:39 +05305441 /*
5442 * Do not try to switch channel if RoC is in progress. RoC code path uses
5443 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5444 * has started listening on the channel requested as part of RoC, if we set
5445 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5446 * upper layers will think that the channel change is not successful and the
5447 * RoC from the upper layer perspective will never end...
5448 */
5449 if (pMac->lim.gpLimRemainOnChanReq)
5450 {
5451 limLog( pMac, LOGE, FL( "RoC is in progress"));
5452 return;
5453 }
5454
Jeff Johnsone7245742012-09-05 17:12:55 -07005455 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5456 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005457 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005458 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5459 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5460 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5461 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005462
5463 // Notify HAL
5464 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005465 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005466 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005467 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005468 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005469 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005470 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5471 pMac->lim.gpchangeChannelCallback = NULL;
5472 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005473
5474#if defined WLAN_FEATURE_VOWIFI
5475 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5476 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5477#else
5478 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5479 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5480#endif
5481
5482 //In case of IBSS, if STA should update HT Info IE in its beacons.
5483 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5484 {
5485 schSetFixedBeaconFields(pMac,psessionEntry);
5486 }
5487
5488 }
5489} // End limUpdateStaRunTimeHTParams.
5490
5491/**
5492 * \brief This function updates the lim global structure, if any of the
5493 * HT Capabilities have changed.
5494 *
5495 *
5496 * \param pMac Pointer to Global MAC structure
5497 *
5498 * \param pHTCapability Pointer to HT Capability Information Element
5499 * obtained from a Beacon or Probe Response
5500 *
5501 *
5502 *
5503 */
5504
5505void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5506 tDot11fIEHTCaps *pHTCaps )
5507{
5508
5509 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5510 {
5511 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5512 // Send change notification to HAL
5513 }
5514
5515 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5516 {
5517 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5518 // Send change notification to HAL
5519 }
5520
5521 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5522 {
5523 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5524 // Send change notification to HAL
5525 }
5526
5527
5528} // End limUpdateStaRunTimeHTCapability.
5529
5530/**
5531 * \brief This function updates lim global structure, if any of the HT
5532 * Info Parameters have changed.
5533 *
5534 *
5535 * \param pMac Pointer to the global MAC structure
5536 *
5537 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5538 * Probe Response
5539 *
5540 *
5541 */
5542
5543void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305544 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005545{
Jeff Johnsone7245742012-09-05 17:12:55 -07005546 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005547 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005548 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 // Send change notification to HAL
5550 }
5551
5552 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5553 {
5554 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5555 // Send change notification to HAL
5556 }
5557
5558 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5559 {
5560 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5561 // Send change notification to HAL
5562 }
5563
5564 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5565 {
5566 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5567 // Send change notification to HAL
5568 }
5569
5570 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5571 {
5572 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5573 }
5574
5575 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5576 {
5577 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5578 // Send change notification to HAL
5579 }
5580
5581 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5582 {
5583 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5584 // Send change notification to HAL
5585 }
5586
5587 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5588 {
5589 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5590 // Send change notification to HAL
5591 }
5592
5593 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5594 {
5595 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5596 // Send change notification to HAL
5597 }
5598
5599 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5600 {
5601 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5602 // Send change notification to HAL
5603 }
5604
5605 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5606 {
5607 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5608 // Send change notification to HAL
5609 }
5610
5611} // End limUpdateStaRunTimeHTInfo.
5612
5613
5614/** -------------------------------------------------------------
5615\fn limProcessHalIndMessages
5616\brief callback function for HAL indication
5617\param tpAniSirGlobal pMac
5618\param tANI_U32 mesgId
5619\param void *mesgParam
5620\return tSirRetStatu - status
5621 -------------------------------------------------------------*/
5622
5623tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5624{
5625 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5626 tSirMsgQ msg;
5627
5628 switch(msgId)
5629 {
5630 case SIR_LIM_DEL_TS_IND:
5631 case SIR_LIM_ADD_BA_IND:
5632 case SIR_LIM_DEL_BA_ALL_IND:
5633 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5634 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305635 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005636 msg.type = (tANI_U16) msgId;
5637 msg.bodyptr = msgParam;
5638 msg.bodyval = 0;
5639 break;
5640
5641 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305642 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005643 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 return eSIR_FAILURE;
5645 }
5646
5647 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5648 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305649 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5651 return eSIR_FAILURE;
5652 }
5653 return eSIR_SUCCESS;
5654}
5655
5656/** -------------------------------------------------------------
5657\fn limValidateDeltsReq
5658\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5659\param tpAniSirGlobal pMac
5660\param tpSirDeltsReq pDeltsReq
5661\param tSirMacAddr peerMacAddr
5662\return eSirRetStatus - status
5663 -------------------------------------------------------------*/
5664
5665tSirRetStatus
5666limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5667{
5668 tpDphHashNode pSta;
5669 tANI_U8 tsStatus;
5670 tSirMacTSInfo *tsinfo;
5671 tANI_U32 i;
5672 tANI_U8 tspecIdx;
5673 /* if sta
5674 * - verify assoc state
5675 * - del tspec locally
5676 * if ap,
5677 * - verify sta is in assoc state
5678 * - del sta tspec locally
5679 */
5680 if(pDeltsReq == NULL)
5681 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005682 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 return eSIR_FAILURE;
5684 }
5685
5686 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5687 {
5688 tANI_U32 val;
5689
5690 // station always talks to the AP
5691 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5692
5693 val = sizeof(tSirMacAddr);
5694 #if 0
5695 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5696 {
5697 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005698 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005699 return eSIR_FAILURE;
5700 }
5701 #endif// TO SUPPORT BT-AMP
5702 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5703
5704 }
5705 else
5706 {
5707 tANI_U16 assocId;
5708 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5709
5710 assocId = pDeltsReq->aid;
5711 if (assocId != 0)
5712 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5713 else
5714 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5715
5716 if (pSta != NULL)
5717 // TBD: check sta assoc state as well
5718 for (i =0; i < sizeof(tSirMacAddr); i++)
5719 macaddr[i] = pSta->staAddr[i];
5720 }
5721
5722 if (pSta == NULL)
5723 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005724 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 return eSIR_FAILURE;
5726 }
5727
5728 if ((! pSta->valid) ||
5729 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5730 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005731 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005732 return eSIR_FAILURE;
5733 }
5734
5735 pDeltsReq->req.wsmTspecPresent = 0;
5736 pDeltsReq->req.wmeTspecPresent = 0;
5737 pDeltsReq->req.lleTspecPresent = 0;
5738
5739 if ((pSta->wsmEnabled) &&
5740 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5741 pDeltsReq->req.wsmTspecPresent = 1;
5742 else if (pSta->wmeEnabled)
5743 pDeltsReq->req.wmeTspecPresent = 1;
5744 else if (pSta->lleEnabled)
5745 pDeltsReq->req.lleTspecPresent = 1;
5746 else
5747 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005748 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005749 return eSIR_FAILURE;
5750 }
5751
5752 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5753 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305754 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005755 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005756 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305757 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005758
5759 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005760
5761 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5762 != eSIR_SUCCESS)
5763 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005764 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005765 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5766 return eSIR_FAILURE;
5767 }
5768 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5769 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5770 {
5771 //edca only now.
5772 }
5773 else
5774 {
5775 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5776 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5777 {
5778 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305779 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5780 pSta->staIndex,
5781 tspecIdx,
5782 pDeltsReq->req,
5783 psessionEntry->peSessionId,
5784 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005785 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005786 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005787 tsinfo->traffic.userPrio);
5788 return eSIR_FAILURE;
5789 }
5790 }
5791 }
5792 return eSIR_SUCCESS;
5793}
5794
5795/** -------------------------------------------------------------
5796\fn limRegisterHalIndCallBack
5797\brief registers callback function to HAL for any indication.
5798\param tpAniSirGlobal pMac
5799\return none.
5800 -------------------------------------------------------------*/
5801void
5802limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5803{
5804 tSirMsgQ msg;
5805 tpHalIndCB pHalCB;
5806
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305807 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5808 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005809 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 return;
5812 }
5813
5814 pHalCB->pHalIndCB = limProcessHalIndMessages;
5815
5816 msg.type = WDA_REGISTER_PE_CALLBACK;
5817 msg.bodyptr = pHalCB;
5818 msg.bodyval = 0;
5819
Jeff Johnsone7245742012-09-05 17:12:55 -07005820 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5822 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305823 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005824 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 }
5826
5827 return;
5828}
5829
5830
5831/** -------------------------------------------------------------
5832\fn limProcessAddBaInd
5833
5834\brief handles the BA activity check timeout indication coming from HAL.
5835 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5836\param tpAniSirGlobal pMac
5837\param tSirMsgQ limMsg
5838\return None
5839-------------------------------------------------------------*/
5840void
5841limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5842{
5843 tANI_U8 i;
5844 tANI_U8 tid;
5845 tANI_U16 assocId;
5846 tpDphHashNode pSta;
5847 tpAddBaCandidate pBaCandidate;
5848 tANI_U32 baCandidateCnt;
5849 tpBaActivityInd pBaActivityInd;
5850 tpPESession psessionEntry;
5851 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005852#ifdef FEATURE_WLAN_TDLS
5853 boolean htCapable = FALSE;
5854#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005855
5856
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005857 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005858 return;
5859
5860 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5861 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5862
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005863 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005864 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005865 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305866 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005867 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 return;
5869 }
5870
5871 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005872#ifdef FEATURE_WLAN_TDLS
5873 if ((baCandidateCnt > pMac->lim.maxStation))
5874#else
5875 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5876#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005877 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305878 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005879 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005880 return;
5881 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005882
5883#ifdef FEATURE_WLAN_TDLS
5884 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5885 //AP capability
5886 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5887
5888 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5889 {
5890 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5891 if ((NULL == pSta) || (!pSta->valid))
5892 continue;
5893
5894 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5895 htCapable = pSta->mlmStaContext.htCapability;
5896 else
5897 htCapable = psessionEntry->htCapability;
5898
5899 if (htCapable)
5900 break;
5901 }
5902 if (!htCapable)
5903 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305904 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005905 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005906 return;
5907 }
5908#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005909
5910 //delete the complete dialoguetoken linked list
5911 limDeleteDialogueTokenList(pMac);
5912 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5913
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005914 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 {
5916 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005917 if ((NULL == pSta) || (!pSta->valid))
5918 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005919
5920 for (tid=0; tid<STACFG_MAX_TC; tid++)
5921 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005922 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 (pBaCandidate->baInfo[tid].fBaEnable))
5924 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305925 limLog(pMac, LOG1,
5926 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5927 pSta->staIndex, tid,
5928 pBaCandidate->baInfo[tid].startingSeqNum);
5929 limPostMlmAddBAReq(pMac, pSta, tid,
5930 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 }
5932 }
5933 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305934 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005935 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005936 return;
5937}
5938
5939
5940/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005941\fn limDeleteBASessions
5942\brief Deletes all the exisitng BA sessions for given session
5943 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005944\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005945\param tpPESession pSessionEntry
5946\param tANI_U32 baDirection
5947\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005948-------------------------------------------------------------*/
5949
5950void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005951limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305952 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005953{
5954 tANI_U32 i;
5955 tANI_U8 tid;
5956 tpDphHashNode pSta;
5957
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005958 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005959 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005960 limLog(pMac, LOGE, FL("Session does not exist"));
5961 }
5962 else
5963 {
5964 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005966 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5967 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5968 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5969 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005970 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005971 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005972 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005973 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5974 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005975 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005976 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5977 (baDirection & BA_INITIATOR))
5978 {
5979 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305980 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005981 pSessionEntry);
5982 }
5983 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5984 (baDirection & BA_RECIPIENT))
5985 {
5986 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305987 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005988 pSessionEntry);
5989 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005990 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005991 }
5992 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005993 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5994 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5995 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005996 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005997 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5998 &pSessionEntry->dph.dphHashTable);
5999 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006000 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006001 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
6002 (baDirection & BA_INITIATOR))
6003 {
6004 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306005 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006006 pSessionEntry);
6007 }
6008 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
6009 (baDirection & BA_RECIPIENT))
6010 {
6011 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306012 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006013 pSessionEntry);
6014 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006015 }
6016 }
6017 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006018 }
6019}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006020
6021/** -------------------------------------------------------------
6022\fn limDelAllBASessions
6023\brief Deletes all the exisitng BA sessions.
6024\param tpAniSirGlobal pMac
6025\return None
6026-------------------------------------------------------------*/
6027
6028void limDelAllBASessions(tpAniSirGlobal pMac)
6029{
6030 tANI_U32 i;
6031 tpPESession pSessionEntry;
6032
6033 for (i = 0; i < pMac->lim.maxBssId; i++)
6034 {
6035 pSessionEntry = peFindSessionBySessionId(pMac, i);
6036 if (pSessionEntry)
6037 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306038 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
6039 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006040 }
6041 }
6042}
6043
6044/** -------------------------------------------------------------
6045\fn limDelAllBASessionsBtc
6046\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
6047 band.
6048\param tpAniSirGlobal pMac
6049\return None
6050-------------------------------------------------------------*/
6051
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08006052void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006053{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08006054 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006055 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08006056 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
6057 &sessionId);
6058 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006059 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08006060 PELOGW(limLog(pMac, LOGW,
6061 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05306062 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306063 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006064 }
6065}
6066
Jeff Johnson295189b2012-06-20 16:38:30 -07006067/** -------------------------------------------------------------
6068\fn limProcessDelTsInd
6069\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
6070 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
6071\param tpAniSirGlobal pMac
6072\param tSirMsgQ limMsg
6073\return None
6074-------------------------------------------------------------*/
6075void
6076limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
6077{
6078 tpDphHashNode pSta;
6079 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
6080 tpSirDeltsReq pDelTsReq = NULL;
6081 tSirMacAddr peerMacAddr;
6082 tpSirDeltsReqInfo pDelTsReqInfo;
6083 tpLimTspecInfo pTspecInfo;
6084 tpPESession psessionEntry;
6085 tANI_U8 sessionId;
6086
6087if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
6088 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006089 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306090 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006091 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006092 return;
6093 }
6094
6095 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
6096 if(pTspecInfo->inuse == false)
6097 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006098 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 goto error1;
6100 }
6101
6102 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
6103 if(pSta == NULL)
6104 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006105 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006106 pTspecInfo->assocId);
6107 goto error1;
6108 }
6109
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306110 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
6111 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006112 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306113 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 goto error1;
6115 }
6116
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306117 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006118
6119 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306122 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006123
6124
6125 //validate the req
6126 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
6127 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006128 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006129 goto error2;
6130 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306131 limLog(pMac, LOG1, "Sent DELTS request to station with "
6132 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
6133 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07006134
6135 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
6136 psessionEntry);
6137
6138 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306139 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
6140 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07006141 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306142 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006143 goto error3;
6144 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306145 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006146
6147 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306148 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006149 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306150 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006151
6152 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
6153
6154error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306155 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07006156error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306157 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006158error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306159 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006160 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006161 return;
6162}
6163
6164/**
6165 * \brief Setup an A-MPDU/BA session
6166 *
6167 * \sa limPostMlmAddBAReq
6168 *
6169 * \param pMac The global tpAniSirGlobal object
6170 *
6171 * \param pStaDs DPH Hash Node object of peer STA
6172 *
6173 * \param tid TID for which a BA is being setup.
6174 * If this is set to 0xFFFF, then we retrieve
6175 * the default TID from the CFG
6176 *
6177 * \return eSIR_SUCCESS if setup completes successfully
6178 * eSIR_FAILURE is some problem is encountered
6179 */
6180tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6181 tpDphHashNode pStaDs,
6182 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6183{
6184 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006185 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006186 tpDialogueToken dialogueTokenNode;
6187 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006188
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 // Check if the peer is a 11n capable STA
6190 // FIXME - Need a 11n peer indication in DPH.
6191 // For now, using the taurusPeer attribute
6192 //if( 0 == pStaDs->taurusPeer == )
6193 //return eSIR_SUCCESS;
6194
6195 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306196 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6197 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006198 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306199 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006200 status = eSIR_MEM_ALLOC_FAILED;
6201 goto returnFailure;
6202 }
6203
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306204 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006205
6206 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306207 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006208 pMlmAddBAReq->peerMacAddr,
6209 pStaDs->staAddr,
6210 sizeof( tSirMacAddr ));
6211
6212 // Update the TID
6213 pMlmAddBAReq->baTID = tid;
6214
6215 // Determine the supported BA policy of local STA
6216 // for the TID of interest
6217 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6218
6219 // BA Buffer Size
6220 // Requesting the ADDBA recipient to populate the size.
6221 // If ADDBA is accepted, a non-zero buffer size should
6222 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306223 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6224 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6225 {
6226 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6227 causing very low throughput in HT40 case */
6228 limLog( pMac, LOGW,
6229 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6230 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6231 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306232 else if (pMac->miracastVendorConfig)
6233 {
6234 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6235 {
6236 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6237 status = eSIR_FAILURE;
6238 goto returnFailure;
6239 }
6240
6241 pMlmAddBAReq->baBufferSize = val;
6242 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306243 else
6244 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006245
6246 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306247 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 -07006248 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6249 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306250 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006251
6252 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006253 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006254 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006255 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006256 status = eSIR_FAILURE;
6257 goto returnFailure;
6258 }
6259 pMlmAddBAReq->baTimeout = val; // In TU's
6260
6261 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006262 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006263 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6264 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6265
6266 // BA Starting Sequence Number
6267 pMlmAddBAReq->baSSN = startingSeqNum;
6268
6269 /* Update PE session Id*/
6270 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6271
6272 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6273
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006274 dialogueTokenNode = limAssignDialogueToken(pMac);
6275 if (NULL == dialogueTokenNode)
6276 {
6277 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6278 status = eSIR_FAILURE;
6279 goto returnFailure;
6280 }
6281
Jeff Johnson295189b2012-06-20 16:38:30 -07006282 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006283 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006284 dialogueTokenNode->assocId = pStaDs->assocId;
6285 dialogueTokenNode->tid = tid;
6286 // Send ADDBA Req to MLME
6287 limPostMlmMessage( pMac,
6288 LIM_MLM_ADDBA_REQ,
6289 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006290 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006291
6292returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306293 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 return status;
6295}
6296
6297/**
6298 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6299 * will then send an ADDBA Rsp to peer MAC entity
6300 * with the appropriate ADDBA status code
6301 *
6302 * \sa limPostMlmAddBARsp
6303 *
6304 * \param pMac The global tpAniSirGlobal object
6305 *
6306 * \param peerMacAddr MAC address of peer entity that will
6307 * be the recipient of this ADDBA Rsp
6308 *
6309 * \param baStatusCode ADDBA Rsp status code
6310 *
6311 * \param baDialogToken ADDBA Rsp dialog token
6312 *
6313 * \param baTID TID of interest
6314 *
6315 * \param baPolicy The BA policy
6316 *
6317 * \param baBufferSize The BA buffer size
6318 *
6319 * \param baTimeout BA timeout in TU's
6320 *
6321 * \return eSIR_SUCCESS if setup completes successfully
6322 * eSIR_FAILURE is some problem is encountered
6323 */
6324tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6325 tSirMacAddr peerMacAddr,
6326 tSirMacStatusCodes baStatusCode,
6327 tANI_U8 baDialogToken,
6328 tANI_U8 baTID,
6329 tANI_U8 baPolicy,
6330 tANI_U16 baBufferSize,
6331 tANI_U16 baTimeout,
6332 tpPESession psessionEntry)
6333{
6334tSirRetStatus status = eSIR_SUCCESS;
6335tpLimMlmAddBARsp pMlmAddBARsp;
6336
6337 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306338 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6339 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 {
6341 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306342 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006343 status );
6344
6345 status = eSIR_MEM_ALLOC_FAILED;
6346 goto returnFailure;
6347 }
6348
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306349 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006350
6351 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306352 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006353 pMlmAddBARsp->peerMacAddr,
6354 peerMacAddr,
6355 sizeof( tSirMacAddr ));
6356
6357 pMlmAddBARsp->baDialogToken = baDialogToken;
6358 pMlmAddBARsp->addBAResultCode = baStatusCode;
6359 pMlmAddBARsp->baTID = baTID;
6360 pMlmAddBARsp->baPolicy = baPolicy;
6361 pMlmAddBARsp->baBufferSize = baBufferSize;
6362 pMlmAddBARsp->baTimeout = baTimeout;
6363
6364 /* UPdate PE session ID*/
6365 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6366
6367 // Send ADDBA Rsp to MLME
6368 limPostMlmMessage( pMac,
6369 LIM_MLM_ADDBA_RSP,
6370 (tANI_U32 *) pMlmAddBARsp );
6371
6372returnFailure:
6373
6374 return status;
6375}
6376
6377/**
6378 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6379 * will then send an DELBA Ind to peer MAC entity
6380 * with the appropriate DELBA status code
6381 *
6382 * \sa limPostMlmDelBAReq
6383 *
6384 * \param pMac The global tpAniSirGlobal object
6385 *
6386 * \param pSta DPH Hash Node object of peer MAC entity
6387 * for which the BA session is being deleted
6388 *
6389 * \param baDirection DELBA direction
6390 *
6391 * \param baTID TID for which the BA session is being deleted
6392 *
6393 * \param baReasonCode DELBA Req reason code
6394 *
6395 * \return eSIR_SUCCESS if setup completes successfully
6396 * eSIR_FAILURE is some problem is encountered
6397 */
6398tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6399 tpDphHashNode pSta,
6400 tANI_U8 baDirection,
6401 tANI_U8 baTID,
6402 tSirMacReasonCodes baReasonCode,
6403 tpPESession psessionEntry)
6404{
6405tSirRetStatus status = eSIR_SUCCESS;
6406tpLimMlmDelBAReq pMlmDelBAReq;
6407tLimBAState curBaState;
6408
6409if(NULL == pSta)
6410 return eSIR_FAILURE;
6411
6412LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6413
6414 // Need to validate the current BA State.
6415 if( eLIM_BA_STATE_IDLE != curBaState)
6416 {
6417 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006418 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006419 baTID,
6420 curBaState);
6421
6422 status = eSIR_FAILURE;
6423 goto returnFailure;
6424 }
6425
6426 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306427 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6428 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 {
6430 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306431 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006432 status );
6433
6434 status = eSIR_MEM_ALLOC_FAILED;
6435 goto returnFailure;
6436 }
6437
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306438 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006439
6440 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306441 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006442 pMlmDelBAReq->peerMacAddr,
6443 pSta->staAddr,
6444 sizeof( tSirMacAddr ));
6445
6446 pMlmDelBAReq->baDirection = baDirection;
6447 pMlmDelBAReq->baTID = baTID;
6448 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6449
6450 /* Update PE session ID*/
6451 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6452
6453 //we don't have valid BA session for the given direction.
6454 // HDD wants to get the BA session deleted on PEER in this case.
6455 // in this case we just need to send DelBA to the peer.
6456 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6457 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6458 {
6459 // Send DELBA Ind over the air
6460 if( eSIR_SUCCESS !=
6461 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6462 status = eSIR_FAILURE;
6463
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306464 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006465 return status;
6466 }
6467
6468
6469 // Update the BA state in STA
6470 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6471
6472 // Send DELBA Req to MLME
6473 limPostMlmMessage( pMac,
6474 LIM_MLM_DELBA_REQ,
6475 (tANI_U32 *) pMlmDelBAReq );
6476
6477returnFailure:
6478
6479 return status;
6480}
6481
6482/**
6483 * \brief Send WDA_ADDBA_REQ to HAL, in order
6484 * to setup a new BA session with a peer
6485 *
6486 * \sa limPostMsgAddBAReq
6487 *
6488 * \param pMac The global tpAniSirGlobal object
6489 *
6490 * \param pSta Runtime, STA-related configuration cached
6491 * in the HashNode object
6492 *
6493 * \param baDialogToken The Action Frame dialog token
6494 *
6495 * \param baTID TID for which the BA session is being setup
6496 *
6497 * \param baPolicy BA Policy
6498 *
6499 * \param baBufferSize The requested BA buffer size
6500 *
6501 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6502 *
6503 * \param baSSN Starting Sequence Number for this BA session
6504 *
6505 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6506 *
6507 * \return none
6508 *
6509 */
6510tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6511 tpDphHashNode pSta,
6512 tANI_U8 baDialogToken,
6513 tANI_U8 baTID,
6514 tANI_U8 baPolicy,
6515 tANI_U16 baBufferSize,
6516 tANI_U16 baTimeout,
6517 tANI_U16 baSSN,
6518 tANI_U8 baDirection,
6519 tpPESession psessionEntry)
6520{
6521tpAddBAParams pAddBAParams = NULL;
6522tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006523tSirMsgQ msgQ;
6524
6525#ifdef WLAN_SOFTAP_VSTA_FEATURE
6526 // we can only do BA on "hard" STAs
6527 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6528 {
6529 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306530 limLog( pMac, LOGE,
6531 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006532 goto returnFailure;
6533 }
6534#endif //WLAN_SOFTAP_VSTA_FEATURE
6535
6536 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306537 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6538 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006539 {
6540 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306541 FL("AllocateMemory failed")
6542 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006543
6544 retCode = eSIR_MEM_ALLOC_FAILED;
6545 goto returnFailure;
6546 }
6547
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306548 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006549
6550 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306551 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006552 (void *) pAddBAParams->peerMacAddr,
6553 (void *) pSta->staAddr,
6554 sizeof( tSirMacAddr ));
6555
6556 // Populate the REQ parameters
6557 pAddBAParams->staIdx = pSta->staIndex;
6558 pAddBAParams->baDialogToken = baDialogToken;
6559 pAddBAParams->baTID = baTID;
6560 pAddBAParams->baPolicy = baPolicy;
6561 pAddBAParams->baBufferSize = baBufferSize;
6562 pAddBAParams->baTimeout = baTimeout;
6563 pAddBAParams->baSSN = baSSN;
6564 pAddBAParams->baDirection = baDirection;
6565 pAddBAParams->respReqd = 1;
6566
6567 /* UPdate PE session ID */
6568 pAddBAParams->sessionId = psessionEntry->peSessionId;
6569
6570 // Post WDA_ADDBA_REQ to HAL.
6571 msgQ.type = WDA_ADDBA_REQ;
6572 //
6573 // FIXME_AMPDU
6574 // A global counter (dialog token) is required to keep track of
6575 // all PE <-> HAL communication(s)
6576 //
6577 msgQ.reserved = 0;
6578 msgQ.bodyptr = pAddBAParams;
6579 msgQ.bodyval = 0;
6580
6581 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306582 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6583 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6584 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6585 pAddBAParams->baTimeout, pAddBAParams->baTID,
6586 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6587 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006588
6589 //defer any other message until we get response back.
6590 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6591
Jeff Johnsone7245742012-09-05 17:12:55 -07006592 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006593#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6594 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6595#endif //FEATURE_WLAN_DIAG_SUPPORT
6596
6597 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6598 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006599 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 retCode );
6601 else
6602 return retCode;
6603
6604returnFailure:
6605
6606 // Clean-up...
6607 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306608 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006609
6610 return retCode;
6611
6612}
6613
6614/**
6615 * \brief Send WDA_DELBA_IND to HAL, in order
6616 * to delete an existing BA session with peer
6617 *
6618 * \sa limPostMsgDelBAInd
6619 *
6620 * \param pMac The global tpAniSirGlobal object
6621 *
6622 * \param pSta Runtime, STA-related configuration cached
6623 * in the HashNode object
6624 *
6625 * \param baTID TID for which the BA session is being setup
6626 *
6627 * \param baDirection Identifies whether the DELBA Ind was
6628 * sent by the BA initiator or recipient
6629 *
6630 * \return none
6631 *
6632 */
6633tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6634 tpDphHashNode pSta,
6635 tANI_U8 baTID,
6636 tANI_U8 baDirection,
6637 tpPESession psessionEntry)
6638{
6639tpDelBAParams pDelBAParams = NULL;
6640tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006641tSirMsgQ msgQ;
6642
6643 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306644 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6645 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006646 {
6647 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306648 FL("AllocateMemory failed")
6649 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006650
6651 retCode = eSIR_MEM_ALLOC_FAILED;
6652 goto returnFailure;
6653 }
6654
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306655 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006656
6657 // Populate the REQ parameters
6658 pDelBAParams->staIdx = pSta->staIndex;
6659 pDelBAParams->baTID = baTID;
6660 pDelBAParams->baDirection = baDirection;
6661
6662 /* Update PE session ID */
6663
6664
6665 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6666 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6667
6668 // Post WDA_DELBA_IND to HAL.
6669 msgQ.type = WDA_DELBA_IND;
6670 //
6671 // FIXME:
6672 // A global counter (dialog token) is required to keep track of
6673 // all PE <-> HAL communication(s)
6674 //
6675 msgQ.reserved = 0;
6676 msgQ.bodyptr = pDelBAParams;
6677 msgQ.bodyval = 0;
6678
6679 limLog( pMac, LOGW,
6680 FL( "Sending SIR_HAL_DELBA_IND..." ));
6681
Jeff Johnsone7245742012-09-05 17:12:55 -07006682 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006683#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6684 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6685#endif //FEATURE_WLAN_DIAG_SUPPORT
6686
6687 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6688 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006689 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006690 retCode );
6691 else
6692 {
6693 // Update LIM's internal cache...
6694 if( eBA_INITIATOR == baDirection)
6695 {
6696 pSta->tcCfg[baTID].fUseBATx = 0;
6697 pSta->tcCfg[baTID].txBufSize = 0;
6698 }
6699 else
6700 {
6701 pSta->tcCfg[baTID].fUseBARx = 0;
6702 pSta->tcCfg[baTID].rxBufSize = 0;
6703 }
6704
6705 return retCode;
6706 }
6707
6708returnFailure:
6709
6710 // Clean-up...
6711 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306712 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006713
6714 return retCode;
6715
6716}
6717
6718/**
6719 * @function : limPostSMStateUpdate()
6720 *
6721 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6722 *
6723 * LOGIC:
6724 *
6725 * ASSUMPTIONS:
6726 * NA
6727 *
6728 * NOTE:
6729 * NA
6730 *
6731 * @param pMac - Pointer to Global MAC structure
6732 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6733 * @return None
6734 */
6735tSirRetStatus
6736limPostSMStateUpdate(tpAniSirGlobal pMac,
6737 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6738{
6739 tSirRetStatus retCode = eSIR_SUCCESS;
6740 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 tpSetMIMOPS pMIMO_PSParams;
6742
6743 msgQ.reserved = 0;
6744 msgQ.type = WDA_SET_MIMOPS_REQ;
6745
6746 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306747 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6748 if ( NULL == pMIMO_PSParams )
6749 {
6750 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 return eSIR_MEM_ALLOC_FAILED;
6752 }
6753
6754 pMIMO_PSParams->htMIMOPSState = state;
6755 pMIMO_PSParams->staIdx = staIdx;
6756 pMIMO_PSParams->fsendRsp = true;
6757 msgQ.bodyptr = pMIMO_PSParams;
6758 msgQ.bodyval = 0;
6759
6760 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6761
Jeff Johnsone7245742012-09-05 17:12:55 -07006762 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6764 if (eSIR_SUCCESS != retCode)
6765 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006766 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306767 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 return retCode;
6769 }
6770
6771 return retCode;
6772}
6773
6774void limPktFree (
6775 tpAniSirGlobal pMac,
6776 eFrameType frmType,
6777 tANI_U8 *pRxPacketInfo,
6778 void *pBody)
6779{
6780 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006781}
6782
6783/**
6784 * limGetBDfromRxPacket()
6785 *
6786 *FUNCTION:
6787 * This function is called to get pointer to Polaris
6788 * Buffer Descriptor containing MAC header & other control
6789 * info from the body of the message posted to LIM.
6790 *
6791 *LOGIC:
6792 * NA
6793 *
6794 *ASSUMPTIONS:
6795 * NA
6796 *
6797 *NOTE:
6798 * NA
6799 *
6800 * @param body - Received message body
6801 * @param pRxPacketInfo - Pointer to received BD
6802 * @return None
6803 */
6804
6805void
6806limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6807{
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006809} /*** end limGetBDfromRxPacket() ***/
6810
6811
6812
6813
6814
6815void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6816{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306817 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006818}
6819
6820
6821void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6822{
6823 tANI_U8 i;
6824 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6825
6826 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6827 {
6828 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6829 {
6830 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6831 fFound = eANI_BOOLEAN_TRUE;
6832 break;
6833 }
6834 }
6835 if(eANI_BOOLEAN_FALSE == fFound)
6836 {
6837 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6838 {
6839 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6840 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6841 }
6842 else
6843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006844 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006845 }
6846 }
6847}
6848
6849
6850/**
6851 * @function : limIsChannelValidForChannelSwitch()
6852 *
6853 * @brief : This function checks if the channel to which AP
6854 * is expecting us to switch, is a valid channel for us.
6855 * LOGIC:
6856 *
6857 * ASSUMPTIONS:
6858 * NA
6859 *
6860 * NOTE:
6861 * NA
6862 *
6863 * @param pMac - Pointer to Global MAC structure
6864 * @param channel - New channel to which we are expected to move
6865 * @return None
6866 */
6867tAniBool
6868limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6869{
6870 tANI_U8 index;
6871 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6872 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6873
6874 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6875 (tANI_U8 *)validChannelList,
6876 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006878 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006879 return (eSIR_FALSE);
6880 }
6881
6882 for(index = 0; index < validChannelListLen; index++)
6883 {
6884 if(validChannelList[index] == channel)
6885 return (eSIR_TRUE);
6886 }
6887
6888 /* channel does not belong to list of valid channels */
6889 return (eSIR_FALSE);
6890}
6891
6892/**------------------------------------------------------
6893\fn __limFillTxControlParams
6894\brief Fill the message for stopping/resuming tx.
6895
6896\param pMac
6897\param pTxCtrlMsg - Pointer to tx control message.
6898\param type - Which way we want to stop/ resume tx.
6899\param mode - To stop/resume.
6900 -------------------------------------------------------*/
6901static eHalStatus
6902__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6903 tLimQuietTxMode type, tLimControlTx mode)
6904{
6905
6906 //TBD-RAJESH HOW TO GET sessionEntry?????
6907 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6908
6909 if (mode == eLIM_STOP_TX)
6910 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6911 else
6912 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6913
6914 switch (type)
6915 {
6916 case eLIM_TX_ALL:
6917 /** Stops/resumes transmission completely */
6918 pTxCtrlMsg->fCtrlGlobal = 1;
6919 break;
6920
6921 case eLIM_TX_BSS_BUT_BEACON:
6922 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6923 * stop beacon transmission.
6924 */
6925 pTxCtrlMsg->ctrlBss = 1;
6926 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6927 break;
6928
6929 case eLIM_TX_STA:
6930 /** Memory for station bitmap is allocated dynamically in caller of this
6931 * so decode properly here and fill the bitmap. Now not implemented,
6932 * fall through.
6933 */
6934 case eLIM_TX_BSS:
6935 //Fall thru...
6936 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006937 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006938 return eHAL_STATUS_FAILURE;
6939 }
6940
6941 return eHAL_STATUS_SUCCESS;
6942}
6943
6944/**
6945 * @function : limFrameTransmissionControl()
6946 *
6947 * @brief : This API is called by the user to halt/resume any frame
6948 * transmission from the device. If stopped, all frames will be
6949 * queued starting from hardware. Then back-pressure
6950 * is built till the driver.
6951 * LOGIC:
6952 *
6953 * ASSUMPTIONS:
6954 * NA
6955 *
6956 * NOTE:
6957 * NA
6958 *
6959 * @param pMac - Pointer to Global MAC structure
6960 * @return None
6961 */
6962void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6963{
6964
6965 eHalStatus status = eHAL_STATUS_FAILURE;
6966 tpTxControlParams pTxCtrlMsg;
6967 tSirMsgQ msgQ;
6968 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6969
6970 /** Allocate only required number of bytes for station bitmap
6971 * Make it to align to 4 byte boundary */
6972 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6973
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306974 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6975 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006976 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306977 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006978 return;
6979 }
6980
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306981 vos_mem_set((void *) pTxCtrlMsg,
6982 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006983 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6984 if (status != eHAL_STATUS_SUCCESS)
6985 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306986 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006987 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006988 return;
6989 }
6990
6991 msgQ.bodyptr = (void *) pTxCtrlMsg;
6992 msgQ.bodyval = 0;
6993 msgQ.reserved = 0;
6994 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6995
Jeff Johnsone7245742012-09-05 17:12:55 -07006996 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006997 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6998 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306999 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007000 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007001 return;
7002 }
7003
7004 if (mode == eLIM_STOP_TX)
7005 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307006 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007007 }
7008 else
7009 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307010 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 }
7012 return;
7013}
7014
7015
7016/**
7017 * @function : limRestorePreChannelSwitchState()
7018 *
7019 * @brief : This API is called by the user to undo any
7020 * specific changes done on the device during
7021 * channel switch.
7022 * LOGIC:
7023 *
7024 * ASSUMPTIONS:
7025 * NA
7026 *
7027 * NOTE:
7028 * NA
7029 *
7030 * @param pMac - Pointer to Global MAC structure
7031 * @return None
7032 */
7033
7034tSirRetStatus
7035limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
7036{
7037
7038 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007039 tANI_U32 val = 0;
7040
7041 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7042 return retCode;
7043
7044 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007045 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007046
7047 /* Restore the frame transmission, all the time. */
7048 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7049
7050 /* Free to enter BMPS */
7051 limSendSmePostChannelSwitchInd(pMac);
7052
7053 //Background scan is now enabled by SME
7054 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7055 {
7056 /* Enable background scan if already enabled, else don't bother */
7057 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7058 &val)) != eSIR_SUCCESS)
7059
7060 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007061 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007062 return (retCode);
7063 }
7064
7065 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7066 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007067 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7068 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007069 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7070 {
7071 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7072 return (eSIR_FAILURE);
7073 }
7074
7075 }
7076 }
7077
7078 /* Enable heartbeat timer */
7079 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7080 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007081 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7082 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
7083 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
7084 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007085 {
7086 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7087 return (eSIR_FAILURE);
7088 }
7089 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007090 return (retCode);
7091}
7092
7093
7094/**--------------------------------------------
7095\fn limRestorePreQuietState
7096\brief Restore the pre quiet state
7097
7098\param pMac
7099\return NONE
7100---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007101tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07007102{
7103
7104 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007105 tANI_U32 val = 0;
7106
7107 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
7108 return retCode;
7109
7110 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007111 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007112
7113 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07007114 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07007115 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7116
7117
7118 //Background scan is now enabled by SME
7119 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7120 {
7121 /* Enable background scan if already enabled, else don't bother */
7122 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7123 &val)) != eSIR_SUCCESS)
7124
7125 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007126 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007127 return (retCode);
7128 }
7129
7130 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7131 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007132 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007133 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7134 {
7135 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7136 return (eSIR_FAILURE);
7137 }
7138
7139 }
7140 }
7141
7142 /* Enable heartbeat timer */
7143 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7144 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007145 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007146 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07007147 {
7148 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7149 return (eSIR_FAILURE);
7150 }
7151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007152 return (retCode);
7153}
7154
7155
7156/**
7157 * @function: limPrepareFor11hChannelSwitch()
7158 *
7159 * @brief : This API is called by the user to prepare for
7160 * 11h channel switch. As of now, the API does
7161 * very minimal work. User can add more into the
7162 * same API if needed.
7163 * LOGIC:
7164 *
7165 * ASSUMPTIONS:
7166 * NA
7167 *
7168 * NOTE:
7169 * NA
7170 *
7171 * @param pMac - Pointer to Global MAC structure
7172 * @param psessionEntry
7173 * @return None
7174 */
7175void
7176limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7177{
Jeff Johnson295189b2012-06-20 16:38:30 -07007178 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7179 return;
7180
7181 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007182 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007183
7184 /* Disable, Stop background scan if enabled and running */
7185 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7186
7187 /* Stop heart-beat timer to stop heartbeat disassociation */
7188 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7189
7190 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7191 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7192 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007193 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007194 /* Stop ongoing scanning if any */
7195 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7196 {
7197 //Set the resume channel to Any valid channel (invalid).
7198 //This will instruct HAL to set it to any previous valid channel.
7199 peSetResumeChannel(pMac, 0, 0);
7200 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7201 }
7202 else
7203 {
7204 limRestorePreChannelSwitchState(pMac, psessionEntry);
7205 }
7206 return;
7207 }
7208 else
7209 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007210 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007211 /** We are safe to switch channel at this point */
7212 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7213 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007214}
7215
7216
7217
7218/**----------------------------------------------------
7219\fn limGetNwType
7220
7221\brief Get type of the network from data packet or beacon
7222\param pMac
7223\param channelNum - Channel number
7224\param type - Type of packet.
7225\param pBeacon - Pointer to beacon or probe response
7226
7227\return Network type a/b/g.
7228-----------------------------------------------------*/
7229tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7230{
7231 tSirNwType nwType = eSIR_11B_NW_TYPE;
7232
7233 if (type == SIR_MAC_DATA_FRAME)
7234 {
7235 if ((channelNum > 0) && (channelNum < 15))
7236 {
7237 nwType = eSIR_11G_NW_TYPE;
7238 }
7239 else
7240 {
7241 nwType = eSIR_11A_NW_TYPE;
7242 }
7243 }
7244 else
7245 {
7246 if ((channelNum > 0) && (channelNum < 15))
7247 {
7248 int i;
7249 // 11b or 11g packet
7250 // 11g iff extended Rate IE is present or
7251 // if there is an A rate in suppRate IE
7252 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7253 {
7254 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7255 {
7256 nwType = eSIR_11G_NW_TYPE;
7257 break;
7258 }
7259 }
7260 if (pBeacon->extendedRatesPresent)
7261 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007262 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007263 nwType = eSIR_11G_NW_TYPE;
7264 }
7265 }
7266 else
7267 {
7268 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007269 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007270 nwType = eSIR_11A_NW_TYPE;
7271 }
7272 }
7273 return nwType;
7274}
7275
7276
7277/**---------------------------------------------------------
7278\fn limGetChannelFromBeacon
7279\brief To extract channel number from beacon
7280
7281\param pMac
7282\param pBeacon - Pointer to beacon or probe rsp
7283\return channel number
7284-----------------------------------------------------------*/
7285tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7286{
7287 tANI_U8 channelNum = 0;
7288
7289 if (pBeacon->dsParamsPresent)
7290 channelNum = pBeacon->channelNumber;
7291 else if(pBeacon->HTInfo.present)
7292 channelNum = pBeacon->HTInfo.primaryChannel;
7293 else
7294 channelNum = pBeacon->channelNumber;
7295
7296 return channelNum;
7297}
7298
7299
7300/** ---------------------------------------------------------
7301\fn limSetTspecUapsdMask
7302\brief This function sets the PE global variable:
7303\ 1) gUapsdPerAcTriggerEnableMask and
7304\ 2) gUapsdPerAcDeliveryEnableMask
7305\ based on the user priority field and direction field
7306\ in the TS Info Fields.
7307\
7308\ An AC is a trigger-enabled AC if the PSB subfield
7309\ is set to 1 in the uplink direction.
7310\ An AC is a delivery-enabled AC if the PSB subfield
7311\ is set to 1 in the down-link direction.
7312\
7313\param tpAniSirGlobal pMac
7314\param tSirMacTSInfo pTsInfo
7315\param tANI_U32 action
7316\return None
7317 ------------------------------------------------------------*/
7318void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7319{
7320 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7321 tANI_U16 direction = pTsInfo->traffic.direction;
7322 tANI_U8 ac = upToAc(userPrio);
7323
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307324 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 -07007325
7326 /* Converting AC to appropriate Uapsd Bit Mask
7327 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7328 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7329 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7330 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7331 */
7332 ac = ((~ac) & 0x3);
7333
7334 if (action == CLEAR_UAPSD_MASK)
7335 {
7336 if (direction == SIR_MAC_DIRECTION_UPLINK)
7337 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7338 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7339 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7340 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7341 {
7342 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7343 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7344 }
7345 }
7346 else if (action == SET_UAPSD_MASK)
7347 {
7348 if (direction == SIR_MAC_DIRECTION_UPLINK)
7349 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7350 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7351 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7352 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7353 {
7354 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7355 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7356 }
7357 }
7358
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007359 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7360 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007361
7362 return;
7363}
7364
7365
7366
7367void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7368{
7369
7370 tANI_U8 i;
7371 for(i =0;i < pMac->lim.maxBssId;i++)
7372 {
7373 if(pMac->lim.gpSession[i].valid == TRUE )
7374 {
7375 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7376 {
7377 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7378 break;
7379 }
7380
7381 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7382 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7383 {
7384 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7385 }
7386 }
7387 }
7388 for(i=0; i< pMac->lim.maxBssId; i++)
7389 {
7390 if(pMac->lim.gpSession[i].valid == TRUE )
7391 {
7392 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7393 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7394 {
7395 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7396 {
7397 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007398 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 i);)
7400 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7401 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7402 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7403 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007404 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007405 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7406 }
7407 break;
7408 }
7409 }
7410 }
7411 }
7412}
7413
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007414void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7415{
7416 if(psessionEntry->valid == TRUE )
7417 {
7418 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7419 {
7420 limIbssHeartBeatHandle(pMac,psessionEntry);
7421 }
7422 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7423 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7424 {
7425 limHandleHeartBeatFailure(pMac,psessionEntry);
7426 }
7427 }
7428 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7429 and the other things again */
7430 if(psessionEntry->valid == TRUE )
7431 {
7432 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7433 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7434 {
7435 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7436 {
7437 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7438 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7439 psessionEntry->bssIdx);)
7440 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7441 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7442 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7443 {
7444 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7445 limReactivateHeartBeatTimer(pMac, psessionEntry);
7446 }
7447 }
7448 }
7449 }
7450}
7451
7452
Jeff Johnson295189b2012-06-20 16:38:30 -07007453tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7454{
7455 tANI_U8 i;
7456 for(i =0;i < pMac->lim.maxBssId;i++)
7457 {
7458 if(pMac->lim.gpSession[i].valid == TRUE )
7459 {
7460 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7461 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7462 {
7463 return pMac->lim.gpSession[i].currentOperChannel;
7464 }
7465 }
7466 }
7467 return 0;
7468}
7469
7470void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7471{
7472
7473 tpPESession psessionEntry;
7474// tANI_U8 sessionId;
7475 tpAddStaParams pAddStaParams;
7476
7477 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7478
7479 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7480 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007481 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307482 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007483 return;
7484 }
7485 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7486 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007487#ifdef FEATURE_WLAN_TDLS
7488 else if(pMac->lim.gLimAddStaTdls)
7489 {
7490 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7491 pMac->lim.gLimAddStaTdls = FALSE ;
7492 }
7493#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007494 else
7495 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7496
7497}
7498
7499
7500void limUpdateBeacon(tpAniSirGlobal pMac)
7501{
7502 tANI_U8 i;
7503
7504 for(i =0;i < pMac->lim.maxBssId;i++)
7505 {
7506 if(pMac->lim.gpSession[i].valid == TRUE )
7507 {
7508 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7509 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7510 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7511 )
7512 {
7513 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7514 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7515 }
7516 else
7517 {
7518 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7519 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7520 {
7521
7522 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7523 {
7524 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7525 }
7526 }
7527 }
7528 }
7529 }
7530}
7531
7532void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7533{
7534 tANI_U8 i;
7535 tpPESession psessionEntry;
7536 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7537 for(i =0; i < pMac->lim.maxBssId; i++)
7538 {
7539 if(pMac->lim.gpSession[i].valid == TRUE)
7540 {
7541 psessionEntry = &pMac->lim.gpSession[i];
7542 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7543 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307544 limLog(pMac, LOGE,
7545 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7546 psessionEntry->limSmeState, psessionEntry->limMlmState,
7547 psessionEntry->LimRxedBeaconCntDuringHB,
7548 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007549#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7550 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7551#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007552 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7553 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307554 /* Disconnect even if we have not received a single beacon
7555 * after connection.
7556 */
7557 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7558 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307559 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7560 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007561 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007562 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007563 /* AP did not respond to Probe Request. Tear down link with it.*/
7564 limTearDownLinkWithAp(pMac,
7565 psessionEntry->peSessionId,
7566 eSIR_BEACON_MISSED);
7567 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7568 }
7569 else // restart heartbeat timer
7570 {
7571 limReactivateHeartBeatTimer(pMac, psessionEntry);
7572 }
7573 }
7574 else
7575 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007576 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007577 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7578 limReactivateHeartBeatTimer(pMac, psessionEntry);
7579 }
7580
7581 }
7582 }
7583 }
7584 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7585 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7586}
7587
7588
7589/*
7590* This function assumes there will not be more than one IBSS session active at any time.
7591*/
7592tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7593{
7594 tANI_U8 i;
7595
7596 for(i =0;i < pMac->lim.maxBssId;i++)
7597 {
7598 if( (pMac->lim.gpSession[i].valid) &&
7599 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7600 return (&pMac->lim.gpSession[i]);
7601 }
7602
7603 return NULL;
7604}
7605
7606tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7607{
7608 tANI_U8 i;
7609
7610 for(i =0;i < pMac->lim.maxBssId;i++)
7611 {
7612 if( (pMac->lim.gpSession[i].valid) &&
7613 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7614 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7615 return (&pMac->lim.gpSession[i]);
7616 }
7617
7618 return NULL;
7619}
7620
7621/**---------------------------------------------------------
7622\fn limHandleDeferMsgError
7623\brief handles error scenario, when the msg can not be deferred.
7624\param pMac
7625\param pLimMsg LIM msg, which could not be deferred.
7626\return void
7627-----------------------------------------------------------*/
7628
7629void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7630{
7631 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7632 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307633 /*Decrement the Pending count before droping */
7634 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007635 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7636 }
7637 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007638 {
7639 vos_mem_free( pLimMsg->bodyptr);
7640 pLimMsg->bodyptr = NULL;
7641 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007642}
7643
7644
7645#ifdef FEATURE_WLAN_DIAG_SUPPORT
7646/**---------------------------------------------------------
7647\fn limDiagEventReport
7648\brief This function reports Diag event
7649\param pMac
7650\param eventType
7651\param bssid
7652\param status
7653\param reasonCode
7654\return void
7655-----------------------------------------------------------*/
7656void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7657{
7658 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7659 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7660
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307661 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007662
7663 if (NULL == pSessionEntry)
7664 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307665 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007666 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7667 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7668
7669 }
7670 else
7671 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307672 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007673 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7674 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7675 }
7676 peEvent.event_type = eventType;
7677 peEvent.status = status;
7678 peEvent.reason_code = reasonCode;
7679
7680 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7681 return;
7682}
7683
7684#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7685
7686void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7687{
7688
7689 tpAddStaSelfParams pAddStaSelfParams;
7690 tSirMsgQ mmhMsg;
7691 tpSirSmeAddStaSelfRsp pRsp;
7692
7693
7694 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7695
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307696 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7697 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007698 {
7699 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307700 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7701 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007702 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007703 return;
7704 }
7705
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307706 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007707
7708 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7709 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7710 pRsp->status = pAddStaSelfParams->status;
7711
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307712 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007713
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307714 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007715 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007716
7717 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7718 mmhMsg.bodyptr = pRsp;
7719 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307720 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007721 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7722
7723}
7724
7725void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7726{
7727
7728 tpDelStaSelfParams pDelStaSelfParams;
7729 tSirMsgQ mmhMsg;
7730 tpSirSmeDelStaSelfRsp pRsp;
7731
7732
7733 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7734
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307735 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7736 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007737 {
7738 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307739 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7740 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007741 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007742 return;
7743 }
7744
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307745 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007746
7747 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7748 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7749 pRsp->status = pDelStaSelfParams->status;
7750
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307751 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007752
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307753 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007754 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007755
7756 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7757 mmhMsg.bodyptr = pRsp;
7758 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307759 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007760 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7761
7762}
7763
7764/***************************************************************
7765* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7766* To unmap the channel to reverse the effect of mapping
7767* a band channel in hal .Mapping was done hal to overcome the
7768* limitation of the rxbd which use only 4 bit for channel number.
7769*****************************************************************/
7770tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7771{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007772#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007773 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007774 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7775 return aUnsortedChannelList[mapChannel -1];
7776 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007777#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007778 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007779#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007780 return abChannel[mapChannel -1];
7781 else
7782 return 0;
7783}
7784
7785
7786v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7787{
7788 int left = length;
7789 v_U8_t *ptr = pIes;
7790 v_U8_t elem_id;
7791 v_U16_t elem_len;
7792
7793 while(left >= (size_of_len_field+1))
7794 {
7795 elem_id = ptr[0];
7796 if (size_of_len_field == TWO_BYTE)
7797 {
7798 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7799 }
7800 else
7801 {
7802 elem_len = ptr[1];
7803 }
7804
7805
7806 left -= (size_of_len_field+1);
7807 if(elem_len > left)
7808 {
7809 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007810 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007811 eid,elem_len,left);
7812 return NULL;
7813 }
7814 if (elem_id == eid)
7815 {
7816 return ptr;
7817 }
7818
7819 left -= elem_len;
7820 ptr += (elem_len + (size_of_len_field+1));
7821 }
7822 return NULL;
7823}
7824
7825/* return NULL if oui is not found in ie
7826 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7827 */
7828v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7829{
7830 int left = ie_len;
7831 v_U8_t *ptr = ie;
7832 v_U8_t elem_id, elem_len;
7833
7834 while(left >= 2)
7835 {
7836 elem_id = ptr[0];
7837 elem_len = ptr[1];
7838 left -= 2;
7839 if(elem_len > left)
7840 {
7841 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007842 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007843 elem_id,elem_len,left);
7844 return NULL;
7845 }
7846 if (SIR_MAC_EID_VENDOR == elem_id)
7847 {
7848 if(memcmp(&ptr[2], oui, oui_size)==0)
7849 return ptr;
7850 }
7851
7852 left -= elem_len;
7853 ptr += (elem_len + 2);
7854 }
7855 return NULL;
7856}
7857
Jeff Johnson295189b2012-06-20 16:38:30 -07007858//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7859
7860v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7861{
7862 int length = 0;
7863 tANI_U8 *ptr = ie;
7864
7865 ptr[length++] = SIR_MAC_EID_VENDOR;
7866 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307867 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7868 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007869 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7870}
7871
7872//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7873
7874v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7875{
7876 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007877
7878 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7879 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7880 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307881 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007882 noaStream + noaLen - overFlowLen, overFlowLen);
7883 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7884 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307885 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007886 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307887 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7888 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007889 }
7890
Jeff Johnson295189b2012-06-20 16:38:30 -07007891 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7892
7893}
7894
7895//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7896v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7897{
7898 v_U8_t len=0;
7899
7900 v_U8_t *pBody = pNoaStream;
7901
7902
7903 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7904 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7905 {
7906 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7907 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7908 )
7909 return 0; //No NoA Descriptor then return 0
7910
7911
7912 pBody[0] = SIR_P2P_NOA_ATTR;
7913
7914 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7915 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7916 len = 5;
7917 pBody += len;
7918
7919
7920 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7921 {
7922 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7923 pBody += 1;
7924 len +=1;
7925
7926 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7927 pBody += sizeof(tANI_U32);
7928 len +=4;
7929
7930 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7931 pBody += sizeof(tANI_U32);
7932 len +=4;
7933
7934 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7935 pBody += sizeof(tANI_U32);
7936 len +=4;
7937
7938 }
7939
7940 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7941 {
7942 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7943 pBody += 1;
7944 len +=1;
7945
7946 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7947 pBody += sizeof(tANI_U32);
7948 len +=4;
7949
7950 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7951 pBody += sizeof(tANI_U32);
7952 len +=4;
7953
7954 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7955 pBody += sizeof(tANI_U32);
7956 len +=4;
7957
7958 }
7959
7960
7961 pBody = pNoaStream + 1;
7962 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7963
7964 return (len);
7965
7966 }
7967 return 0;
7968
7969}
Jeff Johnsone7245742012-09-05 17:12:55 -07007970
7971void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007972{
7973
7974 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007975 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007976}
Jeff Johnsone7245742012-09-05 17:12:55 -07007977
Jeff Johnson295189b2012-06-20 16:38:30 -07007978/*--------------------------------------------------------------------------
7979
7980 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7981
Jeff Johnsone7245742012-09-05 17:12:55 -07007982 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7983 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007984
7985 \param pMac - pointer to global adapter context
7986 \return - channel to scan from valid session else zero.
7987
7988 \sa
7989
7990 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007991void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007992{
7993
7994 //Rationale - this could be the suspend/resume for assoc and it is essential that
7995 //the new BSS is active for some time. Other BSS was anyway suspended.
7996 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7997 //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 -07007998 //and hence should be ok. Need to discuss this further
7999 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07008000 {
8001 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07008002 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07008003 }
8004 else
8005 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008006 *resumeChannel = pMac->lim.gResumeChannel;
8007 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07008008 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008009 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07008010}
8011
Viral Modid86bde22012-12-10 13:09:21 -08008012tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
8013{
8014 tANI_U8 i;
8015 for(i =0; i < pMac->lim.maxBssId; i++)
8016 {
8017 if(pMac->lim.gpSession[i].valid == TRUE)
8018 {
8019 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
8020 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
8021 )
8022 {
8023 return TRUE;
8024 }
8025 }
8026 }
8027 return FALSE;
8028}
Jeff Johnsone7245742012-09-05 17:12:55 -07008029
Jeff Johnson295189b2012-06-20 16:38:30 -07008030
8031tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
8032{
8033 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
8034 {
8035 return eANI_BOOLEAN_TRUE;
8036 }
8037 else
8038 {
8039 return eANI_BOOLEAN_FALSE;
8040 }
8041}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07008042
Sandeep Puligilla60342762014-01-30 21:05:37 +05308043/**
8044 * \brief verify the changes in channel bonding
8045 *
8046 * \param pMac Pointer to the global MAC structure
8047 *
8048 * \param psessionEntry session entry
8049 * beaconSecChanWidth Secondary channel width
8050 * advertized in beacon
8051 * currentSecChanWidth Current configured width
8052 * staId Station Id
8053 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
8054 */
8055tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
8056 tpPESession psessionEntry,
8057 tANI_U8 beaconSecChanWidth,
8058 tANI_U8 currentSecChanWidth,
8059 tANI_U8 staId)
8060{
8061 tUpdateVHTOpMode tempParam;
8062 tANI_BOOLEAN fCbMode24G = FALSE;
8063 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
8064
8065 /* Moving from HT40 to HT20 operation*/
8066 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
8067 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
8068 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
8069 {
8070 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
8071 tempParam.staId = staId;
8072 fCbMode24G = TRUE;
8073 }
8074
8075 /* Moving from HT20 to HT40 operation*/
8076 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
8077 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
8078 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
8079 {
8080 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
8081 tempParam.staId = staId;
8082 fCbMode24G = TRUE;
8083 }
8084
8085 if (TRUE == fCbMode24G)
8086 {
8087 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8088 "Changing CBMODE to = %d staId = %d",
8089 tempParam.opMode, tempParam.staId );
8090 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
8091 status = eANI_BOOLEAN_TRUE;
8092 }
8093 return status;
8094}
8095
Mohit Khanna4a70d262012-09-11 16:30:12 -07008096#ifdef WLAN_FEATURE_11AC
8097tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
8098{
8099 tUpdateVHTOpMode tempParam;
8100
8101 tempParam.opMode = chanWidth;
8102 tempParam.staId = staId;
8103
8104 limSendModeUpdate( pMac, &tempParam, psessionEntry );
8105
8106 return eANI_BOOLEAN_TRUE;
8107}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008108#endif
8109
krunal soni45b9eb62014-03-26 12:54:25 -07008110void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
8111 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008112{
8113 tANI_U8 val=0;
8114
krunal soni45b9eb62014-03-26 12:54:25 -07008115 //only 2.4G band should have short slot enable, rest it should be default
8116 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008117 {
krunal soni45b9eb62014-03-26 12:54:25 -07008118 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008119 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07008120 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008121 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
8122 {
8123 val = true;
8124 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008125 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008126 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008127 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008128 // Joining BSS.
8129 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008130 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008131 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008132 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008133 // Reassociating with AP.
8134 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008135 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008136 }
krunal soni45b9eb62014-03-26 12:54:25 -07008137 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008138 {
krunal soni45b9eb62014-03-26 12:54:25 -07008139 /*
8140 * 11B does not short slot and short slot is default
8141 * for 11A mode. Hence, not need to set this bit
8142 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008143 val = false;
8144 }
krunal soni45b9eb62014-03-26 12:54:25 -07008145
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07008146 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07008147 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008148}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308149
Kalikinkar dhara205da782014-03-21 15:49:32 -07008150void limUtilsframeshtons(tpAniSirGlobal pCtx,
8151 tANI_U8 *pOut,
8152 tANI_U16 pIn,
8153 tANI_U8 fMsb)
8154{
8155 (void)pCtx;
8156#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8157 if ( !fMsb )
8158 {
8159 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8160 }
8161 else
8162 {
8163 *pOut = ( pIn & 0xff00 ) >> 8;
8164 *( pOut + 1 ) = pIn & 0xff;
8165 }
8166#else
8167 if ( !fMsb )
8168 {
8169 *pOut = pIn & 0xff;
8170 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8171 }
8172 else
8173 {
8174 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8175 }
8176#endif
8177}
8178
8179void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8180 tANI_U8 *pOut,
8181 tANI_U32 pIn,
8182 tANI_U8 fMsb)
8183{
8184 (void)pCtx;
8185#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8186 if ( !fMsb )
8187 {
8188 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8189 }
8190 else
8191 {
8192 *pOut = ( pIn & 0xff000000 ) >> 24;
8193 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8194 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8195 *( pOut + 3 ) = ( pIn & 0x000000ff );
8196 }
8197#else
8198 if ( !fMsb )
8199 {
8200 *( pOut ) = ( pIn & 0x000000ff );
8201 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8202 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8203 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8204 }
8205 else
8206 {
8207 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8208 }
8209#endif
8210}
8211
8212
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308213/**--------------------------------------------
8214\fn limUpdateOBSSScanParams
8215\brief Updates OBSS SCAN IE parameters to session
8216
8217\param psessionEntry - Session Entry
8218\return NONE
8219---------------------------------------------*/
8220void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8221 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8222{
8223 /*If the recieved value is not in the range specified by the Specification
8224 then it will be the default value configured through cfg */
8225 if (( pOBSSScanParameters->obssScanActiveDwell >
8226 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8227 ( pOBSSScanParameters->obssScanActiveDwell <
8228 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8229 {
8230 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8231 pOBSSScanParameters->obssScanActiveDwell;
8232 }
8233 if((pOBSSScanParameters->obssScanPassiveDwell >
8234 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8235 (pOBSSScanParameters->obssScanPassiveDwell <
8236 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8237 {
8238 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8239 pOBSSScanParameters->obssScanPassiveDwell;
8240 }
8241 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8242 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8243 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8244 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8245 {
8246 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8247 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8248 }
8249 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8250 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8251 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8252 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8253 {
8254 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8255 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8256 }
8257 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8258 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8259 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8260 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8261 {
8262 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8263 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8264 }
8265 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8266 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8267 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8268 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8269 {
8270 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8271 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8272 }
8273 if((pOBSSScanParameters->obssScanActivityThreshold >
8274 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8275 (pOBSSScanParameters->obssScanActivityThreshold <
8276 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8277 {
8278 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8279 pOBSSScanParameters->obssScanActivityThreshold;
8280 }
8281}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008282
8283#ifdef WLAN_FEATURE_11W
8284void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8285{
8286 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8287 tPmfSaQueryTimerId timerId;
8288 tpPESession psessionEntry;
8289 tpDphHashNode pSta;
8290 tANI_U32 maxRetries;
8291
8292 limLog(pMac, LOG1, FL("SA Query timer fires"));
8293 timerId.value = param;
8294
8295 // Check that SA Query is in progress
8296 if ((psessionEntry = peFindSessionBySessionId(
8297 pMac, timerId.fields.sessionId)) == NULL)
8298 {
8299 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8300 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008301 return;
8302 }
8303 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8304 &psessionEntry->dph.dphHashTable)) == NULL)
8305 {
8306 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8307 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008308 return;
8309 }
8310 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8311 return;
8312
8313 // Increment the retry count, check if reached maximum
8314 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8315 &maxRetries) != eSIR_SUCCESS)
8316 {
8317 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8318 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8319 return;
8320 }
8321 pSta->pmfSaQueryRetryCount++;
8322 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8323 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308324 limLog(pMac, LOGE,
8325 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8326 MAC_ADDR_ARRAY(pSta->staAddr));
8327 limSendDisassocMgmtFrame(pMac,
8328 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8329 pSta->staAddr, psessionEntry, FALSE);
8330 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008331 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8332 return;
8333 }
8334
8335 // Retry SA Query
8336 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8337 pSta->staAddr, psessionEntry);
8338 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008339 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8340 {
8341 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8342 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8343 }
8344}
8345#endif
8346
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008347/** ---------------------------------------------------------
8348\fn limProcessChannelSwitchSuspendLink
8349\brief This function call channel switch functions based on
8350 the gLimChannelSwitch.state. After function return it
8351 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8352 If gLimChannelSwitch.state is non-identified then
8353 print error log as well as restore back the
8354 pre-channelSwitch.
8355\param tpAniSirGlobal pMac
8356\param eHalStatus status
8357\param tANI_U32 *ctx
8358\return None
8359 ------------------------------------------------------------*/
8360static void
8361limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8362 eHalStatus status,
8363 tANI_U32 *ctx)
8364{
8365 tpPESession pSessionEntry = (tpPESession)ctx;
8366
8367 if ( eHAL_STATUS_SUCCESS != status )
8368 {
8369 limLog(pMac, LOGE,
8370 FL("Suspend link failed. still proceeding "));
8371 }
8372 if (NULL == pSessionEntry )
8373 {
8374 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8375 return;
8376 }
8377
8378 switch(pSessionEntry->gLimChannelSwitch.state)
8379 {
8380 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8381 PELOGW(limLog(pMac, LOGW,
8382 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8383 limSwitchPrimaryChannel(pMac,
8384 pSessionEntry->gLimChannelSwitch.primaryChannel,
8385 pSessionEntry);
8386 pSessionEntry->gLimChannelSwitch.state =
8387 eLIM_CHANNEL_SWITCH_IDLE;
8388 break;
8389
8390 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8391 PELOGW(limLog(pMac, LOGW,
8392 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8393 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8394 pSessionEntry->gLimChannelSwitch.primaryChannel,
8395 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8396 pSessionEntry->gLimChannelSwitch.state =
8397 eLIM_CHANNEL_SWITCH_IDLE;
8398 break;
8399
8400 default:
8401 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8402 pSessionEntry->gLimChannelSwitch.state);)
8403 if (limRestorePreChannelSwitchState(pMac,
8404 pSessionEntry) != eSIR_SUCCESS)
8405 {
8406 limLog(pMac, LOGE,
8407 FL("Could not restore pre-channelSwitch "
8408 "(11h) state, resetting the system"));
8409 }
8410 }
8411}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308412
8413/** ---------------------------------------------------------
8414\fn limInitOBSSScanParams
8415\brief This function Initializes the OBSS Scan Parameters
8416\param tpAniSirGlobal pMac
8417\param tpPESession pSessionEntry
8418\return None
8419 ------------------------------------------------------------*/
8420
8421void limInitOBSSScanParams(tpAniSirGlobal pMac,
8422 tpPESession psessionEntry)
8423{
8424 tANI_U32 cfgValue;
8425
8426 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8427 &cfgValue) != eSIR_SUCCESS)
8428 {
8429 limLog(pMac, LOGE, FL("Fail to retrieve "
8430 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8431 return ;
8432 }
8433 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8434
8435 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8436 &cfgValue) != eSIR_SUCCESS)
8437 {
8438 limLog(pMac, LOGE, FL("Fail to retrieve "
8439 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8440 return ;
8441 }
8442 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8443
8444 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8445 &cfgValue) != eSIR_SUCCESS)
8446 {
8447 limLog(pMac, LOGE, FL("Fail to retrieve "
8448 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8449 return ;
8450 }
8451 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8452 = cfgValue;
8453 if (wlan_cfgGetInt(pMac,
8454 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8455 &cfgValue) != eSIR_SUCCESS)
8456 {
8457 limLog(pMac, LOGE, FL("Fail to retrieve"
8458 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8459 return ;
8460 }
8461 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8462 cfgValue;
8463 if (wlan_cfgGetInt(pMac,
8464 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8465 != eSIR_SUCCESS)
8466 {
8467 limLog(pMac, LOGE, FL("Fail to retrieve"
8468 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8469 return ;
8470 }
8471 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8472 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308473
8474 if (wlan_cfgGetInt(pMac,
8475 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8476 != eSIR_SUCCESS)
8477 {
8478 limLog(pMac, LOGE, FL("Fail to retrieve"
8479 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8480 return ;
8481 }
8482 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8483 cfgValue;
8484
8485
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308486 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8487 &cfgValue) != eSIR_SUCCESS)
8488 {
8489 limLog(pMac, LOGE, FL("Fail to retrieve "
8490 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8491 return ;
8492 }
8493 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308494}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308495
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308496const char * lim_ScanTypetoString(const v_U8_t scanType)
8497{
8498 switch (scanType)
8499 {
8500 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8501 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8502 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8503 default:
8504 return "Unknown ScanType";
8505 }
8506}
8507
8508const char * lim_BssTypetoString(const v_U8_t bssType)
8509{
8510 switch (bssType)
8511 {
8512 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8513 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8514 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8515 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8516 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8517 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8518 default:
8519 return "Unknown BssType";
8520 }
8521}
8522
8523const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8524{
8525 switch (mode)
8526 {
8527 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8528 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8529 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8530 default:
8531 return "Unknown BgScanMode";
8532 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308533}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308534
8535#ifdef WLAN_FEATURE_11W
8536/**
8537 *
8538 * \brief This function is called by various LIM modules to correctly set
8539 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8540 *
8541 *
8542 * \param pMac Pointer to Global MAC structure
8543 *
8544 * \param psessionEntry Pointer to session corresponding to the connection
8545 *
8546 * \param peer Peer address of the STA to which the frame is to be sent
8547 *
8548 * \param pMacHdr Pointer to the frame MAC header
8549 *
8550 * \return nothing
8551 *
8552 *
8553 */
8554void
8555limSetProtectedBit(tpAniSirGlobal pMac,
8556 tpPESession psessionEntry,
8557 tSirMacAddr peer,
8558 tpSirMacMgmtHdr pMacHdr)
8559{
8560 tANI_U16 aid;
8561 tpDphHashNode pStaDs;
8562
8563 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8564 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8565 {
8566
8567 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8568 &psessionEntry->dph.dphHashTable );
8569 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308570 /* rmfenabled will be set at the time of addbss.
8571 * but sometimes EAP auth fails and keys are not
8572 * installed then if we send any management frame
8573 * like deauth/disassoc with this bit set then
8574 * firmware crashes. so check for keys are
8575 * installed or not also before setting the bit
8576 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308577 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308578 pMacHdr->fc.wep = 1;
8579 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308580 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308581 pMacHdr->fc.wep = 1;
8582} /*** end limSetProtectedBit() ***/
8583#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308584
8585tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8586{
8587 int left = length;
8588 tANI_U8 *ptr = pIes;
8589 tANI_U8 elem_id,elem_len;
8590
8591 while (left >= 2)
8592 {
8593 elem_id = ptr[0];
8594 elem_len = ptr[1];
8595 left -= 2;
8596
8597 if (elem_len > left)
8598 {
8599 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8600 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8601 eid,elem_len,left);
8602 return NULL;
8603 }
8604 if (elem_id == eid)
8605 {
8606 return ptr;
8607 }
8608
8609 left -= elem_len;
8610 ptr += (elem_len + 2);
8611 }
8612 return NULL;
8613}
8614
8615
8616void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8617{
8618
8619 tANI_U32 nPayload;
8620 tANI_U8 *pPayload;
8621 tANI_U8 *ieptr;
8622 tSirMacTim *tim;
8623
8624 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8625 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8626
8627 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8628 {
8629 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8630 return;
8631 }
8632
8633 if (NULL !=
8634 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8635 nPayload, SIR_MAC_TIM_EID)))
8636 {
8637 /* Ignore EID and Length field*/
8638 tim = (tSirMacTim *)(ieptr + 2);
8639
8640 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8641 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8642 if (tim->dtimCount >= MAX_DTIM_COUNT)
8643 tim->dtimCount = DTIM_COUNT_DEFAULT;
8644 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8645 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8646 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8647 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8648 psessionEntry->currentBssBeaconCnt++;
8649
8650 limLog(pMac, LOG1,
8651 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8652 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8653 psessionEntry->lastBeaconDtimPeriod);
8654
8655 }
8656 return;
8657}
Girish Gowlia95daca2015-02-04 20:31:31 +05308658
8659void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8660 tANI_U8 smeSessionId,
8661 tANI_U32 maxRateFlag)
8662{
8663 tpSirSmeUpdateMaxRateParams pRsp;
8664 tSirMsgQ msg;
8665
8666 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8667 if (NULL == pRsp)
8668 {
8669 limLog(pMac, LOGP, FL("Memory allocation failed"));
8670 return;
8671 }
8672 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8673 pRsp->maxRateFlag = maxRateFlag;
8674 pRsp->smeSessionId = smeSessionId;
8675 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8676 msg.bodyptr = pRsp;
8677 msg.bodyval = 0;
8678 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8679 return;
8680}
Abhishek Singh5d765712015-03-12 14:04:16 +05308681
8682void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8683{
8684 if( pMac->sys.gSysBbtPendingMgmtCount )
8685 {
8686 vos_spin_lock_acquire( &pMac->sys.lock );
8687 pMac->sys.gSysBbtPendingMgmtCount--;
8688 vos_spin_lock_release( &pMac->sys.lock );
8689 }
8690 else
8691 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8692}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308693
8694eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8695{
8696 tpSirTxBdStatus pTxBdStatus;
8697
8698 if (!pData)
8699 {
8700 limLog(pMac, LOGE, FL("pData is NULL"));
8701 return eHAL_STATUS_FAILURE;
8702 }
8703
8704 pTxBdStatus = (tpSirTxBdStatus) pData;
8705
8706 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8707 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8708 return eHAL_STATUS_SUCCESS;
8709}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308710
Kapil Gupta956c0c42017-06-16 19:24:31 +05308711eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8712{
8713 tpSirTxBdStatus pTxBdStatus;
8714 tpDphHashNode pStaDs;
8715 tpPESession psessionEntry;
8716 VOS_STATUS vosStatus;
8717 vos_list_node_t *pNode= NULL, *pNext = NULL;
8718 assoc_rsp_tx_context *tmp_tx_context = NULL;
8719
8720 if (!pData)
8721 {
8722 limLog(pMac, LOGE, FL("pData is NULL"));
8723 return eHAL_STATUS_FAILURE;
8724 }
8725
8726 pTxBdStatus = (tpSirTxBdStatus) pData;
8727
8728 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8729 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8730
8731 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8732 &pNode);
8733
8734 while(pNode)
8735 {
8736 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8737 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8738 {
8739 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8740 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8741
8742 vosStatus = vos_list_peek_next (
8743 &pMac->assoc_rsp_completion_list,
8744 pNode, &pNext );
8745 pNode = pNext;
8746 pNext = NULL;
8747 }
8748 else
8749 {
8750 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8751 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8752 break;
8753 }
8754 }
8755
8756 if (!tmp_tx_context) {
8757 limLog(pMac, LOGE, FL("context is NULL"));
8758 return eHAL_STATUS_SUCCESS;
8759 }
8760 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8761 if (!psessionEntry) {
8762 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8763 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8764 pNode);
8765 vos_mem_free(tmp_tx_context);
8766 return eHAL_STATUS_SUCCESS;
8767 }
8768 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8769 &psessionEntry->dph.dphHashTable);
8770 if (pStaDs == NULL)
8771 {
8772 limLog(pMac, LOGW,
8773 FL("STA context not found"));
8774 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8775 pNode);
8776 vos_mem_free(tmp_tx_context);
8777
8778 return eHAL_STATUS_SUCCESS;
8779 }
8780
8781 /* Receive path cleanup */
8782 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8783 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8784 pNode);
8785 vos_mem_free(tmp_tx_context);
8786
8787 return eHAL_STATUS_SUCCESS;
8788}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308789/**
8790 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8791 * robust action frame
8792 * @action_catagory: Action frame catagory.
8793 *
8794 * This function is used to check if given action catagory is robust
8795 * action frame.
8796 *
8797 * Return: bool
8798 */
8799bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8800{
8801 switch (action_catagory) {
8802 /*
8803 * NOTE: This function doesn't take care of the DMG
8804 * (Directional Multi-Gigatbit) BSS case as 8011ad
8805 * support is not yet added. In future, if the support
8806 * is required then this function need few more arguments
8807 * and little change in logic.
8808 */
8809 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8810 case SIR_MAC_ACTION_QOS_MGMT:
8811 case SIR_MAC_ACTION_DLP:
8812 case SIR_MAC_ACTION_BLKACK:
8813 case SIR_MAC_ACTION_RRM:
8814 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8815 case SIR_MAC_ACTION_SA_QUERY:
8816 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8817 case SIR_MAC_ACTION_WNM:
8818 case SIR_MAC_ACITON_MESH:
8819 case SIR_MAC_ACTION_MHF:
8820 case SIR_MAC_ACTION_FST:
8821 return true;
8822 default:
8823 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8824 FL("non-PMF action category[%d] "),
8825 action_catagory);
8826 break;
8827 }
8828 return false;
8829}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308830
8831/**
Hu Wangc12631c2016-08-11 09:57:03 +08008832 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8833 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308834 * @ext_cap: extended IEs structure
8835 *
Hu Wangc12631c2016-08-11 09:57:03 +08008836 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308837 */
Hu Wangc12631c2016-08-11 09:57:03 +08008838tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8839 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308840
Hu Wangc12631c2016-08-11 09:57:03 +08008841 while (i) {
8842 if (ext_cap->bytes[i-1]) {
8843 break;
8844 }
8845 i --;
8846 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308847
Hu Wangc12631c2016-08-11 09:57:03 +08008848 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308849}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308850
8851/**
8852 * lim_update_caps_info_for_bss - Update capability info for this BSS
8853 *
8854 * @mac_ctx: mac context
8855 * @caps: Pointer to capability info to be updated
8856 * @bss_caps: Capability info of the BSS
8857 *
8858 * Update the capability info in Assoc/Reassoc request frames and reset
8859 * the spectrum management, short preamble, immediate block ack bits
8860 * if the BSS doesnot support it
8861 *
8862 * Return: None
8863 */
8864void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8865 uint16_t *caps, uint16_t bss_caps)
8866{
8867 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8868 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8869 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8870 }
8871
8872 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8873 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8874 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8875 }
8876
8877 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8878 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8879 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8880 }
8881}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308882#ifdef SAP_AUTH_OFFLOAD
8883/**
8884 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8885 *
8886 * @pmac: mac context
8887 * @assoc_req: Assoc request
8888 * @add_sta_req: Add Sta request
8889 *
8890 * This function process recieved add sta message and store it as
8891 * sta ds entry. This function will add this sta entry to DPH as well.
8892 *
8893 * Return: DPH hash node
8894 */
8895static tpDphHashNode
8896_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8897 tpSirAssocReq assoc_req,
8898 tSapOfldAddStaIndMsg *add_sta_req)
8899{
8900 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8901 tpSirAssocReq temp_assoc_req;
8902 tSirRetStatus status;
8903 tpDphHashNode sta_ds = NULL;
8904 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308905 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308906
8907 tpPESession session_entry = limIsApSessionActive(pmac);
8908
8909 if (session_entry == NULL)
8910 {
8911 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8912 return NULL;
8913 }
8914
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308915 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8916 {
8917 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8918 return NULL;
8919 }
8920
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308921 /* Update Attribute and Remove IE for
8922 * Software AP Authentication Offload
8923 */
8924 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308925
8926 /*
8927 * strip MAC mgmt header before passing buf to
8928 * sirConvertAssocReqFrame2Struct() as this API
8929 * expects buf starting from fixed parameters only.
8930 */
8931 frame_body += sizeof(tSirMacMgmtHdr);
8932 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8933
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308934 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8935 mac_assoc_req->capabilityInfo.privacy = 0;
8936
8937 status = sirConvertAssocReqFrame2Struct(pmac,
8938 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308939 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308940 assoc_req);
8941 if (status != eSIR_SUCCESS)
8942 {
8943 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8944 goto error;
8945 }
8946 /* For software AP Auth Offload feature
8947 * Host will take it as none security station
8948 * Force change to none security
8949 */
8950 assoc_req->rsnPresent = 0;
8951 assoc_req->wpaPresent = 0;
8952
8953 sta_ds = dphAddHashEntry(pmac,
8954 add_sta_req->peer_macaddr,
8955 add_sta_req->assoc_id,
8956 &session_entry->dph.dphHashTable);
8957 if (sta_ds == NULL)
8958 {
8959 /* Could not add hash table entry at DPH */
8960 limLog(pmac, LOGE,
8961 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8962 MAC_ADDRESS_STR),
8963 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8964 goto error;
8965 }
8966
8967 if (session_entry->parsedAssocReq != NULL)
8968 {
8969 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8970 if (temp_assoc_req != NULL)
8971 {
8972 if (temp_assoc_req->assocReqFrame)
8973 {
8974 vos_mem_free(temp_assoc_req->assocReqFrame);
8975 temp_assoc_req->assocReqFrame = NULL;
8976 temp_assoc_req->assocReqFrameLength = 0;
8977 }
8978 vos_mem_free(temp_assoc_req);
8979 temp_assoc_req = NULL;
8980 }
8981 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8982 }
8983error:
8984 return sta_ds;
8985}
8986
8987/**
8988 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8989 *
8990 * @sta_ds: STA state node
8991 * @assoc_req: Assoc request
8992 * @add_sta_req: Add Sta request
8993 *
8994 * This function process recieved add sta message and store station's caps
8995 * in station ds entry.
8996 *
8997 * Return: none
8998 */
8999static void
9000_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
9001 tpSirAssocReq assoc_req,
9002 tSapOfldAddStaIndMsg *add_sta_req)
9003
9004{
9005
9006 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
9007#ifdef WLAN_FEATURE_11AC
9008 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
9009#endif
9010 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
9011 sta_ds->qos.addts = assoc_req->addtsReq;
9012 sta_ds->qos.capability = assoc_req->qosCapability;
9013 sta_ds->versionPresent = 0;
9014 /* short slot and short preamble should be
9015 * updated before doing limaddsta
9016 */
9017 sta_ds->shortPreambleEnabled =
9018 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
9019 sta_ds->shortSlotTimeEnabled =
9020 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
9021
9022 sta_ds->valid = 0;
9023 /* The Auth Type of Software AP Authentication Offload
9024 * is always Open System is host side
9025 */
9026 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
9027 sta_ds->staType = STA_ENTRY_PEER;
9028
9029 /* Assoc Response frame to requesting STA */
9030 sta_ds->mlmStaContext.subType = 0;
9031
9032 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
9033 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
9034
9035 /* The following count will be used to knock-off the station
9036 * if it doesn't come back to receive the buffered data.
9037 * The AP will wait for numTimSent number of beacons after
9038 * sending TIM information for the station, before assuming that
9039 * the station is no more associated and disassociates it
9040 */
9041
9042 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
9043 sta_ds->timWaitCount =
9044 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
9045
9046 /* Initialise the Current successful
9047 * MPDU's tranfered to this STA count as 0
9048 */
9049 sta_ds->curTxMpduCnt = 0;
9050}
9051
9052/**
9053 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
9054 *
9055 * @pmac: mac context
9056 * @sta_ds: STA state node
9057 * @assoc_req: Assoc request
9058 *
9059 * This function process recieved add sta message and store station's HT and
9060 * and VHT caps and store them in station ds entry.
9061 *
9062 * Return: tSirRetStatus
9063 */
9064static tSirRetStatus
9065_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
9066 tpDphHashNode sta_ds,
9067 tpSirAssocReq assoc_req)
9068{
9069 tpPESession session_entry = limIsApSessionActive(pmac);
9070
9071 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
9072 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
9073 {
9074 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
9075 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
9076 sta_ds->htDsssCckRate40MHzSupport =
9077 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
9078 sta_ds->htLsigTXOPProtection =
9079 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
9080 sta_ds->htMaxAmsduLength =
9081 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
9082 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
9083 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
9084 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
9085 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
9086 sta_ds->htSupportedChannelWidthSet =
9087 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
9088 /* peer just follows AP; so when we are softAP/GO,
9089 * we just store our session entry's secondary channel offset here
9090 * in peer INFRA STA. However, if peer's 40MHz channel width support
9091 * is disabled then secondary channel will be zero
9092 */
9093 sta_ds->htSecondaryChannelOffset =
9094 (sta_ds->htSupportedChannelWidthSet) ?
9095 session_entry->htSecondaryChannelOffset : 0;
9096#ifdef WLAN_FEATURE_11AC
9097 if (assoc_req->operMode.present)
9098 {
9099 sta_ds->vhtSupportedChannelWidthSet =
9100 (tANI_U8)((assoc_req->operMode.chanWidth ==
9101 eHT_CHANNEL_WIDTH_80MHZ) ?
9102 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
9103 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
9104 sta_ds->htSupportedChannelWidthSet =
9105 (tANI_U8)(assoc_req->operMode.chanWidth ?
9106 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
9107 }
9108 else if (assoc_req->VHTCaps.present)
9109 {
9110 /* Check if STA has enabled it's channel bonding mode.
9111 * If channel bonding mode is enabled, we decide based on
9112 * SAP's current configuration else, we set it to VHT20.
9113 */
9114 sta_ds->vhtSupportedChannelWidthSet =
9115 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
9116 eHT_CHANNEL_WIDTH_20MHZ) ?
9117 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
9118 session_entry->vhtTxChannelWidthSet );
9119 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
9120 }
9121
9122 /* Lesser among the AP and STA bandwidth of operation. */
9123 sta_ds->htSupportedChannelWidthSet =
9124 (sta_ds->htSupportedChannelWidthSet <
9125 session_entry->htSupportedChannelWidthSet) ?
9126 sta_ds->htSupportedChannelWidthSet :
9127 session_entry->htSupportedChannelWidthSet ;
9128#endif
9129 sta_ds->baPolicyFlag = 0xFF;
9130 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
9131 }
9132
9133 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
9134 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
9135
9136 if (!assoc_req->wmeInfoPresent)
9137 {
9138 sta_ds->mlmStaContext.htCapability = 0;
9139#ifdef WLAN_FEATURE_11AC
9140 sta_ds->mlmStaContext.vhtCapability = 0;
9141#endif
9142 }
9143#ifdef WLAN_FEATURE_11AC
9144 if (limPopulateMatchingRateSet(pmac,
9145 sta_ds,
9146 &(assoc_req->supportedRates),
9147 &(assoc_req->extendedRates),
9148 assoc_req->HTCaps.supportedMCSSet,
9149 &(assoc_req->propIEinfo.propRates),
9150 session_entry , &assoc_req->VHTCaps)
9151 != eSIR_SUCCESS)
9152 {
9153#else
9154 if (limPopulateMatchingRateSet(pmac,
9155 sta_ds,
9156 &(assoc_req->supportedRates),
9157 &(assoc_req->extendedRates),
9158 assoc_req->HTCaps.supportedMCSSet,
9159 &(assoc_req->propIEinfo.propRates),
9160 session_entry) != eSIR_SUCCESS)
9161 {
9162#endif
9163 limLog(pmac, LOGE,
9164 FL("Rate set mismatched for aid=%d, MacAddr: "
9165 MAC_ADDRESS_STR),
9166 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9167 goto error;
9168 }
9169 return eSIR_SUCCESS;
9170error:
9171 return eSIR_FAILURE;
9172}
9173
9174/**
9175 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9176 *
9177 * @pmac: mac context
9178 * @sta_ds: STA state node
9179 * @assoc_req: Assoc request
9180 *
9181 * This function process recieved add sta message and store station's QOS
9182 * store them in station ds entry.
9183 *
9184 * Return: none
9185 */
9186static void
9187 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9188 tpDphHashNode sta_ds,
9189 tpSirAssocReq assoc_req)
9190{
9191 tHalBitVal qos_mode;
9192 tHalBitVal wsm_mode, wme_mode;
9193 tpPESession session_entry = limIsApSessionActive(pmac);
9194
9195 limGetQosMode(session_entry, &qos_mode);
9196 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9197 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9198
9199 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9200 {
9201 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9202 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9203 }
9204
9205 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9206 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9207 limGetWmeMode(session_entry, &wme_mode);
9208 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9209 (wme_mode == eHAL_SET))
9210 {
9211 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9212 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9213 limGetWsmMode(session_entry, &wsm_mode);
9214 /* WMM_APSD - WMM_SA related processing should be
9215 * separate; WMM_SA and WMM_APSD can coexist
9216 */
9217 if (assoc_req->WMMInfoStation.present)
9218 {
9219 /* check whether AP supports or not */
9220 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9221 && (session_entry->apUapsdEnable == 0) &&
9222 (assoc_req->WMMInfoStation.acbe_uapsd
9223 || assoc_req->WMMInfoStation.acbk_uapsd
9224 || assoc_req->WMMInfoStation.acvo_uapsd
9225 || assoc_req->WMMInfoStation.acvi_uapsd))
9226 {
9227 /*
9228 * Received Re/Association Request from
9229 * STA when UPASD is not supported
9230 */
9231 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9232 "to STA accordingly" ));
9233 /* update UAPSD and send it to LIM to add STA */
9234 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9235 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9236 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9237 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9238 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9239 }
9240 else
9241 {
9242 /* update UAPSD and send it to LIM to add STA */
9243 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9244 assoc_req->WMMInfoStation.acbe_uapsd;
9245 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9246 assoc_req->WMMInfoStation.acbk_uapsd;
9247 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9248 assoc_req->WMMInfoStation.acvo_uapsd;
9249 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9250 assoc_req->WMMInfoStation.acvi_uapsd;
9251 sta_ds->qos.capability.qosInfo.maxSpLen =
9252 assoc_req->WMMInfoStation.max_sp_length;
9253 }
9254 }
9255 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9256 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9257 }
9258}
9259
9260/**
9261 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9262 *
9263 * @pmac: mac context
9264 * @lim_msgq: Add Sta indication buffer
9265 *
9266 * This function will recieve buffer from firmware. This buffer will store
9267 * information about connected client. driver will process this buffer and
9268 * will register this client with driver. Driver will call limAddSta
9269 *
9270 * Return: none
9271 */
9272void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9273 tSapOfldAddStaIndMsg *lim_msgq)
9274{
9275 tpSirAssocReq assoc_req = NULL;
9276 tpDphHashNode sta_ds = NULL;
9277
9278 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9279 tpPESession session_entry = limIsApSessionActive(pmac);
9280
9281 if (session_entry == NULL)
9282 {
9283 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9284 return;
9285 }
9286 add_sta_req = lim_msgq;
9287 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9288 if (NULL == assoc_req) {
9289 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9290 return;
9291 }
9292 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9293
9294 /* parse Assoc req frame for station information */
9295 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9296 if (sta_ds == NULL)
9297 {
9298 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9299 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9300 vos_mem_free(assoc_req);
9301 goto error;
9302 }
9303
9304 /* Parse Station Capability */
9305 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9306
9307 /* Parse Station HT/VHT information */
9308 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9309 == eSIR_FAILURE)
9310 {
9311 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9312 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9313 vos_mem_free(assoc_req);
9314 goto error;
9315
9316 }
9317
9318 /* Parse Station QOS information */
9319 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9320
9321 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9322 sta_ds->staIndex = add_sta_req->staIdx;
9323 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9324 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9325 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9326 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9327 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9328 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309329 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309330
Agrawal Ashishce67f362017-01-05 20:10:58 +05309331 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9332 sta_ds->staIndex,
9333 sta_ds->bssId,
9334 sta_ds->dpuIndex,
9335 sta_ds->bcastDpuIndex,
9336 sta_ds->bcastMgmtDpuIdx,
9337 sta_ds->ucUcastSig,
9338 sta_ds->ucBcastSig,
9339 sta_ds->ucMgmtSig,
9340 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309341
9342 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9343 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9344 sta_ds->assocId);
9345 }
9346
9347error:
9348 return;
9349}
9350
9351/**
9352 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9353 *
9354 * @pmac: mac context
9355 * @lim_msgq: Del Sta indication buffer
9356 *
9357 * This function will recieve buffer from firmware. This buffer will
9358 * have information about clinet to remove with reason code.
9359 * This function will call limSendSmeDisassocInd to do cleanup
9360 * for station entry
9361 *
9362 * Return: none
9363 */
9364void
9365lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9366{
9367 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9368 tpDphHashNode sta_ds = NULL;
9369 tANI_U16 assoc_id = 0;
9370 tpPESession psession_entry = limIsApSessionActive(pmac);
9371
9372 if (psession_entry == NULL)
9373 {
9374 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9375 goto error;
9376 }
9377
9378 del_sta_req = lim_msgq;
9379 sta_ds = dphLookupHashEntry(pmac,
9380 del_sta_req->peer_macaddr,
9381 &assoc_id,
9382 &psession_entry->dph.dphHashTable);
9383 if (sta_ds == NULL)
9384 {
9385 /*
9386 * Disassociating STA is not associated.
9387 * Log error
9388 */
9389 PELOGE(limLog(pmac, LOGE,
9390 FL("received del sta event that sta not exist in table "
9391 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9392 del_sta_req->reason,
9393 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9394 goto error;
9395 }
9396
9397 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9398 {
9399 /*
9400 * Associate Id mismatch
9401 * Log error
9402 */
9403 PELOGE(limLog(pmac, LOGE,
9404 FL("received del sta event that sta assoc Id mismatch"));)
9405 goto error;
9406 }
9407
9408 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9409 sta_ds->mlmStaContext.disassocReason =
9410 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309411
9412 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9413
9414error:
9415 return;
9416}
9417#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309418
9419int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9420{
9421 tANI_U8 i;
9422 tpPESession psessionEntry = NULL;
9423
9424 for(i =0; i < pMac->lim.maxBssId; i++)
9425 {
9426 /* If BSSID matches return corresponding tables address*/
9427 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9428 {
9429 psessionEntry = (&pMac->lim.gpSession[i]);
9430 return psessionEntry->bssIdx;
9431 }
9432 }
9433
9434 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9435 return(0xFF);
9436}