blob: ce95cb40a141a62ef971ca2b4a6df7c1ba513027 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limProcessMlmMessages.cc contains the code
25 * for processing MLM request messages.
26 * Author: Chandra Modumudi
27 * Date: 02/12/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 *
32 */
33#include "palTypes.h"
34#ifdef ANI_PRODUCT_TYPE_AP
35#include "wniCfgAp.h"
36#else
37#include "wniCfgSta.h"
38#endif
39#include "aniGlobal.h"
40#include "sirApi.h"
41#include "sirParams.h"
42#include "cfgApi.h"
43
44#include "schApi.h"
45#include "utilsApi.h"
46#include "limUtils.h"
47#include "limAssocUtils.h"
48#include "limPropExtsUtils.h"
49#include "limSecurityUtils.h"
50#include "limSendMessages.h"
51#include "pmmApi.h"
52#include "limSendMessages.h"
53//#include "limSessionUtils.h"
54#include "limSessionUtils.h"
55#ifdef WLAN_FEATURE_VOWIFI_11R
56#include <limFT.h>
57#endif
58
59
60
61// MLM REQ processing function templates
62static void limProcessMlmStartReq(tpAniSirGlobal, tANI_U32 *);
63static void limProcessMlmScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070064#ifdef FEATURE_OEM_DATA_SUPPORT
65static void limProcessMlmOemDataReq(tpAniSirGlobal, tANI_U32 *);
66#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070067static void limProcessMlmJoinReq(tpAniSirGlobal, tANI_U32 *);
68static void limProcessMlmAuthReq(tpAniSirGlobal, tANI_U32 *);
69static void limProcessMlmAssocReq(tpAniSirGlobal, tANI_U32 *);
70static void limProcessMlmReassocReq(tpAniSirGlobal, tANI_U32 *);
71static void limProcessMlmDisassocReq(tpAniSirGlobal, tANI_U32 *);
72static void limProcessMlmDeauthReq(tpAniSirGlobal, tANI_U32 *);
73static void limProcessMlmSetKeysReq(tpAniSirGlobal, tANI_U32 *);
74
75static void limProcessMlmAddBAReq( tpAniSirGlobal, tANI_U32 * );
76static void limProcessMlmAddBARsp( tpAniSirGlobal, tANI_U32 * );
77static void limProcessMlmDelBAReq( tpAniSirGlobal, tANI_U32 * );
78
79// MLM Timeout event handler templates
80static void limProcessMinChannelTimeout(tpAniSirGlobal);
81static void limProcessMaxChannelTimeout(tpAniSirGlobal);
82static void limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac);
83static void limProcessJoinFailureTimeout(tpAniSirGlobal);
84static void limProcessAuthFailureTimeout(tpAniSirGlobal);
85static void limProcessAuthRspTimeout(tpAniSirGlobal, tANI_U32);
86static void limProcessAssocFailureTimeout(tpAniSirGlobal, tANI_U32);
87
88static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
89void
Jeff Johnsone7245742012-09-05 17:12:55 -070090limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -070091#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -070092#define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_NORMAL_BACKGROUND_SCAN)
Jeff Johnson295189b2012-06-20 16:38:30 -070093
94/**
95 * limProcessMlmReqMessages()
96 *
97 *FUNCTION:
98 * This function is called by limPostMlmMessage(). This
99 * function handles MLM primitives invoked by SME.
100 *
101 *LOGIC:
102 * Depending on the message type, corresponding function will be
103 * called.
104 *
105 *ASSUMPTIONS:
106 * 1. Upon receiving Beacon in WT_JOIN_STATE, MLM module invokes
107 * APIs exposed by Beacon Processing module for setting parameters
108 * at MAC hardware.
109 * 2. If attempt to Reassociate with an AP fails, link with current
110 * AP is restored back.
111 *
112 *NOTE:
113 *
114 * @param pMac Pointer to Global MAC structure
115 * @param msgType Indicates the MLM primitive message type
116 * @param *pMsgBuf A pointer to the MLM message buffer
117 *
118 * @return None
119 */
120
121void
122limProcessMlmReqMessages(tpAniSirGlobal pMac, tpSirMsgQ Msg)
123{
124 switch (Msg->type)
125 {
126 case LIM_MLM_START_REQ: limProcessMlmStartReq(pMac, Msg->bodyptr); break;
127 case LIM_MLM_SCAN_REQ: limProcessMlmScanReq(pMac, Msg->bodyptr); break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700128#ifdef FEATURE_OEM_DATA_SUPPORT
129 case LIM_MLM_OEM_DATA_REQ: limProcessMlmOemDataReq(pMac, Msg->bodyptr); break;
130#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 case LIM_MLM_JOIN_REQ: limProcessMlmJoinReq(pMac, Msg->bodyptr); break;
132 case LIM_MLM_AUTH_REQ: limProcessMlmAuthReq(pMac, Msg->bodyptr); break;
133 case LIM_MLM_ASSOC_REQ: limProcessMlmAssocReq(pMac, Msg->bodyptr); break;
134 case LIM_MLM_REASSOC_REQ: limProcessMlmReassocReq(pMac, Msg->bodyptr); break;
135 case LIM_MLM_DISASSOC_REQ: limProcessMlmDisassocReq(pMac, Msg->bodyptr); break;
136 case LIM_MLM_DEAUTH_REQ: limProcessMlmDeauthReq(pMac, Msg->bodyptr); break;
137 case LIM_MLM_SETKEYS_REQ: limProcessMlmSetKeysReq(pMac, Msg->bodyptr); break;
138 case LIM_MLM_REMOVEKEY_REQ: limProcessMlmRemoveKeyReq(pMac, Msg->bodyptr); break;
139 case SIR_LIM_MIN_CHANNEL_TIMEOUT: limProcessMinChannelTimeout(pMac); break;
140 case SIR_LIM_MAX_CHANNEL_TIMEOUT: limProcessMaxChannelTimeout(pMac); break;
141 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
142 limProcessPeriodicProbeReqTimer(pMac); break;
143 case SIR_LIM_JOIN_FAIL_TIMEOUT: limProcessJoinFailureTimeout(pMac); break;
144 case SIR_LIM_AUTH_FAIL_TIMEOUT: limProcessAuthFailureTimeout(pMac); break;
145 case SIR_LIM_AUTH_RSP_TIMEOUT: limProcessAuthRspTimeout(pMac, Msg->bodyval); break;
146 case SIR_LIM_ASSOC_FAIL_TIMEOUT: limProcessAssocFailureTimeout(pMac, Msg->bodyval); break;
147#ifdef WLAN_FEATURE_VOWIFI_11R
148 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:limProcessFTPreauthRspTimeout(pMac); break;
149#endif
150#ifdef WLAN_FEATURE_P2P
151 case SIR_LIM_REMAIN_CHN_TIMEOUT: limProcessRemainOnChnTimeout(pMac); break;
152#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800153 case SIR_LIM_DISASSOC_ACK_TIMEOUT: limProcessDisassocAckTimeout(pMac); break;
154 case SIR_LIM_DEAUTH_ACK_TIMEOUT: limProcessDeauthAckTimeout(pMac); break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 case LIM_MLM_ADDBA_REQ: limProcessMlmAddBAReq( pMac, Msg->bodyptr ); break;
156 case LIM_MLM_ADDBA_RSP: limProcessMlmAddBARsp( pMac, Msg->bodyptr ); break;
157 case LIM_MLM_DELBA_REQ: limProcessMlmDelBAReq( pMac, Msg->bodyptr ); break;
158 case LIM_MLM_TSPEC_REQ:
159 default:
160 break;
161 } // switch (msgType)
162} /*** end limProcessMlmReqMessages() ***/
163
164
165/**
166 * limSetScanMode()
167 *
168 *FUNCTION:
169 * This function is called to setup system into Scan mode
170 *
171 *LOGIC:
172 * NA
173 *
174 *ASSUMPTIONS:
175 * NA
176 *
177 *NOTE:
178 *
179 * @param pMac - Pointer to Global MAC structure
180 * @return None
181 */
182
183void
184limSetScanMode(tpAniSirGlobal pMac)
185{
186 tSirLinkTrafficCheck checkTraffic;
187
188 /// Set current scan channel id to the first in the channel list
189 pMac->lim.gLimCurrentScanChannelId = 0;
190
191#ifdef ANI_PRODUCT_TYPE_CLIENT
192 if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) )
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700193 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700194 checkTraffic = eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700195 }
196 else if (IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac))
197 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700199 }
200 else
201 checkTraffic = eSIR_CHECK_ROAMING_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700202#else
203 /* Currently checking the traffic before scan for Linux station. This is because MLM
204 * scan request is not filled as scan is received via Measurement req in Linux. This
205 * should be made as common code for Windows/Linux station once the scan requests are
206 * enabled in Linux
207 * TODO */
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700208 if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) ||
209 IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac))
210 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN;
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700212 }
213 else
214 checkTraffic = eSIR_CHECK_ROAMING_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700215#endif
216
217 PELOG1(limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq\n"));)
218 limSendHalInitScanReq(pMac, eLIM_HAL_INIT_SCAN_WAIT_STATE, checkTraffic);
219
220 return ;
221} /*** end limSetScanMode() ***/
222
223//WLAN_SUSPEND_LINK Related
224
225/* limIsLinkSuspended()
226 *
227 *FUNCTION:
228 * This function returns is link is suspended or not.
229 *
230 *LOGIC:
231 * Since Suspen link uses init scan, it just returns
232 * gLimSystemInScanLearnMode flag.
233 *
234 *ASSUMPTIONS:
235 * NA
236 *
237 *NOTE:
238 *
239 * @param pMac - Pointer to Global MAC structure
240 * @return None
241 */
242tANI_U8
243limIsLinkSuspended(tpAniSirGlobal pMac)
244{
245 return pMac->lim.gLimSystemInScanLearnMode;
246}
247/**
248 * limSuspendLink()
249 *
250 *FUNCTION:
251 * This function is called to suspend traffic. Internally this function uses WDA_INIT_SCAN_REQ.
252 *
253 *LOGIC:
254 * NA
255 *
256 *ASSUMPTIONS:
257 * NA
258 *
259 *NOTE:
260 *
261 * @param pMac - Pointer to Global MAC structure
262 * @param trafficCheck - Takes value from enum tSirLinkTrafficCheck.
263 * @param callback - Callback function to be called after suspending the link.
264 * @param data - Pointer to any buffer that will be passed to callback.
265 * @return None
266 */
267void
268limSuspendLink(tpAniSirGlobal pMac, tSirLinkTrafficCheck trafficCheck, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data)
269{
270 if( NULL == callback )
271 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700272 limLog( pMac, LOGE, "%s:%d: Invalid parameters\n", __func__, __LINE__ );
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 return;
274 }
275
276 if( pMac->lim.gpLimSuspendCallback )
277 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700278 limLog( pMac, LOGE, "%s:%d: gLimSuspendLink callback is not NULL...something is wrong\n", __func__, __LINE__ );
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 callback( pMac, eHAL_STATUS_FAILURE, data );
280 return;
281 }
282
283 pMac->lim.gLimSystemInScanLearnMode = 1;
284 pMac->lim.gpLimSuspendCallback = callback;
285 pMac->lim.gpLimSuspendData = data;
286 limSendHalInitScanReq(pMac, eLIM_HAL_SUSPEND_LINK_WAIT_STATE, trafficCheck );
287}
288
289/**
290 * limResumeLink()
291 *
292 *FUNCTION:
293 * This function is called to Resume traffic after a suspend. Internally this function uses WDA_FINISH_SCAN_REQ.
294 *
295 *LOGIC:
296 * NA
297 *
298 *ASSUMPTIONS:
299 * NA
300 *
301 *NOTE:
302 *
303 * @param pMac - Pointer to Global MAC structure
304 * @param callback - Callback function to be called after Resuming the link.
305 * @param data - Pointer to any buffer that will be passed to callback.
306 * @return None
307 */
308void
309limResumeLink(tpAniSirGlobal pMac, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data)
310{
311 if( NULL == callback )
312 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700313 limLog( pMac, LOGE, "%s:%d: Invalid parameters\n", __func__, __LINE__ );
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 return;
315 }
316
317 if( pMac->lim.gpLimResumeCallback )
318 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700319 limLog( pMac, LOGE, "%s:%d: gLimResumeLink callback is not NULL...something is wrong\n", __func__, __LINE__ );
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 callback( pMac, eHAL_STATUS_FAILURE, data );
321 return;
322 }
323
324 pMac->lim.gpLimResumeCallback = callback;
325 pMac->lim.gpLimResumeData = data;
326 limSendHalFinishScanReq(pMac, eLIM_HAL_RESUME_LINK_WAIT_STATE );
327}
328//end WLAN_SUSPEND_LINK Related
329
330
331/**
332 *
333 * limChangeChannelWithCallback()
334 *
335 * FUNCTION:
336 * This function is called to change channel and perform off channel operation
337 * if required. The caller registers a callback to be called at the end of the
338 * channel change.
339 *
340 */
341void
342limChangeChannelWithCallback(tpAniSirGlobal pMac, tANI_U8 newChannel,
343 CHANGE_CHANNEL_CALLBACK callback,
344 tANI_U32 *cbdata, tpPESession psessionEntry)
345{
346 // Sanity checks for the current and new channel
347#if defined WLAN_VOWIFI_DEBUG
348 PELOGE(limLog( pMac, LOGE, "Switching channel to %d\n", newChannel);)
349#endif
350 psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION;
351
352 pMac->lim.gpchangeChannelCallback = callback;
353 pMac->lim.gpchangeChannelData = cbdata;
354
355 limSendSwitchChnlParams(pMac, newChannel,
Jeff Johnsone7245742012-09-05 17:12:55 -0700356 PHY_SINGLE_CHANNEL_CENTERED,
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 psessionEntry->maxTxPower, psessionEntry->peSessionId);
358
359 return;
360}
361
362
363/**
364 * limContinuePostChannelScan()
365 *
366 *FUNCTION:
367 * This function is called to scan the current channel.
368 *
369 *LOGIC:
370 *
371 *ASSUMPTIONS:
372 * NA
373 *
374 *NOTE:
375 * NA
376 *
377 * @param pMac - Pointer to Global MAC structure
378 *
379 * @return None
380 */
381
382void limContinuePostChannelScan(tpAniSirGlobal pMac)
383{
384 tANI_U8 channelNum;
385 tANI_U8 handleError = 0;
386 tANI_U8 i = 0;
387 tSirRetStatus status = eSIR_SUCCESS;
388
389 if( pMac->lim.abortScan || (NULL == pMac->lim.gpLimMlmScanReq ) ||
390 (pMac->lim.gLimCurrentScanChannelId >
391 (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)))
392 {
393 pMac->lim.abortScan = 0;
394 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
395 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
396 //Set the resume channel to Any valid channel (invalid).
397 //This will instruct HAL to set it to any previous valid channel.
398 peSetResumeChannel(pMac, 0, 0);
399
400 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
401 return;
402 }
403
404 channelNum = limGetCurrentScanChannel(pMac);
405 if ((pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN) &&
406 (limActiveScanAllowed(pMac, channelNum)))
407 {
408 TX_TIMER *periodicScanTimer;
409 PELOG2(limLog(pMac, LOG2, FL("ACTIVE Scan chan %d, sending probe\n"), channelNum);)
410
411 do
412 {
413 /* Prepare and send Probe Request frame for all the SSIDs present in the saved MLM
414 */
415
416 PELOGE(limLog(pMac, LOG1, FL("sending ProbeReq number %d, for SSID %s on channel: %d\n"),
417 i, pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);)
418 // include additional IE if there is
419 status = limSendProbeReqMgmtFrame( pMac, &pMac->lim.gpLimMlmScanReq->ssId[i],
420 pMac->lim.gpLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr,
421 pMac->lim.gpLimMlmScanReq->dot11mode,
422 pMac->lim.gpLimMlmScanReq->uIEFieldLen,
423 (tANI_U8 *)(pMac->lim.gpLimMlmScanReq)+pMac->lim.gpLimMlmScanReq->uIEFieldOffset);
424
425 if ( status != eSIR_SUCCESS)
426 {
427 PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID %s on channel: %d\n"),
428 pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);)
429 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
430 limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
431 return;
432 }
433 i++;
434 } while (i < pMac->lim.gpLimMlmScanReq->numSsid);
435
436 {
437#if defined WLAN_FEATURE_VOWIFI
438 //If minChannelTime is set to zero, SME is requesting scan to not use min channel timer.
439 //This is used in 11k to request for beacon measurement request with a fixed duration in
440 //max channel time.
441 if( pMac->lim.gpLimMlmScanReq->minChannelTime != 0 )
442 {
443#endif
444 /// TXP has sent Probe Request
445 /// Activate minChannelTimer
446 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
447
448#ifdef GEN6_TODO
449 /* revisit this piece of code to assign the appropriate sessionId below
450 * priority - LOW/might not be needed
451 */
452 pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId;
453#endif
454
Jeff Johnsone7245742012-09-05 17:12:55 -0700455 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MIN_CHANNEL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != TX_SUCCESS)
458 {
459 limLog(pMac, LOGP, FL("could not start min channel timer\n"));
460 return;
461 }
462
463 // Initialize max timer too
464 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
465#if defined WLAN_FEATURE_VOWIFI
466 }
467 else
468 {
469#if defined WLAN_VOWIFI_DEBUG
470 PELOGE(limLog( pMac, LOGE, "Min channel time == 0, Use only max chan timer\n" );)
471#endif
472 //No Need to start Min channel timer. Start Max Channel timer.
473 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
474 if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer)
475 == TX_TIMER_ERROR)
476 {
477 /// Could not activate max channel timer.
478 // Log error
479 limLog(pMac,LOGP, FL("could not start max channel timer\n"));
480 return;
481 }
482
483 }
484#endif
485 }
486 /* Start peridic timer which will trigger probe req based on min/max
487 channel timer */
488 periodicScanTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer;
489 if (tx_timer_activate(periodicScanTimer) != TX_SUCCESS)
490 {
491 limLog(pMac, LOGP, FL("could not start periodic probe req "
492 "timer\n"));
493 return;
494 }
495 periodicScanTimer->sessionId = channelNum;
496 }
497 else
498 {
499 tANI_U32 val;
500 PELOG2(limLog(pMac, LOG2, FL("START PASSIVE Scan chan %d\n"), channelNum);)
501
502 /// Passive Scanning. Activate maxChannelTimer
Jeff Johnsone7245742012-09-05 17:12:55 -0700503 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
505 != TX_SUCCESS)
506 {
507 // Could not deactivate max channel timer.
508 // Log error
509 limLog(pMac, LOGP, FL("Unable to deactivate max channel timer\n"));
510 return;
511 }
512 else
513 {
514 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
515 &val) != eSIR_SUCCESS)
516 {
517 /**
518 * Could not get max channel value
519 * from CFG. Log error.
520 */
521 limLog(pMac, LOGP, FL("could not retrieve passive max channel value\n"));
522 return;
523 }
524 else
525 {
526 tANI_U32 val1 = 0;
527
528 val = SYS_MS_TO_TICKS(val);
Jeff Johnsone7245742012-09-05 17:12:55 -0700529 //TODO: consider sessions.
530#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700531#ifdef ANI_PRODUCT_TYPE_CLIENT
532 // If a background was triggered via Quiet BSS,
533 // then we need to adjust the MIN and MAX channel
534 // timer's accordingly to the Quiet duration that
535 // was specified
536 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
537 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
538 {
539 // gLimQuietDuration is already cached in units of
540 // system ticks. No conversion is reqd...
541 val1 = pMac->lim.gLimSpecMgmt.quietDuration;
542 }
543 else
544 {
545 val1 = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
546 }
547#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700548#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 //Pick the longer stay time
550 val = (val > val1) ? val : val1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700551 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
553 val, 0) != TX_SUCCESS)
554 {
555 // Could not change max channel timer.
556 // Log error
557 limLog(pMac, LOGP, FL("Unable to change max channel timer\n"));
558 return;
559 }
560 else if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) != TX_SUCCESS)
561 {
562 limLog(pMac, LOGP, FL("could not start max channel timer\n"));
563 return;
564 }
565
566 }
567 }
568 // Wait for Beacons to arrive
569 } // if (pMac->lim.gLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN)
570
571 if( handleError )
572 {
573 //
574 // FIXME - With this, LIM/SoftMAC will try and recover
575 // state, but eWNI_SME_SCAN_CNF maybe reporting an
576 // incorrect status back to the SME. Some of the possible
577 // errors are:
578 // eSIR_SME_HAL_SCAN_INIT_FAILED
579 // eSIR_SME_RESOURCES_UNAVAILABLE
580 //
581 //Set the resume channel to Any valid channel (invalid).
582 //This will instruct HAL to set it to any previous valid channel.
583 peSetResumeChannel(pMac, 0, 0);
584 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
585 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
586 }
587 else
588 {
589 limAddScanChannelInfo(pMac, channelNum);
590 }
591
592 return;
593}
594
595
596
597
598/*
599* Creates a Raw frame to be sent before every Scan, if required.
600* If only infra link is active (mlmState = Link Estb), then send Data Null
601* If only BT-AMP-AP link is active(mlmState = BSS_STARTED), then send CTS2Self frame.
602* If only BT-AMP-STA link is active(mlmState = BSS_STARTED or Link Est) then send CTS2Self
603* If Only IBSS link is active, then send CTS2Self
604* for concurrent scenario: Infra+BT or Infra+IBSS, always send CTS2Self, no need to send Data Null
605*
606*/
607static void __limCreateInitScanRawFrame(tpAniSirGlobal pMac,
608 tpInitScanParams pInitScanParam)
609{
610 tANI_U8 i;
611 pInitScanParam->scanEntry.activeBSScnt = 0;
612
613 /* Don't send CTS to self as we have issue with BTQM queues where BTQM can
614 * not handle transmition of CTS2self frames. Sending CTS 2 self at this
615 * juncture also doesn't serve much purpose as probe request frames go out
616 * immediately, No need to notify BSS in IBSS case.
617 * */
618
619 for(i =0; i < pMac->lim.maxBssId; i++)
620 {
621 if(pMac->lim.gpSession[i].valid == TRUE)
622 {
623 if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
624 {
625 if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) &&
626 (pInitScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID))
627 {
628 pInitScanParam->scanEntry.bssIdx[pInitScanParam->scanEntry.activeBSScnt]
629 = pMac->lim.gpSession[i].bssIdx;
630 pInitScanParam->scanEntry.activeBSScnt++;
631
632 }
633 }
634#ifdef WLAN_FEATURE_P2P
635 else if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole )
636 && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona )
637 )
638 {
639 pInitScanParam->useNoA = TRUE;
640 }
641#endif
642 }
643 }
644 if (pInitScanParam->scanEntry.activeBSScnt)
645 {
646 pInitScanParam->notifyBss = TRUE;
647 pInitScanParam->frameType = SIR_MAC_DATA_FRAME;
648 pInitScanParam->frameLength = 0;
649 }
650}
651
652/*
653* Creates a Raw frame to be sent during finish scan, if required.
654* Send data null frame, only when there is just one session active and that session is
655* in 'link Estb' state.
656* if more than one session is active, don't send any frame.
657* for concurrent scenario: Infra+BT or Infra+IBSS, no need to send Data Null
658*
659*/
660static void __limCreateFinishScanRawFrame(tpAniSirGlobal pMac,
661 tpFinishScanParams pFinishScanParam)
662{
663 tANI_U8 i;
664 pFinishScanParam->scanEntry.activeBSScnt = 0;
665
666 for(i =0; i < pMac->lim.maxBssId; i++)
667 {
668 if(pMac->lim.gpSession[i].valid == TRUE)
669 {
670 if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)
671 {
672 //BT-STA can either be in LINK-ESTB state or BSS_STARTED State
673 //for BT, need to send CTS2Self
674 if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) &&
675 (pFinishScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID))
676 {
677 pFinishScanParam->scanEntry.bssIdx[pFinishScanParam->scanEntry.activeBSScnt]
678 = pMac->lim.gpSession[i].bssIdx;
679 pFinishScanParam->scanEntry.activeBSScnt++;
680 }
681 }
682 }
683 }
684
685 if (pFinishScanParam->scanEntry.activeBSScnt)
686 {
687 pFinishScanParam->notifyBss = TRUE;
688 pFinishScanParam->frameType = SIR_MAC_DATA_FRAME;
689 pFinishScanParam->frameLength = 0;
690 }
691}
692
693void
694limSendHalInitScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState, tSirLinkTrafficCheck trafficCheck)
695{
696
697
698 tSirMsgQ msg;
699 tpInitScanParams pInitScanParam;
700 tSirRetStatus rc = eSIR_SUCCESS;
701
702 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pInitScanParam,
703 sizeof(*pInitScanParam)))
704 {
705 PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
706 goto error;
707 }
708
709 /*Initialize the pInitScanParam with 0*/
710 palZeroMemory( pMac->hHdd, (tANI_U8 *)pInitScanParam, sizeof(*pInitScanParam));
711
712 msg.type = WDA_INIT_SCAN_REQ;
713 msg.bodyptr = pInitScanParam;
714 msg.bodyval = 0;
715
716 palZeroMemory( pMac->hHdd, (tANI_U8 *)&pInitScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
717 if (nextState == eLIM_HAL_INIT_LEARN_WAIT_STATE)
718 {
719 pInitScanParam->notifyBss = TRUE;
720 pInitScanParam->notifyHost = FALSE;
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700721 if (eSIR_CHECK_ROAMING_SCAN == trafficCheck)
722 {
723 pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SCAN;
724 }
725 else
726 {
727 pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN;
728 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700729
Jeff Johnsone7245742012-09-05 17:12:55 -0700730 pInitScanParam->frameType = SIR_MAC_CTRL_CTS;
731 __limCreateInitScanRawFrame(pMac, pInitScanParam);
732 pInitScanParam->checkLinkTraffic = trafficCheck;
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 }
734 else
735 {
736 if(nextState == eLIM_HAL_SUSPEND_LINK_WAIT_STATE)
737 {
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700738 if (eSIR_CHECK_ROAMING_SCAN == trafficCheck)
739 {
740 pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SUSPEND_LINK;
741 }
742 else
743 {
744 pInitScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
745 }
746
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 }
748 else
749 {
Madan Mohan Koyyalamudi94d111d2012-11-19 20:11:26 -0800750 if (eSIR_CHECK_ROAMING_SCAN == trafficCheck)
751 {
752 pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SCAN;
753 }
754 else
755 {
756 pInitScanParam->scanMode = eHAL_SYS_MODE_SCAN;
757 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 }
759 __limCreateInitScanRawFrame(pMac, pInitScanParam);
760#ifdef WLAN_FEATURE_P2P
761 if (pInitScanParam->useNoA)
762 {
763 pInitScanParam->scanDuration = pMac->lim.gTotalScanDuration;
764 }
765#endif
766 /* Inform HAL whether it should check for traffic on the link
767 * prior to performing a background scan
768 */
769 pInitScanParam->checkLinkTraffic = trafficCheck;
770 }
771
772 pMac->lim.gLimHalScanState = nextState;
773 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -0700774 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700775
776 rc = wdaPostCtrlMsg(pMac, &msg);
777 if (rc == eSIR_SUCCESS) {
778 PELOG3(limLog(pMac, LOG3, FL("wdaPostCtrlMsg() return eSIR_SUCCESS pMac=%x nextState=%d\n"),
779 pMac, pMac->lim.gLimHalScanState);)
780 return;
781 }
782
783 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
784 palFreeMemory(pMac->hHdd, (void *)pInitScanParam);
785 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
786
787error:
788 switch(nextState)
789 {
790 case eLIM_HAL_START_SCAN_WAIT_STATE:
791 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
792 break;
793
794#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
795 case eLIM_HAL_START_LEARN_WAIT_STATE:
796 // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
797 {
798 limRestorePreLearnState(pMac);
799 limReEnableLearnMode(pMac);
800 }
801 break;
802
803#endif
804
805 //WLAN_SUSPEND_LINK Related
806 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
807 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
808 if( pMac->lim.gpLimSuspendCallback )
809 {
810 pMac->lim.gpLimSuspendCallback( pMac, rc, pMac->lim.gpLimSuspendData );
811 pMac->lim.gpLimSuspendCallback = NULL;
812 pMac->lim.gpLimSuspendData = NULL;
813 }
814 pMac->lim.gLimSystemInScanLearnMode = 0;
815 break;
816 //end WLAN_SUSPEND_LINK Related
817 default:
818 break;
819 }
820 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
821
822 return ;
823}
824
825void
826limSendHalStartScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState)
827{
828 tSirMsgQ msg;
829 tpStartScanParams pStartScanParam;
830 tSirRetStatus rc = eSIR_SUCCESS;
831
832 /**
833 * The Start scan request to be sent only if Start Scan is not already requested
834 */
835 if(pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE)
836 {
837
838 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
839 (void **)&pStartScanParam,
840 sizeof(*pStartScanParam)))
841 {
842 PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
843 goto error;
844 }
845
846 msg.type = WDA_START_SCAN_REQ;
847 msg.bodyptr = pStartScanParam;
848 msg.bodyval = 0;
849 pStartScanParam->status = eHAL_STATUS_SUCCESS;
850 pStartScanParam->scanChannel = (tANI_U8)channelNum;
851
852 pMac->lim.gLimHalScanState = nextState;
853 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
854
Jeff Johnsone7245742012-09-05 17:12:55 -0700855 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Mohit Khanna23863762012-09-11 17:40:09 -0700856 limLog(pMac, LOG1, FL("Channel %d\n"), channelNum);
Jeff Johnson295189b2012-06-20 16:38:30 -0700857
858 rc = wdaPostCtrlMsg(pMac, &msg);
859 if (rc == eSIR_SUCCESS) {
860 return;
861 }
862
863 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
864 palFreeMemory(pMac->hHdd, (void *)pStartScanParam);
865 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
866
867error:
868 switch(nextState)
869 {
870 case eLIM_HAL_START_SCAN_WAIT_STATE:
871 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
872 break;
873
874#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
875 case eLIM_HAL_START_LEARN_WAIT_STATE:
876 //if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
877 {
878 limRestorePreLearnState(pMac);
879 limReEnableLearnMode(pMac);
880 }
881 break;
882
883#endif
884
885 default:
886 break;
887 }
888 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
889
890 }
891 else
892 {
893 PELOGW(limLog(pMac, LOGW, FL("Invalid state for START_SCAN_REQ message=%d\n"), pMac->lim.gLimHalScanState);)
894 }
895
896 return;
897}
898
899void limSendHalEndScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState)
900{
901 tSirMsgQ msg;
902 tpEndScanParams pEndScanParam;
903 tSirRetStatus rc = eSIR_SUCCESS;
904
905 /**
906 * The End scan request to be sent only if End Scan is not already requested or
907 * Start scan is not already requestd
908 */
909 if((pMac->lim.gLimHalScanState != eLIM_HAL_END_SCAN_WAIT_STATE) &&
910 (pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE))
911 {
912
913 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pEndScanParam,
914 sizeof(*pEndScanParam)))
915 {
916 PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
917 goto error;
918 }
919
920 msg.type = WDA_END_SCAN_REQ;
921 msg.bodyptr = pEndScanParam;
922 msg.bodyval = 0;
923 pEndScanParam->status = eHAL_STATUS_SUCCESS;
924 pEndScanParam->scanChannel = (tANI_U8)channelNum;
925
926 pMac->lim.gLimHalScanState = nextState;
927 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -0700928 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700929
930 rc = wdaPostCtrlMsg(pMac, &msg);
931 if (rc == eSIR_SUCCESS) {
932 return;
933 }
934
935 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
936 palFreeMemory(pMac->hHdd, (void *)pEndScanParam);
937 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
938
939 error:
940 switch(nextState)
941 {
942 case eLIM_HAL_END_SCAN_WAIT_STATE:
943 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_END_FAILED);
944 break;
945
946#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
947 case eLIM_HAL_END_LEARN_WAIT_STATE:
948 // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
949 {
950 limRestorePreLearnState(pMac);
951 limReEnableLearnMode(pMac);
952 }
953 break;
954#endif
955
956 default:
957 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg Rcvd invalid nextState %d\n"), nextState);)
958 break;
959 }
960 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
961 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
962 }
963 else
964 {
965 PELOGW(limLog(pMac, LOGW, FL("Invalid state for END_SCAN_REQ message=%d\n"), pMac->lim.gLimHalScanState);)
966 }
967
968
969 return;
970}
971
972/**
973 * limSendHalFinishScanReq()
974 *
975 *FUNCTION:
976 * This function is called to finish scan/learn request..
977 *
978 *LOGIC:
979 *
980 *ASSUMPTIONS:
981 * NA
982 *
983 *NOTE:
984 * NA
985 *
986 * @param pMac - Pointer to Global MAC structure
987 * @param nextState - this parameters determines whether this call is for scan or learn
988 *
989 * @return None
990 */
991void limSendHalFinishScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState)
992{
993
994 tSirMsgQ msg;
995 tpFinishScanParams pFinishScanParam;
996 tSirRetStatus rc = eSIR_SUCCESS;
997
998 if(pMac->lim.gLimHalScanState == nextState)
999 {
1000 /*
1001 * PE may receive multiple probe responses, while waiting for HAL to send 'FINISH_SCAN_RSP' message
1002 * PE was sending multiple finish scan req messages to HAL
1003 * this check will avoid that.
1004 * If PE is already waiting for the 'finish_scan_rsp' message from HAL, it will ignore this request.
1005 */
1006 PELOGW(limLog(pMac, LOGW, FL("Next Scan State is same as the current state: %d \n"), nextState);)
1007 return;
1008 }
1009
1010
1011 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pFinishScanParam,
1012 sizeof(*pFinishScanParam)))
1013 {
1014 PELOGW(limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));)
1015 goto error;
1016 }
1017
1018 msg.type = WDA_FINISH_SCAN_REQ;
1019 msg.bodyptr = pFinishScanParam;
1020 msg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001021
1022 peGetResumeChannel(pMac, &pFinishScanParam->currentOperChannel, &pFinishScanParam->cbState);
1023
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 palZeroMemory( pMac->hHdd, (tANI_U8 *)&pFinishScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr));
1025
1026 if (nextState == eLIM_HAL_FINISH_LEARN_WAIT_STATE)
1027 {
1028 //AP - No pkt need to be transmitted
1029 pFinishScanParam->scanMode = eHAL_SYS_MODE_LEARN;
1030 pFinishScanParam->notifyBss = FALSE;
1031 pFinishScanParam->notifyHost = FALSE;
1032 pFinishScanParam->frameType = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001033
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 pFinishScanParam->frameLength = 0;
1035 pMac->lim.gLimHalScanState = nextState;
1036 }
1037 else
1038 {
1039 /* If STA is associated with an AP (ie. STA is in
1040 * LINK_ESTABLISHED state), then STA need to inform
1041 * the AP via either DATA-NULL
1042 */
1043 if (nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE)
1044 {
1045 pFinishScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK;
1046 }
1047 else
1048 {
1049 pFinishScanParam->scanMode = eHAL_SYS_MODE_SCAN;
1050 }
1051 pFinishScanParam->notifyHost = FALSE;
1052 __limCreateFinishScanRawFrame(pMac, pFinishScanParam);
1053 //WLAN_SUSPEND_LINK Related
1054 pMac->lim.gLimHalScanState = nextState;
1055 //end WLAN_SUSPEND_LINK Related
1056 }
1057
1058 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001059 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001060
1061 rc = wdaPostCtrlMsg(pMac, &msg);
1062 if (rc == eSIR_SUCCESS) {
1063 return;
1064 }
1065 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1066 palFreeMemory(pMac->hHdd, (void *)pFinishScanParam);
1067 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d\n"), rc);)
1068
1069 error:
1070 if(nextState == eLIM_HAL_FINISH_SCAN_WAIT_STATE)
1071 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_FINISH_FAILED);
1072 //WLAN_SUSPEND_LINK Related
1073 else if ( nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE )
1074 {
1075 if( pMac->lim.gpLimResumeCallback )
1076 {
1077 pMac->lim.gpLimResumeCallback( pMac, rc, pMac->lim.gpLimResumeData );
1078 pMac->lim.gpLimResumeCallback = NULL;
1079 pMac->lim.gpLimResumeData = NULL;
1080 pMac->lim.gLimSystemInScanLearnMode = 0;
1081 }
1082 }
1083 //end WLAN_SUSPEND_LINK Related
1084 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
1085 return;
1086}
1087
1088/**
1089 * limContinueChannelScan()
1090 *
1091 *FUNCTION:
1092 * This function is called by limPerformChannelScan().
1093 * This function is called to continue channel scanning when
1094 * Beacon/Probe Response frame are received.
1095 *
1096 *LOGIC:
1097 * Scan criteria stored in pMac->lim.gLimMlmScanReq is used
1098 * to perform channel scan. In this function MLM sub module
1099 * makes channel switch, sends PROBE REQUEST frame in case of
1100 * ACTIVE SCANNING, starts min/max channel timers, programs
1101 * NAV to probeDelay timer and waits for Beacon/Probe Response.
1102 * Once all required channels are scanned, LIM_MLM_SCAN_CNF
1103 * primitive is used to send Scan results to SME sub module.
1104 *
1105 *ASSUMPTIONS:
1106 * 1. In case of Active scanning, start MAX channel time iff
1107 * MIN channel timer expired and activity is observed on
1108 * the channel.
1109 *
1110 *NOTE:
1111 * NA
1112 *
1113 * @param pMac Pointer to Global MAC structure
1114 * @return None
1115 */
1116void
1117limContinueChannelScan(tpAniSirGlobal pMac)
1118{
1119 tANI_U8 channelNum;
1120
1121 PELOG1(limLog(pMac, LOG1, FL("Continue SCAN : chan %d tot %d\n"),
1122 pMac->lim.gLimCurrentScanChannelId,
1123 pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
1124
1125 if (pMac->lim.gLimCurrentScanChannelId >
1126 (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)
1127 || pMac->lim.abortScan)
1128 {
1129#ifndef ANI_SNIFFER
1130 pMac->lim.abortScan = 0;
1131 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1132 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1133
1134 //Set the resume channel to Any valid channel (invalid).
1135 //This will instruct HAL to set it to any previous valid channel.
1136 peSetResumeChannel(pMac, 0, 0);
1137
1138 /// Done scanning all required channels
1139 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1140#endif
1141 return;
1142 }
1143
1144 /// Atleast one more channel is to be scanned
1145
1146 if ((pMac->lim.gLimReturnAfterFirstMatch & 0x40) ||
1147 (pMac->lim.gLimReturnAfterFirstMatch & 0x80))
1148 {
1149 while (pMac->lim.gLimCurrentScanChannelId <=
1150 (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
1151 {
1152 if (((limGetCurrentScanChannel(pMac) <= 14) &&
1153 pMac->lim.gLim24Band11dScanDone) ||
1154 ((limGetCurrentScanChannel(pMac) > 14) &&
1155 pMac->lim.gLim50Band11dScanDone))
1156 {
1157 limLog(pMac, LOGW, FL("skipping chan %d\n"),
1158 limGetCurrentScanChannel(pMac));
1159 pMac->lim.gLimCurrentScanChannelId++;
1160 }
1161 else
1162 break;
1163 }
1164
1165 if (pMac->lim.gLimCurrentScanChannelId >
1166 (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
1167 {
1168 pMac->lim.abortScan = 0;
1169 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1170 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1171 /// Done scanning all required channels
1172 //Set the resume channel to Any valid channel (invalid).
1173 //This will instruct HAL to set it to any previous valid channel.
1174 peSetResumeChannel(pMac, 0, 0);
1175 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1176 return;
1177 }
1178 }
1179
1180 channelNum = limGetCurrentScanChannel(pMac);
1181 PELOG2(limLog(pMac, LOG2, FL("Current Channel to be scanned is %d\n"),
1182 channelNum);)
1183
1184 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_SCAN_WAIT_STATE);
1185 return;
1186} /*** end limContinueChannelScan() ***/
1187
1188
1189
1190/**
1191 * limRestorePreScanState()
1192 *
1193 *FUNCTION:
1194 * This function is called by limContinueChannelScan()
1195 * to restore HW state prior to entering 'scan state'
1196 *
1197 *LOGIC
1198 *
1199 *ASSUMPTIONS:
1200 *
1201 *NOTE:
1202 * NA
1203 *
1204 * @param pMac Pointer to Global MAC structure
1205 * @return None
1206 */
1207void
1208limRestorePreScanState(tpAniSirGlobal pMac)
1209{
1210 int i;
1211
1212 /// Deactivate MIN/MAX channel timers if running
1213 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1214 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1215
1216 /* Re-activate Heartbeat timers for connected sessions as scan
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001217 * is done if the DUT is in active mode
1218 * AND it is not a ROAMING ("background") scan */
1219 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07001220 (ePMM_STATE_READY == pMac->pmm.gPmmState))
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001221 && (pMac->lim.gLimBackgroundScanMode != eSIR_ROAMING_SCAN ))
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 {
1223 for(i=0;i<pMac->lim.maxBssId;i++)
1224 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07001225 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1226 (pMac->lim.gpSession[i].valid == TRUE) &&
1227 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 {
1229 limReactivateHeartBeatTimer(pMac, peFindSessionBySessionId(pMac,i));
1230 }
1231 }
1232 }
1233
1234 /**
1235 * clean up message queue.
1236 * If SME messages, redirect to deferred queue.
1237 * The rest will be discarded.
1238 */
1239 //limCleanupMsgQ(pMac);
1240
1241 pMac->lim.gLimSystemInScanLearnMode = 0;
1242 PELOG1(limLog(pMac, LOG1, FL("Scan ended, took %d tu\n"), (tx_time_get() - pMac->lim.scanStartTime));)
1243} /*** limRestorePreScanState() ***/
1244
Jeff Johnsone7245742012-09-05 17:12:55 -07001245#ifdef FEATURE_OEM_DATA_SUPPORT
1246
1247void limSendHalOemDataReq(tpAniSirGlobal pMac)
1248{
1249 tSirMsgQ msg;
1250 tpStartOemDataReq pStartOemDataReq = NULL;
1251 tSirRetStatus rc = eSIR_SUCCESS;
1252 tpLimMlmOemDataRsp pMlmOemDataRsp;
1253 tANI_U32 reqLen = 0;
1254 if(NULL == pMac->lim.gpLimMlmOemDataReq)
1255 {
1256 PELOGE(limLog(pMac, LOGE, FL("Null pointer\n"));)
1257 goto error;
1258 }
1259
1260 reqLen = sizeof(tStartOemDataReq);
1261
1262 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pStartOemDataReq, reqLen))
1263 {
1264 PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Could not allocate memory for pStartOemDataReq\n"));)
1265 goto error;
1266 }
1267
1268 palZeroMemory(pMac->hHdd, (tANI_U8*)(pStartOemDataReq), reqLen);
1269
1270 //Now copy over the information to the OEM DATA REQ to HAL
1271 palCopyMemory(pMac->hHdd, pStartOemDataReq->selfMacAddr, pMac->lim.gpLimMlmOemDataReq->selfMacAddr, sizeof(tSirMacAddr));
1272
1273 palCopyMemory(pMac->hHdd, pStartOemDataReq->oemDataReq, pMac->lim.gpLimMlmOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
1274
1275 //Create the message to be passed to HAL
1276 msg.type = WDA_START_OEM_DATA_REQ;
1277 msg.bodyptr = pStartOemDataReq;
1278 msg.bodyval = 0;
1279
1280 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1281 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
1282
1283 rc = wdaPostCtrlMsg(pMac, &msg);
1284 if(rc == eSIR_SUCCESS)
1285 {
1286 return;
1287 }
1288
1289 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1290 palFreeMemory(pMac->hHdd, (void*)pStartOemDataReq);
1291 PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: posting WDA_START_OEM_DATA_REQ to HAL failed\n"));)
1292
1293error:
1294 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
1295
1296 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)(&pMlmOemDataRsp), sizeof(tLimMlmOemDataRsp)))
1297 {
1298 limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure\n"));
1299 return;
1300 }
1301
1302 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1303 {
1304 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
1305 pMac->lim.gpLimMlmOemDataReq = NULL;
1306 }
1307
1308 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
1309
1310 return;
1311}
1312/**
1313 * limSetOemDataReqModeFailed()
1314 *
1315 * FUNCTION:
1316 * This function is used as callback to resume link after the suspend fails while
1317 * starting oem data req mode.
1318 * LOGIC:
1319 * NA
1320 *
1321 * ASSUMPTIONS:
1322 * NA
1323 *
1324 * NOTE:
1325 *
1326 * @param pMac - Pointer to Global MAC structure
1327 * @return None
1328 */
1329
1330void limSetOemDataReqModeFailed(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data)
1331{
1332 tpLimMlmOemDataRsp pMlmOemDataRsp;
1333
1334 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
1335
1336 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)(&pMlmOemDataRsp), sizeof(tLimMlmOemDataRsp)))
1337 {
1338 limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure\n"));
1339 return;
1340 }
1341
1342 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1343 {
1344 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
1345 pMac->lim.gpLimMlmOemDataReq = NULL;
1346 }
1347
1348 palZeroMemory(pMac->hHdd, pMlmOemDataRsp, sizeof(tLimMlmOemDataRsp));
1349
1350 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
1351
1352 return;
1353}
1354
1355/**
1356 * limSetOemDataReqMode()
1357 *
1358 *FUNCTION:
1359 * This function is called to setup system into OEM DATA REQ mode
1360 *
1361 *LOGIC:
1362 * NA
1363 *
1364 *ASSUMPTIONS:
1365 * NA
1366 *
1367 *NOTE:
1368 *
1369 * @param pMac - Pointer to Global MAC structure
1370 * @return None
1371 */
1372
1373void limSetOemDataReqMode(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data)
1374{
1375 if(status != eHAL_STATUS_SUCCESS)
1376 {
1377 limLog(pMac, LOGE, FL("OEM_DATA: failed in suspend link\n"));
1378 goto error;
1379 }
1380 else
1381 {
1382 PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Calling limSendHalOemDataReq\n"));)
1383 limSendHalOemDataReq(pMac);
1384 return;
1385 }
1386
1387error:
1388 limResumeLink(pMac, limSetOemDataReqModeFailed, NULL);
1389 return ;
1390} /*** end limSendHalOemDataReq() ***/
1391
1392#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001393
1394static void
1395mlm_add_sta(
1396 tpAniSirGlobal pMac,
1397 tpAddStaParams pSta,
1398 tANI_U8 *pBssid,
1399 tANI_U8 htCapable,
1400 tpPESession psessionEntry) //psessionEntry may required in future
1401{
1402 tANI_U32 val;
1403 int i;
1404
1405
1406 pSta->staType = STA_ENTRY_SELF; // Identifying self
1407
1408 palCopyMemory( pMac->hHdd, pSta->bssId, pBssid, sizeof( tSirMacAddr ));
1409 palCopyMemory( pMac->hHdd, pSta->staMac, psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
1410
1411 /* Configuration related parameters to be changed to support BT-AMP */
1412
1413 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_LISTEN_INTERVAL, &val ))
1414 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
1415
1416 pSta->listenInterval = (tANI_U16) val;
1417
1418 if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) )
1419 limLog(pMac, LOGP, FL("Couldn't get SHORT_PREAMBLE\n"));
1420 pSta->shortPreambleSupported = (tANI_U8)val;
1421
1422 pSta->assocId = 0; // Is SMAC OK with this?
1423 pSta->wmmEnabled = 0;
1424 pSta->uAPSD = 0;
1425 pSta->maxSPLen = 0;
1426 pSta->us32MaxAmpduDuration = 0;
1427 pSta->maxAmpduSize = 0; // 0: 8k, 1: 16k,2: 32k,3: 64k
1428
1429
1430 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
1431 {
1432 pSta->htCapable = htCapable;
1433#ifdef WLAN_SOFTAP_FEATURE
1434 pSta->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
1435 pSta->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry );
1436 pSta->mimoPS = (tSirMacHTMIMOPowerSaveState)limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
1437 pSta->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
1438 pSta->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
1439 pSta->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
1440 pSta->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
1441 pSta->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
1442 pSta->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
1443 pSta->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
1444 pSta->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
1445#else
1446 pSta->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
1447 pSta->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
1448 pSta->mimoPS = (tSirMacHTMIMOPowerSaveState)limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
1449 pSta->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
1450 pSta->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
1451 pSta->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
1452 pSta->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
1453 pSta->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
1454 pSta->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
1455 pSta->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
1456 pSta->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
1457
1458#endif
1459 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001460#ifdef WLAN_FEATURE_11AC
1461 if (psessionEntry->vhtCapability)
1462 {
1463 pSta->vhtCapable = VOS_TRUE;
1464 }
1465#endif
1466#ifdef WLAN_FEATURE_11AC
1467 limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry,NULL);
1468#else
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001470#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001471 limFillSupportedRatesInfo(pMac, NULL, &pSta->supportedRates,psessionEntry);
1472
1473 limLog( pMac, LOGE, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d\n") ,
1474 pSta->greenFieldCapable, pSta->txChannelWidthSet, pSta->mimoPS, pSta->lsigTxopProtection,
1475 pSta->fDsssCckMode40Mhz,pSta->fShortGI20Mhz, pSta->fShortGI40Mhz);
1476
1477#ifdef WLAN_FEATURE_P2P
1478 if (VOS_P2P_GO_MODE == psessionEntry->pePersona)
1479 {
1480 pSta->p2pCapableSta = 1;
1481 }
1482#endif
1483
1484 //Disable BA. It will be set as part of ADDBA negotiation.
1485 for( i = 0; i < STACFG_MAX_TC; i++ )
1486 {
1487 pSta->staTCParams[i].txUseBA = eBA_DISABLE;
1488 pSta->staTCParams[i].rxUseBA = eBA_DISABLE;
1489 }
1490
1491}
1492
1493//
1494// New HAL interface - WDA_ADD_BSS_REQ
1495// Package WDA_ADD_BSS_REQ to HAL, in order to start a BSS
1496//
1497tSirResultCodes
1498limMlmAddBss (
1499 tpAniSirGlobal pMac,
1500 tLimMlmStartReq *pMlmStartReq,
1501 tpPESession psessionEntry)
1502{
1503 tSirMsgQ msgQ;
1504 tpAddBssParams pAddBssParams = NULL;
1505 tANI_U32 retCode;
1506
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 // Package WDA_ADD_BSS_REQ message parameters
1508
1509 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1510 (void **) &pAddBssParams, sizeof( tAddBssParams )))
1511 {
1512 limLog( pMac, LOGE, FL( "Unable to PAL allocate memory during ADD_BSS\n" ));
1513 // Respond to SME with LIM_MLM_START_CNF
1514 return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
1515 }
1516
1517 palZeroMemory(pMac->hHdd, pAddBssParams, sizeof(tAddBssParams));
1518
1519 // Fill in tAddBssParams members
1520 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, pMlmStartReq->bssId,
1521 sizeof( tSirMacAddr ));
1522
1523 // Fill in tAddBssParams selfMacAddr
1524 palCopyMemory ( pMac->hHdd, pAddBssParams->selfMacAddr,
1525 psessionEntry->selfMacAddr,
1526 sizeof( tSirMacAddr ));
1527
1528 pAddBssParams->bssType = pMlmStartReq->bssType;
1529 if ((pMlmStartReq->bssType == eSIR_IBSS_MODE) ||
1530 (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE)||
1531 (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE)) {
1532 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
1533 }
1534#ifdef WLAN_SOFTAP_FEATURE
1535 else if (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE){
1536#else
1537 else{
1538#endif
1539 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_AP;
1540 }
1541
1542#ifdef WLAN_SOFTAP_FEATURE
Jeff Johnsone7245742012-09-05 17:12:55 -07001543 pAddBssParams->shortSlotTimeSupported = psessionEntry->shortSlotTimeSupported;
Jeff Johnson295189b2012-06-20 16:38:30 -07001544#endif
1545
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 pAddBssParams->beaconInterval = pMlmStartReq->beaconPeriod;
1547 pAddBssParams->dtimPeriod = pMlmStartReq->dtimPeriod;
1548 pAddBssParams->cfParamSet.cfpCount = pMlmStartReq->cfParamSet.cfpCount;
1549 pAddBssParams->cfParamSet.cfpPeriod = pMlmStartReq->cfParamSet.cfpPeriod;
1550 pAddBssParams->cfParamSet.cfpMaxDuration = pMlmStartReq->cfParamSet.cfpMaxDuration;
1551 pAddBssParams->cfParamSet.cfpDurRemaining = pMlmStartReq->cfParamSet.cfpDurRemaining;
1552
1553 pAddBssParams->rateSet.numRates = pMlmStartReq->rateSet.numRates;
1554 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
1555 pMlmStartReq->rateSet.rate, pMlmStartReq->rateSet.numRates );
1556
1557 pAddBssParams->nwType = pMlmStartReq->nwType;
1558
1559 pAddBssParams->htCapable = pMlmStartReq->htCapable;
Jeff Johnsone7245742012-09-05 17:12:55 -07001560#ifdef WLAN_FEATURE_11AC
1561 pAddBssParams->vhtCapable = psessionEntry->vhtCapability;
1562 pAddBssParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
1563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 pAddBssParams->htOperMode = pMlmStartReq->htOperMode;
1565 pAddBssParams->dualCTSProtection = pMlmStartReq->dualCTSProtection;
1566 pAddBssParams->txChannelWidthSet = pMlmStartReq->txChannelWidthSet;
1567
1568 pAddBssParams->currentOperChannel = pMlmStartReq->channelNumber;
Jeff Johnsone7245742012-09-05 17:12:55 -07001569 pAddBssParams->currentExtChannel = pMlmStartReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001570
1571 /* Update PE sessionId*/
1572 pAddBssParams->sessionId = pMlmStartReq->sessionId;
1573
1574 //Send the SSID to HAL to enable SSID matching for IBSS
1575 palCopyMemory( pMac->hHdd, &(pAddBssParams->ssId.ssId),
1576 pMlmStartReq->ssId.ssId,
1577 pMlmStartReq->ssId.length);
1578 pAddBssParams->ssId.length = pMlmStartReq->ssId.length;
1579#ifdef WLAN_SOFTAP_FEATURE
1580 pAddBssParams->bHiddenSSIDEn = pMlmStartReq->ssidHidden;
1581 limLog( pMac, LOGE, FL( "TRYING TO HIDE SSID %d\n" ),pAddBssParams->bHiddenSSIDEn);
1582 // CR309183. Disable Proxy Probe Rsp. Host handles Probe Requests. Until FW fixed.
1583 pAddBssParams->bProxyProbeRespEn = 0;
1584 pAddBssParams->obssProtEnabled = pMlmStartReq->obssProtEnabled;
1585
1586#endif
1587#if defined WLAN_FEATURE_VOWIFI
1588 pAddBssParams->maxTxPower = psessionEntry->maxTxPower;
1589#endif
1590 mlm_add_sta(pMac, &pAddBssParams->staContext,
1591 pAddBssParams->bssId, pAddBssParams->htCapable,psessionEntry);
1592
1593 pAddBssParams->status = eHAL_STATUS_SUCCESS;
1594 pAddBssParams->respReqd = 1;
1595
1596 // Set a new state for MLME
1597 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001598 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001599
1600 pAddBssParams->halPersona=psessionEntry->pePersona; //pass on the session persona to hal
1601
1602 pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled;
1603
1604#if defined WLAN_FEATURE_VOWIFI_11R
1605 pAddBssParams->extSetStaKeyParamValid = 0;
1606#endif
1607
1608 //
1609 // FIXME_GEN4
1610 // A global counter (dialog token) is required to keep track of
1611 // all PE <-> HAL communication(s)
1612 //
1613 msgQ.type = WDA_ADD_BSS_REQ;
1614 msgQ.reserved = 0;
1615 msgQ.bodyptr = pAddBssParams;
1616 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001617 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
1619 limLog( pMac, LOGW, FL( "Sending WDA_ADD_BSS_REQ...\n" ));
1620 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
1621 {
1622 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"), retCode );
1623 palFreeMemory(pMac->hHdd,(void *)pAddBssParams);
1624 return eSIR_SME_HAL_SEND_MESSAGE_FAIL;
1625 }
1626
1627 return eSIR_SME_SUCCESS;
1628}
1629
1630
1631/**
1632 * limProcessMlmStartReq()
1633 *
1634 *FUNCTION:
1635 * This function is called to process MLM_START_REQ message
1636 * from SME
1637 *
1638 *LOGIC:
1639 * 1) MLME receives LIM_MLM_START_REQ from LIM
1640 * 2) MLME sends WDA_ADD_BSS_REQ to HAL
1641 * 3) MLME changes state to eLIM_MLM_WT_ADD_BSS_RSP_STATE
1642 * MLME now waits for HAL to send WDA_ADD_BSS_RSP
1643 *
1644 *ASSUMPTIONS:
1645 *
1646 *NOTE:
1647 *
1648 * @param pMac Pointer to Global MAC structure
1649 * @param *pMsgBuf A pointer to the MLM message buffer
1650 * @return None
1651 */
1652
1653static void
1654limProcessMlmStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1655{
1656 tLimMlmStartReq *pMlmStartReq;
1657 tLimMlmStartCnf mlmStartCnf;
1658 tpPESession psessionEntry = NULL;
1659
1660 if(pMsgBuf == NULL)
1661 {
1662 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1663 return;
1664 }
1665
1666 pMlmStartReq = (tLimMlmStartReq *) pMsgBuf;
1667 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmStartReq->sessionId))==NULL)
1668 {
1669 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
1670 mlmStartCnf.resultCode = eSIR_SME_REFUSED;
1671 goto end;
1672 }
1673
1674 if (psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE)
1675 {
1676 /**
1677 * Should not have received Start req in states other than idle.
1678 * Return Start confirm with failure code.
1679 */
1680 PELOGE(limLog(pMac, LOGE, FL("received unexpected MLM_START_REQ in state %X\n"),psessionEntry->limMlmState);)
1681 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
1682 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1683 goto end;
1684 }
1685
1686 #if 0
1687 if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, pMlmStartReq->channelNumber)!= eSIR_SUCCESS)
1688 limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG\n"));
1689
1690 pMac->lim.gLimCurrentChannelId = pMlmStartReq->channelNumber;
1691 #endif //TO SUPPORT BT-AMP
1692
1693
1694 // Update BSSID & SSID at CFG database
1695 #if 0 //We are not using the BSSID and SSID from the config file, instead we are reading form the session table
1696 if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pMlmStartReq->bssId, sizeof(tSirMacAddr))
1697 != eSIR_SUCCESS)
1698 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
1699
1700
1701
1702 palCopyMemory( pMac->hHdd, pMac->lim.gLimCurrentBssId,
1703 pMlmStartReq->bssId,
1704 sizeof(tSirMacAddr));
1705 #endif //TO SUPPORT BT-AMP
1706
1707 #if 0
1708 if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &pMlmStartReq->ssId.ssId, pMlmStartReq->ssId.length)
1709 != eSIR_SUCCESS)
1710 limLog(pMac, LOGP, FL("could not update SSID at CFG\n"));
1711 #endif //To SUPPORT BT-AMP
1712
1713
1714 // pMac->lim.gLimCurrentSSID.length = pMlmStartReq->ssId.length;
1715
1716 #if 0
1717 if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1718 (tANI_U8 *) &pMac->lim.gpLimStartBssReq->operationalRateSet.rate,
1719 pMac->lim.gpLimStartBssReq->operationalRateSet.numRates)
1720 != eSIR_SUCCESS)
1721 limLog(pMac, LOGP, FL("could not update Operational Rateset at CFG\n"));
1722 #endif //TO SUPPORT BT-AMP
1723
1724
1725#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1726 if (cfgSetInt(pMac, WNI_CFG_CURRENT_TX_POWER_LEVEL, pMac->lim.gpLimStartBssReq->powerLevel)
1727 != eSIR_SUCCESS)
1728 limLog(pMac, LOGP, FL("could not set WNI_CFG_CURRENT_TX_POWER_LEVEL at CFG\n"));
1729#endif
1730
1731#ifdef WLAN_SOFTAP_FEATURE
1732#if 0 // Periodic timer for remove WPS PBC proble response entry in PE is disbaled now.
1733 if (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1734 {
1735 if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_FALSE)
1736 {
1737 if (tx_timer_create(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1738 "PS OVERLAP Timer",
1739 limWPSOverlapTimerHandler,
1740 SIR_LIM_WPS_OVERLAP_TIMEOUT, // expiration_input
1741 SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // initial_ticks
1742 SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // reschedule_ticks
1743 TX_AUTO_ACTIVATE /* TX_NO_ACTIVATE*/) != TX_SUCCESS)
1744 {
1745 limLog(pMac, LOGP, FL("failed to create WPS overlap Timer\n"));
1746 }
1747
1748 pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId = pMlmStartReq->sessionId;
1749 pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_TRUE;
1750 limLog(pMac, LOGE, FL("Create WPS overlap Timer, session=%d\n"), pMlmStartReq->sessionId);
1751
1752 if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1753 {
1754 limLog(pMac, LOGP, FL("tx_timer_activate failed\n"));
1755 }
1756 }
1757 }
1758#endif
1759#endif
1760
1761
1762
1763 mlmStartCnf.resultCode = limMlmAddBss(pMac, pMlmStartReq,psessionEntry);
1764
1765end:
1766 /* Update PE session Id */
1767 mlmStartCnf.sessionId = pMlmStartReq->sessionId;
1768
1769 /// Free up buffer allocated for LimMlmScanReq
1770 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
1771
1772 //
1773 // Respond immediately to LIM, only if MLME has not been
1774 // successfully able to send WDA_ADD_BSS_REQ to HAL.
1775 // Else, LIM_MLM_START_CNF will be sent after receiving
1776 // WDA_ADD_BSS_RSP from HAL
1777 //
1778 if( eSIR_SME_SUCCESS != mlmStartCnf.resultCode )
1779 limPostSmeMessage(pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf);
1780} /*** limProcessMlmStartReq() ***/
1781
1782
1783/*
1784* This function checks if Scan is allowed or not.
1785* It checks each session and if any session is not in the normal state,
1786* it will return false.
1787* Note: BTAMP_STA can be in LINK_EST as well as BSS_STARTED State, so
1788* both cases are handled below.
1789*/
1790
1791static tANI_U8 __limMlmScanAllowed(tpAniSirGlobal pMac)
1792{
1793 int i;
1794
Jeff Johnson43971f52012-07-17 12:26:56 -07001795 if(pMac->lim.gLimMlmState != eLIM_MLM_IDLE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 {
1797 return FALSE;
1798 }
1799 for(i =0; i < pMac->lim.maxBssId; i++)
1800 {
1801 if(pMac->lim.gpSession[i].valid == TRUE)
1802 {
1803 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
1804 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
1805 (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) )||
1806
1807 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
1808 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
1809 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
1810 (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) )
1811#ifdef WLAN_FEATURE_P2P
1812 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
1813 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
1814 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
1815 && (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) )
1816#endif
1817 ))
1818 {
1819 return FALSE;
1820
1821 }
1822 }
1823 }
1824
1825 return TRUE;
1826}
1827
1828
1829
1830/**
1831 * limProcessMlmScanReq()
1832 *
1833 *FUNCTION:
1834 * This function is called to process MLM_SCAN_REQ message
1835 * from SME
1836 *
1837 *LOGIC:
1838 *
1839 *ASSUMPTIONS:
1840 *
1841 *NOTE:
1842 *
1843 * @param pMac Pointer to Global MAC structure
1844 * @param *pMsgBuf A pointer to the MLM message buffer
1845 * @return None
1846 */
1847
1848static void
1849limProcessMlmScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1850{
1851 tLimMlmScanCnf mlmScanCnf;
1852
1853 if (pMac->lim.gLimSystemInScanLearnMode)
1854 {
1855 PELOGE(limLog(pMac, LOGE,
1856 FL("Sending START_SCAN from LIM while one req is pending\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001857 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudid4b301b2012-10-11 14:15:54 -07001858 /*Send back a failure*/
1859 mlmScanCnf.resultCode = eSIR_SME_SCAN_FAILED;
1860 mlmScanCnf.scanResultLength = 0;
1861 limPostSmeMessage(pMac,
1862 LIM_MLM_SCAN_CNF,
1863 (tANI_U32 *) &mlmScanCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 return;
1865 }
1866
1867 if(__limMlmScanAllowed(pMac) &&
1868 (((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels != 0))
1869
1870 {
1871 /// Hold onto SCAN REQ criteria
1872 pMac->lim.gpLimMlmScanReq = (tLimMlmScanReq *) pMsgBuf;
1873
1874 PELOG3(limLog(pMac, LOG3, FL("Number of channels to scan are %d \n"),
1875 pMac->lim.gpLimMlmScanReq->channelList.numChannels);)
1876
1877 pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
1878
1879 if (pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN)
1880 pMac->lim.gLimMlmState = eLIM_MLM_WT_PROBE_RESP_STATE;
1881 else // eSIR_PASSIVE_SCAN
1882 pMac->lim.gLimMlmState = eLIM_MLM_PASSIVE_SCAN_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001883 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001884
1885 pMac->lim.gLimSystemInScanLearnMode = 1;
1886
1887#ifdef WLAN_FEATURE_P2P
1888 pMac->lim.gTotalScanDuration =
1889 pMac->lim.gpLimMlmScanReq->maxChannelTime*
1890 pMac->lim.gpLimMlmScanReq->channelList.numChannels;
1891#endif
1892 limSetScanMode(pMac);
1893 }
1894 else
1895 {
1896 /**
1897 * Should not have received SCAN req in other states
1898 * OR should not have received LIM_MLM_SCAN_REQ with
1899 * zero number of channels
1900 * Log error
1901 */
1902 limLog(pMac, LOGW,
1903 FL("received unexpected MLM_SCAN_REQ in state %X OR zero number of channels: %X\n"),
1904 pMac->lim.gLimMlmState, ((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels);
1905 limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
1906
1907 /// Free up buffer allocated for
1908 /// pMac->lim.gLimMlmScanReq
1909 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
1910
1911 /// Return Scan confirm with INVALID_PARAMETERS
1912
1913 mlmScanCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
1914 mlmScanCnf.scanResultLength = 0;
1915 limPostSmeMessage(pMac,
1916 LIM_MLM_SCAN_CNF,
1917 (tANI_U32 *) &mlmScanCnf);
1918 }
1919} /*** limProcessMlmScanReq() ***/
1920
Jeff Johnsone7245742012-09-05 17:12:55 -07001921#ifdef FEATURE_OEM_DATA_SUPPORT
1922static void limProcessMlmOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1923{
1924 tLimMlmOemDataRsp* pMlmOemDataRsp;
1925
1926 if (((pMac->lim.gLimMlmState == eLIM_MLM_IDLE_STATE) ||
1927 (pMac->lim.gLimMlmState == eLIM_MLM_JOINED_STATE) ||
1928 (pMac->lim.gLimMlmState == eLIM_MLM_AUTHENTICATED_STATE) ||
1929 (pMac->lim.gLimMlmState == eLIM_MLM_BSS_STARTED_STATE) ||
1930 (pMac->lim.gLimMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)))
1931 {
1932 //Hold onto the oem data request criteria
1933 pMac->lim.gpLimMlmOemDataReq = (tLimMlmOemDataReq*)pMsgBuf;
1934
1935 pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
1936
1937 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
1938
1939 //Now request for link suspension
1940 limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, limSetOemDataReqMode, NULL);
1941 }
1942 else
1943 {
1944 /**
1945 * Should not have received oem data req in other states
1946 * Log error
1947 */
1948
1949 PELOGW(limLog(pMac, LOGW, FL("OEM_DATA: unexpected LIM_MLM_OEM_DATA_REQ in invalid state %X\n"),pMac->lim.gLimMlmState);)
1950
1951 limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
1952
1953 /// Free up buffer allocated
1954 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf);
1955
1956 /// Return Meas confirm with INVALID_PARAMETERS
1957 if(eHAL_STATUS_SUCCESS == palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataRsp, sizeof(tLimMlmOemDataRsp)))
1958 {
1959 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp);
1960 palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
1961 }
1962 else
1963 {
1964 limLog(pMac, LOGP, FL("Could not allocate memory for pMlmOemDataRsp\n"));
1965 return;
1966 }
1967 }
1968
1969 return;
1970}
1971#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001972
1973
1974/**
1975 * limProcessMlmPostJoinSuspendLink()
1976 *
1977 *FUNCTION:
1978 * This function is called after the suspend link while joining
1979 * off channel.
1980 *
1981 *LOGIC:
1982 * Check for suspend state.
1983 * If success, proceed with setting link state to recieve the
1984 * probe response/beacon from intended AP.
1985 * Switch to the APs channel.
1986 * On an error case, send the MLM_JOIN_CNF with error status.
1987 *
1988 *ASSUMPTIONS:
1989 *
1990 *NOTE:
1991 *
1992 * @param pMac Pointer to Global MAC structure
1993 * @param status status of suspend link.
1994 * @param ctx passed while calling suspend link(psessionEntry)
1995 * @return None
1996 */
1997static void
1998limProcessMlmPostJoinSuspendLink(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *ctx)
1999{
Jeff Johnsone7245742012-09-05 17:12:55 -07002000 tANI_U8 chanNum, secChanOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 tLimMlmJoinCnf mlmJoinCnf;
2002 tpPESession psessionEntry = (tpPESession)ctx;
2003 tSirLinkState linkState;
2004
2005 if( eHAL_STATUS_SUCCESS != status )
2006 {
2007 limLog(pMac, LOGP, FL("Suspend link failed. Not proceeding with join\n"));
2008 goto error;
2009 }
2010 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2011 psessionEntry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002012 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002013
2014 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
2015
2016 //assign appropriate sessionId to the timer object
2017 pMac->lim.limTimers.gLimJoinFailureTimer.sessionId = psessionEntry->peSessionId;
2018
2019 linkState = ((psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ? eSIR_LINK_BTAMP_PREASSOC_STATE : eSIR_LINK_PREASSOC_STATE);
2020 limLog(pMac, LOG1, FL("[limProcessMlmJoinReq]: linkState:%d\n"),linkState);
2021
2022 if (limSetLinkState(pMac, linkState,
2023 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
2024 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2025 {
2026 limLog(pMac, LOGE, FL("limSetLinkState to eSIR_LINK_PREASSOC_STATE Failed!!\n"));
2027 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002028 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
2029 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 goto error;
2031 }
2032
2033 /** Derive channel from BSS description and store it in the CFG */
2034 // chanNum = pMac->lim.gpLimMlmJoinReq->bssDescription.channelId;
2035
2036 chanNum = psessionEntry->currentOperChannel;
Jeff Johnsone7245742012-09-05 17:12:55 -07002037 secChanOffset = psessionEntry->htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 //store the channel switch sessionEntry in the lim global var
2039 psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_JOIN;
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002040#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2041 psessionEntry->pLimMlmReassocRetryReq = NULL;
2042#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002043
Jeff Johnsone7245742012-09-05 17:12:55 -07002044 limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002045
2046 return;
2047error:
2048 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2049 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
2050 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2051 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
2052
2053}
2054
2055
2056
2057/**
2058 * limProcessMlmJoinReq()
2059 *
2060 *FUNCTION:
2061 * This function is called to process MLM_JOIN_REQ message
2062 * from SME
2063 *
2064 *LOGIC:
2065 * 1) Initialize LIM, HAL, DPH
2066 * 2) Configure the BSS for which the JOIN REQ was received
2067 * a) Send WDA_ADD_BSS_REQ to HAL -
2068 * This will identify the BSS that we are interested in
2069 * --AND--
2070 * Add a STA entry for the AP (in a STA context)
2071 * b) Wait for WDA_ADD_BSS_RSP
2072 * c) Send WDA_ADD_STA_REQ to HAL
2073 * This will add the "local STA" entry to the STA table
2074 * 3) Continue as before, i.e,
2075 * a) Send a PROBE REQ
2076 * b) Wait for PROBE RSP/BEACON containing the SSID that
2077 * we are interested in
2078 * c) Then start an AUTH seq
2079 * d) Followed by the ASSOC seq
2080 *
2081 *ASSUMPTIONS:
2082 *
2083 *NOTE:
2084 *
2085 * @param pMac Pointer to Global MAC structure
2086 * @param *pMsgBuf A pointer to the MLM message buffer
2087 * @return None
2088 */
2089
2090static void
2091limProcessMlmJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2092{
2093 tLimMlmJoinCnf mlmJoinCnf;
2094 tANI_U8 sessionId;
2095 tpPESession psessionEntry;
2096
2097 sessionId = ((tpLimMlmJoinReq)pMsgBuf)->sessionId;
2098
2099 if((psessionEntry = peFindSessionBySessionId(pMac,sessionId))== NULL)
2100 {
2101 limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
2102
2103 goto error;
2104 }
2105
2106 if (( (psessionEntry->limSystemRole != eLIM_AP_ROLE ) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE )) &&
2107 ( (psessionEntry->limMlmState == eLIM_MLM_IDLE_STATE) ||
2108 (psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE)) &&
2109 (SIR_MAC_GET_ESS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo) !=
2110 SIR_MAC_GET_IBSS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo)))
2111 {
2112 #if 0
2113 if (pMac->lim.gpLimMlmJoinReq)
2114 palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
2115 #endif //TO SUPPORT BT-AMP , review 23sep
2116
2117 /// Hold onto Join request parameters
2118
2119 psessionEntry->pLimMlmJoinReq =(tpLimMlmJoinReq) pMsgBuf;
2120
2121 if( isLimSessionOffChannel(pMac, sessionId) )
2122 {
2123 //suspend link
2124 limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
2125 limProcessMlmPostJoinSuspendLink, (tANI_U32*)psessionEntry );
2126 }
2127 else
2128 {
2129 //No need to suspend link.
2130 limProcessMlmPostJoinSuspendLink( pMac, eHAL_STATUS_SUCCESS,
2131 (tANI_U32*) psessionEntry );
2132 }
2133
2134 return;
2135 }
2136 else
2137 {
2138 /**
2139 * Should not have received JOIN req in states other than
2140 * Idle state or on AP.
2141 * Return join confirm with invalid parameters code.
2142 */
2143 PELOGE(limLog(pMac, LOGE,
2144 FL("Unexpected Join request for role %d state %X\n"),
2145 psessionEntry->limSystemRole,
2146 psessionEntry->limMlmState);)
2147 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
2148
2149 limLog(pMac, LOGE, FL("Unexpected Join request for role %d state %X\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07002150 psessionEntry->limSystemRole, psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 }
2152
2153error:
2154
2155
2156 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2157 mlmJoinCnf.sessionId = sessionId;
2158 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2159 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
2160
2161
2162} /*** limProcessMlmJoinReq() ***/
2163
2164
2165
2166/**
2167 * limProcessMlmAuthReq()
2168 *
2169 *FUNCTION:
2170 * This function is called to process MLM_AUTH_REQ message
2171 * from SME
2172 *
2173 *LOGIC:
2174 *
2175 *ASSUMPTIONS:
2176 *
2177 *NOTE:
2178 *
2179 * @param pMac Pointer to Global MAC structure
2180 * @param *pMsgBuf A pointer to the MLM message buffer
2181 * @return None
2182 */
2183
2184static void
2185limProcessMlmAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2186{
2187 tANI_U32 numPreAuthContexts;
2188 tSirMacAddr currentBssId;
2189 tSirMacAuthFrameBody authFrameBody;
2190 tLimMlmAuthCnf mlmAuthCnf;
2191 struct tLimPreAuthNode *preAuthNode;
2192 tpDphHashNode pStaDs;
2193 tANI_U8 sessionId;
2194 tpPESession psessionEntry;
2195
2196 if(pMsgBuf == NULL)
2197 {
2198 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
2199 return;
2200 }
2201
2202 pMac->lim.gpLimMlmAuthReq = (tLimMlmAuthReq *) pMsgBuf;
2203 sessionId = pMac->lim.gpLimMlmAuthReq->sessionId;
2204 if((psessionEntry= peFindSessionBySessionId(pMac,sessionId) )== NULL)
2205 {
2206 limLog(pMac, LOGP, FL("Session Does not exist for given sessionId\n"));
2207 return;
2208 }
2209
2210 /**
2211 * Expect Auth request only when:
2212 * 1. STA joined/associated with a BSS or
2213 * 2. STA is in IBSS mode
2214 * and STA is going to authenticate with a unicast
2215 * adress and requested authentication algorithm is
2216 * supported.
2217 */
2218 #if 0
2219 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
2220 eSIR_SUCCESS)
2221 {
2222 /// Could not get BSSID from CFG. Log error.
2223 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2224 }
2225 #endif //To SuppoRT BT-AMP
2226
2227 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
2228
2229 if (((((psessionEntry->limSystemRole== eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2230 ((psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) ||
2231 (psessionEntry->limMlmState ==
2232 eLIM_MLM_LINK_ESTABLISHED_STATE))) ||
2233 ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) &&
2234 (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))) &&
2235 (limIsGroupAddr(pMac->lim.gpLimMlmAuthReq->peerMacAddr)
2236 == false) &&
2237#ifdef WLAN_SOFTAP_FEATURE
2238 (limIsAuthAlgoSupported(
2239 pMac,
2240 pMac->lim.gpLimMlmAuthReq->authType,
2241 psessionEntry) == true)
2242#else
2243 (limIsAuthAlgoSupported(
2244 pMac,
2245 pMac->lim.gpLimMlmAuthReq->authType) == true)
2246#endif
2247 )
2248 {
2249 /**
2250 * This is a request for pre-authentication.
2251 * Check if there exists context already for
2252 * the requsted peer OR
2253 * if this request is for the AP we're currently
2254 * associated with.
2255 * If yes, return auth confirm immediately when
2256 * requested auth type is same as the one used before.
2257 */
2258 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
2259 (psessionEntry->limMlmState ==
2260 eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2261 (((pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) != NULL) &&
2262 (pMac->lim.gpLimMlmAuthReq->authType ==
2263 pStaDs->mlmStaContext.authType)) &&
2264 (palEqualMemory( pMac->hHdd,pMac->lim.gpLimMlmAuthReq->peerMacAddr,
2265 currentBssId,
2266 sizeof(tSirMacAddr)) )) ||
2267 (((preAuthNode =
2268 limSearchPreAuthList(
2269 pMac,
2270 pMac->lim.gpLimMlmAuthReq->peerMacAddr)) != NULL) &&
2271 (preAuthNode->authType ==
2272 pMac->lim.gpLimMlmAuthReq->authType)))
2273 {
2274 PELOG2(limLog(pMac, LOG2,
2275 FL("Already have pre-auth context with peer\n"));
2276 limPrintMacAddr(pMac, pMac->lim.gpLimMlmAuthReq->peerMacAddr,
2277 LOG2);)
2278
2279 mlmAuthCnf.resultCode = (tSirResultCodes)
2280 eSIR_MAC_SUCCESS_STATUS;
2281
2282
2283 goto end;
2284 }
2285 else
2286 {
2287 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
2288 (tANI_U32 *) &numPreAuthContexts) != eSIR_SUCCESS)
2289 {
2290 limLog(pMac, LOGP,
2291 FL("Could not retrieve NumPreAuthLimit from CFG\n"));
2292 }
2293#ifdef ANI_AP_SDK_OPT
2294 if(numPreAuthContexts > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
2295 numPreAuthContexts = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
2296#endif // ANI_AP_SDK_OPT
2297
2298 if (pMac->lim.gLimNumPreAuthContexts == numPreAuthContexts)
2299 {
2300 PELOGW(limLog(pMac, LOGW,
2301 FL("Number of pre-auth reached max limit\n"));)
2302
2303 /// Return Auth confirm with reject code
2304 mlmAuthCnf.resultCode =
2305 eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED;
2306
2307 goto end;
2308 }
2309 }
2310
2311 // Delete pre-auth node if exists
2312 if (preAuthNode)
2313 limDeletePreAuthNode(pMac,
2314 pMac->lim.gpLimMlmAuthReq->peerMacAddr);
2315
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2317 psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002318 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002319
2320 /// Prepare & send Authentication frame
2321 authFrameBody.authAlgoNumber =
2322 (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType;
2323 authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
2324 authFrameBody.authStatusCode = 0;
2325 limSendAuthMgmtFrame(pMac,
2326 &authFrameBody,
2327 pMac->lim.gpLimMlmAuthReq->peerMacAddr,
2328 LIM_NO_WEP_IN_FC,psessionEntry);
2329
Jeff Johnsone7245742012-09-05 17:12:55 -07002330 //assign appropriate sessionId to the timer object
2331 pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId;
2332
2333 // Activate Auth failure timer
2334 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_AUTH_FAIL_TIMER));
2335 if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer)
2336 != TX_SUCCESS)
2337 {
2338 /// Could not start Auth failure timer.
2339 // Log error
2340 limLog(pMac, LOGP,
2341 FL("could not start Auth failure timer\n"));
2342 // Cleanup as if auth timer expired
2343 limProcessAuthFailureTimeout(pMac);
2344 }
2345
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 return;
2347 }
2348 else
2349 {
2350 /**
2351 * Unexpected auth request.
2352 * Return Auth confirm with Invalid parameters code.
2353 */
2354 mlmAuthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2355
2356 goto end;
2357 }
2358
2359end:
2360 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmAuthCnf.peerMacAddr,
2361 (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr,
2362 sizeof(tSirMacAddr));
2363
2364 mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType;
2365 mlmAuthCnf.sessionId = sessionId;
2366
2367 /// Free up buffer allocated
2368 /// for pMac->lim.gLimMlmAuthReq
2369 palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
2370 pMac->lim.gpLimMlmAuthReq = NULL;
2371 limPostSmeMessage(pMac, LIM_MLM_AUTH_CNF, (tANI_U32 *) &mlmAuthCnf);
2372} /*** limProcessMlmAuthReq() ***/
2373
2374
2375
2376/**
2377 * limProcessMlmAssocReq()
2378 *
2379 *FUNCTION:
2380 * This function is called to process MLM_ASSOC_REQ message
2381 * from SME
2382 *
2383 *LOGIC:
2384 *
2385 *ASSUMPTIONS:
2386 *
2387 *NOTE:
2388 *
2389 * @param pMac Pointer to Global MAC structure
2390 * @param *pMsgBuf A pointer to the MLM message buffer
2391 * @return None
2392 */
2393
2394static void
2395limProcessMlmAssocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2396{
2397 tSirMacAddr currentBssId;
2398 tLimMlmAssocReq *pMlmAssocReq;
2399 tLimMlmAssocCnf mlmAssocCnf;
2400 tpPESession psessionEntry;
2401 // tANI_U8 sessionId;
2402
2403 if(pMsgBuf == NULL)
2404 {
2405 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
2406 return;
2407 }
2408 pMlmAssocReq = (tLimMlmAssocReq *) pMsgBuf;
2409
2410 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL)
2411 {
2412 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002413 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 return;
2415 }
2416
2417 #if 0
2418 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
2419 eSIR_SUCCESS)
2420 {
2421 /// Could not get BSSID from CFG. Log error.
2422 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2423 }
2424 #endif //TO SUPPORT BT-AMP
2425 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
2426
2427 if ( (psessionEntry->limSystemRole != eLIM_AP_ROLE && psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE) &&
2428 (psessionEntry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE || psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) &&
2429 (palEqualMemory(pMac->hHdd,pMlmAssocReq->peerMacAddr, currentBssId, sizeof(tSirMacAddr))) )
2430 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002431
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 /// map the session entry pointer to the AssocFailureTimer
2433 pMac->lim.limTimers.gLimAssocFailureTimer.sessionId = pMlmAssocReq->sessionId;
2434
Jeff Johnson295189b2012-06-20 16:38:30 -07002435 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2436 psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002437 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002438
2439 /// Prepare and send Association request frame
2440 limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry);
2441
2442 //Set the link state to postAssoc, so HW can start receiving frames from AP.
2443 if ((psessionEntry->bssType == eSIR_BTAMP_STA_MODE)||
2444 ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE) && (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)))
2445 {
2446 if(limSetLinkState(pMac, eSIR_LINK_BTAMP_POSTASSOC_STATE, currentBssId,
2447 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2448 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
2449 } else {
2450 if(limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE, currentBssId,
2451 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2452 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
2453 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002454 /// Start association failure timer
2455 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ASSOC_FAIL_TIMER));
2456 if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer)
2457 != TX_SUCCESS)
2458 {
2459 /// Could not start Assoc failure timer.
2460 // Log error
2461 limLog(pMac, LOGP,
2462 FL("could not start Association failure timer\n"));
2463 // Cleanup as if assoc timer expired
2464 limProcessAssocFailureTimeout(pMac,LIM_ASSOC );
2465
2466 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002467
2468 return;
2469 }
2470 else
2471 {
2472 /**
2473 * Received Association request either in invalid state
2474 * or to a peer MAC entity whose address is different
2475 * from one that STA is currently joined with or on AP.
2476 * Return Assoc confirm with Invalid parameters code.
2477 */
2478
2479 // Log error
2480 PELOGW(limLog(pMac, LOGW,
2481 FL("received unexpected MLM_ASSOC_CNF in state %X for role=%d, MAC addr= "),
2482 psessionEntry->limMlmState,
2483 psessionEntry->limSystemRole);)
2484 limPrintMacAddr(pMac, pMlmAssocReq->peerMacAddr, LOGW);
2485 limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
2486
2487 mlmAssocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2488 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2489
2490 goto end;
2491 }
2492
2493end:
2494 /* Update PE session Id*/
2495 mlmAssocCnf.sessionId = pMlmAssocReq->sessionId;
2496
2497 /// Free up buffer allocated for assocReq
2498 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmAssocReq);
2499
2500 limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
2501} /*** limProcessMlmAssocReq() ***/
2502
2503
2504
2505/**
2506 * limProcessMlmReassocReq()
2507 *
2508 *FUNCTION:
2509 * This function is called to process MLM_REASSOC_REQ message
2510 * from SME
2511 *
2512 *LOGIC:
2513 *
2514 *ASSUMPTIONS:
2515 *
2516 *NOTE:
2517 *
2518 * @param pMac Pointer to Global MAC structure
2519 * @param *pMsgBuf A pointer to the MLM message buffer
2520 * @return None
2521 */
2522
2523static void
2524limProcessMlmReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2525{
Jeff Johnsone7245742012-09-05 17:12:55 -07002526 tANI_U8 chanNum, secChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 struct tLimPreAuthNode *pAuthNode;
2528 tLimMlmReassocReq *pMlmReassocReq;
2529 tLimMlmReassocCnf mlmReassocCnf;
2530 tpPESession psessionEntry;
2531
2532 if(pMsgBuf == NULL)
2533 {
2534 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
2535 return;
2536 }
2537
2538 pMlmReassocReq = (tLimMlmReassocReq *) pMsgBuf;
2539
2540 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmReassocReq->sessionId)) == NULL)
2541 {
2542 PELOGE(limLog(pMac, LOGE,FL("Session Does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002543 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 return;
2545 }
2546
2547 if (((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) &&
2548 (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
2549 {
2550 if (psessionEntry->pLimMlmReassocReq)
2551 palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmReassocReq);
2552
2553 /* Hold Re-Assoc request as part of Session, knock-out pMac */
2554 /// Hold onto Reassoc request parameters
2555 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
2556
2557 // See if we have pre-auth context with new AP
2558 pAuthNode = limSearchPreAuthList(pMac, psessionEntry->limReAssocbssId);
2559
2560 if (!pAuthNode &&
2561 (!palEqualMemory( pMac->hHdd,pMlmReassocReq->peerMacAddr,
2562 psessionEntry->bssId,
2563 sizeof(tSirMacAddr)) ))
2564 {
2565 // Either pre-auth context does not exist AND
2566 // we are not reassociating with currently
2567 // associated AP.
2568 // Return Reassoc confirm with not authenticated
2569 mlmReassocCnf.resultCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2570 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2571
2572 goto end;
2573 }
2574
2575 //assign the sessionId to the timer object
2576 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = pMlmReassocReq->sessionId;
2577
2578 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2579 psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002580 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002581
2582#if 0
2583 // Update BSSID at CFG database
2584 if (wlan_cfgSetStr(pMac, WNI_CFG_BSSID,
2585 pMac->lim.gLimReassocBssId,
2586 sizeof(tSirMacAddr)) != eSIR_SUCCESS)
2587 {
2588 /// Could not update BSSID at CFG. Log error.
2589 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
2590 }
2591#endif //TO SUPPORT BT-AMP
2592
2593 /* Copy Global Reassoc ID*/
2594 // sirCopyMacAddr(psessionEntry->reassocbssId,pMac->lim.gLimReAssocBssId);
2595
2596 /**
2597 * Derive channel from BSS description and
2598 * store it at CFG.
2599 */
2600
2601 chanNum = psessionEntry->limReassocChannelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07002602 secChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -07002603
2604 /* To Support BT-AMP .. read channel number from psessionEntry*/
2605 //chanNum = psessionEntry->currentOperChannel;
2606
2607 // Apply previously set configuration at HW
2608 limApplyConfiguration(pMac,psessionEntry);
2609
2610 //store the channel switch sessionEntry in the lim global var
2611 /* We have already saved the ReAssocreq Pointer abobe */
2612 //psessionEntry->pLimReAssocReq = (void *)pMlmReassocReq;
2613 psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC;
2614
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 /** Switch channel to the new Operating channel for Reassoc*/
2616 limSetChannel(pMac, chanNum, secChannelOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002617
2618 return;
2619 }
2620 else
2621 {
2622 /**
2623 * Received Reassoc request in invalid state or
2624 * in AP role.Return Reassoc confirm with Invalid
2625 * parameters code.
2626 */
2627
2628 // Log error
2629 PELOGW(limLog(pMac, LOGW,
2630 FL("received unexpected MLM_REASSOC_CNF in state %X for role=%d, MAC addr= "),
2631 psessionEntry->limMlmState,
2632 psessionEntry->limSystemRole);)
2633 limPrintMacAddr(pMac, pMlmReassocReq->peerMacAddr,
2634 LOGW);
2635 limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
2636
2637 mlmReassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2638 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2639
2640 goto end;
2641 }
2642
2643end:
2644 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2645 /* Update PE sessio Id*/
2646 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
2647 /// Free up buffer allocated for reassocReq
2648 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
2649 psessionEntry->pLimReAssocReq = NULL;
2650
2651 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2652} /*** limProcessMlmReassocReq() ***/
2653
2654
2655static void
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08002656limProcessMlmDisassocReqNtf(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07002657{
2658 tANI_U16 aid;
2659 tSirMacAddr currentBssId;
2660 tpDphHashNode pStaDs;
2661 tLimMlmDisassocReq *pMlmDisassocReq;
2662 tLimMlmDisassocCnf mlmDisassocCnf;
2663 tpPESession psessionEntry;
2664 extern tANI_BOOLEAN sendDisassocFrame;
2665
2666 if(eHAL_STATUS_SUCCESS != suspendStatus)
2667 {
2668 PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X\n"), suspendStatus);)
2669#if 0
2670 //It can ignore the status and proceed with the disassoc processing.
2671 mlmDisassocCnf.resultCode = eSIR_SME_REFUSED;
2672 goto end;
2673#endif
2674 }
2675
2676 pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf;
2677
2678
2679 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL)
2680 {
2681
2682 PELOGE(limLog(pMac, LOGE,
2683 FL("session does not exist for given sessionId\n"));)
2684 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2685 goto end;
2686 }
2687 #if 0
2688 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
2689 eSIR_SUCCESS)
2690 {
2691 /// Could not get BSSID from CFG. Log error.
2692 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2693 }
2694 #endif //BT-AMP Support
2695 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
2696
2697 switch (psessionEntry->limSystemRole)
2698 {
2699 case eLIM_STA_ROLE:
2700 case eLIM_BT_AMP_STA_ROLE:
2701 if ( !palEqualMemory( pMac->hHdd,pMlmDisassocReq->peerMacAddr,
2702 currentBssId,
2703 sizeof(tSirMacAddr)) )
2704 {
2705 PELOGW(limLog(pMac, LOGW,
2706 FL("received MLM_DISASSOC_REQ with invalid BSS id "));)
2707 limPrintMacAddr(pMac, pMlmDisassocReq->peerMacAddr, LOGW);
2708
2709 /// Prepare and Send LIM_MLM_DISASSOC_CNF
2710
2711 mlmDisassocCnf.resultCode =
2712 eSIR_SME_INVALID_PARAMETERS;
2713
2714 goto end;
2715 }
2716
2717 break;
2718
2719 case eLIM_STA_IN_IBSS_ROLE:
2720
2721 break;
2722
2723 default: // eLIM_AP_ROLE
2724
2725 // Fall through
2726 break;
2727
2728 } // end switch (psessionEntry->limSystemRole)
2729
2730 /**
2731 * Check if there exists a context for the peer entity
2732 * to be disassociated with.
2733 */
2734 pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2735 if ((pStaDs == NULL) ||
2736 (pStaDs &&
2737 ((pStaDs->mlmStaContext.mlmState !=
2738 eLIM_MLM_LINK_ESTABLISHED_STATE) &&
2739 (pStaDs->mlmStaContext.mlmState !=
2740 eLIM_MLM_WT_ASSOC_CNF_STATE) &&
2741 (pStaDs->mlmStaContext.mlmState !=
2742 eLIM_MLM_ASSOCIATED_STATE))))
2743 {
2744 /**
2745 * Received LIM_MLM_DISASSOC_REQ for STA that does not
2746 * have context or in some transit state.
2747 * Log error
2748 */
2749 PELOGW(limLog(pMac, LOGW,
2750 FL("received MLM_DISASSOC_REQ for STA that either has no context or in some transit state, Addr= "));)
2751 limPrintMacAddr(pMac, pMlmDisassocReq->peerMacAddr, LOGW);
2752
2753 /// Prepare and Send LIM_MLM_DISASSOC_CNF
2754
2755 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2756
2757 goto end;
2758 }
2759
2760 //pStaDs->mlmStaContext.rxPurgeReq = 1;
2761 pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)
2762 pMlmDisassocReq->reasonCode;
2763 pStaDs->mlmStaContext.cleanupTrigger = pMlmDisassocReq->disassocTrigger;
2764
2765 /// Send Disassociate frame to peer entity
Jeff Johnsone7245742012-09-05 17:12:55 -07002766 if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 {
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08002768 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = pMlmDisassocReq;
Madan Mohan Koyyalamudicdcb58f2012-11-28 01:40:44 +05302769 /* Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE
2770 * This is to address the issue of race condition between
2771 * disconnect request from the HDD and deauth from AP
2772 */
2773 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE;
2774
2775 limSendDisassocMgmtFrame(pMac,
2776 pMlmDisassocReq->reasonCode,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08002777 pMlmDisassocReq->peerMacAddr,
2778 psessionEntry, TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 }
2780 else
2781 {
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08002782 /* Disassoc frame is not sent OTA */
2783 sendDisassocFrame = 1;
2784 // Receive path cleanup with dummy packet
2785 if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs,psessionEntry))
2786 {
2787 mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2788 goto end;
2789 }
2790 // Free up buffer allocated for mlmDisassocReq
2791 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 }
2793
Jeff Johnson295189b2012-06-20 16:38:30 -07002794 return;
2795
2796end:
2797 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
2798 (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
2799 sizeof(tSirMacAddr));
2800 mlmDisassocCnf.aid = pMlmDisassocReq->aid;
2801 mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
2802
2803 /* Update PE session ID*/
2804 mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
2805
2806 /// Free up buffer allocated for mlmDisassocReq
2807 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDisassocReq);
2808
2809 limPostSmeMessage(pMac,
2810 LIM_MLM_DISASSOC_CNF,
2811 (tANI_U32 *) &mlmDisassocCnf);
2812}
2813
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08002814void limProcessDisassocAckTimeout(tpAniSirGlobal pMac)
2815{
2816 limSendDisassocCnf(pMac);
2817}
2818
Jeff Johnson295189b2012-06-20 16:38:30 -07002819/**
2820 * limProcessMlmDisassocReq()
2821 *
2822 *FUNCTION:
2823 * This function is called to process MLM_DISASSOC_REQ message
2824 * from SME
2825 *
2826 *LOGIC:
2827 *
2828 *ASSUMPTIONS:
2829 *
2830 *NOTE:
2831 *
2832 * @param pMac Pointer to Global MAC structure
2833 * @param *pMsgBuf A pointer to the MLM message buffer
2834 * @return None
2835 */
2836
2837static void
2838limProcessMlmDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2839{
2840// tANI_U16 aid;
2841// tSirMacAddr currentBssId;
2842// tpDphHashNode pStaDs;
2843 tLimMlmDisassocReq *pMlmDisassocReq;
2844// tLimMlmDisassocCnf mlmDisassocCnf;
2845 tpPESession psessionEntry;
2846// extern tANI_BOOLEAN sendDisassocFrame;
2847
2848 if(pMsgBuf == NULL)
2849 {
2850 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
2851 return;
2852 }
2853
2854 pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf;
2855
2856 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL)
2857 {
2858
2859 PELOGE(limLog(pMac, LOGE,
2860 FL("session does not exist for given sessionId\n"));)
2861 return;
2862 }
2863
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08002864 limProcessMlmDisassocReqNtf( pMac, eHAL_STATUS_SUCCESS, (tANI_U32*) pMsgBuf );
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08002865
Jeff Johnson295189b2012-06-20 16:38:30 -07002866} /*** limProcessMlmDisassocReq() ***/
2867
2868static void
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08002869limProcessMlmDeauthReqNtf(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07002870{
2871 tANI_U16 aid;
2872 tSirMacAddr currentBssId;
2873 tpDphHashNode pStaDs;
2874 struct tLimPreAuthNode *pAuthNode;
2875 tLimMlmDeauthReq *pMlmDeauthReq;
2876 tLimMlmDeauthCnf mlmDeauthCnf;
2877 tpPESession psessionEntry;
2878
2879
2880 if(eHAL_STATUS_SUCCESS != suspendStatus)
2881 {
2882 PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X\n"), suspendStatus);)
2883#if 0
2884 //It can ignore the status and proceed with the disassoc processing.
2885 mlmDisassocCnf.resultCode = eSIR_SME_REFUSED;
2886 goto end;
2887#endif
2888 }
2889
2890 pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf;
2891
2892 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL)
2893 {
2894
2895 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002896 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002897 return;
2898 }
2899 #if 0
2900 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
2901 eSIR_SUCCESS)
2902 {
2903 /// Could not get BSSID from CFG. Log error.
2904 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2905 }
2906 #endif //SUPPORT BT-AMP
2907 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
2908
2909 switch (psessionEntry->limSystemRole)
2910 {
2911 case eLIM_STA_ROLE:
2912 case eLIM_BT_AMP_STA_ROLE:
2913 switch (psessionEntry->limMlmState)
2914 {
2915 case eLIM_MLM_IDLE_STATE:
2916 // Attempting to Deauthenticate
2917 // with a pre-authenticated peer.
2918 // Deauthetiate with peer if there
2919 // exists a pre-auth context below.
2920 break;
2921
2922 case eLIM_MLM_AUTHENTICATED_STATE:
2923 case eLIM_MLM_WT_ASSOC_RSP_STATE:
2924 case eLIM_MLM_LINK_ESTABLISHED_STATE:
2925 if (!palEqualMemory( pMac->hHdd,pMlmDeauthReq->peerMacAddr,
2926 currentBssId,
2927 sizeof(tSirMacAddr)) )
2928 {
2929 PELOGW(limLog(pMac, LOGW,
2930 FL("received MLM_DEAUTH_REQ with invalid BSS id "));)
2931 PELOGE(limLog(pMac, LOGE, FL("Peer MAC Addr : "));)
2932 limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr,LOGE);
2933
2934 PELOGE(limLog(pMac, LOGE, FL("\n CFG BSSID Addr : "));)
2935 limPrintMacAddr(pMac, currentBssId,LOGE);
2936
2937 /// Prepare and Send LIM_MLM_DEAUTH_CNF
2938
2939 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
2940
2941 goto end;
2942 }
2943
2944 if ((psessionEntry->limMlmState ==
2945 eLIM_MLM_AUTHENTICATED_STATE) ||
2946 (psessionEntry->limMlmState ==
2947 eLIM_MLM_WT_ASSOC_RSP_STATE))
2948 {
2949 // Send Deauthentication frame
2950 // to peer entity
2951 limSendDeauthMgmtFrame(
2952 pMac,
2953 pMlmDeauthReq->reasonCode,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08002954 pMlmDeauthReq->peerMacAddr,
2955 psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002956
2957 /// Prepare and Send LIM_MLM_DEAUTH_CNF
2958 mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
2959 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002960 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002961 goto end;
2962 }
2963 else
2964 {
2965 // LINK_ESTABLISED_STATE
2966 // Cleanup RX & TX paths
2967 // below
2968 }
2969
2970 break;
2971
2972 default:
2973
2974 PELOGW(limLog(pMac, LOGW,
2975 FL("received MLM_DEAUTH_REQ with in state %d for peer "),
2976 psessionEntry->limMlmState);)
2977 limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
2978 limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
2979
2980 /// Prepare and Send LIM_MLM_DEAUTH_CNF
2981 mlmDeauthCnf.resultCode =
2982 eSIR_SME_STA_NOT_AUTHENTICATED;
2983
2984 goto end;
2985 }
2986
2987 break;
2988
2989 case eLIM_STA_IN_IBSS_ROLE:
Jeff Johnsone7245742012-09-05 17:12:55 -07002990 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002991
2992 return;
2993
2994 default: // eLIM_AP_ROLE
2995 break;
2996
2997 } // end switch (psessionEntry->limSystemRole)
2998
2999 /**
3000 * Check if there exists a context for the peer entity
3001 * to be deauthenticated with.
3002 */
3003 pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
3004
3005 if (pStaDs == NULL)
3006 {
3007 /// Check if there exists pre-auth context for this STA
3008 pAuthNode = limSearchPreAuthList(pMac,
3009 pMlmDeauthReq->peerMacAddr);
3010
3011 if (pAuthNode == NULL)
3012 {
3013 /**
3014 * Received DEAUTH REQ for a STA that is neither
3015 * Associated nor Pre-authenticated. Log error,
3016 * Prepare and Send LIM_MLM_DEAUTH_CNF
3017 */
3018 PELOGW(limLog(pMac, LOGW,
3019 FL("received MLM_DEAUTH_REQ for STA that does not have context, Addr="));)
3020 limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
3021
3022 mlmDeauthCnf.resultCode =
3023 eSIR_SME_STA_NOT_AUTHENTICATED;
3024 }
3025 else
3026 {
3027 mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS;
3028
3029 /// Delete STA from pre-auth STA list
3030 limDeletePreAuthNode(pMac, pMlmDeauthReq->peerMacAddr);
3031
3032 /// Send Deauthentication frame to peer entity
3033 limSendDeauthMgmtFrame(pMac,
3034 pMlmDeauthReq->reasonCode,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003035 pMlmDeauthReq->peerMacAddr,
3036 psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 }
3038
3039 goto end;
3040 }
3041 else if ((pStaDs->mlmStaContext.mlmState !=
3042 eLIM_MLM_LINK_ESTABLISHED_STATE) &&
3043 (pStaDs->mlmStaContext.mlmState !=
3044 eLIM_MLM_WT_ASSOC_CNF_STATE))
3045 {
3046 /**
3047 * Received LIM_MLM_DEAUTH_REQ for STA that is n
3048 * some transit state. Log error.
3049 */
3050 PELOGW(limLog(pMac, LOGW,
3051 FL("received MLM_DEAUTH_REQ for STA that either has no context or in some transit state, Addr="));)
3052 limPrintMacAddr(pMac, pMlmDeauthReq->peerMacAddr, LOGW);
3053
3054 /// Prepare and Send LIM_MLM_DEAUTH_CNF
3055
3056 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3057
3058 goto end;
3059 }
3060
3061 //pStaDs->mlmStaContext.rxPurgeReq = 1;
3062 pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes)
3063 pMlmDeauthReq->reasonCode;
3064 pStaDs->mlmStaContext.cleanupTrigger = pMlmDeauthReq->deauthTrigger;
3065
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003066 pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = pMlmDeauthReq;
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 /// Send Deauthentication frame to peer entity
3068 limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003069 pMlmDeauthReq->peerMacAddr,
3070 psessionEntry, TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003071
3072 return;
3073
3074end:
3075 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
3076 (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
3077 sizeof(tSirMacAddr));
3078 mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
3079 mlmDeauthCnf.aid = pMlmDeauthReq->aid;
3080 mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
3081
3082 // Free up buffer allocated
3083 // for mlmDeauthReq
3084 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmDeauthReq);
3085
3086 limPostSmeMessage(pMac,
3087 LIM_MLM_DEAUTH_CNF,
3088 (tANI_U32 *) &mlmDeauthCnf);
3089
3090}
3091
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003092
3093void limProcessDeauthAckTimeout(tpAniSirGlobal pMac)
3094{
3095 limSendDeauthCnf(pMac);
3096}
3097
Jeff Johnson295189b2012-06-20 16:38:30 -07003098/**
3099 * limProcessMlmDeauthReq()
3100 *
3101 *FUNCTION:
3102 * This function is called to process MLM_DEAUTH_REQ message
3103 * from SME
3104 *
3105 *LOGIC:
3106 *
3107 *ASSUMPTIONS:
3108 *
3109 *NOTE:
3110 *
3111 * @param pMac Pointer to Global MAC structure
3112 * @param *pMsgBuf A pointer to the MLM message buffer
3113 * @return None
3114 */
3115
3116static void
3117limProcessMlmDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3118{
3119// tANI_U16 aid;
3120// tSirMacAddr currentBssId;
3121// tpDphHashNode pStaDs;
3122// struct tLimPreAuthNode *pAuthNode;
3123 tLimMlmDeauthReq *pMlmDeauthReq;
3124// tLimMlmDeauthCnf mlmDeauthCnf;
3125 tpPESession psessionEntry;
3126
3127 if(pMsgBuf == NULL)
3128 {
3129 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
3130 return;
3131 }
3132
3133 pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf;
3134
3135 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL)
3136 {
3137
3138 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
3139 return;
3140 }
3141
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08003142 limProcessMlmDeauthReqNtf( pMac, eHAL_STATUS_SUCCESS, (tANI_U32*) pMsgBuf );
3143
Jeff Johnson295189b2012-06-20 16:38:30 -07003144} /*** limProcessMlmDeauthReq() ***/
3145
3146
3147
3148/**
3149 * @function : limProcessMlmSetKeysReq()
3150 *
3151 * @brief : This function is called to process MLM_SETKEYS_REQ message
3152 * from SME
3153 *
3154 *LOGIC:
3155 *
3156 *ASSUMPTIONS:
3157 *
3158 *NOTE:
3159 *
3160 * @param pMac Pointer to Global MAC structure
3161 * @param *pMsgBuf A pointer to the MLM message buffer
3162 * @return None
3163 */
3164
3165static void
3166limProcessMlmSetKeysReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3167{
3168tANI_U16 aid;
3169tANI_U16 staIdx = 0;
3170tANI_U32 defaultKeyId = 0;
3171tSirMacAddr currentBssId;
3172tpDphHashNode pStaDs;
3173tLimMlmSetKeysReq *pMlmSetKeysReq;
3174tLimMlmSetKeysCnf mlmSetKeysCnf;
3175tpPESession psessionEntry;
3176
3177 if(pMsgBuf == NULL)
3178 {
3179 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
3180 return;
3181 }
3182
3183
3184 pMlmSetKeysReq = (tLimMlmSetKeysReq *) pMsgBuf;
3185 // Hold onto the SetKeys request parameters
3186 pMac->lim.gpLimMlmSetKeysReq = (void *) pMlmSetKeysReq;
3187
3188 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmSetKeysReq->sessionId))== NULL)
3189 {
3190 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
3191 return;
3192 }
3193
3194 limLog( pMac, LOGW,
3195 FL( "Received MLM_SETKEYS_REQ with parameters:\n"
3196 "AID [%d], ED Type [%d], # Keys [%d] & Peer MAC Addr - "),
3197 pMlmSetKeysReq->aid,
3198 pMlmSetKeysReq->edType,
3199 pMlmSetKeysReq->numKeys );
3200 limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
3201
3202 #if 0
3203 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, currentBssId, &cfg )) {
3204 limLog( pMac, LOGP, FL("Could not retrieve BSSID\n"));
3205 return;
3206 }
3207 #endif //TO SUPPORT BT-AMP
3208 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
3209
3210 switch( psessionEntry->limSystemRole ) {
3211 case eLIM_STA_ROLE:
3212 case eLIM_BT_AMP_STA_ROLE:
3213 if((!limIsAddrBC( pMlmSetKeysReq->peerMacAddr ) ) &&
3214 (!palEqualMemory( pMac->hHdd,pMlmSetKeysReq->peerMacAddr,
3215 currentBssId, sizeof(tSirMacAddr))) ){
3216 limLog( pMac, LOGW, FL("Received MLM_SETKEYS_REQ with invalid BSSID\n"));
3217 limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
3218
3219 // Prepare and Send LIM_MLM_SETKEYS_CNF with error code
3220 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3221 goto end;
3222 }
3223 // Fall thru' & 'Plumb' keys below
3224 break;
3225 case eLIM_STA_IN_IBSS_ROLE:
3226 default: // others
3227 // Fall thru...
3228 break;
3229 }
3230
3231 /**
3232 * Use the "unicast" parameter to determine if the "Group Keys"
3233 * are being set.
3234 * pMlmSetKeysReq->key.unicast = 0 -> Multicast/broadcast
3235 * pMlmSetKeysReq->key.unicast - 1 -> Unicast keys are being set
3236 */
3237 if( limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
3238 limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"), pMlmSetKeysReq->sessionId);
3239 /** When trying to set Group Keys for any
3240 * security mode other than WEP, use the
3241 * STA Index corresponding to the AP...
3242 */
3243 switch( pMlmSetKeysReq->edType ) {
3244 case eSIR_ED_CCMP:
3245
3246#ifdef WLAN_FEATURE_11W
3247 case eSIR_ED_AES_128_CMAC:
3248#endif
3249 staIdx = psessionEntry->staId;
3250 break;
3251
3252 default:
3253 break;
3254 }
3255 }else {
3256 limLog( pMac, LOG1, FL("Trying to set Unicast Keys...\n"));
3257 /**
3258 * Check if there exists a context for the
3259 * peer entity for which keys need to be set.
3260 */
3261
3262
3263 pStaDs = dphLookupHashEntry( pMac, pMlmSetKeysReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable);
3264
3265#ifdef WLAN_SOFTAP_FEATURE
3266 if ((pStaDs == NULL) ||
3267 ((pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) && (psessionEntry->limSystemRole != eLIM_AP_ROLE))) {
3268#else
3269 if ((pStaDs == NULL) ||
3270 ((pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) )) {
3271#endif
3272 /**
3273 * Received LIM_MLM_SETKEYS_REQ for STA
3274 * that does not have context or in some
3275 * transit state. Log error.
3276 */
3277 limLog( pMac, LOG1,
3278 FL("Received MLM_SETKEYS_REQ for STA that either has no context or in some transit state, Addr = "));
3279 limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW );
3280
3281 // Prepare and Send LIM_MLM_SETKEYS_CNF
3282 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3283 goto end;
3284 } else
3285 staIdx = pStaDs->staIndex;
3286 }
3287
3288 if ((pMlmSetKeysReq->numKeys == 0) && (pMlmSetKeysReq->edType != eSIR_ED_NONE)) {
Jeff Johnsone7245742012-09-05 17:12:55 -07003289 //
3290 // Broadcast/Multicast Keys (for WEP!!) are NOT sent
3291 // via this interface!!
3292 //
3293 // This indicates to HAL that the WEP Keys need to be
3294 // extracted from the CFG and applied to hardware
3295 defaultKeyId = 0xff;
3296 }else if(pMlmSetKeysReq->key[0].keyId &&
3297 ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) ||
3298 (pMlmSetKeysReq->edType == eSIR_ED_WEP104))){
3299 /* If the Key Id is non zero and encryption mode is WEP,
3300 * the key index is coming from the upper layers so that key only
3301 * need to be used as the default tx key, This is being used only
3302 * in case of WEP mode in HAL */
3303 defaultKeyId = pMlmSetKeysReq->key[0].keyId;
3304 }else
3305 defaultKeyId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003306
3307 limLog( pMac, LOG1,
3308 FL( "Trying to set keys for STA Index [%d], using defaultKeyId [%d]\n" ),
3309 staIdx,
3310 defaultKeyId );
3311
3312 if(limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) {
3313 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
3314 psessionEntry->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003315 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 limLog( pMac, LOG1, FL("Trying to set Group Keys...%d \n"),
3317 psessionEntry->peSessionId);
3318
3319 // Package WDA_SET_BSSKEY_REQ message parameters
3320 limSendSetBssKeyReq(pMac, pMlmSetKeysReq,psessionEntry);
3321 return;
3322 }else {
3323 // Package WDA_SET_STAKEY_REQ / WDA_SET_STA_BCASTKEY_REQ message parameters
3324 limSendSetStaKeyReq(pMac, pMlmSetKeysReq, staIdx, (tANI_U8) defaultKeyId,psessionEntry);
3325 return;
3326 }
3327
3328end:
3329 mlmSetKeysCnf.sessionId= pMlmSetKeysReq->sessionId;
3330 limPostSmeSetKeysCnf( pMac, pMlmSetKeysReq, &mlmSetKeysCnf );
3331
3332} /*** limProcessMlmSetKeysReq() ***/
3333
3334/**
3335 * limProcessMlmRemoveKeyReq()
3336 *
3337 *FUNCTION:
3338 * This function is called to process MLM_REMOVEKEY_REQ message
3339 * from SME
3340 *
3341 *LOGIC:
3342 *
3343 *ASSUMPTIONS:
3344 *
3345 *NOTE:
3346 *
3347 * @param pMac Pointer to Global MAC structure
3348 * @param *pMsgBuf A pointer to the MLM message buffer
3349 * @return None
3350 */
3351
3352static void
3353limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3354{
3355tANI_U16 aid;
3356tANI_U16 staIdx = 0;
3357tSirMacAddr currentBssId;
3358tpDphHashNode pStaDs;
3359tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3360tLimMlmRemoveKeyCnf mlmRemoveKeyCnf;
3361 tpPESession psessionEntry;
3362
3363 if(pMsgBuf == NULL)
3364 {
3365 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
3366 return;
3367 }
3368
3369 pMlmRemoveKeyReq = (tLimMlmRemoveKeyReq *) pMsgBuf;
3370
3371
3372 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyReq->sessionId))== NULL)
3373 {
3374 PELOGE(limLog(pMac, LOGE,
3375 FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003376 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 return;
3378 }
3379
3380
3381 if( pMac->lim.gpLimMlmRemoveKeyReq != NULL )
3382 {
3383 // Free any previous requests.
3384 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
3385 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3386 }
3387 // Hold onto the RemoveKeys request parameters
3388 pMac->lim.gpLimMlmRemoveKeyReq = (void *) pMlmRemoveKeyReq;
3389
3390 #if 0
3391 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
3392 WNI_CFG_BSSID,
3393 currentBssId,
3394 &cfg ))
3395 limLog( pMac, LOGP, FL("Could not retrieve BSSID\n"));
3396 #endif //TO-SUPPORT BT-AMP
3397 sirCopyMacAddr(currentBssId,psessionEntry->bssId);
3398
3399 switch( psessionEntry->limSystemRole )
3400 {
3401 case eLIM_STA_ROLE:
3402 case eLIM_BT_AMP_STA_ROLE:
3403 if(( limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr ) != true ) &&
3404 (!palEqualMemory( pMac->hHdd,pMlmRemoveKeyReq->peerMacAddr,
3405 currentBssId,
3406 sizeof(tSirMacAddr))))
3407 {
3408 limLog( pMac, LOGW,
3409 FL("Received MLM_REMOVEKEY_REQ with invalid BSSID\n"));
3410 limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW );
3411
3412 // Prepare and Send LIM_MLM_REMOVEKEY_CNF with error code
3413 mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3414 goto end;
3415 }
3416 break;
3417
3418 case eLIM_STA_IN_IBSS_ROLE:
3419 default: // eLIM_AP_ROLE
3420 // Fall thru...
3421 break;
3422 }
3423
3424
3425 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
3426 if(limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr )) //Second condition for IBSS or AP role.
3427 {
3428 psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_BSS_KEY_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003429 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 // Package WDA_REMOVE_BSSKEY_REQ message parameters
3431 limSendRemoveBssKeyReq( pMac,pMlmRemoveKeyReq,psessionEntry);
3432 return;
3433 }
3434
3435 /**
3436 * Check if there exists a context for the
3437 * peer entity for which keys need to be removed.
3438 */
3439 pStaDs = dphLookupHashEntry( pMac, pMlmRemoveKeyReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
3440 if ((pStaDs == NULL) ||
3441 (pStaDs &&
3442 (pStaDs->mlmStaContext.mlmState !=
3443 eLIM_MLM_LINK_ESTABLISHED_STATE)))
3444 {
3445 /**
3446 * Received LIM_MLM_REMOVEKEY_REQ for STA
3447 * that does not have context or in some
3448 * transit state. Log error.
3449 */
3450 limLog( pMac, LOGW,
3451 FL("Received MLM_REMOVEKEYS_REQ for STA that either has no context or in some transit state, Addr = "));
3452 limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW );
3453
3454 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3455 mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
3456 mlmRemoveKeyCnf.sessionId = pMlmRemoveKeyReq->sessionId;
3457
3458
3459 goto end;
3460 }
3461 else
3462 staIdx = pStaDs->staIndex;
3463
3464
3465
3466 psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_STA_KEY_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003467 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003468
3469 // Package WDA_REMOVE_STAKEY_REQ message parameters
3470 limSendRemoveStaKeyReq( pMac,pMlmRemoveKeyReq,staIdx,psessionEntry);
3471 return;
3472
3473end:
3474 limPostSmeRemoveKeyCnf( pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07003475 psessionEntry,
Jeff Johnson295189b2012-06-20 16:38:30 -07003476 pMlmRemoveKeyReq,
3477 &mlmRemoveKeyCnf );
3478
3479} /*** limProcessMlmRemoveKeyReq() ***/
3480
3481
3482/**
3483 * limProcessMinChannelTimeout()
3484 *
3485 *FUNCTION:
3486 * This function is called to process Min Channel Timeout
3487 * during channel scan.
3488 *
3489 *LOGIC:
3490 *
3491 *ASSUMPTIONS:
3492 *
3493 *NOTE:
3494 *
3495 * @param pMac Pointer to Global MAC structure
3496 * @return None
3497 */
3498
3499static void
3500limProcessMinChannelTimeout(tpAniSirGlobal pMac)
3501{
3502 tANI_U8 channelNum;
3503
3504#ifdef GEN6_TODO
3505 //if the min Channel is maintained per session, then use the below seesionEntry
3506 //priority - LOW/might not be needed
3507
3508 //TBD-RAJESH HOW TO GET sessionEntry?????
3509 tpPESession psessionEntry;
3510
3511 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimMinChannelTimer.sessionId))== NULL)
3512 {
3513 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
3514 return;
3515 }
3516#endif
3517
3518
3519 if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE)
3520 {
3521 PELOG1(limLog(pMac, LOG1, FL("Scanning : min channel timeout occurred\n"));)
3522
3523 /// Min channel timer timed out
3524 pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff;
3525 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3526 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER);
3527 if (pMac->lim.gLimCurrentScanChannelId <=
3528 (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
3529 {
3530 channelNum = (tANI_U8)limGetCurrentScanChannel(pMac);
3531 }
3532 else
3533 {
3534 // This shouldn't be the case, but when this happens, this timeout should be for the last channelId.
3535 // Get the channelNum as close to correct as possible.
3536 if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber)
3537 {
3538 channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1];
3539 }
3540 else
3541 {
3542 channelNum = 1;
3543 }
3544 }
3545
3546 limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
3547 }
3548 else
3549 {
3550 /**
3551 * MIN channel timer should not have timed out
3552 * in states other than wait_probe_response.
3553 * Log error.
3554 */
3555 limLog(pMac, LOGW,
3556 FL("received unexpected MIN channel timeout in state %X\n"),
3557 pMac->lim.gLimMlmState);
3558 limPrintMlmState(pMac, LOGE, pMac->lim.gLimMlmState);
3559 }
3560} /*** limProcessMinChannelTimeout() ***/
3561
3562
3563
3564/**
3565 * limProcessMaxChannelTimeout()
3566 *
3567 *FUNCTION:
3568 * This function is called to process Max Channel Timeout
3569 * during channel scan.
3570 *
3571 *LOGIC:
3572 *
3573 *ASSUMPTIONS:
3574 *
3575 *NOTE:
3576 *
3577 * @param pMac Pointer to Global MAC structure
3578 * @return None
3579 */
3580
3581static void
3582limProcessMaxChannelTimeout(tpAniSirGlobal pMac)
3583{
3584 tANI_U8 channelNum;
3585
3586
3587 if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE ||
3588 pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE)
3589 {
3590 PELOG1(limLog(pMac, LOG1, FL("Scanning : Max channel timed out\n"));)
3591 /**
3592 * MAX channel timer timed out
3593 * Continue channel scan.
3594 */
3595 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3596 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER);
3597 pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff;
3598 if (pMac->lim.gLimCurrentScanChannelId <=
3599 (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))
3600 {
3601 channelNum = limGetCurrentScanChannel(pMac);
3602 }
3603 else
3604 {
3605 if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber)
3606 {
3607 channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1];
3608 }
3609 else
3610 {
3611 channelNum = 1;
3612 }
3613 }
3614 limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE);
3615 }
3616 else
3617 {
3618 /**
3619 * MAX channel timer should not have timed out
3620 * in states other than wait_scan.
3621 * Log error.
3622 */
3623 limLog(pMac, LOGW,
3624 FL("received unexpected MAX channel timeout in state %X\n"),
3625 pMac->lim.gLimMlmState);
3626 limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState);
3627 }
3628} /*** limProcessMaxChannelTimeout() ***/
3629
3630/**
3631 * limProcessPeriodicProbeReqTimer()
3632 *
3633 *FUNCTION:
3634 * This function is called to process periodic probe request
3635 * to send during scan.
3636 *
3637 *LOGIC:
3638 *
3639 *ASSUMPTIONS:
3640 *
3641 *NOTE:
3642 *
3643 * @param pMac Pointer to Global MAC structure
3644 * @return None
3645 */
3646
3647static void
3648limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac)
3649{
3650 tANI_U8 channelNum;
3651 tANI_U8 i = 0;
3652 tSirRetStatus status = eSIR_SUCCESS;
3653 TX_TIMER *pPeriodicProbeReqTimer;
3654 pPeriodicProbeReqTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer;
3655
3656 if(vos_timer_getCurrentState(&pPeriodicProbeReqTimer->vosTimer)
3657 != VOS_TIMER_STATE_STOPPED)
3658 {
3659 PELOG1(limLog(pMac, LOG1, FL("Invalid state of timer\n"));)
3660 return;
3661 }
3662
3663 if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) &&
3664 (pPeriodicProbeReqTimer->sessionId != 0xff))
3665 {
3666 tLimMlmScanReq *pLimMlmScanReq = pMac->lim.gpLimMlmScanReq;
3667 PELOG1(limLog(pMac, LOG1, FL("Scanning : Periodic scanning\n"));)
3668 /**
3669 * Periodic channel timer timed out
3670 * to send probe request.
3671 */
3672 channelNum = limGetCurrentScanChannel(pMac);
3673 do
3674 {
3675 /* Prepare and send Probe Request frame for all the SSIDs
3676 * present in the saved MLM
3677 */
3678
3679 /*
3680 * PELOGE(limLog(pMac, LOGW, FL("sending ProbeReq number %d,"
3681 * " for SSID %s on channel: %d\n"),
3682 * i, pLimMlmScanReq->ssId[i].ssId,
3683 * channelNum);)
3684 */
3685 status = limSendProbeReqMgmtFrame( pMac, &pLimMlmScanReq->ssId[i],
3686 pLimMlmScanReq->bssId, channelNum, pMac->lim.gSelfMacAddr,
3687 pLimMlmScanReq->dot11mode, pLimMlmScanReq->uIEFieldLen,
3688 (tANI_U8 *)(pLimMlmScanReq) + pLimMlmScanReq->uIEFieldOffset);
3689
3690
3691 if ( status != eSIR_SUCCESS)
3692 {
3693 PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID "
3694 "%s on channel: %d\n"),
3695 pLimMlmScanReq->ssId[i].ssId,
3696 channelNum);)
3697 return;
3698 }
3699 i++;
3700 } while (i < pLimMlmScanReq->numSsid);
3701
3702 /* Activate timer again */
3703 if (tx_timer_activate(pPeriodicProbeReqTimer) != TX_SUCCESS)
3704 {
3705 limLog(pMac, LOGP, FL("could not start periodic probe"
3706 " req timer\n"));
3707 return;
3708 }
3709 }
3710 else
3711 {
3712 /**
3713 * Periodic scan is timeout is happening in
3714 * in states other than wait_scan.
3715 * Log error.
3716 */
Mohit Khanna23863762012-09-11 17:40:09 -07003717 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 FL("received unexpected Periodic scan timeout in state %X\n"),
3719 pMac->lim.gLimMlmState);
3720 }
3721} /*** limProcessPeriodicProbeReqTimer() ***/
3722
3723/**
3724 * limProcessJoinFailureTimeout()
3725 *
3726 *FUNCTION:
3727 * This function is called to process JoinFailureTimeout
3728 *
3729 *LOGIC:
3730 *
3731 *ASSUMPTIONS:
3732 *
3733 *NOTE:
3734 *
3735 * @param pMac Pointer to Global MAC structure
3736 * @return None
3737 */
3738
3739static void
3740limProcessJoinFailureTimeout(tpAniSirGlobal pMac)
3741{
3742 tLimMlmJoinCnf mlmJoinCnf;
3743 tSirMacAddr bssid;
3744 tANI_U32 len;
3745
3746 //fetch the sessionEntry based on the sessionId
3747 tpPESession psessionEntry;
3748
3749 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimJoinFailureTimer.sessionId))== NULL)
3750 {
3751 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
3752 return;
3753 }
3754
3755 if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)
3756 {
3757 len = sizeof(tSirMacAddr);
3758
3759 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, bssid, &len) !=
3760 eSIR_SUCCESS)
3761 {
3762 /// Could not get BSSID from CFG. Log error.
3763 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
3764 return;
3765 }
3766
3767 // 'Change' timer for future activations
3768 limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER);
3769
3770 /**
3771 * Issue MLM join confirm with timeout reason code
3772 */
3773 PELOGE(limLog(pMac, LOGE, FL(" Join Failure Timeout occurred.\n"));)
3774
3775 mlmJoinCnf.resultCode = eSIR_SME_JOIN_TIMEOUT_RESULT_CODE;
3776 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3777
3778 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003779 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
3781 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3782 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
3783 /* Update PE session Id */
3784 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3785
3786
3787 // Freeup buffer allocated to join request
3788 if (psessionEntry->pLimMlmJoinReq)
3789 {
3790 palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
3791 psessionEntry->pLimMlmJoinReq = NULL;
3792 }
3793
3794 limPostSmeMessage(pMac,
3795 LIM_MLM_JOIN_CNF,
3796 (tANI_U32 *) &mlmJoinCnf);
3797
3798 return;
3799 }
3800 else
3801 {
3802 /**
3803 * Join failure timer should not have timed out
3804 * in states other than wait_join_beacon state.
3805 * Log error.
3806 */
3807 limLog(pMac, LOGW,
3808 FL("received unexpected JOIN failure timeout in state %X\n"),psessionEntry->limMlmState);
3809 limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
3810 }
3811} /*** limProcessJoinFailureTimeout() ***/
3812
3813
3814
3815/**
3816 * limProcessAuthFailureTimeout()
3817 *
3818 *FUNCTION:
3819 * This function is called to process Min Channel Timeout
3820 * during channel scan.
3821 *
3822 *LOGIC:
3823 *
3824 *ASSUMPTIONS:
3825 *
3826 *NOTE:
3827 *
3828 * @param pMac Pointer to Global MAC structure
3829 * @return None
3830 */
3831
3832static void
3833limProcessAuthFailureTimeout(tpAniSirGlobal pMac)
3834{
3835 //fetch the sessionEntry based on the sessionId
3836 tpPESession psessionEntry;
3837
3838 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAuthFailureTimer.sessionId))== NULL)
3839 {
3840 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
3841 return;
3842 }
3843
3844 switch (psessionEntry->limMlmState)
3845 {
3846 case eLIM_MLM_WT_AUTH_FRAME2_STATE:
3847 case eLIM_MLM_WT_AUTH_FRAME4_STATE:
3848 /**
3849 * Requesting STA did not receive next auth frame
3850 * before Auth Failure timeout.
3851 * Issue MLM auth confirm with timeout reason code
3852 */
3853
3854
3855 limRestoreFromAuthState(pMac,eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry);
3856 break;
3857
3858 default:
3859 /**
3860 * Auth failure timer should not have timed out
3861 * in states other than wt_auth_frame2/4
3862 * Log error.
3863 */
3864 PELOGE(limLog(pMac, LOGE, FL("received unexpected AUTH failure timeout in state %X\n"), psessionEntry->limMlmState);)
3865 limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState);
3866
3867 break;
3868 }
3869} /*** limProcessAuthFailureTimeout() ***/
3870
3871
3872
3873/**
3874 * limProcessAuthRspTimeout()
3875 *
3876 *FUNCTION:
3877 * This function is called to process Min Channel Timeout
3878 * during channel scan.
3879 *
3880 *LOGIC:
3881 *
3882 *ASSUMPTIONS:
3883 *
3884 *NOTE:
3885 *
3886 * @param pMac Pointer to Global MAC structure
3887 * @return None
3888 */
3889
3890static void
3891limProcessAuthRspTimeout(tpAniSirGlobal pMac, tANI_U32 authIndex)
3892{
3893 struct tLimPreAuthNode *pAuthNode;
3894 tpPESession psessionEntry;
3895 tANI_U8 sessionId;
3896
3897 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, authIndex);
3898
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303899 if (NULL == pAuthNode)
3900 {
3901 limLog(pMac, LOGW, FL("Invalid auth node\n"));
3902 return;
3903 }
3904
3905 if ((psessionEntry = peFindSessionByBssid(pMac, pAuthNode->peerMacAddr, &sessionId)) == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 {
3907 limLog(pMac, LOGW, FL("session does not exist for given BSSID \n"));
3908 return;
3909 }
3910
3911 if (psessionEntry->limSystemRole == eLIM_AP_ROLE ||
3912 psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
3913 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303914 if (pAuthNode->mlmState != eLIM_MLM_WT_AUTH_FRAME3_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 {
3916 /**
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303917 * Authentication response timer timedout
3918 * in unexpected state. Log error
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 */
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303920 PELOGE(limLog(pMac, LOGE,
3921 FL("received unexpected AUTH rsp timeout for MAC address "));
3922 limPrintMacAddr(pMac, pAuthNode->peerMacAddr, LOGE);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003923 }
3924 else
3925 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303926 // Authentication response timer
3927 // timedout for an STA.
3928 pAuthNode->mlmState = eLIM_MLM_AUTH_RSP_TIMEOUT_STATE;
3929 pAuthNode->fTimerStarted = 0;
3930 PELOG1( limLog(pMac, LOG1,
3931 FL("AUTH rsp timedout for MAC address "));
3932 limPrintMacAddr(pMac, pAuthNode->peerMacAddr, LOG1);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003933
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303934 // Change timer to reactivate it in future
3935 limDeactivateAndChangePerStaIdTimer(pMac,
3936 eLIM_AUTH_RSP_TIMER,
3937 pAuthNode->authNodeIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07003938
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05303939 limDeletePreAuthNode(pMac, pAuthNode->peerMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 }
3941 }
3942} /*** limProcessAuthRspTimeout() ***/
3943
3944
3945/**
3946 * limProcessAssocFailureTimeout()
3947 *
3948 *FUNCTION:
3949 * This function is called to process Min Channel Timeout
3950 * during channel scan.
3951 *
3952 *LOGIC:
3953 *
3954 *ASSUMPTIONS:
3955 *
3956 *NOTE:
3957 *
3958 * @param pMac Pointer to Global MAC structure
3959 * @return None
3960 */
3961
3962static void
3963limProcessAssocFailureTimeout(tpAniSirGlobal pMac, tANI_U32 MsgType)
3964{
3965
3966 tLimMlmAssocCnf mlmAssocCnf;
3967 tpPESession psessionEntry;
3968
3969 //to fetch the lim/mlm state based on the sessionId, use the below sessionEntry
3970 tANI_U8 sessionId;
3971
3972 if(MsgType == LIM_ASSOC)
3973 {
3974 sessionId = pMac->lim.limTimers.gLimAssocFailureTimer.sessionId;
3975 }
3976 else
3977 {
3978 sessionId = pMac->lim.limTimers.gLimReassocFailureTimer.sessionId;
3979 }
3980
3981 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3982 {
3983 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
3984 return;
3985 }
3986
3987 /**
3988 * Expected Re/Association Response frame
3989 * not received within Re/Association Failure Timeout.
3990 */
3991
3992
3993
3994
3995 /* CR: vos packet memory is leaked when assoc rsp timeouted/failed. */
3996 /* notify TL that association is failed so that TL can flush the cached frame */
3997 WLANTL_AssocFailed (psessionEntry->staId);
3998
3999 // Log error
4000 PELOG1(limLog(pMac, LOG1,
4001 FL("Re/Association Response not received before timeout \n"));)
4002
4003 if (( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )||
4004 ( (psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) &&
4005 (psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) &&
4006 (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE)))
4007 {
4008 /**
4009 * Re/Assoc failure timer should not have timedout on AP
4010 * or in a state other than wt_re/assoc_response.
4011 */
4012
4013 // Log error
4014 limLog(pMac, LOGW,
4015 FL("received unexpected REASSOC failure timeout in state %X for role %d\n"),
4016 psessionEntry->limMlmState, psessionEntry->limSystemRole);
4017 limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState);
4018 }
4019 else
4020 {
4021
4022 if ((MsgType == LIM_ASSOC) ||
4023 ((MsgType == LIM_REASSOC) && (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)))
4024 {
4025 PELOGE(limLog(pMac, LOGE, FL("(Re)Assoc Failure Timeout occurred.\n"));)
4026
4027 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004028 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4029
Jeff Johnson295189b2012-06-20 16:38:30 -07004030 // 'Change' timer for future activations
4031 limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER);
4032
4033 // Free up buffer allocated for JoinReq held by
4034 // MLM state machine
4035 if (psessionEntry->pLimMlmJoinReq)
4036 {
4037 palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq);
4038 psessionEntry->pLimMlmJoinReq = NULL;
4039 }
4040
4041#if defined(ANI_PRODUCT_TYPE_CLIENT)
4042 //To remove the preauth node in case of fail to associate
4043 if (limSearchPreAuthList(pMac, psessionEntry->bssId))
4044 {
4045 PELOG1(limLog(pMac, LOG1, FL(" delete pre auth node for %02X-%02X-%02X-%02X-%02X-%02X\n"),
4046 psessionEntry->bssId[0], psessionEntry->bssId[1], psessionEntry->bssId[2],
4047 psessionEntry->bssId[3], psessionEntry->bssId[4], psessionEntry->bssId[5]);)
4048 limDeletePreAuthNode(pMac, psessionEntry->bssId);
4049 }
4050#endif
4051
4052 mlmAssocCnf.resultCode =
4053 eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE;
4054 mlmAssocCnf.protStatusCode =
4055 eSIR_MAC_UNSPEC_FAILURE_STATUS;
4056
4057 /* Update PE session Id*/
4058 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
4059 if (MsgType == LIM_ASSOC)
4060 limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
4061 else
4062 {
4063 /* Will come here only in case of 11r, CCx FT when reassoc rsp
4064 is not received and we receive a reassoc - timesout */
4065 mlmAssocCnf.resultCode = eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE;
4066 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmAssocCnf);
4067 }
4068 }
4069 else
4070 {
4071 /**
4072 * Restore pre-reassoc req state.
4073 * Set BSSID to currently associated AP address.
4074 */
4075 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07004076 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004077
4078 limRestorePreReassocState(pMac,
4079 eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry);
4080 }
4081 }
4082} /*** limProcessAssocFailureTimeout() ***/
4083
4084
4085
4086/**
4087 * limCompleteMlmScan()
4088 *
4089 *FUNCTION:
4090 * This function is called to send MLM_SCAN_CNF message
4091 * to SME state machine.
4092 *
4093 *LOGIC:
4094 *
4095 *ASSUMPTIONS:
4096 *
4097 *NOTE:
4098 *
4099 * @param pMac Pointer to Global MAC structure
4100 * @param retCode Result code to be sent
4101 * @return None
4102 */
4103
4104void
4105limCompleteMlmScan(tpAniSirGlobal pMac, tSirResultCodes retCode)
4106{
4107 tLimMlmScanCnf mlmScanCnf;
4108
4109 /// Restore previous MLM state
4110 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07004111 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 limRestorePreScanState(pMac);
4113
4114 // Free up pMac->lim.gLimMlmScanReq
4115 if( NULL != pMac->lim.gpLimMlmScanReq )
4116 {
4117 palFreeMemory( pMac->hHdd, pMac->lim.gpLimMlmScanReq);
4118 pMac->lim.gpLimMlmScanReq = NULL;
4119 }
4120
4121 mlmScanCnf.resultCode = retCode;
4122 mlmScanCnf.scanResultLength = pMac->lim.gLimMlmScanResultLength;
4123
4124 limPostSmeMessage(pMac, LIM_MLM_SCAN_CNF, (tANI_U32 *) &mlmScanCnf);
4125
4126} /*** limCompleteMlmScan() ***/
4127
4128/**
4129 * \brief Setup an A-MPDU/BA session
4130 *
4131 * \sa limProcessMlmAddBAReq
4132 *
4133 * \param pMac The global tpAniSirGlobal object
4134 *
4135 * \param pMsgBuf The MLME ADDBA Req message buffer
4136 *
4137 * \return none
4138 */
4139void limProcessMlmAddBAReq( tpAniSirGlobal pMac,
4140 tANI_U32 *pMsgBuf )
4141{
4142tSirRetStatus status = eSIR_SUCCESS;
4143tpLimMlmAddBAReq pMlmAddBAReq;
4144tpLimMlmAddBACnf pMlmAddBACnf;
4145 tpPESession psessionEntry;
4146
4147 if(pMsgBuf == NULL)
4148 {
4149 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4150 return;
4151 }
4152
4153 pMlmAddBAReq = (tpLimMlmAddBAReq) pMsgBuf;
4154 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBAReq->sessionId))== NULL)
4155 {
4156 PELOGE(limLog(pMac, LOGE,
4157 FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004158 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 return;
4160 }
4161
4162
4163 // Send ADDBA Req over the air
4164 status = limSendAddBAReq( pMac, pMlmAddBAReq,psessionEntry);
4165
4166 //
4167 // Respond immediately to LIM, only if MLME has not been
4168 // successfully able to send WDA_ADDBA_REQ to HAL.
4169 // Else, LIM_MLM_ADDBA_CNF will be sent after receiving
4170 // ADDBA Rsp from peer entity
4171 //
4172 if( eSIR_SUCCESS != status )
4173 {
4174 // Allocate for LIM_MLM_ADDBA_CNF
4175 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4176 (void **) &pMlmAddBACnf,
4177 sizeof( tLimMlmAddBACnf )))
4178 {
4179 limLog( pMac, LOGP,
4180 FL("palAllocateMemory failed with error code %d\n"));
4181 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
4182 return;
4183 }
4184 else
4185 {
4186 palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
4187 palCopyMemory( pMac->hHdd,
4188 (void *) pMlmAddBACnf->peerMacAddr,
4189 (void *) pMlmAddBAReq->peerMacAddr,
4190 sizeof( tSirMacAddr ));
4191
4192 pMlmAddBACnf->baDialogToken = pMlmAddBAReq->baDialogToken;
4193 pMlmAddBACnf->baTID = pMlmAddBAReq->baTID;
4194 pMlmAddBACnf->baPolicy = pMlmAddBAReq->baPolicy;
4195 pMlmAddBACnf->baBufferSize = pMlmAddBAReq->baBufferSize;
4196 pMlmAddBACnf->baTimeout = pMlmAddBAReq->baTimeout;
4197 pMlmAddBACnf->sessionId = pMlmAddBAReq->sessionId;
4198
4199 // Update the result code
4200 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4201
4202 limPostSmeMessage( pMac,
4203 LIM_MLM_ADDBA_CNF,
4204 (tANI_U32 *) pMlmAddBACnf );
4205 }
4206
4207 // Restore MLME state
4208 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07004209 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004210
4211 }
4212
4213 // Free the buffer allocated for tLimMlmAddBAReq
4214 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
4215
4216}
4217
4218/**
4219 * \brief Send an ADDBA Rsp to peer STA in response
4220 * to an ADDBA Req received earlier
4221 *
4222 * \sa limProcessMlmAddBARsp
4223 *
4224 * \param pMac The global tpAniSirGlobal object
4225 *
4226 * \param pMsgBuf The MLME ADDBA Rsp message buffer
4227 *
4228 * \return none
4229 */
4230void limProcessMlmAddBARsp( tpAniSirGlobal pMac,
4231 tANI_U32 *pMsgBuf )
4232{
4233tpLimMlmAddBARsp pMlmAddBARsp;
4234 tANI_U16 aid;
4235 tpDphHashNode pSta;
4236 tpPESession psessionEntry;
4237
4238
4239 if(pMsgBuf == NULL)
4240 {
4241 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4242 return;
4243 }
4244
4245 pMlmAddBARsp = (tpLimMlmAddBARsp) pMsgBuf;
4246
4247 if(( psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBARsp->sessionId))== NULL)
4248 {
4249 PELOGE(limLog(pMac, LOGE,
4250 FL("session does not exist for given session ID\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004251 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 return;
4253 }
4254
4255
4256 // Send ADDBA Rsp over the air
4257 if( eSIR_SUCCESS != limSendAddBARsp( pMac,pMlmAddBARsp,psessionEntry))
4258 {
4259 limLog( pMac, LOGE,
4260 FL("Failed to send ADDBA Rsp to peer \n"));
4261 limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGE );
4262 /* Clean the BA context maintained by HAL and TL on failure */
4263 pSta = dphLookupHashEntry( pMac, pMlmAddBARsp->peerMacAddr, &aid,
4264 &psessionEntry->dph.dphHashTable);
4265 if( NULL != pSta )
4266 {
4267 limPostMsgDelBAInd( pMac, pSta, pMlmAddBARsp->baTID, eBA_RECIPIENT,
4268 psessionEntry);
4269 }
4270 }
4271
4272 // Time to post a WDA_DELBA_IND to HAL in order
4273 // to cleanup the HAL and SoftMAC entries
4274
4275
4276 // Free the buffer allocated for tLimMlmAddBARsp
4277 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
4278
4279}
4280
4281/**
4282 * \brief Setup an A-MPDU/BA session
4283 *
4284 * \sa limProcessMlmDelBAReq
4285 *
4286 * \param pMac The global tpAniSirGlobal object
4287 *
4288 * \param pMsgBuf The MLME DELBA Req message buffer
4289 *
4290 * \return none
4291 */
4292void limProcessMlmDelBAReq( tpAniSirGlobal pMac,
4293 tANI_U32 *pMsgBuf )
4294{
4295 tSirRetStatus status = eSIR_SUCCESS;
4296 tpLimMlmDelBAReq pMlmDelBAReq;
4297 tpLimMlmDelBACnf pMlmDelBACnf;
4298 tpPESession psessionEntry;
4299
4300
4301 if(pMsgBuf == NULL)
4302 {
4303 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4304 return;
4305 }
4306
4307 // TODO - Need to validate MLME state
4308 pMlmDelBAReq = (tpLimMlmDelBAReq) pMsgBuf;
4309
4310 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDelBAReq->sessionId))== NULL)
4311 {
4312 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004313 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 return;
4315 }
4316
4317 // Send DELBA Ind over the air
4318 if( eSIR_SUCCESS !=
4319 (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry)))
4320 status = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4321 else
4322 {
4323 tANI_U16 aid;
4324 tpDphHashNode pSta;
4325
4326 // Time to post a WDA_DELBA_IND to HAL in order
4327 // to cleanup the HAL and SoftMAC entries
4328 pSta = dphLookupHashEntry( pMac, pMlmDelBAReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable);
4329 if( NULL != pSta )
4330 {
4331 status = limPostMsgDelBAInd( pMac,
4332 pSta,
4333 pMlmDelBAReq->baTID,
4334 pMlmDelBAReq->baDirection,psessionEntry);
4335
4336 }
4337 }
4338
4339 //
4340 // Respond immediately to SME with DELBA CNF using
4341 // LIM_MLM_DELBA_CNF with appropriate status
4342 //
4343
4344 // Allocate for LIM_MLM_DELBA_CNF
4345 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4346 (void **) &pMlmDelBACnf,
4347 sizeof( tLimMlmDelBACnf )))
4348 {
4349 limLog( pMac, LOGP, FL("palAllocateMemory failed\n"));
4350 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
4351 return;
4352 }
4353 else
4354 {
4355 palZeroMemory( pMac->hHdd, (void *) pMlmDelBACnf, sizeof( tLimMlmDelBACnf ));
4356
4357 palCopyMemory( pMac->hHdd,
4358 (void *) pMlmDelBACnf,
4359 (void *) pMlmDelBAReq,
4360 sizeof( tLimMlmDelBAReq ));
4361
4362 // Update DELBA result code
4363 pMlmDelBACnf->delBAReasonCode = pMlmDelBAReq->delBAReasonCode;
4364
4365 /* Update PE session Id*/
4366 pMlmDelBACnf->sessionId = pMlmDelBAReq->sessionId;
4367
4368 limPostSmeMessage( pMac,
4369 LIM_MLM_DELBA_CNF,
4370 (tANI_U32 *) pMlmDelBACnf );
4371 }
4372
4373 // Free the buffer allocated for tLimMlmDelBAReq
4374 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMsgBuf );
4375
4376}
4377
4378/**
4379 * @function : limSMPowerSaveStateInd( )
4380 *
4381 * @brief : This function is called upon receiving the PMC Indication to update the STA's MimoPs State.
4382 *
4383 * LOGIC:
4384 *
4385 * ASSUMPTIONS:
4386 * NA
4387 *
4388 * NOTE:
4389 * NA
4390 *
4391 * @param pMac - Pointer to Global MAC structure
4392 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4393 * @return None
4394 */
4395
4396tSirRetStatus
4397limSMPowerSaveStateInd(tpAniSirGlobal pMac, tSirMacHTMIMOPowerSaveState state)
4398{
4399#if 0
4400 tSirRetStatus retStatus = eSIR_SUCCESS;
4401#if 0
4402 tANI_U32 cfgVal1;
4403 tANI_U16 cfgVal2;
4404 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
4405 tpDphHashNode pSta = NULL;
4406
4407 tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
4408 /** Verify the Mode of operation */
4409 if (pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) {
4410 PELOGE(limLog(pMac, LOGE, FL("Got PMC indication when System not in the STA Role\n"));)
4411 return eSIR_FAILURE;
4412 }
4413
4414 if ((pMac->lim.gHTMIMOPSState == state) || (state == eSIR_HT_MIMO_PS_NA )) {
4415 PELOGE(limLog(pMac, LOGE, FL("Got Indication when already in the same mode or State passed is NA:%d \n"), state);)
4416 return eSIR_FAILURE;
4417 }
4418
4419 if (!pMac->lim.htCapability){
4420 PELOGW(limLog(pMac, LOGW, FL(" Not in 11n or HT capable mode\n"));)
4421 return eSIR_FAILURE;
4422 }
4423
4424 /** Update the CFG about the default MimoPS State */
4425 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgVal1) != eSIR_SUCCESS) {
4426 limLog(pMac, LOGP, FL("could not retrieve HT Cap CFG \n"));
4427 return eSIR_FAILURE;
4428 }
4429
4430 cfgVal2 = (tANI_U16)cfgVal1;
4431 pHTCapabilityInfo = (tSirMacHTCapabilityInfo *) &cfgVal2;
4432 pHTCapabilityInfo->mimoPowerSave = state;
4433
4434 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS) {
4435 limLog(pMac, LOGP, FL("could not update HT Cap Info CFG\n"));
4436 return eSIR_FAILURE;
4437 }
4438
4439 PELOG2(limLog(pMac, LOG2, FL(" The HT Capability for Mimo Pwr is updated to State: %u \n"),state);)
4440 if (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) {
4441 PELOG2(limLog(pMac, LOG2,FL(" The STA is not in the Connected/Link Est Sme_State: %d \n"), pMac->lim.gLimSmeState);)
4442 /** Update in the LIM the MIMO PS state of the SELF */
4443 pMac->lim.gHTMIMOPSState = state;
4444 return eSIR_SUCCESS;
4445 }
4446
4447 pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4448 if (!pSta->mlmStaContext.htCapability) {
4449 limLog( pMac, LOGE,FL( "limSendSMPowerState: Peer is not HT Capable \n" ));
4450 return eSIR_FAILURE;
4451 }
4452
4453 if (isEnteringMimoPS(pMac->lim.gHTMIMOPSState, state)) {
4454 tSirMacAddr macAddr;
4455 /** Obtain the AP's Mac Address */
4456 palCopyMemory(pMac ->hHdd, (tANI_U8 *)macAddr, psessionEntry->bssId, sizeof(tSirMacAddr));
4457 /** Send Action Frame with the corresponding mode */
4458 retStatus = limSendSMPowerStateFrame(pMac, macAddr, state);
4459 if (retStatus != eSIR_SUCCESS) {
4460 PELOGE(limLog(pMac, LOGE, "Update SM POWER: Sending Action Frame has failed\n");)
4461 return retStatus;
4462 }
4463 }
4464
4465 /** Update MlmState about the SetMimoPS State */
4466 pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
4467 pMac->lim.gLimMlmState = eLIM_MLM_WT_SET_MIMOPS_STATE;
4468 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4469
4470 /** Update the HAL and s/w mac about the mode to be set */
4471 retStatus = limPostSMStateUpdate( pMac,psessionEntry->staId, state);
4472
4473 PELOG2(limLog(pMac, LOG2, " Updated the New SMPS State");)
4474 /** Update in the LIM the MIMO PS state of the SELF */
4475 pMac->lim.gHTMIMOPSState = state;
4476#endif
4477 return retStatus;
4478#endif
4479return eSIR_SUCCESS;
4480}
4481
Jeff Johnsone7245742012-09-05 17:12:55 -07004482#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004483ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset,tANI_U8 peerCenterChan, tpPESession psessionEntry)
Jeff Johnsone7245742012-09-05 17:12:55 -07004484{
4485 ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED;
4486
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004487 if(!psessionEntry->apChanWidth)
Jeff Johnsone7245742012-09-05 17:12:55 -07004488 {
4489 return htSecondaryChannelOffset;
4490 }
4491
4492 if ( (htSecondaryChannelOffset
4493 == PHY_DOUBLE_CHANNEL_LOW_PRIMARY)
4494 )
4495 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004496 if ((channel + 2 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004497 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004498 else if ((channel + 6 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004499 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004500 else if ((channel - 2 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004501 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
4502 else
4503 limLog (pMac, LOGP,
4504 FL("Invalid Channel Number = %d Center Chan = %d \n"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004505 channel, peerCenterChan);
Jeff Johnsone7245742012-09-05 17:12:55 -07004506 }
4507 if ( (htSecondaryChannelOffset
4508 == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY)
4509 )
4510 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004511 if ((channel - 2 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004512 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004513 else if ((channel + 2 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004514 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004515 else if ((channel - 6 ) == peerCenterChan )
Jeff Johnsone7245742012-09-05 17:12:55 -07004516 cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
4517 else
4518 limLog (pMac, LOGP,
4519 FL("Invalid Channel Number = %d Center Chan = %d \n"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004520 channel, peerCenterChan);
Jeff Johnsone7245742012-09-05 17:12:55 -07004521 }
4522 return cbState;
4523}
4524
4525#endif
4526
Jeff Johnson295189b2012-06-20 16:38:30 -07004527void
Jeff Johnsone7245742012-09-05 17:12:55 -07004528limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004529{
4530#if !defined WLAN_FEATURE_VOWIFI
4531 tANI_U32 localPwrConstraint;
4532#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07004533 tpPESession peSession;
Jeff Johnson295189b2012-06-20 16:38:30 -07004534
Jeff Johnsone7245742012-09-05 17:12:55 -07004535 peSession = peFindSessionBySessionId (pMac, peSessionId);
4536
4537 if ( NULL == peSession)
4538 {
4539 limLog (pMac, LOGP, FL("Invalid PE session = %d\n"), peSessionId);
4540 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004542#if defined WLAN_FEATURE_VOWIFI
Jeff Johnsone7245742012-09-05 17:12:55 -07004543#ifdef WLAN_FEATURE_11AC
4544 if ( peSession->vhtCapability )
4545 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004546 limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset,peSession->apCenterChan, peSession), maxTxPower, peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004547 }
4548 else
4549#endif
4550 {
4551 limSendSwitchChnlParams( pMac, channel, secChannelOffset, maxTxPower, peSessionId);
4552 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004553#else
4554 if (wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) {
4555 limLog(pMac, LOGP, FL("could not read WNI_CFG_LOCAL_POWER_CONSTRAINT from CFG\n"));
4556 return;
4557 }
4558 // Send WDA_CHNL_SWITCH_IND to HAL
Jeff Johnsone7245742012-09-05 17:12:55 -07004559#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004560 if ( peSession->vhtCapability && peSession->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07004561 {
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07004562 limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset,peSession->apCenterChan, peSession), maxTxPower, peSessionId);
Jeff Johnsone7245742012-09-05 17:12:55 -07004563 }
4564 else
Jeff Johnson295189b2012-06-20 16:38:30 -07004565#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07004566 {
4567 limSendSwitchChnlParams( pMac, channel, secChannelOffset, (tPowerdBm)localPwrConstraint, peSessionId);
4568 }
4569#endif
4570
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 }