blob: 72b404868672e9162f7eb529e9bc661ffbc6ef86 [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/** -------------------------------------------------------------
91\fn limAssignDialogueToken
92\brief Assigns dialogue token.
93\param tpAniSirGlobal pMac
94\return tpDialogueToken - dialogueToken data structure.
95 -------------------------------------------------------------*/
96
97tpDialogueToken
98limAssignDialogueToken(tpAniSirGlobal pMac)
99{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700100 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700101 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530102 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
103 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530105 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 return NULL;
107 }
108
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530109 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 //first node in the list is being added.
111 if(NULL == pMac->lim.pDialogueTokenHead)
112 {
113 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
114 }
115 else
116 {
117 pMac->lim.pDialogueTokenTail->next = pCurrNode;
118 pMac->lim.pDialogueTokenTail = pCurrNode;
119 }
120 //assocId and tid of the node will be filled in by caller.
121 pCurrNode->next = NULL;
122 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700123
124 /* Dialog token should be a non-zero value */
125 if (0 == pCurrNode->token)
126 pCurrNode->token = token;
127
128 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 return pCurrNode;
130}
131
132/** -------------------------------------------------------------
133\fn limSearchAndDeleteDialogueToken
134\brief search dialogue token in the list and deletes it if found. returns failure if not found.
135\param tpAniSirGlobal pMac
136\param tANI_U8 token
137\param tANI_U16 assocId
138\param tANI_U16 tid
139\return eSirRetStatus - status of the search
140 -------------------------------------------------------------*/
141
142
143tSirRetStatus
144limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
145{
146 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
147 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
148
149 //if the list is empty
150 if(NULL == pCurrNode)
151 return eSIR_FAILURE;
152
153 // if the matching node is the first node.
154 if(pCurrNode &&
155 (assocId == pCurrNode->assocId) &&
156 (tid == pCurrNode->tid))
157 {
158 pMac->lim.pDialogueTokenHead = pCurrNode->next;
159 //there was only one node in the list. So tail pointer also needs to be adjusted.
160 if(NULL == pMac->lim.pDialogueTokenHead)
161 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530162 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800163 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 return eSIR_SUCCESS;
165 }
166
167 //first node did not match. so move to the next one.
168 pCurrNode = pCurrNode->next;
169 while(NULL != pCurrNode )
170 {
171 if(token == pCurrNode->token)
172 {
173 break;
174 }
175
176 pPrevNode = pCurrNode;
177 pCurrNode = pCurrNode->next;
178 }
179
180 if(pCurrNode &&
181 (assocId == pCurrNode->assocId) &&
182 (tid == pCurrNode->tid))
183 {
184 pPrevNode->next = pCurrNode->next;
185 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
186 if(NULL == pCurrNode->next)
187 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530188 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800189 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 return eSIR_SUCCESS;
191 }
192
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700193 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 return eSIR_FAILURE;
195
196}
197
198
199/** -------------------------------------------------------------
200\fn limDeleteDialogueTokenList
201\brief deletes the complete lim dialogue token linked list.
202\param tpAniSirGlobal pMac
203\return None
204 -------------------------------------------------------------*/
205void
206limDeleteDialogueTokenList(tpAniSirGlobal pMac)
207{
208 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
209
210 while(NULL != pMac->lim.pDialogueTokenHead)
211 {
212 pCurrNode = pMac->lim.pDialogueTokenHead;
213 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530214 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700215 pCurrNode = NULL;
216 }
217 pMac->lim.pDialogueTokenTail = NULL;
218}
219
220void
221limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
222{
223 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
224 *pIgnore = 0;
225
226 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
227 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530228 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 *pIgnore = 1;
230 }
231 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
232 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530233 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 *pIgnore = 1;
235 }
236 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
237 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530238 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 *pIgnore = 0;
240 }
241 else
242 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530243 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 *pIgnore = 1;
245 }
246}
247
248char *
249limMlmStateStr(tLimMlmStates state)
250{
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 switch (state)
252 {
253 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700254 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700255 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700256 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700258 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700260 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700276 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
282 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
283 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700296 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
302 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
303 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700306 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700308 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700310 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700312}
313
314void
315limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
316{
317 limLog(pMac, logLevel, limMlmStateStr(state));
318}
319
320char *
321limSmeStateStr(tLimSmeStates state)
322{
323#ifdef FIXME_GEN6
324 switch (state)
325 {
326 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700327 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700333 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700371 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 }
373#endif
374return "";
375}
376
377
378char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
379{
380#ifdef FIXME_GEN6
381
382 switch(dot11Mode)
383 {
384 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700385 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700387 return "11A";
388 case WNI_CFG_DOT11_MODE_11B:
389 return "11B";
390 case WNI_CFG_DOT11_MODE_11G:
391 return "11G";
392 case WNI_CFG_DOT11_MODE_11N:
393 return "11N";
394 case WNI_CFG_DOT11_MODE_POLARIS:
395 return "Polaris";
396 case WNI_CFG_DOT11_MODE_TITAN:
397 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700399 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
403#endif
404return "";
405}
406
407
408char* limStaOpRateModeStr(tStaRateMode opRateMode)
409{
410#ifdef FIXME_GEN6
411
412 switch(opRateMode)
413 {
414 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700415 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 return "11A";
418 case eSTA_11b:
419 return "11B";
420 case eSTA_11bg:
421 return "11G";
422 case eSTA_11n:
423 return "11N";
424 case eSTA_POLARIS:
425 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700427 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700429 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 }
431#endif
432return "";
433}
434
435char* limBssTypeStr(tSirBssType bssType)
436{
437 switch(bssType)
438 {
439 case eSIR_INFRASTRUCTURE_MODE:
440 return "eSIR_INFRASTRUCTURE_MODE";
441 case eSIR_IBSS_MODE:
442 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700443 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 return "eSIR_AUTO_MODE";
449 default:
450 return "Invalid BSS Type";
451 }
452}
453
454void
455limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
456{
457 limLog(pMac, logLevel, limSmeStateStr(state));
458}
459
460char *limMsgStr(tANI_U32 msgType)
461{
462#ifdef FIXME_GEN6
463 switch (msgType)
464 {
465 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700466 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700468 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700470 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700473#ifdef FEATURE_OEM_DATA_SUPPORT
474 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700475 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700476 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700478#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700570 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700574 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800575#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800576 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700577 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800578 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700579 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800580#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700583 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700624#ifdef WLAN_FEATURE_VOWIFI_11R
625 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700627#endif
628
629 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700632 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700646 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700647
648 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700649 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700651 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800690 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700691 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800692#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700693 case eWNI_SME_GET_TSM_STATS_REQ:
694 return "eWNI_SME_GET_TSM_STATS_REQ";
695 case eWNI_SME_GET_TSM_STATS_RSP:
696 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800697#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700699 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 }
701#endif
702return "";
703}
704
705
706
707char *limResultCodeStr(tSirResultCodes resultCode)
708{
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 switch (resultCode)
710 {
711 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700714 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700828 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700830 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700832 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700834 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700836 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700837#ifdef GEN4_SCAN
838 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700843 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700845 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700847 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700849 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700850#else // GEN4_SCAN
851 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700854 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700855#endif // GEN4_SCAN
856
857 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700858 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700860}
861
862void
863limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
864{
865 limLog(pMac, logLevel, limMsgStr(msgType));
866}
867
Jeff Johnson295189b2012-06-20 16:38:30 -0700868void
869limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
870{
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
872 {
873 switch (msg->type)
874 {
875 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 break;
878 default:
879 limPrintMsgName(pMac, logLevel,msg->type);
880 break;
881 }
882 }
883}
884
885/**
886 * limInitMlm()
887 *
888 *FUNCTION:
889 * This function is called by limProcessSmeMessages() to
890 * initialize MLM state machine on STA
891 *
892 *PARAMS:
893 *
894 *LOGIC:
895 *
896 *ASSUMPTIONS:
897 * NA
898 *
899 *NOTE:
900 * NA
901 *
902 * @param pMac Pointer to Global MAC structure
903 * @return None
904 */
905void
906limInitMlm(tpAniSirGlobal pMac)
907{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700908 tANI_U32 retVal;
909
910 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700911
Jeff Johnsone7245742012-09-05 17:12:55 -0700912 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 /// Initialize scan result hash table
915 limReInitScanResults(pMac); //sep26th review
916
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700917#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
918 /// Initialize lfr scan result hash table
919 // Could there be a problem in multisession with SAP/P2P GO, when in the
920 // middle of FW bg scan, SAP started; Again that could be a problem even on
921 // infra + SAP/P2P GO too - TBD
922 limReInitLfrScanResults(pMac);
923#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700924
925 /// Initialize number of pre-auth contexts
926 pMac->lim.gLimNumPreAuthContexts = 0;
927
928 /// Initialize MAC based Authentication STA list
929 limInitPreAuthList(pMac);
930
931 //pMac->lim.gpLimMlmJoinReq = NULL;
932
933 if (pMac->lim.gLimTimersCreated)
934 return;
935
936 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700937 retVal = limCreateTimers(pMac);
938 if(retVal == TX_SUCCESS)
939 {
940 pMac->lim.gLimTimersCreated = 1;
941 }
942 else
943 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700944 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700945 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700946} /*** end limInitMlm() ***/
947
948
949
950/**
951 * limCleanupMlm()
952 *
953 *FUNCTION:
954 * This function is called to cleanup any resources
955 * allocated by the MLM state machine.
956 *
957 *PARAMS:
958 *
959 *LOGIC:
960 *
961 *ASSUMPTIONS:
962 * NA
963 *
964 *NOTE:
965 * It is assumed that BSS is already informed that we're leaving it
966 * before this function is called.
967 *
968 * @param pMac Pointer to Global MAC structure
969 * @param None
970 * @return None
971 */
972void
973limCleanupMlm(tpAniSirGlobal pMac)
974{
975 tANI_U32 n;
976 tLimPreAuthNode *pAuthNode;
977
978 if (pMac->lim.gLimTimersCreated == 1)
979 {
980 // Deactivate and delete MIN/MAX channel timers.
981 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
982 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
983 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
984 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
985 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
986 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
987
988
989 // Deactivate and delete channel switch timer.
990 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
991 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
992
993
994 // Deactivate and delete addts response timer.
995 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
996 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
997
998 // Deactivate and delete Join failure timer.
999 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1000 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1001
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001002 // Deactivate and delete Periodic Join Probe Request timer.
1003 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1004 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1005
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 // Deactivate and delete Association failure timer.
1007 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1008 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1009
1010 // Deactivate and delete Reassociation failure timer.
1011 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1012 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1013
1014 // Deactivate and delete Authentication failure timer.
1015 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1016 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1017
1018 // Deactivate and delete Heartbeat timer.
1019 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1020 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1021
1022 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1023 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1024 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1025
1026 // Deactivate and delete Quiet timer.
1027 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1028 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1029
1030 // Deactivate and delete Quiet BSS timer.
1031 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1032 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1033
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 // Deactivate and delete LIM background scan timer.
1035 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1036 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001037
1038
1039 // Deactivate and delete cnf wait timer
1040 for (n = 0; n < pMac->lim.maxStation; n++)
1041 {
1042 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1043 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1044 }
1045
1046 // Deactivate and delete keepalive timer
1047 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1048 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1049
1050 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1051
1052 //Deactivate any Authentication response timers
1053 limDeletePreAuthList(pMac);
1054
1055 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1056 {
1057 // Delete any Authentication response
1058 // timers, which might have been started.
1059 tx_timer_delete(&pAuthNode->timer);
1060 }
1061
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1063 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1064 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1065 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1066
1067#if 0 // The WPS PBC clean up timer is disabled
1068 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1069 {
1070 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1071 {
1072 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1073 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1074 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1075 }
1076 }
1077#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001078#ifdef WLAN_FEATURE_VOWIFI_11R
1079 // Deactivate and delete FT Preauth response timer
1080 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1081 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1082#endif
1083
Jeff Johnson295189b2012-06-20 16:38:30 -07001084
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001085#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001087 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1088 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1089#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001091 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1092 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1093
1094 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1095 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1096
Hoonki Leef63df0d2013-01-16 19:29:14 -08001097 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1098 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001099
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301100 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1101 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1102
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 pMac->lim.gLimTimersCreated = 0;
1104 }
1105
1106 /// Cleanup cached scan list
1107 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001108#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1109 /// Cleanup cached scan list
1110 limReInitLfrScanResults(pMac);
1111#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001112
1113} /*** end limCleanupMlm() ***/
1114
1115
1116
1117/**
1118 * limCleanupLmm()
1119 *
1120 *FUNCTION:
1121 * This function is called to cleanup any resources
1122 * allocated by LMM sub-module.
1123 *
1124 *PARAMS:
1125 *
1126 *LOGIC:
1127 *
1128 *ASSUMPTIONS:
1129 * NA
1130 *
1131 *NOTE:
1132 * NA
1133 *
1134 * @param pMac Pointer to Global MAC structure
1135 * @return None
1136 */
1137
1138void
1139limCleanupLmm(tpAniSirGlobal pMac)
1140{
Jeff Johnson295189b2012-06-20 16:38:30 -07001141} /*** end limCleanupLmm() ***/
1142
1143
1144
1145/**
1146 * limIsAddrBC()
1147 *
1148 *FUNCTION:
1149 * This function is called in various places within LIM code
1150 * to determine whether passed MAC address is a broadcast or not
1151 *
1152 *LOGIC:
1153 *
1154 *ASSUMPTIONS:
1155 * NA
1156 *
1157 *NOTE:
1158 * NA
1159 *
1160 * @param macAddr Indicates MAC address that need to be determined
1161 * whether it is Broadcast address or not
1162 *
1163 * @return true if passed address is Broadcast address else false
1164 */
1165
1166tANI_U8
1167limIsAddrBC(tSirMacAddr macAddr)
1168{
1169 int i;
1170 for (i = 0; i < 6; i++)
1171 {
1172 if ((macAddr[i] & 0xFF) != 0xFF)
1173 return false;
1174 }
1175
1176 return true;
1177} /****** end limIsAddrBC() ******/
1178
1179
1180
1181/**
1182 * limIsGroupAddr()
1183 *
1184 *FUNCTION:
1185 * This function is called in various places within LIM code
1186 * to determine whether passed MAC address is a group address or not
1187 *
1188 *LOGIC:
1189 * If least significant bit of first octet of the MAC address is
1190 * set to 1, it is a Group address.
1191 *
1192 *ASSUMPTIONS:
1193 * NA
1194 *
1195 *NOTE:
1196 * NA
1197 *
1198 * @param macAddr Indicates MAC address that need to be determined
1199 * whether it is Group address or not
1200 *
1201 * @return true if passed address is Group address else false
1202 */
1203
1204tANI_U8
1205limIsGroupAddr(tSirMacAddr macAddr)
1206{
1207 if ((macAddr[0] & 0x01) == 0x01)
1208 return true;
1209 else
1210 return false;
1211} /****** end limIsGroupAddr() ******/
1212
1213/**
1214 * limPostMsgApiNoWait()
1215 *
1216 *FUNCTION:
1217 * This function is called from other thread while posting a
1218 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1219 *
1220 *LOGIC:
1221 * NA
1222 *
1223 *ASSUMPTIONS:
1224 * NA
1225 *
1226 *NOTE:
1227 * NA
1228 *
1229 * @param pMsg - Pointer to the Global MAC structure
1230 * @param pMsg - Pointer to the message structure
1231 * @return None
1232 */
1233
1234tANI_U32
1235limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1236{
Jeff Johnson295189b2012-06-20 16:38:30 -07001237 limProcessMessages(pMac, pMsg);
1238 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001239} /*** end limPostMsgApiNoWait() ***/
1240
1241
1242
1243/**
1244 * limPrintMacAddr()
1245 *
1246 *FUNCTION:
1247 * This function is called to print passed MAC address
1248 * in : format.
1249 *
1250 *LOGIC:
1251 *
1252 *ASSUMPTIONS:
1253 * NA
1254 *
1255 *NOTE:
1256 * @param macAddr - MacAddr to be printed
1257 * @param logLevel - Loglevel to be used
1258 *
1259 * @return None.
1260 */
1261
1262void
1263limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1264{
1265 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001266 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001267} /****** end limPrintMacAddr() ******/
1268
1269
Jeff Johnson295189b2012-06-20 16:38:30 -07001270/*
1271 * limResetDeferredMsgQ()
1272 *
1273 *FUNCTION:
1274 * This function resets the deferred message queue parameters.
1275 *
1276 *PARAMS:
1277 * @param pMac - Pointer to Global MAC structure
1278 *
1279 *LOGIC:
1280 *
1281 *ASSUMPTIONS:
1282 * NA
1283 *
1284 *NOTE:
1285 * NA
1286 *
1287 *RETURNS:
1288 * None
1289 */
1290
1291void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1292{
1293 pMac->lim.gLimDeferredMsgQ.size =
1294 pMac->lim.gLimDeferredMsgQ.write =
1295 pMac->lim.gLimDeferredMsgQ.read = 0;
1296
1297}
1298
1299
1300#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1301#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1302
1303/*
1304 * limWriteDeferredMsgQ()
1305 *
1306 *FUNCTION:
1307 * This function queues up a deferred message for later processing on the
1308 * STA side.
1309 *
1310 *PARAMS:
1311 * @param pMac - Pointer to Global MAC structure
1312 * @param limMsg - a LIM message
1313 *
1314 *LOGIC:
1315 *
1316 *ASSUMPTIONS:
1317 * NA
1318 *
1319 *NOTE:
1320 * NA
1321 *
1322 *RETURNS:
1323 * None
1324 */
1325
1326tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1327{
1328 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001329 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1331 limMsg->type);)
1332
1333 /*
1334 ** check if the deferred message queue is full
1335 **/
1336 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1337 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001338 if(!(pMac->lim.deferredMsgCnt & 0xF))
1339 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001340 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 -07001341 }
1342 else
1343 {
1344 pMac->lim.deferredMsgCnt++;
1345 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 return TX_QUEUE_FULL;
1347 }
1348
1349 /*
1350 ** In the application, there should not be more than 1 message get
1351 ** queued up. If happens, flags a warning. In the future, this can
1352 ** happen.
1353 **/
1354 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1355 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001356 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 -07001357 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1358 limIsSystemInScanState(pMac),
1359 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1360 pMac->lim.gLimAddtsSent);)
1361 }
1362
1363 /*
1364 ** To prevent the deferred Q is full of management frames, only give them certain space
1365 **/
1366 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1367 {
1368 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1369 {
1370 tANI_U16 idx, count = 0;
1371 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1372 {
1373 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1374 {
1375 count++;
1376 }
1377 }
1378 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1379 {
1380 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001381 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 //Return error, caller knows what to do
1383 return TX_QUEUE_FULL;
1384 }
1385 }
1386 }
1387
1388 ++pMac->lim.gLimDeferredMsgQ.size;
1389
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001390 /* reset the count here since we are able to defer the message */
1391 if(pMac->lim.deferredMsgCnt != 0)
1392 {
1393 pMac->lim.deferredMsgCnt = 0;
1394 }
1395
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 /*
1397 ** if the write pointer hits the end of the queue, rewind it
1398 **/
1399 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1400 pMac->lim.gLimDeferredMsgQ.write = 0;
1401
1402 /*
1403 ** save the message to the queue and advanced the write pointer
1404 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301405 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1406 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 (tANI_U8 *)limMsg,
1408 sizeof(tSirMsgQ));
1409 return TX_SUCCESS;
1410
1411}
1412
1413/*
1414 * limReadDeferredMsgQ()
1415 *
1416 *FUNCTION:
1417 * This function dequeues a deferred message for processing on the
1418 * STA side.
1419 *
1420 *PARAMS:
1421 * @param pMac - Pointer to Global MAC structure
1422 *
1423 *LOGIC:
1424 *
1425 *ASSUMPTIONS:
1426 * NA
1427 *
1428 *NOTE:
1429 *
1430 *
1431 *RETURNS:
1432 * Returns the message at the head of the deferred message queue
1433 */
1434
1435tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1436{
1437 tSirMsgQ *msg;
1438
1439 /*
1440 ** check any messages left. If no, return
1441 **/
1442 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1443 return NULL;
1444
1445 /*
1446 ** decrement the queue size
1447 **/
1448 pMac->lim.gLimDeferredMsgQ.size--;
1449
1450 /*
1451 ** retrieve the message from the head of the queue
1452 **/
1453 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1454
1455 /*
1456 ** advance the read pointer
1457 **/
1458 pMac->lim.gLimDeferredMsgQ.read++;
1459
1460 /*
1461 ** if the read pointer hits the end of the queue, rewind it
1462 **/
1463 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1464 pMac->lim.gLimDeferredMsgQ.read = 0;
1465
1466 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001467 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1469 msg->type);)
1470
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001471 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 limIsSystemInScanState(pMac),
1473 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1474 pMac->lim.gLimAddtsSent);)
1475
1476 return(msg);
1477}
1478
1479tSirRetStatus
1480limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1481 tSirMsgQ *pMsg,
1482 tANI_U8 qType)
1483{
1484// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 SysProcessMmhMsg(pMac, pMsg);
1486 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001487}
1488
1489char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1490{
1491#ifdef FIXME_GEN6
1492
1493 if (type == SIR_MAC_MGMT_FRAME)
1494 {
1495 switch (subType)
1496 {
1497 case SIR_MAC_MGMT_ASSOC_REQ:
1498 return "MAC_MGMT_ASSOC_REQ";
1499 case SIR_MAC_MGMT_ASSOC_RSP:
1500 return "MAC_MGMT_ASSOC_RSP";
1501 case SIR_MAC_MGMT_REASSOC_REQ:
1502 return "MAC_MGMT_REASSOC_REQ";
1503 case SIR_MAC_MGMT_REASSOC_RSP:
1504 return "MAC_MGMT_REASSOC_RSP";
1505 case SIR_MAC_MGMT_PROBE_REQ:
1506 return "MAC_MGMT_PROBE_REQ";
1507 case SIR_MAC_MGMT_PROBE_RSP:
1508 return "MAC_MGMT_PROBE_RSP";
1509 case SIR_MAC_MGMT_BEACON:
1510 return "MAC_MGMT_BEACON";
1511 case SIR_MAC_MGMT_ATIM:
1512 return "MAC_MGMT_ATIM";
1513 case SIR_MAC_MGMT_DISASSOC:
1514 return "MAC_MGMT_DISASSOC";
1515 case SIR_MAC_MGMT_AUTH:
1516 return "MAC_MGMT_AUTH";
1517 case SIR_MAC_MGMT_DEAUTH:
1518 return "MAC_MGMT_DEAUTH";
1519 case SIR_MAC_MGMT_ACTION:
1520 return "MAC_MGMT_ACTION";
1521 case SIR_MAC_MGMT_RESERVED15:
1522 return "MAC_MGMT_RESERVED15";
1523 default:
1524 return "Unknown MGMT Frame";
1525 }
1526 }
1527
1528 else if (type == SIR_MAC_CTRL_FRAME)
1529 {
1530 switch (subType)
1531 {
1532 case SIR_MAC_CTRL_RR:
1533 return "MAC_CTRL_RR";
1534 case SIR_MAC_CTRL_BAR:
1535 return "MAC_CTRL_BAR";
1536 case SIR_MAC_CTRL_BA:
1537 return "MAC_CTRL_BA";
1538 case SIR_MAC_CTRL_PS_POLL:
1539 return "MAC_CTRL_PS_POLL";
1540 case SIR_MAC_CTRL_RTS:
1541 return "MAC_CTRL_RTS";
1542 case SIR_MAC_CTRL_CTS:
1543 return "MAC_CTRL_CTS";
1544 case SIR_MAC_CTRL_ACK:
1545 return "MAC_CTRL_ACK";
1546 case SIR_MAC_CTRL_CF_END:
1547 return "MAC_CTRL_CF_END";
1548 case SIR_MAC_CTRL_CF_END_ACK:
1549 return "MAC_CTRL_CF_END_ACK";
1550 default:
1551 return "Unknown CTRL Frame";
1552 }
1553 }
1554
1555 else if (type == SIR_MAC_DATA_FRAME)
1556 {
1557 switch (subType)
1558 {
1559 case SIR_MAC_DATA_DATA:
1560 return "MAC_DATA_DATA";
1561 case SIR_MAC_DATA_DATA_ACK:
1562 return "MAC_DATA_DATA_ACK";
1563 case SIR_MAC_DATA_DATA_POLL:
1564 return "MAC_DATA_DATA_POLL";
1565 case SIR_MAC_DATA_DATA_ACK_POLL:
1566 return "MAC_DATA_DATA_ACK_POLL";
1567 case SIR_MAC_DATA_NULL:
1568 return "MAC_DATA_NULL";
1569 case SIR_MAC_DATA_NULL_ACK:
1570 return "MAC_DATA_NULL_ACK";
1571 case SIR_MAC_DATA_NULL_POLL:
1572 return "MAC_DATA_NULL_POLL";
1573 case SIR_MAC_DATA_NULL_ACK_POLL:
1574 return "MAC_DATA_NULL_ACK_POLL";
1575 case SIR_MAC_DATA_QOS_DATA:
1576 return "MAC_DATA_QOS_DATA";
1577 case SIR_MAC_DATA_QOS_DATA_ACK:
1578 return "MAC_DATA_QOS_DATA_ACK";
1579 case SIR_MAC_DATA_QOS_DATA_POLL:
1580 return "MAC_DATA_QOS_DATA_POLL";
1581 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1582 return "MAC_DATA_QOS_DATA_ACK_POLL";
1583 case SIR_MAC_DATA_QOS_NULL:
1584 return "MAC_DATA_QOS_NULL";
1585 case SIR_MAC_DATA_QOS_NULL_ACK:
1586 return "MAC_DATA_QOS_NULL_ACK";
1587 case SIR_MAC_DATA_QOS_NULL_POLL:
1588 return "MAC_DATA_QOS_NULL_POLL";
1589 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1590 return "MAC_DATA_QOS_NULL_ACK_POLL";
1591 default:
1592 return "Unknown Data Frame";
1593 }
1594 }
1595 else
1596 return "Unknown";
1597#endif
1598return "";
1599}
1600
Jeff Johnson295189b2012-06-20 16:38:30 -07001601void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1602{
1603 int i;
1604 static int enable;
1605 tUpdateBeaconParams beaconParams;
1606
1607 tpPESession psessionEntry = limIsApSessionActive(pMac);
1608
1609 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001610 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001611 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001613 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301614
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301615 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001616 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001617
1618 beaconParams.paramChangeBitmap = 0;
1619 /*
1620 ** This is doing a 2 pass check. The first pass is to invalidate
1621 ** all the cache entries. The second pass is to decide whether to
1622 ** disable protection.
1623 **/
1624 if (!enable)
1625 {
1626
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001627 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 psessionEntry->gLimOlbcParams.numSta = 0;
1629 psessionEntry->gLimOverlap11gParams.numSta = 0;
1630 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1631 psessionEntry->gLimNonGfParams.numSta = 0;
1632 psessionEntry->gLimLsigTxopParams.numSta = 0;
1633
1634 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1635 pMac->lim.protStaOverlapCache[i].active = false;
1636
1637 enable = 1;
1638 }
1639 else
1640 {
1641
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001642 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 {
1644 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1645 {
1646 if (!psessionEntry->gLim11bParams.protectionEnabled)
1647 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001648 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1650 }
1651 }
1652 }
1653
1654 if (!psessionEntry->gLimOverlap11gParams.numSta)
1655 {
1656 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1657 {
1658 if (!psessionEntry->gLim11gParams.protectionEnabled)
1659 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001660 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1662 }
1663 }
1664 }
1665
1666 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1667 {
1668 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1669 {
1670 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1671 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001672 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1674 }
1675 }
1676 }
1677
1678 enable = 0;
1679 }
1680
1681 if(beaconParams.paramChangeBitmap)
1682 {
1683 schSetFixedBeaconFields(pMac,psessionEntry);
1684 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1685 }
1686
1687 // Start OLBC timer
1688 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1689 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001690 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 }
1692}
Jeff Johnson295189b2012-06-20 16:38:30 -07001693
1694/**
1695 * limIsNullSsid()
1696 *
1697 *FUNCTION:
1698 * This function checks if Ssid supplied is Null SSID
1699 *
1700 *
1701 *LOGIC:
1702 *
1703 *ASSUMPTIONS:
1704 * NA
1705 *
1706 *NOTE:
1707 * NA
1708 *
1709 * @param tSirMacSSid *
1710 *
1711 *
1712 * @return true if SSID is Null SSID else false
1713 */
1714
1715tANI_U8
1716limIsNullSsid( tSirMacSSid *pSsid )
1717{
1718 tANI_U8 fNullSsid = false;
1719 tANI_U32 SsidLength;
1720 tANI_U8 *pSsidStr;
1721
1722 do
1723 {
1724 if ( 0 == pSsid->length )
1725 {
1726 fNullSsid = true;
1727 break;
1728 }
1729
1730#define ASCII_SPACE_CHARACTER 0x20
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301731 /* If the first charactes is space and SSID length is 1
1732 * then consider it as NULL SSID*/
1733 if ((ASCII_SPACE_CHARACTER == pSsid->ssId[0]) &&
1734 (pSsid->length == 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 {
Sandeep Puligillaf67f9ae2014-03-28 22:40:20 +05301736 fNullSsid = true;
1737 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 }
1739 else
1740 {
1741 /* check if all the charactes in SSID are NULL*/
1742 SsidLength = pSsid->length;
1743 pSsidStr = pSsid->ssId;
1744
1745 while ( SsidLength )
1746 {
1747 if( *pSsidStr )
1748 break;
1749
1750 pSsidStr++;
1751 SsidLength--;
1752 }
1753
1754 if( 0 == SsidLength )
1755 {
1756 fNullSsid = true;
1757 break;
1758 }
1759 }
1760 }
1761 while( 0 );
1762
1763 return fNullSsid;
1764} /****** end limIsNullSsid() ******/
1765
1766
1767
Jeff Johnson295189b2012-06-20 16:38:30 -07001768
1769/** -------------------------------------------------------------
1770\fn limUpdateProtStaParams
1771\brief updates protection related counters.
1772\param tpAniSirGlobal pMac
1773\param tSirMacAddr peerMacAddr
1774\param tLimProtStaCacheType protStaCacheType
1775\param tHalBitVal gfSupported
1776\param tHalBitVal lsigTxopSupported
1777\return None
1778 -------------------------------------------------------------*/
1779void
1780limUpdateProtStaParams(tpAniSirGlobal pMac,
1781tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1782tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1783tpPESession psessionEntry)
1784{
1785 tANI_U32 i;
1786
1787 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1788 limLog(pMac,LOG1, FL("Addr : "));
1789 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1790
1791 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1792 {
1793 if (psessionEntry->protStaCache[i].active)
1794 {
1795 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1796 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1797
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301798 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 psessionEntry->protStaCache[i].addr,
1800 peerMacAddr, sizeof(tSirMacAddr)))
1801 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001802 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 return;
1804 }
1805 }
1806 }
1807
1808 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1809 {
1810 if (!psessionEntry->protStaCache[i].active)
1811 break;
1812 }
1813
1814 if (i >= LIM_PROT_STA_CACHE_SIZE)
1815 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001816 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 return;
1818 }
1819
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301820 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 peerMacAddr,
1822 sizeof(tSirMacAddr));
1823
1824 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1825 psessionEntry->protStaCache[i].active = true;
1826 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1827 {
1828 psessionEntry->gLim11bParams.numSta++;
1829 limLog(pMac,LOG1, FL("11B, "));
1830 }
1831 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1832 {
1833 psessionEntry->gLim11gParams.numSta++;
1834 limLog(pMac,LOG1, FL("11G, "));
1835 }
1836 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1837 {
1838 psessionEntry->gLimHt20Params.numSta++;
1839 limLog(pMac,LOG1, FL("HT20, "));
1840 }
1841
1842 if(!gfSupported)
1843 {
1844 psessionEntry->gLimNonGfParams.numSta++;
1845 limLog(pMac,LOG1, FL("NonGf, "));
1846 }
1847 if(!lsigTxopSupported)
1848 {
1849 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001850 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 }
1852}// ---------------------------------------------------------------------
1853
1854/** -------------------------------------------------------------
1855\fn limDecideApProtection
1856\brief Decides all the protection related staiton coexistence and also sets
1857\ short preamble and short slot appropriately. This function will be called
1858\ when AP is ready to send assocRsp tp the station joining right now.
1859\param tpAniSirGlobal pMac
1860\param tSirMacAddr peerMacAddr
1861\return None
1862 -------------------------------------------------------------*/
1863void
1864limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1865{
1866 tANI_U16 tmpAid;
1867 tpDphHashNode pStaDs;
1868 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1869 tANI_U32 phyMode;
1870 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1871 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1872
1873 pBeaconParams->paramChangeBitmap = 0;
1874 // check whether to enable protection or not
1875 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1876 if(NULL == pStaDs)
1877 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001878 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 return;
1880 }
1881 limGetRfBand(pMac, &rfBand, psessionEntry);
1882 //if we are in 5 GHZ band
1883 if(SIR_BAND_5_GHZ == rfBand)
1884 {
1885 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1886 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001887 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 {
1889 //we are 11N and 11A station is joining.
1890 //protection from 11A required.
1891 if(false == pStaDs->mlmStaContext.htCapability)
1892 {
1893 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1894 return;
1895 }
1896 }
1897 }
1898 else if(SIR_BAND_2_4_GHZ== rfBand)
1899 {
1900 limGetPhyMode(pMac, &phyMode, psessionEntry);
1901
1902 //We are 11G. Check if we need protection from 11b Stations.
1903 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001904 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 {
1906
1907 if (pStaDs->erpEnabled== eHAL_CLEAR)
1908 {
1909 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1910 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001911 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1913 }
1914 }
1915
1916 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001917 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 {
1919 //check if we need protection from 11b station
1920 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1921 (!pStaDs->mlmStaContext.htCapability))
1922 {
1923 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1924 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001925 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1927 }
1928 //station being joined is non-11b and non-ht ==> 11g device
1929 else if(!pStaDs->mlmStaContext.htCapability)
1930 {
1931 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1932 //enable protection
1933 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1934 }
1935 //ERP mode is enabled for the latest station joined
1936 //latest station joined is HT capable
1937 //This case is being handled in common code (commn between both the bands) below.
1938 }
1939 }
1940
1941 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001942 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 (true == pStaDs->mlmStaContext.htCapability))
1944 {
1945 if(!pStaDs->htGreenfield)
1946 {
1947 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1948 gfSupported = eHAL_CLEAR;
1949 }
1950 //Station joining is HT 20Mhz
1951 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1952 {
1953 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1954 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1955 }
1956 //Station joining does not support LSIG TXOP Protection
1957 if(!pStaDs->htLsigTXOPProtection)
1958 {
1959 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1960 lsigTxopSupported = eHAL_CLEAR;
1961 }
1962 }
1963
1964 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1965 gfSupported, lsigTxopSupported, psessionEntry);
1966
1967 return;
1968}
Jeff Johnson295189b2012-06-20 16:38:30 -07001969
1970
1971/** -------------------------------------------------------------
1972\fn limEnableOverlap11gProtection
1973\brief wrapper function for setting overlap 11g protection.
1974\param tpAniSirGlobal pMac
1975\param tpUpdateBeaconParams pBeaconParams
1976\param tpSirMacMgmtHdr pMh
1977\return None
1978 -------------------------------------------------------------*/
1979void
1980limEnableOverlap11gProtection(tpAniSirGlobal pMac,
1981tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
1982{
1983 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
1984
1985 if (psessionEntry->gLimOlbcParams.numSta &&
1986 !psessionEntry->gLimOlbcParams.protectionEnabled)
1987 {
1988 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001989 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
1991 }
1992}
1993
1994
1995/** -------------------------------------------------------------
1996\fn limUpdateShortPreamble
1997\brief Updates short preamble if needed when a new station joins.
1998\param tpAniSirGlobal pMac
1999\param tSirMacAddr peerMacAddr
2000\param tpUpdateBeaconParams pBeaconParams
2001\return None
2002 -------------------------------------------------------------*/
2003void
2004limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2005 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2006{
2007 tANI_U16 tmpAid;
2008 tpDphHashNode pStaDs;
2009 tANI_U32 phyMode;
2010 tANI_U16 i;
2011
2012 // check whether to enable protection or not
2013 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2014
2015 limGetPhyMode(pMac, &phyMode, psessionEntry);
2016
2017 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2018
2019 {
2020 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2021 {
2022 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2023 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2024
2025 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2026 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2028 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2029 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302030 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2032 peerMacAddr, sizeof(tSirMacAddr)))
2033 return;
2034 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 {
2036 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2037 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302038 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2040 peerMacAddr, sizeof(tSirMacAddr)))
2041 return;
2042 }
2043 }
2044 }
2045
2046
2047 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2048 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2050 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2051 break;
2052 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 {
2054 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2055 break;
2056 }
2057 }
2058
2059 if (i >= LIM_PROT_STA_CACHE_SIZE)
2060 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2062 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2063 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2064 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2065 return;
2066 }
2067 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 {
2069 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2070 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2071 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2072 return;
2073 }
2074
2075 }
2076
2077
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302078 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2079 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 peerMacAddr, sizeof(tSirMacAddr));
2081 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2082 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2083 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302085 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 peerMacAddr, sizeof(tSirMacAddr));
2087 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2088 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2089 }
2090
2091
2092 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002093 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002094
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002096 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 }
2098 }
2099}
2100
2101/** -------------------------------------------------------------
2102\fn limUpdateShortSlotTime
2103\brief Updates short slot time if needed when a new station joins.
2104\param tpAniSirGlobal pMac
2105\param tSirMacAddr peerMacAddr
2106\param tpUpdateBeaconParams pBeaconParams
2107\return None
2108 -------------------------------------------------------------*/
2109
2110void
2111limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2112 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2113{
2114 tANI_U16 tmpAid;
2115 tpDphHashNode pStaDs;
2116 tANI_U32 phyMode;
2117 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 tANI_U16 i;
2119
2120 // check whether to enable protection or not
2121 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2122 limGetPhyMode(pMac, &phyMode, psessionEntry);
2123
Jeff Johnsone7245742012-09-05 17:12:55 -07002124 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2125 * be always 1 and in 11b case, it should be always 0
2126 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2128 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002129 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2130 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2131 * it in limDecideShortSlot
2132 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2134 {
2135 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2136 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2137 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2138 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2140 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2141 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302142 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2144 peerMacAddr, sizeof(tSirMacAddr)))
2145 return;
2146 }
2147 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 {
2149 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2150 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302151 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2153 peerMacAddr, sizeof(tSirMacAddr)))
2154 return;
2155 }
2156 }
2157 }
2158
2159 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2160 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2162 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2163 break;
2164 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 {
2166 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2167 break;
2168 }
2169 }
2170
2171 if (i >= LIM_PROT_STA_CACHE_SIZE)
2172 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2174 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2175 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2176 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2177 return;
2178 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 {
2180 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2181 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2182 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2183 return;
2184 }
2185 }
2186
2187
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302189 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 peerMacAddr, sizeof(tSirMacAddr));
2191 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2192 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2193 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302195 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 peerMacAddr, sizeof(tSirMacAddr));
2197 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2198 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2199 }
2200 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2201
Jeff Johnsone7245742012-09-05 17:12:55 -07002202 /* 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
2203 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2204 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002206 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 {
2208 // enable long slot time
2209 pBeaconParams->fShortSlotTime = false;
2210 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002211 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002212 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002216 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 {
2218 // enable long slot time
2219 pBeaconParams->fShortSlotTime = false;
2220 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002221 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002222 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 }
2224 }
2225 }
2226 }
2227}
2228
Jeff Johnson295189b2012-06-20 16:38:30 -07002229
2230/** -------------------------------------------------------------
2231\fn limDecideStaProtectionOnAssoc
2232\brief Decide protection related settings on Sta while association.
2233\param tpAniSirGlobal pMac
2234\param tpSchBeaconStruct pBeaconStruct
2235\return None
2236 -------------------------------------------------------------*/
2237void
2238limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2239 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2240{
2241 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2242 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2243
2244 limGetRfBand(pMac, &rfBand, psessionEntry);
2245 limGetPhyMode(pMac, &phyMode, psessionEntry);
2246
2247 if(SIR_BAND_5_GHZ == rfBand)
2248 {
2249 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2250 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2251 {
2252 if(pMac->lim.cfgProtection.fromlla)
2253 psessionEntry->beaconParams.llaCoexist = true;
2254 }
2255 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2256 {
2257 if(pMac->lim.cfgProtection.ht20)
2258 psessionEntry->beaconParams.ht20Coexist = true;
2259 }
2260
2261 }
2262 else if(SIR_BAND_2_4_GHZ == rfBand)
2263 {
2264 //spec 7.3.2.13
2265 //UseProtection will be set when nonERP STA is associated.
2266 //NonERPPresent bit will be set when:
2267 //--nonERP Sta is associated OR
2268 //--nonERP Sta exists in overlapping BSS
2269 //when useProtection is not set then protection from nonERP stations is optional.
2270
2271 //CFG protection from 11b is enabled and
2272 //11B device in the BSS
2273 /* TODO, This is not sessionized */
2274 if (phyMode != WNI_CFG_PHY_MODE_11B)
2275 {
2276 if (pMac->lim.cfgProtection.fromllb &&
2277 pBeaconStruct->erpPresent &&
2278 (pBeaconStruct->erpIEInfo.useProtection ||
2279 pBeaconStruct->erpIEInfo.nonErpPresent))
2280 {
2281 psessionEntry->beaconParams.llbCoexist = true;
2282 }
2283 //AP has no 11b station associated.
2284 else
2285 {
2286 psessionEntry->beaconParams.llbCoexist = false;
2287 }
2288 }
2289 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002290 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 (pBeaconStruct->HTInfo.present))
2292 {
2293 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2294
2295 //Obss Non HT STA present mode
2296 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2297
2298
2299 //CFG protection from 11G is enabled and
2300 //our AP has at least one 11G station associated.
2301 if(pMac->lim.cfgProtection.fromllg &&
2302 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2303 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2304 (!psessionEntry->beaconParams.llbCoexist))
2305 {
2306 if(pMac->lim.cfgProtection.fromllg)
2307 psessionEntry->beaconParams.llgCoexist = true;
2308 }
2309
2310 //AP has only HT stations associated and at least one station is HT 20
2311 //disable protection from any non-HT devices.
2312 //decision for disabling protection from 11b has already been taken above.
2313 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2314 {
2315 //Disable protection from 11G station.
2316 psessionEntry->beaconParams.llgCoexist = false;
2317 //CFG protection from HT 20 is enabled.
2318 if(pMac->lim.cfgProtection.ht20)
2319 psessionEntry->beaconParams.ht20Coexist = true;
2320 }
2321 //Disable protection from non-HT and HT20 devices.
2322 //decision for disabling protection from 11b has already been taken above.
2323 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2324 {
2325 psessionEntry->beaconParams.llgCoexist = false;
2326 psessionEntry->beaconParams.ht20Coexist = false;
2327 }
2328
2329 }
2330 }
2331
2332 //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 -07002333 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 (pBeaconStruct->HTInfo.present))
2335 {
2336 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2337 psessionEntry->beaconParams.fRIFSMode =
2338 ( tANI_U8 ) htInfo.rifsMode;
2339 psessionEntry->beaconParams.llnNonGFCoexist =
2340 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2341 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2342 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2343 }
2344}
2345
2346
2347/** -------------------------------------------------------------
2348\fn limDecideStaProtection
2349\brief Decides protection related settings on Sta while processing beacon.
2350\param tpAniSirGlobal pMac
2351\param tpUpdateBeaconParams pBeaconParams
2352\return None
2353 -------------------------------------------------------------*/
2354void
2355limDecideStaProtection(tpAniSirGlobal pMac,
2356 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2357{
2358
2359 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2360 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2361
2362 limGetRfBand(pMac, &rfBand, psessionEntry);
2363 limGetPhyMode(pMac, &phyMode, psessionEntry);
2364
2365 if(SIR_BAND_5_GHZ == rfBand)
2366 {
2367 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002368 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 (pBeaconStruct->HTInfo.present))
2370 {
2371 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2372 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2373 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2374 {
2375 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2376 }
2377 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2378 //protection from HT20 if needed.
2379 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2380 {
2381 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2382 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2383 }
2384 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2385 {
2386 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2387 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2388 }
2389 }
2390 }
2391 else if(SIR_BAND_2_4_GHZ == rfBand)
2392 {
2393 /* spec 7.3.2.13
2394 * UseProtection will be set when nonERP STA is associated.
2395 * NonERPPresent bit will be set when:
2396 * --nonERP Sta is associated OR
2397 * --nonERP Sta exists in overlapping BSS
2398 * when useProtection is not set then protection from nonERP stations is optional.
2399 */
2400
2401 if (phyMode != WNI_CFG_PHY_MODE_11B)
2402 {
2403 if (pBeaconStruct->erpPresent &&
2404 (pBeaconStruct->erpIEInfo.useProtection ||
2405 pBeaconStruct->erpIEInfo.nonErpPresent))
2406 {
2407 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2408 }
2409 //AP has no 11b station associated.
2410 else
2411 {
2412 //disable protection from 11b station
2413 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2414 }
2415 }
2416
2417 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002418 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 (pBeaconStruct->HTInfo.present))
2420 {
2421
2422 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2423 //AP has at least one 11G station associated.
2424 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2425 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2426 (!psessionEntry->beaconParams.llbCoexist))
2427 {
2428 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2429
2430 }
2431
2432 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2433 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2434 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2435 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2436 {
2437 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2438
2439 //AP has only HT stations associated and at least one station is HT 20
2440 //disable protection from any non-HT devices.
2441 //decision for disabling protection from 11b has already been taken above.
2442 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2443 {
2444 //Disable protection from 11G station.
2445 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2446
2447 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2448 }
2449 //Disable protection from non-HT and HT20 devices.
2450 //decision for disabling protection from 11b has already been taken above.
2451 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2452 {
2453 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2454 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2455
2456 }
2457 }
2458 }
2459 }
2460
2461 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002462 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 (pBeaconStruct->HTInfo.present))
2464 {
2465 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2466 //Check for changes in protection related factors other than HT operating mode.
2467 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2468 if ( psessionEntry->beaconParams.fRIFSMode !=
2469 ( tANI_U8 ) htInfo.rifsMode )
2470 {
2471 pBeaconParams->fRIFSMode =
2472 psessionEntry->beaconParams.fRIFSMode =
2473 ( tANI_U8 ) htInfo.rifsMode;
2474 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2475 }
2476
2477 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2478 htInfo.nonGFDevicesPresent )
2479 {
2480 pBeaconParams->llnNonGFCoexist =
2481 psessionEntry->beaconParams.llnNonGFCoexist =
2482 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2483 pBeaconParams->paramChangeBitmap |=
2484 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2485 }
2486
2487 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2488 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2489 {
2490 pBeaconParams->fLsigTXOPProtectionFullSupport =
2491 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2492 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2493 pBeaconParams->paramChangeBitmap |=
2494 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2495 }
2496
2497 // For Station just update the global lim variable, no need to send message to HAL
2498 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2499 //stations in overlapping BSS.
2500 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2501 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2502
2503 }
2504}
2505
2506
2507/**
2508 * limProcessChannelSwitchTimeout()
2509 *
2510 *FUNCTION:
2511 * This function is invoked when Channel Switch Timer expires at
2512 * the STA. Now, STA must stop traffic, and then change/disable
2513 * primary or secondary channel.
2514 *
2515 *
2516 *NOTE:
2517 * @param pMac - Pointer to Global MAC structure
2518 * @return None
2519 */
2520void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2521{
2522 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002523 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002524
2525 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2526 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002527 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 return;
2529 }
2530
2531 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2532 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002533 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 -07002534 return;
2535 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002536 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002537 /*
2538 * This potentially can create issues if the function tries to set
2539 * channel while device is in power-save, hence putting an extra check
2540 * to verify if the device is in power-save or not
2541 */
2542 if(!limIsSystemInActiveState(pMac))
2543 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002544 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 return;
2546 }
2547
2548 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002549 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002550
2551 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002552 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002553
2554 /* Check if the AP is switching to a channel that we support.
2555 * Else, just don't bother to switch. Indicate HDD to look for a
2556 * better AP to associate
2557 */
2558 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2559 {
2560 /* We need to restore pre-channelSwitch state on the STA */
2561 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2562 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002563 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 return;
2565 }
2566
2567 /* If the channel-list that AP is asking us to switch is invalid,
2568 * then we cannot switch the channel. Just disassociate from AP.
2569 * We will find a better AP !!!
2570 */
2571 limTearDownLinkWithAp(pMac,
2572 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2573 eSIR_MAC_UNSPEC_FAILURE_REASON);
2574 return;
2575 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002576 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2577 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002578 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 {
2580 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002581 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2582 if ( isLimSessionOffChannel(pMac,
2583 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2584 {
2585 limSuspendLink(pMac,
2586 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2587 limProcessChannelSwitchSuspendLink,
2588 (tANI_U32*)psessionEntry );
2589 }
2590 else
2591 {
2592 limProcessChannelSwitchSuspendLink(pMac,
2593 eHAL_STATUS_SUCCESS,
2594 (tANI_U32*)psessionEntry);
2595 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 break;
2597
2598 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002599 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002600 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002601 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002602 psessionEntry->gLimChannelSwitch.secondarySubBand);
2603 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 case eLIM_CHANNEL_SWITCH_IDLE:
2606 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002607 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2609 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002610 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 }
2612 return; /* Please note, this is 'return' and not 'break' */
2613 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002614}
Jeff Johnson295189b2012-06-20 16:38:30 -07002615
2616/**
2617 * limUpdateChannelSwitch()
2618 *
2619 *FUNCTION:
2620 * This function is invoked whenever Station receives
2621 * either 802.11h channel switch IE or airgo proprietary
2622 * channel switch IE.
2623 *
2624 *NOTE:
2625 * @param pMac - Pointer to Global MAC structure
2626 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2627 * @param psessionentry
2628 */
2629void
2630limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2631{
2632
2633 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2635 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002636#ifdef WLAN_FEATURE_11AC
2637 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2638#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002639
Jeff Johnsone7245742012-09-05 17:12:55 -07002640 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002641
2642 /* STA either received proprietary channel switch IE or 802.11h
2643 * standard channel switch IE.
2644 */
2645 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2646 {
2647 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2648
2649 /* Add logic to determine which change this is: */
2650 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002651 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2652 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2653 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2654 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2655 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002657 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 }
2659 else
2660 {
2661 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002662 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2663 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2664 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002665 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002666 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002667#ifdef WLAN_FEATURE_11AC
2668 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2669 if(pBeacon->WiderBWChanSwitchAnnPresent)
2670 {
2671 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2672 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2673 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2674 }
2675#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002676
2677 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002678 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2679 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002680
2681 /* Do not bother to look and operate on extended channel switch element
2682 * if our own channel-bonding state is not enabled
2683 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002684 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 {
2686 if (pBeacon->extChannelSwitchPresent)
2687 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002688 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2689 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002691 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2692 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002694#ifdef WLAN_FEATURE_11AC
2695 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2696 {
2697 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2698 {
2699 if(pBeacon->extChannelSwitchPresent)
2700 {
2701 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2702 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2703 {
2704 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2705 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2706 psessionEntry->gLimChannelSwitch.primaryChannel,
2707 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2708 pWiderChnlSwitch->newCenterChanFreq0,
2709 psessionEntry);
2710 }
2711 }
2712 }
2713 }
2714#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002715 }
2716 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002717 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002718
2719
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2721 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002722 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 }
2724
2725 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002726 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002727 psessionEntry->peSessionId,
2728 psessionEntry->gLimChannelSwitch.primaryChannel,
2729 psessionEntry->gLimChannelSwitch.secondarySubBand,
2730 psessionEntry->gLimChannelSwitch.switchCount,
2731 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 return;
2733}
2734
2735/**
2736 * limCancelDot11hChannelSwitch
2737 *
2738 *FUNCTION:
2739 * This function is called when STA does not send updated channel-swith IE
2740 * after indicating channel-switch start. This will cancel the channel-swith
2741 * timer which is already running.
2742 *
2743 *LOGIC:
2744 *
2745 *ASSUMPTIONS:
2746 *
2747 *NOTE:
2748 *
2749 * @param pMac - Pointer to Global MAC structure
2750 *
2751 * @return None
2752 */
2753void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2754{
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2756 return;
2757
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002758 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002759 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002760
2761 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2762 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002763 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 }
2765
2766 /* We need to restore pre-channelSwitch state on the STA */
2767 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2768 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002769 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002770
2771 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002772}
2773
2774/**----------------------------------------------
2775\fn limCancelDot11hQuiet
2776\brief Cancel the quieting on Station if latest
2777 beacon doesn't contain quiet IE in it.
2778
2779\param pMac
2780\return NONE
2781-----------------------------------------------*/
2782void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2783{
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2785 return;
2786
Jeff Johnsone7245742012-09-05 17:12:55 -07002787 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002789 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2791 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002792 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002793 }
2794 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002795 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002797 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2799 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002800 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 }
2802 /**
2803 * If the channel switch is already running in silent mode, dont resume the
2804 * transmission. Channel switch timer when timeout, transmission will be resumed.
2805 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002806 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2807 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002808 {
2809 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002810 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002811 }
2812 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002813 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002814}
2815
2816/**
2817 * limProcessQuietTimeout
2818 *
2819 * FUNCTION:
2820 * This function is active only on the STA.
2821 * Handles SIR_LIM_QUIET_TIMEOUT
2822 *
2823 * LOGIC:
2824 * This timeout can occur under only one circumstance:
2825 *
2826 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2827 * This indicates that the timeout "interval" has
2828 * expired. This is a trigger for the STA to now
2829 * shut-off Tx/Rx for the specified gLimQuietDuration
2830 * -> The TIMER object gLimQuietBssTimer is
2831 * activated
2832 * -> With timeout = gLimQuietDuration
2833 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2834 *
2835 * ASSUMPTIONS:
2836 * Using two TIMER objects -
2837 * gLimQuietTimer & gLimQuietBssTimer
2838 *
2839 * NOTE:
2840 *
2841 * @param pMac - Pointer to Global MAC structure
2842 *
2843 * @return None
2844 */
2845void limProcessQuietTimeout(tpAniSirGlobal pMac)
2846{
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 //fetch the sessionEntry based on the sessionId
2848 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002849 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002850
Jeff Johnsone7245742012-09-05 17:12:55 -07002851 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002853 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 return;
2855 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002856
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002857 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002858 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 {
2860 case eLIM_QUIET_BEGIN:
2861 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002862 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2863 if (TX_SUCCESS !=
2864 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2865 {
2866 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002867 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002868 }
2869
2870 // gLimQuietDuration appears to be in units of ticks
2871 // Use it as is
2872 if (TX_SUCCESS !=
2873 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2874 psessionEntry->gLimSpecMgmt.quietDuration,
2875 0))
2876 {
2877 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002878 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002879 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002880 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002881#ifdef GEN6_TODO
2882 /* revisit this piece of code to assign the appropriate sessionId below
2883 * priority - HIGH
2884 */
2885 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2886#endif
2887 if( TX_SUCCESS !=
2888 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2889 {
2890 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002891 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 }
2893 else
2894 {
2895 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002896 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002897
2898 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2899 /* print message, otherwise, stop data traffic and stay quiet */
2900 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2901 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2902 {
2903 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002904 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 }
2906 else
2907 {
2908 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2909 /* freeze the transmission */
2910 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2911
2912 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002913 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002914 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 }
2916 }
2917 break;
2918
2919 case eLIM_QUIET_RUNNING:
2920 case eLIM_QUIET_INIT:
2921 case eLIM_QUIET_END:
2922 default:
2923 //
2924 // As of now, nothing to be done
2925 //
2926 break;
2927 }
2928}
2929
2930/**
2931 * limProcessQuietBssTimeout
2932 *
2933 * FUNCTION:
2934 * This function is active on the AP and STA.
2935 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2936 *
2937 * LOGIC:
2938 * On the AP -
2939 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2940 * an indication for the AP to START sending out the
2941 * Quiet BSS IE.
2942 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2943 * the 11H spec
2944 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2945 * a Proprietary IE. This will be understood by all the
2946 * TITAN STA's
2947 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2948 * initiate the SCH to include the Quiet BSS IE in all
2949 * its subsequent Beacons/PR's.
2950 * The Quiet BSS IE will be included in all the Beacons
2951 * & PR's until the next DTIM period
2952 *
2953 * On the STA -
2954 * When gLimQuietState = eLIM_QUIET_RUNNING
2955 * This indicates that the STA was successfully shut-off
2956 * for the specified gLimQuietDuration. This is a trigger
2957 * for the STA to now resume data traffic.
2958 * -> gLimQuietState is set to eLIM_QUIET_INIT
2959 *
2960 * ASSUMPTIONS:
2961 *
2962 * NOTE:
2963 *
2964 * @param pMac - Pointer to Global MAC structure
2965 *
2966 * @return None
2967 */
2968void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2969{
Jeff Johnsone7245742012-09-05 17:12:55 -07002970 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002971
Jeff Johnsone7245742012-09-05 17:12:55 -07002972 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002974 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 return;
2976 }
2977
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002978 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002979 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 }
2982 else
2983 {
2984 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07002985 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002986 {
2987 case eLIM_QUIET_RUNNING:
2988 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07002989 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002990
2991 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
2992 {
2993 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07002994 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2995 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002996 {
2997 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002998 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 }
3000
3001 /* Reset status flag */
3002 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3003 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3004
3005 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003006 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 }
3008 else
3009 {
3010 //
3011 // Nothing specific to be done in this case
3012 // A background scan that was triggered during
3013 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3014 //
3015 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003016 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 }
3018 break;
3019
3020 case eLIM_QUIET_INIT:
3021 case eLIM_QUIET_BEGIN:
3022 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003023 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003024 /* If the quiet period has ended, then resume the frame transmission */
3025 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003026 limRestorePreQuietState(pMac, psessionEntry);
3027 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 break;
3029
3030 default:
3031 //
3032 // As of now, nothing to be done
3033 //
3034 break;
3035 }
3036 }
3037}
Jeff Johnson295189b2012-06-20 16:38:30 -07003038/**
3039 * limProcessWPSOverlapTimeout
3040 *
3041 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3042 *
3043 * LOGIC:
3044 *
3045 * ASSUMPTIONS:
3046 *
3047 * NOTE:
3048 *
3049 * @param pMac - Pointer to Global MAC structure
3050 *
3051 * @return None
3052 */
3053#if 0
3054void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3055{
3056
3057 tpPESession psessionEntry;
3058 tANI_U32 sessionId;
3059
3060 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3061 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003062 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 }
3064
3065 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3066
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003067 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003068
3069 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3070 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003071 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 return;
3073 }
3074
3075 limWPSPBCTimeout(pMac, psessionEntry);
3076}
3077#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003078
Jeff Johnson295189b2012-06-20 16:38:30 -07003079/**----------------------------------------------
3080\fn limStartQuietTimer
3081\brief Starts the quiet timer.
3082
3083\param pMac
3084\return NONE
3085-----------------------------------------------*/
3086void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3087{
3088 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303089 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003090
3091 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003092 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 return;
3094 }
3095
Jeff Johnson295189b2012-06-20 16:38:30 -07003096
3097 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3098 return;
3099 // First, de-activate Timer, if its already active
3100 limCancelDot11hQuiet(pMac, psessionEntry);
3101
Jeff Johnsone7245742012-09-05 17:12:55 -07003102 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3103 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3104 {
3105 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003106 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003107 }
3108
3109 // Set the NEW timeout value, in ticks
3110 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3111 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3112 {
3113 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003114 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003115 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003116
3117 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3118 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3119 {
3120 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003121 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003122 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003123
Jeff Johnsone7245742012-09-05 17:12:55 -07003124 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 return;
3126 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003127}
3128
Jeff Johnson295189b2012-06-20 16:38:30 -07003129
3130/** ------------------------------------------------------------------------ **/
3131/**
3132 * keep track of the number of ANI peers associated in the BSS
3133 * For the first and last ANI peer, we have to update EDCA params as needed
3134 *
3135 * When the first ANI peer joins the BSS, we notify SCH
3136 * When the last ANI peer leaves the BSS, we notfiy SCH
3137 */
3138void
3139limUtilCountStaAdd(
3140 tpAniSirGlobal pMac,
3141 tpDphHashNode pSta,
3142 tpPESession psessionEntry)
3143{
3144
3145 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3146 return;
3147
3148 pSta->fAniCount = 1;
3149
3150 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3151 return;
3152
3153 // get here only if this is the first ANI peer in the BSS
3154 schEdcaProfileUpdate(pMac, psessionEntry);
3155}
3156
3157void
3158limUtilCountStaDel(
3159 tpAniSirGlobal pMac,
3160 tpDphHashNode pSta,
3161 tpPESession psessionEntry)
3162{
3163
3164 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3165 return;
3166
3167 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3168 * then go ahead and update the count and profiles. This ensures
3169 * that the "number of ani station" count is properly incremented/decremented.
3170 */
3171 if (pSta->valid == 1)
3172 return;
3173
3174 pSta->fAniCount = 0;
3175
3176 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3177 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003178 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 pMac->lim.gLimNumOfAniSTAs);
3180 return;
3181 }
3182
3183 pMac->lim.gLimNumOfAniSTAs--;
3184
3185 if (pMac->lim.gLimNumOfAniSTAs != 0)
3186 return;
3187
3188 // get here only if this is the last ANI peer in the BSS
3189 schEdcaProfileUpdate(pMac, psessionEntry);
3190}
3191
Jeff Johnson295189b2012-06-20 16:38:30 -07003192/**
3193 * limSwitchChannelCback()
3194 *
3195 *FUNCTION:
3196 * This is the callback function registered while requesting to switch channel
3197 * after AP indicates a channel switch for spectrum management (11h).
3198 *
3199 *NOTE:
3200 * @param pMac Pointer to Global MAC structure
3201 * @param status Status of channel switch request
3202 * @param data User data
3203 * @param psessionEntry Session information
3204 * @return NONE
3205 */
3206void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3207 tANI_U32 *data, tpPESession psessionEntry)
3208{
3209 tSirMsgQ mmhMsg = {0};
3210 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3211
Jeff Johnson295189b2012-06-20 16:38:30 -07003212 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3213
3214 /* We need to restore pre-channelSwitch state on the STA */
3215 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3216 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003217 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003218 return;
3219 }
3220
3221 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303222 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3223 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003225 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 return;
3227 }
3228
3229 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3230 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003231 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3233 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303234 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3236 mmhMsg.bodyval = 0;
3237
Jeff Johnsone7245742012-09-05 17:12:55 -07003238 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003239
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003241}
3242
3243/**
3244 * limSwitchPrimaryChannel()
3245 *
3246 *FUNCTION:
3247 * This function changes the current operating channel
3248 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3249 *
3250 *NOTE:
3251 * @param pMac Pointer to Global MAC structure
3252 * @param newChannel new chnannel ID
3253 * @return NONE
3254 */
3255void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3256{
3257#if !defined WLAN_FEATURE_VOWIFI
3258 tANI_U32 localPwrConstraint;
3259#endif
3260
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003261 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 psessionEntry->currentOperChannel, newChannel);)
3263 psessionEntry->currentReqChannel = newChannel;
3264 psessionEntry->limRFBand = limGetRFBand(newChannel);
3265
3266 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3267
3268 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3269 pMac->lim.gpchangeChannelData = NULL;
3270
3271#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003272 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3274#else
3275 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3276 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003277 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 return;
3279 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003280 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3282#endif
3283 return;
3284}
3285
3286/**
3287 * limSwitchPrimarySecondaryChannel()
3288 *
3289 *FUNCTION:
3290 * This function changes the primary and secondary channel.
3291 * If 11h is enabled and user provides a "new channel ID"
3292 * that is different from the current operating channel,
3293 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3294 * assign notify LIM of such change.
3295 *
3296 *NOTE:
3297 * @param pMac Pointer to Global MAC structure
3298 * @param newChannel New chnannel ID (or current channel ID)
3299 * @param subband CB secondary info:
3300 * - eANI_CB_SECONDARY_NONE
3301 * - eANI_CB_SECONDARY_UP
3302 * - eANI_CB_SECONDARY_DOWN
3303 * @return NONE
3304 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003305void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003306{
3307#if !defined WLAN_FEATURE_VOWIFI
3308 tANI_U32 localPwrConstraint;
3309#endif
3310
Jeff Johnson295189b2012-06-20 16:38:30 -07003311#if !defined WLAN_FEATURE_VOWIFI
3312 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003313 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 return;
3315 }
3316#endif
3317
Jeff Johnson295189b2012-06-20 16:38:30 -07003318#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003319 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003320#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003321 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003322#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003323
Jeff Johnsone7245742012-09-05 17:12:55 -07003324 // Store the new primary and secondary channel in session entries if different
3325 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 {
3327 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003328 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 psessionEntry->currentOperChannel = newChannel;
3331 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003332 if (psessionEntry->htSecondaryChannelOffset != subband)
3333 {
3334 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003335 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003336 psessionEntry->htSecondaryChannelOffset, subband);
3337 psessionEntry->htSecondaryChannelOffset = subband;
3338 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3339 {
3340 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3341 }
3342 else
3343 {
3344 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3345 }
3346 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003348
3349 return;
3350}
3351
3352
3353/**
3354 * limActiveScanAllowed()
3355 *
3356 *FUNCTION:
3357 * Checks if active scans are permitted on the given channel
3358 *
3359 *LOGIC:
3360 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3361 * Need to check if the channelNum matches, then depending on the corresponding
3362 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3363 *
3364 *ASSUMPTIONS:
3365 *
3366 *NOTE:
3367 *
3368 * @param pMac Pointer to Global MAC structure
3369 * @param channelNum channel number
3370 * @return None
3371 */
3372
3373tANI_U8 limActiveScanAllowed(
3374 tpAniSirGlobal pMac,
3375 tANI_U8 channelNum)
3376{
3377 tANI_U32 i;
3378 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3379 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3380 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3381 != eSIR_SUCCESS)
3382 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003383 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 return false;
3385 }
3386
3387 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3388 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003389 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 len);
3391 return false;
3392 }
3393
3394 for (i=0; (i+1) < len; i+=2)
3395 {
3396 if (channelPair[i] == channelNum)
3397 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3398 }
3399 return false;
3400}
3401
3402/**
3403 * limTriggerBackgroundScanDuringQuietBss()
3404 *
3405 *FUNCTION:
3406 * This function is applicable to the STA only.
3407 * This function is called by limProcessQuietTimeout(),
3408 * when it is time to honor the Quiet BSS IE from the AP.
3409 *
3410 *LOGIC:
3411 * If 11H is enabled:
3412 * We cannot trigger a background scan. The STA needs to
3413 * shut-off Tx/Rx.
3414 * If 11 is not enabled:
3415 * Determine if the next channel that we are going to
3416 * scan is NOT the same channel (or not) on which the
3417 * Quiet BSS was requested.
3418 * If yes, then we cannot trigger a background scan on
3419 * this channel. Return with a false.
3420 * If no, then trigger a background scan. Return with
3421 * a true.
3422 *
3423 *ASSUMPTIONS:
3424 *
3425 *NOTE:
3426 * This API is redundant if the existing API,
3427 * limTriggerBackgroundScan(), were to return a valid
3428 * response instead of returning void.
3429 * If possible, try to revisit this API
3430 *
3431 * @param pMac Pointer to Global MAC structure
3432 * @return eSIR_TRUE, if a background scan was attempted
3433 * eSIR_FALSE, if not
3434 */
3435tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3436{
3437 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003438
3439
3440
3441 //TBD-RAJESH HOW TO GET sessionEntry?????
3442 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3443
3444 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3445 return bScanTriggered;
3446
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 {
3449 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3450 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3451
3452 // Determine the next scan channel
3453
3454 // Get background scan channel list from CFG
3455 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3456 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3457 (tANI_U8 *) bgScanChannelList,
3458 (tANI_U32 *) &len ))
3459 {
3460 // Ensure that we do not go off scanning on the same
3461 // channel on which the Quiet BSS was requested
3462 if( psessionEntry->currentOperChannel!=
3463 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3464 {
3465 // For now, try and attempt a background scan. It will
3466 // be ideal if this API actually returns a success or
3467 // failure instead of having a void return type
3468 limTriggerBackgroundScan( pMac );
3469
3470 bScanTriggered = eSIR_TRUE;
3471 }
3472 else
3473 {
3474 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003475 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 -07003476 }
3477 }
3478 else
3479 {
3480 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003481 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 -07003482 }
3483 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003484 return bScanTriggered;
3485}
3486
3487
3488/**
3489 * limGetHTCapability()
3490 *
3491 *FUNCTION:
3492 * A utility function that returns the "current HT capability state" for the HT
3493 * capability of interest (as requested in the API)
3494 *
3495 *LOGIC:
3496 * This routine will return with the "current" setting of a requested HT
3497 * capability. This state info could be retrieved from -
3498 * a) CFG (for static entries)
3499 * b) Run time info
3500 * - Dynamic state maintained by LIM
3501 * - Configured at radio init time by SME
3502 *
3503 *
3504 *ASSUMPTIONS:
3505 * NA
3506 *
3507 *NOTE:
3508 *
3509 * @param pMac Pointer to Global MAC structure
3510 * @param htCap The HT capability being queried
3511 * @return tANI_U8 The current state of the requested HT capability is returned in a
3512 * tANI_U8 variable
3513 */
3514
Jeff Johnson295189b2012-06-20 16:38:30 -07003515tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3516 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003517{
3518tANI_U8 retVal = 0;
3519tANI_U8 *ptr;
3520tANI_U32 cfgValue;
3521tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3522tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3523tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3524tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3525
3526 //
3527 // Determine which CFG to read from. Not ALL of the HT
3528 // related CFG's need to be read each time this API is
3529 // accessed
3530 //
3531 if( htCap >= eHT_ANTENNA_SELECTION &&
3532 htCap < eHT_SI_GRANULARITY )
3533 {
3534 // Get Antenna Seletion HT Capabilities
3535 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3536 cfgValue = 0;
3537 ptr = (tANI_U8 *) &macASCapabilityInfo;
3538 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3539 }
3540 else
3541 {
3542 if( htCap >= eHT_TX_BEAMFORMING &&
3543 htCap < eHT_ANTENNA_SELECTION )
3544 {
3545 // Get Transmit Beam Forming HT Capabilities
3546 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3547 cfgValue = 0;
3548 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3549 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3550 }
3551 else
3552 {
3553 if( htCap >= eHT_PCO &&
3554 htCap < eHT_TX_BEAMFORMING )
3555 {
3556 // Get Extended HT Capabilities
3557 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3558 cfgValue = 0;
3559 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3560 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3561 }
3562 else
3563 {
3564 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3565 {
3566 // Get HT Capabilities
3567 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3568 cfgValue = 0;
3569 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3570 // 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
3571 *ptr++ = cfgValue & 0xff;
3572 *ptr = (cfgValue >> 8) & 0xff;
3573 }
3574 }
3575 }
3576 }
3577
3578 switch( htCap )
3579 {
3580 case eHT_LSIG_TXOP_PROTECTION:
3581 retVal = pMac->lim.gHTLsigTXOPProtection;
3582 break;
3583
3584 case eHT_STBC_CONTROL_FRAME:
3585 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3586 break;
3587
3588 case eHT_PSMP:
3589 retVal = pMac->lim.gHTPSMPSupport;
3590 break;
3591
3592 case eHT_DSSS_CCK_MODE_40MHZ:
3593 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3594 break;
3595
3596 case eHT_MAX_AMSDU_LENGTH:
3597 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3598 break;
3599
3600 case eHT_DELAYED_BA:
3601 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3602 break;
3603
3604 case eHT_RX_STBC:
3605 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3606 break;
3607
3608 case eHT_TX_STBC:
3609 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3610 break;
3611
3612 case eHT_SHORT_GI_40MHZ:
3613 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3614 break;
3615
3616 case eHT_SHORT_GI_20MHZ:
3617 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3618 break;
3619
3620 case eHT_GREENFIELD:
3621 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3622 break;
3623
3624 case eHT_MIMO_POWER_SAVE:
3625 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3626 break;
3627
3628 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003629 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 break;
3631
3632 case eHT_ADVANCED_CODING:
3633 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3634 break;
3635
3636 case eHT_MAX_RX_AMPDU_FACTOR:
3637 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3638 break;
3639
3640 case eHT_MPDU_DENSITY:
3641 retVal = pMac->lim.gHTAMpduDensity;
3642 break;
3643
3644 case eHT_PCO:
3645 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3646 break;
3647
3648 case eHT_TRANSITION_TIME:
3649 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3650 break;
3651
3652 case eHT_MCS_FEEDBACK:
3653 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3654 break;
3655
3656 case eHT_TX_BEAMFORMING:
3657 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3658 break;
3659
3660 case eHT_ANTENNA_SELECTION:
3661 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3662 break;
3663
3664 case eHT_SI_GRANULARITY:
3665 retVal = pMac->lim.gHTServiceIntervalGranularity;
3666 break;
3667
3668 case eHT_CONTROLLED_ACCESS:
3669 retVal = pMac->lim.gHTControlledAccessOnly;
3670 break;
3671
3672 case eHT_RIFS_MODE:
3673 retVal = psessionEntry->beaconParams.fRIFSMode;
3674 break;
3675
3676 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003677 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 break;
3679
3680 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003681 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 break;
3683
3684 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3686 retVal = psessionEntry->htOperMode;
3687 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 retVal = pMac->lim.gHTOperMode;
3689 break;
3690
3691 case eHT_BASIC_STBC_MCS:
3692 retVal = pMac->lim.gHTSTBCBasicMCS;
3693 break;
3694
3695 case eHT_DUAL_CTS_PROTECTION:
3696 retVal = pMac->lim.gHTDualCTSProtection;
3697 break;
3698
3699 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3700 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3701 break;
3702
3703 case eHT_PCO_ACTIVE:
3704 retVal = pMac->lim.gHTPCOActive;
3705 break;
3706
3707 case eHT_PCO_PHASE:
3708 retVal = pMac->lim.gHTPCOPhase;
3709 break;
3710
3711 default:
3712 break;
3713 }
3714
3715 return retVal;
3716}
3717
Jeff Johnson295189b2012-06-20 16:38:30 -07003718void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3719{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303720 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 return;
3722}
3723
3724
3725
3726
3727/** -------------------------------------------------------------
3728\fn limEnable11aProtection
3729\brief based on config setting enables\disables 11a protection.
3730\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3731\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3732\param tpUpdateBeaconParams pBeaconParams
3733\return None
3734 -------------------------------------------------------------*/
3735tSirRetStatus
3736limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3737 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3738{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003739 if(NULL == psessionEntry)
3740 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003741 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003742 return eSIR_FAILURE;
3743 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 //overlapping protection configuration check.
3745 if(overlap)
3746 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 }
3748 else
3749 {
3750 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003751 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003752 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 {
3754 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003755 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 return eSIR_SUCCESS;
3757 }
3758 }
3759
3760 if (enable)
3761 {
3762 //If we are AP and HT capable, we need to set the HT OP mode
3763 //appropriately.
3764 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003765 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 {
3767 if(overlap)
3768 {
3769 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3770 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3771 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3772 {
3773 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3774 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3775 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3776 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3777 }
3778 }
3779 else
3780 {
3781 psessionEntry->gLim11aParams.protectionEnabled = true;
3782 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3783 {
3784 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003785 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003786 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3787 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3788
3789 }
3790 }
3791 }
3792
3793 //This part is common for staiton as well.
3794 if(false == psessionEntry->beaconParams.llaCoexist)
3795 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003796 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003797 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3798 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3799 }
3800 }
3801 else if (true == psessionEntry->beaconParams.llaCoexist)
3802 {
3803 //for AP role.
3804 //we need to take care of HT OP mode change if needed.
3805 //We need to take care of Overlap cases.
3806 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3807 {
3808 if(overlap)
3809 {
3810 //Overlap Legacy protection disabled.
3811 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3812
3813 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003814 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 {
3816 // no HT op mode change if any of the overlap protection enabled.
3817 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3818 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3819 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3820
3821 {
3822 //Check if there is a need to change HT OP mode.
3823 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3824 {
3825 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3826 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3827
3828 if(psessionEntry->gLimHt20Params.protectionEnabled)
3829 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3830 else
3831 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3832 }
3833 }
3834 }
3835 }
3836 else
3837 {
3838 //Disable protection from 11A stations.
3839 psessionEntry->gLim11aParams.protectionEnabled = false;
3840 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3841
3842 //Check if any other non-HT protection enabled.
3843 //Right now we are in HT OP Mixed mode.
3844 //Change HT op mode appropriately.
3845
3846 //Change HT OP mode to 01 if any overlap protection enabled
3847 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3848 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3849 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3850
3851 {
3852 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003853 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003854 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3855 }
3856 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3857 {
3858 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003859 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3861 }
3862 else
3863 {
3864 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003865 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003866 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3867 }
3868 }
3869 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3870 !psessionEntry->gLim11aParams.protectionEnabled)
3871 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003872 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003873 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3874 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3875 }
3876 }
3877 //for station role
3878 else
3879 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003880 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3882 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3883 }
3884 }
3885
3886 return eSIR_SUCCESS;
3887}
3888
3889/** -------------------------------------------------------------
3890\fn limEnable11gProtection
3891\brief based on config setting enables\disables 11g protection.
3892\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3893\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3894\param tpUpdateBeaconParams pBeaconParams
3895\return None
3896 -------------------------------------------------------------*/
3897
3898tSirRetStatus
3899limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3900 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3901{
3902
3903 //overlapping protection configuration check.
3904 if(overlap)
3905 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 }
3907 else
3908 {
3909 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3911 !psessionEntry->cfgProtection.fromllb)
3912 {
3913 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003914 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 return eSIR_SUCCESS;
3916 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 {
3918 if(!pMac->lim.cfgProtection.fromllb)
3919 {
3920 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003921 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 return eSIR_SUCCESS;
3923 }
3924 }
3925 }
3926
3927 if (enable)
3928 {
3929 //If we are AP and HT capable, we need to set the HT OP mode
3930 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3932 {
3933 if(overlap)
3934 {
3935 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003936 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003937 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 {
3939 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3940 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3941 {
3942 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3943 }
3944 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3945 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3946 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3947 //Not processing OBSS bit from other APs, as we are already taking care
3948 //of Protection from overlapping BSS based on erp IE or useProtection bit
3949 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3950 }
3951 }
3952 else
3953 {
3954 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003955 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003956 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 {
3958 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3959 {
3960 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3961 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3962 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3963 }
3964 }
3965 }
3966 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003967 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003968 {
3969 if(overlap)
3970 {
3971 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3972 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3973 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3974 {
3975 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3976 }
3977 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3978 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3979 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3980 //Not processing OBSS bit from other APs, as we are already taking care
3981 //of Protection from overlapping BSS based on erp IE or useProtection bit
3982 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3983 }
3984 else
3985 {
3986 psessionEntry->gLim11bParams.protectionEnabled = true;
3987 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3988 {
3989 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
3990 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3991 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3992 }
3993 }
3994 }
3995
3996 //This part is common for staiton as well.
3997 if(false == psessionEntry->beaconParams.llbCoexist)
3998 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003999 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004000 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4001 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4002 }
4003 }
4004 else if (true == psessionEntry->beaconParams.llbCoexist)
4005 {
4006 //for AP role.
4007 //we need to take care of HT OP mode change if needed.
4008 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4010 {
4011 if(overlap)
4012 {
4013 //Overlap Legacy protection disabled.
4014 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4015
4016 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004017 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004018 {
4019 // no HT op mode change if any of the overlap protection enabled.
4020 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4021 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4022 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4023 {
4024 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004025 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 {
4027 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4028 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4029 if(psessionEntry->gLimHt20Params.protectionEnabled){
4030 //Commenting out beacuse of CR 258588 WFA cert
4031 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4032 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4033 }
4034 else
4035 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4036 }
4037 }
4038 }
4039 }
4040 else
4041 {
4042 //Disable protection from 11B stations.
4043 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004044 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 //Check if any other non-HT protection enabled.
4046 if(!psessionEntry->gLim11gParams.protectionEnabled)
4047 {
4048 //Right now we are in HT OP Mixed mode.
4049 //Change HT op mode appropriately.
4050 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4051
4052 //Change HT OP mode to 01 if any overlap protection enabled
4053 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4054 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4055 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4056 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4057 {
4058 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004059 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4061 }
4062 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4063 {
4064 //Commenting because of CR 258588 WFA cert
4065 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4066 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004067 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4069 }
4070 else
4071 {
4072 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4073 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4074 }
4075 }
4076 }
4077 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4078 !psessionEntry->gLim11bParams.protectionEnabled)
4079 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004080 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4082 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4083 }
4084 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 {
4086 if(overlap)
4087 {
4088 //Overlap Legacy protection disabled.
4089 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4090
4091 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004092 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004093 {
4094 // no HT op mode change if any of the overlap protection enabled.
4095 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4096 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4097 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4098
4099 {
4100 //Check if there is a need to change HT OP mode.
4101 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4102 {
4103 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4104 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4105 if(psessionEntry->gLimHt20Params.protectionEnabled)
4106 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4107 else
4108 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4109 }
4110 }
4111 }
4112 }
4113 else
4114 {
4115 //Disable protection from 11B stations.
4116 psessionEntry->gLim11bParams.protectionEnabled = false;
4117 //Check if any other non-HT protection enabled.
4118 if(!psessionEntry->gLim11gParams.protectionEnabled)
4119 {
4120 //Right now we are in HT OP Mixed mode.
4121 //Change HT op mode appropriately.
4122 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4123
4124 //Change HT OP mode to 01 if any overlap protection enabled
4125 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4126 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4127 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4128 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4129
4130 {
4131 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4132 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4133 }
4134 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4135 {
4136 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4137 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4138 }
4139 else
4140 {
4141 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4142 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4143 }
4144 }
4145 }
4146 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4147 !psessionEntry->gLim11bParams.protectionEnabled)
4148 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004149 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4151 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4152 }
4153 }
4154 //for station role
4155 else
4156 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004157 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004158 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4159 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4160 }
4161 }
4162 return eSIR_SUCCESS;
4163}
4164
4165/** -------------------------------------------------------------
4166\fn limEnableHtProtectionFrom11g
4167\brief based on cofig enables\disables protection from 11g.
4168\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4169\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4170\param tpUpdateBeaconParams pBeaconParams
4171\return None
4172 -------------------------------------------------------------*/
4173tSirRetStatus
4174limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4175 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4176{
Jeff Johnsone7245742012-09-05 17:12:55 -07004177 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4179
4180 //overlapping protection configuration check.
4181 if(overlap)
4182 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4184 {
4185 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004186 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004187 return eSIR_SUCCESS;
4188 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 {
4190 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004191 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 return eSIR_SUCCESS;
4193 }
4194 }
4195 else
4196 {
4197 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4199 !psessionEntry->cfgProtection.fromllg){
4200 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004201 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 return eSIR_SUCCESS;
4203 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 {
4205 if(!pMac->lim.cfgProtection.fromllg)
4206 {
4207 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004208 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 return eSIR_SUCCESS;
4210 }
4211 }
4212 }
4213 if (enable)
4214 {
4215 //If we are AP and HT capable, we need to set the HT OP mode
4216 //appropriately.
4217
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4219 {
4220 if(overlap)
4221 {
4222 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4223 //11g exists in overlap BSS.
4224 //need not to change the operating mode to overlap_legacy
4225 //if higher or same protection operating mode is enabled right now.
4226 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4227 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4228 {
4229 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4230 }
4231 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304232 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 }
4234 else
4235 {
4236 //11g is associated to an AP operating in 11n mode.
4237 //Change the HT operating mode to 'mixed mode'.
4238 psessionEntry->gLim11gParams.protectionEnabled = true;
4239 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4240 {
4241 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4242 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304243 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 }
4245 }
4246 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 {
4248 if(overlap)
4249 {
4250 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4251 //11g exists in overlap BSS.
4252 //need not to change the operating mode to overlap_legacy
4253 //if higher or same protection operating mode is enabled right now.
4254 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4255 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4256 {
4257 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4258 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4259 }
4260 }
4261 else
4262 {
4263 //11g is associated to an AP operating in 11n mode.
4264 //Change the HT operating mode to 'mixed mode'.
4265 psessionEntry->gLim11gParams.protectionEnabled = true;
4266 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4267 {
4268 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4269 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304270 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 }
4272 }
4273 }
4274
4275 //This part is common for staiton as well.
4276 if(false == psessionEntry->beaconParams.llgCoexist)
4277 {
4278 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4279 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4280 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4282 {
4283 // As operating mode changed after G station assoc some way to update beacon
4284 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4285 //pMac->sch.schObject.fBeaconChanged = 1;
4286 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4287 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 }
4289 else if (true == psessionEntry->beaconParams.llgCoexist)
4290 {
4291 //for AP role.
4292 //we need to take care of HT OP mode change if needed.
4293 //We need to take care of Overlap cases.
4294
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4296 {
4297 if(overlap)
4298 {
4299 //Overlap Legacy protection disabled.
4300 if (psessionEntry->gLim11gParams.numSta == 0)
4301 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4302
4303 // no HT op mode change if any of the overlap protection enabled.
4304 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4305 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4306 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4307 {
4308 //Check if there is a need to change HT OP mode.
4309 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4310 {
4311 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4312 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4313
4314 if(psessionEntry->gLimHt20Params.protectionEnabled){
4315 //Commenting because of CR 258588 WFA cert
4316 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4317 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4318 }
4319 else
4320 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4321 }
4322 }
4323 }
4324 else
4325 {
4326 //Disable protection from 11G stations.
4327 psessionEntry->gLim11gParams.protectionEnabled = false;
4328 //Check if any other non-HT protection enabled.
4329 if(!psessionEntry->gLim11bParams.protectionEnabled)
4330 {
4331
4332 //Right now we are in HT OP Mixed mode.
4333 //Change HT op mode appropriately.
4334 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4335
4336 //Change HT OP mode to 01 if any overlap protection enabled
4337 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4338 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4339 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4340 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4341
4342 {
4343 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4344 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4345 }
4346 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4347 {
4348 //Commenting because of CR 258588 WFA cert
4349 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4350 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4351 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4352 }
4353 else
4354 {
4355 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4356 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4357 }
4358 }
4359 }
4360 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4361 !psessionEntry->gLim11gParams.protectionEnabled)
4362 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004363 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4365 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4366 }
4367 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004368 {
4369 if(overlap)
4370 {
4371 //Overlap Legacy protection disabled.
4372 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4373
4374 // no HT op mode change if any of the overlap protection enabled.
4375 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4376 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4377 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4378 {
4379 //Check if there is a need to change HT OP mode.
4380 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4381 {
4382 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4383 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4384
4385 if(psessionEntry->gLimHt20Params.protectionEnabled)
4386 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4387 else
4388 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4389 }
4390 }
4391 }
4392 else
4393 {
4394 //Disable protection from 11G stations.
4395 psessionEntry->gLim11gParams.protectionEnabled = false;
4396 //Check if any other non-HT protection enabled.
4397 if(!psessionEntry->gLim11bParams.protectionEnabled)
4398 {
4399
4400 //Right now we are in HT OP Mixed mode.
4401 //Change HT op mode appropriately.
4402 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4403
4404 //Change HT OP mode to 01 if any overlap protection enabled
4405 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4406 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4407 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4408 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4409
4410 {
4411 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4412 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4413 }
4414 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4415 {
4416 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4417 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4418 }
4419 else
4420 {
4421 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4422 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4423 }
4424 }
4425 }
4426 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4427 !psessionEntry->gLim11gParams.protectionEnabled)
4428 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004429 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4431 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4432 }
4433 }
4434 //for station role
4435 else
4436 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004437 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4439 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4440 }
4441 }
4442 return eSIR_SUCCESS;
4443}
4444//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4445//This check will be done at the caller.
4446
4447/** -------------------------------------------------------------
4448\fn limEnableHtObssProtection
4449\brief based on cofig enables\disables obss protection.
4450\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4451\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4452\param tpUpdateBeaconParams pBeaconParams
4453\return None
4454 -------------------------------------------------------------*/
4455tSirRetStatus
4456limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4457 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4458{
4459
4460
Jeff Johnsone7245742012-09-05 17:12:55 -07004461 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 return eSIR_SUCCESS; // this protection is only for HT stations.
4463
4464 //overlapping protection configuration check.
4465 if(overlap)
4466 {
4467 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004468 }
4469 else
4470 {
4471 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004472 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4473 { //ToDo Update this field
4474 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004475 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 return eSIR_SUCCESS;
4477 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 {
4479 if(!pMac->lim.cfgProtection.obss)
4480 { //ToDo Update this field
4481 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004482 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 return eSIR_SUCCESS;
4484 }
4485 }
4486 }
4487
4488
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4490 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004492 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 psessionEntry->beaconParams.gHTObssMode = true;
4494 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4495
4496 }
4497 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4498 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004499 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 psessionEntry->beaconParams.gHTObssMode = false;
4501 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4502
4503 }
4504//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4505 if (!enable && !overlap)
4506 {
4507 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4508 }
4509 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 {
4511 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4512 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004513 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 psessionEntry->beaconParams.gHTObssMode = true;
4515 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4516
4517 }
4518 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4519 {
4520
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004521 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 psessionEntry->beaconParams.gHTObssMode = false;
4523 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4524
4525 }
4526 }
4527 return eSIR_SUCCESS;
4528}
4529/** -------------------------------------------------------------
4530\fn limEnableHT20Protection
4531\brief based on cofig enables\disables protection from Ht20.
4532\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4533\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4534\param tpUpdateBeaconParams pBeaconParams
4535\return None
4536 -------------------------------------------------------------*/
4537tSirRetStatus
4538limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4539 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4540{
Jeff Johnsone7245742012-09-05 17:12:55 -07004541 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004542 return eSIR_SUCCESS; // this protection is only for HT stations.
4543
4544 //overlapping protection configuration check.
4545 if(overlap)
4546 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 }
4548 else
4549 {
4550 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004551 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4552 !psessionEntry->cfgProtection.ht20)
4553 {
4554 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004555 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 return eSIR_SUCCESS;
4557 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 {
4559 if(!pMac->lim.cfgProtection.ht20)
4560 {
4561 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004562 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 return eSIR_SUCCESS;
4564 }
4565 }
4566 }
4567
4568 if (enable)
4569 {
4570 //If we are AP and HT capable, we need to set the HT OP mode
4571 //appropriately.
4572
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4574 if(overlap)
4575 {
4576 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4577 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4578 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4579 {
4580 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4581 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4582 }
4583 }
4584 else
4585 {
4586 psessionEntry->gLimHt20Params.protectionEnabled = true;
4587 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4588 {
4589 //Commenting because of CR 258588 WFA cert
4590 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4591 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4592 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4593 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4594 }
4595 }
4596 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 {
4598 if(overlap)
4599 {
4600 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4601 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4602 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4603 {
4604 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4605 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4606 }
4607 }
4608 else
4609 {
4610 psessionEntry->gLimHt20Params.protectionEnabled = true;
4611 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4612 {
4613 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4614 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4615 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4616 }
4617 }
4618 }
4619
4620 //This part is common for staiton as well.
4621 if(false == psessionEntry->beaconParams.ht20Coexist)
4622 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004623 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004624 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4625 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4626 }
4627 }
4628 else if (true == psessionEntry->beaconParams.ht20Coexist)
4629 {
4630 //for AP role.
4631 //we need to take care of HT OP mode change if needed.
4632 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4634 if(overlap)
4635 {
4636 //Overlap Legacy protection disabled.
4637 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4638
4639 // no HT op mode change if any of the overlap protection enabled.
4640 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4641 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4642 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4643 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4644 {
4645
4646 //Check if there is a need to change HT OP mode.
4647 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4648 {
4649 if(psessionEntry->gLimHt20Params.protectionEnabled)
4650 {
4651 //Commented beacuse of CR 258588 for WFA Cert
4652 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4653 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4654 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4655 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4656 }
4657 else
4658 {
4659 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4660 }
4661 }
4662 }
4663 }
4664 else
4665 {
4666 //Disable protection from 11G stations.
4667 psessionEntry->gLimHt20Params.protectionEnabled = false;
4668
4669 //Change HT op mode appropriately.
4670 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4671 {
4672 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4673 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4674 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4675 }
4676 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004677 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4679 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4680 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 {
4682 if(overlap)
4683 {
4684 //Overlap Legacy protection disabled.
4685 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4686
4687 // no HT op mode change if any of the overlap protection enabled.
4688 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4689 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4690 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4691 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4692 {
4693
4694 //Check if there is a need to change HT OP mode.
4695 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4696 {
4697 if(psessionEntry->gLimHt20Params.protectionEnabled)
4698 {
4699 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4700 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4701 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4702 }
4703 else
4704 {
4705 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4706 }
4707 }
4708 }
4709 }
4710 else
4711 {
4712 //Disable protection from 11G stations.
4713 psessionEntry->gLimHt20Params.protectionEnabled = false;
4714
4715 //Change HT op mode appropriately.
4716 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4717 {
4718 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4719 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4720 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4721 }
4722 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004723 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4725 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4726 }
4727 //for station role
4728 else
4729 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004730 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004731 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4732 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4733 }
4734 }
4735
4736 return eSIR_SUCCESS;
4737}
4738
4739/** -------------------------------------------------------------
4740\fn limEnableHTNonGfProtection
4741\brief based on cofig enables\disables protection from NonGf.
4742\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4743\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4744\param tpUpdateBeaconParams pBeaconParams
4745\return None
4746 -------------------------------------------------------------*/
4747tSirRetStatus
4748limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4749 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4750{
Jeff Johnsone7245742012-09-05 17:12:55 -07004751 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 return eSIR_SUCCESS; // this protection is only for HT stations.
4753
4754 //overlapping protection configuration check.
4755 if(overlap)
4756 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 }
4758 else
4759 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004760 //normal protection config check
4761 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4762 !psessionEntry->cfgProtection.nonGf)
4763 {
4764 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004765 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 return eSIR_SUCCESS;
4767 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004768 {
4769 //normal protection config check
4770 if(!pMac->lim.cfgProtection.nonGf)
4771 {
4772 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004773 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 return eSIR_SUCCESS;
4775 }
4776 }
4777 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4779 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4780 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004781 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4783 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4784 }
4785 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4786 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004787 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4789 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4790 }
4791 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 {
4793 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004795 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4797 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4798 }
4799 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4800 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004801 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4803 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4804 }
4805 }
4806
4807 return eSIR_SUCCESS;
4808}
4809
4810/** -------------------------------------------------------------
4811\fn limEnableHTLsigTxopProtection
4812\brief based on cofig enables\disables LsigTxop protection.
4813\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4814\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4815\param tpUpdateBeaconParams pBeaconParams
4816\return None
4817 -------------------------------------------------------------*/
4818tSirRetStatus
4819limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4820 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4821{
Jeff Johnsone7245742012-09-05 17:12:55 -07004822 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 return eSIR_SUCCESS; // this protection is only for HT stations.
4824
4825 //overlapping protection configuration check.
4826 if(overlap)
4827 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 }
4829 else
4830 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004831 //normal protection config check
4832 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4833 !psessionEntry->cfgProtection.lsigTxop)
4834 {
4835 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004836 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 return eSIR_SUCCESS;
4838 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 {
4840 //normal protection config check
4841 if(!pMac->lim.cfgProtection.lsigTxop)
4842 {
4843 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004844 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 return eSIR_SUCCESS;
4846 }
4847 }
4848 }
4849
4850
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4852 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4853 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004854 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004855 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4856 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4857 }
4858 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4859 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004860 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004861 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4862 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4863 }
4864 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 {
4866 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004868 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4870 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4871 }
4872 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004874 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004875 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4876 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4877 }
4878 }
4879 return eSIR_SUCCESS;
4880}
4881//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4882//This check will be done at the caller.
4883/** -------------------------------------------------------------
4884\fn limEnableHtRifsProtection
4885\brief based on cofig enables\disables Rifs protection.
4886\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4887\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4888\param tpUpdateBeaconParams pBeaconParams
4889\return None
4890 -------------------------------------------------------------*/
4891tSirRetStatus
4892limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4893 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4894{
Jeff Johnsone7245742012-09-05 17:12:55 -07004895 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 return eSIR_SUCCESS; // this protection is only for HT stations.
4897
4898
4899 //overlapping protection configuration check.
4900 if(overlap)
4901 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 }
4903 else
4904 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004905 //normal protection config check
4906 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4907 !psessionEntry->cfgProtection.rifs)
4908 {
4909 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004910 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 return eSIR_SUCCESS;
4912 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004913 {
4914 //normal protection config check
4915 if(!pMac->lim.cfgProtection.rifs)
4916 {
4917 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004918 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004919 return eSIR_SUCCESS;
4920 }
4921 }
4922 }
4923
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4925 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4926 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4927 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004928 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004929 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4930 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4931 }
4932 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4933 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4934 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004935 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004936 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4937 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4938 }
4939 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004940 {
4941 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4942 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4943 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004944 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4946 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4947 }
4948 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4949 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4950 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004951 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004952 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4953 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4954 }
4955 }
4956 return eSIR_SUCCESS;
4957}
4958
4959// ---------------------------------------------------------------------
4960/**
4961 * limEnableShortPreamble
4962 *
4963 * FUNCTION:
4964 * Enable/Disable short preamble
4965 *
4966 * LOGIC:
4967 *
4968 * ASSUMPTIONS:
4969 *
4970 * NOTE:
4971 *
4972 * @param enable Flag to enable/disable short preamble
4973 * @return None
4974 */
4975
4976tSirRetStatus
4977limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
4978{
4979 tANI_U32 val;
4980
4981 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
4982 {
4983 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004984 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 return eSIR_FAILURE;
4986 }
4987
4988 if (!val)
4989 return eSIR_SUCCESS;
4990
4991 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
4992 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004993 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 return eSIR_FAILURE;
4995 }
4996
4997 if (!val) // 11G short preamble switching is disabled.
4998 return eSIR_SUCCESS;
4999
5000 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5001 {
5002 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5003 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005004 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005005 psessionEntry->beaconParams.fShortPreamble = true;
5006 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5007 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5008 }
5009 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5010 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005011 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 psessionEntry->beaconParams.fShortPreamble = false;
5013 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5014 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5015 }
5016 }
5017
5018 return eSIR_SUCCESS;
5019 }
5020
5021/**
5022 * limTxComplete
5023 *
5024 * Function:
5025 * This is LIM's very own "TX MGMT frame complete" completion routine.
5026 *
5027 * Logic:
5028 * LIM wants to send a MGMT frame (broadcast or unicast)
5029 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5030 * LIM transmits the MGMT frame using the API:
5031 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5032 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5033 * HDD, if it determines that a TX completion routine (in this case
5034 * limTxComplete) has been provided, will invoke this callback
5035 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5036 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5037 *
5038 * Assumptions:
5039 * Presently, this is ONLY being used for MGMT frames/packets
5040 * TODO:
5041 * Would it do good for LIM to have some sort of "signature" validation to
5042 * ensure that the pData argument passed in was a buffer that was actually
5043 * allocated by LIM and/or is not corrupted?
5044 *
5045 * Note: FIXME and TODO
5046 * Looks like palPktFree() is interested in pPacket. But, when this completion
5047 * routine is called, only pData is made available to LIM!!
5048 *
5049 * @param void A pointer to pData. Shouldn't it be pPacket?!
5050 *
5051 * @return none
5052 */
5053void limTxComplete( tHalHandle hHal, void *pData )
5054{
5055 tpAniSirGlobal pMac;
5056 pMac = (tpAniSirGlobal)hHal;
5057
5058#ifdef FIXME_PRIMA
5059 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5060#ifdef TRACE_RECORD
5061 {
5062 tpSirMacMgmtHdr mHdr;
5063 v_U8_t *pRxBd;
5064 vos_pkt_t *pVosPkt;
5065 VOS_STATUS vosStatus;
5066
5067
5068
5069 pVosPkt = (vos_pkt_t *)pData;
5070 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5071
5072 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5073 {
5074 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005075
5076 }
5077 }
5078#endif
5079#endif
5080
5081 palPktFree( pMac->hHdd,
5082 HAL_TXRX_FRM_802_11_MGMT,
5083 (void *) NULL, // this is ignored and will likely be removed from this API
5084 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5085}
5086
5087/**
5088 * \brief This function updates lim global structure, if CB parameters in the BSS
5089 * have changed, and sends an indication to HAL also with the
5090 * updated HT Parameters.
5091 * This function does not detect the change in the primary channel, that is done as part
5092 * of channel Swtich IE processing.
5093 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5094 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5095 *
5096 *
5097 * \param pMac Pointer to global MAC structure
5098 *
5099 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5100 * Probe Response
5101 *
5102 * \param bssIdx BSS Index of the Bss to which Station is associated.
5103 *
5104 *
5105 */
5106
5107void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5108 tDot11fIEHTInfo *pHTInfo,
5109 tANI_U8 bssIdx,
5110 tpPESession psessionEntry)
5111{
Jeff Johnsone7245742012-09-05 17:12:55 -07005112 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005113#if !defined WLAN_FEATURE_VOWIFI
5114 tANI_U32 localPwrConstraint;
5115#endif
5116
5117 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005118 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005119 return;
5120
5121#if !defined WLAN_FEATURE_VOWIFI
5122 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005123 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005124 return;
5125 }
5126#endif
5127
Mihir Shete8fdc9f12014-08-22 11:25:04 +05305128 if (pMac->ft.ftPEContext.pFTPreAuthReq)
5129 {
5130 limLog( pMac, LOGE, FL( "FT PREAUTH channel change is in progress"));
5131 return;
5132 }
5133
Mihir Shetebc160b72014-08-22 14:10:39 +05305134 /*
5135 * Do not try to switch channel if RoC is in progress. RoC code path uses
5136 * pMac->lim.gpLimRemainOnChanReq to notify the upper layers that the device
5137 * has started listening on the channel requested as part of RoC, if we set
5138 * pMac->lim.gpLimRemainOnChanReq to NULL as we do below then the
5139 * upper layers will think that the channel change is not successful and the
5140 * RoC from the upper layer perspective will never end...
5141 */
5142 if (pMac->lim.gpLimRemainOnChanReq)
5143 {
5144 limLog( pMac, LOGE, FL( "RoC is in progress"));
5145 return;
5146 }
5147
Jeff Johnsone7245742012-09-05 17:12:55 -07005148 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5149 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005151 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5152 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5153 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5154 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005155
5156 // Notify HAL
5157 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005158 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005160 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005162 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005163 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5164 pMac->lim.gpchangeChannelCallback = NULL;
5165 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005166
5167#if defined WLAN_FEATURE_VOWIFI
5168 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5169 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5170#else
5171 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5172 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5173#endif
5174
5175 //In case of IBSS, if STA should update HT Info IE in its beacons.
5176 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5177 {
5178 schSetFixedBeaconFields(pMac,psessionEntry);
5179 }
5180
5181 }
5182} // End limUpdateStaRunTimeHTParams.
5183
5184/**
5185 * \brief This function updates the lim global structure, if any of the
5186 * HT Capabilities have changed.
5187 *
5188 *
5189 * \param pMac Pointer to Global MAC structure
5190 *
5191 * \param pHTCapability Pointer to HT Capability Information Element
5192 * obtained from a Beacon or Probe Response
5193 *
5194 *
5195 *
5196 */
5197
5198void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5199 tDot11fIEHTCaps *pHTCaps )
5200{
5201
5202 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5203 {
5204 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5205 // Send change notification to HAL
5206 }
5207
5208 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5209 {
5210 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5211 // Send change notification to HAL
5212 }
5213
5214 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5215 {
5216 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5217 // Send change notification to HAL
5218 }
5219
5220
5221} // End limUpdateStaRunTimeHTCapability.
5222
5223/**
5224 * \brief This function updates lim global structure, if any of the HT
5225 * Info Parameters have changed.
5226 *
5227 *
5228 * \param pMac Pointer to the global MAC structure
5229 *
5230 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5231 * Probe Response
5232 *
5233 *
5234 */
5235
5236void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305237 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005238{
Jeff Johnsone7245742012-09-05 17:12:55 -07005239 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005241 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 // Send change notification to HAL
5243 }
5244
5245 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5246 {
5247 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5248 // Send change notification to HAL
5249 }
5250
5251 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5252 {
5253 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5254 // Send change notification to HAL
5255 }
5256
5257 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5258 {
5259 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5260 // Send change notification to HAL
5261 }
5262
5263 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5264 {
5265 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5266 }
5267
5268 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5269 {
5270 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5271 // Send change notification to HAL
5272 }
5273
5274 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5275 {
5276 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5277 // Send change notification to HAL
5278 }
5279
5280 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5281 {
5282 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5283 // Send change notification to HAL
5284 }
5285
5286 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5287 {
5288 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5289 // Send change notification to HAL
5290 }
5291
5292 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5293 {
5294 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5295 // Send change notification to HAL
5296 }
5297
5298 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5299 {
5300 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5301 // Send change notification to HAL
5302 }
5303
5304} // End limUpdateStaRunTimeHTInfo.
5305
5306
5307/** -------------------------------------------------------------
5308\fn limProcessHalIndMessages
5309\brief callback function for HAL indication
5310\param tpAniSirGlobal pMac
5311\param tANI_U32 mesgId
5312\param void *mesgParam
5313\return tSirRetStatu - status
5314 -------------------------------------------------------------*/
5315
5316tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5317{
5318 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5319 tSirMsgQ msg;
5320
5321 switch(msgId)
5322 {
5323 case SIR_LIM_DEL_TS_IND:
5324 case SIR_LIM_ADD_BA_IND:
5325 case SIR_LIM_DEL_BA_ALL_IND:
5326 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5327 case SIR_LIM_BEACON_GEN_IND:
Abhishek Singh66c16762014-08-14 19:13:19 +05305328 case SIR_LIM_DEL_BA_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07005329 msg.type = (tANI_U16) msgId;
5330 msg.bodyptr = msgParam;
5331 msg.bodyval = 0;
5332 break;
5333
5334 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305335 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005336 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005337 return eSIR_FAILURE;
5338 }
5339
5340 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5341 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305342 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005343 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5344 return eSIR_FAILURE;
5345 }
5346 return eSIR_SUCCESS;
5347}
5348
5349/** -------------------------------------------------------------
5350\fn limValidateDeltsReq
5351\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5352\param tpAniSirGlobal pMac
5353\param tpSirDeltsReq pDeltsReq
5354\param tSirMacAddr peerMacAddr
5355\return eSirRetStatus - status
5356 -------------------------------------------------------------*/
5357
5358tSirRetStatus
5359limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5360{
5361 tpDphHashNode pSta;
5362 tANI_U8 tsStatus;
5363 tSirMacTSInfo *tsinfo;
5364 tANI_U32 i;
5365 tANI_U8 tspecIdx;
5366 /* if sta
5367 * - verify assoc state
5368 * - del tspec locally
5369 * if ap,
5370 * - verify sta is in assoc state
5371 * - del sta tspec locally
5372 */
5373 if(pDeltsReq == NULL)
5374 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005375 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005376 return eSIR_FAILURE;
5377 }
5378
5379 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5380 {
5381 tANI_U32 val;
5382
5383 // station always talks to the AP
5384 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5385
5386 val = sizeof(tSirMacAddr);
5387 #if 0
5388 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5389 {
5390 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005391 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005392 return eSIR_FAILURE;
5393 }
5394 #endif// TO SUPPORT BT-AMP
5395 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5396
5397 }
5398 else
5399 {
5400 tANI_U16 assocId;
5401 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5402
5403 assocId = pDeltsReq->aid;
5404 if (assocId != 0)
5405 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5406 else
5407 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5408
5409 if (pSta != NULL)
5410 // TBD: check sta assoc state as well
5411 for (i =0; i < sizeof(tSirMacAddr); i++)
5412 macaddr[i] = pSta->staAddr[i];
5413 }
5414
5415 if (pSta == NULL)
5416 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005417 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 return eSIR_FAILURE;
5419 }
5420
5421 if ((! pSta->valid) ||
5422 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5423 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005424 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005425 return eSIR_FAILURE;
5426 }
5427
5428 pDeltsReq->req.wsmTspecPresent = 0;
5429 pDeltsReq->req.wmeTspecPresent = 0;
5430 pDeltsReq->req.lleTspecPresent = 0;
5431
5432 if ((pSta->wsmEnabled) &&
5433 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5434 pDeltsReq->req.wsmTspecPresent = 1;
5435 else if (pSta->wmeEnabled)
5436 pDeltsReq->req.wmeTspecPresent = 1;
5437 else if (pSta->lleEnabled)
5438 pDeltsReq->req.lleTspecPresent = 1;
5439 else
5440 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005441 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005442 return eSIR_FAILURE;
5443 }
5444
5445 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5446 : &pDeltsReq->req.tsinfo;
5447 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005448 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005449 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5450 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5451
5452 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005453
5454 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5455 != eSIR_SUCCESS)
5456 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005457 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005458 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5459 return eSIR_FAILURE;
5460 }
5461 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5462 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5463 {
5464 //edca only now.
5465 }
5466 else
5467 {
5468 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5469 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5470 {
5471 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305472 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5473 pSta->staIndex,
5474 tspecIdx,
5475 pDeltsReq->req,
5476 psessionEntry->peSessionId,
5477 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005478 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005479 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 tsinfo->traffic.userPrio);
5481 return eSIR_FAILURE;
5482 }
5483 }
5484 }
5485 return eSIR_SUCCESS;
5486}
5487
5488/** -------------------------------------------------------------
5489\fn limRegisterHalIndCallBack
5490\brief registers callback function to HAL for any indication.
5491\param tpAniSirGlobal pMac
5492\return none.
5493 -------------------------------------------------------------*/
5494void
5495limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5496{
5497 tSirMsgQ msg;
5498 tpHalIndCB pHalCB;
5499
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305500 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5501 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305503 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005504 return;
5505 }
5506
5507 pHalCB->pHalIndCB = limProcessHalIndMessages;
5508
5509 msg.type = WDA_REGISTER_PE_CALLBACK;
5510 msg.bodyptr = pHalCB;
5511 msg.bodyval = 0;
5512
Jeff Johnsone7245742012-09-05 17:12:55 -07005513 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005514 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5515 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305516 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005517 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 }
5519
5520 return;
5521}
5522
5523
5524/** -------------------------------------------------------------
5525\fn limProcessAddBaInd
5526
5527\brief handles the BA activity check timeout indication coming from HAL.
5528 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5529\param tpAniSirGlobal pMac
5530\param tSirMsgQ limMsg
5531\return None
5532-------------------------------------------------------------*/
5533void
5534limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5535{
5536 tANI_U8 i;
5537 tANI_U8 tid;
5538 tANI_U16 assocId;
5539 tpDphHashNode pSta;
5540 tpAddBaCandidate pBaCandidate;
5541 tANI_U32 baCandidateCnt;
5542 tpBaActivityInd pBaActivityInd;
5543 tpPESession psessionEntry;
5544 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005545#ifdef FEATURE_WLAN_TDLS
5546 boolean htCapable = FALSE;
5547#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005548
5549
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005550 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005551 return;
5552
5553 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5554 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5555
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005556 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005557 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005558 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305559 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005560 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005561 return;
5562 }
5563
5564 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005565#ifdef FEATURE_WLAN_TDLS
5566 if ((baCandidateCnt > pMac->lim.maxStation))
5567#else
5568 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5569#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005570 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305571 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005572 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005573 return;
5574 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005575
5576#ifdef FEATURE_WLAN_TDLS
5577 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5578 //AP capability
5579 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5580
5581 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5582 {
5583 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5584 if ((NULL == pSta) || (!pSta->valid))
5585 continue;
5586
5587 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5588 htCapable = pSta->mlmStaContext.htCapability;
5589 else
5590 htCapable = psessionEntry->htCapability;
5591
5592 if (htCapable)
5593 break;
5594 }
5595 if (!htCapable)
5596 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305597 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005598 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005599 return;
5600 }
5601#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005602
5603 //delete the complete dialoguetoken linked list
5604 limDeleteDialogueTokenList(pMac);
5605 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5606
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005607 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005608 {
5609 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005610 if ((NULL == pSta) || (!pSta->valid))
5611 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005612
5613 for (tid=0; tid<STACFG_MAX_TC; tid++)
5614 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005615 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 (pBaCandidate->baInfo[tid].fBaEnable))
5617 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005618 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5619 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005620 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5621 }
5622 }
5623 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305624 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005625 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005626 return;
5627}
5628
5629
5630/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005631\fn limDeleteBASessions
5632\brief Deletes all the exisitng BA sessions for given session
5633 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005634\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005635\param tpPESession pSessionEntry
5636\param tANI_U32 baDirection
5637\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005638-------------------------------------------------------------*/
5639
5640void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005641limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305642 tANI_U32 baDirection, tSirMacReasonCodes baReasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005643{
5644 tANI_U32 i;
5645 tANI_U8 tid;
5646 tpDphHashNode pSta;
5647
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005648 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005649 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005650 limLog(pMac, LOGE, FL("Session does not exist"));
5651 }
5652 else
5653 {
5654 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005655 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005656 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5657 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5658 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5659 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005661 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005662 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005663 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5664 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005665 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005666 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5667 (baDirection & BA_INITIATOR))
5668 {
5669 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305670 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005671 pSessionEntry);
5672 }
5673 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5674 (baDirection & BA_RECIPIENT))
5675 {
5676 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305677 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005678 pSessionEntry);
5679 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005680 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005681 }
5682 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005683 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5684 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5685 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005686 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005687 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5688 &pSessionEntry->dph.dphHashTable);
5689 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005690 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005691 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5692 (baDirection & BA_INITIATOR))
5693 {
5694 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305695 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005696 pSessionEntry);
5697 }
5698 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5699 (baDirection & BA_RECIPIENT))
5700 {
5701 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305702 baReasonCode,
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005703 pSessionEntry);
5704 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005705 }
5706 }
5707 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005708 }
5709}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005710
5711/** -------------------------------------------------------------
5712\fn limDelAllBASessions
5713\brief Deletes all the exisitng BA sessions.
5714\param tpAniSirGlobal pMac
5715\return None
5716-------------------------------------------------------------*/
5717
5718void limDelAllBASessions(tpAniSirGlobal pMac)
5719{
5720 tANI_U32 i;
5721 tpPESession pSessionEntry;
5722
5723 for (i = 0; i < pMac->lim.maxBssId; i++)
5724 {
5725 pSessionEntry = peFindSessionBySessionId(pMac, i);
5726 if (pSessionEntry)
5727 {
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305728 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
5729 eSIR_MAC_UNSPEC_FAILURE_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005730 }
5731 }
5732}
5733
5734/** -------------------------------------------------------------
5735\fn limDelAllBASessionsBtc
5736\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5737 band.
5738\param tpAniSirGlobal pMac
5739\return None
5740-------------------------------------------------------------*/
5741
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005742void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005743{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005744 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005745 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005746 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5747 &sessionId);
5748 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005750 PELOGW(limLog(pMac, LOGW,
5751 "Deleting the BA for session %d as host got BTC event", sessionId);)
c_hpothu3ba2a512014-08-06 14:02:54 +05305752 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS,
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05305753 eSIR_MAC_PEER_TIMEDOUT_REASON);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005754 }
5755}
5756
Jeff Johnson295189b2012-06-20 16:38:30 -07005757/** -------------------------------------------------------------
5758\fn limProcessDelTsInd
5759\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5760 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5761\param tpAniSirGlobal pMac
5762\param tSirMsgQ limMsg
5763\return None
5764-------------------------------------------------------------*/
5765void
5766limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5767{
5768 tpDphHashNode pSta;
5769 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5770 tpSirDeltsReq pDelTsReq = NULL;
5771 tSirMacAddr peerMacAddr;
5772 tpSirDeltsReqInfo pDelTsReqInfo;
5773 tpLimTspecInfo pTspecInfo;
5774 tpPESession psessionEntry;
5775 tANI_U8 sessionId;
5776
5777if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5778 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005779 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305780 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005781 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005782 return;
5783 }
5784
5785 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5786 if(pTspecInfo->inuse == false)
5787 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005788 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 goto error1;
5790 }
5791
5792 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5793 if(pSta == NULL)
5794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005795 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005796 pTspecInfo->assocId);
5797 goto error1;
5798 }
5799
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305800 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5801 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005802 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305803 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005804 goto error1;
5805 }
5806
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305807 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005808
5809 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305812 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005813
5814
5815 //validate the req
5816 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5817 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005818 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 goto error2;
5820 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005821 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5822 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5823 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005824
5825 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5826 psessionEntry);
5827
5828 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305829 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5830 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005831 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005833 goto error3;
5834 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305835 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005836
5837 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305838 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005839 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305840 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005841
5842 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5843
5844error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305845 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005846error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305847 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005848error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305849 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005850 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005851 return;
5852}
5853
5854/**
5855 * \brief Setup an A-MPDU/BA session
5856 *
5857 * \sa limPostMlmAddBAReq
5858 *
5859 * \param pMac The global tpAniSirGlobal object
5860 *
5861 * \param pStaDs DPH Hash Node object of peer STA
5862 *
5863 * \param tid TID for which a BA is being setup.
5864 * If this is set to 0xFFFF, then we retrieve
5865 * the default TID from the CFG
5866 *
5867 * \return eSIR_SUCCESS if setup completes successfully
5868 * eSIR_FAILURE is some problem is encountered
5869 */
5870tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5871 tpDphHashNode pStaDs,
5872 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5873{
5874 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005875 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 tpDialogueToken dialogueTokenNode;
5877 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005878
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 // Check if the peer is a 11n capable STA
5880 // FIXME - Need a 11n peer indication in DPH.
5881 // For now, using the taurusPeer attribute
5882 //if( 0 == pStaDs->taurusPeer == )
5883 //return eSIR_SUCCESS;
5884
5885 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305886 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5887 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005888 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005890 status = eSIR_MEM_ALLOC_FAILED;
5891 goto returnFailure;
5892 }
5893
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305894 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005895
5896 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305897 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005898 pMlmAddBAReq->peerMacAddr,
5899 pStaDs->staAddr,
5900 sizeof( tSirMacAddr ));
5901
5902 // Update the TID
5903 pMlmAddBAReq->baTID = tid;
5904
5905 // Determine the supported BA policy of local STA
5906 // for the TID of interest
5907 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5908
5909 // BA Buffer Size
5910 // Requesting the ADDBA recipient to populate the size.
5911 // If ADDBA is accepted, a non-zero buffer size should
5912 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305913 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5914 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5915 {
5916 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5917 causing very low throughput in HT40 case */
5918 limLog( pMac, LOGW,
5919 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5920 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5921 }
5922 else
5923 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005924
5925 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005926 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005927 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5928 pStaDs->staIndex,
5929 tid );
5930
5931 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005932 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005934 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005935 status = eSIR_FAILURE;
5936 goto returnFailure;
5937 }
5938 pMlmAddBAReq->baTimeout = val; // In TU's
5939
5940 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005941 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5943 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5944
5945 // BA Starting Sequence Number
5946 pMlmAddBAReq->baSSN = startingSeqNum;
5947
5948 /* Update PE session Id*/
5949 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5950
5951 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5952
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005953 dialogueTokenNode = limAssignDialogueToken(pMac);
5954 if (NULL == dialogueTokenNode)
5955 {
5956 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5957 status = eSIR_FAILURE;
5958 goto returnFailure;
5959 }
5960
Jeff Johnson295189b2012-06-20 16:38:30 -07005961 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005962 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 dialogueTokenNode->assocId = pStaDs->assocId;
5964 dialogueTokenNode->tid = tid;
5965 // Send ADDBA Req to MLME
5966 limPostMlmMessage( pMac,
5967 LIM_MLM_ADDBA_REQ,
5968 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005969 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005970
5971returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305972 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 return status;
5974}
5975
5976/**
5977 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5978 * will then send an ADDBA Rsp to peer MAC entity
5979 * with the appropriate ADDBA status code
5980 *
5981 * \sa limPostMlmAddBARsp
5982 *
5983 * \param pMac The global tpAniSirGlobal object
5984 *
5985 * \param peerMacAddr MAC address of peer entity that will
5986 * be the recipient of this ADDBA Rsp
5987 *
5988 * \param baStatusCode ADDBA Rsp status code
5989 *
5990 * \param baDialogToken ADDBA Rsp dialog token
5991 *
5992 * \param baTID TID of interest
5993 *
5994 * \param baPolicy The BA policy
5995 *
5996 * \param baBufferSize The BA buffer size
5997 *
5998 * \param baTimeout BA timeout in TU's
5999 *
6000 * \return eSIR_SUCCESS if setup completes successfully
6001 * eSIR_FAILURE is some problem is encountered
6002 */
6003tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6004 tSirMacAddr peerMacAddr,
6005 tSirMacStatusCodes baStatusCode,
6006 tANI_U8 baDialogToken,
6007 tANI_U8 baTID,
6008 tANI_U8 baPolicy,
6009 tANI_U16 baBufferSize,
6010 tANI_U16 baTimeout,
6011 tpPESession psessionEntry)
6012{
6013tSirRetStatus status = eSIR_SUCCESS;
6014tpLimMlmAddBARsp pMlmAddBARsp;
6015
6016 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306017 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6018 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 {
6020 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306021 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 status );
6023
6024 status = eSIR_MEM_ALLOC_FAILED;
6025 goto returnFailure;
6026 }
6027
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306028 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006029
6030 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306031 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006032 pMlmAddBARsp->peerMacAddr,
6033 peerMacAddr,
6034 sizeof( tSirMacAddr ));
6035
6036 pMlmAddBARsp->baDialogToken = baDialogToken;
6037 pMlmAddBARsp->addBAResultCode = baStatusCode;
6038 pMlmAddBARsp->baTID = baTID;
6039 pMlmAddBARsp->baPolicy = baPolicy;
6040 pMlmAddBARsp->baBufferSize = baBufferSize;
6041 pMlmAddBARsp->baTimeout = baTimeout;
6042
6043 /* UPdate PE session ID*/
6044 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6045
6046 // Send ADDBA Rsp to MLME
6047 limPostMlmMessage( pMac,
6048 LIM_MLM_ADDBA_RSP,
6049 (tANI_U32 *) pMlmAddBARsp );
6050
6051returnFailure:
6052
6053 return status;
6054}
6055
6056/**
6057 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6058 * will then send an DELBA Ind to peer MAC entity
6059 * with the appropriate DELBA status code
6060 *
6061 * \sa limPostMlmDelBAReq
6062 *
6063 * \param pMac The global tpAniSirGlobal object
6064 *
6065 * \param pSta DPH Hash Node object of peer MAC entity
6066 * for which the BA session is being deleted
6067 *
6068 * \param baDirection DELBA direction
6069 *
6070 * \param baTID TID for which the BA session is being deleted
6071 *
6072 * \param baReasonCode DELBA Req reason code
6073 *
6074 * \return eSIR_SUCCESS if setup completes successfully
6075 * eSIR_FAILURE is some problem is encountered
6076 */
6077tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6078 tpDphHashNode pSta,
6079 tANI_U8 baDirection,
6080 tANI_U8 baTID,
6081 tSirMacReasonCodes baReasonCode,
6082 tpPESession psessionEntry)
6083{
6084tSirRetStatus status = eSIR_SUCCESS;
6085tpLimMlmDelBAReq pMlmDelBAReq;
6086tLimBAState curBaState;
6087
6088if(NULL == pSta)
6089 return eSIR_FAILURE;
6090
6091LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6092
6093 // Need to validate the current BA State.
6094 if( eLIM_BA_STATE_IDLE != curBaState)
6095 {
6096 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006097 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006098 baTID,
6099 curBaState);
6100
6101 status = eSIR_FAILURE;
6102 goto returnFailure;
6103 }
6104
6105 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306106 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6107 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006108 {
6109 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306110 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006111 status );
6112
6113 status = eSIR_MEM_ALLOC_FAILED;
6114 goto returnFailure;
6115 }
6116
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306117 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006118
6119 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 pMlmDelBAReq->peerMacAddr,
6122 pSta->staAddr,
6123 sizeof( tSirMacAddr ));
6124
6125 pMlmDelBAReq->baDirection = baDirection;
6126 pMlmDelBAReq->baTID = baTID;
6127 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6128
6129 /* Update PE session ID*/
6130 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6131
6132 //we don't have valid BA session for the given direction.
6133 // HDD wants to get the BA session deleted on PEER in this case.
6134 // in this case we just need to send DelBA to the peer.
6135 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6136 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6137 {
6138 // Send DELBA Ind over the air
6139 if( eSIR_SUCCESS !=
6140 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6141 status = eSIR_FAILURE;
6142
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306143 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006144 return status;
6145 }
6146
6147
6148 // Update the BA state in STA
6149 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6150
6151 // Send DELBA Req to MLME
6152 limPostMlmMessage( pMac,
6153 LIM_MLM_DELBA_REQ,
6154 (tANI_U32 *) pMlmDelBAReq );
6155
6156returnFailure:
6157
6158 return status;
6159}
6160
6161/**
6162 * \brief Send WDA_ADDBA_REQ to HAL, in order
6163 * to setup a new BA session with a peer
6164 *
6165 * \sa limPostMsgAddBAReq
6166 *
6167 * \param pMac The global tpAniSirGlobal object
6168 *
6169 * \param pSta Runtime, STA-related configuration cached
6170 * in the HashNode object
6171 *
6172 * \param baDialogToken The Action Frame dialog token
6173 *
6174 * \param baTID TID for which the BA session is being setup
6175 *
6176 * \param baPolicy BA Policy
6177 *
6178 * \param baBufferSize The requested BA buffer size
6179 *
6180 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6181 *
6182 * \param baSSN Starting Sequence Number for this BA session
6183 *
6184 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6185 *
6186 * \return none
6187 *
6188 */
6189tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6190 tpDphHashNode pSta,
6191 tANI_U8 baDialogToken,
6192 tANI_U8 baTID,
6193 tANI_U8 baPolicy,
6194 tANI_U16 baBufferSize,
6195 tANI_U16 baTimeout,
6196 tANI_U16 baSSN,
6197 tANI_U8 baDirection,
6198 tpPESession psessionEntry)
6199{
6200tpAddBAParams pAddBAParams = NULL;
6201tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006202tSirMsgQ msgQ;
6203
6204#ifdef WLAN_SOFTAP_VSTA_FEATURE
6205 // we can only do BA on "hard" STAs
6206 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6207 {
6208 retCode = eHAL_STATUS_FAILURE;
6209 goto returnFailure;
6210 }
6211#endif //WLAN_SOFTAP_VSTA_FEATURE
6212
6213 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306214 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6215 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006216 {
6217 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306218 FL("AllocateMemory failed")
6219 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006220
6221 retCode = eSIR_MEM_ALLOC_FAILED;
6222 goto returnFailure;
6223 }
6224
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306225 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006226
6227 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306228 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006229 (void *) pAddBAParams->peerMacAddr,
6230 (void *) pSta->staAddr,
6231 sizeof( tSirMacAddr ));
6232
6233 // Populate the REQ parameters
6234 pAddBAParams->staIdx = pSta->staIndex;
6235 pAddBAParams->baDialogToken = baDialogToken;
6236 pAddBAParams->baTID = baTID;
6237 pAddBAParams->baPolicy = baPolicy;
6238 pAddBAParams->baBufferSize = baBufferSize;
6239 pAddBAParams->baTimeout = baTimeout;
6240 pAddBAParams->baSSN = baSSN;
6241 pAddBAParams->baDirection = baDirection;
6242 pAddBAParams->respReqd = 1;
6243
6244 /* UPdate PE session ID */
6245 pAddBAParams->sessionId = psessionEntry->peSessionId;
6246
6247 // Post WDA_ADDBA_REQ to HAL.
6248 msgQ.type = WDA_ADDBA_REQ;
6249 //
6250 // FIXME_AMPDU
6251 // A global counter (dialog token) is required to keep track of
6252 // all PE <-> HAL communication(s)
6253 //
6254 msgQ.reserved = 0;
6255 msgQ.bodyptr = pAddBAParams;
6256 msgQ.bodyval = 0;
6257
6258 limLog( pMac, LOGW,
Kaushik, Sushant335328c2014-07-31 19:15:31 +05306259 FL( "Sending WDA_ADDBA_REQ... Buff size = %d , staId = %d , timeout = %d "
6260 "Tid = %d, Direction = %d , Policy = %d, sessionId = %d , baSSN = %d " ),
6261 pAddBAParams->baBufferSize, pAddBAParams->staIdx,
6262 pAddBAParams->baTimeout, pAddBAParams->baTID,
6263 pAddBAParams->baDirection, pAddBAParams->baPolicy,
6264 pAddBAParams->sessionId, pAddBAParams->baSSN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006265
6266 //defer any other message until we get response back.
6267 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6268
Jeff Johnsone7245742012-09-05 17:12:55 -07006269 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006270#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6271 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6272#endif //FEATURE_WLAN_DIAG_SUPPORT
6273
6274 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6275 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006276 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006277 retCode );
6278 else
6279 return retCode;
6280
6281returnFailure:
6282
6283 // Clean-up...
6284 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306285 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006286
6287 return retCode;
6288
6289}
6290
6291/**
6292 * \brief Send WDA_DELBA_IND to HAL, in order
6293 * to delete an existing BA session with peer
6294 *
6295 * \sa limPostMsgDelBAInd
6296 *
6297 * \param pMac The global tpAniSirGlobal object
6298 *
6299 * \param pSta Runtime, STA-related configuration cached
6300 * in the HashNode object
6301 *
6302 * \param baTID TID for which the BA session is being setup
6303 *
6304 * \param baDirection Identifies whether the DELBA Ind was
6305 * sent by the BA initiator or recipient
6306 *
6307 * \return none
6308 *
6309 */
6310tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6311 tpDphHashNode pSta,
6312 tANI_U8 baTID,
6313 tANI_U8 baDirection,
6314 tpPESession psessionEntry)
6315{
6316tpDelBAParams pDelBAParams = NULL;
6317tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006318tSirMsgQ msgQ;
6319
6320 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306321 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6322 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006323 {
6324 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306325 FL("AllocateMemory failed")
6326 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006327
6328 retCode = eSIR_MEM_ALLOC_FAILED;
6329 goto returnFailure;
6330 }
6331
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306332 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006333
6334 // Populate the REQ parameters
6335 pDelBAParams->staIdx = pSta->staIndex;
6336 pDelBAParams->baTID = baTID;
6337 pDelBAParams->baDirection = baDirection;
6338
6339 /* Update PE session ID */
6340
6341
6342 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6343 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6344
6345 // Post WDA_DELBA_IND to HAL.
6346 msgQ.type = WDA_DELBA_IND;
6347 //
6348 // FIXME:
6349 // A global counter (dialog token) is required to keep track of
6350 // all PE <-> HAL communication(s)
6351 //
6352 msgQ.reserved = 0;
6353 msgQ.bodyptr = pDelBAParams;
6354 msgQ.bodyval = 0;
6355
6356 limLog( pMac, LOGW,
6357 FL( "Sending SIR_HAL_DELBA_IND..." ));
6358
Jeff Johnsone7245742012-09-05 17:12:55 -07006359 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006360#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6361 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6362#endif //FEATURE_WLAN_DIAG_SUPPORT
6363
6364 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6365 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006366 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006367 retCode );
6368 else
6369 {
6370 // Update LIM's internal cache...
6371 if( eBA_INITIATOR == baDirection)
6372 {
6373 pSta->tcCfg[baTID].fUseBATx = 0;
6374 pSta->tcCfg[baTID].txBufSize = 0;
6375 }
6376 else
6377 {
6378 pSta->tcCfg[baTID].fUseBARx = 0;
6379 pSta->tcCfg[baTID].rxBufSize = 0;
6380 }
6381
6382 return retCode;
6383 }
6384
6385returnFailure:
6386
6387 // Clean-up...
6388 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306389 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006390
6391 return retCode;
6392
6393}
6394
6395/**
6396 * @function : limPostSMStateUpdate()
6397 *
6398 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6399 *
6400 * LOGIC:
6401 *
6402 * ASSUMPTIONS:
6403 * NA
6404 *
6405 * NOTE:
6406 * NA
6407 *
6408 * @param pMac - Pointer to Global MAC structure
6409 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6410 * @return None
6411 */
6412tSirRetStatus
6413limPostSMStateUpdate(tpAniSirGlobal pMac,
6414 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6415{
6416 tSirRetStatus retCode = eSIR_SUCCESS;
6417 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006418 tpSetMIMOPS pMIMO_PSParams;
6419
6420 msgQ.reserved = 0;
6421 msgQ.type = WDA_SET_MIMOPS_REQ;
6422
6423 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306424 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6425 if ( NULL == pMIMO_PSParams )
6426 {
6427 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006428 return eSIR_MEM_ALLOC_FAILED;
6429 }
6430
6431 pMIMO_PSParams->htMIMOPSState = state;
6432 pMIMO_PSParams->staIdx = staIdx;
6433 pMIMO_PSParams->fsendRsp = true;
6434 msgQ.bodyptr = pMIMO_PSParams;
6435 msgQ.bodyval = 0;
6436
6437 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6438
Jeff Johnsone7245742012-09-05 17:12:55 -07006439 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006440 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6441 if (eSIR_SUCCESS != retCode)
6442 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006443 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306444 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006445 return retCode;
6446 }
6447
6448 return retCode;
6449}
6450
6451void limPktFree (
6452 tpAniSirGlobal pMac,
6453 eFrameType frmType,
6454 tANI_U8 *pRxPacketInfo,
6455 void *pBody)
6456{
6457 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006458}
6459
6460/**
6461 * limGetBDfromRxPacket()
6462 *
6463 *FUNCTION:
6464 * This function is called to get pointer to Polaris
6465 * Buffer Descriptor containing MAC header & other control
6466 * info from the body of the message posted to LIM.
6467 *
6468 *LOGIC:
6469 * NA
6470 *
6471 *ASSUMPTIONS:
6472 * NA
6473 *
6474 *NOTE:
6475 * NA
6476 *
6477 * @param body - Received message body
6478 * @param pRxPacketInfo - Pointer to received BD
6479 * @return None
6480 */
6481
6482void
6483limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6484{
Jeff Johnson295189b2012-06-20 16:38:30 -07006485 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006486} /*** end limGetBDfromRxPacket() ***/
6487
6488
6489
6490
6491
6492void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6493{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306494 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006495}
6496
6497
6498void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6499{
6500 tANI_U8 i;
6501 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6502
6503 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6504 {
6505 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6506 {
6507 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6508 fFound = eANI_BOOLEAN_TRUE;
6509 break;
6510 }
6511 }
6512 if(eANI_BOOLEAN_FALSE == fFound)
6513 {
6514 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6515 {
6516 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6517 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6518 }
6519 else
6520 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006521 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006522 }
6523 }
6524}
6525
6526
6527/**
6528 * @function : limIsChannelValidForChannelSwitch()
6529 *
6530 * @brief : This function checks if the channel to which AP
6531 * is expecting us to switch, is a valid channel for us.
6532 * LOGIC:
6533 *
6534 * ASSUMPTIONS:
6535 * NA
6536 *
6537 * NOTE:
6538 * NA
6539 *
6540 * @param pMac - Pointer to Global MAC structure
6541 * @param channel - New channel to which we are expected to move
6542 * @return None
6543 */
6544tAniBool
6545limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6546{
6547 tANI_U8 index;
6548 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6549 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6550
6551 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6552 (tANI_U8 *)validChannelList,
6553 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6554 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006555 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006556 return (eSIR_FALSE);
6557 }
6558
6559 for(index = 0; index < validChannelListLen; index++)
6560 {
6561 if(validChannelList[index] == channel)
6562 return (eSIR_TRUE);
6563 }
6564
6565 /* channel does not belong to list of valid channels */
6566 return (eSIR_FALSE);
6567}
6568
6569/**------------------------------------------------------
6570\fn __limFillTxControlParams
6571\brief Fill the message for stopping/resuming tx.
6572
6573\param pMac
6574\param pTxCtrlMsg - Pointer to tx control message.
6575\param type - Which way we want to stop/ resume tx.
6576\param mode - To stop/resume.
6577 -------------------------------------------------------*/
6578static eHalStatus
6579__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6580 tLimQuietTxMode type, tLimControlTx mode)
6581{
6582
6583 //TBD-RAJESH HOW TO GET sessionEntry?????
6584 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6585
6586 if (mode == eLIM_STOP_TX)
6587 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6588 else
6589 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6590
6591 switch (type)
6592 {
6593 case eLIM_TX_ALL:
6594 /** Stops/resumes transmission completely */
6595 pTxCtrlMsg->fCtrlGlobal = 1;
6596 break;
6597
6598 case eLIM_TX_BSS_BUT_BEACON:
6599 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6600 * stop beacon transmission.
6601 */
6602 pTxCtrlMsg->ctrlBss = 1;
6603 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6604 break;
6605
6606 case eLIM_TX_STA:
6607 /** Memory for station bitmap is allocated dynamically in caller of this
6608 * so decode properly here and fill the bitmap. Now not implemented,
6609 * fall through.
6610 */
6611 case eLIM_TX_BSS:
6612 //Fall thru...
6613 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006614 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006615 return eHAL_STATUS_FAILURE;
6616 }
6617
6618 return eHAL_STATUS_SUCCESS;
6619}
6620
6621/**
6622 * @function : limFrameTransmissionControl()
6623 *
6624 * @brief : This API is called by the user to halt/resume any frame
6625 * transmission from the device. If stopped, all frames will be
6626 * queued starting from hardware. Then back-pressure
6627 * is built till the driver.
6628 * LOGIC:
6629 *
6630 * ASSUMPTIONS:
6631 * NA
6632 *
6633 * NOTE:
6634 * NA
6635 *
6636 * @param pMac - Pointer to Global MAC structure
6637 * @return None
6638 */
6639void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6640{
6641
6642 eHalStatus status = eHAL_STATUS_FAILURE;
6643 tpTxControlParams pTxCtrlMsg;
6644 tSirMsgQ msgQ;
6645 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6646
6647 /** Allocate only required number of bytes for station bitmap
6648 * Make it to align to 4 byte boundary */
6649 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6650
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306651 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6652 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006653 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306654 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 return;
6656 }
6657
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306658 vos_mem_set((void *) pTxCtrlMsg,
6659 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6661 if (status != eHAL_STATUS_SUCCESS)
6662 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306663 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006664 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006665 return;
6666 }
6667
6668 msgQ.bodyptr = (void *) pTxCtrlMsg;
6669 msgQ.bodyval = 0;
6670 msgQ.reserved = 0;
6671 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6672
Jeff Johnsone7245742012-09-05 17:12:55 -07006673 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006674 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6675 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306676 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006677 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 return;
6679 }
6680
6681 if (mode == eLIM_STOP_TX)
6682 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006683 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006684 }
6685 else
6686 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006687 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006688 }
6689 return;
6690}
6691
6692
6693/**
6694 * @function : limRestorePreChannelSwitchState()
6695 *
6696 * @brief : This API is called by the user to undo any
6697 * specific changes done on the device during
6698 * channel switch.
6699 * LOGIC:
6700 *
6701 * ASSUMPTIONS:
6702 * NA
6703 *
6704 * NOTE:
6705 * NA
6706 *
6707 * @param pMac - Pointer to Global MAC structure
6708 * @return None
6709 */
6710
6711tSirRetStatus
6712limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6713{
6714
6715 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006716 tANI_U32 val = 0;
6717
6718 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6719 return retCode;
6720
6721 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006722 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006723
6724 /* Restore the frame transmission, all the time. */
6725 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6726
6727 /* Free to enter BMPS */
6728 limSendSmePostChannelSwitchInd(pMac);
6729
6730 //Background scan is now enabled by SME
6731 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6732 {
6733 /* Enable background scan if already enabled, else don't bother */
6734 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6735 &val)) != eSIR_SUCCESS)
6736
6737 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006738 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 return (retCode);
6740 }
6741
6742 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6743 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006744 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6745 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006746 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6747 {
6748 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6749 return (eSIR_FAILURE);
6750 }
6751
6752 }
6753 }
6754
6755 /* Enable heartbeat timer */
6756 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6757 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006758 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6759 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6760 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6761 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006762 {
6763 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6764 return (eSIR_FAILURE);
6765 }
6766 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006767 return (retCode);
6768}
6769
6770
6771/**--------------------------------------------
6772\fn limRestorePreQuietState
6773\brief Restore the pre quiet state
6774
6775\param pMac
6776\return NONE
6777---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006778tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006779{
6780
6781 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 tANI_U32 val = 0;
6783
6784 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6785 return retCode;
6786
6787 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006788 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006789
6790 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006791 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006792 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6793
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 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006809 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006810 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6811 {
6812 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6813 return (eSIR_FAILURE);
6814 }
6815
6816 }
6817 }
6818
6819 /* Enable heartbeat timer */
6820 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6821 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006822 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006823 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006824 {
6825 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6826 return (eSIR_FAILURE);
6827 }
6828 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006829 return (retCode);
6830}
6831
6832
6833/**
6834 * @function: limPrepareFor11hChannelSwitch()
6835 *
6836 * @brief : This API is called by the user to prepare for
6837 * 11h channel switch. As of now, the API does
6838 * very minimal work. User can add more into the
6839 * same API if needed.
6840 * LOGIC:
6841 *
6842 * ASSUMPTIONS:
6843 * NA
6844 *
6845 * NOTE:
6846 * NA
6847 *
6848 * @param pMac - Pointer to Global MAC structure
6849 * @param psessionEntry
6850 * @return None
6851 */
6852void
6853limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6854{
Jeff Johnson295189b2012-06-20 16:38:30 -07006855 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6856 return;
6857
6858 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006859 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006860
6861 /* Disable, Stop background scan if enabled and running */
6862 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6863
6864 /* Stop heart-beat timer to stop heartbeat disassociation */
6865 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6866
6867 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6868 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6869 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006870 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006871 /* Stop ongoing scanning if any */
6872 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6873 {
6874 //Set the resume channel to Any valid channel (invalid).
6875 //This will instruct HAL to set it to any previous valid channel.
6876 peSetResumeChannel(pMac, 0, 0);
6877 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6878 }
6879 else
6880 {
6881 limRestorePreChannelSwitchState(pMac, psessionEntry);
6882 }
6883 return;
6884 }
6885 else
6886 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006887 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006888 /** We are safe to switch channel at this point */
6889 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6890 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006891}
6892
6893
6894
6895/**----------------------------------------------------
6896\fn limGetNwType
6897
6898\brief Get type of the network from data packet or beacon
6899\param pMac
6900\param channelNum - Channel number
6901\param type - Type of packet.
6902\param pBeacon - Pointer to beacon or probe response
6903
6904\return Network type a/b/g.
6905-----------------------------------------------------*/
6906tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6907{
6908 tSirNwType nwType = eSIR_11B_NW_TYPE;
6909
6910 if (type == SIR_MAC_DATA_FRAME)
6911 {
6912 if ((channelNum > 0) && (channelNum < 15))
6913 {
6914 nwType = eSIR_11G_NW_TYPE;
6915 }
6916 else
6917 {
6918 nwType = eSIR_11A_NW_TYPE;
6919 }
6920 }
6921 else
6922 {
6923 if ((channelNum > 0) && (channelNum < 15))
6924 {
6925 int i;
6926 // 11b or 11g packet
6927 // 11g iff extended Rate IE is present or
6928 // if there is an A rate in suppRate IE
6929 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6930 {
6931 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6932 {
6933 nwType = eSIR_11G_NW_TYPE;
6934 break;
6935 }
6936 }
6937 if (pBeacon->extendedRatesPresent)
6938 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006939 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006940 nwType = eSIR_11G_NW_TYPE;
6941 }
6942 }
6943 else
6944 {
6945 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006946 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006947 nwType = eSIR_11A_NW_TYPE;
6948 }
6949 }
6950 return nwType;
6951}
6952
6953
6954/**---------------------------------------------------------
6955\fn limGetChannelFromBeacon
6956\brief To extract channel number from beacon
6957
6958\param pMac
6959\param pBeacon - Pointer to beacon or probe rsp
6960\return channel number
6961-----------------------------------------------------------*/
6962tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6963{
6964 tANI_U8 channelNum = 0;
6965
6966 if (pBeacon->dsParamsPresent)
6967 channelNum = pBeacon->channelNumber;
6968 else if(pBeacon->HTInfo.present)
6969 channelNum = pBeacon->HTInfo.primaryChannel;
6970 else
6971 channelNum = pBeacon->channelNumber;
6972
6973 return channelNum;
6974}
6975
6976
6977/** ---------------------------------------------------------
6978\fn limSetTspecUapsdMask
6979\brief This function sets the PE global variable:
6980\ 1) gUapsdPerAcTriggerEnableMask and
6981\ 2) gUapsdPerAcDeliveryEnableMask
6982\ based on the user priority field and direction field
6983\ in the TS Info Fields.
6984\
6985\ An AC is a trigger-enabled AC if the PSB subfield
6986\ is set to 1 in the uplink direction.
6987\ An AC is a delivery-enabled AC if the PSB subfield
6988\ is set to 1 in the down-link direction.
6989\
6990\param tpAniSirGlobal pMac
6991\param tSirMacTSInfo pTsInfo
6992\param tANI_U32 action
6993\return None
6994 ------------------------------------------------------------*/
6995void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6996{
6997 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6998 tANI_U16 direction = pTsInfo->traffic.direction;
6999 tANI_U8 ac = upToAc(userPrio);
7000
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007001 PELOG1(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 -07007002
7003 /* Converting AC to appropriate Uapsd Bit Mask
7004 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7005 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7006 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7007 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7008 */
7009 ac = ((~ac) & 0x3);
7010
7011 if (action == CLEAR_UAPSD_MASK)
7012 {
7013 if (direction == SIR_MAC_DIRECTION_UPLINK)
7014 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7015 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7016 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7017 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7018 {
7019 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7020 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7021 }
7022 }
7023 else if (action == SET_UAPSD_MASK)
7024 {
7025 if (direction == SIR_MAC_DIRECTION_UPLINK)
7026 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7027 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7028 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7029 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7030 {
7031 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7032 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7033 }
7034 }
7035
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007036 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7037 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007038
7039 return;
7040}
7041
7042
7043
7044void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7045{
7046
7047 tANI_U8 i;
7048 for(i =0;i < pMac->lim.maxBssId;i++)
7049 {
7050 if(pMac->lim.gpSession[i].valid == TRUE )
7051 {
7052 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7053 {
7054 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7055 break;
7056 }
7057
7058 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7059 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7060 {
7061 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7062 }
7063 }
7064 }
7065 for(i=0; i< pMac->lim.maxBssId; i++)
7066 {
7067 if(pMac->lim.gpSession[i].valid == TRUE )
7068 {
7069 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7070 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7071 {
7072 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7073 {
7074 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007075 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007076 i);)
7077 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7078 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7079 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007081 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007082 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7083 }
7084 break;
7085 }
7086 }
7087 }
7088 }
7089}
7090
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007091void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7092{
7093 if(psessionEntry->valid == TRUE )
7094 {
7095 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7096 {
7097 limIbssHeartBeatHandle(pMac,psessionEntry);
7098 }
7099 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7100 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7101 {
7102 limHandleHeartBeatFailure(pMac,psessionEntry);
7103 }
7104 }
7105 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7106 and the other things again */
7107 if(psessionEntry->valid == TRUE )
7108 {
7109 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7110 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7111 {
7112 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7113 {
7114 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7115 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7116 psessionEntry->bssIdx);)
7117 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7118 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7119 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7120 {
7121 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7122 limReactivateHeartBeatTimer(pMac, psessionEntry);
7123 }
7124 }
7125 }
7126 }
7127}
7128
7129
Jeff Johnson295189b2012-06-20 16:38:30 -07007130tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7131{
7132 tANI_U8 i;
7133 for(i =0;i < pMac->lim.maxBssId;i++)
7134 {
7135 if(pMac->lim.gpSession[i].valid == TRUE )
7136 {
7137 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7138 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7139 {
7140 return pMac->lim.gpSession[i].currentOperChannel;
7141 }
7142 }
7143 }
7144 return 0;
7145}
7146
7147void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7148{
7149
7150 tpPESession psessionEntry;
7151// tANI_U8 sessionId;
7152 tpAddStaParams pAddStaParams;
7153
7154 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7155
7156 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7157 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007158 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307159 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007160 return;
7161 }
7162 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7163 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007164#ifdef FEATURE_WLAN_TDLS
7165 else if(pMac->lim.gLimAddStaTdls)
7166 {
7167 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7168 pMac->lim.gLimAddStaTdls = FALSE ;
7169 }
7170#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007171 else
7172 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7173
7174}
7175
7176
7177void limUpdateBeacon(tpAniSirGlobal pMac)
7178{
7179 tANI_U8 i;
7180
7181 for(i =0;i < pMac->lim.maxBssId;i++)
7182 {
7183 if(pMac->lim.gpSession[i].valid == TRUE )
7184 {
7185 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7186 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7187 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7188 )
7189 {
7190 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7191 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7192 }
7193 else
7194 {
7195 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7196 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7197 {
7198
7199 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7200 {
7201 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7202 }
7203 }
7204 }
7205 }
7206 }
7207}
7208
7209void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7210{
7211 tANI_U8 i;
7212 tpPESession psessionEntry;
7213 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7214 for(i =0; i < pMac->lim.maxBssId; i++)
7215 {
7216 if(pMac->lim.gpSession[i].valid == TRUE)
7217 {
7218 psessionEntry = &pMac->lim.gpSession[i];
7219 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7220 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007221 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007222 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007223#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7224 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7225#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007226 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7227 {
Kaushik, Sushant65b19712014-05-13 11:52:24 +05307228 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) &&
7229 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)&&
7230 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007231 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007232 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007233 /* AP did not respond to Probe Request. Tear down link with it.*/
7234 limTearDownLinkWithAp(pMac,
7235 psessionEntry->peSessionId,
7236 eSIR_BEACON_MISSED);
7237 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7238 }
7239 else // restart heartbeat timer
7240 {
7241 limReactivateHeartBeatTimer(pMac, psessionEntry);
7242 }
7243 }
7244 else
7245 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007246 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007247 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7248 limReactivateHeartBeatTimer(pMac, psessionEntry);
7249 }
7250
7251 }
7252 }
7253 }
7254 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7255 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7256}
7257
7258
7259/*
7260* This function assumes there will not be more than one IBSS session active at any time.
7261*/
7262tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7263{
7264 tANI_U8 i;
7265
7266 for(i =0;i < pMac->lim.maxBssId;i++)
7267 {
7268 if( (pMac->lim.gpSession[i].valid) &&
7269 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7270 return (&pMac->lim.gpSession[i]);
7271 }
7272
7273 return NULL;
7274}
7275
7276tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7277{
7278 tANI_U8 i;
7279
7280 for(i =0;i < pMac->lim.maxBssId;i++)
7281 {
7282 if( (pMac->lim.gpSession[i].valid) &&
7283 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7284 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7285 return (&pMac->lim.gpSession[i]);
7286 }
7287
7288 return NULL;
7289}
7290
7291/**---------------------------------------------------------
7292\fn limHandleDeferMsgError
7293\brief handles error scenario, when the msg can not be deferred.
7294\param pMac
7295\param pLimMsg LIM msg, which could not be deferred.
7296\return void
7297-----------------------------------------------------------*/
7298
7299void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7300{
7301 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7302 {
7303 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7304 }
7305 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007306 {
7307 vos_mem_free( pLimMsg->bodyptr);
7308 pLimMsg->bodyptr = NULL;
7309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007310}
7311
7312
7313#ifdef FEATURE_WLAN_DIAG_SUPPORT
7314/**---------------------------------------------------------
7315\fn limDiagEventReport
7316\brief This function reports Diag event
7317\param pMac
7318\param eventType
7319\param bssid
7320\param status
7321\param reasonCode
7322\return void
7323-----------------------------------------------------------*/
7324void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7325{
7326 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7327 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7328
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307329 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007330
7331 if (NULL == pSessionEntry)
7332 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307333 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007334 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7335 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7336
7337 }
7338 else
7339 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307340 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007341 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7342 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7343 }
7344 peEvent.event_type = eventType;
7345 peEvent.status = status;
7346 peEvent.reason_code = reasonCode;
7347
7348 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7349 return;
7350}
7351
7352#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7353
7354void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7355{
7356
7357 tpAddStaSelfParams pAddStaSelfParams;
7358 tSirMsgQ mmhMsg;
7359 tpSirSmeAddStaSelfRsp pRsp;
7360
7361
7362 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7363
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307364 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7365 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007366 {
7367 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307368 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7369 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007370 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007371 return;
7372 }
7373
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307374 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007375
7376 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7377 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7378 pRsp->status = pAddStaSelfParams->status;
7379
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307380 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007381
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307382 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007383 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007384
7385 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7386 mmhMsg.bodyptr = pRsp;
7387 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007388 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007389 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7390
7391}
7392
7393void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7394{
7395
7396 tpDelStaSelfParams pDelStaSelfParams;
7397 tSirMsgQ mmhMsg;
7398 tpSirSmeDelStaSelfRsp pRsp;
7399
7400
7401 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7402
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307403 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7404 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007405 {
7406 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307407 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7408 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007409 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007410 return;
7411 }
7412
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307413 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007414
7415 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7416 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7417 pRsp->status = pDelStaSelfParams->status;
7418
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307419 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007420
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307421 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007422 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007423
7424 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7425 mmhMsg.bodyptr = pRsp;
7426 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007427 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007428 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7429
7430}
7431
7432/***************************************************************
7433* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7434* To unmap the channel to reverse the effect of mapping
7435* a band channel in hal .Mapping was done hal to overcome the
7436* limitation of the rxbd which use only 4 bit for channel number.
7437*****************************************************************/
7438tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7439{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007440#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007441 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007442 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7443 return aUnsortedChannelList[mapChannel -1];
7444 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007445#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007446 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007447#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007448 return abChannel[mapChannel -1];
7449 else
7450 return 0;
7451}
7452
7453
7454v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7455{
7456 int left = length;
7457 v_U8_t *ptr = pIes;
7458 v_U8_t elem_id;
7459 v_U16_t elem_len;
7460
7461 while(left >= (size_of_len_field+1))
7462 {
7463 elem_id = ptr[0];
7464 if (size_of_len_field == TWO_BYTE)
7465 {
7466 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7467 }
7468 else
7469 {
7470 elem_len = ptr[1];
7471 }
7472
7473
7474 left -= (size_of_len_field+1);
7475 if(elem_len > left)
7476 {
7477 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007478 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007479 eid,elem_len,left);
7480 return NULL;
7481 }
7482 if (elem_id == eid)
7483 {
7484 return ptr;
7485 }
7486
7487 left -= elem_len;
7488 ptr += (elem_len + (size_of_len_field+1));
7489 }
7490 return NULL;
7491}
7492
7493/* return NULL if oui is not found in ie
7494 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7495 */
7496v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7497{
7498 int left = ie_len;
7499 v_U8_t *ptr = ie;
7500 v_U8_t elem_id, elem_len;
7501
7502 while(left >= 2)
7503 {
7504 elem_id = ptr[0];
7505 elem_len = ptr[1];
7506 left -= 2;
7507 if(elem_len > left)
7508 {
7509 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007510 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007511 elem_id,elem_len,left);
7512 return NULL;
7513 }
7514 if (SIR_MAC_EID_VENDOR == elem_id)
7515 {
7516 if(memcmp(&ptr[2], oui, oui_size)==0)
7517 return ptr;
7518 }
7519
7520 left -= elem_len;
7521 ptr += (elem_len + 2);
7522 }
7523 return NULL;
7524}
7525
Jeff Johnson295189b2012-06-20 16:38:30 -07007526//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7527
7528v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7529{
7530 int length = 0;
7531 tANI_U8 *ptr = ie;
7532
7533 ptr[length++] = SIR_MAC_EID_VENDOR;
7534 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307535 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7536 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007537 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7538}
7539
7540//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7541
7542v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7543{
7544 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007545
7546 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7547 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7548 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307549 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007550 noaStream + noaLen - overFlowLen, overFlowLen);
7551 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7552 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307553 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007554 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307555 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7556 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007557 }
7558
Jeff Johnson295189b2012-06-20 16:38:30 -07007559 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7560
7561}
7562
7563//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7564v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7565{
7566 v_U8_t len=0;
7567
7568 v_U8_t *pBody = pNoaStream;
7569
7570
7571 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7572 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7573 {
7574 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7575 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7576 )
7577 return 0; //No NoA Descriptor then return 0
7578
7579
7580 pBody[0] = SIR_P2P_NOA_ATTR;
7581
7582 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7583 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7584 len = 5;
7585 pBody += len;
7586
7587
7588 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7589 {
7590 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7591 pBody += 1;
7592 len +=1;
7593
7594 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7595 pBody += sizeof(tANI_U32);
7596 len +=4;
7597
7598 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7599 pBody += sizeof(tANI_U32);
7600 len +=4;
7601
7602 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7603 pBody += sizeof(tANI_U32);
7604 len +=4;
7605
7606 }
7607
7608 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7609 {
7610 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7611 pBody += 1;
7612 len +=1;
7613
7614 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7615 pBody += sizeof(tANI_U32);
7616 len +=4;
7617
7618 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7619 pBody += sizeof(tANI_U32);
7620 len +=4;
7621
7622 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7623 pBody += sizeof(tANI_U32);
7624 len +=4;
7625
7626 }
7627
7628
7629 pBody = pNoaStream + 1;
7630 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7631
7632 return (len);
7633
7634 }
7635 return 0;
7636
7637}
Jeff Johnsone7245742012-09-05 17:12:55 -07007638
7639void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007640{
7641
7642 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007643 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007644}
Jeff Johnsone7245742012-09-05 17:12:55 -07007645
Jeff Johnson295189b2012-06-20 16:38:30 -07007646/*--------------------------------------------------------------------------
7647
7648 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7649
Jeff Johnsone7245742012-09-05 17:12:55 -07007650 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7651 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007652
7653 \param pMac - pointer to global adapter context
7654 \return - channel to scan from valid session else zero.
7655
7656 \sa
7657
7658 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007659void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007660{
7661
7662 //Rationale - this could be the suspend/resume for assoc and it is essential that
7663 //the new BSS is active for some time. Other BSS was anyway suspended.
7664 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7665 //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 -07007666 //and hence should be ok. Need to discuss this further
7667 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007668 {
7669 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007670 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007671 }
7672 else
7673 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007674 *resumeChannel = pMac->lim.gResumeChannel;
7675 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007677 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007678}
7679
Viral Modid86bde22012-12-10 13:09:21 -08007680tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7681{
7682 tANI_U8 i;
7683 for(i =0; i < pMac->lim.maxBssId; i++)
7684 {
7685 if(pMac->lim.gpSession[i].valid == TRUE)
7686 {
7687 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7688 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7689 )
7690 {
7691 return TRUE;
7692 }
7693 }
7694 }
7695 return FALSE;
7696}
Jeff Johnsone7245742012-09-05 17:12:55 -07007697
Jeff Johnson295189b2012-06-20 16:38:30 -07007698
7699tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7700{
7701 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7702 {
7703 return eANI_BOOLEAN_TRUE;
7704 }
7705 else
7706 {
7707 return eANI_BOOLEAN_FALSE;
7708 }
7709}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007710
Sandeep Puligilla60342762014-01-30 21:05:37 +05307711/**
7712 * \brief verify the changes in channel bonding
7713 *
7714 * \param pMac Pointer to the global MAC structure
7715 *
7716 * \param psessionEntry session entry
7717 * beaconSecChanWidth Secondary channel width
7718 * advertized in beacon
7719 * currentSecChanWidth Current configured width
7720 * staId Station Id
7721 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7722 */
7723tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7724 tpPESession psessionEntry,
7725 tANI_U8 beaconSecChanWidth,
7726 tANI_U8 currentSecChanWidth,
7727 tANI_U8 staId)
7728{
7729 tUpdateVHTOpMode tempParam;
7730 tANI_BOOLEAN fCbMode24G = FALSE;
7731 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7732
7733 /* Moving from HT40 to HT20 operation*/
7734 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7735 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7736 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7737 {
7738 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7739 tempParam.staId = staId;
7740 fCbMode24G = TRUE;
7741 }
7742
7743 /* Moving from HT20 to HT40 operation*/
7744 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7745 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7746 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7747 {
7748 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7749 tempParam.staId = staId;
7750 fCbMode24G = TRUE;
7751 }
7752
7753 if (TRUE == fCbMode24G)
7754 {
7755 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7756 "Changing CBMODE to = %d staId = %d",
7757 tempParam.opMode, tempParam.staId );
7758 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7759 status = eANI_BOOLEAN_TRUE;
7760 }
7761 return status;
7762}
7763
Mohit Khanna4a70d262012-09-11 16:30:12 -07007764#ifdef WLAN_FEATURE_11AC
7765tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7766{
7767 tUpdateVHTOpMode tempParam;
7768
7769 tempParam.opMode = chanWidth;
7770 tempParam.staId = staId;
7771
7772 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7773
7774 return eANI_BOOLEAN_TRUE;
7775}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007776#endif
7777
krunal soni45b9eb62014-03-26 12:54:25 -07007778void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry,
7779 tANI_U32 phyMode, tANI_U8 *pShortSlotEnabled)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007780{
7781 tANI_U8 val=0;
7782
krunal soni45b9eb62014-03-26 12:54:25 -07007783 //only 2.4G band should have short slot enable, rest it should be default
7784 if (phyMode == WNI_CFG_PHY_MODE_11G)
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007785 {
krunal soni45b9eb62014-03-26 12:54:25 -07007786 /* short slot is default in all other modes */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007787 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007788 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007789 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7790 {
7791 val = true;
7792 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007793 // Program Polaris based on AP capability
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007794 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007795 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007796 // Joining BSS.
7797 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007798 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007799 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
krunal soni45b9eb62014-03-26 12:54:25 -07007800 {
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007801 // Reassociating with AP.
7802 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
krunal soni45b9eb62014-03-26 12:54:25 -07007803 }
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007804 }
krunal soni45b9eb62014-03-26 12:54:25 -07007805 else
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007806 {
krunal soni45b9eb62014-03-26 12:54:25 -07007807 /*
7808 * 11B does not short slot and short slot is default
7809 * for 11A mode. Hence, not need to set this bit
7810 */
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007811 val = false;
7812 }
krunal soni45b9eb62014-03-26 12:54:25 -07007813
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007814 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
krunal soni45b9eb62014-03-26 12:54:25 -07007815 *pShortSlotEnabled = val;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007816}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307817
Kalikinkar dhara205da782014-03-21 15:49:32 -07007818void limUtilsframeshtons(tpAniSirGlobal pCtx,
7819 tANI_U8 *pOut,
7820 tANI_U16 pIn,
7821 tANI_U8 fMsb)
7822{
7823 (void)pCtx;
7824#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7825 if ( !fMsb )
7826 {
7827 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7828 }
7829 else
7830 {
7831 *pOut = ( pIn & 0xff00 ) >> 8;
7832 *( pOut + 1 ) = pIn & 0xff;
7833 }
7834#else
7835 if ( !fMsb )
7836 {
7837 *pOut = pIn & 0xff;
7838 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7839 }
7840 else
7841 {
7842 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7843 }
7844#endif
7845}
7846
7847void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7848 tANI_U8 *pOut,
7849 tANI_U32 pIn,
7850 tANI_U8 fMsb)
7851{
7852 (void)pCtx;
7853#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7854 if ( !fMsb )
7855 {
7856 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7857 }
7858 else
7859 {
7860 *pOut = ( pIn & 0xff000000 ) >> 24;
7861 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7862 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7863 *( pOut + 3 ) = ( pIn & 0x000000ff );
7864 }
7865#else
7866 if ( !fMsb )
7867 {
7868 *( pOut ) = ( pIn & 0x000000ff );
7869 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7870 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7871 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7872 }
7873 else
7874 {
7875 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7876 }
7877#endif
7878}
7879
7880
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307881/**--------------------------------------------
7882\fn limUpdateOBSSScanParams
7883\brief Updates OBSS SCAN IE parameters to session
7884
7885\param psessionEntry - Session Entry
7886\return NONE
7887---------------------------------------------*/
7888void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7889 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7890{
7891 /*If the recieved value is not in the range specified by the Specification
7892 then it will be the default value configured through cfg */
7893 if (( pOBSSScanParameters->obssScanActiveDwell >
7894 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7895 ( pOBSSScanParameters->obssScanActiveDwell <
7896 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7897 {
7898 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7899 pOBSSScanParameters->obssScanActiveDwell;
7900 }
7901 if((pOBSSScanParameters->obssScanPassiveDwell >
7902 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7903 (pOBSSScanParameters->obssScanPassiveDwell <
7904 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7905 {
7906 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7907 pOBSSScanParameters->obssScanPassiveDwell;
7908 }
7909 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7910 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7911 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7912 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7913 {
7914 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7915 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7916 }
7917 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7918 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7919 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7920 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7921 {
7922 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7923 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7924 }
7925 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7926 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7927 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7928 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7929 {
7930 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7931 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7932 }
7933 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7934 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7935 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7936 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7937 {
7938 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7939 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7940 }
7941 if((pOBSSScanParameters->obssScanActivityThreshold >
7942 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7943 (pOBSSScanParameters->obssScanActivityThreshold <
7944 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7945 {
7946 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7947 pOBSSScanParameters->obssScanActivityThreshold;
7948 }
7949}
Chet Lanctot8cecea22014-02-11 19:09:36 -08007950
7951#ifdef WLAN_FEATURE_11W
7952void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
7953{
7954 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
7955 tPmfSaQueryTimerId timerId;
7956 tpPESession psessionEntry;
7957 tpDphHashNode pSta;
7958 tANI_U32 maxRetries;
7959
7960 limLog(pMac, LOG1, FL("SA Query timer fires"));
7961 timerId.value = param;
7962
7963 // Check that SA Query is in progress
7964 if ((psessionEntry = peFindSessionBySessionId(
7965 pMac, timerId.fields.sessionId)) == NULL)
7966 {
7967 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
7968 timerId.fields.sessionId);
Chet Lanctot8cecea22014-02-11 19:09:36 -08007969 return;
7970 }
7971 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
7972 &psessionEntry->dph.dphHashTable)) == NULL)
7973 {
7974 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
7975 timerId.fields.peerIdx);
Chet Lanctot8cecea22014-02-11 19:09:36 -08007976 return;
7977 }
7978 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
7979 return;
7980
7981 // Increment the retry count, check if reached maximum
7982 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
7983 &maxRetries) != eSIR_SUCCESS)
7984 {
7985 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
7986 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7987 return;
7988 }
7989 pSta->pmfSaQueryRetryCount++;
7990 if (pSta->pmfSaQueryRetryCount >= maxRetries)
7991 {
7992 limLog(pMac, LOG1, FL("SA Query timed out"));
Chet Lanctot8cecea22014-02-11 19:09:36 -08007993 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
7994 return;
7995 }
7996
7997 // Retry SA Query
7998 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
7999 pSta->staAddr, psessionEntry);
8000 pSta->pmfSaQueryCurrentTransId++;
Chet Lanctot8cecea22014-02-11 19:09:36 -08008001 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8002 {
8003 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8004 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8005 }
8006}
8007#endif
8008
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008009/** ---------------------------------------------------------
8010\fn limProcessChannelSwitchSuspendLink
8011\brief This function call channel switch functions based on
8012 the gLimChannelSwitch.state. After function return it
8013 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8014 If gLimChannelSwitch.state is non-identified then
8015 print error log as well as restore back the
8016 pre-channelSwitch.
8017\param tpAniSirGlobal pMac
8018\param eHalStatus status
8019\param tANI_U32 *ctx
8020\return None
8021 ------------------------------------------------------------*/
8022static void
8023limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8024 eHalStatus status,
8025 tANI_U32 *ctx)
8026{
8027 tpPESession pSessionEntry = (tpPESession)ctx;
8028
8029 if ( eHAL_STATUS_SUCCESS != status )
8030 {
8031 limLog(pMac, LOGE,
8032 FL("Suspend link failed. still proceeding "));
8033 }
8034 if (NULL == pSessionEntry )
8035 {
8036 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8037 return;
8038 }
8039
8040 switch(pSessionEntry->gLimChannelSwitch.state)
8041 {
8042 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8043 PELOGW(limLog(pMac, LOGW,
8044 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8045 limSwitchPrimaryChannel(pMac,
8046 pSessionEntry->gLimChannelSwitch.primaryChannel,
8047 pSessionEntry);
8048 pSessionEntry->gLimChannelSwitch.state =
8049 eLIM_CHANNEL_SWITCH_IDLE;
8050 break;
8051
8052 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8053 PELOGW(limLog(pMac, LOGW,
8054 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8055 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8056 pSessionEntry->gLimChannelSwitch.primaryChannel,
8057 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8058 pSessionEntry->gLimChannelSwitch.state =
8059 eLIM_CHANNEL_SWITCH_IDLE;
8060 break;
8061
8062 default:
8063 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8064 pSessionEntry->gLimChannelSwitch.state);)
8065 if (limRestorePreChannelSwitchState(pMac,
8066 pSessionEntry) != eSIR_SUCCESS)
8067 {
8068 limLog(pMac, LOGE,
8069 FL("Could not restore pre-channelSwitch "
8070 "(11h) state, resetting the system"));
8071 }
8072 }
8073}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308074
8075/** ---------------------------------------------------------
8076\fn limInitOBSSScanParams
8077\brief This function Initializes the OBSS Scan Parameters
8078\param tpAniSirGlobal pMac
8079\param tpPESession pSessionEntry
8080\return None
8081 ------------------------------------------------------------*/
8082
8083void limInitOBSSScanParams(tpAniSirGlobal pMac,
8084 tpPESession psessionEntry)
8085{
8086 tANI_U32 cfgValue;
8087
8088 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME,
8089 &cfgValue) != eSIR_SUCCESS)
8090 {
8091 limLog(pMac, LOGE, FL("Fail to retrieve "
8092 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME value"));
8093 return ;
8094 }
8095 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime = cfgValue;
8096
8097 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME,
8098 &cfgValue) != eSIR_SUCCESS)
8099 {
8100 limLog(pMac, LOGE, FL("Fail to retrieve "
8101 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME value"));
8102 return ;
8103 }
8104 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime = cfgValue;
8105
8106 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL,
8107 &cfgValue) != eSIR_SUCCESS)
8108 {
8109 limLog(pMac, LOGE, FL("Fail to retrieve "
8110 "WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL value"));
8111 return ;
8112 }
8113 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval
8114 = cfgValue;
8115 if (wlan_cfgGetInt(pMac,
8116 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL,
8117 &cfgValue) != eSIR_SUCCESS)
8118 {
8119 limLog(pMac, LOGE, FL("Fail to retrieve"
8120 "WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL value"));
8121 return ;
8122 }
8123 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
8124 cfgValue;
8125 if (wlan_cfgGetInt(pMac,
8126 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL, &cfgValue)
8127 != eSIR_SUCCESS)
8128 {
8129 limLog(pMac, LOGE, FL("Fail to retrieve"
8130 "WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL value"));
8131 return ;
8132 }
8133 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
8134 cfgValue;
8135 if (wlan_cfgGetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD ,
8136 &cfgValue) != eSIR_SUCCESS)
8137 {
8138 limLog(pMac, LOGE, FL("Fail to retrieve "
8139 "WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD value"));
8140 return ;
8141 }
8142 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold = cfgValue;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308143}
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308144
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05308145const char * lim_ScanTypetoString(const v_U8_t scanType)
8146{
8147 switch (scanType)
8148 {
8149 CASE_RETURN_STRING( eSIR_PASSIVE_SCAN );
8150 CASE_RETURN_STRING( eSIR_ACTIVE_SCAN );
8151 CASE_RETURN_STRING( eSIR_BEACON_TABLE );
8152 default:
8153 return "Unknown ScanType";
8154 }
8155}
8156
8157const char * lim_BssTypetoString(const v_U8_t bssType)
8158{
8159 switch (bssType)
8160 {
8161 CASE_RETURN_STRING( eSIR_INFRASTRUCTURE_MODE );
8162 CASE_RETURN_STRING( eSIR_INFRA_AP_MODE );
8163 CASE_RETURN_STRING( eSIR_IBSS_MODE );
8164 CASE_RETURN_STRING( eSIR_BTAMP_STA_MODE );
8165 CASE_RETURN_STRING( eSIR_BTAMP_AP_MODE );
8166 CASE_RETURN_STRING( eSIR_AUTO_MODE );
8167 default:
8168 return "Unknown BssType";
8169 }
8170}
8171
8172const char *lim_BackgroundScanModetoString(const v_U8_t mode)
8173{
8174 switch (mode)
8175 {
8176 CASE_RETURN_STRING( eSIR_AGGRESSIVE_BACKGROUND_SCAN );
8177 CASE_RETURN_STRING( eSIR_NORMAL_BACKGROUND_SCAN );
8178 CASE_RETURN_STRING( eSIR_ROAMING_SCAN );
8179 default:
8180 return "Unknown BgScanMode";
8181 }
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05308182}
Abhishek Singh0ebac9c2014-06-25 13:34:12 +05308183
8184#ifdef WLAN_FEATURE_11W
8185/**
8186 *
8187 * \brief This function is called by various LIM modules to correctly set
8188 * the Protected bit in the Frame Control Field of the 802.11 frame MAC header
8189 *
8190 *
8191 * \param pMac Pointer to Global MAC structure
8192 *
8193 * \param psessionEntry Pointer to session corresponding to the connection
8194 *
8195 * \param peer Peer address of the STA to which the frame is to be sent
8196 *
8197 * \param pMacHdr Pointer to the frame MAC header
8198 *
8199 * \return nothing
8200 *
8201 *
8202 */
8203void
8204limSetProtectedBit(tpAniSirGlobal pMac,
8205 tpPESession psessionEntry,
8206 tSirMacAddr peer,
8207 tpSirMacMgmtHdr pMacHdr)
8208{
8209 tANI_U16 aid;
8210 tpDphHashNode pStaDs;
8211
8212 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
8213 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
8214 {
8215
8216 pStaDs = dphLookupHashEntry( pMac, peer, &aid,
8217 &psessionEntry->dph.dphHashTable );
8218 if( pStaDs != NULL )
8219 if( pStaDs->rmfEnabled )
8220 pMacHdr->fc.wep = 1;
8221 }
8222 else if ( psessionEntry->limRmfEnabled )
8223 pMacHdr->fc.wep = 1;
8224} /*** end limSetProtectedBit() ***/
8225#endif