blob: 6bf27d01a963046277081e5e516993eb4ae9b6a3 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
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
28/**
29 * \file csr_neighbor_roam.h
30 *
31 * Exports and types for the neighbor roaming algorithm which is sepcifically
32 * designed for Android.
33 */
34
35#ifndef CSR_NEIGHBOR_ROAM_H
36#define CSR_NEIGHBOR_ROAM_H
37
38#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
39#include "sme_api.h"
40
41#define ROAM_AP_AGE_LIMIT_MS 10000
42
43/* Enumeration of various states in neighbor roam algorithm */
44typedef enum {
45 eCSR_NEIGHBOR_ROAM_STATE_CLOSED,
46 eCSR_NEIGHBOR_ROAM_STATE_INIT,
47 eCSR_NEIGHBOR_ROAM_STATE_CONNECTED,
48 eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING,
49#ifdef WLAN_FEATURE_VOWIFI_11R
50 eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING,
51 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE,
52#endif /* WLAN_FEATURE_VOWIFI_11R */
53 eNEIGHBOR_STATE_MAX
54} eCsrNeighborRoamState;
55
56/* Parameters that are obtained from CFG */
57typedef struct sCsrNeighborRoamCfgParams {
58 uint8_t maxNeighborRetries;
59 uint32_t neighborScanPeriod;
60 tCsrChannelInfo channelInfo;
61 uint8_t neighborLookupThreshold;
62 uint8_t neighborReassocThreshold;
63 uint32_t minChannelScanTime;
64 uint32_t maxChannelScanTime;
65 uint16_t neighborResultsRefreshPeriod;
66 uint16_t emptyScanRefreshPeriod;
67 uint8_t nOpportunisticThresholdDiff;
68 uint8_t nRoamRescanRssiDiff;
69 uint8_t nRoamBmissFirstBcnt;
70 uint8_t nRoamBmissFinalBcnt;
71 uint8_t nRoamBeaconRssiWeight;
72 uint8_t delay_before_vdev_stop;
73 uint32_t hi_rssi_scan_max_count;
74 uint32_t hi_rssi_scan_rssi_delta;
75 uint32_t hi_rssi_scan_delay;
76 int32_t hi_rssi_scan_rssi_ub;
77} tCsrNeighborRoamCfgParams, *tpCsrNeighborRoamCfgParams;
78
79#define CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX 255
80typedef struct sCsrNeighborRoamChannelInfo {
81 /* Flag to mark reception of IAPP Neighbor list */
82 bool IAPPNeighborListReceived;
83 /* Current channel index that is being scanned */
84 uint8_t currentChanIndex;
85 /* Max number of channels in channel list and the list of channels */
86 tCsrChannelInfo currentChannelListInfo;
87} tCsrNeighborRoamChannelInfo, *tpCsrNeighborRoamChannelInfo;
88
89typedef struct sCsrNeighborRoamBSSInfo {
90 tListElem List;
91 uint8_t apPreferenceVal;
92 tpSirBssDescription pBssDescription;
93} tCsrNeighborRoamBSSInfo, *tpCsrNeighborRoamBSSInfo;
94
95#ifdef WLAN_FEATURE_VOWIFI_11R
96#define CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT 1000 /* in milliseconds */
97#define CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER 10 /* in milliseconds */
98/* Max number of MAC addresses with which the pre-auth was failed */
99#define MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS 10
100#define MAX_BSS_IN_NEIGHBOR_RPT 15
101#define CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES 3
102
103/* Black listed APs. List of MAC Addresses with which the Preauth was failed */
104typedef struct sCsrPreauthFailListInfo {
105 uint8_t numMACAddress;
106 tSirMacAddr macAddress[MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS];
107} tCsrPreauthFailListInfo, *tpCsrPreauthFailListInfo;
108
109typedef struct sCsrNeighborReportBssInfo {
110 uint8_t channelNum;
111 uint8_t neighborScore;
112 tSirMacAddr neighborBssId;
113} tCsrNeighborReportBssInfo, *tpCsrNeighborReportBssInfo;
114
115typedef struct sCsr11rAssocNeighborInfo {
116 bool preauthRspPending;
117 bool neighborRptPending;
118 uint8_t currentNeighborRptRetryNum;
119 tCsrPreauthFailListInfo preAuthFailList;
120 uint32_t neighborReportTimeout;
121 uint32_t PEPreauthRespTimeout;
122 uint8_t numPreAuthRetries;
123 tDblLinkList preAuthDoneList; /* llist which consists/preauth nodes */
124 uint8_t numBssFromNeighborReport;
125 /* Contains info needed during REPORT_SCAN State */
126 tCsrNeighborReportBssInfo neighboReportBssInfo[MAX_BSS_IN_NEIGHBOR_RPT];
127} tCsr11rAssocNeighborInfo, *tpCsr11rAssocNeighborInfo;
128#endif /* WLAN_FEATURE_VOWIFI_11R */
129
130#ifdef FEATURE_WLAN_LFR
131typedef enum {
132 eFirstEmptyScan = 1,
133 eSecondEmptyScan,
134 eThirdEmptyScan,
135 eFourthEmptyScan,
136 eFifthEmptyScan,
137 eMaxEmptyScan = eFifthEmptyScan,
138} eNeighborRoamEmptyScanCount;
139
140typedef enum {
141 DEFAULT_SCAN = 0,
142 SPLIT_SCAN_OCCUPIED_LIST = 1,
143} eNeighborRoamScanMode;
144#endif
145
146/* Complete control information for neighbor roam algorithm */
147typedef struct sCsrNeighborRoamControlInfo {
148 eCsrNeighborRoamState neighborRoamState;
149 eCsrNeighborRoamState prevNeighborRoamState;
150 tCsrNeighborRoamCfgParams cfgParams;
151 struct cdf_mac_addr currAPbssid; /* current assoc AP */
152 uint8_t currAPoperationChannel; /* current assoc AP */
153 tCsrNeighborRoamChannelInfo roamChannelInfo;
154 uint8_t currentNeighborLookupThreshold;
155 uint8_t currentOpportunisticThresholdDiff;
156 uint8_t currentRoamRescanRssiDiff;
157 tDblLinkList roamableAPList; /* List of current FT candidates */
158 tCsrRoamProfile csrNeighborRoamProfile;
159#ifdef WLAN_FEATURE_VOWIFI_11R
160 bool is11rAssoc;
161 tCsr11rAssocNeighborInfo FTRoamInfo;
162#endif /* WLAN_FEATURE_VOWIFI_11R */
163#ifdef FEATURE_WLAN_ESE
164 bool isESEAssoc;
165 bool isVOAdmitted;
166 uint16_t MinQBssLoadRequired;
167#endif
168#ifdef FEATURE_WLAN_LFR
169 /*
170 * Previous connected profile.
171 * If the new profile does not match previous we re-initialize
172 * occupied channel list
173 */
174 tCsrRoamConnectedProfile prevConnProfile;
175 /* upper layer requested a reassoc */
176 uint8_t uOsRequestedHandoff;
177 /* handoff related info came with upper layer's req for reassoc */
178 tCsrHandoffRequest handoffReqInfo;
179#endif
180 uint8_t currentRoamBmissFirstBcnt;
181 uint8_t currentRoamBmissFinalBcnt;
182 uint8_t currentRoamBeaconRssiWeight;
183 uint8_t last_sent_cmd;
184} tCsrNeighborRoamControlInfo, *tpCsrNeighborRoamControlInfo;
185
186/* All the necessary Function declarations are here */
187CDF_STATUS csr_neighbor_roam_indicate_connect(tpAniSirGlobal pMac,
188 uint8_t sessionId, CDF_STATUS status);
189CDF_STATUS csr_neighbor_roam_indicate_disconnect(tpAniSirGlobal pMac,
190 uint8_t sessionId);
191bool csr_neighbor_roam_is_handoff_in_progress(tpAniSirGlobal pMac,
192 uint8_t sessionId);
193void csr_neighbor_roam_request_handoff(tpAniSirGlobal pMac, uint8_t sessionId);
194CDF_STATUS csr_neighbor_roam_init(tpAniSirGlobal pMac, uint8_t sessionId);
195void csr_neighbor_roam_close(tpAniSirGlobal pMac, uint8_t sessionId);
196void csr_neighbor_roam_purge_preauth_failed_list(tpAniSirGlobal pMac);
197CDF_STATUS csr_neighbor_roam_transit_to_cfg_chan_scan(tpAniSirGlobal pMac,
198 uint8_t sessionId);
199CDF_STATUS csrNeighborRoamTransitionToPreauthDone(tpAniSirGlobal pMac);
200CDF_STATUS csr_neighbor_roam_prepare_scan_profile_filter(tpAniSirGlobal pMac,
201 tCsrScanResultFilter *pScanFilter, uint8_t sessionId);
202bool csr_neighbor_roam_get_handoff_ap_info(tpAniSirGlobal pMac,
203 tpCsrNeighborRoamBSSInfo pHandoffNode, uint8_t sessionId);
204CDF_STATUS csr_neighbor_roam_preauth_rsp_handler(tpAniSirGlobal pMac,
205 uint8_t sessionId, tSirRetStatus limStatus);
206#ifdef WLAN_FEATURE_VOWIFI_11R
207bool csr_neighbor_roam_is11r_assoc(tpAniSirGlobal pMac, uint8_t sessionId);
208#endif
209CDF_STATUS csr_neighbor_roam_create_chan_list_from_neighbor_report(
210 tpAniSirGlobal pMac, uint8_t sessionId);
211void csr_neighbor_roam_tranistion_preauth_done_to_disconnected(
212 tpAniSirGlobal pMac, uint8_t sessionId);
213bool csr_neighbor_roam_state_preauth_done(tpAniSirGlobal pMac,
214 uint8_t sessionId);
215bool csr_neighbor_middle_of_roaming(tpAniSirGlobal pMac, uint8_t sessionId);
216CDF_STATUS csr_neighbor_roam_set_lookup_rssi_threshold(tpAniSirGlobal pMac,
217 uint8_t sessionId, uint8_t neighborLookupRssiThreshold);
218CDF_STATUS csr_neighbor_roam_set_opportunistic_scan_threshold_diff(
219 tpAniSirGlobal pMac, uint8_t sessionId,
220 uint8_t nOpportunisticThresholdDiff);
221CDF_STATUS csr_neighbor_roam_set_roam_rescan_rssi_diff(tpAniSirGlobal pMac,
222 uint8_t sessionId, uint8_t nRoamRescanRssiDiff);
223CDF_STATUS csr_neighbor_roam_set_roam_bmiss_first_bcnt(tpAniSirGlobal pMac,
224 uint8_t sessionId, uint8_t nRoamBmissFirstBcnt);
225CDF_STATUS csr_neighbor_roam_set_roam_bmiss_final_bcnt(tpAniSirGlobal pMac,
226 uint8_t sessionId, uint8_t nRoamBmissFinalBcnt);
227CDF_STATUS csr_neighbor_roam_set_roam_beacon_rssi_weight(tpAniSirGlobal pMac,
228 uint8_t sessionId, uint8_t nRoamBeaconRssiWeight);
229CDF_STATUS csr_neighbor_roam_update_fast_roaming_enabled(tpAniSirGlobal pMac,
230 uint8_t sessionId, const bool fastRoamEnabled);
231CDF_STATUS csr_neighbor_roam_update_ese_mode_enabled(tpAniSirGlobal pMac,
232 uint8_t sessionId, const bool eseMode);
233CDF_STATUS csr_neighbor_roam_channels_filter_by_current_band(
234 tpAniSirGlobal pMac, uint8_t sessionId,
235 uint8_t *pInputChannelList,
236 uint8_t inputNumOfChannels,
237 uint8_t *pOutputChannelList,
238 uint8_t *pMergedOutputNumOfChannels);
239CDF_STATUS csr_neighbor_roam_merge_channel_lists(tpAniSirGlobal pMac,
240 uint8_t *pInputChannelList,
241 uint8_t inputNumOfChannels,
242 uint8_t *pOutputChannelList,
243 uint8_t outputNumOfChannels,
244 uint8_t *pMergedOutputNumOfChannels);
245void csr_roam_reset_roam_params(tpAniSirGlobal mac_ptr);
246#define ROAM_SCAN_OFFLOAD_START 1
247#define ROAM_SCAN_OFFLOAD_STOP 2
248#define ROAM_SCAN_OFFLOAD_RESTART 3
249#define ROAM_SCAN_OFFLOAD_UPDATE_CFG 4
250#define ROAM_SCAN_OFFLOAD_ABORT_SCAN 5
251
252#define REASON_CONNECT 1
253#define REASON_CHANNEL_LIST_CHANGED 2
254#define REASON_LOOKUP_THRESH_CHANGED 3
255#define REASON_DISCONNECTED 4
256#define REASON_RSSI_DIFF_CHANGED 5
257#define REASON_ESE_INI_CFG_CHANGED 6
258#define REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED 7
259#define REASON_VALID_CHANNEL_LIST_CHANGED 8
260#define REASON_FLUSH_CHANNEL_LIST 9
261#define REASON_EMPTY_SCAN_REF_PERIOD_CHANGED 10
262#define REASON_PREAUTH_FAILED_FOR_ALL 11
263#define REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW 12
264#define REASON_NPROBES_CHANGED 13
265#define REASON_HOME_AWAY_TIME_CHANGED 14
266#define REASON_OS_REQUESTED_ROAMING_NOW 15
267#define REASON_SCAN_CH_TIME_CHANGED 16
268#define REASON_SCAN_HOME_TIME_CHANGED 17
269#define REASON_OPPORTUNISTIC_THRESH_DIFF_CHANGED 18
270#define REASON_ROAM_RESCAN_RSSI_DIFF_CHANGED 19
271#define REASON_ROAM_BMISS_FIRST_BCNT_CHANGED 20
272#define REASON_ROAM_BMISS_FINAL_BCNT_CHANGED 21
273#define REASON_ROAM_BEACON_RSSI_WEIGHT_CHANGED 22
274#define REASON_ROAM_DFS_SCAN_MODE_CHANGED 23
275#define REASON_ROAM_ABORT_ROAM_SCAN 24
276#define REASON_ROAM_EXT_SCAN_PARAMS_CHANGED 25
277#define REASON_ROAM_SET_SSID_ALLOWED 26
278#define REASON_ROAM_SET_FAVORED_BSSID 27
279#define REASON_ROAM_GOOD_RSSI_CHANGED 28
280#define REASON_ROAM_SET_BLACKLIST_BSSID 29
281#define REASON_ROAM_SCAN_HI_RSSI_MAXCOUNT_CHANGED 30
282#define REASON_ROAM_SCAN_HI_RSSI_DELTA_CHANGED 31
283#define REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED 32
284#define REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED 33
285
286CDF_STATUS csr_roam_offload_scan(tpAniSirGlobal pMac, uint8_t sessionId,
287 uint8_t command, uint8_t reason);
288CDF_STATUS csr_neighbor_roam_candidate_found_ind_hdlr(tpAniSirGlobal pMac,
289 void *pMsg);
290CDF_STATUS csr_neighbor_roam_handoff_req_hdlr(tpAniSirGlobal pMac, void *pMsg);
291CDF_STATUS csr_neighbor_roam_proceed_with_handoff_req(tpAniSirGlobal pMac,
292 uint8_t sessionId);
293CDF_STATUS csr_neighbor_roam_sssid_scan_done(tpAniSirGlobal pMac,
294 uint8_t sessionId, CDF_STATUS status);
295CDF_STATUS csr_neighbor_roam_start_lfr_scan(tpAniSirGlobal pMac,
296 uint8_t sessionId);
297
298#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
299CDF_STATUS csr_set_cckm_ie(tpAniSirGlobal pMac, const uint8_t sessionId,
300 const uint8_t *pCckmIe, const uint8_t ccKmIeLen);
301CDF_STATUS csr_roam_read_tsf(tpAniSirGlobal pMac, uint8_t *pTimestamp,
302 const uint8_t sessionId);
303#endif /*FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
304#ifdef WLAN_FEATURE_ROAM_OFFLOAD
305CDF_STATUS csr_roam_offload_send_synch_cnf(tpAniSirGlobal pMac,
306 uint8_t sessionId);
307CDF_STATUS csr_neighbor_roam_offload_update_preauth_list(tpAniSirGlobal pMac,
308 roam_offload_synch_ind *roam_synch_ind_ptr, uint8_t sessionId);
309#endif
310#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
311#endif /* CSR_NEIGHBOR_ROAM_H */