blob: e0f4560c0fc74c32cf630608c0bce25fd10ab8e7 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Yeshwanth Sriram Guntukaa3961612018-01-04 14:24:50 +05302 * Copyright (c) 2011-2018 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)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302927 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302928 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)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302932 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302933 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
Abhishek Singh0f09f382018-12-04 14:06:07 +05302970 ch_offset =
2971 lim_get_channel_width_from_opclass(mac_ctx->scan.countryCodeCurrent,
2972 ecsa_req->new_channel,
2973 sta_ds->mlmStaContext.vhtCapability,
2974 ecsa_req->op_class);
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302975 if (ch_offset == BW80) {
2976 session->gLimWiderBWChannelSwitch.newChanWidth =
2977 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
2978 } else {
2979 session->gLimWiderBWChannelSwitch.newChanWidth =
2980 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
2981 }
2982
2983 /*
2984 * Do not bother to look and operate on extended channel switch element
2985 * if our own channel-bonding state is not enabled
2986 */
2987 if (session->htSupportedChannelWidthSet) {
2988 session->gLimChannelSwitch.secondarySubBand = lim_select_cbmode(sta_ds,
2989 ecsa_req->new_channel,
2990 session->gLimWiderBWChannelSwitch.newChanWidth);
2991 if (session->gLimChannelSwitch.secondarySubBand > 0)
2992 session->gLimChannelSwitch.state =
2993 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2994 }
2995
2996 if (eSIR_SUCCESS != limStartChannelSwitch(mac_ctx, session)) {
2997 limLog(mac_ctx, LOGW, FL("Could not start Channel Switch"));
2998 }
2999
3000 limLog(mac_ctx, LOG1,
3001 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
3002 session->peSessionId,
3003 session->gLimChannelSwitch.primaryChannel,
3004 session->gLimChannelSwitch.secondarySubBand,
3005 session->gLimChannelSwitch.switchCount,
3006 session->gLimChannelSwitch.switchTimeoutValue);
3007}
3008
3009/**
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 * limCancelDot11hChannelSwitch
3011 *
3012 *FUNCTION:
3013 * This function is called when STA does not send updated channel-swith IE
3014 * after indicating channel-switch start. This will cancel the channel-swith
3015 * timer which is already running.
3016 *
3017 *LOGIC:
3018 *
3019 *ASSUMPTIONS:
3020 *
3021 *NOTE:
3022 *
3023 * @param pMac - Pointer to Global MAC structure
3024 *
3025 * @return None
3026 */
3027void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
3028{
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3030 return;
3031
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003032 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003033 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003034
3035 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
3036 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003037 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 }
3039
3040 /* We need to restore pre-channelSwitch state on the STA */
3041 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3042 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003043 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003044
3045 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003046}
3047
3048/**----------------------------------------------
3049\fn limCancelDot11hQuiet
3050\brief Cancel the quieting on Station if latest
3051 beacon doesn't contain quiet IE in it.
3052
3053\param pMac
3054\return NONE
3055-----------------------------------------------*/
3056void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
3057{
Jeff Johnson295189b2012-06-20 16:38:30 -07003058 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3059 return;
3060
Jeff Johnsone7245742012-09-05 17:12:55 -07003061 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003063 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
3065 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003066 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 }
3068 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003069 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003071 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
3073 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003074 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 }
3076 /**
3077 * If the channel switch is already running in silent mode, dont resume the
3078 * transmission. Channel switch timer when timeout, transmission will be resumed.
3079 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003080 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3081 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 {
3083 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003084 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
3086 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003087 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003088}
3089
3090/**
3091 * limProcessQuietTimeout
3092 *
3093 * FUNCTION:
3094 * This function is active only on the STA.
3095 * Handles SIR_LIM_QUIET_TIMEOUT
3096 *
3097 * LOGIC:
3098 * This timeout can occur under only one circumstance:
3099 *
3100 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
3101 * This indicates that the timeout "interval" has
3102 * expired. This is a trigger for the STA to now
3103 * shut-off Tx/Rx for the specified gLimQuietDuration
3104 * -> The TIMER object gLimQuietBssTimer is
3105 * activated
3106 * -> With timeout = gLimQuietDuration
3107 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
3108 *
3109 * ASSUMPTIONS:
3110 * Using two TIMER objects -
3111 * gLimQuietTimer & gLimQuietBssTimer
3112 *
3113 * NOTE:
3114 *
3115 * @param pMac - Pointer to Global MAC structure
3116 *
3117 * @return None
3118 */
3119void limProcessQuietTimeout(tpAniSirGlobal pMac)
3120{
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 //fetch the sessionEntry based on the sessionId
3122 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07003123 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003124
Jeff Johnsone7245742012-09-05 17:12:55 -07003125 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003127 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003128 return;
3129 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003130
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303131 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003132 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 {
3134 case eLIM_QUIET_BEGIN:
3135 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07003136 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
3137 if (TX_SUCCESS !=
3138 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
3139 {
3140 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003141 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003142 }
3143
3144 // gLimQuietDuration appears to be in units of ticks
3145 // Use it as is
3146 if (TX_SUCCESS !=
3147 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
3148 psessionEntry->gLimSpecMgmt.quietDuration,
3149 0))
3150 {
3151 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003152 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003153 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003154 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003155#ifdef GEN6_TODO
3156 /* revisit this piece of code to assign the appropriate sessionId below
3157 * priority - HIGH
3158 */
3159 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3160#endif
3161 if( TX_SUCCESS !=
3162 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3163 {
3164 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003165 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003166 }
3167 else
3168 {
3169 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003170 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003171
3172 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3173 /* print message, otherwise, stop data traffic and stay quiet */
3174 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3175 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3176 {
3177 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003178 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 }
3180 else
3181 {
3182 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3183 /* freeze the transmission */
3184 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3185
3186 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003187 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003188 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 }
3190 }
3191 break;
3192
3193 case eLIM_QUIET_RUNNING:
3194 case eLIM_QUIET_INIT:
3195 case eLIM_QUIET_END:
3196 default:
3197 //
3198 // As of now, nothing to be done
3199 //
3200 break;
3201 }
3202}
3203
3204/**
3205 * limProcessQuietBssTimeout
3206 *
3207 * FUNCTION:
3208 * This function is active on the AP and STA.
3209 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3210 *
3211 * LOGIC:
3212 * On the AP -
3213 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3214 * an indication for the AP to START sending out the
3215 * Quiet BSS IE.
3216 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3217 * the 11H spec
3218 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3219 * a Proprietary IE. This will be understood by all the
3220 * TITAN STA's
3221 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3222 * initiate the SCH to include the Quiet BSS IE in all
3223 * its subsequent Beacons/PR's.
3224 * The Quiet BSS IE will be included in all the Beacons
3225 * & PR's until the next DTIM period
3226 *
3227 * On the STA -
3228 * When gLimQuietState = eLIM_QUIET_RUNNING
3229 * This indicates that the STA was successfully shut-off
3230 * for the specified gLimQuietDuration. This is a trigger
3231 * for the STA to now resume data traffic.
3232 * -> gLimQuietState is set to eLIM_QUIET_INIT
3233 *
3234 * ASSUMPTIONS:
3235 *
3236 * NOTE:
3237 *
3238 * @param pMac - Pointer to Global MAC structure
3239 *
3240 * @return None
3241 */
3242void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3243{
Jeff Johnsone7245742012-09-05 17:12:55 -07003244 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003245
Jeff Johnsone7245742012-09-05 17:12:55 -07003246 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003248 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 return;
3250 }
3251
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303252 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 }
3256 else
3257 {
3258 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003259 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 {
3261 case eLIM_QUIET_RUNNING:
3262 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003263 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003264
3265 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3266 {
3267 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003268 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3269 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 {
3271 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003272 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 }
3274
3275 /* Reset status flag */
3276 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3277 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3278
3279 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003280 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 }
3282 else
3283 {
3284 //
3285 // Nothing specific to be done in this case
3286 // A background scan that was triggered during
3287 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3288 //
3289 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003290 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 }
3292 break;
3293
3294 case eLIM_QUIET_INIT:
3295 case eLIM_QUIET_BEGIN:
3296 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003297 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 /* If the quiet period has ended, then resume the frame transmission */
3299 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003300 limRestorePreQuietState(pMac, psessionEntry);
3301 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 break;
3303
3304 default:
3305 //
3306 // As of now, nothing to be done
3307 //
3308 break;
3309 }
3310 }
3311}
Jeff Johnson295189b2012-06-20 16:38:30 -07003312/**
3313 * limProcessWPSOverlapTimeout
3314 *
3315 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3316 *
3317 * LOGIC:
3318 *
3319 * ASSUMPTIONS:
3320 *
3321 * NOTE:
3322 *
3323 * @param pMac - Pointer to Global MAC structure
3324 *
3325 * @return None
3326 */
3327#if 0
3328void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3329{
3330
3331 tpPESession psessionEntry;
3332 tANI_U32 sessionId;
3333
3334 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3335 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003336 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 }
3338
3339 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3340
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003341 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003342
3343 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3344 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003345 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 return;
3347 }
3348
3349 limWPSPBCTimeout(pMac, psessionEntry);
3350}
3351#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003352
Jeff Johnson295189b2012-06-20 16:38:30 -07003353/**----------------------------------------------
3354\fn limStartQuietTimer
3355\brief Starts the quiet timer.
3356
3357\param pMac
3358\return NONE
3359-----------------------------------------------*/
3360void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3361{
3362 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303363 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003364
3365 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003366 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 return;
3368 }
3369
Jeff Johnson295189b2012-06-20 16:38:30 -07003370
3371 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3372 return;
3373 // First, de-activate Timer, if its already active
3374 limCancelDot11hQuiet(pMac, psessionEntry);
3375
Jeff Johnsone7245742012-09-05 17:12:55 -07003376 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3377 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3378 {
3379 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003380 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003381 }
3382
3383 // Set the NEW timeout value, in ticks
3384 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3385 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3386 {
3387 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003388 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003389 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003390
3391 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3392 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3393 {
3394 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003395 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003396 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003397
Jeff Johnsone7245742012-09-05 17:12:55 -07003398 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003399 return;
3400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003401}
3402
Jeff Johnson295189b2012-06-20 16:38:30 -07003403
3404/** ------------------------------------------------------------------------ **/
3405/**
3406 * keep track of the number of ANI peers associated in the BSS
3407 * For the first and last ANI peer, we have to update EDCA params as needed
3408 *
3409 * When the first ANI peer joins the BSS, we notify SCH
3410 * When the last ANI peer leaves the BSS, we notfiy SCH
3411 */
3412void
3413limUtilCountStaAdd(
3414 tpAniSirGlobal pMac,
3415 tpDphHashNode pSta,
3416 tpPESession psessionEntry)
3417{
3418
3419 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3420 return;
3421
3422 pSta->fAniCount = 1;
3423
3424 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3425 return;
3426
3427 // get here only if this is the first ANI peer in the BSS
3428 schEdcaProfileUpdate(pMac, psessionEntry);
3429}
3430
3431void
3432limUtilCountStaDel(
3433 tpAniSirGlobal pMac,
3434 tpDphHashNode pSta,
3435 tpPESession psessionEntry)
3436{
3437
3438 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3439 return;
3440
3441 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3442 * then go ahead and update the count and profiles. This ensures
3443 * that the "number of ani station" count is properly incremented/decremented.
3444 */
3445 if (pSta->valid == 1)
3446 return;
3447
3448 pSta->fAniCount = 0;
3449
3450 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3451 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003452 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 pMac->lim.gLimNumOfAniSTAs);
3454 return;
3455 }
3456
3457 pMac->lim.gLimNumOfAniSTAs--;
3458
3459 if (pMac->lim.gLimNumOfAniSTAs != 0)
3460 return;
3461
3462 // get here only if this is the last ANI peer in the BSS
3463 schEdcaProfileUpdate(pMac, psessionEntry);
3464}
3465
Jeff Johnson295189b2012-06-20 16:38:30 -07003466/**
3467 * limSwitchChannelCback()
3468 *
3469 *FUNCTION:
3470 * This is the callback function registered while requesting to switch channel
3471 * after AP indicates a channel switch for spectrum management (11h).
3472 *
3473 *NOTE:
3474 * @param pMac Pointer to Global MAC structure
3475 * @param status Status of channel switch request
3476 * @param data User data
3477 * @param psessionEntry Session information
3478 * @return NONE
3479 */
3480void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3481 tANI_U32 *data, tpPESession psessionEntry)
3482{
3483 tSirMsgQ mmhMsg = {0};
3484 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3485
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3487
3488 /* We need to restore pre-channelSwitch state on the STA */
3489 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3490 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003491 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 return;
3493 }
3494
3495 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303496 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3497 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003499 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003500 return;
3501 }
3502
3503 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3504 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003505 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3507 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303508 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3510 mmhMsg.bodyval = 0;
3511
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303512 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3513 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003515}
3516
3517/**
3518 * limSwitchPrimaryChannel()
3519 *
3520 *FUNCTION:
3521 * This function changes the current operating channel
3522 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3523 *
3524 *NOTE:
3525 * @param pMac Pointer to Global MAC structure
3526 * @param newChannel new chnannel ID
3527 * @return NONE
3528 */
3529void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3530{
3531#if !defined WLAN_FEATURE_VOWIFI
3532 tANI_U32 localPwrConstraint;
3533#endif
3534
Abhishek Singh127a8442014-12-15 17:31:27 +05303535 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3536 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003537 psessionEntry->currentReqChannel = newChannel;
3538 psessionEntry->limRFBand = limGetRFBand(newChannel);
3539
3540 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3541
3542 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3543 pMac->lim.gpchangeChannelData = NULL;
3544
3545#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003546 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3548#else
3549 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3550 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003551 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003552 return;
3553 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003554 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3556#endif
3557 return;
3558}
3559
3560/**
3561 * limSwitchPrimarySecondaryChannel()
3562 *
3563 *FUNCTION:
3564 * This function changes the primary and secondary channel.
3565 * If 11h is enabled and user provides a "new channel ID"
3566 * that is different from the current operating channel,
3567 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3568 * assign notify LIM of such change.
3569 *
3570 *NOTE:
3571 * @param pMac Pointer to Global MAC structure
3572 * @param newChannel New chnannel ID (or current channel ID)
3573 * @param subband CB secondary info:
3574 * - eANI_CB_SECONDARY_NONE
3575 * - eANI_CB_SECONDARY_UP
3576 * - eANI_CB_SECONDARY_DOWN
3577 * @return NONE
3578 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003579void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003580{
3581#if !defined WLAN_FEATURE_VOWIFI
3582 tANI_U32 localPwrConstraint;
3583#endif
3584
Jeff Johnson295189b2012-06-20 16:38:30 -07003585#if !defined WLAN_FEATURE_VOWIFI
3586 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003587 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 return;
3589 }
3590#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303591 /* Assign the callback to resume TX once channel is changed.
3592 */
3593 psessionEntry->currentReqChannel = newChannel;
3594 psessionEntry->limRFBand = limGetRFBand(newChannel);
3595
3596 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3597
3598 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3599 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003600
Jeff Johnson295189b2012-06-20 16:38:30 -07003601#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003602 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003603#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003604 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003605#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003606
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303607#ifdef FEATURE_WLAN_DIAG_SUPPORT
3608 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3609 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3610#endif
3611
Jeff Johnsone7245742012-09-05 17:12:55 -07003612 // Store the new primary and secondary channel in session entries if different
3613 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 {
3615 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003616 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003618 psessionEntry->currentOperChannel = newChannel;
3619 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303620 if (psessionEntry->htSecondaryChannelOffset != limGetHTCBState(subband))
Jeff Johnsone7245742012-09-05 17:12:55 -07003621 {
3622 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003623 FL("switch old sec chnl %d --> new sec chnl %d "),
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303624 psessionEntry->htSecondaryChannelOffset, limGetHTCBState(subband));
3625 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(subband);
Jeff Johnsone7245742012-09-05 17:12:55 -07003626 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3627 {
3628 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303629 psessionEntry->apCenterChan = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003630 }
3631 else
3632 {
3633 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3634 }
3635 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003637
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303638 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3639 return;
3640
3641 if (subband > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
3642 psessionEntry->apCenterChan =
3643 limGetCenterChannel(pMac, newChannel,
3644 subband, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
3645 else
3646 psessionEntry->apCenterChan =
3647 limGetCenterChannel(pMac, newChannel,
3648 subband, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
3649
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 return;
3651}
3652
3653
3654/**
3655 * limActiveScanAllowed()
3656 *
3657 *FUNCTION:
3658 * Checks if active scans are permitted on the given channel
3659 *
3660 *LOGIC:
3661 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3662 * Need to check if the channelNum matches, then depending on the corresponding
3663 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3664 *
3665 *ASSUMPTIONS:
3666 *
3667 *NOTE:
3668 *
3669 * @param pMac Pointer to Global MAC structure
3670 * @param channelNum channel number
3671 * @return None
3672 */
3673
3674tANI_U8 limActiveScanAllowed(
3675 tpAniSirGlobal pMac,
3676 tANI_U8 channelNum)
3677{
3678 tANI_U32 i;
3679 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3680 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3681 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3682 != eSIR_SUCCESS)
3683 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003684 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 return false;
3686 }
3687
3688 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003690 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 len);
3692 return false;
3693 }
3694
3695 for (i=0; (i+1) < len; i+=2)
3696 {
3697 if (channelPair[i] == channelNum)
3698 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3699 }
3700 return false;
3701}
3702
3703/**
3704 * limTriggerBackgroundScanDuringQuietBss()
3705 *
3706 *FUNCTION:
3707 * This function is applicable to the STA only.
3708 * This function is called by limProcessQuietTimeout(),
3709 * when it is time to honor the Quiet BSS IE from the AP.
3710 *
3711 *LOGIC:
3712 * If 11H is enabled:
3713 * We cannot trigger a background scan. The STA needs to
3714 * shut-off Tx/Rx.
3715 * If 11 is not enabled:
3716 * Determine if the next channel that we are going to
3717 * scan is NOT the same channel (or not) on which the
3718 * Quiet BSS was requested.
3719 * If yes, then we cannot trigger a background scan on
3720 * this channel. Return with a false.
3721 * If no, then trigger a background scan. Return with
3722 * a true.
3723 *
3724 *ASSUMPTIONS:
3725 *
3726 *NOTE:
3727 * This API is redundant if the existing API,
3728 * limTriggerBackgroundScan(), were to return a valid
3729 * response instead of returning void.
3730 * If possible, try to revisit this API
3731 *
3732 * @param pMac Pointer to Global MAC structure
3733 * @return eSIR_TRUE, if a background scan was attempted
3734 * eSIR_FALSE, if not
3735 */
3736tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3737{
3738 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003739
3740
3741
3742 //TBD-RAJESH HOW TO GET sessionEntry?????
3743 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3744
3745 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3746 return bScanTriggered;
3747
Jeff Johnsone7245742012-09-05 17:12:55 -07003748 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 {
3750 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3751 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3752
3753 // Determine the next scan channel
3754
3755 // Get background scan channel list from CFG
3756 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3757 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3758 (tANI_U8 *) bgScanChannelList,
3759 (tANI_U32 *) &len ))
3760 {
3761 // Ensure that we do not go off scanning on the same
3762 // channel on which the Quiet BSS was requested
3763 if( psessionEntry->currentOperChannel!=
3764 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3765 {
3766 // For now, try and attempt a background scan. It will
3767 // be ideal if this API actually returns a success or
3768 // failure instead of having a void return type
3769 limTriggerBackgroundScan( pMac );
3770
3771 bScanTriggered = eSIR_TRUE;
3772 }
3773 else
3774 {
3775 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003776 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 -07003777 }
3778 }
3779 else
3780 {
3781 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003782 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 -07003783 }
3784 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003785 return bScanTriggered;
3786}
3787
3788
3789/**
3790 * limGetHTCapability()
3791 *
3792 *FUNCTION:
3793 * A utility function that returns the "current HT capability state" for the HT
3794 * capability of interest (as requested in the API)
3795 *
3796 *LOGIC:
3797 * This routine will return with the "current" setting of a requested HT
3798 * capability. This state info could be retrieved from -
3799 * a) CFG (for static entries)
3800 * b) Run time info
3801 * - Dynamic state maintained by LIM
3802 * - Configured at radio init time by SME
3803 *
3804 *
3805 *ASSUMPTIONS:
3806 * NA
3807 *
3808 *NOTE:
3809 *
3810 * @param pMac Pointer to Global MAC structure
3811 * @param htCap The HT capability being queried
3812 * @return tANI_U8 The current state of the requested HT capability is returned in a
3813 * tANI_U8 variable
3814 */
3815
Jeff Johnson295189b2012-06-20 16:38:30 -07003816tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3817 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003818{
3819tANI_U8 retVal = 0;
3820tANI_U8 *ptr;
3821tANI_U32 cfgValue;
3822tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3823tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3824tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3825tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3826
3827 //
3828 // Determine which CFG to read from. Not ALL of the HT
3829 // related CFG's need to be read each time this API is
3830 // accessed
3831 //
3832 if( htCap >= eHT_ANTENNA_SELECTION &&
3833 htCap < eHT_SI_GRANULARITY )
3834 {
3835 // Get Antenna Seletion HT Capabilities
3836 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3837 cfgValue = 0;
3838 ptr = (tANI_U8 *) &macASCapabilityInfo;
3839 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3840 }
3841 else
3842 {
3843 if( htCap >= eHT_TX_BEAMFORMING &&
3844 htCap < eHT_ANTENNA_SELECTION )
3845 {
3846 // Get Transmit Beam Forming HT Capabilities
3847 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3848 cfgValue = 0;
3849 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3850 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3851 }
3852 else
3853 {
3854 if( htCap >= eHT_PCO &&
3855 htCap < eHT_TX_BEAMFORMING )
3856 {
3857 // Get Extended HT Capabilities
3858 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3859 cfgValue = 0;
3860 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3861 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3862 }
3863 else
3864 {
3865 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3866 {
3867 // Get HT Capabilities
3868 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3869 cfgValue = 0;
3870 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3871 // 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
3872 *ptr++ = cfgValue & 0xff;
3873 *ptr = (cfgValue >> 8) & 0xff;
3874 }
3875 }
3876 }
3877 }
3878
3879 switch( htCap )
3880 {
3881 case eHT_LSIG_TXOP_PROTECTION:
3882 retVal = pMac->lim.gHTLsigTXOPProtection;
3883 break;
3884
3885 case eHT_STBC_CONTROL_FRAME:
3886 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3887 break;
3888
3889 case eHT_PSMP:
3890 retVal = pMac->lim.gHTPSMPSupport;
3891 break;
3892
3893 case eHT_DSSS_CCK_MODE_40MHZ:
3894 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3895 break;
3896
3897 case eHT_MAX_AMSDU_LENGTH:
3898 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3899 break;
3900
3901 case eHT_DELAYED_BA:
3902 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3903 break;
3904
3905 case eHT_RX_STBC:
3906 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3907 break;
3908
3909 case eHT_TX_STBC:
3910 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3911 break;
3912
3913 case eHT_SHORT_GI_40MHZ:
3914 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3915 break;
3916
3917 case eHT_SHORT_GI_20MHZ:
3918 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3919 break;
3920
3921 case eHT_GREENFIELD:
3922 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3923 break;
3924
3925 case eHT_MIMO_POWER_SAVE:
3926 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3927 break;
3928
3929 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003930 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 break;
3932
3933 case eHT_ADVANCED_CODING:
3934 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3935 break;
3936
3937 case eHT_MAX_RX_AMPDU_FACTOR:
3938 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3939 break;
3940
3941 case eHT_MPDU_DENSITY:
3942 retVal = pMac->lim.gHTAMpduDensity;
3943 break;
3944
3945 case eHT_PCO:
3946 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3947 break;
3948
3949 case eHT_TRANSITION_TIME:
3950 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3951 break;
3952
3953 case eHT_MCS_FEEDBACK:
3954 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3955 break;
3956
3957 case eHT_TX_BEAMFORMING:
3958 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3959 break;
3960
3961 case eHT_ANTENNA_SELECTION:
3962 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3963 break;
3964
3965 case eHT_SI_GRANULARITY:
3966 retVal = pMac->lim.gHTServiceIntervalGranularity;
3967 break;
3968
3969 case eHT_CONTROLLED_ACCESS:
3970 retVal = pMac->lim.gHTControlledAccessOnly;
3971 break;
3972
3973 case eHT_RIFS_MODE:
3974 retVal = psessionEntry->beaconParams.fRIFSMode;
3975 break;
3976
3977 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003978 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 break;
3980
3981 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003982 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 break;
3984
3985 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3987 retVal = psessionEntry->htOperMode;
3988 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 retVal = pMac->lim.gHTOperMode;
3990 break;
3991
3992 case eHT_BASIC_STBC_MCS:
3993 retVal = pMac->lim.gHTSTBCBasicMCS;
3994 break;
3995
3996 case eHT_DUAL_CTS_PROTECTION:
3997 retVal = pMac->lim.gHTDualCTSProtection;
3998 break;
3999
4000 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
4001 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
4002 break;
4003
4004 case eHT_PCO_ACTIVE:
4005 retVal = pMac->lim.gHTPCOActive;
4006 break;
4007
4008 case eHT_PCO_PHASE:
4009 retVal = pMac->lim.gHTPCOPhase;
4010 break;
4011
4012 default:
4013 break;
4014 }
4015
4016 return retVal;
4017}
4018
Jeff Johnson295189b2012-06-20 16:38:30 -07004019void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
4020{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304021 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004022 return;
4023}
4024
4025
4026
4027
4028/** -------------------------------------------------------------
4029\fn limEnable11aProtection
4030\brief based on config setting enables\disables 11a protection.
4031\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4032\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4033\param tpUpdateBeaconParams pBeaconParams
4034\return None
4035 -------------------------------------------------------------*/
4036tSirRetStatus
4037limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4038 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4039{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004040 if(NULL == psessionEntry)
4041 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004042 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004043 return eSIR_FAILURE;
4044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 //overlapping protection configuration check.
4046 if(overlap)
4047 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 }
4049 else
4050 {
4051 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004052 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004053 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07004054 {
4055 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004056 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 return eSIR_SUCCESS;
4058 }
4059 }
4060
4061 if (enable)
4062 {
4063 //If we are AP and HT capable, we need to set the HT OP mode
4064 //appropriately.
4065 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07004066 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 {
4068 if(overlap)
4069 {
4070 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
4071 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4072 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4073 {
4074 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4075 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4076 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4077 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4078 }
4079 }
4080 else
4081 {
4082 psessionEntry->gLim11aParams.protectionEnabled = true;
4083 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4084 {
4085 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07004086 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4088 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4089
4090 }
4091 }
4092 }
4093
4094 //This part is common for staiton as well.
4095 if(false == psessionEntry->beaconParams.llaCoexist)
4096 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004097 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
4099 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4100 }
4101 }
4102 else if (true == psessionEntry->beaconParams.llaCoexist)
4103 {
4104 //for AP role.
4105 //we need to take care of HT OP mode change if needed.
4106 //We need to take care of Overlap cases.
4107 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4108 {
4109 if(overlap)
4110 {
4111 //Overlap Legacy protection disabled.
4112 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
4113
4114 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004115 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004116 {
4117 // no HT op mode change if any of the overlap protection enabled.
4118 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4119 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4120 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4121
4122 {
4123 //Check if there is a need to change HT OP mode.
4124 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4125 {
4126 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4127 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4128
4129 if(psessionEntry->gLimHt20Params.protectionEnabled)
4130 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4131 else
4132 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4133 }
4134 }
4135 }
4136 }
4137 else
4138 {
4139 //Disable protection from 11A stations.
4140 psessionEntry->gLim11aParams.protectionEnabled = false;
4141 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4142
4143 //Check if any other non-HT protection enabled.
4144 //Right now we are in HT OP Mixed mode.
4145 //Change HT op mode appropriately.
4146
4147 //Change HT OP mode to 01 if any overlap protection enabled
4148 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4149 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4150 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4151
4152 {
4153 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07004154 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4156 }
4157 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4158 {
4159 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07004160 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4162 }
4163 else
4164 {
4165 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004166 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004167 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4168 }
4169 }
4170 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4171 !psessionEntry->gLim11aParams.protectionEnabled)
4172 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004173 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4175 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4176 }
4177 }
4178 //for station role
4179 else
4180 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004181 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4183 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4184 }
4185 }
4186
4187 return eSIR_SUCCESS;
4188}
4189
4190/** -------------------------------------------------------------
4191\fn limEnable11gProtection
4192\brief based on config setting enables\disables 11g protection.
4193\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4194\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4195\param tpUpdateBeaconParams pBeaconParams
4196\return None
4197 -------------------------------------------------------------*/
4198
4199tSirRetStatus
4200limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4201 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4202{
4203
4204 //overlapping protection configuration check.
4205 if(overlap)
4206 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 }
4208 else
4209 {
4210 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4212 !psessionEntry->cfgProtection.fromllb)
4213 {
4214 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004215 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004216 return eSIR_SUCCESS;
4217 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 {
4219 if(!pMac->lim.cfgProtection.fromllb)
4220 {
4221 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004222 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 return eSIR_SUCCESS;
4224 }
4225 }
4226 }
4227
4228 if (enable)
4229 {
4230 //If we are AP and HT capable, we need to set the HT OP mode
4231 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4233 {
4234 if(overlap)
4235 {
4236 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004237 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004238 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 {
4240 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4241 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4242 {
4243 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4244 }
4245 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4246 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4247 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4248 //Not processing OBSS bit from other APs, as we are already taking care
4249 //of Protection from overlapping BSS based on erp IE or useProtection bit
4250 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4251 }
4252 }
4253 else
4254 {
4255 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004256 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004257 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 {
4259 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4260 {
4261 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4262 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4263 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4264 }
4265 }
4266 }
4267 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004268 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 {
4270 if(overlap)
4271 {
4272 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4273 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4274 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4275 {
4276 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4277 }
4278 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4279 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4280 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4281 //Not processing OBSS bit from other APs, as we are already taking care
4282 //of Protection from overlapping BSS based on erp IE or useProtection bit
4283 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4284 }
4285 else
4286 {
4287 psessionEntry->gLim11bParams.protectionEnabled = true;
4288 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4289 {
4290 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4291 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4292 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4293 }
4294 }
4295 }
4296
4297 //This part is common for staiton as well.
4298 if(false == psessionEntry->beaconParams.llbCoexist)
4299 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004300 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4302 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4303 }
4304 }
4305 else if (true == psessionEntry->beaconParams.llbCoexist)
4306 {
4307 //for AP role.
4308 //we need to take care of HT OP mode change if needed.
4309 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4311 {
4312 if(overlap)
4313 {
4314 //Overlap Legacy protection disabled.
4315 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4316
4317 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004318 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 {
4320 // no HT op mode change if any of the overlap protection enabled.
4321 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4322 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4323 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4324 {
4325 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004326 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004327 {
4328 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4329 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4330 if(psessionEntry->gLimHt20Params.protectionEnabled){
4331 //Commenting out beacuse of CR 258588 WFA cert
4332 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4333 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4334 }
4335 else
4336 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4337 }
4338 }
4339 }
4340 }
4341 else
4342 {
4343 //Disable protection from 11B stations.
4344 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004345 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 //Check if any other non-HT protection enabled.
4347 if(!psessionEntry->gLim11gParams.protectionEnabled)
4348 {
4349 //Right now we are in HT OP Mixed mode.
4350 //Change HT op mode appropriately.
4351 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4352
4353 //Change HT OP mode to 01 if any overlap protection enabled
4354 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4355 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4356 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4357 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4358 {
4359 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004360 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004361 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4362 }
4363 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4364 {
4365 //Commenting because of CR 258588 WFA cert
4366 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4367 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004368 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4370 }
4371 else
4372 {
4373 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4374 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4375 }
4376 }
4377 }
4378 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4379 !psessionEntry->gLim11bParams.protectionEnabled)
4380 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004381 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4383 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4384 }
4385 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 {
4387 if(overlap)
4388 {
4389 //Overlap Legacy protection disabled.
4390 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4391
4392 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004393 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004394 {
4395 // no HT op mode change if any of the overlap protection enabled.
4396 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4397 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4398 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4399
4400 {
4401 //Check if there is a need to change HT OP mode.
4402 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4403 {
4404 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4405 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4406 if(psessionEntry->gLimHt20Params.protectionEnabled)
4407 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4408 else
4409 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4410 }
4411 }
4412 }
4413 }
4414 else
4415 {
4416 //Disable protection from 11B stations.
4417 psessionEntry->gLim11bParams.protectionEnabled = false;
4418 //Check if any other non-HT protection enabled.
4419 if(!psessionEntry->gLim11gParams.protectionEnabled)
4420 {
4421 //Right now we are in HT OP Mixed mode.
4422 //Change HT op mode appropriately.
4423 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4424
4425 //Change HT OP mode to 01 if any overlap protection enabled
4426 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4427 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4428 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4429 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4430
4431 {
4432 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4433 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4434 }
4435 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4436 {
4437 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4438 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4439 }
4440 else
4441 {
4442 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4443 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4444 }
4445 }
4446 }
4447 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4448 !psessionEntry->gLim11bParams.protectionEnabled)
4449 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004450 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4452 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4453 }
4454 }
4455 //for station role
4456 else
4457 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004458 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4460 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4461 }
4462 }
4463 return eSIR_SUCCESS;
4464}
4465
4466/** -------------------------------------------------------------
4467\fn limEnableHtProtectionFrom11g
4468\brief based on cofig enables\disables protection from 11g.
4469\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4470\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4471\param tpUpdateBeaconParams pBeaconParams
4472\return None
4473 -------------------------------------------------------------*/
4474tSirRetStatus
4475limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4476 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4477{
Jeff Johnsone7245742012-09-05 17:12:55 -07004478 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4480
4481 //overlapping protection configuration check.
4482 if(overlap)
4483 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4485 {
4486 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004487 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004488 return eSIR_SUCCESS;
4489 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 {
4491 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004492 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 return eSIR_SUCCESS;
4494 }
4495 }
4496 else
4497 {
4498 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4500 !psessionEntry->cfgProtection.fromllg){
4501 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004502 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 return eSIR_SUCCESS;
4504 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 {
4506 if(!pMac->lim.cfgProtection.fromllg)
4507 {
4508 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004509 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 return eSIR_SUCCESS;
4511 }
4512 }
4513 }
4514 if (enable)
4515 {
4516 //If we are AP and HT capable, we need to set the HT OP mode
4517 //appropriately.
4518
Jeff Johnson295189b2012-06-20 16:38:30 -07004519 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4520 {
4521 if(overlap)
4522 {
4523 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4524 //11g exists in overlap BSS.
4525 //need not to change the operating mode to overlap_legacy
4526 //if higher or same protection operating mode is enabled right now.
4527 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4528 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4529 {
4530 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4531 }
4532 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304533 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 }
4535 else
4536 {
4537 //11g is associated to an AP operating in 11n mode.
4538 //Change the HT operating mode to 'mixed mode'.
4539 psessionEntry->gLim11gParams.protectionEnabled = true;
4540 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4541 {
4542 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4543 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304544 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 }
4546 }
4547 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 {
4549 if(overlap)
4550 {
4551 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4552 //11g exists in overlap BSS.
4553 //need not to change the operating mode to overlap_legacy
4554 //if higher or same protection operating mode is enabled right now.
4555 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4556 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4557 {
4558 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4559 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4560 }
4561 }
4562 else
4563 {
4564 //11g is associated to an AP operating in 11n mode.
4565 //Change the HT operating mode to 'mixed mode'.
4566 psessionEntry->gLim11gParams.protectionEnabled = true;
4567 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4568 {
4569 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4570 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304571 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 }
4573 }
4574 }
4575
4576 //This part is common for staiton as well.
4577 if(false == psessionEntry->beaconParams.llgCoexist)
4578 {
4579 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4580 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4581 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4583 {
4584 // As operating mode changed after G station assoc some way to update beacon
4585 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4586 //pMac->sch.schObject.fBeaconChanged = 1;
4587 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4588 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 }
4590 else if (true == psessionEntry->beaconParams.llgCoexist)
4591 {
4592 //for AP role.
4593 //we need to take care of HT OP mode change if needed.
4594 //We need to take care of Overlap cases.
4595
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4597 {
4598 if(overlap)
4599 {
4600 //Overlap Legacy protection disabled.
4601 if (psessionEntry->gLim11gParams.numSta == 0)
4602 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4603
4604 // no HT op mode change if any of the overlap protection enabled.
4605 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4606 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4607 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4608 {
4609 //Check if there is a need to change HT OP mode.
4610 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4611 {
4612 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4613 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4614
4615 if(psessionEntry->gLimHt20Params.protectionEnabled){
4616 //Commenting because of CR 258588 WFA cert
4617 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4618 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4619 }
4620 else
4621 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4622 }
4623 }
4624 }
4625 else
4626 {
4627 //Disable protection from 11G stations.
4628 psessionEntry->gLim11gParams.protectionEnabled = false;
4629 //Check if any other non-HT protection enabled.
4630 if(!psessionEntry->gLim11bParams.protectionEnabled)
4631 {
4632
4633 //Right now we are in HT OP Mixed mode.
4634 //Change HT op mode appropriately.
4635 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4636
4637 //Change HT OP mode to 01 if any overlap protection enabled
4638 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4639 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4640 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4641 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4642
4643 {
4644 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4645 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4646 }
4647 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4648 {
4649 //Commenting because of CR 258588 WFA cert
4650 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4651 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4652 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4653 }
4654 else
4655 {
4656 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4657 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4658 }
4659 }
4660 }
4661 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4662 !psessionEntry->gLim11gParams.protectionEnabled)
4663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004664 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4666 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4667 }
4668 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 {
4670 if(overlap)
4671 {
4672 //Overlap Legacy protection disabled.
4673 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4674
4675 // no HT op mode change if any of the overlap protection enabled.
4676 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4677 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4678 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4679 {
4680 //Check if there is a need to change HT OP mode.
4681 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4682 {
4683 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4684 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4685
4686 if(psessionEntry->gLimHt20Params.protectionEnabled)
4687 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4688 else
4689 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4690 }
4691 }
4692 }
4693 else
4694 {
4695 //Disable protection from 11G stations.
4696 psessionEntry->gLim11gParams.protectionEnabled = false;
4697 //Check if any other non-HT protection enabled.
4698 if(!psessionEntry->gLim11bParams.protectionEnabled)
4699 {
4700
4701 //Right now we are in HT OP Mixed mode.
4702 //Change HT op mode appropriately.
4703 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4704
4705 //Change HT OP mode to 01 if any overlap protection enabled
4706 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4707 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4708 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4709 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4710
4711 {
4712 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4713 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4714 }
4715 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4716 {
4717 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4718 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4719 }
4720 else
4721 {
4722 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4723 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4724 }
4725 }
4726 }
4727 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4728 !psessionEntry->gLim11gParams.protectionEnabled)
4729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004730 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004731 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4732 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4733 }
4734 }
4735 //for station role
4736 else
4737 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004738 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4740 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4741 }
4742 }
4743 return eSIR_SUCCESS;
4744}
4745//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4746//This check will be done at the caller.
4747
4748/** -------------------------------------------------------------
4749\fn limEnableHtObssProtection
4750\brief based on cofig enables\disables obss protection.
4751\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4752\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4753\param tpUpdateBeaconParams pBeaconParams
4754\return None
4755 -------------------------------------------------------------*/
4756tSirRetStatus
4757limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4758 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4759{
4760
4761
Jeff Johnsone7245742012-09-05 17:12:55 -07004762 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004763 return eSIR_SUCCESS; // this protection is only for HT stations.
4764
4765 //overlapping protection configuration check.
4766 if(overlap)
4767 {
4768 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004769 }
4770 else
4771 {
4772 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4774 { //ToDo Update this field
4775 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004776 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 return eSIR_SUCCESS;
4778 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 {
4780 if(!pMac->lim.cfgProtection.obss)
4781 { //ToDo Update this field
4782 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004783 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004784 return eSIR_SUCCESS;
4785 }
4786 }
4787 }
4788
4789
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4791 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4792 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004793 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 psessionEntry->beaconParams.gHTObssMode = true;
4795 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4796
4797 }
4798 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4799 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004800 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 psessionEntry->beaconParams.gHTObssMode = false;
4802 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4803
4804 }
4805//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4806 if (!enable && !overlap)
4807 {
4808 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4809 }
4810 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 {
4812 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004814 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 psessionEntry->beaconParams.gHTObssMode = true;
4816 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4817
4818 }
4819 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4820 {
4821
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004822 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 psessionEntry->beaconParams.gHTObssMode = false;
4824 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4825
4826 }
4827 }
4828 return eSIR_SUCCESS;
4829}
4830/** -------------------------------------------------------------
4831\fn limEnableHT20Protection
4832\brief based on cofig enables\disables protection from Ht20.
4833\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4834\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4835\param tpUpdateBeaconParams pBeaconParams
4836\return None
4837 -------------------------------------------------------------*/
4838tSirRetStatus
4839limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4840 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4841{
Jeff Johnsone7245742012-09-05 17:12:55 -07004842 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004843 return eSIR_SUCCESS; // this protection is only for HT stations.
4844
4845 //overlapping protection configuration check.
4846 if(overlap)
4847 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 }
4849 else
4850 {
4851 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4853 !psessionEntry->cfgProtection.ht20)
4854 {
4855 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004856 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 return eSIR_SUCCESS;
4858 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 {
4860 if(!pMac->lim.cfgProtection.ht20)
4861 {
4862 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004863 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 return eSIR_SUCCESS;
4865 }
4866 }
4867 }
4868
4869 if (enable)
4870 {
4871 //If we are AP and HT capable, we need to set the HT OP mode
4872 //appropriately.
4873
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4875 if(overlap)
4876 {
4877 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4878 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4879 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4880 {
4881 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4882 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4883 }
4884 }
4885 else
4886 {
4887 psessionEntry->gLimHt20Params.protectionEnabled = true;
4888 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4889 {
4890 //Commenting because of CR 258588 WFA cert
4891 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4892 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4893 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4894 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4895 }
4896 }
4897 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 {
4899 if(overlap)
4900 {
4901 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4902 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4903 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4904 {
4905 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4906 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4907 }
4908 }
4909 else
4910 {
4911 psessionEntry->gLimHt20Params.protectionEnabled = true;
4912 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4913 {
4914 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4915 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4916 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4917 }
4918 }
4919 }
4920
4921 //This part is common for staiton as well.
4922 if(false == psessionEntry->beaconParams.ht20Coexist)
4923 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004924 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4926 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4927 }
4928 }
4929 else if (true == psessionEntry->beaconParams.ht20Coexist)
4930 {
4931 //for AP role.
4932 //we need to take care of HT OP mode change if needed.
4933 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4935 if(overlap)
4936 {
4937 //Overlap Legacy protection disabled.
4938 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4939
4940 // no HT op mode change if any of the overlap protection enabled.
4941 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4942 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4943 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4944 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4945 {
4946
4947 //Check if there is a need to change HT OP mode.
4948 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4949 {
4950 if(psessionEntry->gLimHt20Params.protectionEnabled)
4951 {
4952 //Commented beacuse of CR 258588 for WFA Cert
4953 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4954 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4955 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4956 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4957 }
4958 else
4959 {
4960 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4961 }
4962 }
4963 }
4964 }
4965 else
4966 {
4967 //Disable protection from 11G stations.
4968 psessionEntry->gLimHt20Params.protectionEnabled = false;
4969
4970 //Change HT op mode appropriately.
4971 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4972 {
4973 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4974 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4975 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4976 }
4977 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004978 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004979 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4980 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4981 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 {
4983 if(overlap)
4984 {
4985 //Overlap Legacy protection disabled.
4986 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4987
4988 // no HT op mode change if any of the overlap protection enabled.
4989 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4990 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4991 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4992 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4993 {
4994
4995 //Check if there is a need to change HT OP mode.
4996 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4997 {
4998 if(psessionEntry->gLimHt20Params.protectionEnabled)
4999 {
5000 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
5001 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5002 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5003 }
5004 else
5005 {
5006 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5007 }
5008 }
5009 }
5010 }
5011 else
5012 {
5013 //Disable protection from 11G stations.
5014 psessionEntry->gLimHt20Params.protectionEnabled = false;
5015
5016 //Change HT op mode appropriately.
5017 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
5018 {
5019 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5020 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5021 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5022 }
5023 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005024 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5026 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5027 }
5028 //for station role
5029 else
5030 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005031 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005032 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5033 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5034 }
5035 }
5036
5037 return eSIR_SUCCESS;
5038}
5039
5040/** -------------------------------------------------------------
5041\fn limEnableHTNonGfProtection
5042\brief based on cofig enables\disables protection from NonGf.
5043\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5044\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5045\param tpUpdateBeaconParams pBeaconParams
5046\return None
5047 -------------------------------------------------------------*/
5048tSirRetStatus
5049limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5050 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5051{
Jeff Johnsone7245742012-09-05 17:12:55 -07005052 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 return eSIR_SUCCESS; // this protection is only for HT stations.
5054
5055 //overlapping protection configuration check.
5056 if(overlap)
5057 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005058 }
5059 else
5060 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 //normal protection config check
5062 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5063 !psessionEntry->cfgProtection.nonGf)
5064 {
5065 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005066 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005067 return eSIR_SUCCESS;
5068 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005069 {
5070 //normal protection config check
5071 if(!pMac->lim.cfgProtection.nonGf)
5072 {
5073 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005074 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005075 return eSIR_SUCCESS;
5076 }
5077 }
5078 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5080 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5081 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005082 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005083 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5084 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5085 }
5086 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5087 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005088 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005089 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5090 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5091 }
5092 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 {
5094 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5095 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005096 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005097 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5098 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5099 }
5100 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5101 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005102 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5104 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5105 }
5106 }
5107
5108 return eSIR_SUCCESS;
5109}
5110
5111/** -------------------------------------------------------------
5112\fn limEnableHTLsigTxopProtection
5113\brief based on cofig enables\disables LsigTxop protection.
5114\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5115\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5116\param tpUpdateBeaconParams pBeaconParams
5117\return None
5118 -------------------------------------------------------------*/
5119tSirRetStatus
5120limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5121 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5122{
Jeff Johnsone7245742012-09-05 17:12:55 -07005123 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005124 return eSIR_SUCCESS; // this protection is only for HT stations.
5125
5126 //overlapping protection configuration check.
5127 if(overlap)
5128 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005129 }
5130 else
5131 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 //normal protection config check
5133 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5134 !psessionEntry->cfgProtection.lsigTxop)
5135 {
5136 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005137 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 return eSIR_SUCCESS;
5139 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005140 {
5141 //normal protection config check
5142 if(!pMac->lim.cfgProtection.lsigTxop)
5143 {
5144 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005145 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005146 return eSIR_SUCCESS;
5147 }
5148 }
5149 }
5150
5151
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5153 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5154 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005155 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005156 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5157 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5158 }
5159 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5160 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005161 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005162 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5163 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5164 }
5165 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005166 {
5167 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5168 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005169 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005170 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5171 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5172 }
5173 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5174 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005175 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005176 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5177 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5178 }
5179 }
5180 return eSIR_SUCCESS;
5181}
5182//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5183//This check will be done at the caller.
5184/** -------------------------------------------------------------
5185\fn limEnableHtRifsProtection
5186\brief based on cofig enables\disables Rifs protection.
5187\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5188\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5189\param tpUpdateBeaconParams pBeaconParams
5190\return None
5191 -------------------------------------------------------------*/
5192tSirRetStatus
5193limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5194 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5195{
Jeff Johnsone7245742012-09-05 17:12:55 -07005196 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005197 return eSIR_SUCCESS; // this protection is only for HT stations.
5198
5199
5200 //overlapping protection configuration check.
5201 if(overlap)
5202 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005203 }
5204 else
5205 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005206 //normal protection config check
5207 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5208 !psessionEntry->cfgProtection.rifs)
5209 {
5210 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005211 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 return eSIR_SUCCESS;
5213 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005214 {
5215 //normal protection config check
5216 if(!pMac->lim.cfgProtection.rifs)
5217 {
5218 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005219 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005220 return eSIR_SUCCESS;
5221 }
5222 }
5223 }
5224
Jeff Johnson295189b2012-06-20 16:38:30 -07005225 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5226 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5227 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5228 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005229 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005230 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5231 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5232 }
5233 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5234 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005236 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005237 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5238 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5239 }
5240 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005241 {
5242 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5243 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5244 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005245 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5247 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5248 }
5249 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5250 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5251 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005252 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5254 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5255 }
5256 }
5257 return eSIR_SUCCESS;
5258}
5259
5260// ---------------------------------------------------------------------
5261/**
5262 * limEnableShortPreamble
5263 *
5264 * FUNCTION:
5265 * Enable/Disable short preamble
5266 *
5267 * LOGIC:
5268 *
5269 * ASSUMPTIONS:
5270 *
5271 * NOTE:
5272 *
5273 * @param enable Flag to enable/disable short preamble
5274 * @return None
5275 */
5276
5277tSirRetStatus
5278limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5279{
5280 tANI_U32 val;
5281
5282 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5283 {
5284 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005285 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005286 return eSIR_FAILURE;
5287 }
5288
5289 if (!val)
5290 return eSIR_SUCCESS;
5291
5292 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5293 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005294 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005295 return eSIR_FAILURE;
5296 }
5297
5298 if (!val) // 11G short preamble switching is disabled.
5299 return eSIR_SUCCESS;
5300
5301 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5302 {
5303 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5304 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005305 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005306 psessionEntry->beaconParams.fShortPreamble = true;
5307 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5308 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5309 }
5310 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5311 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005312 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005313 psessionEntry->beaconParams.fShortPreamble = false;
5314 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5315 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5316 }
5317 }
5318
5319 return eSIR_SUCCESS;
5320 }
5321
5322/**
5323 * limTxComplete
5324 *
5325 * Function:
5326 * This is LIM's very own "TX MGMT frame complete" completion routine.
5327 *
5328 * Logic:
5329 * LIM wants to send a MGMT frame (broadcast or unicast)
5330 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5331 * LIM transmits the MGMT frame using the API:
5332 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5333 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5334 * HDD, if it determines that a TX completion routine (in this case
5335 * limTxComplete) has been provided, will invoke this callback
5336 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5337 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5338 *
5339 * Assumptions:
5340 * Presently, this is ONLY being used for MGMT frames/packets
5341 * TODO:
5342 * Would it do good for LIM to have some sort of "signature" validation to
5343 * ensure that the pData argument passed in was a buffer that was actually
5344 * allocated by LIM and/or is not corrupted?
5345 *
5346 * Note: FIXME and TODO
5347 * Looks like palPktFree() is interested in pPacket. But, when this completion
5348 * routine is called, only pData is made available to LIM!!
5349 *
5350 * @param void A pointer to pData. Shouldn't it be pPacket?!
5351 *
5352 * @return none
5353 */
5354void limTxComplete( tHalHandle hHal, void *pData )
5355{
5356 tpAniSirGlobal pMac;
5357 pMac = (tpAniSirGlobal)hHal;
5358
5359#ifdef FIXME_PRIMA
5360 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5361#ifdef TRACE_RECORD
5362 {
5363 tpSirMacMgmtHdr mHdr;
5364 v_U8_t *pRxBd;
5365 vos_pkt_t *pVosPkt;
5366 VOS_STATUS vosStatus;
5367
5368
5369
5370 pVosPkt = (vos_pkt_t *)pData;
5371 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5372
5373 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5374 {
5375 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005376
5377 }
5378 }
5379#endif
5380#endif
5381
5382 palPktFree( pMac->hHdd,
5383 HAL_TXRX_FRM_802_11_MGMT,
5384 (void *) NULL, // this is ignored and will likely be removed from this API
5385 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5386}
5387
5388/**
5389 * \brief This function updates lim global structure, if CB parameters in the BSS
5390 * have changed, and sends an indication to HAL also with the
5391 * updated HT Parameters.
5392 * This function does not detect the change in the primary channel, that is done as part
5393 * of channel Swtich IE processing.
5394 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5395 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5396 *
5397 *
5398 * \param pMac Pointer to global MAC structure
5399 *
5400 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5401 * Probe Response
5402 *
5403 * \param bssIdx BSS Index of the Bss to which Station is associated.
5404 *
5405 *
5406 */
5407
5408void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5409 tDot11fIEHTInfo *pHTInfo,
5410 tANI_U8 bssIdx,
5411 tpPESession psessionEntry)
5412{
Jeff Johnsone7245742012-09-05 17:12:55 -07005413 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005414#if !defined WLAN_FEATURE_VOWIFI
5415 tANI_U32 localPwrConstraint;
5416#endif
5417
5418 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005419 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 return;
5421
Abhishek Singhe3beee22017-07-31 15:35:40 +05305422 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5423 psessionEntry->force_24ghz_in_ht20) {
5424 limLog(pMac, LOG1,
5425 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5426 return;
5427 }
5428
Jeff Johnson295189b2012-06-20 16:38:30 -07005429#if !defined WLAN_FEATURE_VOWIFI
5430 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005431 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005432 return;
5433 }
5434#endif
5435
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305436 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5437 {
5438 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5439 return;
5440 }
5441
Mihir Shetebc160b72014-08-22 14:10:39 +05305442 /*
5443 * Do not try to switch channel if RoC is in progress. RoC code path uses
5444 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5445 * has started listening on the channel requested as part of RoC, if we set
5446 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5447 * upper layers will think that the channel change is not successful and the
5448 * RoC from the upper layer perspective will never end...
5449 */
5450 if (pMac->lim.gpLimRemainOnChanReq)
5451 {
5452 limLog( pMac, LOGE, FL( "RoC is in progress"));
5453 return;
5454 }
5455
Jeff Johnsone7245742012-09-05 17:12:55 -07005456 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5457 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005458 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005459 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5460 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5461 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5462 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005463
5464 // Notify HAL
5465 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005466 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005468 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005470 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005471 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5472 pMac->lim.gpchangeChannelCallback = NULL;
5473 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005474
5475#if defined WLAN_FEATURE_VOWIFI
5476 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5477 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5478#else
5479 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5480 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5481#endif
5482
5483 //In case of IBSS, if STA should update HT Info IE in its beacons.
5484 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5485 {
5486 schSetFixedBeaconFields(pMac,psessionEntry);
5487 }
5488
5489 }
5490} // End limUpdateStaRunTimeHTParams.
5491
5492/**
5493 * \brief This function updates the lim global structure, if any of the
5494 * HT Capabilities have changed.
5495 *
5496 *
5497 * \param pMac Pointer to Global MAC structure
5498 *
5499 * \param pHTCapability Pointer to HT Capability Information Element
5500 * obtained from a Beacon or Probe Response
5501 *
5502 *
5503 *
5504 */
5505
5506void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5507 tDot11fIEHTCaps *pHTCaps )
5508{
5509
5510 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5511 {
5512 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5513 // Send change notification to HAL
5514 }
5515
5516 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5517 {
5518 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5519 // Send change notification to HAL
5520 }
5521
5522 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5523 {
5524 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5525 // Send change notification to HAL
5526 }
5527
5528
5529} // End limUpdateStaRunTimeHTCapability.
5530
5531/**
5532 * \brief This function updates lim global structure, if any of the HT
5533 * Info Parameters have changed.
5534 *
5535 *
5536 * \param pMac Pointer to the global MAC structure
5537 *
5538 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5539 * Probe Response
5540 *
5541 *
5542 */
5543
5544void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305545 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005546{
Jeff Johnsone7245742012-09-05 17:12:55 -07005547 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005548 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005549 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005550 // Send change notification to HAL
5551 }
5552
5553 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5554 {
5555 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5556 // Send change notification to HAL
5557 }
5558
5559 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5560 {
5561 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5562 // Send change notification to HAL
5563 }
5564
5565 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5566 {
5567 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5568 // Send change notification to HAL
5569 }
5570
5571 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5572 {
5573 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5574 }
5575
5576 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5577 {
5578 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5579 // Send change notification to HAL
5580 }
5581
5582 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5583 {
5584 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5585 // Send change notification to HAL
5586 }
5587
5588 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5589 {
5590 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5591 // Send change notification to HAL
5592 }
5593
5594 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5595 {
5596 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5597 // Send change notification to HAL
5598 }
5599
5600 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5601 {
5602 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5603 // Send change notification to HAL
5604 }
5605
5606 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5607 {
5608 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5609 // Send change notification to HAL
5610 }
5611
5612} // End limUpdateStaRunTimeHTInfo.
5613
5614
5615/** -------------------------------------------------------------
5616\fn limProcessHalIndMessages
5617\brief callback function for HAL indication
5618\param tpAniSirGlobal pMac
5619\param tANI_U32 mesgId
5620\param void *mesgParam
5621\return tSirRetStatu - status
5622 -------------------------------------------------------------*/
5623
5624tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5625{
5626 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5627 tSirMsgQ msg;
5628
5629 switch(msgId)
5630 {
5631 case SIR_LIM_DEL_TS_IND:
5632 case SIR_LIM_ADD_BA_IND:
5633 case SIR_LIM_DEL_BA_ALL_IND:
5634 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5635 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305636 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 msg.type = (tANI_U16) msgId;
5638 msg.bodyptr = msgParam;
5639 msg.bodyval = 0;
5640 break;
5641
5642 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305643 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005644 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005645 return eSIR_FAILURE;
5646 }
5647
5648 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5649 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305650 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005651 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5652 return eSIR_FAILURE;
5653 }
5654 return eSIR_SUCCESS;
5655}
5656
5657/** -------------------------------------------------------------
5658\fn limValidateDeltsReq
5659\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5660\param tpAniSirGlobal pMac
5661\param tpSirDeltsReq pDeltsReq
5662\param tSirMacAddr peerMacAddr
5663\return eSirRetStatus - status
5664 -------------------------------------------------------------*/
5665
5666tSirRetStatus
5667limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5668{
5669 tpDphHashNode pSta;
5670 tANI_U8 tsStatus;
5671 tSirMacTSInfo *tsinfo;
5672 tANI_U32 i;
5673 tANI_U8 tspecIdx;
5674 /* if sta
5675 * - verify assoc state
5676 * - del tspec locally
5677 * if ap,
5678 * - verify sta is in assoc state
5679 * - del sta tspec locally
5680 */
5681 if(pDeltsReq == NULL)
5682 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005683 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 return eSIR_FAILURE;
5685 }
5686
5687 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5688 {
5689 tANI_U32 val;
5690
5691 // station always talks to the AP
5692 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5693
5694 val = sizeof(tSirMacAddr);
5695 #if 0
5696 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5697 {
5698 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005699 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005700 return eSIR_FAILURE;
5701 }
5702 #endif// TO SUPPORT BT-AMP
5703 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5704
5705 }
5706 else
5707 {
5708 tANI_U16 assocId;
5709 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5710
5711 assocId = pDeltsReq->aid;
5712 if (assocId != 0)
5713 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5714 else
5715 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5716
5717 if (pSta != NULL)
5718 // TBD: check sta assoc state as well
5719 for (i =0; i < sizeof(tSirMacAddr); i++)
5720 macaddr[i] = pSta->staAddr[i];
5721 }
5722
5723 if (pSta == NULL)
5724 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005725 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005726 return eSIR_FAILURE;
5727 }
5728
5729 if ((! pSta->valid) ||
5730 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5731 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005732 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005733 return eSIR_FAILURE;
5734 }
5735
5736 pDeltsReq->req.wsmTspecPresent = 0;
5737 pDeltsReq->req.wmeTspecPresent = 0;
5738 pDeltsReq->req.lleTspecPresent = 0;
5739
5740 if ((pSta->wsmEnabled) &&
5741 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5742 pDeltsReq->req.wsmTspecPresent = 1;
5743 else if (pSta->wmeEnabled)
5744 pDeltsReq->req.wmeTspecPresent = 1;
5745 else if (pSta->lleEnabled)
5746 pDeltsReq->req.lleTspecPresent = 1;
5747 else
5748 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005749 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005750 return eSIR_FAILURE;
5751 }
5752
5753 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5754 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305755 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005756 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305758 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005759
5760 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005761
5762 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5763 != eSIR_SUCCESS)
5764 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005765 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005766 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5767 return eSIR_FAILURE;
5768 }
5769 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5770 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5771 {
5772 //edca only now.
5773 }
5774 else
5775 {
5776 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5777 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5778 {
5779 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305780 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5781 pSta->staIndex,
5782 tspecIdx,
5783 pDeltsReq->req,
5784 psessionEntry->peSessionId,
5785 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005786 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005787 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005788 tsinfo->traffic.userPrio);
5789 return eSIR_FAILURE;
5790 }
5791 }
5792 }
5793 return eSIR_SUCCESS;
5794}
5795
5796/** -------------------------------------------------------------
5797\fn limRegisterHalIndCallBack
5798\brief registers callback function to HAL for any indication.
5799\param tpAniSirGlobal pMac
5800\return none.
5801 -------------------------------------------------------------*/
5802void
5803limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5804{
5805 tSirMsgQ msg;
5806 tpHalIndCB pHalCB;
5807
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305808 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5809 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005810 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305811 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005812 return;
5813 }
5814
5815 pHalCB->pHalIndCB = limProcessHalIndMessages;
5816
5817 msg.type = WDA_REGISTER_PE_CALLBACK;
5818 msg.bodyptr = pHalCB;
5819 msg.bodyval = 0;
5820
Jeff Johnsone7245742012-09-05 17:12:55 -07005821 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005822 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5823 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305824 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005825 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005826 }
5827
5828 return;
5829}
5830
5831
5832/** -------------------------------------------------------------
5833\fn limProcessAddBaInd
5834
5835\brief handles the BA activity check timeout indication coming from HAL.
5836 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5837\param tpAniSirGlobal pMac
5838\param tSirMsgQ limMsg
5839\return None
5840-------------------------------------------------------------*/
5841void
5842limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5843{
5844 tANI_U8 i;
5845 tANI_U8 tid;
5846 tANI_U16 assocId;
5847 tpDphHashNode pSta;
5848 tpAddBaCandidate pBaCandidate;
5849 tANI_U32 baCandidateCnt;
5850 tpBaActivityInd pBaActivityInd;
5851 tpPESession psessionEntry;
5852 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005853#ifdef FEATURE_WLAN_TDLS
5854 boolean htCapable = FALSE;
5855#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005856
5857
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005858 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005859 return;
5860
5861 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5862 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5863
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005864 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005865 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005866 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305867 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005868 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005869 return;
5870 }
5871
5872 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005873#ifdef FEATURE_WLAN_TDLS
5874 if ((baCandidateCnt > pMac->lim.maxStation))
5875#else
5876 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5877#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005878 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305879 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005880 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005881 return;
5882 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005883
5884#ifdef FEATURE_WLAN_TDLS
5885 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5886 //AP capability
5887 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5888
5889 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5890 {
5891 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5892 if ((NULL == pSta) || (!pSta->valid))
5893 continue;
5894
5895 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5896 htCapable = pSta->mlmStaContext.htCapability;
5897 else
5898 htCapable = psessionEntry->htCapability;
5899
5900 if (htCapable)
5901 break;
5902 }
5903 if (!htCapable)
5904 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305905 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005906 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005907 return;
5908 }
5909#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005910
5911 //delete the complete dialoguetoken linked list
5912 limDeleteDialogueTokenList(pMac);
5913 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5914
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005915 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005916 {
5917 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005918 if ((NULL == pSta) || (!pSta->valid))
5919 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005920
5921 for (tid=0; tid<STACFG_MAX_TC; tid++)
5922 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005923 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005924 (pBaCandidate->baInfo[tid].fBaEnable))
5925 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305926 limLog(pMac, LOG1,
5927 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5928 pSta->staIndex, tid,
5929 pBaCandidate->baInfo[tid].startingSeqNum);
5930 limPostMlmAddBAReq(pMac, pSta, tid,
5931 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 }
5933 }
5934 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305935 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005936 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005937 return;
5938}
5939
5940
5941/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005942\fn limDeleteBASessions
5943\brief Deletes all the exisitng BA sessions for given session
5944 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005945\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005946\param tpPESession pSessionEntry
5947\param tANI_U32 baDirection
5948\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005949-------------------------------------------------------------*/
5950
5951void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005952limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305953 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005954{
5955 tANI_U32 i;
5956 tANI_U8 tid;
5957 tpDphHashNode pSta;
5958
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005959 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005961 limLog(pMac, LOGE, FL("Session does not exist"));
5962 }
5963 else
5964 {
5965 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005966 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005967 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5968 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5969 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5970 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005971 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005972 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005974 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5975 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005976 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005977 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5978 (baDirection & BA_INITIATOR))
5979 {
5980 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305981 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005982 pSessionEntry);
5983 }
5984 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5985 (baDirection & BA_RECIPIENT))
5986 {
5987 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305988 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005989 pSessionEntry);
5990 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005991 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005992 }
5993 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005994 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5995 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5996 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005997 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005998 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5999 &pSessionEntry->dph.dphHashTable);
6000 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006001 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006002 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
6003 (baDirection & BA_INITIATOR))
6004 {
6005 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306006 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006007 pSessionEntry);
6008 }
6009 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
6010 (baDirection & BA_RECIPIENT))
6011 {
6012 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306013 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006014 pSessionEntry);
6015 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006016 }
6017 }
6018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 }
6020}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006021
6022/** -------------------------------------------------------------
6023\fn limDelAllBASessions
6024\brief Deletes all the exisitng BA sessions.
6025\param tpAniSirGlobal pMac
6026\return None
6027-------------------------------------------------------------*/
6028
6029void limDelAllBASessions(tpAniSirGlobal pMac)
6030{
6031 tANI_U32 i;
6032 tpPESession pSessionEntry;
6033
6034 for (i = 0; i < pMac->lim.maxBssId; i++)
6035 {
6036 pSessionEntry = peFindSessionBySessionId(pMac, i);
6037 if (pSessionEntry)
6038 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306039 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
6040 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006041 }
6042 }
6043}
6044
6045/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006046\fn limProcessDelTsInd
6047\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
6048 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
6049\param tpAniSirGlobal pMac
6050\param tSirMsgQ limMsg
6051\return None
6052-------------------------------------------------------------*/
6053void
6054limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
6055{
6056 tpDphHashNode pSta;
6057 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
6058 tpSirDeltsReq pDelTsReq = NULL;
6059 tSirMacAddr peerMacAddr;
6060 tpSirDeltsReqInfo pDelTsReqInfo;
6061 tpLimTspecInfo pTspecInfo;
6062 tpPESession psessionEntry;
6063 tANI_U8 sessionId;
6064
6065if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
6066 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006067 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306068 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006069 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006070 return;
6071 }
6072
6073 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
6074 if(pTspecInfo->inuse == false)
6075 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006076 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07006077 goto error1;
6078 }
6079
6080 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
6081 if(pSta == NULL)
6082 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006083 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006084 pTspecInfo->assocId);
6085 goto error1;
6086 }
6087
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306088 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
6089 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006090 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306091 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006092 goto error1;
6093 }
6094
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306095 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006096
6097 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306100 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006101
6102
6103 //validate the req
6104 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
6105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006106 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 goto error2;
6108 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306109 limLog(pMac, LOG1, "Sent DELTS request to station with "
6110 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
6111 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07006112
6113 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
6114 psessionEntry);
6115
6116 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306117 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
6118 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07006119 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 goto error3;
6122 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306123 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006124
6125 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306126 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006127 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306128 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006129
6130 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
6131
6132error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306133 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07006134error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306135 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006136error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306137 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006138 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006139 return;
6140}
6141
6142/**
6143 * \brief Setup an A-MPDU/BA session
6144 *
6145 * \sa limPostMlmAddBAReq
6146 *
6147 * \param pMac The global tpAniSirGlobal object
6148 *
6149 * \param pStaDs DPH Hash Node object of peer STA
6150 *
6151 * \param tid TID for which a BA is being setup.
6152 * If this is set to 0xFFFF, then we retrieve
6153 * the default TID from the CFG
6154 *
6155 * \return eSIR_SUCCESS if setup completes successfully
6156 * eSIR_FAILURE is some problem is encountered
6157 */
6158tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6159 tpDphHashNode pStaDs,
6160 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6161{
6162 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006163 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006164 tpDialogueToken dialogueTokenNode;
6165 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006166
Jeff Johnson295189b2012-06-20 16:38:30 -07006167 // Check if the peer is a 11n capable STA
6168 // FIXME - Need a 11n peer indication in DPH.
6169 // For now, using the taurusPeer attribute
6170 //if( 0 == pStaDs->taurusPeer == )
6171 //return eSIR_SUCCESS;
6172
6173 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306174 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6175 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006176 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306177 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006178 status = eSIR_MEM_ALLOC_FAILED;
6179 goto returnFailure;
6180 }
6181
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306182 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006183
6184 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306185 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006186 pMlmAddBAReq->peerMacAddr,
6187 pStaDs->staAddr,
6188 sizeof( tSirMacAddr ));
6189
6190 // Update the TID
6191 pMlmAddBAReq->baTID = tid;
6192
6193 // Determine the supported BA policy of local STA
6194 // for the TID of interest
6195 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6196
6197 // BA Buffer Size
6198 // Requesting the ADDBA recipient to populate the size.
6199 // If ADDBA is accepted, a non-zero buffer size should
6200 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306201 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6202 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6203 {
6204 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6205 causing very low throughput in HT40 case */
6206 limLog( pMac, LOGW,
6207 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6208 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6209 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306210 else if (pMac->miracastVendorConfig)
6211 {
6212 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6213 {
6214 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6215 status = eSIR_FAILURE;
6216 goto returnFailure;
6217 }
6218
6219 pMlmAddBAReq->baBufferSize = val;
6220 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306221 else
6222 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006223
6224 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306225 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 -07006226 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6227 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306228 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006229
6230 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006231 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006233 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006234 status = eSIR_FAILURE;
6235 goto returnFailure;
6236 }
6237 pMlmAddBAReq->baTimeout = val; // In TU's
6238
6239 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006240 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006241 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6242 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6243
6244 // BA Starting Sequence Number
6245 pMlmAddBAReq->baSSN = startingSeqNum;
6246
6247 /* Update PE session Id*/
6248 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6249
6250 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6251
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006252 dialogueTokenNode = limAssignDialogueToken(pMac);
6253 if (NULL == dialogueTokenNode)
6254 {
6255 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6256 status = eSIR_FAILURE;
6257 goto returnFailure;
6258 }
6259
Jeff Johnson295189b2012-06-20 16:38:30 -07006260 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006261 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006262 dialogueTokenNode->assocId = pStaDs->assocId;
6263 dialogueTokenNode->tid = tid;
6264 // Send ADDBA Req to MLME
6265 limPostMlmMessage( pMac,
6266 LIM_MLM_ADDBA_REQ,
6267 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006268 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006269
6270returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306271 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 return status;
6273}
6274
6275/**
6276 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6277 * will then send an ADDBA Rsp to peer MAC entity
6278 * with the appropriate ADDBA status code
6279 *
6280 * \sa limPostMlmAddBARsp
6281 *
6282 * \param pMac The global tpAniSirGlobal object
6283 *
6284 * \param peerMacAddr MAC address of peer entity that will
6285 * be the recipient of this ADDBA Rsp
6286 *
6287 * \param baStatusCode ADDBA Rsp status code
6288 *
6289 * \param baDialogToken ADDBA Rsp dialog token
6290 *
6291 * \param baTID TID of interest
6292 *
6293 * \param baPolicy The BA policy
6294 *
6295 * \param baBufferSize The BA buffer size
6296 *
6297 * \param baTimeout BA timeout in TU's
6298 *
6299 * \return eSIR_SUCCESS if setup completes successfully
6300 * eSIR_FAILURE is some problem is encountered
6301 */
6302tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6303 tSirMacAddr peerMacAddr,
6304 tSirMacStatusCodes baStatusCode,
6305 tANI_U8 baDialogToken,
6306 tANI_U8 baTID,
6307 tANI_U8 baPolicy,
6308 tANI_U16 baBufferSize,
6309 tANI_U16 baTimeout,
6310 tpPESession psessionEntry)
6311{
6312tSirRetStatus status = eSIR_SUCCESS;
6313tpLimMlmAddBARsp pMlmAddBARsp;
6314
6315 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306316 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6317 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006318 {
6319 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306320 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006321 status );
6322
6323 status = eSIR_MEM_ALLOC_FAILED;
6324 goto returnFailure;
6325 }
6326
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306327 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006328
6329 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306330 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006331 pMlmAddBARsp->peerMacAddr,
6332 peerMacAddr,
6333 sizeof( tSirMacAddr ));
6334
6335 pMlmAddBARsp->baDialogToken = baDialogToken;
6336 pMlmAddBARsp->addBAResultCode = baStatusCode;
6337 pMlmAddBARsp->baTID = baTID;
6338 pMlmAddBARsp->baPolicy = baPolicy;
6339 pMlmAddBARsp->baBufferSize = baBufferSize;
6340 pMlmAddBARsp->baTimeout = baTimeout;
6341
6342 /* UPdate PE session ID*/
6343 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6344
6345 // Send ADDBA Rsp to MLME
6346 limPostMlmMessage( pMac,
6347 LIM_MLM_ADDBA_RSP,
6348 (tANI_U32 *) pMlmAddBARsp );
6349
6350returnFailure:
6351
6352 return status;
6353}
6354
6355/**
6356 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6357 * will then send an DELBA Ind to peer MAC entity
6358 * with the appropriate DELBA status code
6359 *
6360 * \sa limPostMlmDelBAReq
6361 *
6362 * \param pMac The global tpAniSirGlobal object
6363 *
6364 * \param pSta DPH Hash Node object of peer MAC entity
6365 * for which the BA session is being deleted
6366 *
6367 * \param baDirection DELBA direction
6368 *
6369 * \param baTID TID for which the BA session is being deleted
6370 *
6371 * \param baReasonCode DELBA Req reason code
6372 *
6373 * \return eSIR_SUCCESS if setup completes successfully
6374 * eSIR_FAILURE is some problem is encountered
6375 */
6376tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6377 tpDphHashNode pSta,
6378 tANI_U8 baDirection,
6379 tANI_U8 baTID,
6380 tSirMacReasonCodes baReasonCode,
6381 tpPESession psessionEntry)
6382{
6383tSirRetStatus status = eSIR_SUCCESS;
6384tpLimMlmDelBAReq pMlmDelBAReq;
6385tLimBAState curBaState;
6386
6387if(NULL == pSta)
6388 return eSIR_FAILURE;
6389
6390LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6391
6392 // Need to validate the current BA State.
6393 if( eLIM_BA_STATE_IDLE != curBaState)
6394 {
6395 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006396 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006397 baTID,
6398 curBaState);
6399
6400 status = eSIR_FAILURE;
6401 goto returnFailure;
6402 }
6403
6404 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306405 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6406 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006407 {
6408 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306409 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006410 status );
6411
6412 status = eSIR_MEM_ALLOC_FAILED;
6413 goto returnFailure;
6414 }
6415
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306416 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006417
6418 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306419 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006420 pMlmDelBAReq->peerMacAddr,
6421 pSta->staAddr,
6422 sizeof( tSirMacAddr ));
6423
6424 pMlmDelBAReq->baDirection = baDirection;
6425 pMlmDelBAReq->baTID = baTID;
6426 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6427
6428 /* Update PE session ID*/
6429 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6430
6431 //we don't have valid BA session for the given direction.
6432 // HDD wants to get the BA session deleted on PEER in this case.
6433 // in this case we just need to send DelBA to the peer.
6434 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6435 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6436 {
6437 // Send DELBA Ind over the air
6438 if( eSIR_SUCCESS !=
6439 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6440 status = eSIR_FAILURE;
6441
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306442 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006443 return status;
6444 }
6445
6446
6447 // Update the BA state in STA
6448 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6449
6450 // Send DELBA Req to MLME
6451 limPostMlmMessage( pMac,
6452 LIM_MLM_DELBA_REQ,
6453 (tANI_U32 *) pMlmDelBAReq );
6454
6455returnFailure:
6456
6457 return status;
6458}
6459
6460/**
6461 * \brief Send WDA_ADDBA_REQ to HAL, in order
6462 * to setup a new BA session with a peer
6463 *
6464 * \sa limPostMsgAddBAReq
6465 *
6466 * \param pMac The global tpAniSirGlobal object
6467 *
6468 * \param pSta Runtime, STA-related configuration cached
6469 * in the HashNode object
6470 *
6471 * \param baDialogToken The Action Frame dialog token
6472 *
6473 * \param baTID TID for which the BA session is being setup
6474 *
6475 * \param baPolicy BA Policy
6476 *
6477 * \param baBufferSize The requested BA buffer size
6478 *
6479 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6480 *
6481 * \param baSSN Starting Sequence Number for this BA session
6482 *
6483 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6484 *
6485 * \return none
6486 *
6487 */
6488tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6489 tpDphHashNode pSta,
6490 tANI_U8 baDialogToken,
6491 tANI_U8 baTID,
6492 tANI_U8 baPolicy,
6493 tANI_U16 baBufferSize,
6494 tANI_U16 baTimeout,
6495 tANI_U16 baSSN,
6496 tANI_U8 baDirection,
6497 tpPESession psessionEntry)
6498{
6499tpAddBAParams pAddBAParams = NULL;
6500tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006501tSirMsgQ msgQ;
6502
6503#ifdef WLAN_SOFTAP_VSTA_FEATURE
6504 // we can only do BA on "hard" STAs
6505 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6506 {
6507 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306508 limLog( pMac, LOGE,
6509 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006510 goto returnFailure;
6511 }
6512#endif //WLAN_SOFTAP_VSTA_FEATURE
6513
6514 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306515 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6516 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006517 {
6518 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306519 FL("AllocateMemory failed")
6520 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006521
6522 retCode = eSIR_MEM_ALLOC_FAILED;
6523 goto returnFailure;
6524 }
6525
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306526 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006527
6528 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306529 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006530 (void *) pAddBAParams->peerMacAddr,
6531 (void *) pSta->staAddr,
6532 sizeof( tSirMacAddr ));
6533
6534 // Populate the REQ parameters
6535 pAddBAParams->staIdx = pSta->staIndex;
6536 pAddBAParams->baDialogToken = baDialogToken;
6537 pAddBAParams->baTID = baTID;
6538 pAddBAParams->baPolicy = baPolicy;
6539 pAddBAParams->baBufferSize = baBufferSize;
6540 pAddBAParams->baTimeout = baTimeout;
6541 pAddBAParams->baSSN = baSSN;
6542 pAddBAParams->baDirection = baDirection;
6543 pAddBAParams->respReqd = 1;
6544
6545 /* UPdate PE session ID */
6546 pAddBAParams->sessionId = psessionEntry->peSessionId;
6547
6548 // Post WDA_ADDBA_REQ to HAL.
6549 msgQ.type = WDA_ADDBA_REQ;
6550 //
6551 // FIXME_AMPDU
6552 // A global counter (dialog token) is required to keep track of
6553 // all PE <-> HAL communication(s)
6554 //
6555 msgQ.reserved = 0;
6556 msgQ.bodyptr = pAddBAParams;
6557 msgQ.bodyval = 0;
6558
6559 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306560 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6561 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6562 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6563 pAddBAParams->baTimeout, pAddBAParams->baTID,
6564 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6565 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006566
6567 //defer any other message until we get response back.
6568 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6569
Jeff Johnsone7245742012-09-05 17:12:55 -07006570 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006571#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6572 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6573#endif //FEATURE_WLAN_DIAG_SUPPORT
6574
6575 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6576 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006577 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006578 retCode );
6579 else
6580 return retCode;
6581
6582returnFailure:
6583
6584 // Clean-up...
6585 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306586 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006587
6588 return retCode;
6589
6590}
6591
6592/**
6593 * \brief Send WDA_DELBA_IND to HAL, in order
6594 * to delete an existing BA session with peer
6595 *
6596 * \sa limPostMsgDelBAInd
6597 *
6598 * \param pMac The global tpAniSirGlobal object
6599 *
6600 * \param pSta Runtime, STA-related configuration cached
6601 * in the HashNode object
6602 *
6603 * \param baTID TID for which the BA session is being setup
6604 *
6605 * \param baDirection Identifies whether the DELBA Ind was
6606 * sent by the BA initiator or recipient
6607 *
6608 * \return none
6609 *
6610 */
6611tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6612 tpDphHashNode pSta,
6613 tANI_U8 baTID,
6614 tANI_U8 baDirection,
6615 tpPESession psessionEntry)
6616{
6617tpDelBAParams pDelBAParams = NULL;
6618tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006619tSirMsgQ msgQ;
6620
6621 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306622 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6623 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006624 {
6625 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306626 FL("AllocateMemory failed")
6627 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006628
6629 retCode = eSIR_MEM_ALLOC_FAILED;
6630 goto returnFailure;
6631 }
6632
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306633 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006634
6635 // Populate the REQ parameters
6636 pDelBAParams->staIdx = pSta->staIndex;
6637 pDelBAParams->baTID = baTID;
6638 pDelBAParams->baDirection = baDirection;
6639
6640 /* Update PE session ID */
6641
6642
6643 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6644 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6645
6646 // Post WDA_DELBA_IND to HAL.
6647 msgQ.type = WDA_DELBA_IND;
6648 //
6649 // FIXME:
6650 // A global counter (dialog token) is required to keep track of
6651 // all PE <-> HAL communication(s)
6652 //
6653 msgQ.reserved = 0;
6654 msgQ.bodyptr = pDelBAParams;
6655 msgQ.bodyval = 0;
6656
6657 limLog( pMac, LOGW,
6658 FL( "Sending SIR_HAL_DELBA_IND..." ));
6659
Jeff Johnsone7245742012-09-05 17:12:55 -07006660 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006661#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6662 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6663#endif //FEATURE_WLAN_DIAG_SUPPORT
6664
6665 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6666 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006667 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006668 retCode );
6669 else
6670 {
6671 // Update LIM's internal cache...
6672 if( eBA_INITIATOR == baDirection)
6673 {
6674 pSta->tcCfg[baTID].fUseBATx = 0;
6675 pSta->tcCfg[baTID].txBufSize = 0;
6676 }
6677 else
6678 {
6679 pSta->tcCfg[baTID].fUseBARx = 0;
6680 pSta->tcCfg[baTID].rxBufSize = 0;
6681 }
6682
6683 return retCode;
6684 }
6685
6686returnFailure:
6687
6688 // Clean-up...
6689 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306690 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006691
6692 return retCode;
6693
6694}
6695
6696/**
6697 * @function : limPostSMStateUpdate()
6698 *
6699 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6700 *
6701 * LOGIC:
6702 *
6703 * ASSUMPTIONS:
6704 * NA
6705 *
6706 * NOTE:
6707 * NA
6708 *
6709 * @param pMac - Pointer to Global MAC structure
6710 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6711 * @return None
6712 */
6713tSirRetStatus
6714limPostSMStateUpdate(tpAniSirGlobal pMac,
6715 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6716{
6717 tSirRetStatus retCode = eSIR_SUCCESS;
6718 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006719 tpSetMIMOPS pMIMO_PSParams;
6720
6721 msgQ.reserved = 0;
6722 msgQ.type = WDA_SET_MIMOPS_REQ;
6723
6724 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306725 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6726 if ( NULL == pMIMO_PSParams )
6727 {
6728 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 return eSIR_MEM_ALLOC_FAILED;
6730 }
6731
6732 pMIMO_PSParams->htMIMOPSState = state;
6733 pMIMO_PSParams->staIdx = staIdx;
6734 pMIMO_PSParams->fsendRsp = true;
6735 msgQ.bodyptr = pMIMO_PSParams;
6736 msgQ.bodyval = 0;
6737
6738 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6739
Jeff Johnsone7245742012-09-05 17:12:55 -07006740 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6742 if (eSIR_SUCCESS != retCode)
6743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006744 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306745 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006746 return retCode;
6747 }
6748
6749 return retCode;
6750}
6751
6752void limPktFree (
6753 tpAniSirGlobal pMac,
6754 eFrameType frmType,
6755 tANI_U8 *pRxPacketInfo,
6756 void *pBody)
6757{
6758 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006759}
6760
6761/**
6762 * limGetBDfromRxPacket()
6763 *
6764 *FUNCTION:
6765 * This function is called to get pointer to Polaris
6766 * Buffer Descriptor containing MAC header & other control
6767 * info from the body of the message posted to LIM.
6768 *
6769 *LOGIC:
6770 * NA
6771 *
6772 *ASSUMPTIONS:
6773 * NA
6774 *
6775 *NOTE:
6776 * NA
6777 *
6778 * @param body - Received message body
6779 * @param pRxPacketInfo - Pointer to received BD
6780 * @return None
6781 */
6782
6783void
6784limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6785{
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006787} /*** end limGetBDfromRxPacket() ***/
6788
6789
6790
6791
6792
6793void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6794{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306795 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006796}
6797
6798
6799void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6800{
6801 tANI_U8 i;
6802 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6803
6804 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6805 {
6806 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6807 {
6808 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6809 fFound = eANI_BOOLEAN_TRUE;
6810 break;
6811 }
6812 }
6813 if(eANI_BOOLEAN_FALSE == fFound)
6814 {
6815 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6816 {
6817 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6818 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6819 }
6820 else
6821 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006822 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006823 }
6824 }
6825}
6826
6827
6828/**
6829 * @function : limIsChannelValidForChannelSwitch()
6830 *
6831 * @brief : This function checks if the channel to which AP
6832 * is expecting us to switch, is a valid channel for us.
6833 * LOGIC:
6834 *
6835 * ASSUMPTIONS:
6836 * NA
6837 *
6838 * NOTE:
6839 * NA
6840 *
6841 * @param pMac - Pointer to Global MAC structure
6842 * @param channel - New channel to which we are expected to move
6843 * @return None
6844 */
6845tAniBool
6846limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6847{
6848 tANI_U8 index;
6849 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6850 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6851
6852 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6853 (tANI_U8 *)validChannelList,
6854 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6855 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006856 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 return (eSIR_FALSE);
6858 }
6859
6860 for(index = 0; index < validChannelListLen; index++)
6861 {
6862 if(validChannelList[index] == channel)
6863 return (eSIR_TRUE);
6864 }
6865
6866 /* channel does not belong to list of valid channels */
6867 return (eSIR_FALSE);
6868}
6869
6870/**------------------------------------------------------
6871\fn __limFillTxControlParams
6872\brief Fill the message for stopping/resuming tx.
6873
6874\param pMac
6875\param pTxCtrlMsg - Pointer to tx control message.
6876\param type - Which way we want to stop/ resume tx.
6877\param mode - To stop/resume.
6878 -------------------------------------------------------*/
6879static eHalStatus
6880__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6881 tLimQuietTxMode type, tLimControlTx mode)
6882{
6883
6884 //TBD-RAJESH HOW TO GET sessionEntry?????
6885 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6886
6887 if (mode == eLIM_STOP_TX)
6888 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6889 else
6890 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6891
6892 switch (type)
6893 {
6894 case eLIM_TX_ALL:
6895 /** Stops/resumes transmission completely */
6896 pTxCtrlMsg->fCtrlGlobal = 1;
6897 break;
6898
6899 case eLIM_TX_BSS_BUT_BEACON:
6900 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6901 * stop beacon transmission.
6902 */
6903 pTxCtrlMsg->ctrlBss = 1;
6904 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6905 break;
6906
6907 case eLIM_TX_STA:
6908 /** Memory for station bitmap is allocated dynamically in caller of this
6909 * so decode properly here and fill the bitmap. Now not implemented,
6910 * fall through.
6911 */
6912 case eLIM_TX_BSS:
6913 //Fall thru...
6914 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006915 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 return eHAL_STATUS_FAILURE;
6917 }
6918
6919 return eHAL_STATUS_SUCCESS;
6920}
6921
6922/**
6923 * @function : limFrameTransmissionControl()
6924 *
6925 * @brief : This API is called by the user to halt/resume any frame
6926 * transmission from the device. If stopped, all frames will be
6927 * queued starting from hardware. Then back-pressure
6928 * is built till the driver.
6929 * LOGIC:
6930 *
6931 * ASSUMPTIONS:
6932 * NA
6933 *
6934 * NOTE:
6935 * NA
6936 *
6937 * @param pMac - Pointer to Global MAC structure
6938 * @return None
6939 */
6940void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6941{
6942
6943 eHalStatus status = eHAL_STATUS_FAILURE;
6944 tpTxControlParams pTxCtrlMsg;
6945 tSirMsgQ msgQ;
6946 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6947
6948 /** Allocate only required number of bytes for station bitmap
6949 * Make it to align to 4 byte boundary */
6950 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6951
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306952 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6953 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006954 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306955 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006956 return;
6957 }
6958
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306959 vos_mem_set((void *) pTxCtrlMsg,
6960 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006961 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6962 if (status != eHAL_STATUS_SUCCESS)
6963 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306964 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006965 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006966 return;
6967 }
6968
6969 msgQ.bodyptr = (void *) pTxCtrlMsg;
6970 msgQ.bodyval = 0;
6971 msgQ.reserved = 0;
6972 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6973
Jeff Johnsone7245742012-09-05 17:12:55 -07006974 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006975 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6976 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306977 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006978 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006979 return;
6980 }
6981
6982 if (mode == eLIM_STOP_TX)
6983 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306984 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006985 }
6986 else
6987 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306988 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006989 }
6990 return;
6991}
6992
6993
6994/**
6995 * @function : limRestorePreChannelSwitchState()
6996 *
6997 * @brief : This API is called by the user to undo any
6998 * specific changes done on the device during
6999 * channel switch.
7000 * LOGIC:
7001 *
7002 * ASSUMPTIONS:
7003 * NA
7004 *
7005 * NOTE:
7006 * NA
7007 *
7008 * @param pMac - Pointer to Global MAC structure
7009 * @return None
7010 */
7011
7012tSirRetStatus
7013limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
7014{
7015
7016 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007017 tANI_U32 val = 0;
7018
7019 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7020 return retCode;
7021
7022 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007023 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007024
7025 /* Restore the frame transmission, all the time. */
7026 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7027
7028 /* Free to enter BMPS */
7029 limSendSmePostChannelSwitchInd(pMac);
7030
7031 //Background scan is now enabled by SME
7032 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7033 {
7034 /* Enable background scan if already enabled, else don't bother */
7035 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7036 &val)) != eSIR_SUCCESS)
7037
7038 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007039 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007040 return (retCode);
7041 }
7042
7043 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7044 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007045 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7046 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7048 {
7049 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7050 return (eSIR_FAILURE);
7051 }
7052
7053 }
7054 }
7055
7056 /* Enable heartbeat timer */
7057 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7058 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007059 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7060 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
7061 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
7062 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007063 {
7064 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7065 return (eSIR_FAILURE);
7066 }
7067 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007068 return (retCode);
7069}
7070
7071
7072/**--------------------------------------------
7073\fn limRestorePreQuietState
7074\brief Restore the pre quiet state
7075
7076\param pMac
7077\return NONE
7078---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007079tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07007080{
7081
7082 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007083 tANI_U32 val = 0;
7084
7085 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
7086 return retCode;
7087
7088 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007089 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007090
7091 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07007092 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07007093 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7094
7095
7096 //Background scan is now enabled by SME
7097 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7098 {
7099 /* Enable background scan if already enabled, else don't bother */
7100 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7101 &val)) != eSIR_SUCCESS)
7102
7103 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007104 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007105 return (retCode);
7106 }
7107
7108 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7109 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007110 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007111 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7112 {
7113 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7114 return (eSIR_FAILURE);
7115 }
7116
7117 }
7118 }
7119
7120 /* Enable heartbeat timer */
7121 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7122 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007123 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007124 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07007125 {
7126 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7127 return (eSIR_FAILURE);
7128 }
7129 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007130 return (retCode);
7131}
7132
7133
7134/**
7135 * @function: limPrepareFor11hChannelSwitch()
7136 *
7137 * @brief : This API is called by the user to prepare for
7138 * 11h channel switch. As of now, the API does
7139 * very minimal work. User can add more into the
7140 * same API if needed.
7141 * LOGIC:
7142 *
7143 * ASSUMPTIONS:
7144 * NA
7145 *
7146 * NOTE:
7147 * NA
7148 *
7149 * @param pMac - Pointer to Global MAC structure
7150 * @param psessionEntry
7151 * @return None
7152 */
7153void
7154limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7155{
Jeff Johnson295189b2012-06-20 16:38:30 -07007156 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7157 return;
7158
7159 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007160 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007161
7162 /* Disable, Stop background scan if enabled and running */
7163 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7164
7165 /* Stop heart-beat timer to stop heartbeat disassociation */
7166 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7167
7168 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7169 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007171 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007172 /* Stop ongoing scanning if any */
7173 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7174 {
7175 //Set the resume channel to Any valid channel (invalid).
7176 //This will instruct HAL to set it to any previous valid channel.
7177 peSetResumeChannel(pMac, 0, 0);
7178 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7179 }
7180 else
7181 {
7182 limRestorePreChannelSwitchState(pMac, psessionEntry);
7183 }
7184 return;
7185 }
7186 else
7187 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007188 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007189 /** We are safe to switch channel at this point */
7190 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7191 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007192}
7193
7194
7195
7196/**----------------------------------------------------
7197\fn limGetNwType
7198
7199\brief Get type of the network from data packet or beacon
7200\param pMac
7201\param channelNum - Channel number
7202\param type - Type of packet.
7203\param pBeacon - Pointer to beacon or probe response
7204
7205\return Network type a/b/g.
7206-----------------------------------------------------*/
7207tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7208{
7209 tSirNwType nwType = eSIR_11B_NW_TYPE;
7210
7211 if (type == SIR_MAC_DATA_FRAME)
7212 {
7213 if ((channelNum > 0) && (channelNum < 15))
7214 {
7215 nwType = eSIR_11G_NW_TYPE;
7216 }
7217 else
7218 {
7219 nwType = eSIR_11A_NW_TYPE;
7220 }
7221 }
7222 else
7223 {
7224 if ((channelNum > 0) && (channelNum < 15))
7225 {
7226 int i;
7227 // 11b or 11g packet
7228 // 11g iff extended Rate IE is present or
7229 // if there is an A rate in suppRate IE
7230 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7231 {
7232 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7233 {
7234 nwType = eSIR_11G_NW_TYPE;
7235 break;
7236 }
7237 }
7238 if (pBeacon->extendedRatesPresent)
7239 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007240 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007241 nwType = eSIR_11G_NW_TYPE;
7242 }
7243 }
7244 else
7245 {
7246 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007247 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007248 nwType = eSIR_11A_NW_TYPE;
7249 }
7250 }
7251 return nwType;
7252}
7253
7254
7255/**---------------------------------------------------------
7256\fn limGetChannelFromBeacon
7257\brief To extract channel number from beacon
7258
7259\param pMac
7260\param pBeacon - Pointer to beacon or probe rsp
7261\return channel number
7262-----------------------------------------------------------*/
7263tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7264{
7265 tANI_U8 channelNum = 0;
7266
7267 if (pBeacon->dsParamsPresent)
7268 channelNum = pBeacon->channelNumber;
7269 else if(pBeacon->HTInfo.present)
7270 channelNum = pBeacon->HTInfo.primaryChannel;
7271 else
7272 channelNum = pBeacon->channelNumber;
7273
7274 return channelNum;
7275}
7276
7277
7278/** ---------------------------------------------------------
7279\fn limSetTspecUapsdMask
7280\brief This function sets the PE global variable:
7281\ 1) gUapsdPerAcTriggerEnableMask and
7282\ 2) gUapsdPerAcDeliveryEnableMask
7283\ based on the user priority field and direction field
7284\ in the TS Info Fields.
7285\
7286\ An AC is a trigger-enabled AC if the PSB subfield
7287\ is set to 1 in the uplink direction.
7288\ An AC is a delivery-enabled AC if the PSB subfield
7289\ is set to 1 in the down-link direction.
7290\
7291\param tpAniSirGlobal pMac
7292\param tSirMacTSInfo pTsInfo
7293\param tANI_U32 action
7294\return None
7295 ------------------------------------------------------------*/
7296void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7297{
7298 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7299 tANI_U16 direction = pTsInfo->traffic.direction;
7300 tANI_U8 ac = upToAc(userPrio);
7301
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307302 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 -07007303
7304 /* Converting AC to appropriate Uapsd Bit Mask
7305 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7306 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7307 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7308 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7309 */
7310 ac = ((~ac) & 0x3);
7311
7312 if (action == CLEAR_UAPSD_MASK)
7313 {
7314 if (direction == SIR_MAC_DIRECTION_UPLINK)
7315 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7316 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7317 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7318 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7319 {
7320 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7321 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7322 }
7323 }
7324 else if (action == SET_UAPSD_MASK)
7325 {
7326 if (direction == SIR_MAC_DIRECTION_UPLINK)
7327 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7328 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7329 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7330 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7331 {
7332 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7333 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7334 }
7335 }
7336
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007337 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7338 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007339
7340 return;
7341}
7342
7343
7344
7345void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7346{
7347
7348 tANI_U8 i;
7349 for(i =0;i < pMac->lim.maxBssId;i++)
7350 {
7351 if(pMac->lim.gpSession[i].valid == TRUE )
7352 {
7353 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7354 {
7355 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7356 break;
7357 }
7358
7359 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7360 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7361 {
7362 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7363 }
7364 }
7365 }
7366 for(i=0; i< pMac->lim.maxBssId; i++)
7367 {
7368 if(pMac->lim.gpSession[i].valid == TRUE )
7369 {
7370 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7371 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7372 {
7373 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7374 {
7375 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007376 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007377 i);)
7378 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7379 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7380 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7381 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007382 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007383 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7384 }
7385 break;
7386 }
7387 }
7388 }
7389 }
7390}
7391
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007392void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7393{
7394 if(psessionEntry->valid == TRUE )
7395 {
7396 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7397 {
7398 limIbssHeartBeatHandle(pMac,psessionEntry);
7399 }
7400 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7401 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7402 {
7403 limHandleHeartBeatFailure(pMac,psessionEntry);
7404 }
7405 }
7406 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7407 and the other things again */
7408 if(psessionEntry->valid == TRUE )
7409 {
7410 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7411 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7412 {
7413 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7414 {
7415 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7416 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7417 psessionEntry->bssIdx);)
7418 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7419 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7420 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7421 {
7422 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7423 limReactivateHeartBeatTimer(pMac, psessionEntry);
7424 }
7425 }
7426 }
7427 }
7428}
7429
7430
Jeff Johnson295189b2012-06-20 16:38:30 -07007431tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7432{
7433 tANI_U8 i;
7434 for(i =0;i < pMac->lim.maxBssId;i++)
7435 {
7436 if(pMac->lim.gpSession[i].valid == TRUE )
7437 {
7438 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7439 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7440 {
7441 return pMac->lim.gpSession[i].currentOperChannel;
7442 }
7443 }
7444 }
7445 return 0;
7446}
7447
7448void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7449{
7450
7451 tpPESession psessionEntry;
7452// tANI_U8 sessionId;
7453 tpAddStaParams pAddStaParams;
7454
7455 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7456
7457 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007459 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307460 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007461 return;
7462 }
7463 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7464 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007465#ifdef FEATURE_WLAN_TDLS
7466 else if(pMac->lim.gLimAddStaTdls)
7467 {
7468 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7469 pMac->lim.gLimAddStaTdls = FALSE ;
7470 }
7471#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007472 else
7473 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7474
7475}
7476
7477
7478void limUpdateBeacon(tpAniSirGlobal pMac)
7479{
7480 tANI_U8 i;
7481
7482 for(i =0;i < pMac->lim.maxBssId;i++)
7483 {
7484 if(pMac->lim.gpSession[i].valid == TRUE )
7485 {
7486 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7487 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7488 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7489 )
7490 {
7491 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7492 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7493 }
7494 else
7495 {
7496 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7497 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7498 {
7499
7500 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7501 {
7502 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7503 }
7504 }
7505 }
7506 }
7507 }
7508}
7509
7510void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7511{
7512 tANI_U8 i;
7513 tpPESession psessionEntry;
7514 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7515 for(i =0; i < pMac->lim.maxBssId; i++)
7516 {
7517 if(pMac->lim.gpSession[i].valid == TRUE)
7518 {
7519 psessionEntry = &pMac->lim.gpSession[i];
7520 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7521 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307522 limLog(pMac, LOGE,
7523 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7524 psessionEntry->limSmeState, psessionEntry->limMlmState,
7525 psessionEntry->LimRxedBeaconCntDuringHB,
7526 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007527#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7528 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7529#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007530 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7531 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307532 /* Disconnect even if we have not received a single beacon
7533 * after connection.
7534 */
7535 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7536 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307537 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7538 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007539 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007540 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007541 /* AP did not respond to Probe Request. Tear down link with it.*/
7542 limTearDownLinkWithAp(pMac,
7543 psessionEntry->peSessionId,
7544 eSIR_BEACON_MISSED);
7545 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7546 }
7547 else // restart heartbeat timer
7548 {
7549 limReactivateHeartBeatTimer(pMac, psessionEntry);
7550 }
7551 }
7552 else
7553 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007554 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007555 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7556 limReactivateHeartBeatTimer(pMac, psessionEntry);
7557 }
7558
7559 }
7560 }
7561 }
7562 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7563 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7564}
7565
7566
7567/*
7568* This function assumes there will not be more than one IBSS session active at any time.
7569*/
7570tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7571{
7572 tANI_U8 i;
7573
7574 for(i =0;i < pMac->lim.maxBssId;i++)
7575 {
7576 if( (pMac->lim.gpSession[i].valid) &&
7577 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7578 return (&pMac->lim.gpSession[i]);
7579 }
7580
7581 return NULL;
7582}
7583
7584tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7585{
7586 tANI_U8 i;
7587
7588 for(i =0;i < pMac->lim.maxBssId;i++)
7589 {
7590 if( (pMac->lim.gpSession[i].valid) &&
7591 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7592 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7593 return (&pMac->lim.gpSession[i]);
7594 }
7595
7596 return NULL;
7597}
7598
7599/**---------------------------------------------------------
7600\fn limHandleDeferMsgError
7601\brief handles error scenario, when the msg can not be deferred.
7602\param pMac
7603\param pLimMsg LIM msg, which could not be deferred.
7604\return void
7605-----------------------------------------------------------*/
7606
7607void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7608{
7609 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7610 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307611 /*Decrement the Pending count before droping */
7612 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007613 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7614 }
7615 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007616 {
7617 vos_mem_free( pLimMsg->bodyptr);
7618 pLimMsg->bodyptr = NULL;
7619 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007620}
7621
7622
7623#ifdef FEATURE_WLAN_DIAG_SUPPORT
7624/**---------------------------------------------------------
7625\fn limDiagEventReport
7626\brief This function reports Diag event
7627\param pMac
7628\param eventType
7629\param bssid
7630\param status
7631\param reasonCode
7632\return void
7633-----------------------------------------------------------*/
7634void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7635{
7636 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7637 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7638
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307639 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007640
7641 if (NULL == pSessionEntry)
7642 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307643 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007644 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7645 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7646
7647 }
7648 else
7649 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307650 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007651 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7652 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7653 }
7654 peEvent.event_type = eventType;
7655 peEvent.status = status;
7656 peEvent.reason_code = reasonCode;
7657
7658 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7659 return;
7660}
7661
7662#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7663
7664void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7665{
7666
7667 tpAddStaSelfParams pAddStaSelfParams;
7668 tSirMsgQ mmhMsg;
7669 tpSirSmeAddStaSelfRsp pRsp;
7670
7671
7672 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7673
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307674 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7675 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 {
7677 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307678 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7679 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007680 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007681 return;
7682 }
7683
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307684 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007685
7686 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7687 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7688 pRsp->status = pAddStaSelfParams->status;
7689
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307690 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007691
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307692 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007693 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007694
7695 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7696 mmhMsg.bodyptr = pRsp;
7697 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307698 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007699 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7700
7701}
7702
7703void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7704{
7705
7706 tpDelStaSelfParams pDelStaSelfParams;
7707 tSirMsgQ mmhMsg;
7708 tpSirSmeDelStaSelfRsp pRsp;
7709
7710
7711 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7712
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307713 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7714 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007715 {
7716 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307717 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7718 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007719 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 return;
7721 }
7722
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307723 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007724
7725 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7726 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7727 pRsp->status = pDelStaSelfParams->status;
7728
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307729 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007730
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307731 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007732 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007733
7734 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7735 mmhMsg.bodyptr = pRsp;
7736 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307737 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007738 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7739
7740}
7741
7742/***************************************************************
7743* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7744* To unmap the channel to reverse the effect of mapping
7745* a band channel in hal .Mapping was done hal to overcome the
7746* limitation of the rxbd which use only 4 bit for channel number.
7747*****************************************************************/
7748tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7749{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007750#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007751 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007752 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7753 return aUnsortedChannelList[mapChannel -1];
7754 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007755#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007756 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007757#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007758 return abChannel[mapChannel -1];
7759 else
7760 return 0;
7761}
7762
7763
7764v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7765{
7766 int left = length;
7767 v_U8_t *ptr = pIes;
7768 v_U8_t elem_id;
7769 v_U16_t elem_len;
7770
7771 while(left >= (size_of_len_field+1))
7772 {
7773 elem_id = ptr[0];
7774 if (size_of_len_field == TWO_BYTE)
7775 {
7776 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7777 }
7778 else
7779 {
7780 elem_len = ptr[1];
7781 }
7782
7783
7784 left -= (size_of_len_field+1);
7785 if(elem_len > left)
7786 {
7787 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007788 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007789 eid,elem_len,left);
7790 return NULL;
7791 }
7792 if (elem_id == eid)
7793 {
7794 return ptr;
7795 }
7796
7797 left -= elem_len;
7798 ptr += (elem_len + (size_of_len_field+1));
7799 }
7800 return NULL;
7801}
7802
7803/* return NULL if oui is not found in ie
7804 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7805 */
7806v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7807{
7808 int left = ie_len;
7809 v_U8_t *ptr = ie;
7810 v_U8_t elem_id, elem_len;
7811
7812 while(left >= 2)
7813 {
7814 elem_id = ptr[0];
7815 elem_len = ptr[1];
7816 left -= 2;
7817 if(elem_len > left)
7818 {
7819 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007820 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007821 elem_id,elem_len,left);
7822 return NULL;
7823 }
7824 if (SIR_MAC_EID_VENDOR == elem_id)
7825 {
7826 if(memcmp(&ptr[2], oui, oui_size)==0)
7827 return ptr;
7828 }
7829
7830 left -= elem_len;
7831 ptr += (elem_len + 2);
7832 }
7833 return NULL;
7834}
7835
Jeff Johnson295189b2012-06-20 16:38:30 -07007836//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7837
7838v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7839{
7840 int length = 0;
7841 tANI_U8 *ptr = ie;
7842
7843 ptr[length++] = SIR_MAC_EID_VENDOR;
7844 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307845 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7846 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007847 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7848}
7849
7850//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7851
7852v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7853{
7854 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007855
7856 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7857 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7858 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307859 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007860 noaStream + noaLen - overFlowLen, overFlowLen);
7861 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7862 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307863 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007864 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307865 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7866 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007867 }
7868
Jeff Johnson295189b2012-06-20 16:38:30 -07007869 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7870
7871}
7872
7873//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7874v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7875{
7876 v_U8_t len=0;
7877
7878 v_U8_t *pBody = pNoaStream;
7879
7880
7881 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7882 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7883 {
7884 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7885 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7886 )
7887 return 0; //No NoA Descriptor then return 0
7888
7889
7890 pBody[0] = SIR_P2P_NOA_ATTR;
7891
7892 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7893 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7894 len = 5;
7895 pBody += len;
7896
7897
7898 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7899 {
7900 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7901 pBody += 1;
7902 len +=1;
7903
7904 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7905 pBody += sizeof(tANI_U32);
7906 len +=4;
7907
7908 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7909 pBody += sizeof(tANI_U32);
7910 len +=4;
7911
7912 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7913 pBody += sizeof(tANI_U32);
7914 len +=4;
7915
7916 }
7917
7918 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7919 {
7920 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7921 pBody += 1;
7922 len +=1;
7923
7924 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7925 pBody += sizeof(tANI_U32);
7926 len +=4;
7927
7928 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7929 pBody += sizeof(tANI_U32);
7930 len +=4;
7931
7932 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7933 pBody += sizeof(tANI_U32);
7934 len +=4;
7935
7936 }
7937
7938
7939 pBody = pNoaStream + 1;
7940 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7941
7942 return (len);
7943
7944 }
7945 return 0;
7946
7947}
Jeff Johnsone7245742012-09-05 17:12:55 -07007948
7949void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007950{
7951
7952 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007953 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007954}
Jeff Johnsone7245742012-09-05 17:12:55 -07007955
Jeff Johnson295189b2012-06-20 16:38:30 -07007956/*--------------------------------------------------------------------------
7957
7958 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7959
Jeff Johnsone7245742012-09-05 17:12:55 -07007960 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7961 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007962
7963 \param pMac - pointer to global adapter context
7964 \return - channel to scan from valid session else zero.
7965
7966 \sa
7967
7968 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007969void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007970{
7971
7972 //Rationale - this could be the suspend/resume for assoc and it is essential that
7973 //the new BSS is active for some time. Other BSS was anyway suspended.
7974 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7975 //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 -07007976 //and hence should be ok. Need to discuss this further
7977 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007978 {
7979 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007980 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007981 }
7982 else
7983 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007984 *resumeChannel = pMac->lim.gResumeChannel;
7985 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007986 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007987 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007988}
7989
Viral Modid86bde22012-12-10 13:09:21 -08007990tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7991{
7992 tANI_U8 i;
7993 for(i =0; i < pMac->lim.maxBssId; i++)
7994 {
7995 if(pMac->lim.gpSession[i].valid == TRUE)
7996 {
7997 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7998 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7999 )
8000 {
8001 return TRUE;
8002 }
8003 }
8004 }
8005 return FALSE;
8006}
Jeff Johnsone7245742012-09-05 17:12:55 -07008007
Jeff Johnson295189b2012-06-20 16:38:30 -07008008
8009tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
8010{
8011 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
8012 {
8013 return eANI_BOOLEAN_TRUE;
8014 }
8015 else
8016 {
8017 return eANI_BOOLEAN_FALSE;
8018 }
8019}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07008020
Sandeep Puligilla60342762014-01-30 21:05:37 +05308021/**
8022 * \brief verify the changes in channel bonding
8023 *
8024 * \param pMac Pointer to the global MAC structure
8025 *
8026 * \param psessionEntry session entry
8027 * beaconSecChanWidth Secondary channel width
8028 * advertized in beacon
8029 * currentSecChanWidth Current configured width
8030 * staId Station Id
8031 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
8032 */
8033tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
8034 tpPESession psessionEntry,
8035 tANI_U8 beaconSecChanWidth,
8036 tANI_U8 currentSecChanWidth,
8037 tANI_U8 staId)
8038{
8039 tUpdateVHTOpMode tempParam;
8040 tANI_BOOLEAN fCbMode24G = FALSE;
8041 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
8042
8043 /* Moving from HT40 to HT20 operation*/
8044 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
8045 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
8046 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
8047 {
8048 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
8049 tempParam.staId = staId;
8050 fCbMode24G = TRUE;
8051 }
8052
8053 /* Moving from HT20 to HT40 operation*/
8054 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
8055 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
8056 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
8057 {
8058 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
8059 tempParam.staId = staId;
8060 fCbMode24G = TRUE;
8061 }
8062
8063 if (TRUE == fCbMode24G)
8064 {
8065 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8066 "Changing CBMODE to = %d staId = %d",
8067 tempParam.opMode, tempParam.staId );
8068 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
8069 status = eANI_BOOLEAN_TRUE;
8070 }
8071 return status;
8072}
8073
Mohit Khanna4a70d262012-09-11 16:30:12 -07008074#ifdef WLAN_FEATURE_11AC
8075tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
8076{
8077 tUpdateVHTOpMode tempParam;
8078
8079 tempParam.opMode = chanWidth;
8080 tempParam.staId = staId;
8081
8082 limSendModeUpdate( pMac, &tempParam, psessionEntry );
8083
8084 return eANI_BOOLEAN_TRUE;
8085}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008086#endif
8087
krunal soni45b9eb62014-03-26 12:54:25 -07008088void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
8089 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008090{
8091 tANI_U8 val=0;
8092
krunal soni45b9eb62014-03-26 12:54:25 -07008093 //only 2.4G band should have short slot enable, rest it should be default
8094 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008095 {
krunal soni45b9eb62014-03-26 12:54:25 -07008096 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008097 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07008098 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008099 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
8100 {
8101 val = true;
8102 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008103 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008104 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008105 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008106 // Joining BSS.
8107 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008108 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008109 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008110 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008111 // Reassociating with AP.
8112 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008113 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008114 }
krunal soni45b9eb62014-03-26 12:54:25 -07008115 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008116 {
krunal soni45b9eb62014-03-26 12:54:25 -07008117 /*
8118 * 11B does not short slot and short slot is default
8119 * for 11A mode. Hence, not need to set this bit
8120 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008121 val = false;
8122 }
krunal soni45b9eb62014-03-26 12:54:25 -07008123
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07008124 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07008125 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008126}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308127
Kalikinkar dhara205da782014-03-21 15:49:32 -07008128void limUtilsframeshtons(tpAniSirGlobal pCtx,
8129 tANI_U8 *pOut,
8130 tANI_U16 pIn,
8131 tANI_U8 fMsb)
8132{
8133 (void)pCtx;
8134#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8135 if ( !fMsb )
8136 {
8137 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8138 }
8139 else
8140 {
8141 *pOut = ( pIn & 0xff00 ) >> 8;
8142 *( pOut + 1 ) = pIn & 0xff;
8143 }
8144#else
8145 if ( !fMsb )
8146 {
8147 *pOut = pIn & 0xff;
8148 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8149 }
8150 else
8151 {
8152 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8153 }
8154#endif
8155}
8156
8157void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8158 tANI_U8 *pOut,
8159 tANI_U32 pIn,
8160 tANI_U8 fMsb)
8161{
8162 (void)pCtx;
8163#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8164 if ( !fMsb )
8165 {
8166 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8167 }
8168 else
8169 {
8170 *pOut = ( pIn & 0xff000000 ) >> 24;
8171 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8172 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8173 *( pOut + 3 ) = ( pIn & 0x000000ff );
8174 }
8175#else
8176 if ( !fMsb )
8177 {
8178 *( pOut ) = ( pIn & 0x000000ff );
8179 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8180 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8181 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8182 }
8183 else
8184 {
8185 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8186 }
8187#endif
8188}
8189
8190
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308191/**--------------------------------------------
8192\fn limUpdateOBSSScanParams
8193\brief Updates OBSS SCAN IE parameters to session
8194
8195\param psessionEntry - Session Entry
8196\return NONE
8197---------------------------------------------*/
8198void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8199 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8200{
8201 /*If the recieved value is not in the range specified by the Specification
8202 then it will be the default value configured through cfg */
8203 if (( pOBSSScanParameters->obssScanActiveDwell >
8204 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8205 ( pOBSSScanParameters->obssScanActiveDwell <
8206 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8207 {
8208 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8209 pOBSSScanParameters->obssScanActiveDwell;
8210 }
8211 if((pOBSSScanParameters->obssScanPassiveDwell >
8212 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8213 (pOBSSScanParameters->obssScanPassiveDwell <
8214 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8215 {
8216 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8217 pOBSSScanParameters->obssScanPassiveDwell;
8218 }
8219 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8220 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8221 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8222 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8223 {
8224 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8225 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8226 }
8227 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8228 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8229 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8230 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8231 {
8232 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8233 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8234 }
8235 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8236 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8237 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8238 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8239 {
8240 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8241 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8242 }
8243 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8244 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8245 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8246 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8247 {
8248 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8249 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8250 }
8251 if((pOBSSScanParameters->obssScanActivityThreshold >
8252 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8253 (pOBSSScanParameters->obssScanActivityThreshold <
8254 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8255 {
8256 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8257 pOBSSScanParameters->obssScanActivityThreshold;
8258 }
8259}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008260
8261#ifdef WLAN_FEATURE_11W
8262void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8263{
8264 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8265 tPmfSaQueryTimerId timerId;
8266 tpPESession psessionEntry;
8267 tpDphHashNode pSta;
8268 tANI_U32 maxRetries;
8269
8270 limLog(pMac, LOG1, FL("SA Query timer fires"));
8271 timerId.value = param;
8272
8273 // Check that SA Query is in progress
8274 if ((psessionEntry = peFindSessionBySessionId(
8275 pMac, timerId.fields.sessionId)) == NULL)
8276 {
8277 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8278 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008279 return;
8280 }
8281 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8282 &psessionEntry->dph.dphHashTable)) == NULL)
8283 {
8284 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8285 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008286 return;
8287 }
8288 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8289 return;
8290
8291 // Increment the retry count, check if reached maximum
8292 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8293 &maxRetries) != eSIR_SUCCESS)
8294 {
8295 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8296 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8297 return;
8298 }
8299 pSta->pmfSaQueryRetryCount++;
8300 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8301 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308302 limLog(pMac, LOGE,
8303 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8304 MAC_ADDR_ARRAY(pSta->staAddr));
8305 limSendDisassocMgmtFrame(pMac,
8306 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8307 pSta->staAddr, psessionEntry, FALSE);
8308 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008309 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8310 return;
8311 }
8312
8313 // Retry SA Query
8314 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8315 pSta->staAddr, psessionEntry);
8316 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008317 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8318 {
8319 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8320 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8321 }
8322}
8323#endif
8324
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008325/** ---------------------------------------------------------
8326\fn limProcessChannelSwitchSuspendLink
8327\brief This function call channel switch functions based on
8328 the gLimChannelSwitch.state. After function return it
8329 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8330 If gLimChannelSwitch.state is non-identified then
8331 print error log as well as restore back the
8332 pre-channelSwitch.
8333\param tpAniSirGlobal pMac
8334\param eHalStatus status
8335\param tANI_U32 *ctx
8336\return None
8337 ------------------------------------------------------------*/
8338static void
8339limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8340 eHalStatus status,
8341 tANI_U32 *ctx)
8342{
8343 tpPESession pSessionEntry = (tpPESession)ctx;
8344
8345 if ( eHAL_STATUS_SUCCESS != status )
8346 {
8347 limLog(pMac, LOGE,
8348 FL("Suspend link failed. still proceeding "));
8349 }
8350 if (NULL == pSessionEntry )
8351 {
8352 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8353 return;
8354 }
8355
8356 switch(pSessionEntry->gLimChannelSwitch.state)
8357 {
8358 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8359 PELOGW(limLog(pMac, LOGW,
8360 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8361 limSwitchPrimaryChannel(pMac,
8362 pSessionEntry->gLimChannelSwitch.primaryChannel,
8363 pSessionEntry);
8364 pSessionEntry->gLimChannelSwitch.state =
8365 eLIM_CHANNEL_SWITCH_IDLE;
8366 break;
8367
8368 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8369 PELOGW(limLog(pMac, LOGW,
8370 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8371 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8372 pSessionEntry->gLimChannelSwitch.primaryChannel,
8373 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8374 pSessionEntry->gLimChannelSwitch.state =
8375 eLIM_CHANNEL_SWITCH_IDLE;
8376 break;
8377
8378 default:
8379 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8380 pSessionEntry->gLimChannelSwitch.state);)
8381 if (limRestorePreChannelSwitchState(pMac,
8382 pSessionEntry) != eSIR_SUCCESS)
8383 {
8384 limLog(pMac, LOGE,
8385 FL("Could not restore pre-channelSwitch "
8386 "(11h) state, resetting the system"));
8387 }
8388 }
8389}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308390
8391/** ---------------------------------------------------------
8392\fn limInitOBSSScanParams
8393\brief This function Initializes the OBSS Scan Parameters
8394\param tpAniSirGlobal pMac
8395\param tpPESession pSessionEntry
8396\return None
8397 ------------------------------------------------------------*/
8398
8399void limInitOBSSScanParams(tpAniSirGlobal pMac,
8400 tpPESession psessionEntry)
8401{
8402 tANI_U32 cfgValue;
8403
8404 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8405 &cfgValue) != eSIR_SUCCESS)
8406 {
8407 limLog(pMac, LOGE, FL("Fail to retrieve "
8408 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8409 return ;
8410 }
8411 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8412
8413 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8414 &cfgValue) != eSIR_SUCCESS)
8415 {
8416 limLog(pMac, LOGE, FL("Fail to retrieve "
8417 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8418 return ;
8419 }
8420 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8421
8422 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8423 &cfgValue) != eSIR_SUCCESS)
8424 {
8425 limLog(pMac, LOGE, FL("Fail to retrieve "
8426 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8427 return ;
8428 }
8429 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8430 = cfgValue;
8431 if (wlan_cfgGetInt(pMac,
8432 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8433 &cfgValue) != eSIR_SUCCESS)
8434 {
8435 limLog(pMac, LOGE, FL("Fail to retrieve"
8436 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8437 return ;
8438 }
8439 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8440 cfgValue;
8441 if (wlan_cfgGetInt(pMac,
8442 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8443 != eSIR_SUCCESS)
8444 {
8445 limLog(pMac, LOGE, FL("Fail to retrieve"
8446 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8447 return ;
8448 }
8449 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8450 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308451
8452 if (wlan_cfgGetInt(pMac,
8453 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8454 != eSIR_SUCCESS)
8455 {
8456 limLog(pMac, LOGE, FL("Fail to retrieve"
8457 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8458 return ;
8459 }
8460 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8461 cfgValue;
8462
8463
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308464 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8465 &cfgValue) != eSIR_SUCCESS)
8466 {
8467 limLog(pMac, LOGE, FL("Fail to retrieve "
8468 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8469 return ;
8470 }
8471 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308472}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308473
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308474const char * lim_ScanTypetoString(const v_U8_t scanType)
8475{
8476 switch (scanType)
8477 {
8478 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8479 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8480 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8481 default:
8482 return "Unknown ScanType";
8483 }
8484}
8485
8486const char * lim_BssTypetoString(const v_U8_t bssType)
8487{
8488 switch (bssType)
8489 {
8490 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8491 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8492 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8493 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8494 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8495 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8496 default:
8497 return "Unknown BssType";
8498 }
8499}
8500
8501const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8502{
8503 switch (mode)
8504 {
8505 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8506 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8507 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8508 default:
8509 return "Unknown BgScanMode";
8510 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308511}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308512
8513#ifdef WLAN_FEATURE_11W
8514/**
8515 *
8516 * \brief This function is called by various LIM modules to correctly set
8517 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8518 *
8519 *
8520 * \param pMac Pointer to Global MAC structure
8521 *
8522 * \param psessionEntry Pointer to session corresponding to the connection
8523 *
8524 * \param peer Peer address of the STA to which the frame is to be sent
8525 *
8526 * \param pMacHdr Pointer to the frame MAC header
8527 *
8528 * \return nothing
8529 *
8530 *
8531 */
8532void
8533limSetProtectedBit(tpAniSirGlobal pMac,
8534 tpPESession psessionEntry,
8535 tSirMacAddr peer,
8536 tpSirMacMgmtHdr pMacHdr)
8537{
8538 tANI_U16 aid;
8539 tpDphHashNode pStaDs;
8540
8541 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8542 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8543 {
8544
8545 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8546 &psessionEntry->dph.dphHashTable );
8547 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308548 /* rmfenabled will be set at the time of addbss.
8549 * but sometimes EAP auth fails and keys are not
8550 * installed then if we send any management frame
8551 * like deauth/disassoc with this bit set then
8552 * firmware crashes. so check for keys are
8553 * installed or not also before setting the bit
8554 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308555 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308556 pMacHdr->fc.wep = 1;
8557 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308558 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308559 pMacHdr->fc.wep = 1;
8560} /*** end limSetProtectedBit() ***/
8561#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308562
8563tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8564{
8565 int left = length;
8566 tANI_U8 *ptr = pIes;
8567 tANI_U8 elem_id,elem_len;
8568
8569 while (left >= 2)
8570 {
8571 elem_id = ptr[0];
8572 elem_len = ptr[1];
8573 left -= 2;
8574
8575 if (elem_len > left)
8576 {
8577 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8578 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8579 eid,elem_len,left);
8580 return NULL;
8581 }
8582 if (elem_id == eid)
8583 {
8584 return ptr;
8585 }
8586
8587 left -= elem_len;
8588 ptr += (elem_len + 2);
8589 }
8590 return NULL;
8591}
8592
8593
8594void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8595{
8596
8597 tANI_U32 nPayload;
8598 tANI_U8 *pPayload;
8599 tANI_U8 *ieptr;
8600 tSirMacTim *tim;
8601
8602 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8603 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8604
8605 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8606 {
8607 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8608 return;
8609 }
8610
8611 if (NULL !=
8612 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8613 nPayload, SIR_MAC_TIM_EID)))
8614 {
8615 /* Ignore EID and Length field*/
8616 tim = (tSirMacTim *)(ieptr + 2);
8617
8618 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8619 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8620 if (tim->dtimCount >= MAX_DTIM_COUNT)
8621 tim->dtimCount = DTIM_COUNT_DEFAULT;
8622 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8623 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8624 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8625 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8626 psessionEntry->currentBssBeaconCnt++;
8627
8628 limLog(pMac, LOG1,
8629 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8630 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8631 psessionEntry->lastBeaconDtimPeriod);
8632
8633 }
8634 return;
8635}
Girish Gowlia95daca2015-02-04 20:31:31 +05308636
8637void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8638 tANI_U8 smeSessionId,
8639 tANI_U32 maxRateFlag)
8640{
8641 tpSirSmeUpdateMaxRateParams pRsp;
8642 tSirMsgQ msg;
8643
8644 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8645 if (NULL == pRsp)
8646 {
8647 limLog(pMac, LOGP, FL("Memory allocation failed"));
8648 return;
8649 }
8650 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8651 pRsp->maxRateFlag = maxRateFlag;
8652 pRsp->smeSessionId = smeSessionId;
8653 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8654 msg.bodyptr = pRsp;
8655 msg.bodyval = 0;
8656 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8657 return;
8658}
Abhishek Singh5d765712015-03-12 14:04:16 +05308659
8660void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8661{
8662 if( pMac->sys.gSysBbtPendingMgmtCount )
8663 {
8664 vos_spin_lock_acquire( &pMac->sys.lock );
8665 pMac->sys.gSysBbtPendingMgmtCount--;
8666 vos_spin_lock_release( &pMac->sys.lock );
8667 }
8668 else
8669 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8670}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308671
8672eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8673{
8674 tpSirTxBdStatus pTxBdStatus;
8675
8676 if (!pData)
8677 {
8678 limLog(pMac, LOGE, FL("pData is NULL"));
8679 return eHAL_STATUS_FAILURE;
8680 }
8681
8682 pTxBdStatus = (tpSirTxBdStatus) pData;
8683
8684 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8685 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8686 return eHAL_STATUS_SUCCESS;
8687}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308688
Kapil Gupta956c0c42017-06-16 19:24:31 +05308689eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8690{
8691 tpSirTxBdStatus pTxBdStatus;
8692 tpDphHashNode pStaDs;
8693 tpPESession psessionEntry;
8694 VOS_STATUS vosStatus;
8695 vos_list_node_t *pNode= NULL, *pNext = NULL;
8696 assoc_rsp_tx_context *tmp_tx_context = NULL;
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
8709 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8710 &pNode);
8711
8712 while(pNode)
8713 {
8714 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8715 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8716 {
8717 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8718 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8719
8720 vosStatus = vos_list_peek_next (
8721 &pMac->assoc_rsp_completion_list,
8722 pNode, &pNext );
8723 pNode = pNext;
8724 pNext = NULL;
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308725 tmp_tx_context = NULL;
Kapil Gupta956c0c42017-06-16 19:24:31 +05308726 }
8727 else
8728 {
8729 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8730 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8731 break;
8732 }
8733 }
8734
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308735 if (!pNode) {
Kapil Gupta956c0c42017-06-16 19:24:31 +05308736 limLog(pMac, LOGE, FL("context is NULL"));
8737 return eHAL_STATUS_SUCCESS;
8738 }
8739 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8740 if (!psessionEntry) {
8741 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8742 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8743 pNode);
8744 vos_mem_free(tmp_tx_context);
8745 return eHAL_STATUS_SUCCESS;
8746 }
8747 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8748 &psessionEntry->dph.dphHashTable);
8749 if (pStaDs == NULL)
8750 {
8751 limLog(pMac, LOGW,
8752 FL("STA context not found"));
8753 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8754 pNode);
8755 vos_mem_free(tmp_tx_context);
8756
8757 return eHAL_STATUS_SUCCESS;
8758 }
8759
8760 /* Receive path cleanup */
8761 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8762 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8763 pNode);
8764 vos_mem_free(tmp_tx_context);
8765
8766 return eHAL_STATUS_SUCCESS;
8767}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308768/**
8769 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8770 * robust action frame
8771 * @action_catagory: Action frame catagory.
8772 *
8773 * This function is used to check if given action catagory is robust
8774 * action frame.
8775 *
8776 * Return: bool
8777 */
8778bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8779{
8780 switch (action_catagory) {
8781 /*
8782 * NOTE: This function doesn't take care of the DMG
8783 * (Directional Multi-Gigatbit) BSS case as 8011ad
8784 * support is not yet added. In future, if the support
8785 * is required then this function need few more arguments
8786 * and little change in logic.
8787 */
8788 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8789 case SIR_MAC_ACTION_QOS_MGMT:
8790 case SIR_MAC_ACTION_DLP:
8791 case SIR_MAC_ACTION_BLKACK:
8792 case SIR_MAC_ACTION_RRM:
8793 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8794 case SIR_MAC_ACTION_SA_QUERY:
8795 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8796 case SIR_MAC_ACTION_WNM:
8797 case SIR_MAC_ACITON_MESH:
8798 case SIR_MAC_ACTION_MHF:
8799 case SIR_MAC_ACTION_FST:
8800 return true;
8801 default:
8802 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8803 FL("non-PMF action category[%d] "),
8804 action_catagory);
8805 break;
8806 }
8807 return false;
8808}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308809
8810/**
Hu Wangc12631c2016-08-11 09:57:03 +08008811 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8812 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308813 * @ext_cap: extended IEs structure
8814 *
Hu Wangc12631c2016-08-11 09:57:03 +08008815 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308816 */
Hu Wangc12631c2016-08-11 09:57:03 +08008817tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8818 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308819
Hu Wangc12631c2016-08-11 09:57:03 +08008820 while (i) {
8821 if (ext_cap->bytes[i-1]) {
8822 break;
8823 }
8824 i --;
8825 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308826
Hu Wangc12631c2016-08-11 09:57:03 +08008827 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308828}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308829
8830/**
8831 * lim_update_caps_info_for_bss - Update capability info for this BSS
8832 *
8833 * @mac_ctx: mac context
8834 * @caps: Pointer to capability info to be updated
8835 * @bss_caps: Capability info of the BSS
8836 *
8837 * Update the capability info in Assoc/Reassoc request frames and reset
8838 * the spectrum management, short preamble, immediate block ack bits
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308839 * and rrm bit mask if the BSS doesnot support it
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308840 *
8841 * Return: None
8842 */
8843void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8844 uint16_t *caps, uint16_t bss_caps)
8845{
8846 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8847 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8848 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8849 }
8850
8851 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8852 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8853 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8854 }
8855
8856 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8857 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8858 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8859 }
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308860
8861 if (!(bss_caps & LIM_RRM_BIT_MASK)) {
8862 *caps &= (~LIM_RRM_BIT_MASK);
8863 limLog(mac_ctx, LOG1,
8864 FL("Clearing radio measurement :no AP support"));
8865 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308866}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308867#ifdef SAP_AUTH_OFFLOAD
8868/**
8869 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8870 *
8871 * @pmac: mac context
8872 * @assoc_req: Assoc request
8873 * @add_sta_req: Add Sta request
8874 *
8875 * This function process recieved add sta message and store it as
8876 * sta ds entry. This function will add this sta entry to DPH as well.
8877 *
8878 * Return: DPH hash node
8879 */
8880static tpDphHashNode
8881_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8882 tpSirAssocReq assoc_req,
8883 tSapOfldAddStaIndMsg *add_sta_req)
8884{
8885 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8886 tpSirAssocReq temp_assoc_req;
8887 tSirRetStatus status;
8888 tpDphHashNode sta_ds = NULL;
8889 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308890 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308891
8892 tpPESession session_entry = limIsApSessionActive(pmac);
8893
8894 if (session_entry == NULL)
8895 {
8896 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8897 return NULL;
8898 }
8899
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308900 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8901 {
8902 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8903 return NULL;
8904 }
8905
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308906 /* Update Attribute and Remove IE for
8907 * Software AP Authentication Offload
8908 */
8909 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308910
8911 /*
8912 * strip MAC mgmt header before passing buf to
8913 * sirConvertAssocReqFrame2Struct() as this API
8914 * expects buf starting from fixed parameters only.
8915 */
8916 frame_body += sizeof(tSirMacMgmtHdr);
8917 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8918
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308919 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8920 mac_assoc_req->capabilityInfo.privacy = 0;
8921
8922 status = sirConvertAssocReqFrame2Struct(pmac,
8923 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308924 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308925 assoc_req);
8926 if (status != eSIR_SUCCESS)
8927 {
8928 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8929 goto error;
8930 }
8931 /* For software AP Auth Offload feature
8932 * Host will take it as none security station
8933 * Force change to none security
8934 */
8935 assoc_req->rsnPresent = 0;
8936 assoc_req->wpaPresent = 0;
8937
8938 sta_ds = dphAddHashEntry(pmac,
8939 add_sta_req->peer_macaddr,
8940 add_sta_req->assoc_id,
8941 &session_entry->dph.dphHashTable);
8942 if (sta_ds == NULL)
8943 {
8944 /* Could not add hash table entry at DPH */
8945 limLog(pmac, LOGE,
8946 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8947 MAC_ADDRESS_STR),
8948 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8949 goto error;
8950 }
8951
8952 if (session_entry->parsedAssocReq != NULL)
8953 {
8954 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8955 if (temp_assoc_req != NULL)
8956 {
8957 if (temp_assoc_req->assocReqFrame)
8958 {
8959 vos_mem_free(temp_assoc_req->assocReqFrame);
8960 temp_assoc_req->assocReqFrame = NULL;
8961 temp_assoc_req->assocReqFrameLength = 0;
8962 }
8963 vos_mem_free(temp_assoc_req);
8964 temp_assoc_req = NULL;
8965 }
8966 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8967 }
8968error:
8969 return sta_ds;
8970}
8971
8972/**
8973 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8974 *
8975 * @sta_ds: STA state node
8976 * @assoc_req: Assoc request
8977 * @add_sta_req: Add Sta request
8978 *
8979 * This function process recieved add sta message and store station's caps
8980 * in station ds entry.
8981 *
8982 * Return: none
8983 */
8984static void
8985_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
8986 tpSirAssocReq assoc_req,
8987 tSapOfldAddStaIndMsg *add_sta_req)
8988
8989{
8990
8991 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
8992#ifdef WLAN_FEATURE_11AC
8993 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
8994#endif
8995 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
8996 sta_ds->qos.addts = assoc_req->addtsReq;
8997 sta_ds->qos.capability = assoc_req->qosCapability;
8998 sta_ds->versionPresent = 0;
8999 /* short slot and short preamble should be
9000 * updated before doing limaddsta
9001 */
9002 sta_ds->shortPreambleEnabled =
9003 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
9004 sta_ds->shortSlotTimeEnabled =
9005 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
9006
9007 sta_ds->valid = 0;
9008 /* The Auth Type of Software AP Authentication Offload
9009 * is always Open System is host side
9010 */
9011 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
9012 sta_ds->staType = STA_ENTRY_PEER;
9013
9014 /* Assoc Response frame to requesting STA */
9015 sta_ds->mlmStaContext.subType = 0;
9016
9017 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
9018 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
9019
9020 /* The following count will be used to knock-off the station
9021 * if it doesn't come back to receive the buffered data.
9022 * The AP will wait for numTimSent number of beacons after
9023 * sending TIM information for the station, before assuming that
9024 * the station is no more associated and disassociates it
9025 */
9026
9027 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
9028 sta_ds->timWaitCount =
9029 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
9030
9031 /* Initialise the Current successful
9032 * MPDU's tranfered to this STA count as 0
9033 */
9034 sta_ds->curTxMpduCnt = 0;
9035}
9036
9037/**
9038 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
9039 *
9040 * @pmac: mac context
9041 * @sta_ds: STA state node
9042 * @assoc_req: Assoc request
9043 *
9044 * This function process recieved add sta message and store station's HT and
9045 * and VHT caps and store them in station ds entry.
9046 *
9047 * Return: tSirRetStatus
9048 */
9049static tSirRetStatus
9050_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
9051 tpDphHashNode sta_ds,
9052 tpSirAssocReq assoc_req)
9053{
9054 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309055 if (session_entry == NULL)
9056 {
9057 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9058 goto error;
9059 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309060
9061 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
9062 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
9063 {
9064 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
9065 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
9066 sta_ds->htDsssCckRate40MHzSupport =
9067 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
9068 sta_ds->htLsigTXOPProtection =
9069 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
9070 sta_ds->htMaxAmsduLength =
9071 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
9072 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
9073 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
9074 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
9075 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
9076 sta_ds->htSupportedChannelWidthSet =
9077 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
9078 /* peer just follows AP; so when we are softAP/GO,
9079 * we just store our session entry's secondary channel offset here
9080 * in peer INFRA STA. However, if peer's 40MHz channel width support
9081 * is disabled then secondary channel will be zero
9082 */
9083 sta_ds->htSecondaryChannelOffset =
9084 (sta_ds->htSupportedChannelWidthSet) ?
9085 session_entry->htSecondaryChannelOffset : 0;
9086#ifdef WLAN_FEATURE_11AC
9087 if (assoc_req->operMode.present)
9088 {
9089 sta_ds->vhtSupportedChannelWidthSet =
9090 (tANI_U8)((assoc_req->operMode.chanWidth ==
9091 eHT_CHANNEL_WIDTH_80MHZ) ?
9092 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
9093 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
9094 sta_ds->htSupportedChannelWidthSet =
9095 (tANI_U8)(assoc_req->operMode.chanWidth ?
9096 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
9097 }
9098 else if (assoc_req->VHTCaps.present)
9099 {
9100 /* Check if STA has enabled it's channel bonding mode.
9101 * If channel bonding mode is enabled, we decide based on
9102 * SAP's current configuration else, we set it to VHT20.
9103 */
9104 sta_ds->vhtSupportedChannelWidthSet =
9105 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
9106 eHT_CHANNEL_WIDTH_20MHZ) ?
9107 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
9108 session_entry->vhtTxChannelWidthSet );
9109 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
9110 }
9111
9112 /* Lesser among the AP and STA bandwidth of operation. */
9113 sta_ds->htSupportedChannelWidthSet =
9114 (sta_ds->htSupportedChannelWidthSet <
9115 session_entry->htSupportedChannelWidthSet) ?
9116 sta_ds->htSupportedChannelWidthSet :
9117 session_entry->htSupportedChannelWidthSet ;
9118#endif
9119 sta_ds->baPolicyFlag = 0xFF;
9120 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
9121 }
9122
9123 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
9124 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
9125
9126 if (!assoc_req->wmeInfoPresent)
9127 {
9128 sta_ds->mlmStaContext.htCapability = 0;
9129#ifdef WLAN_FEATURE_11AC
9130 sta_ds->mlmStaContext.vhtCapability = 0;
9131#endif
9132 }
9133#ifdef WLAN_FEATURE_11AC
9134 if (limPopulateMatchingRateSet(pmac,
9135 sta_ds,
9136 &(assoc_req->supportedRates),
9137 &(assoc_req->extendedRates),
9138 assoc_req->HTCaps.supportedMCSSet,
9139 &(assoc_req->propIEinfo.propRates),
9140 session_entry , &assoc_req->VHTCaps)
9141 != eSIR_SUCCESS)
9142 {
9143#else
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) != eSIR_SUCCESS)
9151 {
9152#endif
9153 limLog(pmac, LOGE,
9154 FL("Rate set mismatched for aid=%d, MacAddr: "
9155 MAC_ADDRESS_STR),
9156 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9157 goto error;
9158 }
9159 return eSIR_SUCCESS;
9160error:
9161 return eSIR_FAILURE;
9162}
9163
9164/**
9165 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9166 *
9167 * @pmac: mac context
9168 * @sta_ds: STA state node
9169 * @assoc_req: Assoc request
9170 *
9171 * This function process recieved add sta message and store station's QOS
9172 * store them in station ds entry.
9173 *
9174 * Return: none
9175 */
9176static void
9177 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9178 tpDphHashNode sta_ds,
9179 tpSirAssocReq assoc_req)
9180{
9181 tHalBitVal qos_mode;
9182 tHalBitVal wsm_mode, wme_mode;
9183 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309184 if (session_entry == NULL)
9185 {
9186 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9187 return;
9188 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309189 limGetQosMode(session_entry, &qos_mode);
9190 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9191 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9192
9193 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9194 {
9195 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9196 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9197 }
9198
9199 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9200 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9201 limGetWmeMode(session_entry, &wme_mode);
9202 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9203 (wme_mode == eHAL_SET))
9204 {
9205 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9206 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9207 limGetWsmMode(session_entry, &wsm_mode);
9208 /* WMM_APSD - WMM_SA related processing should be
9209 * separate; WMM_SA and WMM_APSD can coexist
9210 */
9211 if (assoc_req->WMMInfoStation.present)
9212 {
9213 /* check whether AP supports or not */
9214 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9215 && (session_entry->apUapsdEnable == 0) &&
9216 (assoc_req->WMMInfoStation.acbe_uapsd
9217 || assoc_req->WMMInfoStation.acbk_uapsd
9218 || assoc_req->WMMInfoStation.acvo_uapsd
9219 || assoc_req->WMMInfoStation.acvi_uapsd))
9220 {
9221 /*
9222 * Received Re/Association Request from
9223 * STA when UPASD is not supported
9224 */
9225 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9226 "to STA accordingly" ));
9227 /* update UAPSD and send it to LIM to add STA */
9228 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9229 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9230 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9231 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9232 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9233 }
9234 else
9235 {
9236 /* update UAPSD and send it to LIM to add STA */
9237 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9238 assoc_req->WMMInfoStation.acbe_uapsd;
9239 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9240 assoc_req->WMMInfoStation.acbk_uapsd;
9241 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9242 assoc_req->WMMInfoStation.acvo_uapsd;
9243 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9244 assoc_req->WMMInfoStation.acvi_uapsd;
9245 sta_ds->qos.capability.qosInfo.maxSpLen =
9246 assoc_req->WMMInfoStation.max_sp_length;
9247 }
9248 }
9249 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9250 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9251 }
9252}
9253
9254/**
9255 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9256 *
9257 * @pmac: mac context
9258 * @lim_msgq: Add Sta indication buffer
9259 *
9260 * This function will recieve buffer from firmware. This buffer will store
9261 * information about connected client. driver will process this buffer and
9262 * will register this client with driver. Driver will call limAddSta
9263 *
9264 * Return: none
9265 */
9266void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9267 tSapOfldAddStaIndMsg *lim_msgq)
9268{
9269 tpSirAssocReq assoc_req = NULL;
9270 tpDphHashNode sta_ds = NULL;
9271
9272 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9273 tpPESession session_entry = limIsApSessionActive(pmac);
9274
9275 if (session_entry == NULL)
9276 {
9277 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9278 return;
9279 }
9280 add_sta_req = lim_msgq;
9281 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9282 if (NULL == assoc_req) {
9283 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9284 return;
9285 }
9286 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9287
9288 /* parse Assoc req frame for station information */
9289 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9290 if (sta_ds == NULL)
9291 {
9292 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9293 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9294 vos_mem_free(assoc_req);
9295 goto error;
9296 }
9297
9298 /* Parse Station Capability */
9299 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9300
9301 /* Parse Station HT/VHT information */
9302 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9303 == eSIR_FAILURE)
9304 {
9305 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9306 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9307 vos_mem_free(assoc_req);
9308 goto error;
9309
9310 }
9311
9312 /* Parse Station QOS information */
9313 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9314
9315 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9316 sta_ds->staIndex = add_sta_req->staIdx;
9317 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9318 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9319 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9320 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9321 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9322 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309323 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309324
Agrawal Ashishce67f362017-01-05 20:10:58 +05309325 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9326 sta_ds->staIndex,
9327 sta_ds->bssId,
9328 sta_ds->dpuIndex,
9329 sta_ds->bcastDpuIndex,
9330 sta_ds->bcastMgmtDpuIdx,
9331 sta_ds->ucUcastSig,
9332 sta_ds->ucBcastSig,
9333 sta_ds->ucMgmtSig,
9334 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309335
9336 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9337 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9338 sta_ds->assocId);
9339 }
9340
9341error:
9342 return;
9343}
9344
9345/**
9346 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9347 *
9348 * @pmac: mac context
9349 * @lim_msgq: Del Sta indication buffer
9350 *
9351 * This function will recieve buffer from firmware. This buffer will
9352 * have information about clinet to remove with reason code.
9353 * This function will call limSendSmeDisassocInd to do cleanup
9354 * for station entry
9355 *
9356 * Return: none
9357 */
9358void
9359lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9360{
9361 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9362 tpDphHashNode sta_ds = NULL;
9363 tANI_U16 assoc_id = 0;
9364 tpPESession psession_entry = limIsApSessionActive(pmac);
9365
9366 if (psession_entry == NULL)
9367 {
9368 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9369 goto error;
9370 }
9371
9372 del_sta_req = lim_msgq;
9373 sta_ds = dphLookupHashEntry(pmac,
9374 del_sta_req->peer_macaddr,
9375 &assoc_id,
9376 &psession_entry->dph.dphHashTable);
9377 if (sta_ds == NULL)
9378 {
9379 /*
9380 * Disassociating STA is not associated.
9381 * Log error
9382 */
9383 PELOGE(limLog(pmac, LOGE,
9384 FL("received del sta event that sta not exist in table "
9385 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9386 del_sta_req->reason,
9387 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9388 goto error;
9389 }
9390
9391 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9392 {
9393 /*
9394 * Associate Id mismatch
9395 * Log error
9396 */
9397 PELOGE(limLog(pmac, LOGE,
9398 FL("received del sta event that sta assoc Id mismatch"));)
9399 goto error;
9400 }
9401
9402 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9403 sta_ds->mlmStaContext.disassocReason =
9404 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309405
9406 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9407
9408error:
9409 return;
9410}
9411#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309412
9413int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9414{
9415 tANI_U8 i;
9416 tpPESession psessionEntry = NULL;
9417
9418 for(i =0; i < pMac->lim.maxBssId; i++)
9419 {
9420 /* If BSSID matches return corresponding tables address*/
9421 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9422 {
9423 psessionEntry = (&pMac->lim.gpSession[i]);
9424 return psessionEntry->bssIdx;
9425 }
9426 }
9427
9428 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9429 return(0xFF);
9430}
Yeshwanth Sriram Guntuka8d9b29c2017-12-12 15:44:57 +05309431void limStaDelBASession(tpAniSirGlobal pMac)
9432{
9433 tANI_U32 i;
9434 tpPESession pSessionEntry;
9435
9436 for (i = 0; i < pMac->lim.maxBssId; i++)
9437 {
9438 pSessionEntry = peFindSessionBySessionId(pMac, i);
9439 if (pSessionEntry &&
9440 pSessionEntry->limSystemRole == eLIM_STA_ROLE)
9441 {
9442 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
9443 eSIR_MAC_UNSPEC_FAILURE_REASON);
9444 }
9445 }
9446}