blob: a35cff5f7320192aa01f9b0c98c1c417feef8d55 [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
Jeff Johnson295189b2012-06-20 16:38:30 -07001122
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001123#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001125 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1126 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1127#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001128
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001129 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1130 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1131
1132 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1133 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1134
Hoonki Leef63df0d2013-01-16 19:29:14 -08001135 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1136 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001137
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301138 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1139 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1140
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301141 tx_timer_deactivate(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1142 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
1143
Abhinav Kumar626f8652019-08-05 16:20:39 +05301144 tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer);
1145 tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
1146
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 pMac->lim.gLimTimersCreated = 0;
1148 }
1149
Agarwal Ashish888ca022014-11-05 14:25:56 +05301150#ifdef WLAN_FEATURE_11W
1151 /*
1152 * When SSR is triggered, we need to loop through
1153 * each STA associated per BSSId and deactivate/delete
1154 * the pmfSaQueryTimer for it
1155 */
1156 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1157 {
1158 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1159 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1160 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1161 {
1162 if (pMac->lim.gpSession[bss_entry].valid)
1163 {
1164 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1165 sta_entry++)
1166 {
1167 psessionEntry = &pMac->lim.gpSession[bss_entry];
1168 pStaDs = dphGetHashEntry(pMac, sta_entry,
1169 &psessionEntry->dph.dphHashTable);
1170 if (NULL == pStaDs)
1171 {
1172 continue;
1173 }
1174 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1175 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1176 pStaDs->staIndex) ;
1177 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1178 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1179 }
1180 }
1181 }
1182 }
1183#endif
1184
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 /// Cleanup cached scan list
1186 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001187#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1188 /// Cleanup cached scan list
1189 limReInitLfrScanResults(pMac);
1190#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192} /*** end limCleanupMlm() ***/
1193
1194
1195
1196/**
1197 * limCleanupLmm()
1198 *
1199 *FUNCTION:
1200 * This function is called to cleanup any resources
1201 * allocated by LMM sub-module.
1202 *
1203 *PARAMS:
1204 *
1205 *LOGIC:
1206 *
1207 *ASSUMPTIONS:
1208 * NA
1209 *
1210 *NOTE:
1211 * NA
1212 *
1213 * @param pMac Pointer to Global MAC structure
1214 * @return None
1215 */
1216
1217void
1218limCleanupLmm(tpAniSirGlobal pMac)
1219{
Jeff Johnson295189b2012-06-20 16:38:30 -07001220} /*** end limCleanupLmm() ***/
1221
1222
1223
1224/**
1225 * limIsAddrBC()
1226 *
1227 *FUNCTION:
1228 * This function is called in various places within LIM code
1229 * to determine whether passed MAC address is a broadcast or not
1230 *
1231 *LOGIC:
1232 *
1233 *ASSUMPTIONS:
1234 * NA
1235 *
1236 *NOTE:
1237 * NA
1238 *
1239 * @param macAddr Indicates MAC address that need to be determined
1240 * whether it is Broadcast address or not
1241 *
1242 * @return true if passed address is Broadcast address else false
1243 */
1244
1245tANI_U8
1246limIsAddrBC(tSirMacAddr macAddr)
1247{
1248 int i;
1249 for (i = 0; i < 6; i++)
1250 {
1251 if ((macAddr[i] & 0xFF) != 0xFF)
1252 return false;
1253 }
1254
1255 return true;
1256} /****** end limIsAddrBC() ******/
1257
1258
1259
1260/**
1261 * limIsGroupAddr()
1262 *
1263 *FUNCTION:
1264 * This function is called in various places within LIM code
1265 * to determine whether passed MAC address is a group address or not
1266 *
1267 *LOGIC:
1268 * If least significant bit of first octet of the MAC address is
1269 * set to 1, it is a Group address.
1270 *
1271 *ASSUMPTIONS:
1272 * NA
1273 *
1274 *NOTE:
1275 * NA
1276 *
1277 * @param macAddr Indicates MAC address that need to be determined
1278 * whether it is Group address or not
1279 *
1280 * @return true if passed address is Group address else false
1281 */
1282
1283tANI_U8
1284limIsGroupAddr(tSirMacAddr macAddr)
1285{
1286 if ((macAddr[0] & 0x01) == 0x01)
1287 return true;
1288 else
1289 return false;
1290} /****** end limIsGroupAddr() ******/
1291
1292/**
1293 * limPostMsgApiNoWait()
1294 *
1295 *FUNCTION:
1296 * This function is called from other thread while posting a
1297 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1298 *
1299 *LOGIC:
1300 * NA
1301 *
1302 *ASSUMPTIONS:
1303 * NA
1304 *
1305 *NOTE:
1306 * NA
1307 *
1308 * @param pMsg - Pointer to the Global MAC structure
1309 * @param pMsg - Pointer to the message structure
1310 * @return None
1311 */
1312
1313tANI_U32
1314limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1315{
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 limProcessMessages(pMac, pMsg);
1317 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001318} /*** end limPostMsgApiNoWait() ***/
1319
1320
1321
1322/**
1323 * limPrintMacAddr()
1324 *
1325 *FUNCTION:
1326 * This function is called to print passed MAC address
1327 * in : format.
1328 *
1329 *LOGIC:
1330 *
1331 *ASSUMPTIONS:
1332 * NA
1333 *
1334 *NOTE:
1335 * @param macAddr - MacAddr to be printed
1336 * @param logLevel - Loglevel to be used
1337 *
1338 * @return None.
1339 */
1340
1341void
1342limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1343{
1344 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001345 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001346} /****** end limPrintMacAddr() ******/
1347
1348
Jeff Johnson295189b2012-06-20 16:38:30 -07001349/*
1350 * limResetDeferredMsgQ()
1351 *
1352 *FUNCTION:
1353 * This function resets the deferred message queue parameters.
1354 *
1355 *PARAMS:
1356 * @param pMac - Pointer to Global MAC structure
1357 *
1358 *LOGIC:
1359 *
1360 *ASSUMPTIONS:
1361 * NA
1362 *
1363 *NOTE:
1364 * NA
1365 *
1366 *RETURNS:
1367 * None
1368 */
1369
1370void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1371{
1372 pMac->lim.gLimDeferredMsgQ.size =
1373 pMac->lim.gLimDeferredMsgQ.write =
1374 pMac->lim.gLimDeferredMsgQ.read = 0;
1375
1376}
1377
1378
1379#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1380#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1381
1382/*
1383 * limWriteDeferredMsgQ()
1384 *
1385 *FUNCTION:
1386 * This function queues up a deferred message for later processing on the
1387 * STA side.
1388 *
1389 *PARAMS:
1390 * @param pMac - Pointer to Global MAC structure
1391 * @param limMsg - a LIM message
1392 *
1393 *LOGIC:
1394 *
1395 *ASSUMPTIONS:
1396 * NA
1397 *
1398 *NOTE:
1399 * NA
1400 *
1401 *RETURNS:
1402 * None
1403 */
1404
1405tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1406{
1407 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001408 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1410 limMsg->type);)
1411
1412 /*
1413 ** check if the deferred message queue is full
1414 **/
1415 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1416 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301417 if (!(pMac->lim.deferredMsgCnt & 0xF))
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001418 {
Abhishek Singh837adf22015-10-01 17:37:37 +05301419 limLog(pMac, LOGE,
1420 FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"),
1421 limMsg->type, ++pMac->lim.deferredMsgCnt);
1422 vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL,
1423 WLAN_LOG_INDICATOR_HOST_DRIVER,
1424 WLAN_LOG_REASON_QUEUE_FULL,
1425 FALSE, TRUE);
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001426 }
1427 else
1428 {
1429 pMac->lim.deferredMsgCnt++;
1430 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 return TX_QUEUE_FULL;
1432 }
1433
1434 /*
1435 ** In the application, there should not be more than 1 message get
1436 ** queued up. If happens, flags a warning. In the future, this can
1437 ** happen.
1438 **/
1439 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1440 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001441 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 -07001442 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1443 limIsSystemInScanState(pMac),
1444 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1445 pMac->lim.gLimAddtsSent);)
1446 }
1447
1448 /*
1449 ** To prevent the deferred Q is full of management frames, only give them certain space
1450 **/
1451 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1452 {
1453 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1454 {
1455 tANI_U16 idx, count = 0;
1456 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1457 {
1458 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1459 {
1460 count++;
1461 }
1462 }
1463 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1464 {
1465 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001466 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 //Return error, caller knows what to do
1468 return TX_QUEUE_FULL;
1469 }
1470 }
1471 }
1472
1473 ++pMac->lim.gLimDeferredMsgQ.size;
1474
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001475 /* reset the count here since we are able to defer the message */
1476 if(pMac->lim.deferredMsgCnt != 0)
1477 {
1478 pMac->lim.deferredMsgCnt = 0;
1479 }
1480
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 /*
1482 ** if the write pointer hits the end of the queue, rewind it
1483 **/
1484 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1485 pMac->lim.gLimDeferredMsgQ.write = 0;
1486
1487 /*
1488 ** save the message to the queue and advanced the write pointer
1489 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301490 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1491 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 (tANI_U8 *)limMsg,
1493 sizeof(tSirMsgQ));
1494 return TX_SUCCESS;
1495
1496}
1497
1498/*
1499 * limReadDeferredMsgQ()
1500 *
1501 *FUNCTION:
1502 * This function dequeues a deferred message for processing on the
1503 * STA side.
1504 *
1505 *PARAMS:
1506 * @param pMac - Pointer to Global MAC structure
1507 *
1508 *LOGIC:
1509 *
1510 *ASSUMPTIONS:
1511 * NA
1512 *
1513 *NOTE:
1514 *
1515 *
1516 *RETURNS:
1517 * Returns the message at the head of the deferred message queue
1518 */
1519
1520tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1521{
1522 tSirMsgQ *msg;
1523
1524 /*
1525 ** check any messages left. If no, return
1526 **/
1527 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1528 return NULL;
1529
1530 /*
1531 ** decrement the queue size
1532 **/
1533 pMac->lim.gLimDeferredMsgQ.size--;
1534
1535 /*
1536 ** retrieve the message from the head of the queue
1537 **/
1538 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1539
1540 /*
1541 ** advance the read pointer
1542 **/
1543 pMac->lim.gLimDeferredMsgQ.read++;
1544
1545 /*
1546 ** if the read pointer hits the end of the queue, rewind it
1547 **/
1548 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1549 pMac->lim.gLimDeferredMsgQ.read = 0;
1550
1551 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001552 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1554 msg->type);)
1555
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001556 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 limIsSystemInScanState(pMac),
1558 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1559 pMac->lim.gLimAddtsSent);)
1560
1561 return(msg);
1562}
1563
1564tSirRetStatus
1565limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1566 tSirMsgQ *pMsg,
1567 tANI_U8 qType)
1568{
1569// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 SysProcessMmhMsg(pMac, pMsg);
1571 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001572}
1573
1574char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1575{
1576#ifdef FIXME_GEN6
1577
1578 if (type == SIR_MAC_MGMT_FRAME)
1579 {
1580 switch (subType)
1581 {
1582 case SIR_MAC_MGMT_ASSOC_REQ:
1583 return "MAC_MGMT_ASSOC_REQ";
1584 case SIR_MAC_MGMT_ASSOC_RSP:
1585 return "MAC_MGMT_ASSOC_RSP";
1586 case SIR_MAC_MGMT_REASSOC_REQ:
1587 return "MAC_MGMT_REASSOC_REQ";
1588 case SIR_MAC_MGMT_REASSOC_RSP:
1589 return "MAC_MGMT_REASSOC_RSP";
1590 case SIR_MAC_MGMT_PROBE_REQ:
1591 return "MAC_MGMT_PROBE_REQ";
1592 case SIR_MAC_MGMT_PROBE_RSP:
1593 return "MAC_MGMT_PROBE_RSP";
1594 case SIR_MAC_MGMT_BEACON:
1595 return "MAC_MGMT_BEACON";
1596 case SIR_MAC_MGMT_ATIM:
1597 return "MAC_MGMT_ATIM";
1598 case SIR_MAC_MGMT_DISASSOC:
1599 return "MAC_MGMT_DISASSOC";
1600 case SIR_MAC_MGMT_AUTH:
1601 return "MAC_MGMT_AUTH";
1602 case SIR_MAC_MGMT_DEAUTH:
1603 return "MAC_MGMT_DEAUTH";
1604 case SIR_MAC_MGMT_ACTION:
1605 return "MAC_MGMT_ACTION";
1606 case SIR_MAC_MGMT_RESERVED15:
1607 return "MAC_MGMT_RESERVED15";
1608 default:
1609 return "Unknown MGMT Frame";
1610 }
1611 }
1612
1613 else if (type == SIR_MAC_CTRL_FRAME)
1614 {
1615 switch (subType)
1616 {
1617 case SIR_MAC_CTRL_RR:
1618 return "MAC_CTRL_RR";
1619 case SIR_MAC_CTRL_BAR:
1620 return "MAC_CTRL_BAR";
1621 case SIR_MAC_CTRL_BA:
1622 return "MAC_CTRL_BA";
1623 case SIR_MAC_CTRL_PS_POLL:
1624 return "MAC_CTRL_PS_POLL";
1625 case SIR_MAC_CTRL_RTS:
1626 return "MAC_CTRL_RTS";
1627 case SIR_MAC_CTRL_CTS:
1628 return "MAC_CTRL_CTS";
1629 case SIR_MAC_CTRL_ACK:
1630 return "MAC_CTRL_ACK";
1631 case SIR_MAC_CTRL_CF_END:
1632 return "MAC_CTRL_CF_END";
1633 case SIR_MAC_CTRL_CF_END_ACK:
1634 return "MAC_CTRL_CF_END_ACK";
1635 default:
1636 return "Unknown CTRL Frame";
1637 }
1638 }
1639
1640 else if (type == SIR_MAC_DATA_FRAME)
1641 {
1642 switch (subType)
1643 {
1644 case SIR_MAC_DATA_DATA:
1645 return "MAC_DATA_DATA";
1646 case SIR_MAC_DATA_DATA_ACK:
1647 return "MAC_DATA_DATA_ACK";
1648 case SIR_MAC_DATA_DATA_POLL:
1649 return "MAC_DATA_DATA_POLL";
1650 case SIR_MAC_DATA_DATA_ACK_POLL:
1651 return "MAC_DATA_DATA_ACK_POLL";
1652 case SIR_MAC_DATA_NULL:
1653 return "MAC_DATA_NULL";
1654 case SIR_MAC_DATA_NULL_ACK:
1655 return "MAC_DATA_NULL_ACK";
1656 case SIR_MAC_DATA_NULL_POLL:
1657 return "MAC_DATA_NULL_POLL";
1658 case SIR_MAC_DATA_NULL_ACK_POLL:
1659 return "MAC_DATA_NULL_ACK_POLL";
1660 case SIR_MAC_DATA_QOS_DATA:
1661 return "MAC_DATA_QOS_DATA";
1662 case SIR_MAC_DATA_QOS_DATA_ACK:
1663 return "MAC_DATA_QOS_DATA_ACK";
1664 case SIR_MAC_DATA_QOS_DATA_POLL:
1665 return "MAC_DATA_QOS_DATA_POLL";
1666 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1667 return "MAC_DATA_QOS_DATA_ACK_POLL";
1668 case SIR_MAC_DATA_QOS_NULL:
1669 return "MAC_DATA_QOS_NULL";
1670 case SIR_MAC_DATA_QOS_NULL_ACK:
1671 return "MAC_DATA_QOS_NULL_ACK";
1672 case SIR_MAC_DATA_QOS_NULL_POLL:
1673 return "MAC_DATA_QOS_NULL_POLL";
1674 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1675 return "MAC_DATA_QOS_NULL_ACK_POLL";
1676 default:
1677 return "Unknown Data Frame";
1678 }
1679 }
1680 else
1681 return "Unknown";
1682#endif
1683return "";
1684}
1685
Jeff Johnson295189b2012-06-20 16:38:30 -07001686void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1687{
1688 int i;
1689 static int enable;
1690 tUpdateBeaconParams beaconParams;
1691
1692 tpPESession psessionEntry = limIsApSessionActive(pMac);
1693
1694 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001695 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001696 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001698 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301699
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301700 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001701 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001702
1703 beaconParams.paramChangeBitmap = 0;
1704 /*
1705 ** This is doing a 2 pass check. The first pass is to invalidate
1706 ** all the cache entries. The second pass is to decide whether to
1707 ** disable protection.
1708 **/
1709 if (!enable)
1710 {
1711
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001712 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 psessionEntry->gLimOlbcParams.numSta = 0;
1714 psessionEntry->gLimOverlap11gParams.numSta = 0;
1715 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1716 psessionEntry->gLimNonGfParams.numSta = 0;
1717 psessionEntry->gLimLsigTxopParams.numSta = 0;
1718
1719 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1720 pMac->lim.protStaOverlapCache[i].active = false;
1721
1722 enable = 1;
1723 }
1724 else
1725 {
1726
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001727 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 {
1729 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1730 {
1731 if (!psessionEntry->gLim11bParams.protectionEnabled)
1732 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001733 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1735 }
1736 }
1737 }
1738
1739 if (!psessionEntry->gLimOverlap11gParams.numSta)
1740 {
1741 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1742 {
1743 if (!psessionEntry->gLim11gParams.protectionEnabled)
1744 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001745 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1747 }
1748 }
1749 }
1750
1751 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1752 {
1753 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1754 {
1755 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1756 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001757 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1759 }
1760 }
1761 }
1762
1763 enable = 0;
1764 }
1765
1766 if(beaconParams.paramChangeBitmap)
1767 {
1768 schSetFixedBeaconFields(pMac,psessionEntry);
1769 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1770 }
1771
1772 // Start OLBC timer
1773 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1774 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001775 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 }
1777}
Jeff Johnson295189b2012-06-20 16:38:30 -07001778
1779/**
1780 * limIsNullSsid()
1781 *
1782 *FUNCTION:
1783 * This function checks if Ssid supplied is Null SSID
1784 *
1785 *
1786 *LOGIC:
1787 *
1788 *ASSUMPTIONS:
1789 * NA
1790 *
1791 *NOTE:
1792 * NA
1793 *
1794 * @param tSirMacSSid *
1795 *
1796 *
1797 * @return true if SSID is Null SSID else false
1798 */
1799
1800tANI_U8
1801limIsNullSsid( tSirMacSSid *pSsid )
1802{
1803 tANI_U8 fNullSsid = false;
1804 tANI_U32 SsidLength;
1805 tANI_U8 *pSsidStr;
1806
1807 do
1808 {
1809 if ( 0 == pSsid->length )
1810 {
1811 fNullSsid = true;
1812 break;
1813 }
1814
1815#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301816 /* If the first charactes is space and SSID length is 1
1817 * then consider it as NULL SSID*/
1818 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1819 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301821 fNullSsid = true;
1822 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 }
1824 else
1825 {
1826 /* check if all the charactes in SSID are NULL*/
1827 SsidLength = pSsid->length;
1828 pSsidStr = pSsid->ssId;
1829
1830 while ( SsidLength )
1831 {
1832 if( *pSsidStr )
1833 break;
1834
1835 pSsidStr++;
1836 SsidLength--;
1837 }
1838
1839 if( 0 == SsidLength )
1840 {
1841 fNullSsid = true;
1842 break;
1843 }
1844 }
1845 }
1846 while( 0 );
1847
1848 return fNullSsid;
1849} /****** end limIsNullSsid() ******/
1850
1851
1852
Jeff Johnson295189b2012-06-20 16:38:30 -07001853
1854/** -------------------------------------------------------------
1855\fn limUpdateProtStaParams
1856\brief updates protection related counters.
1857\param tpAniSirGlobal pMac
1858\param tSirMacAddr peerMacAddr
1859\param tLimProtStaCacheType protStaCacheType
1860\param tHalBitVal gfSupported
1861\param tHalBitVal lsigTxopSupported
1862\return None
1863 -------------------------------------------------------------*/
1864void
1865limUpdateProtStaParams(tpAniSirGlobal pMac,
1866tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1867tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1868tpPESession psessionEntry)
1869{
1870 tANI_U32 i;
1871
1872 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1873 limLog(pMac,LOG1, FL("Addr : "));
1874 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1875
1876 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1877 {
1878 if (psessionEntry->protStaCache[i].active)
1879 {
1880 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1881 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1882
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301883 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001884 psessionEntry->protStaCache[i].addr,
1885 peerMacAddr, sizeof(tSirMacAddr)))
1886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001887 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 return;
1889 }
1890 }
1891 }
1892
1893 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1894 {
1895 if (!psessionEntry->protStaCache[i].active)
1896 break;
1897 }
1898
1899 if (i >= LIM_PROT_STA_CACHE_SIZE)
1900 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001901 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 return;
1903 }
1904
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301905 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 peerMacAddr,
1907 sizeof(tSirMacAddr));
1908
1909 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1910 psessionEntry->protStaCache[i].active = true;
1911 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1912 {
1913 psessionEntry->gLim11bParams.numSta++;
1914 limLog(pMac,LOG1, FL("11B, "));
1915 }
1916 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1917 {
1918 psessionEntry->gLim11gParams.numSta++;
1919 limLog(pMac,LOG1, FL("11G, "));
1920 }
1921 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1922 {
1923 psessionEntry->gLimHt20Params.numSta++;
1924 limLog(pMac,LOG1, FL("HT20, "));
1925 }
1926
1927 if(!gfSupported)
1928 {
1929 psessionEntry->gLimNonGfParams.numSta++;
1930 limLog(pMac,LOG1, FL("NonGf, "));
1931 }
1932 if(!lsigTxopSupported)
1933 {
1934 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001935 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 }
1937}// ---------------------------------------------------------------------
1938
1939/** -------------------------------------------------------------
1940\fn limDecideApProtection
1941\brief Decides all the protection related staiton coexistence and also sets
1942\ short preamble and short slot appropriately. This function will be called
1943\ when AP is ready to send assocRsp tp the station joining right now.
1944\param tpAniSirGlobal pMac
1945\param tSirMacAddr peerMacAddr
1946\return None
1947 -------------------------------------------------------------*/
1948void
1949limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1950{
1951 tANI_U16 tmpAid;
1952 tpDphHashNode pStaDs;
1953 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1954 tANI_U32 phyMode;
1955 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1956 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1957
1958 pBeaconParams->paramChangeBitmap = 0;
1959 // check whether to enable protection or not
1960 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1961 if(NULL == pStaDs)
1962 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301963 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 return;
1965 }
1966 limGetRfBand(pMac, &rfBand, psessionEntry);
1967 //if we are in 5 GHZ band
1968 if(SIR_BAND_5_GHZ == rfBand)
1969 {
1970 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1971 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001972 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 {
1974 //we are 11N and 11A station is joining.
1975 //protection from 11A required.
1976 if(false == pStaDs->mlmStaContext.htCapability)
1977 {
1978 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1979 return;
1980 }
1981 }
1982 }
1983 else if(SIR_BAND_2_4_GHZ== rfBand)
1984 {
1985 limGetPhyMode(pMac, &phyMode, psessionEntry);
1986
1987 //We are 11G. Check if we need protection from 11b Stations.
1988 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001989 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 {
1991
1992 if (pStaDs->erpEnabled== eHAL_CLEAR)
1993 {
1994 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1995 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001996 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1998 }
1999 }
2000
2001 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002002 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 {
2004 //check if we need protection from 11b station
2005 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
2006 (!pStaDs->mlmStaContext.htCapability))
2007 {
2008 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
2009 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002010 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2012 }
2013 //station being joined is non-11b and non-ht ==> 11g device
2014 else if(!pStaDs->mlmStaContext.htCapability)
2015 {
2016 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
2017 //enable protection
2018 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
2019 }
2020 //ERP mode is enabled for the latest station joined
2021 //latest station joined is HT capable
2022 //This case is being handled in common code (commn between both the bands) below.
2023 }
2024 }
2025
2026 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07002027 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 (true == pStaDs->mlmStaContext.htCapability))
2029 {
2030 if(!pStaDs->htGreenfield)
2031 {
2032 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2033 gfSupported = eHAL_CLEAR;
2034 }
2035 //Station joining is HT 20Mhz
2036 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2037 {
2038 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2039 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2040 }
2041 //Station joining does not support LSIG TXOP Protection
2042 if(!pStaDs->htLsigTXOPProtection)
2043 {
2044 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2045 lsigTxopSupported = eHAL_CLEAR;
2046 }
2047 }
2048
2049 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2050 gfSupported, lsigTxopSupported, psessionEntry);
2051
2052 return;
2053}
Jeff Johnson295189b2012-06-20 16:38:30 -07002054
2055
2056/** -------------------------------------------------------------
2057\fn limEnableOverlap11gProtection
2058\brief wrapper function for setting overlap 11g protection.
2059\param tpAniSirGlobal pMac
2060\param tpUpdateBeaconParams pBeaconParams
2061\param tpSirMacMgmtHdr pMh
2062\return None
2063 -------------------------------------------------------------*/
2064void
2065limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2066tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2067{
2068 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2069
2070 if (psessionEntry->gLimOlbcParams.numSta &&
2071 !psessionEntry->gLimOlbcParams.protectionEnabled)
2072 {
2073 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002074 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2076 }
2077}
2078
2079
2080/** -------------------------------------------------------------
2081\fn limUpdateShortPreamble
2082\brief Updates short preamble if needed when a new station joins.
2083\param tpAniSirGlobal pMac
2084\param tSirMacAddr peerMacAddr
2085\param tpUpdateBeaconParams pBeaconParams
2086\return None
2087 -------------------------------------------------------------*/
2088void
2089limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2090 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2091{
2092 tANI_U16 tmpAid;
2093 tpDphHashNode pStaDs;
2094 tANI_U32 phyMode;
2095 tANI_U16 i;
2096
2097 // check whether to enable protection or not
2098 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2099
2100 limGetPhyMode(pMac, &phyMode, psessionEntry);
2101
2102 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2103
2104 {
2105 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2106 {
2107 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2108 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2109
2110 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2111 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2113 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2114 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302115 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2117 peerMacAddr, sizeof(tSirMacAddr)))
2118 return;
2119 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 {
2121 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2122 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302123 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2125 peerMacAddr, sizeof(tSirMacAddr)))
2126 return;
2127 }
2128 }
2129 }
2130
2131
2132 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2133 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2135 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2136 break;
2137 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 {
2139 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2140 break;
2141 }
2142 }
2143
2144 if (i >= LIM_PROT_STA_CACHE_SIZE)
2145 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2147 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2148 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2149 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2150 return;
2151 }
2152 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 {
2154 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2155 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2156 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2157 return;
2158 }
2159
2160 }
2161
2162
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302163 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2164 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 peerMacAddr, sizeof(tSirMacAddr));
2166 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2167 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2168 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302170 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 peerMacAddr, sizeof(tSirMacAddr));
2172 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2173 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2174 }
2175
2176
2177 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002178 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002181 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 }
2183 }
2184}
2185
2186/** -------------------------------------------------------------
2187\fn limUpdateShortSlotTime
2188\brief Updates short slot time if needed when a new station joins.
2189\param tpAniSirGlobal pMac
2190\param tSirMacAddr peerMacAddr
2191\param tpUpdateBeaconParams pBeaconParams
2192\return None
2193 -------------------------------------------------------------*/
2194
2195void
2196limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2197 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2198{
2199 tANI_U16 tmpAid;
2200 tpDphHashNode pStaDs;
2201 tANI_U32 phyMode;
2202 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 tANI_U16 i;
2204
2205 // check whether to enable protection or not
2206 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2207 limGetPhyMode(pMac, &phyMode, psessionEntry);
2208
Jeff Johnsone7245742012-09-05 17:12:55 -07002209 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2210 * be always 1 and in 11b case, it should be always 0
2211 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2213 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002214 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2215 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2216 * it in limDecideShortSlot
2217 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2219 {
2220 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2221 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2222 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2223 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2225 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2226 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302227 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2229 peerMacAddr, sizeof(tSirMacAddr)))
2230 return;
2231 }
2232 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 {
2234 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2235 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302236 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2238 peerMacAddr, sizeof(tSirMacAddr)))
2239 return;
2240 }
2241 }
2242 }
2243
2244 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2245 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2247 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2248 break;
2249 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 {
2251 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2252 break;
2253 }
2254 }
2255
2256 if (i >= LIM_PROT_STA_CACHE_SIZE)
2257 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2259 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2260 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2261 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2262 return;
2263 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 {
2265 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2266 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2267 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2268 return;
2269 }
2270 }
2271
2272
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302274 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 peerMacAddr, sizeof(tSirMacAddr));
2276 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2277 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2278 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302280 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 peerMacAddr, sizeof(tSirMacAddr));
2282 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2283 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2284 }
2285 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2286
Jeff Johnsone7245742012-09-05 17:12:55 -07002287 /* 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
2288 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2289 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002291 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 {
2293 // enable long slot time
2294 pBeaconParams->fShortSlotTime = false;
2295 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002296 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002297 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 }
2299 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002301 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 {
2303 // enable long slot time
2304 pBeaconParams->fShortSlotTime = false;
2305 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002306 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002307 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 }
2309 }
2310 }
2311 }
2312}
2313
Jeff Johnson295189b2012-06-20 16:38:30 -07002314
2315/** -------------------------------------------------------------
2316\fn limDecideStaProtectionOnAssoc
2317\brief Decide protection related settings on Sta while association.
2318\param tpAniSirGlobal pMac
2319\param tpSchBeaconStruct pBeaconStruct
2320\return None
2321 -------------------------------------------------------------*/
2322void
2323limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2324 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2325{
2326 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2327 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2328
2329 limGetRfBand(pMac, &rfBand, psessionEntry);
2330 limGetPhyMode(pMac, &phyMode, psessionEntry);
2331
2332 if(SIR_BAND_5_GHZ == rfBand)
2333 {
2334 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2335 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2336 {
2337 if(pMac->lim.cfgProtection.fromlla)
2338 psessionEntry->beaconParams.llaCoexist = true;
2339 }
2340 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2341 {
2342 if(pMac->lim.cfgProtection.ht20)
2343 psessionEntry->beaconParams.ht20Coexist = true;
2344 }
2345
2346 }
2347 else if(SIR_BAND_2_4_GHZ == rfBand)
2348 {
2349 //spec 7.3.2.13
2350 //UseProtection will be set when nonERP STA is associated.
2351 //NonERPPresent bit will be set when:
2352 //--nonERP Sta is associated OR
2353 //--nonERP Sta exists in overlapping BSS
2354 //when useProtection is not set then protection from nonERP stations is optional.
2355
2356 //CFG protection from 11b is enabled and
2357 //11B device in the BSS
2358 /* TODO, This is not sessionized */
2359 if (phyMode != WNI_CFG_PHY_MODE_11B)
2360 {
2361 if (pMac->lim.cfgProtection.fromllb &&
2362 pBeaconStruct->erpPresent &&
2363 (pBeaconStruct->erpIEInfo.useProtection ||
2364 pBeaconStruct->erpIEInfo.nonErpPresent))
2365 {
2366 psessionEntry->beaconParams.llbCoexist = true;
2367 }
2368 //AP has no 11b station associated.
2369 else
2370 {
2371 psessionEntry->beaconParams.llbCoexist = false;
2372 }
2373 }
2374 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002375 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 (pBeaconStruct->HTInfo.present))
2377 {
2378 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2379
2380 //Obss Non HT STA present mode
2381 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2382
2383
2384 //CFG protection from 11G is enabled and
2385 //our AP has at least one 11G station associated.
2386 if(pMac->lim.cfgProtection.fromllg &&
2387 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2388 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2389 (!psessionEntry->beaconParams.llbCoexist))
2390 {
2391 if(pMac->lim.cfgProtection.fromllg)
2392 psessionEntry->beaconParams.llgCoexist = true;
2393 }
2394
2395 //AP has only HT stations associated and at least one station is HT 20
2396 //disable protection from any non-HT devices.
2397 //decision for disabling protection from 11b has already been taken above.
2398 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2399 {
2400 //Disable protection from 11G station.
2401 psessionEntry->beaconParams.llgCoexist = false;
2402 //CFG protection from HT 20 is enabled.
2403 if(pMac->lim.cfgProtection.ht20)
2404 psessionEntry->beaconParams.ht20Coexist = true;
2405 }
2406 //Disable protection from non-HT and HT20 devices.
2407 //decision for disabling protection from 11b has already been taken above.
2408 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2409 {
2410 psessionEntry->beaconParams.llgCoexist = false;
2411 psessionEntry->beaconParams.ht20Coexist = false;
2412 }
2413
2414 }
2415 }
2416
2417 //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 -07002418 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 (pBeaconStruct->HTInfo.present))
2420 {
2421 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2422 psessionEntry->beaconParams.fRIFSMode =
2423 ( tANI_U8 ) htInfo.rifsMode;
2424 psessionEntry->beaconParams.llnNonGFCoexist =
2425 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2426 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2427 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2428 }
2429}
2430
2431
2432/** -------------------------------------------------------------
2433\fn limDecideStaProtection
2434\brief Decides protection related settings on Sta while processing beacon.
2435\param tpAniSirGlobal pMac
2436\param tpUpdateBeaconParams pBeaconParams
2437\return None
2438 -------------------------------------------------------------*/
2439void
2440limDecideStaProtection(tpAniSirGlobal pMac,
2441 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2442{
2443
2444 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2445 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2446
2447 limGetRfBand(pMac, &rfBand, psessionEntry);
2448 limGetPhyMode(pMac, &phyMode, psessionEntry);
2449
2450 if(SIR_BAND_5_GHZ == rfBand)
2451 {
2452 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002453 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 (pBeaconStruct->HTInfo.present))
2455 {
2456 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2457 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2458 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2459 {
2460 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2461 }
2462 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2463 //protection from HT20 if needed.
2464 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2465 {
2466 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2467 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2468 }
2469 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2470 {
2471 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2472 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2473 }
2474 }
2475 }
2476 else if(SIR_BAND_2_4_GHZ == rfBand)
2477 {
2478 /* spec 7.3.2.13
2479 * UseProtection will be set when nonERP STA is associated.
2480 * NonERPPresent bit will be set when:
2481 * --nonERP Sta is associated OR
2482 * --nonERP Sta exists in overlapping BSS
2483 * when useProtection is not set then protection from nonERP stations is optional.
2484 */
2485
2486 if (phyMode != WNI_CFG_PHY_MODE_11B)
2487 {
2488 if (pBeaconStruct->erpPresent &&
2489 (pBeaconStruct->erpIEInfo.useProtection ||
2490 pBeaconStruct->erpIEInfo.nonErpPresent))
2491 {
2492 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2493 }
2494 //AP has no 11b station associated.
2495 else
2496 {
2497 //disable protection from 11b station
2498 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2499 }
2500 }
2501
2502 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002503 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 (pBeaconStruct->HTInfo.present))
2505 {
2506
2507 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2508 //AP has at least one 11G station associated.
2509 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2510 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2511 (!psessionEntry->beaconParams.llbCoexist))
2512 {
2513 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2514
2515 }
2516
2517 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2518 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2519 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2520 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2521 {
2522 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2523
2524 //AP has only HT stations associated and at least one station is HT 20
2525 //disable protection from any non-HT devices.
2526 //decision for disabling protection from 11b has already been taken above.
2527 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2528 {
2529 //Disable protection from 11G station.
2530 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2531
2532 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2533 }
2534 //Disable protection from non-HT and HT20 devices.
2535 //decision for disabling protection from 11b has already been taken above.
2536 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2537 {
2538 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2539 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2540
2541 }
2542 }
2543 }
2544 }
2545
2546 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002547 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 (pBeaconStruct->HTInfo.present))
2549 {
2550 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2551 //Check for changes in protection related factors other than HT operating mode.
2552 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2553 if ( psessionEntry->beaconParams.fRIFSMode !=
2554 ( tANI_U8 ) htInfo.rifsMode )
2555 {
2556 pBeaconParams->fRIFSMode =
2557 psessionEntry->beaconParams.fRIFSMode =
2558 ( tANI_U8 ) htInfo.rifsMode;
2559 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2560 }
2561
2562 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2563 htInfo.nonGFDevicesPresent )
2564 {
2565 pBeaconParams->llnNonGFCoexist =
2566 psessionEntry->beaconParams.llnNonGFCoexist =
2567 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2568 pBeaconParams->paramChangeBitmap |=
2569 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2570 }
2571
2572 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2573 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2574 {
2575 pBeaconParams->fLsigTXOPProtectionFullSupport =
2576 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2577 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2578 pBeaconParams->paramChangeBitmap |=
2579 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2580 }
2581
2582 // For Station just update the global lim variable, no need to send message to HAL
2583 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2584 //stations in overlapping BSS.
2585 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2586 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2587
2588 }
2589}
2590
2591
2592/**
2593 * limProcessChannelSwitchTimeout()
2594 *
2595 *FUNCTION:
2596 * This function is invoked when Channel Switch Timer expires at
2597 * the STA. Now, STA must stop traffic, and then change/disable
2598 * primary or secondary channel.
2599 *
2600 *
2601 *NOTE:
2602 * @param pMac - Pointer to Global MAC structure
2603 * @return None
2604 */
2605void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2606{
2607 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002608 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
Abhishek Singh800d17a2016-08-26 17:00:49 +05302610 if ((psessionEntry = peFindSessionBySessionId(pMac,
2611 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL) {
2612 limLog(pMac, LOGW,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 return;
2614 }
2615
2616 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2617 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002618 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 -07002619 return;
2620 }
Abhishek Singh800d17a2016-08-26 17:00:49 +05302621 if (psessionEntry->gLimSpecMgmt.dot11hChanSwState !=
2622 eLIM_11H_CHANSW_RUNNING) {
2623 limLog(pMac, LOGW,
2624 FL("Channel switch timer should not have been running in state %d"),
2625 psessionEntry->gLimSpecMgmt.dot11hChanSwState);
2626 return;
2627 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002628 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Mukul Sharma6b888db2015-08-24 20:56:07 +05302629
2630 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 * This potentially can create issues if the function tries to set
2632 * channel while device is in power-save, hence putting an extra check
2633 * to verify if the device is in power-save or not
2634 */
2635 if(!limIsSystemInActiveState(pMac))
2636 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002637 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 return;
2639 }
2640
2641 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002642 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002643
2644 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002645 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Abhishek Singhcb255b82015-10-01 12:37:57 +05302646
2647 /*
2648 * If Lim allows Switch channel on same channel on which preauth
2649 * is going on then LIM will not post resume link(WDA_FINISH_SCAN)
2650 * during preauth rsp handling hence firmware may crash on ENTER/
2651 * EXIT BMPS request.
2652 */
2653 if(pMac->ft.ftPEContext.pFTPreAuthReq)
2654 {
2655 limLog(pMac, LOGE,
2656 FL("Avoid Switch Channel req during pre auth"));
2657 return;
2658 }
2659 /* If link is already suspended mean some off
2660 * channel operation or scan is in progress, Allowing
2661 * Change channel here will lead to either Init Scan
2662 * sent twice or missing Finish scan when change
2663 * channel is completed, this may lead
2664 * to driver in invalid state and crash.
2665 */
2666 if (limIsLinkSuspended(pMac))
2667 {
2668 limLog(pMac, LOGE, FL("Link is already suspended for "
2669 "some other reason. Return here for sessionId:%d"),
2670 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId);
2671 return;
2672 }
2673
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 /* Check if the AP is switching to a channel that we support.
2675 * Else, just don't bother to switch. Indicate HDD to look for a
2676 * better AP to associate
2677 */
2678 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2679 {
2680 /* We need to restore pre-channelSwitch state on the STA */
2681 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2682 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002683 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 return;
2685 }
2686
2687 /* If the channel-list that AP is asking us to switch is invalid,
2688 * then we cannot switch the channel. Just disassociate from AP.
2689 * We will find a better AP !!!
2690 */
Abhishek Singh800d17a2016-08-26 17:00:49 +05302691 if ((psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2692 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
2693 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) {
2694 limLog(pMac, LOGE, FL("Invalid channel!! Disconnect.."));
2695 limTearDownLinkWithAp(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2697 eSIR_MAC_UNSPEC_FAILURE_REASON);
Abhishek Singh800d17a2016-08-26 17:00:49 +05302698 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 return;
2700 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002701 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2702 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002703 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 {
2705 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002706 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2707 if ( isLimSessionOffChannel(pMac,
2708 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2709 {
2710 limSuspendLink(pMac,
2711 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2712 limProcessChannelSwitchSuspendLink,
2713 (tANI_U32*)psessionEntry );
2714 }
2715 else
2716 {
2717 limProcessChannelSwitchSuspendLink(pMac,
2718 eHAL_STATUS_SUCCESS,
2719 (tANI_U32*)psessionEntry);
2720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 break;
2722
2723 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002724 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002725 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002727 psessionEntry->gLimChannelSwitch.secondarySubBand);
2728 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002729 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 case eLIM_CHANNEL_SWITCH_IDLE:
2731 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002732 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2734 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002735 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 }
2737 return; /* Please note, this is 'return' and not 'break' */
2738 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002739}
Jeff Johnson295189b2012-06-20 16:38:30 -07002740
2741/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302742 * lim_process_ecsa_ie()- Process ECSA IE in beacon/ probe resp
2743 * @mac_ctx: pointer to global mac structure
2744 * @ecsa_ie: ecsa ie
2745 * @session: Session entry.
2746 *
2747 * This function is called when ECSA IE is received on STA interface.
2748 *
2749 * Return: void
2750 */
2751static void
2752lim_process_ecsa_ie(tpAniSirGlobal mac_ctx,
2753 tDot11fIEext_chan_switch_ann *ecsa_ie, tpPESession session)
2754{
2755 struct ecsa_frame_params ecsa_req;
2756
2757 limLog(mac_ctx, LOG1, FL("Received ECSA IE in beacon/probe resp"));
2758
2759 if (session->currentOperChannel == ecsa_ie->new_channel) {
2760 limLog(mac_ctx, LOGE, FL("New channel %d is same as old channel ignore req"),
2761 ecsa_ie->new_channel);
2762 return;
2763 }
2764
2765 ecsa_req.new_channel = ecsa_ie->new_channel;
2766 ecsa_req.op_class = ecsa_ie->new_reg_class;
2767 ecsa_req.switch_mode = ecsa_ie->switch_mode;
2768 ecsa_req.switch_count = ecsa_ie->switch_count;
2769 limLog(mac_ctx, LOG1, FL("New channel %d op class %d switch mode %d switch count %d"),
2770 ecsa_req.new_channel, ecsa_req.op_class,
2771 ecsa_req.switch_mode, ecsa_req.switch_count);
2772
2773 lim_handle_ecsa_req(mac_ctx, &ecsa_req, session);
2774}
2775
2776
2777/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 * limUpdateChannelSwitch()
2779 *
2780 *FUNCTION:
2781 * This function is invoked whenever Station receives
2782 * either 802.11h channel switch IE or airgo proprietary
2783 * channel switch IE.
2784 *
2785 *NOTE:
2786 * @param pMac - Pointer to Global MAC structure
2787 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2788 * @param psessionentry
2789 */
2790void
2791limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2792{
2793
2794 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2796 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002797#ifdef WLAN_FEATURE_11AC
2798 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2799#endif
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302800 if (pBeacon->ecsa_present)
2801 return lim_process_ecsa_ie(pMac,
2802 &pBeacon->ext_chan_switch_ann, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002803
Jeff Johnsone7245742012-09-05 17:12:55 -07002804 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002805
2806 /* STA either received proprietary channel switch IE or 802.11h
2807 * standard channel switch IE.
2808 */
2809 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2810 {
2811 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2812
2813 /* Add logic to determine which change this is: */
2814 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002815 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2816 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2817 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2818 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2819 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002821 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 }
2823 else
2824 {
2825 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002826 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2827 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2828 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002830 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002831#ifdef WLAN_FEATURE_11AC
2832 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2833 if(pBeacon->WiderBWChanSwitchAnnPresent)
2834 {
2835 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2836 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2837 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2838 }
2839#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002840
2841 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002842 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2843 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002844
2845 /* Do not bother to look and operate on extended channel switch element
2846 * if our own channel-bonding state is not enabled
2847 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002848 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002849 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302850 if (pBeacon->sec_chan_offset_present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302852 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2853 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002855 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
Abhishek Singh15431c42017-10-25 15:43:02 +05302856 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->sec_chan_offset.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002858#ifdef WLAN_FEATURE_11AC
2859 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2860 {
2861 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2862 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302863 if(pBeacon->sec_chan_offset_present)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002864 {
Abhishek Singh15431c42017-10-25 15:43:02 +05302865 if ((pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2866 (pBeacon->sec_chan_offset.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002867 {
2868 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2869 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2870 psessionEntry->gLimChannelSwitch.primaryChannel,
Abhishek Singh15431c42017-10-25 15:43:02 +05302871 pBeacon->sec_chan_offset.secondaryChannelOffset,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002872 pWiderChnlSwitch->newCenterChanFreq0,
2873 psessionEntry);
2874 }
2875 }
2876 }
2877 }
2878#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002879 }
2880 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002881 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002882
2883
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2885 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002886 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 }
2888
2889 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002890 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002891 psessionEntry->peSessionId,
2892 psessionEntry->gLimChannelSwitch.primaryChannel,
2893 psessionEntry->gLimChannelSwitch.secondarySubBand,
2894 psessionEntry->gLimChannelSwitch.switchCount,
2895 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 return;
2897}
2898
2899/**
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302900 * lim_select_cbmode()- select cb mode for the channel and BW
2901 * @sta_ds: peer sta
2902 * @channel: channel
2903 * @chan_bw: BW
2904 *
2905 * Return: cb mode for a channel and BW
2906 */
2907static inline int lim_select_cbmode(tDphHashNode *sta_ds, uint8_t channel,
2908 uint8_t chan_bw)
2909{
2910 if (sta_ds->mlmStaContext.vhtCapability && chan_bw) {
2911 if (channel== 36 || channel == 52 || channel == 100 ||
2912 channel == 116 || channel == 149)
2913 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
2914 else if (channel == 40 || channel == 56 || channel == 104 ||
2915 channel == 120 || channel == 153)
2916 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
2917 else if (channel == 44 || channel == 60 || channel == 108 ||
2918 channel == 124 || channel == 157)
2919 return PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
2920 else if (channel == 48 || channel == 64 || channel == 112 ||
2921 channel == 128 || channel == 161)
2922 return PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
2923 else if (channel == 165)
2924 return PHY_SINGLE_CHANNEL_CENTERED;
2925 } else if (sta_ds->mlmStaContext.htCapability) {
2926 if (channel== 40 || channel == 48 || channel == 56 ||
2927 channel == 64 || channel == 104 || channel == 112 ||
2928 channel == 120 || channel == 128 || channel == 136 ||
2929 channel == 144 || channel == 153 || channel == 161)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302930 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302931 else if (channel== 36 || channel == 44 || channel == 52 ||
2932 channel == 60 || channel == 100 || channel == 108 ||
2933 channel == 116 || channel == 124 || channel == 132 ||
2934 channel == 140 || channel == 149 || channel == 157)
Abhishek Singh0ad9a3c2017-12-13 10:18:10 +05302935 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302936 else if (channel == 165)
2937 return PHY_SINGLE_CHANNEL_CENTERED;
2938 }
2939 return PHY_SINGLE_CHANNEL_CENTERED;
2940}
2941
2942void lim_handle_ecsa_req(tpAniSirGlobal mac_ctx, struct ecsa_frame_params *ecsa_req,
2943 tpPESession session)
2944{
2945 offset_t ch_offset;
2946 tpDphHashNode sta_ds = NULL ;
2947 uint16_t aid = 0;
2948
2949 if (!LIM_IS_STA_ROLE(session)) {
2950 limLog(mac_ctx, LOGE, FL("Session not in sta role"));
2951 return;
2952 }
2953
2954 sta_ds = dphLookupHashEntry(mac_ctx, session->bssId, &aid,
2955 &session->dph.dphHashTable);
2956 if (!sta_ds) {
2957 limLog(mac_ctx, LOGE, FL("pStaDs does not exist for given sessionID"));
2958 return;
2959 }
2960
2961 session->gLimChannelSwitch.primaryChannel = ecsa_req->new_channel;
2962 session->gLimChannelSwitch.switchCount = ecsa_req->switch_count;
2963 session->gLimChannelSwitch.switchTimeoutValue =
2964 SYS_MS_TO_TICKS(session->beaconParams.beaconInterval) *
2965 ecsa_req->switch_count;
2966 session->gLimChannelSwitch.switchMode = ecsa_req->switch_mode;
2967
2968 /* Only primary channel switch element is present */
2969 session->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2970 session->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
2971 session->gLimWiderBWChannelSwitch.newChanWidth = 0;
2972
Abhishek Singh0f09f382018-12-04 14:06:07 +05302973 ch_offset =
2974 lim_get_channel_width_from_opclass(mac_ctx->scan.countryCodeCurrent,
2975 ecsa_req->new_channel,
2976 sta_ds->mlmStaContext.vhtCapability,
2977 ecsa_req->op_class);
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302978 if (ch_offset == BW80) {
2979 session->gLimWiderBWChannelSwitch.newChanWidth =
2980 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
2981 } else {
2982 session->gLimWiderBWChannelSwitch.newChanWidth =
2983 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
2984 }
2985
2986 /*
2987 * Do not bother to look and operate on extended channel switch element
2988 * if our own channel-bonding state is not enabled
2989 */
2990 if (session->htSupportedChannelWidthSet) {
2991 session->gLimChannelSwitch.secondarySubBand = lim_select_cbmode(sta_ds,
2992 ecsa_req->new_channel,
2993 session->gLimWiderBWChannelSwitch.newChanWidth);
2994 if (session->gLimChannelSwitch.secondarySubBand > 0)
2995 session->gLimChannelSwitch.state =
2996 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2997 }
2998
2999 if (eSIR_SUCCESS != limStartChannelSwitch(mac_ctx, session)) {
3000 limLog(mac_ctx, LOGW, FL("Could not start Channel Switch"));
3001 }
3002
3003 limLog(mac_ctx, LOG1,
3004 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
3005 session->peSessionId,
3006 session->gLimChannelSwitch.primaryChannel,
3007 session->gLimChannelSwitch.secondarySubBand,
3008 session->gLimChannelSwitch.switchCount,
3009 session->gLimChannelSwitch.switchTimeoutValue);
3010}
3011
3012/**
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 * limCancelDot11hChannelSwitch
3014 *
3015 *FUNCTION:
3016 * This function is called when STA does not send updated channel-swith IE
3017 * after indicating channel-switch start. This will cancel the channel-swith
3018 * timer which is already running.
3019 *
3020 *LOGIC:
3021 *
3022 *ASSUMPTIONS:
3023 *
3024 *NOTE:
3025 *
3026 * @param pMac - Pointer to Global MAC structure
3027 *
3028 * @return None
3029 */
3030void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
3031{
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3033 return;
3034
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003035 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003036 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003037
3038 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
3039 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003040 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 }
3042
3043 /* We need to restore pre-channelSwitch state on the STA */
3044 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3045 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003046 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003047
3048 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003049}
3050
3051/**----------------------------------------------
3052\fn limCancelDot11hQuiet
3053\brief Cancel the quieting on Station if latest
3054 beacon doesn't contain quiet IE in it.
3055
3056\param pMac
3057\return NONE
3058-----------------------------------------------*/
3059void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
3060{
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3062 return;
3063
Jeff Johnsone7245742012-09-05 17:12:55 -07003064 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003066 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
3068 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003069 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 }
3071 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003072 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003074 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
3076 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003077 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 }
3079 /**
3080 * If the channel switch is already running in silent mode, dont resume the
3081 * transmission. Channel switch timer when timeout, transmission will be resumed.
3082 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003083 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3084 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 {
3086 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003087 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 }
3089 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003090 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003091}
3092
3093/**
3094 * limProcessQuietTimeout
3095 *
3096 * FUNCTION:
3097 * This function is active only on the STA.
3098 * Handles SIR_LIM_QUIET_TIMEOUT
3099 *
3100 * LOGIC:
3101 * This timeout can occur under only one circumstance:
3102 *
3103 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
3104 * This indicates that the timeout "interval" has
3105 * expired. This is a trigger for the STA to now
3106 * shut-off Tx/Rx for the specified gLimQuietDuration
3107 * -> The TIMER object gLimQuietBssTimer is
3108 * activated
3109 * -> With timeout = gLimQuietDuration
3110 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
3111 *
3112 * ASSUMPTIONS:
3113 * Using two TIMER objects -
3114 * gLimQuietTimer & gLimQuietBssTimer
3115 *
3116 * NOTE:
3117 *
3118 * @param pMac - Pointer to Global MAC structure
3119 *
3120 * @return None
3121 */
3122void limProcessQuietTimeout(tpAniSirGlobal pMac)
3123{
Jeff Johnson295189b2012-06-20 16:38:30 -07003124 //fetch the sessionEntry based on the sessionId
3125 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07003126 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003127
Jeff Johnsone7245742012-09-05 17:12:55 -07003128 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003129 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003130 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 return;
3132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003133
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303134 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003136 {
3137 case eLIM_QUIET_BEGIN:
3138 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07003139 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
3140 if (TX_SUCCESS !=
3141 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
3142 {
3143 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003144 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003145 }
3146
3147 // gLimQuietDuration appears to be in units of ticks
3148 // Use it as is
3149 if (TX_SUCCESS !=
3150 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
3151 psessionEntry->gLimSpecMgmt.quietDuration,
3152 0))
3153 {
3154 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003155 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003156 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003157 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003158#ifdef GEN6_TODO
3159 /* revisit this piece of code to assign the appropriate sessionId below
3160 * priority - HIGH
3161 */
3162 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
3163#endif
3164 if( TX_SUCCESS !=
3165 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
3166 {
3167 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003168 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 }
3170 else
3171 {
3172 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07003173 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07003174
3175 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
3176 /* print message, otherwise, stop data traffic and stay quiet */
3177 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
3178 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
3179 {
3180 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003181 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003182 }
3183 else
3184 {
3185 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
3186 /* freeze the transmission */
3187 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
3188
3189 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003190 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003191 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 }
3193 }
3194 break;
3195
3196 case eLIM_QUIET_RUNNING:
3197 case eLIM_QUIET_INIT:
3198 case eLIM_QUIET_END:
3199 default:
3200 //
3201 // As of now, nothing to be done
3202 //
3203 break;
3204 }
3205}
3206
3207/**
3208 * limProcessQuietBssTimeout
3209 *
3210 * FUNCTION:
3211 * This function is active on the AP and STA.
3212 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
3213 *
3214 * LOGIC:
3215 * On the AP -
3216 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
3217 * an indication for the AP to START sending out the
3218 * Quiet BSS IE.
3219 * If 802.11H is enabled, the Quiet BSS IE is sent as per
3220 * the 11H spec
3221 * If 802.11H is not enabled, the Quiet BSS IE is sent as
3222 * a Proprietary IE. This will be understood by all the
3223 * TITAN STA's
3224 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3225 * initiate the SCH to include the Quiet BSS IE in all
3226 * its subsequent Beacons/PR's.
3227 * The Quiet BSS IE will be included in all the Beacons
3228 * & PR's until the next DTIM period
3229 *
3230 * On the STA -
3231 * When gLimQuietState = eLIM_QUIET_RUNNING
3232 * This indicates that the STA was successfully shut-off
3233 * for the specified gLimQuietDuration. This is a trigger
3234 * for the STA to now resume data traffic.
3235 * -> gLimQuietState is set to eLIM_QUIET_INIT
3236 *
3237 * ASSUMPTIONS:
3238 *
3239 * NOTE:
3240 *
3241 * @param pMac - Pointer to Global MAC structure
3242 *
3243 * @return None
3244 */
3245void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3246{
Jeff Johnsone7245742012-09-05 17:12:55 -07003247 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003248
Jeff Johnsone7245742012-09-05 17:12:55 -07003249 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003251 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 return;
3253 }
3254
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303255 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003256 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 }
3259 else
3260 {
3261 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003262 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003263 {
3264 case eLIM_QUIET_RUNNING:
3265 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003266 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003267
3268 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3269 {
3270 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3272 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 {
3274 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003275 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 }
3277
3278 /* Reset status flag */
3279 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3280 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3281
3282 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003283 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 }
3285 else
3286 {
3287 //
3288 // Nothing specific to be done in this case
3289 // A background scan that was triggered during
3290 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3291 //
3292 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003293 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 }
3295 break;
3296
3297 case eLIM_QUIET_INIT:
3298 case eLIM_QUIET_BEGIN:
3299 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003300 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 /* If the quiet period has ended, then resume the frame transmission */
3302 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003303 limRestorePreQuietState(pMac, psessionEntry);
3304 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 break;
3306
3307 default:
3308 //
3309 // As of now, nothing to be done
3310 //
3311 break;
3312 }
3313 }
3314}
Jeff Johnson295189b2012-06-20 16:38:30 -07003315/**
3316 * limProcessWPSOverlapTimeout
3317 *
3318 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3319 *
3320 * LOGIC:
3321 *
3322 * ASSUMPTIONS:
3323 *
3324 * NOTE:
3325 *
3326 * @param pMac - Pointer to Global MAC structure
3327 *
3328 * @return None
3329 */
3330#if 0
3331void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3332{
3333
3334 tpPESession psessionEntry;
3335 tANI_U32 sessionId;
3336
3337 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3338 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003339 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 }
3341
3342 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3343
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003344 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003345
3346 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3347 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003348 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 return;
3350 }
3351
3352 limWPSPBCTimeout(pMac, psessionEntry);
3353}
3354#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003355
Jeff Johnson295189b2012-06-20 16:38:30 -07003356/**----------------------------------------------
3357\fn limStartQuietTimer
3358\brief Starts the quiet timer.
3359
3360\param pMac
3361\return NONE
3362-----------------------------------------------*/
3363void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3364{
3365 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303366 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003367
3368 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003369 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003370 return;
3371 }
3372
Jeff Johnson295189b2012-06-20 16:38:30 -07003373
3374 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3375 return;
3376 // First, de-activate Timer, if its already active
3377 limCancelDot11hQuiet(pMac, psessionEntry);
3378
Jeff Johnsone7245742012-09-05 17:12:55 -07003379 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3380 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3381 {
3382 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003383 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003384 }
3385
3386 // Set the NEW timeout value, in ticks
3387 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3388 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3389 {
3390 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003391 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003392 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003393
3394 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3395 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3396 {
3397 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003398 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003400
Jeff Johnsone7245742012-09-05 17:12:55 -07003401 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003402 return;
3403 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003404}
3405
Jeff Johnson295189b2012-06-20 16:38:30 -07003406
3407/** ------------------------------------------------------------------------ **/
3408/**
3409 * keep track of the number of ANI peers associated in the BSS
3410 * For the first and last ANI peer, we have to update EDCA params as needed
3411 *
3412 * When the first ANI peer joins the BSS, we notify SCH
3413 * When the last ANI peer leaves the BSS, we notfiy SCH
3414 */
3415void
3416limUtilCountStaAdd(
3417 tpAniSirGlobal pMac,
3418 tpDphHashNode pSta,
3419 tpPESession psessionEntry)
3420{
3421
3422 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3423 return;
3424
3425 pSta->fAniCount = 1;
3426
3427 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3428 return;
3429
3430 // get here only if this is the first ANI peer in the BSS
3431 schEdcaProfileUpdate(pMac, psessionEntry);
3432}
3433
3434void
3435limUtilCountStaDel(
3436 tpAniSirGlobal pMac,
3437 tpDphHashNode pSta,
3438 tpPESession psessionEntry)
3439{
3440
3441 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3442 return;
3443
3444 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3445 * then go ahead and update the count and profiles. This ensures
3446 * that the "number of ani station" count is properly incremented/decremented.
3447 */
3448 if (pSta->valid == 1)
3449 return;
3450
3451 pSta->fAniCount = 0;
3452
3453 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3454 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003455 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 pMac->lim.gLimNumOfAniSTAs);
3457 return;
3458 }
3459
3460 pMac->lim.gLimNumOfAniSTAs--;
3461
3462 if (pMac->lim.gLimNumOfAniSTAs != 0)
3463 return;
3464
3465 // get here only if this is the last ANI peer in the BSS
3466 schEdcaProfileUpdate(pMac, psessionEntry);
3467}
3468
Jeff Johnson295189b2012-06-20 16:38:30 -07003469/**
3470 * limSwitchChannelCback()
3471 *
3472 *FUNCTION:
3473 * This is the callback function registered while requesting to switch channel
3474 * after AP indicates a channel switch for spectrum management (11h).
3475 *
3476 *NOTE:
3477 * @param pMac Pointer to Global MAC structure
3478 * @param status Status of channel switch request
3479 * @param data User data
3480 * @param psessionEntry Session information
3481 * @return NONE
3482 */
3483void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3484 tANI_U32 *data, tpPESession psessionEntry)
3485{
3486 tSirMsgQ mmhMsg = {0};
3487 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3488
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3490
3491 /* We need to restore pre-channelSwitch state on the STA */
3492 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3493 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003494 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 return;
3496 }
3497
3498 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303499 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3500 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003502 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 return;
3504 }
3505
3506 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3507 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003508 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3510 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303511 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3513 mmhMsg.bodyval = 0;
3514
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303515 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
3516 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003518}
3519
3520/**
3521 * limSwitchPrimaryChannel()
3522 *
3523 *FUNCTION:
3524 * This function changes the current operating channel
3525 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3526 *
3527 *NOTE:
3528 * @param pMac Pointer to Global MAC structure
3529 * @param newChannel new chnannel ID
3530 * @return NONE
3531 */
3532void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3533{
3534#if !defined WLAN_FEATURE_VOWIFI
3535 tANI_U32 localPwrConstraint;
3536#endif
3537
Abhishek Singh127a8442014-12-15 17:31:27 +05303538 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3539 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 psessionEntry->currentReqChannel = newChannel;
3541 psessionEntry->limRFBand = limGetRFBand(newChannel);
3542
3543 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3544
3545 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3546 pMac->lim.gpchangeChannelData = NULL;
3547
3548#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003549 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3551#else
3552 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3553 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003554 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 return;
3556 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003557 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3559#endif
3560 return;
3561}
3562
3563/**
3564 * limSwitchPrimarySecondaryChannel()
3565 *
3566 *FUNCTION:
3567 * This function changes the primary and secondary channel.
3568 * If 11h is enabled and user provides a "new channel ID"
3569 * that is different from the current operating channel,
3570 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3571 * assign notify LIM of such change.
3572 *
3573 *NOTE:
3574 * @param pMac Pointer to Global MAC structure
3575 * @param newChannel New chnannel ID (or current channel ID)
3576 * @param subband CB secondary info:
3577 * - eANI_CB_SECONDARY_NONE
3578 * - eANI_CB_SECONDARY_UP
3579 * - eANI_CB_SECONDARY_DOWN
3580 * @return NONE
3581 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003582void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003583{
3584#if !defined WLAN_FEATURE_VOWIFI
3585 tANI_U32 localPwrConstraint;
3586#endif
3587
Jeff Johnson295189b2012-06-20 16:38:30 -07003588#if !defined WLAN_FEATURE_VOWIFI
3589 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003590 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 return;
3592 }
3593#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303594 /* Assign the callback to resume TX once channel is changed.
3595 */
3596 psessionEntry->currentReqChannel = newChannel;
3597 psessionEntry->limRFBand = limGetRFBand(newChannel);
3598
3599 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3600
3601 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3602 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003603
Jeff Johnson295189b2012-06-20 16:38:30 -07003604#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003605 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003606#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003607 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003608#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003609
Sushant Kaushikb97a0082015-08-31 12:36:45 +05303610#ifdef FEATURE_WLAN_DIAG_SUPPORT
3611 limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT,
3612 psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_OPERATION);
3613#endif
3614
Jeff Johnsone7245742012-09-05 17:12:55 -07003615 // Store the new primary and secondary channel in session entries if different
3616 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 {
3618 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003619 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 psessionEntry->currentOperChannel = newChannel;
3622 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303623 if (psessionEntry->htSecondaryChannelOffset != limGetHTCBState(subband))
Jeff Johnsone7245742012-09-05 17:12:55 -07003624 {
3625 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003626 FL("switch old sec chnl %d --> new sec chnl %d "),
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303627 psessionEntry->htSecondaryChannelOffset, limGetHTCBState(subband));
3628 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(subband);
Jeff Johnsone7245742012-09-05 17:12:55 -07003629 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3630 {
3631 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303632 psessionEntry->apCenterChan = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003633 }
3634 else
3635 {
3636 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3637 }
3638 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3639 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003640
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303641 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3642 return;
3643
3644 if (subband > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
3645 psessionEntry->apCenterChan =
3646 limGetCenterChannel(pMac, newChannel,
3647 subband, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
3648 else
3649 psessionEntry->apCenterChan =
3650 limGetCenterChannel(pMac, newChannel,
3651 subband, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
3652
Jeff Johnson295189b2012-06-20 16:38:30 -07003653 return;
3654}
3655
3656
3657/**
3658 * limActiveScanAllowed()
3659 *
3660 *FUNCTION:
3661 * Checks if active scans are permitted on the given channel
3662 *
3663 *LOGIC:
3664 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3665 * Need to check if the channelNum matches, then depending on the corresponding
3666 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3667 *
3668 *ASSUMPTIONS:
3669 *
3670 *NOTE:
3671 *
3672 * @param pMac Pointer to Global MAC structure
3673 * @param channelNum channel number
3674 * @return None
3675 */
3676
3677tANI_U8 limActiveScanAllowed(
3678 tpAniSirGlobal pMac,
3679 tANI_U8 channelNum)
3680{
3681 tANI_U32 i;
3682 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3683 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3684 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3685 != eSIR_SUCCESS)
3686 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003687 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 return false;
3689 }
3690
3691 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3692 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003693 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 len);
3695 return false;
3696 }
3697
3698 for (i=0; (i+1) < len; i+=2)
3699 {
3700 if (channelPair[i] == channelNum)
3701 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3702 }
3703 return false;
3704}
3705
3706/**
3707 * limTriggerBackgroundScanDuringQuietBss()
3708 *
3709 *FUNCTION:
3710 * This function is applicable to the STA only.
3711 * This function is called by limProcessQuietTimeout(),
3712 * when it is time to honor the Quiet BSS IE from the AP.
3713 *
3714 *LOGIC:
3715 * If 11H is enabled:
3716 * We cannot trigger a background scan. The STA needs to
3717 * shut-off Tx/Rx.
3718 * If 11 is not enabled:
3719 * Determine if the next channel that we are going to
3720 * scan is NOT the same channel (or not) on which the
3721 * Quiet BSS was requested.
3722 * If yes, then we cannot trigger a background scan on
3723 * this channel. Return with a false.
3724 * If no, then trigger a background scan. Return with
3725 * a true.
3726 *
3727 *ASSUMPTIONS:
3728 *
3729 *NOTE:
3730 * This API is redundant if the existing API,
3731 * limTriggerBackgroundScan(), were to return a valid
3732 * response instead of returning void.
3733 * If possible, try to revisit this API
3734 *
3735 * @param pMac Pointer to Global MAC structure
3736 * @return eSIR_TRUE, if a background scan was attempted
3737 * eSIR_FALSE, if not
3738 */
3739tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3740{
3741 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003742
3743
3744
3745 //TBD-RAJESH HOW TO GET sessionEntry?????
3746 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3747
3748 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3749 return bScanTriggered;
3750
Jeff Johnsone7245742012-09-05 17:12:55 -07003751 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003752 {
3753 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3754 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3755
3756 // Determine the next scan channel
3757
3758 // Get background scan channel list from CFG
3759 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3760 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3761 (tANI_U8 *) bgScanChannelList,
3762 (tANI_U32 *) &len ))
3763 {
3764 // Ensure that we do not go off scanning on the same
3765 // channel on which the Quiet BSS was requested
3766 if( psessionEntry->currentOperChannel!=
3767 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3768 {
3769 // For now, try and attempt a background scan. It will
3770 // be ideal if this API actually returns a success or
3771 // failure instead of having a void return type
3772 limTriggerBackgroundScan( pMac );
3773
3774 bScanTriggered = eSIR_TRUE;
3775 }
3776 else
3777 {
3778 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003779 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 -07003780 }
3781 }
3782 else
3783 {
3784 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003785 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 -07003786 }
3787 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 return bScanTriggered;
3789}
3790
3791
3792/**
3793 * limGetHTCapability()
3794 *
3795 *FUNCTION:
3796 * A utility function that returns the "current HT capability state" for the HT
3797 * capability of interest (as requested in the API)
3798 *
3799 *LOGIC:
3800 * This routine will return with the "current" setting of a requested HT
3801 * capability. This state info could be retrieved from -
3802 * a) CFG (for static entries)
3803 * b) Run time info
3804 * - Dynamic state maintained by LIM
3805 * - Configured at radio init time by SME
3806 *
3807 *
3808 *ASSUMPTIONS:
3809 * NA
3810 *
3811 *NOTE:
3812 *
3813 * @param pMac Pointer to Global MAC structure
3814 * @param htCap The HT capability being queried
3815 * @return tANI_U8 The current state of the requested HT capability is returned in a
3816 * tANI_U8 variable
3817 */
3818
Jeff Johnson295189b2012-06-20 16:38:30 -07003819tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3820 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003821{
3822tANI_U8 retVal = 0;
3823tANI_U8 *ptr;
3824tANI_U32 cfgValue;
3825tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3826tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3827tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3828tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3829
3830 //
3831 // Determine which CFG to read from. Not ALL of the HT
3832 // related CFG's need to be read each time this API is
3833 // accessed
3834 //
3835 if( htCap >= eHT_ANTENNA_SELECTION &&
3836 htCap < eHT_SI_GRANULARITY )
3837 {
3838 // Get Antenna Seletion HT Capabilities
3839 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3840 cfgValue = 0;
3841 ptr = (tANI_U8 *) &macASCapabilityInfo;
3842 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3843 }
3844 else
3845 {
3846 if( htCap >= eHT_TX_BEAMFORMING &&
3847 htCap < eHT_ANTENNA_SELECTION )
3848 {
3849 // Get Transmit Beam Forming HT Capabilities
3850 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3851 cfgValue = 0;
3852 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3853 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3854 }
3855 else
3856 {
3857 if( htCap >= eHT_PCO &&
3858 htCap < eHT_TX_BEAMFORMING )
3859 {
3860 // Get Extended HT Capabilities
3861 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3862 cfgValue = 0;
3863 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3864 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3865 }
3866 else
3867 {
3868 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3869 {
3870 // Get HT Capabilities
3871 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3872 cfgValue = 0;
3873 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3874 // 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
3875 *ptr++ = cfgValue & 0xff;
3876 *ptr = (cfgValue >> 8) & 0xff;
3877 }
3878 }
3879 }
3880 }
3881
3882 switch( htCap )
3883 {
3884 case eHT_LSIG_TXOP_PROTECTION:
3885 retVal = pMac->lim.gHTLsigTXOPProtection;
3886 break;
3887
3888 case eHT_STBC_CONTROL_FRAME:
3889 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3890 break;
3891
3892 case eHT_PSMP:
3893 retVal = pMac->lim.gHTPSMPSupport;
3894 break;
3895
3896 case eHT_DSSS_CCK_MODE_40MHZ:
3897 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3898 break;
3899
3900 case eHT_MAX_AMSDU_LENGTH:
3901 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3902 break;
3903
3904 case eHT_DELAYED_BA:
3905 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3906 break;
3907
3908 case eHT_RX_STBC:
3909 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3910 break;
3911
3912 case eHT_TX_STBC:
3913 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3914 break;
3915
3916 case eHT_SHORT_GI_40MHZ:
3917 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3918 break;
3919
3920 case eHT_SHORT_GI_20MHZ:
3921 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3922 break;
3923
3924 case eHT_GREENFIELD:
3925 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3926 break;
3927
3928 case eHT_MIMO_POWER_SAVE:
3929 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3930 break;
3931
3932 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003933 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003934 break;
3935
3936 case eHT_ADVANCED_CODING:
3937 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3938 break;
3939
3940 case eHT_MAX_RX_AMPDU_FACTOR:
3941 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3942 break;
3943
3944 case eHT_MPDU_DENSITY:
3945 retVal = pMac->lim.gHTAMpduDensity;
3946 break;
3947
3948 case eHT_PCO:
3949 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3950 break;
3951
3952 case eHT_TRANSITION_TIME:
3953 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3954 break;
3955
3956 case eHT_MCS_FEEDBACK:
3957 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3958 break;
3959
3960 case eHT_TX_BEAMFORMING:
3961 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3962 break;
3963
3964 case eHT_ANTENNA_SELECTION:
3965 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3966 break;
3967
3968 case eHT_SI_GRANULARITY:
3969 retVal = pMac->lim.gHTServiceIntervalGranularity;
3970 break;
3971
3972 case eHT_CONTROLLED_ACCESS:
3973 retVal = pMac->lim.gHTControlledAccessOnly;
3974 break;
3975
3976 case eHT_RIFS_MODE:
3977 retVal = psessionEntry->beaconParams.fRIFSMode;
3978 break;
3979
3980 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003981 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 break;
3983
3984 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003985 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 break;
3987
3988 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3990 retVal = psessionEntry->htOperMode;
3991 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 retVal = pMac->lim.gHTOperMode;
3993 break;
3994
3995 case eHT_BASIC_STBC_MCS:
3996 retVal = pMac->lim.gHTSTBCBasicMCS;
3997 break;
3998
3999 case eHT_DUAL_CTS_PROTECTION:
4000 retVal = pMac->lim.gHTDualCTSProtection;
4001 break;
4002
4003 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
4004 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
4005 break;
4006
4007 case eHT_PCO_ACTIVE:
4008 retVal = pMac->lim.gHTPCOActive;
4009 break;
4010
4011 case eHT_PCO_PHASE:
4012 retVal = pMac->lim.gHTPCOPhase;
4013 break;
4014
4015 default:
4016 break;
4017 }
4018
4019 return retVal;
4020}
4021
Jeff Johnson295189b2012-06-20 16:38:30 -07004022void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
4023{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304024 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004025 return;
4026}
4027
4028
4029
4030
4031/** -------------------------------------------------------------
4032\fn limEnable11aProtection
4033\brief based on config setting enables\disables 11a protection.
4034\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4035\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4036\param tpUpdateBeaconParams pBeaconParams
4037\return None
4038 -------------------------------------------------------------*/
4039tSirRetStatus
4040limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4041 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4042{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004043 if(NULL == psessionEntry)
4044 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004045 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004046 return eSIR_FAILURE;
4047 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 //overlapping protection configuration check.
4049 if(overlap)
4050 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 }
4052 else
4053 {
4054 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07004055 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004056 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 {
4058 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004059 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 return eSIR_SUCCESS;
4061 }
4062 }
4063
4064 if (enable)
4065 {
4066 //If we are AP and HT capable, we need to set the HT OP mode
4067 //appropriately.
4068 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07004069 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 {
4071 if(overlap)
4072 {
4073 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
4074 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4075 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4076 {
4077 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4078 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4079 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4080 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4081 }
4082 }
4083 else
4084 {
4085 psessionEntry->gLim11aParams.protectionEnabled = true;
4086 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4087 {
4088 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07004089 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4091 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4092
4093 }
4094 }
4095 }
4096
4097 //This part is common for staiton as well.
4098 if(false == psessionEntry->beaconParams.llaCoexist)
4099 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004100 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
4102 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4103 }
4104 }
4105 else if (true == psessionEntry->beaconParams.llaCoexist)
4106 {
4107 //for AP role.
4108 //we need to take care of HT OP mode change if needed.
4109 //We need to take care of Overlap cases.
4110 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4111 {
4112 if(overlap)
4113 {
4114 //Overlap Legacy protection disabled.
4115 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
4116
4117 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004118 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 {
4120 // no HT op mode change if any of the overlap protection enabled.
4121 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4122 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4123 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4124
4125 {
4126 //Check if there is a need to change HT OP mode.
4127 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4128 {
4129 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4130 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4131
4132 if(psessionEntry->gLimHt20Params.protectionEnabled)
4133 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4134 else
4135 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4136 }
4137 }
4138 }
4139 }
4140 else
4141 {
4142 //Disable protection from 11A stations.
4143 psessionEntry->gLim11aParams.protectionEnabled = false;
4144 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4145
4146 //Check if any other non-HT protection enabled.
4147 //Right now we are in HT OP Mixed mode.
4148 //Change HT op mode appropriately.
4149
4150 //Change HT OP mode to 01 if any overlap protection enabled
4151 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
4152 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4153 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4154
4155 {
4156 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07004157 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07004158 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4159 }
4160 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4161 {
4162 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07004163 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4165 }
4166 else
4167 {
4168 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004169 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4171 }
4172 }
4173 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
4174 !psessionEntry->gLim11aParams.protectionEnabled)
4175 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004176 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004177 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4178 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4179 }
4180 }
4181 //for station role
4182 else
4183 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004184 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004185 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
4186 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
4187 }
4188 }
4189
4190 return eSIR_SUCCESS;
4191}
4192
4193/** -------------------------------------------------------------
4194\fn limEnable11gProtection
4195\brief based on config setting enables\disables 11g protection.
4196\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4197\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4198\param tpUpdateBeaconParams pBeaconParams
4199\return None
4200 -------------------------------------------------------------*/
4201
4202tSirRetStatus
4203limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4204 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4205{
4206
4207 //overlapping protection configuration check.
4208 if(overlap)
4209 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 }
4211 else
4212 {
4213 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4215 !psessionEntry->cfgProtection.fromllb)
4216 {
4217 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004218 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 return eSIR_SUCCESS;
4220 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 {
4222 if(!pMac->lim.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 }
4228 }
4229 }
4230
4231 if (enable)
4232 {
4233 //If we are AP and HT capable, we need to set the HT OP mode
4234 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4236 {
4237 if(overlap)
4238 {
4239 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004240 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004241 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 {
4243 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4244 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4245 {
4246 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4247 }
4248 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4249 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4250 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4251 //Not processing OBSS bit from other APs, as we are already taking care
4252 //of Protection from overlapping BSS based on erp IE or useProtection bit
4253 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4254 }
4255 }
4256 else
4257 {
4258 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004259 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004260 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 {
4262 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4263 {
4264 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4265 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4266 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4267 }
4268 }
4269 }
4270 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004271 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004272 {
4273 if(overlap)
4274 {
4275 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4276 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4277 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4278 {
4279 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4280 }
4281 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4282 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4283 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4284 //Not processing OBSS bit from other APs, as we are already taking care
4285 //of Protection from overlapping BSS based on erp IE or useProtection bit
4286 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4287 }
4288 else
4289 {
4290 psessionEntry->gLim11bParams.protectionEnabled = true;
4291 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4292 {
4293 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4294 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4295 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4296 }
4297 }
4298 }
4299
4300 //This part is common for staiton as well.
4301 if(false == psessionEntry->beaconParams.llbCoexist)
4302 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004303 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4305 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4306 }
4307 }
4308 else if (true == psessionEntry->beaconParams.llbCoexist)
4309 {
4310 //for AP role.
4311 //we need to take care of HT OP mode change if needed.
4312 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4314 {
4315 if(overlap)
4316 {
4317 //Overlap Legacy protection disabled.
4318 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4319
4320 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004321 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004322 {
4323 // no HT op mode change if any of the overlap protection enabled.
4324 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4325 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4326 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4327 {
4328 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004329 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004330 {
4331 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4332 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4333 if(psessionEntry->gLimHt20Params.protectionEnabled){
4334 //Commenting out beacuse of CR 258588 WFA cert
4335 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4336 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4337 }
4338 else
4339 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4340 }
4341 }
4342 }
4343 }
4344 else
4345 {
4346 //Disable protection from 11B stations.
4347 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004348 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 //Check if any other non-HT protection enabled.
4350 if(!psessionEntry->gLim11gParams.protectionEnabled)
4351 {
4352 //Right now we are in HT OP Mixed mode.
4353 //Change HT op mode appropriately.
4354 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4355
4356 //Change HT OP mode to 01 if any overlap protection enabled
4357 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4358 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4359 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4360 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4361 {
4362 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004363 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4365 }
4366 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4367 {
4368 //Commenting because of CR 258588 WFA cert
4369 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4370 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004371 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004372 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4373 }
4374 else
4375 {
4376 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4377 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4378 }
4379 }
4380 }
4381 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4382 !psessionEntry->gLim11bParams.protectionEnabled)
4383 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004384 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4386 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4387 }
4388 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 {
4390 if(overlap)
4391 {
4392 //Overlap Legacy protection disabled.
4393 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4394
4395 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004396 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004397 {
4398 // no HT op mode change if any of the overlap protection enabled.
4399 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4400 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4401 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4402
4403 {
4404 //Check if there is a need to change HT OP mode.
4405 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4406 {
4407 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4408 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4409 if(psessionEntry->gLimHt20Params.protectionEnabled)
4410 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4411 else
4412 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4413 }
4414 }
4415 }
4416 }
4417 else
4418 {
4419 //Disable protection from 11B stations.
4420 psessionEntry->gLim11bParams.protectionEnabled = false;
4421 //Check if any other non-HT protection enabled.
4422 if(!psessionEntry->gLim11gParams.protectionEnabled)
4423 {
4424 //Right now we are in HT OP Mixed mode.
4425 //Change HT op mode appropriately.
4426 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4427
4428 //Change HT OP mode to 01 if any overlap protection enabled
4429 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4430 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4431 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4432 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4433
4434 {
4435 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4436 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4437 }
4438 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4439 {
4440 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4441 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4442 }
4443 else
4444 {
4445 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4446 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4447 }
4448 }
4449 }
4450 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4451 !psessionEntry->gLim11bParams.protectionEnabled)
4452 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004453 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004454 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4455 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4456 }
4457 }
4458 //for station role
4459 else
4460 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004461 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4463 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4464 }
4465 }
4466 return eSIR_SUCCESS;
4467}
4468
4469/** -------------------------------------------------------------
4470\fn limEnableHtProtectionFrom11g
4471\brief based on cofig enables\disables protection from 11g.
4472\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4473\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4474\param tpUpdateBeaconParams pBeaconParams
4475\return None
4476 -------------------------------------------------------------*/
4477tSirRetStatus
4478limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4479 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4480{
Jeff Johnsone7245742012-09-05 17:12:55 -07004481 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4483
4484 //overlapping protection configuration check.
4485 if(overlap)
4486 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4488 {
4489 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004490 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 return eSIR_SUCCESS;
4492 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 {
4494 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004495 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004496 return eSIR_SUCCESS;
4497 }
4498 }
4499 else
4500 {
4501 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4503 !psessionEntry->cfgProtection.fromllg){
4504 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004505 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 return eSIR_SUCCESS;
4507 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 {
4509 if(!pMac->lim.cfgProtection.fromllg)
4510 {
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 }
4515 }
4516 }
4517 if (enable)
4518 {
4519 //If we are AP and HT capable, we need to set the HT OP mode
4520 //appropriately.
4521
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4523 {
4524 if(overlap)
4525 {
4526 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4527 //11g exists in overlap BSS.
4528 //need not to change the operating mode to overlap_legacy
4529 //if higher or same protection operating mode is enabled right now.
4530 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4531 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4532 {
4533 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4534 }
4535 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304536 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004537 }
4538 else
4539 {
4540 //11g is associated to an AP operating in 11n mode.
4541 //Change the HT operating mode to 'mixed mode'.
4542 psessionEntry->gLim11gParams.protectionEnabled = true;
4543 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4544 {
4545 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4546 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304547 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 }
4549 }
4550 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004551 {
4552 if(overlap)
4553 {
4554 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4555 //11g exists in overlap BSS.
4556 //need not to change the operating mode to overlap_legacy
4557 //if higher or same protection operating mode is enabled right now.
4558 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4559 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4560 {
4561 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4562 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4563 }
4564 }
4565 else
4566 {
4567 //11g is associated to an AP operating in 11n mode.
4568 //Change the HT operating mode to 'mixed mode'.
4569 psessionEntry->gLim11gParams.protectionEnabled = true;
4570 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4571 {
4572 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4573 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304574 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 }
4576 }
4577 }
4578
4579 //This part is common for staiton as well.
4580 if(false == psessionEntry->beaconParams.llgCoexist)
4581 {
4582 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4583 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4584 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4586 {
4587 // As operating mode changed after G station assoc some way to update beacon
4588 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4589 //pMac->sch.schObject.fBeaconChanged = 1;
4590 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 }
4593 else if (true == psessionEntry->beaconParams.llgCoexist)
4594 {
4595 //for AP role.
4596 //we need to take care of HT OP mode change if needed.
4597 //We need to take care of Overlap cases.
4598
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4600 {
4601 if(overlap)
4602 {
4603 //Overlap Legacy protection disabled.
4604 if (psessionEntry->gLim11gParams.numSta == 0)
4605 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4606
4607 // no HT op mode change if any of the overlap protection enabled.
4608 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4609 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4610 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4611 {
4612 //Check if there is a need to change HT OP mode.
4613 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4614 {
4615 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4616 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4617
4618 if(psessionEntry->gLimHt20Params.protectionEnabled){
4619 //Commenting because of CR 258588 WFA cert
4620 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4621 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4622 }
4623 else
4624 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4625 }
4626 }
4627 }
4628 else
4629 {
4630 //Disable protection from 11G stations.
4631 psessionEntry->gLim11gParams.protectionEnabled = false;
4632 //Check if any other non-HT protection enabled.
4633 if(!psessionEntry->gLim11bParams.protectionEnabled)
4634 {
4635
4636 //Right now we are in HT OP Mixed mode.
4637 //Change HT op mode appropriately.
4638 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4639
4640 //Change HT OP mode to 01 if any overlap protection enabled
4641 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4642 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4643 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4644 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4645
4646 {
4647 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4648 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4649 }
4650 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4651 {
4652 //Commenting because of CR 258588 WFA cert
4653 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4654 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4655 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4656 }
4657 else
4658 {
4659 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4660 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4661 }
4662 }
4663 }
4664 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4665 !psessionEntry->gLim11gParams.protectionEnabled)
4666 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004667 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4669 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4670 }
4671 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004672 {
4673 if(overlap)
4674 {
4675 //Overlap Legacy protection disabled.
4676 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4677
4678 // no HT op mode change if any of the overlap protection enabled.
4679 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4680 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4681 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4682 {
4683 //Check if there is a need to change HT OP mode.
4684 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4685 {
4686 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4687 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4688
4689 if(psessionEntry->gLimHt20Params.protectionEnabled)
4690 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4691 else
4692 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4693 }
4694 }
4695 }
4696 else
4697 {
4698 //Disable protection from 11G stations.
4699 psessionEntry->gLim11gParams.protectionEnabled = false;
4700 //Check if any other non-HT protection enabled.
4701 if(!psessionEntry->gLim11bParams.protectionEnabled)
4702 {
4703
4704 //Right now we are in HT OP Mixed mode.
4705 //Change HT op mode appropriately.
4706 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4707
4708 //Change HT OP mode to 01 if any overlap protection enabled
4709 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4710 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4711 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4712 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4713
4714 {
4715 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4716 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4717 }
4718 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4719 {
4720 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4721 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4722 }
4723 else
4724 {
4725 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4726 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 }
4728 }
4729 }
4730 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4731 !psessionEntry->gLim11gParams.protectionEnabled)
4732 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004733 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004734 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4735 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4736 }
4737 }
4738 //for station role
4739 else
4740 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004741 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004742 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4743 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4744 }
4745 }
4746 return eSIR_SUCCESS;
4747}
4748//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4749//This check will be done at the caller.
4750
4751/** -------------------------------------------------------------
4752\fn limEnableHtObssProtection
4753\brief based on cofig enables\disables obss protection.
4754\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4755\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4756\param tpUpdateBeaconParams pBeaconParams
4757\return None
4758 -------------------------------------------------------------*/
4759tSirRetStatus
4760limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4761 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4762{
4763
4764
Jeff Johnsone7245742012-09-05 17:12:55 -07004765 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 return eSIR_SUCCESS; // this protection is only for HT stations.
4767
4768 //overlapping protection configuration check.
4769 if(overlap)
4770 {
4771 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 }
4773 else
4774 {
4775 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4777 { //ToDo Update this field
4778 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004779 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 return eSIR_SUCCESS;
4781 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 {
4783 if(!pMac->lim.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 }
4789 }
4790 }
4791
4792
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4794 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4795 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004796 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 psessionEntry->beaconParams.gHTObssMode = true;
4798 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4799
4800 }
4801 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004803 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 psessionEntry->beaconParams.gHTObssMode = false;
4805 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4806
4807 }
4808//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4809 if (!enable && !overlap)
4810 {
4811 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4812 }
4813 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 {
4815 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004817 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 psessionEntry->beaconParams.gHTObssMode = true;
4819 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4820
4821 }
4822 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4823 {
4824
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004825 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004826 psessionEntry->beaconParams.gHTObssMode = false;
4827 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4828
4829 }
4830 }
4831 return eSIR_SUCCESS;
4832}
4833/** -------------------------------------------------------------
4834\fn limEnableHT20Protection
4835\brief based on cofig enables\disables protection from Ht20.
4836\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4837\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4838\param tpUpdateBeaconParams pBeaconParams
4839\return None
4840 -------------------------------------------------------------*/
4841tSirRetStatus
4842limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4843 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4844{
Jeff Johnsone7245742012-09-05 17:12:55 -07004845 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004846 return eSIR_SUCCESS; // this protection is only for HT stations.
4847
4848 //overlapping protection configuration check.
4849 if(overlap)
4850 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 }
4852 else
4853 {
4854 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4856 !psessionEntry->cfgProtection.ht20)
4857 {
4858 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004859 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 return eSIR_SUCCESS;
4861 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 {
4863 if(!pMac->lim.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 }
4869 }
4870 }
4871
4872 if (enable)
4873 {
4874 //If we are AP and HT capable, we need to set the HT OP mode
4875 //appropriately.
4876
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4878 if(overlap)
4879 {
4880 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4881 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4882 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4883 {
4884 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4885 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4886 }
4887 }
4888 else
4889 {
4890 psessionEntry->gLimHt20Params.protectionEnabled = true;
4891 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4892 {
4893 //Commenting because of CR 258588 WFA cert
4894 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4895 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4896 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4897 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4898 }
4899 }
4900 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 {
4902 if(overlap)
4903 {
4904 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4905 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4906 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4907 {
4908 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4909 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4910 }
4911 }
4912 else
4913 {
4914 psessionEntry->gLimHt20Params.protectionEnabled = true;
4915 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4916 {
4917 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4918 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4919 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4920 }
4921 }
4922 }
4923
4924 //This part is common for staiton as well.
4925 if(false == psessionEntry->beaconParams.ht20Coexist)
4926 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004927 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4929 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4930 }
4931 }
4932 else if (true == psessionEntry->beaconParams.ht20Coexist)
4933 {
4934 //for AP role.
4935 //we need to take care of HT OP mode change if needed.
4936 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4938 if(overlap)
4939 {
4940 //Overlap Legacy protection disabled.
4941 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4942
4943 // no HT op mode change if any of the overlap protection enabled.
4944 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4945 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4946 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4947 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4948 {
4949
4950 //Check if there is a need to change HT OP mode.
4951 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4952 {
4953 if(psessionEntry->gLimHt20Params.protectionEnabled)
4954 {
4955 //Commented beacuse of CR 258588 for WFA Cert
4956 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4957 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4958 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4959 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4960 }
4961 else
4962 {
4963 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4964 }
4965 }
4966 }
4967 }
4968 else
4969 {
4970 //Disable protection from 11G stations.
4971 psessionEntry->gLimHt20Params.protectionEnabled = false;
4972
4973 //Change HT op mode appropriately.
4974 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4975 {
4976 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4977 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4978 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4979 }
4980 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004981 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4983 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4984 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 {
4986 if(overlap)
4987 {
4988 //Overlap Legacy protection disabled.
4989 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4990
4991 // no HT op mode change if any of the overlap protection enabled.
4992 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4993 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4994 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4995 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4996 {
4997
4998 //Check if there is a need to change HT OP mode.
4999 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
5000 {
5001 if(psessionEntry->gLimHt20Params.protectionEnabled)
5002 {
5003 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
5004 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5005 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5006 }
5007 else
5008 {
5009 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5010 }
5011 }
5012 }
5013 }
5014 else
5015 {
5016 //Disable protection from 11G stations.
5017 psessionEntry->gLimHt20Params.protectionEnabled = false;
5018
5019 //Change HT op mode appropriately.
5020 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
5021 {
5022 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
5023 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5024 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
5025 }
5026 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005027 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005028 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5029 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5030 }
5031 //for station role
5032 else
5033 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005034 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
5036 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
5037 }
5038 }
5039
5040 return eSIR_SUCCESS;
5041}
5042
5043/** -------------------------------------------------------------
5044\fn limEnableHTNonGfProtection
5045\brief based on cofig enables\disables protection from NonGf.
5046\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5047\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5048\param tpUpdateBeaconParams pBeaconParams
5049\return None
5050 -------------------------------------------------------------*/
5051tSirRetStatus
5052limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5053 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5054{
Jeff Johnsone7245742012-09-05 17:12:55 -07005055 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 return eSIR_SUCCESS; // this protection is only for HT stations.
5057
5058 //overlapping protection configuration check.
5059 if(overlap)
5060 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 }
5062 else
5063 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005064 //normal protection config check
5065 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5066 !psessionEntry->cfgProtection.nonGf)
5067 {
5068 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005069 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005070 return eSIR_SUCCESS;
5071 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 {
5073 //normal protection config check
5074 if(!pMac->lim.cfgProtection.nonGf)
5075 {
5076 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005077 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 return eSIR_SUCCESS;
5079 }
5080 }
5081 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005082 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5083 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5084 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005085 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5087 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5088 }
5089 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5090 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005091 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005092 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5093 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5094 }
5095 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 {
5097 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
5098 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005099 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
5101 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5102 }
5103 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
5104 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005105 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005106 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
5107 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
5108 }
5109 }
5110
5111 return eSIR_SUCCESS;
5112}
5113
5114/** -------------------------------------------------------------
5115\fn limEnableHTLsigTxopProtection
5116\brief based on cofig enables\disables LsigTxop protection.
5117\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5118\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5119\param tpUpdateBeaconParams pBeaconParams
5120\return None
5121 -------------------------------------------------------------*/
5122tSirRetStatus
5123limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5124 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5125{
Jeff Johnsone7245742012-09-05 17:12:55 -07005126 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005127 return eSIR_SUCCESS; // this protection is only for HT stations.
5128
5129 //overlapping protection configuration check.
5130 if(overlap)
5131 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 }
5133 else
5134 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005135 //normal protection config check
5136 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
5137 !psessionEntry->cfgProtection.lsigTxop)
5138 {
5139 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005140 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 return eSIR_SUCCESS;
5142 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005143 {
5144 //normal protection config check
5145 if(!pMac->lim.cfgProtection.lsigTxop)
5146 {
5147 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005148 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005149 return eSIR_SUCCESS;
5150 }
5151 }
5152 }
5153
5154
Jeff Johnson295189b2012-06-20 16:38:30 -07005155 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5156 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5157 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005158 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5160 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5161 }
5162 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5163 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005164 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5166 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5167 }
5168 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 {
5170 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5171 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005172 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005173 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
5174 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5175 }
5176 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
5177 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005178 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005179 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
5180 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
5181 }
5182 }
5183 return eSIR_SUCCESS;
5184}
5185//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
5186//This check will be done at the caller.
5187/** -------------------------------------------------------------
5188\fn limEnableHtRifsProtection
5189\brief based on cofig enables\disables Rifs protection.
5190\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
5191\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
5192\param tpUpdateBeaconParams pBeaconParams
5193\return None
5194 -------------------------------------------------------------*/
5195tSirRetStatus
5196limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
5197 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
5198{
Jeff Johnsone7245742012-09-05 17:12:55 -07005199 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07005200 return eSIR_SUCCESS; // this protection is only for HT stations.
5201
5202
5203 //overlapping protection configuration check.
5204 if(overlap)
5205 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005206 }
5207 else
5208 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005209 //normal protection config check
5210 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
5211 !psessionEntry->cfgProtection.rifs)
5212 {
5213 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005214 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005215 return eSIR_SUCCESS;
5216 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07005217 {
5218 //normal protection config check
5219 if(!pMac->lim.cfgProtection.rifs)
5220 {
5221 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005222 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005223 return eSIR_SUCCESS;
5224 }
5225 }
5226 }
5227
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
5229 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5230 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5231 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005232 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005233 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5234 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5235 }
5236 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5237 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005239 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5241 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5242 }
5243 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 {
5245 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5246 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5247 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005248 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005249 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5250 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5251 }
5252 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5253 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5254 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005255 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005256 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5257 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5258 }
5259 }
5260 return eSIR_SUCCESS;
5261}
5262
5263// ---------------------------------------------------------------------
5264/**
5265 * limEnableShortPreamble
5266 *
5267 * FUNCTION:
5268 * Enable/Disable short preamble
5269 *
5270 * LOGIC:
5271 *
5272 * ASSUMPTIONS:
5273 *
5274 * NOTE:
5275 *
5276 * @param enable Flag to enable/disable short preamble
5277 * @return None
5278 */
5279
5280tSirRetStatus
5281limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5282{
5283 tANI_U32 val;
5284
5285 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5286 {
5287 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005288 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005289 return eSIR_FAILURE;
5290 }
5291
5292 if (!val)
5293 return eSIR_SUCCESS;
5294
5295 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5296 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005297 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005298 return eSIR_FAILURE;
5299 }
5300
5301 if (!val) // 11G short preamble switching is disabled.
5302 return eSIR_SUCCESS;
5303
5304 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5305 {
5306 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5307 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005308 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005309 psessionEntry->beaconParams.fShortPreamble = true;
5310 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5311 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5312 }
5313 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5314 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005315 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 psessionEntry->beaconParams.fShortPreamble = false;
5317 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5318 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5319 }
5320 }
5321
5322 return eSIR_SUCCESS;
5323 }
5324
5325/**
5326 * limTxComplete
5327 *
5328 * Function:
5329 * This is LIM's very own "TX MGMT frame complete" completion routine.
5330 *
5331 * Logic:
5332 * LIM wants to send a MGMT frame (broadcast or unicast)
5333 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5334 * LIM transmits the MGMT frame using the API:
5335 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5336 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5337 * HDD, if it determines that a TX completion routine (in this case
5338 * limTxComplete) has been provided, will invoke this callback
5339 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5340 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5341 *
5342 * Assumptions:
5343 * Presently, this is ONLY being used for MGMT frames/packets
5344 * TODO:
5345 * Would it do good for LIM to have some sort of "signature" validation to
5346 * ensure that the pData argument passed in was a buffer that was actually
5347 * allocated by LIM and/or is not corrupted?
5348 *
5349 * Note: FIXME and TODO
5350 * Looks like palPktFree() is interested in pPacket. But, when this completion
5351 * routine is called, only pData is made available to LIM!!
5352 *
5353 * @param void A pointer to pData. Shouldn't it be pPacket?!
5354 *
5355 * @return none
5356 */
5357void limTxComplete( tHalHandle hHal, void *pData )
5358{
5359 tpAniSirGlobal pMac;
5360 pMac = (tpAniSirGlobal)hHal;
5361
5362#ifdef FIXME_PRIMA
5363 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5364#ifdef TRACE_RECORD
5365 {
5366 tpSirMacMgmtHdr mHdr;
5367 v_U8_t *pRxBd;
5368 vos_pkt_t *pVosPkt;
5369 VOS_STATUS vosStatus;
5370
5371
5372
5373 pVosPkt = (vos_pkt_t *)pData;
5374 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5375
5376 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5377 {
5378 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005379
5380 }
5381 }
5382#endif
5383#endif
5384
5385 palPktFree( pMac->hHdd,
5386 HAL_TXRX_FRM_802_11_MGMT,
5387 (void *) NULL, // this is ignored and will likely be removed from this API
5388 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5389}
5390
5391/**
5392 * \brief This function updates lim global structure, if CB parameters in the BSS
5393 * have changed, and sends an indication to HAL also with the
5394 * updated HT Parameters.
5395 * This function does not detect the change in the primary channel, that is done as part
5396 * of channel Swtich IE processing.
5397 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5398 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5399 *
5400 *
5401 * \param pMac Pointer to global MAC structure
5402 *
5403 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5404 * Probe Response
5405 *
5406 * \param bssIdx BSS Index of the Bss to which Station is associated.
5407 *
5408 *
5409 */
5410
5411void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5412 tDot11fIEHTInfo *pHTInfo,
5413 tANI_U8 bssIdx,
5414 tpPESession psessionEntry)
5415{
Jeff Johnsone7245742012-09-05 17:12:55 -07005416 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005417#if !defined WLAN_FEATURE_VOWIFI
5418 tANI_U32 localPwrConstraint;
5419#endif
5420
5421 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005422 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005423 return;
5424
Abhishek Singhe3beee22017-07-31 15:35:40 +05305425 if ((RF_CHAN_14 >= psessionEntry->currentOperChannel) &&
5426 psessionEntry->force_24ghz_in_ht20) {
5427 limLog(pMac, LOG1,
5428 FL("force_24_gh_in_ht20 is set and channel is 2.4 Ghz"));
5429 return;
5430 }
5431
Jeff Johnson295189b2012-06-20 16:38:30 -07005432#if !defined WLAN_FEATURE_VOWIFI
5433 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005434 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005435 return;
5436 }
5437#endif
5438
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305439 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5440 {
5441 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5442 return;
5443 }
5444
Mihir Shetebc160b72014-08-22 14:10:39 +05305445 /*
5446 * Do not try to switch channel if RoC is in progress. RoC code path uses
5447 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5448 * has started listening on the channel requested as part of RoC, if we set
5449 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5450 * upper layers will think that the channel change is not successful and the
5451 * RoC from the upper layer perspective will never end...
5452 */
5453 if (pMac->lim.gpLimRemainOnChanReq)
5454 {
5455 limLog( pMac, LOGE, FL( "RoC is in progress"));
5456 return;
5457 }
5458
Jeff Johnsone7245742012-09-05 17:12:55 -07005459 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5460 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005461 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005462 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5463 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5464 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5465 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005466
5467 // Notify HAL
5468 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005469 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005470 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005471 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005472 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005473 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005474 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5475 pMac->lim.gpchangeChannelCallback = NULL;
5476 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005477
5478#if defined WLAN_FEATURE_VOWIFI
5479 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5480 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5481#else
5482 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5483 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5484#endif
5485
5486 //In case of IBSS, if STA should update HT Info IE in its beacons.
5487 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5488 {
5489 schSetFixedBeaconFields(pMac,psessionEntry);
5490 }
5491
5492 }
5493} // End limUpdateStaRunTimeHTParams.
5494
5495/**
5496 * \brief This function updates the lim global structure, if any of the
5497 * HT Capabilities have changed.
5498 *
5499 *
5500 * \param pMac Pointer to Global MAC structure
5501 *
5502 * \param pHTCapability Pointer to HT Capability Information Element
5503 * obtained from a Beacon or Probe Response
5504 *
5505 *
5506 *
5507 */
5508
5509void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5510 tDot11fIEHTCaps *pHTCaps )
5511{
5512
5513 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5514 {
5515 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5516 // Send change notification to HAL
5517 }
5518
5519 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5520 {
5521 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5522 // Send change notification to HAL
5523 }
5524
5525 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5526 {
5527 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5528 // Send change notification to HAL
5529 }
5530
5531
5532} // End limUpdateStaRunTimeHTCapability.
5533
5534/**
5535 * \brief This function updates lim global structure, if any of the HT
5536 * Info Parameters have changed.
5537 *
5538 *
5539 * \param pMac Pointer to the global MAC structure
5540 *
5541 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5542 * Probe Response
5543 *
5544 *
5545 */
5546
5547void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305548 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005549{
Jeff Johnsone7245742012-09-05 17:12:55 -07005550 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005552 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 // Send change notification to HAL
5554 }
5555
5556 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5557 {
5558 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5559 // Send change notification to HAL
5560 }
5561
5562 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5563 {
5564 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5565 // Send change notification to HAL
5566 }
5567
5568 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5569 {
5570 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5571 // Send change notification to HAL
5572 }
5573
5574 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5575 {
5576 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5577 }
5578
5579 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5580 {
5581 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5582 // Send change notification to HAL
5583 }
5584
5585 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5586 {
5587 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5588 // Send change notification to HAL
5589 }
5590
5591 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5592 {
5593 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5594 // Send change notification to HAL
5595 }
5596
5597 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5598 {
5599 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5600 // Send change notification to HAL
5601 }
5602
5603 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5604 {
5605 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5606 // Send change notification to HAL
5607 }
5608
5609 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5610 {
5611 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5612 // Send change notification to HAL
5613 }
5614
5615} // End limUpdateStaRunTimeHTInfo.
5616
5617
5618/** -------------------------------------------------------------
5619\fn limProcessHalIndMessages
5620\brief callback function for HAL indication
5621\param tpAniSirGlobal pMac
5622\param tANI_U32 mesgId
5623\param void *mesgParam
5624\return tSirRetStatu - status
5625 -------------------------------------------------------------*/
5626
5627tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5628{
5629 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5630 tSirMsgQ msg;
5631
5632 switch(msgId)
5633 {
5634 case SIR_LIM_DEL_TS_IND:
5635 case SIR_LIM_ADD_BA_IND:
5636 case SIR_LIM_DEL_BA_ALL_IND:
5637 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5638 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305639 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 msg.type = (tANI_U16) msgId;
5641 msg.bodyptr = msgParam;
5642 msg.bodyval = 0;
5643 break;
5644
5645 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305646 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005647 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005648 return eSIR_FAILURE;
5649 }
5650
5651 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5652 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305653 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005654 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5655 return eSIR_FAILURE;
5656 }
5657 return eSIR_SUCCESS;
5658}
5659
5660/** -------------------------------------------------------------
5661\fn limValidateDeltsReq
5662\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5663\param tpAniSirGlobal pMac
5664\param tpSirDeltsReq pDeltsReq
5665\param tSirMacAddr peerMacAddr
5666\return eSirRetStatus - status
5667 -------------------------------------------------------------*/
5668
5669tSirRetStatus
5670limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5671{
5672 tpDphHashNode pSta;
5673 tANI_U8 tsStatus;
5674 tSirMacTSInfo *tsinfo;
5675 tANI_U32 i;
5676 tANI_U8 tspecIdx;
5677 /* if sta
5678 * - verify assoc state
5679 * - del tspec locally
5680 * if ap,
5681 * - verify sta is in assoc state
5682 * - del sta tspec locally
5683 */
5684 if(pDeltsReq == NULL)
5685 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005686 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005687 return eSIR_FAILURE;
5688 }
5689
5690 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5691 {
5692 tANI_U32 val;
5693
5694 // station always talks to the AP
5695 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5696
5697 val = sizeof(tSirMacAddr);
5698 #if 0
5699 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5700 {
5701 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005702 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 return eSIR_FAILURE;
5704 }
5705 #endif// TO SUPPORT BT-AMP
5706 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5707
5708 }
5709 else
5710 {
5711 tANI_U16 assocId;
5712 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5713
5714 assocId = pDeltsReq->aid;
5715 if (assocId != 0)
5716 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5717 else
5718 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5719
5720 if (pSta != NULL)
5721 // TBD: check sta assoc state as well
5722 for (i =0; i < sizeof(tSirMacAddr); i++)
5723 macaddr[i] = pSta->staAddr[i];
5724 }
5725
5726 if (pSta == NULL)
5727 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005728 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005729 return eSIR_FAILURE;
5730 }
5731
5732 if ((! pSta->valid) ||
5733 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5734 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005735 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005736 return eSIR_FAILURE;
5737 }
5738
5739 pDeltsReq->req.wsmTspecPresent = 0;
5740 pDeltsReq->req.wmeTspecPresent = 0;
5741 pDeltsReq->req.lleTspecPresent = 0;
5742
5743 if ((pSta->wsmEnabled) &&
5744 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5745 pDeltsReq->req.wsmTspecPresent = 1;
5746 else if (pSta->wmeEnabled)
5747 pDeltsReq->req.wmeTspecPresent = 1;
5748 else if (pSta->lleEnabled)
5749 pDeltsReq->req.lleTspecPresent = 1;
5750 else
5751 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005752 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005753 return eSIR_FAILURE;
5754 }
5755
5756 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5757 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305758 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005759 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005760 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305761 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005762
5763 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005764
5765 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5766 != eSIR_SUCCESS)
5767 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005768 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5770 return eSIR_FAILURE;
5771 }
5772 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5773 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5774 {
5775 //edca only now.
5776 }
5777 else
5778 {
5779 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5780 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5781 {
5782 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305783 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5784 pSta->staIndex,
5785 tspecIdx,
5786 pDeltsReq->req,
5787 psessionEntry->peSessionId,
5788 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005790 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005791 tsinfo->traffic.userPrio);
5792 return eSIR_FAILURE;
5793 }
5794 }
5795 }
5796 return eSIR_SUCCESS;
5797}
5798
5799/** -------------------------------------------------------------
5800\fn limRegisterHalIndCallBack
5801\brief registers callback function to HAL for any indication.
5802\param tpAniSirGlobal pMac
5803\return none.
5804 -------------------------------------------------------------*/
5805void
5806limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5807{
5808 tSirMsgQ msg;
5809 tpHalIndCB pHalCB;
5810
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305811 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5812 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005813 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305814 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005815 return;
5816 }
5817
5818 pHalCB->pHalIndCB = limProcessHalIndMessages;
5819
5820 msg.type = WDA_REGISTER_PE_CALLBACK;
5821 msg.bodyptr = pHalCB;
5822 msg.bodyval = 0;
5823
Jeff Johnsone7245742012-09-05 17:12:55 -07005824 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5826 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305827 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005828 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005829 }
5830
5831 return;
5832}
5833
5834
5835/** -------------------------------------------------------------
5836\fn limProcessAddBaInd
5837
5838\brief handles the BA activity check timeout indication coming from HAL.
5839 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5840\param tpAniSirGlobal pMac
5841\param tSirMsgQ limMsg
5842\return None
5843-------------------------------------------------------------*/
5844void
5845limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5846{
5847 tANI_U8 i;
5848 tANI_U8 tid;
5849 tANI_U16 assocId;
5850 tpDphHashNode pSta;
5851 tpAddBaCandidate pBaCandidate;
5852 tANI_U32 baCandidateCnt;
5853 tpBaActivityInd pBaActivityInd;
5854 tpPESession psessionEntry;
5855 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005856#ifdef FEATURE_WLAN_TDLS
5857 boolean htCapable = FALSE;
5858#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005859
5860
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005861 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005862 return;
5863
5864 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5865 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5866
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005867 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005868 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005869 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305870 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005871 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005872 return;
5873 }
5874
5875 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005876#ifdef FEATURE_WLAN_TDLS
5877 if ((baCandidateCnt > pMac->lim.maxStation))
5878#else
5879 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5880#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005881 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305882 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005883 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005884 return;
5885 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005886
5887#ifdef FEATURE_WLAN_TDLS
5888 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5889 //AP capability
5890 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5891
5892 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5893 {
5894 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5895 if ((NULL == pSta) || (!pSta->valid))
5896 continue;
5897
5898 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5899 htCapable = pSta->mlmStaContext.htCapability;
5900 else
5901 htCapable = psessionEntry->htCapability;
5902
5903 if (htCapable)
5904 break;
5905 }
5906 if (!htCapable)
5907 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305908 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005909 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005910 return;
5911 }
5912#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005913
5914 //delete the complete dialoguetoken linked list
5915 limDeleteDialogueTokenList(pMac);
5916 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5917
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005918 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005919 {
5920 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005921 if ((NULL == pSta) || (!pSta->valid))
5922 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005923
5924 for (tid=0; tid<STACFG_MAX_TC; tid++)
5925 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005926 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005927 (pBaCandidate->baInfo[tid].fBaEnable))
5928 {
Abhishek Singh58749d62016-02-03 15:27:20 +05305929 limLog(pMac, LOG1,
5930 FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5931 pSta->staIndex, tid,
5932 pBaCandidate->baInfo[tid].startingSeqNum);
5933 limPostMlmAddBAReq(pMac, pSta, tid,
5934 pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07005935 }
5936 }
5937 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305938 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005939 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005940 return;
5941}
5942
5943
5944/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005945\fn limDeleteBASessions
5946\brief Deletes all the exisitng BA sessions for given session
5947 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005948\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005949\param tpPESession pSessionEntry
5950\param tANI_U32 baDirection
5951\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005952-------------------------------------------------------------*/
5953
5954void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005955limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305956 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005957{
5958 tANI_U32 i;
5959 tANI_U8 tid;
5960 tpDphHashNode pSta;
5961
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005962 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005964 limLog(pMac, LOGE, FL("Session does not exist"));
5965 }
5966 else
5967 {
5968 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005969 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005970 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5971 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5972 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5973 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005975 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005977 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5978 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005979 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005980 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5981 (baDirection & BA_INITIATOR))
5982 {
5983 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305984 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005985 pSessionEntry);
5986 }
5987 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5988 (baDirection & BA_RECIPIENT))
5989 {
5990 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305991 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005992 pSessionEntry);
5993 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005994 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 }
5996 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005997 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5998 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5999 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006000 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006001 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
6002 &pSessionEntry->dph.dphHashTable);
6003 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006004 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006005 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
6006 (baDirection & BA_INITIATOR))
6007 {
6008 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306009 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006010 pSessionEntry);
6011 }
6012 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
6013 (baDirection & BA_RECIPIENT))
6014 {
6015 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306016 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006017 pSessionEntry);
6018 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07006019 }
6020 }
6021 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 }
6023}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006024
6025/** -------------------------------------------------------------
6026\fn limDelAllBASessions
6027\brief Deletes all the exisitng BA sessions.
6028\param tpAniSirGlobal pMac
6029\return None
6030-------------------------------------------------------------*/
6031
6032void limDelAllBASessions(tpAniSirGlobal pMac)
6033{
6034 tANI_U32 i;
6035 tpPESession pSessionEntry;
6036
6037 for (i = 0; i < pMac->lim.maxBssId; i++)
6038 {
6039 pSessionEntry = peFindSessionBySessionId(pMac, i);
6040 if (pSessionEntry)
6041 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05306042 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
6043 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07006044 }
6045 }
6046}
6047
6048/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006049\fn limProcessDelTsInd
6050\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
6051 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
6052\param tpAniSirGlobal pMac
6053\param tSirMsgQ limMsg
6054\return None
6055-------------------------------------------------------------*/
6056void
6057limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
6058{
6059 tpDphHashNode pSta;
6060 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
6061 tpSirDeltsReq pDelTsReq = NULL;
6062 tSirMacAddr peerMacAddr;
6063 tpSirDeltsReqInfo pDelTsReqInfo;
6064 tpLimTspecInfo pTspecInfo;
6065 tpPESession psessionEntry;
6066 tANI_U8 sessionId;
6067
6068if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
6069 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006070 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306071 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006072 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006073 return;
6074 }
6075
6076 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
6077 if(pTspecInfo->inuse == false)
6078 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006079 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07006080 goto error1;
6081 }
6082
6083 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
6084 if(pSta == NULL)
6085 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006086 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006087 pTspecInfo->assocId);
6088 goto error1;
6089 }
6090
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306091 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
6092 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006093 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306094 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006095 goto error1;
6096 }
6097
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306098 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006099
6100 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306101 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006102 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306103 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006104
6105
6106 //validate the req
6107 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
6108 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006109 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006110 goto error2;
6111 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306112 limLog(pMac, LOG1, "Sent DELTS request to station with "
6113 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
6114 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07006115
6116 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
6117 psessionEntry);
6118
6119 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
6121 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07006122 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306123 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006124 goto error3;
6125 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306126 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006127
6128 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306129 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07006130 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306131 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07006132
6133 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
6134
6135error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306136 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07006137error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306138 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006139error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306140 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08006141 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006142 return;
6143}
6144
6145/**
6146 * \brief Setup an A-MPDU/BA session
6147 *
6148 * \sa limPostMlmAddBAReq
6149 *
6150 * \param pMac The global tpAniSirGlobal object
6151 *
6152 * \param pStaDs DPH Hash Node object of peer STA
6153 *
6154 * \param tid TID for which a BA is being setup.
6155 * If this is set to 0xFFFF, then we retrieve
6156 * the default TID from the CFG
6157 *
6158 * \return eSIR_SUCCESS if setup completes successfully
6159 * eSIR_FAILURE is some problem is encountered
6160 */
6161tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
6162 tpDphHashNode pStaDs,
6163 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
6164{
6165 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006166 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006167 tpDialogueToken dialogueTokenNode;
6168 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006169
Jeff Johnson295189b2012-06-20 16:38:30 -07006170 // Check if the peer is a 11n capable STA
6171 // FIXME - Need a 11n peer indication in DPH.
6172 // For now, using the taurusPeer attribute
6173 //if( 0 == pStaDs->taurusPeer == )
6174 //return eSIR_SUCCESS;
6175
6176 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306177 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
6178 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006179 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306180 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006181 status = eSIR_MEM_ALLOC_FAILED;
6182 goto returnFailure;
6183 }
6184
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306185 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006186
6187 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306188 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 pMlmAddBAReq->peerMacAddr,
6190 pStaDs->staAddr,
6191 sizeof( tSirMacAddr ));
6192
6193 // Update the TID
6194 pMlmAddBAReq->baTID = tid;
6195
6196 // Determine the supported BA policy of local STA
6197 // for the TID of interest
6198 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
6199
6200 // BA Buffer Size
6201 // Requesting the ADDBA recipient to populate the size.
6202 // If ADDBA is accepted, a non-zero buffer size should
6203 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306204 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
6205 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
6206 {
6207 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
6208 causing very low throughput in HT40 case */
6209 limLog( pMac, LOGW,
6210 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
6211 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
6212 }
Abhishek Singh01c73d12015-03-12 15:13:44 +05306213 else if (pMac->miracastVendorConfig)
6214 {
6215 if (wlan_cfgGetInt(pMac, WNI_CFG_NUM_BUFF_ADVERT , &val) != eSIR_SUCCESS)
6216 {
6217 limLog(pMac, LOGE, FL("Unable to get WNI_CFG_NUM_BUFF_ADVERT"));
6218 status = eSIR_FAILURE;
6219 goto returnFailure;
6220 }
6221
6222 pMlmAddBAReq->baBufferSize = val;
6223 }
Agarwal Ashish87039eb2014-01-15 14:13:15 +05306224 else
6225 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006226
6227 limLog( pMac, LOGW,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306228 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 -07006229 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
6230 pStaDs->staIndex,
Abhishek Singh01c73d12015-03-12 15:13:44 +05306231 tid, pMlmAddBAReq->baBufferSize );
Jeff Johnson295189b2012-06-20 16:38:30 -07006232
6233 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006234 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006235 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006236 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006237 status = eSIR_FAILURE;
6238 goto returnFailure;
6239 }
6240 pMlmAddBAReq->baTimeout = val; // In TU's
6241
6242 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006243 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006244 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6245 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6246
6247 // BA Starting Sequence Number
6248 pMlmAddBAReq->baSSN = startingSeqNum;
6249
6250 /* Update PE session Id*/
6251 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6252
6253 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6254
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006255 dialogueTokenNode = limAssignDialogueToken(pMac);
6256 if (NULL == dialogueTokenNode)
6257 {
6258 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6259 status = eSIR_FAILURE;
6260 goto returnFailure;
6261 }
6262
Jeff Johnson295189b2012-06-20 16:38:30 -07006263 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006264 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006265 dialogueTokenNode->assocId = pStaDs->assocId;
6266 dialogueTokenNode->tid = tid;
6267 // Send ADDBA Req to MLME
6268 limPostMlmMessage( pMac,
6269 LIM_MLM_ADDBA_REQ,
6270 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006271 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006272
6273returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306274 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006275 return status;
6276}
6277
6278/**
6279 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6280 * will then send an ADDBA Rsp to peer MAC entity
6281 * with the appropriate ADDBA status code
6282 *
6283 * \sa limPostMlmAddBARsp
6284 *
6285 * \param pMac The global tpAniSirGlobal object
6286 *
6287 * \param peerMacAddr MAC address of peer entity that will
6288 * be the recipient of this ADDBA Rsp
6289 *
6290 * \param baStatusCode ADDBA Rsp status code
6291 *
6292 * \param baDialogToken ADDBA Rsp dialog token
6293 *
6294 * \param baTID TID of interest
6295 *
6296 * \param baPolicy The BA policy
6297 *
6298 * \param baBufferSize The BA buffer size
6299 *
6300 * \param baTimeout BA timeout in TU's
6301 *
6302 * \return eSIR_SUCCESS if setup completes successfully
6303 * eSIR_FAILURE is some problem is encountered
6304 */
6305tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6306 tSirMacAddr peerMacAddr,
6307 tSirMacStatusCodes baStatusCode,
6308 tANI_U8 baDialogToken,
6309 tANI_U8 baTID,
6310 tANI_U8 baPolicy,
6311 tANI_U16 baBufferSize,
6312 tANI_U16 baTimeout,
6313 tpPESession psessionEntry)
6314{
6315tSirRetStatus status = eSIR_SUCCESS;
6316tpLimMlmAddBARsp pMlmAddBARsp;
6317
6318 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306319 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6320 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006321 {
6322 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306323 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006324 status );
6325
6326 status = eSIR_MEM_ALLOC_FAILED;
6327 goto returnFailure;
6328 }
6329
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306330 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006331
6332 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306333 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006334 pMlmAddBARsp->peerMacAddr,
6335 peerMacAddr,
6336 sizeof( tSirMacAddr ));
6337
6338 pMlmAddBARsp->baDialogToken = baDialogToken;
6339 pMlmAddBARsp->addBAResultCode = baStatusCode;
6340 pMlmAddBARsp->baTID = baTID;
6341 pMlmAddBARsp->baPolicy = baPolicy;
6342 pMlmAddBARsp->baBufferSize = baBufferSize;
6343 pMlmAddBARsp->baTimeout = baTimeout;
6344
6345 /* UPdate PE session ID*/
6346 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6347
6348 // Send ADDBA Rsp to MLME
6349 limPostMlmMessage( pMac,
6350 LIM_MLM_ADDBA_RSP,
6351 (tANI_U32 *) pMlmAddBARsp );
6352
6353returnFailure:
6354
6355 return status;
6356}
6357
6358/**
6359 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6360 * will then send an DELBA Ind to peer MAC entity
6361 * with the appropriate DELBA status code
6362 *
6363 * \sa limPostMlmDelBAReq
6364 *
6365 * \param pMac The global tpAniSirGlobal object
6366 *
6367 * \param pSta DPH Hash Node object of peer MAC entity
6368 * for which the BA session is being deleted
6369 *
6370 * \param baDirection DELBA direction
6371 *
6372 * \param baTID TID for which the BA session is being deleted
6373 *
6374 * \param baReasonCode DELBA Req reason code
6375 *
6376 * \return eSIR_SUCCESS if setup completes successfully
6377 * eSIR_FAILURE is some problem is encountered
6378 */
6379tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6380 tpDphHashNode pSta,
6381 tANI_U8 baDirection,
6382 tANI_U8 baTID,
6383 tSirMacReasonCodes baReasonCode,
6384 tpPESession psessionEntry)
6385{
6386tSirRetStatus status = eSIR_SUCCESS;
6387tpLimMlmDelBAReq pMlmDelBAReq;
6388tLimBAState curBaState;
6389
6390if(NULL == pSta)
6391 return eSIR_FAILURE;
6392
6393LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6394
6395 // Need to validate the current BA State.
6396 if( eLIM_BA_STATE_IDLE != curBaState)
6397 {
6398 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006399 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006400 baTID,
6401 curBaState);
6402
6403 status = eSIR_FAILURE;
6404 goto returnFailure;
6405 }
6406
6407 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306408 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6409 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006410 {
6411 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306412 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006413 status );
6414
6415 status = eSIR_MEM_ALLOC_FAILED;
6416 goto returnFailure;
6417 }
6418
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306419 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006420
6421 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306422 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006423 pMlmDelBAReq->peerMacAddr,
6424 pSta->staAddr,
6425 sizeof( tSirMacAddr ));
6426
6427 pMlmDelBAReq->baDirection = baDirection;
6428 pMlmDelBAReq->baTID = baTID;
6429 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6430
6431 /* Update PE session ID*/
6432 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6433
6434 //we don't have valid BA session for the given direction.
6435 // HDD wants to get the BA session deleted on PEER in this case.
6436 // in this case we just need to send DelBA to the peer.
6437 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6438 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6439 {
6440 // Send DELBA Ind over the air
6441 if( eSIR_SUCCESS !=
6442 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6443 status = eSIR_FAILURE;
6444
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306445 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006446 return status;
6447 }
6448
6449
6450 // Update the BA state in STA
6451 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6452
6453 // Send DELBA Req to MLME
6454 limPostMlmMessage( pMac,
6455 LIM_MLM_DELBA_REQ,
6456 (tANI_U32 *) pMlmDelBAReq );
6457
6458returnFailure:
6459
6460 return status;
6461}
6462
6463/**
6464 * \brief Send WDA_ADDBA_REQ to HAL, in order
6465 * to setup a new BA session with a peer
6466 *
6467 * \sa limPostMsgAddBAReq
6468 *
6469 * \param pMac The global tpAniSirGlobal object
6470 *
6471 * \param pSta Runtime, STA-related configuration cached
6472 * in the HashNode object
6473 *
6474 * \param baDialogToken The Action Frame dialog token
6475 *
6476 * \param baTID TID for which the BA session is being setup
6477 *
6478 * \param baPolicy BA Policy
6479 *
6480 * \param baBufferSize The requested BA buffer size
6481 *
6482 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6483 *
6484 * \param baSSN Starting Sequence Number for this BA session
6485 *
6486 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6487 *
6488 * \return none
6489 *
6490 */
6491tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6492 tpDphHashNode pSta,
6493 tANI_U8 baDialogToken,
6494 tANI_U8 baTID,
6495 tANI_U8 baPolicy,
6496 tANI_U16 baBufferSize,
6497 tANI_U16 baTimeout,
6498 tANI_U16 baSSN,
6499 tANI_U8 baDirection,
6500 tpPESession psessionEntry)
6501{
6502tpAddBAParams pAddBAParams = NULL;
6503tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006504tSirMsgQ msgQ;
6505
6506#ifdef WLAN_SOFTAP_VSTA_FEATURE
6507 // we can only do BA on "hard" STAs
6508 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6509 {
6510 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306511 limLog( pMac, LOGE,
6512 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006513 goto returnFailure;
6514 }
6515#endif //WLAN_SOFTAP_VSTA_FEATURE
6516
6517 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306518 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6519 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 {
6521 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306522 FL("AllocateMemory failed")
6523 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006524
6525 retCode = eSIR_MEM_ALLOC_FAILED;
6526 goto returnFailure;
6527 }
6528
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306529 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006530
6531 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306532 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006533 (void *) pAddBAParams->peerMacAddr,
6534 (void *) pSta->staAddr,
6535 sizeof( tSirMacAddr ));
6536
6537 // Populate the REQ parameters
6538 pAddBAParams->staIdx = pSta->staIndex;
6539 pAddBAParams->baDialogToken = baDialogToken;
6540 pAddBAParams->baTID = baTID;
6541 pAddBAParams->baPolicy = baPolicy;
6542 pAddBAParams->baBufferSize = baBufferSize;
6543 pAddBAParams->baTimeout = baTimeout;
6544 pAddBAParams->baSSN = baSSN;
6545 pAddBAParams->baDirection = baDirection;
6546 pAddBAParams->respReqd = 1;
6547
6548 /* UPdate PE session ID */
6549 pAddBAParams->sessionId = psessionEntry->peSessionId;
6550
6551 // Post WDA_ADDBA_REQ to HAL.
6552 msgQ.type = WDA_ADDBA_REQ;
6553 //
6554 // FIXME_AMPDU
6555 // A global counter (dialog token) is required to keep track of
6556 // all PE <-> HAL communication(s)
6557 //
6558 msgQ.reserved = 0;
6559 msgQ.bodyptr = pAddBAParams;
6560 msgQ.bodyval = 0;
6561
6562 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306563 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6564 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6565 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6566 pAddBAParams->baTimeout, pAddBAParams->baTID,
6567 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6568 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006569
6570 //defer any other message until we get response back.
6571 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6572
Jeff Johnsone7245742012-09-05 17:12:55 -07006573 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006574#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6575 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6576#endif //FEATURE_WLAN_DIAG_SUPPORT
6577
6578 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6579 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006580 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006581 retCode );
6582 else
6583 return retCode;
6584
6585returnFailure:
6586
6587 // Clean-up...
6588 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306589 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006590
6591 return retCode;
6592
6593}
6594
6595/**
6596 * \brief Send WDA_DELBA_IND to HAL, in order
6597 * to delete an existing BA session with peer
6598 *
6599 * \sa limPostMsgDelBAInd
6600 *
6601 * \param pMac The global tpAniSirGlobal object
6602 *
6603 * \param pSta Runtime, STA-related configuration cached
6604 * in the HashNode object
6605 *
6606 * \param baTID TID for which the BA session is being setup
6607 *
6608 * \param baDirection Identifies whether the DELBA Ind was
6609 * sent by the BA initiator or recipient
6610 *
6611 * \return none
6612 *
6613 */
6614tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6615 tpDphHashNode pSta,
6616 tANI_U8 baTID,
6617 tANI_U8 baDirection,
6618 tpPESession psessionEntry)
6619{
6620tpDelBAParams pDelBAParams = NULL;
6621tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006622tSirMsgQ msgQ;
6623
6624 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306625 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6626 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006627 {
6628 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306629 FL("AllocateMemory failed")
6630 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006631
6632 retCode = eSIR_MEM_ALLOC_FAILED;
6633 goto returnFailure;
6634 }
6635
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306636 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006637
6638 // Populate the REQ parameters
6639 pDelBAParams->staIdx = pSta->staIndex;
6640 pDelBAParams->baTID = baTID;
6641 pDelBAParams->baDirection = baDirection;
6642
6643 /* Update PE session ID */
6644
6645
6646 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6647 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6648
6649 // Post WDA_DELBA_IND to HAL.
6650 msgQ.type = WDA_DELBA_IND;
6651 //
6652 // FIXME:
6653 // A global counter (dialog token) is required to keep track of
6654 // all PE <-> HAL communication(s)
6655 //
6656 msgQ.reserved = 0;
6657 msgQ.bodyptr = pDelBAParams;
6658 msgQ.bodyval = 0;
6659
6660 limLog( pMac, LOGW,
6661 FL( "Sending SIR_HAL_DELBA_IND..." ));
6662
Jeff Johnsone7245742012-09-05 17:12:55 -07006663 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006664#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6665 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6666#endif //FEATURE_WLAN_DIAG_SUPPORT
6667
6668 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6669 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006670 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006671 retCode );
6672 else
6673 {
6674 // Update LIM's internal cache...
6675 if( eBA_INITIATOR == baDirection)
6676 {
6677 pSta->tcCfg[baTID].fUseBATx = 0;
6678 pSta->tcCfg[baTID].txBufSize = 0;
6679 }
6680 else
6681 {
6682 pSta->tcCfg[baTID].fUseBARx = 0;
6683 pSta->tcCfg[baTID].rxBufSize = 0;
6684 }
6685
6686 return retCode;
6687 }
6688
6689returnFailure:
6690
6691 // Clean-up...
6692 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306693 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006694
6695 return retCode;
6696
6697}
6698
6699/**
6700 * @function : limPostSMStateUpdate()
6701 *
6702 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6703 *
6704 * LOGIC:
6705 *
6706 * ASSUMPTIONS:
6707 * NA
6708 *
6709 * NOTE:
6710 * NA
6711 *
6712 * @param pMac - Pointer to Global MAC structure
6713 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6714 * @return None
6715 */
6716tSirRetStatus
6717limPostSMStateUpdate(tpAniSirGlobal pMac,
6718 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6719{
6720 tSirRetStatus retCode = eSIR_SUCCESS;
6721 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006722 tpSetMIMOPS pMIMO_PSParams;
6723
6724 msgQ.reserved = 0;
6725 msgQ.type = WDA_SET_MIMOPS_REQ;
6726
6727 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306728 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6729 if ( NULL == pMIMO_PSParams )
6730 {
6731 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006732 return eSIR_MEM_ALLOC_FAILED;
6733 }
6734
6735 pMIMO_PSParams->htMIMOPSState = state;
6736 pMIMO_PSParams->staIdx = staIdx;
6737 pMIMO_PSParams->fsendRsp = true;
6738 msgQ.bodyptr = pMIMO_PSParams;
6739 msgQ.bodyval = 0;
6740
6741 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6742
Jeff Johnsone7245742012-09-05 17:12:55 -07006743 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6745 if (eSIR_SUCCESS != retCode)
6746 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006747 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306748 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006749 return retCode;
6750 }
6751
6752 return retCode;
6753}
6754
6755void limPktFree (
6756 tpAniSirGlobal pMac,
6757 eFrameType frmType,
6758 tANI_U8 *pRxPacketInfo,
6759 void *pBody)
6760{
6761 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006762}
6763
6764/**
6765 * limGetBDfromRxPacket()
6766 *
6767 *FUNCTION:
6768 * This function is called to get pointer to Polaris
6769 * Buffer Descriptor containing MAC header & other control
6770 * info from the body of the message posted to LIM.
6771 *
6772 *LOGIC:
6773 * NA
6774 *
6775 *ASSUMPTIONS:
6776 * NA
6777 *
6778 *NOTE:
6779 * NA
6780 *
6781 * @param body - Received message body
6782 * @param pRxPacketInfo - Pointer to received BD
6783 * @return None
6784 */
6785
6786void
6787limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6788{
Jeff Johnson295189b2012-06-20 16:38:30 -07006789 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006790} /*** end limGetBDfromRxPacket() ***/
6791
6792
6793
6794
6795
6796void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6797{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306798 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006799}
6800
6801
6802void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6803{
6804 tANI_U8 i;
6805 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6806
6807 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6808 {
6809 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6810 {
6811 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6812 fFound = eANI_BOOLEAN_TRUE;
6813 break;
6814 }
6815 }
6816 if(eANI_BOOLEAN_FALSE == fFound)
6817 {
6818 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6819 {
6820 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6821 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6822 }
6823 else
6824 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006825 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006826 }
6827 }
6828}
6829
6830
6831/**
6832 * @function : limIsChannelValidForChannelSwitch()
6833 *
6834 * @brief : This function checks if the channel to which AP
6835 * is expecting us to switch, is a valid channel for us.
6836 * LOGIC:
6837 *
6838 * ASSUMPTIONS:
6839 * NA
6840 *
6841 * NOTE:
6842 * NA
6843 *
6844 * @param pMac - Pointer to Global MAC structure
6845 * @param channel - New channel to which we are expected to move
6846 * @return None
6847 */
6848tAniBool
6849limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6850{
6851 tANI_U8 index;
6852 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6853 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6854
6855 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6856 (tANI_U8 *)validChannelList,
6857 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6858 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006859 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006860 return (eSIR_FALSE);
6861 }
6862
6863 for(index = 0; index < validChannelListLen; index++)
6864 {
6865 if(validChannelList[index] == channel)
6866 return (eSIR_TRUE);
6867 }
6868
6869 /* channel does not belong to list of valid channels */
6870 return (eSIR_FALSE);
6871}
6872
6873/**------------------------------------------------------
6874\fn __limFillTxControlParams
6875\brief Fill the message for stopping/resuming tx.
6876
6877\param pMac
6878\param pTxCtrlMsg - Pointer to tx control message.
6879\param type - Which way we want to stop/ resume tx.
6880\param mode - To stop/resume.
6881 -------------------------------------------------------*/
6882static eHalStatus
6883__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6884 tLimQuietTxMode type, tLimControlTx mode)
6885{
6886
6887 //TBD-RAJESH HOW TO GET sessionEntry?????
6888 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6889
6890 if (mode == eLIM_STOP_TX)
6891 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6892 else
6893 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6894
6895 switch (type)
6896 {
6897 case eLIM_TX_ALL:
6898 /** Stops/resumes transmission completely */
6899 pTxCtrlMsg->fCtrlGlobal = 1;
6900 break;
6901
6902 case eLIM_TX_BSS_BUT_BEACON:
6903 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6904 * stop beacon transmission.
6905 */
6906 pTxCtrlMsg->ctrlBss = 1;
6907 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6908 break;
6909
6910 case eLIM_TX_STA:
6911 /** Memory for station bitmap is allocated dynamically in caller of this
6912 * so decode properly here and fill the bitmap. Now not implemented,
6913 * fall through.
6914 */
6915 case eLIM_TX_BSS:
6916 //Fall thru...
6917 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006918 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006919 return eHAL_STATUS_FAILURE;
6920 }
6921
6922 return eHAL_STATUS_SUCCESS;
6923}
6924
6925/**
6926 * @function : limFrameTransmissionControl()
6927 *
6928 * @brief : This API is called by the user to halt/resume any frame
6929 * transmission from the device. If stopped, all frames will be
6930 * queued starting from hardware. Then back-pressure
6931 * is built till the driver.
6932 * LOGIC:
6933 *
6934 * ASSUMPTIONS:
6935 * NA
6936 *
6937 * NOTE:
6938 * NA
6939 *
6940 * @param pMac - Pointer to Global MAC structure
6941 * @return None
6942 */
6943void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6944{
6945
6946 eHalStatus status = eHAL_STATUS_FAILURE;
6947 tpTxControlParams pTxCtrlMsg;
6948 tSirMsgQ msgQ;
6949 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6950
6951 /** Allocate only required number of bytes for station bitmap
6952 * Make it to align to 4 byte boundary */
6953 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6954
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306955 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6956 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006957 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306958 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006959 return;
6960 }
6961
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306962 vos_mem_set((void *) pTxCtrlMsg,
6963 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006964 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6965 if (status != eHAL_STATUS_SUCCESS)
6966 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306967 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006968 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006969 return;
6970 }
6971
6972 msgQ.bodyptr = (void *) pTxCtrlMsg;
6973 msgQ.bodyval = 0;
6974 msgQ.reserved = 0;
6975 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6976
Jeff Johnsone7245742012-09-05 17:12:55 -07006977 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006978 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6979 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306980 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006981 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006982 return;
6983 }
6984
6985 if (mode == eLIM_STOP_TX)
6986 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306987 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006988 }
6989 else
6990 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306991 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006992 }
6993 return;
6994}
6995
6996
6997/**
6998 * @function : limRestorePreChannelSwitchState()
6999 *
7000 * @brief : This API is called by the user to undo any
7001 * specific changes done on the device during
7002 * channel switch.
7003 * LOGIC:
7004 *
7005 * ASSUMPTIONS:
7006 * NA
7007 *
7008 * NOTE:
7009 * NA
7010 *
7011 * @param pMac - Pointer to Global MAC structure
7012 * @return None
7013 */
7014
7015tSirRetStatus
7016limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
7017{
7018
7019 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007020 tANI_U32 val = 0;
7021
7022 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7023 return retCode;
7024
7025 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007026 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007027
7028 /* Restore the frame transmission, all the time. */
7029 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7030
7031 /* Free to enter BMPS */
7032 limSendSmePostChannelSwitchInd(pMac);
7033
7034 //Background scan is now enabled by SME
7035 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7036 {
7037 /* Enable background scan if already enabled, else don't bother */
7038 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7039 &val)) != eSIR_SUCCESS)
7040
7041 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007042 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007043 return (retCode);
7044 }
7045
7046 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7047 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007048 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7049 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007050 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7051 {
7052 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7053 return (eSIR_FAILURE);
7054 }
7055
7056 }
7057 }
7058
7059 /* Enable heartbeat timer */
7060 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7061 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007062 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
7063 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
7064 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
7065 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007066 {
7067 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7068 return (eSIR_FAILURE);
7069 }
7070 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007071 return (retCode);
7072}
7073
7074
7075/**--------------------------------------------
7076\fn limRestorePreQuietState
7077\brief Restore the pre quiet state
7078
7079\param pMac
7080\return NONE
7081---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007082tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07007083{
7084
7085 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007086 tANI_U32 val = 0;
7087
7088 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
7089 return retCode;
7090
7091 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07007092 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07007093
7094 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07007095 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07007096 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
7097
7098
7099 //Background scan is now enabled by SME
7100 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
7101 {
7102 /* Enable background scan if already enabled, else don't bother */
7103 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
7104 &val)) != eSIR_SUCCESS)
7105
7106 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007107 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007108 return (retCode);
7109 }
7110
7111 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
7112 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007113 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07007114 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
7115 {
7116 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
7117 return (eSIR_FAILURE);
7118 }
7119
7120 }
7121 }
7122
7123 /* Enable heartbeat timer */
7124 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
7125 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08007126 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07007127 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07007128 {
7129 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
7130 return (eSIR_FAILURE);
7131 }
7132 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007133 return (retCode);
7134}
7135
7136
7137/**
7138 * @function: limPrepareFor11hChannelSwitch()
7139 *
7140 * @brief : This API is called by the user to prepare for
7141 * 11h channel switch. As of now, the API does
7142 * very minimal work. User can add more into the
7143 * same API if needed.
7144 * LOGIC:
7145 *
7146 * ASSUMPTIONS:
7147 * NA
7148 *
7149 * NOTE:
7150 * NA
7151 *
7152 * @param pMac - Pointer to Global MAC structure
7153 * @param psessionEntry
7154 * @return None
7155 */
7156void
7157limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
7158{
Jeff Johnson295189b2012-06-20 16:38:30 -07007159 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
7160 return;
7161
7162 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07007163 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07007164
7165 /* Disable, Stop background scan if enabled and running */
7166 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
7167
7168 /* Stop heart-beat timer to stop heartbeat disassociation */
7169 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
7170
7171 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
7172 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
7173 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007174 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007175 /* Stop ongoing scanning if any */
7176 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
7177 {
7178 //Set the resume channel to Any valid channel (invalid).
7179 //This will instruct HAL to set it to any previous valid channel.
7180 peSetResumeChannel(pMac, 0, 0);
7181 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
7182 }
7183 else
7184 {
7185 limRestorePreChannelSwitchState(pMac, psessionEntry);
7186 }
7187 return;
7188 }
7189 else
7190 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007191 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007192 /** We are safe to switch channel at this point */
7193 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
7194 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007195}
7196
7197
7198
7199/**----------------------------------------------------
7200\fn limGetNwType
7201
7202\brief Get type of the network from data packet or beacon
7203\param pMac
7204\param channelNum - Channel number
7205\param type - Type of packet.
7206\param pBeacon - Pointer to beacon or probe response
7207
7208\return Network type a/b/g.
7209-----------------------------------------------------*/
7210tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
7211{
7212 tSirNwType nwType = eSIR_11B_NW_TYPE;
7213
7214 if (type == SIR_MAC_DATA_FRAME)
7215 {
7216 if ((channelNum > 0) && (channelNum < 15))
7217 {
7218 nwType = eSIR_11G_NW_TYPE;
7219 }
7220 else
7221 {
7222 nwType = eSIR_11A_NW_TYPE;
7223 }
7224 }
7225 else
7226 {
7227 if ((channelNum > 0) && (channelNum < 15))
7228 {
7229 int i;
7230 // 11b or 11g packet
7231 // 11g iff extended Rate IE is present or
7232 // if there is an A rate in suppRate IE
7233 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
7234 {
7235 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
7236 {
7237 nwType = eSIR_11G_NW_TYPE;
7238 break;
7239 }
7240 }
7241 if (pBeacon->extendedRatesPresent)
7242 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007243 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007244 nwType = eSIR_11G_NW_TYPE;
7245 }
7246 }
7247 else
7248 {
7249 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007250 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007251 nwType = eSIR_11A_NW_TYPE;
7252 }
7253 }
7254 return nwType;
7255}
7256
7257
7258/**---------------------------------------------------------
7259\fn limGetChannelFromBeacon
7260\brief To extract channel number from beacon
7261
7262\param pMac
7263\param pBeacon - Pointer to beacon or probe rsp
7264\return channel number
7265-----------------------------------------------------------*/
7266tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7267{
7268 tANI_U8 channelNum = 0;
7269
7270 if (pBeacon->dsParamsPresent)
7271 channelNum = pBeacon->channelNumber;
7272 else if(pBeacon->HTInfo.present)
7273 channelNum = pBeacon->HTInfo.primaryChannel;
7274 else
7275 channelNum = pBeacon->channelNumber;
7276
7277 return channelNum;
7278}
7279
7280
7281/** ---------------------------------------------------------
7282\fn limSetTspecUapsdMask
7283\brief This function sets the PE global variable:
7284\ 1) gUapsdPerAcTriggerEnableMask and
7285\ 2) gUapsdPerAcDeliveryEnableMask
7286\ based on the user priority field and direction field
7287\ in the TS Info Fields.
7288\
7289\ An AC is a trigger-enabled AC if the PSB subfield
7290\ is set to 1 in the uplink direction.
7291\ An AC is a delivery-enabled AC if the PSB subfield
7292\ is set to 1 in the down-link direction.
7293\
7294\param tpAniSirGlobal pMac
7295\param tSirMacTSInfo pTsInfo
7296\param tANI_U32 action
7297\return None
7298 ------------------------------------------------------------*/
7299void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7300{
7301 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7302 tANI_U16 direction = pTsInfo->traffic.direction;
7303 tANI_U8 ac = upToAc(userPrio);
7304
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307305 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 -07007306
7307 /* Converting AC to appropriate Uapsd Bit Mask
7308 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7309 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7310 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7311 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7312 */
7313 ac = ((~ac) & 0x3);
7314
7315 if (action == CLEAR_UAPSD_MASK)
7316 {
7317 if (direction == SIR_MAC_DIRECTION_UPLINK)
7318 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7319 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7320 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7321 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7322 {
7323 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7324 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7325 }
7326 }
7327 else if (action == SET_UAPSD_MASK)
7328 {
7329 if (direction == SIR_MAC_DIRECTION_UPLINK)
7330 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7331 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7332 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7333 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7334 {
7335 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7336 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7337 }
7338 }
7339
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007340 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7341 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007342
7343 return;
7344}
7345
7346
7347
7348void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7349{
7350
7351 tANI_U8 i;
7352 for(i =0;i < pMac->lim.maxBssId;i++)
7353 {
7354 if(pMac->lim.gpSession[i].valid == TRUE )
7355 {
7356 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7357 {
7358 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7359 break;
7360 }
7361
7362 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7363 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7364 {
7365 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7366 }
7367 }
7368 }
7369 for(i=0; i< pMac->lim.maxBssId; i++)
7370 {
7371 if(pMac->lim.gpSession[i].valid == TRUE )
7372 {
7373 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7374 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7375 {
7376 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7377 {
7378 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007379 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007380 i);)
7381 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7382 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7383 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7384 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007385 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007386 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7387 }
7388 break;
7389 }
7390 }
7391 }
7392 }
7393}
7394
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007395void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7396{
7397 if(psessionEntry->valid == TRUE )
7398 {
7399 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7400 {
7401 limIbssHeartBeatHandle(pMac,psessionEntry);
7402 }
7403 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7404 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7405 {
7406 limHandleHeartBeatFailure(pMac,psessionEntry);
7407 }
7408 }
7409 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7410 and the other things again */
7411 if(psessionEntry->valid == TRUE )
7412 {
7413 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7414 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7415 {
7416 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7417 {
7418 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7419 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7420 psessionEntry->bssIdx);)
7421 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7422 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7423 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7424 {
7425 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7426 limReactivateHeartBeatTimer(pMac, psessionEntry);
7427 }
7428 }
7429 }
7430 }
7431}
7432
7433
Jeff Johnson295189b2012-06-20 16:38:30 -07007434tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7435{
7436 tANI_U8 i;
7437 for(i =0;i < pMac->lim.maxBssId;i++)
7438 {
7439 if(pMac->lim.gpSession[i].valid == TRUE )
7440 {
7441 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7442 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7443 {
7444 return pMac->lim.gpSession[i].currentOperChannel;
7445 }
7446 }
7447 }
7448 return 0;
7449}
7450
7451void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7452{
7453
7454 tpPESession psessionEntry;
7455// tANI_U8 sessionId;
7456 tpAddStaParams pAddStaParams;
7457
7458 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7459
7460 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007462 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307463 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007464 return;
7465 }
7466 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7467 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007468#ifdef FEATURE_WLAN_TDLS
7469 else if(pMac->lim.gLimAddStaTdls)
7470 {
7471 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7472 pMac->lim.gLimAddStaTdls = FALSE ;
7473 }
7474#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007475 else
7476 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7477
7478}
7479
7480
7481void limUpdateBeacon(tpAniSirGlobal pMac)
7482{
7483 tANI_U8 i;
7484
7485 for(i =0;i < pMac->lim.maxBssId;i++)
7486 {
7487 if(pMac->lim.gpSession[i].valid == TRUE )
7488 {
7489 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7490 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7491 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7492 )
7493 {
7494 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7495 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7496 }
7497 else
7498 {
7499 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7500 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7501 {
7502
7503 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7504 {
7505 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7506 }
7507 }
7508 }
7509 }
7510 }
7511}
7512
7513void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7514{
7515 tANI_U8 i;
7516 tpPESession psessionEntry;
7517 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7518 for(i =0; i < pMac->lim.maxBssId; i++)
7519 {
7520 if(pMac->lim.gpSession[i].valid == TRUE)
7521 {
7522 psessionEntry = &pMac->lim.gpSession[i];
7523 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7524 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307525 limLog(pMac, LOGE,
7526 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7527 psessionEntry->limSmeState, psessionEntry->limMlmState,
7528 psessionEntry->LimRxedBeaconCntDuringHB,
7529 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007530#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7531 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7532#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007533 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7534 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307535 /* Disconnect even if we have not received a single beacon
7536 * after connection.
7537 */
7538 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7539 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307540 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7541 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007542 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007543 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007544 /* AP did not respond to Probe Request. Tear down link with it.*/
7545 limTearDownLinkWithAp(pMac,
7546 psessionEntry->peSessionId,
7547 eSIR_BEACON_MISSED);
7548 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7549 }
7550 else // restart heartbeat timer
7551 {
7552 limReactivateHeartBeatTimer(pMac, psessionEntry);
7553 }
7554 }
7555 else
7556 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007557 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007558 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7559 limReactivateHeartBeatTimer(pMac, psessionEntry);
7560 }
7561
7562 }
7563 }
7564 }
7565 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7566 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7567}
7568
7569
7570/*
7571* This function assumes there will not be more than one IBSS session active at any time.
7572*/
7573tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7574{
7575 tANI_U8 i;
7576
7577 for(i =0;i < pMac->lim.maxBssId;i++)
7578 {
7579 if( (pMac->lim.gpSession[i].valid) &&
7580 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7581 return (&pMac->lim.gpSession[i]);
7582 }
7583
7584 return NULL;
7585}
7586
7587tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7588{
7589 tANI_U8 i;
7590
7591 for(i =0;i < pMac->lim.maxBssId;i++)
7592 {
7593 if( (pMac->lim.gpSession[i].valid) &&
7594 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7595 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7596 return (&pMac->lim.gpSession[i]);
7597 }
7598
7599 return NULL;
7600}
7601
7602/**---------------------------------------------------------
7603\fn limHandleDeferMsgError
7604\brief handles error scenario, when the msg can not be deferred.
7605\param pMac
7606\param pLimMsg LIM msg, which could not be deferred.
7607\return void
7608-----------------------------------------------------------*/
7609
7610void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7611{
7612 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7613 {
Abhishek Singh035e34f2015-04-08 18:04:54 +05307614 /*Decrement the Pending count before droping */
7615 limDecrementPendingMgmtCount (pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07007616 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7617 }
7618 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007619 {
7620 vos_mem_free( pLimMsg->bodyptr);
7621 pLimMsg->bodyptr = NULL;
7622 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007623}
7624
7625
7626#ifdef FEATURE_WLAN_DIAG_SUPPORT
7627/**---------------------------------------------------------
7628\fn limDiagEventReport
7629\brief This function reports Diag event
7630\param pMac
7631\param eventType
7632\param bssid
7633\param status
7634\param reasonCode
7635\return void
7636-----------------------------------------------------------*/
7637void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7638{
7639 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7640 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7641
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307642 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007643
7644 if (NULL == pSessionEntry)
7645 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307646 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007647 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7648 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7649
7650 }
7651 else
7652 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307653 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007654 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7655 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7656 }
7657 peEvent.event_type = eventType;
7658 peEvent.status = status;
7659 peEvent.reason_code = reasonCode;
7660
7661 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7662 return;
7663}
7664
7665#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7666
7667void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7668{
7669
7670 tpAddStaSelfParams pAddStaSelfParams;
7671 tSirMsgQ mmhMsg;
7672 tpSirSmeAddStaSelfRsp pRsp;
7673
7674
7675 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7676
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307677 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7678 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007679 {
7680 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307681 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7682 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007683 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007684 return;
7685 }
7686
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307687 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007688
7689 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7690 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7691 pRsp->status = pAddStaSelfParams->status;
7692
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307693 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007694
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307695 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007696 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007697
7698 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7699 mmhMsg.bodyptr = pRsp;
7700 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307701 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007702 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7703
7704}
7705
7706void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7707{
7708
7709 tpDelStaSelfParams pDelStaSelfParams;
7710 tSirMsgQ mmhMsg;
7711 tpSirSmeDelStaSelfRsp pRsp;
7712
7713
7714 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7715
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307716 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7717 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007718 {
7719 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307720 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7721 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007722 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007723 return;
7724 }
7725
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307726 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007727
7728 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7729 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7730 pRsp->status = pDelStaSelfParams->status;
7731
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307732 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007733
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307734 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007735 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007736
7737 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7738 mmhMsg.bodyptr = pRsp;
7739 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05307740 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007741 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7742
7743}
7744
7745/***************************************************************
7746* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7747* To unmap the channel to reverse the effect of mapping
7748* a band channel in hal .Mapping was done hal to overcome the
7749* limitation of the rxbd which use only 4 bit for channel number.
7750*****************************************************************/
7751tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7752{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007753#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007754 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007755 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7756 return aUnsortedChannelList[mapChannel -1];
7757 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007758#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007759 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007760#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007761 return abChannel[mapChannel -1];
7762 else
7763 return 0;
7764}
7765
7766
7767v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7768{
7769 int left = length;
7770 v_U8_t *ptr = pIes;
7771 v_U8_t elem_id;
7772 v_U16_t elem_len;
7773
7774 while(left >= (size_of_len_field+1))
7775 {
7776 elem_id = ptr[0];
7777 if (size_of_len_field == TWO_BYTE)
7778 {
7779 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7780 }
7781 else
7782 {
7783 elem_len = ptr[1];
7784 }
7785
7786
7787 left -= (size_of_len_field+1);
7788 if(elem_len > left)
7789 {
7790 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007791 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007792 eid,elem_len,left);
7793 return NULL;
7794 }
7795 if (elem_id == eid)
7796 {
7797 return ptr;
7798 }
7799
7800 left -= elem_len;
7801 ptr += (elem_len + (size_of_len_field+1));
7802 }
7803 return NULL;
7804}
7805
7806/* return NULL if oui is not found in ie
7807 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7808 */
7809v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7810{
7811 int left = ie_len;
7812 v_U8_t *ptr = ie;
7813 v_U8_t elem_id, elem_len;
7814
7815 while(left >= 2)
7816 {
7817 elem_id = ptr[0];
7818 elem_len = ptr[1];
7819 left -= 2;
7820 if(elem_len > left)
7821 {
7822 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007823 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007824 elem_id,elem_len,left);
7825 return NULL;
7826 }
7827 if (SIR_MAC_EID_VENDOR == elem_id)
7828 {
7829 if(memcmp(&ptr[2], oui, oui_size)==0)
7830 return ptr;
7831 }
7832
7833 left -= elem_len;
7834 ptr += (elem_len + 2);
7835 }
7836 return NULL;
7837}
7838
Jeff Johnson295189b2012-06-20 16:38:30 -07007839//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7840
7841v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7842{
7843 int length = 0;
7844 tANI_U8 *ptr = ie;
7845
7846 ptr[length++] = SIR_MAC_EID_VENDOR;
7847 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307848 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7849 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007850 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7851}
7852
7853//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7854
7855v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7856{
7857 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007858
7859 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7860 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7861 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307862 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007863 noaStream + noaLen - overFlowLen, overFlowLen);
7864 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7865 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307866 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007867 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307868 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7869 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007870 }
7871
Jeff Johnson295189b2012-06-20 16:38:30 -07007872 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7873
7874}
7875
7876//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7877v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7878{
7879 v_U8_t len=0;
7880
7881 v_U8_t *pBody = pNoaStream;
7882
7883
7884 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7885 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7886 {
7887 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7888 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7889 )
7890 return 0; //No NoA Descriptor then return 0
7891
7892
7893 pBody[0] = SIR_P2P_NOA_ATTR;
7894
7895 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7896 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7897 len = 5;
7898 pBody += len;
7899
7900
7901 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7902 {
7903 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7904 pBody += 1;
7905 len +=1;
7906
7907 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7908 pBody += sizeof(tANI_U32);
7909 len +=4;
7910
7911 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7912 pBody += sizeof(tANI_U32);
7913 len +=4;
7914
7915 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7916 pBody += sizeof(tANI_U32);
7917 len +=4;
7918
7919 }
7920
7921 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7922 {
7923 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7924 pBody += 1;
7925 len +=1;
7926
7927 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7928 pBody += sizeof(tANI_U32);
7929 len +=4;
7930
7931 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7932 pBody += sizeof(tANI_U32);
7933 len +=4;
7934
7935 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7936 pBody += sizeof(tANI_U32);
7937 len +=4;
7938
7939 }
7940
7941
7942 pBody = pNoaStream + 1;
7943 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7944
7945 return (len);
7946
7947 }
7948 return 0;
7949
7950}
Jeff Johnsone7245742012-09-05 17:12:55 -07007951
7952void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007953{
7954
7955 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007956 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007957}
Jeff Johnsone7245742012-09-05 17:12:55 -07007958
Jeff Johnson295189b2012-06-20 16:38:30 -07007959/*--------------------------------------------------------------------------
7960
7961 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7962
Jeff Johnsone7245742012-09-05 17:12:55 -07007963 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7964 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007965
7966 \param pMac - pointer to global adapter context
7967 \return - channel to scan from valid session else zero.
7968
7969 \sa
7970
7971 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007972void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007973{
7974
7975 //Rationale - this could be the suspend/resume for assoc and it is essential that
7976 //the new BSS is active for some time. Other BSS was anyway suspended.
7977 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7978 //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 -07007979 //and hence should be ok. Need to discuss this further
7980 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007981 {
7982 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007983 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007984 }
7985 else
7986 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007987 *resumeChannel = pMac->lim.gResumeChannel;
7988 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007989 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007990 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007991}
7992
Viral Modid86bde22012-12-10 13:09:21 -08007993tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7994{
7995 tANI_U8 i;
7996 for(i =0; i < pMac->lim.maxBssId; i++)
7997 {
7998 if(pMac->lim.gpSession[i].valid == TRUE)
7999 {
8000 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
8001 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
8002 )
8003 {
8004 return TRUE;
8005 }
8006 }
8007 }
8008 return FALSE;
8009}
Jeff Johnsone7245742012-09-05 17:12:55 -07008010
Jeff Johnson295189b2012-06-20 16:38:30 -07008011
8012tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
8013{
8014 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
8015 {
8016 return eANI_BOOLEAN_TRUE;
8017 }
8018 else
8019 {
8020 return eANI_BOOLEAN_FALSE;
8021 }
8022}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07008023
Sandeep Puligilla60342762014-01-30 21:05:37 +05308024/**
8025 * \brief verify the changes in channel bonding
8026 *
8027 * \param pMac Pointer to the global MAC structure
8028 *
8029 * \param psessionEntry session entry
8030 * beaconSecChanWidth Secondary channel width
8031 * advertized in beacon
8032 * currentSecChanWidth Current configured width
8033 * staId Station Id
8034 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
8035 */
8036tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
8037 tpPESession psessionEntry,
8038 tANI_U8 beaconSecChanWidth,
8039 tANI_U8 currentSecChanWidth,
8040 tANI_U8 staId)
8041{
8042 tUpdateVHTOpMode tempParam;
8043 tANI_BOOLEAN fCbMode24G = FALSE;
8044 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
8045
8046 /* Moving from HT40 to HT20 operation*/
8047 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
8048 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
8049 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
8050 {
8051 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
8052 tempParam.staId = staId;
8053 fCbMode24G = TRUE;
8054 }
8055
8056 /* Moving from HT20 to HT40 operation*/
8057 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
8058 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
8059 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
8060 {
8061 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
8062 tempParam.staId = staId;
8063 fCbMode24G = TRUE;
8064 }
8065
8066 if (TRUE == fCbMode24G)
8067 {
8068 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8069 "Changing CBMODE to = %d staId = %d",
8070 tempParam.opMode, tempParam.staId );
8071 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
8072 status = eANI_BOOLEAN_TRUE;
8073 }
8074 return status;
8075}
8076
Mohit Khanna4a70d262012-09-11 16:30:12 -07008077#ifdef WLAN_FEATURE_11AC
8078tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
8079{
8080 tUpdateVHTOpMode tempParam;
8081
8082 tempParam.opMode = chanWidth;
8083 tempParam.staId = staId;
8084
8085 limSendModeUpdate( pMac, &tempParam, psessionEntry );
8086
8087 return eANI_BOOLEAN_TRUE;
8088}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008089#endif
8090
krunal soni45b9eb62014-03-26 12:54:25 -07008091void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
8092 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008093{
8094 tANI_U8 val=0;
8095
krunal soni45b9eb62014-03-26 12:54:25 -07008096 //only 2.4G band should have short slot enable, rest it should be default
8097 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008098 {
krunal soni45b9eb62014-03-26 12:54:25 -07008099 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008100 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07008101 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008102 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
8103 {
8104 val = true;
8105 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008106 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008107 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008108 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008109 // Joining BSS.
8110 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008111 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008112 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07008113 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008114 // Reassociating with AP.
8115 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07008116 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008117 }
krunal soni45b9eb62014-03-26 12:54:25 -07008118 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008119 {
krunal soni45b9eb62014-03-26 12:54:25 -07008120 /*
8121 * 11B does not short slot and short slot is default
8122 * for 11A mode. Hence, not need to set this bit
8123 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008124 val = false;
8125 }
krunal soni45b9eb62014-03-26 12:54:25 -07008126
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07008127 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07008128 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07008129}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308130
Kalikinkar dhara205da782014-03-21 15:49:32 -07008131void limUtilsframeshtons(tpAniSirGlobal pCtx,
8132 tANI_U8 *pOut,
8133 tANI_U16 pIn,
8134 tANI_U8 fMsb)
8135{
8136 (void)pCtx;
8137#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8138 if ( !fMsb )
8139 {
8140 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8141 }
8142 else
8143 {
8144 *pOut = ( pIn & 0xff00 ) >> 8;
8145 *( pOut + 1 ) = pIn & 0xff;
8146 }
8147#else
8148 if ( !fMsb )
8149 {
8150 *pOut = pIn & 0xff;
8151 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
8152 }
8153 else
8154 {
8155 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
8156 }
8157#endif
8158}
8159
8160void limUtilsframeshtonl(tpAniSirGlobal pCtx,
8161 tANI_U8 *pOut,
8162 tANI_U32 pIn,
8163 tANI_U8 fMsb)
8164{
8165 (void)pCtx;
8166#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
8167 if ( !fMsb )
8168 {
8169 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8170 }
8171 else
8172 {
8173 *pOut = ( pIn & 0xff000000 ) >> 24;
8174 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
8175 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
8176 *( pOut + 3 ) = ( pIn & 0x000000ff );
8177 }
8178#else
8179 if ( !fMsb )
8180 {
8181 *( pOut ) = ( pIn & 0x000000ff );
8182 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
8183 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
8184 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
8185 }
8186 else
8187 {
8188 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
8189 }
8190#endif
8191}
8192
8193
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05308194/**--------------------------------------------
8195\fn limUpdateOBSSScanParams
8196\brief Updates OBSS SCAN IE parameters to session
8197
8198\param psessionEntry - Session Entry
8199\return NONE
8200---------------------------------------------*/
8201void limUpdateOBSSScanParams(tpPESession psessionEntry ,
8202 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
8203{
8204 /*If the recieved value is not in the range specified by the Specification
8205 then it will be the default value configured through cfg */
8206 if (( pOBSSScanParameters->obssScanActiveDwell >
8207 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
8208 ( pOBSSScanParameters->obssScanActiveDwell <
8209 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
8210 {
8211 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
8212 pOBSSScanParameters->obssScanActiveDwell;
8213 }
8214 if((pOBSSScanParameters->obssScanPassiveDwell >
8215 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
8216 (pOBSSScanParameters->obssScanPassiveDwell <
8217 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
8218 {
8219 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
8220 pOBSSScanParameters->obssScanPassiveDwell;
8221 }
8222 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
8223 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
8224 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
8225 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
8226 {
8227 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8228 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
8229 }
8230 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
8231 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8232 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
8233 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
8234 {
8235 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8236 pOBSSScanParameters->obssScanActiveTotalPerChannel;
8237 }
8238 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
8239 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
8240 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8241 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8242 {
8243 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8244 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8245 }
8246 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8247 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8248 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8249 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8250 {
8251 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8252 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8253 }
8254 if((pOBSSScanParameters->obssScanActivityThreshold >
8255 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8256 (pOBSSScanParameters->obssScanActivityThreshold <
8257 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8258 {
8259 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8260 pOBSSScanParameters->obssScanActivityThreshold;
8261 }
8262}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008263
8264#ifdef WLAN_FEATURE_11W
8265void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8266{
8267 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8268 tPmfSaQueryTimerId timerId;
8269 tpPESession psessionEntry;
8270 tpDphHashNode pSta;
8271 tANI_U32 maxRetries;
8272
8273 limLog(pMac, LOG1, FL("SA Query timer fires"));
8274 timerId.value = param;
8275
8276 // Check that SA Query is in progress
8277 if ((psessionEntry = peFindSessionBySessionId(
8278 pMac, timerId.fields.sessionId)) == NULL)
8279 {
8280 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8281 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008282 return;
8283 }
8284 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8285 &psessionEntry->dph.dphHashTable)) == NULL)
8286 {
8287 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8288 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008289 return;
8290 }
8291 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8292 return;
8293
8294 // Increment the retry count, check if reached maximum
8295 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8296 &maxRetries) != eSIR_SUCCESS)
8297 {
8298 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8299 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8300 return;
8301 }
8302 pSta->pmfSaQueryRetryCount++;
8303 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8304 {
Abhishek Singh5696b732015-01-16 10:51:45 +05308305 limLog(pMac, LOGE,
8306 FL("SA Query timed out,Deleting STA: " MAC_ADDRESS_STR),
8307 MAC_ADDR_ARRAY(pSta->staAddr));
8308 limSendDisassocMgmtFrame(pMac,
8309 eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON,
8310 pSta->staAddr, psessionEntry, FALSE);
8311 limTriggerSTAdeletion(pMac, pSta, psessionEntry);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008312 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8313 return;
8314 }
8315
8316 // Retry SA Query
8317 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8318 pSta->staAddr, psessionEntry);
8319 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008320 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8321 {
8322 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8323 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8324 }
8325}
8326#endif
8327
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008328/** ---------------------------------------------------------
8329\fn limProcessChannelSwitchSuspendLink
8330\brief This function call channel switch functions based on
8331 the gLimChannelSwitch.state. After function return it
8332 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8333 If gLimChannelSwitch.state is non-identified then
8334 print error log as well as restore back the
8335 pre-channelSwitch.
8336\param tpAniSirGlobal pMac
8337\param eHalStatus status
8338\param tANI_U32 *ctx
8339\return None
8340 ------------------------------------------------------------*/
8341static void
8342limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8343 eHalStatus status,
8344 tANI_U32 *ctx)
8345{
8346 tpPESession pSessionEntry = (tpPESession)ctx;
8347
8348 if ( eHAL_STATUS_SUCCESS != status )
8349 {
8350 limLog(pMac, LOGE,
8351 FL("Suspend link failed. still proceeding "));
8352 }
8353 if (NULL == pSessionEntry )
8354 {
8355 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8356 return;
8357 }
8358
8359 switch(pSessionEntry->gLimChannelSwitch.state)
8360 {
8361 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8362 PELOGW(limLog(pMac, LOGW,
8363 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8364 limSwitchPrimaryChannel(pMac,
8365 pSessionEntry->gLimChannelSwitch.primaryChannel,
8366 pSessionEntry);
8367 pSessionEntry->gLimChannelSwitch.state =
8368 eLIM_CHANNEL_SWITCH_IDLE;
8369 break;
8370
8371 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8372 PELOGW(limLog(pMac, LOGW,
8373 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8374 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8375 pSessionEntry->gLimChannelSwitch.primaryChannel,
8376 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8377 pSessionEntry->gLimChannelSwitch.state =
8378 eLIM_CHANNEL_SWITCH_IDLE;
8379 break;
8380
8381 default:
8382 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8383 pSessionEntry->gLimChannelSwitch.state);)
8384 if (limRestorePreChannelSwitchState(pMac,
8385 pSessionEntry) != eSIR_SUCCESS)
8386 {
8387 limLog(pMac, LOGE,
8388 FL("Could not restore pre-channelSwitch "
8389 "(11h) state, resetting the system"));
8390 }
8391 }
8392}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308393
8394/** ---------------------------------------------------------
8395\fn limInitOBSSScanParams
8396\brief This function Initializes the OBSS Scan Parameters
8397\param tpAniSirGlobal pMac
8398\param tpPESession pSessionEntry
8399\return None
8400 ------------------------------------------------------------*/
8401
8402void limInitOBSSScanParams(tpAniSirGlobal pMac,
8403 tpPESession psessionEntry)
8404{
8405 tANI_U32 cfgValue;
8406
8407 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8408 &cfgValue) != eSIR_SUCCESS)
8409 {
8410 limLog(pMac, LOGE, FL("Fail to retrieve "
8411 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8412 return ;
8413 }
8414 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8415
8416 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8417 &cfgValue) != eSIR_SUCCESS)
8418 {
8419 limLog(pMac, LOGE, FL("Fail to retrieve "
8420 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8421 return ;
8422 }
8423 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8424
8425 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8426 &cfgValue) != eSIR_SUCCESS)
8427 {
8428 limLog(pMac, LOGE, FL("Fail to retrieve "
8429 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8430 return ;
8431 }
8432 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8433 = cfgValue;
8434 if (wlan_cfgGetInt(pMac,
8435 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8436 &cfgValue) != eSIR_SUCCESS)
8437 {
8438 limLog(pMac, LOGE, FL("Fail to retrieve"
8439 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8440 return ;
8441 }
8442 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8443 cfgValue;
8444 if (wlan_cfgGetInt(pMac,
8445 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8446 != eSIR_SUCCESS)
8447 {
8448 limLog(pMac, LOGE, FL("Fail to retrieve"
8449 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8450 return ;
8451 }
8452 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8453 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308454
8455 if (wlan_cfgGetInt(pMac,
8456 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8457 != eSIR_SUCCESS)
8458 {
8459 limLog(pMac, LOGE, FL("Fail to retrieve"
8460 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8461 return ;
8462 }
8463 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8464 cfgValue;
8465
8466
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308467 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8468 &cfgValue) != eSIR_SUCCESS)
8469 {
8470 limLog(pMac, LOGE, FL("Fail to retrieve "
8471 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8472 return ;
8473 }
8474 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308475}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308476
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308477const char * lim_ScanTypetoString(const v_U8_t scanType)
8478{
8479 switch (scanType)
8480 {
8481 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8482 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8483 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8484 default:
8485 return "Unknown ScanType";
8486 }
8487}
8488
8489const char * lim_BssTypetoString(const v_U8_t bssType)
8490{
8491 switch (bssType)
8492 {
8493 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8494 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8495 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8496 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8497 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8498 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8499 default:
8500 return "Unknown BssType";
8501 }
8502}
8503
8504const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8505{
8506 switch (mode)
8507 {
8508 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8509 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8510 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8511 default:
8512 return "Unknown BgScanMode";
8513 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308514}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308515
8516#ifdef WLAN_FEATURE_11W
8517/**
8518 *
8519 * \brief This function is called by various LIM modules to correctly set
8520 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8521 *
8522 *
8523 * \param pMac Pointer to Global MAC structure
8524 *
8525 * \param psessionEntry Pointer to session corresponding to the connection
8526 *
8527 * \param peer Peer address of the STA to which the frame is to be sent
8528 *
8529 * \param pMacHdr Pointer to the frame MAC header
8530 *
8531 * \return nothing
8532 *
8533 *
8534 */
8535void
8536limSetProtectedBit(tpAniSirGlobal pMac,
8537 tpPESession psessionEntry,
8538 tSirMacAddr peer,
8539 tpSirMacMgmtHdr pMacHdr)
8540{
8541 tANI_U16 aid;
8542 tpDphHashNode pStaDs;
8543
8544 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8545 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8546 {
8547
8548 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8549 &psessionEntry->dph.dphHashTable );
8550 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308551 /* rmfenabled will be set at the time of addbss.
8552 * but sometimes EAP auth fails and keys are not
8553 * installed then if we send any management frame
8554 * like deauth/disassoc with this bit set then
8555 * firmware crashes. so check for keys are
8556 * installed or not also before setting the bit
8557 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308558 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308559 pMacHdr->fc.wep = 1;
8560 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308561 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308562 pMacHdr->fc.wep = 1;
8563} /*** end limSetProtectedBit() ***/
8564#endif
Sushant Kaushik02c866d2015-01-16 15:24:25 +05308565
8566tANI_U8* limGetIePtr(v_U8_t *pIes, int length, v_U8_t eid)
8567{
8568 int left = length;
8569 tANI_U8 *ptr = pIes;
8570 tANI_U8 elem_id,elem_len;
8571
8572 while (left >= 2)
8573 {
8574 elem_id = ptr[0];
8575 elem_len = ptr[1];
8576 left -= 2;
8577
8578 if (elem_len > left)
8579 {
8580 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
8581 FL("****Invalid IEs eid = %d elem_len=%d left=%d\n*****"),
8582 eid,elem_len,left);
8583 return NULL;
8584 }
8585 if (elem_id == eid)
8586 {
8587 return ptr;
8588 }
8589
8590 left -= elem_len;
8591 ptr += (elem_len + 2);
8592 }
8593 return NULL;
8594}
8595
8596
8597void limParseBeaconForTim(tpAniSirGlobal pMac,tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
8598{
8599
8600 tANI_U32 nPayload;
8601 tANI_U8 *pPayload;
8602 tANI_U8 *ieptr;
8603 tSirMacTim *tim;
8604
8605 pPayload = WDA_GET_RX_MPDU_DATA( pRxPacketInfo );
8606 nPayload = WDA_GET_RX_PAYLOAD_LEN( pRxPacketInfo );
8607
8608 if (nPayload < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN))
8609 {
8610 limLog(pMac, LOGE, FL("Beacon length too short to parse"));
8611 return;
8612 }
8613
8614 if (NULL !=
8615 (ieptr = limGetIePtr((pPayload + SIR_MAC_B_PR_SSID_OFFSET),
8616 nPayload, SIR_MAC_TIM_EID)))
8617 {
8618 /* Ignore EID and Length field*/
8619 tim = (tSirMacTim *)(ieptr + 2);
8620
8621 vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp,
8622 ( tANI_U8* )pPayload, sizeof(tANI_U64));
8623 if (tim->dtimCount >= MAX_DTIM_COUNT)
8624 tim->dtimCount = DTIM_COUNT_DEFAULT;
8625 if (tim->dtimPeriod >= MAX_DTIM_PERIOD)
8626 tim->dtimPeriod = DTIM_PERIOD_DEFAULT;
8627 psessionEntry->lastBeaconDtimCount = tim->dtimCount;
8628 psessionEntry->lastBeaconDtimPeriod = tim->dtimPeriod;
8629 psessionEntry->currentBssBeaconCnt++;
8630
8631 limLog(pMac, LOG1,
8632 FL("currentBssBeaconCnt %d lastBeaconDtimCount %d lastBeaconDtimPeriod %d"),
8633 psessionEntry->currentBssBeaconCnt, psessionEntry->lastBeaconDtimCount,
8634 psessionEntry->lastBeaconDtimPeriod);
8635
8636 }
8637 return;
8638}
Girish Gowlia95daca2015-02-04 20:31:31 +05308639
8640void limUpdateMaxRateFlag(tpAniSirGlobal pMac,
8641 tANI_U8 smeSessionId,
8642 tANI_U32 maxRateFlag)
8643{
8644 tpSirSmeUpdateMaxRateParams pRsp;
8645 tSirMsgQ msg;
8646
8647 pRsp = vos_mem_malloc(sizeof(tSirSmeUpdateMaxRateParams));
8648 if (NULL == pRsp)
8649 {
8650 limLog(pMac, LOGP, FL("Memory allocation failed"));
8651 return;
8652 }
8653 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeUpdateMaxRateParams), 0);
8654 pRsp->maxRateFlag = maxRateFlag;
8655 pRsp->smeSessionId = smeSessionId;
8656 msg.type = eWNI_SME_UPDATE_MAX_RATE_IND;
8657 msg.bodyptr = pRsp;
8658 msg.bodyval = 0;
8659 limSysProcessMmhMsgApi(pMac, &msg, ePROT);
8660 return;
8661}
Abhishek Singh5d765712015-03-12 14:04:16 +05308662
8663void limDecrementPendingMgmtCount (tpAniSirGlobal pMac)
8664{
8665 if( pMac->sys.gSysBbtPendingMgmtCount )
8666 {
8667 vos_spin_lock_acquire( &pMac->sys.lock );
8668 pMac->sys.gSysBbtPendingMgmtCount--;
8669 vos_spin_lock_release( &pMac->sys.lock );
8670 }
8671 else
8672 limLog(pMac, LOGW, FL("Pending Management count going negative"));
8673}
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05308674
8675eHalStatus limTxBdComplete(tpAniSirGlobal pMac, void *pData)
8676{
8677 tpSirTxBdStatus pTxBdStatus;
8678
8679 if (!pData)
8680 {
8681 limLog(pMac, LOGE, FL("pData is NULL"));
8682 return eHAL_STATUS_FAILURE;
8683 }
8684
8685 pTxBdStatus = (tpSirTxBdStatus) pData;
8686
8687 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8688 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8689 return eHAL_STATUS_SUCCESS;
8690}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308691
Kapil Gupta956c0c42017-06-16 19:24:31 +05308692eHalStatus limAssocRspTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
8693{
8694 tpSirTxBdStatus pTxBdStatus;
8695 tpDphHashNode pStaDs;
8696 tpPESession psessionEntry;
8697 VOS_STATUS vosStatus;
8698 vos_list_node_t *pNode= NULL, *pNext = NULL;
8699 assoc_rsp_tx_context *tmp_tx_context = NULL;
8700
8701 if (!pData)
8702 {
8703 limLog(pMac, LOGE, FL("pData is NULL"));
8704 return eHAL_STATUS_FAILURE;
8705 }
8706
8707 pTxBdStatus = (tpSirTxBdStatus) pData;
8708
8709 limLog(pMac, LOG1, FL("txBdToken %u, txBdStatus %u"),
8710 pTxBdStatus->txBdToken, pTxBdStatus->txCompleteStatus);
8711
8712 vos_list_peek_front(&pMac->assoc_rsp_completion_list,
8713 &pNode);
8714
8715 while(pNode)
8716 {
8717 tmp_tx_context = container_of(pNode, assoc_rsp_tx_context, node);
8718 if (tmp_tx_context->txBdToken != pTxBdStatus->txBdToken)
8719 {
8720 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8721 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8722
8723 vosStatus = vos_list_peek_next (
8724 &pMac->assoc_rsp_completion_list,
8725 pNode, &pNext );
8726 pNode = pNext;
8727 pNext = NULL;
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308728 tmp_tx_context = NULL;
Kapil Gupta956c0c42017-06-16 19:24:31 +05308729 }
8730 else
8731 {
8732 limLog(pMac, LOG1, FL("expecting txBdToken %u, got txBdToken %u"),
8733 tmp_tx_context->txBdToken, pTxBdStatus->txBdToken);
8734 break;
8735 }
8736 }
8737
Himanshu Agarwal8be45ac2018-04-03 18:51:10 +05308738 if (!pNode) {
Kapil Gupta956c0c42017-06-16 19:24:31 +05308739 limLog(pMac, LOGE, FL("context is NULL"));
8740 return eHAL_STATUS_SUCCESS;
8741 }
8742 psessionEntry = peFindSessionBySessionId(pMac, tmp_tx_context->psessionID);
8743 if (!psessionEntry) {
8744 limLog(pMac, LOGE, FL("failed to get psession pointer"));
8745 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8746 pNode);
8747 vos_mem_free(tmp_tx_context);
8748 return eHAL_STATUS_SUCCESS;
8749 }
8750 pStaDs = dphGetHashEntry(pMac, tmp_tx_context->staId,
8751 &psessionEntry->dph.dphHashTable);
8752 if (pStaDs == NULL)
8753 {
8754 limLog(pMac, LOGW,
8755 FL("STA context not found"));
8756 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8757 pNode);
8758 vos_mem_free(tmp_tx_context);
8759
8760 return eHAL_STATUS_SUCCESS;
8761 }
8762
8763 /* Receive path cleanup */
8764 limCleanupRxPath(pMac, pStaDs, psessionEntry);
8765 vos_list_remove_node(&pMac->assoc_rsp_completion_list,
8766 pNode);
8767 vos_mem_free(tmp_tx_context);
8768
8769 return eHAL_STATUS_SUCCESS;
8770}
Abhishek Singh09d4e4a2016-01-12 11:20:22 +05308771/**
8772 * lim_is_robust_mgmt_action_frame() - Check if action catagory is
8773 * robust action frame
8774 * @action_catagory: Action frame catagory.
8775 *
8776 * This function is used to check if given action catagory is robust
8777 * action frame.
8778 *
8779 * Return: bool
8780 */
8781bool lim_is_robust_mgmt_action_frame(uint8 action_catagory)
8782{
8783 switch (action_catagory) {
8784 /*
8785 * NOTE: This function doesn't take care of the DMG
8786 * (Directional Multi-Gigatbit) BSS case as 8011ad
8787 * support is not yet added. In future, if the support
8788 * is required then this function need few more arguments
8789 * and little change in logic.
8790 */
8791 case SIR_MAC_ACTION_SPECTRUM_MGMT:
8792 case SIR_MAC_ACTION_QOS_MGMT:
8793 case SIR_MAC_ACTION_DLP:
8794 case SIR_MAC_ACTION_BLKACK:
8795 case SIR_MAC_ACTION_RRM:
8796 case SIR_MAC_ACTION_FAST_BSS_TRNST:
8797 case SIR_MAC_ACTION_SA_QUERY:
8798 case SIR_MAC_ACTION_PROT_DUAL_PUB:
8799 case SIR_MAC_ACTION_WNM:
8800 case SIR_MAC_ACITON_MESH:
8801 case SIR_MAC_ACTION_MHF:
8802 case SIR_MAC_ACTION_FST:
8803 return true;
8804 default:
8805 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
8806 FL("non-PMF action category[%d] "),
8807 action_catagory);
8808 break;
8809 }
8810 return false;
8811}
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308812
8813/**
Hu Wangc12631c2016-08-11 09:57:03 +08008814 * lim_compute_ext_cap_ie_length - compute the length of ext cap ie
8815 * based on the bits set
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308816 * @ext_cap: extended IEs structure
8817 *
Hu Wangc12631c2016-08-11 09:57:03 +08008818 * Return: length of the ext cap ie, 0 means should not present
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308819 */
Hu Wangc12631c2016-08-11 09:57:03 +08008820tANI_U8 lim_compute_ext_cap_ie_length (tDot11fIEExtCap *ext_cap) {
8821 tANI_U8 i = DOT11F_IE_EXTCAP_MAX_LEN;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308822
Hu Wangc12631c2016-08-11 09:57:03 +08008823 while (i) {
8824 if (ext_cap->bytes[i-1]) {
8825 break;
8826 }
8827 i --;
8828 }
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308829
Hu Wangc12631c2016-08-11 09:57:03 +08008830 return i;
Gupta, Kapil6f49bd72016-03-22 16:41:14 +05308831}
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308832
8833/**
8834 * lim_update_caps_info_for_bss - Update capability info for this BSS
8835 *
8836 * @mac_ctx: mac context
8837 * @caps: Pointer to capability info to be updated
8838 * @bss_caps: Capability info of the BSS
8839 *
8840 * Update the capability info in Assoc/Reassoc request frames and reset
8841 * the spectrum management, short preamble, immediate block ack bits
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308842 * and rrm bit mask if the BSS doesnot support it
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308843 *
8844 * Return: None
8845 */
8846void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
8847 uint16_t *caps, uint16_t bss_caps)
8848{
8849 if (!(bss_caps & LIM_SPECTRUM_MANAGEMENT_BIT_MASK)) {
8850 *caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
8851 limLog(mac_ctx, LOG1, FL("Clearing spectrum management:no AP support"));
8852 }
8853
8854 if (!(bss_caps & LIM_SHORT_PREAMBLE_BIT_MASK)) {
8855 *caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
8856 limLog(mac_ctx, LOG1, FL("Clearing short preamble:no AP support"));
8857 }
8858
8859 if (!(bss_caps & LIM_IMMEDIATE_BLOCK_ACK_MASK)) {
8860 *caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
8861 limLog(mac_ctx, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
8862 }
Abhinav Kumar47bc7622018-08-16 18:38:28 +05308863
8864 if (!(bss_caps & LIM_RRM_BIT_MASK)) {
8865 *caps &= (~LIM_RRM_BIT_MASK);
8866 limLog(mac_ctx, LOG1,
8867 FL("Clearing radio measurement :no AP support"));
8868 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05308869}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308870#ifdef SAP_AUTH_OFFLOAD
8871/**
8872 * _sap_offload_parse_assoc_req - Parse assoc request and store it.
8873 *
8874 * @pmac: mac context
8875 * @assoc_req: Assoc request
8876 * @add_sta_req: Add Sta request
8877 *
8878 * This function process recieved add sta message and store it as
8879 * sta ds entry. This function will add this sta entry to DPH as well.
8880 *
8881 * Return: DPH hash node
8882 */
8883static tpDphHashNode
8884_sap_offload_parse_assoc_req(tpAniSirGlobal pmac,
8885 tpSirAssocReq assoc_req,
8886 tSapOfldAddStaIndMsg *add_sta_req)
8887{
8888 tpSirMacAssocReqFrame mac_assoc_req = NULL;
8889 tpSirAssocReq temp_assoc_req;
8890 tSirRetStatus status;
8891 tpDphHashNode sta_ds = NULL;
8892 uint8_t *frame_body = NULL;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308893 uint32_t data_len;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308894
8895 tpPESession session_entry = limIsApSessionActive(pmac);
8896
8897 if (session_entry == NULL)
8898 {
8899 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
8900 return NULL;
8901 }
8902
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308903 if (add_sta_req->data_len <= sizeof(tSirMacMgmtHdr))
8904 {
8905 limLog(pmac, LOGE, FL("insufficient length of assoc request"));
8906 return NULL;
8907 }
8908
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308909 /* Update Attribute and Remove IE for
8910 * Software AP Authentication Offload
8911 */
8912 frame_body = (tANI_U8 *)add_sta_req->bufp;
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308913
8914 /*
8915 * strip MAC mgmt header before passing buf to
8916 * sirConvertAssocReqFrame2Struct() as this API
8917 * expects buf starting from fixed parameters only.
8918 */
8919 frame_body += sizeof(tSirMacMgmtHdr);
8920 data_len = add_sta_req->data_len - sizeof(tSirMacMgmtHdr);
8921
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308922 mac_assoc_req = (tpSirMacAssocReqFrame)frame_body;
8923 mac_assoc_req->capabilityInfo.privacy = 0;
8924
8925 status = sirConvertAssocReqFrame2Struct(pmac,
8926 frame_body,
Himanshu Agarwalfd3b43c2017-09-26 16:17:39 +05308927 data_len,
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05308928 assoc_req);
8929 if (status != eSIR_SUCCESS)
8930 {
8931 limLog(pmac, LOGW, FL("sap_offload_add_sta_req parse error"));
8932 goto error;
8933 }
8934 /* For software AP Auth Offload feature
8935 * Host will take it as none security station
8936 * Force change to none security
8937 */
8938 assoc_req->rsnPresent = 0;
8939 assoc_req->wpaPresent = 0;
8940
8941 sta_ds = dphAddHashEntry(pmac,
8942 add_sta_req->peer_macaddr,
8943 add_sta_req->assoc_id,
8944 &session_entry->dph.dphHashTable);
8945 if (sta_ds == NULL)
8946 {
8947 /* Could not add hash table entry at DPH */
8948 limLog(pmac, LOGE,
8949 FL("could not add hash entry at DPH for aid=%d, MacAddr:"
8950 MAC_ADDRESS_STR),
8951 add_sta_req->assoc_id,MAC_ADDR_ARRAY(add_sta_req->peer_macaddr));
8952 goto error;
8953 }
8954
8955 if (session_entry->parsedAssocReq != NULL)
8956 {
8957 temp_assoc_req = session_entry->parsedAssocReq[sta_ds->assocId];
8958 if (temp_assoc_req != NULL)
8959 {
8960 if (temp_assoc_req->assocReqFrame)
8961 {
8962 vos_mem_free(temp_assoc_req->assocReqFrame);
8963 temp_assoc_req->assocReqFrame = NULL;
8964 temp_assoc_req->assocReqFrameLength = 0;
8965 }
8966 vos_mem_free(temp_assoc_req);
8967 temp_assoc_req = NULL;
8968 }
8969 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
8970 }
8971error:
8972 return sta_ds;
8973}
8974
8975/**
8976 * _sap_offload_parse_sta_capability - Parse sta caps from assoc request
8977 *
8978 * @sta_ds: STA state node
8979 * @assoc_req: Assoc request
8980 * @add_sta_req: Add Sta request
8981 *
8982 * This function process recieved add sta message and store station's caps
8983 * in station ds entry.
8984 *
8985 * Return: none
8986 */
8987static void
8988_sap_offload_parse_sta_capability(tpDphHashNode sta_ds,
8989 tpSirAssocReq assoc_req,
8990 tSapOfldAddStaIndMsg *add_sta_req)
8991
8992{
8993
8994 sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present;
8995#ifdef WLAN_FEATURE_11AC
8996 sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present;
8997#endif
8998 sta_ds->qos.addtsPresent = (assoc_req->addtsPresent==0) ? false : true;
8999 sta_ds->qos.addts = assoc_req->addtsReq;
9000 sta_ds->qos.capability = assoc_req->qosCapability;
9001 sta_ds->versionPresent = 0;
9002 /* short slot and short preamble should be
9003 * updated before doing limaddsta
9004 */
9005 sta_ds->shortPreambleEnabled =
9006 (tANI_U8)assoc_req->capabilityInfo.shortPreamble;
9007 sta_ds->shortSlotTimeEnabled =
9008 (tANI_U8)assoc_req->capabilityInfo.shortSlotTime;
9009
9010 sta_ds->valid = 0;
9011 /* The Auth Type of Software AP Authentication Offload
9012 * is always Open System is host side
9013 */
9014 sta_ds->mlmStaContext.authType = eSIR_OPEN_SYSTEM;
9015 sta_ds->staType = STA_ENTRY_PEER;
9016
9017 /* Assoc Response frame to requesting STA */
9018 sta_ds->mlmStaContext.subType = 0;
9019
9020 sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval;
9021 sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo;
9022
9023 /* The following count will be used to knock-off the station
9024 * if it doesn't come back to receive the buffered data.
9025 * The AP will wait for numTimSent number of beacons after
9026 * sending TIM information for the station, before assuming that
9027 * the station is no more associated and disassociates it
9028 */
9029
9030 /* timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/
9031 sta_ds->timWaitCount =
9032 (tANI_U8)GET_TIM_WAIT_COUNT(assoc_req->listenInterval);
9033
9034 /* Initialise the Current successful
9035 * MPDU's tranfered to this STA count as 0
9036 */
9037 sta_ds->curTxMpduCnt = 0;
9038}
9039
9040/**
9041 * _sap_offload_parse_sta_vht - Parse sta's HT/VHT caps from assoc request
9042 *
9043 * @pmac: mac context
9044 * @sta_ds: STA state node
9045 * @assoc_req: Assoc request
9046 *
9047 * This function process recieved add sta message and store station's HT and
9048 * and VHT caps and store them in station ds entry.
9049 *
9050 * Return: tSirRetStatus
9051 */
9052static tSirRetStatus
9053_sap_offload_parse_sta_vht(tpAniSirGlobal pmac,
9054 tpDphHashNode sta_ds,
9055 tpSirAssocReq assoc_req)
9056{
9057 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309058 if (session_entry == NULL)
9059 {
9060 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9061 goto error;
9062 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309063
9064 if (IS_DOT11_MODE_HT(session_entry->dot11mode) &&
9065 assoc_req->HTCaps.present && assoc_req->wmeInfoPresent)
9066 {
9067 sta_ds->htGreenfield = (tANI_U8)assoc_req->HTCaps.greenField;
9068 sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity;
9069 sta_ds->htDsssCckRate40MHzSupport =
9070 (tANI_U8)assoc_req->HTCaps.dsssCckMode40MHz;
9071 sta_ds->htLsigTXOPProtection =
9072 (tANI_U8)assoc_req->HTCaps.lsigTXOPProtection;
9073 sta_ds->htMaxAmsduLength =
9074 (tANI_U8)assoc_req->HTCaps.maximalAMSDUsize;
9075 sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor;
9076 sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave;
9077 sta_ds->htShortGI20Mhz = (tANI_U8)assoc_req->HTCaps.shortGI20MHz;
9078 sta_ds->htShortGI40Mhz = (tANI_U8)assoc_req->HTCaps.shortGI40MHz;
9079 sta_ds->htSupportedChannelWidthSet =
9080 (tANI_U8)assoc_req->HTCaps.supportedChannelWidthSet;
9081 /* peer just follows AP; so when we are softAP/GO,
9082 * we just store our session entry's secondary channel offset here
9083 * in peer INFRA STA. However, if peer's 40MHz channel width support
9084 * is disabled then secondary channel will be zero
9085 */
9086 sta_ds->htSecondaryChannelOffset =
9087 (sta_ds->htSupportedChannelWidthSet) ?
9088 session_entry->htSecondaryChannelOffset : 0;
9089#ifdef WLAN_FEATURE_11AC
9090 if (assoc_req->operMode.present)
9091 {
9092 sta_ds->vhtSupportedChannelWidthSet =
9093 (tANI_U8)((assoc_req->operMode.chanWidth ==
9094 eHT_CHANNEL_WIDTH_80MHZ) ?
9095 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ :
9096 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ);
9097 sta_ds->htSupportedChannelWidthSet =
9098 (tANI_U8)(assoc_req->operMode.chanWidth ?
9099 eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ);
9100 }
9101 else if (assoc_req->VHTCaps.present)
9102 {
9103 /* Check if STA has enabled it's channel bonding mode.
9104 * If channel bonding mode is enabled, we decide based on
9105 * SAP's current configuration else, we set it to VHT20.
9106 */
9107 sta_ds->vhtSupportedChannelWidthSet =
9108 (tANI_U8)((sta_ds->htSupportedChannelWidthSet ==
9109 eHT_CHANNEL_WIDTH_20MHZ) ?
9110 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ :
9111 session_entry->vhtTxChannelWidthSet );
9112 sta_ds->htMaxRxAMpduFactor = assoc_req->VHTCaps.maxAMPDULenExp;
9113 }
9114
9115 /* Lesser among the AP and STA bandwidth of operation. */
9116 sta_ds->htSupportedChannelWidthSet =
9117 (sta_ds->htSupportedChannelWidthSet <
9118 session_entry->htSupportedChannelWidthSet) ?
9119 sta_ds->htSupportedChannelWidthSet :
9120 session_entry->htSupportedChannelWidthSet ;
9121#endif
9122 sta_ds->baPolicyFlag = 0xFF;
9123 sta_ds->htLdpcCapable = (tANI_U8)assoc_req->HTCaps.advCodingCap;
9124 }
9125
9126 if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent)
9127 sta_ds->vhtLdpcCapable = (tANI_U8)assoc_req->VHTCaps.ldpcCodingCap;
9128
9129 if (!assoc_req->wmeInfoPresent)
9130 {
9131 sta_ds->mlmStaContext.htCapability = 0;
9132#ifdef WLAN_FEATURE_11AC
9133 sta_ds->mlmStaContext.vhtCapability = 0;
9134#endif
9135 }
9136#ifdef WLAN_FEATURE_11AC
9137 if (limPopulateMatchingRateSet(pmac,
9138 sta_ds,
9139 &(assoc_req->supportedRates),
9140 &(assoc_req->extendedRates),
9141 assoc_req->HTCaps.supportedMCSSet,
9142 &(assoc_req->propIEinfo.propRates),
9143 session_entry , &assoc_req->VHTCaps)
9144 != eSIR_SUCCESS)
9145 {
9146#else
9147 if (limPopulateMatchingRateSet(pmac,
9148 sta_ds,
9149 &(assoc_req->supportedRates),
9150 &(assoc_req->extendedRates),
9151 assoc_req->HTCaps.supportedMCSSet,
9152 &(assoc_req->propIEinfo.propRates),
9153 session_entry) != eSIR_SUCCESS)
9154 {
9155#endif
9156 limLog(pmac, LOGE,
9157 FL("Rate set mismatched for aid=%d, MacAddr: "
9158 MAC_ADDRESS_STR),
9159 sta_ds->assocId, MAC_ADDR_ARRAY(sta_ds->staAddr));
9160 goto error;
9161 }
9162 return eSIR_SUCCESS;
9163error:
9164 return eSIR_FAILURE;
9165}
9166
9167/**
9168 * _sap_offload_parse_sta_qos - Parse sta's QOS caps from assoc request
9169 *
9170 * @pmac: mac context
9171 * @sta_ds: STA state node
9172 * @assoc_req: Assoc request
9173 *
9174 * This function process recieved add sta message and store station's QOS
9175 * store them in station ds entry.
9176 *
9177 * Return: none
9178 */
9179static void
9180 _sap_offload_parse_sta_qos(tpAniSirGlobal pmac,
9181 tpDphHashNode sta_ds,
9182 tpSirAssocReq assoc_req)
9183{
9184 tHalBitVal qos_mode;
9185 tHalBitVal wsm_mode, wme_mode;
9186 tpPESession session_entry = limIsApSessionActive(pmac);
Abhinav Kumarb4626d02018-02-26 18:16:30 +05309187 if (session_entry == NULL)
9188 {
9189 limLog(pmac, LOGE, FL("Invalid Session Entry"));
9190 return;
9191 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309192 limGetQosMode(session_entry, &qos_mode);
9193 sta_ds->qosMode = eANI_BOOLEAN_FALSE;
9194 sta_ds->lleEnabled = eANI_BOOLEAN_FALSE;
9195
9196 if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET))
9197 {
9198 sta_ds->lleEnabled = eANI_BOOLEAN_TRUE;
9199 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9200 }
9201
9202 sta_ds->wmeEnabled = eANI_BOOLEAN_FALSE;
9203 sta_ds->wsmEnabled = eANI_BOOLEAN_FALSE;
9204 limGetWmeMode(session_entry, &wme_mode);
9205 if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent &&
9206 (wme_mode == eHAL_SET))
9207 {
9208 sta_ds->wmeEnabled = eANI_BOOLEAN_TRUE;
9209 sta_ds->qosMode = eANI_BOOLEAN_TRUE;
9210 limGetWsmMode(session_entry, &wsm_mode);
9211 /* WMM_APSD - WMM_SA related processing should be
9212 * separate; WMM_SA and WMM_APSD can coexist
9213 */
9214 if (assoc_req->WMMInfoStation.present)
9215 {
9216 /* check whether AP supports or not */
9217 if ((session_entry->limSystemRole == eLIM_AP_ROLE)
9218 && (session_entry->apUapsdEnable == 0) &&
9219 (assoc_req->WMMInfoStation.acbe_uapsd
9220 || assoc_req->WMMInfoStation.acbk_uapsd
9221 || assoc_req->WMMInfoStation.acvo_uapsd
9222 || assoc_req->WMMInfoStation.acvi_uapsd))
9223 {
9224 /*
9225 * Received Re/Association Request from
9226 * STA when UPASD is not supported
9227 */
9228 limLog( pmac, LOGE, FL( "AP do not support UAPSD so reply "
9229 "to STA accordingly" ));
9230 /* update UAPSD and send it to LIM to add STA */
9231 sta_ds->qos.capability.qosInfo.acbe_uapsd = 0;
9232 sta_ds->qos.capability.qosInfo.acbk_uapsd = 0;
9233 sta_ds->qos.capability.qosInfo.acvo_uapsd = 0;
9234 sta_ds->qos.capability.qosInfo.acvi_uapsd = 0;
9235 sta_ds->qos.capability.qosInfo.maxSpLen = 0;
9236 }
9237 else
9238 {
9239 /* update UAPSD and send it to LIM to add STA */
9240 sta_ds->qos.capability.qosInfo.acbe_uapsd =
9241 assoc_req->WMMInfoStation.acbe_uapsd;
9242 sta_ds->qos.capability.qosInfo.acbk_uapsd =
9243 assoc_req->WMMInfoStation.acbk_uapsd;
9244 sta_ds->qos.capability.qosInfo.acvo_uapsd =
9245 assoc_req->WMMInfoStation.acvo_uapsd;
9246 sta_ds->qos.capability.qosInfo.acvi_uapsd =
9247 assoc_req->WMMInfoStation.acvi_uapsd;
9248 sta_ds->qos.capability.qosInfo.maxSpLen =
9249 assoc_req->WMMInfoStation.max_sp_length;
9250 }
9251 }
9252 if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET))
9253 sta_ds->wsmEnabled = eANI_BOOLEAN_TRUE;
9254 }
9255}
9256
9257/**
9258 * lim_sap_offload_add_sta - Parse Add sta request from firmware
9259 *
9260 * @pmac: mac context
9261 * @lim_msgq: Add Sta indication buffer
9262 *
9263 * This function will recieve buffer from firmware. This buffer will store
9264 * information about connected client. driver will process this buffer and
9265 * will register this client with driver. Driver will call limAddSta
9266 *
9267 * Return: none
9268 */
9269void lim_sap_offload_add_sta(tpAniSirGlobal pmac,
9270 tSapOfldAddStaIndMsg *lim_msgq)
9271{
9272 tpSirAssocReq assoc_req = NULL;
9273 tpDphHashNode sta_ds = NULL;
9274
9275 tSapOfldAddStaIndMsg *add_sta_req = NULL;
9276 tpPESession session_entry = limIsApSessionActive(pmac);
9277
9278 if (session_entry == NULL)
9279 {
9280 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9281 return;
9282 }
9283 add_sta_req = lim_msgq;
9284 assoc_req = vos_mem_malloc(sizeof(*assoc_req));
9285 if (NULL == assoc_req) {
9286 limLog(pmac, LOGP, FL("Allocate Memory failed in AssocReq"));
9287 return;
9288 }
9289 vos_mem_set(assoc_req , sizeof(*assoc_req), 0);
9290
9291 /* parse Assoc req frame for station information */
9292 sta_ds = _sap_offload_parse_assoc_req(pmac, assoc_req, add_sta_req);
9293 if (sta_ds == NULL)
9294 {
9295 PELOGE(limLog(pmac, LOGE, FL("could not add hash entry for"));)
9296 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9297 vos_mem_free(assoc_req);
9298 goto error;
9299 }
9300
9301 /* Parse Station Capability */
9302 _sap_offload_parse_sta_capability(sta_ds, assoc_req, add_sta_req);
9303
9304 /* Parse Station HT/VHT information */
9305 if (_sap_offload_parse_sta_vht(pmac, sta_ds, assoc_req)
9306 == eSIR_FAILURE)
9307 {
9308 PELOGE(limLog(pmac, LOGE, FL("mismatch ht/vht information for "));)
9309 limPrintMacAddr(pmac, add_sta_req->peer_macaddr, LOGE);
9310 vos_mem_free(assoc_req);
9311 goto error;
9312
9313 }
9314
9315 /* Parse Station QOS information */
9316 _sap_offload_parse_sta_qos(pmac, sta_ds, assoc_req);
9317
9318 session_entry->parsedAssocReq[sta_ds->assocId] = assoc_req;
9319 sta_ds->staIndex = add_sta_req->staIdx;
9320 sta_ds->dpuIndex = add_sta_req->dpuIndex;
9321 sta_ds->bcastDpuIndex = add_sta_req->bcastDpuIndex;
9322 sta_ds->bcastMgmtDpuIdx = add_sta_req->bcastMgmtDpuIdx;
9323 sta_ds->ucUcastSig = add_sta_req->ucUcastSig;
9324 sta_ds->ucBcastSig = add_sta_req->ucBcastSig;
9325 sta_ds->ucMgmtSig = add_sta_req->ucMgmtSig;
Agrawal Ashishce67f362017-01-05 20:10:58 +05309326 sta_ds->bssId = add_sta_req->bssIdx;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309327
Agrawal Ashishce67f362017-01-05 20:10:58 +05309328 limLog(pmac, LOG1, FL("StaIndex %d BssIDx %d dpuIndex %d bcastDpuIndex %d bcastMgmtDpuIdx %d ucUcastSig %d ucBcastSig %d ucMgmtSig %d AssocId %d"),
9329 sta_ds->staIndex,
9330 sta_ds->bssId,
9331 sta_ds->dpuIndex,
9332 sta_ds->bcastDpuIndex,
9333 sta_ds->bcastMgmtDpuIdx,
9334 sta_ds->ucUcastSig,
9335 sta_ds->ucBcastSig,
9336 sta_ds->ucMgmtSig,
9337 sta_ds->assocId);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309338
9339 if (limAddSta(pmac, sta_ds, false, session_entry) != eSIR_SUCCESS) {
9340 limLog(pmac, LOGE, FL("could not Add STA with assocId=%d"),
9341 sta_ds->assocId);
9342 }
9343
9344error:
9345 return;
9346}
9347
9348/**
9349 * lim_sap_offload_del_sta - Parse Del sta request from firmware
9350 *
9351 * @pmac: mac context
9352 * @lim_msgq: Del Sta indication buffer
9353 *
9354 * This function will recieve buffer from firmware. This buffer will
9355 * have information about clinet to remove with reason code.
9356 * This function will call limSendSmeDisassocInd to do cleanup
9357 * for station entry
9358 *
9359 * Return: none
9360 */
9361void
9362lim_sap_offload_del_sta(tpAniSirGlobal pmac, tSapOfldDelStaIndMsg *lim_msgq)
9363{
9364 tSapOfldDelStaIndMsg *del_sta_req = NULL;
9365 tpDphHashNode sta_ds = NULL;
9366 tANI_U16 assoc_id = 0;
9367 tpPESession psession_entry = limIsApSessionActive(pmac);
9368
9369 if (psession_entry == NULL)
9370 {
9371 PELOGE(limLog(pmac, LOGE, FL(" Session not found"));)
9372 goto error;
9373 }
9374
9375 del_sta_req = lim_msgq;
9376 sta_ds = dphLookupHashEntry(pmac,
9377 del_sta_req->peer_macaddr,
9378 &assoc_id,
9379 &psession_entry->dph.dphHashTable);
9380 if (sta_ds == NULL)
9381 {
9382 /*
9383 * Disassociating STA is not associated.
9384 * Log error
9385 */
9386 PELOGE(limLog(pmac, LOGE,
9387 FL("received del sta event that sta not exist in table "
9388 "reasonCode=%d, addr "MAC_ADDRESS_STR),
9389 del_sta_req->reason,
9390 MAC_ADDR_ARRAY(del_sta_req->peer_macaddr));)
9391 goto error;
9392 }
9393
9394 if (assoc_id != (tANI_U16)del_sta_req->assoc_id)
9395 {
9396 /*
9397 * Associate Id mismatch
9398 * Log error
9399 */
9400 PELOGE(limLog(pmac, LOGE,
9401 FL("received del sta event that sta assoc Id mismatch"));)
9402 goto error;
9403 }
9404
9405 sta_ds->mlmStaContext.cleanupTrigger = eLIM_PEER_ENTITY_DISASSOC;
9406 sta_ds->mlmStaContext.disassocReason =
9407 (tSirMacReasonCodes) del_sta_req->reason;
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05309408
9409 limSendSmeDisassocInd(pmac, sta_ds, psession_entry);
9410
9411error:
9412 return;
9413}
9414#endif /* SAP_AUTH_OFFLOAD */
Sachin Ahujae4c6fac2016-12-29 10:30:15 +05309415
9416int peFindBssIdxFromSmeSessionId(tpAniSirGlobal pMac, tANI_U8 sme_sessionId)
9417{
9418 tANI_U8 i;
9419 tpPESession psessionEntry = NULL;
9420
9421 for(i =0; i < pMac->lim.maxBssId; i++)
9422 {
9423 /* If BSSID matches return corresponding tables address*/
9424 if( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].smeSessionId == sme_sessionId))
9425 {
9426 psessionEntry = (&pMac->lim.gpSession[i]);
9427 return psessionEntry->bssIdx;
9428 }
9429 }
9430
9431 limLog(pMac, LOG4, FL("Session lookup fails for sme_sessionId: "));
9432 return(0xFF);
9433}
Yeshwanth Sriram Guntuka8d9b29c2017-12-12 15:44:57 +05309434void limStaDelBASession(tpAniSirGlobal pMac)
9435{
9436 tANI_U32 i;
9437 tpPESession pSessionEntry;
9438
9439 for (i = 0; i < pMac->lim.maxBssId; i++)
9440 {
9441 pSessionEntry = peFindSessionBySessionId(pMac, i);
9442 if (pSessionEntry &&
9443 pSessionEntry->limSystemRole == eLIM_STA_ROLE)
9444 {
9445 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
9446 eSIR_MAC_UNSPEC_FAILURE_REASON);
9447 }
9448 }
9449}