Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 1 | /* |
Abhishek Singh | bd80d5c | 2019-04-09 15:05:54 +0530 | [diff] [blame] | 2 | * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 3 | * |
| 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
| 20 | * DOC: contains scan cache entry api |
| 21 | */ |
| 22 | |
| 23 | #ifndef _WLAN_SCAN_CACHE_DB_H_ |
| 24 | #define _WLAN_SCAN_CACHE_DB_H_ |
| 25 | |
| 26 | #include <scheduler_api.h> |
Abhishek Singh | 4caf1a9 | 2017-02-21 15:01:08 +0530 | [diff] [blame] | 27 | #include <wlan_objmgr_psoc_obj.h> |
| 28 | #include <wlan_objmgr_pdev_obj.h> |
| 29 | #include <wlan_objmgr_vdev_obj.h> |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 30 | #include <wlan_scan_public_structs.h> |
| 31 | |
| 32 | #define SCAN_HASH_SIZE 64 |
| 33 | #define SCAN_GET_HASH(addr) \ |
| 34 | (((const uint8_t *)(addr))[QDF_MAC_ADDR_SIZE - 1] % SCAN_HASH_SIZE) |
Om Prakash Tripathi | 4fa65d8 | 2017-06-22 11:15:24 +0530 | [diff] [blame] | 35 | |
Abhishek Singh | 7b59903 | 2017-11-10 14:42:31 +0530 | [diff] [blame] | 36 | #define SCM_PCL_RSSI_THRESHOLD -75 |
Abhishek Singh | b80af7e | 2017-07-19 18:48:42 +0530 | [diff] [blame] | 37 | #define BEST_CANDIDATE_MAX_BSS_SCORE 10000 |
| 38 | |
Abhishek Singh | c05285d | 2018-01-12 15:19:32 +0530 | [diff] [blame] | 39 | #define ADJACENT_CHANNEL_RSSI_THRESHOLD -80 |
| 40 | |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 41 | /** |
| 42 | * struct scan_dbs - scan cache data base definition |
| 43 | * @num_entries: number of scan entries |
| 44 | * @scan_hash_tbl: link list of bssid hashed scan cache entries for a pdev |
| 45 | */ |
| 46 | struct scan_dbs { |
| 47 | uint32_t num_entries; |
| 48 | qdf_spinlock_t scan_db_lock; |
| 49 | qdf_list_t scan_hash_tbl[SCAN_HASH_SIZE]; |
| 50 | }; |
| 51 | |
| 52 | /** |
| 53 | * struct scan_bcn_probe_event - beacon/probe info |
| 54 | * @frm_type: frame type |
| 55 | * @rx_data: mgmt rx data |
| 56 | * @psoc: psoc pointer |
| 57 | * @buf: rx frame |
| 58 | */ |
| 59 | struct scan_bcn_probe_event { |
| 60 | uint32_t frm_type; |
| 61 | struct mgmt_rx_event_params *rx_data; |
| 62 | struct wlan_objmgr_psoc *psoc; |
| 63 | qdf_nbuf_t buf; |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * scm_handle_bcn_probe() - Process beacon and probe rsp |
Abhishek Singh | bd80d5c | 2019-04-09 15:05:54 +0530 | [diff] [blame] | 68 | * @msg: schedular msg with bcn info; |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 69 | * |
Abhishek Singh | a7bfb9b | 2019-04-16 09:33:04 +0530 | [diff] [blame] | 70 | * API to handle the beacon/probe resp. msg->bodyptr will be consumed and freed |
| 71 | * by this func |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 72 | * |
| 73 | * Return: QDF status. |
| 74 | */ |
| 75 | QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg); |
| 76 | |
| 77 | /** |
Abhishek Singh | bd80d5c | 2019-04-09 15:05:54 +0530 | [diff] [blame] | 78 | * __scm_handle_bcn_probe() - Process beacon and probe rsp |
| 79 | * @bcn: beacon info; |
| 80 | * |
Abhishek Singh | a7bfb9b | 2019-04-16 09:33:04 +0530 | [diff] [blame] | 81 | * API to handle the beacon/probe resp. bcn will be consumed and freed by this |
| 82 | * func |
Abhishek Singh | bd80d5c | 2019-04-09 15:05:54 +0530 | [diff] [blame] | 83 | * |
| 84 | * Return: QDF status. |
| 85 | */ |
| 86 | QDF_STATUS __scm_handle_bcn_probe(struct scan_bcn_probe_event *bcn); |
| 87 | |
Abhishek Singh | bd80d5c | 2019-04-09 15:05:54 +0530 | [diff] [blame] | 88 | /** |
Abhishek Singh | 4caf1a9 | 2017-02-21 15:01:08 +0530 | [diff] [blame] | 89 | * scm_age_out_entries() - Age out entries older than aging time |
Abhishek Singh | 6e7489e | 2017-03-23 10:54:22 +0530 | [diff] [blame] | 90 | * @psoc: psoc pointer |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 91 | * @scan_db: scan database |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 92 | * |
Abhishek Singh | 4caf1a9 | 2017-02-21 15:01:08 +0530 | [diff] [blame] | 93 | * Return: void. |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 94 | */ |
Abhishek Singh | 6e7489e | 2017-03-23 10:54:22 +0530 | [diff] [blame] | 95 | void scm_age_out_entries(struct wlan_objmgr_psoc *psoc, |
| 96 | struct scan_dbs *scan_db); |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * scm_get_scan_result() - fetches scan result |
| 100 | * @pdev: pdev info |
| 101 | * @filter: Filters |
| 102 | * |
| 103 | * This function fetches scan result |
| 104 | * |
| 105 | * Return: scan list |
| 106 | */ |
| 107 | qdf_list_t *scm_get_scan_result(struct wlan_objmgr_pdev *pdev, |
| 108 | struct scan_filter *filter); |
| 109 | |
| 110 | /** |
| 111 | * scm_purge_scan_results() - purge the scan list |
| 112 | * @scan_result: scan list to be purged |
| 113 | * |
| 114 | * This function purge the temp scan list |
| 115 | * |
| 116 | * Return: QDF_STATUS |
| 117 | */ |
| 118 | QDF_STATUS scm_purge_scan_results(qdf_list_t *scan_result); |
| 119 | |
| 120 | /** |
| 121 | * scm_update_scan_mlme_info() - updates scan entry with mlme data |
Om Prakash Tripathi | c3fcb68 | 2017-08-01 18:24:55 +0530 | [diff] [blame] | 122 | * @pdev: pdev object |
| 123 | * @scan_entry: source scan entry to read mlme info |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 124 | * |
Om Prakash Tripathi | c3fcb68 | 2017-08-01 18:24:55 +0530 | [diff] [blame] | 125 | * This function updates scan db with scan_entry->mlme_info |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 126 | * |
| 127 | * Return: QDF_STATUS |
| 128 | */ |
Om Prakash Tripathi | c3fcb68 | 2017-08-01 18:24:55 +0530 | [diff] [blame] | 129 | QDF_STATUS scm_update_scan_mlme_info(struct wlan_objmgr_pdev *pdev, |
| 130 | struct scan_cache_entry *scan_entry); |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 131 | |
| 132 | /** |
| 133 | * scm_flush_results() - flush scan entries matching the filter |
| 134 | * @pdev: vdev object |
| 135 | * @filter: filter to flush the scan entries |
| 136 | * |
| 137 | * Flush scan entries matching the filter. |
| 138 | * |
| 139 | * Return: QDF status. |
| 140 | */ |
| 141 | QDF_STATUS scm_flush_results(struct wlan_objmgr_pdev *pdev, |
| 142 | struct scan_filter *filter); |
| 143 | |
| 144 | /** |
| 145 | * scm_filter_valid_channel() - The Public API to filter scan result |
| 146 | * based on valid channel list |
| 147 | * @pdev: pdev object |
hqu | e131d31 | 2019-11-21 17:55:27 +0800 | [diff] [blame^] | 148 | * @chan_freq_list: valid channel frequency (in MHz) list |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 149 | * @num_chan: number of valid channels |
| 150 | * |
| 151 | * The Public API to to filter scan result |
| 152 | * based on valid channel list. |
| 153 | * |
| 154 | * Return: void. |
| 155 | */ |
| 156 | void scm_filter_valid_channel(struct wlan_objmgr_pdev *pdev, |
hqu | e131d31 | 2019-11-21 17:55:27 +0800 | [diff] [blame^] | 157 | uint32_t *chan_freq_list, uint32_t num_chan); |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 158 | |
| 159 | /** |
| 160 | * scm_iterate_scan_db() - function to iterate scan table |
| 161 | * @pdev: pdev object |
| 162 | * @func: iterator function pointer |
| 163 | * @arg: argument to be passed to func() |
| 164 | * |
| 165 | * API, this API iterates scan table and invokes func |
| 166 | * on each scan enetry by passing scan entry and arg. |
| 167 | * |
| 168 | * Return: QDF_STATUS |
| 169 | */ |
| 170 | QDF_STATUS |
| 171 | scm_iterate_scan_db(struct wlan_objmgr_pdev *pdev, |
| 172 | scan_iterator_func func, void *arg); |
| 173 | |
| 174 | /** |
| 175 | * scm_scan_register_bcn_cb() - API to register api to indicate bcn/probe |
| 176 | * as soon as they are received |
| 177 | * @pdev: psoc |
| 178 | * @cb: callback to be registered |
| 179 | * @type: Type of callback to be registered |
| 180 | * |
| 181 | * Return: enum scm_scan_status |
| 182 | */ |
| 183 | QDF_STATUS scm_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc, |
| 184 | update_beacon_cb cb, enum scan_cb_type type); |
| 185 | |
| 186 | /** |
| 187 | * scm_db_init() - API to init scan db |
| 188 | * @psoc: psoc |
| 189 | * |
| 190 | * Return: QDF_STATUS |
| 191 | */ |
| 192 | QDF_STATUS scm_db_init(struct wlan_objmgr_psoc *psoc); |
| 193 | |
| 194 | /** |
| 195 | * scm_db_deinit() - API to deinit scan db |
| 196 | * @psoc: psoc |
| 197 | * |
| 198 | * Return: QDF_STATUS |
| 199 | */ |
| 200 | QDF_STATUS scm_db_deinit(struct wlan_objmgr_psoc *psoc); |
Abhishek Singh | 7b59903 | 2017-11-10 14:42:31 +0530 | [diff] [blame] | 201 | |
| 202 | /** |
Sandeep Puligilla | d763fee | 2019-11-08 14:00:10 -0800 | [diff] [blame] | 203 | * scm_channel_list_db_init() - API to init scan list priority list db |
| 204 | * @psoc: psoc |
| 205 | * |
| 206 | * Return: QDF_STATUS |
| 207 | */ |
| 208 | QDF_STATUS scm_channel_list_db_init(struct wlan_objmgr_psoc *psoc); |
| 209 | |
| 210 | /** |
| 211 | * scm_channel_list_db_deinit() - API to deinit scan list priority list db |
| 212 | * @psoc: psoc |
| 213 | * |
| 214 | * Return: QDF_STATUS |
| 215 | */ |
| 216 | QDF_STATUS scm_channel_list_db_deinit(struct wlan_objmgr_psoc *psoc); |
| 217 | |
| 218 | /** |
| 219 | * scm_get_chan_meta() - API to return channel meta |
| 220 | * @freq: channel frequency |
| 221 | * |
| 222 | * Return: channel meta information |
| 223 | */ |
| 224 | struct meta_rnr_channel *scm_get_chan_meta(uint32_t freq); |
| 225 | |
| 226 | /** |
Abhishek Singh | 7b59903 | 2017-11-10 14:42:31 +0530 | [diff] [blame] | 227 | * scm_validate_scoring_config() - validate score config |
| 228 | * @score_cfg: config to be validated |
| 229 | * |
| 230 | * Return: void |
| 231 | */ |
| 232 | void scm_validate_scoring_config( |
| 233 | struct scoring_config *score_cfg); |
Sandeep Puligilla | e062e82 | 2018-02-28 00:27:10 -0800 | [diff] [blame] | 234 | |
| 235 | /** |
| 236 | * scm_scan_update_mlme_by_bssinfo() - updates scan entry with mlme data |
| 237 | * @pdev: pdev object |
| 238 | * @bss_info: BSS information |
| 239 | * |
| 240 | * This function updates scan db with scan_entry->mlme_info |
| 241 | * |
| 242 | * Return: QDF_STATUS |
| 243 | */ |
| 244 | QDF_STATUS scm_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev, |
| 245 | struct bss_info *bss_info, struct mlme_info *mlme); |
Om Prakash Tripathi | 7e3f45d | 2016-12-28 16:58:54 +0530 | [diff] [blame] | 246 | #endif |