/drivers/net/wireless/tiwlan1251/common/src/Application/Roaming/roamingMngr.c
C | 1674 lines | 988 code | 219 blank | 467 comment | 120 complexity | f2b685a04c18200937d7b92c6aca664a MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
Large files files are truncated, but you can click here to view the full file
- /***************************************************************************
- **+-----------------------------------------------------------------------+**
- **| |**
- **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
- **| All rights reserved. |**
- **| |**
- **| Redistribution and use in source and binary forms, with or without |**
- **| modification, are permitted provided that the following conditions |**
- **| are met: |**
- **| |**
- **| * Redistributions of source code must retain the above copyright |**
- **| notice, this list of conditions and the following disclaimer. |**
- **| * Redistributions in binary form must reproduce the above copyright |**
- **| notice, this list of conditions and the following disclaimer in |**
- **| the documentation and/or other materials provided with the |**
- **| distribution. |**
- **| * Neither the name Texas Instruments nor the names of its |**
- **| contributors may be used to endorse or promote products derived |**
- **| from this software without specific prior written permission. |**
- **| |**
- **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
- **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
- **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
- **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
- **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
- **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
- **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
- **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
- **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
- **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
- **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
- **| |**
- **+-----------------------------------------------------------------------+**
- ****************************************************************************/
- /****************************************************************************
- * *
- * MODULE: Roaming Manager *
- * PURPOSE: *
- * Roaming manager is responsible to receive Roaming triggers and try
- * to select a better AP.
- * The Roaming triggers are: Low RSSI, PER, consecutive No ACK on TX,
- * beacon Missed or External request.
- * In each Internal Roaming request, scan is performed and selection for
- * better AP. Better AP is defined as a different AP with better RSSI,
- * and similar SSID and security settings.
- * If better AP is found, there is a check for fast-roaming via the
- * Supplicant. Then connection to the new AP is invoked.
- * *
- ****************************************************************************/
- #include "osApi.h"
- #include "paramOut.h"
- #include "report.h"
- #include "fsm.h"
- #include "utils.h"
- #include "scanMngrApi.h"
- #include "roamingMngrApi.h"
- #include "apConnApi.h"
- #include "roamingMngrTypes.h"
- #include "bssTypes.h"
- /* Constants */
- /* Init bits */
- #define ROAMING_MNGR_CONTEXT_INIT_BIT 1
- #define ROAMING_MNGR_SM_INIT_BIT 2
- #define DEFAULT_AP_QUALITY (-70)
- #define DEFAULT_LOW_PASS_FILTER (30)
- #define DEFAULT_DATA_RETRY_THRESHOLD (20)
- #define DEFAULT_LOW_QUALITY_SCAN_COND (-60)
- #define DEFAULT_NORMAL_QUALITY_SCAN_COND (-50)
- #define DEFAULT_LOW_RSSI (-70)
- #define DEFAULT_LOW_SNR (0)
- #define DEFAULT_TBTT_4_BSS_LOSS (10)
- #define DEFAULT_LOW_TX_RATE (2)
-
- /* Enumerations */
- /** state machine states */
- typedef enum
- {
- ROAMING_STATE_IDLE = 0,
- ROAMING_STATE_WAIT_4_TRIGGER = 1,
- ROAMING_STATE_WAIT_4_CMD = 2,
- ROAMING_STATE_SCANNING = 3,
- ROAMING_STATE_SELECTING = 4,
- ROAMING_STATE_CONNECTING = 5,
- ROAMING_STATE_LAST = 6
- } roamingMngr_smStates;
- /** State machine events */
- typedef enum
- {
- ROAMING_EVENT_START = 0, /* CONNECTED */
- ROAMING_EVENT_STOP = 1, /* NOT CONNECTED */
- ROAMING_EVENT_ROAM_TRIGGER = 2,
- ROAMING_EVENT_SCAN = 3,
- ROAMING_EVENT_SELECT = 4,
- ROAMING_EVENT_REQ_HANDOVER = 5,
- ROAMING_EVENT_ROAM_SUCCESS = 6,
- ROAMING_EVENT_FAILURE = 7,
- ROAMING_EVENT_LAST = 8
- } roamingMngr_smEvents;
- /* scan types */
- typedef enum
- {
- ROAMING_NO_SCAN,
- ROAMING_PARTIAL_SCAN,
- ROAMING_PARTIAL_SCAN_RETRY,
- ROAMING_FULL_SCAN,
- ROAMING_FULL_SCAN_RETRY
- } scan4RoamingType_e;
- /* Roaming Trigger groups, according to Roaming Triggers */
- typedef enum
- {
- ROAMING_TRIGGER_BG_SCAN_GROUP = ROAMING_TRIGGER_NORMAL_QUALITY_FOR_BG_SCAN,
- ROAMING_TRIGGER_LOW_QUALITY_GROUP = ROAMING_TRIGGER_MAX_TX_RETRIES,
- ROAMING_TRIGGER_FAST_CONNECT_GROUP = ROAMING_TRIGGER_SWITCH_CHANNEL,
- ROAMING_TRIGGER_FULL_CONNECT_GROUP = ROAMING_TRIGGER_SECURITY_ATTACK
- } roamingMngr_connectTypeGroup_e;
- #define ROAMING_MNGR_NUM_STATES ROAMING_STATE_LAST
- #define ROAMING_MNGR_NUM_EVENTS ROAMING_EVENT_LAST
- #define INVALID_CANDIDATE_INDEX 0xFF
- #define CURRENT_AP_INDEX 0xFE
- /* Typedefs */
- typedef struct _roamingMngr_t roamingMngr_t;
- /* Structures */
- typedef struct
- {
- UINT8 preAuthBSSList[MAX_SIZE_OF_BSS_TRACK_LIST];
- UINT8 numOfPreAuthBSS;
- UINT8 neighborBSSList[MAX_SIZE_OF_BSS_TRACK_LIST];
- UINT8 numOfNeighborBSS;
- UINT8 regularBSSList[MAX_SIZE_OF_BSS_TRACK_LIST];
- UINT8 numOfRegularBSS;
- } listOfCandidateAps_t;
- #define MAX_ROAMING_TRIGGERS ROAMING_TRIGGER_LAST
- struct _roamingMngr_t
- {
- /*** Roaming manager parameters that can be configured externally ***/
- roamingMngrConfig_t roamingMngrConfig;
- roamingMngrThresholdsConfig_t roamingMngrThresholdsConfig;
- UINT32 lowPassFilterRoamingAttemptInMsec;
- /*** Internal roaming parameters ***/
- /* the roaming trigger type */
- apConn_roamingTrigger_e roamingTrigger;
- /* Roaming SM current state */
- roamingMngr_smStates currentState;
- /* Indicate if a trigger is already in process, and therefore the
- other triggers will be ignored */
- BOOL maskRoamingEvents;
- /* TS to filter Too many low Quality roaming triggers */
- UINT32 lowQualityTriggerTimestamp;
- /* the scan type performed for Roaming */
- scan4RoamingType_e scanType;
- /* list of BSS received from Scan Manager */
- bssList_t *pListOfAPs;
- /* Indicating if Neighbor APs exist */
- BOOL neighborApsExist;
- /* a list of the candiadte APs indexes in pListOfAPs according to
- neighbor APs, pre-auth APs and other APs */
- listOfCandidateAps_t listOfCandidateAps;
- /* The current candidate AP's index to Roam to */
- UINT8 candidateApIndex;
- /* Indicates whether at least one handover was performed */
- BOOL handoverWasPerformed;
- /* The station capabilities for the current Connection */
- apConn_staCapabilities_t staCapabilities;
- /* Roaming manager SM */
- fsm_stateMachine_t *pRoamingSm;
-
- /* Roaming manager handles to other objects */
- TI_HANDLE hReport;
- TI_HANDLE hOs;
- TI_HANDLE hScanMngr;
- TI_HANDLE hAPConnection;
- #ifdef TI_DBG
- /* Debug trace for Roaming statistics */
- UINT32 roamingTriggerEvents[MAX_ROAMING_TRIGGERS];
- UINT32 roamingHandoverEvents[MAX_ROAMING_TRIGGERS];
- UINT32 roamingSuccesfulHandoverNum;
- UINT32 roamingFailedHandoverNum;
- UINT32 roamingTriggerTimestamp;
- UINT32 roamingHandoverStartedTimestamp;
- UINT32 roamingHandoverCompletedTimestamp;
- UINT32 roamingAverageSuccHandoverDuration;
- UINT32 roamingAverageRoamingDuration;
- #endif
-
- };
- /* External data definitions */
- /* Local functions definitions */
- /* Global variables */
- #ifdef REPORT_LOG
- static char *roamingMngr_stateDesc[ROAMING_MNGR_NUM_STATES] = {
- "STATE_IDLE",
- "STATE_WAIT_4_TRIGGER",
- "STATE_WAIT_4_CMD",
- "STATE_SCANNING",
- "STATE_SELECTING",
- "CONNECTING"
- };
-
- static char *roamingMngr_eventDesc[ROAMING_MNGR_NUM_EVENTS] = {
- "EVENT_START",
- "EVENT_STOP",
- "EVENT_ROAM_TRIGGER",
- "EVENT_SCAN",
- "EVENT_SELECT",
- "EVENT_REQ_HANDOVER",
- "EVENT_ROAM_SUCCESS",
- "EVENT_FAILURE"
- };
- #endif
- /* Function prototypes */
- /* SM functions */
- static TI_STATUS roamingMngr_smEvent(UINT8 *currState, UINT8 event, void* data);
- static TI_STATUS roamingMngr_smUnexpected(void *pData);
- static TI_STATUS roamingMngr_smNop(void *pData);
- static TI_STATUS roamingMngr_smStartIdle(void *pData);
- static TI_STATUS roamingMngr_smStop(void *pData);
- static TI_STATUS roamingMngr_smStopWhileScanning(void *pData);
- static TI_STATUS roamingMngr_smRoamTrigger(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smInvokeScan(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smSelection(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smHandover(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smSuccHandover(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smFailHandover(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smScanFailure(TI_HANDLE hRoamingMngr);
- static TI_STATUS roamingMngr_smDisconnectWhileConnecting(TI_HANDLE hRoamingMngr);
- /************** callback funtions called by AP Connection **************/
- /* called when a trigger for Roaming occurs */
- TI_STATUS roamingMngr_triggerRoamingCb(TI_HANDLE hRoamingMngr, void *pData);
- /* called when CONN status event occurs */
- TI_STATUS roamingMngr_connStatusCb(TI_HANDLE hRoamingMngr, void *pData);
- /* called when Neighbor APs is updated */
- TI_STATUS roamingMngr_updateNeighborApListCb(TI_HANDLE hRoamingMngr, void *pData);
- /* internal functions */
- static void roamingMngr_releaseModule(roamingMngr_t *pRoamingMngr, UINT32 initVec);
- #ifdef TI_DBG
- /* debug function */
- static void roamingMngr_printStatistics(TI_HANDLE hRoamingMngr);
- static void roamingMngr_resetStatistics(TI_HANDLE hRoamingMngr);
- #endif
- /**
- *
- * roamingMngr_create
- *
- * \b Description:
- *
- * Create the Roaming Manager context.
- *
- * \b ARGS:
- *
- * I - hOs - OS handler \n
- *
- * \b RETURNS:
- *
- * OK on success, NOK on failure.
- *
- * \sa
- */
- TI_HANDLE roamingMngr_create(TI_HANDLE hOs)
- {
- TI_STATUS status;
- roamingMngr_t *pRoamingMngr;
- UINT32 initVec;
- initVec = 0;
- pRoamingMngr = os_memoryAlloc(hOs, sizeof(roamingMngr_t));
- if (pRoamingMngr == NULL)
- return NULL;
- initVec |= (1 << ROAMING_MNGR_CONTEXT_INIT_BIT);
- pRoamingMngr->hOs = hOs;
- status = fsm_Create(hOs, &pRoamingMngr->pRoamingSm, ROAMING_MNGR_NUM_STATES, ROAMING_MNGR_NUM_EVENTS);
- if (status != OK)
- {
- roamingMngr_releaseModule(pRoamingMngr, initVec);
- WLAN_OS_REPORT(("FATAL ERROR: roamingMngr_create(): Error Creating pRoamingSm - Aborting\n"));
- return NULL;
- }
- initVec |= (1 << ROAMING_MNGR_SM_INIT_BIT);
-
- return pRoamingMngr;
- }
- /**
- *
- * roamingMngr_releaseModule
- *
- * \b Description:
- *
- * Called by the un load function
- * Go over the vector, for each bit that is set, release the corresponding module.
- *
- * \b ARGS:
- *
- * I - pRoamingMngr - Roaming Manager context \n
- * I - initVec - indicates which modules should be released
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- * \sa roamingMngr_create
- */
- static void roamingMngr_releaseModule(roamingMngr_t *pRoamingMngr, UINT32 initVec)
- {
- if (pRoamingMngr==NULL)
- {
- return;
- }
- if (initVec & (1 << ROAMING_MNGR_SM_INIT_BIT))
- {
- fsm_Unload(pRoamingMngr->hOs, pRoamingMngr->pRoamingSm);
- }
- if (initVec & (1 << ROAMING_MNGR_CONTEXT_INIT_BIT))
- {
- utils_nullMemoryFree(pRoamingMngr->hOs, pRoamingMngr, sizeof(roamingMngr_t));
- }
- initVec = 0;
- }
- /**
- *
- * roamingMngr_unload
- *
- * \b Description:
- *
- * Unload Roaming Manager module from memory
- *
- * \b ARGS:
- *
- * I - hAdmCtrl - Roaming Manager context \n
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- * \sa roamingMngr_create
- */
- TI_STATUS roamingMngr_unload(TI_HANDLE hRoamingMngr)
- {
- UINT32 initVec;
- if (hRoamingMngr == NULL)
- {
- return OK;
- }
- initVec = 0xFFFF;
- roamingMngr_releaseModule(hRoamingMngr, initVec);
- return OK;
- }
- /**
- *
- * roamingMngr_config
- *
- * \b Description:
- *
- * Configure the Roaming Manager module.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - Roaming Manager context \n
- * I - hReport - Report context \n
- * I - hOs - OS context \n
- * I - hSiteMgr - Site Manager context \n
- * I - hSmeSm - SME context \n
- * I - hCtrlData - Control Data context \n
- * I - hPowerMgr - Power Manager context \n
- * I - pRoamingParams - init roaming parameters read from the registry \n
- *
- * \b RETURNS:
- *
- * OK on success, NOK on failure.
- *
- * \sa
- */
- TI_STATUS roamingMngr_init(TI_HANDLE hRoamingMngr,
- TI_HANDLE hReport,
- TI_HANDLE hScanMngr,
- TI_HANDLE hAPConnection)
- {
- roamingMngr_t *pRoamingMngr;
- TI_STATUS status;
- #ifdef ENABLE_ROAMING_BY_DEFAULT
- roamingMngrConfigParams_t InitRoamingParams;
- paramInfo_t param;
- #endif
- #ifdef TI_DBG
- UINT8 index;
- #endif
- /** Station broadcast key State Machine matrix */
- fsm_actionCell_t roamingMngr_matrix[ROAMING_MNGR_NUM_STATES][ROAMING_MNGR_NUM_EVENTS] =
- {
- /* next state and actions for IDLE state */
- { {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smStartIdle}, /* START */
- {ROAMING_STATE_IDLE, roamingMngr_smNop}, /* STOP */
- {ROAMING_STATE_IDLE, roamingMngr_smNop}, /* ROAM_TRIGGER */
- {ROAMING_STATE_IDLE, roamingMngr_smUnexpected}, /* SCAN */
- {ROAMING_STATE_IDLE, roamingMngr_smUnexpected}, /* SELECT */
- {ROAMING_STATE_IDLE, roamingMngr_smUnexpected}, /* REQ_HANDOVER */
- {ROAMING_STATE_IDLE, roamingMngr_smUnexpected}, /* ROAM_SUCCESS */
- {ROAMING_STATE_IDLE, roamingMngr_smUnexpected} /* FAILURE */
- },
- /* next state and actions for WAIT_4_TRIGGER state */
- { {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected}, /* START */
- {ROAMING_STATE_IDLE, roamingMngr_smStop}, /* STOP */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smRoamTrigger}, /* ROAM_TRIGGER */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected}, /* SCAN */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected}, /* SELECT */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected}, /* REQ_HANDOVER */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected}, /* ROAM_SUCCESS */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smUnexpected} /* FAILURE */
- },
-
- /* next state and actions for WAIT_4_CMD state */
- { {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected}, /* START */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected}, /* STOP */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected}, /* ROAM_TRIGGER */
- {ROAMING_STATE_SCANNING, roamingMngr_smInvokeScan}, /* SCAN */
- {ROAMING_STATE_SELECTING, roamingMngr_smSelection}, /* SELECT */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected}, /* REQ_HANDOVER */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected}, /* ROAM_SUCCESS */
- {ROAMING_STATE_WAIT_4_CMD, roamingMngr_smUnexpected} /* FAILURE */
- },
- /* next state and actions for SCANNING state */
- { {ROAMING_STATE_SCANNING, roamingMngr_smUnexpected}, /* START */
- {ROAMING_STATE_IDLE, roamingMngr_smStopWhileScanning}, /* STOP */
- {ROAMING_STATE_SCANNING, roamingMngr_smNop}, /* ROAM_TRIGGER */
- {ROAMING_STATE_SCANNING, roamingMngr_smInvokeScan}, /* SCAN */
- {ROAMING_STATE_SELECTING, roamingMngr_smSelection}, /* SELECT */
- {ROAMING_STATE_SCANNING, roamingMngr_smUnexpected}, /* REQ_HANDOVER */
- {ROAMING_STATE_SCANNING, roamingMngr_smUnexpected}, /* ROAM_SUCCESS */
- {ROAMING_STATE_IDLE, roamingMngr_smScanFailure} /* FAILURE */
-
- },
- /* next state and actions for SELECTING state */
- { {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* START */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* STOP */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* ROAM_TRIGGER */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* SCAN */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* SELECT */
- {ROAMING_STATE_CONNECTING, roamingMngr_smHandover}, /* REQ_HANDOVER */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected}, /* ROAM_SUCCESS */
- {ROAMING_STATE_SELECTING, roamingMngr_smUnexpected} /* FAILURE */
-
- },
- /* next state and actions for CONNECTING state */
- { {ROAMING_STATE_CONNECTING, roamingMngr_smUnexpected}, /* START */
- {ROAMING_STATE_IDLE, roamingMngr_smStop}, /* STOP */
- {ROAMING_STATE_IDLE, roamingMngr_smDisconnectWhileConnecting}, /* ROAM_TRIGGER */
- {ROAMING_STATE_CONNECTING, roamingMngr_smUnexpected}, /* SCAN, */
- {ROAMING_STATE_CONNECTING, roamingMngr_smUnexpected}, /* SELECT */
- {ROAMING_STATE_CONNECTING, roamingMngr_smHandover}, /* REQ_HANDOVER */
- {ROAMING_STATE_WAIT_4_TRIGGER, roamingMngr_smSuccHandover} , /* ROAM_SUCCESS */
- {ROAMING_STATE_IDLE, roamingMngr_smFailHandover} /* FAILURE */
-
- }
- };
- if (hRoamingMngr == NULL)
- {
- return NOK;
- }
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- /* Update handlers */
- pRoamingMngr->hReport = hReport;
- pRoamingMngr->hScanMngr = hScanMngr;
- pRoamingMngr->hAPConnection = hAPConnection;
- /* Init intrenal variables */
- pRoamingMngr->currentState = ROAMING_STATE_IDLE;
- pRoamingMngr->roamingMngrConfig.enableDisable = ROAMING_DISABLED;
- pRoamingMngr->roamingTrigger = ROAMING_TRIGGER_NONE;
- pRoamingMngr->maskRoamingEvents= TRUE;
- pRoamingMngr->scanType = ROAMING_NO_SCAN;
- pRoamingMngr->candidateApIndex = INVALID_CANDIDATE_INDEX;
- pRoamingMngr->handoverWasPerformed = FALSE;
- pRoamingMngr->lowQualityTriggerTimestamp = 0;
- pRoamingMngr->neighborApsExist = FALSE;
- pRoamingMngr->pListOfAPs = NULL;
- pRoamingMngr->candidateApIndex = INVALID_CANDIDATE_INDEX;
- pRoamingMngr->listOfCandidateAps.numOfNeighborBSS = 0;
- pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS = 0;
- pRoamingMngr->listOfCandidateAps.numOfRegularBSS = 0;
- #ifdef TI_DBG
- /* debug counters */
- pRoamingMngr->roamingSuccesfulHandoverNum = 0;
- pRoamingMngr->roamingHandoverStartedTimestamp = 0;
- pRoamingMngr->roamingHandoverCompletedTimestamp = 0;
- pRoamingMngr->roamingAverageSuccHandoverDuration = 0;
- pRoamingMngr->roamingAverageRoamingDuration = 0;
- pRoamingMngr->roamingFailedHandoverNum = 0;
- for (index=ROAMING_TRIGGER_NONE; index<ROAMING_TRIGGER_LAST; index++)
- {
- pRoamingMngr->roamingTriggerEvents[index] = 0;
- pRoamingMngr->roamingHandoverEvents[index] = 0;
- }
- #endif
- /* config the FSM */
- status = fsm_Config(pRoamingMngr->pRoamingSm,
- &roamingMngr_matrix[0][0],
- ROAMING_MNGR_NUM_STATES,
- ROAMING_MNGR_NUM_EVENTS,
- roamingMngr_smEvent, pRoamingMngr->hOs);
- #ifdef ENABLE_ROAMING_BY_DEFAULT
- if (status != OK)
- {
- return status;
- }
- param.paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION;
- param.content.applicationConfigBuffer.bufferSize = sizeof(roamingMngrConfigParams_t);
- param.content.applicationConfigBuffer.buffer = (UINT8 *)¶m;
- InitRoamingParams.roamingMngrConfig.enableDisable = ROAMING_ENABLED;
- InitRoamingParams.roamingMngrConfig.lowPassFilterRoamingAttempt = 30;
- InitRoamingParams.roamingMngrConfig.apQualityThreshold = -70;
- InitRoamingParams.roamingMngrThresholdsConfig.dataRetryThreshold = 20;
- InitRoamingParams.roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss = 10;
- InitRoamingParams.roamingMngrThresholdsConfig.txRateThreshold = 2;
- InitRoamingParams.roamingMngrThresholdsConfig.lowRssiThreshold = -80;
- InitRoamingParams.roamingMngrThresholdsConfig.lowSnrThreshold = 0;
- InitRoamingParams.roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition = -60;
- InitRoamingParams.roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition = -50;
- InitRoamingParams.roamingMngrThresholdsConfig.rssiFilterWeight = 10;
- InitRoamingParams.roamingMngrThresholdsConfig.snrFilterWeight = 10;
- param.paramType = ROAMING_MNGR_APPLICATION_CONFIGURATION;
- param.content.applicationConfigBuffer.bufferSize = sizeof(roamingMngrConfigParams_t);
- param.content.applicationConfigBuffer.buffer = (UINT8 *)&InitRoamingParams;
- roamingMngr_setParam (hRoamingMngr,¶m);
- #endif
- return status;
- }
- /* For debug */
- extern TI_STATUS apConn_reportRoamingEvent(TI_HANDLE hAPConnection,apConn_roamingTrigger_e roamingEventType,void *pRoamingEventData);
- /**
- *
- * roamingMngr_setParam - Set a specific parameter to the roamingMngr SM
- *
- * \b Description:
- *
- * Set a specific parameter to the roamingMngr SM.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I/O - pParam - Parameter \n
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_setParam(TI_HANDLE hRoamingMngr, paramInfo_t *pParam)
- {
- roamingMngr_t *pRoamingMngr;
- TI_STATUS status=OK;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if ((hRoamingMngr == NULL) || (pParam == NULL))
- {
- return NOK;
- }
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_setParam %X \n",
- pParam->paramType));
- switch (pParam->paramType)
- {
-
- case ROAMING_MNGR_APPLICATION_CONFIGURATION:
- {
- roamingMngrConfigParams_t *pRoamingMngrConfigParams;
-
- if (pParam->content.applicationConfigBuffer.bufferSize < sizeof(roamingMngrConfigParams_t))
- {
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_setParam bad size = %d \n",
- pParam->content.applicationConfigBuffer.bufferSize));
- return NOK;
- }
-
- pRoamingMngrConfigParams = (roamingMngrConfigParams_t*)pParam->content.applicationConfigBuffer.buffer;
-
- /* Configure the Roaming Parmeters */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,("roamingMngr_setParam Configuration: \n \
- enableDisable= %d,\n lowPassFilterRoamingAttempt=%d,\n \
- apQualityThreshold=%d\n",
- pRoamingMngrConfigParams->roamingMngrConfig.enableDisable,
- pRoamingMngrConfigParams->roamingMngrConfig.lowPassFilterRoamingAttempt,
- pRoamingMngrConfigParams->roamingMngrConfig.apQualityThreshold));
- pRoamingMngr->roamingMngrConfig.apQualityThreshold = pRoamingMngrConfigParams->roamingMngrConfig.apQualityThreshold;
- pRoamingMngr->roamingMngrConfig.lowPassFilterRoamingAttempt = pRoamingMngrConfigParams->roamingMngrConfig.lowPassFilterRoamingAttempt;
- pRoamingMngr->lowPassFilterRoamingAttemptInMsec = pRoamingMngrConfigParams->roamingMngrConfig.lowPassFilterRoamingAttempt * 1000;
- /* Configure the Roaming Trigger thresholds */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,("roamingMngr_setParam Thresholds: \n \
- dataRetryThreshold= %d,\n lowQualityForBackgroungScanCondition=%d,\n \
- lowRssiThreshold=%d,\n lowSNRThreshold=%d,\n \
- normalQualityForBackgroungScanCondition=%d,\n \
- numExpectedTbttForBSSLoss=%d,\n txRateThreshold=%d \n \n",
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.dataRetryThreshold,
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.lowQualityForBackgroungScanCondition,
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.lowRssiThreshold,
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.lowSnrThreshold, pRoamingMngrConfigParams->roamingMngrThresholdsConfig.normalQualityForBackgroungScanCondition,
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.numExpectedTbttForBSSLoss,
- pRoamingMngrConfigParams->roamingMngrThresholdsConfig.txRateThreshold));
- os_memoryCopy(pRoamingMngr->hOs, &pRoamingMngr->roamingMngrThresholdsConfig, &pRoamingMngrConfigParams->roamingMngrThresholdsConfig, sizeof(roamingMngrThresholdsConfig_t));
-
- status = apConn_setRoamThresholds(pRoamingMngr->hAPConnection, &pRoamingMngrConfigParams->roamingMngrThresholdsConfig);
- if (pRoamingMngr->roamingMngrConfig.enableDisable &&
- !pRoamingMngrConfigParams->roamingMngrConfig.enableDisable)
- { /* disable Roaming Manager */
- apConn_unregisterRoamMngrCallb(pRoamingMngr->hAPConnection);
- pRoamingMngr->roamingMngrConfig.enableDisable = ROAMING_DISABLED;
- return (roamingMngr_smEvent((UINT8*)&pRoamingMngr->currentState, ROAMING_EVENT_STOP, pRoamingMngr));
- }
- else if (!pRoamingMngr->roamingMngrConfig.enableDisable &&
- pRoamingMngrConfigParams->roamingMngrConfig.enableDisable)
- { /* enable Roaming Manager */
- /* Save the Roaming Configuration parameters */
- pRoamingMngr->roamingMngrConfig.enableDisable = pRoamingMngrConfigParams->roamingMngrConfig.enableDisable;
- /* register Roaming callback */
- apConn_registerRoamMngrCallb(pRoamingMngr->hAPConnection,
- roamingMngr_triggerRoamingCb,
- roamingMngr_connStatusCb,
- roamingMngr_updateNeighborApListCb);
- }
- }
- break;
- /*********** For Debug Purposes ***********/
- case ROAMING_MNGR_TRIGGER_EVENT:
- /* Enable/disable Internal Roaming */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_setParam TRIGGER_EVENT= %d \n",
- pParam->content.roamingTriggerType));
- if ((apConn_roamingTrigger_e)pParam->content.roamingTriggerType == ROAMING_TRIGGER_AP_DISCONNECT)
- {
- /* DeAuth packet with status code of deauth/disassoc packet equal to 1 */
- apConn_reportRoamingEventDisconnect(pRoamingMngr->hAPConnection ,1 ,TRUE);
- }
- else
- {
- apConn_reportRoamingEvent(pRoamingMngr->hAPConnection, (apConn_roamingTrigger_e)pParam->content.roamingTriggerType, NULL);
- }
- break;
-
- case ROAMING_MNGR_CONN_STATUS:
- /* External request to connect to BBSID */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_setParam CONN_STATUS= %d \n",
- pParam->content.roamingConnStatus));
- roamingMngr_connStatusCb(pRoamingMngr, &pParam->content.roamingConnStatus);
- break;
- default:
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_setParam bad param= %X\n",
- pParam->paramType));
- break;
- }
- return status;
- }
- /**
- *
- * roamingMngr_getParam - Get a specific parameter from the roamingMngr SM
- *
- * \b Description:
- *
- * Get a specific parameter from the roamingMngr SM.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I/O - pParam - Parameter \n
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_getParam(TI_HANDLE hRoamingMngr, paramInfo_t *pParam)
- {
- roamingMngr_t *pRoamingMngr;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if ((hRoamingMngr == NULL) || (pParam == NULL))
- {
- return NOK;
- }
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_getParam %X \n",
- pParam->paramType));
- switch (pParam->paramType)
- {
- case ROAMING_MNGR_APPLICATION_CONFIGURATION:
- {
- roamingMngrConfigParams_t *pRoamingMngrConfigParams;
-
- pRoamingMngrConfigParams = (roamingMngrConfigParams_t *)&pParam->content.roamingConfigBuffer;
-
- if (pRoamingMngr->roamingMngrConfig.enableDisable == ROAMING_DISABLED)
- {
- pRoamingMngrConfigParams->roamingMngrConfig.enableDisable = FALSE;
- }
- else
- {
- pRoamingMngrConfigParams->roamingMngrConfig.enableDisable = TRUE;
- }
- pRoamingMngrConfigParams->roamingMngrConfig.apQualityThreshold = pRoamingMngr->roamingMngrConfig.apQualityThreshold;
- pRoamingMngrConfigParams->roamingMngrConfig.lowPassFilterRoamingAttempt = pRoamingMngr->roamingMngrConfig.lowPassFilterRoamingAttempt;
- apConn_getRoamThresholds(pRoamingMngr->hAPConnection, &pRoamingMngr->roamingMngrThresholdsConfig);
- os_memoryCopy(pRoamingMngr->hOs, &pRoamingMngrConfigParams->roamingMngrThresholdsConfig, &pRoamingMngr->roamingMngrThresholdsConfig, sizeof(roamingMngrThresholdsConfig_t));
- pParam->paramLength = sizeof(roamingMngrConfigParams_t);
- }
- break;
- case ROAMING_MNGR_CONF_PARAM:
- WLAN_OS_REPORT(("Roaming is: %s \n", pRoamingMngr->roamingMngrConfig.enableDisable ? "Enabled" : "Disabled"));
- WLAN_OS_REPORT(("lowPassFilterRoamingAttempt = %d msec, apQualityThreshold = %d\n",
- pRoamingMngr->roamingMngrConfig.lowPassFilterRoamingAttempt,
- pRoamingMngr->roamingMngrConfig.apQualityThreshold));
- break;
- #ifdef TI_DBG
- case ROAMING_MNGR_PRINT_STATISTICS:
- roamingMngr_printStatistics(pRoamingMngr);
- break;
- case ROAMING_MNGR_RESET_STATISTICS:
- roamingMngr_resetStatistics(pRoamingMngr);
- break;
- case ROAMING_MNGR_PRINT_CURRENT_STATUS:
- WLAN_OS_REPORT(("Roaming Current State = %s, enableDisable=%d\n, maskRoamingEvents = %d, roamingTrigger=%d \n scanType=%d, handoverWasPerformed=%d \n, candidateApIndex=%d, lowQualityTriggerTimestamp=%d \n",
- roamingMngr_stateDesc[pRoamingMngr->currentState],
- pRoamingMngr->roamingMngrConfig.enableDisable,
- pRoamingMngr->maskRoamingEvents,
- pRoamingMngr->roamingTrigger,
- pRoamingMngr->scanType,
- pRoamingMngr->handoverWasPerformed,
- pRoamingMngr->candidateApIndex,
- pRoamingMngr->lowQualityTriggerTimestamp));
- break;
- case ROAMING_MNGR_PRINT_CANDIDATE_TABLE:
- {
- UINT32 index;
- if (pRoamingMngr->pListOfAPs==NULL)
- {
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("Roaming Mngr the candidate AP list is invalid \n") );
- break;
- }
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("The number of candidates is %d\n",
- pRoamingMngr->pListOfAPs->numOfEntries) );
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("Roaming Mngr Neighbor AP list, num of candidates = %d\n",
- pRoamingMngr->listOfCandidateAps.numOfNeighborBSS) );
- for (index=0; index<pRoamingMngr->listOfCandidateAps.numOfNeighborBSS; index++)
- {
- UINT32 candidateIndex;
- bssEntry_t *pBssEntry;
- candidateIndex = pRoamingMngr->listOfCandidateAps.neighborBSSList[index];
- pBssEntry = &pRoamingMngr->pListOfAPs->BSSList[candidateIndex];
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("candiate %d, BSSID=%x-%x-%x-%x-%x-%x, RSSI =%d \n",
- candidateIndex, pBssEntry->BSSID.addr[0],
- pBssEntry->BSSID.addr[1], pBssEntry->BSSID.addr[2],
- pBssEntry->BSSID.addr[3], pBssEntry->BSSID.addr[4],
- pBssEntry->BSSID.addr[5], pBssEntry->RSSI) );
- }
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("Roaming Mngr Pre-Auth AP list, num of candidates = %d\n",
- pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS) );
- for (index=0; index<pRoamingMngr->listOfCandidateAps.numOfPreAuthBSS; index++)
- {
- UINT32 candidateIndex;
- bssEntry_t *pBssEntry;
- candidateIndex = pRoamingMngr->listOfCandidateAps.preAuthBSSList[index];
- pBssEntry = &pRoamingMngr->pListOfAPs->BSSList[candidateIndex];
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("candiate %d, BSSID=%x-%x-%x-%x-%x-%x, RSSI =%d \n",
- candidateIndex, pBssEntry->BSSID.addr[0],
- pBssEntry->BSSID.addr[1], pBssEntry->BSSID.addr[2],
- pBssEntry->BSSID.addr[3], pBssEntry->BSSID.addr[4],
- pBssEntry->BSSID.addr[5], pBssEntry->RSSI) );
- }
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("Roaming Mngr Regular AP list, num of candidates = %d\n",
- pRoamingMngr->listOfCandidateAps.numOfRegularBSS) );
- for (index=0; index<pRoamingMngr->listOfCandidateAps.numOfRegularBSS; index++)
- {
- UINT32 candidateIndex;
- bssEntry_t *pBssEntry;
- candidateIndex = pRoamingMngr->listOfCandidateAps.regularBSSList[index];
- pBssEntry = &pRoamingMngr->pListOfAPs->BSSList[candidateIndex];
- WLAN_REPORT_INFORMATION( pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("candiate %d, BSSID=%x-%x-%x-%x-%x-%x, RSSI =%d \n",
- candidateIndex, pBssEntry->BSSID.addr[0],
- pBssEntry->BSSID.addr[1], pBssEntry->BSSID.addr[2],
- pBssEntry->BSSID.addr[3], pBssEntry->BSSID.addr[4],
- pBssEntry->BSSID.addr[5], pBssEntry->RSSI) );
- }
- }
- break;
- #endif /*TI_DBG*/
- default:
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_getParam bad paramType= %X \n",
- pParam->paramType));
- return NOK;
- }
- return OK;
- }
- /**
- *
- * roamingMngr_triggerRoamingCb
- *
- * \b Description:
- *
- * This procedure is called when Roaming should be triggered
- * due to one of apConn_roamingTrigger_e Roaming Reasons.
- * Save the trigger and process it only if there's no other Roaming trigger
- * in process.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I - pData - pointer to roaming trigger
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_triggerRoamingCb(TI_HANDLE hRoamingMngr, void *pData)
- {
- roamingMngr_t *pRoamingMngr;
- apConn_roamingTrigger_e roamingTrigger;
- UINT32 curTimestamp;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if ((pRoamingMngr == NULL) || (pData == NULL))
- {
- return NOK;
- }
- roamingTrigger = *(apConn_roamingTrigger_e *)pData;
- if (roamingTrigger >= ROAMING_TRIGGER_LAST)
- {
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_triggerRoamingCb, bad roaming trigger = %d\n", roamingTrigger));
- return NOK;
- }
- #ifdef TI_DBG
- /* save parameters for debug*/
- pRoamingMngr->roamingTriggerEvents[pRoamingMngr->roamingTrigger]++;
- #endif
- if (roamingTrigger <= ROAMING_TRIGGER_BG_SCAN_GROUP)
- {
- BOOL lowQuality = FALSE;
- if (roamingTrigger == ROAMING_TRIGGER_LOW_QUALITY_FOR_BG_SCAN)
- {
- lowQuality = TRUE;
- }
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_triggerRoamingCb, lowQuality = %d \n",
- lowQuality));
- scanMngr_qualityChangeTrigger(pRoamingMngr->hScanMngr, lowQuality);
- }
- else
- {
- if (roamingTrigger > pRoamingMngr->roamingTrigger)
- { /* Save the highest priority roaming trigger */
- pRoamingMngr->roamingTrigger = roamingTrigger;
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_triggerRoamingCb, higher trigger = %d \n",
- roamingTrigger));
- }
- curTimestamp = os_timeStampMs(pRoamingMngr->hOs);
- /* If "No BSS" trigger received, disable count of low pass filter timer */
- if (roamingTrigger > ROAMING_TRIGGER_LOW_QUALITY_GROUP)
- {
- pRoamingMngr->lowQualityTriggerTimestamp = 0;
- }
- /* Do not invoke a new Roaming Trigger when a previous one is in process */
- if (pRoamingMngr->maskRoamingEvents == FALSE)
- { /* No Roaming trigger is in process */
- /* If the trigger is low quality check the low pass filter */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_triggerRoamingCb, trigger = %d \n",
- roamingTrigger));
- if (roamingTrigger <= ROAMING_TRIGGER_LOW_QUALITY_GROUP)
- {
- UINT32 deltaTs = curTimestamp-pRoamingMngr->lowQualityTriggerTimestamp;
- if ((pRoamingMngr->lowQualityTriggerTimestamp != 0) &&
- (deltaTs < pRoamingMngr->lowPassFilterRoamingAttemptInMsec))
- { /* Ignore the low quality events. till the low pass time elapses */
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_triggerRoamingCb, trigger = %d Ignored!!,deltaTs=%d, curTimestamp = %d, lowQualityTriggerTimestamp = %d, lowPassFilterRoamingAttempt=%d\n",
- roamingTrigger, deltaTs, curTimestamp, pRoamingMngr->lowQualityTriggerTimestamp, pRoamingMngr->lowPassFilterRoamingAttemptInMsec));
- return OK;
- }
- pRoamingMngr->lowQualityTriggerTimestamp = curTimestamp;
- }
- /* Mask all future roaming events */
- pRoamingMngr->maskRoamingEvents = TRUE;
- #ifdef TI_DBG
- /* For debug */
- pRoamingMngr->roamingTriggerTimestamp = curTimestamp;
- #endif
- return (roamingMngr_smEvent((UINT8*)&pRoamingMngr->currentState, ROAMING_EVENT_ROAM_TRIGGER, pRoamingMngr));
- }
- else if (roamingTrigger > ROAMING_TRIGGER_FAST_CONNECT_GROUP)
- { /* If the trigger is from the Full Connect group, then stop the connection. */
- return (roamingMngr_smEvent((UINT8*)&pRoamingMngr->currentState, ROAMING_EVENT_ROAM_TRIGGER, pRoamingMngr));
-
- }
- }
- return OK;
- }
- /**
- *
- * roamingMngr_connStatusCb
- *
- * \b Description:
- *
- * This procedure is called when the connection status event
- * is triggered.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I - pData - pointer to the connection status.
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_connStatusCb(TI_HANDLE hRoamingMngr, void *pData)
- {
- roamingMngr_t *pRoamingMngr;
- apConn_connStatus_e connStatus;
- roamingMngr_smEvents roamingEvent;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if ((pRoamingMngr == NULL) || (pData == NULL))
- {
- return NOK;
- }
- connStatus = ((apConn_connStatus_t *)pData)->status;
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_connStatusCb, conn status = %d\n", connStatus));
- if (!pRoamingMngr->roamingMngrConfig.enableDisable)
- {
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_connStatusCb, connStatus=%d was received while Roaming is disabled. Stop Roaming \n",
- connStatus));
- return NOK;
- }
- switch (connStatus)
- {
- case CONN_STATUS_CONNECTED: roamingEvent = ROAMING_EVENT_START;
- /* Get station capabilities */
- apConn_getStaCapabilities(pRoamingMngr->hAPConnection, &pRoamingMngr->staCapabilities);
- break;
- case CONN_STATUS_NOT_CONNECTED: roamingEvent = ROAMING_EVENT_STOP;
- break;
- case CONN_STATUS_HANDOVER_SUCCESS: roamingEvent = ROAMING_EVENT_ROAM_SUCCESS;
- #ifdef TI_DBG
- /* For debug */
- pRoamingMngr->roamingSuccesfulHandoverNum++;
- pRoamingMngr->roamingHandoverCompletedTimestamp = os_timeStampMs(pRoamingMngr->hOs);
- pRoamingMngr->roamingAverageSuccHandoverDuration += os_timeStampMs(pRoamingMngr->hOs)-pRoamingMngr->roamingHandoverStartedTimestamp;
- pRoamingMngr->roamingAverageRoamingDuration += os_timeStampMs(pRoamingMngr->hOs)-pRoamingMngr->roamingTriggerTimestamp;
- pRoamingMngr->roamingHandoverEvents[pRoamingMngr->roamingTrigger]++;
- #endif
- break;
- case CONN_STATUS_HANDOVER_FAILURE: roamingEvent = ROAMING_EVENT_REQ_HANDOVER;
- #ifdef TI_DBG
- /* For debug */
- pRoamingMngr->roamingFailedHandoverNum++;
- #endif
- break;
- default:
- WLAN_REPORT_ERROR(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_connStatusCb, bad connStatus = %d\n", connStatus));
- return NOK;
- /* break; - unreachable */
- }
- return (roamingMngr_smEvent((UINT8*)&pRoamingMngr->currentState, roamingEvent, pRoamingMngr));
- }
- /**
- *
- * roamingMngr_updateNeighborApListCb
- *
- * \b Description:
- *
- * This procedure is called when Neighbor AP list is received from the AP.
- * Save the list, and set them in Scan Manager object.
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I - pData - pointer to the list of Neighbor APs.
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_updateNeighborApListCb(TI_HANDLE hRoamingMngr, void *pData)
- {
- roamingMngr_t *pRoamingMngr;
- neighborAPList_t *pNeighborAPList;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if ((pRoamingMngr == NULL) || (pData == NULL))
- {
- return NOK;
- }
- pNeighborAPList = (neighborAPList_t *)pData;
- if (pNeighborAPList->numOfEntries>0)
- {
- pRoamingMngr->neighborApsExist = TRUE;
- }
- else
- {
- pRoamingMngr->neighborApsExist = FALSE;
- }
-
- if (pRoamingMngr->roamingMngrConfig.enableDisable)
- {
- scanMngr_setNeighborAPs (pRoamingMngr->hScanMngr, pNeighborAPList);
- }
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_updateNeighborApListCb, numberOfAps = %d, enableDisable=%d\n",
- pNeighborAPList->numOfEntries, pRoamingMngr->roamingMngrConfig.enableDisable));
- return OK;
- }
- /**
- *
- * roamingMngr_immediateScanComplete
- *
- * \b Description:
- *
- * This procedure is called when Scan Manager completed Immediate Scan for Roaming
- * It performs the following:
- * - Partial or Full scan
- * - Re-try Partial or Full scan if the previous scan failed
- * - Full scan if the previous partial scan didn't get any APS
- * - Fail event if all the Scans failed
- *
- * \b ARGS:
- *
- * I - hRoamingMngr - roamingMngr SM context \n
- * I - scanCmpltStatus - the scan result, success or failure with different reasons
- *
- * \b RETURNS:
- *
- * OK if successful, NOK otherwise.
- *
- *
- */
- TI_STATUS roamingMngr_immediateScanComplete(TI_HANDLE hRoamingMngr, scan_mngrResultStatus_e scanCmpltStatus)
- {
- roamingMngr_t *pRoamingMngr;
- roamingMngr_smEvents roamingEvent;
- pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
- if (pRoamingMngr == NULL)
- {
- return NOK;
- }
- WLAN_REPORT_INFORMATION(pRoamingMngr->hReport, ROAMING_MANAGER_MODULE_LOG,
- ("roamingMngr_immediateScanComplete, scanCmpltStatus = %d\n", scanCmpltStatus));
- if (scanCmpltStatus == SCAN_MRS_SCAN_COMPLETE_OK)
- { /* The scan completed OK, get the updated list of APs */
- pRoamingMngr->pListOfAPs = scanMngr_getBSSList(pRoamingMngr->hScanMngr);
- if ((pRoamingMngr->pListOfAPs != NULL) && (pRoamingMngr->pListOfAPs->numOfEntries > 0))
- { /* APs were found, start selection */
- pRoamingMngr->scanType = ROAMING_NO_SCAN;
- roamingEvent = ROAMING_EVENT_SELECT;
- }
- else
- { /* There were no APs, if the scan was partial, retry full scan */
- if ((pRoamingMngr->scanType == ROAMING_PARTIAL_SCAN) ||
- (pRoamingMngr->scanType == ROAMING_PARTIAL_SCAN_RETRY))
- {
- pRoamingMngr->scanType = ROAMING_FULL_SCAN;
- roamingEvent = ROAMING_EVENT_SCAN;
- }
- else
- { /* No APs were fo…
Large files files are truncated, but you can click here to view the full file