blob: 7bdc05b503c73d579d0ee44f8a3ed64f4f893c53 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhinav Kumar626f8652019-08-05 16:20:39 +05302 * Copyright (c) 2011-2019 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
Dundi Raviteja588d4db2020-06-25 10:15:52 +05301122#ifdef WLAN_FEATURE_LFR_MBB
1123 tx_timer_deactivate(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer);
1124 tx_timer_delete(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer);
1125
1126 tx_timer_deactivate(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer);
1127 tx_timer_delete(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer);
1128#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001129
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001130#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001132 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1133 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1134#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001135
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001136 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1137 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1138
1139 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1140 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1141
Hoonki Leef63df0d2013-01-16 19:29:14 -08001142 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1143 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001144
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301145 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1146 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1147
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301148 tx_timer_deactivate(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1149 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1150
Abhinav Kumar626f8652019-08-05 16:20:39 +05301151 tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer);
1152 tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
1153
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 pMac->lim.gLimTimersCreated = 0;
1155 }
1156
Agarwal Ashish888ca022014-11-05 14:25:56 +05301157#ifdef WLAN_FEATURE_11W
1158 /*
1159 * When SSR is triggered, we need to loop through
1160 * each STA associated per BSSId and deactivate/delete
1161 * the pmfSaQueryTimer for it
1162 */
1163 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1164 {
1165 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1166 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1167 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1168 {
1169 if (pMac->lim.gpSession[bss_entry].valid)
1170 {
1171 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1172 sta_entry++)
1173 {
1174 psessionEntry = &pMac->lim.gpSession[bss_entry];
1175 pStaDs = dphGetHashEntry(pMac, sta_entry,
1176 &psessionEntry->dph.dphHashTable);
1177 if (NULL == pStaDs)
1178 {
1179 continue;
1180 }
1181 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1182 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1183 pStaDs->staIndex) ;
1184 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1185 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1186 }
1187 }
1188 }
1189 }
1190#endif
1191
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 /// Cleanup cached scan list
1193 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001194#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1195 /// Cleanup cached scan list
1196 limReInitLfrScanResults(pMac);
1197#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001198
1199} /*** end limCleanupMlm() ***/
1200
1201
1202
1203/**
1204 * limCleanupLmm()
1205 *
1206 *FUNCTION:
1207 * This function is called to cleanup any resources
1208 * allocated by LMM sub-module.
1209 *
1210 *PARAMS:
1211 *
1212 *LOGIC:
1213 *
1214 *ASSUMPTIONS:
1215 * NA
1216 *
1217 *NOTE:
1218 * NA
1219 *
1220 * @param pMac Pointer to Global MAC structure
1221 * @return None
1222 */
1223
1224void
1225limCleanupLmm(tpAniSirGlobal pMac)
1226{
Jeff Johnson295189b2012-06-20 16:38:30 -07001227} /*** end limCleanupLmm() ***/
1228
1229
1230
1231/**
1232 * limIsAddrBC()
1233 *
1234 *FUNCTION:
1235 * This function is called in various places within LIM code
1236 * to determine whether passed MAC address is a broadcast or not
1237 *
1238 *LOGIC:
1239 *
1240 *ASSUMPTIONS:
1241 * NA
1242 *
1243 *NOTE:
1244 * NA
1245 *
1246 * @param macAddr Indicates MAC address that need to be determined
1247 * whether it is Broadcast address or not
1248 *
1249 * @return true if passed address is Broadcast address else false
1250 */
1251
1252tANI_U8
1253limIsAddrBC(tSirMacAddr macAddr)
1254{
1255 int i;
1256 for (i = 0; i < 6; i++)
1257 {
1258 if ((macAddr[i] & 0xFF) != 0xFF)
1259 return false;
1260 }
1261
1262 return true;
1263} /****** end limIsAddrBC() ******/
1264
1265
1266
1267/**
1268 * limIsGroupAddr()
1269 *
1270 *FUNCTION:
1271 * This function is called in various places within LIM code
1272 * to determine whether passed MAC address is a group address or not
1273 *
1274 *LOGIC:
1275 * If least significant bit of first octet of the MAC address is
1276 * set to 1, it is a Group address.
1277 *
1278 *ASSUMPTIONS:
1279 * NA
1280 *
1281 *NOTE:
1282 * NA
1283 *
1284 * @param macAddr Indicates MAC address that need to be determined
1285 * whether it is Group address or not
1286 *
1287 * @return true if passed address is Group address else false
1288 */
1289
1290tANI_U8
1291limIsGroupAddr(tSirMacAddr macAddr)
1292{
1293 if ((macAddr[0] & 0x01) == 0x01)
1294 return true;
1295 else
1296 return false;
1297} /****** end limIsGroupAddr() ******/
1298
1299/**
1300 * limPostMsgApiNoWait()
1301 *
1302 *FUNCTION:
1303 * This function is called from other thread while posting a
1304 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1305 *
1306 *LOGIC:
1307 * NA
1308 *
1309 *ASSUMPTIONS:
1310 * NA
1311 *
1312 *NOTE:
1313 * NA
1314 *
1315 * @param pMsg - Pointer to the Global MAC structure
1316 * @param pMsg - Pointer to the message structure
1317 * @return None
1318 */
1319
1320tANI_U32
1321limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1322{
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 limProcessMessages(pMac, pMsg);
1324 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001325} /*** end limPostMsgApiNoWait() ***/
1326
1327
1328
1329/**
1330 * limPrintMacAddr()
1331 *
1332 *FUNCTION:
1333 * This function is called to print passed MAC address
1334 * in : format.
1335 *
1336 *LOGIC:
1337 *
1338 *ASSUMPTIONS:
1339 * NA
1340 *
1341 *NOTE:
1342 * @param macAddr - MacAddr to be printed
1343 * @param logLevel - Loglevel to be used
1344 *
1345 * @return None.
1346 */
1347
1348void
1349limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1350{
1351 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001352 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001353} /****** end limPrintMacAddr() ******/
1354
1355
Jeff Johnson295189b2012-06-20 16:38:30 -07001356/*
1357 * limResetDeferredMsgQ()
1358 *
1359 *FUNCTION:
1360 * This function resets the deferred message queue parameters.
1361 *
1362 *PARAMS:
1363 * @param pMac - Pointer to Global MAC structure
1364 *
1365 *LOGIC:
1366 *
1367 *ASSUMPTIONS:
1368 * NA
1369 *
1370 *NOTE:
1371 * NA
1372 *
1373 *RETURNS:
1374 * None
1375 */
1376
1377void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1378{
1379 pMac->lim.gLimDeferredMsgQ.size =
1380 pMac->lim.gLimDeferredMsgQ.write =
1381 pMac->lim.gLimDeferredMsgQ.read = 0;
1382
1383}
1384
1385
1386#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1387#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1388
1389/*
1390 * limWriteDeferredMsgQ()
1391 *
1392 *FUNCTION:
1393 * This function queues up a deferred message for later processing on the
1394 * STA side.
1395 *
1396 *PARAMS:
1397 * @param pMac - Pointer to Global MAC structure
1398 * @param limMsg - a LIM message
1399 *
1400 *LOGIC:
1401 *
1402 *ASSUMPTIONS:
1403 * NA
1404 *
1405 *NOTE:
1406 * NA
1407 *
1408 *RETURNS:
1409 * None
1410 */
1411
1412tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1413{
1414 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001415 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1417 limMsg->type);)
1418
1419 /*
1420 ** check if the deferred message queue is full
1421 **/
1422 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1423 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301424 if (!(pMac->lim.deferredMsgCnt & 0xF))
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001425 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301426 limLog(pMac, LOGE,
1427 FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
1428 limMsg->type, ++pMac->lim.deferredMsgCnt);
1429 vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
1430 WLAN_LOG_INDICATOR_HOST_DRIVER,
1431 WLAN_LOG_REASON_QUEUE_FULL,
1432 FALSE, TRUE);
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001433 }
1434 else
1435 {
1436 pMac->lim.deferredMsgCnt++;
1437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 return TX_QUEUE_FULL;
1439 }
1440
1441 /*
1442 ** In the application, there should not be more than 1 message get
1443 ** queued up. If happens, flags a warning. In the future, this can
1444 ** happen.
1445 **/
1446 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1447 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001448 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 -07001449 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1450 limIsSystemInScanState(pMac),
1451 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1452 pMac->lim.gLimAddtsSent);)
1453 }
1454
1455 /*
1456 ** To prevent the deferred Q is full of management frames, only give them certain space
1457 **/
1458 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1459 {
1460 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1461 {
1462 tANI_U16 idx, count = 0;
1463 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1464 {
1465 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1466 {
1467 count++;
1468 }
1469 }
1470 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1471 {
1472 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001473 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 //Return error, caller knows what to do
1475 return TX_QUEUE_FULL;
1476 }
1477 }
1478 }
1479
1480 ++pMac->lim.gLimDeferredMsgQ.size;
1481
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001482 /* reset the count here since we are able to defer the message */
1483 if(pMac->lim.deferredMsgCnt != 0)
1484 {
1485 pMac->lim.deferredMsgCnt = 0;
1486 }
1487
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 /*
1489 ** if the write pointer hits the end of the queue, rewind it
1490 **/
1491 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1492 pMac->lim.gLimDeferredMsgQ.write = 0;
1493
1494 /*
1495 ** save the message to the queue and advanced the write pointer
1496 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301497 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1498 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 (tANI_U8 *)limMsg,
1500 sizeof(tSirMsgQ));
1501 return TX_SUCCESS;
1502
1503}
1504
1505/*
1506 * limReadDeferredMsgQ()
1507 *
1508 *FUNCTION:
1509 * This function dequeues a deferred message for processing on the
1510 * STA side.
1511 *
1512 *PARAMS:
1513 * @param pMac - Pointer to Global MAC structure
1514 *
1515 *LOGIC:
1516 *
1517 *ASSUMPTIONS:
1518 * NA
1519 *
1520 *NOTE:
1521 *
1522 *
1523 *RETURNS:
1524 * Returns the message at the head of the deferred message queue
1525 */
1526
1527tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1528{
1529 tSirMsgQ *msg;
1530
1531 /*
1532 ** check any messages left. If no, return
1533 **/
1534 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1535 return NULL;
1536
1537 /*
1538 ** decrement the queue size
1539 **/
1540 pMac->lim.gLimDeferredMsgQ.size--;
1541
1542 /*
1543 ** retrieve the message from the head of the queue
1544 **/
1545 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1546
1547 /*
1548 ** advance the read pointer
1549 **/
1550 pMac->lim.gLimDeferredMsgQ.read++;
1551
1552 /*
1553 ** if the read pointer hits the end of the queue, rewind it
1554 **/
1555 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1556 pMac->lim.gLimDeferredMsgQ.read = 0;
1557
1558 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001559 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1561 msg->type);)
1562
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001563 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 limIsSystemInScanState(pMac),
1565 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1566 pMac->lim.gLimAddtsSent);)
1567
1568 return(msg);
1569}
1570
1571tSirRetStatus
1572limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1573 tSirMsgQ *pMsg,
1574 tANI_U8 qType)
1575{
1576// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 SysProcessMmhMsg(pMac, pMsg);
1578 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001579}
1580
1581char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1582{
1583#ifdef FIXME_GEN6
1584
1585 if (type == SIR_MAC_MGMT_FRAME)
1586 {
1587 switch (subType)
1588 {
1589 case SIR_MAC_MGMT_ASSOC_REQ:
1590 return "MAC_MGMT_ASSOC_REQ";
1591 case SIR_MAC_MGMT_ASSOC_RSP:
1592 return "MAC_MGMT_ASSOC_RSP";
1593 case SIR_MAC_MGMT_REASSOC_REQ:
1594 return "MAC_MGMT_REASSOC_REQ";
1595 case SIR_MAC_MGMT_REASSOC_RSP:
1596 return "MAC_MGMT_REASSOC_RSP";
1597 case SIR_MAC_MGMT_PROBE_REQ:
1598 return "MAC_MGMT_PROBE_REQ";
1599 case SIR_MAC_MGMT_PROBE_RSP:
1600 return "MAC_MGMT_PROBE_RSP";
1601 case SIR_MAC_MGMT_BEACON:
1602 return "MAC_MGMT_BEACON";
1603 case SIR_MAC_MGMT_ATIM:
1604 return "MAC_MGMT_ATIM";
1605 case SIR_MAC_MGMT_DISASSOC:
1606 return "MAC_MGMT_DISASSOC";
1607 case SIR_MAC_MGMT_AUTH:
1608 return "MAC_MGMT_AUTH";
1609 case SIR_MAC_MGMT_DEAUTH:
1610 return "MAC_MGMT_DEAUTH";
1611 case SIR_MAC_MGMT_ACTION:
1612 return "MAC_MGMT_ACTION";
1613 case SIR_MAC_MGMT_RESERVED15:
1614 return "MAC_MGMT_RESERVED15";
1615 default:
1616 return "Unknown MGMT Frame";
1617 }
1618 }
1619
1620 else if (type == SIR_MAC_CTRL_FRAME)
1621 {
1622 switch (subType)
1623 {
1624 case SIR_MAC_CTRL_RR:
1625 return "MAC_CTRL_RR";
1626 case SIR_MAC_CTRL_BAR:
1627 return "MAC_CTRL_BAR";
1628 case SIR_MAC_CTRL_BA:
1629 return "MAC_CTRL_BA";
1630 case SIR_MAC_CTRL_PS_POLL:
1631 return "MAC_CTRL_PS_POLL";
1632 case SIR_MAC_CTRL_RTS:
1633 return "MAC_CTRL_RTS";
1634 case SIR_MAC_CTRL_CTS:
1635 return "MAC_CTRL_CTS";
1636 case SIR_MAC_CTRL_ACK:
1637 return "MAC_CTRL_ACK";
1638 case SIR_MAC_CTRL_CF_END:
1639 return "MAC_CTRL_CF_END";
1640 case SIR_MAC_CTRL_CF_END_ACK:
1641 return "MAC_CTRL_CF_END_ACK";
1642 default:
1643 return "Unknown CTRL Frame";
1644 }
1645 }
1646
1647 else if (type == SIR_MAC_DATA_FRAME)
1648 {
1649 switch (subType)
1650 {
1651 case SIR_MAC_DATA_DATA:
1652 return "MAC_DATA_DATA";
1653 case SIR_MAC_DATA_DATA_ACK:
1654 return "MAC_DATA_DATA_ACK";
1655 case SIR_MAC_DATA_DATA_POLL:
1656 return "MAC_DATA_DATA_POLL";
1657 case SIR_MAC_DATA_DATA_ACK_POLL:
1658 return "MAC_DATA_DATA_ACK_POLL";
1659 case SIR_MAC_DATA_NULL:
1660 return "MAC_DATA_NULL";
1661 case SIR_MAC_DATA_NULL_ACK:
1662 return "MAC_DATA_NULL_ACK";
1663 case SIR_MAC_DATA_NULL_POLL:
1664 return "MAC_DATA_NULL_POLL";
1665 case SIR_MAC_DATA_NULL_ACK_POLL:
1666 return "MAC_DATA_NULL_ACK_POLL";
1667 case SIR_MAC_DATA_QOS_DATA:
1668 return "MAC_DATA_QOS_DATA";
1669 case SIR_MAC_DATA_QOS_DATA_ACK:
1670 return "MAC_DATA_QOS_DATA_ACK";
1671 case SIR_MAC_DATA_QOS_DATA_POLL:
1672 return "MAC_DATA_QOS_DATA_POLL";
1673 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1674 return "MAC_DATA_QOS_DATA_ACK_POLL";
1675 case SIR_MAC_DATA_QOS_NULL:
1676 return "MAC_DATA_QOS_NULL";
1677 case SIR_MAC_DATA_QOS_NULL_ACK:
1678 return "MAC_DATA_QOS_NULL_ACK";
1679 case SIR_MAC_DATA_QOS_NULL_POLL:
1680 return "MAC_DATA_QOS_NULL_POLL";
1681 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1682 return "MAC_DATA_QOS_NULL_ACK_POLL";
1683 default:
1684 return "Unknown Data Frame";
1685 }
1686 }
1687 else
1688 return "Unknown";
1689#endif
1690return "";
1691}
1692
Jeff Johnson295189b2012-06-20 16:38:30 -07001693void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1694{
1695 int i;
1696 static int enable;
1697 tUpdateBeaconParams beaconParams;
1698
1699 tpPESession psessionEntry = limIsApSessionActive(pMac);
1700
1701 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001702 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001703 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001705 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301706
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301707 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001708 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001709
1710 beaconParams.paramChangeBitmap = 0;
1711 /*
1712 ** This is doing a 2 pass check. The first pass is to invalidate
1713 ** all the cache entries. The second pass is to decide whether to
1714 ** disable protection.
1715 **/
1716 if (!enable)
1717 {
1718
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001719 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001720 psessionEntry->gLimOlbcParams.numSta = 0;
1721 psessionEntry->gLimOverlap11gParams.numSta = 0;
1722 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1723 psessionEntry->gLimNonGfParams.numSta = 0;
1724 psessionEntry->gLimLsigTxopParams.numSta = 0;
1725
1726 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1727 pMac->lim.protStaOverlapCache[i].active = false;
1728
1729 enable = 1;
1730 }
1731 else
1732 {
1733
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001734 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 {
1736 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1737 {
1738 if (!psessionEntry->gLim11bParams.protectionEnabled)
1739 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001740 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1742 }
1743 }
1744 }
1745
1746 if (!psessionEntry->gLimOverlap11gParams.numSta)
1747 {
1748 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1749 {
1750 if (!psessionEntry->gLim11gParams.protectionEnabled)
1751 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001752 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1754 }
1755 }
1756 }
1757
1758 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1759 {
1760 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1761 {
1762 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1763 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001764 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1766 }
1767 }
1768 }
1769
1770 enable = 0;
1771 }
1772
1773 if(beaconParams.paramChangeBitmap)
1774 {
1775 schSetFixedBeaconFields(pMac,psessionEntry);
1776 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1777 }
1778
1779 // Start OLBC timer
1780 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1781 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001782 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 }
1784}
Jeff Johnson295189b2012-06-20 16:38:30 -07001785
1786/**
1787 * limIsNullSsid()
1788 *
1789 *FUNCTION:
1790 * This function checks if Ssid supplied is Null SSID
1791 *
1792 *
1793 *LOGIC:
1794 *
1795 *ASSUMPTIONS:
1796 * NA
1797 *
1798 *NOTE:
1799 * NA
1800 *
1801 * @param tSirMacSSid *
1802 *
1803 *
1804 * @return true if SSID is Null SSID else false
1805 */
1806
1807tANI_U8
1808limIsNullSsid( tSirMacSSid *pSsid )
1809{
1810 tANI_U8 fNullSsid = false;
1811 tANI_U32 SsidLength;
1812 tANI_U8 *pSsidStr;
1813
1814 do
1815 {
1816 if ( 0 == pSsid->length )
1817 {
1818 fNullSsid = true;
1819 break;
1820 }
1821
1822#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301823 /* If the first charactes is space and SSID length is 1
1824 * then consider it as NULL SSID*/
1825 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1826 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301828 fNullSsid = true;
1829 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 }
1831 else
1832 {
1833 /* check if all the charactes in SSID are NULL*/
1834 SsidLength = pSsid->length;
1835 pSsidStr = pSsid->ssId;
1836
1837 while ( SsidLength )
1838 {
1839 if( *pSsidStr )
1840 break;
1841
1842 pSsidStr++;
1843 SsidLength--;
1844 }
1845
1846 if( 0 == SsidLength )
1847 {
1848 fNullSsid = true;
1849 break;
1850 }
1851 }
1852 }
1853 while( 0 );
1854
1855 return fNullSsid;
1856} /****** end limIsNullSsid() ******/
1857
1858
1859
Jeff Johnson295189b2012-06-20 16:38:30 -07001860
1861/** -------------------------------------------------------------
1862\fn limUpdateProtStaParams
1863\brief updates protection related counters.
1864\param tpAniSirGlobal pMac
1865\param tSirMacAddr peerMacAddr
1866\param tLimProtStaCacheType protStaCacheType
1867\param tHalBitVal gfSupported
1868\param tHalBitVal lsigTxopSupported
1869\return None
1870 -------------------------------------------------------------*/
1871void
1872limUpdateProtStaParams(tpAniSirGlobal pMac,
1873tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1874tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1875tpPESession psessionEntry)
1876{
1877 tANI_U32 i;
1878
1879 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1880 limLog(pMac,LOG1, FL("Addr : "));
1881 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1882
1883 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1884 {
1885 if (psessionEntry->protStaCache[i].active)
1886 {
1887 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1888 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1889
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301890 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 psessionEntry->protStaCache[i].addr,
1892 peerMacAddr, sizeof(tSirMacAddr)))
1893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001894 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 return;
1896 }
1897 }
1898 }
1899
1900 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1901 {
1902 if (!psessionEntry->protStaCache[i].active)
1903 break;
1904 }
1905
1906 if (i >= LIM_PROT_STA_CACHE_SIZE)
1907 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001908 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 return;
1910 }
1911
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301912 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 peerMacAddr,
1914 sizeof(tSirMacAddr));
1915
1916 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1917 psessionEntry->protStaCache[i].active = true;
1918 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1919 {
1920 psessionEntry->gLim11bParams.numSta++;
1921 limLog(pMac,LOG1, FL("11B, "));
1922 }
1923 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1924 {
1925 psessionEntry->gLim11gParams.numSta++;
1926 limLog(pMac,LOG1, FL("11G, "));
1927 }
1928 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1929 {
1930 psessionEntry->gLimHt20Params.numSta++;
1931 limLog(pMac,LOG1, FL("HT20, "));
1932 }
1933
1934 if(!gfSupported)
1935 {
1936 psessionEntry->gLimNonGfParams.numSta++;
1937 limLog(pMac,LOG1, FL("NonGf, "));
1938 }
1939 if(!lsigTxopSupported)
1940 {
1941 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001942 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 }
1944}// ---------------------------------------------------------------------
1945
1946/** -------------------------------------------------------------
1947\fn limDecideApProtection
1948\brief Decides all the protection related staiton coexistence and also sets
1949\ short preamble and short slot appropriately. This function will be called
1950\ when AP is ready to send assocRsp tp the station joining right now.
1951\param tpAniSirGlobal pMac
1952\param tSirMacAddr peerMacAddr
1953\return None
1954 -------------------------------------------------------------*/
1955void
1956limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1957{
1958 tANI_U16 tmpAid;
1959 tpDphHashNode pStaDs;
1960 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1961 tANI_U32 phyMode;
1962 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1963 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1964
1965 pBeaconParams->paramChangeBitmap = 0;
1966 // check whether to enable protection or not
1967 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1968 if(NULL == pStaDs)
1969 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301970 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 return;
1972 }
1973 limGetRfBand(pMac, &rfBand, psessionEntry);
1974 //if we are in 5 GHZ band
1975 if(SIR_BAND_5_GHZ == rfBand)
1976 {
1977 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1978 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001979 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 {
1981 //we are 11N and 11A station is joining.
1982 //protection from 11A required.
1983 if(false == pStaDs->mlmStaContext.htCapability)
1984 {
1985 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1986 return;
1987 }
1988 }
1989 }
1990 else if(SIR_BAND_2_4_GHZ== rfBand)
1991 {
1992 limGetPhyMode(pMac, &phyMode, psessionEntry);
1993
1994 //We are 11G. Check if we need protection from 11b Stations.
1995 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001996 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 {
1998
1999 if (pStaDs->erpEnabled== eHAL_CLEAR)
2000 {
2001 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
2002 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002003 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
2005 }
2006 }
2007
2008 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002009 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 {
2011 //check if we need protection from 11b station
2012 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
2013 (!pStaDs->mlmStaContext.htCapability))
2014 {
2015 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
2016 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002017 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2019 }
2020 //station being joined is non-11b and non-ht ==> 11g device
2021 else if(!pStaDs->mlmStaContext.htCapability)
2022 {
2023 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
2024 //enable protection
2025 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
2026 }
2027 //ERP mode is enabled for the latest station joined
2028 //latest station joined is HT capable
2029 //This case is being handled in common code (commn between both the bands) below.
2030 }
2031 }
2032
2033 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002034 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 (true == pStaDs->mlmStaContext.htCapability))
2036 {
2037 if(!pStaDs->htGreenfield)
2038 {
2039 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2040 gfSupported = eHAL_CLEAR;
2041 }
2042 //Station joining is HT 20Mhz
2043 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2044 {
2045 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2046 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2047 }
2048 //Station joining does not support LSIG TXOP Protection
2049 if(!pStaDs->htLsigTXOPProtection)
2050 {
2051 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2052 lsigTxopSupported = eHAL_CLEAR;
2053 }
2054 }
2055
2056 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2057 gfSupported, lsigTxopSupported, psessionEntry);
2058
2059 return;
2060}
Jeff Johnson295189b2012-06-20 16:38:30 -07002061
2062
2063/** -------------------------------------------------------------
2064\fn limEnableOverlap11gProtection
2065\brief wrapper function for setting overlap 11g protection.
2066\param tpAniSirGlobal pMac
2067\param tpUpdateBeaconParams pBeaconParams
2068\param tpSirMacMgmtHdr pMh
2069\return None
2070 -------------------------------------------------------------*/
2071void
2072limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2073tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2074{
2075 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2076
2077 if (psessionEntry->gLimOlbcParams.numSta &&
2078 !psessionEntry->gLimOlbcParams.protectionEnabled)
2079 {
2080 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002081 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2083 }
2084}
2085
2086
2087/** -------------------------------------------------------------
2088\fn limUpdateShortPreamble
2089\brief Updates short preamble if needed when a new station joins.
2090\param tpAniSirGlobal pMac
2091\param tSirMacAddr peerMacAddr
2092\param tpUpdateBeaconParams pBeaconParams
2093\return None
2094 -------------------------------------------------------------*/
2095void
2096limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2097 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2098{
2099 tANI_U16 tmpAid;
2100 tpDphHashNode pStaDs;
2101 tANI_U32 phyMode;
2102 tANI_U16 i;
2103
2104 // check whether to enable protection or not
2105 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2106
2107 limGetPhyMode(pMac, &phyMode, psessionEntry);
2108
2109 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2110
2111 {
2112 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2113 {
2114 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2115 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2116
2117 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2118 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2120 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2121 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302122 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2124 peerMacAddr, sizeof(tSirMacAddr)))
2125 return;
2126 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 {
2128 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2129 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302130 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2132 peerMacAddr, sizeof(tSirMacAddr)))
2133 return;
2134 }
2135 }
2136 }
2137
2138
2139 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2140 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2142 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2143 break;
2144 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 {
2146 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2147 break;
2148 }
2149 }
2150
2151 if (i >= LIM_PROT_STA_CACHE_SIZE)
2152 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2154 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2155 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2156 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2157 return;
2158 }
2159 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 {
2161 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2162 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2163 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2164 return;
2165 }
2166
2167 }
2168
2169
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302170 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2171 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 peerMacAddr, sizeof(tSirMacAddr));
2173 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2174 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2175 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302177 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 peerMacAddr, sizeof(tSirMacAddr));
2179 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2180 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2181 }
2182
2183
2184 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002185 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002186
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002188 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 }
2190 }
2191}
2192
2193/** -------------------------------------------------------------
2194\fn limUpdateShortSlotTime
2195\brief Updates short slot time if needed when a new station joins.
2196\param tpAniSirGlobal pMac
2197\param tSirMacAddr peerMacAddr
2198\param tpUpdateBeaconParams pBeaconParams
2199\return None
2200 -------------------------------------------------------------*/
2201
2202void
2203limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2204 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2205{
2206 tANI_U16 tmpAid;
2207 tpDphHashNode pStaDs;
2208 tANI_U32 phyMode;
2209 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 tANI_U16 i;
2211
2212 // check whether to enable protection or not
2213 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2214 limGetPhyMode(pMac, &phyMode, psessionEntry);
2215
Jeff Johnsone7245742012-09-05 17:12:55 -07002216 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2217 * be always 1 and in 11b case, it should be always 0
2218 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2220 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002221 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2222 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2223 * it in limDecideShortSlot
2224 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2226 {
2227 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2228 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2229 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2230 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2232 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2233 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302234 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2236 peerMacAddr, sizeof(tSirMacAddr)))
2237 return;
2238 }
2239 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 {
2241 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2242 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302243 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2245 peerMacAddr, sizeof(tSirMacAddr)))
2246 return;
2247 }
2248 }
2249 }
2250
2251 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2252 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2254 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2255 break;
2256 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 {
2258 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2259 break;
2260 }
2261 }
2262
2263 if (i >= LIM_PROT_STA_CACHE_SIZE)
2264 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2266 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2267 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2268 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2269 return;
2270 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2273 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2274 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2275 return;
2276 }
2277 }
2278
2279
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302281 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 peerMacAddr, sizeof(tSirMacAddr));
2283 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2284 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2285 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302287 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 peerMacAddr, sizeof(tSirMacAddr));
2289 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2290 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2291 }
2292 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2293
Jeff Johnsone7245742012-09-05 17:12:55 -07002294 /* 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
2295 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2296 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002298 (val && psessionEntry->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 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002308 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 {
2310 // enable long slot time
2311 pBeaconParams->fShortSlotTime = false;
2312 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002313 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002314 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 }
2316 }
2317 }
2318 }
2319}
2320
Jeff Johnson295189b2012-06-20 16:38:30 -07002321
2322/** -------------------------------------------------------------
2323\fn limDecideStaProtectionOnAssoc
2324\brief Decide protection related settings on Sta while association.
2325\param tpAniSirGlobal pMac
2326\param tpSchBeaconStruct pBeaconStruct
2327\return None
2328 -------------------------------------------------------------*/
2329void
2330limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2331 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2332{
2333 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2334 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2335
2336 limGetRfBand(pMac, &rfBand, psessionEntry);
2337 limGetPhyMode(pMac, &phyMode, psessionEntry);
2338
2339 if(SIR_BAND_5_GHZ == rfBand)
2340 {
2341 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2342 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2343 {
2344 if(pMac->lim.cfgProtection.fromlla)
2345 psessionEntry->beaconParams.llaCoexist = true;
2346 }
2347 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2348 {
2349 if(pMac->lim.cfgProtection.ht20)
2350 psessionEntry->beaconParams.ht20Coexist = true;
2351 }
2352
2353 }
2354 else if(SIR_BAND_2_4_GHZ == rfBand)
2355 {
2356 //spec 7.3.2.13
2357 //UseProtection will be set when nonERP STA is associated.
2358 //NonERPPresent bit will be set when:
2359 //--nonERP Sta is associated OR
2360 //--nonERP Sta exists in overlapping BSS
2361 //when useProtection is not set then protection from nonERP stations is optional.
2362
2363 //CFG protection from 11b is enabled and
2364 //11B device in the BSS
2365 /* TODO, This is not sessionized */
2366 if (phyMode != WNI_CFG_PHY_MODE_11B)
2367 {
2368 if (pMac->lim.cfgProtection.fromllb &&
2369 pBeaconStruct->erpPresent &&
2370 (pBeaconStruct->erpIEInfo.useProtection ||
2371 pBeaconStruct->erpIEInfo.nonErpPresent))
2372 {
2373 psessionEntry->beaconParams.llbCoexist = true;
2374 }
2375 //AP has no 11b station associated.
2376 else
2377 {
2378 psessionEntry->beaconParams.llbCoexist = false;
2379 }
2380 }
2381 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002382 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 (pBeaconStruct->HTInfo.present))
2384 {
2385 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2386
2387 //Obss Non HT STA present mode
2388 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2389
2390
2391 //CFG protection from 11G is enabled and
2392 //our AP has at least one 11G station associated.
2393 if(pMac->lim.cfgProtection.fromllg &&
2394 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2395 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2396 (!psessionEntry->beaconParams.llbCoexist))
2397 {
2398 if(pMac->lim.cfgProtection.fromllg)
2399 psessionEntry->beaconParams.llgCoexist = true;
2400 }
2401
2402 //AP has only HT stations associated and at least one station is HT 20
2403 //disable protection from any non-HT devices.
2404 //decision for disabling protection from 11b has already been taken above.
2405 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2406 {
2407 //Disable protection from 11G station.
2408 psessionEntry->beaconParams.llgCoexist = false;
2409 //CFG protection from HT 20 is enabled.
2410 if(pMac->lim.cfgProtection.ht20)
2411 psessionEntry->beaconParams.ht20Coexist = true;
2412 }
2413 //Disable protection from non-HT and HT20 devices.
2414 //decision for disabling protection from 11b has already been taken above.
2415 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2416 {
2417 psessionEntry->beaconParams.llgCoexist = false;
2418 psessionEntry->beaconParams.ht20Coexist = false;
2419 }
2420
2421 }
2422 }
2423
2424 //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 -07002425 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 (pBeaconStruct->HTInfo.present))
2427 {
2428 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2429 psessionEntry->beaconParams.fRIFSMode =
2430 ( tANI_U8 ) htInfo.rifsMode;
2431 psessionEntry->beaconParams.llnNonGFCoexist =
2432 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2433 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2434 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2435 }
2436}
2437
2438
2439/** -------------------------------------------------------------
2440\fn limDecideStaProtection
2441\brief Decides protection related settings on Sta while processing beacon.
2442\param tpAniSirGlobal pMac
2443\param tpUpdateBeaconParams pBeaconParams
2444\return None
2445 -------------------------------------------------------------*/
2446void
2447limDecideStaProtection(tpAniSirGlobal pMac,
2448 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2449{
2450
2451 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2452 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2453
2454 limGetRfBand(pMac, &rfBand, psessionEntry);
2455 limGetPhyMode(pMac, &phyMode, psessionEntry);
2456
2457 if(SIR_BAND_5_GHZ == rfBand)
2458 {
2459 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002460 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 (pBeaconStruct->HTInfo.present))
2462 {
2463 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2464 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2465 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2466 {
2467 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2468 }
2469 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2470 //protection from HT20 if needed.
2471 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2472 {
2473 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2474 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2475 }
2476 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2477 {
2478 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2479 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2480 }
2481 }
2482 }
2483 else if(SIR_BAND_2_4_GHZ == rfBand)
2484 {
2485 /* spec 7.3.2.13
2486 * UseProtection will be set when nonERP STA is associated.
2487 * NonERPPresent bit will be set when:
2488 * --nonERP Sta is associated OR
2489 * --nonERP Sta exists in overlapping BSS
2490 * when useProtection is not set then protection from nonERP stations is optional.
2491 */
2492
2493 if (phyMode != WNI_CFG_PHY_MODE_11B)
2494 {
2495 if (pBeaconStruct->erpPresent &&
2496 (pBeaconStruct->erpIEInfo.useProtection ||
2497 pBeaconStruct->erpIEInfo.nonErpPresent))
2498 {
2499 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2500 }
2501 //AP has no 11b station associated.
2502 else
2503 {
2504 //disable protection from 11b station
2505 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2506 }
2507 }
2508
2509 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002510 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 (pBeaconStruct->HTInfo.present))
2512 {
2513
2514 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2515 //AP has at least one 11G station associated.
2516 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2517 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2518 (!psessionEntry->beaconParams.llbCoexist))
2519 {
2520 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2521
2522 }
2523
2524 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2525 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2526 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2527 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2528 {
2529 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2530
2531 //AP has only HT stations associated and at least one station is HT 20
2532 //disable protection from any non-HT devices.
2533 //decision for disabling protection from 11b has already been taken above.
2534 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2535 {
2536 //Disable protection from 11G station.
2537 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2538
2539 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2540 }
2541 //Disable protection from non-HT and HT20 devices.
2542 //decision for disabling protection from 11b has already been taken above.
2543 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2544 {
2545 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2546 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2547
2548 }
2549 }
2550 }
2551 }
2552
2553 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002554 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 (pBeaconStruct->HTInfo.present))
2556 {
2557 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2558 //Check for changes in protection related factors other than HT operating mode.
2559 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2560 if ( psessionEntry->beaconParams.fRIFSMode !=
2561 ( tANI_U8 ) htInfo.rifsMode )
2562 {
2563 pBeaconParams->fRIFSMode =
2564 psessionEntry->beaconParams.fRIFSMode =
2565 ( tANI_U8 ) htInfo.rifsMode;
2566 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2567 }
2568
2569 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2570 htInfo.nonGFDevicesPresent )
2571 {
2572 pBeaconParams->llnNonGFCoexist =
2573 psessionEntry->beaconParams.llnNonGFCoexist =
2574 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2575 pBeaconParams->paramChangeBitmap |=
2576 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2577 }
2578
2579 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2580 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2581 {
2582 pBeaconParams->fLsigTXOPProtectionFullSupport =
2583 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2584 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2585 pBeaconParams->paramChangeBitmap |=
2586 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2587 }
2588
2589 // For Station just update the global lim variable, no need to send message to HAL
2590 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2591 //stations in overlapping BSS.
2592 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2593 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2594
2595 }
2596}
2597
2598
2599/**
2600 * limProcessChannelSwitchTimeout()
2601 *
2602 *FUNCTION:
2603 * This function is invoked when Channel Switch Timer expires at
2604 * the STA. Now, STA must stop traffic, and then change/disable
2605 * primary or secondary channel.
2606 *
2607 *
2608 *NOTE:
2609 * @param pMac - Pointer to Global MAC structure
2610 * @return None
2611 */
2612void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2613{
2614 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002616
Abhishek Singh800d17a2016-08-26 17:00:49 +05302617 if ((psessionEntry = peFindSessionBySessionId(pMac,
2618 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) {
2619 limLog(pMac, LOGW,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 return;
2621 }
2622
2623 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2624 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002625 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 -07002626 return;
2627 }
Abhishek Singh800d17a2016-08-26 17:00:49 +05302628 if (psessionEntry->gLimSpecMgmt.dot11hChanSwState !=
2629 eLIM_11H_CHANSW_RUNNING) {
2630 limLog(pMac, LOGW,
2631 FL("Channel switch timer should not have been running in state %d"),
2632 psessionEntry->gLimSpecMgmt.dot11hChanSwState);
2633 return;
2634 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002635 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302636
2637 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 * This potentially can create issues if the function tries to set
2639 * channel while device is in power-save, hence putting an extra check
2640 * to verify if the device is in power-save or not
2641 */
2642 if(!limIsSystemInActiveState(pMac))
2643 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002644 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 return;
2646 }
2647
2648 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002649 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002650
2651 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002652 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Abhishek Singhcb255b82015-10-01 12:37:57 +05302653
2654 /*
2655 * If Lim allows Switch channel on same channel on which preauth
2656 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2657 * during preauth rsp handling hence firmware may crash on ENTER/
2658 * EXIT BMPS request.
2659 */
2660 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2661 {
2662 limLog(pMac, LOGE,
2663 FL("Avoid Switch Channel req during pre auth"));
2664 return;
2665 }
2666 /* If link is already suspended mean some off
2667 * channel operation or scan is in progress, Allowing
2668 * Change channel here will lead to either Init Scan
2669 * sent twice or missing Finish scan when change
2670 * channel is completed, this may lead
2671 * to driver in invalid state and crash.
2672 */
2673 if (limIsLinkSuspended(pMac))
2674 {
2675 limLog(pMac, LOGE, FL("Link is already suspended for "
2676 "some other reason. Return here for sessionId:%d"),
2677 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2678 return;
2679 }
2680
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 /* Check if the AP is switching to a channel that we support.
2682 * Else, just don't bother to switch. Indicate HDD to look for a
2683 * better AP to associate
2684 */
2685 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2686 {
2687 /* We need to restore pre-channelSwitch state on the STA */
2688 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002690 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 return;
2692 }
2693
Aravind Kishore Suklacec17852023-02-10 14:31:02 +05302694 /* The channel switch request received from AP is carrying
2695 * invalid channel. It's ok to ignore this channel switch
2696 * request as it might be from spoof AP. If it's from genuine
2697 * AP, it may lead to heart beat failure and result in
2698 * disconnection. DUT can go ahead and reconnect to it/any
2699 * other AP once it disconnects.
2700 */
2701 limLog(pMac, LOGE, FL("Invalid channel %u Ignore CSA request"),
2702 channel);
2703 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002705 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2706 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002707 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 {
2709 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002710 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2711 if ( isLimSessionOffChannel(pMac,
2712 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2713 {
2714 limSuspendLink(pMac,
2715 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2716 limProcessChannelSwitchSuspendLink,
2717 (tANI_U32*)psessionEntry );
2718 }
2719 else
2720 {
2721 limProcessChannelSwitchSuspendLink(pMac,
2722 eHAL_STATUS_SUCCESS,
2723 (tANI_U32*)psessionEntry);
2724 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 break;
2726
2727 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002728 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002729 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002731 psessionEntry->gLimChannelSwitch.secondarySubBand);
2732 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 case eLIM_CHANNEL_SWITCH_IDLE:
2735 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002736 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2738 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002739 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 }
2741 return; /* Please note, this is 'return' and not 'break' */
2742 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002743}
Jeff Johnson295189b2012-06-20 16:38:30 -07002744
2745/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302746 * lim_process_ecsa_ie()- Process ECSA IE in beacon/ probe resp
2747 * @mac_ctx: pointer to global mac structure
2748 * @ecsa_ie: ecsa ie
2749 * @session: Session entry.
2750 *
2751 * This function is called when ECSA IE is received on STA interface.
2752 *
2753 * Return: void
2754 */
2755static void
2756lim_process_ecsa_ie(tpAniSirGlobal mac_ctx,
2757 tDot11fIEext_chan_switch_ann *ecsa_ie, tpPESession session)
2758{
2759 struct ecsa_frame_params ecsa_req;
2760
2761 limLog(mac_ctx, LOG1, FL("Received ECSA IE in beacon/probe resp"));
2762
2763 if (session->currentOperChannel == ecsa_ie->new_channel) {
2764 limLog(mac_ctx, LOGE, FL("New channel %d is same as old channel ignore req"),
2765 ecsa_ie->new_channel);
2766 return;
2767 }
2768
2769 ecsa_req.new_channel = ecsa_ie->new_channel;
2770 ecsa_req.op_class = ecsa_ie->new_reg_class;
2771 ecsa_req.switch_mode = ecsa_ie->switch_mode;
2772 ecsa_req.switch_count = ecsa_ie->switch_count;
2773 limLog(mac_ctx, LOG1, FL("New channel %d op class %d switch mode %d switch count %d"),
2774 ecsa_req.new_channel, ecsa_req.op_class,
2775 ecsa_req.switch_mode, ecsa_req.switch_count);
2776
2777 lim_handle_ecsa_req(mac_ctx, &ecsa_req, session);
2778}
2779
2780
2781/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 * limUpdateChannelSwitch()
2783 *
2784 *FUNCTION:
2785 * This function is invoked whenever Station receives
2786 * either 802.11h channel switch IE or airgo proprietary
2787 * channel switch IE.
2788 *
2789 *NOTE:
2790 * @param pMac - Pointer to Global MAC structure
2791 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2792 * @param psessionentry
2793 */
2794void
2795limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2796{
2797
2798 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002799 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2800 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002801#ifdef WLAN_FEATURE_11AC
2802 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2803#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302804 if (pBeacon->ecsa_present)
2805 return lim_process_ecsa_ie(pMac,
2806 &pBeacon->ext_chan_switch_ann, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002807
Jeff Johnsone7245742012-09-05 17:12:55 -07002808 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002809
2810 /* STA either received proprietary channel switch IE or 802.11h
2811 * standard channel switch IE.
2812 */
2813 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2814 {
2815 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2816
2817 /* Add logic to determine which change this is: */
2818 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002819 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2820 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2821 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2822 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2823 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002825 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 }
2827 else
2828 {
2829 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002830 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2831 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2832 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002834 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002835#ifdef WLAN_FEATURE_11AC
2836 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2837 if(pBeacon->WiderBWChanSwitchAnnPresent)
2838 {
2839 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2840 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2841 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2842 }
2843#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002844
2845 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002846 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2847 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002848
2849 /* Do not bother to look and operate on extended channel switch element
2850 * if our own channel-bonding state is not enabled
2851 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002852 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302854 if (pBeacon->sec_chan_offset_present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302856 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2857 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002859 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +05302860 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002862#ifdef WLAN_FEATURE_11AC
2863 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2864 {
2865 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2866 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302867 if(pBeacon->sec_chan_offset_present)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002868 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302869 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2870 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002871 {
2872 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2873 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2874 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +05302875 pBeacon->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002876 pWiderChnlSwitch->newCenterChanFreq0,
2877 psessionEntry);
2878 }
2879 }
2880 }
2881 }
2882#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002883 }
2884 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002885 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002886
2887
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2889 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002890 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 }
2892
2893 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002894 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002895 psessionEntry->peSessionId,
2896 psessionEntry->gLimChannelSwitch.primaryChannel,
2897 psessionEntry->gLimChannelSwitch.secondarySubBand,
2898 psessionEntry->gLimChannelSwitch.switchCount,
2899 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 return;
2901}
2902
2903/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302904 * lim_select_cbmode()- select cb mode for the channel and BW
2905 * @sta_ds: peer sta
2906 * @channel: channel
2907 * @chan_bw: BW
2908 *
2909 * Return: cb mode for a channel and BW
2910 */
2911static inline int lim_select_cbmode(tDphHashNode *sta_ds, uint8_t channel,
2912 uint8_t chan_bw)
2913{
2914 if (sta_ds->mlmStaContext.vhtCapability && chan_bw) {
2915 if (channel== 36 || channel == 52 || channel == 100 ||
2916 channel == 116 || channel == 149)
2917 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
2918 else if (channel == 40 || channel == 56 || channel == 104 ||
2919 channel == 120 || channel == 153)
2920 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
2921 else if (channel == 44 || channel == 60 || channel == 108 ||
2922 channel == 124 || channel == 157)
2923 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
2924 else if (channel == 48 || channel == 64 || channel == 112 ||
2925 channel == 128 || channel == 161)
2926 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
2927 else if (channel == 165)
2928 return PHY_SINGLE_CHANNEL_CENTERED;
2929 } else if (sta_ds->mlmStaContext.htCapability) {
2930 if (channel== 40 || channel == 48 || channel == 56 ||
2931 channel == 64 || channel == 104 || channel == 112 ||
2932 channel == 120 || channel == 128 || channel == 136 ||
2933 channel == 144 || channel == 153 || channel == 161)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302934 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302935 else if (channel== 36 || channel == 44 || channel == 52 ||
2936 channel == 60 || channel == 100 || channel == 108 ||
2937 channel == 116 || channel == 124 || channel == 132 ||
2938 channel == 140 || channel == 149 || channel == 157)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302939 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302940 else if (channel == 165)
2941 return PHY_SINGLE_CHANNEL_CENTERED;
2942 }
2943 return PHY_SINGLE_CHANNEL_CENTERED;
2944}
2945
2946void lim_handle_ecsa_req(tpAniSirGlobal mac_ctx, struct ecsa_frame_params *ecsa_req,
2947 tpPESession session)
2948{
2949 offset_t ch_offset;
2950 tpDphHashNode sta_ds = NULL ;
2951 uint16_t aid = 0;
2952
2953 if (!LIM_IS_STA_ROLE(session)) {
2954 limLog(mac_ctx, LOGE, FL("Session not in sta role"));
2955 return;
2956 }
2957
2958 sta_ds = dphLookupHashEntry(mac_ctx, session->bssId, &aid,
2959 &session->dph.dphHashTable);
2960 if (!sta_ds) {
2961 limLog(mac_ctx, LOGE, FL("pStaDs does not exist for given sessionID"));
2962 return;
2963 }
2964
2965 session->gLimChannelSwitch.primaryChannel = ecsa_req->new_channel;
2966 session->gLimChannelSwitch.switchCount = ecsa_req->switch_count;
2967 session->gLimChannelSwitch.switchTimeoutValue =
2968 SYS_MS_TO_TICKS(session->beaconParams.beaconInterval) *
2969 ecsa_req->switch_count;
2970 session->gLimChannelSwitch.switchMode = ecsa_req->switch_mode;
2971
2972 /* Only primary channel switch element is present */
2973 session->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2974 session->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
2975 session->gLimWiderBWChannelSwitch.newChanWidth = 0;
2976
Abhishek Singh0f09f382018-12-04 14:06:07 +05302977 ch_offset =
2978 lim_get_channel_width_from_opclass(mac_ctx->scan.countryCodeCurrent,
2979 ecsa_req->new_channel,
2980 sta_ds->mlmStaContext.vhtCapability,
2981 ecsa_req->op_class);
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302982 if (ch_offset == BW80) {
2983 session->gLimWiderBWChannelSwitch.newChanWidth =
2984 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
2985 } else {
2986 session->gLimWiderBWChannelSwitch.newChanWidth =
2987 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
2988 }
2989
2990 /*
2991 * Do not bother to look and operate on extended channel switch element
2992 * if our own channel-bonding state is not enabled
2993 */
2994 if (session->htSupportedChannelWidthSet) {
2995 session->gLimChannelSwitch.secondarySubBand = lim_select_cbmode(sta_ds,
2996 ecsa_req->new_channel,
2997 session->gLimWiderBWChannelSwitch.newChanWidth);
2998 if (session->gLimChannelSwitch.secondarySubBand > 0)
2999 session->gLimChannelSwitch.state =
3000 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
3001 }
3002
3003 if (eSIR_SUCCESS != limStartChannelSwitch(mac_ctx, session)) {
3004 limLog(mac_ctx, LOGW, FL("Could not start Channel Switch"));
3005 }
3006
3007 limLog(mac_ctx, LOG1,
3008 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
3009 session->peSessionId,
3010 session->gLimChannelSwitch.primaryChannel,
3011 session->gLimChannelSwitch.secondarySubBand,
3012 session->gLimChannelSwitch.switchCount,
3013 session->gLimChannelSwitch.switchTimeoutValue);
3014}
3015
3016/**
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 * limCancelDot11hChannelSwitch
3018 *
3019 *FUNCTION:
3020 * This function is called when STA does not send updated channel-swith IE
3021 * after indicating channel-switch start. This will cancel the channel-swith
3022 * timer which is already running.
3023 *
3024 *LOGIC:
3025 *
3026 *ASSUMPTIONS:
3027 *
3028 *NOTE:
3029 *
3030 * @param pMac - Pointer to Global MAC structure
3031 *
3032 * @return None
3033 */
3034void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
3035{
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3037 return;
3038
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003039 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003040 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003041
3042 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
3043 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003044 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 }
3046
3047 /* We need to restore pre-channelSwitch state on the STA */
3048 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3049 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003050 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003051
3052 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003053}
3054
3055/**----------------------------------------------
3056\fn limCancelDot11hQuiet
3057\brief Cancel the quieting on Station if latest
3058 beacon doesn't contain quiet IE in it.
3059
3060\param pMac
3061\return NONE
3062-----------------------------------------------*/
3063void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
3064{
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3066 return;
3067
Jeff Johnsone7245742012-09-05 17:12:55 -07003068 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
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_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != 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 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003076 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07003077 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003078 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003079 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
3080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003081 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 }
3083 /**
3084 * If the channel switch is already running in silent mode, dont resume the
3085 * transmission. Channel switch timer when timeout, transmission will be resumed.
3086 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003087 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3088 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 {
3090 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003091 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 }
3093 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003094 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003095}
3096
3097/**
3098 * limProcessQuietTimeout
3099 *
3100 * FUNCTION:
3101 * This function is active only on the STA.
3102 * Handles SIR_LIM_QUIET_TIMEOUT
3103 *
3104 * LOGIC:
3105 * This timeout can occur under only one circumstance:
3106 *
3107 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
3108 * This indicates that the timeout "interval" has
3109 * expired. This is a trigger for the STA to now
3110 * shut-off Tx/Rx for the specified gLimQuietDuration
3111 * -> The TIMER object gLimQuietBssTimer is
3112 * activated
3113 * -> With timeout = gLimQuietDuration
3114 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
3115 *
3116 * ASSUMPTIONS:
3117 * Using two TIMER objects -
3118 * gLimQuietTimer & gLimQuietBssTimer
3119 *
3120 * NOTE:
3121 *
3122 * @param pMac - Pointer to Global MAC structure
3123 *
3124 * @return None
3125 */
3126void limProcessQuietTimeout(tpAniSirGlobal pMac)
3127{
Jeff Johnson295189b2012-06-20 16:38:30 -07003128 //fetch the sessionEntry based on the sessionId
3129 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07003130 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003131
Jeff Johnsone7245742012-09-05 17:12:55 -07003132 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003134 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003135 return;
3136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003137
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303138 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003139 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 {
3141 case eLIM_QUIET_BEGIN:
3142 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07003143 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
3144 if (TX_SUCCESS !=
3145 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
3146 {
3147 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003148 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003149 }
3150
3151 // gLimQuietDuration appears to be in units of ticks
3152 // Use it as is
3153 if (TX_SUCCESS !=
3154 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
3155 psessionEntry->gLimSpecMgmt.quietDuration,
3156 0))
3157 {
3158 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003159 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003160 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003161 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003162#ifdef GEN6_TODO
3163 /* revisit this piece of code to assign the appropriate sessionId below
3164 * priority - HIGH
3165 */
3166 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3167#endif
3168 if( TX_SUCCESS !=
3169 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3170 {
3171 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003172 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 }
3174 else
3175 {
3176 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003177 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003178
3179 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3180 /* print message, otherwise, stop data traffic and stay quiet */
3181 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3182 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3183 {
3184 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003185 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003186 }
3187 else
3188 {
3189 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3190 /* freeze the transmission */
3191 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3192
3193 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003194 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003195 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 }
3197 }
3198 break;
3199
3200 case eLIM_QUIET_RUNNING:
3201 case eLIM_QUIET_INIT:
3202 case eLIM_QUIET_END:
3203 default:
3204 //
3205 // As of now, nothing to be done
3206 //
3207 break;
3208 }
3209}
3210
3211/**
3212 * limProcessQuietBssTimeout
3213 *
3214 * FUNCTION:
3215 * This function is active on the AP and STA.
3216 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3217 *
3218 * LOGIC:
3219 * On the AP -
3220 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3221 * an indication for the AP to START sending out the
3222 * Quiet BSS IE.
3223 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3224 * the 11H spec
3225 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3226 * a Proprietary IE. This will be understood by all the
3227 * TITAN STA's
3228 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3229 * initiate the SCH to include the Quiet BSS IE in all
3230 * its subsequent Beacons/PR's.
3231 * The Quiet BSS IE will be included in all the Beacons
3232 * & PR's until the next DTIM period
3233 *
3234 * On the STA -
3235 * When gLimQuietState = eLIM_QUIET_RUNNING
3236 * This indicates that the STA was successfully shut-off
3237 * for the specified gLimQuietDuration. This is a trigger
3238 * for the STA to now resume data traffic.
3239 * -> gLimQuietState is set to eLIM_QUIET_INIT
3240 *
3241 * ASSUMPTIONS:
3242 *
3243 * NOTE:
3244 *
3245 * @param pMac - Pointer to Global MAC structure
3246 *
3247 * @return None
3248 */
3249void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3250{
Jeff Johnsone7245742012-09-05 17:12:55 -07003251 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003252
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003255 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 return;
3257 }
3258
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303259 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003260 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 }
3263 else
3264 {
3265 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003266 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 {
3268 case eLIM_QUIET_RUNNING:
3269 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003270 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003271
3272 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3273 {
3274 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003275 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3276 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003277 {
3278 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003279 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 }
3281
3282 /* Reset status flag */
3283 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3284 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3285
3286 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003287 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 }
3289 else
3290 {
3291 //
3292 // Nothing specific to be done in this case
3293 // A background scan that was triggered during
3294 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3295 //
3296 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003297 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 }
3299 break;
3300
3301 case eLIM_QUIET_INIT:
3302 case eLIM_QUIET_BEGIN:
3303 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003304 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 /* If the quiet period has ended, then resume the frame transmission */
3306 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003307 limRestorePreQuietState(pMac, psessionEntry);
3308 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 break;
3310
3311 default:
3312 //
3313 // As of now, nothing to be done
3314 //
3315 break;
3316 }
3317 }
3318}
Jeff Johnson295189b2012-06-20 16:38:30 -07003319/**
3320 * limProcessWPSOverlapTimeout
3321 *
3322 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3323 *
3324 * LOGIC:
3325 *
3326 * ASSUMPTIONS:
3327 *
3328 * NOTE:
3329 *
3330 * @param pMac - Pointer to Global MAC structure
3331 *
3332 * @return None
3333 */
3334#if 0
3335void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3336{
3337
3338 tpPESession psessionEntry;
3339 tANI_U32 sessionId;
3340
3341 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3342 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003343 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 }
3345
3346 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3347
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003348 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003349
3350 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3351 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003352 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003353 return;
3354 }
3355
3356 limWPSPBCTimeout(pMac, psessionEntry);
3357}
3358#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003359
Jeff Johnson295189b2012-06-20 16:38:30 -07003360/**----------------------------------------------
3361\fn limStartQuietTimer
3362\brief Starts the quiet timer.
3363
3364\param pMac
3365\return NONE
3366-----------------------------------------------*/
3367void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3368{
3369 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303370 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003371
3372 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003373 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 return;
3375 }
3376
Jeff Johnson295189b2012-06-20 16:38:30 -07003377
3378 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3379 return;
3380 // First, de-activate Timer, if its already active
3381 limCancelDot11hQuiet(pMac, psessionEntry);
3382
Jeff Johnsone7245742012-09-05 17:12:55 -07003383 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3384 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3385 {
3386 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003387 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003388 }
3389
3390 // Set the NEW timeout value, in ticks
3391 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3392 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3393 {
3394 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003395 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003396 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003397
3398 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3399 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3400 {
3401 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003402 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003403 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003404
Jeff Johnsone7245742012-09-05 17:12:55 -07003405 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 return;
3407 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003408}
3409
Jeff Johnson295189b2012-06-20 16:38:30 -07003410
3411/** ------------------------------------------------------------------------ **/
3412/**
3413 * keep track of the number of ANI peers associated in the BSS
3414 * For the first and last ANI peer, we have to update EDCA params as needed
3415 *
3416 * When the first ANI peer joins the BSS, we notify SCH
3417 * When the last ANI peer leaves the BSS, we notfiy SCH
3418 */
3419void
3420limUtilCountStaAdd(
3421 tpAniSirGlobal pMac,
3422 tpDphHashNode pSta,
3423 tpPESession psessionEntry)
3424{
3425
3426 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3427 return;
3428
3429 pSta->fAniCount = 1;
3430
3431 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3432 return;
3433
3434 // get here only if this is the first ANI peer in the BSS
3435 schEdcaProfileUpdate(pMac, psessionEntry);
3436}
3437
3438void
3439limUtilCountStaDel(
3440 tpAniSirGlobal pMac,
3441 tpDphHashNode pSta,
3442 tpPESession psessionEntry)
3443{
3444
3445 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3446 return;
3447
3448 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3449 * then go ahead and update the count and profiles. This ensures
3450 * that the "number of ani station" count is properly incremented/decremented.
3451 */
3452 if (pSta->valid == 1)
3453 return;
3454
3455 pSta->fAniCount = 0;
3456
3457 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3458 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003459 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 pMac->lim.gLimNumOfAniSTAs);
3461 return;
3462 }
3463
3464 pMac->lim.gLimNumOfAniSTAs--;
3465
3466 if (pMac->lim.gLimNumOfAniSTAs != 0)
3467 return;
3468
3469 // get here only if this is the last ANI peer in the BSS
3470 schEdcaProfileUpdate(pMac, psessionEntry);
3471}
3472
Jeff Johnson295189b2012-06-20 16:38:30 -07003473/**
3474 * limSwitchChannelCback()
3475 *
3476 *FUNCTION:
3477 * This is the callback function registered while requesting to switch channel
3478 * after AP indicates a channel switch for spectrum management (11h).
3479 *
3480 *NOTE:
3481 * @param pMac Pointer to Global MAC structure
3482 * @param status Status of channel switch request
3483 * @param data User data
3484 * @param psessionEntry Session information
3485 * @return NONE
3486 */
3487void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3488 tANI_U32 *data, tpPESession psessionEntry)
3489{
3490 tSirMsgQ mmhMsg = {0};
3491 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3492
Jeff Johnson295189b2012-06-20 16:38:30 -07003493 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3494
3495 /* We need to restore pre-channelSwitch state on the STA */
3496 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3497 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003498 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 return;
3500 }
3501
3502 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303503 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3504 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003506 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 return;
3508 }
3509
3510 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3511 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003512 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3514 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303515 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3517 mmhMsg.bodyval = 0;
3518
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303519 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3520 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003522}
3523
3524/**
3525 * limSwitchPrimaryChannel()
3526 *
3527 *FUNCTION:
3528 * This function changes the current operating channel
3529 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3530 *
3531 *NOTE:
3532 * @param pMac Pointer to Global MAC structure
3533 * @param newChannel new chnannel ID
3534 * @return NONE
3535 */
3536void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3537{
3538#if !defined WLAN_FEATURE_VOWIFI
3539 tANI_U32 localPwrConstraint;
3540#endif
3541
Abhishek Singh127a8442014-12-15 17:31:27 +05303542 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3543 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 psessionEntry->currentReqChannel = newChannel;
3545 psessionEntry->limRFBand = limGetRFBand(newChannel);
3546
3547 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3548
3549 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3550 pMac->lim.gpchangeChannelData = NULL;
3551
3552#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003553 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3555#else
3556 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3557 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003558 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003559 return;
3560 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003561 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3563#endif
3564 return;
3565}
3566
3567/**
3568 * limSwitchPrimarySecondaryChannel()
3569 *
3570 *FUNCTION:
3571 * This function changes the primary and secondary channel.
3572 * If 11h is enabled and user provides a "new channel ID"
3573 * that is different from the current operating channel,
3574 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3575 * assign notify LIM of such change.
3576 *
3577 *NOTE:
3578 * @param pMac Pointer to Global MAC structure
3579 * @param newChannel New chnannel ID (or current channel ID)
3580 * @param subband CB secondary info:
3581 * - eANI_CB_SECONDARY_NONE
3582 * - eANI_CB_SECONDARY_UP
3583 * - eANI_CB_SECONDARY_DOWN
3584 * @return NONE
3585 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003586void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003587{
3588#if !defined WLAN_FEATURE_VOWIFI
3589 tANI_U32 localPwrConstraint;
3590#endif
3591
Jeff Johnson295189b2012-06-20 16:38:30 -07003592#if !defined WLAN_FEATURE_VOWIFI
3593 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003594 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 return;
3596 }
3597#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303598 /* Assign the callback to resume TX once channel is changed.
3599 */
3600 psessionEntry->currentReqChannel = newChannel;
3601 psessionEntry->limRFBand = limGetRFBand(newChannel);
3602
3603 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3604
3605 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3606 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003607
Jeff Johnson295189b2012-06-20 16:38:30 -07003608#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003609 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003610#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003611 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003612#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003613
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303614#ifdef FEATURE_WLAN_DIAG_SUPPORT
3615 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3616 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3617#endif
3618
Jeff Johnsone7245742012-09-05 17:12:55 -07003619 // Store the new primary and secondary channel in session entries if different
3620 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 {
3622 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003623 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 psessionEntry->currentOperChannel = newChannel;
3626 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303627 if (psessionEntry->htSecondaryChannelOffset != limGetHTCBState(subband))
Jeff Johnsone7245742012-09-05 17:12:55 -07003628 {
3629 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003630 FL("switch old sec chnl %d --> new sec chnl %d "),
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303631 psessionEntry->htSecondaryChannelOffset, limGetHTCBState(subband));
3632 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(subband);
Jeff Johnsone7245742012-09-05 17:12:55 -07003633 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3634 {
3635 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303636 psessionEntry->apCenterChan = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003637 }
3638 else
3639 {
3640 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3641 }
3642 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3643 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003644
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303645 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3646 return;
3647
3648 if (subband > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
3649 psessionEntry->apCenterChan =
3650 limGetCenterChannel(pMac, newChannel,
3651 subband, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
3652 else
3653 psessionEntry->apCenterChan =
3654 limGetCenterChannel(pMac, newChannel,
3655 subband, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
3656
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 return;
3658}
3659
3660
3661/**
3662 * limActiveScanAllowed()
3663 *
3664 *FUNCTION:
3665 * Checks if active scans are permitted on the given channel
3666 *
3667 *LOGIC:
3668 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3669 * Need to check if the channelNum matches, then depending on the corresponding
3670 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3671 *
3672 *ASSUMPTIONS:
3673 *
3674 *NOTE:
3675 *
3676 * @param pMac Pointer to Global MAC structure
3677 * @param channelNum channel number
3678 * @return None
3679 */
3680
3681tANI_U8 limActiveScanAllowed(
3682 tpAniSirGlobal pMac,
3683 tANI_U8 channelNum)
3684{
3685 tANI_U32 i;
3686 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3687 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3688 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3689 != eSIR_SUCCESS)
3690 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003691 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 return false;
3693 }
3694
3695 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3696 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003697 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003698 len);
3699 return false;
3700 }
3701
3702 for (i=0; (i+1) < len; i+=2)
3703 {
3704 if (channelPair[i] == channelNum)
3705 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3706 }
3707 return false;
3708}
3709
3710/**
3711 * limTriggerBackgroundScanDuringQuietBss()
3712 *
3713 *FUNCTION:
3714 * This function is applicable to the STA only.
3715 * This function is called by limProcessQuietTimeout(),
3716 * when it is time to honor the Quiet BSS IE from the AP.
3717 *
3718 *LOGIC:
3719 * If 11H is enabled:
3720 * We cannot trigger a background scan. The STA needs to
3721 * shut-off Tx/Rx.
3722 * If 11 is not enabled:
3723 * Determine if the next channel that we are going to
3724 * scan is NOT the same channel (or not) on which the
3725 * Quiet BSS was requested.
3726 * If yes, then we cannot trigger a background scan on
3727 * this channel. Return with a false.
3728 * If no, then trigger a background scan. Return with
3729 * a true.
3730 *
3731 *ASSUMPTIONS:
3732 *
3733 *NOTE:
3734 * This API is redundant if the existing API,
3735 * limTriggerBackgroundScan(), were to return a valid
3736 * response instead of returning void.
3737 * If possible, try to revisit this API
3738 *
3739 * @param pMac Pointer to Global MAC structure
3740 * @return eSIR_TRUE, if a background scan was attempted
3741 * eSIR_FALSE, if not
3742 */
3743tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3744{
3745 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003746
3747
3748
3749 //TBD-RAJESH HOW TO GET sessionEntry?????
3750 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3751
3752 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3753 return bScanTriggered;
3754
Jeff Johnsone7245742012-09-05 17:12:55 -07003755 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 {
3757 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3758 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3759
3760 // Determine the next scan channel
3761
3762 // Get background scan channel list from CFG
3763 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3764 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3765 (tANI_U8 *) bgScanChannelList,
3766 (tANI_U32 *) &len ))
3767 {
3768 // Ensure that we do not go off scanning on the same
3769 // channel on which the Quiet BSS was requested
3770 if( psessionEntry->currentOperChannel!=
3771 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3772 {
3773 // For now, try and attempt a background scan. It will
3774 // be ideal if this API actually returns a success or
3775 // failure instead of having a void return type
3776 limTriggerBackgroundScan( pMac );
3777
3778 bScanTriggered = eSIR_TRUE;
3779 }
3780 else
3781 {
3782 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003783 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 -07003784 }
3785 }
3786 else
3787 {
3788 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003789 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 -07003790 }
3791 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003792 return bScanTriggered;
3793}
3794
3795
3796/**
3797 * limGetHTCapability()
3798 *
3799 *FUNCTION:
3800 * A utility function that returns the "current HT capability state" for the HT
3801 * capability of interest (as requested in the API)
3802 *
3803 *LOGIC:
3804 * This routine will return with the "current" setting of a requested HT
3805 * capability. This state info could be retrieved from -
3806 * a) CFG (for static entries)
3807 * b) Run time info
3808 * - Dynamic state maintained by LIM
3809 * - Configured at radio init time by SME
3810 *
3811 *
3812 *ASSUMPTIONS:
3813 * NA
3814 *
3815 *NOTE:
3816 *
3817 * @param pMac Pointer to Global MAC structure
3818 * @param htCap The HT capability being queried
3819 * @return tANI_U8 The current state of the requested HT capability is returned in a
3820 * tANI_U8 variable
3821 */
3822
Jeff Johnson295189b2012-06-20 16:38:30 -07003823tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3824 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003825{
3826tANI_U8 retVal = 0;
3827tANI_U8 *ptr;
3828tANI_U32 cfgValue;
3829tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3830tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3831tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3832tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3833
3834 //
3835 // Determine which CFG to read from. Not ALL of the HT
3836 // related CFG's need to be read each time this API is
3837 // accessed
3838 //
3839 if( htCap >= eHT_ANTENNA_SELECTION &&
3840 htCap < eHT_SI_GRANULARITY )
3841 {
3842 // Get Antenna Seletion HT Capabilities
3843 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3844 cfgValue = 0;
3845 ptr = (tANI_U8 *) &macASCapabilityInfo;
3846 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3847 }
3848 else
3849 {
3850 if( htCap >= eHT_TX_BEAMFORMING &&
3851 htCap < eHT_ANTENNA_SELECTION )
3852 {
3853 // Get Transmit Beam Forming HT Capabilities
3854 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3855 cfgValue = 0;
3856 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3857 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3858 }
3859 else
3860 {
3861 if( htCap >= eHT_PCO &&
3862 htCap < eHT_TX_BEAMFORMING )
3863 {
3864 // Get Extended HT Capabilities
3865 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3866 cfgValue = 0;
3867 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3868 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3869 }
3870 else
3871 {
3872 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3873 {
3874 // Get HT Capabilities
3875 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3876 cfgValue = 0;
3877 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3878 // 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
3879 *ptr++ = cfgValue & 0xff;
3880 *ptr = (cfgValue >> 8) & 0xff;
3881 }
3882 }
3883 }
3884 }
3885
3886 switch( htCap )
3887 {
3888 case eHT_LSIG_TXOP_PROTECTION:
3889 retVal = pMac->lim.gHTLsigTXOPProtection;
3890 break;
3891
3892 case eHT_STBC_CONTROL_FRAME:
3893 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3894 break;
3895
3896 case eHT_PSMP:
3897 retVal = pMac->lim.gHTPSMPSupport;
3898 break;
3899
3900 case eHT_DSSS_CCK_MODE_40MHZ:
3901 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3902 break;
3903
3904 case eHT_MAX_AMSDU_LENGTH:
3905 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3906 break;
3907
3908 case eHT_DELAYED_BA:
3909 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3910 break;
3911
3912 case eHT_RX_STBC:
3913 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3914 break;
3915
3916 case eHT_TX_STBC:
3917 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3918 break;
3919
3920 case eHT_SHORT_GI_40MHZ:
3921 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3922 break;
3923
3924 case eHT_SHORT_GI_20MHZ:
3925 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3926 break;
3927
3928 case eHT_GREENFIELD:
3929 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3930 break;
3931
3932 case eHT_MIMO_POWER_SAVE:
3933 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3934 break;
3935
3936 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003937 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 break;
3939
3940 case eHT_ADVANCED_CODING:
3941 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3942 break;
3943
3944 case eHT_MAX_RX_AMPDU_FACTOR:
3945 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3946 break;
3947
3948 case eHT_MPDU_DENSITY:
3949 retVal = pMac->lim.gHTAMpduDensity;
3950 break;
3951
3952 case eHT_PCO:
3953 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3954 break;
3955
3956 case eHT_TRANSITION_TIME:
3957 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3958 break;
3959
3960 case eHT_MCS_FEEDBACK:
3961 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3962 break;
3963
3964 case eHT_TX_BEAMFORMING:
3965 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3966 break;
3967
3968 case eHT_ANTENNA_SELECTION:
3969 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3970 break;
3971
3972 case eHT_SI_GRANULARITY:
3973 retVal = pMac->lim.gHTServiceIntervalGranularity;
3974 break;
3975
3976 case eHT_CONTROLLED_ACCESS:
3977 retVal = pMac->lim.gHTControlledAccessOnly;
3978 break;
3979
3980 case eHT_RIFS_MODE:
3981 retVal = psessionEntry->beaconParams.fRIFSMode;
3982 break;
3983
3984 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003985 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 break;
3987
3988 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 break;
3991
3992 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003993 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3994 retVal = psessionEntry->htOperMode;
3995 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 retVal = pMac->lim.gHTOperMode;
3997 break;
3998
3999 case eHT_BASIC_STBC_MCS:
4000 retVal = pMac->lim.gHTSTBCBasicMCS;
4001 break;
4002
4003 case eHT_DUAL_CTS_PROTECTION:
4004 retVal = pMac->lim.gHTDualCTSProtection;
4005 break;
4006
4007 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
4008 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
4009 break;
4010
4011 case eHT_PCO_ACTIVE:
4012 retVal = pMac->lim.gHTPCOActive;
4013 break;
4014
4015 case eHT_PCO_PHASE:
4016 retVal = pMac->lim.gHTPCOPhase;
4017 break;
4018
4019 default:
4020 break;
4021 }
4022
4023 return retVal;
4024}
4025
Jeff Johnson295189b2012-06-20 16:38:30 -07004026void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
4027{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304028 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 return;
4030}
4031
4032
4033
4034
4035/** -------------------------------------------------------------
4036\fn limEnable11aProtection
4037\brief based on config setting enables\disables 11a protection.
4038\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4039\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4040\param tpUpdateBeaconParams pBeaconParams
4041\return None
4042 -------------------------------------------------------------*/
4043tSirRetStatus
4044limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4045 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4046{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004047 if(NULL == psessionEntry)
4048 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004049 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004050 return eSIR_FAILURE;
4051 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 //overlapping protection configuration check.
4053 if(overlap)
4054 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 }
4056 else
4057 {
4058 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004059 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004060 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 {
4062 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004063 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 return eSIR_SUCCESS;
4065 }
4066 }
4067
4068 if (enable)
4069 {
4070 //If we are AP and HT capable, we need to set the HT OP mode
4071 //appropriately.
4072 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07004073 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 {
4075 if(overlap)
4076 {
4077 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
4078 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4079 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4080 {
4081 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4082 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4083 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4084 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4085 }
4086 }
4087 else
4088 {
4089 psessionEntry->gLim11aParams.protectionEnabled = true;
4090 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4091 {
4092 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07004093 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4095 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4096
4097 }
4098 }
4099 }
4100
4101 //This part is common for staiton as well.
4102 if(false == psessionEntry->beaconParams.llaCoexist)
4103 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004104 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004105 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
4106 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4107 }
4108 }
4109 else if (true == psessionEntry->beaconParams.llaCoexist)
4110 {
4111 //for AP role.
4112 //we need to take care of HT OP mode change if needed.
4113 //We need to take care of Overlap cases.
4114 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4115 {
4116 if(overlap)
4117 {
4118 //Overlap Legacy protection disabled.
4119 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
4120
4121 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004122 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 {
4124 // no HT op mode change if any of the overlap protection enabled.
4125 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4126 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4127 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4128
4129 {
4130 //Check if there is a need to change HT OP mode.
4131 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4132 {
4133 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4134 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4135
4136 if(psessionEntry->gLimHt20Params.protectionEnabled)
4137 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4138 else
4139 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4140 }
4141 }
4142 }
4143 }
4144 else
4145 {
4146 //Disable protection from 11A stations.
4147 psessionEntry->gLim11aParams.protectionEnabled = false;
4148 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4149
4150 //Check if any other non-HT protection enabled.
4151 //Right now we are in HT OP Mixed mode.
4152 //Change HT op mode appropriately.
4153
4154 //Change HT OP mode to 01 if any overlap protection enabled
4155 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4156 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4157 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4158
4159 {
4160 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07004161 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4163 }
4164 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4165 {
4166 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07004167 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4169 }
4170 else
4171 {
4172 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004173 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4175 }
4176 }
4177 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4178 !psessionEntry->gLim11aParams.protectionEnabled)
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 //for station role
4186 else
4187 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004188 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4190 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4191 }
4192 }
4193
4194 return eSIR_SUCCESS;
4195}
4196
4197/** -------------------------------------------------------------
4198\fn limEnable11gProtection
4199\brief based on config setting enables\disables 11g protection.
4200\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4201\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4202\param tpUpdateBeaconParams pBeaconParams
4203\return None
4204 -------------------------------------------------------------*/
4205
4206tSirRetStatus
4207limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4208 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4209{
4210
4211 //overlapping protection configuration check.
4212 if(overlap)
4213 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 }
4215 else
4216 {
4217 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4219 !psessionEntry->cfgProtection.fromllb)
4220 {
4221 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004222 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 return eSIR_SUCCESS;
4224 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 {
4226 if(!pMac->lim.cfgProtection.fromllb)
4227 {
4228 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004229 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004230 return eSIR_SUCCESS;
4231 }
4232 }
4233 }
4234
4235 if (enable)
4236 {
4237 //If we are AP and HT capable, we need to set the HT OP mode
4238 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4240 {
4241 if(overlap)
4242 {
4243 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004244 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004245 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 {
4247 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4248 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4249 {
4250 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4251 }
4252 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4253 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4254 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4255 //Not processing OBSS bit from other APs, as we are already taking care
4256 //of Protection from overlapping BSS based on erp IE or useProtection bit
4257 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4258 }
4259 }
4260 else
4261 {
4262 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004263 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004264 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 {
4266 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4267 {
4268 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4269 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4270 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4271 }
4272 }
4273 }
4274 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004275 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 {
4277 if(overlap)
4278 {
4279 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4280 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4281 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4282 {
4283 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4284 }
4285 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4286 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4287 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4288 //Not processing OBSS bit from other APs, as we are already taking care
4289 //of Protection from overlapping BSS based on erp IE or useProtection bit
4290 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4291 }
4292 else
4293 {
4294 psessionEntry->gLim11bParams.protectionEnabled = true;
4295 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4296 {
4297 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4298 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4299 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4300 }
4301 }
4302 }
4303
4304 //This part is common for staiton as well.
4305 if(false == psessionEntry->beaconParams.llbCoexist)
4306 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004307 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004308 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4309 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4310 }
4311 }
4312 else if (true == psessionEntry->beaconParams.llbCoexist)
4313 {
4314 //for AP role.
4315 //we need to take care of HT OP mode change if needed.
4316 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4318 {
4319 if(overlap)
4320 {
4321 //Overlap Legacy protection disabled.
4322 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4323
4324 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004325 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 {
4327 // no HT op mode change if any of the overlap protection enabled.
4328 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4329 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4330 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4331 {
4332 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004333 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 {
4335 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4336 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4337 if(psessionEntry->gLimHt20Params.protectionEnabled){
4338 //Commenting out beacuse of CR 258588 WFA cert
4339 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4340 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4341 }
4342 else
4343 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4344 }
4345 }
4346 }
4347 }
4348 else
4349 {
4350 //Disable protection from 11B stations.
4351 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004352 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 //Check if any other non-HT protection enabled.
4354 if(!psessionEntry->gLim11gParams.protectionEnabled)
4355 {
4356 //Right now we are in HT OP Mixed mode.
4357 //Change HT op mode appropriately.
4358 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4359
4360 //Change HT OP mode to 01 if any overlap protection enabled
4361 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4362 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4363 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4364 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4365 {
4366 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
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, true, overlap, pBeaconParams,psessionEntry);
4369 }
4370 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4371 {
4372 //Commenting because of CR 258588 WFA cert
4373 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4374 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004375 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4377 }
4378 else
4379 {
4380 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4381 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4382 }
4383 }
4384 }
4385 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4386 !psessionEntry->gLim11bParams.protectionEnabled)
4387 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004388 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4390 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4391 }
4392 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 {
4394 if(overlap)
4395 {
4396 //Overlap Legacy protection disabled.
4397 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4398
4399 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004400 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 {
4402 // no HT op mode change if any of the overlap protection enabled.
4403 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4404 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4405 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4406
4407 {
4408 //Check if there is a need to change HT OP mode.
4409 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4410 {
4411 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4412 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4413 if(psessionEntry->gLimHt20Params.protectionEnabled)
4414 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4415 else
4416 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4417 }
4418 }
4419 }
4420 }
4421 else
4422 {
4423 //Disable protection from 11B stations.
4424 psessionEntry->gLim11bParams.protectionEnabled = false;
4425 //Check if any other non-HT protection enabled.
4426 if(!psessionEntry->gLim11gParams.protectionEnabled)
4427 {
4428 //Right now we are in HT OP Mixed mode.
4429 //Change HT op mode appropriately.
4430 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4431
4432 //Change HT OP mode to 01 if any overlap protection enabled
4433 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4434 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4435 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4436 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4437
4438 {
4439 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4440 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4441 }
4442 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4443 {
4444 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4445 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4446 }
4447 else
4448 {
4449 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4450 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4451 }
4452 }
4453 }
4454 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4455 !psessionEntry->gLim11bParams.protectionEnabled)
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 //for station role
4463 else
4464 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004465 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004466 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4467 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4468 }
4469 }
4470 return eSIR_SUCCESS;
4471}
4472
4473/** -------------------------------------------------------------
4474\fn limEnableHtProtectionFrom11g
4475\brief based on cofig enables\disables protection from 11g.
4476\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4477\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4478\param tpUpdateBeaconParams pBeaconParams
4479\return None
4480 -------------------------------------------------------------*/
4481tSirRetStatus
4482limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4483 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4484{
Jeff Johnsone7245742012-09-05 17:12:55 -07004485 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4487
4488 //overlapping protection configuration check.
4489 if(overlap)
4490 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4492 {
4493 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004494 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004495 return eSIR_SUCCESS;
4496 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 {
4498 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004499 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 return eSIR_SUCCESS;
4501 }
4502 }
4503 else
4504 {
4505 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4507 !psessionEntry->cfgProtection.fromllg){
4508 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004509 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 return eSIR_SUCCESS;
4511 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 {
4513 if(!pMac->lim.cfgProtection.fromllg)
4514 {
4515 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004516 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 return eSIR_SUCCESS;
4518 }
4519 }
4520 }
4521 if (enable)
4522 {
4523 //If we are AP and HT capable, we need to set the HT OP mode
4524 //appropriately.
4525
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4527 {
4528 if(overlap)
4529 {
4530 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4531 //11g exists in overlap BSS.
4532 //need not to change the operating mode to overlap_legacy
4533 //if higher or same protection operating mode is enabled right now.
4534 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4535 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4536 {
4537 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4538 }
4539 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304540 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 }
4542 else
4543 {
4544 //11g is associated to an AP operating in 11n mode.
4545 //Change the HT operating mode to 'mixed mode'.
4546 psessionEntry->gLim11gParams.protectionEnabled = true;
4547 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4548 {
4549 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4550 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304551 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 }
4553 }
4554 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 {
4556 if(overlap)
4557 {
4558 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4559 //11g exists in overlap BSS.
4560 //need not to change the operating mode to overlap_legacy
4561 //if higher or same protection operating mode is enabled right now.
4562 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4563 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4564 {
4565 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4566 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4567 }
4568 }
4569 else
4570 {
4571 //11g is associated to an AP operating in 11n mode.
4572 //Change the HT operating mode to 'mixed mode'.
4573 psessionEntry->gLim11gParams.protectionEnabled = true;
4574 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4575 {
4576 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4577 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304578 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 }
4580 }
4581 }
4582
4583 //This part is common for staiton as well.
4584 if(false == psessionEntry->beaconParams.llgCoexist)
4585 {
4586 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4587 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4588 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4590 {
4591 // As operating mode changed after G station assoc some way to update beacon
4592 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4593 //pMac->sch.schObject.fBeaconChanged = 1;
4594 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4595 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 }
4597 else if (true == psessionEntry->beaconParams.llgCoexist)
4598 {
4599 //for AP role.
4600 //we need to take care of HT OP mode change if needed.
4601 //We need to take care of Overlap cases.
4602
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4604 {
4605 if(overlap)
4606 {
4607 //Overlap Legacy protection disabled.
4608 if (psessionEntry->gLim11gParams.numSta == 0)
4609 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4610
4611 // no HT op mode change if any of the overlap protection enabled.
4612 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4613 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4614 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4615 {
4616 //Check if there is a need to change HT OP mode.
4617 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4618 {
4619 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4620 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4621
4622 if(psessionEntry->gLimHt20Params.protectionEnabled){
4623 //Commenting because of CR 258588 WFA cert
4624 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4625 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4626 }
4627 else
4628 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4629 }
4630 }
4631 }
4632 else
4633 {
4634 //Disable protection from 11G stations.
4635 psessionEntry->gLim11gParams.protectionEnabled = false;
4636 //Check if any other non-HT protection enabled.
4637 if(!psessionEntry->gLim11bParams.protectionEnabled)
4638 {
4639
4640 //Right now we are in HT OP Mixed mode.
4641 //Change HT op mode appropriately.
4642 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4643
4644 //Change HT OP mode to 01 if any overlap protection enabled
4645 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4646 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4647 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4648 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4649
4650 {
4651 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4652 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4653 }
4654 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4655 {
4656 //Commenting because of CR 258588 WFA cert
4657 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4658 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4659 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4660 }
4661 else
4662 {
4663 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4664 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4665 }
4666 }
4667 }
4668 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4669 !psessionEntry->gLim11gParams.protectionEnabled)
4670 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004671 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004672 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4673 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4674 }
4675 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 {
4677 if(overlap)
4678 {
4679 //Overlap Legacy protection disabled.
4680 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4681
4682 // no HT op mode change if any of the overlap protection enabled.
4683 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4684 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4685 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4686 {
4687 //Check if there is a need to change HT OP mode.
4688 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4689 {
4690 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4691 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4692
4693 if(psessionEntry->gLimHt20Params.protectionEnabled)
4694 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4695 else
4696 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4697 }
4698 }
4699 }
4700 else
4701 {
4702 //Disable protection from 11G stations.
4703 psessionEntry->gLim11gParams.protectionEnabled = false;
4704 //Check if any other non-HT protection enabled.
4705 if(!psessionEntry->gLim11bParams.protectionEnabled)
4706 {
4707
4708 //Right now we are in HT OP Mixed mode.
4709 //Change HT op mode appropriately.
4710 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4711
4712 //Change HT OP mode to 01 if any overlap protection enabled
4713 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4714 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4715 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4716 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4717
4718 {
4719 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4720 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4721 }
4722 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4723 {
4724 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4725 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4726 }
4727 else
4728 {
4729 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4730 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4731 }
4732 }
4733 }
4734 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4735 !psessionEntry->gLim11gParams.protectionEnabled)
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 //for station role
4743 else
4744 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004745 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4747 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4748 }
4749 }
4750 return eSIR_SUCCESS;
4751}
4752//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4753//This check will be done at the caller.
4754
4755/** -------------------------------------------------------------
4756\fn limEnableHtObssProtection
4757\brief based on cofig enables\disables obss protection.
4758\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4759\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4760\param tpUpdateBeaconParams pBeaconParams
4761\return None
4762 -------------------------------------------------------------*/
4763tSirRetStatus
4764limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4765 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4766{
4767
4768
Jeff Johnsone7245742012-09-05 17:12:55 -07004769 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 return eSIR_SUCCESS; // this protection is only for HT stations.
4771
4772 //overlapping protection configuration check.
4773 if(overlap)
4774 {
4775 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 }
4777 else
4778 {
4779 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4781 { //ToDo Update this field
4782 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004783 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004784 return eSIR_SUCCESS;
4785 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 {
4787 if(!pMac->lim.cfgProtection.obss)
4788 { //ToDo Update this field
4789 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004790 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 return eSIR_SUCCESS;
4792 }
4793 }
4794 }
4795
4796
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4798 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4799 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004800 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 psessionEntry->beaconParams.gHTObssMode = true;
4802 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4803
4804 }
4805 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4806 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004807 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004808 psessionEntry->beaconParams.gHTObssMode = false;
4809 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4810
4811 }
4812//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4813 if (!enable && !overlap)
4814 {
4815 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4816 }
4817 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 {
4819 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004821 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 psessionEntry->beaconParams.gHTObssMode = true;
4823 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4824
4825 }
4826 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4827 {
4828
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004829 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004830 psessionEntry->beaconParams.gHTObssMode = false;
4831 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4832
4833 }
4834 }
4835 return eSIR_SUCCESS;
4836}
4837/** -------------------------------------------------------------
4838\fn limEnableHT20Protection
4839\brief based on cofig enables\disables protection from Ht20.
4840\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4841\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4842\param tpUpdateBeaconParams pBeaconParams
4843\return None
4844 -------------------------------------------------------------*/
4845tSirRetStatus
4846limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4847 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4848{
Jeff Johnsone7245742012-09-05 17:12:55 -07004849 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 return eSIR_SUCCESS; // this protection is only for HT stations.
4851
4852 //overlapping protection configuration check.
4853 if(overlap)
4854 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 }
4856 else
4857 {
4858 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4860 !psessionEntry->cfgProtection.ht20)
4861 {
4862 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004863 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 return eSIR_SUCCESS;
4865 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004866 {
4867 if(!pMac->lim.cfgProtection.ht20)
4868 {
4869 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004870 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 return eSIR_SUCCESS;
4872 }
4873 }
4874 }
4875
4876 if (enable)
4877 {
4878 //If we are AP and HT capable, we need to set the HT OP mode
4879 //appropriately.
4880
Jeff Johnson295189b2012-06-20 16:38:30 -07004881 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4882 if(overlap)
4883 {
4884 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4885 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4886 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4887 {
4888 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4889 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4890 }
4891 }
4892 else
4893 {
4894 psessionEntry->gLimHt20Params.protectionEnabled = true;
4895 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4896 {
4897 //Commenting because of CR 258588 WFA cert
4898 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4899 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4900 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4901 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4902 }
4903 }
4904 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004905 {
4906 if(overlap)
4907 {
4908 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4909 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4910 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4911 {
4912 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4913 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4914 }
4915 }
4916 else
4917 {
4918 psessionEntry->gLimHt20Params.protectionEnabled = true;
4919 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4920 {
4921 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4922 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4923 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4924 }
4925 }
4926 }
4927
4928 //This part is common for staiton as well.
4929 if(false == psessionEntry->beaconParams.ht20Coexist)
4930 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004931 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4933 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4934 }
4935 }
4936 else if (true == psessionEntry->beaconParams.ht20Coexist)
4937 {
4938 //for AP role.
4939 //we need to take care of HT OP mode change if needed.
4940 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4942 if(overlap)
4943 {
4944 //Overlap Legacy protection disabled.
4945 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4946
4947 // no HT op mode change if any of the overlap protection enabled.
4948 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4949 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4950 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4951 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4952 {
4953
4954 //Check if there is a need to change HT OP mode.
4955 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4956 {
4957 if(psessionEntry->gLimHt20Params.protectionEnabled)
4958 {
4959 //Commented beacuse of CR 258588 for WFA Cert
4960 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4961 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4962 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4963 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4964 }
4965 else
4966 {
4967 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4968 }
4969 }
4970 }
4971 }
4972 else
4973 {
4974 //Disable protection from 11G stations.
4975 psessionEntry->gLimHt20Params.protectionEnabled = false;
4976
4977 //Change HT op mode appropriately.
4978 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4979 {
4980 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4981 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4982 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4983 }
4984 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004985 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4987 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4988 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 {
4990 if(overlap)
4991 {
4992 //Overlap Legacy protection disabled.
4993 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4994
4995 // no HT op mode change if any of the overlap protection enabled.
4996 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4997 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4998 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4999 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
5000 {
5001
5002 //Check if there is a need to change HT OP mode.
5003 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
5004 {
5005 if(psessionEntry->gLimHt20Params.protectionEnabled)
5006 {
5007 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
5008 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5009 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5010 }
5011 else
5012 {
5013 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5014 }
5015 }
5016 }
5017 }
5018 else
5019 {
5020 //Disable protection from 11G stations.
5021 psessionEntry->gLimHt20Params.protectionEnabled = false;
5022
5023 //Change HT op mode appropriately.
5024 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
5025 {
5026 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5027 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5028 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5029 }
5030 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005031 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005032 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5033 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5034 }
5035 //for station role
5036 else
5037 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005038 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005039 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5040 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5041 }
5042 }
5043
5044 return eSIR_SUCCESS;
5045}
5046
5047/** -------------------------------------------------------------
5048\fn limEnableHTNonGfProtection
5049\brief based on cofig enables\disables protection from NonGf.
5050\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5051\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5052\param tpUpdateBeaconParams pBeaconParams
5053\return None
5054 -------------------------------------------------------------*/
5055tSirRetStatus
5056limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5057 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5058{
Jeff Johnsone7245742012-09-05 17:12:55 -07005059 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 return eSIR_SUCCESS; // this protection is only for HT stations.
5061
5062 //overlapping protection configuration check.
5063 if(overlap)
5064 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 }
5066 else
5067 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 //normal protection config check
5069 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5070 !psessionEntry->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 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005076 {
5077 //normal protection config check
5078 if(!pMac->lim.cfgProtection.nonGf)
5079 {
5080 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005081 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005082 return eSIR_SUCCESS;
5083 }
5084 }
5085 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5087 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5088 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005089 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005090 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5091 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5092 }
5093 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5094 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005095 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5097 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5098 }
5099 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 {
5101 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5102 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005103 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5105 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5106 }
5107 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5108 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005109 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005110 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5111 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5112 }
5113 }
5114
5115 return eSIR_SUCCESS;
5116}
5117
5118/** -------------------------------------------------------------
5119\fn limEnableHTLsigTxopProtection
5120\brief based on cofig enables\disables LsigTxop protection.
5121\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5122\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5123\param tpUpdateBeaconParams pBeaconParams
5124\return None
5125 -------------------------------------------------------------*/
5126tSirRetStatus
5127limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5128 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5129{
Jeff Johnsone7245742012-09-05 17:12:55 -07005130 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005131 return eSIR_SUCCESS; // this protection is only for HT stations.
5132
5133 //overlapping protection configuration check.
5134 if(overlap)
5135 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005136 }
5137 else
5138 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 //normal protection config check
5140 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5141 !psessionEntry->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 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 {
5148 //normal protection config check
5149 if(!pMac->lim.cfgProtection.lsigTxop)
5150 {
5151 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005152 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 return eSIR_SUCCESS;
5154 }
5155 }
5156 }
5157
5158
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5160 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5161 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005162 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005163 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5164 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5165 }
5166 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5167 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005168 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5170 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5171 }
5172 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005173 {
5174 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5175 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005176 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005177 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5178 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5179 }
5180 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5181 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005182 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005183 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5184 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5185 }
5186 }
5187 return eSIR_SUCCESS;
5188}
5189//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5190//This check will be done at the caller.
5191/** -------------------------------------------------------------
5192\fn limEnableHtRifsProtection
5193\brief based on cofig enables\disables Rifs protection.
5194\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5195\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5196\param tpUpdateBeaconParams pBeaconParams
5197\return None
5198 -------------------------------------------------------------*/
5199tSirRetStatus
5200limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5201 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5202{
Jeff Johnsone7245742012-09-05 17:12:55 -07005203 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005204 return eSIR_SUCCESS; // this protection is only for HT stations.
5205
5206
5207 //overlapping protection configuration check.
5208 if(overlap)
5209 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 }
5211 else
5212 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 //normal protection config check
5214 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5215 !psessionEntry->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 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005221 {
5222 //normal protection config check
5223 if(!pMac->lim.cfgProtection.rifs)
5224 {
5225 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005226 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005227 return eSIR_SUCCESS;
5228 }
5229 }
5230 }
5231
Jeff Johnson295189b2012-06-20 16:38:30 -07005232 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5233 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5234 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005236 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005237 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5238 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5239 }
5240 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5241 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5242 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005243 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5245 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5246 }
5247 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005248 {
5249 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5250 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5251 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005252 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5254 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5255 }
5256 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5257 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5258 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005259 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005260 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5261 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5262 }
5263 }
5264 return eSIR_SUCCESS;
5265}
5266
5267// ---------------------------------------------------------------------
5268/**
5269 * limEnableShortPreamble
5270 *
5271 * FUNCTION:
5272 * Enable/Disable short preamble
5273 *
5274 * LOGIC:
5275 *
5276 * ASSUMPTIONS:
5277 *
5278 * NOTE:
5279 *
5280 * @param enable Flag to enable/disable short preamble
5281 * @return None
5282 */
5283
5284tSirRetStatus
5285limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5286{
5287 tANI_U32 val;
5288
5289 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5290 {
5291 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005292 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005293 return eSIR_FAILURE;
5294 }
5295
5296 if (!val)
5297 return eSIR_SUCCESS;
5298
5299 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5300 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005301 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005302 return eSIR_FAILURE;
5303 }
5304
5305 if (!val) // 11G short preamble switching is disabled.
5306 return eSIR_SUCCESS;
5307
5308 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5309 {
5310 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5311 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005312 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005313 psessionEntry->beaconParams.fShortPreamble = true;
5314 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5315 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5316 }
5317 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5318 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005319 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005320 psessionEntry->beaconParams.fShortPreamble = false;
5321 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5322 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5323 }
5324 }
5325
5326 return eSIR_SUCCESS;
5327 }
5328
5329/**
5330 * limTxComplete
5331 *
5332 * Function:
5333 * This is LIM's very own "TX MGMT frame complete" completion routine.
5334 *
5335 * Logic:
5336 * LIM wants to send a MGMT frame (broadcast or unicast)
5337 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5338 * LIM transmits the MGMT frame using the API:
5339 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5340 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5341 * HDD, if it determines that a TX completion routine (in this case
5342 * limTxComplete) has been provided, will invoke this callback
5343 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5344 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5345 *
5346 * Assumptions:
5347 * Presently, this is ONLY being used for MGMT frames/packets
5348 * TODO:
5349 * Would it do good for LIM to have some sort of "signature" validation to
5350 * ensure that the pData argument passed in was a buffer that was actually
5351 * allocated by LIM and/or is not corrupted?
5352 *
5353 * Note: FIXME and TODO
5354 * Looks like palPktFree() is interested in pPacket. But, when this completion
5355 * routine is called, only pData is made available to LIM!!
5356 *
5357 * @param void A pointer to pData. Shouldn't it be pPacket?!
5358 *
5359 * @return none
5360 */
5361void limTxComplete( tHalHandle hHal, void *pData )
5362{
5363 tpAniSirGlobal pMac;
5364 pMac = (tpAniSirGlobal)hHal;
5365
5366#ifdef FIXME_PRIMA
5367 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5368#ifdef TRACE_RECORD
5369 {
5370 tpSirMacMgmtHdr mHdr;
5371 v_U8_t *pRxBd;
5372 vos_pkt_t *pVosPkt;
5373 VOS_STATUS vosStatus;
5374
5375
5376
5377 pVosPkt = (vos_pkt_t *)pData;
5378 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5379
5380 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5381 {
5382 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005383
5384 }
5385 }
5386#endif
5387#endif
5388
5389 palPktFree( pMac->hHdd,
5390 HAL_TXRX_FRM_802_11_MGMT,
5391 (void *) NULL, // this is ignored and will likely be removed from this API
5392 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5393}
5394
5395/**
5396 * \brief This function updates lim global structure, if CB parameters in the BSS
5397 * have changed, and sends an indication to HAL also with the
5398 * updated HT Parameters.
5399 * This function does not detect the change in the primary channel, that is done as part
5400 * of channel Swtich IE processing.
5401 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5402 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5403 *
5404 *
5405 * \param pMac Pointer to global MAC structure
5406 *
5407 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5408 * Probe Response
5409 *
5410 * \param bssIdx BSS Index of the Bss to which Station is associated.
5411 *
5412 *
5413 */
5414
5415void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5416 tDot11fIEHTInfo *pHTInfo,
5417 tANI_U8 bssIdx,
5418 tpPESession psessionEntry)
5419{
Jeff Johnsone7245742012-09-05 17:12:55 -07005420 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005421#if !defined WLAN_FEATURE_VOWIFI
5422 tANI_U32 localPwrConstraint;
5423#endif
5424
5425 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005427 return;
5428
Abhishek Singhe3beee22017-07-31 15:35:40 +05305429 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5430 psessionEntry->force_24ghz_in_ht20) {
5431 limLog(pMac, LOG1,
5432 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5433 return;
5434 }
5435
Jeff Johnson295189b2012-06-20 16:38:30 -07005436#if !defined WLAN_FEATURE_VOWIFI
5437 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005438 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005439 return;
5440 }
5441#endif
5442
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305443 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5444 {
5445 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5446 return;
5447 }
5448
Mihir Shetebc160b72014-08-22 14:10:39 +05305449 /*
5450 * Do not try to switch channel if RoC is in progress. RoC code path uses
5451 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5452 * has started listening on the channel requested as part of RoC, if we set
5453 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5454 * upper layers will think that the channel change is not successful and the
5455 * RoC from the upper layer perspective will never end...
5456 */
5457 if (pMac->lim.gpLimRemainOnChanReq)
5458 {
5459 limLog( pMac, LOGE, FL( "RoC is in progress"));
5460 return;
5461 }
5462
Jeff Johnsone7245742012-09-05 17:12:55 -07005463 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5464 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005465 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005466 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5467 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5468 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5469 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005470
5471 // Notify HAL
5472 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005473 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005474 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005475 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005476 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005477 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005478 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5479 pMac->lim.gpchangeChannelCallback = NULL;
5480 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005481
5482#if defined WLAN_FEATURE_VOWIFI
5483 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5484 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5485#else
5486 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5487 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5488#endif
5489
5490 //In case of IBSS, if STA should update HT Info IE in its beacons.
5491 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5492 {
5493 schSetFixedBeaconFields(pMac,psessionEntry);
5494 }
5495
5496 }
5497} // End limUpdateStaRunTimeHTParams.
5498
5499/**
5500 * \brief This function updates the lim global structure, if any of the
5501 * HT Capabilities have changed.
5502 *
5503 *
5504 * \param pMac Pointer to Global MAC structure
5505 *
5506 * \param pHTCapability Pointer to HT Capability Information Element
5507 * obtained from a Beacon or Probe Response
5508 *
5509 *
5510 *
5511 */
5512
5513void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5514 tDot11fIEHTCaps *pHTCaps )
5515{
5516
5517 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5518 {
5519 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5520 // Send change notification to HAL
5521 }
5522
5523 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5524 {
5525 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5526 // Send change notification to HAL
5527 }
5528
5529 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5530 {
5531 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5532 // Send change notification to HAL
5533 }
5534
5535
5536} // End limUpdateStaRunTimeHTCapability.
5537
5538/**
5539 * \brief This function updates lim global structure, if any of the HT
5540 * Info Parameters have changed.
5541 *
5542 *
5543 * \param pMac Pointer to the global MAC structure
5544 *
5545 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5546 * Probe Response
5547 *
5548 *
5549 */
5550
5551void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305552 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005553{
Jeff Johnsone7245742012-09-05 17:12:55 -07005554 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005555 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005556 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005557 // Send change notification to HAL
5558 }
5559
5560 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5561 {
5562 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5563 // Send change notification to HAL
5564 }
5565
5566 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5567 {
5568 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5569 // Send change notification to HAL
5570 }
5571
5572 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5573 {
5574 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5575 // Send change notification to HAL
5576 }
5577
5578 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5579 {
5580 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5581 }
5582
5583 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5584 {
5585 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5586 // Send change notification to HAL
5587 }
5588
5589 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5590 {
5591 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5592 // Send change notification to HAL
5593 }
5594
5595 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5596 {
5597 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5598 // Send change notification to HAL
5599 }
5600
5601 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5602 {
5603 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5604 // Send change notification to HAL
5605 }
5606
5607 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5608 {
5609 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5610 // Send change notification to HAL
5611 }
5612
5613 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5614 {
5615 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5616 // Send change notification to HAL
5617 }
5618
5619} // End limUpdateStaRunTimeHTInfo.
5620
5621
5622/** -------------------------------------------------------------
5623\fn limProcessHalIndMessages
5624\brief callback function for HAL indication
5625\param tpAniSirGlobal pMac
5626\param tANI_U32 mesgId
5627\param void *mesgParam
5628\return tSirRetStatu - status
5629 -------------------------------------------------------------*/
5630
5631tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5632{
5633 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5634 tSirMsgQ msg;
5635
5636 switch(msgId)
5637 {
5638 case SIR_LIM_DEL_TS_IND:
5639 case SIR_LIM_ADD_BA_IND:
5640 case SIR_LIM_DEL_BA_ALL_IND:
5641 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5642 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305643 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 msg.type = (tANI_U16) msgId;
5645 msg.bodyptr = msgParam;
5646 msg.bodyval = 0;
5647 break;
5648
5649 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305650 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005651 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005652 return eSIR_FAILURE;
5653 }
5654
5655 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5656 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305657 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005658 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5659 return eSIR_FAILURE;
5660 }
5661 return eSIR_SUCCESS;
5662}
5663
5664/** -------------------------------------------------------------
5665\fn limValidateDeltsReq
5666\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5667\param tpAniSirGlobal pMac
5668\param tpSirDeltsReq pDeltsReq
5669\param tSirMacAddr peerMacAddr
5670\return eSirRetStatus - status
5671 -------------------------------------------------------------*/
5672
5673tSirRetStatus
5674limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5675{
5676 tpDphHashNode pSta;
5677 tANI_U8 tsStatus;
5678 tSirMacTSInfo *tsinfo;
5679 tANI_U32 i;
5680 tANI_U8 tspecIdx;
5681 /* if sta
5682 * - verify assoc state
5683 * - del tspec locally
5684 * if ap,
5685 * - verify sta is in assoc state
5686 * - del sta tspec locally
5687 */
5688 if(pDeltsReq == NULL)
5689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005690 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005691 return eSIR_FAILURE;
5692 }
5693
5694 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5695 {
5696 tANI_U32 val;
5697
5698 // station always talks to the AP
5699 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5700
5701 val = sizeof(tSirMacAddr);
5702 #if 0
5703 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5704 {
5705 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005706 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005707 return eSIR_FAILURE;
5708 }
5709 #endif// TO SUPPORT BT-AMP
5710 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5711
5712 }
5713 else
5714 {
5715 tANI_U16 assocId;
5716 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5717
5718 assocId = pDeltsReq->aid;
5719 if (assocId != 0)
5720 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5721 else
5722 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5723
5724 if (pSta != NULL)
5725 // TBD: check sta assoc state as well
5726 for (i =0; i < sizeof(tSirMacAddr); i++)
5727 macaddr[i] = pSta->staAddr[i];
5728 }
5729
5730 if (pSta == NULL)
5731 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005732 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005733 return eSIR_FAILURE;
5734 }
5735
5736 if ((! pSta->valid) ||
5737 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5738 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005739 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005740 return eSIR_FAILURE;
5741 }
5742
5743 pDeltsReq->req.wsmTspecPresent = 0;
5744 pDeltsReq->req.wmeTspecPresent = 0;
5745 pDeltsReq->req.lleTspecPresent = 0;
5746
5747 if ((pSta->wsmEnabled) &&
5748 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5749 pDeltsReq->req.wsmTspecPresent = 1;
5750 else if (pSta->wmeEnabled)
5751 pDeltsReq->req.wmeTspecPresent = 1;
5752 else if (pSta->lleEnabled)
5753 pDeltsReq->req.lleTspecPresent = 1;
5754 else
5755 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005756 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005757 return eSIR_FAILURE;
5758 }
5759
5760 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5761 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305762 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005763 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005764 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305765 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005766
5767 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005768
5769 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5770 != eSIR_SUCCESS)
5771 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005772 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005773 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5774 return eSIR_FAILURE;
5775 }
5776 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5777 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5778 {
5779 //edca only now.
5780 }
5781 else
5782 {
5783 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5784 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5785 {
5786 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305787 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5788 pSta->staIndex,
5789 tspecIdx,
5790 pDeltsReq->req,
5791 psessionEntry->peSessionId,
5792 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005793 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005794 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005795 tsinfo->traffic.userPrio);
5796 return eSIR_FAILURE;
5797 }
5798 }
5799 }
5800 return eSIR_SUCCESS;
5801}
5802
5803/** -------------------------------------------------------------
5804\fn limRegisterHalIndCallBack
5805\brief registers callback function to HAL for any indication.
5806\param tpAniSirGlobal pMac
5807\return none.
5808 -------------------------------------------------------------*/
5809void
5810limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5811{
5812 tSirMsgQ msg;
5813 tpHalIndCB pHalCB;
5814
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305815 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5816 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005817 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305818 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 return;
5820 }
5821
5822 pHalCB->pHalIndCB = limProcessHalIndMessages;
5823
5824 msg.type = WDA_REGISTER_PE_CALLBACK;
5825 msg.bodyptr = pHalCB;
5826 msg.bodyval = 0;
5827
Jeff Johnsone7245742012-09-05 17:12:55 -07005828 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005829 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5830 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305831 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005832 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005833 }
5834
5835 return;
5836}
5837
5838
5839/** -------------------------------------------------------------
5840\fn limProcessAddBaInd
5841
5842\brief handles the BA activity check timeout indication coming from HAL.
5843 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5844\param tpAniSirGlobal pMac
5845\param tSirMsgQ limMsg
5846\return None
5847-------------------------------------------------------------*/
5848void
5849limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5850{
5851 tANI_U8 i;
5852 tANI_U8 tid;
5853 tANI_U16 assocId;
5854 tpDphHashNode pSta;
5855 tpAddBaCandidate pBaCandidate;
5856 tANI_U32 baCandidateCnt;
5857 tpBaActivityInd pBaActivityInd;
5858 tpPESession psessionEntry;
5859 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005860#ifdef FEATURE_WLAN_TDLS
5861 boolean htCapable = FALSE;
5862#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005863
5864
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005865 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005866 return;
5867
5868 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5869 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5870
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005871 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005872 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005873 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305874 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005875 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 return;
5877 }
5878
5879 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005880#ifdef FEATURE_WLAN_TDLS
5881 if ((baCandidateCnt > pMac->lim.maxStation))
5882#else
5883 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5884#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005885 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305886 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005887 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005888 return;
5889 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005890
5891#ifdef FEATURE_WLAN_TDLS
5892 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5893 //AP capability
5894 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5895
5896 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5897 {
5898 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5899 if ((NULL == pSta) || (!pSta->valid))
5900 continue;
5901
5902 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5903 htCapable = pSta->mlmStaContext.htCapability;
5904 else
5905 htCapable = psessionEntry->htCapability;
5906
5907 if (htCapable)
5908 break;
5909 }
5910 if (!htCapable)
5911 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305912 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005913 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005914 return;
5915 }
5916#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005917
5918 //delete the complete dialoguetoken linked list
5919 limDeleteDialogueTokenList(pMac);
5920 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5921
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005922 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 {
5924 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005925 if ((NULL == pSta) || (!pSta->valid))
5926 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005927
5928 for (tid=0; tid<STACFG_MAX_TC; tid++)
5929 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005930 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 (pBaCandidate->baInfo[tid].fBaEnable))
5932 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305933 limLog(pMac, LOG1,
5934 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5935 pSta->staIndex, tid,
5936 pBaCandidate->baInfo[tid].startingSeqNum);
5937 limPostMlmAddBAReq(pMac, pSta, tid,
5938 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005939 }
5940 }
5941 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305942 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005943 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005944 return;
5945}
5946
5947
5948/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005949\fn limDeleteBASessions
5950\brief Deletes all the exisitng BA sessions for given session
5951 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005952\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005953\param tpPESession pSessionEntry
5954\param tANI_U32 baDirection
5955\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005956-------------------------------------------------------------*/
5957
5958void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005959limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305960 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005961{
5962 tANI_U32 i;
5963 tANI_U8 tid;
5964 tpDphHashNode pSta;
5965
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005966 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005967 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005968 limLog(pMac, LOGE, FL("Session does not exist"));
5969 }
5970 else
5971 {
5972 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005974 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5975 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5976 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5977 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005978 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005979 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005980 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005981 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5982 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005983 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005984 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5985 (baDirection & BA_INITIATOR))
5986 {
5987 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305988 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005989 pSessionEntry);
5990 }
5991 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5992 (baDirection & BA_RECIPIENT))
5993 {
5994 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305995 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005996 pSessionEntry);
5997 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005998 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005999 }
6000 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006001 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
6002 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
6003 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006004 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006005 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
6006 &pSessionEntry->dph.dphHashTable);
6007 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006008 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006009 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
6010 (baDirection & BA_INITIATOR))
6011 {
6012 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306013 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006014 pSessionEntry);
6015 }
6016 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
6017 (baDirection & BA_RECIPIENT))
6018 {
6019 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306020 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006021 pSessionEntry);
6022 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006023 }
6024 }
6025 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006026 }
6027}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006028
6029/** -------------------------------------------------------------
6030\fn limDelAllBASessions
6031\brief Deletes all the exisitng BA sessions.
6032\param tpAniSirGlobal pMac
6033\return None
6034-------------------------------------------------------------*/
6035
6036void limDelAllBASessions(tpAniSirGlobal pMac)
6037{
6038 tANI_U32 i;
6039 tpPESession pSessionEntry;
6040
6041 for (i = 0; i < pMac->lim.maxBssId; i++)
6042 {
6043 pSessionEntry = peFindSessionBySessionId(pMac, i);
6044 if (pSessionEntry)
6045 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306046 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
6047 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006048 }
6049 }
6050}
6051
6052/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006053\fn limProcessDelTsInd
6054\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
6055 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
6056\param tpAniSirGlobal pMac
6057\param tSirMsgQ limMsg
6058\return None
6059-------------------------------------------------------------*/
6060void
6061limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
6062{
6063 tpDphHashNode pSta;
6064 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
6065 tpSirDeltsReq pDelTsReq = NULL;
6066 tSirMacAddr peerMacAddr;
6067 tpSirDeltsReqInfo pDelTsReqInfo;
6068 tpLimTspecInfo pTspecInfo;
6069 tpPESession psessionEntry;
6070 tANI_U8 sessionId;
6071
6072if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
6073 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006074 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306075 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006076 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006077 return;
6078 }
6079
6080 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
6081 if(pTspecInfo->inuse == false)
6082 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006083 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07006084 goto error1;
6085 }
6086
6087 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
6088 if(pSta == NULL)
6089 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006090 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006091 pTspecInfo->assocId);
6092 goto error1;
6093 }
6094
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306095 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
6096 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006099 goto error1;
6100 }
6101
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306102 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006103
6104 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306105 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006106 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306107 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006108
6109
6110 //validate the req
6111 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
6112 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006113 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 goto error2;
6115 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306116 limLog(pMac, LOG1, "Sent DELTS request to station with "
6117 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
6118 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07006119
6120 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
6121 psessionEntry);
6122
6123 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306124 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
6125 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306127 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006128 goto error3;
6129 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306130 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006131
6132 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306133 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006134 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306135 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006136
6137 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
6138
6139error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306140 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07006141error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306142 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006143error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306144 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006145 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006146 return;
6147}
6148
6149/**
6150 * \brief Setup an A-MPDU/BA session
6151 *
6152 * \sa limPostMlmAddBAReq
6153 *
6154 * \param pMac The global tpAniSirGlobal object
6155 *
6156 * \param pStaDs DPH Hash Node object of peer STA
6157 *
6158 * \param tid TID for which a BA is being setup.
6159 * If this is set to 0xFFFF, then we retrieve
6160 * the default TID from the CFG
6161 *
6162 * \return eSIR_SUCCESS if setup completes successfully
6163 * eSIR_FAILURE is some problem is encountered
6164 */
6165tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6166 tpDphHashNode pStaDs,
6167 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6168{
6169 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006170 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006171 tpDialogueToken dialogueTokenNode;
6172 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006173
Jeff Johnson295189b2012-06-20 16:38:30 -07006174 // Check if the peer is a 11n capable STA
6175 // FIXME - Need a 11n peer indication in DPH.
6176 // For now, using the taurusPeer attribute
6177 //if( 0 == pStaDs->taurusPeer == )
6178 //return eSIR_SUCCESS;
6179
6180 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306181 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6182 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006183 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306184 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006185 status = eSIR_MEM_ALLOC_FAILED;
6186 goto returnFailure;
6187 }
6188
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306189 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006190
6191 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306192 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006193 pMlmAddBAReq->peerMacAddr,
6194 pStaDs->staAddr,
6195 sizeof( tSirMacAddr ));
6196
6197 // Update the TID
6198 pMlmAddBAReq->baTID = tid;
6199
6200 // Determine the supported BA policy of local STA
6201 // for the TID of interest
6202 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6203
6204 // BA Buffer Size
6205 // Requesting the ADDBA recipient to populate the size.
6206 // If ADDBA is accepted, a non-zero buffer size should
6207 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306208 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6209 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6210 {
6211 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6212 causing very low throughput in HT40 case */
6213 limLog( pMac, LOGW,
6214 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6215 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6216 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306217 else if (pMac->miracastVendorConfig)
6218 {
6219 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6220 {
6221 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6222 status = eSIR_FAILURE;
6223 goto returnFailure;
6224 }
6225
6226 pMlmAddBAReq->baBufferSize = val;
6227 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306228 else
6229 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006230
6231 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306232 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 -07006233 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6234 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306235 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006236
6237 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006238 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006239 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006240 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006241 status = eSIR_FAILURE;
6242 goto returnFailure;
6243 }
6244 pMlmAddBAReq->baTimeout = val; // In TU's
6245
6246 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006247 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006248 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6249 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6250
6251 // BA Starting Sequence Number
6252 pMlmAddBAReq->baSSN = startingSeqNum;
6253
6254 /* Update PE session Id*/
6255 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6256
6257 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6258
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006259 dialogueTokenNode = limAssignDialogueToken(pMac);
6260 if (NULL == dialogueTokenNode)
6261 {
6262 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6263 status = eSIR_FAILURE;
6264 goto returnFailure;
6265 }
6266
Jeff Johnson295189b2012-06-20 16:38:30 -07006267 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006268 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006269 dialogueTokenNode->assocId = pStaDs->assocId;
6270 dialogueTokenNode->tid = tid;
6271 // Send ADDBA Req to MLME
6272 limPostMlmMessage( pMac,
6273 LIM_MLM_ADDBA_REQ,
6274 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006275 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006276
6277returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306278 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006279 return status;
6280}
6281
6282/**
6283 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6284 * will then send an ADDBA Rsp to peer MAC entity
6285 * with the appropriate ADDBA status code
6286 *
6287 * \sa limPostMlmAddBARsp
6288 *
6289 * \param pMac The global tpAniSirGlobal object
6290 *
6291 * \param peerMacAddr MAC address of peer entity that will
6292 * be the recipient of this ADDBA Rsp
6293 *
6294 * \param baStatusCode ADDBA Rsp status code
6295 *
6296 * \param baDialogToken ADDBA Rsp dialog token
6297 *
6298 * \param baTID TID of interest
6299 *
6300 * \param baPolicy The BA policy
6301 *
6302 * \param baBufferSize The BA buffer size
6303 *
6304 * \param baTimeout BA timeout in TU's
6305 *
6306 * \return eSIR_SUCCESS if setup completes successfully
6307 * eSIR_FAILURE is some problem is encountered
6308 */
6309tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6310 tSirMacAddr peerMacAddr,
6311 tSirMacStatusCodes baStatusCode,
6312 tANI_U8 baDialogToken,
6313 tANI_U8 baTID,
6314 tANI_U8 baPolicy,
6315 tANI_U16 baBufferSize,
6316 tANI_U16 baTimeout,
6317 tpPESession psessionEntry)
6318{
6319tSirRetStatus status = eSIR_SUCCESS;
6320tpLimMlmAddBARsp pMlmAddBARsp;
6321
6322 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306323 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6324 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006325 {
6326 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306327 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 status );
6329
6330 status = eSIR_MEM_ALLOC_FAILED;
6331 goto returnFailure;
6332 }
6333
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306334 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006335
6336 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306337 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006338 pMlmAddBARsp->peerMacAddr,
6339 peerMacAddr,
6340 sizeof( tSirMacAddr ));
6341
6342 pMlmAddBARsp->baDialogToken = baDialogToken;
6343 pMlmAddBARsp->addBAResultCode = baStatusCode;
6344 pMlmAddBARsp->baTID = baTID;
6345 pMlmAddBARsp->baPolicy = baPolicy;
6346 pMlmAddBARsp->baBufferSize = baBufferSize;
6347 pMlmAddBARsp->baTimeout = baTimeout;
6348
6349 /* UPdate PE session ID*/
6350 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6351
6352 // Send ADDBA Rsp to MLME
6353 limPostMlmMessage( pMac,
6354 LIM_MLM_ADDBA_RSP,
6355 (tANI_U32 *) pMlmAddBARsp );
6356
6357returnFailure:
6358
6359 return status;
6360}
6361
6362/**
6363 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6364 * will then send an DELBA Ind to peer MAC entity
6365 * with the appropriate DELBA status code
6366 *
6367 * \sa limPostMlmDelBAReq
6368 *
6369 * \param pMac The global tpAniSirGlobal object
6370 *
6371 * \param pSta DPH Hash Node object of peer MAC entity
6372 * for which the BA session is being deleted
6373 *
6374 * \param baDirection DELBA direction
6375 *
6376 * \param baTID TID for which the BA session is being deleted
6377 *
6378 * \param baReasonCode DELBA Req reason code
6379 *
6380 * \return eSIR_SUCCESS if setup completes successfully
6381 * eSIR_FAILURE is some problem is encountered
6382 */
6383tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6384 tpDphHashNode pSta,
6385 tANI_U8 baDirection,
6386 tANI_U8 baTID,
6387 tSirMacReasonCodes baReasonCode,
6388 tpPESession psessionEntry)
6389{
6390tSirRetStatus status = eSIR_SUCCESS;
6391tpLimMlmDelBAReq pMlmDelBAReq;
6392tLimBAState curBaState;
6393
6394if(NULL == pSta)
6395 return eSIR_FAILURE;
6396
6397LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6398
6399 // Need to validate the current BA State.
6400 if( eLIM_BA_STATE_IDLE != curBaState)
6401 {
6402 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006403 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006404 baTID,
6405 curBaState);
6406
6407 status = eSIR_FAILURE;
6408 goto returnFailure;
6409 }
6410
6411 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306412 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6413 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006414 {
6415 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306416 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006417 status );
6418
6419 status = eSIR_MEM_ALLOC_FAILED;
6420 goto returnFailure;
6421 }
6422
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306423 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006424
6425 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306426 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006427 pMlmDelBAReq->peerMacAddr,
6428 pSta->staAddr,
6429 sizeof( tSirMacAddr ));
6430
6431 pMlmDelBAReq->baDirection = baDirection;
6432 pMlmDelBAReq->baTID = baTID;
6433 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6434
6435 /* Update PE session ID*/
6436 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6437
6438 //we don't have valid BA session for the given direction.
6439 // HDD wants to get the BA session deleted on PEER in this case.
6440 // in this case we just need to send DelBA to the peer.
6441 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6442 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6443 {
6444 // Send DELBA Ind over the air
6445 if( eSIR_SUCCESS !=
6446 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6447 status = eSIR_FAILURE;
6448
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306449 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006450 return status;
6451 }
6452
6453
6454 // Update the BA state in STA
6455 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6456
6457 // Send DELBA Req to MLME
6458 limPostMlmMessage( pMac,
6459 LIM_MLM_DELBA_REQ,
6460 (tANI_U32 *) pMlmDelBAReq );
6461
6462returnFailure:
6463
6464 return status;
6465}
6466
6467/**
6468 * \brief Send WDA_ADDBA_REQ to HAL, in order
6469 * to setup a new BA session with a peer
6470 *
6471 * \sa limPostMsgAddBAReq
6472 *
6473 * \param pMac The global tpAniSirGlobal object
6474 *
6475 * \param pSta Runtime, STA-related configuration cached
6476 * in the HashNode object
6477 *
6478 * \param baDialogToken The Action Frame dialog token
6479 *
6480 * \param baTID TID for which the BA session is being setup
6481 *
6482 * \param baPolicy BA Policy
6483 *
6484 * \param baBufferSize The requested BA buffer size
6485 *
6486 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6487 *
6488 * \param baSSN Starting Sequence Number for this BA session
6489 *
6490 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6491 *
6492 * \return none
6493 *
6494 */
6495tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6496 tpDphHashNode pSta,
6497 tANI_U8 baDialogToken,
6498 tANI_U8 baTID,
6499 tANI_U8 baPolicy,
6500 tANI_U16 baBufferSize,
6501 tANI_U16 baTimeout,
6502 tANI_U16 baSSN,
6503 tANI_U8 baDirection,
6504 tpPESession psessionEntry)
6505{
6506tpAddBAParams pAddBAParams = NULL;
6507tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006508tSirMsgQ msgQ;
6509
6510#ifdef WLAN_SOFTAP_VSTA_FEATURE
6511 // we can only do BA on "hard" STAs
6512 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6513 {
6514 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306515 limLog( pMac, LOGE,
6516 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006517 goto returnFailure;
6518 }
6519#endif //WLAN_SOFTAP_VSTA_FEATURE
6520
6521 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306522 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6523 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006524 {
6525 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306526 FL("AllocateMemory failed")
6527 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006528
6529 retCode = eSIR_MEM_ALLOC_FAILED;
6530 goto returnFailure;
6531 }
6532
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306533 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006534
6535 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306536 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006537 (void *) pAddBAParams->peerMacAddr,
6538 (void *) pSta->staAddr,
6539 sizeof( tSirMacAddr ));
6540
6541 // Populate the REQ parameters
6542 pAddBAParams->staIdx = pSta->staIndex;
6543 pAddBAParams->baDialogToken = baDialogToken;
6544 pAddBAParams->baTID = baTID;
6545 pAddBAParams->baPolicy = baPolicy;
6546 pAddBAParams->baBufferSize = baBufferSize;
6547 pAddBAParams->baTimeout = baTimeout;
6548 pAddBAParams->baSSN = baSSN;
6549 pAddBAParams->baDirection = baDirection;
6550 pAddBAParams->respReqd = 1;
6551
6552 /* UPdate PE session ID */
6553 pAddBAParams->sessionId = psessionEntry->peSessionId;
6554
6555 // Post WDA_ADDBA_REQ to HAL.
6556 msgQ.type = WDA_ADDBA_REQ;
6557 //
6558 // FIXME_AMPDU
6559 // A global counter (dialog token) is required to keep track of
6560 // all PE <-> HAL communication(s)
6561 //
6562 msgQ.reserved = 0;
6563 msgQ.bodyptr = pAddBAParams;
6564 msgQ.bodyval = 0;
6565
6566 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306567 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6568 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6569 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6570 pAddBAParams->baTimeout, pAddBAParams->baTID,
6571 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6572 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006573
6574 //defer any other message until we get response back.
6575 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6576
Jeff Johnsone7245742012-09-05 17:12:55 -07006577 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006578#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6579 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6580#endif //FEATURE_WLAN_DIAG_SUPPORT
6581
6582 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6583 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006584 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006585 retCode );
6586 else
6587 return retCode;
6588
6589returnFailure:
6590
6591 // Clean-up...
6592 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306593 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006594
6595 return retCode;
6596
6597}
6598
6599/**
6600 * \brief Send WDA_DELBA_IND to HAL, in order
6601 * to delete an existing BA session with peer
6602 *
6603 * \sa limPostMsgDelBAInd
6604 *
6605 * \param pMac The global tpAniSirGlobal object
6606 *
6607 * \param pSta Runtime, STA-related configuration cached
6608 * in the HashNode object
6609 *
6610 * \param baTID TID for which the BA session is being setup
6611 *
6612 * \param baDirection Identifies whether the DELBA Ind was
6613 * sent by the BA initiator or recipient
6614 *
6615 * \return none
6616 *
6617 */
6618tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6619 tpDphHashNode pSta,
6620 tANI_U8 baTID,
6621 tANI_U8 baDirection,
6622 tpPESession psessionEntry)
6623{
6624tpDelBAParams pDelBAParams = NULL;
6625tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006626tSirMsgQ msgQ;
6627
6628 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306629 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6630 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 {
6632 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306633 FL("AllocateMemory failed")
6634 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006635
6636 retCode = eSIR_MEM_ALLOC_FAILED;
6637 goto returnFailure;
6638 }
6639
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306640 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006641
6642 // Populate the REQ parameters
6643 pDelBAParams->staIdx = pSta->staIndex;
6644 pDelBAParams->baTID = baTID;
6645 pDelBAParams->baDirection = baDirection;
6646
6647 /* Update PE session ID */
6648
6649
6650 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6651 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6652
6653 // Post WDA_DELBA_IND to HAL.
6654 msgQ.type = WDA_DELBA_IND;
6655 //
6656 // FIXME:
6657 // A global counter (dialog token) is required to keep track of
6658 // all PE <-> HAL communication(s)
6659 //
6660 msgQ.reserved = 0;
6661 msgQ.bodyptr = pDelBAParams;
6662 msgQ.bodyval = 0;
6663
6664 limLog( pMac, LOGW,
6665 FL( "Sending SIR_HAL_DELBA_IND..." ));
6666
Jeff Johnsone7245742012-09-05 17:12:55 -07006667 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006668#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6669 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6670#endif //FEATURE_WLAN_DIAG_SUPPORT
6671
6672 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6673 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006674 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006675 retCode );
6676 else
6677 {
6678 // Update LIM's internal cache...
6679 if( eBA_INITIATOR == baDirection)
6680 {
6681 pSta->tcCfg[baTID].fUseBATx = 0;
6682 pSta->tcCfg[baTID].txBufSize = 0;
6683 }
6684 else
6685 {
6686 pSta->tcCfg[baTID].fUseBARx = 0;
6687 pSta->tcCfg[baTID].rxBufSize = 0;
6688 }
6689
6690 return retCode;
6691 }
6692
6693returnFailure:
6694
6695 // Clean-up...
6696 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306697 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006698
6699 return retCode;
6700
6701}
6702
6703/**
6704 * @function : limPostSMStateUpdate()
6705 *
6706 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6707 *
6708 * LOGIC:
6709 *
6710 * ASSUMPTIONS:
6711 * NA
6712 *
6713 * NOTE:
6714 * NA
6715 *
6716 * @param pMac - Pointer to Global MAC structure
6717 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6718 * @return None
6719 */
6720tSirRetStatus
6721limPostSMStateUpdate(tpAniSirGlobal pMac,
6722 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6723{
6724 tSirRetStatus retCode = eSIR_SUCCESS;
6725 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006726 tpSetMIMOPS pMIMO_PSParams;
6727
6728 msgQ.reserved = 0;
6729 msgQ.type = WDA_SET_MIMOPS_REQ;
6730
6731 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306732 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6733 if ( NULL == pMIMO_PSParams )
6734 {
6735 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 return eSIR_MEM_ALLOC_FAILED;
6737 }
6738
6739 pMIMO_PSParams->htMIMOPSState = state;
6740 pMIMO_PSParams->staIdx = staIdx;
6741 pMIMO_PSParams->fsendRsp = true;
6742 msgQ.bodyptr = pMIMO_PSParams;
6743 msgQ.bodyval = 0;
6744
6745 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6746
Jeff Johnsone7245742012-09-05 17:12:55 -07006747 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006748 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6749 if (eSIR_SUCCESS != retCode)
6750 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006751 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306752 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 return retCode;
6754 }
6755
6756 return retCode;
6757}
6758
6759void limPktFree (
6760 tpAniSirGlobal pMac,
6761 eFrameType frmType,
6762 tANI_U8 *pRxPacketInfo,
6763 void *pBody)
6764{
6765 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006766}
6767
6768/**
6769 * limGetBDfromRxPacket()
6770 *
6771 *FUNCTION:
6772 * This function is called to get pointer to Polaris
6773 * Buffer Descriptor containing MAC header & other control
6774 * info from the body of the message posted to LIM.
6775 *
6776 *LOGIC:
6777 * NA
6778 *
6779 *ASSUMPTIONS:
6780 * NA
6781 *
6782 *NOTE:
6783 * NA
6784 *
6785 * @param body - Received message body
6786 * @param pRxPacketInfo - Pointer to received BD
6787 * @return None
6788 */
6789
6790void
6791limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6792{
Jeff Johnson295189b2012-06-20 16:38:30 -07006793 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006794} /*** end limGetBDfromRxPacket() ***/
6795
6796
6797
6798
6799
6800void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6801{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306802 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006803}
6804
6805
6806void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6807{
6808 tANI_U8 i;
6809 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6810
6811 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6812 {
6813 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6814 {
6815 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6816 fFound = eANI_BOOLEAN_TRUE;
6817 break;
6818 }
6819 }
6820 if(eANI_BOOLEAN_FALSE == fFound)
6821 {
6822 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6823 {
6824 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6825 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6826 }
6827 else
6828 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006829 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006830 }
6831 }
6832}
6833
6834
6835/**
6836 * @function : limIsChannelValidForChannelSwitch()
6837 *
6838 * @brief : This function checks if the channel to which AP
6839 * is expecting us to switch, is a valid channel for us.
6840 * LOGIC:
6841 *
6842 * ASSUMPTIONS:
6843 * NA
6844 *
6845 * NOTE:
6846 * NA
6847 *
6848 * @param pMac - Pointer to Global MAC structure
6849 * @param channel - New channel to which we are expected to move
6850 * @return None
6851 */
6852tAniBool
6853limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6854{
6855 tANI_U8 index;
6856 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6857 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6858
6859 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6860 (tANI_U8 *)validChannelList,
6861 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6862 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006863 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006864 return (eSIR_FALSE);
6865 }
6866
6867 for(index = 0; index < validChannelListLen; index++)
6868 {
6869 if(validChannelList[index] == channel)
6870 return (eSIR_TRUE);
6871 }
6872
6873 /* channel does not belong to list of valid channels */
6874 return (eSIR_FALSE);
6875}
6876
6877/**------------------------------------------------------
6878\fn __limFillTxControlParams
6879\brief Fill the message for stopping/resuming tx.
6880
6881\param pMac
6882\param pTxCtrlMsg - Pointer to tx control message.
6883\param type - Which way we want to stop/ resume tx.
6884\param mode - To stop/resume.
6885 -------------------------------------------------------*/
6886static eHalStatus
6887__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6888 tLimQuietTxMode type, tLimControlTx mode)
6889{
6890
6891 //TBD-RAJESH HOW TO GET sessionEntry?????
6892 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6893
6894 if (mode == eLIM_STOP_TX)
6895 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6896 else
6897 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6898
6899 switch (type)
6900 {
6901 case eLIM_TX_ALL:
6902 /** Stops/resumes transmission completely */
6903 pTxCtrlMsg->fCtrlGlobal = 1;
6904 break;
6905
6906 case eLIM_TX_BSS_BUT_BEACON:
6907 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6908 * stop beacon transmission.
6909 */
6910 pTxCtrlMsg->ctrlBss = 1;
6911 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6912 break;
6913
6914 case eLIM_TX_STA:
6915 /** Memory for station bitmap is allocated dynamically in caller of this
6916 * so decode properly here and fill the bitmap. Now not implemented,
6917 * fall through.
6918 */
6919 case eLIM_TX_BSS:
6920 //Fall thru...
6921 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006922 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006923 return eHAL_STATUS_FAILURE;
6924 }
6925
6926 return eHAL_STATUS_SUCCESS;
6927}
6928
6929/**
6930 * @function : limFrameTransmissionControl()
6931 *
6932 * @brief : This API is called by the user to halt/resume any frame
6933 * transmission from the device. If stopped, all frames will be
6934 * queued starting from hardware. Then back-pressure
6935 * is built till the driver.
6936 * LOGIC:
6937 *
6938 * ASSUMPTIONS:
6939 * NA
6940 *
6941 * NOTE:
6942 * NA
6943 *
6944 * @param pMac - Pointer to Global MAC structure
6945 * @return None
6946 */
6947void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6948{
6949
6950 eHalStatus status = eHAL_STATUS_FAILURE;
6951 tpTxControlParams pTxCtrlMsg;
6952 tSirMsgQ msgQ;
6953 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6954
6955 /** Allocate only required number of bytes for station bitmap
6956 * Make it to align to 4 byte boundary */
6957 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6958
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306959 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6960 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006961 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306962 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006963 return;
6964 }
6965
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306966 vos_mem_set((void *) pTxCtrlMsg,
6967 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006968 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6969 if (status != eHAL_STATUS_SUCCESS)
6970 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306971 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006972 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006973 return;
6974 }
6975
6976 msgQ.bodyptr = (void *) pTxCtrlMsg;
6977 msgQ.bodyval = 0;
6978 msgQ.reserved = 0;
6979 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6980
Jeff Johnsone7245742012-09-05 17:12:55 -07006981 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006982 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6983 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306984 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006985 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006986 return;
6987 }
6988
6989 if (mode == eLIM_STOP_TX)
6990 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306991 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006992 }
6993 else
6994 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306995 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006996 }
6997 return;
6998}
6999
7000
7001/**
7002 * @function : limRestorePreChannelSwitchState()
7003 *
7004 * @brief : This API is called by the user to undo any
7005 * specific changes done on the device during
7006 * channel switch.
7007 * LOGIC:
7008 *
7009 * ASSUMPTIONS:
7010 * NA
7011 *
7012 * NOTE:
7013 * NA
7014 *
7015 * @param pMac - Pointer to Global MAC structure
7016 * @return None
7017 */
7018
7019tSirRetStatus
7020limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
7021{
7022
7023 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007024 tANI_U32 val = 0;
7025
7026 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7027 return retCode;
7028
7029 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007030 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007031
Surabhi Vishnoic5cfde02020-07-24 17:00:47 +05307032 /* Restore the frame transmission, if switched channel is NON-DFS.
7033 * Else tx should be resumed after receiving first beacon on DFS channel
7034 */
7035 if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
7036 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7037 else
7038 psessionEntry->gLimSpecMgmt.dfs_channel_csa = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07007039
7040 /* Free to enter BMPS */
7041 limSendSmePostChannelSwitchInd(pMac);
7042
7043 //Background scan is now enabled by SME
7044 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7045 {
7046 /* Enable background scan if already enabled, else don't bother */
7047 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7048 &val)) != eSIR_SUCCESS)
7049
7050 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007051 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007052 return (retCode);
7053 }
7054
7055 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7056 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007057 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7058 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007059 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7060 {
7061 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7062 return (eSIR_FAILURE);
7063 }
7064
7065 }
7066 }
7067
7068 /* Enable heartbeat timer */
7069 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7070 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007071 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7072 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
7073 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
7074 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007075 {
7076 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7077 return (eSIR_FAILURE);
7078 }
7079 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007080 return (retCode);
7081}
7082
7083
7084/**--------------------------------------------
7085\fn limRestorePreQuietState
7086\brief Restore the pre quiet state
7087
7088\param pMac
7089\return NONE
7090---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007091tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07007092{
7093
7094 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007095 tANI_U32 val = 0;
7096
7097 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
7098 return retCode;
7099
7100 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007101 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007102
7103 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07007104 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07007105 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7106
7107
7108 //Background scan is now enabled by SME
7109 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7110 {
7111 /* Enable background scan if already enabled, else don't bother */
7112 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7113 &val)) != eSIR_SUCCESS)
7114
7115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007116 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007117 return (retCode);
7118 }
7119
7120 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7121 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007122 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007123 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7124 {
7125 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7126 return (eSIR_FAILURE);
7127 }
7128
7129 }
7130 }
7131
7132 /* Enable heartbeat timer */
7133 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7134 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007135 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007136 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07007137 {
7138 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7139 return (eSIR_FAILURE);
7140 }
7141 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 return (retCode);
7143}
7144
7145
7146/**
7147 * @function: limPrepareFor11hChannelSwitch()
7148 *
7149 * @brief : This API is called by the user to prepare for
7150 * 11h channel switch. As of now, the API does
7151 * very minimal work. User can add more into the
7152 * same API if needed.
7153 * LOGIC:
7154 *
7155 * ASSUMPTIONS:
7156 * NA
7157 *
7158 * NOTE:
7159 * NA
7160 *
7161 * @param pMac - Pointer to Global MAC structure
7162 * @param psessionEntry
7163 * @return None
7164 */
7165void
7166limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7167{
Jeff Johnson295189b2012-06-20 16:38:30 -07007168 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7169 return;
7170
7171 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007172 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007173
7174 /* Disable, Stop background scan if enabled and running */
7175 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7176
7177 /* Stop heart-beat timer to stop heartbeat disassociation */
7178 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7179
7180 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7181 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7182 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007183 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007184 /* Stop ongoing scanning if any */
7185 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7186 {
7187 //Set the resume channel to Any valid channel (invalid).
7188 //This will instruct HAL to set it to any previous valid channel.
7189 peSetResumeChannel(pMac, 0, 0);
7190 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7191 }
7192 else
7193 {
7194 limRestorePreChannelSwitchState(pMac, psessionEntry);
7195 }
7196 return;
7197 }
7198 else
7199 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007200 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Surabhi Vishnoic04b4e72020-08-03 21:01:18 +05307201
7202 /* Stop roam scan during CAC period in DFS channels */
7203 if(limIsconnectedOnDFSChannel(
7204 psessionEntry->gLimChannelSwitch.primaryChannel)) {
7205#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7206 if (pMac->roam.configParam.isRoamOffloadScanEnabled) {
7207 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP,
7208 REASON_DISCONNECTED);
7209 }
7210#endif
7211 psessionEntry->gLimSpecMgmt.dfs_channel_csa = true;
7212 }
7213
Jeff Johnson295189b2012-06-20 16:38:30 -07007214 /** We are safe to switch channel at this point */
7215 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7216 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007217}
7218
7219
7220
7221/**----------------------------------------------------
7222\fn limGetNwType
7223
7224\brief Get type of the network from data packet or beacon
7225\param pMac
7226\param channelNum - Channel number
7227\param type - Type of packet.
7228\param pBeacon - Pointer to beacon or probe response
7229
7230\return Network type a/b/g.
7231-----------------------------------------------------*/
7232tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7233{
7234 tSirNwType nwType = eSIR_11B_NW_TYPE;
7235
7236 if (type == SIR_MAC_DATA_FRAME)
7237 {
7238 if ((channelNum > 0) && (channelNum < 15))
7239 {
7240 nwType = eSIR_11G_NW_TYPE;
7241 }
7242 else
7243 {
7244 nwType = eSIR_11A_NW_TYPE;
7245 }
7246 }
7247 else
7248 {
7249 if ((channelNum > 0) && (channelNum < 15))
7250 {
7251 int i;
7252 // 11b or 11g packet
7253 // 11g iff extended Rate IE is present or
7254 // if there is an A rate in suppRate IE
7255 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7256 {
7257 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7258 {
7259 nwType = eSIR_11G_NW_TYPE;
7260 break;
7261 }
7262 }
7263 if (pBeacon->extendedRatesPresent)
7264 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007265 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007266 nwType = eSIR_11G_NW_TYPE;
7267 }
7268 }
7269 else
7270 {
7271 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007272 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007273 nwType = eSIR_11A_NW_TYPE;
7274 }
7275 }
7276 return nwType;
7277}
7278
7279
7280/**---------------------------------------------------------
7281\fn limGetChannelFromBeacon
7282\brief To extract channel number from beacon
7283
7284\param pMac
7285\param pBeacon - Pointer to beacon or probe rsp
7286\return channel number
7287-----------------------------------------------------------*/
7288tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7289{
7290 tANI_U8 channelNum = 0;
7291
7292 if (pBeacon->dsParamsPresent)
7293 channelNum = pBeacon->channelNumber;
7294 else if(pBeacon->HTInfo.present)
7295 channelNum = pBeacon->HTInfo.primaryChannel;
7296 else
7297 channelNum = pBeacon->channelNumber;
7298
7299 return channelNum;
7300}
7301
7302
7303/** ---------------------------------------------------------
7304\fn limSetTspecUapsdMask
7305\brief This function sets the PE global variable:
7306\ 1) gUapsdPerAcTriggerEnableMask and
7307\ 2) gUapsdPerAcDeliveryEnableMask
7308\ based on the user priority field and direction field
7309\ in the TS Info Fields.
7310\
7311\ An AC is a trigger-enabled AC if the PSB subfield
7312\ is set to 1 in the uplink direction.
7313\ An AC is a delivery-enabled AC if the PSB subfield
7314\ is set to 1 in the down-link direction.
7315\
7316\param tpAniSirGlobal pMac
7317\param tSirMacTSInfo pTsInfo
7318\param tANI_U32 action
7319\return None
7320 ------------------------------------------------------------*/
7321void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7322{
7323 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7324 tANI_U16 direction = pTsInfo->traffic.direction;
7325 tANI_U8 ac = upToAc(userPrio);
7326
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307327 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 -07007328
7329 /* Converting AC to appropriate Uapsd Bit Mask
7330 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7331 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7332 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7333 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7334 */
7335 ac = ((~ac) & 0x3);
7336
7337 if (action == CLEAR_UAPSD_MASK)
7338 {
7339 if (direction == SIR_MAC_DIRECTION_UPLINK)
7340 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7341 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7342 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7343 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7344 {
7345 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7346 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7347 }
7348 }
7349 else if (action == SET_UAPSD_MASK)
7350 {
7351 if (direction == SIR_MAC_DIRECTION_UPLINK)
7352 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7353 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7354 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7355 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7356 {
7357 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7358 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7359 }
7360 }
7361
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007362 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7363 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007364
7365 return;
7366}
7367
7368
7369
7370void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7371{
7372
7373 tANI_U8 i;
7374 for(i =0;i < pMac->lim.maxBssId;i++)
7375 {
7376 if(pMac->lim.gpSession[i].valid == TRUE )
7377 {
7378 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7379 {
7380 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7381 break;
7382 }
7383
7384 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7385 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7386 {
7387 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7388 }
7389 }
7390 }
7391 for(i=0; i< pMac->lim.maxBssId; i++)
7392 {
7393 if(pMac->lim.gpSession[i].valid == TRUE )
7394 {
7395 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7396 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7397 {
7398 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7399 {
7400 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007401 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007402 i);)
7403 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7404 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7405 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7406 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007407 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007408 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7409 }
7410 break;
7411 }
7412 }
7413 }
7414 }
7415}
7416
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007417void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7418{
7419 if(psessionEntry->valid == TRUE )
7420 {
7421 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7422 {
7423 limIbssHeartBeatHandle(pMac,psessionEntry);
7424 }
7425 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7426 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7427 {
7428 limHandleHeartBeatFailure(pMac,psessionEntry);
7429 }
7430 }
7431 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7432 and the other things again */
7433 if(psessionEntry->valid == TRUE )
7434 {
7435 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7436 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7437 {
7438 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7439 {
7440 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7441 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7442 psessionEntry->bssIdx);)
7443 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7444 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7445 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7446 {
7447 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7448 limReactivateHeartBeatTimer(pMac, psessionEntry);
7449 }
7450 }
7451 }
7452 }
7453}
7454
7455
Jeff Johnson295189b2012-06-20 16:38:30 -07007456tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7457{
7458 tANI_U8 i;
7459 for(i =0;i < pMac->lim.maxBssId;i++)
7460 {
7461 if(pMac->lim.gpSession[i].valid == TRUE )
7462 {
7463 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7464 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7465 {
7466 return pMac->lim.gpSession[i].currentOperChannel;
7467 }
7468 }
7469 }
7470 return 0;
7471}
7472
7473void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7474{
7475
7476 tpPESession psessionEntry;
7477// tANI_U8 sessionId;
7478 tpAddStaParams pAddStaParams;
7479
7480 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7481
7482 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007484 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307485 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007486 return;
7487 }
7488 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7489 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007490#ifdef FEATURE_WLAN_TDLS
7491 else if(pMac->lim.gLimAddStaTdls)
7492 {
7493 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7494 pMac->lim.gLimAddStaTdls = FALSE ;
7495 }
7496#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007497 else
7498 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7499
7500}
7501
7502
7503void limUpdateBeacon(tpAniSirGlobal pMac)
7504{
7505 tANI_U8 i;
7506
7507 for(i =0;i < pMac->lim.maxBssId;i++)
7508 {
7509 if(pMac->lim.gpSession[i].valid == TRUE )
7510 {
7511 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7512 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7513 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7514 )
7515 {
7516 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7517 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7518 }
7519 else
7520 {
7521 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7522 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7523 {
7524
7525 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7526 {
7527 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7528 }
7529 }
7530 }
7531 }
7532 }
7533}
7534
7535void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7536{
7537 tANI_U8 i;
7538 tpPESession psessionEntry;
7539 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7540 for(i =0; i < pMac->lim.maxBssId; i++)
7541 {
7542 if(pMac->lim.gpSession[i].valid == TRUE)
7543 {
7544 psessionEntry = &pMac->lim.gpSession[i];
7545 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7546 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307547 limLog(pMac, LOGE,
7548 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7549 psessionEntry->limSmeState, psessionEntry->limMlmState,
7550 psessionEntry->LimRxedBeaconCntDuringHB,
7551 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007552#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7553 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7554#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007555 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7556 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307557 /* Disconnect even if we have not received a single beacon
7558 * after connection.
7559 */
7560 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7561 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307562 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7563 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007564 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007565 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007566 /* AP did not respond to Probe Request. Tear down link with it.*/
7567 limTearDownLinkWithAp(pMac,
7568 psessionEntry->peSessionId,
7569 eSIR_BEACON_MISSED);
7570 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7571 }
7572 else // restart heartbeat timer
7573 {
7574 limReactivateHeartBeatTimer(pMac, psessionEntry);
7575 }
7576 }
7577 else
7578 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007579 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007580 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7581 limReactivateHeartBeatTimer(pMac, psessionEntry);
7582 }
7583
7584 }
7585 }
7586 }
7587 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7588 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7589}
7590
7591
7592/*
7593* This function assumes there will not be more than one IBSS session active at any time.
7594*/
7595tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7596{
7597 tANI_U8 i;
7598
7599 for(i =0;i < pMac->lim.maxBssId;i++)
7600 {
7601 if( (pMac->lim.gpSession[i].valid) &&
7602 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7603 return (&pMac->lim.gpSession[i]);
7604 }
7605
7606 return NULL;
7607}
7608
7609tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7610{
7611 tANI_U8 i;
7612
7613 for(i =0;i < pMac->lim.maxBssId;i++)
7614 {
7615 if( (pMac->lim.gpSession[i].valid) &&
7616 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7617 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7618 return (&pMac->lim.gpSession[i]);
7619 }
7620
7621 return NULL;
7622}
7623
7624/**---------------------------------------------------------
7625\fn limHandleDeferMsgError
7626\brief handles error scenario, when the msg can not be deferred.
7627\param pMac
7628\param pLimMsg LIM msg, which could not be deferred.
7629\return void
7630-----------------------------------------------------------*/
7631
7632void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7633{
7634 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7635 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307636 /*Decrement the Pending count before droping */
7637 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007638 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7639 }
7640 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007641 {
7642 vos_mem_free( pLimMsg->bodyptr);
7643 pLimMsg->bodyptr = NULL;
7644 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007645}
7646
7647
7648#ifdef FEATURE_WLAN_DIAG_SUPPORT
7649/**---------------------------------------------------------
7650\fn limDiagEventReport
7651\brief This function reports Diag event
7652\param pMac
7653\param eventType
7654\param bssid
7655\param status
7656\param reasonCode
7657\return void
7658-----------------------------------------------------------*/
7659void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7660{
7661 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7662 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7663
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307664 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007665
7666 if (NULL == pSessionEntry)
7667 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307668 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007669 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7670 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7671
7672 }
7673 else
7674 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307675 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7677 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7678 }
7679 peEvent.event_type = eventType;
7680 peEvent.status = status;
7681 peEvent.reason_code = reasonCode;
7682
7683 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7684 return;
7685}
7686
7687#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7688
7689void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7690{
7691
7692 tpAddStaSelfParams pAddStaSelfParams;
7693 tSirMsgQ mmhMsg;
7694 tpSirSmeAddStaSelfRsp pRsp;
7695
7696
7697 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7698
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307699 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7700 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007701 {
7702 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307703 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7704 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007705 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007706 return;
7707 }
7708
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307709 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007710
7711 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7712 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7713 pRsp->status = pAddStaSelfParams->status;
7714
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307715 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007716
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307717 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007718 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007719
7720 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7721 mmhMsg.bodyptr = pRsp;
7722 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307723 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007724 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7725
7726}
7727
7728void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7729{
7730
7731 tpDelStaSelfParams pDelStaSelfParams;
7732 tSirMsgQ mmhMsg;
7733 tpSirSmeDelStaSelfRsp pRsp;
7734
7735
7736 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7737
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307738 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7739 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007740 {
7741 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307742 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7743 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007744 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007745 return;
7746 }
7747
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307748 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007749
7750 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7751 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7752 pRsp->status = pDelStaSelfParams->status;
7753
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307754 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007755
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307756 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007757 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007758
7759 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7760 mmhMsg.bodyptr = pRsp;
7761 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307762 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007763 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7764
7765}
7766
7767/***************************************************************
7768* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7769* To unmap the channel to reverse the effect of mapping
7770* a band channel in hal .Mapping was done hal to overcome the
7771* limitation of the rxbd which use only 4 bit for channel number.
7772*****************************************************************/
7773tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7774{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007775#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007776 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007777 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7778 return aUnsortedChannelList[mapChannel -1];
7779 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007780#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007781 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007782#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007783 return abChannel[mapChannel -1];
7784 else
7785 return 0;
7786}
7787
7788
7789v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7790{
7791 int left = length;
7792 v_U8_t *ptr = pIes;
7793 v_U8_t elem_id;
7794 v_U16_t elem_len;
7795
7796 while(left >= (size_of_len_field+1))
7797 {
7798 elem_id = ptr[0];
7799 if (size_of_len_field == TWO_BYTE)
7800 {
7801 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7802 }
7803 else
7804 {
7805 elem_len = ptr[1];
7806 }
7807
7808
7809 left -= (size_of_len_field+1);
7810 if(elem_len > left)
7811 {
7812 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007813 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007814 eid,elem_len,left);
7815 return NULL;
7816 }
7817 if (elem_id == eid)
7818 {
7819 return ptr;
7820 }
7821
7822 left -= elem_len;
7823 ptr += (elem_len + (size_of_len_field+1));
7824 }
7825 return NULL;
7826}
7827
7828/* return NULL if oui is not found in ie
7829 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7830 */
7831v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7832{
7833 int left = ie_len;
7834 v_U8_t *ptr = ie;
7835 v_U8_t elem_id, elem_len;
7836
7837 while(left >= 2)
7838 {
7839 elem_id = ptr[0];
7840 elem_len = ptr[1];
7841 left -= 2;
7842 if(elem_len > left)
7843 {
7844 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007845 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 elem_id,elem_len,left);
7847 return NULL;
7848 }
7849 if (SIR_MAC_EID_VENDOR == elem_id)
7850 {
7851 if(memcmp(&ptr[2], oui, oui_size)==0)
7852 return ptr;
7853 }
7854
7855 left -= elem_len;
7856 ptr += (elem_len + 2);
7857 }
7858 return NULL;
7859}
7860
Jeff Johnson295189b2012-06-20 16:38:30 -07007861//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7862
7863v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7864{
7865 int length = 0;
7866 tANI_U8 *ptr = ie;
7867
7868 ptr[length++] = SIR_MAC_EID_VENDOR;
7869 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307870 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7871 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007872 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7873}
7874
7875//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7876
7877v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7878{
7879 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007880
7881 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7882 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7883 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307884 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007885 noaStream + noaLen - overFlowLen, overFlowLen);
7886 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7887 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307888 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007889 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307890 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7891 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007892 }
7893
Jeff Johnson295189b2012-06-20 16:38:30 -07007894 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7895
7896}
7897
7898//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7899v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7900{
7901 v_U8_t len=0;
7902
7903 v_U8_t *pBody = pNoaStream;
7904
7905
7906 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7907 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7908 {
7909 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7910 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7911 )
7912 return 0; //No NoA Descriptor then return 0
7913
7914
7915 pBody[0] = SIR_P2P_NOA_ATTR;
7916
7917 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7918 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7919 len = 5;
7920 pBody += len;
7921
7922
7923 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7924 {
7925 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7926 pBody += 1;
7927 len +=1;
7928
7929 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7930 pBody += sizeof(tANI_U32);
7931 len +=4;
7932
7933 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7934 pBody += sizeof(tANI_U32);
7935 len +=4;
7936
7937 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7938 pBody += sizeof(tANI_U32);
7939 len +=4;
7940
7941 }
7942
7943 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7944 {
7945 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7946 pBody += 1;
7947 len +=1;
7948
7949 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7950 pBody += sizeof(tANI_U32);
7951 len +=4;
7952
7953 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7954 pBody += sizeof(tANI_U32);
7955 len +=4;
7956
7957 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7958 pBody += sizeof(tANI_U32);
7959 len +=4;
7960
7961 }
7962
7963
7964 pBody = pNoaStream + 1;
7965 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7966
7967 return (len);
7968
7969 }
7970 return 0;
7971
7972}
Jeff Johnsone7245742012-09-05 17:12:55 -07007973
7974void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007975{
7976
7977 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007978 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007979}
Jeff Johnsone7245742012-09-05 17:12:55 -07007980
Jeff Johnson295189b2012-06-20 16:38:30 -07007981/*--------------------------------------------------------------------------
7982
7983 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7984
Jeff Johnsone7245742012-09-05 17:12:55 -07007985 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7986 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007987
7988 \param pMac - pointer to global adapter context
7989 \return - channel to scan from valid session else zero.
7990
7991 \sa
7992
7993 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007994void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007995{
7996
7997 //Rationale - this could be the suspend/resume for assoc and it is essential that
7998 //the new BSS is active for some time. Other BSS was anyway suspended.
7999 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
8000 //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 -07008001 //and hence should be ok. Need to discuss this further
8002 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07008003 {
8004 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07008005 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07008006 }
8007 else
8008 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008009 *resumeChannel = pMac->lim.gResumeChannel;
8010 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07008011 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008012 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07008013}
8014
Viral Modid86bde22012-12-10 13:09:21 -08008015tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
8016{
8017 tANI_U8 i;
8018 for(i =0; i < pMac->lim.maxBssId; i++)
8019 {
8020 if(pMac->lim.gpSession[i].valid == TRUE)
8021 {
8022 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
8023 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
8024 )
8025 {
8026 return TRUE;
8027 }
8028 }
8029 }
8030 return FALSE;
8031}
Jeff Johnsone7245742012-09-05 17:12:55 -07008032
Jeff Johnson295189b2012-06-20 16:38:30 -07008033
8034tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
8035{
8036 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
8037 {
8038 return eANI_BOOLEAN_TRUE;
8039 }
8040 else
8041 {
8042 return eANI_BOOLEAN_FALSE;
8043 }
8044}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07008045
Sandeep Puligilla60342762014-01-30 21:05:37 +05308046/**
8047 * \brief verify the changes in channel bonding
8048 *
8049 * \param pMac Pointer to the global MAC structure
8050 *
8051 * \param psessionEntry session entry
8052 * beaconSecChanWidth Secondary channel width
8053 * advertized in beacon
8054 * currentSecChanWidth Current configured width
8055 * staId Station Id
8056 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
8057 */
8058tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
8059 tpPESession psessionEntry,
8060 tANI_U8 beaconSecChanWidth,
8061 tANI_U8 currentSecChanWidth,
8062 tANI_U8 staId)
8063{
8064 tUpdateVHTOpMode tempParam;
8065 tANI_BOOLEAN fCbMode24G = FALSE;
8066 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
8067
8068 /* Moving from HT40 to HT20 operation*/
8069 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
8070 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
8071 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
8072 {
8073 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
8074 tempParam.staId = staId;
8075 fCbMode24G = TRUE;
8076 }
8077
8078 /* Moving from HT20 to HT40 operation*/
8079 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
8080 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
8081 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
8082 {
8083 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
8084 tempParam.staId = staId;
8085 fCbMode24G = TRUE;
8086 }
8087
8088 if (TRUE == fCbMode24G)
8089 {
8090 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8091 "Changing CBMODE to = %d staId = %d",
8092 tempParam.opMode, tempParam.staId );
8093 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
8094 status = eANI_BOOLEAN_TRUE;
8095 }
8096 return status;
8097}
8098
Mohit Khanna4a70d262012-09-11 16:30:12 -07008099#ifdef WLAN_FEATURE_11AC
8100tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
8101{
8102 tUpdateVHTOpMode tempParam;
8103
8104 tempParam.opMode = chanWidth;
8105 tempParam.staId = staId;
8106
8107 limSendModeUpdate( pMac, &tempParam, psessionEntry );
8108
8109 return eANI_BOOLEAN_TRUE;
8110}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008111#endif
8112
krunal soni45b9eb62014-03-26 12:54:25 -07008113void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
8114 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008115{
8116 tANI_U8 val=0;
8117
krunal soni45b9eb62014-03-26 12:54:25 -07008118 //only 2.4G band should have short slot enable, rest it should be default
8119 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008120 {
krunal soni45b9eb62014-03-26 12:54:25 -07008121 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008122 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07008123 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008124 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
8125 {
8126 val = true;
8127 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008128 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008129 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008130 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008131 // Joining BSS.
8132 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008133 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008134 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008135 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008136 // Reassociating with AP.
8137 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008138 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008139 }
krunal soni45b9eb62014-03-26 12:54:25 -07008140 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008141 {
krunal soni45b9eb62014-03-26 12:54:25 -07008142 /*
8143 * 11B does not short slot and short slot is default
8144 * for 11A mode. Hence, not need to set this bit
8145 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008146 val = false;
8147 }
krunal soni45b9eb62014-03-26 12:54:25 -07008148
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07008149 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07008150 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008151}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308152
Kalikinkar dhara205da782014-03-21 15:49:32 -07008153void limUtilsframeshtons(tpAniSirGlobal pCtx,
8154 tANI_U8 *pOut,
8155 tANI_U16 pIn,
8156 tANI_U8 fMsb)
8157{
8158 (void)pCtx;
8159#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8160 if ( !fMsb )
8161 {
8162 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8163 }
8164 else
8165 {
8166 *pOut = ( pIn & 0xff00 ) >> 8;
8167 *( pOut + 1 ) = pIn & 0xff;
8168 }
8169#else
8170 if ( !fMsb )
8171 {
8172 *pOut = pIn & 0xff;
8173 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8174 }
8175 else
8176 {
8177 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8178 }
8179#endif
8180}
8181
8182void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8183 tANI_U8 *pOut,
8184 tANI_U32 pIn,
8185 tANI_U8 fMsb)
8186{
8187 (void)pCtx;
8188#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8189 if ( !fMsb )
8190 {
8191 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8192 }
8193 else
8194 {
8195 *pOut = ( pIn & 0xff000000 ) >> 24;
8196 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8197 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8198 *( pOut + 3 ) = ( pIn & 0x000000ff );
8199 }
8200#else
8201 if ( !fMsb )
8202 {
8203 *( pOut ) = ( pIn & 0x000000ff );
8204 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8205 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8206 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8207 }
8208 else
8209 {
8210 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8211 }
8212#endif
8213}
8214
8215
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308216/**--------------------------------------------
8217\fn limUpdateOBSSScanParams
8218\brief Updates OBSS SCAN IE parameters to session
8219
8220\param psessionEntry - Session Entry
8221\return NONE
8222---------------------------------------------*/
8223void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8224 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8225{
8226 /*If the recieved value is not in the range specified by the Specification
8227 then it will be the default value configured through cfg */
8228 if (( pOBSSScanParameters->obssScanActiveDwell >
8229 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8230 ( pOBSSScanParameters->obssScanActiveDwell <
8231 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8232 {
8233 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8234 pOBSSScanParameters->obssScanActiveDwell;
8235 }
8236 if((pOBSSScanParameters->obssScanPassiveDwell >
8237 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8238 (pOBSSScanParameters->obssScanPassiveDwell <
8239 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8240 {
8241 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8242 pOBSSScanParameters->obssScanPassiveDwell;
8243 }
8244 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8245 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8246 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8247 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8248 {
8249 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8250 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8251 }
8252 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8253 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8254 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8255 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8256 {
8257 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8258 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8259 }
8260 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8261 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8262 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8263 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8264 {
8265 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8266 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8267 }
8268 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8269 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8270 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8271 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8272 {
8273 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8274 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8275 }
8276 if((pOBSSScanParameters->obssScanActivityThreshold >
8277 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8278 (pOBSSScanParameters->obssScanActivityThreshold <
8279 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8280 {
8281 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8282 pOBSSScanParameters->obssScanActivityThreshold;
8283 }
8284}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008285
8286#ifdef WLAN_FEATURE_11W
8287void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8288{
8289 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8290 tPmfSaQueryTimerId timerId;
8291 tpPESession psessionEntry;
8292 tpDphHashNode pSta;
8293 tANI_U32 maxRetries;
8294
8295 limLog(pMac, LOG1, FL("SA Query timer fires"));
8296 timerId.value = param;
8297
8298 // Check that SA Query is in progress
8299 if ((psessionEntry = peFindSessionBySessionId(
8300 pMac, timerId.fields.sessionId)) == NULL)
8301 {
8302 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8303 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008304 return;
8305 }
8306 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8307 &psessionEntry->dph.dphHashTable)) == NULL)
8308 {
8309 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8310 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008311 return;
8312 }
8313 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8314 return;
8315
8316 // Increment the retry count, check if reached maximum
8317 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8318 &maxRetries) != eSIR_SUCCESS)
8319 {
8320 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8321 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8322 return;
8323 }
8324 pSta->pmfSaQueryRetryCount++;
8325 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8326 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308327 limLog(pMac, LOGE,
8328 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8329 MAC_ADDR_ARRAY(pSta->staAddr));
8330 limSendDisassocMgmtFrame(pMac,
8331 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8332 pSta->staAddr, psessionEntry, FALSE);
8333 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008334 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8335 return;
8336 }
8337
8338 // Retry SA Query
8339 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8340 pSta->staAddr, psessionEntry);
8341 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008342 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8343 {
8344 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8345 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8346 }
8347}
8348#endif
8349
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008350/** ---------------------------------------------------------
8351\fn limProcessChannelSwitchSuspendLink
8352\brief This function call channel switch functions based on
8353 the gLimChannelSwitch.state. After function return it
8354 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8355 If gLimChannelSwitch.state is non-identified then
8356 print error log as well as restore back the
8357 pre-channelSwitch.
8358\param tpAniSirGlobal pMac
8359\param eHalStatus status
8360\param tANI_U32 *ctx
8361\return None
8362 ------------------------------------------------------------*/
8363static void
8364limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8365 eHalStatus status,
8366 tANI_U32 *ctx)
8367{
8368 tpPESession pSessionEntry = (tpPESession)ctx;
8369
8370 if ( eHAL_STATUS_SUCCESS != status )
8371 {
8372 limLog(pMac, LOGE,
8373 FL("Suspend link failed. still proceeding "));
8374 }
8375 if (NULL == pSessionEntry )
8376 {
8377 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8378 return;
8379 }
8380
8381 switch(pSessionEntry->gLimChannelSwitch.state)
8382 {
8383 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8384 PELOGW(limLog(pMac, LOGW,
8385 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8386 limSwitchPrimaryChannel(pMac,
8387 pSessionEntry->gLimChannelSwitch.primaryChannel,
8388 pSessionEntry);
8389 pSessionEntry->gLimChannelSwitch.state =
8390 eLIM_CHANNEL_SWITCH_IDLE;
8391 break;
8392
8393 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8394 PELOGW(limLog(pMac, LOGW,
8395 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8396 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8397 pSessionEntry->gLimChannelSwitch.primaryChannel,
8398 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8399 pSessionEntry->gLimChannelSwitch.state =
8400 eLIM_CHANNEL_SWITCH_IDLE;
8401 break;
8402
8403 default:
8404 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8405 pSessionEntry->gLimChannelSwitch.state);)
8406 if (limRestorePreChannelSwitchState(pMac,
8407 pSessionEntry) != eSIR_SUCCESS)
8408 {
8409 limLog(pMac, LOGE,
8410 FL("Could not restore pre-channelSwitch "
8411 "(11h) state, resetting the system"));
8412 }
8413 }
8414}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308415
8416/** ---------------------------------------------------------
8417\fn limInitOBSSScanParams
8418\brief This function Initializes the OBSS Scan Parameters
8419\param tpAniSirGlobal pMac
8420\param tpPESession pSessionEntry
8421\return None
8422 ------------------------------------------------------------*/
8423
8424void limInitOBSSScanParams(tpAniSirGlobal pMac,
8425 tpPESession psessionEntry)
8426{
8427 tANI_U32 cfgValue;
8428
8429 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8430 &cfgValue) != eSIR_SUCCESS)
8431 {
8432 limLog(pMac, LOGE, FL("Fail to retrieve "
8433 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8434 return ;
8435 }
8436 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8437
8438 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8439 &cfgValue) != eSIR_SUCCESS)
8440 {
8441 limLog(pMac, LOGE, FL("Fail to retrieve "
8442 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8443 return ;
8444 }
8445 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8446
8447 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8448 &cfgValue) != eSIR_SUCCESS)
8449 {
8450 limLog(pMac, LOGE, FL("Fail to retrieve "
8451 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8452 return ;
8453 }
8454 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8455 = cfgValue;
8456 if (wlan_cfgGetInt(pMac,
8457 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8458 &cfgValue) != eSIR_SUCCESS)
8459 {
8460 limLog(pMac, LOGE, FL("Fail to retrieve"
8461 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8462 return ;
8463 }
8464 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8465 cfgValue;
8466 if (wlan_cfgGetInt(pMac,
8467 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8468 != eSIR_SUCCESS)
8469 {
8470 limLog(pMac, LOGE, FL("Fail to retrieve"
8471 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8472 return ;
8473 }
8474 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8475 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308476
8477 if (wlan_cfgGetInt(pMac,
8478 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8479 != eSIR_SUCCESS)
8480 {
8481 limLog(pMac, LOGE, FL("Fail to retrieve"
8482 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8483 return ;
8484 }
8485 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8486 cfgValue;
8487
8488
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308489 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8490 &cfgValue) != eSIR_SUCCESS)
8491 {
8492 limLog(pMac, LOGE, FL("Fail to retrieve "
8493 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8494 return ;
8495 }
8496 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308497}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308498
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308499const char * lim_ScanTypetoString(const v_U8_t scanType)
8500{
8501 switch (scanType)
8502 {
8503 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8504 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8505 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8506 default:
8507 return "Unknown ScanType";
8508 }
8509}
8510
8511const char * lim_BssTypetoString(const v_U8_t bssType)
8512{
8513 switch (bssType)
8514 {
8515 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8516 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8517 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8518 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8519 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8520 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8521 default:
8522 return "Unknown BssType";
8523 }
8524}
8525
8526const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8527{
8528 switch (mode)
8529 {
8530 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8531 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8532 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8533 default:
8534 return "Unknown BgScanMode";
8535 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308536}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308537
8538#ifdef WLAN_FEATURE_11W
8539/**
8540 *
8541 * \brief This function is called by various LIM modules to correctly set
8542 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8543 *
8544 *
8545 * \param pMac Pointer to Global MAC structure
8546 *
8547 * \param psessionEntry Pointer to session corresponding to the connection
8548 *
8549 * \param peer Peer address of the STA to which the frame is to be sent
8550 *
8551 * \param pMacHdr Pointer to the frame MAC header
8552 *
8553 * \return nothing
8554 *
8555 *
8556 */
8557void
8558limSetProtectedBit(tpAniSirGlobal pMac,
8559 tpPESession psessionEntry,
8560 tSirMacAddr peer,
8561 tpSirMacMgmtHdr pMacHdr)
8562{
8563 tANI_U16 aid;
8564 tpDphHashNode pStaDs;
8565
8566 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8567 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8568 {
8569
8570 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8571 &psessionEntry->dph.dphHashTable );
8572 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308573 /* rmfenabled will be set at the time of addbss.
8574 * but sometimes EAP auth fails and keys are not
8575 * installed then if we send any management frame
8576 * like deauth/disassoc with this bit set then
8577 * firmware crashes. so check for keys are
8578 * installed or not also before setting the bit
8579 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308580 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308581 pMacHdr->fc.wep = 1;
8582 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308583 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308584 pMacHdr->fc.wep = 1;
8585} /*** end limSetProtectedBit() ***/
8586#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308587
8588tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8589{
8590 int left = length;
8591 tANI_U8 *ptr = pIes;
8592 tANI_U8 elem_id,elem_len;
8593
8594 while (left >= 2)
8595 {
8596 elem_id = ptr[0];
8597 elem_len = ptr[1];
8598 left -= 2;
8599
8600 if (elem_len > left)
8601 {
8602 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8603 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8604 eid,elem_len,left);
8605 return NULL;
8606 }
8607 if (elem_id == eid)
8608 {
8609 return ptr;
8610 }
8611
8612 left -= elem_len;
8613 ptr += (elem_len + 2);
8614 }
8615 return NULL;
8616}
8617
8618
8619void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8620{
8621
8622 tANI_U32 nPayload;
8623 tANI_U8 *pPayload;
8624 tANI_U8 *ieptr;
8625 tSirMacTim *tim;
8626
8627 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8628 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8629
8630 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8631 {
8632 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8633 return;
8634 }
8635
8636 if (NULL !=
8637 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8638 nPayload, SIR_MAC_TIM_EID)))
8639 {
8640 /* Ignore EID and Length field*/
8641 tim = (tSirMacTim *)(ieptr + 2);
8642
8643 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8644 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8645 if (tim->dtimCount >= MAX_DTIM_COUNT)
8646 tim->dtimCount = DTIM_COUNT_DEFAULT;
8647 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8648 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8649 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8650 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8651 psessionEntry->currentBssBeaconCnt++;
8652
8653 limLog(pMac, LOG1,
8654 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8655 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8656 psessionEntry->lastBeaconDtimPeriod);
8657
8658 }
8659 return;
8660}
Girish Gowlia95daca2015-02-04 20:31:31 +05308661
8662void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8663 tANI_U8 smeSessionId,
8664 tANI_U32 maxRateFlag)
8665{
8666 tpSirSmeUpdateMaxRateParams pRsp;
8667 tSirMsgQ msg;
8668
8669 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8670 if (NULL == pRsp)
8671 {
8672 limLog(pMac, LOGP, FL("Memory allocation failed"));
8673 return;
8674 }
8675 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8676 pRsp->maxRateFlag = maxRateFlag;
8677 pRsp->smeSessionId = smeSessionId;
8678 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8679 msg.bodyptr = pRsp;
8680 msg.bodyval = 0;
8681 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8682 return;
8683}
Abhishek Singh5d765712015-03-12 14:04:16 +05308684
8685void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8686{
8687 if( pMac->sys.gSysBbtPendingMgmtCount )
8688 {
8689 vos_spin_lock_acquire( &pMac->sys.lock );
8690 pMac->sys.gSysBbtPendingMgmtCount--;
8691 vos_spin_lock_release( &pMac->sys.lock );
8692 }
8693 else
8694 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8695}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308696
8697eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8698{
8699 tpSirTxBdStatus pTxBdStatus;
8700
8701 if (!pData)
8702 {
8703 limLog(pMac, LOGE, FL("pData is NULL"));
8704 return eHAL_STATUS_FAILURE;
8705 }
8706
8707 pTxBdStatus = (tpSirTxBdStatus) pData;
8708
8709 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8710 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8711 return eHAL_STATUS_SUCCESS;
8712}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308713
Kapil Gupta956c0c42017-06-16 19:24:31 +05308714eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8715{
8716 tpSirTxBdStatus pTxBdStatus;
8717 tpDphHashNode pStaDs;
8718 tpPESession psessionEntry;
8719 VOS_STATUS vosStatus;
8720 vos_list_node_t *pNode= NULL, *pNext = NULL;
8721 assoc_rsp_tx_context *tmp_tx_context = NULL;
8722
8723 if (!pData)
8724 {
8725 limLog(pMac, LOGE, FL("pData is NULL"));
8726 return eHAL_STATUS_FAILURE;
8727 }
8728
8729 pTxBdStatus = (tpSirTxBdStatus) pData;
8730
8731 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8732 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8733
8734 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8735 &pNode);
8736
8737 while(pNode)
8738 {
8739 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8740 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8741 {
8742 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8743 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8744
8745 vosStatus = vos_list_peek_next (
8746 &pMac->assoc_rsp_completion_list,
8747 pNode, &pNext );
8748 pNode = pNext;
8749 pNext = NULL;
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308750 tmp_tx_context = NULL;
Kapil Gupta956c0c42017-06-16 19:24:31 +05308751 }
8752 else
8753 {
8754 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8755 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8756 break;
8757 }
8758 }
8759
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308760 if (!pNode) {
Kapil Gupta956c0c42017-06-16 19:24:31 +05308761 limLog(pMac, LOGE, FL("context is NULL"));
8762 return eHAL_STATUS_SUCCESS;
8763 }
8764 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8765 if (!psessionEntry) {
8766 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8767 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8768 pNode);
8769 vos_mem_free(tmp_tx_context);
8770 return eHAL_STATUS_SUCCESS;
8771 }
8772 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8773 &psessionEntry->dph.dphHashTable);
8774 if (pStaDs == NULL)
8775 {
8776 limLog(pMac, LOGW,
8777 FL("STA context not found"));
8778 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8779 pNode);
8780 vos_mem_free(tmp_tx_context);
8781
8782 return eHAL_STATUS_SUCCESS;
8783 }
8784
8785 /* Receive path cleanup */
8786 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8787 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8788 pNode);
8789 vos_mem_free(tmp_tx_context);
8790
8791 return eHAL_STATUS_SUCCESS;
8792}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308793/**
8794 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8795 * robust action frame
8796 * @action_catagory: Action frame catagory.
8797 *
8798 * This function is used to check if given action catagory is robust
8799 * action frame.
8800 *
8801 * Return: bool
8802 */
8803bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8804{
8805 switch (action_catagory) {
8806 /*
8807 * NOTE: This function doesn't take care of the DMG
8808 * (Directional Multi-Gigatbit) BSS case as 8011ad
8809 * support is not yet added. In future, if the support
8810 * is required then this function need few more arguments
8811 * and little change in logic.
8812 */
8813 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8814 case SIR_MAC_ACTION_QOS_MGMT:
8815 case SIR_MAC_ACTION_DLP:
8816 case SIR_MAC_ACTION_BLKACK:
8817 case SIR_MAC_ACTION_RRM:
8818 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8819 case SIR_MAC_ACTION_SA_QUERY:
8820 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8821 case SIR_MAC_ACTION_WNM:
8822 case SIR_MAC_ACITON_MESH:
8823 case SIR_MAC_ACTION_MHF:
8824 case SIR_MAC_ACTION_FST:
8825 return true;
8826 default:
8827 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8828 FL("non-PMF action category[%d] "),
8829 action_catagory);
8830 break;
8831 }
8832 return false;
8833}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308834
8835/**
Hu Wangc12631c2016-08-11 09:57:03 +08008836 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8837 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308838 * @ext_cap: extended IEs structure
8839 *
Hu Wangc12631c2016-08-11 09:57:03 +08008840 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308841 */
Hu Wangc12631c2016-08-11 09:57:03 +08008842tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8843 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308844
Hu Wangc12631c2016-08-11 09:57:03 +08008845 while (i) {
8846 if (ext_cap->bytes[i-1]) {
8847 break;
8848 }
8849 i --;
8850 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308851
Hu Wangc12631c2016-08-11 09:57:03 +08008852 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308853}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308854
8855/**
8856 * lim_update_caps_info_for_bss - Update capability info for this BSS
8857 *
8858 * @mac_ctx: mac context
8859 * @caps: Pointer to capability info to be updated
8860 * @bss_caps: Capability info of the BSS
8861 *
8862 * Update the capability info in Assoc/Reassoc request frames and reset
8863 * the spectrum management, short preamble, immediate block ack bits
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308864 * and rrm bit mask if the BSS doesnot support it
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308865 *
8866 * Return: None
8867 */
8868void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8869 uint16_t *caps, uint16_t bss_caps)
8870{
8871 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8872 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8873 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8874 }
8875
8876 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8877 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8878 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8879 }
8880
8881 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8882 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8883 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8884 }
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308885
8886 if (!(bss_caps & LIM_RRM_BIT_MASK)) {
8887 *caps &= (~LIM_RRM_BIT_MASK);
8888 limLog(mac_ctx, LOG1,
8889 FL("Clearing radio measurement :no AP support"));
8890 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308891}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308892#ifdef SAP_AUTH_OFFLOAD
8893/**
8894 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8895 *
8896 * @pmac: mac context
8897 * @assoc_req: Assoc request
8898 * @add_sta_req: Add Sta request
8899 *
8900 * This function process recieved add sta message and store it as
8901 * sta ds entry. This function will add this sta entry to DPH as well.
8902 *
8903 * Return: DPH hash node
8904 */
8905static tpDphHashNode
8906_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8907 tpSirAssocReq assoc_req,
8908 tSapOfldAddStaIndMsg *add_sta_req)
8909{
8910 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8911 tpSirAssocReq temp_assoc_req;
8912 tSirRetStatus status;
8913 tpDphHashNode sta_ds = NULL;
8914 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308915 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308916
8917 tpPESession session_entry = limIsApSessionActive(pmac);
8918
8919 if (session_entry == NULL)
8920 {
8921 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8922 return NULL;
8923 }
8924
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308925 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8926 {
8927 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8928 return NULL;
8929 }
8930
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308931 /* Update Attribute and Remove IE for
8932 * Software AP Authentication Offload
8933 */
8934 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308935
8936 /*
8937 * strip MAC mgmt header before passing buf to
8938 * sirConvertAssocReqFrame2Struct() as this API
8939 * expects buf starting from fixed parameters only.
8940 */
8941 frame_body += sizeof(tSirMacMgmtHdr);
8942 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8943
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308944 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8945 mac_assoc_req->capabilityInfo.privacy = 0;
8946
8947 status = sirConvertAssocReqFrame2Struct(pmac,
8948 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308949 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308950 assoc_req);
8951 if (status != eSIR_SUCCESS)
8952 {
8953 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8954 goto error;
8955 }
8956 /* For software AP Auth Offload feature
8957 * Host will take it as none security station
8958 * Force change to none security
8959 */
8960 assoc_req->rsnPresent = 0;
8961 assoc_req->wpaPresent = 0;
8962
8963 sta_ds = dphAddHashEntry(pmac,
8964 add_sta_req->peer_macaddr,
8965 add_sta_req->assoc_id,
8966 &session_entry->dph.dphHashTable);
8967 if (sta_ds == NULL)
8968 {
8969 /* Could not add hash table entry at DPH */
8970 limLog(pmac, LOGE,
8971 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8972 MAC_ADDRESS_STR),
8973 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8974 goto error;
8975 }
8976
8977 if (session_entry->parsedAssocReq != NULL)
8978 {
8979 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8980 if (temp_assoc_req != NULL)
8981 {
8982 if (temp_assoc_req->assocReqFrame)
8983 {
8984 vos_mem_free(temp_assoc_req->assocReqFrame);
8985 temp_assoc_req->assocReqFrame = NULL;
8986 temp_assoc_req->assocReqFrameLength = 0;
8987 }
8988 vos_mem_free(temp_assoc_req);
8989 temp_assoc_req = NULL;
8990 }
8991 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8992 }
8993error:
8994 return sta_ds;
8995}
8996
8997/**
8998 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8999 *
9000 * @sta_ds: STA state node
9001 * @assoc_req: Assoc request
9002 * @add_sta_req: Add Sta request
9003 *
9004 * This function process recieved add sta message and store station's caps
9005 * in station ds entry.
9006 *
9007 * Return: none
9008 */
9009static void
9010_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
9011 tpSirAssocReq assoc_req,
9012 tSapOfldAddStaIndMsg *add_sta_req)
9013
9014{
9015
9016 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
9017#ifdef WLAN_FEATURE_11AC
9018 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
9019#endif
9020 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
9021 sta_ds->qos.addts = assoc_req->addtsReq;
9022 sta_ds->qos.capability = assoc_req->qosCapability;
9023 sta_ds->versionPresent = 0;
9024 /* short slot and short preamble should be
9025 * updated before doing limaddsta
9026 */
9027 sta_ds->shortPreambleEnabled =
9028 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
9029 sta_ds->shortSlotTimeEnabled =
9030 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
9031
9032 sta_ds->valid = 0;
9033 /* The Auth Type of Software AP Authentication Offload
9034 * is always Open System is host side
9035 */
9036 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
9037 sta_ds->staType = STA_ENTRY_PEER;
9038
9039 /* Assoc Response frame to requesting STA */
9040 sta_ds->mlmStaContext.subType = 0;
9041
9042 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
9043 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
9044
9045 /* The following count will be used to knock-off the station
9046 * if it doesn't come back to receive the buffered data.
9047 * The AP will wait for numTimSent number of beacons after
9048 * sending TIM information for the station, before assuming that
9049 * the station is no more associated and disassociates it
9050 */
9051
9052 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
9053 sta_ds->timWaitCount =
9054 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
9055
9056 /* Initialise the Current successful
9057 * MPDU's tranfered to this STA count as 0
9058 */
9059 sta_ds->curTxMpduCnt = 0;
9060}
9061
9062/**
9063 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
9064 *
9065 * @pmac: mac context
9066 * @sta_ds: STA state node
9067 * @assoc_req: Assoc request
9068 *
9069 * This function process recieved add sta message and store station's HT and
9070 * and VHT caps and store them in station ds entry.
9071 *
9072 * Return: tSirRetStatus
9073 */
9074static tSirRetStatus
9075_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
9076 tpDphHashNode sta_ds,
9077 tpSirAssocReq assoc_req)
9078{
9079 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309080 if (session_entry == NULL)
9081 {
9082 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9083 goto error;
9084 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309085
9086 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
9087 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
9088 {
9089 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
9090 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
9091 sta_ds->htDsssCckRate40MHzSupport =
9092 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
9093 sta_ds->htLsigTXOPProtection =
9094 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
9095 sta_ds->htMaxAmsduLength =
9096 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
9097 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
9098 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
9099 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
9100 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
9101 sta_ds->htSupportedChannelWidthSet =
9102 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
9103 /* peer just follows AP; so when we are softAP/GO,
9104 * we just store our session entry's secondary channel offset here
9105 * in peer INFRA STA. However, if peer's 40MHz channel width support
9106 * is disabled then secondary channel will be zero
9107 */
9108 sta_ds->htSecondaryChannelOffset =
9109 (sta_ds->htSupportedChannelWidthSet) ?
9110 session_entry->htSecondaryChannelOffset : 0;
9111#ifdef WLAN_FEATURE_11AC
9112 if (assoc_req->operMode.present)
9113 {
9114 sta_ds->vhtSupportedChannelWidthSet =
9115 (tANI_U8)((assoc_req->operMode.chanWidth ==
9116 eHT_CHANNEL_WIDTH_80MHZ) ?
9117 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
9118 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
9119 sta_ds->htSupportedChannelWidthSet =
9120 (tANI_U8)(assoc_req->operMode.chanWidth ?
9121 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
9122 }
9123 else if (assoc_req->VHTCaps.present)
9124 {
9125 /* Check if STA has enabled it's channel bonding mode.
9126 * If channel bonding mode is enabled, we decide based on
9127 * SAP's current configuration else, we set it to VHT20.
9128 */
9129 sta_ds->vhtSupportedChannelWidthSet =
9130 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
9131 eHT_CHANNEL_WIDTH_20MHZ) ?
9132 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
9133 session_entry->vhtTxChannelWidthSet );
9134 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
9135 }
9136
9137 /* Lesser among the AP and STA bandwidth of operation. */
9138 sta_ds->htSupportedChannelWidthSet =
9139 (sta_ds->htSupportedChannelWidthSet <
9140 session_entry->htSupportedChannelWidthSet) ?
9141 sta_ds->htSupportedChannelWidthSet :
9142 session_entry->htSupportedChannelWidthSet ;
9143#endif
9144 sta_ds->baPolicyFlag = 0xFF;
9145 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
9146 }
9147
9148 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
9149 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
9150
9151 if (!assoc_req->wmeInfoPresent)
9152 {
9153 sta_ds->mlmStaContext.htCapability = 0;
9154#ifdef WLAN_FEATURE_11AC
9155 sta_ds->mlmStaContext.vhtCapability = 0;
9156#endif
9157 }
9158#ifdef WLAN_FEATURE_11AC
9159 if (limPopulateMatchingRateSet(pmac,
9160 sta_ds,
9161 &(assoc_req->supportedRates),
9162 &(assoc_req->extendedRates),
9163 assoc_req->HTCaps.supportedMCSSet,
9164 &(assoc_req->propIEinfo.propRates),
9165 session_entry , &assoc_req->VHTCaps)
9166 != eSIR_SUCCESS)
9167 {
9168#else
9169 if (limPopulateMatchingRateSet(pmac,
9170 sta_ds,
9171 &(assoc_req->supportedRates),
9172 &(assoc_req->extendedRates),
9173 assoc_req->HTCaps.supportedMCSSet,
9174 &(assoc_req->propIEinfo.propRates),
9175 session_entry) != eSIR_SUCCESS)
9176 {
9177#endif
9178 limLog(pmac, LOGE,
9179 FL("Rate set mismatched for aid=%d, MacAddr: "
9180 MAC_ADDRESS_STR),
9181 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9182 goto error;
9183 }
9184 return eSIR_SUCCESS;
9185error:
9186 return eSIR_FAILURE;
9187}
9188
9189/**
9190 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9191 *
9192 * @pmac: mac context
9193 * @sta_ds: STA state node
9194 * @assoc_req: Assoc request
9195 *
9196 * This function process recieved add sta message and store station's QOS
9197 * store them in station ds entry.
9198 *
9199 * Return: none
9200 */
9201static void
9202 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9203 tpDphHashNode sta_ds,
9204 tpSirAssocReq assoc_req)
9205{
9206 tHalBitVal qos_mode;
9207 tHalBitVal wsm_mode, wme_mode;
9208 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309209 if (session_entry == NULL)
9210 {
9211 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9212 return;
9213 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309214 limGetQosMode(session_entry, &qos_mode);
9215 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9216 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9217
9218 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9219 {
9220 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9221 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9222 }
9223
9224 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9225 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9226 limGetWmeMode(session_entry, &wme_mode);
9227 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9228 (wme_mode == eHAL_SET))
9229 {
9230 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9231 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9232 limGetWsmMode(session_entry, &wsm_mode);
9233 /* WMM_APSD - WMM_SA related processing should be
9234 * separate; WMM_SA and WMM_APSD can coexist
9235 */
9236 if (assoc_req->WMMInfoStation.present)
9237 {
9238 /* check whether AP supports or not */
9239 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9240 && (session_entry->apUapsdEnable == 0) &&
9241 (assoc_req->WMMInfoStation.acbe_uapsd
9242 || assoc_req->WMMInfoStation.acbk_uapsd
9243 || assoc_req->WMMInfoStation.acvo_uapsd
9244 || assoc_req->WMMInfoStation.acvi_uapsd))
9245 {
9246 /*
9247 * Received Re/Association Request from
9248 * STA when UPASD is not supported
9249 */
9250 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9251 "to STA accordingly" ));
9252 /* update UAPSD and send it to LIM to add STA */
9253 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9254 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9255 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9256 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9257 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9258 }
9259 else
9260 {
9261 /* update UAPSD and send it to LIM to add STA */
9262 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9263 assoc_req->WMMInfoStation.acbe_uapsd;
9264 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9265 assoc_req->WMMInfoStation.acbk_uapsd;
9266 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9267 assoc_req->WMMInfoStation.acvo_uapsd;
9268 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9269 assoc_req->WMMInfoStation.acvi_uapsd;
9270 sta_ds->qos.capability.qosInfo.maxSpLen =
9271 assoc_req->WMMInfoStation.max_sp_length;
9272 }
9273 }
9274 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9275 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9276 }
9277}
9278
9279/**
9280 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9281 *
9282 * @pmac: mac context
9283 * @lim_msgq: Add Sta indication buffer
9284 *
9285 * This function will recieve buffer from firmware. This buffer will store
9286 * information about connected client. driver will process this buffer and
9287 * will register this client with driver. Driver will call limAddSta
9288 *
9289 * Return: none
9290 */
9291void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9292 tSapOfldAddStaIndMsg *lim_msgq)
9293{
9294 tpSirAssocReq assoc_req = NULL;
9295 tpDphHashNode sta_ds = NULL;
9296
9297 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9298 tpPESession session_entry = limIsApSessionActive(pmac);
9299
9300 if (session_entry == NULL)
9301 {
9302 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9303 return;
9304 }
9305 add_sta_req = lim_msgq;
9306 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9307 if (NULL == assoc_req) {
9308 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9309 return;
9310 }
9311 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9312
9313 /* parse Assoc req frame for station information */
9314 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9315 if (sta_ds == NULL)
9316 {
9317 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9318 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9319 vos_mem_free(assoc_req);
9320 goto error;
9321 }
9322
9323 /* Parse Station Capability */
9324 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9325
9326 /* Parse Station HT/VHT information */
9327 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9328 == eSIR_FAILURE)
9329 {
9330 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9331 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9332 vos_mem_free(assoc_req);
9333 goto error;
9334
9335 }
9336
9337 /* Parse Station QOS information */
9338 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9339
9340 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9341 sta_ds->staIndex = add_sta_req->staIdx;
9342 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9343 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9344 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9345 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9346 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9347 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309348 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309349
Agrawal Ashishce67f362017-01-05 20:10:58 +05309350 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9351 sta_ds->staIndex,
9352 sta_ds->bssId,
9353 sta_ds->dpuIndex,
9354 sta_ds->bcastDpuIndex,
9355 sta_ds->bcastMgmtDpuIdx,
9356 sta_ds->ucUcastSig,
9357 sta_ds->ucBcastSig,
9358 sta_ds->ucMgmtSig,
9359 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309360
9361 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9362 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9363 sta_ds->assocId);
9364 }
9365
9366error:
9367 return;
9368}
9369
9370/**
9371 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9372 *
9373 * @pmac: mac context
9374 * @lim_msgq: Del Sta indication buffer
9375 *
9376 * This function will recieve buffer from firmware. This buffer will
9377 * have information about clinet to remove with reason code.
9378 * This function will call limSendSmeDisassocInd to do cleanup
9379 * for station entry
9380 *
9381 * Return: none
9382 */
9383void
9384lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9385{
9386 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9387 tpDphHashNode sta_ds = NULL;
9388 tANI_U16 assoc_id = 0;
9389 tpPESession psession_entry = limIsApSessionActive(pmac);
9390
9391 if (psession_entry == NULL)
9392 {
9393 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9394 goto error;
9395 }
9396
9397 del_sta_req = lim_msgq;
9398 sta_ds = dphLookupHashEntry(pmac,
9399 del_sta_req->peer_macaddr,
9400 &assoc_id,
9401 &psession_entry->dph.dphHashTable);
9402 if (sta_ds == NULL)
9403 {
9404 /*
9405 * Disassociating STA is not associated.
9406 * Log error
9407 */
9408 PELOGE(limLog(pmac, LOGE,
9409 FL("received del sta event that sta not exist in table "
9410 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9411 del_sta_req->reason,
9412 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9413 goto error;
9414 }
9415
9416 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9417 {
9418 /*
9419 * Associate Id mismatch
9420 * Log error
9421 */
9422 PELOGE(limLog(pmac, LOGE,
9423 FL("received del sta event that sta assoc Id mismatch"));)
9424 goto error;
9425 }
9426
9427 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9428 sta_ds->mlmStaContext.disassocReason =
9429 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309430
9431 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9432
9433error:
9434 return;
9435}
9436#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309437
9438int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9439{
9440 tANI_U8 i;
9441 tpPESession psessionEntry = NULL;
9442
9443 for(i =0; i < pMac->lim.maxBssId; i++)
9444 {
9445 /* If BSSID matches return corresponding tables address*/
9446 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9447 {
9448 psessionEntry = (&pMac->lim.gpSession[i]);
9449 return psessionEntry->bssIdx;
9450 }
9451 }
9452
9453 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9454 return(0xFF);
9455}
Yeshwanth Sriram Guntuka8d9b29c2017-12-12 15:44:57 +05309456void limStaDelBASession(tpAniSirGlobal pMac)
9457{
9458 tANI_U32 i;
9459 tpPESession pSessionEntry;
9460
9461 for (i = 0; i < pMac->lim.maxBssId; i++)
9462 {
9463 pSessionEntry = peFindSessionBySessionId(pMac, i);
9464 if (pSessionEntry &&
9465 pSessionEntry->limSystemRole == eLIM_STA_ROLE)
9466 {
9467 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
9468 eSIR_MAC_UNSPEC_FAILURE_REASON);
9469 }
9470 }
9471}