blob: c68ecf43f991f67daa602808691da3833495f8e4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08002 * Copyright (c) 2012-2014 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
60#include "wniCfgAp.h"
61#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
64 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
65 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
66 * this information. */
67static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
68
69/* 11A Channel list to decode RX BD channel information */
70static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070071 120,124,128,132,136,140,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080072#define abChannelSize (sizeof(abChannel)/ \
73 sizeof(abChannel[0]))
Jeff Johnson295189b2012-06-20 16:38:30 -070074
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070075#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
76static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
Arif Hussain6af38622014-03-12 12:39:57 -070077 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165,144};
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -080078#define aUnsortedChannelListSize (sizeof(aUnsortedChannelList)/ \
79 sizeof(aUnsortedChannelList[0]))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070080#endif
81
Arif Hussain6af38622014-03-12 12:39:57 -070082//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070083#define SUCCESS 1 //defined temporarily for BT-AMP
84
Agarwal Ashish87039eb2014-01-15 14:13:15 +053085#define MAX_BA_WINDOW_SIZE_FOR_CISCO 25
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080086static void
87limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
88 eHalStatus status,
89 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070090/** -------------------------------------------------------------
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +053091\fn limCheck11BRateBitmap
92\brief Verifies if basic rates are set.
93\param tANI_U16 pRateBitmap
94\return tANI_BOOLEAN - true or false
95 -------------------------------------------------------------*/
96
97tANI_BOOLEAN limCheck11BRateBitmap(tANI_U16 pRateBitmap)
98{
99 return ( ( pRateBitmap & ( 1 << 0 ) ) || ( pRateBitmap & ( 1 << 1 ) ) ||
100 ( pRateBitmap & ( 1 << 2 ) ) ||
101 ( pRateBitmap & ( 1 << 3 ) ) ? 1 : 0 ) ;
102}
103
104/** -------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -0700105\fn limAssignDialogueToken
106\brief Assigns dialogue token.
107\param tpAniSirGlobal pMac
108\return tpDialogueToken - dialogueToken data structure.
109 -------------------------------------------------------------*/
110
111tpDialogueToken
112limAssignDialogueToken(tpAniSirGlobal pMac)
113{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700114 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700115 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530116 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
117 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530119 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700120 return NULL;
121 }
122
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530123 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 //first node in the list is being added.
125 if(NULL == pMac->lim.pDialogueTokenHead)
126 {
127 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
128 }
129 else
130 {
131 pMac->lim.pDialogueTokenTail->next = pCurrNode;
132 pMac->lim.pDialogueTokenTail = pCurrNode;
133 }
134 //assocId and tid of the node will be filled in by caller.
135 pCurrNode->next = NULL;
136 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700137
138 /* Dialog token should be a non-zero value */
139 if (0 == pCurrNode->token)
140 pCurrNode->token = token;
141
142 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 return pCurrNode;
144}
145
146/** -------------------------------------------------------------
147\fn limSearchAndDeleteDialogueToken
148\brief search dialogue token in the list and deletes it if found. returns failure if not found.
149\param tpAniSirGlobal pMac
150\param tANI_U8 token
151\param tANI_U16 assocId
152\param tANI_U16 tid
153\return eSirRetStatus - status of the search
154 -------------------------------------------------------------*/
155
156
157tSirRetStatus
158limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
159{
160 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
161 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
162
163 //if the list is empty
164 if(NULL == pCurrNode)
165 return eSIR_FAILURE;
166
167 // if the matching node is the first node.
168 if(pCurrNode &&
169 (assocId == pCurrNode->assocId) &&
170 (tid == pCurrNode->tid))
171 {
172 pMac->lim.pDialogueTokenHead = pCurrNode->next;
173 //there was only one node in the list. So tail pointer also needs to be adjusted.
174 if(NULL == pMac->lim.pDialogueTokenHead)
175 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530176 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800177 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 return eSIR_SUCCESS;
179 }
180
181 //first node did not match. so move to the next one.
182 pCurrNode = pCurrNode->next;
183 while(NULL != pCurrNode )
184 {
185 if(token == pCurrNode->token)
186 {
187 break;
188 }
189
190 pPrevNode = pCurrNode;
191 pCurrNode = pCurrNode->next;
192 }
193
194 if(pCurrNode &&
195 (assocId == pCurrNode->assocId) &&
196 (tid == pCurrNode->tid))
197 {
198 pPrevNode->next = pCurrNode->next;
199 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
200 if(NULL == pCurrNode->next)
201 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530202 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800203 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700204 return eSIR_SUCCESS;
205 }
206
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700207 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 return eSIR_FAILURE;
209
210}
211
212
213/** -------------------------------------------------------------
214\fn limDeleteDialogueTokenList
215\brief deletes the complete lim dialogue token linked list.
216\param tpAniSirGlobal pMac
217\return None
218 -------------------------------------------------------------*/
219void
220limDeleteDialogueTokenList(tpAniSirGlobal pMac)
221{
222 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
223
224 while(NULL != pMac->lim.pDialogueTokenHead)
225 {
226 pCurrNode = pMac->lim.pDialogueTokenHead;
227 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530228 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 pCurrNode = NULL;
230 }
231 pMac->lim.pDialogueTokenTail = NULL;
232}
233
234void
235limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
236{
237 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
238 *pIgnore = 0;
239
240 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
241 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530242 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 *pIgnore = 1;
244 }
245 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
246 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530247 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700248 *pIgnore = 1;
249 }
250 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
251 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530252 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 *pIgnore = 0;
254 }
255 else
256 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530257 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 *pIgnore = 1;
259 }
260}
261
262char *
263limMlmStateStr(tLimMlmStates state)
264{
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 switch (state)
266 {
267 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
296 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
297 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
316 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
317 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700318 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700320 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700324 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700326}
327
328void
329limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
330{
331 limLog(pMac, logLevel, limMlmStateStr(state));
332}
333
334char *
335limSmeStateStr(tLimSmeStates state)
336{
337#ifdef FIXME_GEN6
338 switch (state)
339 {
340 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700377 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700381 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700383 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 }
387#endif
388return "";
389}
390
391
392char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
393{
394#ifdef FIXME_GEN6
395
396 switch(dot11Mode)
397 {
398 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700399 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 return "11A";
402 case WNI_CFG_DOT11_MODE_11B:
403 return "11B";
404 case WNI_CFG_DOT11_MODE_11G:
405 return "11G";
406 case WNI_CFG_DOT11_MODE_11N:
407 return "11N";
408 case WNI_CFG_DOT11_MODE_POLARIS:
409 return "Polaris";
410 case WNI_CFG_DOT11_MODE_TITAN:
411 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700413 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700415 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 }
417#endif
418return "";
419}
420
421
422char* limStaOpRateModeStr(tStaRateMode opRateMode)
423{
424#ifdef FIXME_GEN6
425
426 switch(opRateMode)
427 {
428 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700429 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700431 return "11A";
432 case eSTA_11b:
433 return "11B";
434 case eSTA_11bg:
435 return "11G";
436 case eSTA_11n:
437 return "11N";
438 case eSTA_POLARIS:
439 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700441 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700443 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 }
445#endif
446return "";
447}
448
449char* limBssTypeStr(tSirBssType bssType)
450{
451 switch(bssType)
452 {
453 case eSIR_INFRASTRUCTURE_MODE:
454 return "eSIR_INFRASTRUCTURE_MODE";
455 case eSIR_IBSS_MODE:
456 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700457 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700459 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700461 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return "eSIR_AUTO_MODE";
463 default:
464 return "Invalid BSS Type";
465 }
466}
467
468void
469limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
470{
471 limLog(pMac, logLevel, limSmeStateStr(state));
472}
473
474char *limMsgStr(tANI_U32 msgType)
475{
476#ifdef FIXME_GEN6
477 switch (msgType)
478 {
479 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700487#ifdef FEATURE_OEM_DATA_SUPPORT
488 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700490 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700491 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700492#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700576 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700582 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800589#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800590 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800592 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800594#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700595
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700625 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700627 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700631 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638#ifdef WLAN_FEATURE_VOWIFI_11R
639 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641#endif
642
643 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700650 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700693 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700695 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700697 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700703 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800704 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700705 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800706#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700707 case eWNI_SME_GET_TSM_STATS_REQ:
708 return "eWNI_SME_GET_TSM_STATS_REQ";
709 case eWNI_SME_GET_TSM_STATS_RSP:
710 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800711#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 }
715#endif
716return "";
717}
718
719
720
721char *limResultCodeStr(tSirResultCodes resultCode)
722{
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 switch (resultCode)
724 {
725 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700838 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700840 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851#ifdef GEN4_SCAN
852 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700853 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700863 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700864#else // GEN4_SCAN
865 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700866 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700868 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700869#endif // GEN4_SCAN
870
871 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700872 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700874}
875
876void
877limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
878{
879 limLog(pMac, logLevel, limMsgStr(msgType));
880}
881
Jeff Johnson295189b2012-06-20 16:38:30 -0700882void
883limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
884{
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
886 {
887 switch (msg->type)
888 {
889 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 break;
892 default:
893 limPrintMsgName(pMac, logLevel,msg->type);
894 break;
895 }
896 }
897}
898
899/**
900 * limInitMlm()
901 *
902 *FUNCTION:
903 * This function is called by limProcessSmeMessages() to
904 * initialize MLM state machine on STA
905 *
906 *PARAMS:
907 *
908 *LOGIC:
909 *
910 *ASSUMPTIONS:
911 * NA
912 *
913 *NOTE:
914 * NA
915 *
916 * @param pMac Pointer to Global MAC structure
917 * @return None
918 */
919void
920limInitMlm(tpAniSirGlobal pMac)
921{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700922 tANI_U32 retVal;
923
924 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700925
Jeff Johnsone7245742012-09-05 17:12:55 -0700926 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928 /// Initialize scan result hash table
929 limReInitScanResults(pMac); //sep26th review
930
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700931#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
932 /// Initialize lfr scan result hash table
933 // Could there be a problem in multisession with SAP/P2P GO, when in the
934 // middle of FW bg scan, SAP started; Again that could be a problem even on
935 // infra + SAP/P2P GO too - TBD
936 limReInitLfrScanResults(pMac);
937#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700938
939 /// Initialize number of pre-auth contexts
940 pMac->lim.gLimNumPreAuthContexts = 0;
941
942 /// Initialize MAC based Authentication STA list
943 limInitPreAuthList(pMac);
944
945 //pMac->lim.gpLimMlmJoinReq = NULL;
946
947 if (pMac->lim.gLimTimersCreated)
948 return;
949
950 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700951 retVal = limCreateTimers(pMac);
952 if(retVal == TX_SUCCESS)
953 {
954 pMac->lim.gLimTimersCreated = 1;
955 }
956 else
957 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700958 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700959 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700960} /*** end limInitMlm() ***/
961
962
963
964/**
965 * limCleanupMlm()
966 *
967 *FUNCTION:
968 * This function is called to cleanup any resources
969 * allocated by the MLM state machine.
970 *
971 *PARAMS:
972 *
973 *LOGIC:
974 *
975 *ASSUMPTIONS:
976 * NA
977 *
978 *NOTE:
979 * It is assumed that BSS is already informed that we're leaving it
980 * before this function is called.
981 *
982 * @param pMac Pointer to Global MAC structure
983 * @param None
984 * @return None
985 */
986void
987limCleanupMlm(tpAniSirGlobal pMac)
988{
989 tANI_U32 n;
990 tLimPreAuthNode *pAuthNode;
Agarwal Ashish888ca022014-11-05 14:25:56 +0530991#ifdef WLAN_FEATURE_11W
992 tANI_U32 bss_entry, sta_entry;
993 tpDphHashNode pStaDs = NULL;
994 tpPESession psessionEntry = NULL;
995#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700996
997 if (pMac->lim.gLimTimersCreated == 1)
998 {
999 // Deactivate and delete MIN/MAX channel timers.
1000 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
1001 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
1002 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
1003 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
1004 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1005 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
1006
1007
1008 // Deactivate and delete channel switch timer.
1009 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1010 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
1011
1012
1013 // Deactivate and delete addts response timer.
1014 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
1015 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1016
1017 // Deactivate and delete Join failure timer.
1018 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1019 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1020
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001021 // Deactivate and delete Periodic Join Probe Request timer.
1022 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1023 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1024
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 // Deactivate and delete Association failure timer.
1026 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1027 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1028
1029 // Deactivate and delete Reassociation failure timer.
1030 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1031 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1032
1033 // Deactivate and delete Authentication failure timer.
1034 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1035 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1036
1037 // Deactivate and delete Heartbeat timer.
1038 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1039 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1040
1041 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1042 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1043 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1044
1045 // Deactivate and delete Quiet timer.
1046 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1047 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1048
1049 // Deactivate and delete Quiet BSS timer.
1050 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1051 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1052
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 // Deactivate and delete LIM background scan timer.
1054 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1055 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001056
1057
1058 // Deactivate and delete cnf wait timer
1059 for (n = 0; n < pMac->lim.maxStation; n++)
1060 {
1061 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1062 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1063 }
1064
1065 // Deactivate and delete keepalive timer
1066 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1067 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1068
1069 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1070
1071 //Deactivate any Authentication response timers
1072 limDeletePreAuthList(pMac);
1073
1074 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1075 {
1076 // Delete any Authentication response
1077 // timers, which might have been started.
1078 tx_timer_delete(&pAuthNode->timer);
1079 }
1080
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1082 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1083 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1084 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1085
1086#if 0 // The WPS PBC clean up timer is disabled
1087 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1088 {
1089 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1090 {
1091 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1092 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1093 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1094 }
1095 }
1096#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001097#ifdef WLAN_FEATURE_VOWIFI_11R
1098 // Deactivate and delete FT Preauth response timer
1099 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1100 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1101#endif
1102
Jeff Johnson295189b2012-06-20 16:38:30 -07001103
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001104#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001106 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1107 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1108#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001109
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001110 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1111 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1112
1113 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1114 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1115
Hoonki Leef63df0d2013-01-16 19:29:14 -08001116 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1117 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001118
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301119 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1120 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1121
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 pMac->lim.gLimTimersCreated = 0;
1123 }
1124
Agarwal Ashish888ca022014-11-05 14:25:56 +05301125#ifdef WLAN_FEATURE_11W
1126 /*
1127 * When SSR is triggered, we need to loop through
1128 * each STA associated per BSSId and deactivate/delete
1129 * the pmfSaQueryTimer for it
1130 */
1131 if (vos_is_logp_in_progress(VOS_MODULE_ID_PE, NULL))
1132 {
1133 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1134 FL("SSR is detected, proceed to clean up pmfSaQueryTimer"));
1135 for (bss_entry = 0; bss_entry < pMac->lim.maxBssId; bss_entry++)
1136 {
1137 if (pMac->lim.gpSession[bss_entry].valid)
1138 {
1139 for (sta_entry = 1; sta_entry < pMac->lim.gLimAssocStaLimit;
1140 sta_entry++)
1141 {
1142 psessionEntry = &pMac->lim.gpSession[bss_entry];
1143 pStaDs = dphGetHashEntry(pMac, sta_entry,
1144 &psessionEntry->dph.dphHashTable);
1145 if (NULL == pStaDs)
1146 {
1147 continue;
1148 }
1149 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1150 FL("Deleting pmfSaQueryTimer for staid[%d]"),
1151 pStaDs->staIndex) ;
1152 tx_timer_deactivate(&pStaDs->pmfSaQueryTimer);
1153 tx_timer_delete(&pStaDs->pmfSaQueryTimer);
1154 }
1155 }
1156 }
1157 }
1158#endif
1159
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 /// Cleanup cached scan list
1161 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001162#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1163 /// Cleanup cached scan list
1164 limReInitLfrScanResults(pMac);
1165#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001166
1167} /*** end limCleanupMlm() ***/
1168
1169
1170
1171/**
1172 * limCleanupLmm()
1173 *
1174 *FUNCTION:
1175 * This function is called to cleanup any resources
1176 * allocated by LMM sub-module.
1177 *
1178 *PARAMS:
1179 *
1180 *LOGIC:
1181 *
1182 *ASSUMPTIONS:
1183 * NA
1184 *
1185 *NOTE:
1186 * NA
1187 *
1188 * @param pMac Pointer to Global MAC structure
1189 * @return None
1190 */
1191
1192void
1193limCleanupLmm(tpAniSirGlobal pMac)
1194{
Jeff Johnson295189b2012-06-20 16:38:30 -07001195} /*** end limCleanupLmm() ***/
1196
1197
1198
1199/**
1200 * limIsAddrBC()
1201 *
1202 *FUNCTION:
1203 * This function is called in various places within LIM code
1204 * to determine whether passed MAC address is a broadcast or not
1205 *
1206 *LOGIC:
1207 *
1208 *ASSUMPTIONS:
1209 * NA
1210 *
1211 *NOTE:
1212 * NA
1213 *
1214 * @param macAddr Indicates MAC address that need to be determined
1215 * whether it is Broadcast address or not
1216 *
1217 * @return true if passed address is Broadcast address else false
1218 */
1219
1220tANI_U8
1221limIsAddrBC(tSirMacAddr macAddr)
1222{
1223 int i;
1224 for (i = 0; i < 6; i++)
1225 {
1226 if ((macAddr[i] & 0xFF) != 0xFF)
1227 return false;
1228 }
1229
1230 return true;
1231} /****** end limIsAddrBC() ******/
1232
1233
1234
1235/**
1236 * limIsGroupAddr()
1237 *
1238 *FUNCTION:
1239 * This function is called in various places within LIM code
1240 * to determine whether passed MAC address is a group address or not
1241 *
1242 *LOGIC:
1243 * If least significant bit of first octet of the MAC address is
1244 * set to 1, it is a Group address.
1245 *
1246 *ASSUMPTIONS:
1247 * NA
1248 *
1249 *NOTE:
1250 * NA
1251 *
1252 * @param macAddr Indicates MAC address that need to be determined
1253 * whether it is Group address or not
1254 *
1255 * @return true if passed address is Group address else false
1256 */
1257
1258tANI_U8
1259limIsGroupAddr(tSirMacAddr macAddr)
1260{
1261 if ((macAddr[0] & 0x01) == 0x01)
1262 return true;
1263 else
1264 return false;
1265} /****** end limIsGroupAddr() ******/
1266
1267/**
1268 * limPostMsgApiNoWait()
1269 *
1270 *FUNCTION:
1271 * This function is called from other thread while posting a
1272 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1273 *
1274 *LOGIC:
1275 * NA
1276 *
1277 *ASSUMPTIONS:
1278 * NA
1279 *
1280 *NOTE:
1281 * NA
1282 *
1283 * @param pMsg - Pointer to the Global MAC structure
1284 * @param pMsg - Pointer to the message structure
1285 * @return None
1286 */
1287
1288tANI_U32
1289limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1290{
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 limProcessMessages(pMac, pMsg);
1292 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001293} /*** end limPostMsgApiNoWait() ***/
1294
1295
1296
1297/**
1298 * limPrintMacAddr()
1299 *
1300 *FUNCTION:
1301 * This function is called to print passed MAC address
1302 * in : format.
1303 *
1304 *LOGIC:
1305 *
1306 *ASSUMPTIONS:
1307 * NA
1308 *
1309 *NOTE:
1310 * @param macAddr - MacAddr to be printed
1311 * @param logLevel - Loglevel to be used
1312 *
1313 * @return None.
1314 */
1315
1316void
1317limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1318{
1319 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001320 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001321} /****** end limPrintMacAddr() ******/
1322
1323
Jeff Johnson295189b2012-06-20 16:38:30 -07001324/*
1325 * limResetDeferredMsgQ()
1326 *
1327 *FUNCTION:
1328 * This function resets the deferred message queue parameters.
1329 *
1330 *PARAMS:
1331 * @param pMac - Pointer to Global MAC structure
1332 *
1333 *LOGIC:
1334 *
1335 *ASSUMPTIONS:
1336 * NA
1337 *
1338 *NOTE:
1339 * NA
1340 *
1341 *RETURNS:
1342 * None
1343 */
1344
1345void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1346{
1347 pMac->lim.gLimDeferredMsgQ.size =
1348 pMac->lim.gLimDeferredMsgQ.write =
1349 pMac->lim.gLimDeferredMsgQ.read = 0;
1350
1351}
1352
1353
1354#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1355#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1356
1357/*
1358 * limWriteDeferredMsgQ()
1359 *
1360 *FUNCTION:
1361 * This function queues up a deferred message for later processing on the
1362 * STA side.
1363 *
1364 *PARAMS:
1365 * @param pMac - Pointer to Global MAC structure
1366 * @param limMsg - a LIM message
1367 *
1368 *LOGIC:
1369 *
1370 *ASSUMPTIONS:
1371 * NA
1372 *
1373 *NOTE:
1374 * NA
1375 *
1376 *RETURNS:
1377 * None
1378 */
1379
1380tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1381{
1382 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001383 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1385 limMsg->type);)
1386
1387 /*
1388 ** check if the deferred message queue is full
1389 **/
1390 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1391 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001392 if(!(pMac->lim.deferredMsgCnt & 0xF))
1393 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001394 PELOGE(limLog(pMac, LOGE, FL("Deferred Message Queue is full. Msg:%d Messages Failed:%d"), limMsg->type, ++pMac->lim.deferredMsgCnt);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001395 }
1396 else
1397 {
1398 pMac->lim.deferredMsgCnt++;
1399 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 return TX_QUEUE_FULL;
1401 }
1402
1403 /*
1404 ** In the application, there should not be more than 1 message get
1405 ** queued up. If happens, flags a warning. In the future, this can
1406 ** happen.
1407 **/
1408 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1409 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001410 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 -07001411 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1412 limIsSystemInScanState(pMac),
1413 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1414 pMac->lim.gLimAddtsSent);)
1415 }
1416
1417 /*
1418 ** To prevent the deferred Q is full of management frames, only give them certain space
1419 **/
1420 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1421 {
1422 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1423 {
1424 tANI_U16 idx, count = 0;
1425 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1426 {
1427 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1428 {
1429 count++;
1430 }
1431 }
1432 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1433 {
1434 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001435 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 //Return error, caller knows what to do
1437 return TX_QUEUE_FULL;
1438 }
1439 }
1440 }
1441
1442 ++pMac->lim.gLimDeferredMsgQ.size;
1443
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001444 /* reset the count here since we are able to defer the message */
1445 if(pMac->lim.deferredMsgCnt != 0)
1446 {
1447 pMac->lim.deferredMsgCnt = 0;
1448 }
1449
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 /*
1451 ** if the write pointer hits the end of the queue, rewind it
1452 **/
1453 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1454 pMac->lim.gLimDeferredMsgQ.write = 0;
1455
1456 /*
1457 ** save the message to the queue and advanced the write pointer
1458 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301459 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1460 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 (tANI_U8 *)limMsg,
1462 sizeof(tSirMsgQ));
1463 return TX_SUCCESS;
1464
1465}
1466
1467/*
1468 * limReadDeferredMsgQ()
1469 *
1470 *FUNCTION:
1471 * This function dequeues a deferred message for processing on the
1472 * STA side.
1473 *
1474 *PARAMS:
1475 * @param pMac - Pointer to Global MAC structure
1476 *
1477 *LOGIC:
1478 *
1479 *ASSUMPTIONS:
1480 * NA
1481 *
1482 *NOTE:
1483 *
1484 *
1485 *RETURNS:
1486 * Returns the message at the head of the deferred message queue
1487 */
1488
1489tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1490{
1491 tSirMsgQ *msg;
1492
1493 /*
1494 ** check any messages left. If no, return
1495 **/
1496 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1497 return NULL;
1498
1499 /*
1500 ** decrement the queue size
1501 **/
1502 pMac->lim.gLimDeferredMsgQ.size--;
1503
1504 /*
1505 ** retrieve the message from the head of the queue
1506 **/
1507 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1508
1509 /*
1510 ** advance the read pointer
1511 **/
1512 pMac->lim.gLimDeferredMsgQ.read++;
1513
1514 /*
1515 ** if the read pointer hits the end of the queue, rewind it
1516 **/
1517 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1518 pMac->lim.gLimDeferredMsgQ.read = 0;
1519
1520 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001521 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1523 msg->type);)
1524
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001525 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 limIsSystemInScanState(pMac),
1527 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1528 pMac->lim.gLimAddtsSent);)
1529
1530 return(msg);
1531}
1532
1533tSirRetStatus
1534limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1535 tSirMsgQ *pMsg,
1536 tANI_U8 qType)
1537{
1538// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 SysProcessMmhMsg(pMac, pMsg);
1540 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001541}
1542
1543char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1544{
1545#ifdef FIXME_GEN6
1546
1547 if (type == SIR_MAC_MGMT_FRAME)
1548 {
1549 switch (subType)
1550 {
1551 case SIR_MAC_MGMT_ASSOC_REQ:
1552 return "MAC_MGMT_ASSOC_REQ";
1553 case SIR_MAC_MGMT_ASSOC_RSP:
1554 return "MAC_MGMT_ASSOC_RSP";
1555 case SIR_MAC_MGMT_REASSOC_REQ:
1556 return "MAC_MGMT_REASSOC_REQ";
1557 case SIR_MAC_MGMT_REASSOC_RSP:
1558 return "MAC_MGMT_REASSOC_RSP";
1559 case SIR_MAC_MGMT_PROBE_REQ:
1560 return "MAC_MGMT_PROBE_REQ";
1561 case SIR_MAC_MGMT_PROBE_RSP:
1562 return "MAC_MGMT_PROBE_RSP";
1563 case SIR_MAC_MGMT_BEACON:
1564 return "MAC_MGMT_BEACON";
1565 case SIR_MAC_MGMT_ATIM:
1566 return "MAC_MGMT_ATIM";
1567 case SIR_MAC_MGMT_DISASSOC:
1568 return "MAC_MGMT_DISASSOC";
1569 case SIR_MAC_MGMT_AUTH:
1570 return "MAC_MGMT_AUTH";
1571 case SIR_MAC_MGMT_DEAUTH:
1572 return "MAC_MGMT_DEAUTH";
1573 case SIR_MAC_MGMT_ACTION:
1574 return "MAC_MGMT_ACTION";
1575 case SIR_MAC_MGMT_RESERVED15:
1576 return "MAC_MGMT_RESERVED15";
1577 default:
1578 return "Unknown MGMT Frame";
1579 }
1580 }
1581
1582 else if (type == SIR_MAC_CTRL_FRAME)
1583 {
1584 switch (subType)
1585 {
1586 case SIR_MAC_CTRL_RR:
1587 return "MAC_CTRL_RR";
1588 case SIR_MAC_CTRL_BAR:
1589 return "MAC_CTRL_BAR";
1590 case SIR_MAC_CTRL_BA:
1591 return "MAC_CTRL_BA";
1592 case SIR_MAC_CTRL_PS_POLL:
1593 return "MAC_CTRL_PS_POLL";
1594 case SIR_MAC_CTRL_RTS:
1595 return "MAC_CTRL_RTS";
1596 case SIR_MAC_CTRL_CTS:
1597 return "MAC_CTRL_CTS";
1598 case SIR_MAC_CTRL_ACK:
1599 return "MAC_CTRL_ACK";
1600 case SIR_MAC_CTRL_CF_END:
1601 return "MAC_CTRL_CF_END";
1602 case SIR_MAC_CTRL_CF_END_ACK:
1603 return "MAC_CTRL_CF_END_ACK";
1604 default:
1605 return "Unknown CTRL Frame";
1606 }
1607 }
1608
1609 else if (type == SIR_MAC_DATA_FRAME)
1610 {
1611 switch (subType)
1612 {
1613 case SIR_MAC_DATA_DATA:
1614 return "MAC_DATA_DATA";
1615 case SIR_MAC_DATA_DATA_ACK:
1616 return "MAC_DATA_DATA_ACK";
1617 case SIR_MAC_DATA_DATA_POLL:
1618 return "MAC_DATA_DATA_POLL";
1619 case SIR_MAC_DATA_DATA_ACK_POLL:
1620 return "MAC_DATA_DATA_ACK_POLL";
1621 case SIR_MAC_DATA_NULL:
1622 return "MAC_DATA_NULL";
1623 case SIR_MAC_DATA_NULL_ACK:
1624 return "MAC_DATA_NULL_ACK";
1625 case SIR_MAC_DATA_NULL_POLL:
1626 return "MAC_DATA_NULL_POLL";
1627 case SIR_MAC_DATA_NULL_ACK_POLL:
1628 return "MAC_DATA_NULL_ACK_POLL";
1629 case SIR_MAC_DATA_QOS_DATA:
1630 return "MAC_DATA_QOS_DATA";
1631 case SIR_MAC_DATA_QOS_DATA_ACK:
1632 return "MAC_DATA_QOS_DATA_ACK";
1633 case SIR_MAC_DATA_QOS_DATA_POLL:
1634 return "MAC_DATA_QOS_DATA_POLL";
1635 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1636 return "MAC_DATA_QOS_DATA_ACK_POLL";
1637 case SIR_MAC_DATA_QOS_NULL:
1638 return "MAC_DATA_QOS_NULL";
1639 case SIR_MAC_DATA_QOS_NULL_ACK:
1640 return "MAC_DATA_QOS_NULL_ACK";
1641 case SIR_MAC_DATA_QOS_NULL_POLL:
1642 return "MAC_DATA_QOS_NULL_POLL";
1643 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1644 return "MAC_DATA_QOS_NULL_ACK_POLL";
1645 default:
1646 return "Unknown Data Frame";
1647 }
1648 }
1649 else
1650 return "Unknown";
1651#endif
1652return "";
1653}
1654
Jeff Johnson295189b2012-06-20 16:38:30 -07001655void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1656{
1657 int i;
1658 static int enable;
1659 tUpdateBeaconParams beaconParams;
1660
1661 tpPESession psessionEntry = limIsApSessionActive(pMac);
1662
1663 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001664 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001665 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001667 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301668
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301669 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001670 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001671
1672 beaconParams.paramChangeBitmap = 0;
1673 /*
1674 ** This is doing a 2 pass check. The first pass is to invalidate
1675 ** all the cache entries. The second pass is to decide whether to
1676 ** disable protection.
1677 **/
1678 if (!enable)
1679 {
1680
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001681 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 psessionEntry->gLimOlbcParams.numSta = 0;
1683 psessionEntry->gLimOverlap11gParams.numSta = 0;
1684 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1685 psessionEntry->gLimNonGfParams.numSta = 0;
1686 psessionEntry->gLimLsigTxopParams.numSta = 0;
1687
1688 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1689 pMac->lim.protStaOverlapCache[i].active = false;
1690
1691 enable = 1;
1692 }
1693 else
1694 {
1695
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001696 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 {
1698 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1699 {
1700 if (!psessionEntry->gLim11bParams.protectionEnabled)
1701 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001702 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1704 }
1705 }
1706 }
1707
1708 if (!psessionEntry->gLimOverlap11gParams.numSta)
1709 {
1710 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1711 {
1712 if (!psessionEntry->gLim11gParams.protectionEnabled)
1713 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001714 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1716 }
1717 }
1718 }
1719
1720 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1721 {
1722 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1723 {
1724 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1725 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001726 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1728 }
1729 }
1730 }
1731
1732 enable = 0;
1733 }
1734
1735 if(beaconParams.paramChangeBitmap)
1736 {
1737 schSetFixedBeaconFields(pMac,psessionEntry);
1738 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1739 }
1740
1741 // Start OLBC timer
1742 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001744 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 }
1746}
Jeff Johnson295189b2012-06-20 16:38:30 -07001747
1748/**
1749 * limIsNullSsid()
1750 *
1751 *FUNCTION:
1752 * This function checks if Ssid supplied is Null SSID
1753 *
1754 *
1755 *LOGIC:
1756 *
1757 *ASSUMPTIONS:
1758 * NA
1759 *
1760 *NOTE:
1761 * NA
1762 *
1763 * @param tSirMacSSid *
1764 *
1765 *
1766 * @return true if SSID is Null SSID else false
1767 */
1768
1769tANI_U8
1770limIsNullSsid( tSirMacSSid *pSsid )
1771{
1772 tANI_U8 fNullSsid = false;
1773 tANI_U32 SsidLength;
1774 tANI_U8 *pSsidStr;
1775
1776 do
1777 {
1778 if ( 0 == pSsid->length )
1779 {
1780 fNullSsid = true;
1781 break;
1782 }
1783
1784#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301785 /* If the first charactes is space and SSID length is 1
1786 * then consider it as NULL SSID*/
1787 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1788 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001789 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301790 fNullSsid = true;
1791 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 }
1793 else
1794 {
1795 /* check if all the charactes in SSID are NULL*/
1796 SsidLength = pSsid->length;
1797 pSsidStr = pSsid->ssId;
1798
1799 while ( SsidLength )
1800 {
1801 if( *pSsidStr )
1802 break;
1803
1804 pSsidStr++;
1805 SsidLength--;
1806 }
1807
1808 if( 0 == SsidLength )
1809 {
1810 fNullSsid = true;
1811 break;
1812 }
1813 }
1814 }
1815 while( 0 );
1816
1817 return fNullSsid;
1818} /****** end limIsNullSsid() ******/
1819
1820
1821
Jeff Johnson295189b2012-06-20 16:38:30 -07001822
1823/** -------------------------------------------------------------
1824\fn limUpdateProtStaParams
1825\brief updates protection related counters.
1826\param tpAniSirGlobal pMac
1827\param tSirMacAddr peerMacAddr
1828\param tLimProtStaCacheType protStaCacheType
1829\param tHalBitVal gfSupported
1830\param tHalBitVal lsigTxopSupported
1831\return None
1832 -------------------------------------------------------------*/
1833void
1834limUpdateProtStaParams(tpAniSirGlobal pMac,
1835tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1836tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1837tpPESession psessionEntry)
1838{
1839 tANI_U32 i;
1840
1841 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1842 limLog(pMac,LOG1, FL("Addr : "));
1843 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1844
1845 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1846 {
1847 if (psessionEntry->protStaCache[i].active)
1848 {
1849 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1850 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1851
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301852 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 psessionEntry->protStaCache[i].addr,
1854 peerMacAddr, sizeof(tSirMacAddr)))
1855 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001856 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 return;
1858 }
1859 }
1860 }
1861
1862 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1863 {
1864 if (!psessionEntry->protStaCache[i].active)
1865 break;
1866 }
1867
1868 if (i >= LIM_PROT_STA_CACHE_SIZE)
1869 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001870 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 return;
1872 }
1873
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301874 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 peerMacAddr,
1876 sizeof(tSirMacAddr));
1877
1878 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1879 psessionEntry->protStaCache[i].active = true;
1880 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1881 {
1882 psessionEntry->gLim11bParams.numSta++;
1883 limLog(pMac,LOG1, FL("11B, "));
1884 }
1885 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1886 {
1887 psessionEntry->gLim11gParams.numSta++;
1888 limLog(pMac,LOG1, FL("11G, "));
1889 }
1890 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1891 {
1892 psessionEntry->gLimHt20Params.numSta++;
1893 limLog(pMac,LOG1, FL("HT20, "));
1894 }
1895
1896 if(!gfSupported)
1897 {
1898 psessionEntry->gLimNonGfParams.numSta++;
1899 limLog(pMac,LOG1, FL("NonGf, "));
1900 }
1901 if(!lsigTxopSupported)
1902 {
1903 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001904 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 }
1906}// ---------------------------------------------------------------------
1907
1908/** -------------------------------------------------------------
1909\fn limDecideApProtection
1910\brief Decides all the protection related staiton coexistence and also sets
1911\ short preamble and short slot appropriately. This function will be called
1912\ when AP is ready to send assocRsp tp the station joining right now.
1913\param tpAniSirGlobal pMac
1914\param tSirMacAddr peerMacAddr
1915\return None
1916 -------------------------------------------------------------*/
1917void
1918limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1919{
1920 tANI_U16 tmpAid;
1921 tpDphHashNode pStaDs;
1922 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1923 tANI_U32 phyMode;
1924 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1925 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1926
1927 pBeaconParams->paramChangeBitmap = 0;
1928 // check whether to enable protection or not
1929 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1930 if(NULL == pStaDs)
1931 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301932 limLog(pMac, LOG1, FL("pStaDs is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 return;
1934 }
1935 limGetRfBand(pMac, &rfBand, psessionEntry);
1936 //if we are in 5 GHZ band
1937 if(SIR_BAND_5_GHZ == rfBand)
1938 {
1939 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1940 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001941 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 {
1943 //we are 11N and 11A station is joining.
1944 //protection from 11A required.
1945 if(false == pStaDs->mlmStaContext.htCapability)
1946 {
1947 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1948 return;
1949 }
1950 }
1951 }
1952 else if(SIR_BAND_2_4_GHZ== rfBand)
1953 {
1954 limGetPhyMode(pMac, &phyMode, psessionEntry);
1955
1956 //We are 11G. Check if we need protection from 11b Stations.
1957 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001958 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 {
1960
1961 if (pStaDs->erpEnabled== eHAL_CLEAR)
1962 {
1963 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1964 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001965 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1967 }
1968 }
1969
1970 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001971 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 {
1973 //check if we need protection from 11b station
1974 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1975 (!pStaDs->mlmStaContext.htCapability))
1976 {
1977 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1978 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001979 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1981 }
1982 //station being joined is non-11b and non-ht ==> 11g device
1983 else if(!pStaDs->mlmStaContext.htCapability)
1984 {
1985 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1986 //enable protection
1987 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1988 }
1989 //ERP mode is enabled for the latest station joined
1990 //latest station joined is HT capable
1991 //This case is being handled in common code (commn between both the bands) below.
1992 }
1993 }
1994
1995 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001996 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 (true == pStaDs->mlmStaContext.htCapability))
1998 {
1999 if(!pStaDs->htGreenfield)
2000 {
2001 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
2002 gfSupported = eHAL_CLEAR;
2003 }
2004 //Station joining is HT 20Mhz
2005 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
2006 {
2007 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
2008 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
2009 }
2010 //Station joining does not support LSIG TXOP Protection
2011 if(!pStaDs->htLsigTXOPProtection)
2012 {
2013 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
2014 lsigTxopSupported = eHAL_CLEAR;
2015 }
2016 }
2017
2018 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
2019 gfSupported, lsigTxopSupported, psessionEntry);
2020
2021 return;
2022}
Jeff Johnson295189b2012-06-20 16:38:30 -07002023
2024
2025/** -------------------------------------------------------------
2026\fn limEnableOverlap11gProtection
2027\brief wrapper function for setting overlap 11g protection.
2028\param tpAniSirGlobal pMac
2029\param tpUpdateBeaconParams pBeaconParams
2030\param tpSirMacMgmtHdr pMh
2031\return None
2032 -------------------------------------------------------------*/
2033void
2034limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2035tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2036{
2037 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2038
2039 if (psessionEntry->gLimOlbcParams.numSta &&
2040 !psessionEntry->gLimOlbcParams.protectionEnabled)
2041 {
2042 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002043 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2045 }
2046}
2047
2048
2049/** -------------------------------------------------------------
2050\fn limUpdateShortPreamble
2051\brief Updates short preamble if needed when a new station joins.
2052\param tpAniSirGlobal pMac
2053\param tSirMacAddr peerMacAddr
2054\param tpUpdateBeaconParams pBeaconParams
2055\return None
2056 -------------------------------------------------------------*/
2057void
2058limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2059 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2060{
2061 tANI_U16 tmpAid;
2062 tpDphHashNode pStaDs;
2063 tANI_U32 phyMode;
2064 tANI_U16 i;
2065
2066 // check whether to enable protection or not
2067 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2068
2069 limGetPhyMode(pMac, &phyMode, psessionEntry);
2070
2071 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2072
2073 {
2074 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2075 {
2076 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2077 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2078
2079 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2080 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2082 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2083 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302084 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2086 peerMacAddr, sizeof(tSirMacAddr)))
2087 return;
2088 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 {
2090 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2091 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302092 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2094 peerMacAddr, sizeof(tSirMacAddr)))
2095 return;
2096 }
2097 }
2098 }
2099
2100
2101 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2102 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2104 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2105 break;
2106 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 {
2108 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2109 break;
2110 }
2111 }
2112
2113 if (i >= LIM_PROT_STA_CACHE_SIZE)
2114 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2116 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2117 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2118 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2119 return;
2120 }
2121 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 {
2123 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2124 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2125 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2126 return;
2127 }
2128
2129 }
2130
2131
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302132 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2133 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 peerMacAddr, sizeof(tSirMacAddr));
2135 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2136 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2137 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302139 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 peerMacAddr, sizeof(tSirMacAddr));
2141 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2142 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2143 }
2144
2145
2146 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002147 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002150 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 }
2152 }
2153}
2154
2155/** -------------------------------------------------------------
2156\fn limUpdateShortSlotTime
2157\brief Updates short slot time if needed when a new station joins.
2158\param tpAniSirGlobal pMac
2159\param tSirMacAddr peerMacAddr
2160\param tpUpdateBeaconParams pBeaconParams
2161\return None
2162 -------------------------------------------------------------*/
2163
2164void
2165limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2166 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2167{
2168 tANI_U16 tmpAid;
2169 tpDphHashNode pStaDs;
2170 tANI_U32 phyMode;
2171 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 tANI_U16 i;
2173
2174 // check whether to enable protection or not
2175 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2176 limGetPhyMode(pMac, &phyMode, psessionEntry);
2177
Jeff Johnsone7245742012-09-05 17:12:55 -07002178 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2179 * be always 1 and in 11b case, it should be always 0
2180 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2182 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002183 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2184 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2185 * it in limDecideShortSlot
2186 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2188 {
2189 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2190 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2191 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2192 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2194 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2195 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302196 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2198 peerMacAddr, sizeof(tSirMacAddr)))
2199 return;
2200 }
2201 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 {
2203 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2204 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302205 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2207 peerMacAddr, sizeof(tSirMacAddr)))
2208 return;
2209 }
2210 }
2211 }
2212
2213 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2214 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2216 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2217 break;
2218 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 {
2220 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2221 break;
2222 }
2223 }
2224
2225 if (i >= LIM_PROT_STA_CACHE_SIZE)
2226 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2228 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2229 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2230 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2231 return;
2232 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 {
2234 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2235 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2236 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2237 return;
2238 }
2239 }
2240
2241
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302243 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 peerMacAddr, sizeof(tSirMacAddr));
2245 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2246 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2247 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302249 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 peerMacAddr, sizeof(tSirMacAddr));
2251 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2252 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2253 }
2254 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2255
Jeff Johnsone7245742012-09-05 17:12:55 -07002256 /* 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
2257 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2258 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002260 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
2262 // enable long slot time
2263 pBeaconParams->fShortSlotTime = false;
2264 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002265 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002266 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 }
2268 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002270 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 // enable long slot time
2273 pBeaconParams->fShortSlotTime = false;
2274 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002275 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002276 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 }
2278 }
2279 }
2280 }
2281}
2282
Jeff Johnson295189b2012-06-20 16:38:30 -07002283
2284/** -------------------------------------------------------------
2285\fn limDecideStaProtectionOnAssoc
2286\brief Decide protection related settings on Sta while association.
2287\param tpAniSirGlobal pMac
2288\param tpSchBeaconStruct pBeaconStruct
2289\return None
2290 -------------------------------------------------------------*/
2291void
2292limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2293 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2294{
2295 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2296 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2297
2298 limGetRfBand(pMac, &rfBand, psessionEntry);
2299 limGetPhyMode(pMac, &phyMode, psessionEntry);
2300
2301 if(SIR_BAND_5_GHZ == rfBand)
2302 {
2303 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2304 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2305 {
2306 if(pMac->lim.cfgProtection.fromlla)
2307 psessionEntry->beaconParams.llaCoexist = true;
2308 }
2309 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2310 {
2311 if(pMac->lim.cfgProtection.ht20)
2312 psessionEntry->beaconParams.ht20Coexist = true;
2313 }
2314
2315 }
2316 else if(SIR_BAND_2_4_GHZ == rfBand)
2317 {
2318 //spec 7.3.2.13
2319 //UseProtection will be set when nonERP STA is associated.
2320 //NonERPPresent bit will be set when:
2321 //--nonERP Sta is associated OR
2322 //--nonERP Sta exists in overlapping BSS
2323 //when useProtection is not set then protection from nonERP stations is optional.
2324
2325 //CFG protection from 11b is enabled and
2326 //11B device in the BSS
2327 /* TODO, This is not sessionized */
2328 if (phyMode != WNI_CFG_PHY_MODE_11B)
2329 {
2330 if (pMac->lim.cfgProtection.fromllb &&
2331 pBeaconStruct->erpPresent &&
2332 (pBeaconStruct->erpIEInfo.useProtection ||
2333 pBeaconStruct->erpIEInfo.nonErpPresent))
2334 {
2335 psessionEntry->beaconParams.llbCoexist = true;
2336 }
2337 //AP has no 11b station associated.
2338 else
2339 {
2340 psessionEntry->beaconParams.llbCoexist = false;
2341 }
2342 }
2343 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002344 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 (pBeaconStruct->HTInfo.present))
2346 {
2347 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2348
2349 //Obss Non HT STA present mode
2350 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2351
2352
2353 //CFG protection from 11G is enabled and
2354 //our AP has at least one 11G station associated.
2355 if(pMac->lim.cfgProtection.fromllg &&
2356 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2357 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2358 (!psessionEntry->beaconParams.llbCoexist))
2359 {
2360 if(pMac->lim.cfgProtection.fromllg)
2361 psessionEntry->beaconParams.llgCoexist = true;
2362 }
2363
2364 //AP has only HT stations associated and at least one station is HT 20
2365 //disable protection from any non-HT devices.
2366 //decision for disabling protection from 11b has already been taken above.
2367 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2368 {
2369 //Disable protection from 11G station.
2370 psessionEntry->beaconParams.llgCoexist = false;
2371 //CFG protection from HT 20 is enabled.
2372 if(pMac->lim.cfgProtection.ht20)
2373 psessionEntry->beaconParams.ht20Coexist = true;
2374 }
2375 //Disable protection from non-HT and HT20 devices.
2376 //decision for disabling protection from 11b has already been taken above.
2377 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2378 {
2379 psessionEntry->beaconParams.llgCoexist = false;
2380 psessionEntry->beaconParams.ht20Coexist = false;
2381 }
2382
2383 }
2384 }
2385
2386 //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 -07002387 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 (pBeaconStruct->HTInfo.present))
2389 {
2390 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2391 psessionEntry->beaconParams.fRIFSMode =
2392 ( tANI_U8 ) htInfo.rifsMode;
2393 psessionEntry->beaconParams.llnNonGFCoexist =
2394 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2395 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2396 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2397 }
2398}
2399
2400
2401/** -------------------------------------------------------------
2402\fn limDecideStaProtection
2403\brief Decides protection related settings on Sta while processing beacon.
2404\param tpAniSirGlobal pMac
2405\param tpUpdateBeaconParams pBeaconParams
2406\return None
2407 -------------------------------------------------------------*/
2408void
2409limDecideStaProtection(tpAniSirGlobal pMac,
2410 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2411{
2412
2413 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2414 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2415
2416 limGetRfBand(pMac, &rfBand, psessionEntry);
2417 limGetPhyMode(pMac, &phyMode, psessionEntry);
2418
2419 if(SIR_BAND_5_GHZ == rfBand)
2420 {
2421 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002422 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002423 (pBeaconStruct->HTInfo.present))
2424 {
2425 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2426 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2427 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2428 {
2429 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2430 }
2431 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2432 //protection from HT20 if needed.
2433 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2434 {
2435 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2436 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2437 }
2438 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2439 {
2440 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2441 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2442 }
2443 }
2444 }
2445 else if(SIR_BAND_2_4_GHZ == rfBand)
2446 {
2447 /* spec 7.3.2.13
2448 * UseProtection will be set when nonERP STA is associated.
2449 * NonERPPresent bit will be set when:
2450 * --nonERP Sta is associated OR
2451 * --nonERP Sta exists in overlapping BSS
2452 * when useProtection is not set then protection from nonERP stations is optional.
2453 */
2454
2455 if (phyMode != WNI_CFG_PHY_MODE_11B)
2456 {
2457 if (pBeaconStruct->erpPresent &&
2458 (pBeaconStruct->erpIEInfo.useProtection ||
2459 pBeaconStruct->erpIEInfo.nonErpPresent))
2460 {
2461 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2462 }
2463 //AP has no 11b station associated.
2464 else
2465 {
2466 //disable protection from 11b station
2467 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2468 }
2469 }
2470
2471 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002472 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002473 (pBeaconStruct->HTInfo.present))
2474 {
2475
2476 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2477 //AP has at least one 11G station associated.
2478 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2479 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2480 (!psessionEntry->beaconParams.llbCoexist))
2481 {
2482 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2483
2484 }
2485
2486 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2487 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2488 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2489 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2490 {
2491 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2492
2493 //AP has only HT stations associated and at least one station is HT 20
2494 //disable protection from any non-HT devices.
2495 //decision for disabling protection from 11b has already been taken above.
2496 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2497 {
2498 //Disable protection from 11G station.
2499 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2500
2501 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2502 }
2503 //Disable protection from non-HT and HT20 devices.
2504 //decision for disabling protection from 11b has already been taken above.
2505 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2506 {
2507 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2508 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2509
2510 }
2511 }
2512 }
2513 }
2514
2515 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002516 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 (pBeaconStruct->HTInfo.present))
2518 {
2519 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2520 //Check for changes in protection related factors other than HT operating mode.
2521 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2522 if ( psessionEntry->beaconParams.fRIFSMode !=
2523 ( tANI_U8 ) htInfo.rifsMode )
2524 {
2525 pBeaconParams->fRIFSMode =
2526 psessionEntry->beaconParams.fRIFSMode =
2527 ( tANI_U8 ) htInfo.rifsMode;
2528 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2529 }
2530
2531 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2532 htInfo.nonGFDevicesPresent )
2533 {
2534 pBeaconParams->llnNonGFCoexist =
2535 psessionEntry->beaconParams.llnNonGFCoexist =
2536 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2537 pBeaconParams->paramChangeBitmap |=
2538 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2539 }
2540
2541 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2542 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2543 {
2544 pBeaconParams->fLsigTXOPProtectionFullSupport =
2545 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2546 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2547 pBeaconParams->paramChangeBitmap |=
2548 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2549 }
2550
2551 // For Station just update the global lim variable, no need to send message to HAL
2552 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2553 //stations in overlapping BSS.
2554 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2555 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2556
2557 }
2558}
2559
2560
2561/**
2562 * limProcessChannelSwitchTimeout()
2563 *
2564 *FUNCTION:
2565 * This function is invoked when Channel Switch Timer expires at
2566 * the STA. Now, STA must stop traffic, and then change/disable
2567 * primary or secondary channel.
2568 *
2569 *
2570 *NOTE:
2571 * @param pMac - Pointer to Global MAC structure
2572 * @return None
2573 */
2574void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2575{
2576 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002577 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002578
2579 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2580 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002581 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 return;
2583 }
2584
2585 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2586 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002587 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 -07002588 return;
2589 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002590 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 /*
2592 * This potentially can create issues if the function tries to set
2593 * channel while device is in power-save, hence putting an extra check
2594 * to verify if the device is in power-save or not
2595 */
2596 if(!limIsSystemInActiveState(pMac))
2597 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002598 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 return;
2600 }
2601
2602 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002603 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002604
2605 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002606 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002607
2608 /* Check if the AP is switching to a channel that we support.
2609 * Else, just don't bother to switch. Indicate HDD to look for a
2610 * better AP to associate
2611 */
2612 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2613 {
2614 /* We need to restore pre-channelSwitch state on the STA */
2615 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2616 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002617 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 return;
2619 }
2620
2621 /* If the channel-list that AP is asking us to switch is invalid,
2622 * then we cannot switch the channel. Just disassociate from AP.
2623 * We will find a better AP !!!
2624 */
2625 limTearDownLinkWithAp(pMac,
2626 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2627 eSIR_MAC_UNSPEC_FAILURE_REASON);
2628 return;
2629 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002630 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2631 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002632 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 {
2634 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002635 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2636 if ( isLimSessionOffChannel(pMac,
2637 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2638 {
2639 limSuspendLink(pMac,
2640 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2641 limProcessChannelSwitchSuspendLink,
2642 (tANI_U32*)psessionEntry );
2643 }
2644 else
2645 {
2646 limProcessChannelSwitchSuspendLink(pMac,
2647 eHAL_STATUS_SUCCESS,
2648 (tANI_U32*)psessionEntry);
2649 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 break;
2651
2652 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002653 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002654 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002656 psessionEntry->gLimChannelSwitch.secondarySubBand);
2657 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 case eLIM_CHANNEL_SWITCH_IDLE:
2660 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002661 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2663 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002664 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002665 }
2666 return; /* Please note, this is 'return' and not 'break' */
2667 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002668}
Jeff Johnson295189b2012-06-20 16:38:30 -07002669
2670/**
2671 * limUpdateChannelSwitch()
2672 *
2673 *FUNCTION:
2674 * This function is invoked whenever Station receives
2675 * either 802.11h channel switch IE or airgo proprietary
2676 * channel switch IE.
2677 *
2678 *NOTE:
2679 * @param pMac - Pointer to Global MAC structure
2680 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2681 * @param psessionentry
2682 */
2683void
2684limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2685{
2686
2687 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2689 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002690#ifdef WLAN_FEATURE_11AC
2691 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2692#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002693
Jeff Johnsone7245742012-09-05 17:12:55 -07002694 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002695
2696 /* STA either received proprietary channel switch IE or 802.11h
2697 * standard channel switch IE.
2698 */
2699 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2700 {
2701 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2702
2703 /* Add logic to determine which change this is: */
2704 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002705 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2706 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2707 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2708 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2709 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002710 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 }
2713 else
2714 {
2715 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002716 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2717 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2718 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002720 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002721#ifdef WLAN_FEATURE_11AC
2722 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2723 if(pBeacon->WiderBWChanSwitchAnnPresent)
2724 {
2725 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2726 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2727 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2728 }
2729#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002730
2731 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002732 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2733 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002734
2735 /* Do not bother to look and operate on extended channel switch element
2736 * if our own channel-bonding state is not enabled
2737 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002738 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002739 {
2740 if (pBeacon->extChannelSwitchPresent)
2741 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002742 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2743 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002745 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2746 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002748#ifdef WLAN_FEATURE_11AC
2749 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2750 {
2751 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2752 {
2753 if(pBeacon->extChannelSwitchPresent)
2754 {
2755 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2756 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2757 {
2758 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2759 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2760 psessionEntry->gLimChannelSwitch.primaryChannel,
2761 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2762 pWiderChnlSwitch->newCenterChanFreq0,
2763 psessionEntry);
2764 }
2765 }
2766 }
2767 }
2768#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002769 }
2770 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002771 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002772
2773
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2775 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002776 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 }
2778
2779 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002780 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 psessionEntry->peSessionId,
2782 psessionEntry->gLimChannelSwitch.primaryChannel,
2783 psessionEntry->gLimChannelSwitch.secondarySubBand,
2784 psessionEntry->gLimChannelSwitch.switchCount,
2785 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 return;
2787}
2788
2789/**
2790 * limCancelDot11hChannelSwitch
2791 *
2792 *FUNCTION:
2793 * This function is called when STA does not send updated channel-swith IE
2794 * after indicating channel-switch start. This will cancel the channel-swith
2795 * timer which is already running.
2796 *
2797 *LOGIC:
2798 *
2799 *ASSUMPTIONS:
2800 *
2801 *NOTE:
2802 *
2803 * @param pMac - Pointer to Global MAC structure
2804 *
2805 * @return None
2806 */
2807void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2808{
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2810 return;
2811
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002812 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002813 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002814
2815 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2816 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002817 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 }
2819
2820 /* We need to restore pre-channelSwitch state on the STA */
2821 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2822 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002823 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002824
2825 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002826}
2827
2828/**----------------------------------------------
2829\fn limCancelDot11hQuiet
2830\brief Cancel the quieting on Station if latest
2831 beacon doesn't contain quiet IE in it.
2832
2833\param pMac
2834\return NONE
2835-----------------------------------------------*/
2836void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2837{
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2839 return;
2840
Jeff Johnsone7245742012-09-05 17:12:55 -07002841 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002843 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2845 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002846 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 }
2848 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002849 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002851 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2853 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002854 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 }
2856 /**
2857 * If the channel switch is already running in silent mode, dont resume the
2858 * transmission. Channel switch timer when timeout, transmission will be resumed.
2859 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002860 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2861 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 {
2863 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002864 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 }
2866 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002867 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002868}
2869
2870/**
2871 * limProcessQuietTimeout
2872 *
2873 * FUNCTION:
2874 * This function is active only on the STA.
2875 * Handles SIR_LIM_QUIET_TIMEOUT
2876 *
2877 * LOGIC:
2878 * This timeout can occur under only one circumstance:
2879 *
2880 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2881 * This indicates that the timeout "interval" has
2882 * expired. This is a trigger for the STA to now
2883 * shut-off Tx/Rx for the specified gLimQuietDuration
2884 * -> The TIMER object gLimQuietBssTimer is
2885 * activated
2886 * -> With timeout = gLimQuietDuration
2887 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2888 *
2889 * ASSUMPTIONS:
2890 * Using two TIMER objects -
2891 * gLimQuietTimer & gLimQuietBssTimer
2892 *
2893 * NOTE:
2894 *
2895 * @param pMac - Pointer to Global MAC structure
2896 *
2897 * @return None
2898 */
2899void limProcessQuietTimeout(tpAniSirGlobal pMac)
2900{
Jeff Johnson295189b2012-06-20 16:38:30 -07002901 //fetch the sessionEntry based on the sessionId
2902 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002903 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002904
Jeff Johnsone7245742012-09-05 17:12:55 -07002905 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002907 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 return;
2909 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002910
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302911 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002912 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 {
2914 case eLIM_QUIET_BEGIN:
2915 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002916 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2917 if (TX_SUCCESS !=
2918 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2919 {
2920 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002921 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002922 }
2923
2924 // gLimQuietDuration appears to be in units of ticks
2925 // Use it as is
2926 if (TX_SUCCESS !=
2927 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2928 psessionEntry->gLimSpecMgmt.quietDuration,
2929 0))
2930 {
2931 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002932 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002933 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002934 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002935#ifdef GEN6_TODO
2936 /* revisit this piece of code to assign the appropriate sessionId below
2937 * priority - HIGH
2938 */
2939 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2940#endif
2941 if( TX_SUCCESS !=
2942 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2943 {
2944 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002945 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002946 }
2947 else
2948 {
2949 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002950 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002951
2952 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2953 /* print message, otherwise, stop data traffic and stay quiet */
2954 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2955 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2956 {
2957 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002958 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 }
2960 else
2961 {
2962 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2963 /* freeze the transmission */
2964 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2965
2966 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002967 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002968 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 }
2970 }
2971 break;
2972
2973 case eLIM_QUIET_RUNNING:
2974 case eLIM_QUIET_INIT:
2975 case eLIM_QUIET_END:
2976 default:
2977 //
2978 // As of now, nothing to be done
2979 //
2980 break;
2981 }
2982}
2983
2984/**
2985 * limProcessQuietBssTimeout
2986 *
2987 * FUNCTION:
2988 * This function is active on the AP and STA.
2989 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2990 *
2991 * LOGIC:
2992 * On the AP -
2993 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2994 * an indication for the AP to START sending out the
2995 * Quiet BSS IE.
2996 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2997 * the 11H spec
2998 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2999 * a Proprietary IE. This will be understood by all the
3000 * TITAN STA's
3001 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
3002 * initiate the SCH to include the Quiet BSS IE in all
3003 * its subsequent Beacons/PR's.
3004 * The Quiet BSS IE will be included in all the Beacons
3005 * & PR's until the next DTIM period
3006 *
3007 * On the STA -
3008 * When gLimQuietState = eLIM_QUIET_RUNNING
3009 * This indicates that the STA was successfully shut-off
3010 * for the specified gLimQuietDuration. This is a trigger
3011 * for the STA to now resume data traffic.
3012 * -> gLimQuietState is set to eLIM_QUIET_INIT
3013 *
3014 * ASSUMPTIONS:
3015 *
3016 * NOTE:
3017 *
3018 * @param pMac - Pointer to Global MAC structure
3019 *
3020 * @return None
3021 */
3022void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
3023{
Jeff Johnsone7245742012-09-05 17:12:55 -07003024 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07003025
Jeff Johnsone7245742012-09-05 17:12:55 -07003026 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003028 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 return;
3030 }
3031
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303032 limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);
Jeff Johnsone7245742012-09-05 17:12:55 -07003033 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003035 }
3036 else
3037 {
3038 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003039 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 {
3041 case eLIM_QUIET_RUNNING:
3042 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003043 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003044
3045 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3046 {
3047 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003048 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3049 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 {
3051 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003052 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 }
3054
3055 /* Reset status flag */
3056 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3057 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3058
3059 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003060 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 }
3062 else
3063 {
3064 //
3065 // Nothing specific to be done in this case
3066 // A background scan that was triggered during
3067 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3068 //
3069 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003070 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 }
3072 break;
3073
3074 case eLIM_QUIET_INIT:
3075 case eLIM_QUIET_BEGIN:
3076 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003077 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 /* If the quiet period has ended, then resume the frame transmission */
3079 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003080 limRestorePreQuietState(pMac, psessionEntry);
3081 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 break;
3083
3084 default:
3085 //
3086 // As of now, nothing to be done
3087 //
3088 break;
3089 }
3090 }
3091}
Jeff Johnson295189b2012-06-20 16:38:30 -07003092/**
3093 * limProcessWPSOverlapTimeout
3094 *
3095 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3096 *
3097 * LOGIC:
3098 *
3099 * ASSUMPTIONS:
3100 *
3101 * NOTE:
3102 *
3103 * @param pMac - Pointer to Global MAC structure
3104 *
3105 * @return None
3106 */
3107#if 0
3108void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3109{
3110
3111 tpPESession psessionEntry;
3112 tANI_U32 sessionId;
3113
3114 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003116 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 }
3118
3119 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3120
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003121 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003122
3123 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3124 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003125 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 return;
3127 }
3128
3129 limWPSPBCTimeout(pMac, psessionEntry);
3130}
3131#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003132
Jeff Johnson295189b2012-06-20 16:38:30 -07003133/**----------------------------------------------
3134\fn limStartQuietTimer
3135\brief Starts the quiet timer.
3136
3137\param pMac
3138\return NONE
3139-----------------------------------------------*/
3140void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3141{
3142 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303143 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003144
3145 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003146 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 return;
3148 }
3149
Jeff Johnson295189b2012-06-20 16:38:30 -07003150
3151 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3152 return;
3153 // First, de-activate Timer, if its already active
3154 limCancelDot11hQuiet(pMac, psessionEntry);
3155
Jeff Johnsone7245742012-09-05 17:12:55 -07003156 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3157 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3158 {
3159 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003160 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003161 }
3162
3163 // Set the NEW timeout value, in ticks
3164 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3165 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3166 {
3167 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003168 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003169 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003170
3171 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3172 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3173 {
3174 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003175 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003176 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003177
Jeff Johnsone7245742012-09-05 17:12:55 -07003178 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 return;
3180 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003181}
3182
Jeff Johnson295189b2012-06-20 16:38:30 -07003183
3184/** ------------------------------------------------------------------------ **/
3185/**
3186 * keep track of the number of ANI peers associated in the BSS
3187 * For the first and last ANI peer, we have to update EDCA params as needed
3188 *
3189 * When the first ANI peer joins the BSS, we notify SCH
3190 * When the last ANI peer leaves the BSS, we notfiy SCH
3191 */
3192void
3193limUtilCountStaAdd(
3194 tpAniSirGlobal pMac,
3195 tpDphHashNode pSta,
3196 tpPESession psessionEntry)
3197{
3198
3199 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3200 return;
3201
3202 pSta->fAniCount = 1;
3203
3204 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3205 return;
3206
3207 // get here only if this is the first ANI peer in the BSS
3208 schEdcaProfileUpdate(pMac, psessionEntry);
3209}
3210
3211void
3212limUtilCountStaDel(
3213 tpAniSirGlobal pMac,
3214 tpDphHashNode pSta,
3215 tpPESession psessionEntry)
3216{
3217
3218 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3219 return;
3220
3221 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3222 * then go ahead and update the count and profiles. This ensures
3223 * that the "number of ani station" count is properly incremented/decremented.
3224 */
3225 if (pSta->valid == 1)
3226 return;
3227
3228 pSta->fAniCount = 0;
3229
3230 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3231 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003232 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003233 pMac->lim.gLimNumOfAniSTAs);
3234 return;
3235 }
3236
3237 pMac->lim.gLimNumOfAniSTAs--;
3238
3239 if (pMac->lim.gLimNumOfAniSTAs != 0)
3240 return;
3241
3242 // get here only if this is the last ANI peer in the BSS
3243 schEdcaProfileUpdate(pMac, psessionEntry);
3244}
3245
Jeff Johnson295189b2012-06-20 16:38:30 -07003246/**
3247 * limSwitchChannelCback()
3248 *
3249 *FUNCTION:
3250 * This is the callback function registered while requesting to switch channel
3251 * after AP indicates a channel switch for spectrum management (11h).
3252 *
3253 *NOTE:
3254 * @param pMac Pointer to Global MAC structure
3255 * @param status Status of channel switch request
3256 * @param data User data
3257 * @param psessionEntry Session information
3258 * @return NONE
3259 */
3260void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3261 tANI_U32 *data, tpPESession psessionEntry)
3262{
3263 tSirMsgQ mmhMsg = {0};
3264 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3265
Jeff Johnson295189b2012-06-20 16:38:30 -07003266 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3267
3268 /* We need to restore pre-channelSwitch state on the STA */
3269 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3270 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003271 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 return;
3273 }
3274
3275 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303276 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3277 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003279 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 return;
3281 }
3282
3283 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3284 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003285 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3287 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303288 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3290 mmhMsg.bodyval = 0;
3291
Jeff Johnsone7245742012-09-05 17:12:55 -07003292 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003293
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003295}
3296
3297/**
3298 * limSwitchPrimaryChannel()
3299 *
3300 *FUNCTION:
3301 * This function changes the current operating channel
3302 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3303 *
3304 *NOTE:
3305 * @param pMac Pointer to Global MAC structure
3306 * @param newChannel new chnannel ID
3307 * @return NONE
3308 */
3309void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3310{
3311#if !defined WLAN_FEATURE_VOWIFI
3312 tANI_U32 localPwrConstraint;
3313#endif
3314
Abhishek Singh127a8442014-12-15 17:31:27 +05303315 limLog(pMac, LOG1, FL(" old chnl %d --> new chnl %d "),
3316 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003317 psessionEntry->currentReqChannel = newChannel;
3318 psessionEntry->limRFBand = limGetRFBand(newChannel);
3319
3320 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3321
3322 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3323 pMac->lim.gpchangeChannelData = NULL;
3324
3325#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003326 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3328#else
3329 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3330 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003331 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 return;
3333 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003334 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3336#endif
3337 return;
3338}
3339
3340/**
3341 * limSwitchPrimarySecondaryChannel()
3342 *
3343 *FUNCTION:
3344 * This function changes the primary and secondary channel.
3345 * If 11h is enabled and user provides a "new channel ID"
3346 * that is different from the current operating channel,
3347 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3348 * assign notify LIM of such change.
3349 *
3350 *NOTE:
3351 * @param pMac Pointer to Global MAC structure
3352 * @param newChannel New chnannel ID (or current channel ID)
3353 * @param subband CB secondary info:
3354 * - eANI_CB_SECONDARY_NONE
3355 * - eANI_CB_SECONDARY_UP
3356 * - eANI_CB_SECONDARY_DOWN
3357 * @return NONE
3358 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003359void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003360{
3361#if !defined WLAN_FEATURE_VOWIFI
3362 tANI_U32 localPwrConstraint;
3363#endif
3364
Jeff Johnson295189b2012-06-20 16:38:30 -07003365#if !defined WLAN_FEATURE_VOWIFI
3366 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003367 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 return;
3369 }
3370#endif
Abhishek Singh27924ba2014-11-18 13:11:11 +05303371 /* Assign the callback to resume TX once channel is changed.
3372 */
3373 psessionEntry->currentReqChannel = newChannel;
3374 psessionEntry->limRFBand = limGetRFBand(newChannel);
3375
3376 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3377
3378 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3379 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003380
Jeff Johnson295189b2012-06-20 16:38:30 -07003381#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003382 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003383#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003384 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003385#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003386
Jeff Johnsone7245742012-09-05 17:12:55 -07003387 // Store the new primary and secondary channel in session entries if different
3388 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 {
3390 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003391 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 psessionEntry->currentOperChannel = newChannel;
3394 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003395 if (psessionEntry->htSecondaryChannelOffset != subband)
3396 {
3397 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003398 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 psessionEntry->htSecondaryChannelOffset, subband);
3400 psessionEntry->htSecondaryChannelOffset = subband;
3401 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3402 {
3403 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3404 }
3405 else
3406 {
3407 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3408 }
3409 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003411
3412 return;
3413}
3414
3415
3416/**
3417 * limActiveScanAllowed()
3418 *
3419 *FUNCTION:
3420 * Checks if active scans are permitted on the given channel
3421 *
3422 *LOGIC:
3423 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3424 * Need to check if the channelNum matches, then depending on the corresponding
3425 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3426 *
3427 *ASSUMPTIONS:
3428 *
3429 *NOTE:
3430 *
3431 * @param pMac Pointer to Global MAC structure
3432 * @param channelNum channel number
3433 * @return None
3434 */
3435
3436tANI_U8 limActiveScanAllowed(
3437 tpAniSirGlobal pMac,
3438 tANI_U8 channelNum)
3439{
3440 tANI_U32 i;
3441 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3442 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3443 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3444 != eSIR_SUCCESS)
3445 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003446 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 return false;
3448 }
3449
3450 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3451 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003452 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 len);
3454 return false;
3455 }
3456
3457 for (i=0; (i+1) < len; i+=2)
3458 {
3459 if (channelPair[i] == channelNum)
3460 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3461 }
3462 return false;
3463}
3464
3465/**
3466 * limTriggerBackgroundScanDuringQuietBss()
3467 *
3468 *FUNCTION:
3469 * This function is applicable to the STA only.
3470 * This function is called by limProcessQuietTimeout(),
3471 * when it is time to honor the Quiet BSS IE from the AP.
3472 *
3473 *LOGIC:
3474 * If 11H is enabled:
3475 * We cannot trigger a background scan. The STA needs to
3476 * shut-off Tx/Rx.
3477 * If 11 is not enabled:
3478 * Determine if the next channel that we are going to
3479 * scan is NOT the same channel (or not) on which the
3480 * Quiet BSS was requested.
3481 * If yes, then we cannot trigger a background scan on
3482 * this channel. Return with a false.
3483 * If no, then trigger a background scan. Return with
3484 * a true.
3485 *
3486 *ASSUMPTIONS:
3487 *
3488 *NOTE:
3489 * This API is redundant if the existing API,
3490 * limTriggerBackgroundScan(), were to return a valid
3491 * response instead of returning void.
3492 * If possible, try to revisit this API
3493 *
3494 * @param pMac Pointer to Global MAC structure
3495 * @return eSIR_TRUE, if a background scan was attempted
3496 * eSIR_FALSE, if not
3497 */
3498tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3499{
3500 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003501
3502
3503
3504 //TBD-RAJESH HOW TO GET sessionEntry?????
3505 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3506
3507 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3508 return bScanTriggered;
3509
Jeff Johnsone7245742012-09-05 17:12:55 -07003510 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003511 {
3512 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3513 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3514
3515 // Determine the next scan channel
3516
3517 // Get background scan channel list from CFG
3518 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3519 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3520 (tANI_U8 *) bgScanChannelList,
3521 (tANI_U32 *) &len ))
3522 {
3523 // Ensure that we do not go off scanning on the same
3524 // channel on which the Quiet BSS was requested
3525 if( psessionEntry->currentOperChannel!=
3526 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3527 {
3528 // For now, try and attempt a background scan. It will
3529 // be ideal if this API actually returns a success or
3530 // failure instead of having a void return type
3531 limTriggerBackgroundScan( pMac );
3532
3533 bScanTriggered = eSIR_TRUE;
3534 }
3535 else
3536 {
3537 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003538 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 -07003539 }
3540 }
3541 else
3542 {
3543 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003544 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 -07003545 }
3546 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 return bScanTriggered;
3548}
3549
3550
3551/**
3552 * limGetHTCapability()
3553 *
3554 *FUNCTION:
3555 * A utility function that returns the "current HT capability state" for the HT
3556 * capability of interest (as requested in the API)
3557 *
3558 *LOGIC:
3559 * This routine will return with the "current" setting of a requested HT
3560 * capability. This state info could be retrieved from -
3561 * a) CFG (for static entries)
3562 * b) Run time info
3563 * - Dynamic state maintained by LIM
3564 * - Configured at radio init time by SME
3565 *
3566 *
3567 *ASSUMPTIONS:
3568 * NA
3569 *
3570 *NOTE:
3571 *
3572 * @param pMac Pointer to Global MAC structure
3573 * @param htCap The HT capability being queried
3574 * @return tANI_U8 The current state of the requested HT capability is returned in a
3575 * tANI_U8 variable
3576 */
3577
Jeff Johnson295189b2012-06-20 16:38:30 -07003578tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3579 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003580{
3581tANI_U8 retVal = 0;
3582tANI_U8 *ptr;
3583tANI_U32 cfgValue;
3584tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3585tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3586tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3587tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3588
3589 //
3590 // Determine which CFG to read from. Not ALL of the HT
3591 // related CFG's need to be read each time this API is
3592 // accessed
3593 //
3594 if( htCap >= eHT_ANTENNA_SELECTION &&
3595 htCap < eHT_SI_GRANULARITY )
3596 {
3597 // Get Antenna Seletion HT Capabilities
3598 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3599 cfgValue = 0;
3600 ptr = (tANI_U8 *) &macASCapabilityInfo;
3601 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3602 }
3603 else
3604 {
3605 if( htCap >= eHT_TX_BEAMFORMING &&
3606 htCap < eHT_ANTENNA_SELECTION )
3607 {
3608 // Get Transmit Beam Forming HT Capabilities
3609 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3610 cfgValue = 0;
3611 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3612 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3613 }
3614 else
3615 {
3616 if( htCap >= eHT_PCO &&
3617 htCap < eHT_TX_BEAMFORMING )
3618 {
3619 // Get Extended HT Capabilities
3620 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3621 cfgValue = 0;
3622 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3623 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3624 }
3625 else
3626 {
3627 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3628 {
3629 // Get HT Capabilities
3630 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3631 cfgValue = 0;
3632 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3633 // 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
3634 *ptr++ = cfgValue & 0xff;
3635 *ptr = (cfgValue >> 8) & 0xff;
3636 }
3637 }
3638 }
3639 }
3640
3641 switch( htCap )
3642 {
3643 case eHT_LSIG_TXOP_PROTECTION:
3644 retVal = pMac->lim.gHTLsigTXOPProtection;
3645 break;
3646
3647 case eHT_STBC_CONTROL_FRAME:
3648 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3649 break;
3650
3651 case eHT_PSMP:
3652 retVal = pMac->lim.gHTPSMPSupport;
3653 break;
3654
3655 case eHT_DSSS_CCK_MODE_40MHZ:
3656 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3657 break;
3658
3659 case eHT_MAX_AMSDU_LENGTH:
3660 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3661 break;
3662
3663 case eHT_DELAYED_BA:
3664 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3665 break;
3666
3667 case eHT_RX_STBC:
3668 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3669 break;
3670
3671 case eHT_TX_STBC:
3672 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3673 break;
3674
3675 case eHT_SHORT_GI_40MHZ:
3676 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3677 break;
3678
3679 case eHT_SHORT_GI_20MHZ:
3680 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3681 break;
3682
3683 case eHT_GREENFIELD:
3684 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3685 break;
3686
3687 case eHT_MIMO_POWER_SAVE:
3688 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3689 break;
3690
3691 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003692 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003693 break;
3694
3695 case eHT_ADVANCED_CODING:
3696 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3697 break;
3698
3699 case eHT_MAX_RX_AMPDU_FACTOR:
3700 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3701 break;
3702
3703 case eHT_MPDU_DENSITY:
3704 retVal = pMac->lim.gHTAMpduDensity;
3705 break;
3706
3707 case eHT_PCO:
3708 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3709 break;
3710
3711 case eHT_TRANSITION_TIME:
3712 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3713 break;
3714
3715 case eHT_MCS_FEEDBACK:
3716 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3717 break;
3718
3719 case eHT_TX_BEAMFORMING:
3720 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3721 break;
3722
3723 case eHT_ANTENNA_SELECTION:
3724 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3725 break;
3726
3727 case eHT_SI_GRANULARITY:
3728 retVal = pMac->lim.gHTServiceIntervalGranularity;
3729 break;
3730
3731 case eHT_CONTROLLED_ACCESS:
3732 retVal = pMac->lim.gHTControlledAccessOnly;
3733 break;
3734
3735 case eHT_RIFS_MODE:
3736 retVal = psessionEntry->beaconParams.fRIFSMode;
3737 break;
3738
3739 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003740 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 break;
3742
3743 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003744 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 break;
3746
3747 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3749 retVal = psessionEntry->htOperMode;
3750 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003751 retVal = pMac->lim.gHTOperMode;
3752 break;
3753
3754 case eHT_BASIC_STBC_MCS:
3755 retVal = pMac->lim.gHTSTBCBasicMCS;
3756 break;
3757
3758 case eHT_DUAL_CTS_PROTECTION:
3759 retVal = pMac->lim.gHTDualCTSProtection;
3760 break;
3761
3762 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3763 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3764 break;
3765
3766 case eHT_PCO_ACTIVE:
3767 retVal = pMac->lim.gHTPCOActive;
3768 break;
3769
3770 case eHT_PCO_PHASE:
3771 retVal = pMac->lim.gHTPCOPhase;
3772 break;
3773
3774 default:
3775 break;
3776 }
3777
3778 return retVal;
3779}
3780
Jeff Johnson295189b2012-06-20 16:38:30 -07003781void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3782{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303783 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 return;
3785}
3786
3787
3788
3789
3790/** -------------------------------------------------------------
3791\fn limEnable11aProtection
3792\brief based on config setting enables\disables 11a protection.
3793\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3794\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3795\param tpUpdateBeaconParams pBeaconParams
3796\return None
3797 -------------------------------------------------------------*/
3798tSirRetStatus
3799limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3800 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3801{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003802 if(NULL == psessionEntry)
3803 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003804 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003805 return eSIR_FAILURE;
3806 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003807 //overlapping protection configuration check.
3808 if(overlap)
3809 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 }
3811 else
3812 {
3813 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003814 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003815 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 {
3817 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003818 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 return eSIR_SUCCESS;
3820 }
3821 }
3822
3823 if (enable)
3824 {
3825 //If we are AP and HT capable, we need to set the HT OP mode
3826 //appropriately.
3827 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003828 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 {
3830 if(overlap)
3831 {
3832 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3833 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3834 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3835 {
3836 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3837 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3838 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3839 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3840 }
3841 }
3842 else
3843 {
3844 psessionEntry->gLim11aParams.protectionEnabled = true;
3845 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3846 {
3847 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003848 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3850 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3851
3852 }
3853 }
3854 }
3855
3856 //This part is common for staiton as well.
3857 if(false == psessionEntry->beaconParams.llaCoexist)
3858 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003859 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3861 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3862 }
3863 }
3864 else if (true == psessionEntry->beaconParams.llaCoexist)
3865 {
3866 //for AP role.
3867 //we need to take care of HT OP mode change if needed.
3868 //We need to take care of Overlap cases.
3869 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3870 {
3871 if(overlap)
3872 {
3873 //Overlap Legacy protection disabled.
3874 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3875
3876 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003877 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003878 {
3879 // no HT op mode change if any of the overlap protection enabled.
3880 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3881 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3882 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3883
3884 {
3885 //Check if there is a need to change HT OP mode.
3886 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3887 {
3888 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3889 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3890
3891 if(psessionEntry->gLimHt20Params.protectionEnabled)
3892 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3893 else
3894 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3895 }
3896 }
3897 }
3898 }
3899 else
3900 {
3901 //Disable protection from 11A stations.
3902 psessionEntry->gLim11aParams.protectionEnabled = false;
3903 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3904
3905 //Check if any other non-HT protection enabled.
3906 //Right now we are in HT OP Mixed mode.
3907 //Change HT op mode appropriately.
3908
3909 //Change HT OP mode to 01 if any overlap protection enabled
3910 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3911 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3912 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3913
3914 {
3915 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003916 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3918 }
3919 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3920 {
3921 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003922 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003923 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3924 }
3925 else
3926 {
3927 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003928 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3930 }
3931 }
3932 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3933 !psessionEntry->gLim11aParams.protectionEnabled)
3934 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003935 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3937 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3938 }
3939 }
3940 //for station role
3941 else
3942 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003943 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003944 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3945 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3946 }
3947 }
3948
3949 return eSIR_SUCCESS;
3950}
3951
3952/** -------------------------------------------------------------
3953\fn limEnable11gProtection
3954\brief based on config setting enables\disables 11g protection.
3955\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3956\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3957\param tpUpdateBeaconParams pBeaconParams
3958\return None
3959 -------------------------------------------------------------*/
3960
3961tSirRetStatus
3962limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3963 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3964{
3965
3966 //overlapping protection configuration check.
3967 if(overlap)
3968 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003969 }
3970 else
3971 {
3972 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3974 !psessionEntry->cfgProtection.fromllb)
3975 {
3976 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003977 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 return eSIR_SUCCESS;
3979 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003980 {
3981 if(!pMac->lim.cfgProtection.fromllb)
3982 {
3983 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003984 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 return eSIR_SUCCESS;
3986 }
3987 }
3988 }
3989
3990 if (enable)
3991 {
3992 //If we are AP and HT capable, we need to set the HT OP mode
3993 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003994 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3995 {
3996 if(overlap)
3997 {
3998 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003999 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004000 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 {
4002 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4003 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4004 {
4005 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4006 }
4007 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4008 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4009 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4010 //Not processing OBSS bit from other APs, as we are already taking care
4011 //of Protection from overlapping BSS based on erp IE or useProtection bit
4012 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4013 }
4014 }
4015 else
4016 {
4017 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004018 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004019 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004020 {
4021 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4022 {
4023 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4024 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4025 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4026 }
4027 }
4028 }
4029 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07004030 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 {
4032 if(overlap)
4033 {
4034 psessionEntry->gLimOlbcParams.protectionEnabled = true;
4035 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4036 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4037 {
4038 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4039 }
4040 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4041 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4042 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4043 //Not processing OBSS bit from other APs, as we are already taking care
4044 //of Protection from overlapping BSS based on erp IE or useProtection bit
4045 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4046 }
4047 else
4048 {
4049 psessionEntry->gLim11bParams.protectionEnabled = true;
4050 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4051 {
4052 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4053 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4054 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4055 }
4056 }
4057 }
4058
4059 //This part is common for staiton as well.
4060 if(false == psessionEntry->beaconParams.llbCoexist)
4061 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004062 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4064 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4065 }
4066 }
4067 else if (true == psessionEntry->beaconParams.llbCoexist)
4068 {
4069 //for AP role.
4070 //we need to take care of HT OP mode change if needed.
4071 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4073 {
4074 if(overlap)
4075 {
4076 //Overlap Legacy protection disabled.
4077 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4078
4079 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004080 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 {
4082 // no HT op mode change if any of the overlap protection enabled.
4083 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4084 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4085 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4086 {
4087 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004088 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004089 {
4090 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4091 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4092 if(psessionEntry->gLimHt20Params.protectionEnabled){
4093 //Commenting out beacuse of CR 258588 WFA cert
4094 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4095 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4096 }
4097 else
4098 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4099 }
4100 }
4101 }
4102 }
4103 else
4104 {
4105 //Disable protection from 11B stations.
4106 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004107 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 //Check if any other non-HT protection enabled.
4109 if(!psessionEntry->gLim11gParams.protectionEnabled)
4110 {
4111 //Right now we are in HT OP Mixed mode.
4112 //Change HT op mode appropriately.
4113 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4114
4115 //Change HT OP mode to 01 if any overlap protection enabled
4116 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4117 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4118 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4119 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4120 {
4121 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004122 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4124 }
4125 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4126 {
4127 //Commenting because of CR 258588 WFA cert
4128 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4129 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004130 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4132 }
4133 else
4134 {
4135 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4136 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4137 }
4138 }
4139 }
4140 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4141 !psessionEntry->gLim11bParams.protectionEnabled)
4142 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004143 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4145 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4146 }
4147 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004148 {
4149 if(overlap)
4150 {
4151 //Overlap Legacy protection disabled.
4152 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4153
4154 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004155 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 {
4157 // no HT op mode change if any of the overlap protection enabled.
4158 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4159 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4160 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4161
4162 {
4163 //Check if there is a need to change HT OP mode.
4164 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4165 {
4166 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4167 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4168 if(psessionEntry->gLimHt20Params.protectionEnabled)
4169 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4170 else
4171 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4172 }
4173 }
4174 }
4175 }
4176 else
4177 {
4178 //Disable protection from 11B stations.
4179 psessionEntry->gLim11bParams.protectionEnabled = false;
4180 //Check if any other non-HT protection enabled.
4181 if(!psessionEntry->gLim11gParams.protectionEnabled)
4182 {
4183 //Right now we are in HT OP Mixed mode.
4184 //Change HT op mode appropriately.
4185 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4186
4187 //Change HT OP mode to 01 if any overlap protection enabled
4188 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4189 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4190 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4191 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4192
4193 {
4194 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4195 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4196 }
4197 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4198 {
4199 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4200 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4201 }
4202 else
4203 {
4204 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4205 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4206 }
4207 }
4208 }
4209 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4210 !psessionEntry->gLim11bParams.protectionEnabled)
4211 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004212 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004213 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4214 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4215 }
4216 }
4217 //for station role
4218 else
4219 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004220 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4222 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4223 }
4224 }
4225 return eSIR_SUCCESS;
4226}
4227
4228/** -------------------------------------------------------------
4229\fn limEnableHtProtectionFrom11g
4230\brief based on cofig enables\disables protection from 11g.
4231\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4232\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4233\param tpUpdateBeaconParams pBeaconParams
4234\return None
4235 -------------------------------------------------------------*/
4236tSirRetStatus
4237limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4238 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4239{
Jeff Johnsone7245742012-09-05 17:12:55 -07004240 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004241 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4242
4243 //overlapping protection configuration check.
4244 if(overlap)
4245 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4247 {
4248 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004249 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004250 return eSIR_SUCCESS;
4251 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 {
4253 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004254 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 return eSIR_SUCCESS;
4256 }
4257 }
4258 else
4259 {
4260 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4262 !psessionEntry->cfgProtection.fromllg){
4263 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004264 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 return eSIR_SUCCESS;
4266 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 {
4268 if(!pMac->lim.cfgProtection.fromllg)
4269 {
4270 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004271 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004272 return eSIR_SUCCESS;
4273 }
4274 }
4275 }
4276 if (enable)
4277 {
4278 //If we are AP and HT capable, we need to set the HT OP mode
4279 //appropriately.
4280
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4282 {
4283 if(overlap)
4284 {
4285 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4286 //11g exists in overlap BSS.
4287 //need not to change the operating mode to overlap_legacy
4288 //if higher or same protection operating mode is enabled right now.
4289 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4290 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4291 {
4292 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4293 }
4294 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304295 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 }
4297 else
4298 {
4299 //11g is associated to an AP operating in 11n mode.
4300 //Change the HT operating mode to 'mixed mode'.
4301 psessionEntry->gLim11gParams.protectionEnabled = true;
4302 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4303 {
4304 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4305 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304306 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 }
4308 }
4309 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 {
4311 if(overlap)
4312 {
4313 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4314 //11g exists in overlap BSS.
4315 //need not to change the operating mode to overlap_legacy
4316 //if higher or same protection operating mode is enabled right now.
4317 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4318 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4319 {
4320 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4321 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4322 }
4323 }
4324 else
4325 {
4326 //11g is associated to an AP operating in 11n mode.
4327 //Change the HT operating mode to 'mixed mode'.
4328 psessionEntry->gLim11gParams.protectionEnabled = true;
4329 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4330 {
4331 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4332 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304333 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 }
4335 }
4336 }
4337
4338 //This part is common for staiton as well.
4339 if(false == psessionEntry->beaconParams.llgCoexist)
4340 {
4341 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4342 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4343 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4345 {
4346 // As operating mode changed after G station assoc some way to update beacon
4347 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4348 //pMac->sch.schObject.fBeaconChanged = 1;
4349 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4350 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004351 }
4352 else if (true == psessionEntry->beaconParams.llgCoexist)
4353 {
4354 //for AP role.
4355 //we need to take care of HT OP mode change if needed.
4356 //We need to take care of Overlap cases.
4357
Jeff Johnson295189b2012-06-20 16:38:30 -07004358 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4359 {
4360 if(overlap)
4361 {
4362 //Overlap Legacy protection disabled.
4363 if (psessionEntry->gLim11gParams.numSta == 0)
4364 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4365
4366 // no HT op mode change if any of the overlap protection enabled.
4367 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4368 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4369 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4370 {
4371 //Check if there is a need to change HT OP mode.
4372 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4373 {
4374 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4375 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4376
4377 if(psessionEntry->gLimHt20Params.protectionEnabled){
4378 //Commenting because of CR 258588 WFA cert
4379 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4380 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4381 }
4382 else
4383 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4384 }
4385 }
4386 }
4387 else
4388 {
4389 //Disable protection from 11G stations.
4390 psessionEntry->gLim11gParams.protectionEnabled = false;
4391 //Check if any other non-HT protection enabled.
4392 if(!psessionEntry->gLim11bParams.protectionEnabled)
4393 {
4394
4395 //Right now we are in HT OP Mixed mode.
4396 //Change HT op mode appropriately.
4397 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4398
4399 //Change HT OP mode to 01 if any overlap protection enabled
4400 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4401 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4402 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4403 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4404
4405 {
4406 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4407 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4408 }
4409 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4410 {
4411 //Commenting because of CR 258588 WFA cert
4412 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4413 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4414 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4415 }
4416 else
4417 {
4418 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4419 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4420 }
4421 }
4422 }
4423 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4424 !psessionEntry->gLim11gParams.protectionEnabled)
4425 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004426 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004427 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4428 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4429 }
4430 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 {
4432 if(overlap)
4433 {
4434 //Overlap Legacy protection disabled.
4435 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4436
4437 // no HT op mode change if any of the overlap protection enabled.
4438 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4439 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4440 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4441 {
4442 //Check if there is a need to change HT OP mode.
4443 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4444 {
4445 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4446 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4447
4448 if(psessionEntry->gLimHt20Params.protectionEnabled)
4449 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4450 else
4451 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4452 }
4453 }
4454 }
4455 else
4456 {
4457 //Disable protection from 11G stations.
4458 psessionEntry->gLim11gParams.protectionEnabled = false;
4459 //Check if any other non-HT protection enabled.
4460 if(!psessionEntry->gLim11bParams.protectionEnabled)
4461 {
4462
4463 //Right now we are in HT OP Mixed mode.
4464 //Change HT op mode appropriately.
4465 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4466
4467 //Change HT OP mode to 01 if any overlap protection enabled
4468 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4469 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4470 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4471 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4472
4473 {
4474 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4475 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4476 }
4477 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4478 {
4479 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4480 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4481 }
4482 else
4483 {
4484 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4485 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4486 }
4487 }
4488 }
4489 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4490 !psessionEntry->gLim11gParams.protectionEnabled)
4491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004492 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4494 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4495 }
4496 }
4497 //for station role
4498 else
4499 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004500 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4502 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4503 }
4504 }
4505 return eSIR_SUCCESS;
4506}
4507//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4508//This check will be done at the caller.
4509
4510/** -------------------------------------------------------------
4511\fn limEnableHtObssProtection
4512\brief based on cofig enables\disables obss protection.
4513\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4514\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4515\param tpUpdateBeaconParams pBeaconParams
4516\return None
4517 -------------------------------------------------------------*/
4518tSirRetStatus
4519limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4520 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4521{
4522
4523
Jeff Johnsone7245742012-09-05 17:12:55 -07004524 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 return eSIR_SUCCESS; // this protection is only for HT stations.
4526
4527 //overlapping protection configuration check.
4528 if(overlap)
4529 {
4530 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 }
4532 else
4533 {
4534 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4536 { //ToDo Update this field
4537 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004538 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 return eSIR_SUCCESS;
4540 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 {
4542 if(!pMac->lim.cfgProtection.obss)
4543 { //ToDo Update this field
4544 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004545 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004546 return eSIR_SUCCESS;
4547 }
4548 }
4549 }
4550
4551
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4553 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4554 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004555 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 psessionEntry->beaconParams.gHTObssMode = true;
4557 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4558
4559 }
4560 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4561 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004562 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 psessionEntry->beaconParams.gHTObssMode = false;
4564 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4565
4566 }
4567//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4568 if (!enable && !overlap)
4569 {
4570 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4571 }
4572 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 {
4574 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4575 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004576 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 psessionEntry->beaconParams.gHTObssMode = true;
4578 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4579
4580 }
4581 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4582 {
4583
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004584 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 psessionEntry->beaconParams.gHTObssMode = false;
4586 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4587
4588 }
4589 }
4590 return eSIR_SUCCESS;
4591}
4592/** -------------------------------------------------------------
4593\fn limEnableHT20Protection
4594\brief based on cofig enables\disables protection from Ht20.
4595\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4596\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4597\param tpUpdateBeaconParams pBeaconParams
4598\return None
4599 -------------------------------------------------------------*/
4600tSirRetStatus
4601limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4602 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4603{
Jeff Johnsone7245742012-09-05 17:12:55 -07004604 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 return eSIR_SUCCESS; // this protection is only for HT stations.
4606
4607 //overlapping protection configuration check.
4608 if(overlap)
4609 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004610 }
4611 else
4612 {
4613 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4615 !psessionEntry->cfgProtection.ht20)
4616 {
4617 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004618 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 return eSIR_SUCCESS;
4620 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 {
4622 if(!pMac->lim.cfgProtection.ht20)
4623 {
4624 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004625 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 return eSIR_SUCCESS;
4627 }
4628 }
4629 }
4630
4631 if (enable)
4632 {
4633 //If we are AP and HT capable, we need to set the HT OP mode
4634 //appropriately.
4635
Jeff Johnson295189b2012-06-20 16:38:30 -07004636 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4637 if(overlap)
4638 {
4639 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4640 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4641 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4642 {
4643 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4644 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4645 }
4646 }
4647 else
4648 {
4649 psessionEntry->gLimHt20Params.protectionEnabled = true;
4650 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
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 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4657 }
4658 }
4659 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004660 {
4661 if(overlap)
4662 {
4663 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4664 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4665 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4666 {
4667 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4668 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4669 }
4670 }
4671 else
4672 {
4673 psessionEntry->gLimHt20Params.protectionEnabled = true;
4674 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4675 {
4676 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4677 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4678 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4679 }
4680 }
4681 }
4682
4683 //This part is common for staiton as well.
4684 if(false == psessionEntry->beaconParams.ht20Coexist)
4685 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004686 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004687 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4688 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4689 }
4690 }
4691 else if (true == psessionEntry->beaconParams.ht20Coexist)
4692 {
4693 //for AP role.
4694 //we need to take care of HT OP mode change if needed.
4695 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4697 if(overlap)
4698 {
4699 //Overlap Legacy protection disabled.
4700 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4701
4702 // no HT op mode change if any of the overlap protection enabled.
4703 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4704 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4705 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4706 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4707 {
4708
4709 //Check if there is a need to change HT OP mode.
4710 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4711 {
4712 if(psessionEntry->gLimHt20Params.protectionEnabled)
4713 {
4714 //Commented beacuse of CR 258588 for WFA Cert
4715 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4716 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4717 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4718 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4719 }
4720 else
4721 {
4722 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4723 }
4724 }
4725 }
4726 }
4727 else
4728 {
4729 //Disable protection from 11G stations.
4730 psessionEntry->gLimHt20Params.protectionEnabled = false;
4731
4732 //Change HT op mode appropriately.
4733 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4734 {
4735 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4736 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4737 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4738 }
4739 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004740 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4742 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4743 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004744 {
4745 if(overlap)
4746 {
4747 //Overlap Legacy protection disabled.
4748 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4749
4750 // no HT op mode change if any of the overlap protection enabled.
4751 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4752 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4753 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4754 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4755 {
4756
4757 //Check if there is a need to change HT OP mode.
4758 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4759 {
4760 if(psessionEntry->gLimHt20Params.protectionEnabled)
4761 {
4762 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4763 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4764 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4765 }
4766 else
4767 {
4768 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4769 }
4770 }
4771 }
4772 }
4773 else
4774 {
4775 //Disable protection from 11G stations.
4776 psessionEntry->gLimHt20Params.protectionEnabled = false;
4777
4778 //Change HT op mode appropriately.
4779 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4780 {
4781 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4782 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4783 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4784 }
4785 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004786 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4788 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4789 }
4790 //for station role
4791 else
4792 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004793 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4795 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4796 }
4797 }
4798
4799 return eSIR_SUCCESS;
4800}
4801
4802/** -------------------------------------------------------------
4803\fn limEnableHTNonGfProtection
4804\brief based on cofig enables\disables protection from NonGf.
4805\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4806\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4807\param tpUpdateBeaconParams pBeaconParams
4808\return None
4809 -------------------------------------------------------------*/
4810tSirRetStatus
4811limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4812 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4813{
Jeff Johnsone7245742012-09-05 17:12:55 -07004814 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 return eSIR_SUCCESS; // this protection is only for HT stations.
4816
4817 //overlapping protection configuration check.
4818 if(overlap)
4819 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 }
4821 else
4822 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 //normal protection config check
4824 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4825 !psessionEntry->cfgProtection.nonGf)
4826 {
4827 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004828 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004829 return eSIR_SUCCESS;
4830 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004831 {
4832 //normal protection config check
4833 if(!pMac->lim.cfgProtection.nonGf)
4834 {
4835 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004836 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 return eSIR_SUCCESS;
4838 }
4839 }
4840 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4842 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4843 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004844 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4846 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4847 }
4848 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4849 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004850 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4852 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4853 }
4854 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 {
4856 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4857 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004858 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4860 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4861 }
4862 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4863 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004864 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4866 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4867 }
4868 }
4869
4870 return eSIR_SUCCESS;
4871}
4872
4873/** -------------------------------------------------------------
4874\fn limEnableHTLsigTxopProtection
4875\brief based on cofig enables\disables LsigTxop protection.
4876\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4877\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4878\param tpUpdateBeaconParams pBeaconParams
4879\return None
4880 -------------------------------------------------------------*/
4881tSirRetStatus
4882limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4883 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4884{
Jeff Johnsone7245742012-09-05 17:12:55 -07004885 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 return eSIR_SUCCESS; // this protection is only for HT stations.
4887
4888 //overlapping protection configuration check.
4889 if(overlap)
4890 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 }
4892 else
4893 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 //normal protection config check
4895 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4896 !psessionEntry->cfgProtection.lsigTxop)
4897 {
4898 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004899 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 return eSIR_SUCCESS;
4901 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 {
4903 //normal protection config check
4904 if(!pMac->lim.cfgProtection.lsigTxop)
4905 {
4906 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004907 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 return eSIR_SUCCESS;
4909 }
4910 }
4911 }
4912
4913
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4915 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4916 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004917 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4919 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4920 }
4921 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4922 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004923 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4925 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4926 }
4927 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 {
4929 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4930 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004931 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4933 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4934 }
4935 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004937 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4939 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4940 }
4941 }
4942 return eSIR_SUCCESS;
4943}
4944//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4945//This check will be done at the caller.
4946/** -------------------------------------------------------------
4947\fn limEnableHtRifsProtection
4948\brief based on cofig enables\disables Rifs protection.
4949\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4950\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4951\param tpUpdateBeaconParams pBeaconParams
4952\return None
4953 -------------------------------------------------------------*/
4954tSirRetStatus
4955limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4956 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4957{
Jeff Johnsone7245742012-09-05 17:12:55 -07004958 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 return eSIR_SUCCESS; // this protection is only for HT stations.
4960
4961
4962 //overlapping protection configuration check.
4963 if(overlap)
4964 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004965 }
4966 else
4967 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 //normal protection config check
4969 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4970 !psessionEntry->cfgProtection.rifs)
4971 {
4972 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004973 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 return eSIR_SUCCESS;
4975 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 {
4977 //normal protection config check
4978 if(!pMac->lim.cfgProtection.rifs)
4979 {
4980 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004981 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 return eSIR_SUCCESS;
4983 }
4984 }
4985 }
4986
Jeff Johnson295189b2012-06-20 16:38:30 -07004987 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4988 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4989 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4990 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004991 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4993 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4994 }
4995 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4996 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4997 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004998 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004999 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5000 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5001 }
5002 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07005003 {
5004 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
5005 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
5006 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005007 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
5009 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5010 }
5011 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
5012 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
5013 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005014 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005015 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
5016 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
5017 }
5018 }
5019 return eSIR_SUCCESS;
5020}
5021
5022// ---------------------------------------------------------------------
5023/**
5024 * limEnableShortPreamble
5025 *
5026 * FUNCTION:
5027 * Enable/Disable short preamble
5028 *
5029 * LOGIC:
5030 *
5031 * ASSUMPTIONS:
5032 *
5033 * NOTE:
5034 *
5035 * @param enable Flag to enable/disable short preamble
5036 * @return None
5037 */
5038
5039tSirRetStatus
5040limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5041{
5042 tANI_U32 val;
5043
5044 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5045 {
5046 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005047 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005048 return eSIR_FAILURE;
5049 }
5050
5051 if (!val)
5052 return eSIR_SUCCESS;
5053
5054 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5055 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005056 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 return eSIR_FAILURE;
5058 }
5059
5060 if (!val) // 11G short preamble switching is disabled.
5061 return eSIR_SUCCESS;
5062
5063 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5064 {
5065 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5066 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005067 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 psessionEntry->beaconParams.fShortPreamble = true;
5069 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5070 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5071 }
5072 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5073 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005074 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005075 psessionEntry->beaconParams.fShortPreamble = false;
5076 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5077 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5078 }
5079 }
5080
5081 return eSIR_SUCCESS;
5082 }
5083
5084/**
5085 * limTxComplete
5086 *
5087 * Function:
5088 * This is LIM's very own "TX MGMT frame complete" completion routine.
5089 *
5090 * Logic:
5091 * LIM wants to send a MGMT frame (broadcast or unicast)
5092 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5093 * LIM transmits the MGMT frame using the API:
5094 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5095 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5096 * HDD, if it determines that a TX completion routine (in this case
5097 * limTxComplete) has been provided, will invoke this callback
5098 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5099 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5100 *
5101 * Assumptions:
5102 * Presently, this is ONLY being used for MGMT frames/packets
5103 * TODO:
5104 * Would it do good for LIM to have some sort of "signature" validation to
5105 * ensure that the pData argument passed in was a buffer that was actually
5106 * allocated by LIM and/or is not corrupted?
5107 *
5108 * Note: FIXME and TODO
5109 * Looks like palPktFree() is interested in pPacket. But, when this completion
5110 * routine is called, only pData is made available to LIM!!
5111 *
5112 * @param void A pointer to pData. Shouldn't it be pPacket?!
5113 *
5114 * @return none
5115 */
5116void limTxComplete( tHalHandle hHal, void *pData )
5117{
5118 tpAniSirGlobal pMac;
5119 pMac = (tpAniSirGlobal)hHal;
5120
5121#ifdef FIXME_PRIMA
5122 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5123#ifdef TRACE_RECORD
5124 {
5125 tpSirMacMgmtHdr mHdr;
5126 v_U8_t *pRxBd;
5127 vos_pkt_t *pVosPkt;
5128 VOS_STATUS vosStatus;
5129
5130
5131
5132 pVosPkt = (vos_pkt_t *)pData;
5133 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5134
5135 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5136 {
5137 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005138
5139 }
5140 }
5141#endif
5142#endif
5143
5144 palPktFree( pMac->hHdd,
5145 HAL_TXRX_FRM_802_11_MGMT,
5146 (void *) NULL, // this is ignored and will likely be removed from this API
5147 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5148}
5149
5150/**
5151 * \brief This function updates lim global structure, if CB parameters in the BSS
5152 * have changed, and sends an indication to HAL also with the
5153 * updated HT Parameters.
5154 * This function does not detect the change in the primary channel, that is done as part
5155 * of channel Swtich IE processing.
5156 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5157 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5158 *
5159 *
5160 * \param pMac Pointer to global MAC structure
5161 *
5162 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5163 * Probe Response
5164 *
5165 * \param bssIdx BSS Index of the Bss to which Station is associated.
5166 *
5167 *
5168 */
5169
5170void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5171 tDot11fIEHTInfo *pHTInfo,
5172 tANI_U8 bssIdx,
5173 tpPESession psessionEntry)
5174{
Jeff Johnsone7245742012-09-05 17:12:55 -07005175 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005176#if !defined WLAN_FEATURE_VOWIFI
5177 tANI_U32 localPwrConstraint;
5178#endif
5179
5180 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005181 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005182 return;
5183
5184#if !defined WLAN_FEATURE_VOWIFI
5185 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005186 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005187 return;
5188 }
5189#endif
5190
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305191 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5192 {
5193 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5194 return;
5195 }
5196
Mihir Shetebc160b72014-08-22 14:10:39 +05305197 /*
5198 * Do not try to switch channel if RoC is in progress. RoC code path uses
5199 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5200 * has started listening on the channel requested as part of RoC, if we set
5201 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5202 * upper layers will think that the channel change is not successful and the
5203 * RoC from the upper layer perspective will never end...
5204 */
5205 if (pMac->lim.gpLimRemainOnChanReq)
5206 {
5207 limLog( pMac, LOGE, FL( "RoC is in progress"));
5208 return;
5209 }
5210
Jeff Johnsone7245742012-09-05 17:12:55 -07005211 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5212 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005213 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005214 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5215 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5216 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5217 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005218
5219 // Notify HAL
5220 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005221 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005222 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005223 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005224 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005225 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005226 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5227 pMac->lim.gpchangeChannelCallback = NULL;
5228 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005229
5230#if defined WLAN_FEATURE_VOWIFI
5231 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5232 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5233#else
5234 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5235 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5236#endif
5237
5238 //In case of IBSS, if STA should update HT Info IE in its beacons.
5239 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5240 {
5241 schSetFixedBeaconFields(pMac,psessionEntry);
5242 }
5243
5244 }
5245} // End limUpdateStaRunTimeHTParams.
5246
5247/**
5248 * \brief This function updates the lim global structure, if any of the
5249 * HT Capabilities have changed.
5250 *
5251 *
5252 * \param pMac Pointer to Global MAC structure
5253 *
5254 * \param pHTCapability Pointer to HT Capability Information Element
5255 * obtained from a Beacon or Probe Response
5256 *
5257 *
5258 *
5259 */
5260
5261void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5262 tDot11fIEHTCaps *pHTCaps )
5263{
5264
5265 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5266 {
5267 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5268 // Send change notification to HAL
5269 }
5270
5271 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5272 {
5273 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5274 // Send change notification to HAL
5275 }
5276
5277 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5278 {
5279 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5280 // Send change notification to HAL
5281 }
5282
5283
5284} // End limUpdateStaRunTimeHTCapability.
5285
5286/**
5287 * \brief This function updates lim global structure, if any of the HT
5288 * Info Parameters have changed.
5289 *
5290 *
5291 * \param pMac Pointer to the global MAC structure
5292 *
5293 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5294 * Probe Response
5295 *
5296 *
5297 */
5298
5299void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305300 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005301{
Jeff Johnsone7245742012-09-05 17:12:55 -07005302 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005303 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005304 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 // Send change notification to HAL
5306 }
5307
5308 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5309 {
5310 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5311 // Send change notification to HAL
5312 }
5313
5314 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5315 {
5316 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5317 // Send change notification to HAL
5318 }
5319
5320 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5321 {
5322 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5323 // Send change notification to HAL
5324 }
5325
5326 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5327 {
5328 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5329 }
5330
5331 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5332 {
5333 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5334 // Send change notification to HAL
5335 }
5336
5337 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5338 {
5339 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5340 // Send change notification to HAL
5341 }
5342
5343 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5344 {
5345 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5346 // Send change notification to HAL
5347 }
5348
5349 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5350 {
5351 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5352 // Send change notification to HAL
5353 }
5354
5355 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5356 {
5357 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5358 // Send change notification to HAL
5359 }
5360
5361 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5362 {
5363 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5364 // Send change notification to HAL
5365 }
5366
5367} // End limUpdateStaRunTimeHTInfo.
5368
5369
5370/** -------------------------------------------------------------
5371\fn limProcessHalIndMessages
5372\brief callback function for HAL indication
5373\param tpAniSirGlobal pMac
5374\param tANI_U32 mesgId
5375\param void *mesgParam
5376\return tSirRetStatu - status
5377 -------------------------------------------------------------*/
5378
5379tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5380{
5381 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5382 tSirMsgQ msg;
5383
5384 switch(msgId)
5385 {
5386 case SIR_LIM_DEL_TS_IND:
5387 case SIR_LIM_ADD_BA_IND:
5388 case SIR_LIM_DEL_BA_ALL_IND:
5389 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5390 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305391 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005392 msg.type = (tANI_U16) msgId;
5393 msg.bodyptr = msgParam;
5394 msg.bodyval = 0;
5395 break;
5396
5397 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305398 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005399 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005400 return eSIR_FAILURE;
5401 }
5402
5403 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5404 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305405 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005406 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5407 return eSIR_FAILURE;
5408 }
5409 return eSIR_SUCCESS;
5410}
5411
5412/** -------------------------------------------------------------
5413\fn limValidateDeltsReq
5414\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5415\param tpAniSirGlobal pMac
5416\param tpSirDeltsReq pDeltsReq
5417\param tSirMacAddr peerMacAddr
5418\return eSirRetStatus - status
5419 -------------------------------------------------------------*/
5420
5421tSirRetStatus
5422limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5423{
5424 tpDphHashNode pSta;
5425 tANI_U8 tsStatus;
5426 tSirMacTSInfo *tsinfo;
5427 tANI_U32 i;
5428 tANI_U8 tspecIdx;
5429 /* if sta
5430 * - verify assoc state
5431 * - del tspec locally
5432 * if ap,
5433 * - verify sta is in assoc state
5434 * - del sta tspec locally
5435 */
5436 if(pDeltsReq == NULL)
5437 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005438 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005439 return eSIR_FAILURE;
5440 }
5441
5442 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5443 {
5444 tANI_U32 val;
5445
5446 // station always talks to the AP
5447 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5448
5449 val = sizeof(tSirMacAddr);
5450 #if 0
5451 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5452 {
5453 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005454 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005455 return eSIR_FAILURE;
5456 }
5457 #endif// TO SUPPORT BT-AMP
5458 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5459
5460 }
5461 else
5462 {
5463 tANI_U16 assocId;
5464 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5465
5466 assocId = pDeltsReq->aid;
5467 if (assocId != 0)
5468 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5469 else
5470 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5471
5472 if (pSta != NULL)
5473 // TBD: check sta assoc state as well
5474 for (i =0; i < sizeof(tSirMacAddr); i++)
5475 macaddr[i] = pSta->staAddr[i];
5476 }
5477
5478 if (pSta == NULL)
5479 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005480 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005481 return eSIR_FAILURE;
5482 }
5483
5484 if ((! pSta->valid) ||
5485 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5486 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005487 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005488 return eSIR_FAILURE;
5489 }
5490
5491 pDeltsReq->req.wsmTspecPresent = 0;
5492 pDeltsReq->req.wmeTspecPresent = 0;
5493 pDeltsReq->req.lleTspecPresent = 0;
5494
5495 if ((pSta->wsmEnabled) &&
5496 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5497 pDeltsReq->req.wsmTspecPresent = 1;
5498 else if (pSta->wmeEnabled)
5499 pDeltsReq->req.wmeTspecPresent = 1;
5500 else if (pSta->lleEnabled)
5501 pDeltsReq->req.lleTspecPresent = 1;
5502 else
5503 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005504 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005505 return eSIR_FAILURE;
5506 }
5507
5508 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5509 : &pDeltsReq->req.tsinfo;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305510 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005511 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005512 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305513 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);
Jeff Johnson295189b2012-06-20 16:38:30 -07005514
5515 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005516
5517 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5518 != eSIR_SUCCESS)
5519 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005520 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005521 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5522 return eSIR_FAILURE;
5523 }
5524 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5525 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5526 {
5527 //edca only now.
5528 }
5529 else
5530 {
5531 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5532 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5533 {
5534 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305535 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5536 pSta->staIndex,
5537 tspecIdx,
5538 pDeltsReq->req,
5539 psessionEntry->peSessionId,
5540 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005541 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005542 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005543 tsinfo->traffic.userPrio);
5544 return eSIR_FAILURE;
5545 }
5546 }
5547 }
5548 return eSIR_SUCCESS;
5549}
5550
5551/** -------------------------------------------------------------
5552\fn limRegisterHalIndCallBack
5553\brief registers callback function to HAL for any indication.
5554\param tpAniSirGlobal pMac
5555\return none.
5556 -------------------------------------------------------------*/
5557void
5558limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5559{
5560 tSirMsgQ msg;
5561 tpHalIndCB pHalCB;
5562
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305563 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5564 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005565 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305566 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005567 return;
5568 }
5569
5570 pHalCB->pHalIndCB = limProcessHalIndMessages;
5571
5572 msg.type = WDA_REGISTER_PE_CALLBACK;
5573 msg.bodyptr = pHalCB;
5574 msg.bodyval = 0;
5575
Jeff Johnsone7245742012-09-05 17:12:55 -07005576 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005577 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5578 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305579 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005580 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005581 }
5582
5583 return;
5584}
5585
5586
5587/** -------------------------------------------------------------
5588\fn limProcessAddBaInd
5589
5590\brief handles the BA activity check timeout indication coming from HAL.
5591 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5592\param tpAniSirGlobal pMac
5593\param tSirMsgQ limMsg
5594\return None
5595-------------------------------------------------------------*/
5596void
5597limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5598{
5599 tANI_U8 i;
5600 tANI_U8 tid;
5601 tANI_U16 assocId;
5602 tpDphHashNode pSta;
5603 tpAddBaCandidate pBaCandidate;
5604 tANI_U32 baCandidateCnt;
5605 tpBaActivityInd pBaActivityInd;
5606 tpPESession psessionEntry;
5607 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005608#ifdef FEATURE_WLAN_TDLS
5609 boolean htCapable = FALSE;
5610#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005611
5612
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005613 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005614 return;
5615
5616 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5617 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5618
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005619 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005620 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005621 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305622 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005623 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005624 return;
5625 }
5626
5627 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005628#ifdef FEATURE_WLAN_TDLS
5629 if ((baCandidateCnt > pMac->lim.maxStation))
5630#else
5631 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5632#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005633 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305634 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005635 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005636 return;
5637 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005638
5639#ifdef FEATURE_WLAN_TDLS
5640 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5641 //AP capability
5642 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5643
5644 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5645 {
5646 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5647 if ((NULL == pSta) || (!pSta->valid))
5648 continue;
5649
5650 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5651 htCapable = pSta->mlmStaContext.htCapability;
5652 else
5653 htCapable = psessionEntry->htCapability;
5654
5655 if (htCapable)
5656 break;
5657 }
5658 if (!htCapable)
5659 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305660 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005661 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005662 return;
5663 }
5664#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005665
5666 //delete the complete dialoguetoken linked list
5667 limDeleteDialogueTokenList(pMac);
5668 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5669
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005670 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005671 {
5672 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005673 if ((NULL == pSta) || (!pSta->valid))
5674 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005675
5676 for (tid=0; tid<STACFG_MAX_TC; tid++)
5677 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005678 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005679 (pBaCandidate->baInfo[tid].fBaEnable))
5680 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005681 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5682 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5684 }
5685 }
5686 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305687 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005688 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005689 return;
5690}
5691
5692
5693/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005694\fn limDeleteBASessions
5695\brief Deletes all the exisitng BA sessions for given session
5696 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005697\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005698\param tpPESession pSessionEntry
5699\param tANI_U32 baDirection
5700\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005701-------------------------------------------------------------*/
5702
5703void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005704limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305705 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005706{
5707 tANI_U32 i;
5708 tANI_U8 tid;
5709 tpDphHashNode pSta;
5710
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005711 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005712 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005713 limLog(pMac, LOGE, FL("Session does not exist"));
5714 }
5715 else
5716 {
5717 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005718 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005719 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5720 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5721 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5722 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005723 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005724 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005726 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5727 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005728 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005729 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5730 (baDirection & BA_INITIATOR))
5731 {
5732 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305733 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005734 pSessionEntry);
5735 }
5736 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5737 (baDirection & BA_RECIPIENT))
5738 {
5739 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305740 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005741 pSessionEntry);
5742 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005743 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005744 }
5745 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005746 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5747 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5748 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005749 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005750 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5751 &pSessionEntry->dph.dphHashTable);
5752 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005753 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5755 (baDirection & BA_INITIATOR))
5756 {
5757 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305758 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005759 pSessionEntry);
5760 }
5761 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5762 (baDirection & BA_RECIPIENT))
5763 {
5764 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305765 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005766 pSessionEntry);
5767 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005768 }
5769 }
5770 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 }
5772}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005773
5774/** -------------------------------------------------------------
5775\fn limDelAllBASessions
5776\brief Deletes all the exisitng BA sessions.
5777\param tpAniSirGlobal pMac
5778\return None
5779-------------------------------------------------------------*/
5780
5781void limDelAllBASessions(tpAniSirGlobal pMac)
5782{
5783 tANI_U32 i;
5784 tpPESession pSessionEntry;
5785
5786 for (i = 0; i < pMac->lim.maxBssId; i++)
5787 {
5788 pSessionEntry = peFindSessionBySessionId(pMac, i);
5789 if (pSessionEntry)
5790 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305791 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5792 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005793 }
5794 }
5795}
5796
5797/** -------------------------------------------------------------
5798\fn limDelAllBASessionsBtc
5799\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5800 band.
5801\param tpAniSirGlobal pMac
5802\return None
5803-------------------------------------------------------------*/
5804
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005805void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005806{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005807 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005808 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005809 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5810 &sessionId);
5811 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005812 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005813 PELOGW(limLog(pMac, LOGW,
5814 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305815 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305816 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005817 }
5818}
5819
Jeff Johnson295189b2012-06-20 16:38:30 -07005820/** -------------------------------------------------------------
5821\fn limProcessDelTsInd
5822\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5823 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5824\param tpAniSirGlobal pMac
5825\param tSirMsgQ limMsg
5826\return None
5827-------------------------------------------------------------*/
5828void
5829limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5830{
5831 tpDphHashNode pSta;
5832 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5833 tpSirDeltsReq pDelTsReq = NULL;
5834 tSirMacAddr peerMacAddr;
5835 tpSirDeltsReqInfo pDelTsReqInfo;
5836 tpLimTspecInfo pTspecInfo;
5837 tpPESession psessionEntry;
5838 tANI_U8 sessionId;
5839
5840if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5841 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005842 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305843 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005844 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005845 return;
5846 }
5847
5848 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5849 if(pTspecInfo->inuse == false)
5850 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005851 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005852 goto error1;
5853 }
5854
5855 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5856 if(pSta == NULL)
5857 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005858 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005859 pTspecInfo->assocId);
5860 goto error1;
5861 }
5862
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305863 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5864 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005865 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305866 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005867 goto error1;
5868 }
5869
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305870 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005871
5872 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305873 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005874 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305875 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005876
5877
5878 //validate the req
5879 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5880 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005881 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 goto error2;
5883 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305884 limLog(pMac, LOG1, "Sent DELTS request to station with "
5885 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5886 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005887
5888 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5889 psessionEntry);
5890
5891 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305892 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5893 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005894 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305895 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005896 goto error3;
5897 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305898 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005899
5900 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305901 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005902 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305903 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005904
5905 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5906
5907error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305908 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005909error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305910 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005911error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305912 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005913 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005914 return;
5915}
5916
5917/**
5918 * \brief Setup an A-MPDU/BA session
5919 *
5920 * \sa limPostMlmAddBAReq
5921 *
5922 * \param pMac The global tpAniSirGlobal object
5923 *
5924 * \param pStaDs DPH Hash Node object of peer STA
5925 *
5926 * \param tid TID for which a BA is being setup.
5927 * If this is set to 0xFFFF, then we retrieve
5928 * the default TID from the CFG
5929 *
5930 * \return eSIR_SUCCESS if setup completes successfully
5931 * eSIR_FAILURE is some problem is encountered
5932 */
5933tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5934 tpDphHashNode pStaDs,
5935 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5936{
5937 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005938 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005939 tpDialogueToken dialogueTokenNode;
5940 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005941
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 // Check if the peer is a 11n capable STA
5943 // FIXME - Need a 11n peer indication in DPH.
5944 // For now, using the taurusPeer attribute
5945 //if( 0 == pStaDs->taurusPeer == )
5946 //return eSIR_SUCCESS;
5947
5948 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305949 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5950 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005951 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305952 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 status = eSIR_MEM_ALLOC_FAILED;
5954 goto returnFailure;
5955 }
5956
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305957 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005958
5959 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305960 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005961 pMlmAddBAReq->peerMacAddr,
5962 pStaDs->staAddr,
5963 sizeof( tSirMacAddr ));
5964
5965 // Update the TID
5966 pMlmAddBAReq->baTID = tid;
5967
5968 // Determine the supported BA policy of local STA
5969 // for the TID of interest
5970 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5971
5972 // BA Buffer Size
5973 // Requesting the ADDBA recipient to populate the size.
5974 // If ADDBA is accepted, a non-zero buffer size should
5975 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305976 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5977 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5978 {
5979 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5980 causing very low throughput in HT40 case */
5981 limLog( pMac, LOGW,
5982 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5983 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5984 }
5985 else
5986 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005987
5988 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005989 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5991 pStaDs->staIndex,
5992 tid );
5993
5994 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005995 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005996 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005997 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005998 status = eSIR_FAILURE;
5999 goto returnFailure;
6000 }
6001 pMlmAddBAReq->baTimeout = val; // In TU's
6002
6003 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006004 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07006005 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
6006 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
6007
6008 // BA Starting Sequence Number
6009 pMlmAddBAReq->baSSN = startingSeqNum;
6010
6011 /* Update PE session Id*/
6012 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
6013
6014 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
6015
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006016 dialogueTokenNode = limAssignDialogueToken(pMac);
6017 if (NULL == dialogueTokenNode)
6018 {
6019 limLog(pMac, LOGE, FL("could not assign dialogue token"));
6020 status = eSIR_FAILURE;
6021 goto returnFailure;
6022 }
6023
Jeff Johnson295189b2012-06-20 16:38:30 -07006024 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006025 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07006026 dialogueTokenNode->assocId = pStaDs->assocId;
6027 dialogueTokenNode->tid = tid;
6028 // Send ADDBA Req to MLME
6029 limPostMlmMessage( pMac,
6030 LIM_MLM_ADDBA_REQ,
6031 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07006032 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006033
6034returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306035 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006036 return status;
6037}
6038
6039/**
6040 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
6041 * will then send an ADDBA Rsp to peer MAC entity
6042 * with the appropriate ADDBA status code
6043 *
6044 * \sa limPostMlmAddBARsp
6045 *
6046 * \param pMac The global tpAniSirGlobal object
6047 *
6048 * \param peerMacAddr MAC address of peer entity that will
6049 * be the recipient of this ADDBA Rsp
6050 *
6051 * \param baStatusCode ADDBA Rsp status code
6052 *
6053 * \param baDialogToken ADDBA Rsp dialog token
6054 *
6055 * \param baTID TID of interest
6056 *
6057 * \param baPolicy The BA policy
6058 *
6059 * \param baBufferSize The BA buffer size
6060 *
6061 * \param baTimeout BA timeout in TU's
6062 *
6063 * \return eSIR_SUCCESS if setup completes successfully
6064 * eSIR_FAILURE is some problem is encountered
6065 */
6066tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6067 tSirMacAddr peerMacAddr,
6068 tSirMacStatusCodes baStatusCode,
6069 tANI_U8 baDialogToken,
6070 tANI_U8 baTID,
6071 tANI_U8 baPolicy,
6072 tANI_U16 baBufferSize,
6073 tANI_U16 baTimeout,
6074 tpPESession psessionEntry)
6075{
6076tSirRetStatus status = eSIR_SUCCESS;
6077tpLimMlmAddBARsp pMlmAddBARsp;
6078
6079 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306080 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6081 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006082 {
6083 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306084 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006085 status );
6086
6087 status = eSIR_MEM_ALLOC_FAILED;
6088 goto returnFailure;
6089 }
6090
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306091 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006092
6093 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306094 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006095 pMlmAddBARsp->peerMacAddr,
6096 peerMacAddr,
6097 sizeof( tSirMacAddr ));
6098
6099 pMlmAddBARsp->baDialogToken = baDialogToken;
6100 pMlmAddBARsp->addBAResultCode = baStatusCode;
6101 pMlmAddBARsp->baTID = baTID;
6102 pMlmAddBARsp->baPolicy = baPolicy;
6103 pMlmAddBARsp->baBufferSize = baBufferSize;
6104 pMlmAddBARsp->baTimeout = baTimeout;
6105
6106 /* UPdate PE session ID*/
6107 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6108
6109 // Send ADDBA Rsp to MLME
6110 limPostMlmMessage( pMac,
6111 LIM_MLM_ADDBA_RSP,
6112 (tANI_U32 *) pMlmAddBARsp );
6113
6114returnFailure:
6115
6116 return status;
6117}
6118
6119/**
6120 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6121 * will then send an DELBA Ind to peer MAC entity
6122 * with the appropriate DELBA status code
6123 *
6124 * \sa limPostMlmDelBAReq
6125 *
6126 * \param pMac The global tpAniSirGlobal object
6127 *
6128 * \param pSta DPH Hash Node object of peer MAC entity
6129 * for which the BA session is being deleted
6130 *
6131 * \param baDirection DELBA direction
6132 *
6133 * \param baTID TID for which the BA session is being deleted
6134 *
6135 * \param baReasonCode DELBA Req reason code
6136 *
6137 * \return eSIR_SUCCESS if setup completes successfully
6138 * eSIR_FAILURE is some problem is encountered
6139 */
6140tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6141 tpDphHashNode pSta,
6142 tANI_U8 baDirection,
6143 tANI_U8 baTID,
6144 tSirMacReasonCodes baReasonCode,
6145 tpPESession psessionEntry)
6146{
6147tSirRetStatus status = eSIR_SUCCESS;
6148tpLimMlmDelBAReq pMlmDelBAReq;
6149tLimBAState curBaState;
6150
6151if(NULL == pSta)
6152 return eSIR_FAILURE;
6153
6154LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6155
6156 // Need to validate the current BA State.
6157 if( eLIM_BA_STATE_IDLE != curBaState)
6158 {
6159 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006160 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006161 baTID,
6162 curBaState);
6163
6164 status = eSIR_FAILURE;
6165 goto returnFailure;
6166 }
6167
6168 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306169 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6170 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006171 {
6172 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306173 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006174 status );
6175
6176 status = eSIR_MEM_ALLOC_FAILED;
6177 goto returnFailure;
6178 }
6179
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306180 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006181
6182 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306183 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006184 pMlmDelBAReq->peerMacAddr,
6185 pSta->staAddr,
6186 sizeof( tSirMacAddr ));
6187
6188 pMlmDelBAReq->baDirection = baDirection;
6189 pMlmDelBAReq->baTID = baTID;
6190 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6191
6192 /* Update PE session ID*/
6193 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6194
6195 //we don't have valid BA session for the given direction.
6196 // HDD wants to get the BA session deleted on PEER in this case.
6197 // in this case we just need to send DelBA to the peer.
6198 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6199 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6200 {
6201 // Send DELBA Ind over the air
6202 if( eSIR_SUCCESS !=
6203 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6204 status = eSIR_FAILURE;
6205
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306206 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006207 return status;
6208 }
6209
6210
6211 // Update the BA state in STA
6212 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6213
6214 // Send DELBA Req to MLME
6215 limPostMlmMessage( pMac,
6216 LIM_MLM_DELBA_REQ,
6217 (tANI_U32 *) pMlmDelBAReq );
6218
6219returnFailure:
6220
6221 return status;
6222}
6223
6224/**
6225 * \brief Send WDA_ADDBA_REQ to HAL, in order
6226 * to setup a new BA session with a peer
6227 *
6228 * \sa limPostMsgAddBAReq
6229 *
6230 * \param pMac The global tpAniSirGlobal object
6231 *
6232 * \param pSta Runtime, STA-related configuration cached
6233 * in the HashNode object
6234 *
6235 * \param baDialogToken The Action Frame dialog token
6236 *
6237 * \param baTID TID for which the BA session is being setup
6238 *
6239 * \param baPolicy BA Policy
6240 *
6241 * \param baBufferSize The requested BA buffer size
6242 *
6243 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6244 *
6245 * \param baSSN Starting Sequence Number for this BA session
6246 *
6247 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6248 *
6249 * \return none
6250 *
6251 */
6252tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6253 tpDphHashNode pSta,
6254 tANI_U8 baDialogToken,
6255 tANI_U8 baTID,
6256 tANI_U8 baPolicy,
6257 tANI_U16 baBufferSize,
6258 tANI_U16 baTimeout,
6259 tANI_U16 baSSN,
6260 tANI_U8 baDirection,
6261 tpPESession psessionEntry)
6262{
6263tpAddBAParams pAddBAParams = NULL;
6264tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006265tSirMsgQ msgQ;
6266
6267#ifdef WLAN_SOFTAP_VSTA_FEATURE
6268 // we can only do BA on "hard" STAs
6269 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6270 {
6271 retCode = eHAL_STATUS_FAILURE;
Masti, Narayanraddi04010dc2014-12-16 20:06:11 +05306272 limLog( pMac, LOGE,
6273 FL( "Sta Id is not HW Sta Id, return code is %d " ), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07006274 goto returnFailure;
6275 }
6276#endif //WLAN_SOFTAP_VSTA_FEATURE
6277
6278 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306279 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6280 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006281 {
6282 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306283 FL("AllocateMemory failed")
6284 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006285
6286 retCode = eSIR_MEM_ALLOC_FAILED;
6287 goto returnFailure;
6288 }
6289
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306290 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006291
6292 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306293 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 (void *) pAddBAParams->peerMacAddr,
6295 (void *) pSta->staAddr,
6296 sizeof( tSirMacAddr ));
6297
6298 // Populate the REQ parameters
6299 pAddBAParams->staIdx = pSta->staIndex;
6300 pAddBAParams->baDialogToken = baDialogToken;
6301 pAddBAParams->baTID = baTID;
6302 pAddBAParams->baPolicy = baPolicy;
6303 pAddBAParams->baBufferSize = baBufferSize;
6304 pAddBAParams->baTimeout = baTimeout;
6305 pAddBAParams->baSSN = baSSN;
6306 pAddBAParams->baDirection = baDirection;
6307 pAddBAParams->respReqd = 1;
6308
6309 /* UPdate PE session ID */
6310 pAddBAParams->sessionId = psessionEntry->peSessionId;
6311
6312 // Post WDA_ADDBA_REQ to HAL.
6313 msgQ.type = WDA_ADDBA_REQ;
6314 //
6315 // FIXME_AMPDU
6316 // A global counter (dialog token) is required to keep track of
6317 // all PE <-> HAL communication(s)
6318 //
6319 msgQ.reserved = 0;
6320 msgQ.bodyptr = pAddBAParams;
6321 msgQ.bodyval = 0;
6322
6323 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306324 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6325 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6326 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6327 pAddBAParams->baTimeout, pAddBAParams->baTID,
6328 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6329 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006330
6331 //defer any other message until we get response back.
6332 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6333
Jeff Johnsone7245742012-09-05 17:12:55 -07006334 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006335#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6336 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6337#endif //FEATURE_WLAN_DIAG_SUPPORT
6338
6339 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6340 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006341 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006342 retCode );
6343 else
6344 return retCode;
6345
6346returnFailure:
6347
6348 // Clean-up...
6349 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306350 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006351
6352 return retCode;
6353
6354}
6355
6356/**
6357 * \brief Send WDA_DELBA_IND to HAL, in order
6358 * to delete an existing BA session with peer
6359 *
6360 * \sa limPostMsgDelBAInd
6361 *
6362 * \param pMac The global tpAniSirGlobal object
6363 *
6364 * \param pSta Runtime, STA-related configuration cached
6365 * in the HashNode object
6366 *
6367 * \param baTID TID for which the BA session is being setup
6368 *
6369 * \param baDirection Identifies whether the DELBA Ind was
6370 * sent by the BA initiator or recipient
6371 *
6372 * \return none
6373 *
6374 */
6375tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6376 tpDphHashNode pSta,
6377 tANI_U8 baTID,
6378 tANI_U8 baDirection,
6379 tpPESession psessionEntry)
6380{
6381tpDelBAParams pDelBAParams = NULL;
6382tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006383tSirMsgQ msgQ;
6384
6385 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306386 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6387 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 {
6389 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306390 FL("AllocateMemory failed")
6391 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006392
6393 retCode = eSIR_MEM_ALLOC_FAILED;
6394 goto returnFailure;
6395 }
6396
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306397 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006398
6399 // Populate the REQ parameters
6400 pDelBAParams->staIdx = pSta->staIndex;
6401 pDelBAParams->baTID = baTID;
6402 pDelBAParams->baDirection = baDirection;
6403
6404 /* Update PE session ID */
6405
6406
6407 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6408 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6409
6410 // Post WDA_DELBA_IND to HAL.
6411 msgQ.type = WDA_DELBA_IND;
6412 //
6413 // FIXME:
6414 // A global counter (dialog token) is required to keep track of
6415 // all PE <-> HAL communication(s)
6416 //
6417 msgQ.reserved = 0;
6418 msgQ.bodyptr = pDelBAParams;
6419 msgQ.bodyval = 0;
6420
6421 limLog( pMac, LOGW,
6422 FL( "Sending SIR_HAL_DELBA_IND..." ));
6423
Jeff Johnsone7245742012-09-05 17:12:55 -07006424 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006425#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6426 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6427#endif //FEATURE_WLAN_DIAG_SUPPORT
6428
6429 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6430 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006431 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006432 retCode );
6433 else
6434 {
6435 // Update LIM's internal cache...
6436 if( eBA_INITIATOR == baDirection)
6437 {
6438 pSta->tcCfg[baTID].fUseBATx = 0;
6439 pSta->tcCfg[baTID].txBufSize = 0;
6440 }
6441 else
6442 {
6443 pSta->tcCfg[baTID].fUseBARx = 0;
6444 pSta->tcCfg[baTID].rxBufSize = 0;
6445 }
6446
6447 return retCode;
6448 }
6449
6450returnFailure:
6451
6452 // Clean-up...
6453 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306454 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006455
6456 return retCode;
6457
6458}
6459
6460/**
6461 * @function : limPostSMStateUpdate()
6462 *
6463 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6464 *
6465 * LOGIC:
6466 *
6467 * ASSUMPTIONS:
6468 * NA
6469 *
6470 * NOTE:
6471 * NA
6472 *
6473 * @param pMac - Pointer to Global MAC structure
6474 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6475 * @return None
6476 */
6477tSirRetStatus
6478limPostSMStateUpdate(tpAniSirGlobal pMac,
6479 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6480{
6481 tSirRetStatus retCode = eSIR_SUCCESS;
6482 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006483 tpSetMIMOPS pMIMO_PSParams;
6484
6485 msgQ.reserved = 0;
6486 msgQ.type = WDA_SET_MIMOPS_REQ;
6487
6488 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306489 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6490 if ( NULL == pMIMO_PSParams )
6491 {
6492 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006493 return eSIR_MEM_ALLOC_FAILED;
6494 }
6495
6496 pMIMO_PSParams->htMIMOPSState = state;
6497 pMIMO_PSParams->staIdx = staIdx;
6498 pMIMO_PSParams->fsendRsp = true;
6499 msgQ.bodyptr = pMIMO_PSParams;
6500 msgQ.bodyval = 0;
6501
6502 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6503
Jeff Johnsone7245742012-09-05 17:12:55 -07006504 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006505 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6506 if (eSIR_SUCCESS != retCode)
6507 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006508 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306509 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006510 return retCode;
6511 }
6512
6513 return retCode;
6514}
6515
6516void limPktFree (
6517 tpAniSirGlobal pMac,
6518 eFrameType frmType,
6519 tANI_U8 *pRxPacketInfo,
6520 void *pBody)
6521{
6522 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006523}
6524
6525/**
6526 * limGetBDfromRxPacket()
6527 *
6528 *FUNCTION:
6529 * This function is called to get pointer to Polaris
6530 * Buffer Descriptor containing MAC header & other control
6531 * info from the body of the message posted to LIM.
6532 *
6533 *LOGIC:
6534 * NA
6535 *
6536 *ASSUMPTIONS:
6537 * NA
6538 *
6539 *NOTE:
6540 * NA
6541 *
6542 * @param body - Received message body
6543 * @param pRxPacketInfo - Pointer to received BD
6544 * @return None
6545 */
6546
6547void
6548limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6549{
Jeff Johnson295189b2012-06-20 16:38:30 -07006550 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006551} /*** end limGetBDfromRxPacket() ***/
6552
6553
6554
6555
6556
6557void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6558{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306559 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006560}
6561
6562
6563void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6564{
6565 tANI_U8 i;
6566 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6567
6568 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6569 {
6570 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6571 {
6572 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6573 fFound = eANI_BOOLEAN_TRUE;
6574 break;
6575 }
6576 }
6577 if(eANI_BOOLEAN_FALSE == fFound)
6578 {
6579 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6580 {
6581 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6582 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6583 }
6584 else
6585 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006586 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 }
6588 }
6589}
6590
6591
6592/**
6593 * @function : limIsChannelValidForChannelSwitch()
6594 *
6595 * @brief : This function checks if the channel to which AP
6596 * is expecting us to switch, is a valid channel for us.
6597 * LOGIC:
6598 *
6599 * ASSUMPTIONS:
6600 * NA
6601 *
6602 * NOTE:
6603 * NA
6604 *
6605 * @param pMac - Pointer to Global MAC structure
6606 * @param channel - New channel to which we are expected to move
6607 * @return None
6608 */
6609tAniBool
6610limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6611{
6612 tANI_U8 index;
6613 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6614 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6615
6616 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6617 (tANI_U8 *)validChannelList,
6618 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6619 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006620 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006621 return (eSIR_FALSE);
6622 }
6623
6624 for(index = 0; index < validChannelListLen; index++)
6625 {
6626 if(validChannelList[index] == channel)
6627 return (eSIR_TRUE);
6628 }
6629
6630 /* channel does not belong to list of valid channels */
6631 return (eSIR_FALSE);
6632}
6633
6634/**------------------------------------------------------
6635\fn __limFillTxControlParams
6636\brief Fill the message for stopping/resuming tx.
6637
6638\param pMac
6639\param pTxCtrlMsg - Pointer to tx control message.
6640\param type - Which way we want to stop/ resume tx.
6641\param mode - To stop/resume.
6642 -------------------------------------------------------*/
6643static eHalStatus
6644__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6645 tLimQuietTxMode type, tLimControlTx mode)
6646{
6647
6648 //TBD-RAJESH HOW TO GET sessionEntry?????
6649 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6650
6651 if (mode == eLIM_STOP_TX)
6652 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6653 else
6654 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6655
6656 switch (type)
6657 {
6658 case eLIM_TX_ALL:
6659 /** Stops/resumes transmission completely */
6660 pTxCtrlMsg->fCtrlGlobal = 1;
6661 break;
6662
6663 case eLIM_TX_BSS_BUT_BEACON:
6664 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6665 * stop beacon transmission.
6666 */
6667 pTxCtrlMsg->ctrlBss = 1;
6668 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6669 break;
6670
6671 case eLIM_TX_STA:
6672 /** Memory for station bitmap is allocated dynamically in caller of this
6673 * so decode properly here and fill the bitmap. Now not implemented,
6674 * fall through.
6675 */
6676 case eLIM_TX_BSS:
6677 //Fall thru...
6678 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006679 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006680 return eHAL_STATUS_FAILURE;
6681 }
6682
6683 return eHAL_STATUS_SUCCESS;
6684}
6685
6686/**
6687 * @function : limFrameTransmissionControl()
6688 *
6689 * @brief : This API is called by the user to halt/resume any frame
6690 * transmission from the device. If stopped, all frames will be
6691 * queued starting from hardware. Then back-pressure
6692 * is built till the driver.
6693 * LOGIC:
6694 *
6695 * ASSUMPTIONS:
6696 * NA
6697 *
6698 * NOTE:
6699 * NA
6700 *
6701 * @param pMac - Pointer to Global MAC structure
6702 * @return None
6703 */
6704void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6705{
6706
6707 eHalStatus status = eHAL_STATUS_FAILURE;
6708 tpTxControlParams pTxCtrlMsg;
6709 tSirMsgQ msgQ;
6710 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6711
6712 /** Allocate only required number of bytes for station bitmap
6713 * Make it to align to 4 byte boundary */
6714 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6715
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306716 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6717 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006718 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306719 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006720 return;
6721 }
6722
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306723 vos_mem_set((void *) pTxCtrlMsg,
6724 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006725 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6726 if (status != eHAL_STATUS_SUCCESS)
6727 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306728 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006729 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006730 return;
6731 }
6732
6733 msgQ.bodyptr = (void *) pTxCtrlMsg;
6734 msgQ.bodyval = 0;
6735 msgQ.reserved = 0;
6736 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6737
Jeff Johnsone7245742012-09-05 17:12:55 -07006738 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6740 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306741 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006742 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 return;
6744 }
6745
6746 if (mode == eLIM_STOP_TX)
6747 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306748 limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006749 }
6750 else
6751 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05306752 limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 }
6754 return;
6755}
6756
6757
6758/**
6759 * @function : limRestorePreChannelSwitchState()
6760 *
6761 * @brief : This API is called by the user to undo any
6762 * specific changes done on the device during
6763 * channel switch.
6764 * LOGIC:
6765 *
6766 * ASSUMPTIONS:
6767 * NA
6768 *
6769 * NOTE:
6770 * NA
6771 *
6772 * @param pMac - Pointer to Global MAC structure
6773 * @return None
6774 */
6775
6776tSirRetStatus
6777limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6778{
6779
6780 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006781 tANI_U32 val = 0;
6782
6783 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6784 return retCode;
6785
6786 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006787 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006788
6789 /* Restore the frame transmission, all the time. */
6790 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6791
6792 /* Free to enter BMPS */
6793 limSendSmePostChannelSwitchInd(pMac);
6794
6795 //Background scan is now enabled by SME
6796 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6797 {
6798 /* Enable background scan if already enabled, else don't bother */
6799 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6800 &val)) != eSIR_SUCCESS)
6801
6802 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006803 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006804 return (retCode);
6805 }
6806
6807 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6808 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006809 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6810 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6812 {
6813 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6814 return (eSIR_FAILURE);
6815 }
6816
6817 }
6818 }
6819
6820 /* Enable heartbeat timer */
6821 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6822 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006823 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6824 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6825 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6826 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006827 {
6828 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6829 return (eSIR_FAILURE);
6830 }
6831 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006832 return (retCode);
6833}
6834
6835
6836/**--------------------------------------------
6837\fn limRestorePreQuietState
6838\brief Restore the pre quiet state
6839
6840\param pMac
6841\return NONE
6842---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006843tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006844{
6845
6846 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 tANI_U32 val = 0;
6848
6849 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6850 return retCode;
6851
6852 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006853 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006854
6855 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006856 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6858
6859
6860 //Background scan is now enabled by SME
6861 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6862 {
6863 /* Enable background scan if already enabled, else don't bother */
6864 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6865 &val)) != eSIR_SUCCESS)
6866
6867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006868 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006869 return (retCode);
6870 }
6871
6872 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6873 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006874 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006875 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6876 {
6877 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6878 return (eSIR_FAILURE);
6879 }
6880
6881 }
6882 }
6883
6884 /* Enable heartbeat timer */
6885 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6886 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006887 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006888 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006889 {
6890 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6891 return (eSIR_FAILURE);
6892 }
6893 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006894 return (retCode);
6895}
6896
6897
6898/**
6899 * @function: limPrepareFor11hChannelSwitch()
6900 *
6901 * @brief : This API is called by the user to prepare for
6902 * 11h channel switch. As of now, the API does
6903 * very minimal work. User can add more into the
6904 * same API if needed.
6905 * LOGIC:
6906 *
6907 * ASSUMPTIONS:
6908 * NA
6909 *
6910 * NOTE:
6911 * NA
6912 *
6913 * @param pMac - Pointer to Global MAC structure
6914 * @param psessionEntry
6915 * @return None
6916 */
6917void
6918limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6919{
Jeff Johnson295189b2012-06-20 16:38:30 -07006920 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6921 return;
6922
6923 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006924 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006925
6926 /* Disable, Stop background scan if enabled and running */
6927 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6928
6929 /* Stop heart-beat timer to stop heartbeat disassociation */
6930 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6931
6932 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6933 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6934 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006935 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006936 /* Stop ongoing scanning if any */
6937 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6938 {
6939 //Set the resume channel to Any valid channel (invalid).
6940 //This will instruct HAL to set it to any previous valid channel.
6941 peSetResumeChannel(pMac, 0, 0);
6942 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6943 }
6944 else
6945 {
6946 limRestorePreChannelSwitchState(pMac, psessionEntry);
6947 }
6948 return;
6949 }
6950 else
6951 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006952 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006953 /** We are safe to switch channel at this point */
6954 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6955 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006956}
6957
6958
6959
6960/**----------------------------------------------------
6961\fn limGetNwType
6962
6963\brief Get type of the network from data packet or beacon
6964\param pMac
6965\param channelNum - Channel number
6966\param type - Type of packet.
6967\param pBeacon - Pointer to beacon or probe response
6968
6969\return Network type a/b/g.
6970-----------------------------------------------------*/
6971tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6972{
6973 tSirNwType nwType = eSIR_11B_NW_TYPE;
6974
6975 if (type == SIR_MAC_DATA_FRAME)
6976 {
6977 if ((channelNum > 0) && (channelNum < 15))
6978 {
6979 nwType = eSIR_11G_NW_TYPE;
6980 }
6981 else
6982 {
6983 nwType = eSIR_11A_NW_TYPE;
6984 }
6985 }
6986 else
6987 {
6988 if ((channelNum > 0) && (channelNum < 15))
6989 {
6990 int i;
6991 // 11b or 11g packet
6992 // 11g iff extended Rate IE is present or
6993 // if there is an A rate in suppRate IE
6994 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6995 {
6996 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6997 {
6998 nwType = eSIR_11G_NW_TYPE;
6999 break;
7000 }
7001 }
7002 if (pBeacon->extendedRatesPresent)
7003 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007004 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007005 nwType = eSIR_11G_NW_TYPE;
7006 }
7007 }
7008 else
7009 {
7010 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007011 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07007012 nwType = eSIR_11A_NW_TYPE;
7013 }
7014 }
7015 return nwType;
7016}
7017
7018
7019/**---------------------------------------------------------
7020\fn limGetChannelFromBeacon
7021\brief To extract channel number from beacon
7022
7023\param pMac
7024\param pBeacon - Pointer to beacon or probe rsp
7025\return channel number
7026-----------------------------------------------------------*/
7027tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
7028{
7029 tANI_U8 channelNum = 0;
7030
7031 if (pBeacon->dsParamsPresent)
7032 channelNum = pBeacon->channelNumber;
7033 else if(pBeacon->HTInfo.present)
7034 channelNum = pBeacon->HTInfo.primaryChannel;
7035 else
7036 channelNum = pBeacon->channelNumber;
7037
7038 return channelNum;
7039}
7040
7041
7042/** ---------------------------------------------------------
7043\fn limSetTspecUapsdMask
7044\brief This function sets the PE global variable:
7045\ 1) gUapsdPerAcTriggerEnableMask and
7046\ 2) gUapsdPerAcDeliveryEnableMask
7047\ based on the user priority field and direction field
7048\ in the TS Info Fields.
7049\
7050\ An AC is a trigger-enabled AC if the PSB subfield
7051\ is set to 1 in the uplink direction.
7052\ An AC is a delivery-enabled AC if the PSB subfield
7053\ is set to 1 in the down-link direction.
7054\
7055\param tpAniSirGlobal pMac
7056\param tSirMacTSInfo pTsInfo
7057\param tANI_U32 action
7058\return None
7059 ------------------------------------------------------------*/
7060void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
7061{
7062 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
7063 tANI_U16 direction = pTsInfo->traffic.direction;
7064 tANI_U8 ac = upToAc(userPrio);
7065
Abhishek Singh3cbf6052014-12-15 16:46:42 +05307066 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 -07007067
7068 /* Converting AC to appropriate Uapsd Bit Mask
7069 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7070 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7071 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7072 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7073 */
7074 ac = ((~ac) & 0x3);
7075
7076 if (action == CLEAR_UAPSD_MASK)
7077 {
7078 if (direction == SIR_MAC_DIRECTION_UPLINK)
7079 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7080 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7081 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7082 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7083 {
7084 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7085 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7086 }
7087 }
7088 else if (action == SET_UAPSD_MASK)
7089 {
7090 if (direction == SIR_MAC_DIRECTION_UPLINK)
7091 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7092 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7093 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7094 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7095 {
7096 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7097 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7098 }
7099 }
7100
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007101 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7102 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007103
7104 return;
7105}
7106
7107
7108
7109void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7110{
7111
7112 tANI_U8 i;
7113 for(i =0;i < pMac->lim.maxBssId;i++)
7114 {
7115 if(pMac->lim.gpSession[i].valid == TRUE )
7116 {
7117 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7118 {
7119 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7120 break;
7121 }
7122
7123 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7124 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7125 {
7126 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7127 }
7128 }
7129 }
7130 for(i=0; i< pMac->lim.maxBssId; i++)
7131 {
7132 if(pMac->lim.gpSession[i].valid == TRUE )
7133 {
7134 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7135 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7136 {
7137 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7138 {
7139 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007140 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007141 i);)
7142 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7143 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7144 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7145 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007146 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007147 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7148 }
7149 break;
7150 }
7151 }
7152 }
7153 }
7154}
7155
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007156void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7157{
7158 if(psessionEntry->valid == TRUE )
7159 {
7160 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7161 {
7162 limIbssHeartBeatHandle(pMac,psessionEntry);
7163 }
7164 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7165 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7166 {
7167 limHandleHeartBeatFailure(pMac,psessionEntry);
7168 }
7169 }
7170 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7171 and the other things again */
7172 if(psessionEntry->valid == TRUE )
7173 {
7174 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7175 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7176 {
7177 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7178 {
7179 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7180 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7181 psessionEntry->bssIdx);)
7182 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7183 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7184 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7185 {
7186 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7187 limReactivateHeartBeatTimer(pMac, psessionEntry);
7188 }
7189 }
7190 }
7191 }
7192}
7193
7194
Jeff Johnson295189b2012-06-20 16:38:30 -07007195tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7196{
7197 tANI_U8 i;
7198 for(i =0;i < pMac->lim.maxBssId;i++)
7199 {
7200 if(pMac->lim.gpSession[i].valid == TRUE )
7201 {
7202 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7203 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7204 {
7205 return pMac->lim.gpSession[i].currentOperChannel;
7206 }
7207 }
7208 }
7209 return 0;
7210}
7211
7212void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7213{
7214
7215 tpPESession psessionEntry;
7216// tANI_U8 sessionId;
7217 tpAddStaParams pAddStaParams;
7218
7219 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7220
7221 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7222 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007223 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307224 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007225 return;
7226 }
7227 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7228 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007229#ifdef FEATURE_WLAN_TDLS
7230 else if(pMac->lim.gLimAddStaTdls)
7231 {
7232 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7233 pMac->lim.gLimAddStaTdls = FALSE ;
7234 }
7235#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007236 else
7237 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7238
7239}
7240
7241
7242void limUpdateBeacon(tpAniSirGlobal pMac)
7243{
7244 tANI_U8 i;
7245
7246 for(i =0;i < pMac->lim.maxBssId;i++)
7247 {
7248 if(pMac->lim.gpSession[i].valid == TRUE )
7249 {
7250 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7251 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7252 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7253 )
7254 {
7255 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7256 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7257 }
7258 else
7259 {
7260 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7261 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7262 {
7263
7264 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7265 {
7266 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7267 }
7268 }
7269 }
7270 }
7271 }
7272}
7273
7274void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7275{
7276 tANI_U8 i;
7277 tpPESession psessionEntry;
7278 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7279 for(i =0; i < pMac->lim.maxBssId; i++)
7280 {
7281 if(pMac->lim.gpSession[i].valid == TRUE)
7282 {
7283 psessionEntry = &pMac->lim.gpSession[i];
7284 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7285 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307286 limLog(pMac, LOGE,
7287 FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d BCN count %d"),
7288 psessionEntry->limSmeState, psessionEntry->limMlmState,
7289 psessionEntry->LimRxedBeaconCntDuringHB,
7290 psessionEntry->currentBssBeaconCnt);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007291#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7292 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7293#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007294 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7295 {
Abhishek Singh514e0702014-12-05 13:49:37 +05307296 /* Disconnect even if we have not received a single beacon
7297 * after connection.
7298 */
7299 if (((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) ||
7300 (0 == psessionEntry->currentBssBeaconCnt)) &&
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307301 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7302 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007303 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007304 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007305 /* AP did not respond to Probe Request. Tear down link with it.*/
7306 limTearDownLinkWithAp(pMac,
7307 psessionEntry->peSessionId,
7308 eSIR_BEACON_MISSED);
7309 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7310 }
7311 else // restart heartbeat timer
7312 {
7313 limReactivateHeartBeatTimer(pMac, psessionEntry);
7314 }
7315 }
7316 else
7317 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007318 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007319 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7320 limReactivateHeartBeatTimer(pMac, psessionEntry);
7321 }
7322
7323 }
7324 }
7325 }
7326 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7327 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7328}
7329
7330
7331/*
7332* This function assumes there will not be more than one IBSS session active at any time.
7333*/
7334tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7335{
7336 tANI_U8 i;
7337
7338 for(i =0;i < pMac->lim.maxBssId;i++)
7339 {
7340 if( (pMac->lim.gpSession[i].valid) &&
7341 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7342 return (&pMac->lim.gpSession[i]);
7343 }
7344
7345 return NULL;
7346}
7347
7348tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7349{
7350 tANI_U8 i;
7351
7352 for(i =0;i < pMac->lim.maxBssId;i++)
7353 {
7354 if( (pMac->lim.gpSession[i].valid) &&
7355 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7356 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7357 return (&pMac->lim.gpSession[i]);
7358 }
7359
7360 return NULL;
7361}
7362
7363/**---------------------------------------------------------
7364\fn limHandleDeferMsgError
7365\brief handles error scenario, when the msg can not be deferred.
7366\param pMac
7367\param pLimMsg LIM msg, which could not be deferred.
7368\return void
7369-----------------------------------------------------------*/
7370
7371void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7372{
7373 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7374 {
7375 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7376 }
7377 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007378 {
7379 vos_mem_free( pLimMsg->bodyptr);
7380 pLimMsg->bodyptr = NULL;
7381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007382}
7383
7384
7385#ifdef FEATURE_WLAN_DIAG_SUPPORT
7386/**---------------------------------------------------------
7387\fn limDiagEventReport
7388\brief This function reports Diag event
7389\param pMac
7390\param eventType
7391\param bssid
7392\param status
7393\param reasonCode
7394\return void
7395-----------------------------------------------------------*/
7396void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7397{
7398 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7399 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7400
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307401 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007402
7403 if (NULL == pSessionEntry)
7404 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307405 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007406 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7407 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7408
7409 }
7410 else
7411 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307412 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007413 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7414 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7415 }
7416 peEvent.event_type = eventType;
7417 peEvent.status = status;
7418 peEvent.reason_code = reasonCode;
7419
7420 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7421 return;
7422}
7423
7424#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7425
7426void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7427{
7428
7429 tpAddStaSelfParams pAddStaSelfParams;
7430 tSirMsgQ mmhMsg;
7431 tpSirSmeAddStaSelfRsp pRsp;
7432
7433
7434 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7435
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307436 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7437 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007438 {
7439 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307440 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7441 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007442 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007443 return;
7444 }
7445
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307446 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007447
7448 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7449 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7450 pRsp->status = pAddStaSelfParams->status;
7451
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307452 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007453
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307454 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007455 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007456
7457 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7458 mmhMsg.bodyptr = pRsp;
7459 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007460 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007461 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7462
7463}
7464
7465void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7466{
7467
7468 tpDelStaSelfParams pDelStaSelfParams;
7469 tSirMsgQ mmhMsg;
7470 tpSirSmeDelStaSelfRsp pRsp;
7471
7472
7473 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7474
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307475 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7476 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007477 {
7478 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307479 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7480 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007481 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007482 return;
7483 }
7484
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307485 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007486
7487 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7488 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7489 pRsp->status = pDelStaSelfParams->status;
7490
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307491 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007492
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307493 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007494 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007495
7496 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7497 mmhMsg.bodyptr = pRsp;
7498 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007499 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007500 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7501
7502}
7503
7504/***************************************************************
7505* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7506* To unmap the channel to reverse the effect of mapping
7507* a band channel in hal .Mapping was done hal to overcome the
7508* limitation of the rxbd which use only 4 bit for channel number.
7509*****************************************************************/
7510tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7511{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007512#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007513 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007514 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7515 return aUnsortedChannelList[mapChannel -1];
7516 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007517#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007518 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007519#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007520 return abChannel[mapChannel -1];
7521 else
7522 return 0;
7523}
7524
7525
7526v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7527{
7528 int left = length;
7529 v_U8_t *ptr = pIes;
7530 v_U8_t elem_id;
7531 v_U16_t elem_len;
7532
7533 while(left >= (size_of_len_field+1))
7534 {
7535 elem_id = ptr[0];
7536 if (size_of_len_field == TWO_BYTE)
7537 {
7538 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7539 }
7540 else
7541 {
7542 elem_len = ptr[1];
7543 }
7544
7545
7546 left -= (size_of_len_field+1);
7547 if(elem_len > left)
7548 {
7549 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007550 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007551 eid,elem_len,left);
7552 return NULL;
7553 }
7554 if (elem_id == eid)
7555 {
7556 return ptr;
7557 }
7558
7559 left -= elem_len;
7560 ptr += (elem_len + (size_of_len_field+1));
7561 }
7562 return NULL;
7563}
7564
7565/* return NULL if oui is not found in ie
7566 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7567 */
7568v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7569{
7570 int left = ie_len;
7571 v_U8_t *ptr = ie;
7572 v_U8_t elem_id, elem_len;
7573
7574 while(left >= 2)
7575 {
7576 elem_id = ptr[0];
7577 elem_len = ptr[1];
7578 left -= 2;
7579 if(elem_len > left)
7580 {
7581 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007582 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007583 elem_id,elem_len,left);
7584 return NULL;
7585 }
7586 if (SIR_MAC_EID_VENDOR == elem_id)
7587 {
7588 if(memcmp(&ptr[2], oui, oui_size)==0)
7589 return ptr;
7590 }
7591
7592 left -= elem_len;
7593 ptr += (elem_len + 2);
7594 }
7595 return NULL;
7596}
7597
Jeff Johnson295189b2012-06-20 16:38:30 -07007598//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7599
7600v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7601{
7602 int length = 0;
7603 tANI_U8 *ptr = ie;
7604
7605 ptr[length++] = SIR_MAC_EID_VENDOR;
7606 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307607 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7608 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007609 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7610}
7611
7612//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7613
7614v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7615{
7616 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007617
7618 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7619 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7620 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307621 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007622 noaStream + noaLen - overFlowLen, overFlowLen);
7623 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7624 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307625 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007626 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307627 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7628 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007629 }
7630
Jeff Johnson295189b2012-06-20 16:38:30 -07007631 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7632
7633}
7634
7635//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7636v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7637{
7638 v_U8_t len=0;
7639
7640 v_U8_t *pBody = pNoaStream;
7641
7642
7643 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7644 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7645 {
7646 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7647 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7648 )
7649 return 0; //No NoA Descriptor then return 0
7650
7651
7652 pBody[0] = SIR_P2P_NOA_ATTR;
7653
7654 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7655 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7656 len = 5;
7657 pBody += len;
7658
7659
7660 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7661 {
7662 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7663 pBody += 1;
7664 len +=1;
7665
7666 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7667 pBody += sizeof(tANI_U32);
7668 len +=4;
7669
7670 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7671 pBody += sizeof(tANI_U32);
7672 len +=4;
7673
7674 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7675 pBody += sizeof(tANI_U32);
7676 len +=4;
7677
7678 }
7679
7680 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7681 {
7682 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7683 pBody += 1;
7684 len +=1;
7685
7686 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7687 pBody += sizeof(tANI_U32);
7688 len +=4;
7689
7690 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7691 pBody += sizeof(tANI_U32);
7692 len +=4;
7693
7694 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7695 pBody += sizeof(tANI_U32);
7696 len +=4;
7697
7698 }
7699
7700
7701 pBody = pNoaStream + 1;
7702 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7703
7704 return (len);
7705
7706 }
7707 return 0;
7708
7709}
Jeff Johnsone7245742012-09-05 17:12:55 -07007710
7711void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007712{
7713
7714 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007715 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007716}
Jeff Johnsone7245742012-09-05 17:12:55 -07007717
Jeff Johnson295189b2012-06-20 16:38:30 -07007718/*--------------------------------------------------------------------------
7719
7720 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7721
Jeff Johnsone7245742012-09-05 17:12:55 -07007722 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7723 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007724
7725 \param pMac - pointer to global adapter context
7726 \return - channel to scan from valid session else zero.
7727
7728 \sa
7729
7730 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007731void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007732{
7733
7734 //Rationale - this could be the suspend/resume for assoc and it is essential that
7735 //the new BSS is active for some time. Other BSS was anyway suspended.
7736 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7737 //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 -07007738 //and hence should be ok. Need to discuss this further
7739 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007740 {
7741 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007742 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007743 }
7744 else
7745 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007746 *resumeChannel = pMac->lim.gResumeChannel;
7747 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007748 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007749 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007750}
7751
Viral Modid86bde22012-12-10 13:09:21 -08007752tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7753{
7754 tANI_U8 i;
7755 for(i =0; i < pMac->lim.maxBssId; i++)
7756 {
7757 if(pMac->lim.gpSession[i].valid == TRUE)
7758 {
7759 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7760 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7761 )
7762 {
7763 return TRUE;
7764 }
7765 }
7766 }
7767 return FALSE;
7768}
Jeff Johnsone7245742012-09-05 17:12:55 -07007769
Jeff Johnson295189b2012-06-20 16:38:30 -07007770
7771tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7772{
7773 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7774 {
7775 return eANI_BOOLEAN_TRUE;
7776 }
7777 else
7778 {
7779 return eANI_BOOLEAN_FALSE;
7780 }
7781}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007782
Sandeep Puligilla60342762014-01-30 21:05:37 +05307783/**
7784 * \brief verify the changes in channel bonding
7785 *
7786 * \param pMac Pointer to the global MAC structure
7787 *
7788 * \param psessionEntry session entry
7789 * beaconSecChanWidth Secondary channel width
7790 * advertized in beacon
7791 * currentSecChanWidth Current configured width
7792 * staId Station Id
7793 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7794 */
7795tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7796 tpPESession psessionEntry,
7797 tANI_U8 beaconSecChanWidth,
7798 tANI_U8 currentSecChanWidth,
7799 tANI_U8 staId)
7800{
7801 tUpdateVHTOpMode tempParam;
7802 tANI_BOOLEAN fCbMode24G = FALSE;
7803 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7804
7805 /* Moving from HT40 to HT20 operation*/
7806 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7807 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7808 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7809 {
7810 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7811 tempParam.staId = staId;
7812 fCbMode24G = TRUE;
7813 }
7814
7815 /* Moving from HT20 to HT40 operation*/
7816 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7817 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7818 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7819 {
7820 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7821 tempParam.staId = staId;
7822 fCbMode24G = TRUE;
7823 }
7824
7825 if (TRUE == fCbMode24G)
7826 {
7827 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7828 "Changing CBMODE to = %d staId = %d",
7829 tempParam.opMode, tempParam.staId );
7830 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7831 status = eANI_BOOLEAN_TRUE;
7832 }
7833 return status;
7834}
7835
Mohit Khanna4a70d262012-09-11 16:30:12 -07007836#ifdef WLAN_FEATURE_11AC
7837tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7838{
7839 tUpdateVHTOpMode tempParam;
7840
7841 tempParam.opMode = chanWidth;
7842 tempParam.staId = staId;
7843
7844 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7845
7846 return eANI_BOOLEAN_TRUE;
7847}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007848#endif
7849
krunal soni45b9eb62014-03-26 12:54:25 -07007850void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7851 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007852{
7853 tANI_U8 val=0;
7854
krunal soni45b9eb62014-03-26 12:54:25 -07007855 //only 2.4G band should have short slot enable, rest it should be default
7856 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007857 {
krunal soni45b9eb62014-03-26 12:54:25 -07007858 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007859 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007860 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007861 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7862 {
7863 val = true;
7864 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007865 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007866 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007867 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007868 // Joining BSS.
7869 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007870 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007871 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007872 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007873 // Reassociating with AP.
7874 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007875 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007876 }
krunal soni45b9eb62014-03-26 12:54:25 -07007877 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007878 {
krunal soni45b9eb62014-03-26 12:54:25 -07007879 /*
7880 * 11B does not short slot and short slot is default
7881 * for 11A mode. Hence, not need to set this bit
7882 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007883 val = false;
7884 }
krunal soni45b9eb62014-03-26 12:54:25 -07007885
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007886 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007887 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007888}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307889
Kalikinkar dhara205da782014-03-21 15:49:32 -07007890void limUtilsframeshtons(tpAniSirGlobal pCtx,
7891 tANI_U8 *pOut,
7892 tANI_U16 pIn,
7893 tANI_U8 fMsb)
7894{
7895 (void)pCtx;
7896#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7897 if ( !fMsb )
7898 {
7899 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7900 }
7901 else
7902 {
7903 *pOut = ( pIn & 0xff00 ) >> 8;
7904 *( pOut + 1 ) = pIn & 0xff;
7905 }
7906#else
7907 if ( !fMsb )
7908 {
7909 *pOut = pIn & 0xff;
7910 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7911 }
7912 else
7913 {
7914 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7915 }
7916#endif
7917}
7918
7919void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7920 tANI_U8 *pOut,
7921 tANI_U32 pIn,
7922 tANI_U8 fMsb)
7923{
7924 (void)pCtx;
7925#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7926 if ( !fMsb )
7927 {
7928 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7929 }
7930 else
7931 {
7932 *pOut = ( pIn & 0xff000000 ) >> 24;
7933 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7934 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7935 *( pOut + 3 ) = ( pIn & 0x000000ff );
7936 }
7937#else
7938 if ( !fMsb )
7939 {
7940 *( pOut ) = ( pIn & 0x000000ff );
7941 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7942 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7943 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7944 }
7945 else
7946 {
7947 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7948 }
7949#endif
7950}
7951
7952
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307953/**--------------------------------------------
7954\fn limUpdateOBSSScanParams
7955\brief Updates OBSS SCAN IE parameters to session
7956
7957\param psessionEntry - Session Entry
7958\return NONE
7959---------------------------------------------*/
7960void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7961 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7962{
7963 /*If the recieved value is not in the range specified by the Specification
7964 then it will be the default value configured through cfg */
7965 if (( pOBSSScanParameters->obssScanActiveDwell >
7966 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7967 ( pOBSSScanParameters->obssScanActiveDwell <
7968 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7969 {
7970 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7971 pOBSSScanParameters->obssScanActiveDwell;
7972 }
7973 if((pOBSSScanParameters->obssScanPassiveDwell >
7974 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7975 (pOBSSScanParameters->obssScanPassiveDwell <
7976 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7977 {
7978 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7979 pOBSSScanParameters->obssScanPassiveDwell;
7980 }
7981 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7982 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7983 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7984 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7985 {
7986 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7987 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7988 }
7989 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7990 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7991 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7992 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7993 {
7994 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7995 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7996 }
7997 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7998 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7999 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
8000 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
8001 {
8002 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8003 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
8004 }
8005 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
8006 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
8007 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
8008 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
8009 {
8010 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
8011 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
8012 }
8013 if((pOBSSScanParameters->obssScanActivityThreshold >
8014 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
8015 (pOBSSScanParameters->obssScanActivityThreshold <
8016 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
8017 {
8018 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
8019 pOBSSScanParameters->obssScanActivityThreshold;
8020 }
8021}
Chet Lanctot8cecea22014-02-11 19:09:36 -08008022
8023#ifdef WLAN_FEATURE_11W
8024void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
8025{
8026 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
8027 tPmfSaQueryTimerId timerId;
8028 tpPESession psessionEntry;
8029 tpDphHashNode pSta;
8030 tANI_U32 maxRetries;
8031
8032 limLog(pMac, LOG1, FL("SA Query timer fires"));
8033 timerId.value = param;
8034
8035 // Check that SA Query is in progress
8036 if ((psessionEntry = peFindSessionBySessionId(
8037 pMac, timerId.fields.sessionId)) == NULL)
8038 {
8039 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
8040 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008041 return;
8042 }
8043 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
8044 &psessionEntry->dph.dphHashTable)) == NULL)
8045 {
8046 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
8047 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08008048 return;
8049 }
8050 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
8051 return;
8052
8053 // Increment the retry count, check if reached maximum
8054 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
8055 &maxRetries) != eSIR_SUCCESS)
8056 {
8057 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
8058 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8059 return;
8060 }
8061 pSta->pmfSaQueryRetryCount++;
8062 if (pSta->pmfSaQueryRetryCount >= maxRetries)
8063 {
8064 limLog(pMac, LOG1, FL("SA Query timed out"));
Chet Lanctot8cecea22014-02-11 19:09:36 -08008065 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
8066 return;
8067 }
8068
8069 // Retry SA Query
8070 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
8071 pSta->staAddr, psessionEntry);
8072 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008073 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8074 {
8075 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8076 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8077 }
8078}
8079#endif
8080
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008081/** ---------------------------------------------------------
8082\fn limProcessChannelSwitchSuspendLink
8083\brief This function call channel switch functions based on
8084 the gLimChannelSwitch.state. After function return it
8085 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8086 If gLimChannelSwitch.state is non-identified then
8087 print error log as well as restore back the
8088 pre-channelSwitch.
8089\param tpAniSirGlobal pMac
8090\param eHalStatus status
8091\param tANI_U32 *ctx
8092\return None
8093 ------------------------------------------------------------*/
8094static void
8095limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8096 eHalStatus status,
8097 tANI_U32 *ctx)
8098{
8099 tpPESession pSessionEntry = (tpPESession)ctx;
8100
8101 if ( eHAL_STATUS_SUCCESS != status )
8102 {
8103 limLog(pMac, LOGE,
8104 FL("Suspend link failed. still proceeding "));
8105 }
8106 if (NULL == pSessionEntry )
8107 {
8108 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8109 return;
8110 }
8111
8112 switch(pSessionEntry->gLimChannelSwitch.state)
8113 {
8114 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8115 PELOGW(limLog(pMac, LOGW,
8116 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8117 limSwitchPrimaryChannel(pMac,
8118 pSessionEntry->gLimChannelSwitch.primaryChannel,
8119 pSessionEntry);
8120 pSessionEntry->gLimChannelSwitch.state =
8121 eLIM_CHANNEL_SWITCH_IDLE;
8122 break;
8123
8124 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8125 PELOGW(limLog(pMac, LOGW,
8126 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8127 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8128 pSessionEntry->gLimChannelSwitch.primaryChannel,
8129 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8130 pSessionEntry->gLimChannelSwitch.state =
8131 eLIM_CHANNEL_SWITCH_IDLE;
8132 break;
8133
8134 default:
8135 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8136 pSessionEntry->gLimChannelSwitch.state);)
8137 if (limRestorePreChannelSwitchState(pMac,
8138 pSessionEntry) != eSIR_SUCCESS)
8139 {
8140 limLog(pMac, LOGE,
8141 FL("Could not restore pre-channelSwitch "
8142 "(11h) state, resetting the system"));
8143 }
8144 }
8145}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308146
8147/** ---------------------------------------------------------
8148\fn limInitOBSSScanParams
8149\brief This function Initializes the OBSS Scan Parameters
8150\param tpAniSirGlobal pMac
8151\param tpPESession pSessionEntry
8152\return None
8153 ------------------------------------------------------------*/
8154
8155void limInitOBSSScanParams(tpAniSirGlobal pMac,
8156 tpPESession psessionEntry)
8157{
8158 tANI_U32 cfgValue;
8159
8160 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8161 &cfgValue) != eSIR_SUCCESS)
8162 {
8163 limLog(pMac, LOGE, FL("Fail to retrieve "
8164 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8165 return ;
8166 }
8167 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8168
8169 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8170 &cfgValue) != eSIR_SUCCESS)
8171 {
8172 limLog(pMac, LOGE, FL("Fail to retrieve "
8173 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8174 return ;
8175 }
8176 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8177
8178 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8179 &cfgValue) != eSIR_SUCCESS)
8180 {
8181 limLog(pMac, LOGE, FL("Fail to retrieve "
8182 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8183 return ;
8184 }
8185 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8186 = cfgValue;
8187 if (wlan_cfgGetInt(pMac,
8188 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8189 &cfgValue) != eSIR_SUCCESS)
8190 {
8191 limLog(pMac, LOGE, FL("Fail to retrieve"
8192 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8193 return ;
8194 }
8195 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8196 cfgValue;
8197 if (wlan_cfgGetInt(pMac,
8198 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8199 != eSIR_SUCCESS)
8200 {
8201 limLog(pMac, LOGE, FL("Fail to retrieve"
8202 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8203 return ;
8204 }
8205 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8206 cfgValue;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05308207
8208 if (wlan_cfgGetInt(pMac,
8209 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR, &cfgValue)
8210 != eSIR_SUCCESS)
8211 {
8212 limLog(pMac, LOGE, FL("Fail to retrieve"
8213 "WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR value"));
8214 return ;
8215 }
8216 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
8217 cfgValue;
8218
8219
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308220 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8221 &cfgValue) != eSIR_SUCCESS)
8222 {
8223 limLog(pMac, LOGE, FL("Fail to retrieve "
8224 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8225 return ;
8226 }
8227 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308228}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308229
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308230const char * lim_ScanTypetoString(const v_U8_t scanType)
8231{
8232 switch (scanType)
8233 {
8234 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8235 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8236 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8237 default:
8238 return "Unknown ScanType";
8239 }
8240}
8241
8242const char * lim_BssTypetoString(const v_U8_t bssType)
8243{
8244 switch (bssType)
8245 {
8246 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8247 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8248 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8249 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8250 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8251 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8252 default:
8253 return "Unknown BssType";
8254 }
8255}
8256
8257const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8258{
8259 switch (mode)
8260 {
8261 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8262 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8263 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8264 default:
8265 return "Unknown BgScanMode";
8266 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308267}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308268
8269#ifdef WLAN_FEATURE_11W
8270/**
8271 *
8272 * \brief This function is called by various LIM modules to correctly set
8273 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8274 *
8275 *
8276 * \param pMac Pointer to Global MAC structure
8277 *
8278 * \param psessionEntry Pointer to session corresponding to the connection
8279 *
8280 * \param peer Peer address of the STA to which the frame is to be sent
8281 *
8282 * \param pMacHdr Pointer to the frame MAC header
8283 *
8284 * \return nothing
8285 *
8286 *
8287 */
8288void
8289limSetProtectedBit(tpAniSirGlobal pMac,
8290 tpPESession psessionEntry,
8291 tSirMacAddr peer,
8292 tpSirMacMgmtHdr pMacHdr)
8293{
8294 tANI_U16 aid;
8295 tpDphHashNode pStaDs;
8296
8297 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8298 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8299 {
8300
8301 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8302 &psessionEntry->dph.dphHashTable );
8303 if( pStaDs != NULL )
Abhishek Singh28266f02014-11-05 17:22:19 +05308304 /* rmfenabled will be set at the time of addbss.
8305 * but sometimes EAP auth fails and keys are not
8306 * installed then if we send any management frame
8307 * like deauth/disassoc with this bit set then
8308 * firmware crashes. so check for keys are
8309 * installed or not also before setting the bit
8310 */
Abhishek Singh683d7862014-11-05 17:34:31 +05308311 if (pStaDs->rmfEnabled && pStaDs->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308312 pMacHdr->fc.wep = 1;
8313 }
Abhishek Singh28266f02014-11-05 17:22:19 +05308314 else if ( psessionEntry->limRmfEnabled && psessionEntry->isKeyInstalled)
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308315 pMacHdr->fc.wep = 1;
8316} /*** end limSetProtectedBit() ***/
8317#endif