blob: 454bb1d998652e3046ead4fc8a359578cf067dad [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 -080086
87static void
88limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
89 eHalStatus status,
90 tANI_U32 *ctx);
Jeff Johnson295189b2012-06-20 16:38:30 -070091/** -------------------------------------------------------------
92\fn limAssignDialogueToken
93\brief Assigns dialogue token.
94\param tpAniSirGlobal pMac
95\return tpDialogueToken - dialogueToken data structure.
96 -------------------------------------------------------------*/
97
98tpDialogueToken
99limAssignDialogueToken(tpAniSirGlobal pMac)
100{
Madan Mohan Koyyalamudidfd6aa82012-10-18 20:18:43 -0700101 static tANI_U8 token;
Jeff Johnson295189b2012-06-20 16:38:30 -0700102 tpDialogueToken pCurrNode;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530103 pCurrNode = vos_mem_malloc(sizeof(tDialogueToken));
104 if ( NULL == pCurrNode )
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530106 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 return NULL;
108 }
109
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530110 vos_mem_set((void *) pCurrNode, sizeof(tDialogueToken), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 //first node in the list is being added.
112 if(NULL == pMac->lim.pDialogueTokenHead)
113 {
114 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenTail = pCurrNode;
115 }
116 else
117 {
118 pMac->lim.pDialogueTokenTail->next = pCurrNode;
119 pMac->lim.pDialogueTokenTail = pCurrNode;
120 }
121 //assocId and tid of the node will be filled in by caller.
122 pCurrNode->next = NULL;
123 pCurrNode->token = token++;
Praveen Kumar Sirisilla539f7422013-08-28 17:01:05 -0700124
125 /* Dialog token should be a non-zero value */
126 if (0 == pCurrNode->token)
127 pCurrNode->token = token;
128
129 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), pCurrNode->token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 return pCurrNode;
131}
132
133/** -------------------------------------------------------------
134\fn limSearchAndDeleteDialogueToken
135\brief search dialogue token in the list and deletes it if found. returns failure if not found.
136\param tpAniSirGlobal pMac
137\param tANI_U8 token
138\param tANI_U16 assocId
139\param tANI_U16 tid
140\return eSirRetStatus - status of the search
141 -------------------------------------------------------------*/
142
143
144tSirRetStatus
145limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
146{
147 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
148 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
149
150 //if the list is empty
151 if(NULL == pCurrNode)
152 return eSIR_FAILURE;
153
154 // if the matching node is the first node.
155 if(pCurrNode &&
156 (assocId == pCurrNode->assocId) &&
157 (tid == pCurrNode->tid))
158 {
159 pMac->lim.pDialogueTokenHead = pCurrNode->next;
160 //there was only one node in the list. So tail pointer also needs to be adjusted.
161 if(NULL == pMac->lim.pDialogueTokenHead)
162 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530163 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800164 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 return eSIR_SUCCESS;
166 }
167
168 //first node did not match. so move to the next one.
169 pCurrNode = pCurrNode->next;
170 while(NULL != pCurrNode )
171 {
172 if(token == pCurrNode->token)
173 {
174 break;
175 }
176
177 pPrevNode = pCurrNode;
178 pCurrNode = pCurrNode->next;
179 }
180
181 if(pCurrNode &&
182 (assocId == pCurrNode->assocId) &&
183 (tid == pCurrNode->tid))
184 {
185 pPrevNode->next = pCurrNode->next;
186 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
187 if(NULL == pCurrNode->next)
188 pMac->lim.pDialogueTokenTail = pPrevNode;
Kiet Lam842c3e12013-11-16 22:40:57 +0530189 vos_mem_free(pCurrNode);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800190 pMac->lim.pDialogueTokenHead = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700191 return eSIR_SUCCESS;
192 }
193
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700194 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 return eSIR_FAILURE;
196
197}
198
199
200/** -------------------------------------------------------------
201\fn limDeleteDialogueTokenList
202\brief deletes the complete lim dialogue token linked list.
203\param tpAniSirGlobal pMac
204\return None
205 -------------------------------------------------------------*/
206void
207limDeleteDialogueTokenList(tpAniSirGlobal pMac)
208{
209 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
210
211 while(NULL != pMac->lim.pDialogueTokenHead)
212 {
213 pCurrNode = pMac->lim.pDialogueTokenHead;
214 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530215 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 pCurrNode = NULL;
217 }
218 pMac->lim.pDialogueTokenTail = NULL;
219}
220
221void
222limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
223{
224 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
225 *pIgnore = 0;
226
227 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
228 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530229 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 *pIgnore = 1;
231 }
232 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
233 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530234 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 *pIgnore = 1;
236 }
237 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
238 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530239 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 *pIgnore = 0;
241 }
242 else
243 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530244 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 *pIgnore = 1;
246 }
247}
248
249char *
250limMlmStateStr(tLimMlmStates state)
251{
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 switch (state)
253 {
254 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700255 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700257 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700259 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700261 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700263 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700265 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700266 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700267 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700269 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700271 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700273 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700275 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700277 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700279 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700281 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
283 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
284 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700285 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700287 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700289 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700291 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700295 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700297 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700299 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700301 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
303 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
304 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700305 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700307 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700309 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700311 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700313}
314
315void
316limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
317{
318 limLog(pMac, logLevel, limMlmStateStr(state));
319}
320
321char *
322limSmeStateStr(tLimSmeStates state)
323{
324#ifdef FIXME_GEN6
325 switch (state)
326 {
327 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700328 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700330 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700332 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700334 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700336 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700338 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700340 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700342 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700344 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700348 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700352 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700354 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700356 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700358 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700360 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700362 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700366 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700368 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700370 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700372 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 }
374#endif
375return "";
376}
377
378
379char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
380{
381#ifdef FIXME_GEN6
382
383 switch(dot11Mode)
384 {
385 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700386 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700388 return "11A";
389 case WNI_CFG_DOT11_MODE_11B:
390 return "11B";
391 case WNI_CFG_DOT11_MODE_11G:
392 return "11G";
393 case WNI_CFG_DOT11_MODE_11N:
394 return "11N";
395 case WNI_CFG_DOT11_MODE_POLARIS:
396 return "Polaris";
397 case WNI_CFG_DOT11_MODE_TITAN:
398 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700400 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700402 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404#endif
405return "";
406}
407
408
409char* limStaOpRateModeStr(tStaRateMode opRateMode)
410{
411#ifdef FIXME_GEN6
412
413 switch(opRateMode)
414 {
415 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700416 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700418 return "11A";
419 case eSTA_11b:
420 return "11B";
421 case eSTA_11bg:
422 return "11G";
423 case eSTA_11n:
424 return "11N";
425 case eSTA_POLARIS:
426 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700428 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700430 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700431 }
432#endif
433return "";
434}
435
436char* limBssTypeStr(tSirBssType bssType)
437{
438 switch(bssType)
439 {
440 case eSIR_INFRASTRUCTURE_MODE:
441 return "eSIR_INFRASTRUCTURE_MODE";
442 case eSIR_IBSS_MODE:
443 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700444 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700446 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700448 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 return "eSIR_AUTO_MODE";
450 default:
451 return "Invalid BSS Type";
452 }
453}
454
455void
456limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
457{
458 limLog(pMac, logLevel, limSmeStateStr(state));
459}
460
461char *limMsgStr(tANI_U32 msgType)
462{
463#ifdef FIXME_GEN6
464 switch (msgType)
465 {
466 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700467 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700469 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700471 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700473 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700474#ifdef FEATURE_OEM_DATA_SUPPORT
475 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700476 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700477 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700478 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700479#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700481 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700483 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700485 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700487 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700491 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700495 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700497 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700499 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700501 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700503 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700505 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700507 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700509 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700511 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700513 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700515 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700519 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700521 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700523 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700525 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700527 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700529 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700533 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700535 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700537 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700539 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700541 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700543 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700545 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700549 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700551 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700553 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700555 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700557 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700559 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700561 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700563 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700565 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700567 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700569 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700571 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700573 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700575 return "eWNI_SME_DELTS_IND";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800576#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800577 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700578 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800579 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700580 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800581#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700582
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700584 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700586 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700588 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700594 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700596 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700598 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700600 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700602 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700604 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700608 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700610 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700612 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700614 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700616 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700618 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700620 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700622 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700624 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700627#ifdef WLAN_FEATURE_VOWIFI_11R
628 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700629 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700630#endif
631
632 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700633 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700637 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700639 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700643 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700645 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700647 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700649 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700650
651 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700652 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700656 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700658 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700660 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700662 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700664 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700666 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700668 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700670 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700672 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700674 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700676 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700678 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700680 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700682 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700686 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700690 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700692 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800693 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700694 return "eWNI_SME_SET_BCN_FILTER_REQ";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800695#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700696 case eWNI_SME_GET_TSM_STATS_REQ:
697 return "eWNI_SME_GET_TSM_STATS_REQ";
698 case eWNI_SME_GET_TSM_STATS_RSP:
699 return "eWNI_SME_GET_TSM_STATS_RSP";
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800700#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 }
704#endif
705return "";
706}
707
708
709
710char *limResultCodeStr(tSirResultCodes resultCode)
711{
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 switch (resultCode)
713 {
714 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700715 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700717 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700719 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700721 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700723 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700727 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700729 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700731 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700733 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700735 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700739 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700741 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700743 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700745 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700747 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700749 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700751 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700753 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700755 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700757 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700759 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700761 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700763 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700765 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700767 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700771 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700773 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700775 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700777 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700779 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700781 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700783 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700785 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700787 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700789 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700791 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700793 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700797 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700799 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700801 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700803 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700805 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700807 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700809 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700811 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700813 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700815 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700817 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700819 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700821 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700823 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700827 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700833 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700837 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840#ifdef GEN4_SCAN
841 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700842 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700846 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700850 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700852 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700853#else // GEN4_SCAN
854 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700855 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700857 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700858#endif // GEN4_SCAN
859
860 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700861 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700863}
864
865void
866limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
867{
868 limLog(pMac, logLevel, limMsgStr(msgType));
869}
870
Jeff Johnson295189b2012-06-20 16:38:30 -0700871void
872limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
873{
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
875 {
876 switch (msg->type)
877 {
878 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 break;
881 default:
882 limPrintMsgName(pMac, logLevel,msg->type);
883 break;
884 }
885 }
886}
887
888/**
889 * limInitMlm()
890 *
891 *FUNCTION:
892 * This function is called by limProcessSmeMessages() to
893 * initialize MLM state machine on STA
894 *
895 *PARAMS:
896 *
897 *LOGIC:
898 *
899 *ASSUMPTIONS:
900 * NA
901 *
902 *NOTE:
903 * NA
904 *
905 * @param pMac Pointer to Global MAC structure
906 * @return None
907 */
908void
909limInitMlm(tpAniSirGlobal pMac)
910{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700911 tANI_U32 retVal;
912
913 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700914
Jeff Johnsone7245742012-09-05 17:12:55 -0700915 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700916
917 /// Initialize scan result hash table
918 limReInitScanResults(pMac); //sep26th review
919
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700920#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
921 /// Initialize lfr scan result hash table
922 // Could there be a problem in multisession with SAP/P2P GO, when in the
923 // middle of FW bg scan, SAP started; Again that could be a problem even on
924 // infra + SAP/P2P GO too - TBD
925 limReInitLfrScanResults(pMac);
926#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928 /// Initialize number of pre-auth contexts
929 pMac->lim.gLimNumPreAuthContexts = 0;
930
931 /// Initialize MAC based Authentication STA list
932 limInitPreAuthList(pMac);
933
934 //pMac->lim.gpLimMlmJoinReq = NULL;
935
936 if (pMac->lim.gLimTimersCreated)
937 return;
938
939 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700940 retVal = limCreateTimers(pMac);
941 if(retVal == TX_SUCCESS)
942 {
943 pMac->lim.gLimTimersCreated = 1;
944 }
945 else
946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700947 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700948 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700949} /*** end limInitMlm() ***/
950
951
952
953/**
954 * limCleanupMlm()
955 *
956 *FUNCTION:
957 * This function is called to cleanup any resources
958 * allocated by the MLM state machine.
959 *
960 *PARAMS:
961 *
962 *LOGIC:
963 *
964 *ASSUMPTIONS:
965 * NA
966 *
967 *NOTE:
968 * It is assumed that BSS is already informed that we're leaving it
969 * before this function is called.
970 *
971 * @param pMac Pointer to Global MAC structure
972 * @param None
973 * @return None
974 */
975void
976limCleanupMlm(tpAniSirGlobal pMac)
977{
978 tANI_U32 n;
979 tLimPreAuthNode *pAuthNode;
980
981 if (pMac->lim.gLimTimersCreated == 1)
982 {
983 // Deactivate and delete MIN/MAX channel timers.
984 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
985 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
986 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
987 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
988 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
989 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
990
991
992 // Deactivate and delete channel switch timer.
993 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
994 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
995
996
997 // Deactivate and delete addts response timer.
998 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
999 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
1000
1001 // Deactivate and delete Join failure timer.
1002 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
1003 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
1004
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001005 // Deactivate and delete Periodic Join Probe Request timer.
1006 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1007 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
1008
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 // Deactivate and delete Association failure timer.
1010 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
1011 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
1012
1013 // Deactivate and delete Reassociation failure timer.
1014 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1015 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1016
1017 // Deactivate and delete Authentication failure timer.
1018 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1019 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1020
1021 // Deactivate and delete Heartbeat timer.
1022 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1023 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1024
1025 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1026 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1027 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1028
1029 // Deactivate and delete Quiet timer.
1030 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1031 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1032
1033 // Deactivate and delete Quiet BSS timer.
1034 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1035 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1036
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 // Deactivate and delete LIM background scan timer.
1038 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1039 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001040
1041
1042 // Deactivate and delete cnf wait timer
1043 for (n = 0; n < pMac->lim.maxStation; n++)
1044 {
1045 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1046 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1047 }
1048
1049 // Deactivate and delete keepalive timer
1050 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1051 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1052
1053 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1054
1055 //Deactivate any Authentication response timers
1056 limDeletePreAuthList(pMac);
1057
1058 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1059 {
1060 // Delete any Authentication response
1061 // timers, which might have been started.
1062 tx_timer_delete(&pAuthNode->timer);
1063 }
1064
Jeff Johnson295189b2012-06-20 16:38:30 -07001065
1066
1067 // Deactivate and delete Hash Miss throttle timer
1068 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1069 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1070
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1072 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1073 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1074 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1075
1076#if 0 // The WPS PBC clean up timer is disabled
1077 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1078 {
1079 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1080 {
1081 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1082 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1083 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1084 }
1085 }
1086#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001087#ifdef WLAN_FEATURE_VOWIFI_11R
1088 // Deactivate and delete FT Preauth response timer
1089 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1090 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1091#endif
1092
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 // Deactivate and delete remain on channel timer
1094 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1095 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001096
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001097#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 // Deactivate and delete TSM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001099 tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer);
1100 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
1101#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001102
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001103 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1104 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1105
1106 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1107 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1108
Hoonki Leef63df0d2013-01-16 19:29:14 -08001109 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1110 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001111
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301112 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1113 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1114
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 pMac->lim.gLimTimersCreated = 0;
1116 }
1117
1118 /// Cleanup cached scan list
1119 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001120#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1121 /// Cleanup cached scan list
1122 limReInitLfrScanResults(pMac);
1123#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001124
1125} /*** end limCleanupMlm() ***/
1126
1127
1128
1129/**
1130 * limCleanupLmm()
1131 *
1132 *FUNCTION:
1133 * This function is called to cleanup any resources
1134 * allocated by LMM sub-module.
1135 *
1136 *PARAMS:
1137 *
1138 *LOGIC:
1139 *
1140 *ASSUMPTIONS:
1141 * NA
1142 *
1143 *NOTE:
1144 * NA
1145 *
1146 * @param pMac Pointer to Global MAC structure
1147 * @return None
1148 */
1149
1150void
1151limCleanupLmm(tpAniSirGlobal pMac)
1152{
Jeff Johnson295189b2012-06-20 16:38:30 -07001153} /*** end limCleanupLmm() ***/
1154
1155
1156
1157/**
1158 * limIsAddrBC()
1159 *
1160 *FUNCTION:
1161 * This function is called in various places within LIM code
1162 * to determine whether passed MAC address is a broadcast or not
1163 *
1164 *LOGIC:
1165 *
1166 *ASSUMPTIONS:
1167 * NA
1168 *
1169 *NOTE:
1170 * NA
1171 *
1172 * @param macAddr Indicates MAC address that need to be determined
1173 * whether it is Broadcast address or not
1174 *
1175 * @return true if passed address is Broadcast address else false
1176 */
1177
1178tANI_U8
1179limIsAddrBC(tSirMacAddr macAddr)
1180{
1181 int i;
1182 for (i = 0; i < 6; i++)
1183 {
1184 if ((macAddr[i] & 0xFF) != 0xFF)
1185 return false;
1186 }
1187
1188 return true;
1189} /****** end limIsAddrBC() ******/
1190
1191
1192
1193/**
1194 * limIsGroupAddr()
1195 *
1196 *FUNCTION:
1197 * This function is called in various places within LIM code
1198 * to determine whether passed MAC address is a group address or not
1199 *
1200 *LOGIC:
1201 * If least significant bit of first octet of the MAC address is
1202 * set to 1, it is a Group address.
1203 *
1204 *ASSUMPTIONS:
1205 * NA
1206 *
1207 *NOTE:
1208 * NA
1209 *
1210 * @param macAddr Indicates MAC address that need to be determined
1211 * whether it is Group address or not
1212 *
1213 * @return true if passed address is Group address else false
1214 */
1215
1216tANI_U8
1217limIsGroupAddr(tSirMacAddr macAddr)
1218{
1219 if ((macAddr[0] & 0x01) == 0x01)
1220 return true;
1221 else
1222 return false;
1223} /****** end limIsGroupAddr() ******/
1224
1225/**
1226 * limPostMsgApiNoWait()
1227 *
1228 *FUNCTION:
1229 * This function is called from other thread while posting a
1230 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1231 *
1232 *LOGIC:
1233 * NA
1234 *
1235 *ASSUMPTIONS:
1236 * NA
1237 *
1238 *NOTE:
1239 * NA
1240 *
1241 * @param pMsg - Pointer to the Global MAC structure
1242 * @param pMsg - Pointer to the message structure
1243 * @return None
1244 */
1245
1246tANI_U32
1247limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1248{
Jeff Johnson295189b2012-06-20 16:38:30 -07001249 limProcessMessages(pMac, pMsg);
1250 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001251} /*** end limPostMsgApiNoWait() ***/
1252
1253
1254
1255/**
1256 * limPrintMacAddr()
1257 *
1258 *FUNCTION:
1259 * This function is called to print passed MAC address
1260 * in : format.
1261 *
1262 *LOGIC:
1263 *
1264 *ASSUMPTIONS:
1265 * NA
1266 *
1267 *NOTE:
1268 * @param macAddr - MacAddr to be printed
1269 * @param logLevel - Loglevel to be used
1270 *
1271 * @return None.
1272 */
1273
1274void
1275limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1276{
1277 limLog(pMac, logLevel,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001278 FL(MAC_ADDRESS_STR), MAC_ADDR_ARRAY(macAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001279} /****** end limPrintMacAddr() ******/
1280
1281
Jeff Johnson295189b2012-06-20 16:38:30 -07001282/*
1283 * limResetDeferredMsgQ()
1284 *
1285 *FUNCTION:
1286 * This function resets the deferred message queue parameters.
1287 *
1288 *PARAMS:
1289 * @param pMac - Pointer to Global MAC structure
1290 *
1291 *LOGIC:
1292 *
1293 *ASSUMPTIONS:
1294 * NA
1295 *
1296 *NOTE:
1297 * NA
1298 *
1299 *RETURNS:
1300 * None
1301 */
1302
1303void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1304{
1305 pMac->lim.gLimDeferredMsgQ.size =
1306 pMac->lim.gLimDeferredMsgQ.write =
1307 pMac->lim.gLimDeferredMsgQ.read = 0;
1308
1309}
1310
1311
1312#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1313#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1314
1315/*
1316 * limWriteDeferredMsgQ()
1317 *
1318 *FUNCTION:
1319 * This function queues up a deferred message for later processing on the
1320 * STA side.
1321 *
1322 *PARAMS:
1323 * @param pMac - Pointer to Global MAC structure
1324 * @param limMsg - a LIM message
1325 *
1326 *LOGIC:
1327 *
1328 *ASSUMPTIONS:
1329 * NA
1330 *
1331 *NOTE:
1332 * NA
1333 *
1334 *RETURNS:
1335 * None
1336 */
1337
1338tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1339{
1340 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001341 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1343 limMsg->type);)
1344
1345 /*
1346 ** check if the deferred message queue is full
1347 **/
1348 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1349 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001350 if(!(pMac->lim.deferredMsgCnt & 0xF))
1351 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001352 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 -07001353 }
1354 else
1355 {
1356 pMac->lim.deferredMsgCnt++;
1357 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 return TX_QUEUE_FULL;
1359 }
1360
1361 /*
1362 ** In the application, there should not be more than 1 message get
1363 ** queued up. If happens, flags a warning. In the future, this can
1364 ** happen.
1365 **/
1366 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1367 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001368 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 -07001369 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1370 limIsSystemInScanState(pMac),
1371 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1372 pMac->lim.gLimAddtsSent);)
1373 }
1374
1375 /*
1376 ** To prevent the deferred Q is full of management frames, only give them certain space
1377 **/
1378 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1379 {
1380 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1381 {
1382 tANI_U16 idx, count = 0;
1383 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1384 {
1385 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1386 {
1387 count++;
1388 }
1389 }
1390 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1391 {
1392 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001393 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 //Return error, caller knows what to do
1395 return TX_QUEUE_FULL;
1396 }
1397 }
1398 }
1399
1400 ++pMac->lim.gLimDeferredMsgQ.size;
1401
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001402 /* reset the count here since we are able to defer the message */
1403 if(pMac->lim.deferredMsgCnt != 0)
1404 {
1405 pMac->lim.deferredMsgCnt = 0;
1406 }
1407
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 /*
1409 ** if the write pointer hits the end of the queue, rewind it
1410 **/
1411 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1412 pMac->lim.gLimDeferredMsgQ.write = 0;
1413
1414 /*
1415 ** save the message to the queue and advanced the write pointer
1416 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301417 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1418 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 (tANI_U8 *)limMsg,
1420 sizeof(tSirMsgQ));
1421 return TX_SUCCESS;
1422
1423}
1424
1425/*
1426 * limReadDeferredMsgQ()
1427 *
1428 *FUNCTION:
1429 * This function dequeues a deferred message for processing on the
1430 * STA side.
1431 *
1432 *PARAMS:
1433 * @param pMac - Pointer to Global MAC structure
1434 *
1435 *LOGIC:
1436 *
1437 *ASSUMPTIONS:
1438 * NA
1439 *
1440 *NOTE:
1441 *
1442 *
1443 *RETURNS:
1444 * Returns the message at the head of the deferred message queue
1445 */
1446
1447tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1448{
1449 tSirMsgQ *msg;
1450
1451 /*
1452 ** check any messages left. If no, return
1453 **/
1454 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1455 return NULL;
1456
1457 /*
1458 ** decrement the queue size
1459 **/
1460 pMac->lim.gLimDeferredMsgQ.size--;
1461
1462 /*
1463 ** retrieve the message from the head of the queue
1464 **/
1465 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1466
1467 /*
1468 ** advance the read pointer
1469 **/
1470 pMac->lim.gLimDeferredMsgQ.read++;
1471
1472 /*
1473 ** if the read pointer hits the end of the queue, rewind it
1474 **/
1475 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1476 pMac->lim.gLimDeferredMsgQ.read = 0;
1477
1478 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001479 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1481 msg->type);)
1482
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001483 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 limIsSystemInScanState(pMac),
1485 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1486 pMac->lim.gLimAddtsSent);)
1487
1488 return(msg);
1489}
1490
1491tSirRetStatus
1492limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1493 tSirMsgQ *pMsg,
1494 tANI_U8 qType)
1495{
1496// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 SysProcessMmhMsg(pMac, pMsg);
1498 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001499}
1500
1501char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1502{
1503#ifdef FIXME_GEN6
1504
1505 if (type == SIR_MAC_MGMT_FRAME)
1506 {
1507 switch (subType)
1508 {
1509 case SIR_MAC_MGMT_ASSOC_REQ:
1510 return "MAC_MGMT_ASSOC_REQ";
1511 case SIR_MAC_MGMT_ASSOC_RSP:
1512 return "MAC_MGMT_ASSOC_RSP";
1513 case SIR_MAC_MGMT_REASSOC_REQ:
1514 return "MAC_MGMT_REASSOC_REQ";
1515 case SIR_MAC_MGMT_REASSOC_RSP:
1516 return "MAC_MGMT_REASSOC_RSP";
1517 case SIR_MAC_MGMT_PROBE_REQ:
1518 return "MAC_MGMT_PROBE_REQ";
1519 case SIR_MAC_MGMT_PROBE_RSP:
1520 return "MAC_MGMT_PROBE_RSP";
1521 case SIR_MAC_MGMT_BEACON:
1522 return "MAC_MGMT_BEACON";
1523 case SIR_MAC_MGMT_ATIM:
1524 return "MAC_MGMT_ATIM";
1525 case SIR_MAC_MGMT_DISASSOC:
1526 return "MAC_MGMT_DISASSOC";
1527 case SIR_MAC_MGMT_AUTH:
1528 return "MAC_MGMT_AUTH";
1529 case SIR_MAC_MGMT_DEAUTH:
1530 return "MAC_MGMT_DEAUTH";
1531 case SIR_MAC_MGMT_ACTION:
1532 return "MAC_MGMT_ACTION";
1533 case SIR_MAC_MGMT_RESERVED15:
1534 return "MAC_MGMT_RESERVED15";
1535 default:
1536 return "Unknown MGMT Frame";
1537 }
1538 }
1539
1540 else if (type == SIR_MAC_CTRL_FRAME)
1541 {
1542 switch (subType)
1543 {
1544 case SIR_MAC_CTRL_RR:
1545 return "MAC_CTRL_RR";
1546 case SIR_MAC_CTRL_BAR:
1547 return "MAC_CTRL_BAR";
1548 case SIR_MAC_CTRL_BA:
1549 return "MAC_CTRL_BA";
1550 case SIR_MAC_CTRL_PS_POLL:
1551 return "MAC_CTRL_PS_POLL";
1552 case SIR_MAC_CTRL_RTS:
1553 return "MAC_CTRL_RTS";
1554 case SIR_MAC_CTRL_CTS:
1555 return "MAC_CTRL_CTS";
1556 case SIR_MAC_CTRL_ACK:
1557 return "MAC_CTRL_ACK";
1558 case SIR_MAC_CTRL_CF_END:
1559 return "MAC_CTRL_CF_END";
1560 case SIR_MAC_CTRL_CF_END_ACK:
1561 return "MAC_CTRL_CF_END_ACK";
1562 default:
1563 return "Unknown CTRL Frame";
1564 }
1565 }
1566
1567 else if (type == SIR_MAC_DATA_FRAME)
1568 {
1569 switch (subType)
1570 {
1571 case SIR_MAC_DATA_DATA:
1572 return "MAC_DATA_DATA";
1573 case SIR_MAC_DATA_DATA_ACK:
1574 return "MAC_DATA_DATA_ACK";
1575 case SIR_MAC_DATA_DATA_POLL:
1576 return "MAC_DATA_DATA_POLL";
1577 case SIR_MAC_DATA_DATA_ACK_POLL:
1578 return "MAC_DATA_DATA_ACK_POLL";
1579 case SIR_MAC_DATA_NULL:
1580 return "MAC_DATA_NULL";
1581 case SIR_MAC_DATA_NULL_ACK:
1582 return "MAC_DATA_NULL_ACK";
1583 case SIR_MAC_DATA_NULL_POLL:
1584 return "MAC_DATA_NULL_POLL";
1585 case SIR_MAC_DATA_NULL_ACK_POLL:
1586 return "MAC_DATA_NULL_ACK_POLL";
1587 case SIR_MAC_DATA_QOS_DATA:
1588 return "MAC_DATA_QOS_DATA";
1589 case SIR_MAC_DATA_QOS_DATA_ACK:
1590 return "MAC_DATA_QOS_DATA_ACK";
1591 case SIR_MAC_DATA_QOS_DATA_POLL:
1592 return "MAC_DATA_QOS_DATA_POLL";
1593 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1594 return "MAC_DATA_QOS_DATA_ACK_POLL";
1595 case SIR_MAC_DATA_QOS_NULL:
1596 return "MAC_DATA_QOS_NULL";
1597 case SIR_MAC_DATA_QOS_NULL_ACK:
1598 return "MAC_DATA_QOS_NULL_ACK";
1599 case SIR_MAC_DATA_QOS_NULL_POLL:
1600 return "MAC_DATA_QOS_NULL_POLL";
1601 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1602 return "MAC_DATA_QOS_NULL_ACK_POLL";
1603 default:
1604 return "Unknown Data Frame";
1605 }
1606 }
1607 else
1608 return "Unknown";
1609#endif
1610return "";
1611}
1612
Jeff Johnson295189b2012-06-20 16:38:30 -07001613void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1614{
1615 int i;
1616 static int enable;
1617 tUpdateBeaconParams beaconParams;
1618
1619 tpPESession psessionEntry = limIsApSessionActive(pMac);
1620
1621 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001622 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001623 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001624 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001625 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301626
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301627 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001628 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001629
1630 beaconParams.paramChangeBitmap = 0;
1631 /*
1632 ** This is doing a 2 pass check. The first pass is to invalidate
1633 ** all the cache entries. The second pass is to decide whether to
1634 ** disable protection.
1635 **/
1636 if (!enable)
1637 {
1638
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001639 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 psessionEntry->gLimOlbcParams.numSta = 0;
1641 psessionEntry->gLimOverlap11gParams.numSta = 0;
1642 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1643 psessionEntry->gLimNonGfParams.numSta = 0;
1644 psessionEntry->gLimLsigTxopParams.numSta = 0;
1645
1646 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1647 pMac->lim.protStaOverlapCache[i].active = false;
1648
1649 enable = 1;
1650 }
1651 else
1652 {
1653
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001654 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 {
1656 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1657 {
1658 if (!psessionEntry->gLim11bParams.protectionEnabled)
1659 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001660 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1662 }
1663 }
1664 }
1665
1666 if (!psessionEntry->gLimOverlap11gParams.numSta)
1667 {
1668 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1669 {
1670 if (!psessionEntry->gLim11gParams.protectionEnabled)
1671 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001672 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1674 }
1675 }
1676 }
1677
1678 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1679 {
1680 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1681 {
1682 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1683 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001684 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1686 }
1687 }
1688 }
1689
1690 enable = 0;
1691 }
1692
1693 if(beaconParams.paramChangeBitmap)
1694 {
1695 schSetFixedBeaconFields(pMac,psessionEntry);
1696 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1697 }
1698
1699 // Start OLBC timer
1700 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1701 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001702 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 }
1704}
Jeff Johnson295189b2012-06-20 16:38:30 -07001705
1706/**
1707 * limIsNullSsid()
1708 *
1709 *FUNCTION:
1710 * This function checks if Ssid supplied is Null SSID
1711 *
1712 *
1713 *LOGIC:
1714 *
1715 *ASSUMPTIONS:
1716 * NA
1717 *
1718 *NOTE:
1719 * NA
1720 *
1721 * @param tSirMacSSid *
1722 *
1723 *
1724 * @return true if SSID is Null SSID else false
1725 */
1726
1727tANI_U8
1728limIsNullSsid( tSirMacSSid *pSsid )
1729{
1730 tANI_U8 fNullSsid = false;
1731 tANI_U32 SsidLength;
1732 tANI_U8 *pSsidStr;
1733
1734 do
1735 {
1736 if ( 0 == pSsid->length )
1737 {
1738 fNullSsid = true;
1739 break;
1740 }
1741
1742#define ASCII_SPACE_CHARACTER 0x20
1743 /* If the first charactes is space, then check if all characters in
1744 * SSID are spaces to consider it as NULL SSID*/
1745 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1746 {
1747 SsidLength = pSsid->length;
1748 pSsidStr = pSsid->ssId;
1749 /* check if all the charactes in SSID are spaces*/
1750 while ( SsidLength )
1751 {
1752 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1753 break;
1754
1755 pSsidStr++;
1756 SsidLength--;
1757 }
1758
1759 if( 0 == SsidLength )
1760 {
1761 fNullSsid = true;
1762 break;
1763 }
1764 }
1765 else
1766 {
1767 /* check if all the charactes in SSID are NULL*/
1768 SsidLength = pSsid->length;
1769 pSsidStr = pSsid->ssId;
1770
1771 while ( SsidLength )
1772 {
1773 if( *pSsidStr )
1774 break;
1775
1776 pSsidStr++;
1777 SsidLength--;
1778 }
1779
1780 if( 0 == SsidLength )
1781 {
1782 fNullSsid = true;
1783 break;
1784 }
1785 }
1786 }
1787 while( 0 );
1788
1789 return fNullSsid;
1790} /****** end limIsNullSsid() ******/
1791
1792
1793
Jeff Johnson295189b2012-06-20 16:38:30 -07001794
1795/** -------------------------------------------------------------
1796\fn limUpdateProtStaParams
1797\brief updates protection related counters.
1798\param tpAniSirGlobal pMac
1799\param tSirMacAddr peerMacAddr
1800\param tLimProtStaCacheType protStaCacheType
1801\param tHalBitVal gfSupported
1802\param tHalBitVal lsigTxopSupported
1803\return None
1804 -------------------------------------------------------------*/
1805void
1806limUpdateProtStaParams(tpAniSirGlobal pMac,
1807tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1808tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1809tpPESession psessionEntry)
1810{
1811 tANI_U32 i;
1812
1813 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1814 limLog(pMac,LOG1, FL("Addr : "));
1815 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1816
1817 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1818 {
1819 if (psessionEntry->protStaCache[i].active)
1820 {
1821 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1822 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1823
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301824 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 psessionEntry->protStaCache[i].addr,
1826 peerMacAddr, sizeof(tSirMacAddr)))
1827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001828 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 return;
1830 }
1831 }
1832 }
1833
1834 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1835 {
1836 if (!psessionEntry->protStaCache[i].active)
1837 break;
1838 }
1839
1840 if (i >= LIM_PROT_STA_CACHE_SIZE)
1841 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001842 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 return;
1844 }
1845
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301846 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 peerMacAddr,
1848 sizeof(tSirMacAddr));
1849
1850 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1851 psessionEntry->protStaCache[i].active = true;
1852 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1853 {
1854 psessionEntry->gLim11bParams.numSta++;
1855 limLog(pMac,LOG1, FL("11B, "));
1856 }
1857 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1858 {
1859 psessionEntry->gLim11gParams.numSta++;
1860 limLog(pMac,LOG1, FL("11G, "));
1861 }
1862 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1863 {
1864 psessionEntry->gLimHt20Params.numSta++;
1865 limLog(pMac,LOG1, FL("HT20, "));
1866 }
1867
1868 if(!gfSupported)
1869 {
1870 psessionEntry->gLimNonGfParams.numSta++;
1871 limLog(pMac,LOG1, FL("NonGf, "));
1872 }
1873 if(!lsigTxopSupported)
1874 {
1875 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001876 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 }
1878}// ---------------------------------------------------------------------
1879
1880/** -------------------------------------------------------------
1881\fn limDecideApProtection
1882\brief Decides all the protection related staiton coexistence and also sets
1883\ short preamble and short slot appropriately. This function will be called
1884\ when AP is ready to send assocRsp tp the station joining right now.
1885\param tpAniSirGlobal pMac
1886\param tSirMacAddr peerMacAddr
1887\return None
1888 -------------------------------------------------------------*/
1889void
1890limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1891{
1892 tANI_U16 tmpAid;
1893 tpDphHashNode pStaDs;
1894 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1895 tANI_U32 phyMode;
1896 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1897 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1898
1899 pBeaconParams->paramChangeBitmap = 0;
1900 // check whether to enable protection or not
1901 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1902 if(NULL == pStaDs)
1903 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001904 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 return;
1906 }
1907 limGetRfBand(pMac, &rfBand, psessionEntry);
1908 //if we are in 5 GHZ band
1909 if(SIR_BAND_5_GHZ == rfBand)
1910 {
1911 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1912 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001913 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 {
1915 //we are 11N and 11A station is joining.
1916 //protection from 11A required.
1917 if(false == pStaDs->mlmStaContext.htCapability)
1918 {
1919 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1920 return;
1921 }
1922 }
1923 }
1924 else if(SIR_BAND_2_4_GHZ== rfBand)
1925 {
1926 limGetPhyMode(pMac, &phyMode, psessionEntry);
1927
1928 //We are 11G. Check if we need protection from 11b Stations.
1929 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001930 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 {
1932
1933 if (pStaDs->erpEnabled== eHAL_CLEAR)
1934 {
1935 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1936 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001937 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1939 }
1940 }
1941
1942 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001943 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 {
1945 //check if we need protection from 11b station
1946 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1947 (!pStaDs->mlmStaContext.htCapability))
1948 {
1949 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1950 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001951 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1953 }
1954 //station being joined is non-11b and non-ht ==> 11g device
1955 else if(!pStaDs->mlmStaContext.htCapability)
1956 {
1957 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1958 //enable protection
1959 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1960 }
1961 //ERP mode is enabled for the latest station joined
1962 //latest station joined is HT capable
1963 //This case is being handled in common code (commn between both the bands) below.
1964 }
1965 }
1966
1967 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001968 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 (true == pStaDs->mlmStaContext.htCapability))
1970 {
1971 if(!pStaDs->htGreenfield)
1972 {
1973 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1974 gfSupported = eHAL_CLEAR;
1975 }
1976 //Station joining is HT 20Mhz
1977 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1978 {
1979 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1980 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1981 }
1982 //Station joining does not support LSIG TXOP Protection
1983 if(!pStaDs->htLsigTXOPProtection)
1984 {
1985 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1986 lsigTxopSupported = eHAL_CLEAR;
1987 }
1988 }
1989
1990 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1991 gfSupported, lsigTxopSupported, psessionEntry);
1992
1993 return;
1994}
Jeff Johnson295189b2012-06-20 16:38:30 -07001995
1996
1997/** -------------------------------------------------------------
1998\fn limEnableOverlap11gProtection
1999\brief wrapper function for setting overlap 11g protection.
2000\param tpAniSirGlobal pMac
2001\param tpUpdateBeaconParams pBeaconParams
2002\param tpSirMacMgmtHdr pMh
2003\return None
2004 -------------------------------------------------------------*/
2005void
2006limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2007tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2008{
2009 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2010
2011 if (psessionEntry->gLimOlbcParams.numSta &&
2012 !psessionEntry->gLimOlbcParams.protectionEnabled)
2013 {
2014 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002015 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2017 }
2018}
2019
2020
2021/** -------------------------------------------------------------
2022\fn limUpdateShortPreamble
2023\brief Updates short preamble if needed when a new station joins.
2024\param tpAniSirGlobal pMac
2025\param tSirMacAddr peerMacAddr
2026\param tpUpdateBeaconParams pBeaconParams
2027\return None
2028 -------------------------------------------------------------*/
2029void
2030limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2031 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2032{
2033 tANI_U16 tmpAid;
2034 tpDphHashNode pStaDs;
2035 tANI_U32 phyMode;
2036 tANI_U16 i;
2037
2038 // check whether to enable protection or not
2039 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2040
2041 limGetPhyMode(pMac, &phyMode, psessionEntry);
2042
2043 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2044
2045 {
2046 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2047 {
2048 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2049 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2050
2051 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2052 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2054 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2055 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302056 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2058 peerMacAddr, sizeof(tSirMacAddr)))
2059 return;
2060 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 {
2062 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2063 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302064 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2066 peerMacAddr, sizeof(tSirMacAddr)))
2067 return;
2068 }
2069 }
2070 }
2071
2072
2073 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2074 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2076 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2077 break;
2078 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 {
2080 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2081 break;
2082 }
2083 }
2084
2085 if (i >= LIM_PROT_STA_CACHE_SIZE)
2086 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2088 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2089 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2090 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2091 return;
2092 }
2093 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 {
2095 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2096 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2097 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2098 return;
2099 }
2100
2101 }
2102
2103
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302104 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2105 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 peerMacAddr, sizeof(tSirMacAddr));
2107 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2108 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2109 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302111 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 peerMacAddr, sizeof(tSirMacAddr));
2113 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2114 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2115 }
2116
2117
2118 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002119 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002120
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002122 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 }
2124 }
2125}
2126
2127/** -------------------------------------------------------------
2128\fn limUpdateShortSlotTime
2129\brief Updates short slot time if needed when a new station joins.
2130\param tpAniSirGlobal pMac
2131\param tSirMacAddr peerMacAddr
2132\param tpUpdateBeaconParams pBeaconParams
2133\return None
2134 -------------------------------------------------------------*/
2135
2136void
2137limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2138 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2139{
2140 tANI_U16 tmpAid;
2141 tpDphHashNode pStaDs;
2142 tANI_U32 phyMode;
2143 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 tANI_U16 i;
2145
2146 // check whether to enable protection or not
2147 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2148 limGetPhyMode(pMac, &phyMode, psessionEntry);
2149
Jeff Johnsone7245742012-09-05 17:12:55 -07002150 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2151 * be always 1 and in 11b case, it should be always 0
2152 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2154 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002155 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2156 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2157 * it in limDecideShortSlot
2158 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2160 {
2161 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2162 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2163 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2164 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2166 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2167 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302168 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2170 peerMacAddr, sizeof(tSirMacAddr)))
2171 return;
2172 }
2173 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 {
2175 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2176 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302177 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2179 peerMacAddr, sizeof(tSirMacAddr)))
2180 return;
2181 }
2182 }
2183 }
2184
2185 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2186 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2188 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2189 break;
2190 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 {
2192 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2193 break;
2194 }
2195 }
2196
2197 if (i >= LIM_PROT_STA_CACHE_SIZE)
2198 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2200 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2201 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2202 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2203 return;
2204 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 {
2206 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2207 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2208 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2209 return;
2210 }
2211 }
2212
2213
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302215 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 peerMacAddr, sizeof(tSirMacAddr));
2217 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2218 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2219 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302221 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 peerMacAddr, sizeof(tSirMacAddr));
2223 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2224 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2225 }
2226 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2227
Jeff Johnsone7245742012-09-05 17:12:55 -07002228 /* 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
2229 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2230 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002232 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 {
2234 // enable long slot time
2235 pBeaconParams->fShortSlotTime = false;
2236 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002237 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002238 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 }
2240 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002242 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 {
2244 // enable long slot time
2245 pBeaconParams->fShortSlotTime = false;
2246 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002247 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002248 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 }
2250 }
2251 }
2252 }
2253}
2254
Jeff Johnson295189b2012-06-20 16:38:30 -07002255
2256/** -------------------------------------------------------------
2257\fn limDecideStaProtectionOnAssoc
2258\brief Decide protection related settings on Sta while association.
2259\param tpAniSirGlobal pMac
2260\param tpSchBeaconStruct pBeaconStruct
2261\return None
2262 -------------------------------------------------------------*/
2263void
2264limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2265 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2266{
2267 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2268 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2269
2270 limGetRfBand(pMac, &rfBand, psessionEntry);
2271 limGetPhyMode(pMac, &phyMode, psessionEntry);
2272
2273 if(SIR_BAND_5_GHZ == rfBand)
2274 {
2275 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2276 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2277 {
2278 if(pMac->lim.cfgProtection.fromlla)
2279 psessionEntry->beaconParams.llaCoexist = true;
2280 }
2281 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2282 {
2283 if(pMac->lim.cfgProtection.ht20)
2284 psessionEntry->beaconParams.ht20Coexist = true;
2285 }
2286
2287 }
2288 else if(SIR_BAND_2_4_GHZ == rfBand)
2289 {
2290 //spec 7.3.2.13
2291 //UseProtection will be set when nonERP STA is associated.
2292 //NonERPPresent bit will be set when:
2293 //--nonERP Sta is associated OR
2294 //--nonERP Sta exists in overlapping BSS
2295 //when useProtection is not set then protection from nonERP stations is optional.
2296
2297 //CFG protection from 11b is enabled and
2298 //11B device in the BSS
2299 /* TODO, This is not sessionized */
2300 if (phyMode != WNI_CFG_PHY_MODE_11B)
2301 {
2302 if (pMac->lim.cfgProtection.fromllb &&
2303 pBeaconStruct->erpPresent &&
2304 (pBeaconStruct->erpIEInfo.useProtection ||
2305 pBeaconStruct->erpIEInfo.nonErpPresent))
2306 {
2307 psessionEntry->beaconParams.llbCoexist = true;
2308 }
2309 //AP has no 11b station associated.
2310 else
2311 {
2312 psessionEntry->beaconParams.llbCoexist = false;
2313 }
2314 }
2315 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002316 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 (pBeaconStruct->HTInfo.present))
2318 {
2319 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2320
2321 //Obss Non HT STA present mode
2322 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2323
2324
2325 //CFG protection from 11G is enabled and
2326 //our AP has at least one 11G station associated.
2327 if(pMac->lim.cfgProtection.fromllg &&
2328 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2329 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2330 (!psessionEntry->beaconParams.llbCoexist))
2331 {
2332 if(pMac->lim.cfgProtection.fromllg)
2333 psessionEntry->beaconParams.llgCoexist = true;
2334 }
2335
2336 //AP has only HT stations associated and at least one station is HT 20
2337 //disable protection from any non-HT devices.
2338 //decision for disabling protection from 11b has already been taken above.
2339 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2340 {
2341 //Disable protection from 11G station.
2342 psessionEntry->beaconParams.llgCoexist = false;
2343 //CFG protection from HT 20 is enabled.
2344 if(pMac->lim.cfgProtection.ht20)
2345 psessionEntry->beaconParams.ht20Coexist = true;
2346 }
2347 //Disable protection from non-HT and HT20 devices.
2348 //decision for disabling protection from 11b has already been taken above.
2349 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2350 {
2351 psessionEntry->beaconParams.llgCoexist = false;
2352 psessionEntry->beaconParams.ht20Coexist = false;
2353 }
2354
2355 }
2356 }
2357
2358 //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 -07002359 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 (pBeaconStruct->HTInfo.present))
2361 {
2362 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2363 psessionEntry->beaconParams.fRIFSMode =
2364 ( tANI_U8 ) htInfo.rifsMode;
2365 psessionEntry->beaconParams.llnNonGFCoexist =
2366 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2367 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2368 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2369 }
2370}
2371
2372
2373/** -------------------------------------------------------------
2374\fn limDecideStaProtection
2375\brief Decides protection related settings on Sta while processing beacon.
2376\param tpAniSirGlobal pMac
2377\param tpUpdateBeaconParams pBeaconParams
2378\return None
2379 -------------------------------------------------------------*/
2380void
2381limDecideStaProtection(tpAniSirGlobal pMac,
2382 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2383{
2384
2385 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2386 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2387
2388 limGetRfBand(pMac, &rfBand, psessionEntry);
2389 limGetPhyMode(pMac, &phyMode, psessionEntry);
2390
2391 if(SIR_BAND_5_GHZ == rfBand)
2392 {
2393 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002394 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 (pBeaconStruct->HTInfo.present))
2396 {
2397 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2398 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2399 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2400 {
2401 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2402 }
2403 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2404 //protection from HT20 if needed.
2405 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2406 {
2407 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2408 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2409 }
2410 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2411 {
2412 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2413 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2414 }
2415 }
2416 }
2417 else if(SIR_BAND_2_4_GHZ == rfBand)
2418 {
2419 /* spec 7.3.2.13
2420 * UseProtection will be set when nonERP STA is associated.
2421 * NonERPPresent bit will be set when:
2422 * --nonERP Sta is associated OR
2423 * --nonERP Sta exists in overlapping BSS
2424 * when useProtection is not set then protection from nonERP stations is optional.
2425 */
2426
2427 if (phyMode != WNI_CFG_PHY_MODE_11B)
2428 {
2429 if (pBeaconStruct->erpPresent &&
2430 (pBeaconStruct->erpIEInfo.useProtection ||
2431 pBeaconStruct->erpIEInfo.nonErpPresent))
2432 {
2433 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2434 }
2435 //AP has no 11b station associated.
2436 else
2437 {
2438 //disable protection from 11b station
2439 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2440 }
2441 }
2442
2443 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002444 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 (pBeaconStruct->HTInfo.present))
2446 {
2447
2448 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2449 //AP has at least one 11G station associated.
2450 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2451 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2452 (!psessionEntry->beaconParams.llbCoexist))
2453 {
2454 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2455
2456 }
2457
2458 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2459 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2460 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2461 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2462 {
2463 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2464
2465 //AP has only HT stations associated and at least one station is HT 20
2466 //disable protection from any non-HT devices.
2467 //decision for disabling protection from 11b has already been taken above.
2468 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2469 {
2470 //Disable protection from 11G station.
2471 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2472
2473 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2474 }
2475 //Disable protection from non-HT and HT20 devices.
2476 //decision for disabling protection from 11b has already been taken above.
2477 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2478 {
2479 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2480 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2481
2482 }
2483 }
2484 }
2485 }
2486
2487 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002488 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 (pBeaconStruct->HTInfo.present))
2490 {
2491 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2492 //Check for changes in protection related factors other than HT operating mode.
2493 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2494 if ( psessionEntry->beaconParams.fRIFSMode !=
2495 ( tANI_U8 ) htInfo.rifsMode )
2496 {
2497 pBeaconParams->fRIFSMode =
2498 psessionEntry->beaconParams.fRIFSMode =
2499 ( tANI_U8 ) htInfo.rifsMode;
2500 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2501 }
2502
2503 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2504 htInfo.nonGFDevicesPresent )
2505 {
2506 pBeaconParams->llnNonGFCoexist =
2507 psessionEntry->beaconParams.llnNonGFCoexist =
2508 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2509 pBeaconParams->paramChangeBitmap |=
2510 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2511 }
2512
2513 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2514 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2515 {
2516 pBeaconParams->fLsigTXOPProtectionFullSupport =
2517 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2518 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2519 pBeaconParams->paramChangeBitmap |=
2520 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2521 }
2522
2523 // For Station just update the global lim variable, no need to send message to HAL
2524 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2525 //stations in overlapping BSS.
2526 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2527 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2528
2529 }
2530}
2531
2532
2533/**
2534 * limProcessChannelSwitchTimeout()
2535 *
2536 *FUNCTION:
2537 * This function is invoked when Channel Switch Timer expires at
2538 * the STA. Now, STA must stop traffic, and then change/disable
2539 * primary or secondary channel.
2540 *
2541 *
2542 *NOTE:
2543 * @param pMac - Pointer to Global MAC structure
2544 * @return None
2545 */
2546void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2547{
2548 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002549 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002550
2551 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2552 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002553 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 return;
2555 }
2556
2557 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2558 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002559 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 -07002560 return;
2561 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002562 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 /*
2564 * This potentially can create issues if the function tries to set
2565 * channel while device is in power-save, hence putting an extra check
2566 * to verify if the device is in power-save or not
2567 */
2568 if(!limIsSystemInActiveState(pMac))
2569 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002570 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 return;
2572 }
2573
2574 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002576
2577 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002578 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002579
2580 /* Check if the AP is switching to a channel that we support.
2581 * Else, just don't bother to switch. Indicate HDD to look for a
2582 * better AP to associate
2583 */
2584 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2585 {
2586 /* We need to restore pre-channelSwitch state on the STA */
2587 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2588 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002589 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 return;
2591 }
2592
2593 /* If the channel-list that AP is asking us to switch is invalid,
2594 * then we cannot switch the channel. Just disassociate from AP.
2595 * We will find a better AP !!!
2596 */
2597 limTearDownLinkWithAp(pMac,
2598 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2599 eSIR_MAC_UNSPEC_FAILURE_REASON);
2600 return;
2601 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002602 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2603 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002604 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 {
2606 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002607 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
2608 if ( isLimSessionOffChannel(pMac,
2609 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId) )
2610 {
2611 limSuspendLink(pMac,
2612 eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2613 limProcessChannelSwitchSuspendLink,
2614 (tANI_U32*)psessionEntry );
2615 }
2616 else
2617 {
2618 limProcessChannelSwitchSuspendLink(pMac,
2619 eHAL_STATUS_SUCCESS,
2620 (tANI_U32*)psessionEntry);
2621 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 break;
2623
2624 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002625 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002626 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002628 psessionEntry->gLimChannelSwitch.secondarySubBand);
2629 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 case eLIM_CHANNEL_SWITCH_IDLE:
2632 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002633 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2635 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002636 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 }
2638 return; /* Please note, this is 'return' and not 'break' */
2639 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002640}
Jeff Johnson295189b2012-06-20 16:38:30 -07002641
2642/**
2643 * limUpdateChannelSwitch()
2644 *
2645 *FUNCTION:
2646 * This function is invoked whenever Station receives
2647 * either 802.11h channel switch IE or airgo proprietary
2648 * channel switch IE.
2649 *
2650 *NOTE:
2651 * @param pMac - Pointer to Global MAC structure
2652 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2653 * @param psessionentry
2654 */
2655void
2656limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2657{
2658
2659 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2661 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002662#ifdef WLAN_FEATURE_11AC
2663 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2664#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002665
Jeff Johnsone7245742012-09-05 17:12:55 -07002666 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002667
2668 /* STA either received proprietary channel switch IE or 802.11h
2669 * standard channel switch IE.
2670 */
2671 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2672 {
2673 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2674
2675 /* Add logic to determine which change this is: */
2676 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002677 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2678 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2679 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2680 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2681 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002683 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 }
2685 else
2686 {
2687 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002688 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2689 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2690 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002692 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002693#ifdef WLAN_FEATURE_11AC
2694 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2695 if(pBeacon->WiderBWChanSwitchAnnPresent)
2696 {
2697 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2698 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2699 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2700 }
2701#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002702
2703 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002704 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2705 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002706
2707 /* Do not bother to look and operate on extended channel switch element
2708 * if our own channel-bonding state is not enabled
2709 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002710 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 {
2712 if (pBeacon->extChannelSwitchPresent)
2713 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002714 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2715 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002717 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2718 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002720#ifdef WLAN_FEATURE_11AC
2721 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2722 {
2723 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2724 {
2725 if(pBeacon->extChannelSwitchPresent)
2726 {
2727 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2728 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2729 {
2730 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2731 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2732 psessionEntry->gLimChannelSwitch.primaryChannel,
2733 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2734 pWiderChnlSwitch->newCenterChanFreq0,
2735 psessionEntry);
2736 }
2737 }
2738 }
2739 }
2740#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002741 }
2742 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002743 }
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08002744
2745
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2747 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002748 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 }
2750
2751 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002752 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002753 psessionEntry->peSessionId,
2754 psessionEntry->gLimChannelSwitch.primaryChannel,
2755 psessionEntry->gLimChannelSwitch.secondarySubBand,
2756 psessionEntry->gLimChannelSwitch.switchCount,
2757 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 return;
2759}
2760
2761/**
2762 * limCancelDot11hChannelSwitch
2763 *
2764 *FUNCTION:
2765 * This function is called when STA does not send updated channel-swith IE
2766 * after indicating channel-switch start. This will cancel the channel-swith
2767 * timer which is already running.
2768 *
2769 *LOGIC:
2770 *
2771 *ASSUMPTIONS:
2772 *
2773 *NOTE:
2774 *
2775 * @param pMac - Pointer to Global MAC structure
2776 *
2777 * @return None
2778 */
2779void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2780{
Jeff Johnson295189b2012-06-20 16:38:30 -07002781 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2782 return;
2783
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002784 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002785 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002786
2787 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2788 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002789 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 }
2791
2792 /* We need to restore pre-channelSwitch state on the STA */
2793 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002795 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002796
2797 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002798}
2799
2800/**----------------------------------------------
2801\fn limCancelDot11hQuiet
2802\brief Cancel the quieting on Station if latest
2803 beacon doesn't contain quiet IE in it.
2804
2805\param pMac
2806\return NONE
2807-----------------------------------------------*/
2808void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2809{
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2811 return;
2812
Jeff Johnsone7245742012-09-05 17:12:55 -07002813 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002814 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002815 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2817 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002818 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 }
2820 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002821 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002823 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2825 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002826 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 }
2828 /**
2829 * If the channel switch is already running in silent mode, dont resume the
2830 * transmission. Channel switch timer when timeout, transmission will be resumed.
2831 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002832 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2833 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 {
2835 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002836 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 }
2838 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002839 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002840}
2841
2842/**
2843 * limProcessQuietTimeout
2844 *
2845 * FUNCTION:
2846 * This function is active only on the STA.
2847 * Handles SIR_LIM_QUIET_TIMEOUT
2848 *
2849 * LOGIC:
2850 * This timeout can occur under only one circumstance:
2851 *
2852 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2853 * This indicates that the timeout "interval" has
2854 * expired. This is a trigger for the STA to now
2855 * shut-off Tx/Rx for the specified gLimQuietDuration
2856 * -> The TIMER object gLimQuietBssTimer is
2857 * activated
2858 * -> With timeout = gLimQuietDuration
2859 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2860 *
2861 * ASSUMPTIONS:
2862 * Using two TIMER objects -
2863 * gLimQuietTimer & gLimQuietBssTimer
2864 *
2865 * NOTE:
2866 *
2867 * @param pMac - Pointer to Global MAC structure
2868 *
2869 * @return None
2870 */
2871void limProcessQuietTimeout(tpAniSirGlobal pMac)
2872{
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 //fetch the sessionEntry based on the sessionId
2874 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002875 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002876
Jeff Johnsone7245742012-09-05 17:12:55 -07002877 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002878 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002879 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 return;
2881 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002882
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002883 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 {
2886 case eLIM_QUIET_BEGIN:
2887 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002888 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2889 if (TX_SUCCESS !=
2890 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2891 {
2892 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002893 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002894 }
2895
2896 // gLimQuietDuration appears to be in units of ticks
2897 // Use it as is
2898 if (TX_SUCCESS !=
2899 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2900 psessionEntry->gLimSpecMgmt.quietDuration,
2901 0))
2902 {
2903 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002904 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002905 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002906 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002907#ifdef GEN6_TODO
2908 /* revisit this piece of code to assign the appropriate sessionId below
2909 * priority - HIGH
2910 */
2911 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2912#endif
2913 if( TX_SUCCESS !=
2914 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2915 {
2916 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002917 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002918 }
2919 else
2920 {
2921 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002922 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002923
2924 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2925 /* print message, otherwise, stop data traffic and stay quiet */
2926 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2927 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2928 {
2929 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002930 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002931 }
2932 else
2933 {
2934 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2935 /* freeze the transmission */
2936 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2937
2938 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002939 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002940 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 }
2942 }
2943 break;
2944
2945 case eLIM_QUIET_RUNNING:
2946 case eLIM_QUIET_INIT:
2947 case eLIM_QUIET_END:
2948 default:
2949 //
2950 // As of now, nothing to be done
2951 //
2952 break;
2953 }
2954}
2955
2956/**
2957 * limProcessQuietBssTimeout
2958 *
2959 * FUNCTION:
2960 * This function is active on the AP and STA.
2961 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2962 *
2963 * LOGIC:
2964 * On the AP -
2965 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2966 * an indication for the AP to START sending out the
2967 * Quiet BSS IE.
2968 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2969 * the 11H spec
2970 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2971 * a Proprietary IE. This will be understood by all the
2972 * TITAN STA's
2973 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2974 * initiate the SCH to include the Quiet BSS IE in all
2975 * its subsequent Beacons/PR's.
2976 * The Quiet BSS IE will be included in all the Beacons
2977 * & PR's until the next DTIM period
2978 *
2979 * On the STA -
2980 * When gLimQuietState = eLIM_QUIET_RUNNING
2981 * This indicates that the STA was successfully shut-off
2982 * for the specified gLimQuietDuration. This is a trigger
2983 * for the STA to now resume data traffic.
2984 * -> gLimQuietState is set to eLIM_QUIET_INIT
2985 *
2986 * ASSUMPTIONS:
2987 *
2988 * NOTE:
2989 *
2990 * @param pMac - Pointer to Global MAC structure
2991 *
2992 * @return None
2993 */
2994void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2995{
Jeff Johnsone7245742012-09-05 17:12:55 -07002996 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002997
Jeff Johnsone7245742012-09-05 17:12:55 -07002998 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003000 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 return;
3002 }
3003
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003004 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07003005 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07003006 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 }
3008 else
3009 {
3010 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07003011 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003012 {
3013 case eLIM_QUIET_RUNNING:
3014 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003015 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003016
3017 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3018 {
3019 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003020 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3021 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 {
3023 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003024 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 }
3026
3027 /* Reset status flag */
3028 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3029 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3030
3031 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003032 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 }
3034 else
3035 {
3036 //
3037 // Nothing specific to be done in this case
3038 // A background scan that was triggered during
3039 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3040 //
3041 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003042 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 }
3044 break;
3045
3046 case eLIM_QUIET_INIT:
3047 case eLIM_QUIET_BEGIN:
3048 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003049 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 /* If the quiet period has ended, then resume the frame transmission */
3051 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003052 limRestorePreQuietState(pMac, psessionEntry);
3053 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 break;
3055
3056 default:
3057 //
3058 // As of now, nothing to be done
3059 //
3060 break;
3061 }
3062 }
3063}
Jeff Johnson295189b2012-06-20 16:38:30 -07003064/**
3065 * limProcessWPSOverlapTimeout
3066 *
3067 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3068 *
3069 * LOGIC:
3070 *
3071 * ASSUMPTIONS:
3072 *
3073 * NOTE:
3074 *
3075 * @param pMac - Pointer to Global MAC structure
3076 *
3077 * @return None
3078 */
3079#if 0
3080void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3081{
3082
3083 tpPESession psessionEntry;
3084 tANI_U32 sessionId;
3085
3086 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3087 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003088 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 }
3090
3091 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3092
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003093 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003094
3095 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3096 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003097 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003098 return;
3099 }
3100
3101 limWPSPBCTimeout(pMac, psessionEntry);
3102}
3103#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003104
Jeff Johnson295189b2012-06-20 16:38:30 -07003105/**----------------------------------------------
3106\fn limStartQuietTimer
3107\brief Starts the quiet timer.
3108
3109\param pMac
3110\return NONE
3111-----------------------------------------------*/
3112void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3113{
3114 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303115 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003116
3117 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003118 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 return;
3120 }
3121
Jeff Johnson295189b2012-06-20 16:38:30 -07003122
3123 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3124 return;
3125 // First, de-activate Timer, if its already active
3126 limCancelDot11hQuiet(pMac, psessionEntry);
3127
Jeff Johnsone7245742012-09-05 17:12:55 -07003128 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3129 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3130 {
3131 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003132 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003133 }
3134
3135 // Set the NEW timeout value, in ticks
3136 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3137 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3138 {
3139 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003140 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003141 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003142
3143 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3144 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3145 {
3146 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003147 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003148 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003149
Jeff Johnsone7245742012-09-05 17:12:55 -07003150 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003151 return;
3152 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003153}
3154
Jeff Johnson295189b2012-06-20 16:38:30 -07003155
3156/** ------------------------------------------------------------------------ **/
3157/**
3158 * keep track of the number of ANI peers associated in the BSS
3159 * For the first and last ANI peer, we have to update EDCA params as needed
3160 *
3161 * When the first ANI peer joins the BSS, we notify SCH
3162 * When the last ANI peer leaves the BSS, we notfiy SCH
3163 */
3164void
3165limUtilCountStaAdd(
3166 tpAniSirGlobal pMac,
3167 tpDphHashNode pSta,
3168 tpPESession psessionEntry)
3169{
3170
3171 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3172 return;
3173
3174 pSta->fAniCount = 1;
3175
3176 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3177 return;
3178
3179 // get here only if this is the first ANI peer in the BSS
3180 schEdcaProfileUpdate(pMac, psessionEntry);
3181}
3182
3183void
3184limUtilCountStaDel(
3185 tpAniSirGlobal pMac,
3186 tpDphHashNode pSta,
3187 tpPESession psessionEntry)
3188{
3189
3190 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3191 return;
3192
3193 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3194 * then go ahead and update the count and profiles. This ensures
3195 * that the "number of ani station" count is properly incremented/decremented.
3196 */
3197 if (pSta->valid == 1)
3198 return;
3199
3200 pSta->fAniCount = 0;
3201
3202 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3203 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003204 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003205 pMac->lim.gLimNumOfAniSTAs);
3206 return;
3207 }
3208
3209 pMac->lim.gLimNumOfAniSTAs--;
3210
3211 if (pMac->lim.gLimNumOfAniSTAs != 0)
3212 return;
3213
3214 // get here only if this is the last ANI peer in the BSS
3215 schEdcaProfileUpdate(pMac, psessionEntry);
3216}
3217
Jeff Johnson295189b2012-06-20 16:38:30 -07003218/**
3219 * limSwitchChannelCback()
3220 *
3221 *FUNCTION:
3222 * This is the callback function registered while requesting to switch channel
3223 * after AP indicates a channel switch for spectrum management (11h).
3224 *
3225 *NOTE:
3226 * @param pMac Pointer to Global MAC structure
3227 * @param status Status of channel switch request
3228 * @param data User data
3229 * @param psessionEntry Session information
3230 * @return NONE
3231 */
3232void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3233 tANI_U32 *data, tpPESession psessionEntry)
3234{
3235 tSirMsgQ mmhMsg = {0};
3236 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3237
Jeff Johnson295189b2012-06-20 16:38:30 -07003238 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3239
3240 /* We need to restore pre-channelSwitch state on the STA */
3241 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3242 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003243 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003244 return;
3245 }
3246
3247 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303248 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3249 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003251 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 return;
3253 }
3254
3255 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3256 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003257 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3259 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303260 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3262 mmhMsg.bodyval = 0;
3263
Jeff Johnsone7245742012-09-05 17:12:55 -07003264 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003265
Jeff Johnson295189b2012-06-20 16:38:30 -07003266 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003267}
3268
3269/**
3270 * limSwitchPrimaryChannel()
3271 *
3272 *FUNCTION:
3273 * This function changes the current operating channel
3274 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3275 *
3276 *NOTE:
3277 * @param pMac Pointer to Global MAC structure
3278 * @param newChannel new chnannel ID
3279 * @return NONE
3280 */
3281void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3282{
3283#if !defined WLAN_FEATURE_VOWIFI
3284 tANI_U32 localPwrConstraint;
3285#endif
3286
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003287 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 psessionEntry->currentOperChannel, newChannel);)
3289 psessionEntry->currentReqChannel = newChannel;
3290 psessionEntry->limRFBand = limGetRFBand(newChannel);
3291
3292 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3293
3294 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3295 pMac->lim.gpchangeChannelData = NULL;
3296
3297#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003298 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003299 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3300#else
3301 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3302 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003303 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003304 return;
3305 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003306 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3308#endif
3309 return;
3310}
3311
3312/**
3313 * limSwitchPrimarySecondaryChannel()
3314 *
3315 *FUNCTION:
3316 * This function changes the primary and secondary channel.
3317 * If 11h is enabled and user provides a "new channel ID"
3318 * that is different from the current operating channel,
3319 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3320 * assign notify LIM of such change.
3321 *
3322 *NOTE:
3323 * @param pMac Pointer to Global MAC structure
3324 * @param newChannel New chnannel ID (or current channel ID)
3325 * @param subband CB secondary info:
3326 * - eANI_CB_SECONDARY_NONE
3327 * - eANI_CB_SECONDARY_UP
3328 * - eANI_CB_SECONDARY_DOWN
3329 * @return NONE
3330 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003331void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003332{
3333#if !defined WLAN_FEATURE_VOWIFI
3334 tANI_U32 localPwrConstraint;
3335#endif
3336
Jeff Johnson295189b2012-06-20 16:38:30 -07003337#if !defined WLAN_FEATURE_VOWIFI
3338 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003339 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 return;
3341 }
3342#endif
3343
Jeff Johnson295189b2012-06-20 16:38:30 -07003344#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003345 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003346#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003347 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003348#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003349
Jeff Johnsone7245742012-09-05 17:12:55 -07003350 // Store the new primary and secondary channel in session entries if different
3351 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 {
3353 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003354 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003356 psessionEntry->currentOperChannel = newChannel;
3357 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003358 if (psessionEntry->htSecondaryChannelOffset != subband)
3359 {
3360 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003361 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003362 psessionEntry->htSecondaryChannelOffset, subband);
3363 psessionEntry->htSecondaryChannelOffset = subband;
3364 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3365 {
3366 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3367 }
3368 else
3369 {
3370 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3371 }
3372 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3373 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003374
3375 return;
3376}
3377
3378
3379/**
3380 * limActiveScanAllowed()
3381 *
3382 *FUNCTION:
3383 * Checks if active scans are permitted on the given channel
3384 *
3385 *LOGIC:
3386 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3387 * Need to check if the channelNum matches, then depending on the corresponding
3388 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3389 *
3390 *ASSUMPTIONS:
3391 *
3392 *NOTE:
3393 *
3394 * @param pMac Pointer to Global MAC structure
3395 * @param channelNum channel number
3396 * @return None
3397 */
3398
3399tANI_U8 limActiveScanAllowed(
3400 tpAniSirGlobal pMac,
3401 tANI_U8 channelNum)
3402{
3403 tANI_U32 i;
3404 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3405 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3406 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3407 != eSIR_SUCCESS)
3408 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003409 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 return false;
3411 }
3412
3413 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3414 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003415 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 len);
3417 return false;
3418 }
3419
3420 for (i=0; (i+1) < len; i+=2)
3421 {
3422 if (channelPair[i] == channelNum)
3423 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3424 }
3425 return false;
3426}
3427
3428/**
3429 * limTriggerBackgroundScanDuringQuietBss()
3430 *
3431 *FUNCTION:
3432 * This function is applicable to the STA only.
3433 * This function is called by limProcessQuietTimeout(),
3434 * when it is time to honor the Quiet BSS IE from the AP.
3435 *
3436 *LOGIC:
3437 * If 11H is enabled:
3438 * We cannot trigger a background scan. The STA needs to
3439 * shut-off Tx/Rx.
3440 * If 11 is not enabled:
3441 * Determine if the next channel that we are going to
3442 * scan is NOT the same channel (or not) on which the
3443 * Quiet BSS was requested.
3444 * If yes, then we cannot trigger a background scan on
3445 * this channel. Return with a false.
3446 * If no, then trigger a background scan. Return with
3447 * a true.
3448 *
3449 *ASSUMPTIONS:
3450 *
3451 *NOTE:
3452 * This API is redundant if the existing API,
3453 * limTriggerBackgroundScan(), were to return a valid
3454 * response instead of returning void.
3455 * If possible, try to revisit this API
3456 *
3457 * @param pMac Pointer to Global MAC structure
3458 * @return eSIR_TRUE, if a background scan was attempted
3459 * eSIR_FALSE, if not
3460 */
3461tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3462{
3463 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003464
3465
3466
3467 //TBD-RAJESH HOW TO GET sessionEntry?????
3468 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3469
3470 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3471 return bScanTriggered;
3472
Jeff Johnsone7245742012-09-05 17:12:55 -07003473 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 {
3475 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3476 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3477
3478 // Determine the next scan channel
3479
3480 // Get background scan channel list from CFG
3481 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3482 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3483 (tANI_U8 *) bgScanChannelList,
3484 (tANI_U32 *) &len ))
3485 {
3486 // Ensure that we do not go off scanning on the same
3487 // channel on which the Quiet BSS was requested
3488 if( psessionEntry->currentOperChannel!=
3489 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3490 {
3491 // For now, try and attempt a background scan. It will
3492 // be ideal if this API actually returns a success or
3493 // failure instead of having a void return type
3494 limTriggerBackgroundScan( pMac );
3495
3496 bScanTriggered = eSIR_TRUE;
3497 }
3498 else
3499 {
3500 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003501 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 -07003502 }
3503 }
3504 else
3505 {
3506 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003507 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 -07003508 }
3509 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 return bScanTriggered;
3511}
3512
3513
3514/**
3515 * limGetHTCapability()
3516 *
3517 *FUNCTION:
3518 * A utility function that returns the "current HT capability state" for the HT
3519 * capability of interest (as requested in the API)
3520 *
3521 *LOGIC:
3522 * This routine will return with the "current" setting of a requested HT
3523 * capability. This state info could be retrieved from -
3524 * a) CFG (for static entries)
3525 * b) Run time info
3526 * - Dynamic state maintained by LIM
3527 * - Configured at radio init time by SME
3528 *
3529 *
3530 *ASSUMPTIONS:
3531 * NA
3532 *
3533 *NOTE:
3534 *
3535 * @param pMac Pointer to Global MAC structure
3536 * @param htCap The HT capability being queried
3537 * @return tANI_U8 The current state of the requested HT capability is returned in a
3538 * tANI_U8 variable
3539 */
3540
Jeff Johnson295189b2012-06-20 16:38:30 -07003541tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3542 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003543{
3544tANI_U8 retVal = 0;
3545tANI_U8 *ptr;
3546tANI_U32 cfgValue;
3547tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3548tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3549tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3550tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3551
3552 //
3553 // Determine which CFG to read from. Not ALL of the HT
3554 // related CFG's need to be read each time this API is
3555 // accessed
3556 //
3557 if( htCap >= eHT_ANTENNA_SELECTION &&
3558 htCap < eHT_SI_GRANULARITY )
3559 {
3560 // Get Antenna Seletion HT Capabilities
3561 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3562 cfgValue = 0;
3563 ptr = (tANI_U8 *) &macASCapabilityInfo;
3564 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3565 }
3566 else
3567 {
3568 if( htCap >= eHT_TX_BEAMFORMING &&
3569 htCap < eHT_ANTENNA_SELECTION )
3570 {
3571 // Get Transmit Beam Forming HT Capabilities
3572 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3573 cfgValue = 0;
3574 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3575 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3576 }
3577 else
3578 {
3579 if( htCap >= eHT_PCO &&
3580 htCap < eHT_TX_BEAMFORMING )
3581 {
3582 // Get Extended HT Capabilities
3583 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3584 cfgValue = 0;
3585 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3586 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3587 }
3588 else
3589 {
3590 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3591 {
3592 // Get HT Capabilities
3593 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3594 cfgValue = 0;
3595 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3596 // 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
3597 *ptr++ = cfgValue & 0xff;
3598 *ptr = (cfgValue >> 8) & 0xff;
3599 }
3600 }
3601 }
3602 }
3603
3604 switch( htCap )
3605 {
3606 case eHT_LSIG_TXOP_PROTECTION:
3607 retVal = pMac->lim.gHTLsigTXOPProtection;
3608 break;
3609
3610 case eHT_STBC_CONTROL_FRAME:
3611 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3612 break;
3613
3614 case eHT_PSMP:
3615 retVal = pMac->lim.gHTPSMPSupport;
3616 break;
3617
3618 case eHT_DSSS_CCK_MODE_40MHZ:
3619 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3620 break;
3621
3622 case eHT_MAX_AMSDU_LENGTH:
3623 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3624 break;
3625
3626 case eHT_DELAYED_BA:
3627 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3628 break;
3629
3630 case eHT_RX_STBC:
3631 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3632 break;
3633
3634 case eHT_TX_STBC:
3635 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3636 break;
3637
3638 case eHT_SHORT_GI_40MHZ:
3639 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3640 break;
3641
3642 case eHT_SHORT_GI_20MHZ:
3643 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3644 break;
3645
3646 case eHT_GREENFIELD:
3647 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3648 break;
3649
3650 case eHT_MIMO_POWER_SAVE:
3651 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3652 break;
3653
3654 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003655 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003656 break;
3657
3658 case eHT_ADVANCED_CODING:
3659 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3660 break;
3661
3662 case eHT_MAX_RX_AMPDU_FACTOR:
3663 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3664 break;
3665
3666 case eHT_MPDU_DENSITY:
3667 retVal = pMac->lim.gHTAMpduDensity;
3668 break;
3669
3670 case eHT_PCO:
3671 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3672 break;
3673
3674 case eHT_TRANSITION_TIME:
3675 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3676 break;
3677
3678 case eHT_MCS_FEEDBACK:
3679 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3680 break;
3681
3682 case eHT_TX_BEAMFORMING:
3683 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3684 break;
3685
3686 case eHT_ANTENNA_SELECTION:
3687 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3688 break;
3689
3690 case eHT_SI_GRANULARITY:
3691 retVal = pMac->lim.gHTServiceIntervalGranularity;
3692 break;
3693
3694 case eHT_CONTROLLED_ACCESS:
3695 retVal = pMac->lim.gHTControlledAccessOnly;
3696 break;
3697
3698 case eHT_RIFS_MODE:
3699 retVal = psessionEntry->beaconParams.fRIFSMode;
3700 break;
3701
3702 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003703 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 break;
3705
3706 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003707 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 break;
3709
3710 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3712 retVal = psessionEntry->htOperMode;
3713 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 retVal = pMac->lim.gHTOperMode;
3715 break;
3716
3717 case eHT_BASIC_STBC_MCS:
3718 retVal = pMac->lim.gHTSTBCBasicMCS;
3719 break;
3720
3721 case eHT_DUAL_CTS_PROTECTION:
3722 retVal = pMac->lim.gHTDualCTSProtection;
3723 break;
3724
3725 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3726 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3727 break;
3728
3729 case eHT_PCO_ACTIVE:
3730 retVal = pMac->lim.gHTPCOActive;
3731 break;
3732
3733 case eHT_PCO_PHASE:
3734 retVal = pMac->lim.gHTPCOPhase;
3735 break;
3736
3737 default:
3738 break;
3739 }
3740
3741 return retVal;
3742}
3743
Jeff Johnson295189b2012-06-20 16:38:30 -07003744void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3745{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303746 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 return;
3748}
3749
3750
3751
3752
3753/** -------------------------------------------------------------
3754\fn limEnable11aProtection
3755\brief based on config setting enables\disables 11a protection.
3756\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3757\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3758\param tpUpdateBeaconParams pBeaconParams
3759\return None
3760 -------------------------------------------------------------*/
3761tSirRetStatus
3762limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3763 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3764{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003765 if(NULL == psessionEntry)
3766 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003767 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003768 return eSIR_FAILURE;
3769 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 //overlapping protection configuration check.
3771 if(overlap)
3772 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 }
3774 else
3775 {
3776 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003777 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003778 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 {
3780 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003781 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 return eSIR_SUCCESS;
3783 }
3784 }
3785
3786 if (enable)
3787 {
3788 //If we are AP and HT capable, we need to set the HT OP mode
3789 //appropriately.
3790 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003791 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003792 {
3793 if(overlap)
3794 {
3795 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3796 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3797 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3798 {
3799 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3800 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3801 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3802 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3803 }
3804 }
3805 else
3806 {
3807 psessionEntry->gLim11aParams.protectionEnabled = true;
3808 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3809 {
3810 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003811 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003812 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3813 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3814
3815 }
3816 }
3817 }
3818
3819 //This part is common for staiton as well.
3820 if(false == psessionEntry->beaconParams.llaCoexist)
3821 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003822 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003823 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3824 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3825 }
3826 }
3827 else if (true == psessionEntry->beaconParams.llaCoexist)
3828 {
3829 //for AP role.
3830 //we need to take care of HT OP mode change if needed.
3831 //We need to take care of Overlap cases.
3832 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3833 {
3834 if(overlap)
3835 {
3836 //Overlap Legacy protection disabled.
3837 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3838
3839 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003840 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 {
3842 // no HT op mode change if any of the overlap protection enabled.
3843 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3844 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3845 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3846
3847 {
3848 //Check if there is a need to change HT OP mode.
3849 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3850 {
3851 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3852 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3853
3854 if(psessionEntry->gLimHt20Params.protectionEnabled)
3855 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3856 else
3857 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3858 }
3859 }
3860 }
3861 }
3862 else
3863 {
3864 //Disable protection from 11A stations.
3865 psessionEntry->gLim11aParams.protectionEnabled = false;
3866 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3867
3868 //Check if any other non-HT protection enabled.
3869 //Right now we are in HT OP Mixed mode.
3870 //Change HT op mode appropriately.
3871
3872 //Change HT OP mode to 01 if any overlap protection enabled
3873 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3874 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3875 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3876
3877 {
3878 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003879 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3881 }
3882 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3883 {
3884 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003885 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3887 }
3888 else
3889 {
3890 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003891 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3893 }
3894 }
3895 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3896 !psessionEntry->gLim11aParams.protectionEnabled)
3897 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003898 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3900 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3901 }
3902 }
3903 //for station role
3904 else
3905 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003906 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003907 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3908 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3909 }
3910 }
3911
3912 return eSIR_SUCCESS;
3913}
3914
3915/** -------------------------------------------------------------
3916\fn limEnable11gProtection
3917\brief based on config setting enables\disables 11g protection.
3918\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3919\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3920\param tpUpdateBeaconParams pBeaconParams
3921\return None
3922 -------------------------------------------------------------*/
3923
3924tSirRetStatus
3925limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3926 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3927{
3928
3929 //overlapping protection configuration check.
3930 if(overlap)
3931 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 }
3933 else
3934 {
3935 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3937 !psessionEntry->cfgProtection.fromllb)
3938 {
3939 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003940 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 return eSIR_SUCCESS;
3942 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003943 {
3944 if(!pMac->lim.cfgProtection.fromllb)
3945 {
3946 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003947 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 return eSIR_SUCCESS;
3949 }
3950 }
3951 }
3952
3953 if (enable)
3954 {
3955 //If we are AP and HT capable, we need to set the HT OP mode
3956 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3958 {
3959 if(overlap)
3960 {
3961 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003962 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003963 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 {
3965 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3966 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3967 {
3968 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3969 }
3970 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3971 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3972 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3973 //Not processing OBSS bit from other APs, as we are already taking care
3974 //of Protection from overlapping BSS based on erp IE or useProtection bit
3975 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3976 }
3977 }
3978 else
3979 {
3980 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003981 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003982 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 {
3984 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3985 {
3986 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3987 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3988 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3989 }
3990 }
3991 }
3992 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003993 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003994 {
3995 if(overlap)
3996 {
3997 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3998 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3999 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4000 {
4001 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4002 }
4003 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4004 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
4005 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4006 //Not processing OBSS bit from other APs, as we are already taking care
4007 //of Protection from overlapping BSS based on erp IE or useProtection bit
4008 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
4009 }
4010 else
4011 {
4012 psessionEntry->gLim11bParams.protectionEnabled = true;
4013 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4014 {
4015 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4016 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4017 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4018 }
4019 }
4020 }
4021
4022 //This part is common for staiton as well.
4023 if(false == psessionEntry->beaconParams.llbCoexist)
4024 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004025 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4027 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4028 }
4029 }
4030 else if (true == psessionEntry->beaconParams.llbCoexist)
4031 {
4032 //for AP role.
4033 //we need to take care of HT OP mode change if needed.
4034 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4036 {
4037 if(overlap)
4038 {
4039 //Overlap Legacy protection disabled.
4040 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4041
4042 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004043 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 {
4045 // no HT op mode change if any of the overlap protection enabled.
4046 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4047 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4048 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4049 {
4050 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004051 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 {
4053 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4054 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4055 if(psessionEntry->gLimHt20Params.protectionEnabled){
4056 //Commenting out beacuse of CR 258588 WFA cert
4057 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4058 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4059 }
4060 else
4061 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4062 }
4063 }
4064 }
4065 }
4066 else
4067 {
4068 //Disable protection from 11B stations.
4069 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004070 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 //Check if any other non-HT protection enabled.
4072 if(!psessionEntry->gLim11gParams.protectionEnabled)
4073 {
4074 //Right now we are in HT OP Mixed mode.
4075 //Change HT op mode appropriately.
4076 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4077
4078 //Change HT OP mode to 01 if any overlap protection enabled
4079 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4080 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4081 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4082 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4083 {
4084 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004085 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004086 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4087 }
4088 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4089 {
4090 //Commenting because of CR 258588 WFA cert
4091 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4092 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004093 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4095 }
4096 else
4097 {
4098 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4099 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4100 }
4101 }
4102 }
4103 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4104 !psessionEntry->gLim11bParams.protectionEnabled)
4105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004106 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4108 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4109 }
4110 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 {
4112 if(overlap)
4113 {
4114 //Overlap Legacy protection disabled.
4115 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4116
4117 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004118 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 {
4120 // no HT op mode change if any of the overlap protection enabled.
4121 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4122 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4123 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4124
4125 {
4126 //Check if there is a need to change HT OP mode.
4127 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4128 {
4129 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4130 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4131 if(psessionEntry->gLimHt20Params.protectionEnabled)
4132 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4133 else
4134 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4135 }
4136 }
4137 }
4138 }
4139 else
4140 {
4141 //Disable protection from 11B stations.
4142 psessionEntry->gLim11bParams.protectionEnabled = false;
4143 //Check if any other non-HT protection enabled.
4144 if(!psessionEntry->gLim11gParams.protectionEnabled)
4145 {
4146 //Right now we are in HT OP Mixed mode.
4147 //Change HT op mode appropriately.
4148 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4149
4150 //Change HT OP mode to 01 if any overlap protection enabled
4151 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4152 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4153 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4154 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4155
4156 {
4157 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4158 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4159 }
4160 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4161 {
4162 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4163 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4164 }
4165 else
4166 {
4167 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4168 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4169 }
4170 }
4171 }
4172 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4173 !psessionEntry->gLim11bParams.protectionEnabled)
4174 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004175 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4177 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4178 }
4179 }
4180 //for station role
4181 else
4182 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004183 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4185 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4186 }
4187 }
4188 return eSIR_SUCCESS;
4189}
4190
4191/** -------------------------------------------------------------
4192\fn limEnableHtProtectionFrom11g
4193\brief based on cofig enables\disables protection from 11g.
4194\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4195\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4196\param tpUpdateBeaconParams pBeaconParams
4197\return None
4198 -------------------------------------------------------------*/
4199tSirRetStatus
4200limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4201 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4202{
Jeff Johnsone7245742012-09-05 17:12:55 -07004203 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4205
4206 //overlapping protection configuration check.
4207 if(overlap)
4208 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4210 {
4211 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004212 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004213 return eSIR_SUCCESS;
4214 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 {
4216 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004217 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 return eSIR_SUCCESS;
4219 }
4220 }
4221 else
4222 {
4223 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4225 !psessionEntry->cfgProtection.fromllg){
4226 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004227 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 return eSIR_SUCCESS;
4229 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004230 {
4231 if(!pMac->lim.cfgProtection.fromllg)
4232 {
4233 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004234 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 return eSIR_SUCCESS;
4236 }
4237 }
4238 }
4239 if (enable)
4240 {
4241 //If we are AP and HT capable, we need to set the HT OP mode
4242 //appropriately.
4243
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4245 {
4246 if(overlap)
4247 {
4248 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4249 //11g exists in overlap BSS.
4250 //need not to change the operating mode to overlap_legacy
4251 //if higher or same protection operating mode is enabled right now.
4252 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4253 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4254 {
4255 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4256 }
4257 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304258 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 }
4260 else
4261 {
4262 //11g is associated to an AP operating in 11n mode.
4263 //Change the HT operating mode to 'mixed mode'.
4264 psessionEntry->gLim11gParams.protectionEnabled = true;
4265 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4266 {
4267 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4268 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304269 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 }
4271 }
4272 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 {
4274 if(overlap)
4275 {
4276 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4277 //11g exists in overlap BSS.
4278 //need not to change the operating mode to overlap_legacy
4279 //if higher or same protection operating mode is enabled right now.
4280 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4281 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4282 {
4283 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4284 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4285 }
4286 }
4287 else
4288 {
4289 //11g is associated to an AP operating in 11n mode.
4290 //Change the HT operating mode to 'mixed mode'.
4291 psessionEntry->gLim11gParams.protectionEnabled = true;
4292 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4293 {
4294 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4295 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304296 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 }
4298 }
4299 }
4300
4301 //This part is common for staiton as well.
4302 if(false == psessionEntry->beaconParams.llgCoexist)
4303 {
4304 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4305 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4306 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4308 {
4309 // As operating mode changed after G station assoc some way to update beacon
4310 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4311 //pMac->sch.schObject.fBeaconChanged = 1;
4312 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4313 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 }
4315 else if (true == psessionEntry->beaconParams.llgCoexist)
4316 {
4317 //for AP role.
4318 //we need to take care of HT OP mode change if needed.
4319 //We need to take care of Overlap cases.
4320
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4322 {
4323 if(overlap)
4324 {
4325 //Overlap Legacy protection disabled.
4326 if (psessionEntry->gLim11gParams.numSta == 0)
4327 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4328
4329 // no HT op mode change if any of the overlap protection enabled.
4330 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4331 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4332 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4333 {
4334 //Check if there is a need to change HT OP mode.
4335 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4336 {
4337 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4338 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4339
4340 if(psessionEntry->gLimHt20Params.protectionEnabled){
4341 //Commenting because of CR 258588 WFA cert
4342 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4343 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4344 }
4345 else
4346 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4347 }
4348 }
4349 }
4350 else
4351 {
4352 //Disable protection from 11G stations.
4353 psessionEntry->gLim11gParams.protectionEnabled = false;
4354 //Check if any other non-HT protection enabled.
4355 if(!psessionEntry->gLim11bParams.protectionEnabled)
4356 {
4357
4358 //Right now we are in HT OP Mixed mode.
4359 //Change HT op mode appropriately.
4360 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4361
4362 //Change HT OP mode to 01 if any overlap protection enabled
4363 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4364 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4365 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4366 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4367
4368 {
4369 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4370 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4371 }
4372 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4373 {
4374 //Commenting because of CR 258588 WFA cert
4375 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4376 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4377 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4378 }
4379 else
4380 {
4381 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4382 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4383 }
4384 }
4385 }
4386 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4387 !psessionEntry->gLim11gParams.protectionEnabled)
4388 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004389 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4391 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4392 }
4393 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004394 {
4395 if(overlap)
4396 {
4397 //Overlap Legacy protection disabled.
4398 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4399
4400 // no HT op mode change if any of the overlap protection enabled.
4401 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4402 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4403 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4404 {
4405 //Check if there is a need to change HT OP mode.
4406 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4407 {
4408 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4409 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4410
4411 if(psessionEntry->gLimHt20Params.protectionEnabled)
4412 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4413 else
4414 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4415 }
4416 }
4417 }
4418 else
4419 {
4420 //Disable protection from 11G stations.
4421 psessionEntry->gLim11gParams.protectionEnabled = false;
4422 //Check if any other non-HT protection enabled.
4423 if(!psessionEntry->gLim11bParams.protectionEnabled)
4424 {
4425
4426 //Right now we are in HT OP Mixed mode.
4427 //Change HT op mode appropriately.
4428 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4429
4430 //Change HT OP mode to 01 if any overlap protection enabled
4431 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4432 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4433 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4434 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4435
4436 {
4437 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4438 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4439 }
4440 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4441 {
4442 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4443 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4444 }
4445 else
4446 {
4447 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4448 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4449 }
4450 }
4451 }
4452 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4453 !psessionEntry->gLim11gParams.protectionEnabled)
4454 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004455 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4457 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4458 }
4459 }
4460 //for station role
4461 else
4462 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004463 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4465 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4466 }
4467 }
4468 return eSIR_SUCCESS;
4469}
4470//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4471//This check will be done at the caller.
4472
4473/** -------------------------------------------------------------
4474\fn limEnableHtObssProtection
4475\brief based on cofig enables\disables obss protection.
4476\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4477\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4478\param tpUpdateBeaconParams pBeaconParams
4479\return None
4480 -------------------------------------------------------------*/
4481tSirRetStatus
4482limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4483 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4484{
4485
4486
Jeff Johnsone7245742012-09-05 17:12:55 -07004487 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004488 return eSIR_SUCCESS; // this protection is only for HT stations.
4489
4490 //overlapping protection configuration check.
4491 if(overlap)
4492 {
4493 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 }
4495 else
4496 {
4497 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4499 { //ToDo Update this field
4500 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004501 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 return eSIR_SUCCESS;
4503 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 {
4505 if(!pMac->lim.cfgProtection.obss)
4506 { //ToDo Update this field
4507 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004508 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 return eSIR_SUCCESS;
4510 }
4511 }
4512 }
4513
4514
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4516 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4517 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004518 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004519 psessionEntry->beaconParams.gHTObssMode = true;
4520 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4521
4522 }
4523 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4524 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004525 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 psessionEntry->beaconParams.gHTObssMode = false;
4527 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4528
4529 }
4530//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4531 if (!enable && !overlap)
4532 {
4533 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4534 }
4535 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 {
4537 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4538 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004539 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 psessionEntry->beaconParams.gHTObssMode = true;
4541 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4542
4543 }
4544 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4545 {
4546
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004547 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 psessionEntry->beaconParams.gHTObssMode = false;
4549 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4550
4551 }
4552 }
4553 return eSIR_SUCCESS;
4554}
4555/** -------------------------------------------------------------
4556\fn limEnableHT20Protection
4557\brief based on cofig enables\disables protection from Ht20.
4558\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4559\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4560\param tpUpdateBeaconParams pBeaconParams
4561\return None
4562 -------------------------------------------------------------*/
4563tSirRetStatus
4564limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4565 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4566{
Jeff Johnsone7245742012-09-05 17:12:55 -07004567 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 return eSIR_SUCCESS; // this protection is only for HT stations.
4569
4570 //overlapping protection configuration check.
4571 if(overlap)
4572 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 }
4574 else
4575 {
4576 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4578 !psessionEntry->cfgProtection.ht20)
4579 {
4580 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004581 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 return eSIR_SUCCESS;
4583 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 {
4585 if(!pMac->lim.cfgProtection.ht20)
4586 {
4587 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004588 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 return eSIR_SUCCESS;
4590 }
4591 }
4592 }
4593
4594 if (enable)
4595 {
4596 //If we are AP and HT capable, we need to set the HT OP mode
4597 //appropriately.
4598
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4600 if(overlap)
4601 {
4602 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4603 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4604 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4605 {
4606 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4607 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4608 }
4609 }
4610 else
4611 {
4612 psessionEntry->gLimHt20Params.protectionEnabled = true;
4613 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4614 {
4615 //Commenting because of CR 258588 WFA cert
4616 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4617 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4618 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4619 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4620 }
4621 }
4622 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 {
4624 if(overlap)
4625 {
4626 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4627 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4628 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4629 {
4630 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4631 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4632 }
4633 }
4634 else
4635 {
4636 psessionEntry->gLimHt20Params.protectionEnabled = true;
4637 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4638 {
4639 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4640 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4641 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4642 }
4643 }
4644 }
4645
4646 //This part is common for staiton as well.
4647 if(false == psessionEntry->beaconParams.ht20Coexist)
4648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004649 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4651 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4652 }
4653 }
4654 else if (true == psessionEntry->beaconParams.ht20Coexist)
4655 {
4656 //for AP role.
4657 //we need to take care of HT OP mode change if needed.
4658 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004659 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4660 if(overlap)
4661 {
4662 //Overlap Legacy protection disabled.
4663 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4664
4665 // no HT op mode change if any of the overlap protection enabled.
4666 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4667 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4668 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4669 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4670 {
4671
4672 //Check if there is a need to change HT OP mode.
4673 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4674 {
4675 if(psessionEntry->gLimHt20Params.protectionEnabled)
4676 {
4677 //Commented beacuse of CR 258588 for WFA Cert
4678 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4679 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4680 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4681 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4682 }
4683 else
4684 {
4685 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4686 }
4687 }
4688 }
4689 }
4690 else
4691 {
4692 //Disable protection from 11G stations.
4693 psessionEntry->gLimHt20Params.protectionEnabled = false;
4694
4695 //Change HT op mode appropriately.
4696 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4697 {
4698 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4699 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4700 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4701 }
4702 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004703 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004704 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4705 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4706 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004707 {
4708 if(overlap)
4709 {
4710 //Overlap Legacy protection disabled.
4711 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4712
4713 // no HT op mode change if any of the overlap protection enabled.
4714 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4715 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4716 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4717 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4718 {
4719
4720 //Check if there is a need to change HT OP mode.
4721 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4722 {
4723 if(psessionEntry->gLimHt20Params.protectionEnabled)
4724 {
4725 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4726 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4727 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4728 }
4729 else
4730 {
4731 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4732 }
4733 }
4734 }
4735 }
4736 else
4737 {
4738 //Disable protection from 11G stations.
4739 psessionEntry->gLimHt20Params.protectionEnabled = false;
4740
4741 //Change HT op mode appropriately.
4742 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4743 {
4744 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4745 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4746 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4747 }
4748 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004749 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004750 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4751 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4752 }
4753 //for station role
4754 else
4755 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004756 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4758 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4759 }
4760 }
4761
4762 return eSIR_SUCCESS;
4763}
4764
4765/** -------------------------------------------------------------
4766\fn limEnableHTNonGfProtection
4767\brief based on cofig enables\disables protection from NonGf.
4768\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4769\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4770\param tpUpdateBeaconParams pBeaconParams
4771\return None
4772 -------------------------------------------------------------*/
4773tSirRetStatus
4774limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4775 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4776{
Jeff Johnsone7245742012-09-05 17:12:55 -07004777 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 return eSIR_SUCCESS; // this protection is only for HT stations.
4779
4780 //overlapping protection configuration check.
4781 if(overlap)
4782 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004783 }
4784 else
4785 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 //normal protection config check
4787 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4788 !psessionEntry->cfgProtection.nonGf)
4789 {
4790 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004791 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 return eSIR_SUCCESS;
4793 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 {
4795 //normal protection config check
4796 if(!pMac->lim.cfgProtection.nonGf)
4797 {
4798 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004799 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 return eSIR_SUCCESS;
4801 }
4802 }
4803 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4805 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4806 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004807 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004808 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4809 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4810 }
4811 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4812 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004813 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4815 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4816 }
4817 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 {
4819 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004821 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4823 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4824 }
4825 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4826 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004827 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4829 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4830 }
4831 }
4832
4833 return eSIR_SUCCESS;
4834}
4835
4836/** -------------------------------------------------------------
4837\fn limEnableHTLsigTxopProtection
4838\brief based on cofig enables\disables LsigTxop protection.
4839\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4840\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4841\param tpUpdateBeaconParams pBeaconParams
4842\return None
4843 -------------------------------------------------------------*/
4844tSirRetStatus
4845limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4846 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4847{
Jeff Johnsone7245742012-09-05 17:12:55 -07004848 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 return eSIR_SUCCESS; // this protection is only for HT stations.
4850
4851 //overlapping protection configuration check.
4852 if(overlap)
4853 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004854 }
4855 else
4856 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 //normal protection config check
4858 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4859 !psessionEntry->cfgProtection.lsigTxop)
4860 {
4861 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004862 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 return eSIR_SUCCESS;
4864 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 {
4866 //normal protection config check
4867 if(!pMac->lim.cfgProtection.lsigTxop)
4868 {
4869 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004870 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 return eSIR_SUCCESS;
4872 }
4873 }
4874 }
4875
4876
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4878 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4879 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004880 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004881 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4882 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4883 }
4884 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4885 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004886 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4888 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4889 }
4890 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 {
4892 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004894 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4896 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4897 }
4898 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4899 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004900 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4902 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4903 }
4904 }
4905 return eSIR_SUCCESS;
4906}
4907//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4908//This check will be done at the caller.
4909/** -------------------------------------------------------------
4910\fn limEnableHtRifsProtection
4911\brief based on cofig enables\disables Rifs protection.
4912\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4913\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4914\param tpUpdateBeaconParams pBeaconParams
4915\return None
4916 -------------------------------------------------------------*/
4917tSirRetStatus
4918limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4919 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4920{
Jeff Johnsone7245742012-09-05 17:12:55 -07004921 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 return eSIR_SUCCESS; // this protection is only for HT stations.
4923
4924
4925 //overlapping protection configuration check.
4926 if(overlap)
4927 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 }
4929 else
4930 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 //normal protection config check
4932 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4933 !psessionEntry->cfgProtection.rifs)
4934 {
4935 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004936 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 return eSIR_SUCCESS;
4938 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 {
4940 //normal protection config check
4941 if(!pMac->lim.cfgProtection.rifs)
4942 {
4943 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004944 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 return eSIR_SUCCESS;
4946 }
4947 }
4948 }
4949
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4951 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4952 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004954 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4956 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4957 }
4958 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4959 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4960 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004961 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4963 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4964 }
4965 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 {
4967 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4968 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4969 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004970 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004971 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4972 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4973 }
4974 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4975 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4976 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004977 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4979 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4980 }
4981 }
4982 return eSIR_SUCCESS;
4983}
4984
4985// ---------------------------------------------------------------------
4986/**
4987 * limEnableShortPreamble
4988 *
4989 * FUNCTION:
4990 * Enable/Disable short preamble
4991 *
4992 * LOGIC:
4993 *
4994 * ASSUMPTIONS:
4995 *
4996 * NOTE:
4997 *
4998 * @param enable Flag to enable/disable short preamble
4999 * @return None
5000 */
5001
5002tSirRetStatus
5003limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
5004{
5005 tANI_U32 val;
5006
5007 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
5008 {
5009 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005010 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005011 return eSIR_FAILURE;
5012 }
5013
5014 if (!val)
5015 return eSIR_SUCCESS;
5016
5017 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5018 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005019 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005020 return eSIR_FAILURE;
5021 }
5022
5023 if (!val) // 11G short preamble switching is disabled.
5024 return eSIR_SUCCESS;
5025
5026 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5027 {
5028 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5029 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005030 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 psessionEntry->beaconParams.fShortPreamble = true;
5032 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5033 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5034 }
5035 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5036 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005037 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005038 psessionEntry->beaconParams.fShortPreamble = false;
5039 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5040 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5041 }
5042 }
5043
5044 return eSIR_SUCCESS;
5045 }
5046
5047/**
5048 * limTxComplete
5049 *
5050 * Function:
5051 * This is LIM's very own "TX MGMT frame complete" completion routine.
5052 *
5053 * Logic:
5054 * LIM wants to send a MGMT frame (broadcast or unicast)
5055 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5056 * LIM transmits the MGMT frame using the API:
5057 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5058 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5059 * HDD, if it determines that a TX completion routine (in this case
5060 * limTxComplete) has been provided, will invoke this callback
5061 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5062 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5063 *
5064 * Assumptions:
5065 * Presently, this is ONLY being used for MGMT frames/packets
5066 * TODO:
5067 * Would it do good for LIM to have some sort of "signature" validation to
5068 * ensure that the pData argument passed in was a buffer that was actually
5069 * allocated by LIM and/or is not corrupted?
5070 *
5071 * Note: FIXME and TODO
5072 * Looks like palPktFree() is interested in pPacket. But, when this completion
5073 * routine is called, only pData is made available to LIM!!
5074 *
5075 * @param void A pointer to pData. Shouldn't it be pPacket?!
5076 *
5077 * @return none
5078 */
5079void limTxComplete( tHalHandle hHal, void *pData )
5080{
5081 tpAniSirGlobal pMac;
5082 pMac = (tpAniSirGlobal)hHal;
5083
5084#ifdef FIXME_PRIMA
5085 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5086#ifdef TRACE_RECORD
5087 {
5088 tpSirMacMgmtHdr mHdr;
5089 v_U8_t *pRxBd;
5090 vos_pkt_t *pVosPkt;
5091 VOS_STATUS vosStatus;
5092
5093
5094
5095 pVosPkt = (vos_pkt_t *)pData;
5096 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5097
5098 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5099 {
5100 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnson295189b2012-06-20 16:38:30 -07005101
5102 }
5103 }
5104#endif
5105#endif
5106
5107 palPktFree( pMac->hHdd,
5108 HAL_TXRX_FRM_802_11_MGMT,
5109 (void *) NULL, // this is ignored and will likely be removed from this API
5110 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5111}
5112
5113/**
5114 * \brief This function updates lim global structure, if CB parameters in the BSS
5115 * have changed, and sends an indication to HAL also with the
5116 * updated HT Parameters.
5117 * This function does not detect the change in the primary channel, that is done as part
5118 * of channel Swtich IE processing.
5119 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5120 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5121 *
5122 *
5123 * \param pMac Pointer to global MAC structure
5124 *
5125 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5126 * Probe Response
5127 *
5128 * \param bssIdx BSS Index of the Bss to which Station is associated.
5129 *
5130 *
5131 */
5132
5133void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5134 tDot11fIEHTInfo *pHTInfo,
5135 tANI_U8 bssIdx,
5136 tpPESession psessionEntry)
5137{
Jeff Johnsone7245742012-09-05 17:12:55 -07005138 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005139#if !defined WLAN_FEATURE_VOWIFI
5140 tANI_U32 localPwrConstraint;
5141#endif
5142
5143 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005144 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 return;
5146
5147#if !defined WLAN_FEATURE_VOWIFI
5148 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005149 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 return;
5151 }
5152#endif
5153
Jeff Johnsone7245742012-09-05 17:12:55 -07005154 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5155 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005156 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005157 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5158 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5159 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5160 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005161
5162 // Notify HAL
5163 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005164 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005166 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005167 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005168 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005169 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5170 pMac->lim.gpchangeChannelCallback = NULL;
5171 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005172
5173#if defined WLAN_FEATURE_VOWIFI
5174 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5175 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5176#else
5177 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5178 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5179#endif
5180
5181 //In case of IBSS, if STA should update HT Info IE in its beacons.
5182 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5183 {
5184 schSetFixedBeaconFields(pMac,psessionEntry);
5185 }
5186
5187 }
5188} // End limUpdateStaRunTimeHTParams.
5189
5190/**
5191 * \brief This function updates the lim global structure, if any of the
5192 * HT Capabilities have changed.
5193 *
5194 *
5195 * \param pMac Pointer to Global MAC structure
5196 *
5197 * \param pHTCapability Pointer to HT Capability Information Element
5198 * obtained from a Beacon or Probe Response
5199 *
5200 *
5201 *
5202 */
5203
5204void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5205 tDot11fIEHTCaps *pHTCaps )
5206{
5207
5208 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5209 {
5210 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5211 // Send change notification to HAL
5212 }
5213
5214 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5215 {
5216 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5217 // Send change notification to HAL
5218 }
5219
5220 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5221 {
5222 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5223 // Send change notification to HAL
5224 }
5225
5226
5227} // End limUpdateStaRunTimeHTCapability.
5228
5229/**
5230 * \brief This function updates lim global structure, if any of the HT
5231 * Info Parameters have changed.
5232 *
5233 *
5234 * \param pMac Pointer to the global MAC structure
5235 *
5236 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5237 * Probe Response
5238 *
5239 *
5240 */
5241
5242void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305243 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005244{
Jeff Johnsone7245742012-09-05 17:12:55 -07005245 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005247 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005248 // Send change notification to HAL
5249 }
5250
5251 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5252 {
5253 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5254 // Send change notification to HAL
5255 }
5256
5257 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5258 {
5259 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5260 // Send change notification to HAL
5261 }
5262
5263 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5264 {
5265 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5266 // Send change notification to HAL
5267 }
5268
5269 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5270 {
5271 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5272 }
5273
5274 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5275 {
5276 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5277 // Send change notification to HAL
5278 }
5279
5280 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5281 {
5282 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5283 // Send change notification to HAL
5284 }
5285
5286 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5287 {
5288 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5289 // Send change notification to HAL
5290 }
5291
5292 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5293 {
5294 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5295 // Send change notification to HAL
5296 }
5297
5298 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5299 {
5300 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5301 // Send change notification to HAL
5302 }
5303
5304 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5305 {
5306 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5307 // Send change notification to HAL
5308 }
5309
5310} // End limUpdateStaRunTimeHTInfo.
5311
5312
5313/** -------------------------------------------------------------
5314\fn limProcessHalIndMessages
5315\brief callback function for HAL indication
5316\param tpAniSirGlobal pMac
5317\param tANI_U32 mesgId
5318\param void *mesgParam
5319\return tSirRetStatu - status
5320 -------------------------------------------------------------*/
5321
5322tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5323{
5324 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5325 tSirMsgQ msg;
5326
5327 switch(msgId)
5328 {
5329 case SIR_LIM_DEL_TS_IND:
5330 case SIR_LIM_ADD_BA_IND:
5331 case SIR_LIM_DEL_BA_ALL_IND:
5332 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5333 case SIR_LIM_BEACON_GEN_IND:
5334 msg.type = (tANI_U16) msgId;
5335 msg.bodyptr = msgParam;
5336 msg.bodyval = 0;
5337 break;
5338
5339 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305340 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005341 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005342 return eSIR_FAILURE;
5343 }
5344
5345 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5346 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305347 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005348 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5349 return eSIR_FAILURE;
5350 }
5351 return eSIR_SUCCESS;
5352}
5353
5354/** -------------------------------------------------------------
5355\fn limValidateDeltsReq
5356\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5357\param tpAniSirGlobal pMac
5358\param tpSirDeltsReq pDeltsReq
5359\param tSirMacAddr peerMacAddr
5360\return eSirRetStatus - status
5361 -------------------------------------------------------------*/
5362
5363tSirRetStatus
5364limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5365{
5366 tpDphHashNode pSta;
5367 tANI_U8 tsStatus;
5368 tSirMacTSInfo *tsinfo;
5369 tANI_U32 i;
5370 tANI_U8 tspecIdx;
5371 /* if sta
5372 * - verify assoc state
5373 * - del tspec locally
5374 * if ap,
5375 * - verify sta is in assoc state
5376 * - del sta tspec locally
5377 */
5378 if(pDeltsReq == NULL)
5379 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005380 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005381 return eSIR_FAILURE;
5382 }
5383
5384 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5385 {
5386 tANI_U32 val;
5387
5388 // station always talks to the AP
5389 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5390
5391 val = sizeof(tSirMacAddr);
5392 #if 0
5393 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5394 {
5395 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005396 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005397 return eSIR_FAILURE;
5398 }
5399 #endif// TO SUPPORT BT-AMP
5400 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5401
5402 }
5403 else
5404 {
5405 tANI_U16 assocId;
5406 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5407
5408 assocId = pDeltsReq->aid;
5409 if (assocId != 0)
5410 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5411 else
5412 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5413
5414 if (pSta != NULL)
5415 // TBD: check sta assoc state as well
5416 for (i =0; i < sizeof(tSirMacAddr); i++)
5417 macaddr[i] = pSta->staAddr[i];
5418 }
5419
5420 if (pSta == NULL)
5421 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005422 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005423 return eSIR_FAILURE;
5424 }
5425
5426 if ((! pSta->valid) ||
5427 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5428 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005429 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 return eSIR_FAILURE;
5431 }
5432
5433 pDeltsReq->req.wsmTspecPresent = 0;
5434 pDeltsReq->req.wmeTspecPresent = 0;
5435 pDeltsReq->req.lleTspecPresent = 0;
5436
5437 if ((pSta->wsmEnabled) &&
5438 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5439 pDeltsReq->req.wsmTspecPresent = 1;
5440 else if (pSta->wmeEnabled)
5441 pDeltsReq->req.wmeTspecPresent = 1;
5442 else if (pSta->lleEnabled)
5443 pDeltsReq->req.lleTspecPresent = 1;
5444 else
5445 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005446 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005447 return eSIR_FAILURE;
5448 }
5449
5450 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5451 : &pDeltsReq->req.tsinfo;
5452 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005453 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005454 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5455 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5456
5457 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005458
5459 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5460 != eSIR_SUCCESS)
5461 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005462 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5464 return eSIR_FAILURE;
5465 }
5466 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5467 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5468 {
5469 //edca only now.
5470 }
5471 else
5472 {
5473 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5474 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5475 {
5476 //send message to HAL to delete TS
Madan Mohan Koyyalamudic0a75a42013-10-07 04:20:49 +05305477 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac,
5478 pSta->staIndex,
5479 tspecIdx,
5480 pDeltsReq->req,
5481 psessionEntry->peSessionId,
5482 psessionEntry->bssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005484 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 tsinfo->traffic.userPrio);
5486 return eSIR_FAILURE;
5487 }
5488 }
5489 }
5490 return eSIR_SUCCESS;
5491}
5492
5493/** -------------------------------------------------------------
5494\fn limRegisterHalIndCallBack
5495\brief registers callback function to HAL for any indication.
5496\param tpAniSirGlobal pMac
5497\return none.
5498 -------------------------------------------------------------*/
5499void
5500limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5501{
5502 tSirMsgQ msg;
5503 tpHalIndCB pHalCB;
5504
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305505 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5506 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005507 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305508 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 return;
5510 }
5511
5512 pHalCB->pHalIndCB = limProcessHalIndMessages;
5513
5514 msg.type = WDA_REGISTER_PE_CALLBACK;
5515 msg.bodyptr = pHalCB;
5516 msg.bodyval = 0;
5517
Jeff Johnsone7245742012-09-05 17:12:55 -07005518 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5520 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305521 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005522 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005523 }
5524
5525 return;
5526}
5527
5528
5529/** -------------------------------------------------------------
5530\fn limProcessAddBaInd
5531
5532\brief handles the BA activity check timeout indication coming from HAL.
5533 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5534\param tpAniSirGlobal pMac
5535\param tSirMsgQ limMsg
5536\return None
5537-------------------------------------------------------------*/
5538void
5539limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5540{
5541 tANI_U8 i;
5542 tANI_U8 tid;
5543 tANI_U16 assocId;
5544 tpDphHashNode pSta;
5545 tpAddBaCandidate pBaCandidate;
5546 tANI_U32 baCandidateCnt;
5547 tpBaActivityInd pBaActivityInd;
5548 tpPESession psessionEntry;
5549 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005550#ifdef FEATURE_WLAN_TDLS
5551 boolean htCapable = FALSE;
5552#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005553
5554
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005555 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005556 return;
5557
5558 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5559 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5560
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005561 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005563 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305564 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005565 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 return;
5567 }
5568
5569 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005570#ifdef FEATURE_WLAN_TDLS
5571 if ((baCandidateCnt > pMac->lim.maxStation))
5572#else
5573 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5574#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305576 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005577 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005578 return;
5579 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005580
5581#ifdef FEATURE_WLAN_TDLS
5582 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5583 //AP capability
5584 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5585
5586 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5587 {
5588 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5589 if ((NULL == pSta) || (!pSta->valid))
5590 continue;
5591
5592 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5593 htCapable = pSta->mlmStaContext.htCapability;
5594 else
5595 htCapable = psessionEntry->htCapability;
5596
5597 if (htCapable)
5598 break;
5599 }
5600 if (!htCapable)
5601 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305602 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005603 limMsg->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005604 return;
5605 }
5606#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005607
5608 //delete the complete dialoguetoken linked list
5609 limDeleteDialogueTokenList(pMac);
5610 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5611
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005612 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005613 {
5614 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005615 if ((NULL == pSta) || (!pSta->valid))
5616 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005617
5618 for (tid=0; tid<STACFG_MAX_TC; tid++)
5619 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005620 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 (pBaCandidate->baInfo[tid].fBaEnable))
5622 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005623 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5624 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005625 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5626 }
5627 }
5628 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305629 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005630 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005631 return;
5632}
5633
5634
5635/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005636\fn limDeleteBASessions
5637\brief Deletes all the exisitng BA sessions for given session
5638 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005639\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005640\param tpPESession pSessionEntry
5641\param tANI_U32 baDirection
5642\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005643-------------------------------------------------------------*/
5644
5645void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005646limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5647 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005648{
5649 tANI_U32 i;
5650 tANI_U8 tid;
5651 tpDphHashNode pSta;
5652
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005653 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005654 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005655 limLog(pMac, LOGE, FL("Session does not exist"));
5656 }
5657 else
5658 {
5659 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005660 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005661 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5662 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5663 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5664 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005665 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005666 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005667 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005668 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5669 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005670 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005671 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5672 (baDirection & BA_INITIATOR))
5673 {
5674 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5675 eSIR_MAC_UNSPEC_FAILURE_REASON,
5676 pSessionEntry);
5677 }
5678 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5679 (baDirection & BA_RECIPIENT))
5680 {
5681 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5682 eSIR_MAC_UNSPEC_FAILURE_REASON,
5683 pSessionEntry);
5684 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005685 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005686 }
5687 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005688 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5689 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5690 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005691 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005692 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5693 &pSessionEntry->dph.dphHashTable);
5694 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005695 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005696 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5697 (baDirection & BA_INITIATOR))
5698 {
5699 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5700 eSIR_MAC_UNSPEC_FAILURE_REASON,
5701 pSessionEntry);
5702 }
5703 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5704 (baDirection & BA_RECIPIENT))
5705 {
5706 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5707 eSIR_MAC_UNSPEC_FAILURE_REASON,
5708 pSessionEntry);
5709 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005710 }
5711 }
5712 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 }
5714}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005715
5716/** -------------------------------------------------------------
5717\fn limDelAllBASessions
5718\brief Deletes all the exisitng BA sessions.
5719\param tpAniSirGlobal pMac
5720\return None
5721-------------------------------------------------------------*/
5722
5723void limDelAllBASessions(tpAniSirGlobal pMac)
5724{
5725 tANI_U32 i;
5726 tpPESession pSessionEntry;
5727
5728 for (i = 0; i < pMac->lim.maxBssId; i++)
5729 {
5730 pSessionEntry = peFindSessionBySessionId(pMac, i);
5731 if (pSessionEntry)
5732 {
5733 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5734 }
5735 }
5736}
5737
5738/** -------------------------------------------------------------
5739\fn limDelAllBASessionsBtc
5740\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5741 band.
5742\param tpAniSirGlobal pMac
5743\return None
5744-------------------------------------------------------------*/
5745
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005746void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005747{
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005748 tANI_U8 sessionId;
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005749 tpPESession pSessionEntry;
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005750 pSessionEntry = peFindSessionByBssid(pMac,pMac->btc.btcBssfordisableaggr,
5751 &sessionId);
5752 if (pSessionEntry)
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005753 {
Leela Venkata Kiran Kumar Reddy Chiralab8dadc22013-11-05 12:34:32 -08005754 PELOGW(limLog(pMac, LOGW,
5755 "Deleting the BA for session %d as host got BTC event", sessionId);)
5756 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005757 }
5758}
5759
Jeff Johnson295189b2012-06-20 16:38:30 -07005760/** -------------------------------------------------------------
5761\fn limProcessDelTsInd
5762\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5763 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5764\param tpAniSirGlobal pMac
5765\param tSirMsgQ limMsg
5766\return None
5767-------------------------------------------------------------*/
5768void
5769limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5770{
5771 tpDphHashNode pSta;
5772 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5773 tpSirDeltsReq pDelTsReq = NULL;
5774 tSirMacAddr peerMacAddr;
5775 tpSirDeltsReqInfo pDelTsReqInfo;
5776 tpLimTspecInfo pTspecInfo;
5777 tpPESession psessionEntry;
5778 tANI_U8 sessionId;
5779
5780if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5781 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005782 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305783 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005784 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005785 return;
5786 }
5787
5788 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5789 if(pTspecInfo->inuse == false)
5790 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005791 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005792 goto error1;
5793 }
5794
5795 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5796 if(pSta == NULL)
5797 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005798 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005799 pTspecInfo->assocId);
5800 goto error1;
5801 }
5802
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305803 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5804 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005805 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305806 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005807 goto error1;
5808 }
5809
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305810 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005811
5812 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305813 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005814 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305815 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005816
5817
5818 //validate the req
5819 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005821 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005822 goto error2;
5823 }
Arif Hussaina7c8e412013-11-20 11:06:42 -08005824 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with "
5825 "assocId = %d MacAddr = "MAC_ADDRESS_STR,
5826 pDelTsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005827
5828 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5829 psessionEntry);
5830
5831 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5833 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005834 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305835 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005836 goto error3;
5837 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305838 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005839
5840 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305841 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005842 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305843 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005844
5845 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5846
5847error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305848 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005849error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305850 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005851error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305852 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005853 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005854 return;
5855}
5856
5857/**
5858 * \brief Setup an A-MPDU/BA session
5859 *
5860 * \sa limPostMlmAddBAReq
5861 *
5862 * \param pMac The global tpAniSirGlobal object
5863 *
5864 * \param pStaDs DPH Hash Node object of peer STA
5865 *
5866 * \param tid TID for which a BA is being setup.
5867 * If this is set to 0xFFFF, then we retrieve
5868 * the default TID from the CFG
5869 *
5870 * \return eSIR_SUCCESS if setup completes successfully
5871 * eSIR_FAILURE is some problem is encountered
5872 */
5873tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5874 tpDphHashNode pStaDs,
5875 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5876{
5877 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005878 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 tpDialogueToken dialogueTokenNode;
5880 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005881
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 // Check if the peer is a 11n capable STA
5883 // FIXME - Need a 11n peer indication in DPH.
5884 // For now, using the taurusPeer attribute
5885 //if( 0 == pStaDs->taurusPeer == )
5886 //return eSIR_SUCCESS;
5887
5888 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305889 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5890 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005891 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305892 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005893 status = eSIR_MEM_ALLOC_FAILED;
5894 goto returnFailure;
5895 }
5896
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305897 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005898
5899 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305900 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005901 pMlmAddBAReq->peerMacAddr,
5902 pStaDs->staAddr,
5903 sizeof( tSirMacAddr ));
5904
5905 // Update the TID
5906 pMlmAddBAReq->baTID = tid;
5907
5908 // Determine the supported BA policy of local STA
5909 // for the TID of interest
5910 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5911
5912 // BA Buffer Size
5913 // Requesting the ADDBA recipient to populate the size.
5914 // If ADDBA is accepted, a non-zero buffer size should
5915 // be returned in the ADDBA Rsp
Agarwal Ashish87039eb2014-01-15 14:13:15 +05305916 if ((TRUE == psessionEntry->isCiscoVendorAP) &&
5917 (eHT_CHANNEL_WIDTH_80MHZ != pStaDs->htSupportedChannelWidthSet))
5918 {
5919 /* Cisco AP has issues in receiving more than 25 "mpdu in ampdu"
5920 causing very low throughput in HT40 case */
5921 limLog( pMac, LOGW,
5922 FL( "Requesting ADDBA with Cisco 1225 AP, window size 25"));
5923 pMlmAddBAReq->baBufferSize = MAX_BA_WINDOW_SIZE_FOR_CISCO;
5924 }
5925 else
5926 pMlmAddBAReq->baBufferSize = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005927
5928 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005929 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5931 pStaDs->staIndex,
5932 tid );
5933
5934 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005935 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005937 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 status = eSIR_FAILURE;
5939 goto returnFailure;
5940 }
5941 pMlmAddBAReq->baTimeout = val; // In TU's
5942
5943 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005944 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5946 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5947
5948 // BA Starting Sequence Number
5949 pMlmAddBAReq->baSSN = startingSeqNum;
5950
5951 /* Update PE session Id*/
5952 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5953
5954 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5955
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005956 dialogueTokenNode = limAssignDialogueToken(pMac);
5957 if (NULL == dialogueTokenNode)
5958 {
5959 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5960 status = eSIR_FAILURE;
5961 goto returnFailure;
5962 }
5963
Jeff Johnson295189b2012-06-20 16:38:30 -07005964 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005965 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005966 dialogueTokenNode->assocId = pStaDs->assocId;
5967 dialogueTokenNode->tid = tid;
5968 // Send ADDBA Req to MLME
5969 limPostMlmMessage( pMac,
5970 LIM_MLM_ADDBA_REQ,
5971 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005972 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005973
5974returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305975 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 return status;
5977}
5978
5979/**
5980 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5981 * will then send an ADDBA Rsp to peer MAC entity
5982 * with the appropriate ADDBA status code
5983 *
5984 * \sa limPostMlmAddBARsp
5985 *
5986 * \param pMac The global tpAniSirGlobal object
5987 *
5988 * \param peerMacAddr MAC address of peer entity that will
5989 * be the recipient of this ADDBA Rsp
5990 *
5991 * \param baStatusCode ADDBA Rsp status code
5992 *
5993 * \param baDialogToken ADDBA Rsp dialog token
5994 *
5995 * \param baTID TID of interest
5996 *
5997 * \param baPolicy The BA policy
5998 *
5999 * \param baBufferSize The BA buffer size
6000 *
6001 * \param baTimeout BA timeout in TU's
6002 *
6003 * \return eSIR_SUCCESS if setup completes successfully
6004 * eSIR_FAILURE is some problem is encountered
6005 */
6006tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
6007 tSirMacAddr peerMacAddr,
6008 tSirMacStatusCodes baStatusCode,
6009 tANI_U8 baDialogToken,
6010 tANI_U8 baTID,
6011 tANI_U8 baPolicy,
6012 tANI_U16 baBufferSize,
6013 tANI_U16 baTimeout,
6014 tpPESession psessionEntry)
6015{
6016tSirRetStatus status = eSIR_SUCCESS;
6017tpLimMlmAddBARsp pMlmAddBARsp;
6018
6019 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306020 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
6021 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 {
6023 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306024 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006025 status );
6026
6027 status = eSIR_MEM_ALLOC_FAILED;
6028 goto returnFailure;
6029 }
6030
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306031 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006032
6033 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306034 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006035 pMlmAddBARsp->peerMacAddr,
6036 peerMacAddr,
6037 sizeof( tSirMacAddr ));
6038
6039 pMlmAddBARsp->baDialogToken = baDialogToken;
6040 pMlmAddBARsp->addBAResultCode = baStatusCode;
6041 pMlmAddBARsp->baTID = baTID;
6042 pMlmAddBARsp->baPolicy = baPolicy;
6043 pMlmAddBARsp->baBufferSize = baBufferSize;
6044 pMlmAddBARsp->baTimeout = baTimeout;
6045
6046 /* UPdate PE session ID*/
6047 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6048
6049 // Send ADDBA Rsp to MLME
6050 limPostMlmMessage( pMac,
6051 LIM_MLM_ADDBA_RSP,
6052 (tANI_U32 *) pMlmAddBARsp );
6053
6054returnFailure:
6055
6056 return status;
6057}
6058
6059/**
6060 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6061 * will then send an DELBA Ind to peer MAC entity
6062 * with the appropriate DELBA status code
6063 *
6064 * \sa limPostMlmDelBAReq
6065 *
6066 * \param pMac The global tpAniSirGlobal object
6067 *
6068 * \param pSta DPH Hash Node object of peer MAC entity
6069 * for which the BA session is being deleted
6070 *
6071 * \param baDirection DELBA direction
6072 *
6073 * \param baTID TID for which the BA session is being deleted
6074 *
6075 * \param baReasonCode DELBA Req reason code
6076 *
6077 * \return eSIR_SUCCESS if setup completes successfully
6078 * eSIR_FAILURE is some problem is encountered
6079 */
6080tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6081 tpDphHashNode pSta,
6082 tANI_U8 baDirection,
6083 tANI_U8 baTID,
6084 tSirMacReasonCodes baReasonCode,
6085 tpPESession psessionEntry)
6086{
6087tSirRetStatus status = eSIR_SUCCESS;
6088tpLimMlmDelBAReq pMlmDelBAReq;
6089tLimBAState curBaState;
6090
6091if(NULL == pSta)
6092 return eSIR_FAILURE;
6093
6094LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6095
6096 // Need to validate the current BA State.
6097 if( eLIM_BA_STATE_IDLE != curBaState)
6098 {
6099 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006100 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006101 baTID,
6102 curBaState);
6103
6104 status = eSIR_FAILURE;
6105 goto returnFailure;
6106 }
6107
6108 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306109 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6110 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006111 {
6112 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306113 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 status );
6115
6116 status = eSIR_MEM_ALLOC_FAILED;
6117 goto returnFailure;
6118 }
6119
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306120 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006121
6122 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306123 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006124 pMlmDelBAReq->peerMacAddr,
6125 pSta->staAddr,
6126 sizeof( tSirMacAddr ));
6127
6128 pMlmDelBAReq->baDirection = baDirection;
6129 pMlmDelBAReq->baTID = baTID;
6130 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6131
6132 /* Update PE session ID*/
6133 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6134
6135 //we don't have valid BA session for the given direction.
6136 // HDD wants to get the BA session deleted on PEER in this case.
6137 // in this case we just need to send DelBA to the peer.
6138 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6139 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6140 {
6141 // Send DELBA Ind over the air
6142 if( eSIR_SUCCESS !=
6143 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6144 status = eSIR_FAILURE;
6145
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306146 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006147 return status;
6148 }
6149
6150
6151 // Update the BA state in STA
6152 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6153
6154 // Send DELBA Req to MLME
6155 limPostMlmMessage( pMac,
6156 LIM_MLM_DELBA_REQ,
6157 (tANI_U32 *) pMlmDelBAReq );
6158
6159returnFailure:
6160
6161 return status;
6162}
6163
6164/**
6165 * \brief Send WDA_ADDBA_REQ to HAL, in order
6166 * to setup a new BA session with a peer
6167 *
6168 * \sa limPostMsgAddBAReq
6169 *
6170 * \param pMac The global tpAniSirGlobal object
6171 *
6172 * \param pSta Runtime, STA-related configuration cached
6173 * in the HashNode object
6174 *
6175 * \param baDialogToken The Action Frame dialog token
6176 *
6177 * \param baTID TID for which the BA session is being setup
6178 *
6179 * \param baPolicy BA Policy
6180 *
6181 * \param baBufferSize The requested BA buffer size
6182 *
6183 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6184 *
6185 * \param baSSN Starting Sequence Number for this BA session
6186 *
6187 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6188 *
6189 * \return none
6190 *
6191 */
6192tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6193 tpDphHashNode pSta,
6194 tANI_U8 baDialogToken,
6195 tANI_U8 baTID,
6196 tANI_U8 baPolicy,
6197 tANI_U16 baBufferSize,
6198 tANI_U16 baTimeout,
6199 tANI_U16 baSSN,
6200 tANI_U8 baDirection,
6201 tpPESession psessionEntry)
6202{
6203tpAddBAParams pAddBAParams = NULL;
6204tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006205tSirMsgQ msgQ;
6206
6207#ifdef WLAN_SOFTAP_VSTA_FEATURE
6208 // we can only do BA on "hard" STAs
6209 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6210 {
6211 retCode = eHAL_STATUS_FAILURE;
6212 goto returnFailure;
6213 }
6214#endif //WLAN_SOFTAP_VSTA_FEATURE
6215
6216 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306217 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6218 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006219 {
6220 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306221 FL("AllocateMemory failed")
6222 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006223
6224 retCode = eSIR_MEM_ALLOC_FAILED;
6225 goto returnFailure;
6226 }
6227
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306228 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006229
6230 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306231 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 (void *) pAddBAParams->peerMacAddr,
6233 (void *) pSta->staAddr,
6234 sizeof( tSirMacAddr ));
6235
6236 // Populate the REQ parameters
6237 pAddBAParams->staIdx = pSta->staIndex;
6238 pAddBAParams->baDialogToken = baDialogToken;
6239 pAddBAParams->baTID = baTID;
6240 pAddBAParams->baPolicy = baPolicy;
6241 pAddBAParams->baBufferSize = baBufferSize;
6242 pAddBAParams->baTimeout = baTimeout;
6243 pAddBAParams->baSSN = baSSN;
6244 pAddBAParams->baDirection = baDirection;
6245 pAddBAParams->respReqd = 1;
6246
6247 /* UPdate PE session ID */
6248 pAddBAParams->sessionId = psessionEntry->peSessionId;
6249
6250 // Post WDA_ADDBA_REQ to HAL.
6251 msgQ.type = WDA_ADDBA_REQ;
6252 //
6253 // FIXME_AMPDU
6254 // A global counter (dialog token) is required to keep track of
6255 // all PE <-> HAL communication(s)
6256 //
6257 msgQ.reserved = 0;
6258 msgQ.bodyptr = pAddBAParams;
6259 msgQ.bodyval = 0;
6260
6261 limLog( pMac, LOGW,
6262 FL( "Sending WDA_ADDBA_REQ..." ));
6263
6264 //defer any other message until we get response back.
6265 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6266
Jeff Johnsone7245742012-09-05 17:12:55 -07006267 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006268#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6269 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6270#endif //FEATURE_WLAN_DIAG_SUPPORT
6271
6272 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6273 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006274 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006275 retCode );
6276 else
6277 return retCode;
6278
6279returnFailure:
6280
6281 // Clean-up...
6282 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306283 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006284
6285 return retCode;
6286
6287}
6288
6289/**
6290 * \brief Send WDA_DELBA_IND to HAL, in order
6291 * to delete an existing BA session with peer
6292 *
6293 * \sa limPostMsgDelBAInd
6294 *
6295 * \param pMac The global tpAniSirGlobal object
6296 *
6297 * \param pSta Runtime, STA-related configuration cached
6298 * in the HashNode object
6299 *
6300 * \param baTID TID for which the BA session is being setup
6301 *
6302 * \param baDirection Identifies whether the DELBA Ind was
6303 * sent by the BA initiator or recipient
6304 *
6305 * \return none
6306 *
6307 */
6308tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6309 tpDphHashNode pSta,
6310 tANI_U8 baTID,
6311 tANI_U8 baDirection,
6312 tpPESession psessionEntry)
6313{
6314tpDelBAParams pDelBAParams = NULL;
6315tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006316tSirMsgQ msgQ;
6317
6318 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306319 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6320 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006321 {
6322 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306323 FL("AllocateMemory failed")
6324 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006325
6326 retCode = eSIR_MEM_ALLOC_FAILED;
6327 goto returnFailure;
6328 }
6329
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306330 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006331
6332 // Populate the REQ parameters
6333 pDelBAParams->staIdx = pSta->staIndex;
6334 pDelBAParams->baTID = baTID;
6335 pDelBAParams->baDirection = baDirection;
6336
6337 /* Update PE session ID */
6338
6339
6340 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6341 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6342
6343 // Post WDA_DELBA_IND to HAL.
6344 msgQ.type = WDA_DELBA_IND;
6345 //
6346 // FIXME:
6347 // A global counter (dialog token) is required to keep track of
6348 // all PE <-> HAL communication(s)
6349 //
6350 msgQ.reserved = 0;
6351 msgQ.bodyptr = pDelBAParams;
6352 msgQ.bodyval = 0;
6353
6354 limLog( pMac, LOGW,
6355 FL( "Sending SIR_HAL_DELBA_IND..." ));
6356
Jeff Johnsone7245742012-09-05 17:12:55 -07006357 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006358#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6359 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6360#endif //FEATURE_WLAN_DIAG_SUPPORT
6361
6362 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6363 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006364 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006365 retCode );
6366 else
6367 {
6368 // Update LIM's internal cache...
6369 if( eBA_INITIATOR == baDirection)
6370 {
6371 pSta->tcCfg[baTID].fUseBATx = 0;
6372 pSta->tcCfg[baTID].txBufSize = 0;
6373 }
6374 else
6375 {
6376 pSta->tcCfg[baTID].fUseBARx = 0;
6377 pSta->tcCfg[baTID].rxBufSize = 0;
6378 }
6379
6380 return retCode;
6381 }
6382
6383returnFailure:
6384
6385 // Clean-up...
6386 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306387 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006388
6389 return retCode;
6390
6391}
6392
6393/**
6394 * @function : limPostSMStateUpdate()
6395 *
6396 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6397 *
6398 * LOGIC:
6399 *
6400 * ASSUMPTIONS:
6401 * NA
6402 *
6403 * NOTE:
6404 * NA
6405 *
6406 * @param pMac - Pointer to Global MAC structure
6407 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6408 * @return None
6409 */
6410tSirRetStatus
6411limPostSMStateUpdate(tpAniSirGlobal pMac,
6412 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6413{
6414 tSirRetStatus retCode = eSIR_SUCCESS;
6415 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006416 tpSetMIMOPS pMIMO_PSParams;
6417
6418 msgQ.reserved = 0;
6419 msgQ.type = WDA_SET_MIMOPS_REQ;
6420
6421 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306422 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6423 if ( NULL == pMIMO_PSParams )
6424 {
6425 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006426 return eSIR_MEM_ALLOC_FAILED;
6427 }
6428
6429 pMIMO_PSParams->htMIMOPSState = state;
6430 pMIMO_PSParams->staIdx = staIdx;
6431 pMIMO_PSParams->fsendRsp = true;
6432 msgQ.bodyptr = pMIMO_PSParams;
6433 msgQ.bodyval = 0;
6434
6435 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6436
Jeff Johnsone7245742012-09-05 17:12:55 -07006437 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006438 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6439 if (eSIR_SUCCESS != retCode)
6440 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006441 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306442 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006443 return retCode;
6444 }
6445
6446 return retCode;
6447}
6448
6449void limPktFree (
6450 tpAniSirGlobal pMac,
6451 eFrameType frmType,
6452 tANI_U8 *pRxPacketInfo,
6453 void *pBody)
6454{
6455 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006456}
6457
6458/**
6459 * limGetBDfromRxPacket()
6460 *
6461 *FUNCTION:
6462 * This function is called to get pointer to Polaris
6463 * Buffer Descriptor containing MAC header & other control
6464 * info from the body of the message posted to LIM.
6465 *
6466 *LOGIC:
6467 * NA
6468 *
6469 *ASSUMPTIONS:
6470 * NA
6471 *
6472 *NOTE:
6473 * NA
6474 *
6475 * @param body - Received message body
6476 * @param pRxPacketInfo - Pointer to received BD
6477 * @return None
6478 */
6479
6480void
6481limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6482{
Jeff Johnson295189b2012-06-20 16:38:30 -07006483 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006484} /*** end limGetBDfromRxPacket() ***/
6485
6486
6487
6488
6489
6490void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6491{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306492 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006493}
6494
6495
6496void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6497{
6498 tANI_U8 i;
6499 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6500
6501 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6502 {
6503 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6504 {
6505 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6506 fFound = eANI_BOOLEAN_TRUE;
6507 break;
6508 }
6509 }
6510 if(eANI_BOOLEAN_FALSE == fFound)
6511 {
6512 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6513 {
6514 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6515 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6516 }
6517 else
6518 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006519 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 }
6521 }
6522}
6523
6524
6525/**
6526 * @function : limIsChannelValidForChannelSwitch()
6527 *
6528 * @brief : This function checks if the channel to which AP
6529 * is expecting us to switch, is a valid channel for us.
6530 * LOGIC:
6531 *
6532 * ASSUMPTIONS:
6533 * NA
6534 *
6535 * NOTE:
6536 * NA
6537 *
6538 * @param pMac - Pointer to Global MAC structure
6539 * @param channel - New channel to which we are expected to move
6540 * @return None
6541 */
6542tAniBool
6543limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6544{
6545 tANI_U8 index;
6546 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6547 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6548
6549 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6550 (tANI_U8 *)validChannelList,
6551 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6552 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006553 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006554 return (eSIR_FALSE);
6555 }
6556
6557 for(index = 0; index < validChannelListLen; index++)
6558 {
6559 if(validChannelList[index] == channel)
6560 return (eSIR_TRUE);
6561 }
6562
6563 /* channel does not belong to list of valid channels */
6564 return (eSIR_FALSE);
6565}
6566
6567/**------------------------------------------------------
6568\fn __limFillTxControlParams
6569\brief Fill the message for stopping/resuming tx.
6570
6571\param pMac
6572\param pTxCtrlMsg - Pointer to tx control message.
6573\param type - Which way we want to stop/ resume tx.
6574\param mode - To stop/resume.
6575 -------------------------------------------------------*/
6576static eHalStatus
6577__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6578 tLimQuietTxMode type, tLimControlTx mode)
6579{
6580
6581 //TBD-RAJESH HOW TO GET sessionEntry?????
6582 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6583
6584 if (mode == eLIM_STOP_TX)
6585 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6586 else
6587 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6588
6589 switch (type)
6590 {
6591 case eLIM_TX_ALL:
6592 /** Stops/resumes transmission completely */
6593 pTxCtrlMsg->fCtrlGlobal = 1;
6594 break;
6595
6596 case eLIM_TX_BSS_BUT_BEACON:
6597 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6598 * stop beacon transmission.
6599 */
6600 pTxCtrlMsg->ctrlBss = 1;
6601 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6602 break;
6603
6604 case eLIM_TX_STA:
6605 /** Memory for station bitmap is allocated dynamically in caller of this
6606 * so decode properly here and fill the bitmap. Now not implemented,
6607 * fall through.
6608 */
6609 case eLIM_TX_BSS:
6610 //Fall thru...
6611 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006612 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006613 return eHAL_STATUS_FAILURE;
6614 }
6615
6616 return eHAL_STATUS_SUCCESS;
6617}
6618
6619/**
6620 * @function : limFrameTransmissionControl()
6621 *
6622 * @brief : This API is called by the user to halt/resume any frame
6623 * transmission from the device. If stopped, all frames will be
6624 * queued starting from hardware. Then back-pressure
6625 * is built till the driver.
6626 * LOGIC:
6627 *
6628 * ASSUMPTIONS:
6629 * NA
6630 *
6631 * NOTE:
6632 * NA
6633 *
6634 * @param pMac - Pointer to Global MAC structure
6635 * @return None
6636 */
6637void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6638{
6639
6640 eHalStatus status = eHAL_STATUS_FAILURE;
6641 tpTxControlParams pTxCtrlMsg;
6642 tSirMsgQ msgQ;
6643 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6644
6645 /** Allocate only required number of bytes for station bitmap
6646 * Make it to align to 4 byte boundary */
6647 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6648
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306649 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6650 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006651 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306652 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006653 return;
6654 }
6655
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306656 vos_mem_set((void *) pTxCtrlMsg,
6657 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006658 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6659 if (status != eHAL_STATUS_SUCCESS)
6660 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306661 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006662 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006663 return;
6664 }
6665
6666 msgQ.bodyptr = (void *) pTxCtrlMsg;
6667 msgQ.bodyval = 0;
6668 msgQ.reserved = 0;
6669 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6670
Jeff Johnsone7245742012-09-05 17:12:55 -07006671 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006672 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6673 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306674 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006675 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006676 return;
6677 }
6678
6679 if (mode == eLIM_STOP_TX)
6680 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006681 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006682 }
6683 else
6684 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006685 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006686 }
6687 return;
6688}
6689
6690
6691/**
6692 * @function : limRestorePreChannelSwitchState()
6693 *
6694 * @brief : This API is called by the user to undo any
6695 * specific changes done on the device during
6696 * channel switch.
6697 * LOGIC:
6698 *
6699 * ASSUMPTIONS:
6700 * NA
6701 *
6702 * NOTE:
6703 * NA
6704 *
6705 * @param pMac - Pointer to Global MAC structure
6706 * @return None
6707 */
6708
6709tSirRetStatus
6710limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6711{
6712
6713 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006714 tANI_U32 val = 0;
6715
6716 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6717 return retCode;
6718
6719 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006720 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006721
6722 /* Restore the frame transmission, all the time. */
6723 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6724
6725 /* Free to enter BMPS */
6726 limSendSmePostChannelSwitchInd(pMac);
6727
6728 //Background scan is now enabled by SME
6729 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6730 {
6731 /* Enable background scan if already enabled, else don't bother */
6732 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6733 &val)) != eSIR_SUCCESS)
6734
6735 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006736 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006737 return (retCode);
6738 }
6739
6740 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6741 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006742 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6743 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6745 {
6746 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6747 return (eSIR_FAILURE);
6748 }
6749
6750 }
6751 }
6752
6753 /* Enable heartbeat timer */
6754 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6755 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006756 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6757 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6758 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6759 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 {
6761 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6762 return (eSIR_FAILURE);
6763 }
6764 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006765 return (retCode);
6766}
6767
6768
6769/**--------------------------------------------
6770\fn limRestorePreQuietState
6771\brief Restore the pre quiet state
6772
6773\param pMac
6774\return NONE
6775---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006776tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006777{
6778
6779 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 tANI_U32 val = 0;
6781
6782 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6783 return retCode;
6784
6785 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006786 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006787
6788 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006789 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006790 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6791
6792
6793 //Background scan is now enabled by SME
6794 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6795 {
6796 /* Enable background scan if already enabled, else don't bother */
6797 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6798 &val)) != eSIR_SUCCESS)
6799
6800 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006801 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006802 return (retCode);
6803 }
6804
6805 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6806 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006807 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006808 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6809 {
6810 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6811 return (eSIR_FAILURE);
6812 }
6813
6814 }
6815 }
6816
6817 /* Enable heartbeat timer */
6818 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6819 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006820 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006821 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006822 {
6823 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6824 return (eSIR_FAILURE);
6825 }
6826 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006827 return (retCode);
6828}
6829
6830
6831/**
6832 * @function: limPrepareFor11hChannelSwitch()
6833 *
6834 * @brief : This API is called by the user to prepare for
6835 * 11h channel switch. As of now, the API does
6836 * very minimal work. User can add more into the
6837 * same API if needed.
6838 * LOGIC:
6839 *
6840 * ASSUMPTIONS:
6841 * NA
6842 *
6843 * NOTE:
6844 * NA
6845 *
6846 * @param pMac - Pointer to Global MAC structure
6847 * @param psessionEntry
6848 * @return None
6849 */
6850void
6851limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6852{
Jeff Johnson295189b2012-06-20 16:38:30 -07006853 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6854 return;
6855
6856 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006857 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006858
6859 /* Disable, Stop background scan if enabled and running */
6860 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6861
6862 /* Stop heart-beat timer to stop heartbeat disassociation */
6863 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6864
6865 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6866 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006868 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006869 /* Stop ongoing scanning if any */
6870 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6871 {
6872 //Set the resume channel to Any valid channel (invalid).
6873 //This will instruct HAL to set it to any previous valid channel.
6874 peSetResumeChannel(pMac, 0, 0);
6875 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6876 }
6877 else
6878 {
6879 limRestorePreChannelSwitchState(pMac, psessionEntry);
6880 }
6881 return;
6882 }
6883 else
6884 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006885 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006886 /** We are safe to switch channel at this point */
6887 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6888 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006889}
6890
6891
6892
6893/**----------------------------------------------------
6894\fn limGetNwType
6895
6896\brief Get type of the network from data packet or beacon
6897\param pMac
6898\param channelNum - Channel number
6899\param type - Type of packet.
6900\param pBeacon - Pointer to beacon or probe response
6901
6902\return Network type a/b/g.
6903-----------------------------------------------------*/
6904tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6905{
6906 tSirNwType nwType = eSIR_11B_NW_TYPE;
6907
6908 if (type == SIR_MAC_DATA_FRAME)
6909 {
6910 if ((channelNum > 0) && (channelNum < 15))
6911 {
6912 nwType = eSIR_11G_NW_TYPE;
6913 }
6914 else
6915 {
6916 nwType = eSIR_11A_NW_TYPE;
6917 }
6918 }
6919 else
6920 {
6921 if ((channelNum > 0) && (channelNum < 15))
6922 {
6923 int i;
6924 // 11b or 11g packet
6925 // 11g iff extended Rate IE is present or
6926 // if there is an A rate in suppRate IE
6927 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6928 {
6929 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6930 {
6931 nwType = eSIR_11G_NW_TYPE;
6932 break;
6933 }
6934 }
6935 if (pBeacon->extendedRatesPresent)
6936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006937 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006938 nwType = eSIR_11G_NW_TYPE;
6939 }
6940 }
6941 else
6942 {
6943 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006944 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006945 nwType = eSIR_11A_NW_TYPE;
6946 }
6947 }
6948 return nwType;
6949}
6950
6951
6952/**---------------------------------------------------------
6953\fn limGetChannelFromBeacon
6954\brief To extract channel number from beacon
6955
6956\param pMac
6957\param pBeacon - Pointer to beacon or probe rsp
6958\return channel number
6959-----------------------------------------------------------*/
6960tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6961{
6962 tANI_U8 channelNum = 0;
6963
6964 if (pBeacon->dsParamsPresent)
6965 channelNum = pBeacon->channelNumber;
6966 else if(pBeacon->HTInfo.present)
6967 channelNum = pBeacon->HTInfo.primaryChannel;
6968 else
6969 channelNum = pBeacon->channelNumber;
6970
6971 return channelNum;
6972}
6973
6974
6975/** ---------------------------------------------------------
6976\fn limSetTspecUapsdMask
6977\brief This function sets the PE global variable:
6978\ 1) gUapsdPerAcTriggerEnableMask and
6979\ 2) gUapsdPerAcDeliveryEnableMask
6980\ based on the user priority field and direction field
6981\ in the TS Info Fields.
6982\
6983\ An AC is a trigger-enabled AC if the PSB subfield
6984\ is set to 1 in the uplink direction.
6985\ An AC is a delivery-enabled AC if the PSB subfield
6986\ is set to 1 in the down-link direction.
6987\
6988\param tpAniSirGlobal pMac
6989\param tSirMacTSInfo pTsInfo
6990\param tANI_U32 action
6991\return None
6992 ------------------------------------------------------------*/
6993void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6994{
6995 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6996 tANI_U16 direction = pTsInfo->traffic.direction;
6997 tANI_U8 ac = upToAc(userPrio);
6998
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006999 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 -07007000
7001 /* Converting AC to appropriate Uapsd Bit Mask
7002 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
7003 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
7004 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
7005 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
7006 */
7007 ac = ((~ac) & 0x3);
7008
7009 if (action == CLEAR_UAPSD_MASK)
7010 {
7011 if (direction == SIR_MAC_DIRECTION_UPLINK)
7012 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7013 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7014 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7015 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7016 {
7017 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
7018 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
7019 }
7020 }
7021 else if (action == SET_UAPSD_MASK)
7022 {
7023 if (direction == SIR_MAC_DIRECTION_UPLINK)
7024 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7025 else if (direction == SIR_MAC_DIRECTION_DNLINK)
7026 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7027 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7028 {
7029 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7030 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7031 }
7032 }
7033
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007034 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7035 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007036
7037 return;
7038}
7039
7040
7041
7042void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7043{
7044
7045 tANI_U8 i;
7046 for(i =0;i < pMac->lim.maxBssId;i++)
7047 {
7048 if(pMac->lim.gpSession[i].valid == TRUE )
7049 {
7050 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7051 {
7052 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7053 break;
7054 }
7055
7056 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7057 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7058 {
7059 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7060 }
7061 }
7062 }
7063 for(i=0; i< pMac->lim.maxBssId; i++)
7064 {
7065 if(pMac->lim.gpSession[i].valid == TRUE )
7066 {
7067 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7068 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7069 {
7070 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7071 {
7072 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007073 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007074 i);)
7075 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7076 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7077 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7078 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007079 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007080 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7081 }
7082 break;
7083 }
7084 }
7085 }
7086 }
7087}
7088
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007089void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7090{
7091 if(psessionEntry->valid == TRUE )
7092 {
7093 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7094 {
7095 limIbssHeartBeatHandle(pMac,psessionEntry);
7096 }
7097 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7098 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7099 {
7100 limHandleHeartBeatFailure(pMac,psessionEntry);
7101 }
7102 }
7103 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7104 and the other things again */
7105 if(psessionEntry->valid == TRUE )
7106 {
7107 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7108 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7109 {
7110 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7111 {
7112 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7113 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7114 psessionEntry->bssIdx);)
7115 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7116 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7117 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7118 {
7119 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7120 limReactivateHeartBeatTimer(pMac, psessionEntry);
7121 }
7122 }
7123 }
7124 }
7125}
7126
7127
Jeff Johnson295189b2012-06-20 16:38:30 -07007128tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7129{
7130 tANI_U8 i;
7131 for(i =0;i < pMac->lim.maxBssId;i++)
7132 {
7133 if(pMac->lim.gpSession[i].valid == TRUE )
7134 {
7135 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7136 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7137 {
7138 return pMac->lim.gpSession[i].currentOperChannel;
7139 }
7140 }
7141 }
7142 return 0;
7143}
7144
7145void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7146{
7147
7148 tpPESession psessionEntry;
7149// tANI_U8 sessionId;
7150 tpAddStaParams pAddStaParams;
7151
7152 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7153
7154 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7155 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007156 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307157 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007158 return;
7159 }
7160 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7161 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007162#ifdef FEATURE_WLAN_TDLS
7163 else if(pMac->lim.gLimAddStaTdls)
7164 {
7165 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7166 pMac->lim.gLimAddStaTdls = FALSE ;
7167 }
7168#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007169 else
7170 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7171
7172}
7173
7174
7175void limUpdateBeacon(tpAniSirGlobal pMac)
7176{
7177 tANI_U8 i;
7178
7179 for(i =0;i < pMac->lim.maxBssId;i++)
7180 {
7181 if(pMac->lim.gpSession[i].valid == TRUE )
7182 {
7183 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7184 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7185 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7186 )
7187 {
7188 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7189 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7190 }
7191 else
7192 {
7193 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7194 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7195 {
7196
7197 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7198 {
7199 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7200 }
7201 }
7202 }
7203 }
7204 }
7205}
7206
7207void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7208{
7209 tANI_U8 i;
7210 tpPESession psessionEntry;
7211 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7212 for(i =0; i < pMac->lim.maxBssId; i++)
7213 {
7214 if(pMac->lim.gpSession[i].valid == TRUE)
7215 {
7216 psessionEntry = &pMac->lim.gpSession[i];
7217 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7218 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007219 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007220 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007221#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7222 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7223#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007224 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7225 {
Abhishek Singhfbaae852014-03-21 12:42:11 +05307226 if (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07007227 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007228 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007229 /* AP did not respond to Probe Request. Tear down link with it.*/
7230 limTearDownLinkWithAp(pMac,
7231 psessionEntry->peSessionId,
7232 eSIR_BEACON_MISSED);
7233 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7234 }
7235 else // restart heartbeat timer
7236 {
7237 limReactivateHeartBeatTimer(pMac, psessionEntry);
7238 }
7239 }
7240 else
7241 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007242 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007243 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7244 limReactivateHeartBeatTimer(pMac, psessionEntry);
7245 }
7246
7247 }
7248 }
7249 }
7250 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7251 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7252}
7253
7254
7255/*
7256* This function assumes there will not be more than one IBSS session active at any time.
7257*/
7258tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7259{
7260 tANI_U8 i;
7261
7262 for(i =0;i < pMac->lim.maxBssId;i++)
7263 {
7264 if( (pMac->lim.gpSession[i].valid) &&
7265 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7266 return (&pMac->lim.gpSession[i]);
7267 }
7268
7269 return NULL;
7270}
7271
7272tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7273{
7274 tANI_U8 i;
7275
7276 for(i =0;i < pMac->lim.maxBssId;i++)
7277 {
7278 if( (pMac->lim.gpSession[i].valid) &&
7279 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7280 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7281 return (&pMac->lim.gpSession[i]);
7282 }
7283
7284 return NULL;
7285}
7286
7287/**---------------------------------------------------------
7288\fn limHandleDeferMsgError
7289\brief handles error scenario, when the msg can not be deferred.
7290\param pMac
7291\param pLimMsg LIM msg, which could not be deferred.
7292\return void
7293-----------------------------------------------------------*/
7294
7295void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7296{
7297 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7298 {
7299 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7300 }
7301 else if(pLimMsg->bodyptr != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007302 {
7303 vos_mem_free( pLimMsg->bodyptr);
7304 pLimMsg->bodyptr = NULL;
7305 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007306}
7307
7308
7309#ifdef FEATURE_WLAN_DIAG_SUPPORT
7310/**---------------------------------------------------------
7311\fn limDiagEventReport
7312\brief This function reports Diag event
7313\param pMac
7314\param eventType
7315\param bssid
7316\param status
7317\param reasonCode
7318\return void
7319-----------------------------------------------------------*/
7320void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7321{
7322 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7323 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7324
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307325 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007326
7327 if (NULL == pSessionEntry)
7328 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307329 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007330 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7331 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7332
7333 }
7334 else
7335 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307336 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007337 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7338 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7339 }
7340 peEvent.event_type = eventType;
7341 peEvent.status = status;
7342 peEvent.reason_code = reasonCode;
7343
7344 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7345 return;
7346}
7347
7348#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7349
7350void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7351{
7352
7353 tpAddStaSelfParams pAddStaSelfParams;
7354 tSirMsgQ mmhMsg;
7355 tpSirSmeAddStaSelfRsp pRsp;
7356
7357
7358 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7359
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307360 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7361 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007362 {
7363 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307364 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7365 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007366 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007367 return;
7368 }
7369
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307370 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007371
7372 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7373 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7374 pRsp->status = pAddStaSelfParams->status;
7375
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307376 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007377
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307378 vos_mem_free(pAddStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007379 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007380
7381 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7382 mmhMsg.bodyptr = pRsp;
7383 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007384 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007385 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7386
7387}
7388
7389void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7390{
7391
7392 tpDelStaSelfParams pDelStaSelfParams;
7393 tSirMsgQ mmhMsg;
7394 tpSirSmeDelStaSelfRsp pRsp;
7395
7396
7397 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7398
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307399 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7400 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007401 {
7402 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307403 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7404 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007405 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007406 return;
7407 }
7408
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307409 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007410
7411 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7412 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7413 pRsp->status = pDelStaSelfParams->status;
7414
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307415 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007416
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307417 vos_mem_free(pDelStaSelfParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08007418 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007419
7420 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7421 mmhMsg.bodyptr = pRsp;
7422 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007423 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007424 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7425
7426}
7427
7428/***************************************************************
7429* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7430* To unmap the channel to reverse the effect of mapping
7431* a band channel in hal .Mapping was done hal to overcome the
7432* limitation of the rxbd which use only 4 bit for channel number.
7433*****************************************************************/
7434tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7435{
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007436#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007437 if( mapChannel > 0 && mapChannel <= aUnsortedChannelListSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007438 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7439 return aUnsortedChannelList[mapChannel -1];
7440 else
Manjunathappa Prakasheb5a3a32014-02-13 19:57:55 -08007441#else
Manjunathappa Prakashb8ac0232014-03-06 17:58:20 -08007442 if( mapChannel > 0 && mapChannel <= abChannelSize )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007443#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007444 return abChannel[mapChannel -1];
7445 else
7446 return 0;
7447}
7448
7449
7450v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7451{
7452 int left = length;
7453 v_U8_t *ptr = pIes;
7454 v_U8_t elem_id;
7455 v_U16_t elem_len;
7456
7457 while(left >= (size_of_len_field+1))
7458 {
7459 elem_id = ptr[0];
7460 if (size_of_len_field == TWO_BYTE)
7461 {
7462 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7463 }
7464 else
7465 {
7466 elem_len = ptr[1];
7467 }
7468
7469
7470 left -= (size_of_len_field+1);
7471 if(elem_len > left)
7472 {
7473 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007474 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007475 eid,elem_len,left);
7476 return NULL;
7477 }
7478 if (elem_id == eid)
7479 {
7480 return ptr;
7481 }
7482
7483 left -= elem_len;
7484 ptr += (elem_len + (size_of_len_field+1));
7485 }
7486 return NULL;
7487}
7488
7489/* return NULL if oui is not found in ie
7490 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7491 */
7492v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7493{
7494 int left = ie_len;
7495 v_U8_t *ptr = ie;
7496 v_U8_t elem_id, elem_len;
7497
7498 while(left >= 2)
7499 {
7500 elem_id = ptr[0];
7501 elem_len = ptr[1];
7502 left -= 2;
7503 if(elem_len > left)
7504 {
7505 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007506 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007507 elem_id,elem_len,left);
7508 return NULL;
7509 }
7510 if (SIR_MAC_EID_VENDOR == elem_id)
7511 {
7512 if(memcmp(&ptr[2], oui, oui_size)==0)
7513 return ptr;
7514 }
7515
7516 left -= elem_len;
7517 ptr += (elem_len + 2);
7518 }
7519 return NULL;
7520}
7521
Jeff Johnson295189b2012-06-20 16:38:30 -07007522//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7523
7524v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7525{
7526 int length = 0;
7527 tANI_U8 *ptr = ie;
7528
7529 ptr[length++] = SIR_MAC_EID_VENDOR;
7530 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307531 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7532 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007533 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7534}
7535
7536//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7537
7538v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7539{
7540 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007541
7542 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7543 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7544 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307545 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007546 noaStream + noaLen - overFlowLen, overFlowLen);
7547 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7548 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307549 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007550 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307551 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7552 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007553 }
7554
Jeff Johnson295189b2012-06-20 16:38:30 -07007555 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7556
7557}
7558
7559//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7560v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7561{
7562 v_U8_t len=0;
7563
7564 v_U8_t *pBody = pNoaStream;
7565
7566
7567 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7568 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7569 {
7570 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7571 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7572 )
7573 return 0; //No NoA Descriptor then return 0
7574
7575
7576 pBody[0] = SIR_P2P_NOA_ATTR;
7577
7578 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7579 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7580 len = 5;
7581 pBody += len;
7582
7583
7584 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7585 {
7586 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7587 pBody += 1;
7588 len +=1;
7589
7590 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7591 pBody += sizeof(tANI_U32);
7592 len +=4;
7593
7594 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7595 pBody += sizeof(tANI_U32);
7596 len +=4;
7597
7598 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7599 pBody += sizeof(tANI_U32);
7600 len +=4;
7601
7602 }
7603
7604 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7605 {
7606 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7607 pBody += 1;
7608 len +=1;
7609
7610 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7611 pBody += sizeof(tANI_U32);
7612 len +=4;
7613
7614 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7615 pBody += sizeof(tANI_U32);
7616 len +=4;
7617
7618 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7619 pBody += sizeof(tANI_U32);
7620 len +=4;
7621
7622 }
7623
7624
7625 pBody = pNoaStream + 1;
7626 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7627
7628 return (len);
7629
7630 }
7631 return 0;
7632
7633}
Jeff Johnsone7245742012-09-05 17:12:55 -07007634
7635void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007636{
7637
7638 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007639 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007640}
Jeff Johnsone7245742012-09-05 17:12:55 -07007641
Jeff Johnson295189b2012-06-20 16:38:30 -07007642/*--------------------------------------------------------------------------
7643
7644 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7645
Jeff Johnsone7245742012-09-05 17:12:55 -07007646 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7647 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007648
7649 \param pMac - pointer to global adapter context
7650 \return - channel to scan from valid session else zero.
7651
7652 \sa
7653
7654 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007655void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007656{
7657
7658 //Rationale - this could be the suspend/resume for assoc and it is essential that
7659 //the new BSS is active for some time. Other BSS was anyway suspended.
7660 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7661 //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 -07007662 //and hence should be ok. Need to discuss this further
7663 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007664 {
7665 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007666 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007667 }
7668 else
7669 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007670 *resumeChannel = pMac->lim.gResumeChannel;
7671 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007673 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007674}
7675
Viral Modid86bde22012-12-10 13:09:21 -08007676tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7677{
7678 tANI_U8 i;
7679 for(i =0; i < pMac->lim.maxBssId; i++)
7680 {
7681 if(pMac->lim.gpSession[i].valid == TRUE)
7682 {
7683 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7684 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7685 )
7686 {
7687 return TRUE;
7688 }
7689 }
7690 }
7691 return FALSE;
7692}
Jeff Johnsone7245742012-09-05 17:12:55 -07007693
Jeff Johnson295189b2012-06-20 16:38:30 -07007694
7695tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7696{
7697 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7698 {
7699 return eANI_BOOLEAN_TRUE;
7700 }
7701 else
7702 {
7703 return eANI_BOOLEAN_FALSE;
7704 }
7705}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007706
Sandeep Puligilla60342762014-01-30 21:05:37 +05307707/**
7708 * \brief verify the changes in channel bonding
7709 *
7710 * \param pMac Pointer to the global MAC structure
7711 *
7712 * \param psessionEntry session entry
7713 * beaconSecChanWidth Secondary channel width
7714 * advertized in beacon
7715 * currentSecChanWidth Current configured width
7716 * staId Station Id
7717 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
7718 */
7719tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac,
7720 tpPESession psessionEntry,
7721 tANI_U8 beaconSecChanWidth,
7722 tANI_U8 currentSecChanWidth,
7723 tANI_U8 staId)
7724{
7725 tUpdateVHTOpMode tempParam;
7726 tANI_BOOLEAN fCbMode24G = FALSE;
7727 tANI_BOOLEAN status = eANI_BOOLEAN_FALSE;
7728
7729 /* Moving from HT40 to HT20 operation*/
7730 if (((PHY_DOUBLE_CHANNEL_LOW_PRIMARY == currentSecChanWidth) ||
7731 (PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == currentSecChanWidth))
7732 && (PHY_SINGLE_CHANNEL_CENTERED == beaconSecChanWidth))
7733 {
7734 tempParam.opMode = eHT_CHANNEL_WIDTH_20MHZ;
7735 tempParam.staId = staId;
7736 fCbMode24G = TRUE;
7737 }
7738
7739 /* Moving from HT20 to HT40 operation*/
7740 if ((( PHY_DOUBLE_CHANNEL_LOW_PRIMARY == beaconSecChanWidth) ||
7741 ( PHY_DOUBLE_CHANNEL_HIGH_PRIMARY == beaconSecChanWidth ))
7742 && (PHY_SINGLE_CHANNEL_CENTERED == currentSecChanWidth))
7743 {
7744 tempParam.opMode = eHT_CHANNEL_WIDTH_40MHZ;
7745 tempParam.staId = staId;
7746 fCbMode24G = TRUE;
7747 }
7748
7749 if (TRUE == fCbMode24G)
7750 {
7751 VOS_TRACE( VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
7752 "Changing CBMODE to = %d staId = %d",
7753 tempParam.opMode, tempParam.staId );
7754 if( eSIR_SUCCESS == limSendModeUpdate(pMac, &tempParam, psessionEntry))
7755 status = eANI_BOOLEAN_TRUE;
7756 }
7757 return status;
7758}
7759
Mohit Khanna4a70d262012-09-11 16:30:12 -07007760#ifdef WLAN_FEATURE_11AC
7761tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7762{
7763 tUpdateVHTOpMode tempParam;
7764
7765 tempParam.opMode = chanWidth;
7766 tempParam.staId = staId;
7767
7768 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7769
7770 return eANI_BOOLEAN_TRUE;
7771}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007772#endif
7773
7774tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7775{
7776 tANI_U8 val=0;
7777
7778 if (phyMode == WNI_CFG_PHY_MODE_11A)
7779 {
7780 // 11a mode always uses short slot
7781 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7782 val = true;
7783 }
7784 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7785 {
7786 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
Ravi Joshi27216f12013-10-19 17:04:39 -07007787 (psessionEntry->pePersona == VOS_IBSS_MODE) ||
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007788 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7789 {
7790 val = true;
7791 }
7792
7793 // Program Polaris based on AP capability
7794
7795 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7796 // Joining BSS.
7797 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7798 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7799 // Reassociating with AP.
7800 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7801 }
7802 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7803 {
7804 // Will reach here in 11b case
7805 val = false;
7806 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007807 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007808 return val;
7809}
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307810
Kalikinkar dhara205da782014-03-21 15:49:32 -07007811void limUtilsframeshtons(tpAniSirGlobal pCtx,
7812 tANI_U8 *pOut,
7813 tANI_U16 pIn,
7814 tANI_U8 fMsb)
7815{
7816 (void)pCtx;
7817#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7818 if ( !fMsb )
7819 {
7820 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7821 }
7822 else
7823 {
7824 *pOut = ( pIn & 0xff00 ) >> 8;
7825 *( pOut + 1 ) = pIn & 0xff;
7826 }
7827#else
7828 if ( !fMsb )
7829 {
7830 *pOut = pIn & 0xff;
7831 *( pOut + 1 ) = ( pIn & 0xff00 ) >> 8;
7832 }
7833 else
7834 {
7835 DOT11F_MEMCPY(pCtx, pOut, &pIn, 2);
7836 }
7837#endif
7838}
7839
7840void limUtilsframeshtonl(tpAniSirGlobal pCtx,
7841 tANI_U8 *pOut,
7842 tANI_U32 pIn,
7843 tANI_U8 fMsb)
7844{
7845 (void)pCtx;
7846#if defined ( DOT11F_LITTLE_ENDIAN_HOST )
7847 if ( !fMsb )
7848 {
7849 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7850 }
7851 else
7852 {
7853 *pOut = ( pIn & 0xff000000 ) >> 24;
7854 *( pOut + 1 ) = ( pIn & 0x00ff0000 ) >> 16;
7855 *( pOut + 2 ) = ( pIn & 0x0000ff00 ) >> 8;
7856 *( pOut + 3 ) = ( pIn & 0x000000ff );
7857 }
7858#else
7859 if ( !fMsb )
7860 {
7861 *( pOut ) = ( pIn & 0x000000ff );
7862 *( pOut + 1 ) = ( pIn & 0x0000ff00 ) >> 8;
7863 *( pOut + 2 ) = ( pIn & 0x00ff0000 ) >> 16;
7864 *( pOut + 3 ) = ( pIn & 0xff000000 ) >> 24;
7865 }
7866 else
7867 {
7868 DOT11F_MEMCPY(pCtx, pOut, &pIn, 4);
7869 }
7870#endif
7871}
7872
7873
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05307874/**--------------------------------------------
7875\fn limUpdateOBSSScanParams
7876\brief Updates OBSS SCAN IE parameters to session
7877
7878\param psessionEntry - Session Entry
7879\return NONE
7880---------------------------------------------*/
7881void limUpdateOBSSScanParams(tpPESession psessionEntry ,
7882 tDot11fIEOBSSScanParameters *pOBSSScanParameters)
7883{
7884 /*If the recieved value is not in the range specified by the Specification
7885 then it will be the default value configured through cfg */
7886 if (( pOBSSScanParameters->obssScanActiveDwell >
7887 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMIN ) &&
7888 ( pOBSSScanParameters->obssScanActiveDwell <
7889 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_DWELL_TIME_STAMAX))
7890 {
7891 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime=
7892 pOBSSScanParameters->obssScanActiveDwell;
7893 }
7894 if((pOBSSScanParameters->obssScanPassiveDwell >
7895 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMIN ) &&
7896 (pOBSSScanParameters->obssScanPassiveDwell <
7897 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_DWELL_TIME_STAMAX))
7898 {
7899 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime =
7900 pOBSSScanParameters->obssScanPassiveDwell;
7901 }
7902 if((pOBSSScanParameters->bssWidthChannelTransitionDelayFactor >
7903 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMIN) &&
7904 (pOBSSScanParameters->bssWidthChannelTransitionDelayFactor <
7905 WNI_CFG_OBSS_HT40_WIDTH_CHANNEL_TRANSITION_DELAY_FACTOR_STAMAX))
7906 {
7907 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor =
7908 pOBSSScanParameters->bssWidthChannelTransitionDelayFactor;
7909 }
7910 if((pOBSSScanParameters->obssScanActiveTotalPerChannel >
7911 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7912 (pOBSSScanParameters->obssScanActiveTotalPerChannel <
7913 WNI_CFG_OBSS_HT40_SCAN_ACTIVE_TOTAL_PER_CHANNEL_STAMAX))
7914 {
7915 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel =
7916 pOBSSScanParameters->obssScanActiveTotalPerChannel;
7917 }
7918 if((pOBSSScanParameters->obssScanPassiveTotalPerChannel >
7919 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMIN) &&
7920 (pOBSSScanParameters->obssScanPassiveTotalPerChannel <
7921 WNI_CFG_OBSS_HT40_SCAN_PASSIVE_TOTAL_PER_CHANNEL_STAMAX))
7922 {
7923 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel =
7924 pOBSSScanParameters->obssScanPassiveTotalPerChannel;
7925 }
7926 if((pOBSSScanParameters->bssChannelWidthTriggerScanInterval >
7927 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMIN) &&
7928 (pOBSSScanParameters->bssChannelWidthTriggerScanInterval <
7929 WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL_STAMAX))
7930 {
7931 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval =
7932 pOBSSScanParameters->bssChannelWidthTriggerScanInterval;
7933 }
7934 if((pOBSSScanParameters->obssScanActivityThreshold >
7935 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMIN )&&
7936 (pOBSSScanParameters->obssScanActivityThreshold <
7937 WNI_CFG_OBSS_HT40_SCAN_ACTIVITY_THRESHOLD_STAMAX))
7938 {
7939 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold =
7940 pOBSSScanParameters->obssScanActivityThreshold;
7941 }
7942}
Chet Lanctot8cecea22014-02-11 19:09:36 -08007943
7944#ifdef WLAN_FEATURE_11W
7945void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param)
7946{
7947 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
7948 tPmfSaQueryTimerId timerId;
7949 tpPESession psessionEntry;
7950 tpDphHashNode pSta;
7951 tANI_U32 maxRetries;
7952
7953 limLog(pMac, LOG1, FL("SA Query timer fires"));
7954 timerId.value = param;
7955
7956 // Check that SA Query is in progress
7957 if ((psessionEntry = peFindSessionBySessionId(
7958 pMac, timerId.fields.sessionId)) == NULL)
7959 {
7960 limLog(pMac, LOGE, FL("Session does not exist for given session ID %d"),
7961 timerId.fields.sessionId);
7962 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7963 return;
7964 }
7965 if ((pSta = dphGetHashEntry(pMac, timerId.fields.peerIdx,
7966 &psessionEntry->dph.dphHashTable)) == NULL)
7967 {
7968 limLog(pMac, LOGE, FL("Entry does not exist for given peer index %d"),
7969 timerId.fields.peerIdx);
7970 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7971 return;
7972 }
7973 if (DPH_SA_QUERY_IN_PROGRESS != pSta->pmfSaQueryState)
7974 return;
7975
7976 // Increment the retry count, check if reached maximum
7977 if (wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
7978 &maxRetries) != eSIR_SUCCESS)
7979 {
7980 limLog(pMac, LOGE, FL("Could not retrieve PMF SA Query maximum retries value"));
7981 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
7982 return;
7983 }
7984 pSta->pmfSaQueryRetryCount++;
7985 if (pSta->pmfSaQueryRetryCount >= maxRetries)
7986 {
7987 limLog(pMac, LOG1, FL("SA Query timed out"));
7988 /* remove before submission */
7989 limLog(pMac, LOGE, FL("SA Query timed out"));
7990 pSta->pmfSaQueryState = DPH_SA_QUERY_TIMED_OUT;
7991 return;
7992 }
7993
7994 // Retry SA Query
7995 limSendSaQueryRequestFrame(pMac, (tANI_U8 *)&(pSta->pmfSaQueryCurrentTransId),
7996 pSta->staAddr, psessionEntry);
7997 pSta->pmfSaQueryCurrentTransId++;
7998 /* remove before submission */
7999 limLog(pMac, LOGE, FL("Starting SA Query retry %d"), pSta->pmfSaQueryRetryCount);
8000 if (tx_timer_activate(&pSta->pmfSaQueryTimer) != TX_SUCCESS)
8001 {
8002 limLog(pMac, LOGE, FL("PMF SA Query timer activation failed!"));
8003 pSta->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS;
8004 }
8005}
8006#endif
8007
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08008008/** ---------------------------------------------------------
8009\fn limProcessChannelSwitchSuspendLink
8010\brief This function call channel switch functions based on
8011 the gLimChannelSwitch.state. After function return it
8012 reset the state to eLIM_CHANNEL_SWITCH_IDLE.
8013 If gLimChannelSwitch.state is non-identified then
8014 print error log as well as restore back the
8015 pre-channelSwitch.
8016\param tpAniSirGlobal pMac
8017\param eHalStatus status
8018\param tANI_U32 *ctx
8019\return None
8020 ------------------------------------------------------------*/
8021static void
8022limProcessChannelSwitchSuspendLink(tpAniSirGlobal pMac,
8023 eHalStatus status,
8024 tANI_U32 *ctx)
8025{
8026 tpPESession pSessionEntry = (tpPESession)ctx;
8027
8028 if ( eHAL_STATUS_SUCCESS != status )
8029 {
8030 limLog(pMac, LOGE,
8031 FL("Suspend link failed. still proceeding "));
8032 }
8033 if (NULL == pSessionEntry )
8034 {
8035 limLog(pMac, LOGE, FL("pSessionEntry is null pointer "));
8036 return;
8037 }
8038
8039 switch(pSessionEntry->gLimChannelSwitch.state)
8040 {
8041 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
8042 PELOGW(limLog(pMac, LOGW,
8043 FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
8044 limSwitchPrimaryChannel(pMac,
8045 pSessionEntry->gLimChannelSwitch.primaryChannel,
8046 pSessionEntry);
8047 pSessionEntry->gLimChannelSwitch.state =
8048 eLIM_CHANNEL_SWITCH_IDLE;
8049 break;
8050
8051 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
8052 PELOGW(limLog(pMac, LOGW,
8053 FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
8054 limSwitchPrimarySecondaryChannel(pMac, pSessionEntry,
8055 pSessionEntry->gLimChannelSwitch.primaryChannel,
8056 pSessionEntry->gLimChannelSwitch.secondarySubBand);
8057 pSessionEntry->gLimChannelSwitch.state =
8058 eLIM_CHANNEL_SWITCH_IDLE;
8059 break;
8060
8061 default:
8062 PELOGE(limLog(pMac, LOGW, FL("incorrect state %d"),
8063 pSessionEntry->gLimChannelSwitch.state);)
8064 if (limRestorePreChannelSwitchState(pMac,
8065 pSessionEntry) != eSIR_SUCCESS)
8066 {
8067 limLog(pMac, LOGE,
8068 FL("Could not restore pre-channelSwitch "
8069 "(11h) state, resetting the system"));
8070 }
8071 }
8072}