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