blob: bc51c9cda260ba6b8b6695e97510abb62601e2a3 [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
2694 /* If the channel-list that AP is asking us to switch is invalid,
2695 * then we cannot switch the channel. Just disassociate from AP.
2696 * We will find a better AP !!!
2697 */
Abhishek Singh800d17a2016-08-26 17:00:49 +05302698 if ((psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2699 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
2700 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) {
2701 limLog(pMac, LOGE, FL("Invalid channel!! Disconnect.."));
2702 limTearDownLinkWithAp(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2704 eSIR_MAC_UNSPEC_FAILURE_REASON);
Abhishek Singh800d17a2016-08-26 17:00:49 +05302705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 return;
2707 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002708 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2709 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002710 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 {
2712 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002713 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2714 if ( isLimSessionOffChannel(pMac,
2715 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2716 {
2717 limSuspendLink(pMac,
2718 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2719 limProcessChannelSwitchSuspendLink,
2720 (tANI_U32*)psessionEntry );
2721 }
2722 else
2723 {
2724 limProcessChannelSwitchSuspendLink(pMac,
2725 eHAL_STATUS_SUCCESS,
2726 (tANI_U32*)psessionEntry);
2727 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 break;
2729
2730 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002731 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002732 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002734 psessionEntry->gLimChannelSwitch.secondarySubBand);
2735 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 case eLIM_CHANNEL_SWITCH_IDLE:
2738 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002739 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2741 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002742 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 }
2744 return; /* Please note, this is 'return' and not 'break' */
2745 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002746}
Jeff Johnson295189b2012-06-20 16:38:30 -07002747
2748/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302749 * lim_process_ecsa_ie()- Process ECSA IE in beacon/ probe resp
2750 * @mac_ctx: pointer to global mac structure
2751 * @ecsa_ie: ecsa ie
2752 * @session: Session entry.
2753 *
2754 * This function is called when ECSA IE is received on STA interface.
2755 *
2756 * Return: void
2757 */
2758static void
2759lim_process_ecsa_ie(tpAniSirGlobal mac_ctx,
2760 tDot11fIEext_chan_switch_ann *ecsa_ie, tpPESession session)
2761{
2762 struct ecsa_frame_params ecsa_req;
2763
2764 limLog(mac_ctx, LOG1, FL("Received ECSA IE in beacon/probe resp"));
2765
2766 if (session->currentOperChannel == ecsa_ie->new_channel) {
2767 limLog(mac_ctx, LOGE, FL("New channel %d is same as old channel ignore req"),
2768 ecsa_ie->new_channel);
2769 return;
2770 }
2771
2772 ecsa_req.new_channel = ecsa_ie->new_channel;
2773 ecsa_req.op_class = ecsa_ie->new_reg_class;
2774 ecsa_req.switch_mode = ecsa_ie->switch_mode;
2775 ecsa_req.switch_count = ecsa_ie->switch_count;
2776 limLog(mac_ctx, LOG1, FL("New channel %d op class %d switch mode %d switch count %d"),
2777 ecsa_req.new_channel, ecsa_req.op_class,
2778 ecsa_req.switch_mode, ecsa_req.switch_count);
2779
2780 lim_handle_ecsa_req(mac_ctx, &ecsa_req, session);
2781}
2782
2783
2784/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 * limUpdateChannelSwitch()
2786 *
2787 *FUNCTION:
2788 * This function is invoked whenever Station receives
2789 * either 802.11h channel switch IE or airgo proprietary
2790 * channel switch IE.
2791 *
2792 *NOTE:
2793 * @param pMac - Pointer to Global MAC structure
2794 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2795 * @param psessionentry
2796 */
2797void
2798limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2799{
2800
2801 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002802 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2803 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002804#ifdef WLAN_FEATURE_11AC
2805 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2806#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302807 if (pBeacon->ecsa_present)
2808 return lim_process_ecsa_ie(pMac,
2809 &pBeacon->ext_chan_switch_ann, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002810
Jeff Johnsone7245742012-09-05 17:12:55 -07002811 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002812
2813 /* STA either received proprietary channel switch IE or 802.11h
2814 * standard channel switch IE.
2815 */
2816 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2817 {
2818 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2819
2820 /* Add logic to determine which change this is: */
2821 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002822 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2823 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2824 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2825 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2826 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 }
2830 else
2831 {
2832 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002833 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2834 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2835 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002837 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002838#ifdef WLAN_FEATURE_11AC
2839 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2840 if(pBeacon->WiderBWChanSwitchAnnPresent)
2841 {
2842 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2843 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2844 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2845 }
2846#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002847
2848 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002849 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2850 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002851
2852 /* Do not bother to look and operate on extended channel switch element
2853 * if our own channel-bonding state is not enabled
2854 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002855 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302857 if (pBeacon->sec_chan_offset_present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302859 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2860 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002862 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +05302863 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002865#ifdef WLAN_FEATURE_11AC
2866 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2867 {
2868 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2869 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302870 if(pBeacon->sec_chan_offset_present)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002871 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302872 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2873 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002874 {
2875 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2876 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2877 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +05302878 pBeacon->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002879 pWiderChnlSwitch->newCenterChanFreq0,
2880 psessionEntry);
2881 }
2882 }
2883 }
2884 }
2885#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002886 }
2887 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002888 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002889
2890
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2892 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002893 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 }
2895
2896 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002897 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002898 psessionEntry->peSessionId,
2899 psessionEntry->gLimChannelSwitch.primaryChannel,
2900 psessionEntry->gLimChannelSwitch.secondarySubBand,
2901 psessionEntry->gLimChannelSwitch.switchCount,
2902 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 return;
2904}
2905
2906/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302907 * lim_select_cbmode()- select cb mode for the channel and BW
2908 * @sta_ds: peer sta
2909 * @channel: channel
2910 * @chan_bw: BW
2911 *
2912 * Return: cb mode for a channel and BW
2913 */
2914static inline int lim_select_cbmode(tDphHashNode *sta_ds, uint8_t channel,
2915 uint8_t chan_bw)
2916{
2917 if (sta_ds->mlmStaContext.vhtCapability && chan_bw) {
2918 if (channel== 36 || channel == 52 || channel == 100 ||
2919 channel == 116 || channel == 149)
2920 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
2921 else if (channel == 40 || channel == 56 || channel == 104 ||
2922 channel == 120 || channel == 153)
2923 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
2924 else if (channel == 44 || channel == 60 || channel == 108 ||
2925 channel == 124 || channel == 157)
2926 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
2927 else if (channel == 48 || channel == 64 || channel == 112 ||
2928 channel == 128 || channel == 161)
2929 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
2930 else if (channel == 165)
2931 return PHY_SINGLE_CHANNEL_CENTERED;
2932 } else if (sta_ds->mlmStaContext.htCapability) {
2933 if (channel== 40 || channel == 48 || channel == 56 ||
2934 channel == 64 || channel == 104 || channel == 112 ||
2935 channel == 120 || channel == 128 || channel == 136 ||
2936 channel == 144 || channel == 153 || channel == 161)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302937 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302938 else if (channel== 36 || channel == 44 || channel == 52 ||
2939 channel == 60 || channel == 100 || channel == 108 ||
2940 channel == 116 || channel == 124 || channel == 132 ||
2941 channel == 140 || channel == 149 || channel == 157)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302942 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302943 else if (channel == 165)
2944 return PHY_SINGLE_CHANNEL_CENTERED;
2945 }
2946 return PHY_SINGLE_CHANNEL_CENTERED;
2947}
2948
2949void lim_handle_ecsa_req(tpAniSirGlobal mac_ctx, struct ecsa_frame_params *ecsa_req,
2950 tpPESession session)
2951{
2952 offset_t ch_offset;
2953 tpDphHashNode sta_ds = NULL ;
2954 uint16_t aid = 0;
2955
2956 if (!LIM_IS_STA_ROLE(session)) {
2957 limLog(mac_ctx, LOGE, FL("Session not in sta role"));
2958 return;
2959 }
2960
2961 sta_ds = dphLookupHashEntry(mac_ctx, session->bssId, &aid,
2962 &session->dph.dphHashTable);
2963 if (!sta_ds) {
2964 limLog(mac_ctx, LOGE, FL("pStaDs does not exist for given sessionID"));
2965 return;
2966 }
2967
2968 session->gLimChannelSwitch.primaryChannel = ecsa_req->new_channel;
2969 session->gLimChannelSwitch.switchCount = ecsa_req->switch_count;
2970 session->gLimChannelSwitch.switchTimeoutValue =
2971 SYS_MS_TO_TICKS(session->beaconParams.beaconInterval) *
2972 ecsa_req->switch_count;
2973 session->gLimChannelSwitch.switchMode = ecsa_req->switch_mode;
2974
2975 /* Only primary channel switch element is present */
2976 session->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2977 session->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
2978 session->gLimWiderBWChannelSwitch.newChanWidth = 0;
2979
Abhishek Singh0f09f382018-12-04 14:06:07 +05302980 ch_offset =
2981 lim_get_channel_width_from_opclass(mac_ctx->scan.countryCodeCurrent,
2982 ecsa_req->new_channel,
2983 sta_ds->mlmStaContext.vhtCapability,
2984 ecsa_req->op_class);
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302985 if (ch_offset == BW80) {
2986 session->gLimWiderBWChannelSwitch.newChanWidth =
2987 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
2988 } else {
2989 session->gLimWiderBWChannelSwitch.newChanWidth =
2990 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
2991 }
2992
2993 /*
2994 * Do not bother to look and operate on extended channel switch element
2995 * if our own channel-bonding state is not enabled
2996 */
2997 if (session->htSupportedChannelWidthSet) {
2998 session->gLimChannelSwitch.secondarySubBand = lim_select_cbmode(sta_ds,
2999 ecsa_req->new_channel,
3000 session->gLimWiderBWChannelSwitch.newChanWidth);
3001 if (session->gLimChannelSwitch.secondarySubBand > 0)
3002 session->gLimChannelSwitch.state =
3003 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
3004 }
3005
3006 if (eSIR_SUCCESS != limStartChannelSwitch(mac_ctx, session)) {
3007 limLog(mac_ctx, LOGW, FL("Could not start Channel Switch"));
3008 }
3009
3010 limLog(mac_ctx, LOG1,
3011 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
3012 session->peSessionId,
3013 session->gLimChannelSwitch.primaryChannel,
3014 session->gLimChannelSwitch.secondarySubBand,
3015 session->gLimChannelSwitch.switchCount,
3016 session->gLimChannelSwitch.switchTimeoutValue);
3017}
3018
3019/**
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 * limCancelDot11hChannelSwitch
3021 *
3022 *FUNCTION:
3023 * This function is called when STA does not send updated channel-swith IE
3024 * after indicating channel-switch start. This will cancel the channel-swith
3025 * timer which is already running.
3026 *
3027 *LOGIC:
3028 *
3029 *ASSUMPTIONS:
3030 *
3031 *NOTE:
3032 *
3033 * @param pMac - Pointer to Global MAC structure
3034 *
3035 * @return None
3036 */
3037void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
3038{
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3040 return;
3041
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003042 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003043 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003044
3045 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
3046 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003047 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003048 }
3049
3050 /* We need to restore pre-channelSwitch state on the STA */
3051 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3052 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003053 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003054
3055 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003056}
3057
3058/**----------------------------------------------
3059\fn limCancelDot11hQuiet
3060\brief Cancel the quieting on Station if latest
3061 beacon doesn't contain quiet IE in it.
3062
3063\param pMac
3064\return NONE
3065-----------------------------------------------*/
3066void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
3067{
Jeff Johnson295189b2012-06-20 16:38:30 -07003068 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3069 return;
3070
Jeff Johnsone7245742012-09-05 17:12:55 -07003071 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003073 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
3075 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003076 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003077 }
3078 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003079 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003081 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
3083 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003084 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
3086 /**
3087 * If the channel switch is already running in silent mode, dont resume the
3088 * transmission. Channel switch timer when timeout, transmission will be resumed.
3089 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003090 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3091 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 {
3093 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003094 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 }
3096 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003097 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003098}
3099
3100/**
3101 * limProcessQuietTimeout
3102 *
3103 * FUNCTION:
3104 * This function is active only on the STA.
3105 * Handles SIR_LIM_QUIET_TIMEOUT
3106 *
3107 * LOGIC:
3108 * This timeout can occur under only one circumstance:
3109 *
3110 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
3111 * This indicates that the timeout "interval" has
3112 * expired. This is a trigger for the STA to now
3113 * shut-off Tx/Rx for the specified gLimQuietDuration
3114 * -> The TIMER object gLimQuietBssTimer is
3115 * activated
3116 * -> With timeout = gLimQuietDuration
3117 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
3118 *
3119 * ASSUMPTIONS:
3120 * Using two TIMER objects -
3121 * gLimQuietTimer & gLimQuietBssTimer
3122 *
3123 * NOTE:
3124 *
3125 * @param pMac - Pointer to Global MAC structure
3126 *
3127 * @return None
3128 */
3129void limProcessQuietTimeout(tpAniSirGlobal pMac)
3130{
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 //fetch the sessionEntry based on the sessionId
3132 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07003133 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003134
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003136 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003137 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003138 return;
3139 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003140
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303141 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003142 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 {
3144 case eLIM_QUIET_BEGIN:
3145 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07003146 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
3147 if (TX_SUCCESS !=
3148 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
3149 {
3150 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003151 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003152 }
3153
3154 // gLimQuietDuration appears to be in units of ticks
3155 // Use it as is
3156 if (TX_SUCCESS !=
3157 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
3158 psessionEntry->gLimSpecMgmt.quietDuration,
3159 0))
3160 {
3161 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003162 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003163 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003164 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003165#ifdef GEN6_TODO
3166 /* revisit this piece of code to assign the appropriate sessionId below
3167 * priority - HIGH
3168 */
3169 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3170#endif
3171 if( TX_SUCCESS !=
3172 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3173 {
3174 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003175 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 }
3177 else
3178 {
3179 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003180 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003181
3182 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3183 /* print message, otherwise, stop data traffic and stay quiet */
3184 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3185 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3186 {
3187 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003188 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 }
3190 else
3191 {
3192 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3193 /* freeze the transmission */
3194 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3195
3196 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003197 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003198 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 }
3200 }
3201 break;
3202
3203 case eLIM_QUIET_RUNNING:
3204 case eLIM_QUIET_INIT:
3205 case eLIM_QUIET_END:
3206 default:
3207 //
3208 // As of now, nothing to be done
3209 //
3210 break;
3211 }
3212}
3213
3214/**
3215 * limProcessQuietBssTimeout
3216 *
3217 * FUNCTION:
3218 * This function is active on the AP and STA.
3219 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3220 *
3221 * LOGIC:
3222 * On the AP -
3223 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3224 * an indication for the AP to START sending out the
3225 * Quiet BSS IE.
3226 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3227 * the 11H spec
3228 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3229 * a Proprietary IE. This will be understood by all the
3230 * TITAN STA's
3231 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3232 * initiate the SCH to include the Quiet BSS IE in all
3233 * its subsequent Beacons/PR's.
3234 * The Quiet BSS IE will be included in all the Beacons
3235 * & PR's until the next DTIM period
3236 *
3237 * On the STA -
3238 * When gLimQuietState = eLIM_QUIET_RUNNING
3239 * This indicates that the STA was successfully shut-off
3240 * for the specified gLimQuietDuration. This is a trigger
3241 * for the STA to now resume data traffic.
3242 * -> gLimQuietState is set to eLIM_QUIET_INIT
3243 *
3244 * ASSUMPTIONS:
3245 *
3246 * NOTE:
3247 *
3248 * @param pMac - Pointer to Global MAC structure
3249 *
3250 * @return None
3251 */
3252void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3253{
Jeff Johnsone7245742012-09-05 17:12:55 -07003254 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003255
Jeff Johnsone7245742012-09-05 17:12:55 -07003256 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003258 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 return;
3260 }
3261
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303262 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003263 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 }
3266 else
3267 {
3268 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003269 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 {
3271 case eLIM_QUIET_RUNNING:
3272 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003273 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003274
3275 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3276 {
3277 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003278 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3279 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 {
3281 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003282 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 }
3284
3285 /* Reset status flag */
3286 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3287 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3288
3289 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003290 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 }
3292 else
3293 {
3294 //
3295 // Nothing specific to be done in this case
3296 // A background scan that was triggered during
3297 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3298 //
3299 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003300 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 }
3302 break;
3303
3304 case eLIM_QUIET_INIT:
3305 case eLIM_QUIET_BEGIN:
3306 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003307 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 /* If the quiet period has ended, then resume the frame transmission */
3309 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003310 limRestorePreQuietState(pMac, psessionEntry);
3311 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 break;
3313
3314 default:
3315 //
3316 // As of now, nothing to be done
3317 //
3318 break;
3319 }
3320 }
3321}
Jeff Johnson295189b2012-06-20 16:38:30 -07003322/**
3323 * limProcessWPSOverlapTimeout
3324 *
3325 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3326 *
3327 * LOGIC:
3328 *
3329 * ASSUMPTIONS:
3330 *
3331 * NOTE:
3332 *
3333 * @param pMac - Pointer to Global MAC structure
3334 *
3335 * @return None
3336 */
3337#if 0
3338void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3339{
3340
3341 tpPESession psessionEntry;
3342 tANI_U32 sessionId;
3343
3344 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3345 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003346 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 }
3348
3349 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3350
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003351 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003352
3353 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3354 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003355 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003356 return;
3357 }
3358
3359 limWPSPBCTimeout(pMac, psessionEntry);
3360}
3361#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003362
Jeff Johnson295189b2012-06-20 16:38:30 -07003363/**----------------------------------------------
3364\fn limStartQuietTimer
3365\brief Starts the quiet timer.
3366
3367\param pMac
3368\return NONE
3369-----------------------------------------------*/
3370void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3371{
3372 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303373 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003374
3375 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003376 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 return;
3378 }
3379
Jeff Johnson295189b2012-06-20 16:38:30 -07003380
3381 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3382 return;
3383 // First, de-activate Timer, if its already active
3384 limCancelDot11hQuiet(pMac, psessionEntry);
3385
Jeff Johnsone7245742012-09-05 17:12:55 -07003386 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3387 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3388 {
3389 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003390 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003391 }
3392
3393 // Set the NEW timeout value, in ticks
3394 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3395 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3396 {
3397 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003398 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003400
3401 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3402 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3403 {
3404 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003405 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003406 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003407
Jeff Johnsone7245742012-09-05 17:12:55 -07003408 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 return;
3410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003411}
3412
Jeff Johnson295189b2012-06-20 16:38:30 -07003413
3414/** ------------------------------------------------------------------------ **/
3415/**
3416 * keep track of the number of ANI peers associated in the BSS
3417 * For the first and last ANI peer, we have to update EDCA params as needed
3418 *
3419 * When the first ANI peer joins the BSS, we notify SCH
3420 * When the last ANI peer leaves the BSS, we notfiy SCH
3421 */
3422void
3423limUtilCountStaAdd(
3424 tpAniSirGlobal pMac,
3425 tpDphHashNode pSta,
3426 tpPESession psessionEntry)
3427{
3428
3429 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3430 return;
3431
3432 pSta->fAniCount = 1;
3433
3434 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3435 return;
3436
3437 // get here only if this is the first ANI peer in the BSS
3438 schEdcaProfileUpdate(pMac, psessionEntry);
3439}
3440
3441void
3442limUtilCountStaDel(
3443 tpAniSirGlobal pMac,
3444 tpDphHashNode pSta,
3445 tpPESession psessionEntry)
3446{
3447
3448 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3449 return;
3450
3451 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3452 * then go ahead and update the count and profiles. This ensures
3453 * that the "number of ani station" count is properly incremented/decremented.
3454 */
3455 if (pSta->valid == 1)
3456 return;
3457
3458 pSta->fAniCount = 0;
3459
3460 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003462 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 pMac->lim.gLimNumOfAniSTAs);
3464 return;
3465 }
3466
3467 pMac->lim.gLimNumOfAniSTAs--;
3468
3469 if (pMac->lim.gLimNumOfAniSTAs != 0)
3470 return;
3471
3472 // get here only if this is the last ANI peer in the BSS
3473 schEdcaProfileUpdate(pMac, psessionEntry);
3474}
3475
Jeff Johnson295189b2012-06-20 16:38:30 -07003476/**
3477 * limSwitchChannelCback()
3478 *
3479 *FUNCTION:
3480 * This is the callback function registered while requesting to switch channel
3481 * after AP indicates a channel switch for spectrum management (11h).
3482 *
3483 *NOTE:
3484 * @param pMac Pointer to Global MAC structure
3485 * @param status Status of channel switch request
3486 * @param data User data
3487 * @param psessionEntry Session information
3488 * @return NONE
3489 */
3490void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3491 tANI_U32 *data, tpPESession psessionEntry)
3492{
3493 tSirMsgQ mmhMsg = {0};
3494 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3495
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3497
3498 /* We need to restore pre-channelSwitch state on the STA */
3499 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3500 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003501 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 return;
3503 }
3504
3505 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303506 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3507 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003509 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 return;
3511 }
3512
3513 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3514 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003515 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3517 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303518 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3520 mmhMsg.bodyval = 0;
3521
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303522 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3523 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003525}
3526
3527/**
3528 * limSwitchPrimaryChannel()
3529 *
3530 *FUNCTION:
3531 * This function changes the current operating channel
3532 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3533 *
3534 *NOTE:
3535 * @param pMac Pointer to Global MAC structure
3536 * @param newChannel new chnannel ID
3537 * @return NONE
3538 */
3539void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3540{
3541#if !defined WLAN_FEATURE_VOWIFI
3542 tANI_U32 localPwrConstraint;
3543#endif
3544
Abhishek Singh127a8442014-12-15 17:31:27 +05303545 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3546 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 psessionEntry->currentReqChannel = newChannel;
3548 psessionEntry->limRFBand = limGetRFBand(newChannel);
3549
3550 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3551
3552 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3553 pMac->lim.gpchangeChannelData = NULL;
3554
3555#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003556 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3558#else
3559 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3560 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003561 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 return;
3563 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003564 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3566#endif
3567 return;
3568}
3569
3570/**
3571 * limSwitchPrimarySecondaryChannel()
3572 *
3573 *FUNCTION:
3574 * This function changes the primary and secondary channel.
3575 * If 11h is enabled and user provides a "new channel ID"
3576 * that is different from the current operating channel,
3577 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3578 * assign notify LIM of such change.
3579 *
3580 *NOTE:
3581 * @param pMac Pointer to Global MAC structure
3582 * @param newChannel New chnannel ID (or current channel ID)
3583 * @param subband CB secondary info:
3584 * - eANI_CB_SECONDARY_NONE
3585 * - eANI_CB_SECONDARY_UP
3586 * - eANI_CB_SECONDARY_DOWN
3587 * @return NONE
3588 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003589void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003590{
3591#if !defined WLAN_FEATURE_VOWIFI
3592 tANI_U32 localPwrConstraint;
3593#endif
3594
Jeff Johnson295189b2012-06-20 16:38:30 -07003595#if !defined WLAN_FEATURE_VOWIFI
3596 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003597 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003598 return;
3599 }
3600#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303601 /* Assign the callback to resume TX once channel is changed.
3602 */
3603 psessionEntry->currentReqChannel = newChannel;
3604 psessionEntry->limRFBand = limGetRFBand(newChannel);
3605
3606 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3607
3608 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3609 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003610
Jeff Johnson295189b2012-06-20 16:38:30 -07003611#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003612 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003613#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003614 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003615#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003616
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303617#ifdef FEATURE_WLAN_DIAG_SUPPORT
3618 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3619 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3620#endif
3621
Jeff Johnsone7245742012-09-05 17:12:55 -07003622 // Store the new primary and secondary channel in session entries if different
3623 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 {
3625 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003626 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 psessionEntry->currentOperChannel = newChannel;
3629 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303630 if (psessionEntry->htSecondaryChannelOffset != limGetHTCBState(subband))
Jeff Johnsone7245742012-09-05 17:12:55 -07003631 {
3632 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003633 FL("switch old sec chnl %d --> new sec chnl %d "),
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303634 psessionEntry->htSecondaryChannelOffset, limGetHTCBState(subband));
3635 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(subband);
Jeff Johnsone7245742012-09-05 17:12:55 -07003636 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3637 {
3638 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303639 psessionEntry->apCenterChan = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003640 }
3641 else
3642 {
3643 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3644 }
3645 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003647
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303648 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3649 return;
3650
3651 if (subband > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
3652 psessionEntry->apCenterChan =
3653 limGetCenterChannel(pMac, newChannel,
3654 subband, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
3655 else
3656 psessionEntry->apCenterChan =
3657 limGetCenterChannel(pMac, newChannel,
3658 subband, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
3659
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 return;
3661}
3662
3663
3664/**
3665 * limActiveScanAllowed()
3666 *
3667 *FUNCTION:
3668 * Checks if active scans are permitted on the given channel
3669 *
3670 *LOGIC:
3671 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3672 * Need to check if the channelNum matches, then depending on the corresponding
3673 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3674 *
3675 *ASSUMPTIONS:
3676 *
3677 *NOTE:
3678 *
3679 * @param pMac Pointer to Global MAC structure
3680 * @param channelNum channel number
3681 * @return None
3682 */
3683
3684tANI_U8 limActiveScanAllowed(
3685 tpAniSirGlobal pMac,
3686 tANI_U8 channelNum)
3687{
3688 tANI_U32 i;
3689 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3690 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3691 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3692 != eSIR_SUCCESS)
3693 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003694 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 return false;
3696 }
3697
3698 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3699 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003700 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 len);
3702 return false;
3703 }
3704
3705 for (i=0; (i+1) < len; i+=2)
3706 {
3707 if (channelPair[i] == channelNum)
3708 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3709 }
3710 return false;
3711}
3712
3713/**
3714 * limTriggerBackgroundScanDuringQuietBss()
3715 *
3716 *FUNCTION:
3717 * This function is applicable to the STA only.
3718 * This function is called by limProcessQuietTimeout(),
3719 * when it is time to honor the Quiet BSS IE from the AP.
3720 *
3721 *LOGIC:
3722 * If 11H is enabled:
3723 * We cannot trigger a background scan. The STA needs to
3724 * shut-off Tx/Rx.
3725 * If 11 is not enabled:
3726 * Determine if the next channel that we are going to
3727 * scan is NOT the same channel (or not) on which the
3728 * Quiet BSS was requested.
3729 * If yes, then we cannot trigger a background scan on
3730 * this channel. Return with a false.
3731 * If no, then trigger a background scan. Return with
3732 * a true.
3733 *
3734 *ASSUMPTIONS:
3735 *
3736 *NOTE:
3737 * This API is redundant if the existing API,
3738 * limTriggerBackgroundScan(), were to return a valid
3739 * response instead of returning void.
3740 * If possible, try to revisit this API
3741 *
3742 * @param pMac Pointer to Global MAC structure
3743 * @return eSIR_TRUE, if a background scan was attempted
3744 * eSIR_FALSE, if not
3745 */
3746tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3747{
3748 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003749
3750
3751
3752 //TBD-RAJESH HOW TO GET sessionEntry?????
3753 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3754
3755 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3756 return bScanTriggered;
3757
Jeff Johnsone7245742012-09-05 17:12:55 -07003758 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 {
3760 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3761 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3762
3763 // Determine the next scan channel
3764
3765 // Get background scan channel list from CFG
3766 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3767 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3768 (tANI_U8 *) bgScanChannelList,
3769 (tANI_U32 *) &len ))
3770 {
3771 // Ensure that we do not go off scanning on the same
3772 // channel on which the Quiet BSS was requested
3773 if( psessionEntry->currentOperChannel!=
3774 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3775 {
3776 // For now, try and attempt a background scan. It will
3777 // be ideal if this API actually returns a success or
3778 // failure instead of having a void return type
3779 limTriggerBackgroundScan( pMac );
3780
3781 bScanTriggered = eSIR_TRUE;
3782 }
3783 else
3784 {
3785 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003786 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 -07003787 }
3788 }
3789 else
3790 {
3791 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003792 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 -07003793 }
3794 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 return bScanTriggered;
3796}
3797
3798
3799/**
3800 * limGetHTCapability()
3801 *
3802 *FUNCTION:
3803 * A utility function that returns the "current HT capability state" for the HT
3804 * capability of interest (as requested in the API)
3805 *
3806 *LOGIC:
3807 * This routine will return with the "current" setting of a requested HT
3808 * capability. This state info could be retrieved from -
3809 * a) CFG (for static entries)
3810 * b) Run time info
3811 * - Dynamic state maintained by LIM
3812 * - Configured at radio init time by SME
3813 *
3814 *
3815 *ASSUMPTIONS:
3816 * NA
3817 *
3818 *NOTE:
3819 *
3820 * @param pMac Pointer to Global MAC structure
3821 * @param htCap The HT capability being queried
3822 * @return tANI_U8 The current state of the requested HT capability is returned in a
3823 * tANI_U8 variable
3824 */
3825
Jeff Johnson295189b2012-06-20 16:38:30 -07003826tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3827 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003828{
3829tANI_U8 retVal = 0;
3830tANI_U8 *ptr;
3831tANI_U32 cfgValue;
3832tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3833tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3834tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3835tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3836
3837 //
3838 // Determine which CFG to read from. Not ALL of the HT
3839 // related CFG's need to be read each time this API is
3840 // accessed
3841 //
3842 if( htCap >= eHT_ANTENNA_SELECTION &&
3843 htCap < eHT_SI_GRANULARITY )
3844 {
3845 // Get Antenna Seletion HT Capabilities
3846 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3847 cfgValue = 0;
3848 ptr = (tANI_U8 *) &macASCapabilityInfo;
3849 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3850 }
3851 else
3852 {
3853 if( htCap >= eHT_TX_BEAMFORMING &&
3854 htCap < eHT_ANTENNA_SELECTION )
3855 {
3856 // Get Transmit Beam Forming HT Capabilities
3857 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3858 cfgValue = 0;
3859 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3860 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3861 }
3862 else
3863 {
3864 if( htCap >= eHT_PCO &&
3865 htCap < eHT_TX_BEAMFORMING )
3866 {
3867 // Get Extended HT Capabilities
3868 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3869 cfgValue = 0;
3870 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3871 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3872 }
3873 else
3874 {
3875 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3876 {
3877 // Get HT Capabilities
3878 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3879 cfgValue = 0;
3880 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3881 // 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
3882 *ptr++ = cfgValue & 0xff;
3883 *ptr = (cfgValue >> 8) & 0xff;
3884 }
3885 }
3886 }
3887 }
3888
3889 switch( htCap )
3890 {
3891 case eHT_LSIG_TXOP_PROTECTION:
3892 retVal = pMac->lim.gHTLsigTXOPProtection;
3893 break;
3894
3895 case eHT_STBC_CONTROL_FRAME:
3896 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3897 break;
3898
3899 case eHT_PSMP:
3900 retVal = pMac->lim.gHTPSMPSupport;
3901 break;
3902
3903 case eHT_DSSS_CCK_MODE_40MHZ:
3904 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3905 break;
3906
3907 case eHT_MAX_AMSDU_LENGTH:
3908 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3909 break;
3910
3911 case eHT_DELAYED_BA:
3912 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3913 break;
3914
3915 case eHT_RX_STBC:
3916 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3917 break;
3918
3919 case eHT_TX_STBC:
3920 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3921 break;
3922
3923 case eHT_SHORT_GI_40MHZ:
3924 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3925 break;
3926
3927 case eHT_SHORT_GI_20MHZ:
3928 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3929 break;
3930
3931 case eHT_GREENFIELD:
3932 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3933 break;
3934
3935 case eHT_MIMO_POWER_SAVE:
3936 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3937 break;
3938
3939 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003940 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 break;
3942
3943 case eHT_ADVANCED_CODING:
3944 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3945 break;
3946
3947 case eHT_MAX_RX_AMPDU_FACTOR:
3948 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3949 break;
3950
3951 case eHT_MPDU_DENSITY:
3952 retVal = pMac->lim.gHTAMpduDensity;
3953 break;
3954
3955 case eHT_PCO:
3956 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3957 break;
3958
3959 case eHT_TRANSITION_TIME:
3960 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3961 break;
3962
3963 case eHT_MCS_FEEDBACK:
3964 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3965 break;
3966
3967 case eHT_TX_BEAMFORMING:
3968 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3969 break;
3970
3971 case eHT_ANTENNA_SELECTION:
3972 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3973 break;
3974
3975 case eHT_SI_GRANULARITY:
3976 retVal = pMac->lim.gHTServiceIntervalGranularity;
3977 break;
3978
3979 case eHT_CONTROLLED_ACCESS:
3980 retVal = pMac->lim.gHTControlledAccessOnly;
3981 break;
3982
3983 case eHT_RIFS_MODE:
3984 retVal = psessionEntry->beaconParams.fRIFSMode;
3985 break;
3986
3987 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003988 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 break;
3990
3991 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003992 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003993 break;
3994
3995 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3997 retVal = psessionEntry->htOperMode;
3998 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 retVal = pMac->lim.gHTOperMode;
4000 break;
4001
4002 case eHT_BASIC_STBC_MCS:
4003 retVal = pMac->lim.gHTSTBCBasicMCS;
4004 break;
4005
4006 case eHT_DUAL_CTS_PROTECTION:
4007 retVal = pMac->lim.gHTDualCTSProtection;
4008 break;
4009
4010 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
4011 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
4012 break;
4013
4014 case eHT_PCO_ACTIVE:
4015 retVal = pMac->lim.gHTPCOActive;
4016 break;
4017
4018 case eHT_PCO_PHASE:
4019 retVal = pMac->lim.gHTPCOPhase;
4020 break;
4021
4022 default:
4023 break;
4024 }
4025
4026 return retVal;
4027}
4028
Jeff Johnson295189b2012-06-20 16:38:30 -07004029void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
4030{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304031 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004032 return;
4033}
4034
4035
4036
4037
4038/** -------------------------------------------------------------
4039\fn limEnable11aProtection
4040\brief based on config setting enables\disables 11a protection.
4041\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4042\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4043\param tpUpdateBeaconParams pBeaconParams
4044\return None
4045 -------------------------------------------------------------*/
4046tSirRetStatus
4047limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4048 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4049{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004050 if(NULL == psessionEntry)
4051 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004052 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004053 return eSIR_FAILURE;
4054 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 //overlapping protection configuration check.
4056 if(overlap)
4057 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004058 }
4059 else
4060 {
4061 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004062 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004063 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 {
4065 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004066 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 return eSIR_SUCCESS;
4068 }
4069 }
4070
4071 if (enable)
4072 {
4073 //If we are AP and HT capable, we need to set the HT OP mode
4074 //appropriately.
4075 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07004076 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 {
4078 if(overlap)
4079 {
4080 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
4081 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4082 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4083 {
4084 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4085 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4086 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4087 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4088 }
4089 }
4090 else
4091 {
4092 psessionEntry->gLim11aParams.protectionEnabled = true;
4093 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4094 {
4095 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07004096 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4098 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4099
4100 }
4101 }
4102 }
4103
4104 //This part is common for staiton as well.
4105 if(false == psessionEntry->beaconParams.llaCoexist)
4106 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004107 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
4109 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4110 }
4111 }
4112 else if (true == psessionEntry->beaconParams.llaCoexist)
4113 {
4114 //for AP role.
4115 //we need to take care of HT OP mode change if needed.
4116 //We need to take care of Overlap cases.
4117 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4118 {
4119 if(overlap)
4120 {
4121 //Overlap Legacy protection disabled.
4122 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
4123
4124 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004125 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 {
4127 // no HT op mode change if any of the overlap protection enabled.
4128 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4129 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4130 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4131
4132 {
4133 //Check if there is a need to change HT OP mode.
4134 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4135 {
4136 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4137 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4138
4139 if(psessionEntry->gLimHt20Params.protectionEnabled)
4140 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4141 else
4142 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4143 }
4144 }
4145 }
4146 }
4147 else
4148 {
4149 //Disable protection from 11A stations.
4150 psessionEntry->gLim11aParams.protectionEnabled = false;
4151 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4152
4153 //Check if any other non-HT protection enabled.
4154 //Right now we are in HT OP Mixed mode.
4155 //Change HT op mode appropriately.
4156
4157 //Change HT OP mode to 01 if any overlap protection enabled
4158 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4159 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4160 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4161
4162 {
4163 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07004164 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4166 }
4167 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4168 {
4169 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07004170 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07004171 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4172 }
4173 else
4174 {
4175 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004176 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004177 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4178 }
4179 }
4180 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4181 !psessionEntry->gLim11aParams.protectionEnabled)
4182 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004183 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4185 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4186 }
4187 }
4188 //for station role
4189 else
4190 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004191 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4193 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4194 }
4195 }
4196
4197 return eSIR_SUCCESS;
4198}
4199
4200/** -------------------------------------------------------------
4201\fn limEnable11gProtection
4202\brief based on config setting enables\disables 11g protection.
4203\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4204\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4205\param tpUpdateBeaconParams pBeaconParams
4206\return None
4207 -------------------------------------------------------------*/
4208
4209tSirRetStatus
4210limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4211 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4212{
4213
4214 //overlapping protection configuration check.
4215 if(overlap)
4216 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 }
4218 else
4219 {
4220 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4222 !psessionEntry->cfgProtection.fromllb)
4223 {
4224 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004225 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 return eSIR_SUCCESS;
4227 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 {
4229 if(!pMac->lim.cfgProtection.fromllb)
4230 {
4231 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004232 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 return eSIR_SUCCESS;
4234 }
4235 }
4236 }
4237
4238 if (enable)
4239 {
4240 //If we are AP and HT capable, we need to set the HT OP mode
4241 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4243 {
4244 if(overlap)
4245 {
4246 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004247 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004248 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 {
4250 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4251 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4252 {
4253 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4254 }
4255 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4256 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4257 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4258 //Not processing OBSS bit from other APs, as we are already taking care
4259 //of Protection from overlapping BSS based on erp IE or useProtection bit
4260 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4261 }
4262 }
4263 else
4264 {
4265 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004266 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004267 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 {
4269 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4270 {
4271 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4272 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4273 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4274 }
4275 }
4276 }
4277 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004278 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004279 {
4280 if(overlap)
4281 {
4282 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4283 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4284 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4285 {
4286 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4287 }
4288 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4289 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4290 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4291 //Not processing OBSS bit from other APs, as we are already taking care
4292 //of Protection from overlapping BSS based on erp IE or useProtection bit
4293 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4294 }
4295 else
4296 {
4297 psessionEntry->gLim11bParams.protectionEnabled = true;
4298 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4299 {
4300 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4301 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4302 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4303 }
4304 }
4305 }
4306
4307 //This part is common for staiton as well.
4308 if(false == psessionEntry->beaconParams.llbCoexist)
4309 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004310 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4312 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4313 }
4314 }
4315 else if (true == psessionEntry->beaconParams.llbCoexist)
4316 {
4317 //for AP role.
4318 //we need to take care of HT OP mode change if needed.
4319 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4321 {
4322 if(overlap)
4323 {
4324 //Overlap Legacy protection disabled.
4325 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4326
4327 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004328 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004329 {
4330 // no HT op mode change if any of the overlap protection enabled.
4331 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4332 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4333 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4334 {
4335 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004336 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 {
4338 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4339 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4340 if(psessionEntry->gLimHt20Params.protectionEnabled){
4341 //Commenting out beacuse of CR 258588 WFA cert
4342 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4343 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4344 }
4345 else
4346 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4347 }
4348 }
4349 }
4350 }
4351 else
4352 {
4353 //Disable protection from 11B stations.
4354 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004355 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004356 //Check if any other non-HT protection enabled.
4357 if(!psessionEntry->gLim11gParams.protectionEnabled)
4358 {
4359 //Right now we are in HT OP Mixed mode.
4360 //Change HT op mode appropriately.
4361 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4362
4363 //Change HT OP mode to 01 if any overlap protection enabled
4364 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4365 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4366 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4367 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4368 {
4369 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004370 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004371 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4372 }
4373 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4374 {
4375 //Commenting because of CR 258588 WFA cert
4376 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4377 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004378 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4380 }
4381 else
4382 {
4383 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4384 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4385 }
4386 }
4387 }
4388 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4389 !psessionEntry->gLim11bParams.protectionEnabled)
4390 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004391 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4393 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4394 }
4395 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 {
4397 if(overlap)
4398 {
4399 //Overlap Legacy protection disabled.
4400 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4401
4402 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004403 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 {
4405 // no HT op mode change if any of the overlap protection enabled.
4406 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4407 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4408 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4409
4410 {
4411 //Check if there is a need to change HT OP mode.
4412 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4413 {
4414 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4415 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4416 if(psessionEntry->gLimHt20Params.protectionEnabled)
4417 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4418 else
4419 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4420 }
4421 }
4422 }
4423 }
4424 else
4425 {
4426 //Disable protection from 11B stations.
4427 psessionEntry->gLim11bParams.protectionEnabled = false;
4428 //Check if any other non-HT protection enabled.
4429 if(!psessionEntry->gLim11gParams.protectionEnabled)
4430 {
4431 //Right now we are in HT OP Mixed mode.
4432 //Change HT op mode appropriately.
4433 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4434
4435 //Change HT OP mode to 01 if any overlap protection enabled
4436 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4437 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4438 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4439 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4440
4441 {
4442 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4443 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4444 }
4445 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4446 {
4447 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4448 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4449 }
4450 else
4451 {
4452 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4453 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4454 }
4455 }
4456 }
4457 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4458 !psessionEntry->gLim11bParams.protectionEnabled)
4459 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004460 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004461 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4462 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4463 }
4464 }
4465 //for station role
4466 else
4467 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004468 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4470 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4471 }
4472 }
4473 return eSIR_SUCCESS;
4474}
4475
4476/** -------------------------------------------------------------
4477\fn limEnableHtProtectionFrom11g
4478\brief based on cofig enables\disables protection from 11g.
4479\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4480\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4481\param tpUpdateBeaconParams pBeaconParams
4482\return None
4483 -------------------------------------------------------------*/
4484tSirRetStatus
4485limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4486 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4487{
Jeff Johnsone7245742012-09-05 17:12:55 -07004488 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4490
4491 //overlapping protection configuration check.
4492 if(overlap)
4493 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4495 {
4496 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004497 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 return eSIR_SUCCESS;
4499 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 {
4501 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004502 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 return eSIR_SUCCESS;
4504 }
4505 }
4506 else
4507 {
4508 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4510 !psessionEntry->cfgProtection.fromllg){
4511 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004512 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 return eSIR_SUCCESS;
4514 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 {
4516 if(!pMac->lim.cfgProtection.fromllg)
4517 {
4518 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004519 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 return eSIR_SUCCESS;
4521 }
4522 }
4523 }
4524 if (enable)
4525 {
4526 //If we are AP and HT capable, we need to set the HT OP mode
4527 //appropriately.
4528
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4530 {
4531 if(overlap)
4532 {
4533 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4534 //11g exists in overlap BSS.
4535 //need not to change the operating mode to overlap_legacy
4536 //if higher or same protection operating mode is enabled right now.
4537 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4538 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4539 {
4540 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4541 }
4542 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304543 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 }
4545 else
4546 {
4547 //11g is associated to an AP operating in 11n mode.
4548 //Change the HT operating mode to 'mixed mode'.
4549 psessionEntry->gLim11gParams.protectionEnabled = true;
4550 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4551 {
4552 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4553 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304554 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 }
4556 }
4557 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 {
4559 if(overlap)
4560 {
4561 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4562 //11g exists in overlap BSS.
4563 //need not to change the operating mode to overlap_legacy
4564 //if higher or same protection operating mode is enabled right now.
4565 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4566 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4567 {
4568 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4569 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4570 }
4571 }
4572 else
4573 {
4574 //11g is associated to an AP operating in 11n mode.
4575 //Change the HT operating mode to 'mixed mode'.
4576 psessionEntry->gLim11gParams.protectionEnabled = true;
4577 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4578 {
4579 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4580 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304581 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 }
4583 }
4584 }
4585
4586 //This part is common for staiton as well.
4587 if(false == psessionEntry->beaconParams.llgCoexist)
4588 {
4589 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4590 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4593 {
4594 // As operating mode changed after G station assoc some way to update beacon
4595 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4596 //pMac->sch.schObject.fBeaconChanged = 1;
4597 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4598 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 }
4600 else if (true == psessionEntry->beaconParams.llgCoexist)
4601 {
4602 //for AP role.
4603 //we need to take care of HT OP mode change if needed.
4604 //We need to take care of Overlap cases.
4605
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4607 {
4608 if(overlap)
4609 {
4610 //Overlap Legacy protection disabled.
4611 if (psessionEntry->gLim11gParams.numSta == 0)
4612 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4613
4614 // no HT op mode change if any of the overlap protection enabled.
4615 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4616 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4617 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4618 {
4619 //Check if there is a need to change HT OP mode.
4620 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4621 {
4622 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4623 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4624
4625 if(psessionEntry->gLimHt20Params.protectionEnabled){
4626 //Commenting because of CR 258588 WFA cert
4627 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4628 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4629 }
4630 else
4631 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4632 }
4633 }
4634 }
4635 else
4636 {
4637 //Disable protection from 11G stations.
4638 psessionEntry->gLim11gParams.protectionEnabled = false;
4639 //Check if any other non-HT protection enabled.
4640 if(!psessionEntry->gLim11bParams.protectionEnabled)
4641 {
4642
4643 //Right now we are in HT OP Mixed mode.
4644 //Change HT op mode appropriately.
4645 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4646
4647 //Change HT OP mode to 01 if any overlap protection enabled
4648 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4649 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4650 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4651 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4652
4653 {
4654 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4655 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4656 }
4657 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4658 {
4659 //Commenting because of CR 258588 WFA cert
4660 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4661 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4662 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4663 }
4664 else
4665 {
4666 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4667 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4668 }
4669 }
4670 }
4671 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4672 !psessionEntry->gLim11gParams.protectionEnabled)
4673 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004674 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004675 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4676 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4677 }
4678 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004679 {
4680 if(overlap)
4681 {
4682 //Overlap Legacy protection disabled.
4683 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4684
4685 // no HT op mode change if any of the overlap protection enabled.
4686 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4687 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4688 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4689 {
4690 //Check if there is a need to change HT OP mode.
4691 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4692 {
4693 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4694 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4695
4696 if(psessionEntry->gLimHt20Params.protectionEnabled)
4697 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4698 else
4699 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4700 }
4701 }
4702 }
4703 else
4704 {
4705 //Disable protection from 11G stations.
4706 psessionEntry->gLim11gParams.protectionEnabled = false;
4707 //Check if any other non-HT protection enabled.
4708 if(!psessionEntry->gLim11bParams.protectionEnabled)
4709 {
4710
4711 //Right now we are in HT OP Mixed mode.
4712 //Change HT op mode appropriately.
4713 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4714
4715 //Change HT OP mode to 01 if any overlap protection enabled
4716 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4717 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4718 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4719 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4720
4721 {
4722 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4723 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4724 }
4725 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4726 {
4727 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4728 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4729 }
4730 else
4731 {
4732 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4733 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4734 }
4735 }
4736 }
4737 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4738 !psessionEntry->gLim11gParams.protectionEnabled)
4739 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004740 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4742 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4743 }
4744 }
4745 //for station role
4746 else
4747 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004748 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4750 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4751 }
4752 }
4753 return eSIR_SUCCESS;
4754}
4755//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4756//This check will be done at the caller.
4757
4758/** -------------------------------------------------------------
4759\fn limEnableHtObssProtection
4760\brief based on cofig enables\disables obss protection.
4761\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4762\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4763\param tpUpdateBeaconParams pBeaconParams
4764\return None
4765 -------------------------------------------------------------*/
4766tSirRetStatus
4767limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4768 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4769{
4770
4771
Jeff Johnsone7245742012-09-05 17:12:55 -07004772 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 return eSIR_SUCCESS; // this protection is only for HT stations.
4774
4775 //overlapping protection configuration check.
4776 if(overlap)
4777 {
4778 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 }
4780 else
4781 {
4782 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004783 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4784 { //ToDo Update this field
4785 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004786 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 return eSIR_SUCCESS;
4788 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 {
4790 if(!pMac->lim.cfgProtection.obss)
4791 { //ToDo Update this field
4792 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004793 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 return eSIR_SUCCESS;
4795 }
4796 }
4797 }
4798
4799
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4801 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004803 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 psessionEntry->beaconParams.gHTObssMode = true;
4805 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4806
4807 }
4808 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4809 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004810 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 psessionEntry->beaconParams.gHTObssMode = false;
4812 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4813
4814 }
4815//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4816 if (!enable && !overlap)
4817 {
4818 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4819 }
4820 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 {
4822 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4823 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004824 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 psessionEntry->beaconParams.gHTObssMode = true;
4826 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4827
4828 }
4829 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4830 {
4831
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004832 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 psessionEntry->beaconParams.gHTObssMode = false;
4834 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4835
4836 }
4837 }
4838 return eSIR_SUCCESS;
4839}
4840/** -------------------------------------------------------------
4841\fn limEnableHT20Protection
4842\brief based on cofig enables\disables protection from Ht20.
4843\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4844\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4845\param tpUpdateBeaconParams pBeaconParams
4846\return None
4847 -------------------------------------------------------------*/
4848tSirRetStatus
4849limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4850 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4851{
Jeff Johnsone7245742012-09-05 17:12:55 -07004852 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 return eSIR_SUCCESS; // this protection is only for HT stations.
4854
4855 //overlapping protection configuration check.
4856 if(overlap)
4857 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 }
4859 else
4860 {
4861 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4863 !psessionEntry->cfgProtection.ht20)
4864 {
4865 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004866 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 return eSIR_SUCCESS;
4868 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 {
4870 if(!pMac->lim.cfgProtection.ht20)
4871 {
4872 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004873 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 return eSIR_SUCCESS;
4875 }
4876 }
4877 }
4878
4879 if (enable)
4880 {
4881 //If we are AP and HT capable, we need to set the HT OP mode
4882 //appropriately.
4883
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4885 if(overlap)
4886 {
4887 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4888 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4889 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4890 {
4891 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4892 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4893 }
4894 }
4895 else
4896 {
4897 psessionEntry->gLimHt20Params.protectionEnabled = true;
4898 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4899 {
4900 //Commenting because of CR 258588 WFA cert
4901 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4902 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4903 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4904 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4905 }
4906 }
4907 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 {
4909 if(overlap)
4910 {
4911 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4912 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4913 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4914 {
4915 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4916 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4917 }
4918 }
4919 else
4920 {
4921 psessionEntry->gLimHt20Params.protectionEnabled = true;
4922 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4923 {
4924 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4925 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4926 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4927 }
4928 }
4929 }
4930
4931 //This part is common for staiton as well.
4932 if(false == psessionEntry->beaconParams.ht20Coexist)
4933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004934 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4936 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4937 }
4938 }
4939 else if (true == psessionEntry->beaconParams.ht20Coexist)
4940 {
4941 //for AP role.
4942 //we need to take care of HT OP mode change if needed.
4943 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4945 if(overlap)
4946 {
4947 //Overlap Legacy protection disabled.
4948 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4949
4950 // no HT op mode change if any of the overlap protection enabled.
4951 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4952 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4953 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4954 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4955 {
4956
4957 //Check if there is a need to change HT OP mode.
4958 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4959 {
4960 if(psessionEntry->gLimHt20Params.protectionEnabled)
4961 {
4962 //Commented beacuse of CR 258588 for WFA Cert
4963 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4964 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4965 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4966 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4967 }
4968 else
4969 {
4970 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4971 }
4972 }
4973 }
4974 }
4975 else
4976 {
4977 //Disable protection from 11G stations.
4978 psessionEntry->gLimHt20Params.protectionEnabled = false;
4979
4980 //Change HT op mode appropriately.
4981 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4982 {
4983 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4984 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4985 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4986 }
4987 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004988 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4990 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4991 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 {
4993 if(overlap)
4994 {
4995 //Overlap Legacy protection disabled.
4996 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4997
4998 // no HT op mode change if any of the overlap protection enabled.
4999 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
5000 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
5001 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
5002 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
5003 {
5004
5005 //Check if there is a need to change HT OP mode.
5006 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
5007 {
5008 if(psessionEntry->gLimHt20Params.protectionEnabled)
5009 {
5010 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
5011 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5012 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5013 }
5014 else
5015 {
5016 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5017 }
5018 }
5019 }
5020 }
5021 else
5022 {
5023 //Disable protection from 11G stations.
5024 psessionEntry->gLimHt20Params.protectionEnabled = false;
5025
5026 //Change HT op mode appropriately.
5027 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
5028 {
5029 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5030 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5031 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5032 }
5033 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005034 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5036 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5037 }
5038 //for station role
5039 else
5040 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005041 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005042 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5043 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5044 }
5045 }
5046
5047 return eSIR_SUCCESS;
5048}
5049
5050/** -------------------------------------------------------------
5051\fn limEnableHTNonGfProtection
5052\brief based on cofig enables\disables protection from NonGf.
5053\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5054\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5055\param tpUpdateBeaconParams pBeaconParams
5056\return None
5057 -------------------------------------------------------------*/
5058tSirRetStatus
5059limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5060 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5061{
Jeff Johnsone7245742012-09-05 17:12:55 -07005062 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 return eSIR_SUCCESS; // this protection is only for HT stations.
5064
5065 //overlapping protection configuration check.
5066 if(overlap)
5067 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 }
5069 else
5070 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005071 //normal protection config check
5072 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5073 !psessionEntry->cfgProtection.nonGf)
5074 {
5075 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005076 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005077 return eSIR_SUCCESS;
5078 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 {
5080 //normal protection config check
5081 if(!pMac->lim.cfgProtection.nonGf)
5082 {
5083 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005084 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 return eSIR_SUCCESS;
5086 }
5087 }
5088 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005089 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5090 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5091 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005092 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5094 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5095 }
5096 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5097 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005098 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005099 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5100 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5101 }
5102 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 {
5104 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005106 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005107 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5108 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5109 }
5110 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5111 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005112 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005113 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5114 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5115 }
5116 }
5117
5118 return eSIR_SUCCESS;
5119}
5120
5121/** -------------------------------------------------------------
5122\fn limEnableHTLsigTxopProtection
5123\brief based on cofig enables\disables LsigTxop protection.
5124\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5125\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5126\param tpUpdateBeaconParams pBeaconParams
5127\return None
5128 -------------------------------------------------------------*/
5129tSirRetStatus
5130limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5131 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5132{
Jeff Johnsone7245742012-09-05 17:12:55 -07005133 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005134 return eSIR_SUCCESS; // this protection is only for HT stations.
5135
5136 //overlapping protection configuration check.
5137 if(overlap)
5138 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 }
5140 else
5141 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005142 //normal protection config check
5143 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5144 !psessionEntry->cfgProtection.lsigTxop)
5145 {
5146 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005147 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005148 return eSIR_SUCCESS;
5149 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 {
5151 //normal protection config check
5152 if(!pMac->lim.cfgProtection.lsigTxop)
5153 {
5154 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005155 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005156 return eSIR_SUCCESS;
5157 }
5158 }
5159 }
5160
5161
Jeff Johnson295189b2012-06-20 16:38:30 -07005162 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5163 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5164 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005165 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005166 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5167 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5168 }
5169 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005171 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5173 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5174 }
5175 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005176 {
5177 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5178 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005179 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005180 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5181 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5182 }
5183 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5184 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005185 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005186 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5187 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5188 }
5189 }
5190 return eSIR_SUCCESS;
5191}
5192//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5193//This check will be done at the caller.
5194/** -------------------------------------------------------------
5195\fn limEnableHtRifsProtection
5196\brief based on cofig enables\disables Rifs protection.
5197\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5198\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5199\param tpUpdateBeaconParams pBeaconParams
5200\return None
5201 -------------------------------------------------------------*/
5202tSirRetStatus
5203limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5204 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5205{
Jeff Johnsone7245742012-09-05 17:12:55 -07005206 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005207 return eSIR_SUCCESS; // this protection is only for HT stations.
5208
5209
5210 //overlapping protection configuration check.
5211 if(overlap)
5212 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 }
5214 else
5215 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005216 //normal protection config check
5217 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5218 !psessionEntry->cfgProtection.rifs)
5219 {
5220 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005221 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005222 return eSIR_SUCCESS;
5223 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005224 {
5225 //normal protection config check
5226 if(!pMac->lim.cfgProtection.rifs)
5227 {
5228 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005229 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005230 return eSIR_SUCCESS;
5231 }
5232 }
5233 }
5234
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5236 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5237 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005239 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5241 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5242 }
5243 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5244 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5245 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005246 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005247 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5248 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5249 }
5250 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005251 {
5252 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5253 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5254 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005255 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005256 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5257 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5258 }
5259 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5260 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5261 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005262 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005263 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5264 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5265 }
5266 }
5267 return eSIR_SUCCESS;
5268}
5269
5270// ---------------------------------------------------------------------
5271/**
5272 * limEnableShortPreamble
5273 *
5274 * FUNCTION:
5275 * Enable/Disable short preamble
5276 *
5277 * LOGIC:
5278 *
5279 * ASSUMPTIONS:
5280 *
5281 * NOTE:
5282 *
5283 * @param enable Flag to enable/disable short preamble
5284 * @return None
5285 */
5286
5287tSirRetStatus
5288limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5289{
5290 tANI_U32 val;
5291
5292 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5293 {
5294 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005295 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005296 return eSIR_FAILURE;
5297 }
5298
5299 if (!val)
5300 return eSIR_SUCCESS;
5301
5302 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5303 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005304 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 return eSIR_FAILURE;
5306 }
5307
5308 if (!val) // 11G short preamble switching is disabled.
5309 return eSIR_SUCCESS;
5310
5311 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5312 {
5313 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5314 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005315 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 psessionEntry->beaconParams.fShortPreamble = true;
5317 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5318 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5319 }
5320 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5321 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005322 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005323 psessionEntry->beaconParams.fShortPreamble = false;
5324 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5325 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5326 }
5327 }
5328
5329 return eSIR_SUCCESS;
5330 }
5331
5332/**
5333 * limTxComplete
5334 *
5335 * Function:
5336 * This is LIM's very own "TX MGMT frame complete" completion routine.
5337 *
5338 * Logic:
5339 * LIM wants to send a MGMT frame (broadcast or unicast)
5340 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5341 * LIM transmits the MGMT frame using the API:
5342 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5343 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5344 * HDD, if it determines that a TX completion routine (in this case
5345 * limTxComplete) has been provided, will invoke this callback
5346 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5347 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5348 *
5349 * Assumptions:
5350 * Presently, this is ONLY being used for MGMT frames/packets
5351 * TODO:
5352 * Would it do good for LIM to have some sort of "signature" validation to
5353 * ensure that the pData argument passed in was a buffer that was actually
5354 * allocated by LIM and/or is not corrupted?
5355 *
5356 * Note: FIXME and TODO
5357 * Looks like palPktFree() is interested in pPacket. But, when this completion
5358 * routine is called, only pData is made available to LIM!!
5359 *
5360 * @param void A pointer to pData. Shouldn't it be pPacket?!
5361 *
5362 * @return none
5363 */
5364void limTxComplete( tHalHandle hHal, void *pData )
5365{
5366 tpAniSirGlobal pMac;
5367 pMac = (tpAniSirGlobal)hHal;
5368
5369#ifdef FIXME_PRIMA
5370 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5371#ifdef TRACE_RECORD
5372 {
5373 tpSirMacMgmtHdr mHdr;
5374 v_U8_t *pRxBd;
5375 vos_pkt_t *pVosPkt;
5376 VOS_STATUS vosStatus;
5377
5378
5379
5380 pVosPkt = (vos_pkt_t *)pData;
5381 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5382
5383 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5384 {
5385 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005386
5387 }
5388 }
5389#endif
5390#endif
5391
5392 palPktFree( pMac->hHdd,
5393 HAL_TXRX_FRM_802_11_MGMT,
5394 (void *) NULL, // this is ignored and will likely be removed from this API
5395 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5396}
5397
5398/**
5399 * \brief This function updates lim global structure, if CB parameters in the BSS
5400 * have changed, and sends an indication to HAL also with the
5401 * updated HT Parameters.
5402 * This function does not detect the change in the primary channel, that is done as part
5403 * of channel Swtich IE processing.
5404 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5405 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5406 *
5407 *
5408 * \param pMac Pointer to global MAC structure
5409 *
5410 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5411 * Probe Response
5412 *
5413 * \param bssIdx BSS Index of the Bss to which Station is associated.
5414 *
5415 *
5416 */
5417
5418void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5419 tDot11fIEHTInfo *pHTInfo,
5420 tANI_U8 bssIdx,
5421 tpPESession psessionEntry)
5422{
Jeff Johnsone7245742012-09-05 17:12:55 -07005423 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005424#if !defined WLAN_FEATURE_VOWIFI
5425 tANI_U32 localPwrConstraint;
5426#endif
5427
5428 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005429 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 return;
5431
Abhishek Singhe3beee22017-07-31 15:35:40 +05305432 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5433 psessionEntry->force_24ghz_in_ht20) {
5434 limLog(pMac, LOG1,
5435 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5436 return;
5437 }
5438
Jeff Johnson295189b2012-06-20 16:38:30 -07005439#if !defined WLAN_FEATURE_VOWIFI
5440 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005441 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005442 return;
5443 }
5444#endif
5445
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305446 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5447 {
5448 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5449 return;
5450 }
5451
Mihir Shetebc160b72014-08-22 14:10:39 +05305452 /*
5453 * Do not try to switch channel if RoC is in progress. RoC code path uses
5454 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5455 * has started listening on the channel requested as part of RoC, if we set
5456 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5457 * upper layers will think that the channel change is not successful and the
5458 * RoC from the upper layer perspective will never end...
5459 */
5460 if (pMac->lim.gpLimRemainOnChanReq)
5461 {
5462 limLog( pMac, LOGE, FL( "RoC is in progress"));
5463 return;
5464 }
5465
Jeff Johnsone7245742012-09-05 17:12:55 -07005466 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5467 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005468 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005469 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5470 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5471 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5472 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005473
5474 // Notify HAL
5475 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005476 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005477 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005478 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005479 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005480 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005481 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5482 pMac->lim.gpchangeChannelCallback = NULL;
5483 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005484
5485#if defined WLAN_FEATURE_VOWIFI
5486 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5487 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5488#else
5489 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5490 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5491#endif
5492
5493 //In case of IBSS, if STA should update HT Info IE in its beacons.
5494 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5495 {
5496 schSetFixedBeaconFields(pMac,psessionEntry);
5497 }
5498
5499 }
5500} // End limUpdateStaRunTimeHTParams.
5501
5502/**
5503 * \brief This function updates the lim global structure, if any of the
5504 * HT Capabilities have changed.
5505 *
5506 *
5507 * \param pMac Pointer to Global MAC structure
5508 *
5509 * \param pHTCapability Pointer to HT Capability Information Element
5510 * obtained from a Beacon or Probe Response
5511 *
5512 *
5513 *
5514 */
5515
5516void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5517 tDot11fIEHTCaps *pHTCaps )
5518{
5519
5520 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5521 {
5522 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5523 // Send change notification to HAL
5524 }
5525
5526 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5527 {
5528 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5529 // Send change notification to HAL
5530 }
5531
5532 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5533 {
5534 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5535 // Send change notification to HAL
5536 }
5537
5538
5539} // End limUpdateStaRunTimeHTCapability.
5540
5541/**
5542 * \brief This function updates lim global structure, if any of the HT
5543 * Info Parameters have changed.
5544 *
5545 *
5546 * \param pMac Pointer to the global MAC structure
5547 *
5548 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5549 * Probe Response
5550 *
5551 *
5552 */
5553
5554void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305555 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005556{
Jeff Johnsone7245742012-09-05 17:12:55 -07005557 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005559 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 // Send change notification to HAL
5561 }
5562
5563 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5564 {
5565 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5566 // Send change notification to HAL
5567 }
5568
5569 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5570 {
5571 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5572 // Send change notification to HAL
5573 }
5574
5575 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5576 {
5577 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5578 // Send change notification to HAL
5579 }
5580
5581 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5582 {
5583 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5584 }
5585
5586 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5587 {
5588 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5589 // Send change notification to HAL
5590 }
5591
5592 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5593 {
5594 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5595 // Send change notification to HAL
5596 }
5597
5598 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5599 {
5600 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5601 // Send change notification to HAL
5602 }
5603
5604 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5605 {
5606 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5607 // Send change notification to HAL
5608 }
5609
5610 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5611 {
5612 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5613 // Send change notification to HAL
5614 }
5615
5616 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5617 {
5618 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5619 // Send change notification to HAL
5620 }
5621
5622} // End limUpdateStaRunTimeHTInfo.
5623
5624
5625/** -------------------------------------------------------------
5626\fn limProcessHalIndMessages
5627\brief callback function for HAL indication
5628\param tpAniSirGlobal pMac
5629\param tANI_U32 mesgId
5630\param void *mesgParam
5631\return tSirRetStatu - status
5632 -------------------------------------------------------------*/
5633
5634tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5635{
5636 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5637 tSirMsgQ msg;
5638
5639 switch(msgId)
5640 {
5641 case SIR_LIM_DEL_TS_IND:
5642 case SIR_LIM_ADD_BA_IND:
5643 case SIR_LIM_DEL_BA_ALL_IND:
5644 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5645 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305646 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 msg.type = (tANI_U16) msgId;
5648 msg.bodyptr = msgParam;
5649 msg.bodyval = 0;
5650 break;
5651
5652 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305653 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005654 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005655 return eSIR_FAILURE;
5656 }
5657
5658 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5659 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305660 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005661 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5662 return eSIR_FAILURE;
5663 }
5664 return eSIR_SUCCESS;
5665}
5666
5667/** -------------------------------------------------------------
5668\fn limValidateDeltsReq
5669\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5670\param tpAniSirGlobal pMac
5671\param tpSirDeltsReq pDeltsReq
5672\param tSirMacAddr peerMacAddr
5673\return eSirRetStatus - status
5674 -------------------------------------------------------------*/
5675
5676tSirRetStatus
5677limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5678{
5679 tpDphHashNode pSta;
5680 tANI_U8 tsStatus;
5681 tSirMacTSInfo *tsinfo;
5682 tANI_U32 i;
5683 tANI_U8 tspecIdx;
5684 /* if sta
5685 * - verify assoc state
5686 * - del tspec locally
5687 * if ap,
5688 * - verify sta is in assoc state
5689 * - del sta tspec locally
5690 */
5691 if(pDeltsReq == NULL)
5692 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005693 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005694 return eSIR_FAILURE;
5695 }
5696
5697 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5698 {
5699 tANI_U32 val;
5700
5701 // station always talks to the AP
5702 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5703
5704 val = sizeof(tSirMacAddr);
5705 #if 0
5706 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5707 {
5708 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005709 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 return eSIR_FAILURE;
5711 }
5712 #endif// TO SUPPORT BT-AMP
5713 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5714
5715 }
5716 else
5717 {
5718 tANI_U16 assocId;
5719 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5720
5721 assocId = pDeltsReq->aid;
5722 if (assocId != 0)
5723 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5724 else
5725 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5726
5727 if (pSta != NULL)
5728 // TBD: check sta assoc state as well
5729 for (i =0; i < sizeof(tSirMacAddr); i++)
5730 macaddr[i] = pSta->staAddr[i];
5731 }
5732
5733 if (pSta == NULL)
5734 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005735 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005736 return eSIR_FAILURE;
5737 }
5738
5739 if ((! pSta->valid) ||
5740 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5741 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005742 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005743 return eSIR_FAILURE;
5744 }
5745
5746 pDeltsReq->req.wsmTspecPresent = 0;
5747 pDeltsReq->req.wmeTspecPresent = 0;
5748 pDeltsReq->req.lleTspecPresent = 0;
5749
5750 if ((pSta->wsmEnabled) &&
5751 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5752 pDeltsReq->req.wsmTspecPresent = 1;
5753 else if (pSta->wmeEnabled)
5754 pDeltsReq->req.wmeTspecPresent = 1;
5755 else if (pSta->lleEnabled)
5756 pDeltsReq->req.lleTspecPresent = 1;
5757 else
5758 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005759 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005760 return eSIR_FAILURE;
5761 }
5762
5763 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5764 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305765 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005766 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005767 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305768 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005769
5770 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005771
5772 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5773 != eSIR_SUCCESS)
5774 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005775 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005776 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5777 return eSIR_FAILURE;
5778 }
5779 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5780 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5781 {
5782 //edca only now.
5783 }
5784 else
5785 {
5786 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5787 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5788 {
5789 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305790 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5791 pSta->staIndex,
5792 tspecIdx,
5793 pDeltsReq->req,
5794 psessionEntry->peSessionId,
5795 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005797 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005798 tsinfo->traffic.userPrio);
5799 return eSIR_FAILURE;
5800 }
5801 }
5802 }
5803 return eSIR_SUCCESS;
5804}
5805
5806/** -------------------------------------------------------------
5807\fn limRegisterHalIndCallBack
5808\brief registers callback function to HAL for any indication.
5809\param tpAniSirGlobal pMac
5810\return none.
5811 -------------------------------------------------------------*/
5812void
5813limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5814{
5815 tSirMsgQ msg;
5816 tpHalIndCB pHalCB;
5817
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305818 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5819 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005820 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305821 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005822 return;
5823 }
5824
5825 pHalCB->pHalIndCB = limProcessHalIndMessages;
5826
5827 msg.type = WDA_REGISTER_PE_CALLBACK;
5828 msg.bodyptr = pHalCB;
5829 msg.bodyval = 0;
5830
Jeff Johnsone7245742012-09-05 17:12:55 -07005831 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005832 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5833 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305834 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005835 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 }
5837
5838 return;
5839}
5840
5841
5842/** -------------------------------------------------------------
5843\fn limProcessAddBaInd
5844
5845\brief handles the BA activity check timeout indication coming from HAL.
5846 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5847\param tpAniSirGlobal pMac
5848\param tSirMsgQ limMsg
5849\return None
5850-------------------------------------------------------------*/
5851void
5852limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5853{
5854 tANI_U8 i;
5855 tANI_U8 tid;
5856 tANI_U16 assocId;
5857 tpDphHashNode pSta;
5858 tpAddBaCandidate pBaCandidate;
5859 tANI_U32 baCandidateCnt;
5860 tpBaActivityInd pBaActivityInd;
5861 tpPESession psessionEntry;
5862 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005863#ifdef FEATURE_WLAN_TDLS
5864 boolean htCapable = FALSE;
5865#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005866
5867
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005868 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005869 return;
5870
5871 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5872 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5873
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005874 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005875 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005876 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305877 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005878 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 return;
5880 }
5881
5882 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005883#ifdef FEATURE_WLAN_TDLS
5884 if ((baCandidateCnt > pMac->lim.maxStation))
5885#else
5886 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5887#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005888 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005890 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005891 return;
5892 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005893
5894#ifdef FEATURE_WLAN_TDLS
5895 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5896 //AP capability
5897 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5898
5899 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5900 {
5901 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5902 if ((NULL == pSta) || (!pSta->valid))
5903 continue;
5904
5905 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5906 htCapable = pSta->mlmStaContext.htCapability;
5907 else
5908 htCapable = psessionEntry->htCapability;
5909
5910 if (htCapable)
5911 break;
5912 }
5913 if (!htCapable)
5914 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305915 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005916 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005917 return;
5918 }
5919#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005920
5921 //delete the complete dialoguetoken linked list
5922 limDeleteDialogueTokenList(pMac);
5923 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5924
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005925 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005926 {
5927 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005928 if ((NULL == pSta) || (!pSta->valid))
5929 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005930
5931 for (tid=0; tid<STACFG_MAX_TC; tid++)
5932 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005933 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 (pBaCandidate->baInfo[tid].fBaEnable))
5935 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305936 limLog(pMac, LOG1,
5937 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5938 pSta->staIndex, tid,
5939 pBaCandidate->baInfo[tid].startingSeqNum);
5940 limPostMlmAddBAReq(pMac, pSta, tid,
5941 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 }
5943 }
5944 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305945 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005946 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005947 return;
5948}
5949
5950
5951/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005952\fn limDeleteBASessions
5953\brief Deletes all the exisitng BA sessions for given session
5954 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005955\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005956\param tpPESession pSessionEntry
5957\param tANI_U32 baDirection
5958\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005959-------------------------------------------------------------*/
5960
5961void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005962limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305963 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005964{
5965 tANI_U32 i;
5966 tANI_U8 tid;
5967 tpDphHashNode pSta;
5968
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005969 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005970 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005971 limLog(pMac, LOGE, FL("Session does not exist"));
5972 }
5973 else
5974 {
5975 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005977 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5978 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5979 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5980 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005981 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005982 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005983 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005984 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5985 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005986 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005987 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5988 (baDirection & BA_INITIATOR))
5989 {
5990 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305991 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005992 pSessionEntry);
5993 }
5994 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5995 (baDirection & BA_RECIPIENT))
5996 {
5997 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305998 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005999 pSessionEntry);
6000 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07006001 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006002 }
6003 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006004 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
6005 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
6006 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006007 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006008 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
6009 &pSessionEntry->dph.dphHashTable);
6010 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006011 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006012 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
6013 (baDirection & BA_INITIATOR))
6014 {
6015 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306016 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006017 pSessionEntry);
6018 }
6019 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
6020 (baDirection & BA_RECIPIENT))
6021 {
6022 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306023 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006024 pSessionEntry);
6025 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006026 }
6027 }
6028 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006029 }
6030}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006031
6032/** -------------------------------------------------------------
6033\fn limDelAllBASessions
6034\brief Deletes all the exisitng BA sessions.
6035\param tpAniSirGlobal pMac
6036\return None
6037-------------------------------------------------------------*/
6038
6039void limDelAllBASessions(tpAniSirGlobal pMac)
6040{
6041 tANI_U32 i;
6042 tpPESession pSessionEntry;
6043
6044 for (i = 0; i < pMac->lim.maxBssId; i++)
6045 {
6046 pSessionEntry = peFindSessionBySessionId(pMac, i);
6047 if (pSessionEntry)
6048 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306049 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
6050 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006051 }
6052 }
6053}
6054
6055/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006056\fn limProcessDelTsInd
6057\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
6058 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
6059\param tpAniSirGlobal pMac
6060\param tSirMsgQ limMsg
6061\return None
6062-------------------------------------------------------------*/
6063void
6064limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
6065{
6066 tpDphHashNode pSta;
6067 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
6068 tpSirDeltsReq pDelTsReq = NULL;
6069 tSirMacAddr peerMacAddr;
6070 tpSirDeltsReqInfo pDelTsReqInfo;
6071 tpLimTspecInfo pTspecInfo;
6072 tpPESession psessionEntry;
6073 tANI_U8 sessionId;
6074
6075if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
6076 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006077 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306078 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006079 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006080 return;
6081 }
6082
6083 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
6084 if(pTspecInfo->inuse == false)
6085 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006086 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07006087 goto error1;
6088 }
6089
6090 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
6091 if(pSta == NULL)
6092 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006093 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006094 pTspecInfo->assocId);
6095 goto error1;
6096 }
6097
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
6099 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006100 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306101 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006102 goto error1;
6103 }
6104
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306105 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006106
6107 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306108 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006109 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306110 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006111
6112
6113 //validate the req
6114 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
6115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006116 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006117 goto error2;
6118 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306119 limLog(pMac, LOG1, "Sent DELTS request to station with "
6120 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
6121 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07006122
6123 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
6124 psessionEntry);
6125
6126 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306127 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
6128 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07006129 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306130 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006131 goto error3;
6132 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306133 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006134
6135 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306136 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006137 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306138 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006139
6140 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
6141
6142error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306143 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07006144error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306145 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006146error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306147 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006148 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006149 return;
6150}
6151
6152/**
6153 * \brief Setup an A-MPDU/BA session
6154 *
6155 * \sa limPostMlmAddBAReq
6156 *
6157 * \param pMac The global tpAniSirGlobal object
6158 *
6159 * \param pStaDs DPH Hash Node object of peer STA
6160 *
6161 * \param tid TID for which a BA is being setup.
6162 * If this is set to 0xFFFF, then we retrieve
6163 * the default TID from the CFG
6164 *
6165 * \return eSIR_SUCCESS if setup completes successfully
6166 * eSIR_FAILURE is some problem is encountered
6167 */
6168tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6169 tpDphHashNode pStaDs,
6170 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6171{
6172 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006173 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006174 tpDialogueToken dialogueTokenNode;
6175 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006176
Jeff Johnson295189b2012-06-20 16:38:30 -07006177 // Check if the peer is a 11n capable STA
6178 // FIXME - Need a 11n peer indication in DPH.
6179 // For now, using the taurusPeer attribute
6180 //if( 0 == pStaDs->taurusPeer == )
6181 //return eSIR_SUCCESS;
6182
6183 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306184 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6185 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006186 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306187 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006188 status = eSIR_MEM_ALLOC_FAILED;
6189 goto returnFailure;
6190 }
6191
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306192 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006193
6194 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306195 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006196 pMlmAddBAReq->peerMacAddr,
6197 pStaDs->staAddr,
6198 sizeof( tSirMacAddr ));
6199
6200 // Update the TID
6201 pMlmAddBAReq->baTID = tid;
6202
6203 // Determine the supported BA policy of local STA
6204 // for the TID of interest
6205 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6206
6207 // BA Buffer Size
6208 // Requesting the ADDBA recipient to populate the size.
6209 // If ADDBA is accepted, a non-zero buffer size should
6210 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306211 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6212 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6213 {
6214 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6215 causing very low throughput in HT40 case */
6216 limLog( pMac, LOGW,
6217 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6218 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6219 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306220 else if (pMac->miracastVendorConfig)
6221 {
6222 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6223 {
6224 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6225 status = eSIR_FAILURE;
6226 goto returnFailure;
6227 }
6228
6229 pMlmAddBAReq->baBufferSize = val;
6230 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306231 else
6232 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006233
6234 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306235 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 -07006236 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6237 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306238 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006239
6240 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006241 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006242 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006243 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006244 status = eSIR_FAILURE;
6245 goto returnFailure;
6246 }
6247 pMlmAddBAReq->baTimeout = val; // In TU's
6248
6249 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006250 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006251 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6252 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6253
6254 // BA Starting Sequence Number
6255 pMlmAddBAReq->baSSN = startingSeqNum;
6256
6257 /* Update PE session Id*/
6258 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6259
6260 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6261
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006262 dialogueTokenNode = limAssignDialogueToken(pMac);
6263 if (NULL == dialogueTokenNode)
6264 {
6265 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6266 status = eSIR_FAILURE;
6267 goto returnFailure;
6268 }
6269
Jeff Johnson295189b2012-06-20 16:38:30 -07006270 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006271 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 dialogueTokenNode->assocId = pStaDs->assocId;
6273 dialogueTokenNode->tid = tid;
6274 // Send ADDBA Req to MLME
6275 limPostMlmMessage( pMac,
6276 LIM_MLM_ADDBA_REQ,
6277 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006278 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006279
6280returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306281 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006282 return status;
6283}
6284
6285/**
6286 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6287 * will then send an ADDBA Rsp to peer MAC entity
6288 * with the appropriate ADDBA status code
6289 *
6290 * \sa limPostMlmAddBARsp
6291 *
6292 * \param pMac The global tpAniSirGlobal object
6293 *
6294 * \param peerMacAddr MAC address of peer entity that will
6295 * be the recipient of this ADDBA Rsp
6296 *
6297 * \param baStatusCode ADDBA Rsp status code
6298 *
6299 * \param baDialogToken ADDBA Rsp dialog token
6300 *
6301 * \param baTID TID of interest
6302 *
6303 * \param baPolicy The BA policy
6304 *
6305 * \param baBufferSize The BA buffer size
6306 *
6307 * \param baTimeout BA timeout in TU's
6308 *
6309 * \return eSIR_SUCCESS if setup completes successfully
6310 * eSIR_FAILURE is some problem is encountered
6311 */
6312tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6313 tSirMacAddr peerMacAddr,
6314 tSirMacStatusCodes baStatusCode,
6315 tANI_U8 baDialogToken,
6316 tANI_U8 baTID,
6317 tANI_U8 baPolicy,
6318 tANI_U16 baBufferSize,
6319 tANI_U16 baTimeout,
6320 tpPESession psessionEntry)
6321{
6322tSirRetStatus status = eSIR_SUCCESS;
6323tpLimMlmAddBARsp pMlmAddBARsp;
6324
6325 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306326 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6327 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 {
6329 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306330 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006331 status );
6332
6333 status = eSIR_MEM_ALLOC_FAILED;
6334 goto returnFailure;
6335 }
6336
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306337 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006338
6339 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306340 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006341 pMlmAddBARsp->peerMacAddr,
6342 peerMacAddr,
6343 sizeof( tSirMacAddr ));
6344
6345 pMlmAddBARsp->baDialogToken = baDialogToken;
6346 pMlmAddBARsp->addBAResultCode = baStatusCode;
6347 pMlmAddBARsp->baTID = baTID;
6348 pMlmAddBARsp->baPolicy = baPolicy;
6349 pMlmAddBARsp->baBufferSize = baBufferSize;
6350 pMlmAddBARsp->baTimeout = baTimeout;
6351
6352 /* UPdate PE session ID*/
6353 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6354
6355 // Send ADDBA Rsp to MLME
6356 limPostMlmMessage( pMac,
6357 LIM_MLM_ADDBA_RSP,
6358 (tANI_U32 *) pMlmAddBARsp );
6359
6360returnFailure:
6361
6362 return status;
6363}
6364
6365/**
6366 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6367 * will then send an DELBA Ind to peer MAC entity
6368 * with the appropriate DELBA status code
6369 *
6370 * \sa limPostMlmDelBAReq
6371 *
6372 * \param pMac The global tpAniSirGlobal object
6373 *
6374 * \param pSta DPH Hash Node object of peer MAC entity
6375 * for which the BA session is being deleted
6376 *
6377 * \param baDirection DELBA direction
6378 *
6379 * \param baTID TID for which the BA session is being deleted
6380 *
6381 * \param baReasonCode DELBA Req reason code
6382 *
6383 * \return eSIR_SUCCESS if setup completes successfully
6384 * eSIR_FAILURE is some problem is encountered
6385 */
6386tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6387 tpDphHashNode pSta,
6388 tANI_U8 baDirection,
6389 tANI_U8 baTID,
6390 tSirMacReasonCodes baReasonCode,
6391 tpPESession psessionEntry)
6392{
6393tSirRetStatus status = eSIR_SUCCESS;
6394tpLimMlmDelBAReq pMlmDelBAReq;
6395tLimBAState curBaState;
6396
6397if(NULL == pSta)
6398 return eSIR_FAILURE;
6399
6400LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6401
6402 // Need to validate the current BA State.
6403 if( eLIM_BA_STATE_IDLE != curBaState)
6404 {
6405 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006406 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006407 baTID,
6408 curBaState);
6409
6410 status = eSIR_FAILURE;
6411 goto returnFailure;
6412 }
6413
6414 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306415 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6416 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006417 {
6418 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306419 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006420 status );
6421
6422 status = eSIR_MEM_ALLOC_FAILED;
6423 goto returnFailure;
6424 }
6425
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306426 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006427
6428 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306429 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006430 pMlmDelBAReq->peerMacAddr,
6431 pSta->staAddr,
6432 sizeof( tSirMacAddr ));
6433
6434 pMlmDelBAReq->baDirection = baDirection;
6435 pMlmDelBAReq->baTID = baTID;
6436 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6437
6438 /* Update PE session ID*/
6439 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6440
6441 //we don't have valid BA session for the given direction.
6442 // HDD wants to get the BA session deleted on PEER in this case.
6443 // in this case we just need to send DelBA to the peer.
6444 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6445 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6446 {
6447 // Send DELBA Ind over the air
6448 if( eSIR_SUCCESS !=
6449 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6450 status = eSIR_FAILURE;
6451
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306452 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006453 return status;
6454 }
6455
6456
6457 // Update the BA state in STA
6458 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6459
6460 // Send DELBA Req to MLME
6461 limPostMlmMessage( pMac,
6462 LIM_MLM_DELBA_REQ,
6463 (tANI_U32 *) pMlmDelBAReq );
6464
6465returnFailure:
6466
6467 return status;
6468}
6469
6470/**
6471 * \brief Send WDA_ADDBA_REQ to HAL, in order
6472 * to setup a new BA session with a peer
6473 *
6474 * \sa limPostMsgAddBAReq
6475 *
6476 * \param pMac The global tpAniSirGlobal object
6477 *
6478 * \param pSta Runtime, STA-related configuration cached
6479 * in the HashNode object
6480 *
6481 * \param baDialogToken The Action Frame dialog token
6482 *
6483 * \param baTID TID for which the BA session is being setup
6484 *
6485 * \param baPolicy BA Policy
6486 *
6487 * \param baBufferSize The requested BA buffer size
6488 *
6489 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6490 *
6491 * \param baSSN Starting Sequence Number for this BA session
6492 *
6493 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6494 *
6495 * \return none
6496 *
6497 */
6498tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6499 tpDphHashNode pSta,
6500 tANI_U8 baDialogToken,
6501 tANI_U8 baTID,
6502 tANI_U8 baPolicy,
6503 tANI_U16 baBufferSize,
6504 tANI_U16 baTimeout,
6505 tANI_U16 baSSN,
6506 tANI_U8 baDirection,
6507 tpPESession psessionEntry)
6508{
6509tpAddBAParams pAddBAParams = NULL;
6510tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006511tSirMsgQ msgQ;
6512
6513#ifdef WLAN_SOFTAP_VSTA_FEATURE
6514 // we can only do BA on "hard" STAs
6515 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6516 {
6517 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306518 limLog( pMac, LOGE,
6519 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 goto returnFailure;
6521 }
6522#endif //WLAN_SOFTAP_VSTA_FEATURE
6523
6524 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306525 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6526 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006527 {
6528 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306529 FL("AllocateMemory failed")
6530 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006531
6532 retCode = eSIR_MEM_ALLOC_FAILED;
6533 goto returnFailure;
6534 }
6535
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306536 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006537
6538 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306539 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006540 (void *) pAddBAParams->peerMacAddr,
6541 (void *) pSta->staAddr,
6542 sizeof( tSirMacAddr ));
6543
6544 // Populate the REQ parameters
6545 pAddBAParams->staIdx = pSta->staIndex;
6546 pAddBAParams->baDialogToken = baDialogToken;
6547 pAddBAParams->baTID = baTID;
6548 pAddBAParams->baPolicy = baPolicy;
6549 pAddBAParams->baBufferSize = baBufferSize;
6550 pAddBAParams->baTimeout = baTimeout;
6551 pAddBAParams->baSSN = baSSN;
6552 pAddBAParams->baDirection = baDirection;
6553 pAddBAParams->respReqd = 1;
6554
6555 /* UPdate PE session ID */
6556 pAddBAParams->sessionId = psessionEntry->peSessionId;
6557
6558 // Post WDA_ADDBA_REQ to HAL.
6559 msgQ.type = WDA_ADDBA_REQ;
6560 //
6561 // FIXME_AMPDU
6562 // A global counter (dialog token) is required to keep track of
6563 // all PE <-> HAL communication(s)
6564 //
6565 msgQ.reserved = 0;
6566 msgQ.bodyptr = pAddBAParams;
6567 msgQ.bodyval = 0;
6568
6569 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306570 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6571 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6572 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6573 pAddBAParams->baTimeout, pAddBAParams->baTID,
6574 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6575 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006576
6577 //defer any other message until we get response back.
6578 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6579
Jeff Johnsone7245742012-09-05 17:12:55 -07006580 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006581#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6582 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6583#endif //FEATURE_WLAN_DIAG_SUPPORT
6584
6585 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6586 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006587 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006588 retCode );
6589 else
6590 return retCode;
6591
6592returnFailure:
6593
6594 // Clean-up...
6595 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306596 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006597
6598 return retCode;
6599
6600}
6601
6602/**
6603 * \brief Send WDA_DELBA_IND to HAL, in order
6604 * to delete an existing BA session with peer
6605 *
6606 * \sa limPostMsgDelBAInd
6607 *
6608 * \param pMac The global tpAniSirGlobal object
6609 *
6610 * \param pSta Runtime, STA-related configuration cached
6611 * in the HashNode object
6612 *
6613 * \param baTID TID for which the BA session is being setup
6614 *
6615 * \param baDirection Identifies whether the DELBA Ind was
6616 * sent by the BA initiator or recipient
6617 *
6618 * \return none
6619 *
6620 */
6621tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6622 tpDphHashNode pSta,
6623 tANI_U8 baTID,
6624 tANI_U8 baDirection,
6625 tpPESession psessionEntry)
6626{
6627tpDelBAParams pDelBAParams = NULL;
6628tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006629tSirMsgQ msgQ;
6630
6631 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306632 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6633 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 {
6635 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306636 FL("AllocateMemory failed")
6637 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006638
6639 retCode = eSIR_MEM_ALLOC_FAILED;
6640 goto returnFailure;
6641 }
6642
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306643 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006644
6645 // Populate the REQ parameters
6646 pDelBAParams->staIdx = pSta->staIndex;
6647 pDelBAParams->baTID = baTID;
6648 pDelBAParams->baDirection = baDirection;
6649
6650 /* Update PE session ID */
6651
6652
6653 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6654 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6655
6656 // Post WDA_DELBA_IND to HAL.
6657 msgQ.type = WDA_DELBA_IND;
6658 //
6659 // FIXME:
6660 // A global counter (dialog token) is required to keep track of
6661 // all PE <-> HAL communication(s)
6662 //
6663 msgQ.reserved = 0;
6664 msgQ.bodyptr = pDelBAParams;
6665 msgQ.bodyval = 0;
6666
6667 limLog( pMac, LOGW,
6668 FL( "Sending SIR_HAL_DELBA_IND..." ));
6669
Jeff Johnsone7245742012-09-05 17:12:55 -07006670 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006671#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6672 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6673#endif //FEATURE_WLAN_DIAG_SUPPORT
6674
6675 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6676 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006677 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 retCode );
6679 else
6680 {
6681 // Update LIM's internal cache...
6682 if( eBA_INITIATOR == baDirection)
6683 {
6684 pSta->tcCfg[baTID].fUseBATx = 0;
6685 pSta->tcCfg[baTID].txBufSize = 0;
6686 }
6687 else
6688 {
6689 pSta->tcCfg[baTID].fUseBARx = 0;
6690 pSta->tcCfg[baTID].rxBufSize = 0;
6691 }
6692
6693 return retCode;
6694 }
6695
6696returnFailure:
6697
6698 // Clean-up...
6699 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306700 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006701
6702 return retCode;
6703
6704}
6705
6706/**
6707 * @function : limPostSMStateUpdate()
6708 *
6709 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6710 *
6711 * LOGIC:
6712 *
6713 * ASSUMPTIONS:
6714 * NA
6715 *
6716 * NOTE:
6717 * NA
6718 *
6719 * @param pMac - Pointer to Global MAC structure
6720 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6721 * @return None
6722 */
6723tSirRetStatus
6724limPostSMStateUpdate(tpAniSirGlobal pMac,
6725 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6726{
6727 tSirRetStatus retCode = eSIR_SUCCESS;
6728 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 tpSetMIMOPS pMIMO_PSParams;
6730
6731 msgQ.reserved = 0;
6732 msgQ.type = WDA_SET_MIMOPS_REQ;
6733
6734 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306735 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6736 if ( NULL == pMIMO_PSParams )
6737 {
6738 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 return eSIR_MEM_ALLOC_FAILED;
6740 }
6741
6742 pMIMO_PSParams->htMIMOPSState = state;
6743 pMIMO_PSParams->staIdx = staIdx;
6744 pMIMO_PSParams->fsendRsp = true;
6745 msgQ.bodyptr = pMIMO_PSParams;
6746 msgQ.bodyval = 0;
6747
6748 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6749
Jeff Johnsone7245742012-09-05 17:12:55 -07006750 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6752 if (eSIR_SUCCESS != retCode)
6753 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006754 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306755 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006756 return retCode;
6757 }
6758
6759 return retCode;
6760}
6761
6762void limPktFree (
6763 tpAniSirGlobal pMac,
6764 eFrameType frmType,
6765 tANI_U8 *pRxPacketInfo,
6766 void *pBody)
6767{
6768 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006769}
6770
6771/**
6772 * limGetBDfromRxPacket()
6773 *
6774 *FUNCTION:
6775 * This function is called to get pointer to Polaris
6776 * Buffer Descriptor containing MAC header & other control
6777 * info from the body of the message posted to LIM.
6778 *
6779 *LOGIC:
6780 * NA
6781 *
6782 *ASSUMPTIONS:
6783 * NA
6784 *
6785 *NOTE:
6786 * NA
6787 *
6788 * @param body - Received message body
6789 * @param pRxPacketInfo - Pointer to received BD
6790 * @return None
6791 */
6792
6793void
6794limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6795{
Jeff Johnson295189b2012-06-20 16:38:30 -07006796 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006797} /*** end limGetBDfromRxPacket() ***/
6798
6799
6800
6801
6802
6803void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6804{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306805 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006806}
6807
6808
6809void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6810{
6811 tANI_U8 i;
6812 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6813
6814 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6815 {
6816 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6817 {
6818 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6819 fFound = eANI_BOOLEAN_TRUE;
6820 break;
6821 }
6822 }
6823 if(eANI_BOOLEAN_FALSE == fFound)
6824 {
6825 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6826 {
6827 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6828 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6829 }
6830 else
6831 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006832 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 }
6834 }
6835}
6836
6837
6838/**
6839 * @function : limIsChannelValidForChannelSwitch()
6840 *
6841 * @brief : This function checks if the channel to which AP
6842 * is expecting us to switch, is a valid channel for us.
6843 * LOGIC:
6844 *
6845 * ASSUMPTIONS:
6846 * NA
6847 *
6848 * NOTE:
6849 * NA
6850 *
6851 * @param pMac - Pointer to Global MAC structure
6852 * @param channel - New channel to which we are expected to move
6853 * @return None
6854 */
6855tAniBool
6856limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6857{
6858 tANI_U8 index;
6859 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6860 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6861
6862 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6863 (tANI_U8 *)validChannelList,
6864 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6865 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006866 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006867 return (eSIR_FALSE);
6868 }
6869
6870 for(index = 0; index < validChannelListLen; index++)
6871 {
6872 if(validChannelList[index] == channel)
6873 return (eSIR_TRUE);
6874 }
6875
6876 /* channel does not belong to list of valid channels */
6877 return (eSIR_FALSE);
6878}
6879
6880/**------------------------------------------------------
6881\fn __limFillTxControlParams
6882\brief Fill the message for stopping/resuming tx.
6883
6884\param pMac
6885\param pTxCtrlMsg - Pointer to tx control message.
6886\param type - Which way we want to stop/ resume tx.
6887\param mode - To stop/resume.
6888 -------------------------------------------------------*/
6889static eHalStatus
6890__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6891 tLimQuietTxMode type, tLimControlTx mode)
6892{
6893
6894 //TBD-RAJESH HOW TO GET sessionEntry?????
6895 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6896
6897 if (mode == eLIM_STOP_TX)
6898 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6899 else
6900 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6901
6902 switch (type)
6903 {
6904 case eLIM_TX_ALL:
6905 /** Stops/resumes transmission completely */
6906 pTxCtrlMsg->fCtrlGlobal = 1;
6907 break;
6908
6909 case eLIM_TX_BSS_BUT_BEACON:
6910 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6911 * stop beacon transmission.
6912 */
6913 pTxCtrlMsg->ctrlBss = 1;
6914 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6915 break;
6916
6917 case eLIM_TX_STA:
6918 /** Memory for station bitmap is allocated dynamically in caller of this
6919 * so decode properly here and fill the bitmap. Now not implemented,
6920 * fall through.
6921 */
6922 case eLIM_TX_BSS:
6923 //Fall thru...
6924 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006925 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006926 return eHAL_STATUS_FAILURE;
6927 }
6928
6929 return eHAL_STATUS_SUCCESS;
6930}
6931
6932/**
6933 * @function : limFrameTransmissionControl()
6934 *
6935 * @brief : This API is called by the user to halt/resume any frame
6936 * transmission from the device. If stopped, all frames will be
6937 * queued starting from hardware. Then back-pressure
6938 * is built till the driver.
6939 * LOGIC:
6940 *
6941 * ASSUMPTIONS:
6942 * NA
6943 *
6944 * NOTE:
6945 * NA
6946 *
6947 * @param pMac - Pointer to Global MAC structure
6948 * @return None
6949 */
6950void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6951{
6952
6953 eHalStatus status = eHAL_STATUS_FAILURE;
6954 tpTxControlParams pTxCtrlMsg;
6955 tSirMsgQ msgQ;
6956 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6957
6958 /** Allocate only required number of bytes for station bitmap
6959 * Make it to align to 4 byte boundary */
6960 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6961
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306962 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6963 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006964 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306965 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006966 return;
6967 }
6968
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306969 vos_mem_set((void *) pTxCtrlMsg,
6970 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006971 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6972 if (status != eHAL_STATUS_SUCCESS)
6973 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306974 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006975 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006976 return;
6977 }
6978
6979 msgQ.bodyptr = (void *) pTxCtrlMsg;
6980 msgQ.bodyval = 0;
6981 msgQ.reserved = 0;
6982 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6983
Jeff Johnsone7245742012-09-05 17:12:55 -07006984 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006985 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6986 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306987 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006988 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006989 return;
6990 }
6991
6992 if (mode == eLIM_STOP_TX)
6993 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306994 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006995 }
6996 else
6997 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306998 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006999 }
7000 return;
7001}
7002
7003
7004/**
7005 * @function : limRestorePreChannelSwitchState()
7006 *
7007 * @brief : This API is called by the user to undo any
7008 * specific changes done on the device during
7009 * channel switch.
7010 * LOGIC:
7011 *
7012 * ASSUMPTIONS:
7013 * NA
7014 *
7015 * NOTE:
7016 * NA
7017 *
7018 * @param pMac - Pointer to Global MAC structure
7019 * @return None
7020 */
7021
7022tSirRetStatus
7023limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
7024{
7025
7026 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007027 tANI_U32 val = 0;
7028
7029 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7030 return retCode;
7031
7032 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007033 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007034
Surabhi Vishnoic5cfde02020-07-24 17:00:47 +05307035 /* Restore the frame transmission, if switched channel is NON-DFS.
7036 * Else tx should be resumed after receiving first beacon on DFS channel
7037 */
7038 if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
7039 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7040 else
7041 psessionEntry->gLimSpecMgmt.dfs_channel_csa = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07007042
7043 /* Free to enter BMPS */
7044 limSendSmePostChannelSwitchInd(pMac);
7045
7046 //Background scan is now enabled by SME
7047 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7048 {
7049 /* Enable background scan if already enabled, else don't bother */
7050 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7051 &val)) != eSIR_SUCCESS)
7052
7053 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007054 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007055 return (retCode);
7056 }
7057
7058 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7059 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007060 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7061 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007062 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7063 {
7064 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7065 return (eSIR_FAILURE);
7066 }
7067
7068 }
7069 }
7070
7071 /* Enable heartbeat timer */
7072 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7073 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007074 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7075 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
7076 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
7077 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007078 {
7079 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7080 return (eSIR_FAILURE);
7081 }
7082 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007083 return (retCode);
7084}
7085
7086
7087/**--------------------------------------------
7088\fn limRestorePreQuietState
7089\brief Restore the pre quiet state
7090
7091\param pMac
7092\return NONE
7093---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007094tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07007095{
7096
7097 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007098 tANI_U32 val = 0;
7099
7100 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
7101 return retCode;
7102
7103 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007104 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007105
7106 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07007107 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07007108 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7109
7110
7111 //Background scan is now enabled by SME
7112 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7113 {
7114 /* Enable background scan if already enabled, else don't bother */
7115 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7116 &val)) != eSIR_SUCCESS)
7117
7118 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007119 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007120 return (retCode);
7121 }
7122
7123 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7124 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007125 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007126 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7127 {
7128 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7129 return (eSIR_FAILURE);
7130 }
7131
7132 }
7133 }
7134
7135 /* Enable heartbeat timer */
7136 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7137 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007138 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007139 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07007140 {
7141 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7142 return (eSIR_FAILURE);
7143 }
7144 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 return (retCode);
7146}
7147
7148
7149/**
7150 * @function: limPrepareFor11hChannelSwitch()
7151 *
7152 * @brief : This API is called by the user to prepare for
7153 * 11h channel switch. As of now, the API does
7154 * very minimal work. User can add more into the
7155 * same API if needed.
7156 * LOGIC:
7157 *
7158 * ASSUMPTIONS:
7159 * NA
7160 *
7161 * NOTE:
7162 * NA
7163 *
7164 * @param pMac - Pointer to Global MAC structure
7165 * @param psessionEntry
7166 * @return None
7167 */
7168void
7169limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7170{
Jeff Johnson295189b2012-06-20 16:38:30 -07007171 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7172 return;
7173
7174 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007175 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007176
7177 /* Disable, Stop background scan if enabled and running */
7178 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7179
7180 /* Stop heart-beat timer to stop heartbeat disassociation */
7181 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7182
7183 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7184 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7185 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007186 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007187 /* Stop ongoing scanning if any */
7188 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7189 {
7190 //Set the resume channel to Any valid channel (invalid).
7191 //This will instruct HAL to set it to any previous valid channel.
7192 peSetResumeChannel(pMac, 0, 0);
7193 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7194 }
7195 else
7196 {
7197 limRestorePreChannelSwitchState(pMac, psessionEntry);
7198 }
7199 return;
7200 }
7201 else
7202 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007203 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Surabhi Vishnoic04b4e72020-08-03 21:01:18 +05307204
7205 /* Stop roam scan during CAC period in DFS channels */
7206 if(limIsconnectedOnDFSChannel(
7207 psessionEntry->gLimChannelSwitch.primaryChannel)) {
7208#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7209 if (pMac->roam.configParam.isRoamOffloadScanEnabled) {
7210 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP,
7211 REASON_DISCONNECTED);
7212 }
7213#endif
7214 psessionEntry->gLimSpecMgmt.dfs_channel_csa = true;
7215 }
7216
Jeff Johnson295189b2012-06-20 16:38:30 -07007217 /** We are safe to switch channel at this point */
7218 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7219 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007220}
7221
7222
7223
7224/**----------------------------------------------------
7225\fn limGetNwType
7226
7227\brief Get type of the network from data packet or beacon
7228\param pMac
7229\param channelNum - Channel number
7230\param type - Type of packet.
7231\param pBeacon - Pointer to beacon or probe response
7232
7233\return Network type a/b/g.
7234-----------------------------------------------------*/
7235tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7236{
7237 tSirNwType nwType = eSIR_11B_NW_TYPE;
7238
7239 if (type == SIR_MAC_DATA_FRAME)
7240 {
7241 if ((channelNum > 0) && (channelNum < 15))
7242 {
7243 nwType = eSIR_11G_NW_TYPE;
7244 }
7245 else
7246 {
7247 nwType = eSIR_11A_NW_TYPE;
7248 }
7249 }
7250 else
7251 {
7252 if ((channelNum > 0) && (channelNum < 15))
7253 {
7254 int i;
7255 // 11b or 11g packet
7256 // 11g iff extended Rate IE is present or
7257 // if there is an A rate in suppRate IE
7258 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7259 {
7260 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7261 {
7262 nwType = eSIR_11G_NW_TYPE;
7263 break;
7264 }
7265 }
7266 if (pBeacon->extendedRatesPresent)
7267 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007268 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007269 nwType = eSIR_11G_NW_TYPE;
7270 }
7271 }
7272 else
7273 {
7274 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007275 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007276 nwType = eSIR_11A_NW_TYPE;
7277 }
7278 }
7279 return nwType;
7280}
7281
7282
7283/**---------------------------------------------------------
7284\fn limGetChannelFromBeacon
7285\brief To extract channel number from beacon
7286
7287\param pMac
7288\param pBeacon - Pointer to beacon or probe rsp
7289\return channel number
7290-----------------------------------------------------------*/
7291tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7292{
7293 tANI_U8 channelNum = 0;
7294
7295 if (pBeacon->dsParamsPresent)
7296 channelNum = pBeacon->channelNumber;
7297 else if(pBeacon->HTInfo.present)
7298 channelNum = pBeacon->HTInfo.primaryChannel;
7299 else
7300 channelNum = pBeacon->channelNumber;
7301
7302 return channelNum;
7303}
7304
7305
7306/** ---------------------------------------------------------
7307\fn limSetTspecUapsdMask
7308\brief This function sets the PE global variable:
7309\ 1) gUapsdPerAcTriggerEnableMask and
7310\ 2) gUapsdPerAcDeliveryEnableMask
7311\ based on the user priority field and direction field
7312\ in the TS Info Fields.
7313\
7314\ An AC is a trigger-enabled AC if the PSB subfield
7315\ is set to 1 in the uplink direction.
7316\ An AC is a delivery-enabled AC if the PSB subfield
7317\ is set to 1 in the down-link direction.
7318\
7319\param tpAniSirGlobal pMac
7320\param tSirMacTSInfo pTsInfo
7321\param tANI_U32 action
7322\return None
7323 ------------------------------------------------------------*/
7324void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7325{
7326 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7327 tANI_U16 direction = pTsInfo->traffic.direction;
7328 tANI_U8 ac = upToAc(userPrio);
7329
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307330 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 -07007331
7332 /* Converting AC to appropriate Uapsd Bit Mask
7333 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7334 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7335 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7336 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7337 */
7338 ac = ((~ac) & 0x3);
7339
7340 if (action == CLEAR_UAPSD_MASK)
7341 {
7342 if (direction == SIR_MAC_DIRECTION_UPLINK)
7343 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7344 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7345 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7346 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7347 {
7348 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7349 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7350 }
7351 }
7352 else if (action == SET_UAPSD_MASK)
7353 {
7354 if (direction == SIR_MAC_DIRECTION_UPLINK)
7355 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7356 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7357 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7358 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7359 {
7360 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7361 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7362 }
7363 }
7364
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007365 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7366 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007367
7368 return;
7369}
7370
7371
7372
7373void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7374{
7375
7376 tANI_U8 i;
7377 for(i =0;i < pMac->lim.maxBssId;i++)
7378 {
7379 if(pMac->lim.gpSession[i].valid == TRUE )
7380 {
7381 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7382 {
7383 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7384 break;
7385 }
7386
7387 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7388 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7389 {
7390 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7391 }
7392 }
7393 }
7394 for(i=0; i< pMac->lim.maxBssId; i++)
7395 {
7396 if(pMac->lim.gpSession[i].valid == TRUE )
7397 {
7398 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7399 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7400 {
7401 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7402 {
7403 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007404 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007405 i);)
7406 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7407 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7408 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7409 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007410 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007411 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7412 }
7413 break;
7414 }
7415 }
7416 }
7417 }
7418}
7419
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007420void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7421{
7422 if(psessionEntry->valid == TRUE )
7423 {
7424 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7425 {
7426 limIbssHeartBeatHandle(pMac,psessionEntry);
7427 }
7428 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7429 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7430 {
7431 limHandleHeartBeatFailure(pMac,psessionEntry);
7432 }
7433 }
7434 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7435 and the other things again */
7436 if(psessionEntry->valid == TRUE )
7437 {
7438 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7439 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7440 {
7441 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7442 {
7443 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7444 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7445 psessionEntry->bssIdx);)
7446 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7447 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7448 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7449 {
7450 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7451 limReactivateHeartBeatTimer(pMac, psessionEntry);
7452 }
7453 }
7454 }
7455 }
7456}
7457
7458
Jeff Johnson295189b2012-06-20 16:38:30 -07007459tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7460{
7461 tANI_U8 i;
7462 for(i =0;i < pMac->lim.maxBssId;i++)
7463 {
7464 if(pMac->lim.gpSession[i].valid == TRUE )
7465 {
7466 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7467 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7468 {
7469 return pMac->lim.gpSession[i].currentOperChannel;
7470 }
7471 }
7472 }
7473 return 0;
7474}
7475
7476void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7477{
7478
7479 tpPESession psessionEntry;
7480// tANI_U8 sessionId;
7481 tpAddStaParams pAddStaParams;
7482
7483 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7484
7485 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7486 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007487 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307488 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007489 return;
7490 }
7491 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7492 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007493#ifdef FEATURE_WLAN_TDLS
7494 else if(pMac->lim.gLimAddStaTdls)
7495 {
7496 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7497 pMac->lim.gLimAddStaTdls = FALSE ;
7498 }
7499#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007500 else
7501 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7502
7503}
7504
7505
7506void limUpdateBeacon(tpAniSirGlobal pMac)
7507{
7508 tANI_U8 i;
7509
7510 for(i =0;i < pMac->lim.maxBssId;i++)
7511 {
7512 if(pMac->lim.gpSession[i].valid == TRUE )
7513 {
7514 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7515 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7516 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7517 )
7518 {
7519 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7520 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7521 }
7522 else
7523 {
7524 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7525 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7526 {
7527
7528 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7529 {
7530 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7531 }
7532 }
7533 }
7534 }
7535 }
7536}
7537
7538void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7539{
7540 tANI_U8 i;
7541 tpPESession psessionEntry;
7542 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7543 for(i =0; i < pMac->lim.maxBssId; i++)
7544 {
7545 if(pMac->lim.gpSession[i].valid == TRUE)
7546 {
7547 psessionEntry = &pMac->lim.gpSession[i];
7548 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7549 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307550 limLog(pMac, LOGE,
7551 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7552 psessionEntry->limSmeState, psessionEntry->limMlmState,
7553 psessionEntry->LimRxedBeaconCntDuringHB,
7554 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007555#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7556 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7557#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007558 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7559 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307560 /* Disconnect even if we have not received a single beacon
7561 * after connection.
7562 */
7563 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7564 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307565 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7566 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007567 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007568 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007569 /* AP did not respond to Probe Request. Tear down link with it.*/
7570 limTearDownLinkWithAp(pMac,
7571 psessionEntry->peSessionId,
7572 eSIR_BEACON_MISSED);
7573 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7574 }
7575 else // restart heartbeat timer
7576 {
7577 limReactivateHeartBeatTimer(pMac, psessionEntry);
7578 }
7579 }
7580 else
7581 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007582 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007583 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7584 limReactivateHeartBeatTimer(pMac, psessionEntry);
7585 }
7586
7587 }
7588 }
7589 }
7590 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7591 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7592}
7593
7594
7595/*
7596* This function assumes there will not be more than one IBSS session active at any time.
7597*/
7598tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7599{
7600 tANI_U8 i;
7601
7602 for(i =0;i < pMac->lim.maxBssId;i++)
7603 {
7604 if( (pMac->lim.gpSession[i].valid) &&
7605 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7606 return (&pMac->lim.gpSession[i]);
7607 }
7608
7609 return NULL;
7610}
7611
7612tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7613{
7614 tANI_U8 i;
7615
7616 for(i =0;i < pMac->lim.maxBssId;i++)
7617 {
7618 if( (pMac->lim.gpSession[i].valid) &&
7619 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7620 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7621 return (&pMac->lim.gpSession[i]);
7622 }
7623
7624 return NULL;
7625}
7626
7627/**---------------------------------------------------------
7628\fn limHandleDeferMsgError
7629\brief handles error scenario, when the msg can not be deferred.
7630\param pMac
7631\param pLimMsg LIM msg, which could not be deferred.
7632\return void
7633-----------------------------------------------------------*/
7634
7635void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7636{
7637 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7638 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307639 /*Decrement the Pending count before droping */
7640 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007641 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7642 }
7643 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007644 {
7645 vos_mem_free( pLimMsg->bodyptr);
7646 pLimMsg->bodyptr = NULL;
7647 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007648}
7649
7650
7651#ifdef FEATURE_WLAN_DIAG_SUPPORT
7652/**---------------------------------------------------------
7653\fn limDiagEventReport
7654\brief This function reports Diag event
7655\param pMac
7656\param eventType
7657\param bssid
7658\param status
7659\param reasonCode
7660\return void
7661-----------------------------------------------------------*/
7662void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7663{
7664 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7665 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7666
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307667 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007668
7669 if (NULL == pSessionEntry)
7670 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307671 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7673 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7674
7675 }
7676 else
7677 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307678 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007679 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7680 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7681 }
7682 peEvent.event_type = eventType;
7683 peEvent.status = status;
7684 peEvent.reason_code = reasonCode;
7685
7686 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7687 return;
7688}
7689
7690#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7691
7692void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7693{
7694
7695 tpAddStaSelfParams pAddStaSelfParams;
7696 tSirMsgQ mmhMsg;
7697 tpSirSmeAddStaSelfRsp pRsp;
7698
7699
7700 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7701
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307702 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7703 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007704 {
7705 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307706 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7707 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007708 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007709 return;
7710 }
7711
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307712 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007713
7714 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7715 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7716 pRsp->status = pAddStaSelfParams->status;
7717
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307718 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007719
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307720 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007721 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007722
7723 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7724 mmhMsg.bodyptr = pRsp;
7725 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307726 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007727 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7728
7729}
7730
7731void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7732{
7733
7734 tpDelStaSelfParams pDelStaSelfParams;
7735 tSirMsgQ mmhMsg;
7736 tpSirSmeDelStaSelfRsp pRsp;
7737
7738
7739 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7740
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307741 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7742 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007743 {
7744 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307745 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7746 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007747 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007748 return;
7749 }
7750
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307751 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007752
7753 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7754 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7755 pRsp->status = pDelStaSelfParams->status;
7756
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307757 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007758
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307759 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007760 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007761
7762 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7763 mmhMsg.bodyptr = pRsp;
7764 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307765 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007766 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7767
7768}
7769
7770/***************************************************************
7771* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7772* To unmap the channel to reverse the effect of mapping
7773* a band channel in hal .Mapping was done hal to overcome the
7774* limitation of the rxbd which use only 4 bit for channel number.
7775*****************************************************************/
7776tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7777{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007778#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007779 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007780 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7781 return aUnsortedChannelList[mapChannel -1];
7782 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007783#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007784 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007785#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007786 return abChannel[mapChannel -1];
7787 else
7788 return 0;
7789}
7790
7791
7792v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7793{
7794 int left = length;
7795 v_U8_t *ptr = pIes;
7796 v_U8_t elem_id;
7797 v_U16_t elem_len;
7798
7799 while(left >= (size_of_len_field+1))
7800 {
7801 elem_id = ptr[0];
7802 if (size_of_len_field == TWO_BYTE)
7803 {
7804 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7805 }
7806 else
7807 {
7808 elem_len = ptr[1];
7809 }
7810
7811
7812 left -= (size_of_len_field+1);
7813 if(elem_len > left)
7814 {
7815 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007816 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007817 eid,elem_len,left);
7818 return NULL;
7819 }
7820 if (elem_id == eid)
7821 {
7822 return ptr;
7823 }
7824
7825 left -= elem_len;
7826 ptr += (elem_len + (size_of_len_field+1));
7827 }
7828 return NULL;
7829}
7830
7831/* return NULL if oui is not found in ie
7832 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7833 */
7834v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7835{
7836 int left = ie_len;
7837 v_U8_t *ptr = ie;
7838 v_U8_t elem_id, elem_len;
7839
7840 while(left >= 2)
7841 {
7842 elem_id = ptr[0];
7843 elem_len = ptr[1];
7844 left -= 2;
7845 if(elem_len > left)
7846 {
7847 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007848 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 elem_id,elem_len,left);
7850 return NULL;
7851 }
7852 if (SIR_MAC_EID_VENDOR == elem_id)
7853 {
7854 if(memcmp(&ptr[2], oui, oui_size)==0)
7855 return ptr;
7856 }
7857
7858 left -= elem_len;
7859 ptr += (elem_len + 2);
7860 }
7861 return NULL;
7862}
7863
Jeff Johnson295189b2012-06-20 16:38:30 -07007864//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7865
7866v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7867{
7868 int length = 0;
7869 tANI_U8 *ptr = ie;
7870
7871 ptr[length++] = SIR_MAC_EID_VENDOR;
7872 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307873 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7874 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007875 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7876}
7877
7878//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7879
7880v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7881{
7882 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007883
7884 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7885 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7886 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307887 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007888 noaStream + noaLen - overFlowLen, overFlowLen);
7889 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7890 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307891 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007892 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307893 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7894 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007895 }
7896
Jeff Johnson295189b2012-06-20 16:38:30 -07007897 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7898
7899}
7900
7901//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7902v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7903{
7904 v_U8_t len=0;
7905
7906 v_U8_t *pBody = pNoaStream;
7907
7908
7909 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7910 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7911 {
7912 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7913 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7914 )
7915 return 0; //No NoA Descriptor then return 0
7916
7917
7918 pBody[0] = SIR_P2P_NOA_ATTR;
7919
7920 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7921 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7922 len = 5;
7923 pBody += len;
7924
7925
7926 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7927 {
7928 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7929 pBody += 1;
7930 len +=1;
7931
7932 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7933 pBody += sizeof(tANI_U32);
7934 len +=4;
7935
7936 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7937 pBody += sizeof(tANI_U32);
7938 len +=4;
7939
7940 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7941 pBody += sizeof(tANI_U32);
7942 len +=4;
7943
7944 }
7945
7946 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7947 {
7948 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7949 pBody += 1;
7950 len +=1;
7951
7952 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7953 pBody += sizeof(tANI_U32);
7954 len +=4;
7955
7956 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7957 pBody += sizeof(tANI_U32);
7958 len +=4;
7959
7960 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7961 pBody += sizeof(tANI_U32);
7962 len +=4;
7963
7964 }
7965
7966
7967 pBody = pNoaStream + 1;
7968 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7969
7970 return (len);
7971
7972 }
7973 return 0;
7974
7975}
Jeff Johnsone7245742012-09-05 17:12:55 -07007976
7977void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007978{
7979
7980 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007981 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007982}
Jeff Johnsone7245742012-09-05 17:12:55 -07007983
Jeff Johnson295189b2012-06-20 16:38:30 -07007984/*--------------------------------------------------------------------------
7985
7986 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7987
Jeff Johnsone7245742012-09-05 17:12:55 -07007988 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7989 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007990
7991 \param pMac - pointer to global adapter context
7992 \return - channel to scan from valid session else zero.
7993
7994 \sa
7995
7996 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007997void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007998{
7999
8000 //Rationale - this could be the suspend/resume for assoc and it is essential that
8001 //the new BSS is active for some time. Other BSS was anyway suspended.
8002 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
8003 //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 -07008004 //and hence should be ok. Need to discuss this further
8005 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07008006 {
8007 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07008008 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07008009 }
8010 else
8011 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008012 *resumeChannel = pMac->lim.gResumeChannel;
8013 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07008014 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008015 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07008016}
8017
Viral Modid86bde22012-12-10 13:09:21 -08008018tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
8019{
8020 tANI_U8 i;
8021 for(i =0; i < pMac->lim.maxBssId; i++)
8022 {
8023 if(pMac->lim.gpSession[i].valid == TRUE)
8024 {
8025 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
8026 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
8027 )
8028 {
8029 return TRUE;
8030 }
8031 }
8032 }
8033 return FALSE;
8034}
Jeff Johnsone7245742012-09-05 17:12:55 -07008035
Jeff Johnson295189b2012-06-20 16:38:30 -07008036
8037tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
8038{
8039 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
8040 {
8041 return eANI_BOOLEAN_TRUE;
8042 }
8043 else
8044 {
8045 return eANI_BOOLEAN_FALSE;
8046 }
8047}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07008048
Sandeep Puligilla60342762014-01-30 21:05:37 +05308049/**
8050 * \brief verify the changes in channel bonding
8051 *
8052 * \param pMac Pointer to the global MAC structure
8053 *
8054 * \param psessionEntry session entry
8055 * beaconSecChanWidth Secondary channel width
8056 * advertized in beacon
8057 * currentSecChanWidth Current configured width
8058 * staId Station Id
8059 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
8060 */
8061tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
8062 tpPESession psessionEntry,
8063 tANI_U8 beaconSecChanWidth,
8064 tANI_U8 currentSecChanWidth,
8065 tANI_U8 staId)
8066{
8067 tUpdateVHTOpMode tempParam;
8068 tANI_BOOLEAN fCbMode24G = FALSE;
8069 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
8070
8071 /* Moving from HT40 to HT20 operation*/
8072 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
8073 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
8074 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
8075 {
8076 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
8077 tempParam.staId = staId;
8078 fCbMode24G = TRUE;
8079 }
8080
8081 /* Moving from HT20 to HT40 operation*/
8082 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
8083 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
8084 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
8085 {
8086 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
8087 tempParam.staId = staId;
8088 fCbMode24G = TRUE;
8089 }
8090
8091 if (TRUE == fCbMode24G)
8092 {
8093 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8094 "Changing CBMODE to = %d staId = %d",
8095 tempParam.opMode, tempParam.staId );
8096 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
8097 status = eANI_BOOLEAN_TRUE;
8098 }
8099 return status;
8100}
8101
Mohit Khanna4a70d262012-09-11 16:30:12 -07008102#ifdef WLAN_FEATURE_11AC
8103tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
8104{
8105 tUpdateVHTOpMode tempParam;
8106
8107 tempParam.opMode = chanWidth;
8108 tempParam.staId = staId;
8109
8110 limSendModeUpdate( pMac, &tempParam, psessionEntry );
8111
8112 return eANI_BOOLEAN_TRUE;
8113}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008114#endif
8115
krunal soni45b9eb62014-03-26 12:54:25 -07008116void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
8117 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008118{
8119 tANI_U8 val=0;
8120
krunal soni45b9eb62014-03-26 12:54:25 -07008121 //only 2.4G band should have short slot enable, rest it should be default
8122 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008123 {
krunal soni45b9eb62014-03-26 12:54:25 -07008124 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008125 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07008126 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008127 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
8128 {
8129 val = true;
8130 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008131 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008132 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008133 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008134 // Joining BSS.
8135 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008136 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008137 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008138 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008139 // Reassociating with AP.
8140 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008141 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008142 }
krunal soni45b9eb62014-03-26 12:54:25 -07008143 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008144 {
krunal soni45b9eb62014-03-26 12:54:25 -07008145 /*
8146 * 11B does not short slot and short slot is default
8147 * for 11A mode. Hence, not need to set this bit
8148 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008149 val = false;
8150 }
krunal soni45b9eb62014-03-26 12:54:25 -07008151
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07008152 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07008153 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008154}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308155
Kalikinkar dhara205da782014-03-21 15:49:32 -07008156void limUtilsframeshtons(tpAniSirGlobal pCtx,
8157 tANI_U8 *pOut,
8158 tANI_U16 pIn,
8159 tANI_U8 fMsb)
8160{
8161 (void)pCtx;
8162#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8163 if ( !fMsb )
8164 {
8165 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8166 }
8167 else
8168 {
8169 *pOut = ( pIn & 0xff00 ) >> 8;
8170 *( pOut + 1 ) = pIn & 0xff;
8171 }
8172#else
8173 if ( !fMsb )
8174 {
8175 *pOut = pIn & 0xff;
8176 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8177 }
8178 else
8179 {
8180 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8181 }
8182#endif
8183}
8184
8185void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8186 tANI_U8 *pOut,
8187 tANI_U32 pIn,
8188 tANI_U8 fMsb)
8189{
8190 (void)pCtx;
8191#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8192 if ( !fMsb )
8193 {
8194 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8195 }
8196 else
8197 {
8198 *pOut = ( pIn & 0xff000000 ) >> 24;
8199 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8200 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8201 *( pOut + 3 ) = ( pIn & 0x000000ff );
8202 }
8203#else
8204 if ( !fMsb )
8205 {
8206 *( pOut ) = ( pIn & 0x000000ff );
8207 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8208 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8209 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8210 }
8211 else
8212 {
8213 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8214 }
8215#endif
8216}
8217
8218
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308219/**--------------------------------------------
8220\fn limUpdateOBSSScanParams
8221\brief Updates OBSS SCAN IE parameters to session
8222
8223\param psessionEntry - Session Entry
8224\return NONE
8225---------------------------------------------*/
8226void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8227 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8228{
8229 /*If the recieved value is not in the range specified by the Specification
8230 then it will be the default value configured through cfg */
8231 if (( pOBSSScanParameters->obssScanActiveDwell >
8232 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8233 ( pOBSSScanParameters->obssScanActiveDwell <
8234 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8235 {
8236 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8237 pOBSSScanParameters->obssScanActiveDwell;
8238 }
8239 if((pOBSSScanParameters->obssScanPassiveDwell >
8240 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8241 (pOBSSScanParameters->obssScanPassiveDwell <
8242 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8243 {
8244 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8245 pOBSSScanParameters->obssScanPassiveDwell;
8246 }
8247 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8248 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8249 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8250 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8251 {
8252 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8253 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8254 }
8255 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8256 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8257 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8258 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8259 {
8260 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8261 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8262 }
8263 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8264 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8265 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8266 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8267 {
8268 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8269 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8270 }
8271 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8272 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8273 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8274 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8275 {
8276 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8277 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8278 }
8279 if((pOBSSScanParameters->obssScanActivityThreshold >
8280 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8281 (pOBSSScanParameters->obssScanActivityThreshold <
8282 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8283 {
8284 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8285 pOBSSScanParameters->obssScanActivityThreshold;
8286 }
8287}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008288
8289#ifdef WLAN_FEATURE_11W
8290void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8291{
8292 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8293 tPmfSaQueryTimerId timerId;
8294 tpPESession psessionEntry;
8295 tpDphHashNode pSta;
8296 tANI_U32 maxRetries;
8297
8298 limLog(pMac, LOG1, FL("SA Query timer fires"));
8299 timerId.value = param;
8300
8301 // Check that SA Query is in progress
8302 if ((psessionEntry = peFindSessionBySessionId(
8303 pMac, timerId.fields.sessionId)) == NULL)
8304 {
8305 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8306 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008307 return;
8308 }
8309 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8310 &psessionEntry->dph.dphHashTable)) == NULL)
8311 {
8312 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8313 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008314 return;
8315 }
8316 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8317 return;
8318
8319 // Increment the retry count, check if reached maximum
8320 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8321 &maxRetries) != eSIR_SUCCESS)
8322 {
8323 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8324 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8325 return;
8326 }
8327 pSta->pmfSaQueryRetryCount++;
8328 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8329 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308330 limLog(pMac, LOGE,
8331 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8332 MAC_ADDR_ARRAY(pSta->staAddr));
8333 limSendDisassocMgmtFrame(pMac,
8334 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8335 pSta->staAddr, psessionEntry, FALSE);
8336 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008337 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8338 return;
8339 }
8340
8341 // Retry SA Query
8342 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8343 pSta->staAddr, psessionEntry);
8344 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008345 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8346 {
8347 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8348 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8349 }
8350}
8351#endif
8352
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008353/** ---------------------------------------------------------
8354\fn limProcessChannelSwitchSuspendLink
8355\brief This function call channel switch functions based on
8356 the gLimChannelSwitch.state. After function return it
8357 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8358 If gLimChannelSwitch.state is non-identified then
8359 print error log as well as restore back the
8360 pre-channelSwitch.
8361\param tpAniSirGlobal pMac
8362\param eHalStatus status
8363\param tANI_U32 *ctx
8364\return None
8365 ------------------------------------------------------------*/
8366static void
8367limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8368 eHalStatus status,
8369 tANI_U32 *ctx)
8370{
8371 tpPESession pSessionEntry = (tpPESession)ctx;
8372
8373 if ( eHAL_STATUS_SUCCESS != status )
8374 {
8375 limLog(pMac, LOGE,
8376 FL("Suspend link failed. still proceeding "));
8377 }
8378 if (NULL == pSessionEntry )
8379 {
8380 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8381 return;
8382 }
8383
8384 switch(pSessionEntry->gLimChannelSwitch.state)
8385 {
8386 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8387 PELOGW(limLog(pMac, LOGW,
8388 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8389 limSwitchPrimaryChannel(pMac,
8390 pSessionEntry->gLimChannelSwitch.primaryChannel,
8391 pSessionEntry);
8392 pSessionEntry->gLimChannelSwitch.state =
8393 eLIM_CHANNEL_SWITCH_IDLE;
8394 break;
8395
8396 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8397 PELOGW(limLog(pMac, LOGW,
8398 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8399 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8400 pSessionEntry->gLimChannelSwitch.primaryChannel,
8401 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8402 pSessionEntry->gLimChannelSwitch.state =
8403 eLIM_CHANNEL_SWITCH_IDLE;
8404 break;
8405
8406 default:
8407 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8408 pSessionEntry->gLimChannelSwitch.state);)
8409 if (limRestorePreChannelSwitchState(pMac,
8410 pSessionEntry) != eSIR_SUCCESS)
8411 {
8412 limLog(pMac, LOGE,
8413 FL("Could not restore pre-channelSwitch "
8414 "(11h) state, resetting the system"));
8415 }
8416 }
8417}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308418
8419/** ---------------------------------------------------------
8420\fn limInitOBSSScanParams
8421\brief This function Initializes the OBSS Scan Parameters
8422\param tpAniSirGlobal pMac
8423\param tpPESession pSessionEntry
8424\return None
8425 ------------------------------------------------------------*/
8426
8427void limInitOBSSScanParams(tpAniSirGlobal pMac,
8428 tpPESession psessionEntry)
8429{
8430 tANI_U32 cfgValue;
8431
8432 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8433 &cfgValue) != eSIR_SUCCESS)
8434 {
8435 limLog(pMac, LOGE, FL("Fail to retrieve "
8436 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8437 return ;
8438 }
8439 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8440
8441 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8442 &cfgValue) != eSIR_SUCCESS)
8443 {
8444 limLog(pMac, LOGE, FL("Fail to retrieve "
8445 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8446 return ;
8447 }
8448 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8449
8450 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8451 &cfgValue) != eSIR_SUCCESS)
8452 {
8453 limLog(pMac, LOGE, FL("Fail to retrieve "
8454 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8455 return ;
8456 }
8457 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8458 = cfgValue;
8459 if (wlan_cfgGetInt(pMac,
8460 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8461 &cfgValue) != eSIR_SUCCESS)
8462 {
8463 limLog(pMac, LOGE, FL("Fail to retrieve"
8464 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8465 return ;
8466 }
8467 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8468 cfgValue;
8469 if (wlan_cfgGetInt(pMac,
8470 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8471 != eSIR_SUCCESS)
8472 {
8473 limLog(pMac, LOGE, FL("Fail to retrieve"
8474 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8475 return ;
8476 }
8477 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8478 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308479
8480 if (wlan_cfgGetInt(pMac,
8481 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8482 != eSIR_SUCCESS)
8483 {
8484 limLog(pMac, LOGE, FL("Fail to retrieve"
8485 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8486 return ;
8487 }
8488 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8489 cfgValue;
8490
8491
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308492 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8493 &cfgValue) != eSIR_SUCCESS)
8494 {
8495 limLog(pMac, LOGE, FL("Fail to retrieve "
8496 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8497 return ;
8498 }
8499 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308500}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308501
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308502const char * lim_ScanTypetoString(const v_U8_t scanType)
8503{
8504 switch (scanType)
8505 {
8506 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8507 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8508 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8509 default:
8510 return "Unknown ScanType";
8511 }
8512}
8513
8514const char * lim_BssTypetoString(const v_U8_t bssType)
8515{
8516 switch (bssType)
8517 {
8518 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8519 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8520 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8521 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8522 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8523 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8524 default:
8525 return "Unknown BssType";
8526 }
8527}
8528
8529const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8530{
8531 switch (mode)
8532 {
8533 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8534 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8535 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8536 default:
8537 return "Unknown BgScanMode";
8538 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308539}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308540
8541#ifdef WLAN_FEATURE_11W
8542/**
8543 *
8544 * \brief This function is called by various LIM modules to correctly set
8545 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8546 *
8547 *
8548 * \param pMac Pointer to Global MAC structure
8549 *
8550 * \param psessionEntry Pointer to session corresponding to the connection
8551 *
8552 * \param peer Peer address of the STA to which the frame is to be sent
8553 *
8554 * \param pMacHdr Pointer to the frame MAC header
8555 *
8556 * \return nothing
8557 *
8558 *
8559 */
8560void
8561limSetProtectedBit(tpAniSirGlobal pMac,
8562 tpPESession psessionEntry,
8563 tSirMacAddr peer,
8564 tpSirMacMgmtHdr pMacHdr)
8565{
8566 tANI_U16 aid;
8567 tpDphHashNode pStaDs;
8568
8569 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8570 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8571 {
8572
8573 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8574 &psessionEntry->dph.dphHashTable );
8575 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308576 /* rmfenabled will be set at the time of addbss.
8577 * but sometimes EAP auth fails and keys are not
8578 * installed then if we send any management frame
8579 * like deauth/disassoc with this bit set then
8580 * firmware crashes. so check for keys are
8581 * installed or not also before setting the bit
8582 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308583 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308584 pMacHdr->fc.wep = 1;
8585 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308586 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308587 pMacHdr->fc.wep = 1;
8588} /*** end limSetProtectedBit() ***/
8589#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308590
8591tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8592{
8593 int left = length;
8594 tANI_U8 *ptr = pIes;
8595 tANI_U8 elem_id,elem_len;
8596
8597 while (left >= 2)
8598 {
8599 elem_id = ptr[0];
8600 elem_len = ptr[1];
8601 left -= 2;
8602
8603 if (elem_len > left)
8604 {
8605 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8606 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8607 eid,elem_len,left);
8608 return NULL;
8609 }
8610 if (elem_id == eid)
8611 {
8612 return ptr;
8613 }
8614
8615 left -= elem_len;
8616 ptr += (elem_len + 2);
8617 }
8618 return NULL;
8619}
8620
8621
8622void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8623{
8624
8625 tANI_U32 nPayload;
8626 tANI_U8 *pPayload;
8627 tANI_U8 *ieptr;
8628 tSirMacTim *tim;
8629
8630 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8631 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8632
8633 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8634 {
8635 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8636 return;
8637 }
8638
8639 if (NULL !=
8640 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8641 nPayload, SIR_MAC_TIM_EID)))
8642 {
8643 /* Ignore EID and Length field*/
8644 tim = (tSirMacTim *)(ieptr + 2);
8645
8646 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8647 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8648 if (tim->dtimCount >= MAX_DTIM_COUNT)
8649 tim->dtimCount = DTIM_COUNT_DEFAULT;
8650 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8651 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8652 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8653 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8654 psessionEntry->currentBssBeaconCnt++;
8655
8656 limLog(pMac, LOG1,
8657 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8658 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8659 psessionEntry->lastBeaconDtimPeriod);
8660
8661 }
8662 return;
8663}
Girish Gowlia95daca2015-02-04 20:31:31 +05308664
8665void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8666 tANI_U8 smeSessionId,
8667 tANI_U32 maxRateFlag)
8668{
8669 tpSirSmeUpdateMaxRateParams pRsp;
8670 tSirMsgQ msg;
8671
8672 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8673 if (NULL == pRsp)
8674 {
8675 limLog(pMac, LOGP, FL("Memory allocation failed"));
8676 return;
8677 }
8678 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8679 pRsp->maxRateFlag = maxRateFlag;
8680 pRsp->smeSessionId = smeSessionId;
8681 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8682 msg.bodyptr = pRsp;
8683 msg.bodyval = 0;
8684 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8685 return;
8686}
Abhishek Singh5d765712015-03-12 14:04:16 +05308687
8688void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8689{
8690 if( pMac->sys.gSysBbtPendingMgmtCount )
8691 {
8692 vos_spin_lock_acquire( &pMac->sys.lock );
8693 pMac->sys.gSysBbtPendingMgmtCount--;
8694 vos_spin_lock_release( &pMac->sys.lock );
8695 }
8696 else
8697 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8698}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308699
8700eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8701{
8702 tpSirTxBdStatus pTxBdStatus;
8703
8704 if (!pData)
8705 {
8706 limLog(pMac, LOGE, FL("pData is NULL"));
8707 return eHAL_STATUS_FAILURE;
8708 }
8709
8710 pTxBdStatus = (tpSirTxBdStatus) pData;
8711
8712 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8713 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8714 return eHAL_STATUS_SUCCESS;
8715}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308716
Kapil Gupta956c0c42017-06-16 19:24:31 +05308717eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8718{
8719 tpSirTxBdStatus pTxBdStatus;
8720 tpDphHashNode pStaDs;
8721 tpPESession psessionEntry;
8722 VOS_STATUS vosStatus;
8723 vos_list_node_t *pNode= NULL, *pNext = NULL;
8724 assoc_rsp_tx_context *tmp_tx_context = NULL;
8725
8726 if (!pData)
8727 {
8728 limLog(pMac, LOGE, FL("pData is NULL"));
8729 return eHAL_STATUS_FAILURE;
8730 }
8731
8732 pTxBdStatus = (tpSirTxBdStatus) pData;
8733
8734 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8735 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8736
8737 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8738 &pNode);
8739
8740 while(pNode)
8741 {
8742 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8743 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8744 {
8745 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8746 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8747
8748 vosStatus = vos_list_peek_next (
8749 &pMac->assoc_rsp_completion_list,
8750 pNode, &pNext );
8751 pNode = pNext;
8752 pNext = NULL;
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308753 tmp_tx_context = NULL;
Kapil Gupta956c0c42017-06-16 19:24:31 +05308754 }
8755 else
8756 {
8757 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8758 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8759 break;
8760 }
8761 }
8762
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308763 if (!pNode) {
Kapil Gupta956c0c42017-06-16 19:24:31 +05308764 limLog(pMac, LOGE, FL("context is NULL"));
8765 return eHAL_STATUS_SUCCESS;
8766 }
8767 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8768 if (!psessionEntry) {
8769 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8770 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8771 pNode);
8772 vos_mem_free(tmp_tx_context);
8773 return eHAL_STATUS_SUCCESS;
8774 }
8775 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8776 &psessionEntry->dph.dphHashTable);
8777 if (pStaDs == NULL)
8778 {
8779 limLog(pMac, LOGW,
8780 FL("STA context not found"));
8781 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8782 pNode);
8783 vos_mem_free(tmp_tx_context);
8784
8785 return eHAL_STATUS_SUCCESS;
8786 }
8787
8788 /* Receive path cleanup */
8789 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8790 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8791 pNode);
8792 vos_mem_free(tmp_tx_context);
8793
8794 return eHAL_STATUS_SUCCESS;
8795}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308796/**
8797 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8798 * robust action frame
8799 * @action_catagory: Action frame catagory.
8800 *
8801 * This function is used to check if given action catagory is robust
8802 * action frame.
8803 *
8804 * Return: bool
8805 */
8806bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8807{
8808 switch (action_catagory) {
8809 /*
8810 * NOTE: This function doesn't take care of the DMG
8811 * (Directional Multi-Gigatbit) BSS case as 8011ad
8812 * support is not yet added. In future, if the support
8813 * is required then this function need few more arguments
8814 * and little change in logic.
8815 */
8816 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8817 case SIR_MAC_ACTION_QOS_MGMT:
8818 case SIR_MAC_ACTION_DLP:
8819 case SIR_MAC_ACTION_BLKACK:
8820 case SIR_MAC_ACTION_RRM:
8821 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8822 case SIR_MAC_ACTION_SA_QUERY:
8823 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8824 case SIR_MAC_ACTION_WNM:
8825 case SIR_MAC_ACITON_MESH:
8826 case SIR_MAC_ACTION_MHF:
8827 case SIR_MAC_ACTION_FST:
8828 return true;
8829 default:
8830 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8831 FL("non-PMF action category[%d] "),
8832 action_catagory);
8833 break;
8834 }
8835 return false;
8836}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308837
8838/**
Hu Wangc12631c2016-08-11 09:57:03 +08008839 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8840 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308841 * @ext_cap: extended IEs structure
8842 *
Hu Wangc12631c2016-08-11 09:57:03 +08008843 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308844 */
Hu Wangc12631c2016-08-11 09:57:03 +08008845tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8846 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308847
Hu Wangc12631c2016-08-11 09:57:03 +08008848 while (i) {
8849 if (ext_cap->bytes[i-1]) {
8850 break;
8851 }
8852 i --;
8853 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308854
Hu Wangc12631c2016-08-11 09:57:03 +08008855 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308856}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308857
8858/**
8859 * lim_update_caps_info_for_bss - Update capability info for this BSS
8860 *
8861 * @mac_ctx: mac context
8862 * @caps: Pointer to capability info to be updated
8863 * @bss_caps: Capability info of the BSS
8864 *
8865 * Update the capability info in Assoc/Reassoc request frames and reset
8866 * the spectrum management, short preamble, immediate block ack bits
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308867 * and rrm bit mask if the BSS doesnot support it
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308868 *
8869 * Return: None
8870 */
8871void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8872 uint16_t *caps, uint16_t bss_caps)
8873{
8874 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8875 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8876 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8877 }
8878
8879 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8880 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8881 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8882 }
8883
8884 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8885 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8886 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8887 }
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308888
8889 if (!(bss_caps & LIM_RRM_BIT_MASK)) {
8890 *caps &= (~LIM_RRM_BIT_MASK);
8891 limLog(mac_ctx, LOG1,
8892 FL("Clearing radio measurement :no AP support"));
8893 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308894}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308895#ifdef SAP_AUTH_OFFLOAD
8896/**
8897 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8898 *
8899 * @pmac: mac context
8900 * @assoc_req: Assoc request
8901 * @add_sta_req: Add Sta request
8902 *
8903 * This function process recieved add sta message and store it as
8904 * sta ds entry. This function will add this sta entry to DPH as well.
8905 *
8906 * Return: DPH hash node
8907 */
8908static tpDphHashNode
8909_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8910 tpSirAssocReq assoc_req,
8911 tSapOfldAddStaIndMsg *add_sta_req)
8912{
8913 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8914 tpSirAssocReq temp_assoc_req;
8915 tSirRetStatus status;
8916 tpDphHashNode sta_ds = NULL;
8917 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308918 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308919
8920 tpPESession session_entry = limIsApSessionActive(pmac);
8921
8922 if (session_entry == NULL)
8923 {
8924 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8925 return NULL;
8926 }
8927
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308928 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8929 {
8930 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8931 return NULL;
8932 }
8933
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308934 /* Update Attribute and Remove IE for
8935 * Software AP Authentication Offload
8936 */
8937 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308938
8939 /*
8940 * strip MAC mgmt header before passing buf to
8941 * sirConvertAssocReqFrame2Struct() as this API
8942 * expects buf starting from fixed parameters only.
8943 */
8944 frame_body += sizeof(tSirMacMgmtHdr);
8945 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8946
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308947 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8948 mac_assoc_req->capabilityInfo.privacy = 0;
8949
8950 status = sirConvertAssocReqFrame2Struct(pmac,
8951 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308952 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308953 assoc_req);
8954 if (status != eSIR_SUCCESS)
8955 {
8956 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8957 goto error;
8958 }
8959 /* For software AP Auth Offload feature
8960 * Host will take it as none security station
8961 * Force change to none security
8962 */
8963 assoc_req->rsnPresent = 0;
8964 assoc_req->wpaPresent = 0;
8965
8966 sta_ds = dphAddHashEntry(pmac,
8967 add_sta_req->peer_macaddr,
8968 add_sta_req->assoc_id,
8969 &session_entry->dph.dphHashTable);
8970 if (sta_ds == NULL)
8971 {
8972 /* Could not add hash table entry at DPH */
8973 limLog(pmac, LOGE,
8974 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8975 MAC_ADDRESS_STR),
8976 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8977 goto error;
8978 }
8979
8980 if (session_entry->parsedAssocReq != NULL)
8981 {
8982 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8983 if (temp_assoc_req != NULL)
8984 {
8985 if (temp_assoc_req->assocReqFrame)
8986 {
8987 vos_mem_free(temp_assoc_req->assocReqFrame);
8988 temp_assoc_req->assocReqFrame = NULL;
8989 temp_assoc_req->assocReqFrameLength = 0;
8990 }
8991 vos_mem_free(temp_assoc_req);
8992 temp_assoc_req = NULL;
8993 }
8994 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8995 }
8996error:
8997 return sta_ds;
8998}
8999
9000/**
9001 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
9002 *
9003 * @sta_ds: STA state node
9004 * @assoc_req: Assoc request
9005 * @add_sta_req: Add Sta request
9006 *
9007 * This function process recieved add sta message and store station's caps
9008 * in station ds entry.
9009 *
9010 * Return: none
9011 */
9012static void
9013_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
9014 tpSirAssocReq assoc_req,
9015 tSapOfldAddStaIndMsg *add_sta_req)
9016
9017{
9018
9019 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
9020#ifdef WLAN_FEATURE_11AC
9021 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
9022#endif
9023 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
9024 sta_ds->qos.addts = assoc_req->addtsReq;
9025 sta_ds->qos.capability = assoc_req->qosCapability;
9026 sta_ds->versionPresent = 0;
9027 /* short slot and short preamble should be
9028 * updated before doing limaddsta
9029 */
9030 sta_ds->shortPreambleEnabled =
9031 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
9032 sta_ds->shortSlotTimeEnabled =
9033 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
9034
9035 sta_ds->valid = 0;
9036 /* The Auth Type of Software AP Authentication Offload
9037 * is always Open System is host side
9038 */
9039 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
9040 sta_ds->staType = STA_ENTRY_PEER;
9041
9042 /* Assoc Response frame to requesting STA */
9043 sta_ds->mlmStaContext.subType = 0;
9044
9045 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
9046 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
9047
9048 /* The following count will be used to knock-off the station
9049 * if it doesn't come back to receive the buffered data.
9050 * The AP will wait for numTimSent number of beacons after
9051 * sending TIM information for the station, before assuming that
9052 * the station is no more associated and disassociates it
9053 */
9054
9055 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
9056 sta_ds->timWaitCount =
9057 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
9058
9059 /* Initialise the Current successful
9060 * MPDU's tranfered to this STA count as 0
9061 */
9062 sta_ds->curTxMpduCnt = 0;
9063}
9064
9065/**
9066 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
9067 *
9068 * @pmac: mac context
9069 * @sta_ds: STA state node
9070 * @assoc_req: Assoc request
9071 *
9072 * This function process recieved add sta message and store station's HT and
9073 * and VHT caps and store them in station ds entry.
9074 *
9075 * Return: tSirRetStatus
9076 */
9077static tSirRetStatus
9078_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
9079 tpDphHashNode sta_ds,
9080 tpSirAssocReq assoc_req)
9081{
9082 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309083 if (session_entry == NULL)
9084 {
9085 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9086 goto error;
9087 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309088
9089 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
9090 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
9091 {
9092 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
9093 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
9094 sta_ds->htDsssCckRate40MHzSupport =
9095 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
9096 sta_ds->htLsigTXOPProtection =
9097 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
9098 sta_ds->htMaxAmsduLength =
9099 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
9100 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
9101 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
9102 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
9103 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
9104 sta_ds->htSupportedChannelWidthSet =
9105 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
9106 /* peer just follows AP; so when we are softAP/GO,
9107 * we just store our session entry's secondary channel offset here
9108 * in peer INFRA STA. However, if peer's 40MHz channel width support
9109 * is disabled then secondary channel will be zero
9110 */
9111 sta_ds->htSecondaryChannelOffset =
9112 (sta_ds->htSupportedChannelWidthSet) ?
9113 session_entry->htSecondaryChannelOffset : 0;
9114#ifdef WLAN_FEATURE_11AC
9115 if (assoc_req->operMode.present)
9116 {
9117 sta_ds->vhtSupportedChannelWidthSet =
9118 (tANI_U8)((assoc_req->operMode.chanWidth ==
9119 eHT_CHANNEL_WIDTH_80MHZ) ?
9120 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
9121 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
9122 sta_ds->htSupportedChannelWidthSet =
9123 (tANI_U8)(assoc_req->operMode.chanWidth ?
9124 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
9125 }
9126 else if (assoc_req->VHTCaps.present)
9127 {
9128 /* Check if STA has enabled it's channel bonding mode.
9129 * If channel bonding mode is enabled, we decide based on
9130 * SAP's current configuration else, we set it to VHT20.
9131 */
9132 sta_ds->vhtSupportedChannelWidthSet =
9133 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
9134 eHT_CHANNEL_WIDTH_20MHZ) ?
9135 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
9136 session_entry->vhtTxChannelWidthSet );
9137 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
9138 }
9139
9140 /* Lesser among the AP and STA bandwidth of operation. */
9141 sta_ds->htSupportedChannelWidthSet =
9142 (sta_ds->htSupportedChannelWidthSet <
9143 session_entry->htSupportedChannelWidthSet) ?
9144 sta_ds->htSupportedChannelWidthSet :
9145 session_entry->htSupportedChannelWidthSet ;
9146#endif
9147 sta_ds->baPolicyFlag = 0xFF;
9148 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
9149 }
9150
9151 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
9152 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
9153
9154 if (!assoc_req->wmeInfoPresent)
9155 {
9156 sta_ds->mlmStaContext.htCapability = 0;
9157#ifdef WLAN_FEATURE_11AC
9158 sta_ds->mlmStaContext.vhtCapability = 0;
9159#endif
9160 }
9161#ifdef WLAN_FEATURE_11AC
9162 if (limPopulateMatchingRateSet(pmac,
9163 sta_ds,
9164 &(assoc_req->supportedRates),
9165 &(assoc_req->extendedRates),
9166 assoc_req->HTCaps.supportedMCSSet,
9167 &(assoc_req->propIEinfo.propRates),
9168 session_entry , &assoc_req->VHTCaps)
9169 != eSIR_SUCCESS)
9170 {
9171#else
9172 if (limPopulateMatchingRateSet(pmac,
9173 sta_ds,
9174 &(assoc_req->supportedRates),
9175 &(assoc_req->extendedRates),
9176 assoc_req->HTCaps.supportedMCSSet,
9177 &(assoc_req->propIEinfo.propRates),
9178 session_entry) != eSIR_SUCCESS)
9179 {
9180#endif
9181 limLog(pmac, LOGE,
9182 FL("Rate set mismatched for aid=%d, MacAddr: "
9183 MAC_ADDRESS_STR),
9184 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9185 goto error;
9186 }
9187 return eSIR_SUCCESS;
9188error:
9189 return eSIR_FAILURE;
9190}
9191
9192/**
9193 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9194 *
9195 * @pmac: mac context
9196 * @sta_ds: STA state node
9197 * @assoc_req: Assoc request
9198 *
9199 * This function process recieved add sta message and store station's QOS
9200 * store them in station ds entry.
9201 *
9202 * Return: none
9203 */
9204static void
9205 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9206 tpDphHashNode sta_ds,
9207 tpSirAssocReq assoc_req)
9208{
9209 tHalBitVal qos_mode;
9210 tHalBitVal wsm_mode, wme_mode;
9211 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309212 if (session_entry == NULL)
9213 {
9214 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9215 return;
9216 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309217 limGetQosMode(session_entry, &qos_mode);
9218 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9219 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9220
9221 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9222 {
9223 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9224 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9225 }
9226
9227 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9228 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9229 limGetWmeMode(session_entry, &wme_mode);
9230 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9231 (wme_mode == eHAL_SET))
9232 {
9233 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9234 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9235 limGetWsmMode(session_entry, &wsm_mode);
9236 /* WMM_APSD - WMM_SA related processing should be
9237 * separate; WMM_SA and WMM_APSD can coexist
9238 */
9239 if (assoc_req->WMMInfoStation.present)
9240 {
9241 /* check whether AP supports or not */
9242 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9243 && (session_entry->apUapsdEnable == 0) &&
9244 (assoc_req->WMMInfoStation.acbe_uapsd
9245 || assoc_req->WMMInfoStation.acbk_uapsd
9246 || assoc_req->WMMInfoStation.acvo_uapsd
9247 || assoc_req->WMMInfoStation.acvi_uapsd))
9248 {
9249 /*
9250 * Received Re/Association Request from
9251 * STA when UPASD is not supported
9252 */
9253 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9254 "to STA accordingly" ));
9255 /* update UAPSD and send it to LIM to add STA */
9256 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9257 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9258 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9259 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9260 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9261 }
9262 else
9263 {
9264 /* update UAPSD and send it to LIM to add STA */
9265 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9266 assoc_req->WMMInfoStation.acbe_uapsd;
9267 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9268 assoc_req->WMMInfoStation.acbk_uapsd;
9269 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9270 assoc_req->WMMInfoStation.acvo_uapsd;
9271 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9272 assoc_req->WMMInfoStation.acvi_uapsd;
9273 sta_ds->qos.capability.qosInfo.maxSpLen =
9274 assoc_req->WMMInfoStation.max_sp_length;
9275 }
9276 }
9277 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9278 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9279 }
9280}
9281
9282/**
9283 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9284 *
9285 * @pmac: mac context
9286 * @lim_msgq: Add Sta indication buffer
9287 *
9288 * This function will recieve buffer from firmware. This buffer will store
9289 * information about connected client. driver will process this buffer and
9290 * will register this client with driver. Driver will call limAddSta
9291 *
9292 * Return: none
9293 */
9294void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9295 tSapOfldAddStaIndMsg *lim_msgq)
9296{
9297 tpSirAssocReq assoc_req = NULL;
9298 tpDphHashNode sta_ds = NULL;
9299
9300 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9301 tpPESession session_entry = limIsApSessionActive(pmac);
9302
9303 if (session_entry == NULL)
9304 {
9305 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9306 return;
9307 }
9308 add_sta_req = lim_msgq;
9309 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9310 if (NULL == assoc_req) {
9311 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9312 return;
9313 }
9314 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9315
9316 /* parse Assoc req frame for station information */
9317 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9318 if (sta_ds == NULL)
9319 {
9320 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9321 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9322 vos_mem_free(assoc_req);
9323 goto error;
9324 }
9325
9326 /* Parse Station Capability */
9327 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9328
9329 /* Parse Station HT/VHT information */
9330 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9331 == eSIR_FAILURE)
9332 {
9333 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9334 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9335 vos_mem_free(assoc_req);
9336 goto error;
9337
9338 }
9339
9340 /* Parse Station QOS information */
9341 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9342
9343 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9344 sta_ds->staIndex = add_sta_req->staIdx;
9345 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9346 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9347 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9348 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9349 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9350 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309351 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309352
Agrawal Ashishce67f362017-01-05 20:10:58 +05309353 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9354 sta_ds->staIndex,
9355 sta_ds->bssId,
9356 sta_ds->dpuIndex,
9357 sta_ds->bcastDpuIndex,
9358 sta_ds->bcastMgmtDpuIdx,
9359 sta_ds->ucUcastSig,
9360 sta_ds->ucBcastSig,
9361 sta_ds->ucMgmtSig,
9362 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309363
9364 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9365 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9366 sta_ds->assocId);
9367 }
9368
9369error:
9370 return;
9371}
9372
9373/**
9374 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9375 *
9376 * @pmac: mac context
9377 * @lim_msgq: Del Sta indication buffer
9378 *
9379 * This function will recieve buffer from firmware. This buffer will
9380 * have information about clinet to remove with reason code.
9381 * This function will call limSendSmeDisassocInd to do cleanup
9382 * for station entry
9383 *
9384 * Return: none
9385 */
9386void
9387lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9388{
9389 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9390 tpDphHashNode sta_ds = NULL;
9391 tANI_U16 assoc_id = 0;
9392 tpPESession psession_entry = limIsApSessionActive(pmac);
9393
9394 if (psession_entry == NULL)
9395 {
9396 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9397 goto error;
9398 }
9399
9400 del_sta_req = lim_msgq;
9401 sta_ds = dphLookupHashEntry(pmac,
9402 del_sta_req->peer_macaddr,
9403 &assoc_id,
9404 &psession_entry->dph.dphHashTable);
9405 if (sta_ds == NULL)
9406 {
9407 /*
9408 * Disassociating STA is not associated.
9409 * Log error
9410 */
9411 PELOGE(limLog(pmac, LOGE,
9412 FL("received del sta event that sta not exist in table "
9413 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9414 del_sta_req->reason,
9415 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9416 goto error;
9417 }
9418
9419 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9420 {
9421 /*
9422 * Associate Id mismatch
9423 * Log error
9424 */
9425 PELOGE(limLog(pmac, LOGE,
9426 FL("received del sta event that sta assoc Id mismatch"));)
9427 goto error;
9428 }
9429
9430 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9431 sta_ds->mlmStaContext.disassocReason =
9432 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309433
9434 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9435
9436error:
9437 return;
9438}
9439#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309440
9441int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9442{
9443 tANI_U8 i;
9444 tpPESession psessionEntry = NULL;
9445
9446 for(i =0; i < pMac->lim.maxBssId; i++)
9447 {
9448 /* If BSSID matches return corresponding tables address*/
9449 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9450 {
9451 psessionEntry = (&pMac->lim.gpSession[i]);
9452 return psessionEntry->bssIdx;
9453 }
9454 }
9455
9456 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9457 return(0xFF);
9458}
Yeshwanth Sriram Guntuka8d9b29c2017-12-12 15:44:57 +05309459void limStaDelBASession(tpAniSirGlobal pMac)
9460{
9461 tANI_U32 i;
9462 tpPESession pSessionEntry;
9463
9464 for (i = 0; i < pMac->lim.maxBssId; i++)
9465 {
9466 pSessionEntry = peFindSessionBySessionId(pMac, i);
9467 if (pSessionEntry &&
9468 pSessionEntry->limSystemRole == eLIM_STA_ROLE)
9469 {
9470 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
9471 eSIR_MAC_UNSPEC_FAILURE_REASON);
9472 }
9473 }
9474}