1 /**************************************************************************** 2 **+-----------------------------------------------------------------------+** 3 **| |** 4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** 5 **| All rights reserved. |** 6 **| |** 7 **| Redistribution and use in source and binary forms, with or without |** 8 **| modification, are permitted provided that the following conditions |** 9 **| are met: |** 10 **| |** 11 **| * Redistributions of source code must retain the above copyright |** 12 **| notice, this list of conditions and the following disclaimer. |** 13 **| * Redistributions in binary form must reproduce the above copyright |** 14 **| notice, this list of conditions and the following disclaimer in |** 15 **| the documentation and/or other materials provided with the |** 16 **| distribution. |** 17 **| * Neither the name Texas Instruments nor the names of its |** 18 **| contributors may be used to endorse or promote products derived |** 19 **| from this software without specific prior written permission. |** 20 **| |** 21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** 22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** 23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** 24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** 25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** 26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** 27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** 28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** 29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** 30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** 31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** 32 **| |** 33 **+-----------------------------------------------------------------------+** 34 ****************************************************************************/ 35 36 37 /** \file smeSm.c 38 * \brief SME SM implementation 39 * 40 * \see smeSm.h 41 */ 42 43 #include "osTIType.h" 44 #include "osApi.h" 45 #include "paramOut.h" 46 #include "paramIn.h" 47 #include "srcApi.h" 48 #include "report.h" 49 #include "connApi.h" 50 #include "siteMgrApi.h" 51 #include "smeSmApi.h" 52 #include "utils.h" 53 #include "fsm.h" 54 #include "smeSm.h" 55 #include "smeApi.h" 56 #include "DataCtrl_Api.h" 57 #include "regulatoryDomainApi.h" 58 #include "TrafficMonitorAPI.h" 59 #include "PowerMgr_API.h" 60 #include "EvHandler.h" 61 #include "TI_IPC_Api.h" 62 #include "ScanCncnApi.h" 63 #ifdef EXC_MODULE_INCLUDED 64 #include "DataCtrl_Api.h" 65 #endif 66 #include "apConn.h" 67 68 69 /* State Machine Functions */ 70 static TI_STATUS idle_to_interScan(void *pData); 71 72 static TI_STATUS interScan_to_scanning(void *pData); 73 74 static TI_STATUS interScan_to_idle(void *pData); 75 76 static TI_STATUS scan_to_idle(void *pData); 77 78 static TI_STATUS scan_to_scan(void *pData); 79 80 static TI_STATUS scan_to_select(void *pData); 81 82 static TI_STATUS scan_to_interScan(void *pData); 83 84 static TI_STATUS select_to_InterScan(void *pData); 85 86 static TI_STATUS select_to_connect(void *pData); 87 88 static TI_STATUS connecting_To_Disconnecting(void *pData); 89 90 static TI_STATUS connecting_to_connected(void *pData); 91 92 static TI_STATUS connecting_to_selecting(void *pData); 93 94 static TI_STATUS connected_to_interScan(void *pData); 95 96 static TI_STATUS connected_To_disconnecting(void *pData); 97 98 static TI_STATUS disconnecting_to_interScan(void *pData); 99 100 101 /* Local functions prototypes */ 102 static TI_STATUS actionUnexpected(void *pData); 103 104 static TI_STATUS actionNop(void *pData); 105 106 static TI_STATUS smeCallScan(void *pData); 107 108 static TI_STATUS chooseScanBand(smeSm_t* pSmeSm, radioBand_e *band); 109 110 static TI_STATUS smeSm_changeBandParams(TI_HANDLE hSmeSm, radioBand_e radioBand); 111 112 static TI_STATUS smeSm_startInterScanTimeout(TI_HANDLE hSmeSm); 113 114 static TI_STATUS smeSm_stopInterScanTimeout(TI_HANDLE hSmeSm); 115 116 static void smeSm_sendDisassociateEvent(smeSm_t* pSmeSm); 117 118 /****************************************************/ 119 /* Interface Functions Implementations */ 120 /****************************************************/ 121 122 123 /*********************************************************************** 124 * smeSm_smCreate 125 *********************************************************************** 126 DESCRIPTION: State machine creation function, called by the SME SM API. Allocates the state machine 127 128 INPUT: hOs - OS handle. 129 130 OUTPUT: 131 132 RETURN: State machine pointer on success, NULL otherwise 133 134 ************************************************************************/ 135 fsm_stateMachine_t *smeSm_smCreate(TI_HANDLE hOs) 136 { 137 TI_STATUS status; 138 fsm_stateMachine_t *pFsm; 139 140 status = fsm_Create(hOs, &pFsm, SME_SM_NUM_STATES, SME_SM_NUM_EVENTS); 141 142 if (status != OK) 143 return NULL; 144 145 return pFsm; 146 } 147 148 /*********************************************************************** 149 * smeSm_smConfig 150 *********************************************************************** 151 DESCRIPTION: State machine configuration function, called by the SME SM API. Configures the state machine 152 153 INPUT: pSmeSm - SME SM handle. 154 155 OUTPUT: 156 157 RETURN: OK on success, NOK otherwise 158 159 ************************************************************************/ 160 TI_STATUS smeSm_smConfig(smeSm_t *pSmeSm) 161 { 162 paramInfo_t param; 163 164 fsm_actionCell_t smMatrix[SME_SM_NUM_STATES][SME_SM_NUM_EVENTS] = 165 { 166 /* next state and actions for IDLE state */ 167 { 168 {SME_SM_STATE_INTER_SCAN, idle_to_interScan}, /* "EVENT_START", */ 169 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_STOP", */ 170 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 171 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 172 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 173 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 174 {SME_SM_STATE_IDLE, actionUnexpected}, /* "EVENT_CONN_FAILURE", */ 175 {SME_SM_STATE_IDLE, actionNop}, /* "EVENT_RESELECT", */ 176 {SME_SM_STATE_IDLE, actionNop}, /* "EVENT_DISCONNECT"*/ 177 }, 178 179 /* next state and actions for SCANNING state */ 180 { 181 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_START", */ 182 {SME_SM_STATE_IDLE, scan_to_idle}, /* "EVENT_STOP", */ 183 {SME_SM_STATE_SELECTING, scan_to_select}, /* "EVENT_SCAN_COMPLETE", */ 184 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 185 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 186 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 187 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_CONN_FAILURE", */ 188 {SME_SM_STATE_SCANNING, scan_to_scan}, /* "EVENT_RESELECT",*/ 189 {SME_SM_STATE_INTER_SCAN, scan_to_interScan}, /* "EVENT_DISCONNECT"*/ 190 }, 191 192 /* next state and actions for SELECTING state */ 193 { 194 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_START", */ 195 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_STOP", */ 196 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 197 {SME_SM_STATE_CONNECTING, select_to_connect}, /* "EVENT_SELECT_SUCCESS", */ 198 {SME_SM_STATE_INTER_SCAN, select_to_InterScan}, /* "EVENT_SELECT_FAILURE", */ 199 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 200 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_CONN_FAILURE", */ 201 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_RESELECT", */ 202 {SME_SM_STATE_SELECTING, actionUnexpected}, /* "EVENT_DISCONNECT",*/ 203 }, 204 205 /* next state and actions for CONNECTING state */ 206 { 207 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_START", */ 208 {SME_SM_STATE_DISCONNECTING, connecting_To_Disconnecting}, /* "EVENT_STOP", */ 209 {SME_SM_STATE_CONNECTING, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 210 {SME_SM_STATE_CONNECTING, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 211 {SME_SM_STATE_CONNECTING, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 212 {SME_SM_STATE_CONNECTED, connecting_to_connected}, /* "EVENT_CONN_SUCCESS", */ 213 {SME_SM_STATE_SELECTING, connecting_to_selecting}, /* "EVENT_CONN_FAILURE", */ 214 {SME_SM_STATE_DISCONNECTING, connecting_To_Disconnecting}, /* "EVENT_RESELECT", */ 215 {SME_SM_STATE_DISCONNECTING, connecting_To_Disconnecting}, /* "EVENT_DISCONNECT", */ 216 }, 217 218 /* next state and actions for CONNECTED state */ 219 { 220 {SME_SM_STATE_SCANNING, actionUnexpected}, /* "EVENT_START", */ 221 {SME_SM_STATE_DISCONNECTING, connected_To_disconnecting}, /* "EVENT_STOP", */ 222 {SME_SM_STATE_CONNECTED, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 223 {SME_SM_STATE_CONNECTED, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 224 {SME_SM_STATE_CONNECTED, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 225 {SME_SM_STATE_CONNECTED, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 226 {SME_SM_STATE_INTER_SCAN, connected_to_interScan}, /* "EVENT_CONN_FAILURE", */ 227 {SME_SM_STATE_DISCONNECTING, connected_To_disconnecting}, /* "EVENT_RESELECT", */ 228 {SME_SM_STATE_DISCONNECTING ,connected_To_disconnecting}, /* "EVENT_DISCONNECT",*/ 229 }, 230 231 /* next state and actions for DISCONNECTING state */ 232 { 233 {SME_SM_STATE_DISCONNECTING, actionNop}, /* "EVENT_START", */ 234 {SME_SM_STATE_DISCONNECTING, actionNop}, /* "EVENT_STOP", */ 235 {SME_SM_STATE_DISCONNECTING, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 236 {SME_SM_STATE_DISCONNECTING, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 237 {SME_SM_STATE_DISCONNECTING, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 238 {SME_SM_STATE_DISCONNECTING, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 239 {SME_SM_STATE_INTER_SCAN, disconnecting_to_interScan}, /* "EVENT_CONN_FAILURE", */ 240 {SME_SM_STATE_DISCONNECTING, actionNop}, /* "EVENT_RESELECT", */ 241 {SME_SM_STATE_DISCONNECTING, actionNop}, /* "EVENT_DISCONNECT",*/ 242 }, 243 244 245 /* next state and actions for STATE_INTER_SCAN_TIMEOUT state */ 246 { 247 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_START", */ 248 {SME_SM_STATE_IDLE, interScan_to_idle}, /* "EVENT_STOP", */ 249 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_SCAN_COMPLETE", */ 250 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_SELECT_SUCCESS", */ 251 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_SELECT_FAILURE", */ 252 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_CONN_SUCCESS", */ 253 {SME_SM_STATE_INTER_SCAN, actionUnexpected}, /* "EVENT_CONN_FAILURE", */ 254 {SME_SM_STATE_SCANNING, interScan_to_scanning}, /* "EVENT_RESELECT", */ 255 {SME_SM_STATE_INTER_SCAN, actionNop}, /* "EVENT_DISCONNECT",*/ 256 }, 257 258 }; 259 260 pSmeSm->dualBandReScanFlag = FALSE; 261 pSmeSm->reScanFlag = FALSE; 262 pSmeSm->radioOn = FALSE; 263 pSmeSm->immediateShutdownRequired = FALSE; 264 265 /* if desired SSID is junk SSID, don't connect (until new SSID is set) */ 266 param.paramType = SITE_MGR_DESIRED_SSID_PARAM; 267 siteMgr_getParam( pSmeSm->hSiteMgr, ¶m ); 268 269 if ( utils_isJunkSSID( &(param.content.siteMgrDesiredSSID) ) ) 270 { 271 pSmeSm->connectEnabled = FALSE; 272 } 273 else 274 { 275 pSmeSm->connectEnabled = TRUE; 276 } 277 278 /* First event should indicate to the upper layer that STA is disassociated. */ 279 pSmeSm->DisAssoc.mgmtStatus = STATUS_UNSPECIFIED; 280 pSmeSm->DisAssoc.uStatusCode = 0; 281 smeSm_sendDisassociateEvent(pSmeSm); 282 283 #ifdef TI_DBG 284 /* clear statistics */ 285 smeSm_resetStats( (TI_HANDLE)pSmeSm ); 286 #endif 287 288 return fsm_Config(pSmeSm->pFsm, (fsm_Matrix_t)smMatrix, SME_SM_NUM_STATES, SME_SM_NUM_EVENTS, smeSm_SMEvent, pSmeSm->hOs); 289 } 290 291 /*********************************************************************** 292 * smeSm_smUnLoad 293 *********************************************************************** 294 DESCRIPTION: State machine unload function, called by the SME SM API. Unloads the state machine 295 296 INPUT: hOs - OS handle. 297 pFsm - Pointer to the state machine 298 299 OUTPUT: 300 301 RETURN: State machine pointer on success, NULL otherwise 302 303 ************************************************************************/ 304 TI_STATUS smeSm_smUnLoad(TI_HANDLE hOs, fsm_stateMachine_t *pFsm) 305 { 306 fsm_Unload(hOs, pFsm); 307 308 return OK; 309 } 310 311 /*********************************************************************** 312 * smeSm_SMEvent 313 *********************************************************************** 314 DESCRIPTION: SME SM event processing function, called by the SME SM API 315 Perform the following: 316 - Print the state movement as a result from the event 317 - Calls the generic state machine event processing function which preform the following: 318 - Calls the corresponding callback function 319 - Move to next state 320 321 INPUT: currentState - Pointer to the connection current state. 322 event - Received event 323 pSmeSm - SME SM handle 324 325 OUTPUT: 326 327 RETURN: OK on success, NOK otherwise 328 329 ************************************************************************/ 330 331 #ifdef REPORT_LOG 332 333 static char *stateDesc[SME_SM_NUM_STATES] = 334 { 335 "STATE_IDLE", 336 "STATE_SCANNING", 337 "STATE_SELECTING", 338 "STATE_CONNECTING", 339 "STATE_CONNECTED", 340 "STATE_DISCONNECTING", 341 "STATE_INTER_SCAN", 342 }; 343 344 static char *eventDesc[SME_SM_NUM_EVENTS] = 345 { 346 "EVENT_START", 347 "EVENT_STOP", 348 "EVENT_SCAN_COMPLETE", 349 "EVENT_SELECT_SUCCESS", 350 "EVENT_SELECT_FAILURE", 351 "EVENT_CONN_SUCCESS", 352 "EVENT_CONN_FAILURE", 353 "EVENT_RESELECT", 354 "EVENT_DISCONNECT", 355 }; 356 357 #endif 358 359 360 TI_STATUS smeSm_SMEvent(UINT8 *currentState, UINT8 event, TI_HANDLE hSmeSm) 361 { 362 smeSm_t *pSmeSm = (smeSm_t *)hSmeSm; 363 TI_STATUS status; 364 UINT8 nextState; 365 366 status = fsm_GetNextState(pSmeSm->pFsm, *currentState, event, &nextState); 367 if (status != OK) 368 { 369 WLAN_REPORT_SM(pSmeSm->hReport, SME_SM_MODULE_LOG, ("State machine error, failed getting next state\n")); 370 return(NOK); 371 } 372 373 WLAN_REPORT_SM(pSmeSm->hReport, SME_SM_MODULE_LOG, 374 ("<%s, %s> --> %s\n\n", 375 stateDesc[*currentState], 376 eventDesc[event], 377 stateDesc[nextState])); 378 379 status = fsm_Event(pSmeSm->pFsm, currentState, event, (void *)pSmeSm); 380 381 return status; 382 } 383 384 385 /************************************************************************************************************/ 386 /* In the following section are listed the callback function used by the SME state machine */ 387 /************************************************************************************************************/ 388 389 /* START_SCAN */ 390 TI_STATUS sme_startScan(void *pData) 391 { 392 paramInfo_t param; 393 smeSm_t *pSmeSm = (smeSm_t *)pData; 394 395 /* 396 * Support Dual Mode Operation 397 */ 398 399 radioBand_e band; 400 401 /* 402 * If scan is disabled then send self scan complete event, skipping the scan procedure. 403 */ 404 if (pSmeSm->scanEnabled != SCAN_ENABLED) 405 { 406 if (pSmeSm->scanEnabled == SKIP_NEXT_SCAN) 407 { 408 pSmeSm->scanEnabled = SCAN_ENABLED; 409 } 410 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_SCAN_COMPLETE , pSmeSm); 411 } 412 413 414 /* if performing a dual band rescan now */ 415 if ( TRUE == pSmeSm->dualBandReScanFlag ) 416 { 417 /* mark that no more scans are needed */ 418 pSmeSm->dualBandReScanFlag = FALSE; 419 chooseScanBand(pSmeSm, &band); 420 smeSm_changeBandParams(pSmeSm, band); 421 } 422 else 423 { 424 param.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM; 425 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 426 427 if(param.content.siteMgrDot11Mode == DOT11_DUAL_MODE) 428 { 429 pSmeSm->dualBandReScanFlag = TRUE; 430 chooseScanBand(pSmeSm, &band); 431 smeSm_changeBandParams(pSmeSm, band); 432 } 433 } 434 435 return smeCallScan(pData); 436 } 437 438 439 /* RESTART_SCAN when exiting from IDLE state*/ 440 static TI_STATUS idle_to_interScan(void *pData) 441 { 442 smeSm_t *pSmeSm = (smeSm_t *)pData; 443 444 pSmeSm->interScanTimeout = pSmeSm->interScanTimeoutMin; 445 446 /* Set the SCR group to inter SCAN */ 447 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 448 449 /* 450 * If the connection is enabled then initiate "reselect" event that moves the 451 * SM into scan state. 452 */ 453 if( pSmeSm->connectEnabled ){ 454 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_RESELECT , pSmeSm); 455 } 456 /* connectEnabled is FALSE, need to stay at this state until it will be changed. */ 457 458 return OK; 459 } 460 461 462 463 TI_STATUS interScan_to_scanning(void *pData) 464 { 465 smeSm_t *pSmeSm = (smeSm_t *)pData; 466 467 pSmeSm->bSendDisAssocEvent = FALSE; 468 469 smeSm_stopInterScanTimeout(pSmeSm); 470 471 /* Set SCR to "first connection" */ 472 scr_setGroup( pSmeSm->hScr, SCR_GID_CONNECT ); 473 474 #ifdef TI_DBG 475 /* update statistics - count scan attempts for connection */ 476 pSmeSm->smeStats.currentNumberOfScanAttempts++; 477 #endif 478 return (sme_startScan(pData)); 479 } 480 481 482 483 static TI_STATUS disconnecting_to_interScan(void *pData) 484 { 485 smeSm_t *pSmeSm = (smeSm_t *)pData; 486 487 pSmeSm->interScanTimeout = pSmeSm->interScanTimeoutMin; 488 489 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 490 491 siteMgr_disSelectSite(pSmeSm->hSiteMgr); 492 493 /* 494 * Notify that the driver is disassociated to the supplicant\IP stack. 495 */ 496 smeSm_sendDisassociateEvent(pSmeSm); 497 498 if (!pSmeSm->scanEnabled) 499 { 500 pSmeSm->connectEnabled = FALSE; 501 } 502 503 /* Radio ON and connection is enabled go to scanning */ 504 if( pSmeSm->radioOn ) 505 { 506 if( pSmeSm->connectEnabled ) 507 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_RESELECT , pSmeSm); 508 509 else { 510 /* Radio is on but connection is disabled, stay at interScan state 511 without starting the interscan timer. */ 512 513 /* SCR is set to enable only APP scan */ 514 return OK; 515 } 516 } 517 518 else{ 519 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_STOP , pSmeSm); 520 } 521 } 522 523 524 static TI_STATUS connected_to_interScan(void *pData) 525 { 526 smeSm_t *pSmeSm = (smeSm_t *)pData; 527 528 pSmeSm->interScanTimeout = pSmeSm->interScanTimeoutMin; 529 530 siteMgr_disSelectSite(pSmeSm->hSiteMgr); 531 532 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 533 534 /* 535 * Notify that the driver is associated to the supplicant\IP stack. 536 */ 537 smeSm_sendDisassociateEvent(pSmeSm); 538 539 if (!pSmeSm->scanEnabled) 540 { 541 pSmeSm->connectEnabled = FALSE; 542 } 543 544 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_RESELECT , pSmeSm); 545 } 546 547 548 static TI_STATUS select_to_InterScan(void *pData) 549 { 550 smeSm_t *pSmeSm = (smeSm_t *)pData; 551 552 siteMgr_disSelectSite(pSmeSm->hSiteMgr); 553 554 /* SCR is set to enable only APP scan */ 555 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 556 557 if (pSmeSm->connectEnabled) 558 { 559 smeSm_startInterScanTimeout(pSmeSm); 560 } 561 562 if ((pSmeSm->bSendDisAssocEvent == TRUE) || (pSmeSm->scanEnabled == FALSE)) 563 { 564 /* 565 * Notify that the driver is disassociated to the supplicant\IP stack. 566 */ 567 smeSm_sendDisassociateEvent(pSmeSm); 568 } 569 570 return OK; 571 } 572 573 574 575 static TI_STATUS scan_to_interScan(void *pData) 576 { 577 smeSm_t *pSmeSm = (smeSm_t *)pData; 578 579 /* SCR is set to enable only APP scan */ 580 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 581 582 pSmeSm->interScanTimeout = pSmeSm->interScanTimeoutMin; 583 584 if (pSmeSm->connectEnabled) 585 { 586 smeSm_startInterScanTimeout(pSmeSm); 587 } 588 589 return OK; 590 591 } 592 593 594 /* STOP_SCAN, START_SCAN */ 595 static TI_STATUS scan_to_scan(void *pData) 596 { 597 smeSm_t *pSmeSm = (smeSm_t *)pData; 598 599 WLAN_REPORT_INFORMATION(pSmeSm->hReport, SME_SM_MODULE_LOG, ("Setting reScanFlag to ON\n")); 600 601 pSmeSm->reScanFlag = TRUE; 602 603 scanConcentrator_stopScan( pSmeSm->hScanCncn, SCAN_SCC_DRIVER ); 604 605 return OK; 606 } 607 608 609 610 /* CANCEL INTER_SCAN TIMEOUT*/ 611 static TI_STATUS interScan_to_idle(void *pData) 612 { 613 smeSm_t *pSmeSm = (smeSm_t *)pData; 614 615 smeSm_stopInterScanTimeout(pSmeSm); 616 617 /* Change shutdown status flag to indicate SME is in IDLE state */ 618 pSmeSm->shutDownStatus |= DRIVER_SHUTDOWN_SME_STOPPED; 619 620 /* Set SCR state to "Idle" */ 621 scr_setGroup( pSmeSm->hScr, SCR_GID_IDLE ); 622 623 return OK; 624 625 } 626 627 628 /* Stop current scanning and go to idle */ 629 static TI_STATUS scan_to_idle(void *pData) 630 { 631 smeSm_t *pSmeSm = (smeSm_t *)pData; 632 633 /* stopping the current active scan process */ 634 scanConcentrator_stopScan( pSmeSm->hScanCncn, SCAN_SCC_DRIVER ); 635 636 /* Change shutdown status flag to indicate SME is in IDLE state */ 637 pSmeSm->shutDownStatus |= DRIVER_SHUTDOWN_SME_STOPPED; 638 639 /* Set the SCR group to "idle" */ 640 scr_setGroup( pSmeSm->hScr, SCR_GID_IDLE ); 641 642 return OK; 643 } 644 645 /* SELECT */ 646 static TI_STATUS scan_to_select(void *pData) 647 { 648 smeSm_t *pSmeSm = (smeSm_t *)pData; 649 650 if (!pSmeSm->connectEnabled) 651 { 652 return smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_SELECT_FAILURE, pSmeSm); 653 } 654 655 siteMgr_resetAttemptsNumberParameter(pSmeSm->hSiteMgr); 656 657 return siteMgr_selectSite(pSmeSm->hSiteMgr); 658 } 659 660 661 662 /* START_TX, CONNECT */ 663 static TI_STATUS select_to_connect(void *pData) 664 { 665 smeSm_t *pSmeSm = (smeSm_t *)pData; 666 paramInfo_t param; 667 668 /* From this moment forward we will send DisAssociation event even if the connection failed */ 669 pSmeSm->bSendDisAssocEvent = TRUE; 670 671 /* if we are about o start an IBSS, the conn SM will wait for few seconds before sending connection 672 failure indication, so that the SME will rescan for IBSSes with the same SSID. To enable application 673 scan during this period, in this case ONLY we change here the SCR group ID to inter scan */ 674 param.paramType = CONN_TYPE_PARAM; 675 conn_getParam(pSmeSm->hConn, ¶m); 676 if (CONNECTION_SELF == param.content.connType) 677 { 678 /* Set SCR group to inter-scan */ 679 scr_setGroup( pSmeSm->hScr, SCR_GID_INTER_SCAN ); 680 } 681 682 /* Configure QoS manager not to renegotiate TSPECs as this is first time connection */ 683 return conn_start(pSmeSm->hConn, CONN_TYPE_FIRST_CONN, smeSm_reportConnStatus, pSmeSm, FALSE, FALSE); 684 } 685 686 687 688 689 /* Stop the connecting and go to disconnecting */ 690 static TI_STATUS connecting_To_Disconnecting(void *pData) 691 { 692 smeSm_t *pSmeSm = (smeSm_t *)pData; 693 694 conn_stop(pSmeSm->hConn, DISCONN_TYPE_DEAUTH, STATUS_UNSPECIFIED, 695 TRUE, smeSm_reportConnStatus, pSmeSm); 696 697 return OK; 698 } 699 700 701 /* Stop the connection and go to disconnecting */ 702 static TI_STATUS connected_To_disconnecting(void *pData) 703 { 704 TI_STATUS status; 705 paramInfo_t param; 706 smeSm_t *pSmeSm = (smeSm_t *)pData; 707 708 scr_setGroup( pSmeSm->hScr, SCR_GID_CONNECT ); 709 710 param.paramType = SITE_MGR_CURRENT_BSS_TYPE_PARAM; 711 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 712 713 if(param.content.siteMgrDesiredBSSType == BSS_INFRASTRUCTURE) 714 { 715 /* Call the AP connection to perform disconnect - If immidiateShutdownRequired is TRUE, no need to send DISASSOC frame */ 716 status = apConn_stop(pSmeSm->hApConn, TRUE, pSmeSm->immediateShutdownRequired); 717 } 718 else 719 { 720 /* In IBSS disconnect is done directly with the connection SM */ 721 status = conn_stop(pSmeSm->hConn, DISCONN_TYPE_DEAUTH, STATUS_UNSPECIFIED, 722 TRUE, smeSm_reportConnStatus,pSmeSm); 723 if (status != OK) 724 { 725 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 726 return status; 727 } 728 } 729 730 731 return OK; 732 } 733 734 /* RESET_ATTEMPTS_NUMBER, START_SITE_AGING, START_DATA_ALGO */ 735 /* CONNECTING -> CONNECTED due to event CONN_SUCC */ 736 static TI_STATUS connecting_to_connected(void *pData) 737 { 738 TI_STATUS status; 739 paramInfo_t param; 740 741 smeSm_t *pSmeSm = (smeSm_t *)pData; 742 743 /* Reset the DisAssociation reason since the SME saves that last reason, and if a new connection was made and than aborted by 744 unspecified reason - no one will clear this value */ 745 pSmeSm->DisAssoc.mgmtStatus = STATUS_UNSPECIFIED; 746 pSmeSm->DisAssoc.uStatusCode = 0; 747 748 status = siteMgr_resetPrevPrimarySiteRssi(pSmeSm->hSiteMgr); 749 if (status != OK) 750 { 751 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 752 return status; 753 } 754 755 status = siteMgr_resetPrimarySiteAttemptsNumber(pSmeSm->hSiteMgr); 756 if (status != OK) 757 { 758 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 759 return status; 760 } 761 762 status = siteMgr_resetEventStatisticsHistory(pSmeSm->hSiteMgr); 763 if (status != OK) 764 { 765 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 766 return status; 767 } 768 769 770 param.paramType = SITE_MGR_CURRENT_BSS_TYPE_PARAM; 771 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 772 if (param.content.siteMgrDesiredBSSType == BSS_INFRASTRUCTURE) 773 { 774 /* Start the AP connection */ 775 apConn_start(pSmeSm->hApConn, siteMgr_isThereValidSSID(pSmeSm->hSiteMgr)); 776 } 777 778 /* Set SCR group to connected */ 779 scr_setGroup( pSmeSm->hScr, SCR_GID_CONNECTED ); 780 781 #ifdef TI_DBG 782 /* update statistics - scan attempts for connection histogran */ 783 if ( SCAN_ATTAMEPTS_HISTOGRAM_SIZE < pSmeSm->smeStats.currentNumberOfScanAttempts ) 784 { 785 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ SCAN_ATTAMEPTS_HISTOGRAM_SIZE - 1 ]++; 786 } 787 else 788 { 789 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ pSmeSm->smeStats.currentNumberOfScanAttempts - 1 ]++; 790 } 791 pSmeSm->smeStats.currentNumberOfScanAttempts = 0; 792 #endif 793 return OK; 794 } 795 796 797 798 /* STOP_RX, STOP_TX, UPDATE_PRIMARY_SITE_FAIL_STATUS, */ 799 static TI_STATUS connecting_to_selecting(void *pData) 800 { 801 TI_STATUS status; 802 paramInfo_t param; 803 smeSm_t *pSmeSm = (smeSm_t *)pData; 804 805 conn_stop(pSmeSm->hConn, DISCONN_TYPE_IMMEDIATE, STATUS_UNSPECIFIED, 806 TRUE, smeSm_reportConnStatus,pSmeSm); 807 808 /* Remove primary site */ 809 status = siteMgr_updatePrimarySiteFailStatus(pSmeSm->hSiteMgr, TRUE); 810 if (status != OK) 811 { 812 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 813 return status; 814 } 815 816 status = siteMgr_disSelectSite(pSmeSm->hSiteMgr); 817 if (status != OK) 818 { 819 WLAN_REPORT_ERROR(pSmeSm->hReport, SME_SM_MODULE_LOG, ("SME status=%d, have to return (%d)\n",status,__LINE__)); 820 return status; 821 } 822 823 /* If we are in IBSS mode we don't try to select another site */ 824 param.paramType = SITE_MGR_DESIRED_BSS_TYPE_PARAM; 825 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 826 827 if(param.content.siteMgrDesiredBSSType == BSS_INDEPENDENT) 828 return smeSm_reportSelectStatus(pSmeSm, (mgmtStatus_e)SELECT_STATUS_FAILURE); 829 else 830 return siteMgr_selectSite(pSmeSm->hSiteMgr); 831 } 832 833 834 835 836 static TI_STATUS chooseScanBand(smeSm_t* pSmeSm, radioBand_e *band) 837 { 838 paramInfo_t param; 839 840 param.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM; 841 siteMgr_getParam( pSmeSm->hSiteMgr, ¶m ); 842 843 /* if working in dual band, select band according to dualBandReScanFlag */ 844 if ( param.content.siteMgrDot11Mode == DOT11_DUAL_MODE ) 845 { 846 *band = ( TRUE == pSmeSm->dualBandReScanFlag ? RADIO_BAND_5_0_GHZ : RADIO_BAND_2_4_GHZ); 847 } 848 /* if not working in dual band, return site manager current band */ 849 else 850 { 851 param.paramType = SITE_MGR_RADIO_BAND_PARAM; 852 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 853 *band = pSmeSm->currBand = param.content.siteMgrRadioBand; 854 } 855 return OK; 856 } 857 858 859 860 static TI_STATUS smeCallScan(void *pData) 861 { 862 smeSm_t *pSmeSm = (smeSm_t *)pData; 863 paramInfo_t param; 864 scan_Params_t* pScanParams = &(pSmeSm->scanParams); 865 sme_scan_Params_t *pSmeScanParams; 866 scan_normalChannelEntry_t *pChanEntry; 867 int chan, k; 868 869 /* 870 * Check in which band we are in and prepare the scan command. 871 */ 872 pScanParams->scanType = SCAN_TYPE_NORMAL_ACTIVE; 873 pScanParams->Tid = 0; 874 875 876 param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; 877 siteMgr_getParam( pSmeSm->hSiteMgr, ¶m ); 878 879 if ( DOT11_A_MODE == param.content.siteMgrDot11OperationalMode ) 880 { 881 pScanParams->band = RADIO_BAND_5_0_GHZ; 882 pSmeScanParams = &(pSmeSm->scanParamsA); 883 } 884 else 885 { 886 pScanParams->band = RADIO_BAND_2_4_GHZ; 887 pSmeScanParams = &(pSmeSm->scanParamsBG); 888 } 889 890 pScanParams->probeRequestRate = pSmeScanParams->probeRequestRate; 891 pScanParams->numOfChannels = pSmeScanParams->numOfChannels; 892 pScanParams->probeReqNumber = pSmeScanParams->probeReqNumber; 893 894 WLAN_REPORT_INFORMATION(pSmeSm->hReport, SME_SM_MODULE_LOG, 895 ("Global Scan Params: Rate=0x%x, Prob#=%d, Channels#=%d\n", 896 pScanParams->probeRequestRate, pScanParams->probeReqNumber, 897 pScanParams->numOfChannels)); 898 899 for( chan=0; chan < pScanParams->numOfChannels; chan++ ) 900 { 901 pChanEntry = &(pScanParams->channelEntry[chan].normalChannelEntry); 902 903 /* Fill channel ID */ 904 pChanEntry->channel = pSmeScanParams->channelsList[chan]; 905 906 /* Set broadcast BSSID */ 907 for ( k = 0; k < 6; k++ ) pChanEntry->bssId.addr[ k ] = 0xff; 908 909 /* Set min & max dwell time */ 910 pChanEntry->minChannelDwellTime = pSmeScanParams->minDwellTime; 911 pChanEntry->maxChannelDwellTime = pSmeScanParams->maxDwellTime; 912 913 /* Set up early termination params. */ 914 pChanEntry->earlyTerminationEvent = SCAN_DEFAULT_EARLY_TERMINATION_EVENT; 915 pChanEntry->ETMaxNumOfAPframes = SCAN_DEFAULT_EARLY_TERMINATION_NUM_OF_FRAMES; 916 917 /* Set desired tx power */ 918 pChanEntry->txPowerDbm = pSmeScanParams->txPowerDbm; 919 920 WLAN_REPORT_INFORMATION(pSmeSm->hReport, SME_SM_MODULE_LOG, 921 ("Chan %d: CH=%d , DwellTime Min=%d Max=%d, ET=%d, TxPowr=%d, \n", 922 chan, 923 pScanParams->channelEntry[chan].normalChannelEntry.channel, 924 pScanParams->channelEntry[chan].normalChannelEntry.minChannelDwellTime, 925 pScanParams->channelEntry[chan].normalChannelEntry.maxChannelDwellTime, 926 pScanParams->channelEntry[chan].normalChannelEntry.earlyTerminationEvent, 927 pScanParams->channelEntry[chan].normalChannelEntry.txPowerDbm)); 928 } /* Channel list setting */ 929 930 931 /* 932 * Set the desired SSID (if any) 933 */ 934 param.paramType = SITE_MGR_DESIRED_SSID_PARAM; 935 siteMgr_getParam( pSmeSm->hSiteMgr, ¶m ); 936 937 if ( utils_isAnySSID( &(param.content.siteMgrDesiredSSID) ) ) 938 { 939 pScanParams->desiredSsid.len = 0; 940 } 941 else 942 { 943 pScanParams->desiredSsid.len = param.content.siteMgrDesiredSSID.len; 944 os_memoryCopy( pSmeSm->hOs, (void *)pScanParams->desiredSsid.ssidString, 945 (void *)param.content.siteMgrDesiredSSID.ssidString, 946 param.content.siteMgrDesiredSSID.len ); 947 } 948 949 950 951 /* 952 * Prepare scan complete's aging, by increasing the scanned sites 953 * scan attemps counter. The counter will be checked upon scan complete, 954 * and the sites with no update scan results will be dropped. 955 */ 956 siteMgr_setNotReceivedParameter(pSmeSm->hSiteMgr, &(pScanParams->desiredSsid), pScanParams->band ); 957 958 #ifdef TI_DBG 959 /* scan results count statistics - nullify the count before starting scan */ 960 pSmeSm->smeStats.currentNumberOfScanResults = 0; 961 #endif 962 963 /* 964 * Set and send the scan command. 965 */ 966 if (scanConcentrator_scan( pSmeSm->hScanCncn, SCAN_SCC_DRIVER, pScanParams ) != 967 SCAN_CRS_SCAN_RUNNING) 968 { 969 /* imitate scan complete event if scan could not be performed.*/ 970 smeSm_SMEvent(&pSmeSm->state, SME_SM_EVENT_SCAN_COMPLETE, pSmeSm); 971 } 972 973 return OK; 974 } 975 976 977 static TI_STATUS actionUnexpected(void *pData) 978 { 979 smeSm_t *pSmeSm = (smeSm_t *)pData; 980 981 WLAN_REPORT_SM(pSmeSm->hReport, SME_SM_MODULE_LOG, ("State machine error, unexpected Event\n\n")); 982 return OK; 983 } 984 985 986 987 static TI_STATUS actionNop(void *pData) 988 { 989 return OK; 990 } 991 992 993 994 static TI_STATUS smeSm_changeBandParams(TI_HANDLE hSmeSm, radioBand_e radioBand) 995 { 996 paramInfo_t param; 997 smeSm_t *pSmeSm = (smeSm_t *)hSmeSm; 998 999 /* change dot11 mode */ 1000 param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; 1001 if(radioBand == RADIO_BAND_2_4_GHZ) 1002 param.content.siteMgrDot11OperationalMode = DOT11_G_MODE; 1003 else 1004 param.content.siteMgrDot11OperationalMode = DOT11_A_MODE; 1005 1006 siteMgr_setParam(pSmeSm->hSiteMgr, ¶m); 1007 1008 param.paramType = SITE_MGR_RADIO_BAND_PARAM; 1009 param.content.siteMgrRadioBand = radioBand; 1010 siteMgr_setParam(pSmeSm->hSiteMgr, ¶m); 1011 1012 siteMgr_setCurrentTable(pSmeSm->hSiteMgr, radioBand); 1013 1014 /* configure hal with common core-hal parameters */ 1015 whalCtrl_SetRadioBand(pSmeSm->hHalCtrl, radioBand); 1016 1017 return OK; 1018 } 1019 1020 /*********************************************************************** 1021 * smeSm_startInterScanTimeout 1022 *********************************************************************** 1023 DESCRIPTION: Starts interscan timeout 1024 1025 INPUT: hSmeSm - SME SM handle. 1026 1027 OUTPUT: 1028 1029 RETURN: OK on success, NOK otherwise 1030 1031 ************************************************************************/ 1032 static TI_STATUS smeSm_startInterScanTimeout(TI_HANDLE hSmeSm) 1033 { 1034 smeSm_t *pSmeSm = (smeSm_t *)hSmeSm; 1035 paramInfo_t param; 1036 1037 /* If the SME scan is disabled, (scan is performed by the application) 1038 * don't start the inter scan timeout 1039 */ 1040 if (pSmeSm->scanEnabled == SCAN_DISABLED) 1041 { 1042 return OK; 1043 } 1044 1045 if (pSmeSm->scanEnabled == SKIP_NEXT_SCAN) 1046 { 1047 pSmeSm->scanEnabled = SCAN_ENABLED; 1048 } 1049 1050 param.paramType = SITE_MGR_DESIRED_BSS_TYPE_PARAM; 1051 siteMgr_getParam(pSmeSm->hSiteMgr, ¶m); 1052 1053 if (param.content.siteMgrDesiredBSSType == BSS_INDEPENDENT) 1054 { 1055 os_timerStart(pSmeSm->hOs, pSmeSm->interScanTimeoutTimer, IBSS_INTER_SCAN_PERIOD, FALSE); 1056 } 1057 else 1058 { 1059 os_timerStart(pSmeSm->hOs, pSmeSm->interScanTimeoutTimer, pSmeSm->interScanTimeout, FALSE); 1060 } 1061 1062 return OK; 1063 } 1064 1065 /*********************************************************************** 1066 * smeSm_stopInterScanTimeout 1067 *********************************************************************** 1068 DESCRIPTION: Stops scan timeout 1069 1070 INPUT: hSmeSm - SME SM handle. 1071 1072 OUTPUT: 1073 1074 RETURN: OK on success, NOK otherwise 1075 1076 ************************************************************************/ 1077 static TI_STATUS smeSm_stopInterScanTimeout(TI_HANDLE hSmeSm) 1078 { 1079 smeSm_t *pSmeSm = (smeSm_t *)hSmeSm; 1080 1081 os_timerStop(pSmeSm->hOs, pSmeSm->interScanTimeoutTimer); 1082 return OK; 1083 } 1084 1085 /*********************************************************************** 1086 * smeSm_sendDisassociateEvent 1087 *********************************************************************** 1088 DESCRIPTION: Send disassociate event with the reason 1089 1090 INPUT: pSmeSm - SME SM handle. 1091 1092 OUTPUT: 1093 1094 RETURN: 1095 1096 ************************************************************************/ 1097 static void smeSm_sendDisassociateEvent(smeSm_t* pSmeSm) 1098 { 1099 OS_802_11_DISASSOCIATE_REASON_T eventReason; 1100 1101 WLAN_REPORT_INFORMATION(pSmeSm->hReport, SME_SM_MODULE_LOG, 1102 ("%s uDissconnectType = %d, uStatusCode = %d\n",__FUNCTION__, pSmeSm->DisAssoc.mgmtStatus, pSmeSm->DisAssoc.uStatusCode)); 1103 1104 /* Convert reason to OS layer */ 1105 switch(pSmeSm->DisAssoc.mgmtStatus) 1106 { 1107 case STATUS_UNSPECIFIED: 1108 eventReason.eDisAssocType = OS_DISASSOC_STATUS_UNSPECIFIED; 1109 break; 1110 case STATUS_AUTH_REJECT: 1111 eventReason.eDisAssocType = OS_DISASSOC_STATUS_AUTH_REJECT; 1112 break; 1113 case STATUS_ASSOC_REJECT: 1114 eventReason.eDisAssocType = OS_DISASSOC_STATUS_ASSOC_REJECT; 1115 break; 1116 case STATUS_SECURITY_FAILURE: 1117 eventReason.eDisAssocType = OS_DISASSOC_STATUS_SECURITY_FAILURE; 1118 break; 1119 case STATUS_AP_DEAUTHENTICATE: 1120 eventReason.eDisAssocType = OS_DISASSOC_STATUS_AP_DEAUTHENTICATE; 1121 break; 1122 case STATUS_AP_DISASSOCIATE: 1123 eventReason.eDisAssocType = OS_DISASSOC_STATUS_AP_DISASSOCIATE; 1124 break; 1125 case STATUS_ROAMING_TRIGGER: 1126 eventReason.eDisAssocType = OS_DISASSOC_STATUS_ROAMING_TRIGGER; 1127 break; 1128 default: 1129 eventReason.eDisAssocType = OS_DISASSOC_STATUS_UNSPECIFIED; 1130 break; 1131 } 1132 /* Use the same status code for OS */ 1133 eventReason.uStatusCode = pSmeSm->DisAssoc.uStatusCode; 1134 1135 EvHandlerSendEvent(pSmeSm->hEvHandler, IPC_EVENT_DISASSOCIATED, (UINT8*)&eventReason, sizeof(OS_802_11_DISASSOCIATE_REASON_T)); 1136 1137 /* Reset status after sending the event */ 1138 pSmeSm->DisAssoc.mgmtStatus = STATUS_UNSPECIFIED; 1139 pSmeSm->DisAssoc.uStatusCode = 0; 1140 } 1141 1142 #ifdef TI_DBG 1143 /*********************************************************************** 1144 * smeSm_resetStats 1145 *********************************************************************** 1146 DESCRIPTION: Reset SME statistics 1147 1148 INPUT: hSmeSm - SME SM handle. 1149 1150 OUTPUT: 1151 1152 RETURN: 1153 1154 ************************************************************************/ 1155 void smeSm_resetStats( TI_HANDLE hSmeSm ) 1156 { 1157 smeSm_t* pSmeSm = (smeSm_t*)hSmeSm; 1158 1159 os_memoryZero( pSmeSm->hOs, &(pSmeSm->smeStats), sizeof(smeSmStats_t) ); 1160 } 1161 1162 /*********************************************************************** 1163 * smeSm_printStats 1164 *********************************************************************** 1165 DESCRIPTION: Print SME statistics 1166 1167 INPUT: hSmeSm - SME SM handle. 1168 1169 OUTPUT: 1170 1171 RETURN: 1172 1173 ************************************************************************/ 1174 void smeSm_printStats( TI_HANDLE hSmeSm ) 1175 { 1176 smeSm_t* pSmeSm = (smeSm_t*)hSmeSm; 1177 1178 WLAN_OS_REPORT(("----------------------- SME statistics -----------------------\n\n")); 1179 WLAN_OS_REPORT(("Scan attempts histogram:\n")); 1180 WLAN_OS_REPORT(("------------------------\n\n")); 1181 WLAN_OS_REPORT(("Attempts: %6d %6d %6d %6d %6d %6d %6d %6d\n", 1, 2, 3, 4, 5, 6, 7, 8)); 1182 WLAN_OS_REPORT(("Count: %6d %6d %6d %6d %6d %6d %6d %6d\n\n", pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 0 ], 1183 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 1 ], pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 2 ], 1184 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 3 ], pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 4 ], 1185 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 5 ], pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 6 ], 1186 pSmeSm->smeStats.scanAttemptsForConnectionHistogram[ 7 ])); 1187 WLAN_OS_REPORT(("Scan result count histogram:\n")); 1188 WLAN_OS_REPORT(("----------------------------\n\n")); 1189 WLAN_OS_REPORT(("Results: %6d %6d %6d %6d %6d %6d %6d %6d\n", 0, 1, 2, 3, 4, 5, 6, 7)); 1190 WLAN_OS_REPORT(("Scans: %6d %6d %6d %6d %6d %6d %6d %6d\n\n", pSmeSm->smeStats.scanResulCountHistogram[ 0 ], 1191 pSmeSm->smeStats.scanResulCountHistogram[ 1 ], pSmeSm->smeStats.scanResulCountHistogram[ 2 ], 1192 pSmeSm->smeStats.scanResulCountHistogram[ 3 ], pSmeSm->smeStats.scanResulCountHistogram[ 4 ], 1193 pSmeSm->smeStats.scanResulCountHistogram[ 5 ], pSmeSm->smeStats.scanResulCountHistogram[ 6 ], 1194 pSmeSm->smeStats.scanResulCountHistogram[ 7 ])); 1195 WLAN_OS_REPORT(("Results: %6d %6d %6d %6d %6d %6d %6d %6d\n", 8, 9, 10, 11, 12, 13, 14, 15)); 1196 WLAN_OS_REPORT(("Scans: %6d %6d %6d %6d %6d %6d %6d %6d\n", pSmeSm->smeStats.scanResulCountHistogram[ 8 ], 1197 pSmeSm->smeStats.scanResulCountHistogram[ 9 ], pSmeSm->smeStats.scanResulCountHistogram[ 10 ], 1198 pSmeSm->smeStats.scanResulCountHistogram[ 11 ], pSmeSm->smeStats.scanResulCountHistogram[ 12 ], 1199 pSmeSm->smeStats.scanResulCountHistogram[ 13 ], pSmeSm->smeStats.scanResulCountHistogram[ 14 ], 1200 pSmeSm->smeStats.scanResulCountHistogram[ 15 ])); 1201 } 1202 1203 /*********************************************************************** 1204 * smeSm_dbgPrintObject 1205 *********************************************************************** 1206 DESCRIPTION: Print the SME object 1207 1208 INPUT: hSmeSm - SME SM handle. 1209 1210 OUTPUT: 1211 1212 RETURN: 1213 1214 ************************************************************************/ 1215 void smeSm_dbgPrintObject( TI_HANDLE hSmeSm ) 1216 { 1217 smeSm_t *pSmeSm = (smeSm_t *)hSmeSm; 1218 1219 WLAN_OS_REPORT(("Current SME State is <%s>\n",stateDesc[pSmeSm->state])); 1220 } 1221 1222 #endif 1223 1224