blob: 5d20c0e0b216fe2854a7e09e009c3934fb39e8c0 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limUtils.cc contains the utility functions
45 * LIM uses.
46 * Author: Chandra Modumudi
47 * Date: 02/13/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 */
52
53#include "schApi.h"
54#include "limUtils.h"
55#include "limTypes.h"
56#include "limSecurityUtils.h"
57#include "limPropExtsUtils.h"
58#include "limSendMessages.h"
59#include "limSerDesUtils.h"
60#include "limAdmitControl.h"
61#include "limStaHashApi.h"
62#include "dot11f.h"
63#include "wmmApsd.h"
64#include "limTrace.h"
Jeff Johnson77165482013-03-07 08:15:44 -080065#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070066#include "vos_diag_core_event.h"
67#endif //FEATURE_WLAN_DIAG_SUPPORT
68#include "limIbssPeerMgmt.h"
69#include "limSessionUtils.h"
70#include "limSession.h"
71#include "vos_nvitem.h"
72
73/* Static global used to mark situations where pMac->lim.gLimTriggerBackgroundScanDuringQuietBss is SET
74 * and limTriggerBackgroundScanDuringQuietBss() returned failure. In this case, we will stop data
75 * traffic instead of going into scan. The recover function limProcessQuietBssTimeout() needs to have
76 * this information. */
77static tAniBool glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
78
79/* 11A Channel list to decode RX BD channel information */
80static const tANI_U8 abChannel[]= {36,40,44,48,52,56,60,64,100,104,108,112,116,
81 120,124,128,132,136,140,149,153,157,161,165};
82
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070083#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
84static const tANI_U8 aUnsortedChannelList[]= {52,56,60,64,100,104,108,112,116,
85 120,124,128,132,136,140,36,40,44,48,149,153,157,161,165};
86#endif
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088//#define LIM_MAX_ACTIVE_SESSIONS 3 //defined temporarily for BT-AMP SUPPORT
89#define SUCCESS 1 //defined temporarily for BT-AMP
90
91/** -------------------------------------------------------------
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++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700124 PELOG4(limLog(pMac, LOG4, FL("token assigned = %d"), token);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 return pCurrNode;
126}
127
128/** -------------------------------------------------------------
129\fn limSearchAndDeleteDialogueToken
130\brief search dialogue token in the list and deletes it if found. returns failure if not found.
131\param tpAniSirGlobal pMac
132\param tANI_U8 token
133\param tANI_U16 assocId
134\param tANI_U16 tid
135\return eSirRetStatus - status of the search
136 -------------------------------------------------------------*/
137
138
139tSirRetStatus
140limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid)
141{
142 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
143 tpDialogueToken pPrevNode = pMac->lim.pDialogueTokenHead;
144
145 //if the list is empty
146 if(NULL == pCurrNode)
147 return eSIR_FAILURE;
148
149 // if the matching node is the first node.
150 if(pCurrNode &&
151 (assocId == pCurrNode->assocId) &&
152 (tid == pCurrNode->tid))
153 {
154 pMac->lim.pDialogueTokenHead = pCurrNode->next;
155 //there was only one node in the list. So tail pointer also needs to be adjusted.
156 if(NULL == pMac->lim.pDialogueTokenHead)
157 pMac->lim.pDialogueTokenTail = NULL;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530158 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 return eSIR_SUCCESS;
160 }
161
162 //first node did not match. so move to the next one.
163 pCurrNode = pCurrNode->next;
164 while(NULL != pCurrNode )
165 {
166 if(token == pCurrNode->token)
167 {
168 break;
169 }
170
171 pPrevNode = pCurrNode;
172 pCurrNode = pCurrNode->next;
173 }
174
175 if(pCurrNode &&
176 (assocId == pCurrNode->assocId) &&
177 (tid == pCurrNode->tid))
178 {
179 pPrevNode->next = pCurrNode->next;
180 //if the node being deleted is the last one then we also need to move the tail pointer to the prevNode.
181 if(NULL == pCurrNode->next)
182 pMac->lim.pDialogueTokenTail = pPrevNode;
Bansidhar Gopalacharia03b13c2013-08-01 18:09:28 +0530183 palFreeMemory(pMac->hHdd, (void *) pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 return eSIR_SUCCESS;
185 }
186
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700187 PELOGW(limLog(pMac, LOGW, FL("LIM does not have matching dialogue token node"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700188 return eSIR_FAILURE;
189
190}
191
192
193/** -------------------------------------------------------------
194\fn limDeleteDialogueTokenList
195\brief deletes the complete lim dialogue token linked list.
196\param tpAniSirGlobal pMac
197\return None
198 -------------------------------------------------------------*/
199void
200limDeleteDialogueTokenList(tpAniSirGlobal pMac)
201{
202 tpDialogueToken pCurrNode = pMac->lim.pDialogueTokenHead;
203
204 while(NULL != pMac->lim.pDialogueTokenHead)
205 {
206 pCurrNode = pMac->lim.pDialogueTokenHead;
207 pMac->lim.pDialogueTokenHead = pMac->lim.pDialogueTokenHead->next;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530208 vos_mem_free(pCurrNode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 pCurrNode = NULL;
210 }
211 pMac->lim.pDialogueTokenTail = NULL;
212}
213
214void
215limGetBssidFromBD(tpAniSirGlobal pMac, tANI_U8 * pRxPacketInfo, tANI_U8 *bssId, tANI_U32 *pIgnore)
216{
217 tpSirMacDataHdr3a pMh = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
218 *pIgnore = 0;
219
220 if (pMh->fc.toDS == 1 && pMh->fc.fromDS == 0)
221 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530222 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700223 *pIgnore = 1;
224 }
225 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 1)
226 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530227 vos_mem_copy ( bssId, pMh->addr2, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 *pIgnore = 1;
229 }
230 else if (pMh->fc.toDS == 0 && pMh->fc.fromDS == 0)
231 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530232 vos_mem_copy( bssId, pMh->addr3, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 *pIgnore = 0;
234 }
235 else
236 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530237 vos_mem_copy( bssId, pMh->addr1, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 *pIgnore = 1;
239 }
240}
241
242char *
243limMlmStateStr(tLimMlmStates state)
244{
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 switch (state)
246 {
247 case eLIM_MLM_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700248 return "eLIM_MLM_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 case eLIM_MLM_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700250 return "eLIM_MLM_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 case eLIM_MLM_WT_PROBE_RESP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700252 return "eLIM_MLM_WT_PROBE_RESP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 case eLIM_MLM_PASSIVE_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700254 return "eLIM_MLM_PASSIVE_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700255 case eLIM_MLM_WT_JOIN_BEACON_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700256 return "eLIM_MLM_WT_JOIN_BEACON_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 case eLIM_MLM_JOINED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700258 return "eLIM_MLM_JOINED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 case eLIM_MLM_BSS_STARTED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700260 return "eLIM_MLM_BSS_STARTED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 return "eLIM_MLM_WT_AUTH_FRAME2_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 case eLIM_MLM_WT_AUTH_FRAME3_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700264 return "eLIM_MLM_WT_AUTH_FRAME3_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700266 return "eLIM_MLM_WT_AUTH_FRAME4_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 case eLIM_MLM_AUTH_RSP_TIMEOUT_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 return "eLIM_MLM_AUTH_RSP_TIMEOUT_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 case eLIM_MLM_AUTHENTICATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700270 return "eLIM_MLM_AUTHENTICATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700271 case eLIM_MLM_WT_ASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700272 return "eLIM_MLM_WT_ASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 case eLIM_MLM_WT_REASSOC_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 return "eLIM_MLM_WT_REASSOC_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 case eLIM_MLM_WT_FT_REASSOC_RSP_STATE:
276 return "eLIM_MLM_WT_FT_REASSOC_RSP_STATE";
277 case eLIM_MLM_WT_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700278 return "eLIM_MLM_WT_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 case eLIM_MLM_WT_DEL_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700280 return "eLIM_MLM_WT_DEL_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 case eLIM_MLM_WT_ADD_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700282 return "eLIM_MLM_WT_ADD_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 case eLIM_MLM_WT_ADD_BSS_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700284 return "eLIM_MLM_WT_ADD_BSS_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 case eLIM_MLM_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 return "eLIM_MLM_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 case eLIM_MLM_LINK_ESTABLISHED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 return "eLIM_MLM_LINK_ESTABLISHED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 case eLIM_MLM_WT_ASSOC_CNF_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700290 return "eLIM_MLM_WT_ASSOC_CNF_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 case eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700292 return "eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 case eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700294 return "eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 case eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE:
296 return "eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE";
297 case eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 return "eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 case eLIM_MLM_WT_SET_BSS_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 return "eLIM_MLM_WT_SET_BSS_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 case eLIM_MLM_WT_SET_STA_KEY_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700302 return "eLIM_MLM_WT_SET_STA_KEY_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700304 return "INVALID MLM state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700306}
307
308void
309limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state)
310{
311 limLog(pMac, logLevel, limMlmStateStr(state));
312}
313
314char *
315limSmeStateStr(tLimSmeStates state)
316{
317#ifdef FIXME_GEN6
318 switch (state)
319 {
320 case eLIM_SME_OFFLINE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700321 return "eLIM_SME_OFFLINE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 case eLIM_SME_IDLE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700323 return "eLIM_SME_IDLE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 case eLIM_SME_SUSPEND_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700325 return "eLIM_SME_SUSPEND_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 case eLIM_SME_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700327 return "eLIM_SME_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 case eLIM_SME_WT_JOIN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700329 return "eLIM_SME_WT_JOIN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 case eLIM_SME_WT_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 return "eLIM_SME_WT_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 case eLIM_SME_WT_ASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700333 return "eLIM_SME_WT_ASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 case eLIM_SME_WT_REASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700335 return "eLIM_SME_WT_REASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 return "eLIM_SME_WT_REASSOC_LINK_FAIL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 case eLIM_SME_JOIN_FAILURE_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700339 return "eLIM_SME_JOIN_FAILURE_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 case eLIM_SME_ASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700341 return "eLIM_SME_ASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 case eLIM_SME_REASSOCIATED_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700343 return "eLIM_SME_REASSOCIATED_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 case eLIM_SME_LINK_EST_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 return "eLIM_SME_LINK_EST_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 return "eLIM_SME_LINK_EST_WT_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 case eLIM_SME_WT_PRE_AUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700349 return "eLIM_SME_WT_PRE_AUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 case eLIM_SME_WT_DISASSOC_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 return "eLIM_SME_WT_DISASSOC_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 case eLIM_SME_WT_DEAUTH_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700353 return "eLIM_SME_WT_DEAUTH_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 case eLIM_SME_WT_START_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700355 return "eLIM_SME_WT_START_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 case eLIM_SME_WT_STOP_BSS_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700357 return "eLIM_SME_WT_STOP_BSS_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 case eLIM_SME_NORMAL_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 return "eLIM_SME_NORMAL_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 case eLIM_SME_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 return "eLIM_SME_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700363 return "eLIM_SME_NORMAL_CHANNEL_SCAN_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700365 return "INVALID SME state";
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 }
367#endif
368return "";
369}
370
371
372char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode)
373{
374#ifdef FIXME_GEN6
375
376 switch(dot11Mode)
377 {
378 case WNI_CFG_DOT11_MODE_ALL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700379 return "ALL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 case WNI_CFG_DOT11_MODE_11A:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700381 return "11A";
382 case WNI_CFG_DOT11_MODE_11B:
383 return "11B";
384 case WNI_CFG_DOT11_MODE_11G:
385 return "11G";
386 case WNI_CFG_DOT11_MODE_11N:
387 return "11N";
388 case WNI_CFG_DOT11_MODE_POLARIS:
389 return "Polaris";
390 case WNI_CFG_DOT11_MODE_TITAN:
391 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 case WNI_CFG_DOT11_MODE_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700393 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700394 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700395 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 }
397#endif
398return "";
399}
400
401
402char* limStaOpRateModeStr(tStaRateMode opRateMode)
403{
404#ifdef FIXME_GEN6
405
406 switch(opRateMode)
407 {
408 case eSTA_TAURUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700409 return "Taurus";
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 case eSTA_11a:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700411 return "11A";
412 case eSTA_11b:
413 return "11B";
414 case eSTA_11bg:
415 return "11G";
416 case eSTA_11n:
417 return "11N";
418 case eSTA_POLARIS:
419 return "Polaris";
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 case eSTA_TITAN:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700421 return "Titan";
Jeff Johnson295189b2012-06-20 16:38:30 -0700422 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700423 return "Invalid Dot11 Mode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 }
425#endif
426return "";
427}
428
429char* limBssTypeStr(tSirBssType bssType)
430{
431 switch(bssType)
432 {
433 case eSIR_INFRASTRUCTURE_MODE:
434 return "eSIR_INFRASTRUCTURE_MODE";
435 case eSIR_IBSS_MODE:
436 return "eSIR_IBSS_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700437 case eSIR_BTAMP_STA_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 return "eSIR_BTAMP_STA_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700439 case eSIR_BTAMP_AP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 return "eSIR_BTAMP_AP_MODE";
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700441 case eSIR_AUTO_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 return "eSIR_AUTO_MODE";
443 default:
444 return "Invalid BSS Type";
445 }
446}
447
448void
449limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state)
450{
451 limLog(pMac, logLevel, limSmeStateStr(state));
452}
453
454char *limMsgStr(tANI_U32 msgType)
455{
456#ifdef FIXME_GEN6
457 switch (msgType)
458 {
459 case eWNI_SME_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700460 return "eWNI_SME_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 case eWNI_SME_START_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700462 return "eWNI_SME_START_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 case eWNI_SME_SYS_READY_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700464 return "eWNI_SME_SYS_READY_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 case eWNI_SME_SCAN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700466 return "eWNI_SME_SCAN_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700467#ifdef FEATURE_OEM_DATA_SUPPORT
468 case eWNI_SME_OEM_DATA_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700469 return "eWNI_SME_OEM_DATA_REQ";
Jeff Johnsone7245742012-09-05 17:12:55 -0700470 case eWNI_SME_OEM_DATA_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700471 return "eWNI_SME_OEM_DATA_RSP";
Jeff Johnsone7245742012-09-05 17:12:55 -0700472#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 case eWNI_SME_SCAN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700474 return "eWNI_SME_SCAN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 case eWNI_SME_JOIN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700476 return "eWNI_SME_JOIN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 case eWNI_SME_JOIN_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700478 return "eWNI_SME_JOIN_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 case eWNI_SME_SETCONTEXT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 return "eWNI_SME_SETCONTEXT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 case eWNI_SME_SETCONTEXT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700482 return "eWNI_SME_SETCONTEXT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 case eWNI_SME_REASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700484 return "eWNI_SME_REASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 case eWNI_SME_REASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700486 return "eWNI_SME_REASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 case eWNI_SME_AUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700488 return "eWNI_SME_AUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 case eWNI_SME_AUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700490 return "eWNI_SME_AUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 case eWNI_SME_DISASSOC_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 return "eWNI_SME_DISASSOC_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eWNI_SME_DISASSOC_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 return "eWNI_SME_DISASSOC_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 case eWNI_SME_DISASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700496 return "eWNI_SME_DISASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 case eWNI_SME_DISASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700498 return "eWNI_SME_DISASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 case eWNI_SME_DEAUTH_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700500 return "eWNI_SME_DEAUTH_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 case eWNI_SME_DEAUTH_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700502 return "eWNI_SME_DEAUTH_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 case eWNI_SME_DEAUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700504 return "eWNI_SME_DEAUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 case eWNI_SME_WM_STATUS_CHANGE_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 return "eWNI_SME_WM_STATUS_CHANGE_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 case eWNI_SME_START_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700508 return "eWNI_SME_START_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 case eWNI_SME_START_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700510 return "eWNI_SME_START_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 case eWNI_SME_AUTH_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700512 return "eWNI_SME_AUTH_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 case eWNI_SME_ASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 return "eWNI_SME_ASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 case eWNI_SME_ASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700516 return "eWNI_SME_ASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eWNI_SME_REASSOC_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700518 return "eWNI_SME_REASSOC_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 case eWNI_SME_REASSOC_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700520 return "eWNI_SME_REASSOC_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 case eWNI_SME_SWITCH_CHL_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700522 return "eWNI_SME_SWITCH_CHL_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 case eWNI_SME_SWITCH_CHL_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700524 return "eWNI_SME_SWITCH_CHL_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700526 return "eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700528 return "eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 case eWNI_SME_STOP_BSS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 return "eWNI_SME_STOP_BSS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 case eWNI_SME_STOP_BSS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700532 return "eWNI_SME_STOP_BSS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 case eWNI_SME_PROMISCUOUS_MODE_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700534 return "eWNI_SME_PROMISCUOUS_MODE_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 case eWNI_SME_PROMISCUOUS_MODE_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700536 return "eWNI_SME_PROMISCUOUS_MODE_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 case eWNI_SME_NEIGHBOR_BSS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700538 return "eWNI_SME_NEIGHBOR_BSS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 case eWNI_SME_MEASUREMENT_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 return "eWNI_SME_MEASUREMENT_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 case eWNI_SME_MEASUREMENT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700542 return "eWNI_SME_MEASUREMENT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 case eWNI_SME_MEASUREMENT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700544 return "eWNI_SME_MEASUREMENT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 case eWNI_SME_SET_WDS_INFO_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700546 return "eWNI_SME_SET_WDS_INFO_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 case eWNI_SME_SET_WDS_INFO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700548 return "eWNI_SME_SET_WDS_INFO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 case eWNI_SME_WDS_INFO_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700550 return "eWNI_SME_WDS_INFO_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 case eWNI_SME_DEAUTH_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700552 return "eWNI_SME_DEAUTH_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 case eWNI_SME_MIC_FAILURE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700554 return "eWNI_SME_MIC_FAILURE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 return "eWNI_SME_ADDTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 case eWNI_SME_ADDTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700558 return "eWNI_SME_ADDTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 case eWNI_SME_ADDTS_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700560 return "eWNI_SME_ADDTS_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 case eWNI_SME_ADDTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 return "eWNI_SME_ADDTS_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 return "eWNI_SME_DELTS_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eWNI_SME_DELTS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700566 return "eWNI_SME_DELTS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 case eWNI_SME_DELTS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 return "eWNI_SME_DELTS_IND";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800569#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
570 case eWNI_SME_GET_ROAM_RSSI_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700571 return "eWNI_SME_GET_ROAM_RSSI_REQ";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800572 case eWNI_SME_GET_ROAM_RSSI_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700573 return "eWNI_SME_GET_ROAM_RSSI_RSP";
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -0800574#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700575
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 case WDA_SUSPEND_ACTIVITY_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700577 return "WDA_SUSPEND_ACTIVITY_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 case SIR_LIM_RETRY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700579 return "SIR_LIM_RETRY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 case SIR_BB_XPORT_MGMT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700581 return "SIR_BB_XPORT_MGMT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700583 return "SIR_LIM_INV_KEY_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 return "SIR_LIM_KEY_ID_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 return "SIR_LIM_REPLAY_THRES_INTERRUPT_MSG";
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700589 return "SIR_LIM_MIN_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700591 return "SIR_LIM_MAX_CHANNEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 return "SIR_LIM_JOIN_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 case SIR_LIM_AUTH_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700595 return "SIR_LIM_AUTH_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 case SIR_LIM_AUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700597 return "SIR_LIM_AUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700599 return "SIR_LIM_ASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700601 return "SIR_LIM_REASSOC_FAIL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 case SIR_LIM_HEART_BEAT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700603 return "SIR_LIM_HEART_BEAT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700605 return "SIR_LIM_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 return "SIR_LIM_CHANNEL_SCAN_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 case SIR_LIM_LINK_TEST_DURATION_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700609 return "SIR_LIM_LINK_TEST_DURATION_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700611 return "SIR_LIM_HASH_MISS_THRES_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 case SIR_LIM_KEEPALIVE_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 return "SIR_LIM_KEEPALIVE_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 return "SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 case SIR_LIM_CNF_WAIT_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 return "SIR_LIM_CNF_WAIT_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 case SIR_LIM_RADAR_DETECT_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 return "SIR_LIM_RADAR_DETECT_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700620#ifdef WLAN_FEATURE_VOWIFI_11R
621 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700622 return "SIR_LIM_FT_PREAUTH_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700623#endif
624
625 case SIR_HAL_APP_SETUP_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 return "SIR_HAL_APP_SETUP_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 case SIR_HAL_INITIAL_CAL_FAILED_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700628 return "SIR_HAL_INITIAL_CAL_FAILED_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 case SIR_HAL_NIC_OPER_NTF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700630 return "SIR_HAL_NIC_OPER_NTF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 case SIR_HAL_INIT_START_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700632 return "SIR_HAL_INIT_START_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 case SIR_HAL_SHUTDOWN_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700634 return "SIR_HAL_SHUTDOWN_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 case SIR_HAL_SHUTDOWN_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700636 return "SIR_HAL_SHUTDOWN_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 case SIR_HAL_RESET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700638 return "SIR_HAL_RESET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 case SIR_HAL_RESET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700640 return "SIR_HAL_RESET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 case SIR_WRITE_TO_TD:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700642 return "SIR_WRITE_TO_TD";
Jeff Johnson295189b2012-06-20 16:38:30 -0700643
644 case WNI_CFG_PARAM_UPDATE_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700645 return "WNI_CFG_PARAM_UPDATE_IND";
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 case WNI_CFG_DNLD_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700647 return "WNI_CFG_DNLD_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 case WNI_CFG_DNLD_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700649 return "WNI_CFG_DNLD_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case WNI_CFG_GET_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700651 return "WNI_CFG_GET_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 case WNI_CFG_SET_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700653 return "WNI_CFG_SET_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 case WNI_CFG_GET_ATTRIB_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700655 return "WNI_CFG_GET_ATTRIB_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 case WNI_CFG_ADD_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700657 return "WNI_CFG_ADD_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case WNI_CFG_DEL_GRP_ADDR_CNF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 return "WNI_CFG_DEL_GRP_ADDR_CNF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case ANI_CFG_GET_RADIO_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700661 return "ANI_CFG_GET_RADIO_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 case ANI_CFG_GET_PER_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700663 return "ANI_CFG_GET_PER_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 case ANI_CFG_GET_AGG_STA_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 return "ANI_CFG_GET_AGG_STA_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 case ANI_CFG_CLEAR_STAT_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700667 return "ANI_CFG_CLEAR_STAT_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case WNI_CFG_DNLD_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700669 return "WNI_CFG_DNLD_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 case WNI_CFG_GET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 return "WNI_CFG_GET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 case WNI_CFG_SET_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700673 return "WNI_CFG_SET_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case WNI_CFG_SET_REQ_NO_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 return "WNI_CFG_SET_REQ_NO_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 case eWNI_PMC_ENTER_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700677 return "eWNI_PMC_ENTER_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 case eWNI_PMC_EXIT_IMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700679 return "eWNI_PMC_EXIT_IMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 case eWNI_PMC_ENTER_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700681 return "eWNI_PMC_ENTER_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 case eWNI_PMC_EXIT_BMPS_RSP:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700683 return "eWNI_PMC_EXIT_BMPS_RSP";
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eWNI_PMC_EXIT_BMPS_IND:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 return "eWNI_PMC_EXIT_BMPS_IND";
Yathish9f22e662012-12-10 14:21:35 -0800686 case eWNI_SME_SET_BCN_FILTER_REQ:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700687 return "eWNI_SME_SET_BCN_FILTER_REQ";
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 return "INVALID SME message";
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691#endif
692return "";
693}
694
695
696
697char *limResultCodeStr(tSirResultCodes resultCode)
698{
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 switch (resultCode)
700 {
701 case eSIR_SME_SUCCESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 return "eSIR_SME_SUCCESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 case eSIR_EOF_SOF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700704 return "eSIR_EOF_SOF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 case eSIR_BMU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700706 return "eSIR_BMU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 case eSIR_LOW_PDU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700708 return "eSIR_LOW_PDU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 case eSIR_USER_TRIG_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700710 return"eSIR_USER_TRIG_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 case eSIR_LOGP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700712 return "eSIR_LOGP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 case eSIR_CP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700714 return "eSIR_CP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 case eSIR_STOP_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700716 return "eSIR_STOP_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 case eSIR_AHB_HANG_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 return "eSIR_AHB_HANG_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 case eSIR_DPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 return "eSIR_DPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 case eSIR_RXP_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700722 return "eSIR_RXP_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 case eSIR_MCPU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700724 return "eSIR_MCPU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 case eSIR_MCU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 return "eSIR_MCU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 case eSIR_MTU_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700728 return "eSIR_MTU_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 case eSIR_MIF_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700730 return "eSIR_MIF_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 case eSIR_FW_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700732 return "eSIR_FW_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 case eSIR_MAILBOX_SANITY_CHK_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700734 return "eSIR_MAILBOX_SANITY_CHK_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 case eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700736 return "eSIR_RADIO_HW_SWITCH_STATUS_IS_OFF";
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 case eSIR_CFB_FLAG_STUCK_EXCEPTION:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700738 return "eSIR_CFB_FLAG_STUCK_EXCEPTION";
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 case eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700740 return "eSIR_SME_BASIC_RATES_NOT_SUPPORTED_STATUS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 case eSIR_SME_INVALID_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700742 return "eSIR_SME_INVALID_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 case eSIR_SME_UNEXPECTED_REQ_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700744 return "eSIR_SME_UNEXPECTED_REQ_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 case eSIR_SME_RESOURCES_UNAVAILABLE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700746 return "eSIR_SME_RESOURCES_UNAVAILABLE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 case eSIR_SME_SCAN_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700748 return "eSIR_SME_SCAN_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 case eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700750 return "eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 case eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700752 return "eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 case eSIR_SME_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700754 return "eSIR_SME_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 case eSIR_SME_JOIN_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700756 return "eSIR_SME_JOIN_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 case eSIR_SME_AUTH_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700758 return "eSIR_SME_AUTH_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 case eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700760 return "eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 case eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700762 return "eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 case eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700764 return "eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 case eSIR_SME_AUTH_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700766 return "eSIR_SME_AUTH_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 case eSIR_SME_INVALID_WEP_DEFAULT_KEY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700768 return "eSIR_SME_INVALID_WEP_DEFAULT_KEY";
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 case eSIR_SME_ASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700770 return "eSIR_SME_ASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 case eSIR_SME_REASSOC_REFUSED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700772 return "eSIR_SME_REASSOC_REFUSED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 case eSIR_SME_STA_NOT_AUTHENTICATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700774 return "eSIR_SME_STA_NOT_AUTHENTICATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 case eSIR_SME_STA_NOT_ASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700776 return "eSIR_SME_STA_NOT_ASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 case eSIR_SME_STA_DISASSOCIATED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700778 return "eSIR_SME_STA_DISASSOCIATED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 case eSIR_SME_ALREADY_JOINED_A_BSS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700780 return "eSIR_SME_ALREADY_JOINED_A_BSS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 case eSIR_ULA_COMPLETED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700782 return "eSIR_ULA_COMPLETED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 case eSIR_ULA_FAILURE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700784 return "eSIR_ULA_FAILURE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case eSIR_SME_LINK_ESTABLISHED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700786 return "eSIR_SME_LINK_ESTABLISHED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 case eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700788 return "eSIR_SME_UNABLE_TO_PERFORM_MEASUREMENTS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 case eSIR_SME_UNABLE_TO_PERFORM_DFS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700790 return "eSIR_SME_UNABLE_TO_PERFORM_DFS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 case eSIR_SME_DFS_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 return "eSIR_SME_DFS_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 case eSIR_SME_TRANSFER_STA:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700794 return "eSIR_SME_TRANSFER_STA";
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 case eSIR_SME_INVALID_LINK_TEST_PARAMETERS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700796 return "eSIR_SME_INVALID_LINK_TEST_PARAMETERS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 case eSIR_SME_LINK_TEST_MAX_EXCEEDED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700798 return "eSIR_SME_LINK_TEST_MAX_EXCEEDED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 case eSIR_SME_UNSUPPORTED_RATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700800 return "eSIR_SME_UNSUPPORTED_RATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 case eSIR_SME_LINK_TEST_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700802 return "eSIR_SME_LINK_TEST_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 case eSIR_SME_LINK_TEST_COMPLETE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700804 return "eSIR_SME_LINK_TEST_COMPLETE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 case eSIR_SME_LINK_TEST_INVALID_STATE:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700806 return "eSIR_SME_LINK_TEST_INVALID_STATE";
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 case eSIR_SME_LINK_TEST_INVALID_ADDRESS:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 return "eSIR_SME_LINK_TEST_INVALID_ADDRESS";
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 case eSIR_SME_POLARIS_RESET:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700810 return "eSIR_SME_POLARIS_RESET";
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 case eSIR_SME_SETCONTEXT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 return "eSIR_SME_SETCONTEXT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 case eSIR_SME_BSS_RESTART:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700814 return "eSIR_SME_BSS_RESTART";
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 case eSIR_SME_MORE_SCAN_RESULTS_FOLLOW:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700816 return "eSIR_SME_MORE_SCAN_RESULTS_FOLLOW";
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 case eSIR_SME_INVALID_ASSOC_RSP_RXED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700818 return "eSIR_SME_INVALID_ASSOC_RSP_RXED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 case eSIR_SME_MIC_COUNTER_MEASURES:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700820 return "eSIR_SME_MIC_COUNTER_MEASURES";
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 case eSIR_SME_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700822 return "eSIR_SME_ADDTS_RSP_TIMEOUT";
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 case eSIR_SME_RECEIVED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700824 return "eSIR_SME_RECEIVED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 case eSIR_SME_CHANNEL_SWITCH_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700826 return "eSIR_SME_CHANNEL_SWITCH_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700827#ifdef GEN4_SCAN
828 case eSIR_SME_CHANNEL_SWITCH_DISABLED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700829 return "eSIR_SME_CHANNEL_SWITCH_DISABLED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 case eSIR_SME_HAL_SCAN_INIT_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700831 return "eSIR_SME_HAL_SCAN_INIT_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 case eSIR_SME_HAL_SCAN_START_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700833 return "eSIR_SME_HAL_SCAN_START_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 case eSIR_SME_HAL_SCAN_END_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 return "eSIR_SME_HAL_SCAN_END_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 case eSIR_SME_HAL_SCAN_FINISH_FAILED:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700837 return "eSIR_SME_HAL_SCAN_FINISH_FAILED";
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 case eSIR_SME_HAL_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700839 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700840#else // 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_SEND_MESSAGE_FAIL:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700844 return "eSIR_SME_HAL_SEND_MESSAGE_FAIL";
Jeff Johnson295189b2012-06-20 16:38:30 -0700845#endif // GEN4_SCAN
846
847 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700848 return "INVALID resultCode";
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700850}
851
852void
853limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType)
854{
855 limLog(pMac, logLevel, limMsgStr(msgType));
856}
857
Jeff Johnson295189b2012-06-20 16:38:30 -0700858void
859limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg)
860{
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 if (logLevel <= pMac->utils.gLogDbgLevel[SIR_LIM_MODULE_ID - LOG_FIRST_MODULE_ID])
862 {
863 switch (msg->type)
864 {
865 case SIR_BB_XPORT_MGMT_MSG:
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 limPrintMsgName(pMac, logLevel,msg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 break;
868 default:
869 limPrintMsgName(pMac, logLevel,msg->type);
870 break;
871 }
872 }
873}
874
875/**
876 * limInitMlm()
877 *
878 *FUNCTION:
879 * This function is called by limProcessSmeMessages() to
880 * initialize MLM state machine on STA
881 *
882 *PARAMS:
883 *
884 *LOGIC:
885 *
886 *ASSUMPTIONS:
887 * NA
888 *
889 *NOTE:
890 * NA
891 *
892 * @param pMac Pointer to Global MAC structure
893 * @return None
894 */
895void
896limInitMlm(tpAniSirGlobal pMac)
897{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700898 tANI_U32 retVal;
899
900 pMac->lim.gLimTimersCreated = 0;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700901
Jeff Johnsone7245742012-09-05 17:12:55 -0700902 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700903
904 /// Initialize scan result hash table
905 limReInitScanResults(pMac); //sep26th review
906
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700907#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
908 /// Initialize lfr scan result hash table
909 // Could there be a problem in multisession with SAP/P2P GO, when in the
910 // middle of FW bg scan, SAP started; Again that could be a problem even on
911 // infra + SAP/P2P GO too - TBD
912 limReInitLfrScanResults(pMac);
913#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700914
915 /// Initialize number of pre-auth contexts
916 pMac->lim.gLimNumPreAuthContexts = 0;
917
918 /// Initialize MAC based Authentication STA list
919 limInitPreAuthList(pMac);
920
921 //pMac->lim.gpLimMlmJoinReq = NULL;
922
923 if (pMac->lim.gLimTimersCreated)
924 return;
925
926 // Create timers used by LIM
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700927 retVal = limCreateTimers(pMac);
928 if(retVal == TX_SUCCESS)
929 {
930 pMac->lim.gLimTimersCreated = 1;
931 }
932 else
933 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700934 limLog(pMac, LOGP, FL(" limCreateTimers Failed to create lim timers "));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700935 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700936} /*** end limInitMlm() ***/
937
938
939
940/**
941 * limCleanupMlm()
942 *
943 *FUNCTION:
944 * This function is called to cleanup any resources
945 * allocated by the MLM state machine.
946 *
947 *PARAMS:
948 *
949 *LOGIC:
950 *
951 *ASSUMPTIONS:
952 * NA
953 *
954 *NOTE:
955 * It is assumed that BSS is already informed that we're leaving it
956 * before this function is called.
957 *
958 * @param pMac Pointer to Global MAC structure
959 * @param None
960 * @return None
961 */
962void
963limCleanupMlm(tpAniSirGlobal pMac)
964{
965 tANI_U32 n;
966 tLimPreAuthNode *pAuthNode;
967
968 if (pMac->lim.gLimTimersCreated == 1)
969 {
970 // Deactivate and delete MIN/MAX channel timers.
971 tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer);
972 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
973 tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer);
974 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
975 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
976 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
977
978
979 // Deactivate and delete channel switch timer.
980 tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer);
981 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
982
983
984 // Deactivate and delete addts response timer.
985 tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer);
986 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
987
988 // Deactivate and delete Join failure timer.
989 tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer);
990 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
991
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800992 // Deactivate and delete Periodic Join Probe Request timer.
993 tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
994 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
995
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 // Deactivate and delete Association failure timer.
997 tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer);
998 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
999
1000 // Deactivate and delete Reassociation failure timer.
1001 tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer);
1002 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
1003
1004 // Deactivate and delete Authentication failure timer.
1005 tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer);
1006 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
1007
1008 // Deactivate and delete Heartbeat timer.
1009 tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1010 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
1011
1012 // Deactivate and delete wait-for-probe-after-Heartbeat timer.
1013 tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1014 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
1015
1016 // Deactivate and delete Quiet timer.
1017 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer);
1018 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
1019
1020 // Deactivate and delete Quiet BSS timer.
1021 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer);
1022 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
1023
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 // Deactivate and delete LIM background scan timer.
1025 tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer);
1026 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001027
1028
1029 // Deactivate and delete cnf wait timer
1030 for (n = 0; n < pMac->lim.maxStation; n++)
1031 {
1032 tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1033 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[n]);
1034 }
1035
1036 // Deactivate and delete keepalive timer
1037 tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer);
1038 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
1039
1040 pAuthNode = pMac->lim.gLimPreAuthTimerTable.pTable;
1041
1042 //Deactivate any Authentication response timers
1043 limDeletePreAuthList(pMac);
1044
1045 for (n = 0; n < pMac->lim.gLimPreAuthTimerTable.numEntry; n++,pAuthNode++)
1046 {
1047 // Delete any Authentication response
1048 // timers, which might have been started.
1049 tx_timer_delete(&pAuthNode->timer);
1050 }
1051
Jeff Johnson295189b2012-06-20 16:38:30 -07001052
1053
1054 // Deactivate and delete Hash Miss throttle timer
1055 tx_timer_deactivate(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1056 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
1057
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 tx_timer_deactivate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1059 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
1060 tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1061 tx_timer_delete(&pMac->lim.limTimers.gLimPreAuthClnupTimer);
1062
1063#if 0 // The WPS PBC clean up timer is disabled
1064 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1065 {
1066 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_TRUE)
1067 {
1068 tx_timer_deactivate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1069 tx_timer_delete(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer);
1070 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_FALSE;
1071 }
1072 }
1073#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001074#ifdef WLAN_FEATURE_VOWIFI_11R
1075 // Deactivate and delete FT Preauth response timer
1076 tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1077 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
1078#endif
1079
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 // Deactivate and delete remain on channel timer
1081 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
1082 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001083
1084#ifdef FEATURE_WLAN_CCX
1085 // Deactivate and delete TSM
1086 tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer);
1087 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
1088#endif
1089
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001090 tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer);
1091 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
1092
1093 tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer);
1094 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
1095
Hoonki Leef63df0d2013-01-16 19:29:14 -08001096 tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
1097 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Hoonki Leef63df0d2013-01-16 19:29:14 -08001098
Gopichand Nakkala0d6e4ad2013-05-17 02:30:25 +05301099 tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1100 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
1101
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 pMac->lim.gLimTimersCreated = 0;
1103 }
1104
1105 /// Cleanup cached scan list
1106 limReInitScanResults(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001107#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1108 /// Cleanup cached scan list
1109 limReInitLfrScanResults(pMac);
1110#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001111
1112} /*** end limCleanupMlm() ***/
1113
1114
1115
1116/**
1117 * limCleanupLmm()
1118 *
1119 *FUNCTION:
1120 * This function is called to cleanup any resources
1121 * allocated by LMM sub-module.
1122 *
1123 *PARAMS:
1124 *
1125 *LOGIC:
1126 *
1127 *ASSUMPTIONS:
1128 * NA
1129 *
1130 *NOTE:
1131 * NA
1132 *
1133 * @param pMac Pointer to Global MAC structure
1134 * @return None
1135 */
1136
1137void
1138limCleanupLmm(tpAniSirGlobal pMac)
1139{
Jeff Johnson295189b2012-06-20 16:38:30 -07001140} /*** end limCleanupLmm() ***/
1141
1142
1143
1144/**
1145 * limIsAddrBC()
1146 *
1147 *FUNCTION:
1148 * This function is called in various places within LIM code
1149 * to determine whether passed MAC address is a broadcast or not
1150 *
1151 *LOGIC:
1152 *
1153 *ASSUMPTIONS:
1154 * NA
1155 *
1156 *NOTE:
1157 * NA
1158 *
1159 * @param macAddr Indicates MAC address that need to be determined
1160 * whether it is Broadcast address or not
1161 *
1162 * @return true if passed address is Broadcast address else false
1163 */
1164
1165tANI_U8
1166limIsAddrBC(tSirMacAddr macAddr)
1167{
1168 int i;
1169 for (i = 0; i < 6; i++)
1170 {
1171 if ((macAddr[i] & 0xFF) != 0xFF)
1172 return false;
1173 }
1174
1175 return true;
1176} /****** end limIsAddrBC() ******/
1177
1178
1179
1180/**
1181 * limIsGroupAddr()
1182 *
1183 *FUNCTION:
1184 * This function is called in various places within LIM code
1185 * to determine whether passed MAC address is a group address or not
1186 *
1187 *LOGIC:
1188 * If least significant bit of first octet of the MAC address is
1189 * set to 1, it is a Group address.
1190 *
1191 *ASSUMPTIONS:
1192 * NA
1193 *
1194 *NOTE:
1195 * NA
1196 *
1197 * @param macAddr Indicates MAC address that need to be determined
1198 * whether it is Group address or not
1199 *
1200 * @return true if passed address is Group address else false
1201 */
1202
1203tANI_U8
1204limIsGroupAddr(tSirMacAddr macAddr)
1205{
1206 if ((macAddr[0] & 0x01) == 0x01)
1207 return true;
1208 else
1209 return false;
1210} /****** end limIsGroupAddr() ******/
1211
1212/**
1213 * limPostMsgApiNoWait()
1214 *
1215 *FUNCTION:
1216 * This function is called from other thread while posting a
1217 * message to LIM message Queue gSirLimMsgQ with NO_WAIT option
1218 *
1219 *LOGIC:
1220 * NA
1221 *
1222 *ASSUMPTIONS:
1223 * NA
1224 *
1225 *NOTE:
1226 * NA
1227 *
1228 * @param pMsg - Pointer to the Global MAC structure
1229 * @param pMsg - Pointer to the message structure
1230 * @return None
1231 */
1232
1233tANI_U32
1234limPostMsgApiNoWait(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1235{
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 limProcessMessages(pMac, pMsg);
1237 return TX_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001238} /*** end limPostMsgApiNoWait() ***/
1239
1240
1241
1242/**
1243 * limPrintMacAddr()
1244 *
1245 *FUNCTION:
1246 * This function is called to print passed MAC address
1247 * in : format.
1248 *
1249 *LOGIC:
1250 *
1251 *ASSUMPTIONS:
1252 * NA
1253 *
1254 *NOTE:
1255 * @param macAddr - MacAddr to be printed
1256 * @param logLevel - Loglevel to be used
1257 *
1258 * @return None.
1259 */
1260
1261void
1262limPrintMacAddr(tpAniSirGlobal pMac, tSirMacAddr macAddr, tANI_U8 logLevel)
1263{
1264 limLog(pMac, logLevel,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001265 FL("%X:%X:%X:%X:%X:%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4],
1267 macAddr[5]);
1268} /****** end limPrintMacAddr() ******/
1269
1270
1271
1272
1273
1274
1275/*
1276 * limResetDeferredMsgQ()
1277 *
1278 *FUNCTION:
1279 * This function resets the deferred message queue parameters.
1280 *
1281 *PARAMS:
1282 * @param pMac - Pointer to Global MAC structure
1283 *
1284 *LOGIC:
1285 *
1286 *ASSUMPTIONS:
1287 * NA
1288 *
1289 *NOTE:
1290 * NA
1291 *
1292 *RETURNS:
1293 * None
1294 */
1295
1296void limResetDeferredMsgQ(tpAniSirGlobal pMac)
1297{
1298 pMac->lim.gLimDeferredMsgQ.size =
1299 pMac->lim.gLimDeferredMsgQ.write =
1300 pMac->lim.gLimDeferredMsgQ.read = 0;
1301
1302}
1303
1304
1305#define LIM_DEFERRED_Q_CHECK_THRESHOLD (MAX_DEFERRED_QUEUE_LEN/2)
1306#define LIM_MAX_NUM_MGMT_FRAME_DEFERRED (MAX_DEFERRED_QUEUE_LEN/2)
1307
1308/*
1309 * limWriteDeferredMsgQ()
1310 *
1311 *FUNCTION:
1312 * This function queues up a deferred message for later processing on the
1313 * STA side.
1314 *
1315 *PARAMS:
1316 * @param pMac - Pointer to Global MAC structure
1317 * @param limMsg - a LIM message
1318 *
1319 *LOGIC:
1320 *
1321 *ASSUMPTIONS:
1322 * NA
1323 *
1324 *NOTE:
1325 * NA
1326 *
1327 *RETURNS:
1328 * None
1329 */
1330
1331tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1332{
1333 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001334 FL("** Queue a deferred message (size %d, write %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.write,
1336 limMsg->type);)
1337
1338 /*
1339 ** check if the deferred message queue is full
1340 **/
1341 if (pMac->lim.gLimDeferredMsgQ.size >= MAX_DEFERRED_QUEUE_LEN)
1342 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001343 if(!(pMac->lim.deferredMsgCnt & 0xF))
1344 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001345 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 -07001346 }
1347 else
1348 {
1349 pMac->lim.deferredMsgCnt++;
1350 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 return TX_QUEUE_FULL;
1352 }
1353
1354 /*
1355 ** In the application, there should not be more than 1 message get
1356 ** queued up. If happens, flags a warning. In the future, this can
1357 ** happen.
1358 **/
1359 if (pMac->lim.gLimDeferredMsgQ.size > 0)
1360 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001361 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 -07001362 pMac->lim.gLimDeferredMsgQ.size, limMsg->type,
1363 limIsSystemInScanState(pMac),
1364 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1365 pMac->lim.gLimAddtsSent);)
1366 }
1367
1368 /*
1369 ** To prevent the deferred Q is full of management frames, only give them certain space
1370 **/
1371 if( SIR_BB_XPORT_MGMT_MSG == limMsg->type )
1372 {
1373 if( LIM_DEFERRED_Q_CHECK_THRESHOLD < pMac->lim.gLimDeferredMsgQ.size )
1374 {
1375 tANI_U16 idx, count = 0;
1376 for(idx = 0; idx < pMac->lim.gLimDeferredMsgQ.size; idx++)
1377 {
1378 if( SIR_BB_XPORT_MGMT_MSG == pMac->lim.gLimDeferredMsgQ.deferredQueue[idx].type )
1379 {
1380 count++;
1381 }
1382 }
1383 if( LIM_MAX_NUM_MGMT_FRAME_DEFERRED < count )
1384 {
1385 //We reach the quota for management frames, drop this one
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07001386 PELOGW(limLog(pMac, LOGW, FL("Cannot deferred. Msg: %d Too many (count=%d) already"), limMsg->type, count);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 //Return error, caller knows what to do
1388 return TX_QUEUE_FULL;
1389 }
1390 }
1391 }
1392
1393 ++pMac->lim.gLimDeferredMsgQ.size;
1394
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001395 /* reset the count here since we are able to defer the message */
1396 if(pMac->lim.deferredMsgCnt != 0)
1397 {
1398 pMac->lim.deferredMsgCnt = 0;
1399 }
1400
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 /*
1402 ** if the write pointer hits the end of the queue, rewind it
1403 **/
1404 if (pMac->lim.gLimDeferredMsgQ.write >= MAX_DEFERRED_QUEUE_LEN)
1405 pMac->lim.gLimDeferredMsgQ.write = 0;
1406
1407 /*
1408 ** save the message to the queue and advanced the write pointer
1409 **/
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301410 vos_mem_copy( (tANI_U8 *)&pMac->lim.gLimDeferredMsgQ.deferredQueue[
1411 pMac->lim.gLimDeferredMsgQ.write++],
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 (tANI_U8 *)limMsg,
1413 sizeof(tSirMsgQ));
1414 return TX_SUCCESS;
1415
1416}
1417
1418/*
1419 * limReadDeferredMsgQ()
1420 *
1421 *FUNCTION:
1422 * This function dequeues a deferred message for processing on the
1423 * STA side.
1424 *
1425 *PARAMS:
1426 * @param pMac - Pointer to Global MAC structure
1427 *
1428 *LOGIC:
1429 *
1430 *ASSUMPTIONS:
1431 * NA
1432 *
1433 *NOTE:
1434 *
1435 *
1436 *RETURNS:
1437 * Returns the message at the head of the deferred message queue
1438 */
1439
1440tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac)
1441{
1442 tSirMsgQ *msg;
1443
1444 /*
1445 ** check any messages left. If no, return
1446 **/
1447 if (pMac->lim.gLimDeferredMsgQ.size <= 0)
1448 return NULL;
1449
1450 /*
1451 ** decrement the queue size
1452 **/
1453 pMac->lim.gLimDeferredMsgQ.size--;
1454
1455 /*
1456 ** retrieve the message from the head of the queue
1457 **/
1458 msg = &pMac->lim.gLimDeferredMsgQ.deferredQueue[pMac->lim.gLimDeferredMsgQ.read];
1459
1460 /*
1461 ** advance the read pointer
1462 **/
1463 pMac->lim.gLimDeferredMsgQ.read++;
1464
1465 /*
1466 ** if the read pointer hits the end of the queue, rewind it
1467 **/
1468 if (pMac->lim.gLimDeferredMsgQ.read >= MAX_DEFERRED_QUEUE_LEN)
1469 pMac->lim.gLimDeferredMsgQ.read = 0;
1470
1471 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001472 FL("** DeQueue a deferred message (size %d read %d) - type 0x%x **"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 pMac->lim.gLimDeferredMsgQ.size, pMac->lim.gLimDeferredMsgQ.read,
1474 msg->type);)
1475
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001476 PELOG1(limLog(pMac, LOG1, FL("DQ msg -- scan %d, global sme %d, global mlme %d, addts %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 limIsSystemInScanState(pMac),
1478 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1479 pMac->lim.gLimAddtsSent);)
1480
1481 return(msg);
1482}
1483
1484tSirRetStatus
1485limSysProcessMmhMsgApi(tpAniSirGlobal pMac,
1486 tSirMsgQ *pMsg,
1487 tANI_U8 qType)
1488{
1489// FIXME
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 SysProcessMmhMsg(pMac, pMsg);
1491 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001492}
1493
1494char *limFrameStr(tANI_U32 type, tANI_U32 subType)
1495{
1496#ifdef FIXME_GEN6
1497
1498 if (type == SIR_MAC_MGMT_FRAME)
1499 {
1500 switch (subType)
1501 {
1502 case SIR_MAC_MGMT_ASSOC_REQ:
1503 return "MAC_MGMT_ASSOC_REQ";
1504 case SIR_MAC_MGMT_ASSOC_RSP:
1505 return "MAC_MGMT_ASSOC_RSP";
1506 case SIR_MAC_MGMT_REASSOC_REQ:
1507 return "MAC_MGMT_REASSOC_REQ";
1508 case SIR_MAC_MGMT_REASSOC_RSP:
1509 return "MAC_MGMT_REASSOC_RSP";
1510 case SIR_MAC_MGMT_PROBE_REQ:
1511 return "MAC_MGMT_PROBE_REQ";
1512 case SIR_MAC_MGMT_PROBE_RSP:
1513 return "MAC_MGMT_PROBE_RSP";
1514 case SIR_MAC_MGMT_BEACON:
1515 return "MAC_MGMT_BEACON";
1516 case SIR_MAC_MGMT_ATIM:
1517 return "MAC_MGMT_ATIM";
1518 case SIR_MAC_MGMT_DISASSOC:
1519 return "MAC_MGMT_DISASSOC";
1520 case SIR_MAC_MGMT_AUTH:
1521 return "MAC_MGMT_AUTH";
1522 case SIR_MAC_MGMT_DEAUTH:
1523 return "MAC_MGMT_DEAUTH";
1524 case SIR_MAC_MGMT_ACTION:
1525 return "MAC_MGMT_ACTION";
1526 case SIR_MAC_MGMT_RESERVED15:
1527 return "MAC_MGMT_RESERVED15";
1528 default:
1529 return "Unknown MGMT Frame";
1530 }
1531 }
1532
1533 else if (type == SIR_MAC_CTRL_FRAME)
1534 {
1535 switch (subType)
1536 {
1537 case SIR_MAC_CTRL_RR:
1538 return "MAC_CTRL_RR";
1539 case SIR_MAC_CTRL_BAR:
1540 return "MAC_CTRL_BAR";
1541 case SIR_MAC_CTRL_BA:
1542 return "MAC_CTRL_BA";
1543 case SIR_MAC_CTRL_PS_POLL:
1544 return "MAC_CTRL_PS_POLL";
1545 case SIR_MAC_CTRL_RTS:
1546 return "MAC_CTRL_RTS";
1547 case SIR_MAC_CTRL_CTS:
1548 return "MAC_CTRL_CTS";
1549 case SIR_MAC_CTRL_ACK:
1550 return "MAC_CTRL_ACK";
1551 case SIR_MAC_CTRL_CF_END:
1552 return "MAC_CTRL_CF_END";
1553 case SIR_MAC_CTRL_CF_END_ACK:
1554 return "MAC_CTRL_CF_END_ACK";
1555 default:
1556 return "Unknown CTRL Frame";
1557 }
1558 }
1559
1560 else if (type == SIR_MAC_DATA_FRAME)
1561 {
1562 switch (subType)
1563 {
1564 case SIR_MAC_DATA_DATA:
1565 return "MAC_DATA_DATA";
1566 case SIR_MAC_DATA_DATA_ACK:
1567 return "MAC_DATA_DATA_ACK";
1568 case SIR_MAC_DATA_DATA_POLL:
1569 return "MAC_DATA_DATA_POLL";
1570 case SIR_MAC_DATA_DATA_ACK_POLL:
1571 return "MAC_DATA_DATA_ACK_POLL";
1572 case SIR_MAC_DATA_NULL:
1573 return "MAC_DATA_NULL";
1574 case SIR_MAC_DATA_NULL_ACK:
1575 return "MAC_DATA_NULL_ACK";
1576 case SIR_MAC_DATA_NULL_POLL:
1577 return "MAC_DATA_NULL_POLL";
1578 case SIR_MAC_DATA_NULL_ACK_POLL:
1579 return "MAC_DATA_NULL_ACK_POLL";
1580 case SIR_MAC_DATA_QOS_DATA:
1581 return "MAC_DATA_QOS_DATA";
1582 case SIR_MAC_DATA_QOS_DATA_ACK:
1583 return "MAC_DATA_QOS_DATA_ACK";
1584 case SIR_MAC_DATA_QOS_DATA_POLL:
1585 return "MAC_DATA_QOS_DATA_POLL";
1586 case SIR_MAC_DATA_QOS_DATA_ACK_POLL:
1587 return "MAC_DATA_QOS_DATA_ACK_POLL";
1588 case SIR_MAC_DATA_QOS_NULL:
1589 return "MAC_DATA_QOS_NULL";
1590 case SIR_MAC_DATA_QOS_NULL_ACK:
1591 return "MAC_DATA_QOS_NULL_ACK";
1592 case SIR_MAC_DATA_QOS_NULL_POLL:
1593 return "MAC_DATA_QOS_NULL_POLL";
1594 case SIR_MAC_DATA_QOS_NULL_ACK_POLL:
1595 return "MAC_DATA_QOS_NULL_ACK_POLL";
1596 default:
1597 return "Unknown Data Frame";
1598 }
1599 }
1600 else
1601 return "Unknown";
1602#endif
1603return "";
1604}
1605
Jeff Johnson295189b2012-06-20 16:38:30 -07001606void limHandleUpdateOlbcCache(tpAniSirGlobal pMac)
1607{
1608 int i;
1609 static int enable;
1610 tUpdateBeaconParams beaconParams;
1611
1612 tpPESession psessionEntry = limIsApSessionActive(pMac);
1613
1614 if (psessionEntry == NULL)
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001615 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001616 PELOGE(limLog(pMac, LOGE, FL(" Session not found"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 return;
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001618 }
Pratik Bhalgatb44ea3f2012-11-22 16:41:39 +05301619
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301620 vos_mem_set( ( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Madan Mohan Koyyalamudib2733142012-10-31 13:59:17 -07001621 beaconParams.bssIdx = psessionEntry->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -07001622
1623 beaconParams.paramChangeBitmap = 0;
1624 /*
1625 ** This is doing a 2 pass check. The first pass is to invalidate
1626 ** all the cache entries. The second pass is to decide whether to
1627 ** disable protection.
1628 **/
1629 if (!enable)
1630 {
1631
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001632 PELOG2(limLog(pMac, LOG2, FL("Resetting OLBC cache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 psessionEntry->gLimOlbcParams.numSta = 0;
1634 psessionEntry->gLimOverlap11gParams.numSta = 0;
1635 psessionEntry->gLimOverlapHt20Params.numSta = 0;
1636 psessionEntry->gLimNonGfParams.numSta = 0;
1637 psessionEntry->gLimLsigTxopParams.numSta = 0;
1638
1639 for (i=0; i < LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1640 pMac->lim.protStaOverlapCache[i].active = false;
1641
1642 enable = 1;
1643 }
1644 else
1645 {
1646
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07001647 if (!psessionEntry->gLimOlbcParams.numSta)
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 {
1649 if (psessionEntry->gLimOlbcParams.protectionEnabled)
1650 {
1651 if (!psessionEntry->gLim11bParams.protectionEnabled)
1652 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001653 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11B STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 limEnable11gProtection(pMac, false, true, &beaconParams, psessionEntry);
1655 }
1656 }
1657 }
1658
1659 if (!psessionEntry->gLimOverlap11gParams.numSta)
1660 {
1661 if (psessionEntry->gLimOverlap11gParams.protectionEnabled)
1662 {
1663 if (!psessionEntry->gLim11gParams.protectionEnabled)
1664 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001665 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no 11G STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 limEnableHtProtectionFrom11g(pMac, false, true, &beaconParams,psessionEntry);
1667 }
1668 }
1669 }
1670
1671 if (!psessionEntry->gLimOverlapHt20Params.numSta)
1672 {
1673 if (psessionEntry->gLimOverlapHt20Params.protectionEnabled)
1674 {
1675 if (!psessionEntry->gLimHt20Params.protectionEnabled)
1676 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001677 PELOG1(limLog(pMac, LOG1, FL("Overlap cache all clear and no HT20 STA detected"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001678 limEnable11gProtection(pMac, false, true, &beaconParams,psessionEntry);
1679 }
1680 }
1681 }
1682
1683 enable = 0;
1684 }
1685
1686 if(beaconParams.paramChangeBitmap)
1687 {
1688 schSetFixedBeaconFields(pMac,psessionEntry);
1689 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
1690 }
1691
1692 // Start OLBC timer
1693 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
1694 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001695 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001696 }
1697}
Jeff Johnson295189b2012-06-20 16:38:30 -07001698
1699/**
1700 * limIsNullSsid()
1701 *
1702 *FUNCTION:
1703 * This function checks if Ssid supplied is Null SSID
1704 *
1705 *
1706 *LOGIC:
1707 *
1708 *ASSUMPTIONS:
1709 * NA
1710 *
1711 *NOTE:
1712 * NA
1713 *
1714 * @param tSirMacSSid *
1715 *
1716 *
1717 * @return true if SSID is Null SSID else false
1718 */
1719
1720tANI_U8
1721limIsNullSsid( tSirMacSSid *pSsid )
1722{
1723 tANI_U8 fNullSsid = false;
1724 tANI_U32 SsidLength;
1725 tANI_U8 *pSsidStr;
1726
1727 do
1728 {
1729 if ( 0 == pSsid->length )
1730 {
1731 fNullSsid = true;
1732 break;
1733 }
1734
1735#define ASCII_SPACE_CHARACTER 0x20
1736 /* If the first charactes is space, then check if all characters in
1737 * SSID are spaces to consider it as NULL SSID*/
1738 if( ASCII_SPACE_CHARACTER == pSsid->ssId[0])
1739 {
1740 SsidLength = pSsid->length;
1741 pSsidStr = pSsid->ssId;
1742 /* check if all the charactes in SSID are spaces*/
1743 while ( SsidLength )
1744 {
1745 if( ASCII_SPACE_CHARACTER != *pSsidStr )
1746 break;
1747
1748 pSsidStr++;
1749 SsidLength--;
1750 }
1751
1752 if( 0 == SsidLength )
1753 {
1754 fNullSsid = true;
1755 break;
1756 }
1757 }
1758 else
1759 {
1760 /* check if all the charactes in SSID are NULL*/
1761 SsidLength = pSsid->length;
1762 pSsidStr = pSsid->ssId;
1763
1764 while ( SsidLength )
1765 {
1766 if( *pSsidStr )
1767 break;
1768
1769 pSsidStr++;
1770 SsidLength--;
1771 }
1772
1773 if( 0 == SsidLength )
1774 {
1775 fNullSsid = true;
1776 break;
1777 }
1778 }
1779 }
1780 while( 0 );
1781
1782 return fNullSsid;
1783} /****** end limIsNullSsid() ******/
1784
1785
1786
Jeff Johnson295189b2012-06-20 16:38:30 -07001787
1788/** -------------------------------------------------------------
1789\fn limUpdateProtStaParams
1790\brief updates protection related counters.
1791\param tpAniSirGlobal pMac
1792\param tSirMacAddr peerMacAddr
1793\param tLimProtStaCacheType protStaCacheType
1794\param tHalBitVal gfSupported
1795\param tHalBitVal lsigTxopSupported
1796\return None
1797 -------------------------------------------------------------*/
1798void
1799limUpdateProtStaParams(tpAniSirGlobal pMac,
1800tSirMacAddr peerMacAddr, tLimProtStaCacheType protStaCacheType,
1801tHalBitVal gfSupported, tHalBitVal lsigTxopSupported,
1802tpPESession psessionEntry)
1803{
1804 tANI_U32 i;
1805
1806 PELOG1(limLog(pMac,LOG1, FL("A STA is associated:"));
1807 limLog(pMac,LOG1, FL("Addr : "));
1808 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
1809
1810 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1811 {
1812 if (psessionEntry->protStaCache[i].active)
1813 {
1814 PELOG1(limLog(pMac, LOG1, FL("Addr: "));)
1815 PELOG1(limPrintMacAddr(pMac, psessionEntry->protStaCache[i].addr, LOG1);)
1816
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301817 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 psessionEntry->protStaCache[i].addr,
1819 peerMacAddr, sizeof(tSirMacAddr)))
1820 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001821 PELOG1(limLog(pMac, LOG1, FL("matching cache entry at %d already active."), i);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 return;
1823 }
1824 }
1825 }
1826
1827 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
1828 {
1829 if (!psessionEntry->protStaCache[i].active)
1830 break;
1831 }
1832
1833 if (i >= LIM_PROT_STA_CACHE_SIZE)
1834 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001835 PELOGE(limLog(pMac, LOGE, FL("No space in ProtStaCache"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 return;
1837 }
1838
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05301839 vos_mem_copy( psessionEntry->protStaCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 peerMacAddr,
1841 sizeof(tSirMacAddr));
1842
1843 psessionEntry->protStaCache[i].protStaCacheType = protStaCacheType;
1844 psessionEntry->protStaCache[i].active = true;
1845 if(eLIM_PROT_STA_CACHE_TYPE_llB == protStaCacheType)
1846 {
1847 psessionEntry->gLim11bParams.numSta++;
1848 limLog(pMac,LOG1, FL("11B, "));
1849 }
1850 else if(eLIM_PROT_STA_CACHE_TYPE_llG == protStaCacheType)
1851 {
1852 psessionEntry->gLim11gParams.numSta++;
1853 limLog(pMac,LOG1, FL("11G, "));
1854 }
1855 else if(eLIM_PROT_STA_CACHE_TYPE_HT20 == protStaCacheType)
1856 {
1857 psessionEntry->gLimHt20Params.numSta++;
1858 limLog(pMac,LOG1, FL("HT20, "));
1859 }
1860
1861 if(!gfSupported)
1862 {
1863 psessionEntry->gLimNonGfParams.numSta++;
1864 limLog(pMac,LOG1, FL("NonGf, "));
1865 }
1866 if(!lsigTxopSupported)
1867 {
1868 psessionEntry->gLimLsigTxopParams.numSta++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001869 limLog(pMac,LOG1, FL("!lsigTxopSupported"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 }
1871}// ---------------------------------------------------------------------
1872
1873/** -------------------------------------------------------------
1874\fn limDecideApProtection
1875\brief Decides all the protection related staiton coexistence and also sets
1876\ short preamble and short slot appropriately. This function will be called
1877\ when AP is ready to send assocRsp tp the station joining right now.
1878\param tpAniSirGlobal pMac
1879\param tSirMacAddr peerMacAddr
1880\return None
1881 -------------------------------------------------------------*/
1882void
1883limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1884{
1885 tANI_U16 tmpAid;
1886 tpDphHashNode pStaDs;
1887 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
1888 tANI_U32 phyMode;
1889 tLimProtStaCacheType protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_INVALID;
1890 tHalBitVal gfSupported = eHAL_SET, lsigTxopSupported = eHAL_SET;
1891
1892 pBeaconParams->paramChangeBitmap = 0;
1893 // check whether to enable protection or not
1894 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
1895 if(NULL == pStaDs)
1896 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001897 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 return;
1899 }
1900 limGetRfBand(pMac, &rfBand, psessionEntry);
1901 //if we are in 5 GHZ band
1902 if(SIR_BAND_5_GHZ == rfBand)
1903 {
1904 //We are 11N. we need to protect from 11A and Ht20. we don't need any other protection in 5 GHZ.
1905 //HT20 case is common between both the bands and handled down as common code.
Jeff Johnsone7245742012-09-05 17:12:55 -07001906 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 {
1908 //we are 11N and 11A station is joining.
1909 //protection from 11A required.
1910 if(false == pStaDs->mlmStaContext.htCapability)
1911 {
1912 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
1913 return;
1914 }
1915 }
1916 }
1917 else if(SIR_BAND_2_4_GHZ== rfBand)
1918 {
1919 limGetPhyMode(pMac, &phyMode, psessionEntry);
1920
1921 //We are 11G. Check if we need protection from 11b Stations.
1922 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001923 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 {
1925
1926 if (pStaDs->erpEnabled== eHAL_CLEAR)
1927 {
1928 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1929 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001930 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 limEnable11gProtection(pMac, true, false, pBeaconParams,psessionEntry);
1932 }
1933 }
1934
1935 //HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07001936 if (true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 {
1938 //check if we need protection from 11b station
1939 if ((pStaDs->erpEnabled == eHAL_CLEAR) &&
1940 (!pStaDs->mlmStaContext.htCapability))
1941 {
1942 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llB;
1943 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001944 PELOG3(limLog(pMac, LOG3, FL("Enabling protection from 11B"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
1946 }
1947 //station being joined is non-11b and non-ht ==> 11g device
1948 else if(!pStaDs->mlmStaContext.htCapability)
1949 {
1950 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_llG;
1951 //enable protection
1952 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams, psessionEntry);
1953 }
1954 //ERP mode is enabled for the latest station joined
1955 //latest station joined is HT capable
1956 //This case is being handled in common code (commn between both the bands) below.
1957 }
1958 }
1959
1960 //we are HT and HT station is joining. This code is common for both the bands.
Jeff Johnsone7245742012-09-05 17:12:55 -07001961 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 (true == pStaDs->mlmStaContext.htCapability))
1963 {
1964 if(!pStaDs->htGreenfield)
1965 {
1966 limEnableHTNonGfProtection(pMac, true, false, pBeaconParams, psessionEntry);
1967 gfSupported = eHAL_CLEAR;
1968 }
1969 //Station joining is HT 20Mhz
1970 if(eHT_CHANNEL_WIDTH_20MHZ == pStaDs->htSupportedChannelWidthSet)
1971 {
1972 protStaCacheType = eLIM_PROT_STA_CACHE_TYPE_HT20;
1973 limEnableHT20Protection(pMac, true, false, pBeaconParams, psessionEntry);
1974 }
1975 //Station joining does not support LSIG TXOP Protection
1976 if(!pStaDs->htLsigTXOPProtection)
1977 {
1978 limEnableHTLsigTxopProtection(pMac, false, false, pBeaconParams,psessionEntry);
1979 lsigTxopSupported = eHAL_CLEAR;
1980 }
1981 }
1982
1983 limUpdateProtStaParams(pMac, peerMacAddr, protStaCacheType,
1984 gfSupported, lsigTxopSupported, psessionEntry);
1985
1986 return;
1987}
Jeff Johnson295189b2012-06-20 16:38:30 -07001988
1989
1990/** -------------------------------------------------------------
1991\fn limEnableOverlap11gProtection
1992\brief wrapper function for setting overlap 11g protection.
1993\param tpAniSirGlobal pMac
1994\param tpUpdateBeaconParams pBeaconParams
1995\param tpSirMacMgmtHdr pMh
1996\return None
1997 -------------------------------------------------------------*/
1998void
1999limEnableOverlap11gProtection(tpAniSirGlobal pMac,
2000tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry)
2001{
2002 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOlbcParams));
2003
2004 if (psessionEntry->gLimOlbcParams.numSta &&
2005 !psessionEntry->gLimOlbcParams.protectionEnabled)
2006 {
2007 // enable protection
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002008 PELOG1(limLog(pMac, LOG1, FL("OLBC happens!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 limEnable11gProtection(pMac, true, true, pBeaconParams,psessionEntry);
2010 }
2011}
2012
2013
2014/** -------------------------------------------------------------
2015\fn limUpdateShortPreamble
2016\brief Updates short preamble if needed when a new station joins.
2017\param tpAniSirGlobal pMac
2018\param tSirMacAddr peerMacAddr
2019\param tpUpdateBeaconParams pBeaconParams
2020\return None
2021 -------------------------------------------------------------*/
2022void
2023limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2024 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2025{
2026 tANI_U16 tmpAid;
2027 tpDphHashNode pStaDs;
2028 tANI_U32 phyMode;
2029 tANI_U16 i;
2030
2031 // check whether to enable protection or not
2032 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2033
2034 limGetPhyMode(pMac, &phyMode, psessionEntry);
2035
2036 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2037
2038 {
2039 if (pStaDs->shortPreambleEnabled == eHAL_CLEAR)
2040 {
2041 PELOG1(limLog(pMac,LOG1,FL("Short Preamble is not enabled in Assoc Req from "));
2042 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2043
2044 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2045 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2047 psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2048 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302049 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
2051 peerMacAddr, sizeof(tSirMacAddr)))
2052 return;
2053 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 {
2055 if (pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2056 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302057 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
2059 peerMacAddr, sizeof(tSirMacAddr)))
2060 return;
2061 }
2062 }
2063 }
2064
2065
2066 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2067 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2069 !psessionEntry->gLimNoShortParams.staNoShortCache[i].active)
2070 break;
2071 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 {
2073 if (!pMac->lim.gLimNoShortParams.staNoShortCache[i].active)
2074 break;
2075 }
2076 }
2077
2078 if (i >= LIM_PROT_STA_CACHE_SIZE)
2079 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2081 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2082 i, psessionEntry->gLimNoShortParams.numNonShortPreambleSta);
2083 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2084 return;
2085 }
2086 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 {
2088 limLog(pMac, LOGE, FL("No space in Short cache (#active %d, #sta %d) for sta "),
2089 i, pMac->lim.gLimNoShortParams.numNonShortPreambleSta);
2090 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2091 return;
2092 }
2093
2094 }
2095
2096
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302097 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
2098 vos_mem_copy( psessionEntry->gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 peerMacAddr, sizeof(tSirMacAddr));
2100 psessionEntry->gLimNoShortParams.staNoShortCache[i].active = true;
2101 psessionEntry->gLimNoShortParams.numNonShortPreambleSta++;
2102 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302104 vos_mem_copy( pMac->lim.gLimNoShortParams.staNoShortCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 peerMacAddr, sizeof(tSirMacAddr));
2106 pMac->lim.gLimNoShortParams.staNoShortCache[i].active = true;
2107 pMac->lim.gLimNoShortParams.numNonShortPreambleSta++;
2108 }
2109
2110
2111 // enable long preamble
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002112 PELOG1(limLog(pMac, LOG1, FL("Disabling short preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002113
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 if (limEnableShortPreamble(pMac, false, pBeaconParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002115 PELOGE(limLog(pMac, LOGE, FL("Cannot enable long preamble"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 }
2117 }
2118}
2119
2120/** -------------------------------------------------------------
2121\fn limUpdateShortSlotTime
2122\brief Updates short slot time if needed when a new station joins.
2123\param tpAniSirGlobal pMac
2124\param tSirMacAddr peerMacAddr
2125\param tpUpdateBeaconParams pBeaconParams
2126\return None
2127 -------------------------------------------------------------*/
2128
2129void
2130limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2131 tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2132{
2133 tANI_U16 tmpAid;
2134 tpDphHashNode pStaDs;
2135 tANI_U32 phyMode;
2136 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 tANI_U16 i;
2138
2139 // check whether to enable protection or not
2140 pStaDs = dphLookupHashEntry(pMac, peerMacAddr, &tmpAid, &psessionEntry->dph.dphHashTable);
2141 limGetPhyMode(pMac, &phyMode, psessionEntry);
2142
Jeff Johnsone7245742012-09-05 17:12:55 -07002143 /* Only in case of softap in 11g mode, slot time might change depending on the STA being added. In 11a case, it should
2144 * be always 1 and in 11b case, it should be always 0
2145 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 if (pStaDs != NULL && phyMode == WNI_CFG_PHY_MODE_11G)
2147 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002148 /* Only when the new STA has short slot time disabled, we need to change softap's overall slot time settings
2149 * else the default for softap is always short slot enabled. When the last long slot STA leaves softAP, we take care of
2150 * it in limDecideShortSlot
2151 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 if (pStaDs->shortSlotTimeEnabled == eHAL_CLEAR)
2153 {
2154 PELOG1(limLog(pMac, LOG1, FL("Short Slot Time is not enabled in Assoc Req from "));
2155 limPrintMacAddr(pMac, peerMacAddr, LOG1);)
2156 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2157 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2159 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2160 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302161 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2163 peerMacAddr, sizeof(tSirMacAddr)))
2164 return;
2165 }
2166 else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 {
2168 if (pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2169 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302170 if (vos_mem_compare(
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
2172 peerMacAddr, sizeof(tSirMacAddr)))
2173 return;
2174 }
2175 }
2176 }
2177
2178 for (i=0; i<LIM_PROT_STA_CACHE_SIZE; i++)
2179 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
2181 !psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2182 break;
2183 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 {
2185 if (!pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active)
2186 break;
2187 }
2188 }
2189
2190 if (i >= LIM_PROT_STA_CACHE_SIZE)
2191 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
2193 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2194 i, psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta);
2195 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2196 return;
2197 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 {
2199 limLog(pMac, LOGE, FL("No space in ShortSlot cache (#active %d, #sta %d) for sta "),
2200 i, pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta);
2201 limPrintMacAddr(pMac, peerMacAddr, LOGE);
2202 return;
2203 }
2204 }
2205
2206
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302208 vos_mem_copy( psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 peerMacAddr, sizeof(tSirMacAddr));
2210 psessionEntry->gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2211 psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta++;
2212 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05302214 vos_mem_copy( pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 peerMacAddr, sizeof(tSirMacAddr));
2216 pMac->lim.gLimNoShortSlotParams.staNoShortSlotCache[i].active = true;
2217 pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta++;
2218 }
2219 wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val);
2220
Jeff Johnsone7245742012-09-05 17:12:55 -07002221 /* 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
2222 * only long slot enabled, we need to change our beacon/pb rsp to broadcast short slot disabled
2223 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07002225 (val && psessionEntry->gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported))
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 {
2227 // enable long slot time
2228 pBeaconParams->fShortSlotTime = false;
2229 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002230 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002231 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 }
2233 else if ( psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002235 if (val && pMac->lim.gLimNoShortSlotParams.numNonShortSlotSta && psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 {
2237 // enable long slot time
2238 pBeaconParams->fShortSlotTime = false;
2239 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002240 PELOG1(limLog(pMac, LOG1, FL("Disable short slot time. Enable long slot time."));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002241 psessionEntry->shortSlotTimeSupported = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 }
2243 }
2244 }
2245 }
2246}
2247
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249/** -------------------------------------------------------------
2250\fn limDecideStaProtectionOnAssoc
2251\brief Decide protection related settings on Sta while association.
2252\param tpAniSirGlobal pMac
2253\param tpSchBeaconStruct pBeaconStruct
2254\return None
2255 -------------------------------------------------------------*/
2256void
2257limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac,
2258 tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry)
2259{
2260 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2261 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2262
2263 limGetRfBand(pMac, &rfBand, psessionEntry);
2264 limGetPhyMode(pMac, &phyMode, psessionEntry);
2265
2266 if(SIR_BAND_5_GHZ == rfBand)
2267 {
2268 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2269 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2270 {
2271 if(pMac->lim.cfgProtection.fromlla)
2272 psessionEntry->beaconParams.llaCoexist = true;
2273 }
2274 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBeaconStruct->HTInfo.opMode)
2275 {
2276 if(pMac->lim.cfgProtection.ht20)
2277 psessionEntry->beaconParams.ht20Coexist = true;
2278 }
2279
2280 }
2281 else if(SIR_BAND_2_4_GHZ == rfBand)
2282 {
2283 //spec 7.3.2.13
2284 //UseProtection will be set when nonERP STA is associated.
2285 //NonERPPresent bit will be set when:
2286 //--nonERP Sta is associated OR
2287 //--nonERP Sta exists in overlapping BSS
2288 //when useProtection is not set then protection from nonERP stations is optional.
2289
2290 //CFG protection from 11b is enabled and
2291 //11B device in the BSS
2292 /* TODO, This is not sessionized */
2293 if (phyMode != WNI_CFG_PHY_MODE_11B)
2294 {
2295 if (pMac->lim.cfgProtection.fromllb &&
2296 pBeaconStruct->erpPresent &&
2297 (pBeaconStruct->erpIEInfo.useProtection ||
2298 pBeaconStruct->erpIEInfo.nonErpPresent))
2299 {
2300 psessionEntry->beaconParams.llbCoexist = true;
2301 }
2302 //AP has no 11b station associated.
2303 else
2304 {
2305 psessionEntry->beaconParams.llbCoexist = false;
2306 }
2307 }
2308 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002309 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 (pBeaconStruct->HTInfo.present))
2311 {
2312 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2313
2314 //Obss Non HT STA present mode
2315 psessionEntry->beaconParams.gHTObssMode = (tANI_U8)htInfo.obssNonHTStaPresent;
2316
2317
2318 //CFG protection from 11G is enabled and
2319 //our AP has at least one 11G station associated.
2320 if(pMac->lim.cfgProtection.fromllg &&
2321 ((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2322 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2323 (!psessionEntry->beaconParams.llbCoexist))
2324 {
2325 if(pMac->lim.cfgProtection.fromllg)
2326 psessionEntry->beaconParams.llgCoexist = true;
2327 }
2328
2329 //AP has only HT stations associated and at least one station is HT 20
2330 //disable protection from any non-HT devices.
2331 //decision for disabling protection from 11b has already been taken above.
2332 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2333 {
2334 //Disable protection from 11G station.
2335 psessionEntry->beaconParams.llgCoexist = false;
2336 //CFG protection from HT 20 is enabled.
2337 if(pMac->lim.cfgProtection.ht20)
2338 psessionEntry->beaconParams.ht20Coexist = true;
2339 }
2340 //Disable protection from non-HT and HT20 devices.
2341 //decision for disabling protection from 11b has already been taken above.
2342 if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2343 {
2344 psessionEntry->beaconParams.llgCoexist = false;
2345 psessionEntry->beaconParams.ht20Coexist = false;
2346 }
2347
2348 }
2349 }
2350
2351 //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 -07002352 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 (pBeaconStruct->HTInfo.present))
2354 {
2355 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2356 psessionEntry->beaconParams.fRIFSMode =
2357 ( tANI_U8 ) htInfo.rifsMode;
2358 psessionEntry->beaconParams.llnNonGFCoexist =
2359 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2360 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2361 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2362 }
2363}
2364
2365
2366/** -------------------------------------------------------------
2367\fn limDecideStaProtection
2368\brief Decides protection related settings on Sta while processing beacon.
2369\param tpAniSirGlobal pMac
2370\param tpUpdateBeaconParams pBeaconParams
2371\return None
2372 -------------------------------------------------------------*/
2373void
2374limDecideStaProtection(tpAniSirGlobal pMac,
2375 tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
2376{
2377
2378 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
2379 tANI_U32 phyMode = WNI_CFG_PHY_MODE_NONE;
2380
2381 limGetRfBand(pMac, &rfBand, psessionEntry);
2382 limGetPhyMode(pMac, &phyMode, psessionEntry);
2383
2384 if(SIR_BAND_5_GHZ == rfBand)
2385 {
2386 //we are HT capable.
Jeff Johnsone7245742012-09-05 17:12:55 -07002387 if((true == psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 (pBeaconStruct->HTInfo.present))
2389 {
2390 //we are HT capable, AP's HT OPMode is mixed / overlap legacy ==> need protection from 11A.
2391 if((eSIR_HT_OP_MODE_MIXED == pBeaconStruct->HTInfo.opMode) ||
2392 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBeaconStruct->HTInfo.opMode))
2393 {
2394 limEnable11aProtection(pMac, true, false, pBeaconParams,psessionEntry);
2395 }
2396 //we are HT capable, AP's HT OPMode is HT20 ==> disable protection from 11A if enabled. enabled
2397 //protection from HT20 if needed.
2398 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT== pBeaconStruct->HTInfo.opMode)
2399 {
2400 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2401 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2402 }
2403 else if(eSIR_HT_OP_MODE_PURE == pBeaconStruct->HTInfo.opMode)
2404 {
2405 limEnable11aProtection(pMac, false, false, pBeaconParams,psessionEntry);
2406 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2407 }
2408 }
2409 }
2410 else if(SIR_BAND_2_4_GHZ == rfBand)
2411 {
2412 /* spec 7.3.2.13
2413 * UseProtection will be set when nonERP STA is associated.
2414 * NonERPPresent bit will be set when:
2415 * --nonERP Sta is associated OR
2416 * --nonERP Sta exists in overlapping BSS
2417 * when useProtection is not set then protection from nonERP stations is optional.
2418 */
2419
2420 if (phyMode != WNI_CFG_PHY_MODE_11B)
2421 {
2422 if (pBeaconStruct->erpPresent &&
2423 (pBeaconStruct->erpIEInfo.useProtection ||
2424 pBeaconStruct->erpIEInfo.nonErpPresent))
2425 {
2426 limEnable11gProtection(pMac, true, false, pBeaconParams, psessionEntry);
2427 }
2428 //AP has no 11b station associated.
2429 else
2430 {
2431 //disable protection from 11b station
2432 limEnable11gProtection(pMac, false, false, pBeaconParams, psessionEntry);
2433 }
2434 }
2435
2436 //following code block is only for HT station.
Jeff Johnsone7245742012-09-05 17:12:55 -07002437 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 (pBeaconStruct->HTInfo.present))
2439 {
2440
2441 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2442 //AP has at least one 11G station associated.
2443 if(((eSIR_HT_OP_MODE_MIXED == htInfo.opMode) ||
2444 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == htInfo.opMode))&&
2445 (!psessionEntry->beaconParams.llbCoexist))
2446 {
2447 limEnableHtProtectionFrom11g(pMac, true, false, pBeaconParams,psessionEntry);
2448
2449 }
2450
2451 //no HT operating mode change ==> no change in protection settings except for MIXED_MODE/Legacy Mode.
2452 //in Mixed mode/legacy Mode even if there is no change in HT operating mode, there might be change in 11bCoexist
2453 //or 11gCoexist. that is why this check is being done after mixed/legacy mode check.
2454 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )htInfo.opMode )
2455 {
2456 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )htInfo.opMode;
2457
2458 //AP has only HT stations associated and at least one station is HT 20
2459 //disable protection from any non-HT devices.
2460 //decision for disabling protection from 11b has already been taken above.
2461 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == htInfo.opMode)
2462 {
2463 //Disable protection from 11G station.
2464 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2465
2466 limEnableHT20Protection(pMac, true, false, pBeaconParams,psessionEntry);
2467 }
2468 //Disable protection from non-HT and HT20 devices.
2469 //decision for disabling protection from 11b has already been taken above.
2470 else if(eSIR_HT_OP_MODE_PURE == htInfo.opMode)
2471 {
2472 limEnableHtProtectionFrom11g(pMac, false, false, pBeaconParams,psessionEntry);
2473 limEnableHT20Protection(pMac, false, false, pBeaconParams,psessionEntry);
2474
2475 }
2476 }
2477 }
2478 }
2479
2480 //following code block is only for HT station. ( 2.4 GHZ as well as 5 GHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -07002481 if((psessionEntry->htCapability) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 (pBeaconStruct->HTInfo.present))
2483 {
2484 tDot11fIEHTInfo htInfo = pBeaconStruct->HTInfo;
2485 //Check for changes in protection related factors other than HT operating mode.
2486 //Check for changes in RIFS mode, nonGFDevicesPresent, lsigTXOPProtectionFullSupport.
2487 if ( psessionEntry->beaconParams.fRIFSMode !=
2488 ( tANI_U8 ) htInfo.rifsMode )
2489 {
2490 pBeaconParams->fRIFSMode =
2491 psessionEntry->beaconParams.fRIFSMode =
2492 ( tANI_U8 ) htInfo.rifsMode;
2493 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
2494 }
2495
2496 if ( psessionEntry->beaconParams.llnNonGFCoexist !=
2497 htInfo.nonGFDevicesPresent )
2498 {
2499 pBeaconParams->llnNonGFCoexist =
2500 psessionEntry->beaconParams.llnNonGFCoexist =
2501 ( tANI_U8 )htInfo.nonGFDevicesPresent;
2502 pBeaconParams->paramChangeBitmap |=
2503 PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
2504 }
2505
2506 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport !=
2507 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport )
2508 {
2509 pBeaconParams->fLsigTXOPProtectionFullSupport =
2510 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2511 ( tANI_U8 )htInfo.lsigTXOPProtectionFullSupport;
2512 pBeaconParams->paramChangeBitmap |=
2513 PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
2514 }
2515
2516 // For Station just update the global lim variable, no need to send message to HAL
2517 // Station already taking care of HT OPR Mode=01, meaning AP is seeing legacy
2518 //stations in overlapping BSS.
2519 if ( psessionEntry->beaconParams.gHTObssMode != ( tANI_U8 )htInfo.obssNonHTStaPresent )
2520 psessionEntry->beaconParams.gHTObssMode = ( tANI_U8 )htInfo.obssNonHTStaPresent ;
2521
2522 }
2523}
2524
2525
2526/**
2527 * limProcessChannelSwitchTimeout()
2528 *
2529 *FUNCTION:
2530 * This function is invoked when Channel Switch Timer expires at
2531 * the STA. Now, STA must stop traffic, and then change/disable
2532 * primary or secondary channel.
2533 *
2534 *
2535 *NOTE:
2536 * @param pMac - Pointer to Global MAC structure
2537 * @return None
2538 */
2539void limProcessChannelSwitchTimeout(tpAniSirGlobal pMac)
2540{
2541 tpPESession psessionEntry = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07002542 tANI_U8 channel; // This is received and stored from channelSwitch Action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07002543
2544 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId))== NULL)
2545 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002546 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 return;
2548 }
2549
2550 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2551 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002552 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 -07002553 return;
2554 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002555 channel = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 /*
2557 * This potentially can create issues if the function tries to set
2558 * channel while device is in power-save, hence putting an extra check
2559 * to verify if the device is in power-save or not
2560 */
2561 if(!limIsSystemInActiveState(pMac))
2562 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002563 PELOGW(limLog(pMac, LOGW, FL("Device is not in active state, cannot switch channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 return;
2565 }
2566
2567 // Restore Channel Switch parameters to default
Jeff Johnsone7245742012-09-05 17:12:55 -07002568 psessionEntry->gLimChannelSwitch.switchTimeoutValue = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002569
2570 /* Channel-switch timeout has occurred. reset the state */
Jeff Johnsone7245742012-09-05 17:12:55 -07002571 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_END;
Jeff Johnson295189b2012-06-20 16:38:30 -07002572
2573 /* Check if the AP is switching to a channel that we support.
2574 * Else, just don't bother to switch. Indicate HDD to look for a
2575 * better AP to associate
2576 */
2577 if(!limIsChannelValidForChannelSwitch(pMac, channel))
2578 {
2579 /* We need to restore pre-channelSwitch state on the STA */
2580 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2581 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002582 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 return;
2584 }
2585
2586 /* If the channel-list that AP is asking us to switch is invalid,
2587 * then we cannot switch the channel. Just disassociate from AP.
2588 * We will find a better AP !!!
2589 */
2590 limTearDownLinkWithAp(pMac,
2591 pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId,
2592 eSIR_MAC_UNSPEC_FAILURE_REASON);
2593 return;
2594 }
Kiran Kumar Lokereb8bb6842013-08-12 16:40:24 -07002595 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
2596 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002597 switch(psessionEntry->gLimChannelSwitch.state)
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 {
2599 case eLIM_CHANNEL_SWITCH_PRIMARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002600 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002601 limSwitchPrimaryChannel(pMac, psessionEntry->gLimChannelSwitch.primaryChannel,psessionEntry);
2602 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 break;
2604
2605 case eLIM_CHANNEL_SWITCH_SECONDARY_ONLY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002606 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_SECONDARY_ONLY "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002607 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 psessionEntry->currentOperChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -07002609 psessionEntry->gLimChannelSwitch.secondarySubBand);
2610 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 break;
2612
2613 case eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002614 PELOGW(limLog(pMac, LOGW, FL("CHANNEL_SWITCH_PRIMARY_AND_SECONDARY"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 limSwitchPrimarySecondaryChannel(pMac, psessionEntry,
2616 psessionEntry->gLimChannelSwitch.primaryChannel,
2617 psessionEntry->gLimChannelSwitch.secondarySubBand);
2618 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 break;
2620
2621 case eLIM_CHANNEL_SWITCH_IDLE:
2622 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002623 PELOGE(limLog(pMac, LOGE, FL("incorrect state "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 if(limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2625 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002626 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 }
2628 return; /* Please note, this is 'return' and not 'break' */
2629 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002630}
Jeff Johnson295189b2012-06-20 16:38:30 -07002631
2632/**
2633 * limUpdateChannelSwitch()
2634 *
2635 *FUNCTION:
2636 * This function is invoked whenever Station receives
2637 * either 802.11h channel switch IE or airgo proprietary
2638 * channel switch IE.
2639 *
2640 *NOTE:
2641 * @param pMac - Pointer to Global MAC structure
2642 * @return tpSirProbeRespBeacon - Pointer to Beacon/Probe Rsp
2643 * @param psessionentry
2644 */
2645void
2646limUpdateChannelSwitch(struct sAniSirGlobal *pMac, tpSirProbeRespBeacon pBeacon, tpPESession psessionEntry)
2647{
2648
2649 tANI_U16 beaconPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 tChannelSwitchPropIEStruct *pPropChnlSwitch;
2651 tDot11fIEChanSwitchAnn *pChnlSwitch;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002652#ifdef WLAN_FEATURE_11AC
2653 tDot11fIEWiderBWChanSwitchAnn *pWiderChnlSwitch;
2654#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002655
Jeff Johnsone7245742012-09-05 17:12:55 -07002656 beaconPeriod = psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002657
2658 /* STA either received proprietary channel switch IE or 802.11h
2659 * standard channel switch IE.
2660 */
2661 if (pBeacon->propIEinfo.propChannelSwitchPresent)
2662 {
2663 pPropChnlSwitch = &(pBeacon->propIEinfo.channelSwitch);
2664
2665 /* Add logic to determine which change this is: */
2666 /* primary, secondary, both. For now assume both. */
Jeff Johnsone7245742012-09-05 17:12:55 -07002667 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2668 psessionEntry->gLimChannelSwitch.primaryChannel = pPropChnlSwitch->primaryChannel;
2669 psessionEntry->gLimChannelSwitch.secondarySubBand = (ePhyChanBondState)pPropChnlSwitch->subBand;
2670 psessionEntry->gLimChannelSwitch.switchCount = pPropChnlSwitch->channelSwitchCount;
2671 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 SYS_MS_TO_TICKS(beaconPeriod)* (pPropChnlSwitch->channelSwitchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002673 psessionEntry->gLimChannelSwitch.switchMode = pPropChnlSwitch->mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 }
2675 else
2676 {
2677 pChnlSwitch = &(pBeacon->channelSwitchIE);
Jeff Johnsone7245742012-09-05 17:12:55 -07002678 psessionEntry->gLimChannelSwitch.primaryChannel = pChnlSwitch->newChannel;
2679 psessionEntry->gLimChannelSwitch.switchCount = pChnlSwitch->switchCount;
2680 psessionEntry->gLimChannelSwitch.switchTimeoutValue =
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 SYS_MS_TO_TICKS(beaconPeriod)* (pChnlSwitch->switchCount);
Jeff Johnsone7245742012-09-05 17:12:55 -07002682 psessionEntry->gLimChannelSwitch.switchMode = pChnlSwitch->switchMode;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002683#ifdef WLAN_FEATURE_11AC
2684 pWiderChnlSwitch = &(pBeacon->WiderBWChanSwitchAnn);
2685 if(pBeacon->WiderBWChanSwitchAnnPresent)
2686 {
2687 psessionEntry->gLimWiderBWChannelSwitch.newChanWidth = pWiderChnlSwitch->newChanWidth;
2688 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0 = pWiderChnlSwitch->newCenterChanFreq0;
2689 psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1 = pWiderChnlSwitch->newCenterChanFreq1;
2690 }
2691#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002692
2693 /* Only primary channel switch element is present */
Jeff Johnsone7245742012-09-05 17:12:55 -07002694 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_ONLY;
2695 psessionEntry->gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002696
2697 /* Do not bother to look and operate on extended channel switch element
2698 * if our own channel-bonding state is not enabled
2699 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002700 if (psessionEntry->htSupportedChannelWidthSet)
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 {
2702 if (pBeacon->extChannelSwitchPresent)
2703 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002704 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2705 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002707 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2708 psessionEntry->gLimChannelSwitch.secondarySubBand = pBeacon->extChannelSwitchIE.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002710#ifdef WLAN_FEATURE_11AC
2711 if(psessionEntry->vhtCapability && pBeacon->WiderBWChanSwitchAnnPresent)
2712 {
2713 if (pWiderChnlSwitch->newChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
2714 {
2715 if(pBeacon->extChannelSwitchPresent)
2716 {
2717 if ((pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) ||
2718 (pBeacon->extChannelSwitchIE.secondaryChannelOffset == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY))
2719 {
2720 psessionEntry->gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY;
2721 psessionEntry->gLimChannelSwitch.secondarySubBand = limGet11ACPhyCBState(pMac,
2722 psessionEntry->gLimChannelSwitch.primaryChannel,
2723 pBeacon->extChannelSwitchIE.secondaryChannelOffset,
2724 pWiderChnlSwitch->newCenterChanFreq0,
2725 psessionEntry);
2726 }
2727 }
2728 }
2729 }
2730#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002731 }
2732 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002733 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 if (eSIR_SUCCESS != limStartChannelSwitch(pMac, psessionEntry))
2735 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002736 PELOGW(limLog(pMac, LOGW, FL("Could not start Channel Switch"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 }
2738
2739 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002740 FL("session %d primary chl %d, subband %d, count %d (%d ticks) "),
Jeff Johnsone7245742012-09-05 17:12:55 -07002741 psessionEntry->peSessionId,
2742 psessionEntry->gLimChannelSwitch.primaryChannel,
2743 psessionEntry->gLimChannelSwitch.secondarySubBand,
2744 psessionEntry->gLimChannelSwitch.switchCount,
2745 psessionEntry->gLimChannelSwitch.switchTimeoutValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 return;
2747}
2748
2749/**
2750 * limCancelDot11hChannelSwitch
2751 *
2752 *FUNCTION:
2753 * This function is called when STA does not send updated channel-swith IE
2754 * after indicating channel-switch start. This will cancel the channel-swith
2755 * timer which is already running.
2756 *
2757 *LOGIC:
2758 *
2759 *ASSUMPTIONS:
2760 *
2761 *NOTE:
2762 *
2763 * @param pMac - Pointer to Global MAC structure
2764 *
2765 * @return None
2766 */
2767void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
2768{
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2770 return;
2771
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002772 PELOGW(limLog(pMac, LOGW, FL("Received a beacon without channel switch IE"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002773 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_CHANNEL_SWITCH_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002774
2775 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
2776 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002777 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 }
2779
2780 /* We need to restore pre-channelSwitch state on the STA */
2781 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
2782 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002783 PELOGE(limLog(pMac, LOGE, FL("LIM: Could not restore pre-channelSwitch (11h) state, resetting the system"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002784
2785 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002786}
2787
2788/**----------------------------------------------
2789\fn limCancelDot11hQuiet
2790\brief Cancel the quieting on Station if latest
2791 beacon doesn't contain quiet IE in it.
2792
2793\param pMac
2794\return NONE
2795-----------------------------------------------*/
2796void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry)
2797{
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
2799 return;
2800
Jeff Johnsone7245742012-09-05 17:12:55 -07002801 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
Jeff Johnson295189b2012-06-20 16:38:30 -07002802 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002803 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer) != TX_SUCCESS)
2805 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002806 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 }
2808 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002809 else if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002811 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer) != TX_SUCCESS)
2813 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002814 PELOGE(limLog(pMac, LOGE, FL("tx_timer_deactivate failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 }
2816 /**
2817 * If the channel switch is already running in silent mode, dont resume the
2818 * transmission. Channel switch timer when timeout, transmission will be resumed.
2819 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002820 if(!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
2821 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 {
2823 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07002824 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002825 }
2826 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002827 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07002828}
2829
2830/**
2831 * limProcessQuietTimeout
2832 *
2833 * FUNCTION:
2834 * This function is active only on the STA.
2835 * Handles SIR_LIM_QUIET_TIMEOUT
2836 *
2837 * LOGIC:
2838 * This timeout can occur under only one circumstance:
2839 *
2840 * 1) When gLimQuietState = eLIM_QUIET_BEGIN
2841 * This indicates that the timeout "interval" has
2842 * expired. This is a trigger for the STA to now
2843 * shut-off Tx/Rx for the specified gLimQuietDuration
2844 * -> The TIMER object gLimQuietBssTimer is
2845 * activated
2846 * -> With timeout = gLimQuietDuration
2847 * -> gLimQuietState is set to eLIM_QUIET_RUNNING
2848 *
2849 * ASSUMPTIONS:
2850 * Using two TIMER objects -
2851 * gLimQuietTimer & gLimQuietBssTimer
2852 *
2853 * NOTE:
2854 *
2855 * @param pMac - Pointer to Global MAC structure
2856 *
2857 * @return None
2858 */
2859void limProcessQuietTimeout(tpAniSirGlobal pMac)
2860{
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 //fetch the sessionEntry based on the sessionId
2862 //priority - MEDIUM
Jeff Johnsone7245742012-09-05 17:12:55 -07002863 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002864
Jeff Johnsone7245742012-09-05 17:12:55 -07002865 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002867 limLog(pMac, LOGE,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002868 return;
2869 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002870
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002871 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002872 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 {
2874 case eLIM_QUIET_BEGIN:
2875 // Time to Stop data traffic for quietDuration
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 //limDeactivateAndChangeTimer(pMac, eLIM_QUIET_BSS_TIMER);
2877 if (TX_SUCCESS !=
2878 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
2879 {
2880 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002881 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002882 }
2883
2884 // gLimQuietDuration appears to be in units of ticks
2885 // Use it as is
2886 if (TX_SUCCESS !=
2887 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
2888 psessionEntry->gLimSpecMgmt.quietDuration,
2889 0))
2890 {
2891 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002892 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07002893 }
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002894 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, pMac->lim.limTimers.gLimQuietTimer.sessionId, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895#ifdef GEN6_TODO
2896 /* revisit this piece of code to assign the appropriate sessionId below
2897 * priority - HIGH
2898 */
2899 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
2900#endif
2901 if( TX_SUCCESS !=
2902 tx_timer_activate( &pMac->lim.limTimers.gLimQuietBssTimer ))
2903 {
2904 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002905 FL("Unable to activate gLimQuietBssTimer! The STA will be unable to honor Quiet BSS..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 }
2907 else
2908 {
2909 // Transition to eLIM_QUIET_RUNNING
Jeff Johnsone7245742012-09-05 17:12:55 -07002910 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07002911
2912 /* If we have sta bk scan triggered and trigger bk scan actually started successfully, */
2913 /* print message, otherwise, stop data traffic and stay quiet */
2914 if( pMac->lim.gLimTriggerBackgroundScanDuringQuietBss &&
2915 (eSIR_TRUE == (glimTriggerBackgroundScanDuringQuietBss_Status = limTriggerBackgroundScanDuringQuietBss( pMac ))) )
2916 {
2917 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002918 FL("Attempting to trigger a background scan..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 }
2920 else
2921 {
2922 // Shut-off Tx/Rx for gLimSpecMgmt.quietDuration
2923 /* freeze the transmission */
2924 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_STOP_TX);
2925
2926 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002927 FL("Quiet BSS: STA shutting down for %d ticks"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002928 psessionEntry->gLimSpecMgmt.quietDuration );
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 }
2930 }
2931 break;
2932
2933 case eLIM_QUIET_RUNNING:
2934 case eLIM_QUIET_INIT:
2935 case eLIM_QUIET_END:
2936 default:
2937 //
2938 // As of now, nothing to be done
2939 //
2940 break;
2941 }
2942}
2943
2944/**
2945 * limProcessQuietBssTimeout
2946 *
2947 * FUNCTION:
2948 * This function is active on the AP and STA.
2949 * Handles SIR_LIM_QUIET_BSS_TIMEOUT
2950 *
2951 * LOGIC:
2952 * On the AP -
2953 * When the SIR_LIM_QUIET_BSS_TIMEOUT is triggered, it is
2954 * an indication for the AP to START sending out the
2955 * Quiet BSS IE.
2956 * If 802.11H is enabled, the Quiet BSS IE is sent as per
2957 * the 11H spec
2958 * If 802.11H is not enabled, the Quiet BSS IE is sent as
2959 * a Proprietary IE. This will be understood by all the
2960 * TITAN STA's
2961 * Transitioning gLimQuietState to eLIM_QUIET_BEGIN will
2962 * initiate the SCH to include the Quiet BSS IE in all
2963 * its subsequent Beacons/PR's.
2964 * The Quiet BSS IE will be included in all the Beacons
2965 * & PR's until the next DTIM period
2966 *
2967 * On the STA -
2968 * When gLimQuietState = eLIM_QUIET_RUNNING
2969 * This indicates that the STA was successfully shut-off
2970 * for the specified gLimQuietDuration. This is a trigger
2971 * for the STA to now resume data traffic.
2972 * -> gLimQuietState is set to eLIM_QUIET_INIT
2973 *
2974 * ASSUMPTIONS:
2975 *
2976 * NOTE:
2977 *
2978 * @param pMac - Pointer to Global MAC structure
2979 *
2980 * @return None
2981 */
2982void limProcessQuietBssTimeout( tpAniSirGlobal pMac )
2983{
Jeff Johnsone7245742012-09-05 17:12:55 -07002984 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07002985
Jeff Johnsone7245742012-09-05 17:12:55 -07002986 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimQuietBssTimer.sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002988 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 return;
2990 }
2991
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002992 PELOG1(limLog(pMac, LOG1, FL("quietState = %d"), psessionEntry->gLimSpecMgmt.quietState);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002993 if (eLIM_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 }
2996 else
2997 {
2998 // eLIM_STA_ROLE
Jeff Johnsone7245742012-09-05 17:12:55 -07002999 switch( psessionEntry->gLimSpecMgmt.quietState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 {
3001 case eLIM_QUIET_RUNNING:
3002 // Transition to eLIM_QUIET_INIT
Jeff Johnsone7245742012-09-05 17:12:55 -07003003 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003004
3005 if( !pMac->lim.gLimTriggerBackgroundScanDuringQuietBss || (glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE) )
3006 {
3007 // Resume data traffic only if channel switch is not running in silent mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07003008 if (!((psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) &&
3009 (psessionEntry->gLimChannelSwitch.switchMode == eSIR_CHANSW_MODE_SILENT)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 {
3011 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003012 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 }
3014
3015 /* Reset status flag */
3016 if(glimTriggerBackgroundScanDuringQuietBss_Status == eSIR_FALSE)
3017 glimTriggerBackgroundScanDuringQuietBss_Status = eSIR_TRUE;
3018
3019 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003020 FL("Quiet BSS: Resuming traffic..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
3022 else
3023 {
3024 //
3025 // Nothing specific to be done in this case
3026 // A background scan that was triggered during
3027 // SIR_LIM_QUIET_TIMEOUT will complete on its own
3028 //
3029 limLog( pMac, LOG2,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003030 FL("Background scan should be complete now..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 }
3032 break;
3033
3034 case eLIM_QUIET_INIT:
3035 case eLIM_QUIET_BEGIN:
3036 case eLIM_QUIET_END:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003037 PELOG2(limLog(pMac, LOG2, FL("Quiet state not in RUNNING"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 /* If the quiet period has ended, then resume the frame transmission */
3039 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
Jeff Johnsone7245742012-09-05 17:12:55 -07003040 limRestorePreQuietState(pMac, psessionEntry);
3041 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003042 break;
3043
3044 default:
3045 //
3046 // As of now, nothing to be done
3047 //
3048 break;
3049 }
3050 }
3051}
Jeff Johnson295189b2012-06-20 16:38:30 -07003052/**
3053 * limProcessWPSOverlapTimeout
3054 *
3055 * FUNCTION: This function call limWPSPBCTimeout() to clean WPS PBC probe request entries
3056 *
3057 * LOGIC:
3058 *
3059 * ASSUMPTIONS:
3060 *
3061 * NOTE:
3062 *
3063 * @param pMac - Pointer to Global MAC structure
3064 *
3065 * @return None
3066 */
3067#if 0
3068void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac)
3069{
3070
3071 tpPESession psessionEntry;
3072 tANI_U32 sessionId;
3073
3074 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
3075 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003076 limLog(pMac, LOGP, FL("tx_timer_activate failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003077 }
3078
3079 sessionId = pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId;
3080
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003081 PELOGE(limLog(pMac, LOGE, FL("WPS overlap timeout, sessionId=%d"), sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003082
3083 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId)) == NULL)
3084 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003085 PELOGE(limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003086 return;
3087 }
3088
3089 limWPSPBCTimeout(pMac, psessionEntry);
3090}
3091#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003092
Jeff Johnson295189b2012-06-20 16:38:30 -07003093/**----------------------------------------------
3094\fn limStartQuietTimer
3095\brief Starts the quiet timer.
3096
3097\param pMac
3098\return NONE
3099-----------------------------------------------*/
3100void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId)
3101{
3102 tpPESession psessionEntry;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303103 psessionEntry = peFindSessionBySessionId(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003104
3105 if(psessionEntry == NULL) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003106 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003107 return;
3108 }
3109
Jeff Johnson295189b2012-06-20 16:38:30 -07003110
3111 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3112 return;
3113 // First, de-activate Timer, if its already active
3114 limCancelDot11hQuiet(pMac, psessionEntry);
3115
Jeff Johnsone7245742012-09-05 17:12:55 -07003116 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, sessionId, eLIM_QUIET_TIMER));
3117 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
3118 {
3119 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003120 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003121 }
3122
3123 // Set the NEW timeout value, in ticks
3124 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
3125 SYS_MS_TO_TICKS(psessionEntry->gLimSpecMgmt.quietTimeoutValue), 0))
3126 {
3127 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003128 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003129 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003130
3131 pMac->lim.limTimers.gLimQuietTimer.sessionId = sessionId;
3132 if( TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimQuietTimer))
3133 {
3134 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003135 FL("Unable to activate gLimQuietTimer! STA cannot honor Quiet BSS!"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003136 limRestorePreQuietState(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003137
Jeff Johnsone7245742012-09-05 17:12:55 -07003138 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 return;
3140 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003141}
3142
Jeff Johnson295189b2012-06-20 16:38:30 -07003143
3144/** ------------------------------------------------------------------------ **/
3145/**
3146 * keep track of the number of ANI peers associated in the BSS
3147 * For the first and last ANI peer, we have to update EDCA params as needed
3148 *
3149 * When the first ANI peer joins the BSS, we notify SCH
3150 * When the last ANI peer leaves the BSS, we notfiy SCH
3151 */
3152void
3153limUtilCountStaAdd(
3154 tpAniSirGlobal pMac,
3155 tpDphHashNode pSta,
3156 tpPESession psessionEntry)
3157{
3158
3159 if ((! pSta) || (! pSta->valid) || (! pSta->aniPeer) || (pSta->fAniCount))
3160 return;
3161
3162 pSta->fAniCount = 1;
3163
3164 if (pMac->lim.gLimNumOfAniSTAs++ != 0)
3165 return;
3166
3167 // get here only if this is the first ANI peer in the BSS
3168 schEdcaProfileUpdate(pMac, psessionEntry);
3169}
3170
3171void
3172limUtilCountStaDel(
3173 tpAniSirGlobal pMac,
3174 tpDphHashNode pSta,
3175 tpPESession psessionEntry)
3176{
3177
3178 if ((pSta == NULL) || (pSta->aniPeer == eHAL_CLEAR) || (! pSta->fAniCount))
3179 return;
3180
3181 /* Only if sta is invalid and the validInDummyState bit is set to 1,
3182 * then go ahead and update the count and profiles. This ensures
3183 * that the "number of ani station" count is properly incremented/decremented.
3184 */
3185 if (pSta->valid == 1)
3186 return;
3187
3188 pSta->fAniCount = 0;
3189
3190 if (pMac->lim.gLimNumOfAniSTAs <= 0)
3191 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003192 limLog(pMac, LOGE, FL("CountStaDel: ignoring Delete Req when AniPeer count is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 pMac->lim.gLimNumOfAniSTAs);
3194 return;
3195 }
3196
3197 pMac->lim.gLimNumOfAniSTAs--;
3198
3199 if (pMac->lim.gLimNumOfAniSTAs != 0)
3200 return;
3201
3202 // get here only if this is the last ANI peer in the BSS
3203 schEdcaProfileUpdate(pMac, psessionEntry);
3204}
3205
Jeff Johnson295189b2012-06-20 16:38:30 -07003206/**
3207 * limSwitchChannelCback()
3208 *
3209 *FUNCTION:
3210 * This is the callback function registered while requesting to switch channel
3211 * after AP indicates a channel switch for spectrum management (11h).
3212 *
3213 *NOTE:
3214 * @param pMac Pointer to Global MAC structure
3215 * @param status Status of channel switch request
3216 * @param data User data
3217 * @param psessionEntry Session information
3218 * @return NONE
3219 */
3220void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status,
3221 tANI_U32 *data, tpPESession psessionEntry)
3222{
3223 tSirMsgQ mmhMsg = {0};
3224 tSirSmeSwitchChannelInd *pSirSmeSwitchChInd;
3225
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 psessionEntry->currentOperChannel = psessionEntry->currentReqChannel;
3227
3228 /* We need to restore pre-channelSwitch state on the STA */
3229 if (limRestorePreChannelSwitchState(pMac, psessionEntry) != eSIR_SUCCESS)
3230 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003231 limLog(pMac, LOGP, FL("Could not restore pre-channelSwitch (11h) state, resetting the system"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 return;
3233 }
3234
3235 mmhMsg.type = eWNI_SME_SWITCH_CHL_REQ;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303236 pSirSmeSwitchChInd = vos_mem_malloc(sizeof(tSirSmeSwitchChannelInd));
3237 if ( NULL == pSirSmeSwitchChInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07003238 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003239 limLog(pMac, LOGP, FL("Failed to allocate buffer for buffer descriptor"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 return;
3241 }
3242
3243 pSirSmeSwitchChInd->messageType = eWNI_SME_SWITCH_CHL_REQ;
3244 pSirSmeSwitchChInd->length = sizeof(tSirSmeSwitchChannelInd);
Jeff Johnsone7245742012-09-05 17:12:55 -07003245 pSirSmeSwitchChInd->newChannelId = psessionEntry->gLimChannelSwitch.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 pSirSmeSwitchChInd->sessionId = psessionEntry->smeSessionId;
3247 //BSS ID
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303248 vos_mem_copy( pSirSmeSwitchChInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 mmhMsg.bodyptr = pSirSmeSwitchChInd;
3250 mmhMsg.bodyval = 0;
3251
Jeff Johnsone7245742012-09-05 17:12:55 -07003252 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003253
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 SysProcessMmhMsg(pMac, &mmhMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07003255}
3256
3257/**
3258 * limSwitchPrimaryChannel()
3259 *
3260 *FUNCTION:
3261 * This function changes the current operating channel
3262 * and sets the new new channel ID in WNI_CFG_CURRENT_CHANNEL.
3263 *
3264 *NOTE:
3265 * @param pMac Pointer to Global MAC structure
3266 * @param newChannel new chnannel ID
3267 * @return NONE
3268 */
3269void limSwitchPrimaryChannel(tpAniSirGlobal pMac, tANI_U8 newChannel,tpPESession psessionEntry)
3270{
3271#if !defined WLAN_FEATURE_VOWIFI
3272 tANI_U32 localPwrConstraint;
3273#endif
3274
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003275 PELOG3(limLog(pMac, LOG3, FL("limSwitchPrimaryChannel: old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 psessionEntry->currentOperChannel, newChannel);)
3277 psessionEntry->currentReqChannel = newChannel;
3278 psessionEntry->limRFBand = limGetRFBand(newChannel);
3279
3280 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
3281
3282 pMac->lim.gpchangeChannelCallback = limSwitchChannelCback;
3283 pMac->lim.gpchangeChannelData = NULL;
3284
3285#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003286 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 psessionEntry->maxTxPower, psessionEntry->peSessionId);
3288#else
3289 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS)
3290 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003291 limLog( pMac, LOGP, FL( "Unable to read Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 return;
3293 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003294 limSendSwitchChnlParams(pMac, newChannel, PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
3296#endif
3297 return;
3298}
3299
3300/**
3301 * limSwitchPrimarySecondaryChannel()
3302 *
3303 *FUNCTION:
3304 * This function changes the primary and secondary channel.
3305 * If 11h is enabled and user provides a "new channel ID"
3306 * that is different from the current operating channel,
3307 * then we must set this new channel in WNI_CFG_CURRENT_CHANNEL,
3308 * assign notify LIM of such change.
3309 *
3310 *NOTE:
3311 * @param pMac Pointer to Global MAC structure
3312 * @param newChannel New chnannel ID (or current channel ID)
3313 * @param subband CB secondary info:
3314 * - eANI_CB_SECONDARY_NONE
3315 * - eANI_CB_SECONDARY_UP
3316 * - eANI_CB_SECONDARY_DOWN
3317 * @return NONE
3318 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003319void limSwitchPrimarySecondaryChannel(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 newChannel, ePhyChanBondState subband)
Jeff Johnson295189b2012-06-20 16:38:30 -07003320{
3321#if !defined WLAN_FEATURE_VOWIFI
3322 tANI_U32 localPwrConstraint;
3323#endif
3324
Jeff Johnson295189b2012-06-20 16:38:30 -07003325#if !defined WLAN_FEATURE_VOWIFI
3326 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003327 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003328 return;
3329 }
3330#endif
3331
Jeff Johnson295189b2012-06-20 16:38:30 -07003332#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07003333 limSendSwitchChnlParams(pMac, newChannel, subband, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003334#else
Jeff Johnsone7245742012-09-05 17:12:55 -07003335 limSendSwitchChnlParams(pMac, newChannel, subband, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003337
Jeff Johnsone7245742012-09-05 17:12:55 -07003338 // Store the new primary and secondary channel in session entries if different
3339 if (psessionEntry->currentOperChannel != newChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 {
3341 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003342 FL("switch old chnl %d --> new chnl %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 psessionEntry->currentOperChannel, newChannel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 psessionEntry->currentOperChannel = newChannel;
3345 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 if (psessionEntry->htSecondaryChannelOffset != subband)
3347 {
3348 limLog(pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003349 FL("switch old sec chnl %d --> new sec chnl %d "),
Jeff Johnsone7245742012-09-05 17:12:55 -07003350 psessionEntry->htSecondaryChannelOffset, subband);
3351 psessionEntry->htSecondaryChannelOffset = subband;
3352 if (psessionEntry->htSecondaryChannelOffset == PHY_SINGLE_CHANNEL_CENTERED)
3353 {
3354 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
3355 }
3356 else
3357 {
3358 psessionEntry->htSupportedChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
3359 }
3360 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
3361 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003362
3363 return;
3364}
3365
3366
3367/**
3368 * limActiveScanAllowed()
3369 *
3370 *FUNCTION:
3371 * Checks if active scans are permitted on the given channel
3372 *
3373 *LOGIC:
3374 * The config variable SCAN_CONTROL_LIST contains pairs of (channelNum, activeScanAllowed)
3375 * Need to check if the channelNum matches, then depending on the corresponding
3376 * scan flag, return true (for activeScanAllowed==1) or false (otherwise).
3377 *
3378 *ASSUMPTIONS:
3379 *
3380 *NOTE:
3381 *
3382 * @param pMac Pointer to Global MAC structure
3383 * @param channelNum channel number
3384 * @return None
3385 */
3386
3387tANI_U8 limActiveScanAllowed(
3388 tpAniSirGlobal pMac,
3389 tANI_U8 channelNum)
3390{
3391 tANI_U32 i;
3392 tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN];
3393 tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN;
3394 if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len)
3395 != eSIR_SUCCESS)
3396 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003397 PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 return false;
3399 }
3400
3401 if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN)
3402 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003403 limLog(pMac, LOGE, FL("Invalid scan control list length:%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 len);
3405 return false;
3406 }
3407
3408 for (i=0; (i+1) < len; i+=2)
3409 {
3410 if (channelPair[i] == channelNum)
3411 return ((channelPair[i+1] == eSIR_ACTIVE_SCAN) ? true : false);
3412 }
3413 return false;
3414}
3415
3416/**
3417 * limTriggerBackgroundScanDuringQuietBss()
3418 *
3419 *FUNCTION:
3420 * This function is applicable to the STA only.
3421 * This function is called by limProcessQuietTimeout(),
3422 * when it is time to honor the Quiet BSS IE from the AP.
3423 *
3424 *LOGIC:
3425 * If 11H is enabled:
3426 * We cannot trigger a background scan. The STA needs to
3427 * shut-off Tx/Rx.
3428 * If 11 is not enabled:
3429 * Determine if the next channel that we are going to
3430 * scan is NOT the same channel (or not) on which the
3431 * Quiet BSS was requested.
3432 * If yes, then we cannot trigger a background scan on
3433 * this channel. Return with a false.
3434 * If no, then trigger a background scan. Return with
3435 * a true.
3436 *
3437 *ASSUMPTIONS:
3438 *
3439 *NOTE:
3440 * This API is redundant if the existing API,
3441 * limTriggerBackgroundScan(), were to return a valid
3442 * response instead of returning void.
3443 * If possible, try to revisit this API
3444 *
3445 * @param pMac Pointer to Global MAC structure
3446 * @return eSIR_TRUE, if a background scan was attempted
3447 * eSIR_FALSE, if not
3448 */
3449tAniBool limTriggerBackgroundScanDuringQuietBss( tpAniSirGlobal pMac )
3450{
3451 tAniBool bScanTriggered = eSIR_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003452
3453
3454
3455 //TBD-RAJESH HOW TO GET sessionEntry?????
3456 tpPESession psessionEntry = &pMac->lim.gpSession[0];
3457
3458 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
3459 return bScanTriggered;
3460
Jeff Johnsone7245742012-09-05 17:12:55 -07003461 if( !psessionEntry->lim11hEnable )
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 {
3463 tSirMacChanNum bgScanChannelList[WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN];
3464 tANI_U32 len = WNI_CFG_BG_SCAN_CHANNEL_LIST_LEN;
3465
3466 // Determine the next scan channel
3467
3468 // Get background scan channel list from CFG
3469 if( eSIR_SUCCESS == wlan_cfgGetStr( pMac,
3470 WNI_CFG_BG_SCAN_CHANNEL_LIST,
3471 (tANI_U8 *) bgScanChannelList,
3472 (tANI_U32 *) &len ))
3473 {
3474 // Ensure that we do not go off scanning on the same
3475 // channel on which the Quiet BSS was requested
3476 if( psessionEntry->currentOperChannel!=
3477 bgScanChannelList[pMac->lim.gLimBackgroundScanChannelId] )
3478 {
3479 // For now, try and attempt a background scan. It will
3480 // be ideal if this API actually returns a success or
3481 // failure instead of having a void return type
3482 limTriggerBackgroundScan( pMac );
3483
3484 bScanTriggered = eSIR_TRUE;
3485 }
3486 else
3487 {
3488 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003489 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 -07003490 }
3491 }
3492 else
3493 {
3494 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003495 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 -07003496 }
3497 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 return bScanTriggered;
3499}
3500
3501
3502/**
3503 * limGetHTCapability()
3504 *
3505 *FUNCTION:
3506 * A utility function that returns the "current HT capability state" for the HT
3507 * capability of interest (as requested in the API)
3508 *
3509 *LOGIC:
3510 * This routine will return with the "current" setting of a requested HT
3511 * capability. This state info could be retrieved from -
3512 * a) CFG (for static entries)
3513 * b) Run time info
3514 * - Dynamic state maintained by LIM
3515 * - Configured at radio init time by SME
3516 *
3517 *
3518 *ASSUMPTIONS:
3519 * NA
3520 *
3521 *NOTE:
3522 *
3523 * @param pMac Pointer to Global MAC structure
3524 * @param htCap The HT capability being queried
3525 * @return tANI_U8 The current state of the requested HT capability is returned in a
3526 * tANI_U8 variable
3527 */
3528
Jeff Johnson295189b2012-06-20 16:38:30 -07003529tANI_U8 limGetHTCapability( tpAniSirGlobal pMac,
3530 tANI_U32 htCap, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07003531{
3532tANI_U8 retVal = 0;
3533tANI_U8 *ptr;
3534tANI_U32 cfgValue;
3535tSirMacHTCapabilityInfo macHTCapabilityInfo = {0};
3536tSirMacExtendedHTCapabilityInfo macExtHTCapabilityInfo = {0};
3537tSirMacTxBFCapabilityInfo macTxBFCapabilityInfo = {0};
3538tSirMacASCapabilityInfo macASCapabilityInfo = {0};
3539
3540 //
3541 // Determine which CFG to read from. Not ALL of the HT
3542 // related CFG's need to be read each time this API is
3543 // accessed
3544 //
3545 if( htCap >= eHT_ANTENNA_SELECTION &&
3546 htCap < eHT_SI_GRANULARITY )
3547 {
3548 // Get Antenna Seletion HT Capabilities
3549 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_AS_CAP, &cfgValue ))
3550 cfgValue = 0;
3551 ptr = (tANI_U8 *) &macASCapabilityInfo;
3552 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
3553 }
3554 else
3555 {
3556 if( htCap >= eHT_TX_BEAMFORMING &&
3557 htCap < eHT_ANTENNA_SELECTION )
3558 {
3559 // Get Transmit Beam Forming HT Capabilities
3560 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TX_BF_CAP, &cfgValue ))
3561 cfgValue = 0;
3562 ptr = (tANI_U8 *) &macTxBFCapabilityInfo;
3563 *((tANI_U32 *)ptr) = (tANI_U32) (cfgValue);
3564 }
3565 else
3566 {
3567 if( htCap >= eHT_PCO &&
3568 htCap < eHT_TX_BEAMFORMING )
3569 {
3570 // Get Extended HT Capabilities
3571 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_EXT_HT_CAP_INFO, &cfgValue ))
3572 cfgValue = 0;
3573 ptr = (tANI_U8 *) &macExtHTCapabilityInfo;
3574 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
3575 }
3576 else
3577 {
3578 if( htCap < eHT_MAX_RX_AMPDU_FACTOR )
3579 {
3580 // Get HT Capabilities
3581 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_HT_CAP_INFO, &cfgValue ))
3582 cfgValue = 0;
3583 ptr = (tANI_U8 *) &macHTCapabilityInfo;
3584 // 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
3585 *ptr++ = cfgValue & 0xff;
3586 *ptr = (cfgValue >> 8) & 0xff;
3587 }
3588 }
3589 }
3590 }
3591
3592 switch( htCap )
3593 {
3594 case eHT_LSIG_TXOP_PROTECTION:
3595 retVal = pMac->lim.gHTLsigTXOPProtection;
3596 break;
3597
3598 case eHT_STBC_CONTROL_FRAME:
3599 retVal = (tANI_U8) macHTCapabilityInfo.stbcControlFrame;
3600 break;
3601
3602 case eHT_PSMP:
3603 retVal = pMac->lim.gHTPSMPSupport;
3604 break;
3605
3606 case eHT_DSSS_CCK_MODE_40MHZ:
3607 retVal = pMac->lim.gHTDsssCckRate40MHzSupport;
3608 break;
3609
3610 case eHT_MAX_AMSDU_LENGTH:
3611 retVal = (tANI_U8) macHTCapabilityInfo.maximalAMSDUsize;
3612 break;
3613
3614 case eHT_DELAYED_BA:
3615 retVal = (tANI_U8) macHTCapabilityInfo.delayedBA;
3616 break;
3617
3618 case eHT_RX_STBC:
3619 retVal = (tANI_U8) macHTCapabilityInfo.rxSTBC;
3620 break;
3621
3622 case eHT_TX_STBC:
3623 retVal = (tANI_U8) macHTCapabilityInfo.txSTBC;
3624 break;
3625
3626 case eHT_SHORT_GI_40MHZ:
3627 retVal = (tANI_U8) macHTCapabilityInfo.shortGI40MHz;
3628 break;
3629
3630 case eHT_SHORT_GI_20MHZ:
3631 retVal = (tANI_U8) macHTCapabilityInfo.shortGI20MHz;
3632 break;
3633
3634 case eHT_GREENFIELD:
3635 retVal = (tANI_U8) macHTCapabilityInfo.greenField;
3636 break;
3637
3638 case eHT_MIMO_POWER_SAVE:
3639 retVal = (tANI_U8) pMac->lim.gHTMIMOPSState;
3640 break;
3641
3642 case eHT_SUPPORTED_CHANNEL_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003643 retVal = (tANI_U8) psessionEntry->htSupportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 break;
3645
3646 case eHT_ADVANCED_CODING:
3647 retVal = (tANI_U8) macHTCapabilityInfo.advCodingCap;
3648 break;
3649
3650 case eHT_MAX_RX_AMPDU_FACTOR:
3651 retVal = pMac->lim.gHTMaxRxAMpduFactor;
3652 break;
3653
3654 case eHT_MPDU_DENSITY:
3655 retVal = pMac->lim.gHTAMpduDensity;
3656 break;
3657
3658 case eHT_PCO:
3659 retVal = (tANI_U8) macExtHTCapabilityInfo.pco;
3660 break;
3661
3662 case eHT_TRANSITION_TIME:
3663 retVal = (tANI_U8) macExtHTCapabilityInfo.transitionTime;
3664 break;
3665
3666 case eHT_MCS_FEEDBACK:
3667 retVal = (tANI_U8) macExtHTCapabilityInfo.mcsFeedback;
3668 break;
3669
3670 case eHT_TX_BEAMFORMING:
3671 retVal = (tANI_U8) macTxBFCapabilityInfo.txBF;
3672 break;
3673
3674 case eHT_ANTENNA_SELECTION:
3675 retVal = (tANI_U8) macASCapabilityInfo.antennaSelection;
3676 break;
3677
3678 case eHT_SI_GRANULARITY:
3679 retVal = pMac->lim.gHTServiceIntervalGranularity;
3680 break;
3681
3682 case eHT_CONTROLLED_ACCESS:
3683 retVal = pMac->lim.gHTControlledAccessOnly;
3684 break;
3685
3686 case eHT_RIFS_MODE:
3687 retVal = psessionEntry->beaconParams.fRIFSMode;
3688 break;
3689
3690 case eHT_RECOMMENDED_TX_WIDTH_SET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003691 retVal = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 break;
3693
3694 case eHT_EXTENSION_CHANNEL_OFFSET:
Jeff Johnsone7245742012-09-05 17:12:55 -07003695 retVal = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 break;
3697
3698 case eHT_OP_MODE:
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
3700 retVal = psessionEntry->htOperMode;
3701 else
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 retVal = pMac->lim.gHTOperMode;
3703 break;
3704
3705 case eHT_BASIC_STBC_MCS:
3706 retVal = pMac->lim.gHTSTBCBasicMCS;
3707 break;
3708
3709 case eHT_DUAL_CTS_PROTECTION:
3710 retVal = pMac->lim.gHTDualCTSProtection;
3711 break;
3712
3713 case eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT:
3714 retVal = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
3715 break;
3716
3717 case eHT_PCO_ACTIVE:
3718 retVal = pMac->lim.gHTPCOActive;
3719 break;
3720
3721 case eHT_PCO_PHASE:
3722 retVal = pMac->lim.gHTPCOPhase;
3723 break;
3724
3725 default:
3726 break;
3727 }
3728
3729 return retVal;
3730}
3731
Jeff Johnson295189b2012-06-20 16:38:30 -07003732void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac)
3733{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05303734 vos_mem_copy( mac, pMac->lim.gLimMyMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003735 return;
3736}
3737
3738
3739
3740
3741/** -------------------------------------------------------------
3742\fn limEnable11aProtection
3743\brief based on config setting enables\disables 11a protection.
3744\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3745\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3746\param tpUpdateBeaconParams pBeaconParams
3747\return None
3748 -------------------------------------------------------------*/
3749tSirRetStatus
3750limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3751 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3752{
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003753 if(NULL == psessionEntry)
3754 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003755 PELOG3(limLog(pMac, LOG3, FL("psessionEntry is NULL"));)
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003756 return eSIR_FAILURE;
3757 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003758 //overlapping protection configuration check.
3759 if(overlap)
3760 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 }
3762 else
3763 {
3764 //normal protection config check
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07003765 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003766 (!psessionEntry->cfgProtection.fromlla))
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 {
3768 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003769 PELOG3(limLog(pMac, LOG3, FL("protection from 11a is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 return eSIR_SUCCESS;
3771 }
3772 }
3773
3774 if (enable)
3775 {
3776 //If we are AP and HT capable, we need to set the HT OP mode
3777 //appropriately.
3778 if(((eLIM_AP_ROLE == psessionEntry->limSystemRole)||(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole))&&
Jeff Johnsone7245742012-09-05 17:12:55 -07003779 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 {
3781 if(overlap)
3782 {
3783 pMac->lim.gLimOverlap11aParams.protectionEnabled = true;
3784 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3785 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3786 {
3787 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3788 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3789 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3790 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3791 }
3792 }
3793 else
3794 {
3795 psessionEntry->gLim11aParams.protectionEnabled = true;
3796 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
3797 {
3798 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnsone7245742012-09-05 17:12:55 -07003799 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3801 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3802
3803 }
3804 }
3805 }
3806
3807 //This part is common for staiton as well.
3808 if(false == psessionEntry->beaconParams.llaCoexist)
3809 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003810 PELOG1(limLog(pMac, LOG1, FL(" => protection from 11A Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = true;
3812 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3813 }
3814 }
3815 else if (true == psessionEntry->beaconParams.llaCoexist)
3816 {
3817 //for AP role.
3818 //we need to take care of HT OP mode change if needed.
3819 //We need to take care of Overlap cases.
3820 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3821 {
3822 if(overlap)
3823 {
3824 //Overlap Legacy protection disabled.
3825 pMac->lim.gLimOverlap11aParams.protectionEnabled = false;
3826
3827 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07003828 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 {
3830 // no HT op mode change if any of the overlap protection enabled.
3831 if(!(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3832 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3833 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
3834
3835 {
3836 //Check if there is a need to change HT OP mode.
3837 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
3838 {
3839 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3840 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3841
3842 if(psessionEntry->gLimHt20Params.protectionEnabled)
3843 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
3844 else
3845 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
3846 }
3847 }
3848 }
3849 }
3850 else
3851 {
3852 //Disable protection from 11A stations.
3853 psessionEntry->gLim11aParams.protectionEnabled = false;
3854 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3855
3856 //Check if any other non-HT protection enabled.
3857 //Right now we are in HT OP Mixed mode.
3858 //Change HT op mode appropriately.
3859
3860 //Change HT OP mode to 01 if any overlap protection enabled
3861 if(pMac->lim.gLimOverlap11aParams.protectionEnabled ||
3862 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
3863 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
3864
3865 {
3866 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnsone7245742012-09-05 17:12:55 -07003867 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Jeff Johnson295189b2012-06-20 16:38:30 -07003868 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3869 }
3870 else if(psessionEntry->gLimHt20Params.protectionEnabled)
3871 {
3872 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnsone7245742012-09-05 17:12:55 -07003873 psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3875 }
3876 else
3877 {
3878 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003879 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
3881 }
3882 }
3883 if(!pMac->lim.gLimOverlap11aParams.protectionEnabled &&
3884 !psessionEntry->gLim11aParams.protectionEnabled)
3885 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003886 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3888 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3889 }
3890 }
3891 //for station role
3892 else
3893 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003894 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11A Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 pBeaconParams->llaCoexist = psessionEntry->beaconParams.llaCoexist = false;
3896 pBeaconParams->paramChangeBitmap |= PARAM_llACOEXIST_CHANGED;
3897 }
3898 }
3899
3900 return eSIR_SUCCESS;
3901}
3902
3903/** -------------------------------------------------------------
3904\fn limEnable11gProtection
3905\brief based on config setting enables\disables 11g protection.
3906\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
3907\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
3908\param tpUpdateBeaconParams pBeaconParams
3909\return None
3910 -------------------------------------------------------------*/
3911
3912tSirRetStatus
3913limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable,
3914 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
3915{
3916
3917 //overlapping protection configuration check.
3918 if(overlap)
3919 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 }
3921 else
3922 {
3923 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
3925 !psessionEntry->cfgProtection.fromllb)
3926 {
3927 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003928 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 return eSIR_SUCCESS;
3930 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 {
3932 if(!pMac->lim.cfgProtection.fromllb)
3933 {
3934 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003935 PELOG1(limLog(pMac, LOG1, FL("protection from 11b is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 return eSIR_SUCCESS;
3937 }
3938 }
3939 }
3940
3941 if (enable)
3942 {
3943 //If we are AP and HT capable, we need to set the HT OP mode
3944 //appropriately.
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
3946 {
3947 if(overlap)
3948 {
3949 psessionEntry->gLimOlbcParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003950 PELOGE(limLog(pMac, LOGE, FL("protection from olbc is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003951 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003952 {
3953 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
3954 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
3955 {
3956 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3957 }
3958 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3959 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3960 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3961 //Not processing OBSS bit from other APs, as we are already taking care
3962 //of Protection from overlapping BSS based on erp IE or useProtection bit
3963 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3964 }
3965 }
3966 else
3967 {
3968 psessionEntry->gLim11bParams.protectionEnabled = true;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003969 PELOGE(limLog(pMac, LOGE, FL("protection from 11b is enabled"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003970 if(true == psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 {
3972 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
3973 {
3974 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
3975 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3976 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3977 }
3978 }
3979 }
3980 }else if ((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) &&
Jeff Johnsone7245742012-09-05 17:12:55 -07003981 (true == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 {
3983 if(overlap)
3984 {
3985 psessionEntry->gLimOlbcParams.protectionEnabled = true;
3986 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
3987 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
3988 {
3989 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
3990 }
3991 //CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
3992 // This fixes issue of OBSS bit not set after 11b, 11g station leaves
3993 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
3994 //Not processing OBSS bit from other APs, as we are already taking care
3995 //of Protection from overlapping BSS based on erp IE or useProtection bit
3996 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
3997 }
3998 else
3999 {
4000 psessionEntry->gLim11bParams.protectionEnabled = true;
4001 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4002 {
4003 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4004 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4005 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4006 }
4007 }
4008 }
4009
4010 //This part is common for staiton as well.
4011 if(false == psessionEntry->beaconParams.llbCoexist)
4012 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004013 PELOG1(limLog(pMac, LOG1, FL("=> 11G Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = true;
4015 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4016 }
4017 }
4018 else if (true == psessionEntry->beaconParams.llbCoexist)
4019 {
4020 //for AP role.
4021 //we need to take care of HT OP mode change if needed.
4022 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4024 {
4025 if(overlap)
4026 {
4027 //Overlap Legacy protection disabled.
4028 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4029
4030 //We need to take care of HT OP mode if we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004031 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004032 {
4033 // no HT op mode change if any of the overlap protection enabled.
4034 if(!(psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4035 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4036 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4037 {
4038 //Check if there is a need to change HT OP mode.
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004039 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 {
4041 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4042 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4043 if(psessionEntry->gLimHt20Params.protectionEnabled){
4044 //Commenting out beacuse of CR 258588 WFA cert
4045 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4046 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4047 }
4048 else
4049 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4050 }
4051 }
4052 }
4053 }
4054 else
4055 {
4056 //Disable protection from 11B stations.
4057 psessionEntry->gLim11bParams.protectionEnabled = false;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004058 PELOGE(limLog(pMac, LOGE, FL("===> 11B Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 //Check if any other non-HT protection enabled.
4060 if(!psessionEntry->gLim11gParams.protectionEnabled)
4061 {
4062 //Right now we are in HT OP Mixed mode.
4063 //Change HT op mode appropriately.
4064 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4065
4066 //Change HT OP mode to 01 if any overlap protection enabled
4067 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4068 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4069 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4070 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4071 {
4072 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004073 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4075 }
4076 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4077 {
4078 //Commenting because of CR 258588 WFA cert
4079 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4080 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004081 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004082 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4083 }
4084 else
4085 {
4086 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4087 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4088 }
4089 }
4090 }
4091 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4092 !psessionEntry->gLim11bParams.protectionEnabled)
4093 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004094 PELOGE(limLog(pMac, LOGE, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4096 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4097 }
4098 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004099 {
4100 if(overlap)
4101 {
4102 //Overlap Legacy protection disabled.
4103 psessionEntry->gLimOlbcParams.protectionEnabled = false;
4104
4105 //We need to take care of HT OP mode iff we are HT AP.
Jeff Johnsone7245742012-09-05 17:12:55 -07004106 if(psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 {
4108 // no HT op mode change if any of the overlap protection enabled.
4109 if(!(pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4110 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4111 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4112
4113 {
4114 //Check if there is a need to change HT OP mode.
4115 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4116 {
4117 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4118 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4119 if(psessionEntry->gLimHt20Params.protectionEnabled)
4120 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4121 else
4122 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4123 }
4124 }
4125 }
4126 }
4127 else
4128 {
4129 //Disable protection from 11B stations.
4130 psessionEntry->gLim11bParams.protectionEnabled = false;
4131 //Check if any other non-HT protection enabled.
4132 if(!psessionEntry->gLim11gParams.protectionEnabled)
4133 {
4134 //Right now we are in HT OP Mixed mode.
4135 //Change HT op mode appropriately.
4136 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4137
4138 //Change HT OP mode to 01 if any overlap protection enabled
4139 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4140 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4141 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4142 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4143
4144 {
4145 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4146 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4147 }
4148 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4149 {
4150 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4151 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4152 }
4153 else
4154 {
4155 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4156 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4157 }
4158 }
4159 }
4160 if(!psessionEntry->gLimOlbcParams.protectionEnabled &&
4161 !psessionEntry->gLim11bParams.protectionEnabled)
4162 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004163 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4165 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4166 }
4167 }
4168 //for station role
4169 else
4170 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004171 PELOG1(limLog(pMac, LOG1, FL("===> 11G Protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 pBeaconParams->llbCoexist = psessionEntry->beaconParams.llbCoexist = false;
4173 pBeaconParams->paramChangeBitmap |= PARAM_llBCOEXIST_CHANGED;
4174 }
4175 }
4176 return eSIR_SUCCESS;
4177}
4178
4179/** -------------------------------------------------------------
4180\fn limEnableHtProtectionFrom11g
4181\brief based on cofig enables\disables protection from 11g.
4182\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4183\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4184\param tpUpdateBeaconParams pBeaconParams
4185\return None
4186 -------------------------------------------------------------*/
4187tSirRetStatus
4188limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable,
4189 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4190{
Jeff Johnsone7245742012-09-05 17:12:55 -07004191 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 return eSIR_SUCCESS; // protection from 11g is only for HT stations.
4193
4194 //overlapping protection configuration check.
4195 if(overlap)
4196 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004197 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) && (!psessionEntry->cfgProtection.overlapFromllg))
4198 {
4199 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004200 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 return eSIR_SUCCESS;
4202 }else if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) && (!pMac->lim.cfgProtection.overlapFromllg))
Jeff Johnson295189b2012-06-20 16:38:30 -07004203 {
4204 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004205 PELOG3(limLog(pMac, LOG3, FL("overlap protection from 11g is disabled")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004206 return eSIR_SUCCESS;
4207 }
4208 }
4209 else
4210 {
4211 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4213 !psessionEntry->cfgProtection.fromllg){
4214 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004215 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004216 return eSIR_SUCCESS;
4217 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 {
4219 if(!pMac->lim.cfgProtection.fromllg)
4220 {
4221 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004222 PELOG3(limLog(pMac, LOG3, FL("protection from 11g is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 return eSIR_SUCCESS;
4224 }
4225 }
4226 }
4227 if (enable)
4228 {
4229 //If we are AP and HT capable, we need to set the HT OP mode
4230 //appropriately.
4231
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4233 {
4234 if(overlap)
4235 {
4236 psessionEntry->gLimOverlap11gParams.protectionEnabled = true;
4237 //11g exists in overlap BSS.
4238 //need not to change the operating mode to overlap_legacy
4239 //if higher or same protection operating mode is enabled right now.
4240 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4241 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4242 {
4243 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4244 }
4245 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304246 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 }
4248 else
4249 {
4250 //11g is associated to an AP operating in 11n mode.
4251 //Change the HT operating mode to 'mixed mode'.
4252 psessionEntry->gLim11gParams.protectionEnabled = true;
4253 if(eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode)
4254 {
4255 psessionEntry->htOperMode = eSIR_HT_OP_MODE_MIXED;
4256 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304257 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 }
4259 }
4260 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 {
4262 if(overlap)
4263 {
4264 pMac->lim.gLimOverlap11gParams.protectionEnabled = true;
4265 //11g exists in overlap BSS.
4266 //need not to change the operating mode to overlap_legacy
4267 //if higher or same protection operating mode is enabled right now.
4268 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4269 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4270 {
4271 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4272 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4273 }
4274 }
4275 else
4276 {
4277 //11g is associated to an AP operating in 11n mode.
4278 //Change the HT operating mode to 'mixed mode'.
4279 psessionEntry->gLim11gParams.protectionEnabled = true;
4280 if(eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode)
4281 {
4282 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_MIXED;
4283 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05304284 limEnableHtOBSSProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 }
4286 }
4287 }
4288
4289 //This part is common for staiton as well.
4290 if(false == psessionEntry->beaconParams.llgCoexist)
4291 {
4292 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = true;
4293 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4294 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 else if (true == psessionEntry->gLimOverlap11gParams.protectionEnabled)
4296 {
4297 // As operating mode changed after G station assoc some way to update beacon
4298 // This addresses the issue of mode not changing to - 11 in beacon when OBSS overlap is enabled
4299 //pMac->sch.schObject.fBeaconChanged = 1;
4300 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4301 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 }
4303 else if (true == psessionEntry->beaconParams.llgCoexist)
4304 {
4305 //for AP role.
4306 //we need to take care of HT OP mode change if needed.
4307 //We need to take care of Overlap cases.
4308
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 if(eLIM_AP_ROLE == psessionEntry->limSystemRole)
4310 {
4311 if(overlap)
4312 {
4313 //Overlap Legacy protection disabled.
4314 if (psessionEntry->gLim11gParams.numSta == 0)
4315 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4316
4317 // no HT op mode change if any of the overlap protection enabled.
4318 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4319 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4320 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4321 {
4322 //Check if there is a need to change HT OP mode.
4323 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4324 {
4325 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4326 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4327
4328 if(psessionEntry->gLimHt20Params.protectionEnabled){
4329 //Commenting because of CR 258588 WFA cert
4330 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4331 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4332 }
4333 else
4334 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4335 }
4336 }
4337 }
4338 else
4339 {
4340 //Disable protection from 11G stations.
4341 psessionEntry->gLim11gParams.protectionEnabled = false;
4342 //Check if any other non-HT protection enabled.
4343 if(!psessionEntry->gLim11bParams.protectionEnabled)
4344 {
4345
4346 //Right now we are in HT OP Mixed mode.
4347 //Change HT op mode appropriately.
4348 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4349
4350 //Change HT OP mode to 01 if any overlap protection enabled
4351 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4352 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4353 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4354 psessionEntry->gLimOverlapNonGfParams.protectionEnabled)
4355
4356 {
4357 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4358 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4359 }
4360 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4361 {
4362 //Commenting because of CR 258588 WFA cert
4363 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4364 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4365 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4366 }
4367 else
4368 {
4369 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4370 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4371 }
4372 }
4373 }
4374 if(!psessionEntry->gLimOverlap11gParams.protectionEnabled &&
4375 !psessionEntry->gLim11gParams.protectionEnabled)
4376 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004377 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004378 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4379 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4380 }
4381 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 {
4383 if(overlap)
4384 {
4385 //Overlap Legacy protection disabled.
4386 pMac->lim.gLimOverlap11gParams.protectionEnabled = false;
4387
4388 // no HT op mode change if any of the overlap protection enabled.
4389 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4390 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4391 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4392 {
4393 //Check if there is a need to change HT OP mode.
4394 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4395 {
4396 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4397 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4398
4399 if(psessionEntry->gLimHt20Params.protectionEnabled)
4400 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4401 else
4402 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4403 }
4404 }
4405 }
4406 else
4407 {
4408 //Disable protection from 11G stations.
4409 psessionEntry->gLim11gParams.protectionEnabled = false;
4410 //Check if any other non-HT protection enabled.
4411 if(!psessionEntry->gLim11bParams.protectionEnabled)
4412 {
4413
4414 //Right now we are in HT OP Mixed mode.
4415 //Change HT op mode appropriately.
4416 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4417
4418 //Change HT OP mode to 01 if any overlap protection enabled
4419 if(psessionEntry->gLimOlbcParams.protectionEnabled ||
4420 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4421 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4422 pMac->lim.gLimOverlapNonGfParams.protectionEnabled)
4423
4424 {
4425 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4426 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4427 }
4428 else if(psessionEntry->gLimHt20Params.protectionEnabled)
4429 {
4430 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4431 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4432 }
4433 else
4434 {
4435 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4436 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4437 }
4438 }
4439 }
4440 if(!pMac->lim.gLimOverlap11gParams.protectionEnabled &&
4441 !psessionEntry->gLim11gParams.protectionEnabled)
4442 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004443 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004444 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4445 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4446 }
4447 }
4448 //for station role
4449 else
4450 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004451 PELOG1(limLog(pMac, LOG1, FL("===> Protection from 11G Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 pBeaconParams->llgCoexist = psessionEntry->beaconParams.llgCoexist = false;
4453 pBeaconParams->paramChangeBitmap |= PARAM_llGCOEXIST_CHANGED;
4454 }
4455 }
4456 return eSIR_SUCCESS;
4457}
4458//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4459//This check will be done at the caller.
4460
4461/** -------------------------------------------------------------
4462\fn limEnableHtObssProtection
4463\brief based on cofig enables\disables obss protection.
4464\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4465\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4466\param tpUpdateBeaconParams pBeaconParams
4467\return None
4468 -------------------------------------------------------------*/
4469tSirRetStatus
4470limEnableHtOBSSProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4471 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4472{
4473
4474
Jeff Johnsone7245742012-09-05 17:12:55 -07004475 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 return eSIR_SUCCESS; // this protection is only for HT stations.
4477
4478 //overlapping protection configuration check.
4479 if(overlap)
4480 {
4481 //overlapping protection configuration check.
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 }
4483 else
4484 {
4485 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) && !psessionEntry->cfgProtection.obss)
4487 { //ToDo Update this field
4488 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004489 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 return eSIR_SUCCESS;
4491 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004492 {
4493 if(!pMac->lim.cfgProtection.obss)
4494 { //ToDo Update this field
4495 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004496 PELOG1(limLog(pMac, LOG1, FL("protection from Obss is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004497 return eSIR_SUCCESS;
4498 }
4499 }
4500 }
4501
4502
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 if (eLIM_AP_ROLE == psessionEntry->limSystemRole){
4504 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4505 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004506 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 psessionEntry->beaconParams.gHTObssMode = true;
4508 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4509
4510 }
4511 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4512 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004513 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 psessionEntry->beaconParams.gHTObssMode = false;
4515 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4516
4517 }
4518//CR-263021: OBSS bit is not switching back to 0 after disabling the overlapping legacy BSS
4519 if (!enable && !overlap)
4520 {
4521 psessionEntry->gLimOverlap11gParams.protectionEnabled = false;
4522 }
4523 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07004524 {
4525 if ((enable) && (false == psessionEntry->beaconParams.gHTObssMode) )
4526 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004527 PELOG1(limLog(pMac, LOG1, FL("=>obss protection enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004528 psessionEntry->beaconParams.gHTObssMode = true;
4529 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED; // UPDATE AN ENUM FOR OBSS MODE <todo>
4530
4531 }
4532 else if (!enable && (true == psessionEntry->beaconParams.gHTObssMode))
4533 {
4534
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004535 PELOG1(limLog(pMac, LOG1, FL("===> obss Protection disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 psessionEntry->beaconParams.gHTObssMode = false;
4537 pBeaconParams->paramChangeBitmap |= PARAM_OBSS_MODE_CHANGED;
4538
4539 }
4540 }
4541 return eSIR_SUCCESS;
4542}
4543/** -------------------------------------------------------------
4544\fn limEnableHT20Protection
4545\brief based on cofig enables\disables protection from Ht20.
4546\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4547\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4548\param tpUpdateBeaconParams pBeaconParams
4549\return None
4550 -------------------------------------------------------------*/
4551tSirRetStatus
4552limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable,
4553 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4554{
Jeff Johnsone7245742012-09-05 17:12:55 -07004555 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 return eSIR_SUCCESS; // this protection is only for HT stations.
4557
4558 //overlapping protection configuration check.
4559 if(overlap)
4560 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 }
4562 else
4563 {
4564 //normal protection config check
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4566 !psessionEntry->cfgProtection.ht20)
4567 {
4568 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004569 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 return eSIR_SUCCESS;
4571 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 {
4573 if(!pMac->lim.cfgProtection.ht20)
4574 {
4575 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004576 PELOG3(limLog(pMac, LOG3, FL("protection from HT20 is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 return eSIR_SUCCESS;
4578 }
4579 }
4580 }
4581
4582 if (enable)
4583 {
4584 //If we are AP and HT capable, we need to set the HT OP mode
4585 //appropriately.
4586
Jeff Johnson295189b2012-06-20 16:38:30 -07004587 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4588 if(overlap)
4589 {
4590 psessionEntry->gLimOverlapHt20Params.protectionEnabled = true;
4591 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != psessionEntry->htOperMode) &&
4592 (eSIR_HT_OP_MODE_MIXED != psessionEntry->htOperMode))
4593 {
4594 psessionEntry->htOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4595 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4596 }
4597 }
4598 else
4599 {
4600 psessionEntry->gLimHt20Params.protectionEnabled = true;
4601 if(eSIR_HT_OP_MODE_PURE == psessionEntry->htOperMode)
4602 {
4603 //Commenting because of CR 258588 WFA cert
4604 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4605 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4606 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4607 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4608 }
4609 }
4610 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 {
4612 if(overlap)
4613 {
4614 pMac->lim.gLimOverlapHt20Params.protectionEnabled = true;
4615 if((eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode) &&
4616 (eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode))
4617 {
4618 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_OVERLAP_LEGACY;
4619 limEnableHtRifsProtection(pMac, true, overlap, pBeaconParams,psessionEntry);
4620 }
4621 }
4622 else
4623 {
4624 psessionEntry->gLimHt20Params.protectionEnabled = true;
4625 if(eSIR_HT_OP_MODE_PURE == pMac->lim.gHTOperMode)
4626 {
4627 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4628 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4629 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4630 }
4631 }
4632 }
4633
4634 //This part is common for staiton as well.
4635 if(false == psessionEntry->beaconParams.ht20Coexist)
4636 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004637 PELOG1(limLog(pMac, LOG1, FL("=> Prtection from HT20 Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = true;
4639 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4640 }
4641 }
4642 else if (true == psessionEntry->beaconParams.ht20Coexist)
4643 {
4644 //for AP role.
4645 //we need to take care of HT OP mode change if needed.
4646 //We need to take care of Overlap cases.
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 if(eLIM_AP_ROLE == psessionEntry->limSystemRole){
4648 if(overlap)
4649 {
4650 //Overlap Legacy protection disabled.
4651 psessionEntry->gLimOverlapHt20Params.protectionEnabled = false;
4652
4653 // no HT op mode change if any of the overlap protection enabled.
4654 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4655 psessionEntry->gLimOverlap11gParams.protectionEnabled ||
4656 psessionEntry->gLimOverlapHt20Params.protectionEnabled ||
4657 psessionEntry->gLimOverlapNonGfParams.protectionEnabled))
4658 {
4659
4660 //Check if there is a need to change HT OP mode.
4661 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == psessionEntry->htOperMode)
4662 {
4663 if(psessionEntry->gLimHt20Params.protectionEnabled)
4664 {
4665 //Commented beacuse of CR 258588 for WFA Cert
4666 //psessionEntry->htOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4667 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4668 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4669 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4670 }
4671 else
4672 {
4673 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4674 }
4675 }
4676 }
4677 }
4678 else
4679 {
4680 //Disable protection from 11G stations.
4681 psessionEntry->gLimHt20Params.protectionEnabled = false;
4682
4683 //Change HT op mode appropriately.
4684 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == psessionEntry->htOperMode)
4685 {
4686 psessionEntry->htOperMode = eSIR_HT_OP_MODE_PURE;
4687 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4688 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4689 }
4690 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004691 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4693 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4694 }else if(eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole)
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 {
4696 if(overlap)
4697 {
4698 //Overlap Legacy protection disabled.
4699 pMac->lim.gLimOverlapHt20Params.protectionEnabled = false;
4700
4701 // no HT op mode change if any of the overlap protection enabled.
4702 if(!(psessionEntry->gLimOlbcParams.protectionEnabled ||
4703 pMac->lim.gLimOverlap11gParams.protectionEnabled ||
4704 pMac->lim.gLimOverlapHt20Params.protectionEnabled ||
4705 pMac->lim.gLimOverlapNonGfParams.protectionEnabled))
4706 {
4707
4708 //Check if there is a need to change HT OP mode.
4709 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pMac->lim.gHTOperMode)
4710 {
4711 if(psessionEntry->gLimHt20Params.protectionEnabled)
4712 {
4713 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT;
4714 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4715 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4716 }
4717 else
4718 {
4719 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4720 }
4721 }
4722 }
4723 }
4724 else
4725 {
4726 //Disable protection from 11G stations.
4727 psessionEntry->gLimHt20Params.protectionEnabled = false;
4728
4729 //Change HT op mode appropriately.
4730 if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pMac->lim.gHTOperMode)
4731 {
4732 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
4733 limEnableHtRifsProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4734 limEnableHtOBSSProtection(pMac, false, overlap, pBeaconParams,psessionEntry);
4735 }
4736 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004737 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT 20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004738 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4739 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4740 }
4741 //for station role
4742 else
4743 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004744 PELOG1(limLog(pMac, LOG1, FL("===> Protection from HT20 Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 pBeaconParams->ht20MhzCoexist = psessionEntry->beaconParams.ht20Coexist = false;
4746 pBeaconParams->paramChangeBitmap |= PARAM_HT20MHZCOEXIST_CHANGED;
4747 }
4748 }
4749
4750 return eSIR_SUCCESS;
4751}
4752
4753/** -------------------------------------------------------------
4754\fn limEnableHTNonGfProtection
4755\brief based on cofig enables\disables protection from NonGf.
4756\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4757\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4758\param tpUpdateBeaconParams pBeaconParams
4759\return None
4760 -------------------------------------------------------------*/
4761tSirRetStatus
4762limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4763 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4764{
Jeff Johnsone7245742012-09-05 17:12:55 -07004765 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 return eSIR_SUCCESS; // this protection is only for HT stations.
4767
4768 //overlapping protection configuration check.
4769 if(overlap)
4770 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004771 }
4772 else
4773 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 //normal protection config check
4775 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4776 !psessionEntry->cfgProtection.nonGf)
4777 {
4778 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004779 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 return eSIR_SUCCESS;
4781 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 {
4783 //normal protection config check
4784 if(!pMac->lim.cfgProtection.nonGf)
4785 {
4786 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004787 PELOG3(limLog(pMac, LOG3, FL("protection from NonGf is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 return eSIR_SUCCESS;
4789 }
4790 }
4791 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4793 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004795 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4797 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4798 }
4799 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4800 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004801 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4803 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4804 }
4805 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 {
4807 if ((enable) && (false == psessionEntry->beaconParams.llnNonGFCoexist))
4808 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004809 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from non GF Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004810 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = true;
4811 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4812 }
4813 else if (!enable && (true == psessionEntry->beaconParams.llnNonGFCoexist))
4814 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004815 PELOG1(limLog(pMac, LOG1, FL("===> Protection from Non GF Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 pBeaconParams->llnNonGFCoexist = psessionEntry->beaconParams.llnNonGFCoexist = false;
4817 pBeaconParams->paramChangeBitmap |= PARAM_NON_GF_DEVICES_PRESENT_CHANGED;
4818 }
4819 }
4820
4821 return eSIR_SUCCESS;
4822}
4823
4824/** -------------------------------------------------------------
4825\fn limEnableHTLsigTxopProtection
4826\brief based on cofig enables\disables LsigTxop protection.
4827\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4828\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4829\param tpUpdateBeaconParams pBeaconParams
4830\return None
4831 -------------------------------------------------------------*/
4832tSirRetStatus
4833limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4834 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4835{
Jeff Johnsone7245742012-09-05 17:12:55 -07004836 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 return eSIR_SUCCESS; // this protection is only for HT stations.
4838
4839 //overlapping protection configuration check.
4840 if(overlap)
4841 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 }
4843 else
4844 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 //normal protection config check
4846 if((psessionEntry->limSystemRole == eLIM_AP_ROLE ) &&
4847 !psessionEntry->cfgProtection.lsigTxop)
4848 {
4849 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004850 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 return eSIR_SUCCESS;
4852 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 {
4854 //normal protection config check
4855 if(!pMac->lim.cfgProtection.lsigTxop)
4856 {
4857 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004858 PELOG3(limLog(pMac, LOG3, FL(" protection from LsigTxop not supported is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004859 return eSIR_SUCCESS;
4860 }
4861 }
4862 }
4863
4864
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4866 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4867 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004868 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004869 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4870 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4871 }
4872 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4873 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004874 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004875 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4876 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4877 }
4878 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004879 {
4880 if ((enable) && (false == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4881 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004882 PELOG1(limLog(pMac, LOG1, FL(" => Prtection from LsigTxop Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 pBeaconParams->fLsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = true;
4884 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4885 }
4886 else if (!enable && (true == psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport))
4887 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004888 PELOG1(limLog(pMac, LOG1, FL("===> Protection from LsigTxop Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 pBeaconParams->fLsigTXOPProtectionFullSupport= psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = false;
4890 pBeaconParams->paramChangeBitmap |= PARAM_LSIG_TXOP_FULL_SUPPORT_CHANGED;
4891 }
4892 }
4893 return eSIR_SUCCESS;
4894}
4895//FIXME_PROTECTION : need to check for no APSD whenever we want to enable this protection.
4896//This check will be done at the caller.
4897/** -------------------------------------------------------------
4898\fn limEnableHtRifsProtection
4899\brief based on cofig enables\disables Rifs protection.
4900\param tANI_U8 enable : 1=> enable protection, 0=> disable protection.
4901\param tANI_U8 overlap: 1=> called from overlap context, 0 => called from assoc context.
4902\param tpUpdateBeaconParams pBeaconParams
4903\return None
4904 -------------------------------------------------------------*/
4905tSirRetStatus
4906limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable,
4907 tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
4908{
Jeff Johnsone7245742012-09-05 17:12:55 -07004909 if(!psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07004910 return eSIR_SUCCESS; // this protection is only for HT stations.
4911
4912
4913 //overlapping protection configuration check.
4914 if(overlap)
4915 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004916 }
4917 else
4918 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004919 //normal protection config check
4920 if((psessionEntry->limSystemRole == eLIM_AP_ROLE) &&
4921 !psessionEntry->cfgProtection.rifs)
4922 {
4923 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004924 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004925 return eSIR_SUCCESS;
4926 }else if(psessionEntry->limSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 {
4928 //normal protection config check
4929 if(!pMac->lim.cfgProtection.rifs)
4930 {
4931 // protection disabled.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004932 PELOG3(limLog(pMac, LOG3, FL(" protection from Rifs is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004933 return eSIR_SUCCESS;
4934 }
4935 }
4936 }
4937
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 if(psessionEntry->limSystemRole == eLIM_AP_ROLE){
4939 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4940 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4941 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004942 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4944 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4945 }
4946 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4947 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4948 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004949 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004950 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4951 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4952 }
4953 }else
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 {
4955 // Disabling the RIFS Protection means Enable the RIFS mode of operation in the BSS
4956 if ((!enable) && (false == psessionEntry->beaconParams.fRIFSMode))
4957 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004958 PELOG1(limLog(pMac, LOG1, FL(" => Rifs protection Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = true;
4960 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4961 }
4962 // Enabling the RIFS Protection means Disable the RIFS mode of operation in the BSS
4963 else if (enable && (true == psessionEntry->beaconParams.fRIFSMode))
4964 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004965 PELOG1(limLog(pMac, LOG1, FL("===> Rifs Protection Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 pBeaconParams->fRIFSMode = psessionEntry->beaconParams.fRIFSMode = false;
4967 pBeaconParams->paramChangeBitmap |= PARAM_RIFS_MODE_CHANGED;
4968 }
4969 }
4970 return eSIR_SUCCESS;
4971}
4972
4973// ---------------------------------------------------------------------
4974/**
4975 * limEnableShortPreamble
4976 *
4977 * FUNCTION:
4978 * Enable/Disable short preamble
4979 *
4980 * LOGIC:
4981 *
4982 * ASSUMPTIONS:
4983 *
4984 * NOTE:
4985 *
4986 * @param enable Flag to enable/disable short preamble
4987 * @return None
4988 */
4989
4990tSirRetStatus
4991limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry)
4992{
4993 tANI_U32 val;
4994
4995 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS)
4996 {
4997 /* Could not get short preamble enabled flag from CFG. Log error. */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004998 limLog(pMac, LOGP, FL("could not retrieve short preamble flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004999 return eSIR_FAILURE;
5000 }
5001
5002 if (!val)
5003 return eSIR_SUCCESS;
5004
5005 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_PREAMBLE_ENABLED, &val) != eSIR_SUCCESS)
5006 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005007 limLog(pMac, LOGP, FL("could not retrieve 11G short preamble switching enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 return eSIR_FAILURE;
5009 }
5010
5011 if (!val) // 11G short preamble switching is disabled.
5012 return eSIR_SUCCESS;
5013
5014 if ( psessionEntry->limSystemRole == eLIM_AP_ROLE )
5015 {
5016 if (enable && (psessionEntry->beaconParams.fShortPreamble == 0))
5017 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005018 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Enabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 psessionEntry->beaconParams.fShortPreamble = true;
5020 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5021 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5022 }
5023 else if (!enable && (psessionEntry->beaconParams.fShortPreamble == 1))
5024 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005025 PELOG1(limLog(pMac, LOG1, FL("===> Short Preamble Disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005026 psessionEntry->beaconParams.fShortPreamble = false;
5027 pBeaconParams->fShortPreamble = (tANI_U8) psessionEntry->beaconParams.fShortPreamble;
5028 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_PREAMBLE_CHANGED;
5029 }
5030 }
5031
5032 return eSIR_SUCCESS;
5033 }
5034
5035/**
5036 * limTxComplete
5037 *
5038 * Function:
5039 * This is LIM's very own "TX MGMT frame complete" completion routine.
5040 *
5041 * Logic:
5042 * LIM wants to send a MGMT frame (broadcast or unicast)
5043 * LIM allocates memory using palPktAlloc( ..., **pData, **pPacket )
5044 * LIM transmits the MGMT frame using the API:
5045 * halTxFrame( ... pPacket, ..., (void *) limTxComplete, pData )
5046 * HDD, via halTxFrame/DXE, "transfers" the packet over to BMU
5047 * HDD, if it determines that a TX completion routine (in this case
5048 * limTxComplete) has been provided, will invoke this callback
5049 * LIM will try to free the TX MGMT packet that was earlier allocated, in order
5050 * to send this MGMT frame, using the PAL API palPktFree( ... pData, pPacket )
5051 *
5052 * Assumptions:
5053 * Presently, this is ONLY being used for MGMT frames/packets
5054 * TODO:
5055 * Would it do good for LIM to have some sort of "signature" validation to
5056 * ensure that the pData argument passed in was a buffer that was actually
5057 * allocated by LIM and/or is not corrupted?
5058 *
5059 * Note: FIXME and TODO
5060 * Looks like palPktFree() is interested in pPacket. But, when this completion
5061 * routine is called, only pData is made available to LIM!!
5062 *
5063 * @param void A pointer to pData. Shouldn't it be pPacket?!
5064 *
5065 * @return none
5066 */
5067void limTxComplete( tHalHandle hHal, void *pData )
5068{
5069 tpAniSirGlobal pMac;
5070 pMac = (tpAniSirGlobal)hHal;
5071
5072#ifdef FIXME_PRIMA
5073 /* the trace logic needs to be fixed for Prima. Refer to CR 306075 */
5074#ifdef TRACE_RECORD
5075 {
5076 tpSirMacMgmtHdr mHdr;
5077 v_U8_t *pRxBd;
5078 vos_pkt_t *pVosPkt;
5079 VOS_STATUS vosStatus;
5080
5081
5082
5083 pVosPkt = (vos_pkt_t *)pData;
5084 vosStatus = vos_pkt_peek_data( pVosPkt, 0, (v_PVOID_t *)&pRxBd, WLANHAL_RX_BD_HEADER_SIZE);
5085
5086 if(VOS_IS_STATUS_SUCCESS(vosStatus))
5087 {
5088 mHdr = WDA_GET_RX_MAC_HEADER(pRxBd);
Jeff Johnsone7245742012-09-05 17:12:55 -07005089 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE, NO_SESSION, mHdr->fc.subType);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005090
5091 }
5092 }
5093#endif
5094#endif
5095
5096 palPktFree( pMac->hHdd,
5097 HAL_TXRX_FRM_802_11_MGMT,
5098 (void *) NULL, // this is ignored and will likely be removed from this API
5099 (void *) pData ); // lim passed in pPacket in the pData pointer that is given in this completion routine
5100}
5101
5102/**
5103 * \brief This function updates lim global structure, if CB parameters in the BSS
5104 * have changed, and sends an indication to HAL also with the
5105 * updated HT Parameters.
5106 * This function does not detect the change in the primary channel, that is done as part
5107 * of channel Swtich IE processing.
5108 * If STA is configured with '20Mhz only' mode, then this function does not do anything
5109 * This function changes the CB mode, only if the self capability is set to '20 as well as 40Mhz'
5110 *
5111 *
5112 * \param pMac Pointer to global MAC structure
5113 *
5114 * \param pRcvdHTInfo Pointer to HT Info IE obtained from a Beacon or
5115 * Probe Response
5116 *
5117 * \param bssIdx BSS Index of the Bss to which Station is associated.
5118 *
5119 *
5120 */
5121
5122void limUpdateStaRunTimeHTSwitchChnlParams( tpAniSirGlobal pMac,
5123 tDot11fIEHTInfo *pHTInfo,
5124 tANI_U8 bssIdx,
5125 tpPESession psessionEntry)
5126{
Jeff Johnsone7245742012-09-05 17:12:55 -07005127 ePhyChanBondState secondaryChnlOffset = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -07005128#if !defined WLAN_FEATURE_VOWIFI
5129 tANI_U32 localPwrConstraint;
5130#endif
5131
5132 //If self capability is set to '20Mhz only', then do not change the CB mode.
Jeff Johnson295189b2012-06-20 16:38:30 -07005133 if( !limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005134 return;
5135
5136#if !defined WLAN_FEATURE_VOWIFI
5137 if(wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005138 limLog( pMac, LOGP, FL( "Unable to get Local Power Constraint from cfg" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 return;
5140 }
5141#endif
5142
Jeff Johnsone7245742012-09-05 17:12:55 -07005143 if ( psessionEntry->htSecondaryChannelOffset != ( tANI_U8 ) pHTInfo->secondaryChannelOffset ||
5144 psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 ) pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005146 psessionEntry->htSecondaryChannelOffset = ( ePhyChanBondState ) pHTInfo->secondaryChannelOffset;
5147 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 ) pHTInfo->recommendedTxWidthSet;
5148 if ( eHT_CHANNEL_WIDTH_40MHZ == psessionEntry->htRecommendedTxWidthSet )
5149 secondaryChnlOffset = (ePhyChanBondState)pHTInfo->secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07005150
5151 // Notify HAL
5152 limLog( pMac, LOGW, FL( "Channel Information in HT IE change"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005153 "d; sending notification to HAL." ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005154 limLog( pMac, LOGW, FL( "Primary Channel: %d, Secondary Chan"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005155 "nel Offset: %d, Channel Width: %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005156 pHTInfo->primaryChannel, secondaryChnlOffset,
Jeff Johnsone7245742012-09-05 17:12:55 -07005157 psessionEntry->htRecommendedTxWidthSet );
Madan Mohan Koyyalamudifd322a02012-10-05 12:01:26 -07005158 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
5159 pMac->lim.gpchangeChannelCallback = NULL;
5160 pMac->lim.gpchangeChannelData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005161
5162#if defined WLAN_FEATURE_VOWIFI
5163 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5164 secondaryChnlOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
5165#else
5166 limSendSwitchChnlParams( pMac, ( tANI_U8 ) pHTInfo->primaryChannel,
5167 secondaryChnlOffset, (tPowerdBm)localPwrConstraint, psessionEntry->peSessionId);
5168#endif
5169
5170 //In case of IBSS, if STA should update HT Info IE in its beacons.
5171 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
5172 {
5173 schSetFixedBeaconFields(pMac,psessionEntry);
5174 }
5175
5176 }
5177} // End limUpdateStaRunTimeHTParams.
5178
5179/**
5180 * \brief This function updates the lim global structure, if any of the
5181 * HT Capabilities have changed.
5182 *
5183 *
5184 * \param pMac Pointer to Global MAC structure
5185 *
5186 * \param pHTCapability Pointer to HT Capability Information Element
5187 * obtained from a Beacon or Probe Response
5188 *
5189 *
5190 *
5191 */
5192
5193void limUpdateStaRunTimeHTCapability( tpAniSirGlobal pMac,
5194 tDot11fIEHTCaps *pHTCaps )
5195{
5196
5197 if ( pMac->lim.gHTLsigTXOPProtection != ( tANI_U8 ) pHTCaps->lsigTXOPProtection )
5198 {
5199 pMac->lim.gHTLsigTXOPProtection = ( tANI_U8 ) pHTCaps->lsigTXOPProtection;
5200 // Send change notification to HAL
5201 }
5202
5203 if ( pMac->lim.gHTAMpduDensity != ( tANI_U8 ) pHTCaps->mpduDensity )
5204 {
5205 pMac->lim.gHTAMpduDensity = ( tANI_U8 ) pHTCaps->mpduDensity;
5206 // Send change notification to HAL
5207 }
5208
5209 if ( pMac->lim.gHTMaxRxAMpduFactor != ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor )
5210 {
5211 pMac->lim.gHTMaxRxAMpduFactor = ( tANI_U8 ) pHTCaps->maxRxAMPDUFactor;
5212 // Send change notification to HAL
5213 }
5214
5215
5216} // End limUpdateStaRunTimeHTCapability.
5217
5218/**
5219 * \brief This function updates lim global structure, if any of the HT
5220 * Info Parameters have changed.
5221 *
5222 *
5223 * \param pMac Pointer to the global MAC structure
5224 *
5225 * \param pHTInfo Pointer to the HT Info IE obtained from a Beacon or
5226 * Probe Response
5227 *
5228 *
5229 */
5230
5231void limUpdateStaRunTimeHTInfo( tpAniSirGlobal pMac,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305232 tDot11fIEHTInfo *pHTInfo, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005233{
Jeff Johnsone7245742012-09-05 17:12:55 -07005234 if ( psessionEntry->htRecommendedTxWidthSet != ( tANI_U8 )pHTInfo->recommendedTxWidthSet )
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005236 psessionEntry->htRecommendedTxWidthSet = ( tANI_U8 )pHTInfo->recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -07005237 // Send change notification to HAL
5238 }
5239
5240 if ( psessionEntry->beaconParams.fRIFSMode != ( tANI_U8 )pHTInfo->rifsMode )
5241 {
5242 psessionEntry->beaconParams.fRIFSMode = ( tANI_U8 )pHTInfo->rifsMode;
5243 // Send change notification to HAL
5244 }
5245
5246 if ( pMac->lim.gHTServiceIntervalGranularity != ( tANI_U8 )pHTInfo->serviceIntervalGranularity )
5247 {
5248 pMac->lim.gHTServiceIntervalGranularity = ( tANI_U8 )pHTInfo->serviceIntervalGranularity;
5249 // Send change notification to HAL
5250 }
5251
5252 if ( pMac->lim.gHTOperMode != ( tSirMacHTOperatingMode )pHTInfo->opMode )
5253 {
5254 pMac->lim.gHTOperMode = ( tSirMacHTOperatingMode )pHTInfo->opMode;
5255 // Send change notification to HAL
5256 }
5257
5258 if ( psessionEntry->beaconParams.llnNonGFCoexist != pHTInfo->nonGFDevicesPresent )
5259 {
5260 psessionEntry->beaconParams.llnNonGFCoexist = ( tANI_U8 )pHTInfo->nonGFDevicesPresent;
5261 }
5262
5263 if ( pMac->lim.gHTSTBCBasicMCS != ( tANI_U8 )pHTInfo->basicSTBCMCS )
5264 {
5265 pMac->lim.gHTSTBCBasicMCS = ( tANI_U8 )pHTInfo->basicSTBCMCS;
5266 // Send change notification to HAL
5267 }
5268
5269 if ( pMac->lim.gHTDualCTSProtection != ( tANI_U8 )pHTInfo->dualCTSProtection )
5270 {
5271 pMac->lim.gHTDualCTSProtection = ( tANI_U8 )pHTInfo->dualCTSProtection;
5272 // Send change notification to HAL
5273 }
5274
5275 if ( pMac->lim.gHTSecondaryBeacon != ( tANI_U8 )pHTInfo->secondaryBeacon )
5276 {
5277 pMac->lim.gHTSecondaryBeacon = ( tANI_U8 )pHTInfo->secondaryBeacon;
5278 // Send change notification to HAL
5279 }
5280
5281 if ( psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport != ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport )
5282 {
5283 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = ( tANI_U8 )pHTInfo->lsigTXOPProtectionFullSupport;
5284 // Send change notification to HAL
5285 }
5286
5287 if ( pMac->lim.gHTPCOActive != ( tANI_U8 )pHTInfo->pcoActive )
5288 {
5289 pMac->lim.gHTPCOActive = ( tANI_U8 )pHTInfo->pcoActive;
5290 // Send change notification to HAL
5291 }
5292
5293 if ( pMac->lim.gHTPCOPhase != ( tANI_U8 )pHTInfo->pcoPhase )
5294 {
5295 pMac->lim.gHTPCOPhase = ( tANI_U8 )pHTInfo->pcoPhase;
5296 // Send change notification to HAL
5297 }
5298
5299} // End limUpdateStaRunTimeHTInfo.
5300
5301
5302/** -------------------------------------------------------------
5303\fn limProcessHalIndMessages
5304\brief callback function for HAL indication
5305\param tpAniSirGlobal pMac
5306\param tANI_U32 mesgId
5307\param void *mesgParam
5308\return tSirRetStatu - status
5309 -------------------------------------------------------------*/
5310
5311tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 msgId, void *msgParam )
5312{
5313 //its PE's responsibility to free msgparam when its done extracting the message parameters.
5314 tSirMsgQ msg;
5315
5316 switch(msgId)
5317 {
5318 case SIR_LIM_DEL_TS_IND:
5319 case SIR_LIM_ADD_BA_IND:
5320 case SIR_LIM_DEL_BA_ALL_IND:
5321 case SIR_LIM_DELETE_STA_CONTEXT_IND:
5322 case SIR_LIM_BEACON_GEN_IND:
5323 msg.type = (tANI_U16) msgId;
5324 msg.bodyptr = msgParam;
5325 msg.bodyval = 0;
5326 break;
5327
5328 default:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305329 vos_mem_free(msgParam);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005330 limLog(pMac, LOGP, FL("invalid message id = %d received"), msgId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005331 return eSIR_FAILURE;
5332 }
5333
5334 if (limPostMsgApi(pMac, &msg) != eSIR_SUCCESS)
5335 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305336 vos_mem_free(msgParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07005337 limLog(pMac, LOGP, FL("limPostMsgApi failed for msgid = %d"), msg.type);
5338 return eSIR_FAILURE;
5339 }
5340 return eSIR_SUCCESS;
5341}
5342
5343/** -------------------------------------------------------------
5344\fn limValidateDeltsReq
5345\brief Validates DelTs req originated by SME or by HAL and also sends halMsg_DelTs to HAL
5346\param tpAniSirGlobal pMac
5347\param tpSirDeltsReq pDeltsReq
5348\param tSirMacAddr peerMacAddr
5349\return eSirRetStatus - status
5350 -------------------------------------------------------------*/
5351
5352tSirRetStatus
5353limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry)
5354{
5355 tpDphHashNode pSta;
5356 tANI_U8 tsStatus;
5357 tSirMacTSInfo *tsinfo;
5358 tANI_U32 i;
5359 tANI_U8 tspecIdx;
5360 /* if sta
5361 * - verify assoc state
5362 * - del tspec locally
5363 * if ap,
5364 * - verify sta is in assoc state
5365 * - del sta tspec locally
5366 */
5367 if(pDeltsReq == NULL)
5368 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005369 PELOGE(limLog(pMac, LOGE, FL("Delete TS request pointer is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005370 return eSIR_FAILURE;
5371 }
5372
5373 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
5374 {
5375 tANI_U32 val;
5376
5377 // station always talks to the AP
5378 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5379
5380 val = sizeof(tSirMacAddr);
5381 #if 0
5382 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMacAddr, &val) != eSIR_SUCCESS)
5383 {
5384 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005385 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005386 return eSIR_FAILURE;
5387 }
5388 #endif// TO SUPPORT BT-AMP
5389 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
5390
5391 }
5392 else
5393 {
5394 tANI_U16 assocId;
5395 tANI_U8 *macaddr = (tANI_U8 *) peerMacAddr;
5396
5397 assocId = pDeltsReq->aid;
5398 if (assocId != 0)
5399 pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
5400 else
5401 pSta = dphLookupHashEntry(pMac, pDeltsReq->macAddr, &assocId, &psessionEntry->dph.dphHashTable);
5402
5403 if (pSta != NULL)
5404 // TBD: check sta assoc state as well
5405 for (i =0; i < sizeof(tSirMacAddr); i++)
5406 macaddr[i] = pSta->staAddr[i];
5407 }
5408
5409 if (pSta == NULL)
5410 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005411 PELOGE(limLog(pMac, LOGE, "Cannot find station context for delts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005412 return eSIR_FAILURE;
5413 }
5414
5415 if ((! pSta->valid) ||
5416 (pSta->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
5417 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005418 PELOGE(limLog(pMac, LOGE, "Invalid Sta (or state) for DelTsReq");)
Jeff Johnson295189b2012-06-20 16:38:30 -07005419 return eSIR_FAILURE;
5420 }
5421
5422 pDeltsReq->req.wsmTspecPresent = 0;
5423 pDeltsReq->req.wmeTspecPresent = 0;
5424 pDeltsReq->req.lleTspecPresent = 0;
5425
5426 if ((pSta->wsmEnabled) &&
5427 (pDeltsReq->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
5428 pDeltsReq->req.wsmTspecPresent = 1;
5429 else if (pSta->wmeEnabled)
5430 pDeltsReq->req.wmeTspecPresent = 1;
5431 else if (pSta->lleEnabled)
5432 pDeltsReq->req.lleTspecPresent = 1;
5433 else
5434 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005435 PELOGW(limLog(pMac, LOGW, FL("DELTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005436 return eSIR_FAILURE;
5437 }
5438
5439 tsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo
5440 : &pDeltsReq->req.tsinfo;
5441 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005442 FL("received DELTS_REQ message (wmeTspecPresent = %d, lleTspecPresent = %d, wsmTspecPresent = %d, tsid %d, up %d, direction = %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005443 pDeltsReq->req.wmeTspecPresent, pDeltsReq->req.lleTspecPresent, pDeltsReq->req.wsmTspecPresent,
5444 tsinfo->traffic.tsid, tsinfo->traffic.userPrio, tsinfo->traffic.direction);)
5445
5446 // if no Access Control, ignore the request
Jeff Johnson295189b2012-06-20 16:38:30 -07005447
5448 if (limAdmitControlDeleteTS(pMac, pSta->assocId, tsinfo, &tsStatus, &tspecIdx)
5449 != eSIR_SUCCESS)
5450 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005451 PELOGE(limLog(pMac, LOGE, "ERROR DELTS request for sta assocId %d (tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07005452 pSta->assocId, tsinfo->traffic.tsid, tsinfo->traffic.userPrio);)
5453 return eSIR_FAILURE;
5454 }
5455 else if ((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
5456 (tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH))
5457 {
5458 //edca only now.
5459 }
5460 else
5461 {
5462 if((tsinfo->traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_EDCA) &&
5463 psessionEntry->gLimEdcaParams[upToAc(tsinfo->traffic.userPrio)].aci.acm)
5464 {
5465 //send message to HAL to delete TS
Jeff Johnsone7245742012-09-05 17:12:55 -07005466 if(eSIR_SUCCESS != limSendHalMsgDelTs(pMac, pSta->staIndex, tspecIdx, pDeltsReq->req, psessionEntry->peSessionId))
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005468 limLog(pMac, LOGW, FL("DelTs with UP %d failed in limSendHalMsgDelTs - ignoring request"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 tsinfo->traffic.userPrio);
5470 return eSIR_FAILURE;
5471 }
5472 }
5473 }
5474 return eSIR_SUCCESS;
5475}
5476
5477/** -------------------------------------------------------------
5478\fn limRegisterHalIndCallBack
5479\brief registers callback function to HAL for any indication.
5480\param tpAniSirGlobal pMac
5481\return none.
5482 -------------------------------------------------------------*/
5483void
5484limRegisterHalIndCallBack(tpAniSirGlobal pMac)
5485{
5486 tSirMsgQ msg;
5487 tpHalIndCB pHalCB;
5488
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305489 pHalCB = vos_mem_malloc(sizeof(tHalIndCB));
5490 if ( NULL == pHalCB )
Jeff Johnson295189b2012-06-20 16:38:30 -07005491 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305492 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005493 return;
5494 }
5495
5496 pHalCB->pHalIndCB = limProcessHalIndMessages;
5497
5498 msg.type = WDA_REGISTER_PE_CALLBACK;
5499 msg.bodyptr = pHalCB;
5500 msg.bodyval = 0;
5501
Jeff Johnsone7245742012-09-05 17:12:55 -07005502 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5504 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305505 vos_mem_free(pHalCB);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005506 limLog(pMac, LOGP, FL("wdaPostCtrlMsg() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005507 }
5508
5509 return;
5510}
5511
5512
5513/** -------------------------------------------------------------
5514\fn limProcessAddBaInd
5515
5516\brief handles the BA activity check timeout indication coming from HAL.
5517 Validates the request, posts request for sending addBaReq message for every candidate in the list.
5518\param tpAniSirGlobal pMac
5519\param tSirMsgQ limMsg
5520\return None
5521-------------------------------------------------------------*/
5522void
5523limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5524{
5525 tANI_U8 i;
5526 tANI_U8 tid;
5527 tANI_U16 assocId;
5528 tpDphHashNode pSta;
5529 tpAddBaCandidate pBaCandidate;
5530 tANI_U32 baCandidateCnt;
5531 tpBaActivityInd pBaActivityInd;
5532 tpPESession psessionEntry;
5533 tANI_U8 sessionId;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005534#ifdef FEATURE_WLAN_TDLS
5535 boolean htCapable = FALSE;
5536#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005537
5538
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005539 if (limMsg->bodyptr == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005540 return;
5541
5542 pBaActivityInd = (tpBaActivityInd)limMsg->bodyptr;
5543 baCandidateCnt = pBaActivityInd->baCandidateCnt;
5544
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005545 if ((psessionEntry = peFindSessionByBssid(pMac,pBaActivityInd->bssId,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005546 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005547 limLog(pMac, LOGE,FL("session does not exist for given BSSId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305548 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 return;
5550 }
5551
5552 //if we are not HT capable we don't need to handle BA timeout indication from HAL.
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005553#ifdef FEATURE_WLAN_TDLS
5554 if ((baCandidateCnt > pMac->lim.maxStation))
5555#else
5556 if ((baCandidateCnt > pMac->lim.maxStation) || !psessionEntry->htCapability )
5557#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005558 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305559 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 return;
5561 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005562
5563#ifdef FEATURE_WLAN_TDLS
5564 //if we have TDLS peers, we should look at peers HT capability, which can be different than
5565 //AP capability
5566 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5567
5568 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
5569 {
5570 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
5571 if ((NULL == pSta) || (!pSta->valid))
5572 continue;
5573
5574 if (STA_ENTRY_TDLS_PEER == pSta->staType)
5575 htCapable = pSta->mlmStaContext.htCapability;
5576 else
5577 htCapable = psessionEntry->htCapability;
5578
5579 if (htCapable)
5580 break;
5581 }
5582 if (!htCapable)
5583 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305584 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005585 return;
5586 }
5587#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005588
5589 //delete the complete dialoguetoken linked list
5590 limDeleteDialogueTokenList(pMac);
5591 pBaCandidate = (tpAddBaCandidate) (((tANI_U8*)pBaActivityInd) + sizeof(tBaActivityInd));
5592
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005593 for (i=0; i<baCandidateCnt; i++, pBaCandidate++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005594 {
5595 pSta = dphLookupHashEntry(pMac, pBaCandidate->staAddr, &assocId, &psessionEntry->dph.dphHashTable);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005596 if ((NULL == pSta) || (!pSta->valid))
5597 continue;
Jeff Johnson295189b2012-06-20 16:38:30 -07005598
5599 for (tid=0; tid<STACFG_MAX_TC; tid++)
5600 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08005601 if((eBA_DISABLE == pSta->tcCfg[tid].fUseBATx) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07005602 (pBaCandidate->baInfo[tid].fBaEnable))
5603 {
Hoonki Lee9af07cf2013-04-24 01:21:58 -07005604 limLog(pMac, LOGE, FL("BA setup for staId = %d, TID: %d, SSN: %d"),
5605 pSta->staIndex, tid, pBaCandidate->baInfo[tid].startingSeqNum);
Jeff Johnson295189b2012-06-20 16:38:30 -07005606 limPostMlmAddBAReq(pMac, pSta, tid, pBaCandidate->baInfo[tid].startingSeqNum,psessionEntry);
5607 }
5608 }
5609 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305610 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 return;
5612}
5613
5614
5615/** -------------------------------------------------------------
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005616\fn limDeleteBASessions
5617\brief Deletes all the exisitng BA sessions for given session
5618 and BA direction.
Jeff Johnson295189b2012-06-20 16:38:30 -07005619\param tpAniSirGlobal pMac
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005620\param tpPESession pSessionEntry
5621\param tANI_U32 baDirection
5622\return None
Jeff Johnson295189b2012-06-20 16:38:30 -07005623-------------------------------------------------------------*/
5624
5625void
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005626limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry,
5627 tANI_U32 baDirection)
Jeff Johnson295189b2012-06-20 16:38:30 -07005628{
5629 tANI_U32 i;
5630 tANI_U8 tid;
5631 tpDphHashNode pSta;
5632
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005633 if (NULL == pSessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005634 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005635 limLog(pMac, LOGE, FL("Session does not exist"));
5636 }
5637 else
5638 {
5639 for(tid = 0; tid < STACFG_MAX_TC; tid++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005641 if ((eLIM_AP_ROLE == pSessionEntry->limSystemRole) ||
5642 (pSessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
5643 (eLIM_STA_IN_IBSS_ROLE == pSessionEntry->limSystemRole) ||
5644 (pSessionEntry->limSystemRole == eLIM_P2P_DEVICE_GO))
Jeff Johnson295189b2012-06-20 16:38:30 -07005645 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005646 for (i = 0; i < pMac->lim.maxStation; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005648 pSta = pSessionEntry->dph.dphHashTable.pDphNodeArray + i;
5649 if (pSta && pSta->added)
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005650 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005651 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5652 (baDirection & BA_INITIATOR))
5653 {
5654 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5655 eSIR_MAC_UNSPEC_FAILURE_REASON,
5656 pSessionEntry);
5657 }
5658 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5659 (baDirection & BA_RECIPIENT))
5660 {
5661 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5662 eSIR_MAC_UNSPEC_FAILURE_REASON,
5663 pSessionEntry);
5664 }
Kiran Kumar Lokerec1641f52013-05-29 14:29:43 -07005665 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005666 }
5667 }
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005668 else if ((eLIM_STA_ROLE == pSessionEntry->limSystemRole) ||
5669 (eLIM_BT_AMP_STA_ROLE == pSessionEntry->limSystemRole) ||
5670 (eLIM_P2P_DEVICE_ROLE == pSessionEntry->limSystemRole))
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005671 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005672 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
5673 &pSessionEntry->dph.dphHashTable);
5674 if (pSta && pSta->added)
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005675 {
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005676 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBATx) &&
5677 (baDirection & BA_INITIATOR))
5678 {
5679 limPostMlmDelBAReq(pMac, pSta, eBA_INITIATOR, tid,
5680 eSIR_MAC_UNSPEC_FAILURE_REASON,
5681 pSessionEntry);
5682 }
5683 if ((eBA_ENABLE == pSta->tcCfg[tid].fUseBARx) &&
5684 (baDirection & BA_RECIPIENT))
5685 {
5686 limPostMlmDelBAReq(pMac, pSta, eBA_RECIPIENT, tid,
5687 eSIR_MAC_UNSPEC_FAILURE_REASON,
5688 pSessionEntry);
5689 }
Gopichand Nakkala6a36e142013-06-07 21:23:15 -07005690 }
5691 }
5692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005693 }
5694}
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07005695
5696/** -------------------------------------------------------------
5697\fn limDelAllBASessions
5698\brief Deletes all the exisitng BA sessions.
5699\param tpAniSirGlobal pMac
5700\return None
5701-------------------------------------------------------------*/
5702
5703void limDelAllBASessions(tpAniSirGlobal pMac)
5704{
5705 tANI_U32 i;
5706 tpPESession pSessionEntry;
5707
5708 for (i = 0; i < pMac->lim.maxBssId; i++)
5709 {
5710 pSessionEntry = peFindSessionBySessionId(pMac, i);
5711 if (pSessionEntry)
5712 {
5713 limDeleteBASessions(pMac, pSessionEntry, BA_BOTH_DIRECTIONS);
5714 }
5715 }
5716}
5717
5718/** -------------------------------------------------------------
5719\fn limDelAllBASessionsBtc
5720\brief Deletes all the exisitng BA receipent sessions in 2.4GHz
5721 band.
5722\param tpAniSirGlobal pMac
5723\return None
5724-------------------------------------------------------------*/
5725
5726void limDelAllBASessionsBtc(tpAniSirGlobal pMac)
5727{
5728 tANI_U32 i;
5729 tpPESession pSessionEntry;
5730
5731 for (i = 0; i < pMac->lim.maxBssId; i++)
5732 {
5733 pSessionEntry = peFindSessionBySessionId(pMac, i);
5734 if (pSessionEntry)
5735 {
5736 if (SIR_BAND_2_4_GHZ ==
5737 limGetRFBand(pSessionEntry->currentOperChannel))
5738 {
5739 limDeleteBASessions(pMac, pSessionEntry, BA_RECIPIENT);
5740 }
5741 }
5742 }
5743}
5744
Jeff Johnson295189b2012-06-20 16:38:30 -07005745/** -------------------------------------------------------------
5746\fn limProcessDelTsInd
5747\brief handles the DeleteTS indication coming from HAL or generated by PE itself in some error cases.
5748 Validates the request, sends the DelTs action frame to the Peer and sends DelTs indicatoin to HDD.
5749\param tpAniSirGlobal pMac
5750\param tSirMsgQ limMsg
5751\return None
5752-------------------------------------------------------------*/
5753void
5754limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
5755{
5756 tpDphHashNode pSta;
5757 tpDelTsParams pDelTsParam = (tpDelTsParams) (limMsg->bodyptr);
5758 tpSirDeltsReq pDelTsReq = NULL;
5759 tSirMacAddr peerMacAddr;
5760 tpSirDeltsReqInfo pDelTsReqInfo;
5761 tpLimTspecInfo pTspecInfo;
5762 tpPESession psessionEntry;
5763 tANI_U8 sessionId;
5764
5765if((psessionEntry = peFindSessionByBssid(pMac,pDelTsParam->bssId,&sessionId))== NULL)
5766 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005767 limLog(pMac, LOGE,FL("session does not exist for given BssId"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305768 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005769 return;
5770 }
5771
5772 pTspecInfo = &(pMac->lim.tspecInfo[pDelTsParam->tspecIdx]);
5773 if(pTspecInfo->inuse == false)
5774 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005775 PELOGE(limLog(pMac, LOGE, FL("tspec entry with index %d is not in use"), pDelTsParam->tspecIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07005776 goto error1;
5777 }
5778
5779 pSta = dphGetHashEntry(pMac, pTspecInfo->assocId, &psessionEntry->dph.dphHashTable);
5780 if(pSta == NULL)
5781 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005782 limLog(pMac, LOGE, FL("Could not find entry in DPH table for assocId = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005783 pTspecInfo->assocId);
5784 goto error1;
5785 }
5786
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305787 pDelTsReq = vos_mem_malloc(sizeof(tSirDeltsReq));
5788 if ( NULL == pDelTsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305790 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005791 goto error1;
5792 }
5793
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305794 vos_mem_set( (tANI_U8 *)pDelTsReq, sizeof(tSirDeltsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005795
5796 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305797 vos_mem_copy( &(pDelTsReq->req.tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005798 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305799 vos_mem_copy( &(pDelTsReq->req.tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005800
5801
5802 //validate the req
5803 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDelTsReq, peerMacAddr,psessionEntry))
5804 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005805 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005806 goto error2;
5807 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005808 PELOG1(limLog(pMac, LOG1, "Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x",
Jeff Johnson295189b2012-06-20 16:38:30 -07005809 pDelTsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
5810 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
5811
5812 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDelTsReq->req.wmeTspecPresent, &pDelTsReq->req.tsinfo, &pDelTsReq->req.tspec,
5813 psessionEntry);
5814
5815 // prepare and send an sme indication to HDD
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305816 pDelTsReqInfo = vos_mem_malloc(sizeof(tSirDeltsReqInfo));
5817 if ( NULL == pDelTsReqInfo )
Jeff Johnson295189b2012-06-20 16:38:30 -07005818 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305819 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005820 goto error3;
5821 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305822 vos_mem_set( (tANI_U8 *)pDelTsReqInfo, sizeof(tSirDeltsReqInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005823
5824 if(pSta->wmeEnabled)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305825 vos_mem_copy( &(pDelTsReqInfo->tspec), &(pTspecInfo->tspec), sizeof(tSirMacTspecIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07005826 else
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305827 vos_mem_copy( &(pDelTsReqInfo->tsinfo), &(pTspecInfo->tspec.tsinfo), sizeof(tSirMacTSInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07005828
5829 limSendSmeDeltsInd(pMac, pDelTsReqInfo, pDelTsReq->aid,psessionEntry);
5830
5831error3:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305832 vos_mem_free(pDelTsReqInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07005833error2:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305834 vos_mem_free(pDelTsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005835error1:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305836 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005837 return;
5838}
5839
5840/**
5841 * \brief Setup an A-MPDU/BA session
5842 *
5843 * \sa limPostMlmAddBAReq
5844 *
5845 * \param pMac The global tpAniSirGlobal object
5846 *
5847 * \param pStaDs DPH Hash Node object of peer STA
5848 *
5849 * \param tid TID for which a BA is being setup.
5850 * If this is set to 0xFFFF, then we retrieve
5851 * the default TID from the CFG
5852 *
5853 * \return eSIR_SUCCESS if setup completes successfully
5854 * eSIR_FAILURE is some problem is encountered
5855 */
5856tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac,
5857 tpDphHashNode pStaDs,
5858 tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry)
5859{
5860 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005861 tpLimMlmAddBAReq pMlmAddBAReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005862 tpDialogueToken dialogueTokenNode;
5863 tANI_U32 val = 0;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005864
Jeff Johnson295189b2012-06-20 16:38:30 -07005865 // Check if the peer is a 11n capable STA
5866 // FIXME - Need a 11n peer indication in DPH.
5867 // For now, using the taurusPeer attribute
5868 //if( 0 == pStaDs->taurusPeer == )
5869 //return eSIR_SUCCESS;
5870
5871 // Allocate for LIM_MLM_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305872 pMlmAddBAReq = vos_mem_malloc(sizeof( tLimMlmAddBAReq ));
5873 if ( NULL == pMlmAddBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07005874 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305875 limLog( pMac, LOGP, FL("AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 status = eSIR_MEM_ALLOC_FAILED;
5877 goto returnFailure;
5878 }
5879
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305880 vos_mem_set( (void *) pMlmAddBAReq, sizeof( tLimMlmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005881
5882 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305883 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07005884 pMlmAddBAReq->peerMacAddr,
5885 pStaDs->staAddr,
5886 sizeof( tSirMacAddr ));
5887
5888 // Update the TID
5889 pMlmAddBAReq->baTID = tid;
5890
5891 // Determine the supported BA policy of local STA
5892 // for the TID of interest
5893 pMlmAddBAReq->baPolicy = (pStaDs->baPolicyFlag >> tid) & 0x1;
5894
5895 // BA Buffer Size
5896 // Requesting the ADDBA recipient to populate the size.
5897 // If ADDBA is accepted, a non-zero buffer size should
5898 // be returned in the ADDBA Rsp
5899 pMlmAddBAReq->baBufferSize = 0;
5900
5901 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005902 FL( "Requesting an ADDBA to setup a %s BA session with STA %d for TID %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005903 (pMlmAddBAReq->baPolicy ? "Immediate": "Delayed"),
5904 pStaDs->staIndex,
5905 tid );
5906
5907 // BA Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005908 if (wlan_cfgGetInt(pMac, WNI_CFG_BA_TIMEOUT, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07005909 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005910 limLog(pMac, LOGE, FL("could not retrieve BA TIME OUT Param CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005911 status = eSIR_FAILURE;
5912 goto returnFailure;
5913 }
5914 pMlmAddBAReq->baTimeout = val; // In TU's
5915
5916 // ADDBA Failure Timeout
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005917 // FIXME_AMPDU - Need to retrieve this from CFG.
Jeff Johnson295189b2012-06-20 16:38:30 -07005918 //right now we are not checking for response timeout. so this field is dummy just to be compliant with the spec.
5919 pMlmAddBAReq->addBAFailureTimeout = 2000; // In TU's
5920
5921 // BA Starting Sequence Number
5922 pMlmAddBAReq->baSSN = startingSeqNum;
5923
5924 /* Update PE session Id*/
5925 pMlmAddBAReq->sessionId = psessionEntry->peSessionId;
5926
5927 LIM_SET_STA_BA_STATE(pStaDs, tid, eLIM_BA_STATE_WT_ADD_RSP);
5928
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005929 dialogueTokenNode = limAssignDialogueToken(pMac);
5930 if (NULL == dialogueTokenNode)
5931 {
5932 limLog(pMac, LOGE, FL("could not assign dialogue token"));
5933 status = eSIR_FAILURE;
5934 goto returnFailure;
5935 }
5936
Jeff Johnson295189b2012-06-20 16:38:30 -07005937 pMlmAddBAReq->baDialogToken = dialogueTokenNode->token;
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005938 //set assocId and tid information in the lim linked list
Jeff Johnson295189b2012-06-20 16:38:30 -07005939 dialogueTokenNode->assocId = pStaDs->assocId;
5940 dialogueTokenNode->tid = tid;
5941 // Send ADDBA Req to MLME
5942 limPostMlmMessage( pMac,
5943 LIM_MLM_ADDBA_REQ,
5944 (tANI_U32 *) pMlmAddBAReq );
Jeff Johnson09fb4cd2013-04-03 15:27:59 -07005945 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005946
5947returnFailure:
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305948 vos_mem_free(pMlmAddBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07005949 return status;
5950}
5951
5952/**
5953 * \brief Post LIM_MLM_ADDBA_RSP to MLME. MLME
5954 * will then send an ADDBA Rsp to peer MAC entity
5955 * with the appropriate ADDBA status code
5956 *
5957 * \sa limPostMlmAddBARsp
5958 *
5959 * \param pMac The global tpAniSirGlobal object
5960 *
5961 * \param peerMacAddr MAC address of peer entity that will
5962 * be the recipient of this ADDBA Rsp
5963 *
5964 * \param baStatusCode ADDBA Rsp status code
5965 *
5966 * \param baDialogToken ADDBA Rsp dialog token
5967 *
5968 * \param baTID TID of interest
5969 *
5970 * \param baPolicy The BA policy
5971 *
5972 * \param baBufferSize The BA buffer size
5973 *
5974 * \param baTimeout BA timeout in TU's
5975 *
5976 * \return eSIR_SUCCESS if setup completes successfully
5977 * eSIR_FAILURE is some problem is encountered
5978 */
5979tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac,
5980 tSirMacAddr peerMacAddr,
5981 tSirMacStatusCodes baStatusCode,
5982 tANI_U8 baDialogToken,
5983 tANI_U8 baTID,
5984 tANI_U8 baPolicy,
5985 tANI_U16 baBufferSize,
5986 tANI_U16 baTimeout,
5987 tpPESession psessionEntry)
5988{
5989tSirRetStatus status = eSIR_SUCCESS;
5990tpLimMlmAddBARsp pMlmAddBARsp;
5991
5992 // Allocate for LIM_MLM_ADDBA_RSP
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305993 pMlmAddBARsp = vos_mem_malloc(sizeof( tLimMlmAddBARsp ));
5994 if ( NULL == pMlmAddBARsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 {
5996 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05305997 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005998 status );
5999
6000 status = eSIR_MEM_ALLOC_FAILED;
6001 goto returnFailure;
6002 }
6003
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306004 vos_mem_set( (void *) pMlmAddBARsp, sizeof( tLimMlmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006005
6006 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306007 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006008 pMlmAddBARsp->peerMacAddr,
6009 peerMacAddr,
6010 sizeof( tSirMacAddr ));
6011
6012 pMlmAddBARsp->baDialogToken = baDialogToken;
6013 pMlmAddBARsp->addBAResultCode = baStatusCode;
6014 pMlmAddBARsp->baTID = baTID;
6015 pMlmAddBARsp->baPolicy = baPolicy;
6016 pMlmAddBARsp->baBufferSize = baBufferSize;
6017 pMlmAddBARsp->baTimeout = baTimeout;
6018
6019 /* UPdate PE session ID*/
6020 pMlmAddBARsp->sessionId = psessionEntry->peSessionId;
6021
6022 // Send ADDBA Rsp to MLME
6023 limPostMlmMessage( pMac,
6024 LIM_MLM_ADDBA_RSP,
6025 (tANI_U32 *) pMlmAddBARsp );
6026
6027returnFailure:
6028
6029 return status;
6030}
6031
6032/**
6033 * \brief Post LIM_MLM_DELBA_REQ to MLME. MLME
6034 * will then send an DELBA Ind to peer MAC entity
6035 * with the appropriate DELBA status code
6036 *
6037 * \sa limPostMlmDelBAReq
6038 *
6039 * \param pMac The global tpAniSirGlobal object
6040 *
6041 * \param pSta DPH Hash Node object of peer MAC entity
6042 * for which the BA session is being deleted
6043 *
6044 * \param baDirection DELBA direction
6045 *
6046 * \param baTID TID for which the BA session is being deleted
6047 *
6048 * \param baReasonCode DELBA Req reason code
6049 *
6050 * \return eSIR_SUCCESS if setup completes successfully
6051 * eSIR_FAILURE is some problem is encountered
6052 */
6053tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac,
6054 tpDphHashNode pSta,
6055 tANI_U8 baDirection,
6056 tANI_U8 baTID,
6057 tSirMacReasonCodes baReasonCode,
6058 tpPESession psessionEntry)
6059{
6060tSirRetStatus status = eSIR_SUCCESS;
6061tpLimMlmDelBAReq pMlmDelBAReq;
6062tLimBAState curBaState;
6063
6064if(NULL == pSta)
6065 return eSIR_FAILURE;
6066
6067LIM_GET_STA_BA_STATE(pSta, baTID, &curBaState);
6068
6069 // Need to validate the current BA State.
6070 if( eLIM_BA_STATE_IDLE != curBaState)
6071 {
6072 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006073 FL( "Received unexpected DELBA REQ when STA BA state for tid = %d is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006074 baTID,
6075 curBaState);
6076
6077 status = eSIR_FAILURE;
6078 goto returnFailure;
6079 }
6080
6081 // Allocate for LIM_MLM_DELBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306082 pMlmDelBAReq = vos_mem_malloc(sizeof( tLimMlmDelBAReq ));
6083 if ( NULL == pMlmDelBAReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07006084 {
6085 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306086 FL("AllocateMemory failed with error code %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006087 status );
6088
6089 status = eSIR_MEM_ALLOC_FAILED;
6090 goto returnFailure;
6091 }
6092
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306093 vos_mem_set( (void *) pMlmDelBAReq, sizeof( tLimMlmDelBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006094
6095 // Copy the peer MAC
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306096 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 pMlmDelBAReq->peerMacAddr,
6098 pSta->staAddr,
6099 sizeof( tSirMacAddr ));
6100
6101 pMlmDelBAReq->baDirection = baDirection;
6102 pMlmDelBAReq->baTID = baTID;
6103 pMlmDelBAReq->delBAReasonCode = baReasonCode;
6104
6105 /* Update PE session ID*/
6106 pMlmDelBAReq->sessionId = psessionEntry->peSessionId;
6107
6108 //we don't have valid BA session for the given direction.
6109 // HDD wants to get the BA session deleted on PEER in this case.
6110 // in this case we just need to send DelBA to the peer.
6111 if(((eBA_RECIPIENT == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBARx)) ||
6112 ((eBA_INITIATOR == baDirection) && (eBA_DISABLE == pSta->tcCfg[baTID].fUseBATx)))
6113 {
6114 // Send DELBA Ind over the air
6115 if( eSIR_SUCCESS !=
6116 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
6117 status = eSIR_FAILURE;
6118
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306119 vos_mem_free(pMlmDelBAReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07006120 return status;
6121 }
6122
6123
6124 // Update the BA state in STA
6125 LIM_SET_STA_BA_STATE(pSta, pMlmDelBAReq->baTID, eLIM_BA_STATE_WT_DEL_RSP);
6126
6127 // Send DELBA Req to MLME
6128 limPostMlmMessage( pMac,
6129 LIM_MLM_DELBA_REQ,
6130 (tANI_U32 *) pMlmDelBAReq );
6131
6132returnFailure:
6133
6134 return status;
6135}
6136
6137/**
6138 * \brief Send WDA_ADDBA_REQ to HAL, in order
6139 * to setup a new BA session with a peer
6140 *
6141 * \sa limPostMsgAddBAReq
6142 *
6143 * \param pMac The global tpAniSirGlobal object
6144 *
6145 * \param pSta Runtime, STA-related configuration cached
6146 * in the HashNode object
6147 *
6148 * \param baDialogToken The Action Frame dialog token
6149 *
6150 * \param baTID TID for which the BA session is being setup
6151 *
6152 * \param baPolicy BA Policy
6153 *
6154 * \param baBufferSize The requested BA buffer size
6155 *
6156 * \param baTimeout BA Timeout. 0 indicates no BA timeout enforced
6157 *
6158 * \param baSSN Starting Sequence Number for this BA session
6159 *
6160 * \param baDirection BA Direction: 1 - Initiator, 0 - Recipient
6161 *
6162 * \return none
6163 *
6164 */
6165tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac,
6166 tpDphHashNode pSta,
6167 tANI_U8 baDialogToken,
6168 tANI_U8 baTID,
6169 tANI_U8 baPolicy,
6170 tANI_U16 baBufferSize,
6171 tANI_U16 baTimeout,
6172 tANI_U16 baSSN,
6173 tANI_U8 baDirection,
6174 tpPESession psessionEntry)
6175{
6176tpAddBAParams pAddBAParams = NULL;
6177tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006178tSirMsgQ msgQ;
6179
6180#ifdef WLAN_SOFTAP_VSTA_FEATURE
6181 // we can only do BA on "hard" STAs
6182 if (!(IS_HWSTA_IDX(pSta->staIndex)))
6183 {
6184 retCode = eHAL_STATUS_FAILURE;
6185 goto returnFailure;
6186 }
6187#endif //WLAN_SOFTAP_VSTA_FEATURE
6188
6189 // Allocate for WDA_ADDBA_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306190 pAddBAParams = vos_mem_malloc(sizeof( tAddBAParams ));
6191 if ( NULL == pAddBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006192 {
6193 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306194 FL("AllocateMemory failed")
6195 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006196
6197 retCode = eSIR_MEM_ALLOC_FAILED;
6198 goto returnFailure;
6199 }
6200
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306201 vos_mem_set( (void *) pAddBAParams, sizeof( tAddBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006202
6203 // Copy the peer MAC address
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306204 vos_mem_copy(
Jeff Johnson295189b2012-06-20 16:38:30 -07006205 (void *) pAddBAParams->peerMacAddr,
6206 (void *) pSta->staAddr,
6207 sizeof( tSirMacAddr ));
6208
6209 // Populate the REQ parameters
6210 pAddBAParams->staIdx = pSta->staIndex;
6211 pAddBAParams->baDialogToken = baDialogToken;
6212 pAddBAParams->baTID = baTID;
6213 pAddBAParams->baPolicy = baPolicy;
6214 pAddBAParams->baBufferSize = baBufferSize;
6215 pAddBAParams->baTimeout = baTimeout;
6216 pAddBAParams->baSSN = baSSN;
6217 pAddBAParams->baDirection = baDirection;
6218 pAddBAParams->respReqd = 1;
6219
6220 /* UPdate PE session ID */
6221 pAddBAParams->sessionId = psessionEntry->peSessionId;
6222
6223 // Post WDA_ADDBA_REQ to HAL.
6224 msgQ.type = WDA_ADDBA_REQ;
6225 //
6226 // FIXME_AMPDU
6227 // A global counter (dialog token) is required to keep track of
6228 // all PE <-> HAL communication(s)
6229 //
6230 msgQ.reserved = 0;
6231 msgQ.bodyptr = pAddBAParams;
6232 msgQ.bodyval = 0;
6233
6234 limLog( pMac, LOGW,
6235 FL( "Sending WDA_ADDBA_REQ..." ));
6236
6237 //defer any other message until we get response back.
6238 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
6239
Jeff Johnsone7245742012-09-05 17:12:55 -07006240 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006241#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6242 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, psessionEntry, 0, 0);
6243#endif //FEATURE_WLAN_DIAG_SUPPORT
6244
6245 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6246 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006247 FL("Posting WDA_ADDBA_REQ to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006248 retCode );
6249 else
6250 return retCode;
6251
6252returnFailure:
6253
6254 // Clean-up...
6255 if( NULL != pAddBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306256 vos_mem_free( pAddBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006257
6258 return retCode;
6259
6260}
6261
6262/**
6263 * \brief Send WDA_DELBA_IND to HAL, in order
6264 * to delete an existing BA session with peer
6265 *
6266 * \sa limPostMsgDelBAInd
6267 *
6268 * \param pMac The global tpAniSirGlobal object
6269 *
6270 * \param pSta Runtime, STA-related configuration cached
6271 * in the HashNode object
6272 *
6273 * \param baTID TID for which the BA session is being setup
6274 *
6275 * \param baDirection Identifies whether the DELBA Ind was
6276 * sent by the BA initiator or recipient
6277 *
6278 * \return none
6279 *
6280 */
6281tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac,
6282 tpDphHashNode pSta,
6283 tANI_U8 baTID,
6284 tANI_U8 baDirection,
6285 tpPESession psessionEntry)
6286{
6287tpDelBAParams pDelBAParams = NULL;
6288tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006289tSirMsgQ msgQ;
6290
6291 // Allocate for SIR_HAL_DELBA_IND
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306292 pDelBAParams = vos_mem_malloc(sizeof( tDelBAParams ));
6293 if ( NULL == pDelBAParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 {
6295 limLog( pMac, LOGE,
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306296 FL("AllocateMemory failed")
6297 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006298
6299 retCode = eSIR_MEM_ALLOC_FAILED;
6300 goto returnFailure;
6301 }
6302
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306303 vos_mem_set( (void *) pDelBAParams, sizeof( tDelBAParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006304
6305 // Populate the REQ parameters
6306 pDelBAParams->staIdx = pSta->staIndex;
6307 pDelBAParams->baTID = baTID;
6308 pDelBAParams->baDirection = baDirection;
6309
6310 /* Update PE session ID */
6311
6312
6313 //TBD-RAJESH Updating of the session ID is requird for SIR_HAL_DELBA_IND?????
6314 //pDelBAParams->sessionId = psessionEntry->peSessionId;
6315
6316 // Post WDA_DELBA_IND to HAL.
6317 msgQ.type = WDA_DELBA_IND;
6318 //
6319 // FIXME:
6320 // A global counter (dialog token) is required to keep track of
6321 // all PE <-> HAL communication(s)
6322 //
6323 msgQ.reserved = 0;
6324 msgQ.bodyptr = pDelBAParams;
6325 msgQ.bodyval = 0;
6326
6327 limLog( pMac, LOGW,
6328 FL( "Sending SIR_HAL_DELBA_IND..." ));
6329
Jeff Johnsone7245742012-09-05 17:12:55 -07006330 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006331#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
6332 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, psessionEntry, 0, 0);
6333#endif //FEATURE_WLAN_DIAG_SUPPORT
6334
6335 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
6336 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006337 FL("Posting WDA_DELBA_IND to HAL failed! Reason = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006338 retCode );
6339 else
6340 {
6341 // Update LIM's internal cache...
6342 if( eBA_INITIATOR == baDirection)
6343 {
6344 pSta->tcCfg[baTID].fUseBATx = 0;
6345 pSta->tcCfg[baTID].txBufSize = 0;
6346 }
6347 else
6348 {
6349 pSta->tcCfg[baTID].fUseBARx = 0;
6350 pSta->tcCfg[baTID].rxBufSize = 0;
6351 }
6352
6353 return retCode;
6354 }
6355
6356returnFailure:
6357
6358 // Clean-up...
6359 if( NULL != pDelBAParams )
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306360 vos_mem_free( pDelBAParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07006361
6362 return retCode;
6363
6364}
6365
6366/**
6367 * @function : limPostSMStateUpdate()
6368 *
6369 * @brief : This function Updates the HAL and Softmac about the change in the STA's SMPS state.
6370 *
6371 * LOGIC:
6372 *
6373 * ASSUMPTIONS:
6374 * NA
6375 *
6376 * NOTE:
6377 * NA
6378 *
6379 * @param pMac - Pointer to Global MAC structure
6380 * @param limMsg - Lim Message structure object with the MimoPSparam in body
6381 * @return None
6382 */
6383tSirRetStatus
6384limPostSMStateUpdate(tpAniSirGlobal pMac,
6385 tANI_U16 staIdx, tSirMacHTMIMOPowerSaveState state)
6386{
6387 tSirRetStatus retCode = eSIR_SUCCESS;
6388 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07006389 tpSetMIMOPS pMIMO_PSParams;
6390
6391 msgQ.reserved = 0;
6392 msgQ.type = WDA_SET_MIMOPS_REQ;
6393
6394 // Allocate for WDA_SET_MIMOPS_REQ
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306395 pMIMO_PSParams = vos_mem_malloc(sizeof(tSetMIMOPS));
6396 if ( NULL == pMIMO_PSParams )
6397 {
6398 limLog( pMac, LOGP,FL(" AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006399 return eSIR_MEM_ALLOC_FAILED;
6400 }
6401
6402 pMIMO_PSParams->htMIMOPSState = state;
6403 pMIMO_PSParams->staIdx = staIdx;
6404 pMIMO_PSParams->fsendRsp = true;
6405 msgQ.bodyptr = pMIMO_PSParams;
6406 msgQ.bodyval = 0;
6407
6408 limLog( pMac, LOG2, FL( "Sending WDA_SET_MIMOPS_REQ..." ));
6409
Jeff Johnsone7245742012-09-05 17:12:55 -07006410 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006411 retCode = wdaPostCtrlMsg( pMac, &msgQ );
6412 if (eSIR_SUCCESS != retCode)
6413 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006414 limLog( pMac, LOGP, FL("Posting WDA_SET_MIMOPS_REQ to HAL failed! Reason = %d"), retCode );
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306415 vos_mem_free(pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07006416 return retCode;
6417 }
6418
6419 return retCode;
6420}
6421
6422void limPktFree (
6423 tpAniSirGlobal pMac,
6424 eFrameType frmType,
6425 tANI_U8 *pRxPacketInfo,
6426 void *pBody)
6427{
6428 (void) pMac; (void) frmType; (void) pRxPacketInfo; (void) pBody;
Jeff Johnson295189b2012-06-20 16:38:30 -07006429}
6430
6431/**
6432 * limGetBDfromRxPacket()
6433 *
6434 *FUNCTION:
6435 * This function is called to get pointer to Polaris
6436 * Buffer Descriptor containing MAC header & other control
6437 * info from the body of the message posted to LIM.
6438 *
6439 *LOGIC:
6440 * NA
6441 *
6442 *ASSUMPTIONS:
6443 * NA
6444 *
6445 *NOTE:
6446 * NA
6447 *
6448 * @param body - Received message body
6449 * @param pRxPacketInfo - Pointer to received BD
6450 * @return None
6451 */
6452
6453void
6454limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pRxPacketInfo)
6455{
Jeff Johnson295189b2012-06-20 16:38:30 -07006456 *pRxPacketInfo = (tANI_U32 *) body;
Jeff Johnson295189b2012-06-20 16:38:30 -07006457} /*** end limGetBDfromRxPacket() ***/
6458
6459
6460
6461
6462
6463void limRessetScanChannelInfo(tpAniSirGlobal pMac)
6464{
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306465 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006466}
6467
6468
6469void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId)
6470{
6471 tANI_U8 i;
6472 tANI_BOOLEAN fFound = eANI_BOOLEAN_FALSE;
6473
6474 for(i = 0; i < pMac->lim.scanChnInfo.numChnInfo; i++)
6475 {
6476 if(pMac->lim.scanChnInfo.scanChn[i].channelId == channelId)
6477 {
6478 pMac->lim.scanChnInfo.scanChn[i].numTimeScan++;
6479 fFound = eANI_BOOLEAN_TRUE;
6480 break;
6481 }
6482 }
6483 if(eANI_BOOLEAN_FALSE == fFound)
6484 {
6485 if(pMac->lim.scanChnInfo.numChnInfo < SIR_MAX_SUPPORTED_CHANNEL_LIST)
6486 {
6487 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo].channelId = channelId;
6488 pMac->lim.scanChnInfo.scanChn[pMac->lim.scanChnInfo.numChnInfo++].numTimeScan = 1;
6489 }
6490 else
6491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006492 PELOGW(limLog(pMac, LOGW, FL(" -- number of channels exceed mac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006493 }
6494 }
6495}
6496
6497
6498/**
6499 * @function : limIsChannelValidForChannelSwitch()
6500 *
6501 * @brief : This function checks if the channel to which AP
6502 * is expecting us to switch, is a valid channel for us.
6503 * LOGIC:
6504 *
6505 * ASSUMPTIONS:
6506 * NA
6507 *
6508 * NOTE:
6509 * NA
6510 *
6511 * @param pMac - Pointer to Global MAC structure
6512 * @param channel - New channel to which we are expected to move
6513 * @return None
6514 */
6515tAniBool
6516limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel)
6517{
6518 tANI_U8 index;
6519 tANI_U32 validChannelListLen = WNI_CFG_VALID_CHANNEL_LIST_LEN;
6520 tSirMacChanNum validChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
6521
6522 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
6523 (tANI_U8 *)validChannelList,
6524 (tANI_U32 *)&validChannelListLen) != eSIR_SUCCESS)
6525 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006526 PELOGE(limLog(pMac, LOGE, FL("could not retrieve valid channel list"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006527 return (eSIR_FALSE);
6528 }
6529
6530 for(index = 0; index < validChannelListLen; index++)
6531 {
6532 if(validChannelList[index] == channel)
6533 return (eSIR_TRUE);
6534 }
6535
6536 /* channel does not belong to list of valid channels */
6537 return (eSIR_FALSE);
6538}
6539
6540/**------------------------------------------------------
6541\fn __limFillTxControlParams
6542\brief Fill the message for stopping/resuming tx.
6543
6544\param pMac
6545\param pTxCtrlMsg - Pointer to tx control message.
6546\param type - Which way we want to stop/ resume tx.
6547\param mode - To stop/resume.
6548 -------------------------------------------------------*/
6549static eHalStatus
6550__limFillTxControlParams(tpAniSirGlobal pMac, tpTxControlParams pTxCtrlMsg,
6551 tLimQuietTxMode type, tLimControlTx mode)
6552{
6553
6554 //TBD-RAJESH HOW TO GET sessionEntry?????
6555 tpPESession psessionEntry = &pMac->lim.gpSession[0];
6556
6557 if (mode == eLIM_STOP_TX)
6558 pTxCtrlMsg->stopTx = eANI_BOOLEAN_TRUE;
6559 else
6560 pTxCtrlMsg->stopTx = eANI_BOOLEAN_FALSE;
6561
6562 switch (type)
6563 {
6564 case eLIM_TX_ALL:
6565 /** Stops/resumes transmission completely */
6566 pTxCtrlMsg->fCtrlGlobal = 1;
6567 break;
6568
6569 case eLIM_TX_BSS_BUT_BEACON:
6570 /** Stops/resumes transmission on a particular BSS. Stopping BSS, doesnt
6571 * stop beacon transmission.
6572 */
6573 pTxCtrlMsg->ctrlBss = 1;
6574 pTxCtrlMsg->bssBitmap |= (1 << psessionEntry->bssIdx);
6575 break;
6576
6577 case eLIM_TX_STA:
6578 /** Memory for station bitmap is allocated dynamically in caller of this
6579 * so decode properly here and fill the bitmap. Now not implemented,
6580 * fall through.
6581 */
6582 case eLIM_TX_BSS:
6583 //Fall thru...
6584 default:
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006585 PELOGW(limLog(pMac, LOGW, FL("Invalid case: Not Handled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006586 return eHAL_STATUS_FAILURE;
6587 }
6588
6589 return eHAL_STATUS_SUCCESS;
6590}
6591
6592/**
6593 * @function : limFrameTransmissionControl()
6594 *
6595 * @brief : This API is called by the user to halt/resume any frame
6596 * transmission from the device. If stopped, all frames will be
6597 * queued starting from hardware. Then back-pressure
6598 * is built till the driver.
6599 * LOGIC:
6600 *
6601 * ASSUMPTIONS:
6602 * NA
6603 *
6604 * NOTE:
6605 * NA
6606 *
6607 * @param pMac - Pointer to Global MAC structure
6608 * @return None
6609 */
6610void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode)
6611{
6612
6613 eHalStatus status = eHAL_STATUS_FAILURE;
6614 tpTxControlParams pTxCtrlMsg;
6615 tSirMsgQ msgQ;
6616 tANI_U8 nBytes = 0; // No of bytes required for station bitmap.
6617
6618 /** Allocate only required number of bytes for station bitmap
6619 * Make it to align to 4 byte boundary */
6620 nBytes = (tANI_U8)HALMSG_NUMBYTES_STATION_BITMAP(pMac->lim.maxStation);
6621
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306622 pTxCtrlMsg = vos_mem_malloc(sizeof(*pTxCtrlMsg) + nBytes);
6623 if ( NULL == pTxCtrlMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006624 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306625 limLog(pMac, LOGP, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006626 return;
6627 }
6628
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306629 vos_mem_set((void *) pTxCtrlMsg,
6630 (sizeof(*pTxCtrlMsg) + nBytes), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 status = __limFillTxControlParams(pMac, pTxCtrlMsg, type, mode);
6632 if (status != eHAL_STATUS_SUCCESS)
6633 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306634 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006635 limLog(pMac, LOGP, FL("__limFillTxControlParams failed, status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 return;
6637 }
6638
6639 msgQ.bodyptr = (void *) pTxCtrlMsg;
6640 msgQ.bodyval = 0;
6641 msgQ.reserved = 0;
6642 msgQ.type = WDA_TRANSMISSION_CONTROL_IND;
6643
Jeff Johnsone7245742012-09-05 17:12:55 -07006644 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07006645 if(wdaPostCtrlMsg( pMac, &msgQ) != eSIR_SUCCESS)
6646 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05306647 vos_mem_free(pTxCtrlMsg);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006648 limLog( pMac, LOGP, FL("Posting Message to HAL failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 return;
6650 }
6651
6652 if (mode == eLIM_STOP_TX)
6653 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006654 PELOG1(limLog(pMac, LOG1, FL("Stopping the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 }
6656 else
6657 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006658 PELOG1(limLog(pMac, LOG1, FL("Resuming the transmission of all packets, indicated softmac"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006659 }
6660 return;
6661}
6662
6663
6664/**
6665 * @function : limRestorePreChannelSwitchState()
6666 *
6667 * @brief : This API is called by the user to undo any
6668 * specific changes done on the device during
6669 * channel switch.
6670 * LOGIC:
6671 *
6672 * ASSUMPTIONS:
6673 * NA
6674 *
6675 * NOTE:
6676 * NA
6677 *
6678 * @param pMac - Pointer to Global MAC structure
6679 * @return None
6680 */
6681
6682tSirRetStatus
6683limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry)
6684{
6685
6686 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006687 tANI_U32 val = 0;
6688
6689 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6690 return retCode;
6691
6692 /* Channel switch should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006693 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006694
6695 /* Restore the frame transmission, all the time. */
6696 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6697
6698 /* Free to enter BMPS */
6699 limSendSmePostChannelSwitchInd(pMac);
6700
6701 //Background scan is now enabled by SME
6702 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6703 {
6704 /* Enable background scan if already enabled, else don't bother */
6705 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6706 &val)) != eSIR_SUCCESS)
6707
6708 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006709 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006710 return (retCode);
6711 }
6712
6713 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6714 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006715 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6716 psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006717 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6718 {
6719 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6720 return (eSIR_FAILURE);
6721 }
6722
6723 }
6724 }
6725
6726 /* Enable heartbeat timer */
6727 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6728 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006729 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE,
6730 psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
6731 if((limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS) &&
6732 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07006733 {
6734 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6735 return (eSIR_FAILURE);
6736 }
6737 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006738 return (retCode);
6739}
6740
6741
6742/**--------------------------------------------
6743\fn limRestorePreQuietState
6744\brief Restore the pre quiet state
6745
6746\param pMac
6747\return NONE
6748---------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006749tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07006750{
6751
6752 tSirRetStatus retCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 tANI_U32 val = 0;
6754
6755 if (pMac->lim.gLimSystemRole != eLIM_STA_ROLE)
6756 return retCode;
6757
6758 /* Quiet should be ready for the next time */
Jeff Johnsone7245742012-09-05 17:12:55 -07006759 psessionEntry->gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
Jeff Johnson295189b2012-06-20 16:38:30 -07006760
6761 /* Restore the frame transmission, all the time. */
Jeff Johnsone7245742012-09-05 17:12:55 -07006762 if (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
6764
6765
6766 //Background scan is now enabled by SME
6767 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
6768 {
6769 /* Enable background scan if already enabled, else don't bother */
6770 if ((retCode = wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
6771 &val)) != eSIR_SUCCESS)
6772
6773 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006774 limLog(pMac, LOGP, FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006775 return (retCode);
6776 }
6777
6778 if (val > 0 && TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
6779 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006780 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07006781 if(tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
6782 {
6783 limLog(pMac, LOGP, FL("Could not restart background scan timer, doing LOGP"));
6784 return (eSIR_FAILURE);
6785 }
6786
6787 }
6788 }
6789
6790 /* Enable heartbeat timer */
6791 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimHeartBeatTimer))
6792 {
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08006793 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07006794 if(limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07006795 {
6796 limLog(pMac, LOGP, FL("Could not restart heartbeat timer, doing LOGP"));
6797 return (eSIR_FAILURE);
6798 }
6799 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006800 return (retCode);
6801}
6802
6803
6804/**
6805 * @function: limPrepareFor11hChannelSwitch()
6806 *
6807 * @brief : This API is called by the user to prepare for
6808 * 11h channel switch. As of now, the API does
6809 * very minimal work. User can add more into the
6810 * same API if needed.
6811 * LOGIC:
6812 *
6813 * ASSUMPTIONS:
6814 * NA
6815 *
6816 * NOTE:
6817 * NA
6818 *
6819 * @param pMac - Pointer to Global MAC structure
6820 * @param psessionEntry
6821 * @return None
6822 */
6823void
6824limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry)
6825{
Jeff Johnson295189b2012-06-20 16:38:30 -07006826 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
6827 return;
6828
6829 /* Flag to indicate 11h channel switch in progress */
Jeff Johnsone7245742012-09-05 17:12:55 -07006830 psessionEntry->gLimSpecMgmt.dot11hChanSwState = eLIM_11H_CHANSW_RUNNING;
Jeff Johnson295189b2012-06-20 16:38:30 -07006831
6832 /* Disable, Stop background scan if enabled and running */
6833 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
6834
6835 /* Stop heart-beat timer to stop heartbeat disassociation */
6836 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
6837
6838 if(pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE ||
6839 pMac->lim.gLimSmeState == eLIM_SME_CHANNEL_SCAN_STATE)
6840 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006841 PELOGE(limLog(pMac, LOGE, FL("Posting finish scan as we are in scan state"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006842 /* Stop ongoing scanning if any */
6843 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
6844 {
6845 //Set the resume channel to Any valid channel (invalid).
6846 //This will instruct HAL to set it to any previous valid channel.
6847 peSetResumeChannel(pMac, 0, 0);
6848 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
6849 }
6850 else
6851 {
6852 limRestorePreChannelSwitchState(pMac, psessionEntry);
6853 }
6854 return;
6855 }
6856 else
6857 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006858 PELOGE(limLog(pMac, LOGE, FL("Not in scan state, start channel switch timer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006859 /** We are safe to switch channel at this point */
6860 limStopTxAndSwitchChannel(pMac, psessionEntry->peSessionId);
6861 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006862}
6863
6864
6865
6866/**----------------------------------------------------
6867\fn limGetNwType
6868
6869\brief Get type of the network from data packet or beacon
6870\param pMac
6871\param channelNum - Channel number
6872\param type - Type of packet.
6873\param pBeacon - Pointer to beacon or probe response
6874
6875\return Network type a/b/g.
6876-----------------------------------------------------*/
6877tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon)
6878{
6879 tSirNwType nwType = eSIR_11B_NW_TYPE;
6880
6881 if (type == SIR_MAC_DATA_FRAME)
6882 {
6883 if ((channelNum > 0) && (channelNum < 15))
6884 {
6885 nwType = eSIR_11G_NW_TYPE;
6886 }
6887 else
6888 {
6889 nwType = eSIR_11A_NW_TYPE;
6890 }
6891 }
6892 else
6893 {
6894 if ((channelNum > 0) && (channelNum < 15))
6895 {
6896 int i;
6897 // 11b or 11g packet
6898 // 11g iff extended Rate IE is present or
6899 // if there is an A rate in suppRate IE
6900 for (i = 0; i < pBeacon->supportedRates.numRates; i++)
6901 {
6902 if (sirIsArate(pBeacon->supportedRates.rate[i] & 0x7f))
6903 {
6904 nwType = eSIR_11G_NW_TYPE;
6905 break;
6906 }
6907 }
6908 if (pBeacon->extendedRatesPresent)
6909 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006910 PELOG3(limLog(pMac, LOG3, FL("Beacon, nwtype=G"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 nwType = eSIR_11G_NW_TYPE;
6912 }
6913 }
6914 else
6915 {
6916 // 11a packet
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006917 PELOG3(limLog(pMac, LOG3,FL("Beacon, nwtype=A"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07006918 nwType = eSIR_11A_NW_TYPE;
6919 }
6920 }
6921 return nwType;
6922}
6923
6924
6925/**---------------------------------------------------------
6926\fn limGetChannelFromBeacon
6927\brief To extract channel number from beacon
6928
6929\param pMac
6930\param pBeacon - Pointer to beacon or probe rsp
6931\return channel number
6932-----------------------------------------------------------*/
6933tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon)
6934{
6935 tANI_U8 channelNum = 0;
6936
6937 if (pBeacon->dsParamsPresent)
6938 channelNum = pBeacon->channelNumber;
6939 else if(pBeacon->HTInfo.present)
6940 channelNum = pBeacon->HTInfo.primaryChannel;
6941 else
6942 channelNum = pBeacon->channelNumber;
6943
6944 return channelNum;
6945}
6946
6947
6948/** ---------------------------------------------------------
6949\fn limSetTspecUapsdMask
6950\brief This function sets the PE global variable:
6951\ 1) gUapsdPerAcTriggerEnableMask and
6952\ 2) gUapsdPerAcDeliveryEnableMask
6953\ based on the user priority field and direction field
6954\ in the TS Info Fields.
6955\
6956\ An AC is a trigger-enabled AC if the PSB subfield
6957\ is set to 1 in the uplink direction.
6958\ An AC is a delivery-enabled AC if the PSB subfield
6959\ is set to 1 in the down-link direction.
6960\
6961\param tpAniSirGlobal pMac
6962\param tSirMacTSInfo pTsInfo
6963\param tANI_U32 action
6964\return None
6965 ------------------------------------------------------------*/
6966void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action)
6967{
6968 tANI_U8 userPrio = (tANI_U8)pTsInfo->traffic.userPrio;
6969 tANI_U16 direction = pTsInfo->traffic.direction;
6970 tANI_U8 ac = upToAc(userPrio);
6971
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006972 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 -07006973
6974 /* Converting AC to appropriate Uapsd Bit Mask
6975 * AC_BE(0) --> UAPSD_BITOFFSET_ACVO(3)
6976 * AC_BK(1) --> UAPSD_BITOFFSET_ACVO(2)
6977 * AC_VI(2) --> UAPSD_BITOFFSET_ACVO(1)
6978 * AC_VO(3) --> UAPSD_BITOFFSET_ACVO(0)
6979 */
6980 ac = ((~ac) & 0x3);
6981
6982 if (action == CLEAR_UAPSD_MASK)
6983 {
6984 if (direction == SIR_MAC_DIRECTION_UPLINK)
6985 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6986 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6987 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6988 else if (direction == SIR_MAC_DIRECTION_BIDIR)
6989 {
6990 pMac->lim.gUapsdPerAcTriggerEnableMask &= ~(1 << ac);
6991 pMac->lim.gUapsdPerAcDeliveryEnableMask &= ~(1 << ac);
6992 }
6993 }
6994 else if (action == SET_UAPSD_MASK)
6995 {
6996 if (direction == SIR_MAC_DIRECTION_UPLINK)
6997 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
6998 else if (direction == SIR_MAC_DIRECTION_DNLINK)
6999 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7000 else if (direction == SIR_MAC_DIRECTION_BIDIR)
7001 {
7002 pMac->lim.gUapsdPerAcTriggerEnableMask |= (1 << ac);
7003 pMac->lim.gUapsdPerAcDeliveryEnableMask |= (1 << ac);
7004 }
7005 }
7006
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007007 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcTriggerEnableMask = 0x%x "), pMac->lim.gUapsdPerAcTriggerEnableMask );
7008 limLog(pMac, LOGE, FL("New pMac->lim.gUapsdPerAcDeliveryEnableMask = 0x%x "), pMac->lim.gUapsdPerAcDeliveryEnableMask );
Jeff Johnson295189b2012-06-20 16:38:30 -07007009
7010 return;
7011}
7012
7013
7014
7015void limHandleHeartBeatTimeout(tpAniSirGlobal pMac )
7016{
7017
7018 tANI_U8 i;
7019 for(i =0;i < pMac->lim.maxBssId;i++)
7020 {
7021 if(pMac->lim.gpSession[i].valid == TRUE )
7022 {
7023 if(pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)
7024 {
7025 limIbssHeartBeatHandle(pMac,&pMac->lim.gpSession[i]);
7026 break;
7027 }
7028
7029 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7030 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7031 {
7032 limHandleHeartBeatFailure(pMac,&pMac->lim.gpSession[i]);
7033 }
7034 }
7035 }
7036 for(i=0; i< pMac->lim.maxBssId; i++)
7037 {
7038 if(pMac->lim.gpSession[i].valid == TRUE )
7039 {
7040 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7041 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7042 {
7043 if(pMac->lim.gpSession[i].LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7044 {
7045 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007046 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 i);)
7048 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7049 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7050 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7051 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007052 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007053 limReactivateHeartBeatTimer(pMac, &pMac->lim.gpSession[i]);
7054 }
7055 break;
7056 }
7057 }
7058 }
7059 }
7060}
7061
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08007062void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
7063{
7064 if(psessionEntry->valid == TRUE )
7065 {
7066 if(psessionEntry->bssType == eSIR_IBSS_MODE)
7067 {
7068 limIbssHeartBeatHandle(pMac,psessionEntry);
7069 }
7070 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7071 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7072 {
7073 limHandleHeartBeatFailure(pMac,psessionEntry);
7074 }
7075 }
7076 /* In the function limHandleHeartBeatFailure things can change so check for the session entry valid
7077 and the other things again */
7078 if(psessionEntry->valid == TRUE )
7079 {
7080 if((psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE) &&
7081 (psessionEntry->limSystemRole == eLIM_STA_ROLE))
7082 {
7083 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7084 {
7085 /* Activate Probe After HeartBeat Timer incase HB Failure detected */
7086 PELOGW(limLog(pMac, LOGW,FL("Sending Probe for Session: %d"),
7087 psessionEntry->bssIdx);)
7088 limDeactivateAndChangeTimer(pMac, eLIM_PROBE_AFTER_HB_TIMER);
7089 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_PROBE_AFTER_HB_TIMER));
7090 if (tx_timer_activate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) != TX_SUCCESS)
7091 {
7092 limLog(pMac, LOGP, FL("Fail to re-activate Probe-after-heartbeat timer"));
7093 limReactivateHeartBeatTimer(pMac, psessionEntry);
7094 }
7095 }
7096 }
7097 }
7098}
7099
7100
Jeff Johnson295189b2012-06-20 16:38:30 -07007101tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac)
7102{
7103 tANI_U8 i;
7104 for(i =0;i < pMac->lim.maxBssId;i++)
7105 {
7106 if(pMac->lim.gpSession[i].valid == TRUE )
7107 {
7108 if((pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) &&
7109 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
7110 {
7111 return pMac->lim.gpSession[i].currentOperChannel;
7112 }
7113 }
7114 }
7115 return 0;
7116}
7117
7118void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7119{
7120
7121 tpPESession psessionEntry;
7122// tANI_U8 sessionId;
7123 tpAddStaParams pAddStaParams;
7124
7125 pAddStaParams = (tpAddStaParams)limMsgQ->bodyptr;
7126
7127 if((psessionEntry = peFindSessionBySessionId(pMac,pAddStaParams->sessionId))==NULL)
7128 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007129 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307130 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007131 return;
7132 }
7133 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
7134 (void) limIbssAddStaRsp(pMac, limMsgQ->bodyptr,psessionEntry);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007135#ifdef FEATURE_WLAN_TDLS
7136 else if(pMac->lim.gLimAddStaTdls)
7137 {
7138 limProcessTdlsAddStaRsp(pMac, limMsgQ->bodyptr, psessionEntry) ;
7139 pMac->lim.gLimAddStaTdls = FALSE ;
7140 }
7141#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 else
7143 limProcessMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
7144
7145}
7146
7147
7148void limUpdateBeacon(tpAniSirGlobal pMac)
7149{
7150 tANI_U8 i;
7151
7152 for(i =0;i < pMac->lim.maxBssId;i++)
7153 {
7154 if(pMac->lim.gpSession[i].valid == TRUE )
7155 {
7156 if( ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7157 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
7158 && (eLIM_SME_NORMAL_STATE == pMac->lim.gpSession[i].limSmeState)
7159 )
7160 {
7161 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7162 limSendBeaconInd(pMac, &pMac->lim.gpSession[i]);
7163 }
7164 else
7165 {
7166 if( (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
7167 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))
7168 {
7169
7170 if(pMac->lim.gpSession[i].statypeForBss == STA_ENTRY_SELF)
7171 {
7172 schSetFixedBeaconFields(pMac,&pMac->lim.gpSession[i]);
7173 }
7174 }
7175 }
7176 }
7177 }
7178}
7179
7180void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac)
7181{
7182 tANI_U8 i;
7183 tpPESession psessionEntry;
7184 /* Probe response is not received after HB failure. This is handled by LMM sub module. */
7185 for(i =0; i < pMac->lim.maxBssId; i++)
7186 {
7187 if(pMac->lim.gpSession[i].valid == TRUE)
7188 {
7189 psessionEntry = &pMac->lim.gpSession[i];
7190 if(psessionEntry->LimHBFailureStatus == eANI_BOOLEAN_TRUE)
7191 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007192 limLog(pMac, LOGE, FL("Probe_hb_failure: SME %d, MLME %d, HB-Count %d"),psessionEntry->limSmeState,
Jeff Johnson295189b2012-06-20 16:38:30 -07007193 psessionEntry->limMlmState, psessionEntry->LimRxedBeaconCntDuringHB);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07007194#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
7195 limDiagEventReport(pMac, WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, psessionEntry, 0, 0);
7196#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007197 if (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
7198 {
Leela Venkata Kiran Kumar Reddy Chiralaab842fb2013-04-30 12:27:35 -07007199 if ((!LIM_IS_CONNECTION_ACTIVE(psessionEntry))&&
7200 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07007201 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007202 limLog(pMac, LOGE, FL("Probe_hb_failure: for session:%d " ),psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007203 /* AP did not respond to Probe Request. Tear down link with it.*/
7204 limTearDownLinkWithAp(pMac,
7205 psessionEntry->peSessionId,
7206 eSIR_BEACON_MISSED);
7207 pMac->lim.gLimProbeFailureAfterHBfailedCnt++ ;
7208 }
7209 else // restart heartbeat timer
7210 {
7211 limReactivateHeartBeatTimer(pMac, psessionEntry);
7212 }
7213 }
7214 else
7215 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007216 limLog(pMac, LOGE, FL("Unexpected wt-probe-timeout in state "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007217 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
7218 limReactivateHeartBeatTimer(pMac, psessionEntry);
7219 }
7220
7221 }
7222 }
7223 }
7224 /* Deactivate Timer ProbeAfterHB Timer -> As its a oneshot timer, need not deactivate the timer */
7225 // tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
7226}
7227
7228
7229/*
7230* This function assumes there will not be more than one IBSS session active at any time.
7231*/
7232tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac)
7233{
7234 tANI_U8 i;
7235
7236 for(i =0;i < pMac->lim.maxBssId;i++)
7237 {
7238 if( (pMac->lim.gpSession[i].valid) &&
7239 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_IN_IBSS_ROLE))
7240 return (&pMac->lim.gpSession[i]);
7241 }
7242
7243 return NULL;
7244}
7245
7246tpPESession limIsApSessionActive(tpAniSirGlobal pMac)
7247{
7248 tANI_U8 i;
7249
7250 for(i =0;i < pMac->lim.maxBssId;i++)
7251 {
7252 if( (pMac->lim.gpSession[i].valid) &&
7253 ( (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ||
7254 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)))
7255 return (&pMac->lim.gpSession[i]);
7256 }
7257
7258 return NULL;
7259}
7260
7261/**---------------------------------------------------------
7262\fn limHandleDeferMsgError
7263\brief handles error scenario, when the msg can not be deferred.
7264\param pMac
7265\param pLimMsg LIM msg, which could not be deferred.
7266\return void
7267-----------------------------------------------------------*/
7268
7269void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg)
7270{
7271 if(SIR_BB_XPORT_MGMT_MSG == pLimMsg->type)
7272 {
7273 vos_pkt_return_packet((vos_pkt_t*)pLimMsg->bodyptr);
7274 }
7275 else if(pLimMsg->bodyptr != NULL)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307276 vos_mem_free( pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07007277
7278}
7279
7280
7281#ifdef FEATURE_WLAN_DIAG_SUPPORT
7282/**---------------------------------------------------------
7283\fn limDiagEventReport
7284\brief This function reports Diag event
7285\param pMac
7286\param eventType
7287\param bssid
7288\param status
7289\param reasonCode
7290\return void
7291-----------------------------------------------------------*/
7292void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode)
7293{
7294 tSirMacAddr nullBssid = { 0, 0, 0, 0, 0, 0 };
7295 WLAN_VOS_DIAG_EVENT_DEF(peEvent, vos_event_wlan_pe_payload_type);
7296
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307297 vos_mem_set(&peEvent, sizeof(vos_event_wlan_pe_payload_type), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007298
7299 if (NULL == pSessionEntry)
7300 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307301 vos_mem_copy( peEvent.bssid, nullBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007302 peEvent.sme_state = (tANI_U16)pMac->lim.gLimSmeState;
7303 peEvent.mlm_state = (tANI_U16)pMac->lim.gLimMlmState;
7304
7305 }
7306 else
7307 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307308 vos_mem_copy(peEvent.bssid, pSessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07007309 peEvent.sme_state = (tANI_U16)pSessionEntry->limSmeState;
7310 peEvent.mlm_state = (tANI_U16)pSessionEntry->limMlmState;
7311 }
7312 peEvent.event_type = eventType;
7313 peEvent.status = status;
7314 peEvent.reason_code = reasonCode;
7315
7316 WLAN_VOS_DIAG_EVENT_REPORT(&peEvent, EVENT_WLAN_PE);
7317 return;
7318}
7319
7320#endif /* FEATURE_WLAN_DIAG_SUPPORT */
7321
7322void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7323{
7324
7325 tpAddStaSelfParams pAddStaSelfParams;
7326 tSirMsgQ mmhMsg;
7327 tpSirSmeAddStaSelfRsp pRsp;
7328
7329
7330 pAddStaSelfParams = (tpAddStaSelfParams)limMsgQ->bodyptr;
7331
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307332 pRsp = vos_mem_malloc(sizeof(tSirSmeAddStaSelfRsp));
7333 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007334 {
7335 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307336 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7337 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007338 return;
7339 }
7340
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307341 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeAddStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007342
7343 pRsp->mesgType = eWNI_SME_ADD_STA_SELF_RSP;
7344 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeAddStaSelfRsp);
7345 pRsp->status = pAddStaSelfParams->status;
7346
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307347 vos_mem_copy( pRsp->selfMacAddr, pAddStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007348
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307349 vos_mem_free(pAddStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007350
7351 mmhMsg.type = eWNI_SME_ADD_STA_SELF_RSP;
7352 mmhMsg.bodyptr = pRsp;
7353 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007354 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007355 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7356
7357}
7358
7359void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ)
7360{
7361
7362 tpDelStaSelfParams pDelStaSelfParams;
7363 tSirMsgQ mmhMsg;
7364 tpSirSmeDelStaSelfRsp pRsp;
7365
7366
7367 pDelStaSelfParams = (tpDelStaSelfParams)limMsgQ->bodyptr;
7368
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307369 pRsp = vos_mem_malloc(sizeof(tSirSmeDelStaSelfRsp));
7370 if ( NULL == pRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07007371 {
7372 /// Buffer not available. Log error
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307373 limLog(pMac, LOGP, FL("call to AllocateMemory failed for Add Sta self RSP"));
7374 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007375 return;
7376 }
7377
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307378 vos_mem_set((tANI_U8*)pRsp, sizeof(tSirSmeDelStaSelfRsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007379
7380 pRsp->mesgType = eWNI_SME_DEL_STA_SELF_RSP;
7381 pRsp->mesgLen = (tANI_U16) sizeof(tSirSmeDelStaSelfRsp);
7382 pRsp->status = pDelStaSelfParams->status;
7383
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307384 vos_mem_copy( pRsp->selfMacAddr, pDelStaSelfParams->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07007385
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307386 vos_mem_free(pDelStaSelfParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07007387
7388 mmhMsg.type = eWNI_SME_DEL_STA_SELF_RSP;
7389 mmhMsg.bodyptr = pRsp;
7390 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07007391 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007392 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
7393
7394}
7395
7396/***************************************************************
7397* tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7398* To unmap the channel to reverse the effect of mapping
7399* a band channel in hal .Mapping was done hal to overcome the
7400* limitation of the rxbd which use only 4 bit for channel number.
7401*****************************************************************/
7402tANI_U8 limUnmapChannel(tANI_U8 mapChannel)
7403{
7404 if( mapChannel > 0 && mapChannel < 25 )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007405#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7406 if (IS_ROAM_SCAN_OFFLOAD_FEATURE_ENABLE)
7407 return aUnsortedChannelList[mapChannel -1];
7408 else
7409#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007410 return abChannel[mapChannel -1];
7411 else
7412 return 0;
7413}
7414
7415
7416v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field)
7417{
7418 int left = length;
7419 v_U8_t *ptr = pIes;
7420 v_U8_t elem_id;
7421 v_U16_t elem_len;
7422
7423 while(left >= (size_of_len_field+1))
7424 {
7425 elem_id = ptr[0];
7426 if (size_of_len_field == TWO_BYTE)
7427 {
7428 elem_len = ((v_U16_t) ptr[1]) | (ptr[2]<<8);
7429 }
7430 else
7431 {
7432 elem_len = ptr[1];
7433 }
7434
7435
7436 left -= (size_of_len_field+1);
7437 if(elem_len > left)
7438 {
7439 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07007440 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007441 eid,elem_len,left);
7442 return NULL;
7443 }
7444 if (elem_id == eid)
7445 {
7446 return ptr;
7447 }
7448
7449 left -= elem_len;
7450 ptr += (elem_len + (size_of_len_field+1));
7451 }
7452 return NULL;
7453}
7454
7455/* return NULL if oui is not found in ie
7456 return !NULL pointer to vendor IE (starting from 0xDD) if oui is found
7457 */
7458v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len)
7459{
7460 int left = ie_len;
7461 v_U8_t *ptr = ie;
7462 v_U8_t elem_id, elem_len;
7463
7464 while(left >= 2)
7465 {
7466 elem_id = ptr[0];
7467 elem_len = ptr[1];
7468 left -= 2;
7469 if(elem_len > left)
7470 {
7471 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007472 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -07007473 elem_id,elem_len,left);
7474 return NULL;
7475 }
7476 if (SIR_MAC_EID_VENDOR == elem_id)
7477 {
7478 if(memcmp(&ptr[2], oui, oui_size)==0)
7479 return ptr;
7480 }
7481
7482 left -= elem_len;
7483 ptr += (elem_len + 2);
7484 }
7485 return NULL;
7486}
7487
Jeff Johnson295189b2012-06-20 16:38:30 -07007488//Returns length of P2P stream and Pointer ie passed to this function is filled with noa stream
7489
7490v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len)
7491{
7492 int length = 0;
7493 tANI_U8 *ptr = ie;
7494
7495 ptr[length++] = SIR_MAC_EID_VENDOR;
7496 ptr[length++] = ie_len + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307497 vos_mem_copy(&ptr[length], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
7498 vos_mem_copy(&ptr[length + SIR_MAC_P2P_OUI_SIZE], data, ie_len);
Jeff Johnson295189b2012-06-20 16:38:30 -07007499 return (ie_len + SIR_P2P_IE_HEADER_LEN);
7500}
7501
7502//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7503
7504v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen)
7505{
7506 v_U8_t overFlowP2pStream[SIR_MAX_NOA_ATTR_LEN];
Krunal Sonic768a932013-05-15 19:26:30 -07007507
7508 if ((noaLen <= (SIR_MAX_NOA_ATTR_LEN+SIR_P2P_IE_HEADER_LEN)) &&
7509 (noaLen >= overFlowLen) && (overFlowLen <= SIR_MAX_NOA_ATTR_LEN))
7510 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307511 vos_mem_copy(overFlowP2pStream,
Krunal Sonic768a932013-05-15 19:26:30 -07007512 noaStream + noaLen - overFlowLen, overFlowLen);
7513 noaStream[noaLen - overFlowLen] = SIR_MAC_EID_VENDOR;
7514 noaStream[noaLen - overFlowLen + 1] = overFlowLen + SIR_MAC_P2P_OUI_SIZE;
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307515 vos_mem_copy(noaStream+noaLen-overFlowLen + 2,
Krunal Sonic768a932013-05-15 19:26:30 -07007516 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE);
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +05307517 vos_mem_copy(noaStream+noaLen + 2 + SIR_MAC_P2P_OUI_SIZE - overFlowLen,
7518 overFlowP2pStream, overFlowLen);
Krunal Sonic768a932013-05-15 19:26:30 -07007519 }
7520
Jeff Johnson295189b2012-06-20 16:38:30 -07007521 return (noaLen + SIR_P2P_IE_HEADER_LEN);
7522
7523}
7524
7525//Returns length of NoA stream and Pointer pNoaStream passed to this function is filled with noa stream
7526v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry)
7527{
7528 v_U8_t len=0;
7529
7530 v_U8_t *pBody = pNoaStream;
7531
7532
7533 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
7534 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7535 {
7536 if ((!(psessionEntry->p2pGoPsUpdate.uNoa1Duration)) && (!(psessionEntry->p2pGoPsUpdate.uNoa2Duration))
7537 && (!psessionEntry->p2pGoPsUpdate.oppPsFlag)
7538 )
7539 return 0; //No NoA Descriptor then return 0
7540
7541
7542 pBody[0] = SIR_P2P_NOA_ATTR;
7543
7544 pBody[3] = psessionEntry->p2pGoPsUpdate.index;
7545 pBody[4] = psessionEntry->p2pGoPsUpdate.ctWin | (psessionEntry->p2pGoPsUpdate.oppPsFlag<<7);
7546 len = 5;
7547 pBody += len;
7548
7549
7550 if (psessionEntry->p2pGoPsUpdate.uNoa1Duration)
7551 {
7552 *pBody = psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt;
7553 pBody += 1;
7554 len +=1;
7555
7556 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Duration);
7557 pBody += sizeof(tANI_U32);
7558 len +=4;
7559
7560 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1Interval);
7561 pBody += sizeof(tANI_U32);
7562 len +=4;
7563
7564 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
7565 pBody += sizeof(tANI_U32);
7566 len +=4;
7567
7568 }
7569
7570 if (psessionEntry->p2pGoPsUpdate.uNoa2Duration)
7571 {
7572 *pBody = psessionEntry->p2pGoPsUpdate.uNoa2IntervalCnt;
7573 pBody += 1;
7574 len +=1;
7575
7576 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Duration);
7577 pBody += sizeof(tANI_U32);
7578 len +=4;
7579
7580 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2Interval);
7581 pBody += sizeof(tANI_U32);
7582 len +=4;
7583
7584 *((tANI_U32 *)(pBody)) = sirSwapU32ifNeeded(psessionEntry->p2pGoPsUpdate.uNoa2StartTime);
7585 pBody += sizeof(tANI_U32);
7586 len +=4;
7587
7588 }
7589
7590
7591 pBody = pNoaStream + 1;
7592 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(len-3);/*one byte for Attr and 2 bytes for length*/
7593
7594 return (len);
7595
7596 }
7597 return 0;
7598
7599}
Jeff Johnsone7245742012-09-05 17:12:55 -07007600
7601void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState phyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007602{
7603
7604 pMac->lim.gResumeChannel = channel;
Jeff Johnsone7245742012-09-05 17:12:55 -07007605 pMac->lim.gResumePhyCbState = phyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007606}
Jeff Johnsone7245742012-09-05 17:12:55 -07007607
Jeff Johnson295189b2012-06-20 16:38:30 -07007608/*--------------------------------------------------------------------------
7609
7610 \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session.
7611
Jeff Johnsone7245742012-09-05 17:12:55 -07007612 This function returns the channel to resume to during link resume. channel id of 0 means HAL will
7613 resume to previous channel before link suspend
Jeff Johnson295189b2012-06-20 16:38:30 -07007614
7615 \param pMac - pointer to global adapter context
7616 \return - channel to scan from valid session else zero.
7617
7618 \sa
7619
7620 --------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07007621void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState)
Jeff Johnson295189b2012-06-20 16:38:30 -07007622{
7623
7624 //Rationale - this could be the suspend/resume for assoc and it is essential that
7625 //the new BSS is active for some time. Other BSS was anyway suspended.
7626 //TODO: Comeup with a better alternative. Sending NULL with PM=0 on other BSS means
7627 //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 -07007628 //and hence should be ok. Need to discuss this further
7629 if( !limIsInMCC(pMac) )
Jeff Johnson295189b2012-06-20 16:38:30 -07007630 {
7631 //Get current active session channel
Jeff Johnsone7245742012-09-05 17:12:55 -07007632 peGetActiveSessionChannel(pMac, resumeChannel, resumePhyCbState);
Jeff Johnson295189b2012-06-20 16:38:30 -07007633 }
7634 else
7635 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007636 *resumeChannel = pMac->lim.gResumeChannel;
7637 *resumePhyCbState = pMac->lim.gResumePhyCbState;
Jeff Johnson295189b2012-06-20 16:38:30 -07007638 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007639 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07007640}
7641
Viral Modid86bde22012-12-10 13:09:21 -08007642tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac)
7643{
7644 tANI_U8 i;
7645 for(i =0; i < pMac->lim.maxBssId; i++)
7646 {
7647 if(pMac->lim.gpSession[i].valid == TRUE)
7648 {
7649 if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
7650 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
7651 )
7652 {
7653 return TRUE;
7654 }
7655 }
7656 }
7657 return FALSE;
7658}
Jeff Johnsone7245742012-09-05 17:12:55 -07007659
Jeff Johnson295189b2012-06-20 16:38:30 -07007660
7661tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel)
7662{
7663 if(NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(currentChannel))
7664 {
7665 return eANI_BOOLEAN_TRUE;
7666 }
7667 else
7668 {
7669 return eANI_BOOLEAN_FALSE;
7670 }
7671}
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07007672
Mohit Khanna4a70d262012-09-11 16:30:12 -07007673#ifdef WLAN_FEATURE_11AC
7674tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId)
7675{
7676 tUpdateVHTOpMode tempParam;
7677
7678 tempParam.opMode = chanWidth;
7679 tempParam.staId = staId;
7680
7681 limSendModeUpdate( pMac, &tempParam, psessionEntry );
7682
7683 return eANI_BOOLEAN_TRUE;
7684}
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007685#endif
7686
7687tANI_U8 limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode)
7688{
7689 tANI_U8 val=0;
7690
7691 if (phyMode == WNI_CFG_PHY_MODE_11A)
7692 {
7693 // 11a mode always uses short slot
7694 // Check this since some APs in 11a mode broadcast long slot in their beacons. As per standard, always use what PHY mandates.
7695 val = true;
7696 }
7697 else if (phyMode == WNI_CFG_PHY_MODE_11G)
7698 {
7699 if ((psessionEntry->pePersona == VOS_STA_SAP_MODE) ||
7700 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
7701 {
7702 val = true;
7703 }
7704
7705 // Program Polaris based on AP capability
7706
7707 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
7708 // Joining BSS.
7709 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limCurrentBssCaps);
7710 else if (psessionEntry->limMlmState == eLIM_MLM_WT_REASSOC_RSP_STATE)
7711 // Reassociating with AP.
7712 val = SIR_MAC_GET_SHORT_SLOT_TIME( psessionEntry->limReassocBssCaps);
7713 }
7714 else // if (phyMode == WNI_CFG_PHY_MODE_11B) - use this if another phymode is added later ON
7715 {
7716 // Will reach here in 11b case
7717 val = false;
7718 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07007719 limLog(pMac, LOG1, FL("phyMode = %u shortslotsupported = %u"), phyMode, val);
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -07007720 return val;
7721}