blob: da8c95195a66b0156a3e65ee11cd9ffae7c24881 [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
44 W L A N _ Q C T _ T L _ HOSUPPORT. C
45
46 OVERVIEW:
47
48 DEPENDENCIES:
49
50 Are listed for each API below.
51
52
53 Copyright (c) 2008 QUALCOMM Incorporated.
54 All Rights Reserved.
55 Qualcomm Confidential and Proprietary
56===========================================================================*/
57
58/*===========================================================================
59
60 EDIT HISTORY FOR FILE
61
62
63 This section contains comments describing changes made to the module.
64 Notice that changes are listed in reverse chronological order.
65
66
67 $Header$$DateTime$$Author$
68
69
70 when who what, where, why
71---------- --- --------------------------------------------------------
7202/19/09 lti Vos trace fix
7302/06/09 sch Dereg Bug fix
7412/11/08 sch Initial creation
75
76===========================================================================*/
77#include "wlan_qct_tl.h"
78#include "wlan_qct_wda.h"
79#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
80/*----------------------------------------------------------------------------
81 * Include Files
82 * -------------------------------------------------------------------------*/
83#include "wlan_qct_tl_hosupport.h"
84#include "wlan_qct_tli.h"
85#include "tlDebug.h"
86/*----------------------------------------------------------------------------
87 * Preprocessor Definitions and Constants
88 * -------------------------------------------------------------------------*/
89//#define WLANTL_HO_DEBUG_MSG
90//#define WLANTL_HO_UTEST
91
92#define WLANTL_HO_DEFAULT_RSSI 0xFF
93#define WLANTL_HO_DEFAULT_ALPHA 5
94#define WLANTL_HO_INVALID_RSSI -100
95/* RSSI sampling period, usec based
96 * To reduce performance overhead
97 * Current default 500msec */
98#define WLANTL_HO_SAMPLING_PERIOD 500000
99
100
101
102/* Get and release lock */
103#define THSGETLOCK(a, b) \
104 do \
105 { \
106 if(!VOS_IS_STATUS_SUCCESS(vos_lock_acquire(b))) \
107 { \
108 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%s Get Lock Fail", a)); \
109 return VOS_STATUS_E_FAILURE; \
110 } \
111 }while(0)
112
113#define THSRELEASELOCK(a, b) \
114 do \
115 { \
116 if(!VOS_IS_STATUS_SUCCESS(vos_lock_release(b))) \
117 { \
118 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"%s Release Lock Fail", a)); \
119 return VOS_STATUS_E_FAILURE; \
120 } \
121 }while(0)
122
123const v_U8_t WLANTL_HO_TID_2_AC[WLAN_MAX_TID] = {WLANTL_AC_BE,
124 WLANTL_AC_BK,
125 WLANTL_AC_BK,
126 WLANTL_AC_BE,
127 WLANTL_AC_VI,
128 WLANTL_AC_VI,
129 WLANTL_AC_VO,
130 WLANTL_AC_VO};
131/*----------------------------------------------------------------------------
132 * Type Declarations
133 * -------------------------------------------------------------------------*/
134/* Temporary threshold store place for BMPS */
135typedef struct
136{
137 v_S7_t rssi;
138 v_U8_t event;
139} WLANTL_HSTempPSIndType;
140
141#ifdef RSSI_HACK
142/* This is a dummy averaged RSSI value that can be controlled using dump commands
143 * to trigger TL to issue handoff related events. We will be using dump 362 <average RSSI>
144 * value to change its value */
145int dumpCmdRSSI = -48;
146#endif
147
148#ifdef WLANTL_HO_UTEST
149/*==========================================================================
150
151 FUNCTION
152
153 DESCRIPTION
154
155 PARAMETERS
156
157 RETURN VALUE
158
159============================================================================*/
160static v_S7_t rssi;
161static v_S7_t direction;
162void TLHS_UtestHandleNewRSSI(v_S7_t *newRSSI, v_PVOID_t pAdapter)
163{
164 if(0 == rssi)
165 {
166 direction = -1;
167 }
168 else if(-90 == rssi)
169 {
170 direction = 1;
171 }
172
173 *newRSSI = rssi;
174 rssi += direction;
175
176 return;
177}
178#endif /* WLANTL_HO_UTEST */
179
180#ifdef WLANTL_HO_DEBUG_MSG
181/*==========================================================================
182
183 FUNCTION
184
185 DESCRIPTION
186
187 PARAMETERS
188
189 RETURN VALUE
190
191============================================================================*/
192void WLANTL_StatDebugDisplay
193(
194 v_U8_t STAid,
195 WLANTL_TRANSFER_STA_TYPE *statistics
196)
197{
198 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"================================================="));
199 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Statistics for STA %d", STAid));
200 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX UC Fcnt %5d, MC Fcnt %5d, BC Fcnt %5d",
201 statistics->rxUCFcnt, statistics->rxMCFcnt, statistics->rxBCFcnt));
202 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX UC Bcnt %5d, MC Bcnt %5d, BC Bcnt %5d",
203 statistics->rxUCBcnt, statistics->rxMCBcnt, statistics->rxBCBcnt));
204 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX UC Fcnt %5d, MC Fcnt %5d, BC Fcnt %5d",
205 statistics->txUCFcnt, statistics->txMCFcnt, statistics->txBCFcnt));
206 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX UC Bcnt %5d, MC Bcnt %5d, BC Bcnt %5d",
207 statistics->txUCBcnt, statistics->txMCBcnt, statistics->txBCBcnt));
208 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TRX Bcnt %5d, CRCOK Bcnt %5d, RXRate %5d",
209 statistics->rxBcnt, statistics->rxBcntCRCok, statistics->rxRate));
210 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"================================================="));
211 return;
212}
213#endif /* WLANTL_HO_DEBUG_MSG */
214
215/*==========================================================================
216
217 FUNCTION
218
219 DESCRIPTION
220
221 PARAMETERS
222
223 RETURN VALUE
224
225============================================================================*/
226void WLANTL_HSDebugDisplay
227(
228 v_PVOID_t pAdapter
229)
230{
231 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
232 v_U8_t idx, sIdx;
233 v_BOOL_t regionFound = VOS_FALSE;
234 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
235 WLANTL_HO_SUPPORT_TYPE *hoSupport;
236
237 if (NULL == tlCtxt)
238 {
239 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
240 "%s: Invalid TL Context",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700241 __func__));
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 return;
243 }
244
245 currentHO = &(tlCtxt->hoSupport.currentHOState);
246 hoSupport = &(tlCtxt->hoSupport);
247
248
249 for(idx = 0; idx < currentHO->numThreshold; idx++)
250 {
251 if(idx == currentHO->regionNumber)
252 {
253 regionFound = VOS_TRUE;
254 if(VOS_TRUE == tlCtxt->isBMPS)
255 {
256 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
257 currentHO->regionNumber, currentHO->alpha));
258 }
259 else
260 {
261 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO," ----> CRegion %d, hRSSI %d, Alpha %d",
262 currentHO->regionNumber,
263 currentHO->historyRSSI,
264 currentHO->alpha));
265 }
266 }
267 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
268 {
269 if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
270 {
271 if(VOS_MODULE_ID_HDD == hoSupport->registeredInd[idx].whoIsClient[sIdx])
272 {
273 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Client HDD pCB %p, triggerEvt %d, RSSI %d",
274 hoSupport->registeredInd[idx].crossCBFunction[sIdx],
275 hoSupport->registeredInd[idx].triggerEvent[sIdx],
276 hoSupport->registeredInd[idx].rssiValue));
277 }
278 else
279 {
280 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Client SME pCB %p, triggerEvt %d, RSSI %d",
281 hoSupport->registeredInd[idx].crossCBFunction[sIdx],
282 hoSupport->registeredInd[idx].triggerEvent[sIdx],
283 hoSupport->registeredInd[idx].rssiValue));
284 }
285 }
286 }
287 }
288
289 if(VOS_FALSE == regionFound)
290 {
291 if(VOS_TRUE == tlCtxt->isBMPS)
292 {
293 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI:NA, BMPS, Alpha %d",
294 currentHO->regionNumber, currentHO->alpha));
295 }
296 else
297 {
298 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR," ----> CRegion %d, hRSSI %d, Alpha %d",
299 currentHO->regionNumber,
300 currentHO->historyRSSI,
301 currentHO->alpha));
302 }
303 }
304
305 return;
306}
307
308/*==========================================================================
309
310 FUNCTION
311
312 DESCRIPTION
313
314 PARAMETERS
315
316 RETURN VALUE
317
318============================================================================*/
319VOS_STATUS WLANTL_SetFWRSSIThresholds
320(
321 v_PVOID_t pAdapter
322)
323{
324 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
325 VOS_STATUS status = VOS_STATUS_SUCCESS;
326 WLANTL_HO_SUPPORT_TYPE *hoSupport;
327 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
328 tSirRSSIThresholds bmpsThresholds;
329 WLANTL_HSTempPSIndType tempIndSet[WLANTL_SINGLE_CLNT_THRESHOLD];
330 v_U8_t bmpsLoop;
331 v_U8_t bmpsInd;
332 v_U8_t clientLoop;
333
334 if(NULL == tlCtxt)
335 {
336 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
337 return VOS_STATUS_E_INVAL;
338 }
339
340 WLANTL_HSDebugDisplay(pAdapter);
341 currentHO = &(tlCtxt->hoSupport.currentHOState);
342 hoSupport = &(tlCtxt->hoSupport);
343
344 memset((v_U8_t *)&tempIndSet[0], 0, WLANTL_SINGLE_CLNT_THRESHOLD * sizeof(WLANTL_HSTempPSIndType));
345 memset(&bmpsThresholds, 0, sizeof(tSirRSSIThresholds));
346
347 bmpsInd = 0;
348 for(bmpsLoop = 0; bmpsLoop < WLANTL_MAX_AVAIL_THRESHOLD; bmpsLoop++)
349 {
350 for(clientLoop = 0; clientLoop < WLANTL_HS_NUM_CLIENT; clientLoop++)
351 {
352 if(0 != hoSupport->registeredInd[bmpsLoop].triggerEvent[clientLoop])
353 {
354 if(bmpsInd == WLANTL_SINGLE_CLNT_THRESHOLD)
355 {
356 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Single Client Threshold should be less than %d", WLANTL_SINGLE_CLNT_THRESHOLD));
357 break;
358 }
359 tempIndSet[bmpsInd].rssi = hoSupport->registeredInd[bmpsLoop].rssiValue;
360 tempIndSet[bmpsInd].event = hoSupport->registeredInd[bmpsLoop].triggerEvent[clientLoop];
361 bmpsInd++;
362 break;
363 }
364 }
365 }
366
367 bmpsThresholds.ucRssiThreshold1 = tempIndSet[0].rssi;
368 if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[0].event) ||
369 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[0].event))
370 {
371 bmpsThresholds.bRssiThres1NegNotify = 1;
372 }
373 if((WLANTL_HO_THRESHOLD_UP == tempIndSet[0].event) ||
374 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[0].event))
375 {
376 bmpsThresholds.bRssiThres1PosNotify = 1;
377 }
378
379 bmpsThresholds.ucRssiThreshold2 = tempIndSet[1].rssi;
380 if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[1].event) ||
381 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[1].event))
382 {
383 bmpsThresholds.bRssiThres2NegNotify = 1;
384 }
385 if((WLANTL_HO_THRESHOLD_UP == tempIndSet[1].event) ||
386 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[1].event))
387 {
388 bmpsThresholds.bRssiThres2PosNotify = 1;
389 }
390
391 bmpsThresholds.ucRssiThreshold3 = tempIndSet[2].rssi;
392 if((WLANTL_HO_THRESHOLD_DOWN == tempIndSet[2].event) ||
393 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[2].event))
394 {
395 bmpsThresholds.bRssiThres3NegNotify = 1;
396 }
397 if((WLANTL_HO_THRESHOLD_UP == tempIndSet[2].event) ||
398 (WLANTL_HO_THRESHOLD_CROSS == tempIndSet[2].event))
399 {
400 bmpsThresholds.bRssiThres3PosNotify = 1;
401 }
402
403 WDA_SetRSSIThresholds(hoSupport->macCtxt, &bmpsThresholds);
404 return status;
405}
406
407/*==========================================================================
408
409 FUNCTION
410
411 DESCRIPTION
412
413 PARAMETERS
414
415 RETURN VALUE
416
417============================================================================*/
418VOS_STATUS WLANTL_StatHandleRXFrame
419(
420 v_PVOID_t pAdapter,
421 v_PVOID_t pBDHeader,
422 v_U8_t STAid,
423 v_BOOL_t isBroadcast,
424 vos_pkt_t *dataBuffer
425)
426{
427 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
428 VOS_STATUS status = VOS_STATUS_SUCCESS;
429 WLANTL_TRANSFER_STA_TYPE *statistics;
430 v_U16_t packetSize;
431
432 if(NULL == tlCtxt)
433 {
434 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
435 return VOS_STATUS_E_INVAL;
436 }
437
438 if(NULL == dataBuffer)
439 {
440 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Management Frame, not need to handle with Stat"));
441 return status;
442 }
443
444 if(0 == tlCtxt->atlSTAClients[STAid].ucExists)
445 {
446 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: %d STA ID is not exist", STAid));
447 return VOS_STATUS_E_INVAL;
448 }
449
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 statistics = &tlCtxt->atlSTAClients[STAid].trafficStatistics;
451 vos_pkt_get_packet_length(dataBuffer, &packetSize);
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -0800452
453 if(isBroadcast)
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -0800455 /* Above flag is set for both broadcast and multicast frame. So
456 find frame type to distinguish between multicast and broadcast.
457 Ideally, it would be better if BD header has a field to indicate
458 multicast frame and then we would not need to call below function */
459
460 v_U8_t ucFrameCastType;
461
462 status = WLANTL_FindFrameTypeBcMcUc(tlCtxt, STAid, dataBuffer,
463 &ucFrameCastType);
464
465 if (VOS_STATUS_SUCCESS != status)
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -0800467 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: failed to distinguish if Rx frame is broadcast or multicast"));
468 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 }
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -0800470
471 switch (ucFrameCastType)
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 {
Madan Mohan Koyyalamudia148e1e2012-11-30 14:52:59 -0800473 case WLANTL_FRAME_TYPE_BCAST:
474 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX BC frame"));
475 statistics->rxBCFcnt++;
476 statistics->rxBCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
477 break;
478
479 case WLANTL_FRAME_TYPE_MCAST:
480 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX MC frame"));
481 statistics->rxMCFcnt++;
482 statistics->rxMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
483 break;
484
485 case WLANTL_FRAME_TYPE_UCAST:
486 /* error - for unicast frame we should not reach here */
487 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: BD header indicates broadcast but MAC address indicates unicast"));
488 return VOS_STATUS_E_INVAL;
489 break;
490
491 default:
492 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: error in finding bc/mc/uc type of the received frame"));
493 return VOS_STATUS_E_INVAL;
494 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 }
496 }
497 else
498 {
499 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is RX UC frame"));
500 statistics->rxUCFcnt++;
501 statistics->rxUCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
502 }
503
504 /* TODO caculation is needed, dimension of 500kbps */
505 statistics->rxRate = WDA_GET_RX_MAC_RATE_IDX(pBDHeader);
Jeff Johnsone7245742012-09-05 17:12:55 -0700506
507 TLLOG1(VOS_TRACE (VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_MED,
508 "****Received rate Index = %ld type=%d subtype=%d****\n",
509 statistics->rxRate,WDA_GET_RX_TYPE(pBDHeader),WDA_GET_RX_SUBTYPE(pBDHeader)));
510
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 statistics->rxBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
512
513#ifdef WLANTL_HO_DEBUG_MSG
514 WLANTL_StatDebugDisplay(STAid, statistics);
515#endif /* WLANTL_HO_DEBUG_MSG */
516
517 return status;
518}
519
520/*==========================================================================
521
522 FUNCTION
523
524 DESCRIPTION
525
526 PARAMETERS
527
528 RETURN VALUE
529
530============================================================================*/
531VOS_STATUS WLANTL_StatHandleTXFrame
532(
533 v_PVOID_t pAdapter,
534 v_U8_t STAid,
535 vos_pkt_t *dataBuffer,
536 v_PVOID_t pBDHeader
Jeff Johnsone7245742012-09-05 17:12:55 -0700537#ifdef FEATURE_WLAN_INTEGRATED_SOC
538 ,WLANTL_MetaInfoType *txMetaInfo
539#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -0700540)
541{
542 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
543 VOS_STATUS status = VOS_STATUS_SUCCESS;
544 WLANTL_TRANSFER_STA_TYPE *statistics;
545 v_U16_t packetSize;
546
547 if((NULL == tlCtxt) || (NULL == dataBuffer))
548 {
549 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
550 return VOS_STATUS_E_INVAL;
551 }
552
553 if(0 == tlCtxt->atlSTAClients[STAid].ucExists)
554 {
555 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLAN TL: %d STA ID is not exist", STAid));
556 return VOS_STATUS_E_INVAL;
557 }
558
559 /* TODO : BC/MC/UC have to be determined by MAC address */
560 statistics = &tlCtxt->atlSTAClients[STAid].trafficStatistics;
561 vos_pkt_get_packet_length(dataBuffer, &packetSize);
Jeff Johnsone7245742012-09-05 17:12:55 -0700562#ifdef FEATURE_WLAN_INTEGRATED_SOC
563 if(txMetaInfo->ucBcast)
564#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 if(WLANTL_STA_ID_BCAST == STAid)
Jeff Johnsone7245742012-09-05 17:12:55 -0700566#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 {
568 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is BC frame"));
569 statistics->txBCFcnt++;
Jeff Johnsone7245742012-09-05 17:12:55 -0700570#ifdef FEATURE_WLAN_INTEGRATED_SOC
571 statistics->txBCBcnt += packetSize;
572#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 statistics->txBCBcnt += (packetSize - WLANHAL_TX_BD_HEADER_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -0700574#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700576 else if(txMetaInfo->ucMcast)
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700578 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This TX is MC frame"));
579 statistics->txMCFcnt++;
580#ifdef FEATURE_WLAN_INTEGRATED_SOC
581 statistics->txMCBcnt += packetSize;
582#else
583 statistics->txMCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
584#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 else
587 {
588 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is TX UC frame"));
589 statistics->txUCFcnt++;
Jeff Johnsone7245742012-09-05 17:12:55 -0700590#ifdef FEATURE_WLAN_INTEGRATED_SOC
591 statistics->txUCBcnt += packetSize;
592#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 statistics->txUCBcnt += (packetSize - WLANHAL_RX_BD_HEADER_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -0700594#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 }
596
597#ifdef WLANTL_HO_DEBUG_MSG
598 WLANTL_StatDebugDisplay(STAid, statistics);
599#endif /* WLANTL_HO_DEBUG_MSG */
600
601 return status;
602}
603
604/*==========================================================================
605
606 FUNCTION WLANTL_HSTrafficStatusTimerExpired
607
608 DESCRIPTION If traffic status monitoring timer is expiered,
609 Count how may frames have sent and received during
610 measure period and if traffic status is changed
611 send notification to Client(SME)
612
613 PARAMETERS pAdapter
614 Global handle
615
616 RETURN VALUE
617
618============================================================================*/
619v_VOID_t WLANTL_HSTrafficStatusTimerExpired
620(
621 v_PVOID_t pAdapter
622)
623{
624 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
625 WLANTL_HO_TRAFFIC_STATUS_HANDLE_TYPE *trafficHandle = NULL;
626 WLANTL_HO_TRAFFIC_STATUS_TYPE newTraffic;
627 v_U32_t rtFrameCount;
628 v_U32_t nrtFrameCount;
629 v_BOOL_t trafficStatusChanged = VOS_FALSE;
630
631 if(NULL == tlCtxt)
632 {
633 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
634 return;
635 }
636
637 /* Get rt and nrt frame count sum */
638 trafficHandle = &tlCtxt->hoSupport.currentTraffic;
639 rtFrameCount = trafficHandle->rtRXFrameCount + trafficHandle->rtTXFrameCount;
640 nrtFrameCount = trafficHandle->nrtRXFrameCount + trafficHandle->nrtTXFrameCount;
641
642 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Traffic status timer expired RT FC %d, NRT FC %d", rtFrameCount, nrtFrameCount));
643
644 /* Get current traffic status */
645 if(rtFrameCount > trafficHandle->idleThreshold)
646 {
647 newTraffic.rtTrafficStatus = WLANTL_HO_RT_TRAFFIC_STATUS_ON;
648 }
649 else
650 {
651 newTraffic.rtTrafficStatus = WLANTL_HO_RT_TRAFFIC_STATUS_OFF;
652 }
653
654 if(nrtFrameCount > trafficHandle->idleThreshold)
655 {
656 newTraffic.nrtTrafficStatus = WLANTL_HO_NRT_TRAFFIC_STATUS_ON;
657 }
658 else
659 {
660 newTraffic.nrtTrafficStatus = WLANTL_HO_NRT_TRAFFIC_STATUS_OFF;
661 }
662
663 /* Differentiate with old traffic status */
664 if(trafficHandle->trafficStatus.rtTrafficStatus != newTraffic.rtTrafficStatus)
665 {
666 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"RT Traffic status changed from %d to %d",
667 trafficHandle->trafficStatus.rtTrafficStatus,
668 newTraffic.rtTrafficStatus));
669 trafficStatusChanged = VOS_TRUE;
670 }
671 if(trafficHandle->trafficStatus.nrtTrafficStatus != newTraffic.nrtTrafficStatus)
672 {
673 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"NRT Traffic status changed from %d to %d",
674 trafficHandle->trafficStatus.nrtTrafficStatus,
675 newTraffic.nrtTrafficStatus));
676 trafficStatusChanged = VOS_TRUE;
677 }
678
679 /* If traffic status is changed send notification to client */
680 if((VOS_TRUE == trafficStatusChanged) && (NULL != trafficHandle->trafficCB))
681 {
682 trafficHandle->trafficCB(pAdapter, newTraffic, trafficHandle->usrCtxt);
683 trafficHandle->trafficStatus.rtTrafficStatus = newTraffic.rtTrafficStatus;
684 trafficHandle->trafficStatus.nrtTrafficStatus = newTraffic.nrtTrafficStatus;
685 }
686 else if((VOS_TRUE == trafficStatusChanged) && (NULL == trafficHandle->trafficCB))
687 {
688 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"Traffic status is changed but not need to report"));
689 }
690
691 /* Reset frame counters */
692 trafficHandle->rtRXFrameCount = 0;
693 trafficHandle->rtTXFrameCount = 0;
694 trafficHandle->nrtRXFrameCount = 0;
695 trafficHandle->nrtTXFrameCount = 0;
696
697 if(NULL != trafficHandle->trafficCB)
698 {
699 /* restart timer only when the callback is not NULL */
700 vos_timer_start(&trafficHandle->trafficTimer, trafficHandle->measurePeriod);
701 }
702
703 return;
704}
705
706
707/*==========================================================================
708
709 FUNCTION
710
711 DESCRIPTION
712
713 PARAMETERS
714
715 RETURN VALUE
716
717============================================================================*/
718VOS_STATUS WLANTL_HSGetRSSI
719(
720 v_PVOID_t pAdapter,
721 v_PVOID_t pBDHeader,
722 v_U8_t STAid,
723 v_S7_t *currentAvgRSSI
724)
725{
726 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
727 VOS_STATUS status = VOS_STATUS_SUCCESS;
728 v_S7_t currentRSSI, currentRSSI0, currentRSSI1;
729 WLANTL_CURRENT_HO_STATE_TYPE *currentHO = NULL;
730
731
732 if(NULL == tlCtxt)
733 {
734 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
735 return VOS_STATUS_E_INVAL;
736 }
737
738 /*
739 Compute RSSI only for the last MPDU of an AMPDU.
740 Only last MPDU carries the Phy Stats Values
741 */
742 if (WDA_IS_RX_AN_AMPDU (pBDHeader)) {
743 if (!WDA_IS_RX_LAST_MPDU(pBDHeader)) {
744 return VOS_STATUS_E_FAILURE;
745 }
746 }
747
748 currentHO = &tlCtxt->hoSupport.currentHOState;
749
750 currentRSSI0 = WLANTL_GETRSSI0(pBDHeader);
751 currentRSSI1 = WLANTL_GETRSSI0(pBDHeader);
752 currentRSSI = (currentRSSI0 > currentRSSI1) ? currentRSSI0 : currentRSSI1;
753
754 if (0 == currentRSSI)
755 return VOS_STATUS_E_INVAL;
756
757#ifdef WLANTL_HO_UTEST
758 TLHS_UtestHandleNewRSSI(&currentRSSI, pAdapter);
759#endif /* WLANTL_HO_UTEST */
760
761/* Commenting this part of the code as this may not be necessarity true in all cases */
762#if 0
763 if(WLANTL_HO_INVALID_RSSI == currentRSSI)
764 {
765 return status;
766 }
767#endif
768
769 if(0 == currentHO->historyRSSI)
770 {
771 *currentAvgRSSI = currentRSSI;
772 }
773 else
774 {
775 *currentAvgRSSI = ((currentHO->historyRSSI * currentHO->alpha) +
776 (currentRSSI * (10 - currentHO->alpha))) / 10;
777 }
778#ifdef RSSI_HACK
779 *currentAvgRSSI = (v_S7_t)dumpCmdRSSI;
780#endif
781
782
783 tlCtxt->atlSTAClients[STAid].rssiAvg = *currentAvgRSSI;
784
785 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current new RSSI is %d, averaged RSSI is %d", currentRSSI, *currentAvgRSSI));
786 return status;
787}
788
789/*==========================================================================
790
791 FUNCTION
792
793 DESCRIPTION
794
795 PARAMETERS
796
797 RETURN VALUE
798
799============================================================================*/
800VOS_STATUS WLANTL_HSBMPSRSSIRegionChangedNotification
801(
802 v_PVOID_t pAdapter,
803 tpSirRSSINotification pRSSINotification
804)
805{
806 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
807 VOS_STATUS status = VOS_STATUS_SUCCESS;
808 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
809 WLANTL_HO_SUPPORT_TYPE *hoSupport;
810 WLANTL_RSSICrossThresholdCBType cbFunction = NULL;
811 v_PVOID_t usrCtxt = NULL;
812 v_U8_t evtType = WLANTL_HO_THRESHOLD_NA;
813 v_U32_t preFWNotification = 0;
814 v_U32_t curFWNotification = 0;
815 v_U8_t newRegionNumber = 0;
816 v_U8_t pRegionNumber = 0, nRegionNumber = 0;
817 v_U32_t isSet;
818 v_U8_t idx, sIdx;
819
Srinivasdaaec712012-12-12 15:59:44 -0800820
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 if(NULL == tlCtxt)
822 {
823 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
824 return VOS_STATUS_E_INVAL;
825 }
826
827 if(NULL == pRSSINotification)
828 {
829 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid FW RSSI Notification"));
830 VOS_ASSERT(0);
831 return VOS_STATUS_E_INVAL;
832 }
833
834 currentHO = &(tlCtxt->hoSupport.currentHOState);
835 hoSupport = &(tlCtxt->hoSupport);
836 preFWNotification = currentHO->fwNotification;
837
838 isSet = pRSSINotification->bRssiThres1PosCross;
839 curFWNotification |= isSet << 5;
840 isSet = pRSSINotification->bRssiThres2PosCross;
841 curFWNotification |= isSet << 4;
842 isSet = pRSSINotification->bRssiThres3PosCross;
843 curFWNotification |= isSet << 3;
844 isSet = pRSSINotification->bRssiThres1NegCross;
845 curFWNotification |= isSet << 2;
846 isSet = pRSSINotification->bRssiThres2NegCross;
847 curFWNotification |= isSet << 1;
848 isSet = pRSSINotification->bRssiThres3NegCross;
849 curFWNotification |= isSet;
850 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current FW Notification is 0x%x", (v_U32_t)curFWNotification ));
851
852 currentHO->fwNotification = curFWNotification;
853
854 if(0 == preFWNotification)
855 {
856 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"This is the first time notification from FW Value is 0x%x", curFWNotification));
857 preFWNotification = curFWNotification;
858 }
859 else if(preFWNotification == curFWNotification)
860 {
861 return status;
862 }
863
864 if(1 == pRSSINotification->bRssiThres1PosCross)
865 {
866 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 0"));
867 pRegionNumber = 0;
868 }
869 else if(1 == pRSSINotification->bRssiThres2PosCross)
870 {
871 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 1"));
872 pRegionNumber = 1;
873 }
874 else if(1 == pRSSINotification->bRssiThres3PosCross)
875 {
876 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"POS Cross to Region 2"));
877 pRegionNumber = 2;
878 }
879
880 if(1 == pRSSINotification->bRssiThres3NegCross)
881 {
882 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 3"));
883 nRegionNumber = 3;
884 }
885 else if(1 == pRSSINotification->bRssiThres2NegCross)
886 {
887 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 2"));
888 nRegionNumber = 2;
889 }
890 else if(1 == pRSSINotification->bRssiThres1NegCross)
891 {
892 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"NEG Cross to Region 1"));
893 nRegionNumber = 1;
894 }
895
896
897 newRegionNumber = (nRegionNumber > pRegionNumber) ? nRegionNumber : pRegionNumber;
898 if((currentHO->regionNumber) && (newRegionNumber == currentHO->regionNumber))
899 {
900 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"No Region Change with BMPS mode"));
901 preFWNotification = curFWNotification;
902 return status;
903 }
904 else if(newRegionNumber > currentHO->regionNumber)
905 {
906 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Region Increase Worse RSSI"));
907 for(idx = currentHO->regionNumber; idx < newRegionNumber; idx++)
908 {
909 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
910 {
911 if((WLANTL_HO_THRESHOLD_DOWN == hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
912 (WLANTL_HO_THRESHOLD_CROSS == hoSupport->registeredInd[idx].triggerEvent[sIdx]))
913 {
914 if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
915 {
916 cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
917 usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
Srinivasdaaec712012-12-12 15:59:44 -0800918
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 evtType = WLANTL_HO_THRESHOLD_DOWN;
920 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
921 currentHO->regionNumber = newRegionNumber;
Srinivasdaaec712012-12-12 15:59:44 -0800922 status = cbFunction(pAdapter, evtType, usrCtxt, pRSSINotification->avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 }
924 }
925 }
926 }
927 }
928 else
929 {
930 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Region Decrease Better RSSI"));
931 idx = (currentHO->regionNumber)?(currentHO->regionNumber-1):0;
932 while (idx >= newRegionNumber)
933 {
934 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
935 {
936 if((WLANTL_HO_THRESHOLD_UP & hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
937 (WLANTL_HO_THRESHOLD_CROSS & hoSupport->registeredInd[idx].triggerEvent[sIdx]))
938 {
939 if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
940 {
941 cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
942 usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
Srinivasdaaec712012-12-12 15:59:44 -0800943
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 evtType = WLANTL_HO_THRESHOLD_UP;
945 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
946 currentHO->regionNumber = newRegionNumber;
Srinivasdaaec712012-12-12 15:59:44 -0800947 status = cbFunction(pAdapter, evtType, usrCtxt, pRSSINotification->avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 }
949 }
950 }
951 if (!idx--)
952 break;
953 }
954 }
955
956 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"BMPS State, MSG from FW, Trigger Event %d, region index %d",
957 evtType, currentHO->regionNumber));
958
959 return VOS_STATUS_SUCCESS;
960}
961
962/*==========================================================================
963
964 FUNCTION
965
966 DESCRIPTION
967
968 PARAMETERS
969
970 RETURN VALUE
971
972============================================================================*/
973VOS_STATUS WLANTL_HSHandleRSSIChange
974(
975 v_PVOID_t pAdapter,
976 v_S7_t currentRSSI
977)
978{
979 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
980 VOS_STATUS status = VOS_STATUS_SUCCESS;
981 v_U8_t currentRegion = 0;
982 v_U8_t idx, sIdx;
983 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
984 WLANTL_HO_SUPPORT_TYPE *hoSupport;
985 WLANTL_RSSICrossThresholdCBType cbFunction = NULL;
986 v_PVOID_t usrCtxt = NULL;
987 v_U8_t evtType = WLANTL_HO_THRESHOLD_NA;
988
989 if(NULL == tlCtxt)
990 {
991 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
992 return VOS_STATUS_E_INVAL;
993 }
994
995 currentHO = &(tlCtxt->hoSupport.currentHOState);
996 hoSupport = &(tlCtxt->hoSupport);
997 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"CRegion %d, NThreshold %d, HRSSI %d",
998 currentHO->regionNumber,
999 currentHO->numThreshold,
1000 currentHO->historyRSSI));
1001
1002 /* Find where is current region */
1003 for(idx = 0; idx < currentHO->numThreshold; idx++)
1004 {
1005 if(hoSupport->registeredInd[idx].rssiValue < currentRSSI)
1006 {
1007 currentRegion = idx;
1008 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found region %d, not bottom", currentRegion));
1009 break;
1010 }
1011 }
1012
1013 /* If could not find then new RSSI is belong to bottom region */
1014 if(idx == currentHO->numThreshold)
1015 {
1016 currentRegion = idx;
1017 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current region is bottom %d", idx));
1018 }
1019
1020 /* This is a hack. Actual assignment was happening after the below checks. This hack is needed till TL
1021 posts message and nothing else in the callback indicating UP/DOWN event to the registered module */
1022 currentHO->historyRSSI = currentRSSI;
1023
1024 if(currentRegion == currentHO->regionNumber)
1025 {
1026 currentHO->historyRSSI = currentRSSI;
1027 return status;
1028 }
1029 else if(currentRegion > currentHO->regionNumber)
1030 {
1031 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Region Increase Worse RSSI"));
1032 for(idx = currentHO->regionNumber; idx < currentRegion; idx++)
1033 {
1034 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1035 {
1036 if((WLANTL_HO_THRESHOLD_DOWN == hoSupport->registeredInd[idx].triggerEvent[sIdx]) ||
1037 (WLANTL_HO_THRESHOLD_CROSS == hoSupport->registeredInd[idx].triggerEvent[sIdx]))
1038 {
1039 if(NULL != hoSupport->registeredInd[idx].crossCBFunction[sIdx])
1040 {
1041 cbFunction = hoSupport->registeredInd[idx].crossCBFunction[sIdx];
1042 usrCtxt = hoSupport->registeredInd[idx].usrCtxt[sIdx];
Srinivasdaaec712012-12-12 15:59:44 -08001043
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 evtType = WLANTL_HO_THRESHOLD_DOWN;
1045 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx].triggerEvent[sIdx], idx));
Srinivasdaaec712012-12-12 15:59:44 -08001046 status = WLANTL_HSSerializeTlIndication(pAdapter, evtType, usrCtxt, cbFunction, currentRSSI);
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 }
1048 }
1049 }
1050 }
1051 }
1052 else
1053 {
1054 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Region Decrease Better RSSI"));
1055 for(idx = currentHO->regionNumber; idx > currentRegion; idx--)
1056 {
1057 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1058 {
1059 if((WLANTL_HO_THRESHOLD_UP & hoSupport->registeredInd[idx - 1].triggerEvent[sIdx]) ||
1060 (WLANTL_HO_THRESHOLD_CROSS & hoSupport->registeredInd[idx - 1].triggerEvent[sIdx]))
1061 {
1062 if(NULL != hoSupport->registeredInd[idx - 1].crossCBFunction[sIdx])
1063 {
1064 cbFunction = hoSupport->registeredInd[idx - 1].crossCBFunction[sIdx];
1065 usrCtxt = hoSupport->registeredInd[idx - 1].usrCtxt[sIdx];
Srinivasdaaec712012-12-12 15:59:44 -08001066
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 evtType = WLANTL_HO_THRESHOLD_UP;
1068 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Trigger Event %d, region index %d", hoSupport->registeredInd[idx - 1].triggerEvent[sIdx], idx - 1));
Srinivasdaaec712012-12-12 15:59:44 -08001069 status = WLANTL_HSSerializeTlIndication(pAdapter, evtType, usrCtxt, cbFunction, currentRSSI);
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 }
1071 }
1072 }
1073 }
1074 }
1075
1076 currentHO->historyRSSI = currentRSSI;
1077 currentHO->regionNumber = currentRegion;
1078 WLANTL_HSDebugDisplay(pAdapter);
1079
1080 if(!VOS_IS_STATUS_SUCCESS(status))
1081 {
1082 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Client fail to handle region change in normal mode %d", status));
1083 }
1084 return VOS_STATUS_SUCCESS;
1085}
1086
1087/*==========================================================================
1088
1089 FUNCTION
1090
1091 DESCRIPTION
1092
1093 PARAMETERS
1094
1095 RETURN VALUE
1096
1097============================================================================*/
1098VOS_STATUS WLANTL_HSHandleRXFrame
1099(
1100 v_PVOID_t pAdapter,
1101 v_U8_t frameType,
1102 v_PVOID_t pBDHeader,
1103 v_U8_t STAid,
1104 v_BOOL_t isBroadcast,
1105 vos_pkt_t *dataBuffer
1106)
1107{
1108 WLANTL_CURRENT_HO_STATE_TYPE *currentHO = NULL;
1109 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1110 VOS_STATUS status = VOS_STATUS_SUCCESS;
1111 v_S7_t currentAvgRSSI = 0;
1112 v_U8_t ac;
1113 v_U32_t currentTimestamp;
1114 v_U8_t tid;
1115
1116 if(NULL == tlCtxt)
1117 {
1118 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1119 return VOS_STATUS_E_INVAL;
1120 }
1121
1122 WLANTL_StatHandleRXFrame(pAdapter, pBDHeader, STAid, isBroadcast, dataBuffer);
1123
1124 /* If this frame is not management frame increase frame count */
1125 if((0 != tlCtxt->hoSupport.currentTraffic.idleThreshold) &&
1126 (WLANTL_MGMT_FRAME_TYPE != frameType))
1127 {
1128 tid = WDA_GET_RX_TID( pBDHeader );
1129 ac = WLANTL_HO_TID_2_AC[(v_U8_t)tid];
1130
1131 /* Only Voice traffic is handled as real time traffic */
1132 if(WLANTL_AC_VO == ac)
1133 {
1134 tlCtxt->hoSupport.currentTraffic.rtRXFrameCount++;
1135 }
1136 else
1137 {
1138 tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount++;
1139 }
1140 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"RX frame AC %d, RT Frame Count %d, NRT Frame Count %d",
1141 ac,
1142 tlCtxt->hoSupport.currentTraffic.rtRXFrameCount,
1143 tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount));
1144 }
1145
1146 currentHO = &tlCtxt->hoSupport.currentHOState;
1147 if(VOS_TRUE == tlCtxt->isBMPS)
1148 {
1149 WLANTL_HSGetRSSI(pAdapter, pBDHeader, STAid, &currentAvgRSSI);
Madan Mohan Koyyalamudi88537f72012-10-05 12:23:32 -07001150 currentHO->historyRSSI = currentAvgRSSI;
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 return status;
1152 }
1153
1154 currentTimestamp = WDA_GET_RX_TIMESTAMP(pBDHeader);
1155 if((currentTimestamp - currentHO->sampleTime) < WLANTL_HO_SAMPLING_PERIOD)
1156 {
1157 return status;
1158 }
1159 currentHO->sampleTime = currentTimestamp;
1160
Jeff Johnsone7245742012-09-05 17:12:55 -07001161 /* Get Current RSSI from BD Heaser */
1162 status = WLANTL_HSGetRSSI(pAdapter, pBDHeader, STAid, &currentAvgRSSI);
1163 if(!VOS_IS_STATUS_SUCCESS(status))
1164 {
1165 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Get RSSI Fail"));
1166 return status;
1167 }
Yathish9f22e662012-12-10 14:21:35 -08001168#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1169 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1170#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001171 {
Yathish9f22e662012-12-10 14:21:35 -08001172 /* If any threshold is not registerd, DO NOTHING! */
1173 if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 {
Yathish9f22e662012-12-10 14:21:35 -08001175 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"There is no thresholds pass"));
1176 }
1177 else
1178 {
1179 /* Handle current RSSI value, region, notification, etc */
1180 status = WLANTL_HSHandleRSSIChange(pAdapter, currentAvgRSSI);
1181 if(!VOS_IS_STATUS_SUCCESS(status))
1182 {
1183 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Handle new RSSI fail"));
1184 return status;
1185 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 }
1187 }
1188
1189 return status;
1190}
1191
1192/*==========================================================================
1193
1194 FUNCTION
1195
1196 DESCRIPTION
1197
1198 PARAMETERS
1199
1200 RETURN VALUE
1201
1202============================================================================*/
1203VOS_STATUS WLANTL_HSHandleTXFrame
1204(
1205 v_PVOID_t pAdapter,
1206 v_U8_t ac,
1207 v_U8_t STAid,
1208 vos_pkt_t *dataBuffer,
1209 v_PVOID_t bdHeader
1210)
1211{
1212 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1213 VOS_STATUS status = VOS_STATUS_SUCCESS;
1214
1215 if(NULL == tlCtxt)
1216 {
1217 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1218 return VOS_STATUS_E_INVAL;
1219 }
1220
1221 /* Traffic status report is not registered, JUST DO NOTHING */
1222 if(0 == tlCtxt->hoSupport.currentTraffic.idleThreshold)
1223 {
1224 return VOS_STATUS_SUCCESS;
1225 }
1226
Jeff Johnsone7245742012-09-05 17:12:55 -07001227#ifndef FEATURE_WLAN_INTEGRATED_SOC
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 WLANTL_StatHandleTXFrame(pAdapter, STAid, dataBuffer, bdHeader);
Jeff Johnsone7245742012-09-05 17:12:55 -07001229#endif /* FEATURE_WLAN_INTEGRATED_SOC */
Jeff Johnson295189b2012-06-20 16:38:30 -07001230
1231 /* Only Voice traffic is handled as real time traffic */
1232 if(WLANTL_AC_VO == ac)
1233 {
1234 tlCtxt->hoSupport.currentTraffic.rtTXFrameCount++;
1235 }
1236 else
1237 {
1238 tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount++;
1239 }
1240 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"TX frame AC %d, RT Frame Count %d, NRT Frame Count %d",
1241 ac,
1242 tlCtxt->hoSupport.currentTraffic.rtTXFrameCount,
1243 tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount));
1244
1245 return status;
1246}
1247
1248/*==========================================================================
1249
1250 FUNCTION
1251
1252 DESCRIPTION
1253
1254 PARAMETERS
1255
1256 RETURN VALUE
1257
1258============================================================================*/
1259VOS_STATUS WLANTL_HSRegRSSIIndicationCB
1260(
1261 v_PVOID_t pAdapter,
1262 v_S7_t rssiValue,
1263 v_U8_t triggerEvent,
1264 WLANTL_RSSICrossThresholdCBType crossCBFunction,
1265 VOS_MODULE_ID moduleID,
1266 v_PVOID_t usrCtxt
1267)
1268{
1269 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1270 VOS_STATUS status = VOS_STATUS_SUCCESS;
1271 v_U8_t idx, sIdx;
1272 WLANTL_HO_SUPPORT_TYPE *hoSupport;
1273 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
1274 v_U8_t clientOrder = 0;
1275
1276 if(NULL == tlCtxt)
1277 {
1278 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1279 return VOS_STATUS_E_INVAL;
1280 }
1281
1282 if((-1 < rssiValue) || (NULL == crossCBFunction))
1283 {
1284 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Reg Invalid Argument"));
1285 return VOS_STATUS_E_INVAL;
1286 }
1287
1288 THSGETLOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1289
1290 currentHO = &(tlCtxt->hoSupport.currentHOState);
1291 hoSupport = &(tlCtxt->hoSupport);
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001292 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Make Registration Module %d, Event %d, RSSI %d", moduleID, triggerEvent, rssiValue));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293
1294 if((WLANTL_MAX_AVAIL_THRESHOLD < currentHO->numThreshold) ||
1295 (WLANTL_MAX_AVAIL_THRESHOLD == currentHO->numThreshold))
1296 {
1297 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"No more available slot, please DEL first %d",
1298 currentHO->numThreshold));
1299 THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1300 return VOS_STATUS_E_RESOURCES;
1301 }
1302
1303 if(0 == currentHO->numThreshold)
1304 {
1305 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"First Registration"));
1306 hoSupport->registeredInd[0].rssiValue = rssiValue;
1307 hoSupport->registeredInd[0].triggerEvent[0] = triggerEvent;
1308 hoSupport->registeredInd[0].crossCBFunction[0] = crossCBFunction;
1309 hoSupport->registeredInd[0].usrCtxt[0] = usrCtxt;
1310 hoSupport->registeredInd[0].whoIsClient[0] = moduleID;
1311 hoSupport->registeredInd[0].numClient++;
1312 }
1313 else
1314 {
1315 for(idx = 0; idx < currentHO->numThreshold; idx++)
1316 {
1317 if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
1318 {
1319 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1320 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001321 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Reg CB P 0x%x, registered CB P 0x%x",
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 crossCBFunction,
1323 hoSupport->registeredInd[idx].crossCBFunction[sIdx]));
1324 if(crossCBFunction == hoSupport->registeredInd[idx].crossCBFunction[sIdx])
1325 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001326 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Same RSSI %d, Same CB 0x%x already registered",
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 rssiValue, crossCBFunction));
1328 WLANTL_HSDebugDisplay(pAdapter);
1329 THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1330 return status;
1331 }
1332 }
1333
1334 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1335 {
1336 if(NULL == hoSupport->registeredInd[idx].crossCBFunction[sIdx])
1337 {
1338 clientOrder = sIdx;
1339 break;
1340 }
1341 }
1342 hoSupport->registeredInd[idx].triggerEvent[clientOrder] = triggerEvent;
1343 hoSupport->registeredInd[idx].crossCBFunction[clientOrder] = crossCBFunction;
1344 hoSupport->registeredInd[idx].usrCtxt[clientOrder] = usrCtxt;
1345 hoSupport->registeredInd[idx].whoIsClient[clientOrder] = moduleID;
1346 hoSupport->registeredInd[idx].numClient++;
1347 WLANTL_HSDebugDisplay(pAdapter);
1348 THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1349 return status;
1350 }
1351 }
1352 for(idx = 0; idx < currentHO->numThreshold; idx++)
1353 {
1354 if(rssiValue > hoSupport->registeredInd[idx].rssiValue)
1355 {
1356 for(sIdx = (currentHO->numThreshold - 1); (sIdx > idx) || (sIdx == idx); sIdx--)
1357 {
1358 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "Shift %d array to %d", sIdx, sIdx + 1));
1359 memcpy(&hoSupport->registeredInd[sIdx + 1], &hoSupport->registeredInd[sIdx], sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
1360 memset(&hoSupport->registeredInd[sIdx], 0, sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
1361 if(0 == sIdx)
1362 {
1363 break;
1364 }
1365 }
1366 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Put in Here %d", idx));
1367 hoSupport->registeredInd[idx].rssiValue = rssiValue;
1368 hoSupport->registeredInd[idx].triggerEvent[0] = triggerEvent;
1369 hoSupport->registeredInd[idx].crossCBFunction[0] = crossCBFunction;
1370 hoSupport->registeredInd[idx].usrCtxt[0] = usrCtxt;
1371 hoSupport->registeredInd[idx].whoIsClient[0] = moduleID;
1372 hoSupport->registeredInd[idx].numClient++;
1373 break;
1374 }
1375 }
1376 if(currentHO->numThreshold == idx)
1377 {
1378 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO, "New threshold put in bottom"));
1379
1380 hoSupport->registeredInd[currentHO->numThreshold].rssiValue = rssiValue;
1381 hoSupport->registeredInd[currentHO->numThreshold].triggerEvent[0] = triggerEvent;
1382 hoSupport->registeredInd[currentHO->numThreshold].crossCBFunction[0] = crossCBFunction;
1383 hoSupport->registeredInd[currentHO->numThreshold].usrCtxt[0] = usrCtxt;
1384 hoSupport->registeredInd[currentHO->numThreshold].whoIsClient[0] = moduleID;
1385 hoSupport->registeredInd[currentHO->numThreshold].numClient++;
1386 }
1387 }
1388
1389 currentHO->numThreshold++;
1390 if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue > currentHO->historyRSSI))
1391 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001392 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Added Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 if(4 > currentHO->regionNumber)
1394 {
1395 currentHO->regionNumber++;
1396 }
1397 else
1398 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001399 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Current region number is max %d, cannot increase anymore", currentHO->regionNumber));
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 }
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001401 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"increase region number without notification %d", currentHO->regionNumber));
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 }
1403 else if(VOS_TRUE == tlCtxt->isBMPS)
1404 {
1405 if(0 != currentHO->regionNumber)
1406 {
1407 if(hoSupport->registeredInd[currentHO->regionNumber].rssiValue < rssiValue)
1408 {
1409 currentHO->regionNumber++;
1410 if((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
1411 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001412 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
Srinivasdaaec712012-12-12 15:59:44 -08001413 WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt, crossCBFunction,
1414 hoSupport->registeredInd[currentHO->regionNumber].rssiValue);
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 }
1416 }
1417 else if((currentHO->regionNumber < (currentHO->numThreshold - 1)) &&
1418 (hoSupport->registeredInd[currentHO->regionNumber + 1].rssiValue > rssiValue))
1419 {
1420 if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
1421 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001422 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 }
1424 }
1425 }
1426 else
1427 {
1428 if(hoSupport->registeredInd[currentHO->regionNumber].rssiValue > rssiValue)
1429 {
1430 if((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent))
1431 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001432 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 }
1434 }
1435 }
1436 }
1437
1438 if((VOS_FALSE == tlCtxt->isBMPS) &&
1439 (rssiValue >= currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
1440 ((WLANTL_HO_THRESHOLD_DOWN == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
1441 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001442 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value larger than Current RSSI, and DOWN event, Send Notification"));
Srinivasdaaec712012-12-12 15:59:44 -08001443 WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_DOWN, usrCtxt, crossCBFunction, currentHO->historyRSSI);
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 }
1445 else if((VOS_FALSE == tlCtxt->isBMPS) &&
1446 (rssiValue < currentHO->historyRSSI) && (0 != currentHO->historyRSSI) &&
1447 ((WLANTL_HO_THRESHOLD_UP == triggerEvent) || (WLANTL_HO_THRESHOLD_CROSS == triggerEvent)))
1448 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001449 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Registered RSSI value smaller than Current RSSI, and UP event, Send Notification"));
Srinivasdaaec712012-12-12 15:59:44 -08001450 WLANTL_HSSerializeTlIndication(pAdapter, WLANTL_HO_THRESHOLD_UP, usrCtxt, crossCBFunction, currentHO->historyRSSI);
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 }
1452
Yathish9f22e662012-12-10 14:21:35 -08001453 if((VOS_TRUE == tlCtxt->isBMPS) || (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 {
Madan Mohan Koyyalamudib8917912012-10-31 14:03:52 -07001455 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Register into FW, now BMPS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 /* this function holds the lock across a downstream WDA function call, this is violates some lock
1457 ordering checks done on some HLOS see CR323221*/
1458 THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1459 WLANTL_SetFWRSSIThresholds(pAdapter);
1460 THSGETLOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1461 }
1462
1463 WLANTL_HSDebugDisplay(pAdapter);
1464 THSRELEASELOCK("WLANTL_HSRegRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1465 return status;
1466}
1467
1468/*==========================================================================
1469
1470 FUNCTION
1471
1472 DESCRIPTION
1473
1474 PARAMETERS
1475
1476 RETURN VALUE
1477
1478============================================================================*/
1479VOS_STATUS WLANTL_HSDeregRSSIIndicationCB
1480(
1481 v_PVOID_t pAdapter,
1482 v_S7_t rssiValue,
1483 v_U8_t triggerEvent,
1484 WLANTL_RSSICrossThresholdCBType crossCBFunction,
1485 VOS_MODULE_ID moduleID
1486)
1487{
1488 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1489 VOS_STATUS status = VOS_STATUS_SUCCESS;
1490 v_U8_t idx, sIdx;
1491 WLANTL_HO_SUPPORT_TYPE *hoSupport;
1492 WLANTL_CURRENT_HO_STATE_TYPE *currentHO;
1493 v_BOOL_t bmpsAbove = VOS_FALSE;
1494
1495 if(NULL == tlCtxt)
1496 {
1497 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1498 return VOS_STATUS_E_INVAL;
1499 }
1500
1501 if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
1502 {
Mohit Khanna23863762012-09-11 17:40:09 -07001503 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Empty list, can not remove"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 return VOS_STATUS_E_EMPTY;
1505 }
1506
1507 THSGETLOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1508 currentHO = &(tlCtxt->hoSupport.currentHOState);
1509 hoSupport = &(tlCtxt->hoSupport);
1510
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001511 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"DEL target RSSI %d, event %d", rssiValue, triggerEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07001512
1513 if((VOS_TRUE == tlCtxt->isBMPS) && (0 < currentHO->regionNumber))
1514 {
1515 if(rssiValue >= hoSupport->registeredInd[currentHO->regionNumber - 1].rssiValue)
1516 {
1517 bmpsAbove = VOS_TRUE;
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001518 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Remove Threshold larger than current region"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 }
1520 }
1521
1522 for(idx = 0; idx < currentHO->numThreshold; idx++)
1523 {
1524 if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
1525 {
1526 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1527 {
1528 if(crossCBFunction == tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx])
1529 {
1530 tlCtxt->hoSupport.registeredInd[idx].triggerEvent[sIdx] = 0;
1531 tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx] = NULL;
1532 tlCtxt->hoSupport.registeredInd[idx].usrCtxt[sIdx] = NULL;
1533 tlCtxt->hoSupport.registeredInd[idx].whoIsClient[sIdx] = 0;
1534 tlCtxt->hoSupport.registeredInd[idx].numClient--;
1535 }
1536 }
1537 if(0 != tlCtxt->hoSupport.registeredInd[idx].numClient)
1538 {
1539 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found Multiple idx is %d", idx));
1540 WLANTL_HSDebugDisplay(pAdapter);
1541 THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1542 return status;
1543 }
1544 else
1545 {
1546 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Found Single idx is %d", idx));
1547 break;
1548 }
1549 }
1550 }
1551 if(idx == currentHO->numThreshold)
1552 {
Madan Mohan Koyyalamudib8917912012-10-31 14:03:52 -07001553 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Could not find entry, maybe invalid arg"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1555 return VOS_STATUS_E_INVAL;
1556 }
1557
1558 for(idx = 0; idx < currentHO->numThreshold; idx++)
1559 {
1560 if(rssiValue == hoSupport->registeredInd[idx].rssiValue)
1561 {
1562 if((currentHO->numThreshold - 1) == idx)
1563 {
1564 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Remove target is last one"));
1565 /* Does not need move any element, just remove last array entry */
1566 }
1567 else
1568 {
1569 for(sIdx = idx; sIdx < (currentHO->numThreshold - 1); sIdx++)
1570 {
1571 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Shift up from %d to %d", sIdx + 1, sIdx));
1572 memcpy(&hoSupport->registeredInd[sIdx], &hoSupport->registeredInd[sIdx + 1], sizeof(WLANTL_HO_RSSI_INDICATION_TYPE));
1573 }
1574 }
1575 break;
1576 }
1577 }
1578 /* Common remove last array entry */
1579 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].rssiValue = WLANTL_HO_DEFAULT_RSSI;
1580 for(idx = 0; idx < WLANTL_HS_NUM_CLIENT; idx++)
1581 {
1582 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].triggerEvent[idx] = WLANTL_HO_THRESHOLD_NA;
1583 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].crossCBFunction[idx] = NULL;
1584 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].usrCtxt[idx] = NULL;
1585 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].whoIsClient[idx] = 0;
1586 tlCtxt->hoSupport.registeredInd[currentHO->numThreshold - 1].numClient = 0;
1587 }
1588
1589 if((VOS_FALSE == tlCtxt->isBMPS) && (rssiValue >= currentHO->historyRSSI))
1590 {
Madan Mohan Koyyalamudi179e6fe2012-10-15 15:31:08 -07001591 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Removed Threshold above current RSSI level, old RN %d", currentHO->regionNumber));
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 if(0 < currentHO->regionNumber)
1593 {
1594 currentHO->regionNumber--;
1595 }
1596 else
1597 {
1598 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Current Region number is 0, cannot decrease anymore"));
1599 }
1600 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Decrease region number without notification %d", currentHO->regionNumber));
1601 }
1602 else if((VOS_TRUE == tlCtxt->isBMPS) && (VOS_TRUE == bmpsAbove))
1603 {
1604 currentHO->regionNumber--;
1605 }
1606 /* Decrease number of thresholds */
1607 tlCtxt->hoSupport.currentHOState.numThreshold--;
1608 /*Reset the FW notification*/
1609 tlCtxt->hoSupport.currentHOState.fwNotification=0;
1610
Yathish9f22e662012-12-10 14:21:35 -08001611 if((VOS_TRUE == tlCtxt->isBMPS) || (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 {
1613 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Register into FW, now BMPS"));
1614 /* this function holds the lock across a downstream WDA function call, this is violates some lock
1615 ordering checks done on some HLOS see CR323221*/
1616 THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1617 WLANTL_SetFWRSSIThresholds(pAdapter);
1618 THSGETLOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1619 }
1620
1621 /* Based on new threshold set recalculated current RSSI status */
1622 if(0 < tlCtxt->hoSupport.currentHOState.numThreshold)
1623 {
1624 }
1625 else if(0 == tlCtxt->hoSupport.currentHOState.numThreshold)
1626 {
1627 currentHO->regionNumber = 0;
1628 TLLOGW(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_WARN,"No registered Threshold"));
1629 /* What should do? */
1630 }
1631
1632 WLANTL_HSDebugDisplay(pAdapter);
1633 THSRELEASELOCK("WLANTL_HSDeregRSSIIndicationCB", &tlCtxt->hoSupport.hosLock);
1634 return status;
1635}
1636
1637/*==========================================================================
1638
1639 FUNCTION
1640
1641 DESCRIPTION
1642
1643 PARAMETERS
1644
1645 RETURN VALUE
1646
1647============================================================================*/
1648VOS_STATUS WLANTL_HSSetAlpha
1649(
1650 v_PVOID_t pAdapter,
1651 int valueAlpha
1652)
1653{
1654 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1655 VOS_STATUS status = VOS_STATUS_SUCCESS;
1656
1657 if(NULL == tlCtxt)
1658 {
1659 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1660 return VOS_STATUS_E_INVAL;
1661 }
1662
1663 THSGETLOCK("WLANTL_HSSetAlpha", &tlCtxt->hoSupport.hosLock);
1664 tlCtxt->hoSupport.currentHOState.alpha = (v_U8_t)valueAlpha;
1665 THSRELEASELOCK("WLANTL_HSSetAlpha", &tlCtxt->hoSupport.hosLock);
1666 return status;
1667}
1668
1669/*==========================================================================
1670
1671 FUNCTION
1672
1673 DESCRIPTION
1674
1675 PARAMETERS
1676
1677 RETURN VALUE
1678
1679============================================================================*/
1680VOS_STATUS WLANTL_HSRegGetTrafficStatus
1681(
1682 v_PVOID_t pAdapter,
1683 v_U32_t idleThreshold,
1684 v_U32_t period,
1685 WLANTL_TrafficStatusChangedCBType trfficStatusCB,
1686 v_PVOID_t usrCtxt
1687)
1688{
1689 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1690 VOS_STATUS status = VOS_STATUS_SUCCESS;
1691
1692 if(NULL == tlCtxt)
1693 {
1694 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1695 return VOS_STATUS_E_INVAL;
1696 }
1697
1698 if((0 == idleThreshold) || (0 == period) || (NULL == trfficStatusCB))
1699 {
1700 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid Argument Passed from SME"));
1701 return VOS_STATUS_E_INVAL;
1702 }
1703
1704 tlCtxt->hoSupport.currentTraffic.idleThreshold = idleThreshold;
1705 tlCtxt->hoSupport.currentTraffic.measurePeriod = period;
1706 tlCtxt->hoSupport.currentTraffic.trafficCB = trfficStatusCB;
1707 tlCtxt->hoSupport.currentTraffic.usrCtxt = usrCtxt;
1708
1709 vos_timer_start(&tlCtxt->hoSupport.currentTraffic.trafficTimer,
1710 tlCtxt->hoSupport.currentTraffic.measurePeriod);
1711
1712 return status;
1713}
1714
1715/*==========================================================================
1716
1717 FUNCTION
1718
1719 DESCRIPTION
1720
1721 PARAMETERS
1722
1723 RETURN VALUE
1724
1725============================================================================*/
1726VOS_STATUS WLANTL_HSInit
1727(
1728 v_PVOID_t pAdapter
1729)
1730{
1731 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1732 VOS_STATUS status = VOS_STATUS_SUCCESS;
1733 v_U8_t idx, sIdx;
1734
1735 if(NULL == tlCtxt)
1736 {
1737 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1738 return VOS_STATUS_E_INVAL;
1739 }
1740#ifdef WLANTL_HO_UTEST
1741 rssi = 0;
1742 direction = -1;
1743#endif /* WLANTL_HO_UTEST */
1744
1745 /* set default current HO status */
1746 tlCtxt->hoSupport.currentHOState.alpha = WLANTL_HO_DEFAULT_ALPHA;
1747 tlCtxt->hoSupport.currentHOState.historyRSSI = 0;
1748 tlCtxt->hoSupport.currentHOState.numThreshold = 0;
1749 tlCtxt->hoSupport.currentHOState.regionNumber = 0;
1750 tlCtxt->hoSupport.currentHOState.sampleTime = 0;
1751
1752 /* set default current traffic status */
1753 tlCtxt->hoSupport.currentTraffic.trafficStatus.rtTrafficStatus
1754 = WLANTL_HO_RT_TRAFFIC_STATUS_OFF;
1755 tlCtxt->hoSupport.currentTraffic.trafficStatus.nrtTrafficStatus
1756 = WLANTL_HO_NRT_TRAFFIC_STATUS_OFF;
1757 tlCtxt->hoSupport.currentTraffic.idleThreshold = 0;
1758 tlCtxt->hoSupport.currentTraffic.measurePeriod = 0;
1759 tlCtxt->hoSupport.currentTraffic.rtRXFrameCount = 0;
1760 tlCtxt->hoSupport.currentTraffic.rtTXFrameCount = 0;
1761 tlCtxt->hoSupport.currentTraffic.nrtRXFrameCount = 0;
1762 tlCtxt->hoSupport.currentTraffic.nrtTXFrameCount = 0;
1763 tlCtxt->hoSupport.currentTraffic.trafficCB = NULL;
1764
1765 /* Initialize indication array */
1766 for(idx = 0; idx < WLANTL_MAX_AVAIL_THRESHOLD; idx++)
1767 {
1768 for(sIdx = 0; sIdx < WLANTL_HS_NUM_CLIENT; sIdx++)
1769 {
1770 tlCtxt->hoSupport.registeredInd[idx].triggerEvent[sIdx] = WLANTL_HO_THRESHOLD_NA;
1771 tlCtxt->hoSupport.registeredInd[idx].crossCBFunction[sIdx] = NULL;
1772 tlCtxt->hoSupport.registeredInd[idx].usrCtxt[sIdx] = NULL;
1773 tlCtxt->hoSupport.registeredInd[idx].whoIsClient[sIdx] = 0;
1774 }
1775 tlCtxt->hoSupport.registeredInd[idx].rssiValue = WLANTL_HO_DEFAULT_RSSI;
1776 tlCtxt->hoSupport.registeredInd[idx].numClient = 0;
1777 }
1778
1779 vos_timer_init(&tlCtxt->hoSupport.currentTraffic.trafficTimer,
1780 VOS_TIMER_TYPE_SW,
1781 WLANTL_HSTrafficStatusTimerExpired,
1782 pAdapter);
1783
1784
1785 vos_lock_init(&tlCtxt->hoSupport.hosLock);
1786 tlCtxt->hoSupport.macCtxt = vos_get_context(VOS_MODULE_ID_SME, pAdapter);
1787
1788 return status;
1789}
1790
1791
1792/*==========================================================================
1793
1794 FUNCTION WLANTL_HSDeInit
1795
1796 DESCRIPTION
1797
1798 PARAMETERS
1799
1800 RETURN VALUE
1801
1802============================================================================*/
1803
1804VOS_STATUS WLANTL_HSDeInit
1805(
1806 v_PVOID_t pAdapter
1807)
1808{
1809 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1810 VOS_STATUS status = VOS_STATUS_SUCCESS;
1811
1812 if(NULL == tlCtxt)
1813 {
1814 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1815 return VOS_STATUS_E_INVAL;
1816 }
1817
1818 // Destroy the timer...
1819 status = vos_timer_destroy( &tlCtxt->hoSupport.currentTraffic.trafficTimer );
1820 if ( !VOS_IS_STATUS_SUCCESS( status ) )
1821 {
1822 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"WLANTL_HSStop: Timer Destroy Fail Status %d", status));
1823 }
1824 return status;
1825}
1826
1827
1828/*==========================================================================
1829
1830 FUNCTION
1831
1832 DESCRIPTION
1833
1834 PARAMETERS
1835
1836 RETURN VALUE
1837
1838============================================================================*/
1839VOS_STATUS WLANTL_HSStop
1840(
1841 v_PVOID_t pAdapter
1842)
1843{
1844 WLANTL_CbType *tlCtxt = VOS_GET_TL_CB(pAdapter);
1845 VOS_STATUS status = VOS_STATUS_SUCCESS;
1846 VOS_TIMER_STATE timerState;
1847
1848 if(NULL == tlCtxt)
1849 {
1850 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Invalid TL handle"));
1851 return VOS_STATUS_E_INVAL;
1852 }
1853
1854 timerState = vos_timer_getCurrentState(&tlCtxt->hoSupport.currentTraffic.trafficTimer);
1855 if(VOS_TIMER_STATE_RUNNING == timerState)
1856 {
1857 TLLOG1(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO,"Stop Traffic status monitoring timer"));
1858 status = vos_timer_stop(&tlCtxt->hoSupport.currentTraffic.trafficTimer);
1859 }
1860 if(VOS_STATUS_SUCCESS != status)
1861 {
1862 TLLOGE(VOS_TRACE(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,"Timer Stop Failed, Status %d", status));
1863 }
1864
1865 //Deregister the traffic Status
1866 tlCtxt->hoSupport.currentTraffic.idleThreshold = 0;
1867 tlCtxt->hoSupport.currentTraffic.measurePeriod = 0;
1868 tlCtxt->hoSupport.currentTraffic.trafficCB = NULL;
1869 tlCtxt->hoSupport.currentTraffic.usrCtxt = NULL;
1870
1871 return status;
1872}
Jeff Johnsone7245742012-09-05 17:12:55 -07001873
1874/*==========================================================================
1875
1876 FUNCTION
1877
1878 DESCRIPTION
1879
1880 PARAMETERS
1881
1882 RETURN VALUE
1883
1884============================================================================*/
1885VOS_STATUS WLANTL_HSSerializeTlIndication
1886(
1887 v_PVOID_t pAdapter,
1888 v_U8_t rssiNotification,
1889 v_PVOID_t pUserCtxt,
Srinivasdaaec712012-12-12 15:59:44 -08001890 WLANTL_RSSICrossThresholdCBType cbFunction,
1891 v_U8_t avgRssi
Jeff Johnsone7245742012-09-05 17:12:55 -07001892)
1893{
1894 VOS_STATUS status = VOS_STATUS_SUCCESS;
1895 vos_msg_t msg;
1896 WLANTL_TlIndicationReq *pMsg;
1897
1898 pMsg = vos_mem_malloc(sizeof(WLANTL_TlIndicationReq));
1899 if ( NULL == pMsg )
1900 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001901 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "In %s, failed to allocate mem for req", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07001902 return VOS_STATUS_E_NOMEM;
1903 }
1904
1905 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_RSSI_IND);
1906 pMsg->msgLen = (tANI_U16)sizeof(WLANTL_TlIndicationReq);
1907 pMsg->sessionId = 0;//for now just pass 0
1908 pMsg->pAdapter = pAdapter;
1909 pMsg->pUserCtxt = pUserCtxt;
1910 pMsg->rssiNotification = rssiNotification;
Srinivasdaaec712012-12-12 15:59:44 -08001911 pMsg->avgRssi = avgRssi;
Jeff Johnsone7245742012-09-05 17:12:55 -07001912 pMsg->tlCallback = cbFunction;
1913
1914
1915 msg.type = eWNI_SME_RSSI_IND;
1916 msg.bodyptr = pMsg;
1917 msg.reserved = 0;
1918
1919 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
1920 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001921 VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "In %s, failed to post msg to self", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07001922 vos_mem_free(pMsg);
1923 status = VOS_STATUS_E_FAILURE;
1924 }
1925
1926 return status;
1927}
1928
1929#endif //FEATURE_WLAN_GEN6_ROAMING || WLAN_FEATURE_NEIGHBOR_ROAMING