blob: ed3e2fef639389c2866bff0c40e611f35596c335 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*===========================================================================
43 L I M _ P 2 P . C
44
45 OVERVIEW:
46
47 This software unit holds the implementation of the WLAN Protocol Engine for
48 P2P.
49
50 Copyright (c) 2011 QUALCOMM Incorporated.
51 All Rights Reserved.
52 Qualcomm Confidential and Proprietary
53===========================================================================*/
54
55/*===========================================================================
56
57 EDIT HISTORY FOR FILE
58
59
60 This section contains comments describing changes made to the module.
61 Notice that changes are listed in reverse chronological order.
62
63
64 $Header$$DateTime$$Author$
65
66
67 when who what, where, why
68---------- --- --------------------------------------------------------
692011-05-02 djindal Corrected file indentation and changed remain on channel
70 handling for concurrency.
71===========================================================================*/
72
73
74#ifdef WLAN_FEATURE_P2P
75#include "limUtils.h"
76#include "limSessionUtils.h"
77#include "wlan_qct_wda.h"
78
79#define PROBE_RSP_IE_OFFSET 36
80#define BSSID_OFFSET 16
81#define ADDR2_OFFSET 10
82#define ACTION_OFFSET 24
Jeff Johnson32d95a32012-09-10 13:15:23 -070083#define LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME 50
84#define LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME 60
Jeff Johnson295189b2012-06-20 16:38:30 -070085
86
87
88void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status,
89 tANI_U32 *data);
90void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status,
91 tANI_U32 *data, tpPESession psessionEntry);
92void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status,
93 tANI_U32 *data, tpPESession psessionEntry);
94void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data);
95extern tSirRetStatus limSetLinkState(
96 tpAniSirGlobal pMac, tSirLinkState state,
97 tSirMacAddr bssId, tSirMacAddr selfMacAddr,
98 tpSetLinkStateCallback callback, void *callbackArg);
99
100static tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession);
Jeff Johnsone7245742012-09-05 17:12:55 -0700101eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess);
Jeff Johnson295189b2012-06-20 16:38:30 -0700102/*------------------------------------------------------------------
103 *
104 * Below function is callback function, it is called when
105 * WDA_SET_LINK_STATE_RSP is received from WDI. callback function for
106 * P2P of limSetLinkState
107 *
108 *------------------------------------------------------------------*/
109void limSetLinkStateP2PCallback(tpAniSirGlobal pMac, void *callbackArg)
110{
111 //Send Ready on channel indication to SME
112 if(pMac->lim.gpLimRemainOnChanReq)
113 {
114 limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RDY_IND, eHAL_STATUS_SUCCESS,
115 pMac->lim.gpLimRemainOnChanReq->sessionId, 0);
116 }
117 else
118 {
119 //This is possible in case remain on channel is aborted
120 limLog( pMac, LOGE, FL(" NULL pointer of gpLimRemainOnChanReq") );
121 }
122}
123
124/*------------------------------------------------------------------
125 *
126 * Remain on channel req handler. Initiate the INIT_SCAN, CHN_CHANGE
127 * and SET_LINK Request from SME, chnNum and duration to remain on channel.
128 *
129 *------------------------------------------------------------------*/
130
131
132int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg)
133{
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530134
135 /* CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE - Currently removed the special optimization when a concurrent session
136 * exists with operating channel same as P2P listen channel since it was causing issues in P2P search. The reason was
137 * STA-AP link entering BMPS when returning to home channel causing P2P search to miss Probe Reqs and hence not
138 * respond with Probe Rsp causing peer device to NOT find us.
139 * If we need this optimization, we need to find a way to keep the STA-AP link awake (no BMPS) on home channel when in listen state
140 */
141#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
Jeff Johnson295189b2012-06-20 16:38:30 -0700142 tANI_U8 i;
143 tpPESession psessionEntry;
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530144#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700145#ifdef WLAN_FEATURE_P2P_INTERNAL
146 tpPESession pP2pSession;
147#endif
148
149 tSirRemainOnChnReq *MsgBuff = (tSirRemainOnChnReq *)pMsg;
150 pMac->lim.gpLimRemainOnChanReq = MsgBuff;
151
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530152#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 for (i =0; i < pMac->lim.maxBssId;i++)
154 {
155 psessionEntry = peFindSessionBySessionId(pMac,i);
156
157 if ( (psessionEntry != NULL) )
158 {
159 if (psessionEntry->currentOperChannel == MsgBuff->chnNum)
160 {
161 tANI_U32 val;
162 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
163
Jeff Johnsone7245742012-09-05 17:12:55 -0700164 pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
165 pMac->lim.gTotalScanDuration = MsgBuff->duration;
Jeff Johnson295189b2012-06-20 16:38:30 -0700166
167 /* get the duration from the request */
168 val = SYS_MS_TO_TICKS(MsgBuff->duration);
169
Madan Mohan Koyyalamudi709790c2012-09-24 12:12:51 -0700170 limLog( pMac, LOG2, "Start listen duration = %d", val);
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 if (tx_timer_change(
172 &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
173 != TX_SUCCESS)
174 {
175 limLog(pMac, LOGP,
176 FL("Unable to change remain on channel Timer val\n"));
177 goto error;
178 }
179 else if(TX_SUCCESS != tx_timer_activate(
180 &pMac->lim.limTimers.gLimRemainOnChannelTimer))
181 {
182 limLog(pMac, LOGP,
183 FL("Unable to activate remain on channel Timer\n"));
184 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
185 goto error;
186 }
187
188#ifdef WLAN_FEATURE_P2P_INTERNAL
189 //Session is needed to send probe rsp
190 if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &pP2pSession))
191 {
192 limLog( pMac, LOGE, "Unable to create session");
193 goto error;
194 }
195#endif
196
197 if ((limSetLinkState(pMac, eSIR_LINK_LISTEN_STATE,
198 nullBssid, pMac->lim.gSelfMacAddr,
199 limSetLinkStateP2PCallback, NULL)) != eSIR_SUCCESS)
200 {
201 limLog( pMac, LOGE, "Unable to change link state");
202 goto error;
203 }
204 return FALSE;
205 }
206 }
207 }
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530208#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
210 pMac->lim.gLimMlmState = eLIM_MLM_P2P_LISTEN_STATE;
211
212 pMac->lim.gTotalScanDuration = MsgBuff->duration;
213
214 /* 1st we need to suspend link with callback to initiate change channel */
215 limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
216 limRemainOnChnlSuspendLinkHdlr, NULL);
217 return FALSE;
218
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530219#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
Jeff Johnson295189b2012-06-20 16:38:30 -0700220error:
221 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
222 /* pMsg is freed by the caller */
223 return FALSE;
Pratik Bhalgata1bf8bb2012-11-22 17:02:26 +0530224#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700225}
226
227
228tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession)
229{
230 tSirRetStatus nSirStatus = eSIR_FAILURE;
231 tpPESession psessionEntry;
232 tANI_U8 sessionId;
233 tANI_U32 val;
234
235 if(pMac->lim.gpLimRemainOnChanReq && ppP2pSession)
236 {
237 if((psessionEntry = peCreateSession(pMac,
238 pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId, 1)) == NULL)
239 {
240 limLog(pMac, LOGE, FL("Session Can not be created \n"));
241 /* send remain on chn failure */
242 return nSirStatus;
243 }
244 /* Store PE sessionId in session Table */
245 psessionEntry->peSessionId = sessionId;
246
247 psessionEntry->limSystemRole = eLIM_P2P_DEVICE_ROLE;
248 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
249 psessionEntry->rateSet.rate, val , SIR_MAC_MAX_NUMBER_OF_RATES );
250 psessionEntry->rateSet.numRates = val;
251
252 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
253 psessionEntry->extRateSet.rate, val,
254 WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
255 psessionEntry->extRateSet.numRates = val;
256
257 sirCopyMacAddr(psessionEntry->selfMacAddr,
258 pMac->lim.gpLimRemainOnChanReq->selfMacAddr);
259
260 psessionEntry->currentOperChannel = pMac->lim.gpLimRemainOnChanReq->chnNum;
261 nSirStatus = eSIR_SUCCESS;
262 *ppP2pSession = psessionEntry;
263 }
264
265 return nSirStatus;
266}
267
268
269/*------------------------------------------------------------------
270 *
271 * limSuspenLink callback, on success link suspend, trigger change chn
272 *
273 *
274 *------------------------------------------------------------------*/
275
276tSirRetStatus limRemainOnChnlChangeChnReq(tpAniSirGlobal pMac,
277 eHalStatus status, tANI_U32 *data)
278{
279 tpPESession psessionEntry;
280 tANI_U8 sessionId = 0;
281 tSirRetStatus nSirStatus = eSIR_FAILURE;
282
283 if( NULL == pMac->lim.gpLimRemainOnChanReq )
284 {
285 //RemainOnChannel may have aborted
286 PELOGE(limLog( pMac, LOGE, FL(" gpLimRemainOnChanReq is NULL") );)
287 return nSirStatus;
288 }
289
290 /* The link is not suspended */
291 if (status != eHAL_STATUS_SUCCESS)
292 {
293 PELOGE(limLog( pMac, LOGE, FL(" Suspend link Failure ") );)
294 goto error;
295 }
296
297
298 if((psessionEntry = peFindSessionByBssid(
299 pMac,pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId)) != NULL)
300 {
301 goto change_channel;
302 }
303 else /* Session Entry does not exist for given BSSId */
304 {
305 /* Try to Create a new session */
306 if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &psessionEntry))
307 {
308 limLog(pMac, LOGE, FL("Session Can not be created \n"));
309 /* send remain on chn failure */
310 goto error;
311 }
312 }
313
314change_channel:
315 /* change channel to the requested by RemainOn Chn*/
316 limChangeChannelWithCallback(pMac,
317 pMac->lim.gpLimRemainOnChanReq->chnNum,
318 limRemainOnChnlSetLinkStat, NULL, psessionEntry);
319 return eSIR_SUCCESS;
320
321error:
322 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
323 return eSIR_FAILURE;
324}
325
326void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status,
327 tANI_U32 *data)
328{
329 limRemainOnChnlChangeChnReq(pMac, status, data);
330 return;
331}
332
333/*------------------------------------------------------------------
334 *
335 * Set the LINK state to LISTEN to allow only PROBE_REQ and Action frames
336 *
337 *------------------------------------------------------------------*/
338void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status,
339 tANI_U32 *data, tpPESession psessionEntry)
340{
341 tANI_U32 val;
342 tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
343 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
344
345 if (status != eHAL_STATUS_SUCCESS)
346 {
347 limLog( pMac, LOGE, "%s: Change channel not successful\n");
348 goto error1;
349 }
350
351 // Start timer here to come back to operating channel.
352 pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId =
353 psessionEntry->peSessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700354 pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
355 pMac->lim.gTotalScanDuration = MsgRemainonChannel->duration;
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357 /* get the duration from the request */
358 val = SYS_MS_TO_TICKS(MsgRemainonChannel->duration);
359
Madan Mohan Koyyalamudi709790c2012-09-24 12:12:51 -0700360 limLog( pMac, LOG2, "Start listen duration = %d", val);
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
362 val, 0) != TX_SUCCESS)
363 {
364 /**
365 * Could not change Remain on channel Timer. Log error.
366 */
367 limLog(pMac, LOGP,
368 FL("Unable to change remain on channel Timer val\n"));
369 goto error;
370 }
371
372 if(TX_SUCCESS !=
373 tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
374 {
375 limLog( pMac, LOGE,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700376 "%s: remain on channel Timer Start Failed\n", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 goto error;
378 }
379
380 if ((limSetLinkState(pMac, eSIR_LINK_LISTEN_STATE,nullBssid,
381 pMac->lim.gSelfMacAddr, limSetLinkStateP2PCallback,
382 NULL)) != eSIR_SUCCESS)
383 {
384 limLog( pMac, LOGE, "Unable to change link state");
385 goto error;
386 }
387
388 return;
389error:
390 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
391error1:
392 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
393 return;
394}
395
396/*------------------------------------------------------------------
397 *
Viral Modid86bde22012-12-10 13:09:21 -0800398 * lim Insert NOA timer timeout callback - when timer fires, deactivate it and send
399 * scan rsp to csr/hdd
400 *
401 *------------------------------------------------------------------*/
402void limProcessInsertSingleShotNOATimeout(tpAniSirGlobal pMac)
403{
404 /* timeout means start NOA did not arrive; we need to restart the timer and
405 * send the scan response from here
406 */
407 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
408
409 // send the scan response back and do not even call insert NOA
410 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Gopichand Nakkala4261ea52012-12-31 16:43:00 -0800411
412 if(pMac->lim.gpLimSmeScanReq != NULL)
413 {
414 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimSmeScanReq);
415 pMac->lim.gpLimSmeScanReq = NULL;
416 }
417
Viral Modid86bde22012-12-10 13:09:21 -0800418 return;
419}
420
421/*------------------------------------------------------------------
422 *
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 * limchannelchange callback, on success channel change, set the
424 * link_state to LISTEN
425 *
426 *------------------------------------------------------------------*/
427
428void limProcessRemainOnChnTimeout(tpAniSirGlobal pMac)
429{
430 tpPESession psessionEntry;
431 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
432
Jeff Johnsone7245742012-09-05 17:12:55 -0700433 //Timer might get extended while Sending Action Frame
434 //In that case don't process Channel Timeout
435 if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
436 {
437 limLog( pMac, LOGE,
438 "still timer is running already and not processing limProcessRemainOnChnTimeout");
439 return;
440 }
441
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
443
444 if (NULL == pMac->lim.gpLimRemainOnChanReq)
445 {
446 limLog( pMac, LOGE, "No Remain on channel pending");
447 return;
448 }
449
450 /* get the previous valid LINK state */
451 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
452 pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS)
453 {
454 limLog( pMac, LOGE, "Unable to change link state");
455 return;
456 }
457
458 if (pMac->lim.gLimMlmState != eLIM_MLM_P2P_LISTEN_STATE )
459 {
460 limRemainOnChnRsp(pMac,eHAL_STATUS_SUCCESS, NULL);
461 }
462 else
463 {
464 /* get the session */
465 if((psessionEntry = peFindSessionBySessionId(pMac,
466 pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId))== NULL)
467 {
468 limLog(pMac, LOGE,
469 FL("Session Does not exist for given sessionID\n"));
470 goto error;
471 }
472
473 limExitRemainOnChannel(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
474 return;
475error:
476 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
477 }
478 return;
479}
480
481
482/*------------------------------------------------------------------
483 *
484 * limchannelchange callback, on success channel change, set the link_state
485 * to LISTEN
486 *
487 *------------------------------------------------------------------*/
488
489void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status,
490 tANI_U32 *data, tpPESession psessionEntry)
491{
492
493 if (status != eHAL_STATUS_SUCCESS)
494 {
495 PELOGE(limLog( pMac, LOGE, "Remain on Channel Failed\n");)
496 goto error;
497 }
498 //Set the resume channel to Any valid channel (invalid).
499 //This will instruct HAL to set it to any previous valid channel.
500 peSetResumeChannel(pMac, 0, 0);
501 limResumeLink(pMac, limRemainOnChnRsp, NULL);
502 return;
503error:
504 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
505 return;
506}
507
508/*------------------------------------------------------------------
509 *
510 * Send remain on channel respone: Success/ Failure
511 *
512 *------------------------------------------------------------------*/
513void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
514{
515 tpPESession psessionEntry;
516 tANI_U8 sessionId;
517 tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq;
518 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
519
520 if ( NULL == MsgRemainonChannel )
521 {
522 PELOGE(limLog( pMac, LOGP,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700523 "%s: No Pointer for Remain on Channel Req\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 return;
525 }
526
527 //Incase of the Remain on Channel Failure Case
528 //Cleanup Everything
529 if(eHAL_STATUS_FAILURE == status)
530 {
531 //Deactivate Remain on Channel Timer
532 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
533
534 //Set the Link State to Idle
535 /* get the previous valid LINK state */
536 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
537 pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS)
538 {
539 limLog( pMac, LOGE, "Unable to change link state");
540 }
541
542 pMac->lim.gLimSystemInScanLearnMode = 0;
543 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
544 }
545
546 /* delete the session */
547 if((psessionEntry = peFindSessionByBssid(pMac,
548 MsgRemainonChannel->selfMacAddr,&sessionId)) != NULL)
549 {
550 if ( eLIM_P2P_DEVICE_ROLE == psessionEntry->limSystemRole )
551 {
552 peDeleteSession( pMac, psessionEntry);
553 }
554 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700555
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 /* Post the meessage to Sme */
557 limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP, status,
558 MsgRemainonChannel->sessionId, 0);
559
560 palFreeMemory( pMac->hHdd, pMac->lim.gpLimRemainOnChanReq );
561 pMac->lim.gpLimRemainOnChanReq = NULL;
562
563 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700564
565 /* If remain on channel timer expired and action frame is pending then
566 * indicaiton confirmation with status failure */
567 if (pMac->lim.actionFrameSessionId != 0xff)
568 {
569 limP2PActionCnf(pMac, 0);
570 }
571
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 return;
573}
574
575/*------------------------------------------------------------------
576 *
577 * Indicate the Mgmt Frame received to SME to HDD callback
578 * handle Probe_req/Action frame currently
579 *
580 *------------------------------------------------------------------*/
581void limSendSmeMgmtFrameInd(
582 tpAniSirGlobal pMac, tANI_U8 frameType,
583 tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId,
Chilam NG571c65a2013-01-19 12:27:36 +0530584 tANI_U32 rxChannel, tpPESession psessionEntry,
585 tANI_S8 rxRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -0700586{
587 tSirMsgQ mmhMsg;
588 tpSirSmeMgmtFrameInd pSirSmeMgmtFrame = NULL;
589 tANI_U16 length;
590
591 length = sizeof(tSirSmeMgmtFrameInd) + frameLen;
592
593 if( eHAL_STATUS_SUCCESS !=
594 palAllocateMemory( pMac->hHdd, (void **)&pSirSmeMgmtFrame, length ))
595 {
596 limLog(pMac, LOGP,
597 FL("palAllocateMemory failed for eWNI_SME_LISTEN_RSP\n"));
598 return;
599 }
600 palZeroMemory(pMac->hHdd, (void*)pSirSmeMgmtFrame, length);
601
602 pSirSmeMgmtFrame->mesgType = eWNI_SME_MGMT_FRM_IND;
603 pSirSmeMgmtFrame->mesgLen = length;
604 pSirSmeMgmtFrame->sessionId = sessionId;
605 pSirSmeMgmtFrame->frameType = frameType;
Chilam NG571c65a2013-01-19 12:27:36 +0530606 pSirSmeMgmtFrame->rxRssi = rxRssi;
Jeff Johnsone7245742012-09-05 17:12:55 -0700607
608 /* work around for 5Ghz channel is not correct since rxhannel
609 * is 4 bits. So we don't indicate more than 16 channels
610 */
611 if( (VOS_FALSE ==
612 tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer)) &&
613 (psessionEntry != NULL) &&
614 (SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel)) )
615 {
616 pSirSmeMgmtFrame->rxChan = psessionEntry->currentOperChannel;
617 }
618 else
619 {
620 pSirSmeMgmtFrame->rxChan = rxChannel;
621 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700622
623 vos_mem_zero(pSirSmeMgmtFrame->frameBuf,frameLen);
624 vos_mem_copy(pSirSmeMgmtFrame->frameBuf,frame,frameLen);
625
626 mmhMsg.type = eWNI_SME_MGMT_FRM_IND;
627 mmhMsg.bodyptr = pSirSmeMgmtFrame;
628 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700629
630 if(VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer) &&
631 ( (psessionEntry != NULL) && (psessionEntry->pePersona != VOS_P2P_GO_MODE)) &&
632 (frameType == SIR_MAC_MGMT_ACTION))
633 {
634 tANI_U32 curTime = vos_timer_get_system_time();
635 if((curTime - pMac->lim.p2pRemOnChanTimeStamp) > (pMac->lim.gTotalScanDuration - LIM_MIN_REM_TIME_FOR_TX_ACTION_FRAME))
636 {
637 unsigned int chanWaitTime, vStatus ;
638
639 limLog( pMac, LOG1, FL("Rx: Extend the gLimRemainOnChannelTimer"));
640
641 pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
642 pMac->lim.gTotalScanDuration = LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME;
643
Jeff Johnson32d95a32012-09-10 13:15:23 -0700644 chanWaitTime = SYS_MS_TO_TICKS(LIM_MIN_REM_TIME_EXT_FOR_TX_ACTION_FRAME);
Jeff Johnsone7245742012-09-05 17:12:55 -0700645 vStatus = tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
646
647 if (VOS_STATUS_SUCCESS != vStatus)
648 {
649 limLog( pMac, LOGE, FL("Rx: Extend the gLimRemainOnChannelTimer"));
650 }
651
652 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer, chanWaitTime, 0) != TX_SUCCESS)
653 {
654 limLog( pMac, LOGE, FL("Unable to change the gLimRemainOnChannelTimer"));
655 }
656
657 if (tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != 0)
658 {
659 limLog( pMac, LOGE, FL("Unable to active the gLimRemainOnChannelTimer"));
660 }
661 }
662 }
663
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
665 return;
666} /*** end limSendSmeListenRsp() ***/
667
668
669eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess)
670{
Jeff Johnsone7245742012-09-05 17:12:55 -0700671 if (pMac->lim.actionFrameSessionId != 0xff)
672 {
673 /* The session entry might be invalid(0xff) action confirmation received after
674 * remain on channel timer expired */
675 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
676 (txCompleteSuccess ? eSIR_SME_SUCCESS : eSIR_SME_SEND_ACTION_FAIL),
677 pMac->lim.actionFrameSessionId, 0);
678 pMac->lim.actionFrameSessionId = 0xff;
679 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681 return eHAL_STATUS_SUCCESS;
682}
683
684
Jeff Johnsone7245742012-09-05 17:12:55 -0700685void limSetHtCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pIeStartPtr,tANI_U32 nBytes)
Jeff Johnson295189b2012-06-20 16:38:30 -0700686{
687 v_U8_t *pIe=NULL;
688 tDot11fIEHTCaps dot11HtCap;
689
Jeff Johnsone7245742012-09-05 17:12:55 -0700690 PopulateDot11fHTCaps(pMac, psessionEntry, &dot11HtCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes,
692 DOT11F_EID_HTCAPS,ONE_BYTE);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700693 limLog( pMac, LOG2, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 (tANI_U32)pIe,dot11HtCap.supportedMCSSet[0]);
695 if(pIe)
696 {
697 tHtCaps *pHtcap = (tHtCaps *)&pIe[2]; //convert from unpacked to packed structure
698 pHtcap->advCodingCap = dot11HtCap.advCodingCap;
699 pHtcap->supportedChannelWidthSet = dot11HtCap.supportedChannelWidthSet;
700 pHtcap->mimoPowerSave = dot11HtCap.mimoPowerSave;
701 pHtcap->greenField = dot11HtCap.greenField;
702 pHtcap->shortGI20MHz = dot11HtCap.shortGI20MHz;
703 pHtcap->shortGI40MHz = dot11HtCap.shortGI40MHz;
704 pHtcap->txSTBC = dot11HtCap.txSTBC;
705 pHtcap->rxSTBC = dot11HtCap.rxSTBC;
706 pHtcap->delayedBA = dot11HtCap.delayedBA ;
707 pHtcap->maximalAMSDUsize = dot11HtCap.maximalAMSDUsize;
708 pHtcap->dsssCckMode40MHz = dot11HtCap.dsssCckMode40MHz;
709 pHtcap->psmp = dot11HtCap.psmp;
710 pHtcap->stbcControlFrame = dot11HtCap.stbcControlFrame;
711 pHtcap->lsigTXOPProtection = dot11HtCap.lsigTXOPProtection;
712 pHtcap->maxRxAMPDUFactor = dot11HtCap.maxRxAMPDUFactor;
713 pHtcap->mpduDensity = dot11HtCap.mpduDensity;
714 palCopyMemory( pMac->hHdd, (void *)pHtcap->supportedMCSSet,
715 (void *)(dot11HtCap.supportedMCSSet),
716 sizeof(pHtcap->supportedMCSSet));
717 pHtcap->pco = dot11HtCap.pco;
718 pHtcap->transitionTime = dot11HtCap.transitionTime;
719 pHtcap->mcsFeedback = dot11HtCap.mcsFeedback;
720 pHtcap->txBF = dot11HtCap.txBF;
721 pHtcap->rxStaggeredSounding = dot11HtCap.rxStaggeredSounding;
722 pHtcap->txStaggeredSounding = dot11HtCap.txStaggeredSounding;
723 pHtcap->rxZLF = dot11HtCap.rxZLF;
724 pHtcap->txZLF = dot11HtCap.txZLF;
725 pHtcap->implicitTxBF = dot11HtCap.implicitTxBF;
726 pHtcap->calibration = dot11HtCap.calibration;
727 pHtcap->explicitCSITxBF = dot11HtCap.explicitCSITxBF;
728 pHtcap->explicitUncompressedSteeringMatrix =
729 dot11HtCap.explicitUncompressedSteeringMatrix;
730 pHtcap->explicitBFCSIFeedback = dot11HtCap.explicitBFCSIFeedback;
731 pHtcap->explicitUncompressedSteeringMatrixFeedback =
732 dot11HtCap.explicitUncompressedSteeringMatrixFeedback;
733 pHtcap->explicitCompressedSteeringMatrixFeedback =
734 dot11HtCap.explicitCompressedSteeringMatrixFeedback;
735 pHtcap->csiNumBFAntennae = dot11HtCap.csiNumBFAntennae;
736 pHtcap->uncompressedSteeringMatrixBFAntennae =
737 dot11HtCap.uncompressedSteeringMatrixBFAntennae;
738 pHtcap->compressedSteeringMatrixBFAntennae =
739 dot11HtCap.compressedSteeringMatrixBFAntennae;
740 pHtcap->antennaSelection = dot11HtCap.antennaSelection;
741 pHtcap->explicitCSIFeedbackTx = dot11HtCap.explicitCSIFeedbackTx;
742 pHtcap->antennaIndicesFeedbackTx = dot11HtCap.antennaIndicesFeedbackTx;
743 pHtcap->explicitCSIFeedback = dot11HtCap.explicitCSIFeedback;
744 pHtcap->antennaIndicesFeedback = dot11HtCap.antennaIndicesFeedback;
745 pHtcap->rxAS = dot11HtCap.rxAS;
746 pHtcap->txSoundingPPDUs = dot11HtCap.txSoundingPPDUs;
747 }
748}
749
750
751void limSendP2PActionFrame(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
752{
753 tSirMbMsgP2p *pMbMsg = (tSirMbMsgP2p *)pMsg->bodyptr;
754 tANI_U32 nBytes;
755 tANI_U8 *pFrame;
756 void *pPacket;
757 eHalStatus halstatus;
758 tANI_U8 txFlag = 0;
759 tpSirMacFrameCtl pFc = (tpSirMacFrameCtl ) pMbMsg->data;
760 tANI_U8 noaLen = 0;
761 tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
762 tANI_U8 origLen = 0;
763 tANI_U8 sessionId = 0;
764 v_U8_t *pP2PIe = NULL;
765 tpPESession psessionEntry;
766 v_U8_t *pPresenceRspNoaAttr = NULL;
767 v_U8_t *pNewP2PIe = NULL;
768 v_U16_t remainLen = 0;
769
770 nBytes = pMbMsg->msgLen - sizeof(tSirMbMsg);
771
772 limLog( pMac, LOG1, FL("sending pFc->type=%d pFc->subType=%d"),
773 pFc->type, pFc->subType);
774
775 psessionEntry = peFindSessionByBssid(pMac,
776 (tANI_U8*)pMbMsg->data + BSSID_OFFSET, &sessionId);
777
778 /* Check for session corresponding to ADDR2 As Supplicant is filling
779 ADDR2 with BSSID */
780 if( NULL == psessionEntry )
781 {
782 psessionEntry = peFindSessionByBssid(pMac,
783 (tANI_U8*)pMbMsg->data + ADDR2_OFFSET, &sessionId);
784 }
785
786 if( NULL == psessionEntry )
787 {
788 tANI_U8 isSessionActive = 0;
789 tANI_U8 i;
790
791 /* If we are not able to find psessionEntry entry, then try to find
792 active session, if found any active sessions then send the
793 action frame, If no active sessions found then drop the frame */
794 for (i =0; i < pMac->lim.maxBssId;i++)
795 {
796 psessionEntry = peFindSessionBySessionId(pMac,i);
797 if ( NULL != psessionEntry)
798 {
799 isSessionActive = 1;
800 break;
801 }
802 }
803 if( !isSessionActive )
804 {
805 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
806 eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
807 return;
808 }
809 }
810
811 if ((SIR_MAC_MGMT_FRAME == pFc->type)&&
812 ((SIR_MAC_MGMT_PROBE_RSP == pFc->subType)||
813 (SIR_MAC_MGMT_ACTION == pFc->subType)))
814 {
815 //if this is a probe RSP being sent from wpa_supplicant
816 if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
817 {
818 //get proper offset for Probe RSP
819 pP2PIe = limGetP2pIEPtr(pMac,
820 (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
821 nBytes - PROBE_RSP_IE_OFFSET);
822 while ((NULL != pP2PIe) && (SIR_MAC_MAX_IE_LENGTH == pP2PIe[1]))
823 {
824 remainLen = nBytes - (pP2PIe - (tANI_U8*)pMbMsg->data);
825 if (remainLen > 2)
826 {
827 pNewP2PIe = limGetP2pIEPtr(pMac,
828 pP2PIe+SIR_MAC_MAX_IE_LENGTH + 2, remainLen);
829 }
830 if (pNewP2PIe)
831 {
832 pP2PIe = pNewP2PIe;
833 pNewP2PIe = NULL;
834 }
835 else
836 {
837 break;
838 }
839 } //end of while
840 }
841 else
842 {
843 if (SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY ==
844 *((v_U8_t *)pMbMsg->data+ACTION_OFFSET))
845 {
846 tpSirMacP2PActionFrameHdr pActionHdr =
847 (tpSirMacP2PActionFrameHdr)((v_U8_t *)pMbMsg->data +
848 ACTION_OFFSET);
849 if ( palEqualMemory( pMac->hHdd, pActionHdr->Oui,
850 SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE ) &&
851 (SIR_MAC_ACTION_P2P_SUBTYPE_PRESENCE_RSP ==
852 pActionHdr->OuiSubType))
853 { //In case of Presence RSP response
854 pP2PIe = limGetP2pIEPtr(pMac,
855 (v_U8_t *)pMbMsg->data + ACTION_OFFSET +
856 sizeof(tSirMacP2PActionFrameHdr),
857 (nBytes - ACTION_OFFSET -
858 sizeof(tSirMacP2PActionFrameHdr)));
859 if( NULL != pP2PIe )
860 {
861 //extract the presence of NoA attribute inside P2P IE
862 pPresenceRspNoaAttr =
863 limGetIEPtr(pMac,pP2PIe + SIR_P2P_IE_HEADER_LEN,
864 pP2PIe[1], SIR_P2P_NOA_ATTR,TWO_BYTE);
865 }
866 }
867 }
868 }
869
870 if (pP2PIe != NULL)
871 {
872 //get NoA attribute stream P2P IE
873 noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
874 //need to append NoA attribute in P2P IE
875 if (noaLen > 0)
876 {
877 origLen = pP2PIe[1];
878 //if Presence Rsp has NoAttr
879 if (pPresenceRspNoaAttr)
880 {
881 v_U16_t noaAttrLen = pPresenceRspNoaAttr[1] |
882 (pPresenceRspNoaAttr[2]<<8);
883 /*One byte for attribute, 2bytes for length*/
884 origLen -= (noaAttrLen + 1 + 2);
885 //remove those bytes to copy
886 nBytes -= (noaAttrLen + 1 + 2);
887 //remove NoA from original Len
888 pP2PIe[1] = origLen;
889 }
890 if ((pP2PIe[1] + (tANI_U16)noaLen)> SIR_MAC_MAX_IE_LENGTH)
891 {
892 //Form the new NoA Byte array in multiple P2P IEs
893 noaLen = limGetNoaAttrStreamInMultP2pIes(pMac, noaStream,
894 noaLen,((pP2PIe[1] + (tANI_U16)noaLen)-
895 SIR_MAC_MAX_IE_LENGTH));
896 pP2PIe[1] = SIR_MAC_MAX_IE_LENGTH;
897 }
898 else
899 {
900 pP2PIe[1] += noaLen; //increment the length of P2P IE
901 }
902 nBytes += noaLen;
903 limLog( pMac, LOGE,
904 FL("noaLen=%d origLen=%d pP2PIe=0x%x"
905 " nBytes=%d nBytesToCopy=%d \n"),
906 noaLen,origLen,pP2PIe,nBytes,
907 ((pP2PIe + origLen + 2) - (v_U8_t *)pMbMsg->data));
908 }
909 }
910
911 if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType)
912 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700913 limSetHtCaps( pMac, psessionEntry, (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET,
Madan Mohan Koyyalamudifb29a5d2012-10-11 12:14:17 -0700914 nBytes - PROBE_RSP_IE_OFFSET);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700916
917 /* The minimum wait for any action frame should be atleast 100 ms.
918 * If supplicant sends action frame at the end of already running remain on channel time
919 * Then there is a chance to miss the response of the frame. So increase the remain on channel
920 * time for all action frame to make sure that we receive the response frame */
921 if ((SIR_MAC_MGMT_ACTION == pFc->subType) &&
922 (0 != pMbMsg->wait))
923 {
924 if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer))
925 {
926 tANI_U32 val = 0;
927 tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
928 /* get the duration from the request */
929 pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
930 pMac->lim.gTotalScanDuration = pMbMsg->wait;
931
932 val = SYS_MS_TO_TICKS(pMbMsg->wait);
933
934 limLog(pMac, LOG1,
935 FL("Tx: Extending the gLimRemainOnChannelTimer\n"));
936 if (tx_timer_change(
937 &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
938 != TX_SUCCESS)
939 {
940 limLog(pMac, LOGP,
941 FL("Unable to change remain on channel Timer val\n"));
942 return;
943 }
944 else if(TX_SUCCESS != tx_timer_activate(
945 &pMac->lim.limTimers.gLimRemainOnChannelTimer))
946 {
947 limLog(pMac, LOGP,
948 FL("Unable to activate remain on channel Timer\n"));
949 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
950 return;
951 }
952 }
953 else
954 {
955 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
956 eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0);
957 return;
958 }
959 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 }
961
962
963 // Ok-- try to allocate some memory:
964 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
965 (tANI_U16)nBytes, ( void** ) &pFrame, (void**) &pPacket);
966 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
967 {
968 limLog( pMac, LOGE, FL("Failed to allocate %d bytes for a Probe"
969 " Request.\n"), nBytes );
970 return;
971 }
972
973 // Paranoia:
974 palZeroMemory( pMac->hHdd, pFrame, nBytes );
975
976 if (noaLen > 0)
977 {
978 // Add 2 bytes for length and Arribute field
979 v_U32_t nBytesToCopy = ((pP2PIe + origLen + 2 ) -
980 (v_U8_t *)pMbMsg->data);
981 palCopyMemory( pMac->hHdd, pFrame, pMbMsg->data, nBytesToCopy);
982 palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy), noaStream, noaLen);
983 palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy + noaLen),
984 pMbMsg->data + nBytesToCopy, nBytes - nBytesToCopy - noaLen);
985
986 }
987 else
988 {
989 palCopyMemory(pMac->hHdd, pFrame, pMbMsg->data, nBytes);
990 }
991
992 /* Use BD rate 2 for all P2P related frames. As these frames need to go
993 * at OFDM rates. And BD rate2 we configured at 6Mbps.
994 */
995 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
996
Jeff Johnsone7245742012-09-05 17:12:55 -0700997 if ( (SIR_MAC_MGMT_PROBE_RSP == pFc->subType) ||
998 (pMbMsg->noack)
999 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 {
1001 halstatus = halTxFrame( pMac, pPacket, (tANI_U16)nBytes,
1002 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
1003 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame,
1004 txFlag );
1005
Jeff Johnsone7245742012-09-05 17:12:55 -07001006 if (!pMbMsg->noack)
1007 {
1008 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF,
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 halstatus, pMbMsg->sessionId, 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001010 }
1011 pMac->lim.actionFrameSessionId = 0xff;
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 }
1013 else
1014 {
1015 halstatus = halTxFrameWithTxComplete( pMac, pPacket, (tANI_U16)nBytes,
1016 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
1017 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame,
1018 limP2PActionCnf, txFlag );
1019
1020 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1021 {
1022 limLog( pMac, LOGE, FL("could not send action frame!\n" ));
1023 limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, halstatus,
1024 pMbMsg->sessionId, 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001025 pMac->lim.actionFrameSessionId = 0xff;
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 }
1027 else
1028 {
1029 pMac->lim.actionFrameSessionId = pMbMsg->sessionId;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07001030 limLog( pMac, LOG2, FL("lim.actionFrameSessionId = %lu\n" ),
Jeff Johnsone7245742012-09-05 17:12:55 -07001031 pMac->lim.actionFrameSessionId);
1032
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 }
1034 }
1035
1036 return;
1037}
1038
1039
1040void limAbortRemainOnChan(tpAniSirGlobal pMac)
1041{
1042 if(VOS_TRUE == tx_timer_running(
1043 &pMac->lim.limTimers.gLimRemainOnChannelTimer))
1044 {
1045 //TODO check for state and take appropriate actions
1046 limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
1047 limProcessRemainOnChnTimeout(pMac);
1048 }
1049 return;
1050}
1051
1052/* Power Save Related Functions */
1053tSirRetStatus __limProcessSmeNoAUpdate(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1054{
1055 tpP2pPsConfig pNoA;
1056 tpP2pPsParams pMsgNoA;
1057 tSirMsgQ msg;
1058
1059 pNoA = (tpP2pPsConfig) pMsgBuf;
1060
1061 if( eHAL_STATUS_SUCCESS != palAllocateMemory(
1062 pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig )))
1063 {
1064 limLog( pMac, LOGE,
1065 FL( "Unable to allocate memory during NoA Update\n" ));
1066 return eSIR_MEM_ALLOC_FAILED;
1067 }
1068
1069 palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig));
1070 pMsgNoA->opp_ps = pNoA->opp_ps;
1071 pMsgNoA->ctWindow = pNoA->ctWindow;
1072 pMsgNoA->duration = pNoA->duration;
1073 pMsgNoA->interval = pNoA->interval;
1074 pMsgNoA->count = pNoA->count;
1075 pMsgNoA->single_noa_duration = pNoA->single_noa_duration;
1076 pMsgNoA->psSelection = pNoA->psSelection;
1077
Viral Modid86bde22012-12-10 13:09:21 -08001078 msg.type = WDA_SET_P2P_GO_NOA_REQ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 msg.reserved = 0;
1080 msg.bodyptr = pMsgNoA;
1081 msg.bodyval = 0;
1082
1083 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1084 {
1085 limLog(pMac, LOGE, FL("halPostMsgApi failed\n"));
1086 return eSIR_FAILURE;
1087 }
1088
1089 return eSIR_SUCCESS;
1090} /*** end __limProcessSmeGoNegReq() ***/
1091
1092#endif
1093