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