wlan_scan_api.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. /*
  2. * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
  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. * DOC: contains scan api
  20. */
  21. #ifndef _WLAN_SCAN_API_H_
  22. #define _WLAN_SCAN_API_H_
  23. #include <wlan_objmgr_psoc_obj.h>
  24. #include <wlan_objmgr_pdev_obj.h>
  25. #include <wlan_objmgr_vdev_obj.h>
  26. #include "../../core/src/wlan_scan_main.h"
  27. /**
  28. * wlan_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime
  29. * @psoc: pointer to psoc object
  30. * @dwell_time: scan active dwell time
  31. *
  32. * Return: none
  33. */
  34. void wlan_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
  35. uint32_t dwell_time);
  36. /**
  37. * wlan_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime
  38. * @psoc: pointer to psoc object
  39. * @dwell_time: scan active dwelltime
  40. *
  41. * Return: scan active dwell time
  42. */
  43. void wlan_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
  44. uint32_t *dwell_time);
  45. #ifdef CONFIG_BAND_6GHZ
  46. /**
  47. * wlan_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime
  48. * @psoc: pointer to psoc object
  49. * @dwell_time: scan active dwell time
  50. *
  51. * Return: QDF_STATUS
  52. */
  53. QDF_STATUS wlan_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  54. uint32_t dwell_time);
  55. /**
  56. * wlan_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime
  57. * @psoc: pointer to psoc object
  58. * @dwell_time: scan active dwelltime
  59. *
  60. * Return: QDF_STATUS
  61. */
  62. QDF_STATUS wlan_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  63. uint32_t *dwell_time);
  64. /**
  65. * wlan_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g
  66. * dwelltime
  67. * @psoc: pointer to psoc object
  68. * @dwell_time: scan passive dwell time
  69. *
  70. * Return: QDF_STATUS
  71. */
  72. QDF_STATUS wlan_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  73. uint32_t dwell_time);
  74. /**
  75. * wlan_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime
  76. * @psoc: pointer to psoc object
  77. * @dwell_time: scan passive dwelltime
  78. *
  79. * Return: QDF_STATUS
  80. */
  81. QDF_STATUS wlan_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  82. uint32_t *dwell_time);
  83. #endif
  84. /**
  85. * wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
  86. * @psoc: pointer to psoc object
  87. * @dwell_time: scan active dwell time
  88. *
  89. * Return: none
  90. */
  91. void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  92. uint32_t dwell_time);
  93. /**
  94. * wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
  95. * @psoc: pointer to psoc object
  96. * @dwell_time: scan active dwelltime
  97. *
  98. * Return: scan active dwell time
  99. */
  100. void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  101. uint32_t *dwell_time);
  102. /**
  103. * wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
  104. * @psoc: pointer to psoc object
  105. * @dwell_time: scan passive dwell time
  106. *
  107. * Return: none
  108. */
  109. void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  110. uint32_t dwell_time);
  111. /**
  112. * wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
  113. * @psoc: pointer to psoc object
  114. * @dwell_time: scan passive dwelltime
  115. *
  116. * Return: scan passive dwell time
  117. */
  118. void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  119. uint32_t *dwell_time);
  120. #ifdef WLAN_POLICY_MGR_ENABLE
  121. /*
  122. * wlan_scan_update_pno_dwell_time() - update active and passive dwell time
  123. * depending on active concurrency modes
  124. * @vdev: vdev object pointer
  125. * @req: scan request
  126. *
  127. * Return: void
  128. */
  129. void wlan_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev,
  130. struct pno_scan_req_params *req,
  131. struct scan_default_params *scan_def);
  132. #endif
  133. /**
  134. * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
  135. * @psoc: pointer to psoc object
  136. * @dwell_time: scan active dwelltime
  137. *
  138. * Return: scan concurrent active dwell time
  139. */
  140. void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  141. uint32_t *dwell_time);
  142. /**
  143. * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
  144. * @psoc: pointer to psoc object
  145. * @dwell_time: scan active dwelltime
  146. *
  147. * Return: scan concurrent active dwell time
  148. */
  149. void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  150. uint32_t dwell_time);
  151. /**
  152. * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
  153. * @psoc: pointer to psoc object
  154. * @dwell_time: scan passive dwelltime
  155. *
  156. * Return: scan concurrent passive dwell time
  157. */
  158. void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  159. uint32_t *dwell_time);
  160. /**
  161. * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
  162. * @psoc: pointer to psoc object
  163. * @dwell_time: scan passive dwelltime
  164. *
  165. * Return: scan concurrent passive dwell time
  166. */
  167. void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  168. uint32_t dwell_time);
  169. /**
  170. * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
  171. * flags honoured
  172. * @psoc: pointer to psoc object
  173. *
  174. * Return: nl scan policy flags honoured or not
  175. */
  176. bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
  177. /**
  178. * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
  179. * @psoc: pointer to psoc object
  180. * @rest_time: scan concurrent max resttime
  181. *
  182. * Return: scan concurrent max rest time
  183. */
  184. void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
  185. uint32_t *rest_time);
  186. /**
  187. * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
  188. * @psoc: pointer to psoc object
  189. * @enable_dfs_scan: DFS scan enabled or not.
  190. *
  191. * Return: None
  192. */
  193. void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  194. bool *enable_dfs_scan);
  195. /**
  196. * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
  197. * @psoc: pointer to psoc object
  198. * @enable_dfs_scan: Set dfs scan enabled or not.
  199. *
  200. * Return: None
  201. */
  202. void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  203. bool enable_dfs_scan);
  204. /**
  205. * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
  206. * @psoc: pointer to psoc object
  207. * @rest_time: scan concurrent min rest time
  208. *
  209. * Return: scan concurrent min rest time
  210. */
  211. void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
  212. uint32_t *rest_time);
  213. /**
  214. * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
  215. * @psoc: pointer to psoc object
  216. *
  217. * Return: enable/disable snr monitor mode.
  218. */
  219. bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
  220. /**
  221. * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
  222. * scheduler thread
  223. * @psoc: psoc context
  224. * @buf: frame buf
  225. * @params: rx event params
  226. * @frm_type: frame type
  227. *
  228. * handle bcn without posting to scheduler thread, this should be called
  229. * while caller is already in scheduler thread context
  230. *
  231. * Return: success or error code.
  232. */
  233. QDF_STATUS
  234. wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
  235. qdf_nbuf_t buf,
  236. struct mgmt_rx_event_params *rx_param,
  237. enum mgmt_frame_type frm_type);
  238. /**
  239. * wlan_scan_get_aging_time - Get the scan aging time config
  240. * @psoc: psoc context
  241. *
  242. * Return: Scan aging time config
  243. */
  244. qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
  245. /**
  246. * wlan_scan_set_aging_time - Set the scan aging time config
  247. * @psoc: psoc context
  248. * @time: scan aging time
  249. *
  250. * Return: success or error code.
  251. */
  252. QDF_STATUS wlan_scan_set_aging_time(struct wlan_objmgr_psoc *psoc,
  253. qdf_time_t time);
  254. /**
  255. * wlan_scan_purge_results() - purge the scan list
  256. * @scan_list: scan list to be purged
  257. *
  258. * This function purge the temp scan list
  259. *
  260. * Return: QDF_STATUS
  261. */
  262. static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
  263. {
  264. return scm_purge_scan_results(scan_list);
  265. }
  266. /**
  267. * wlan_scan_get_result() - The Public API to get scan results
  268. * @pdev: pdev info
  269. * @filter: Filters
  270. *
  271. * This function fetches scan result
  272. *
  273. * Return: scan list pointer
  274. */
  275. static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
  276. struct scan_filter *filter)
  277. {
  278. return scm_get_scan_result(pdev, filter);
  279. }
  280. /**
  281. * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
  282. * info in the scan entry
  283. * @pdev: pdev object
  284. * @bss_info: bssid info to find the matching scan entry
  285. * @mlme_info: mlme info to be updated.
  286. *
  287. * Return: QDF_STATUS
  288. */
  289. static inline QDF_STATUS
  290. wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
  291. struct bss_info *bss_info,
  292. struct mlme_info *mlme_info)
  293. {
  294. return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
  295. }
  296. /**
  297. * wlan_scan_start() - Public API to start a scan
  298. * @req: start scan req params
  299. *
  300. * The Public API to start a scan. Post a msg to target_if queue
  301. *
  302. * Return: QDF_STATUS.
  303. */
  304. QDF_STATUS wlan_scan_start(struct scan_start_request *req);
  305. /**
  306. * wlan_scan_cancel() - Public API to stop a scan
  307. * @req: stop scan request params
  308. *
  309. * The Public API to stop a scan. Post a msg to target_if queue
  310. *
  311. * Return: QDF_STATUS.
  312. */
  313. QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
  314. /**
  315. * wlan_scan_get_scan_id() - Public API to allocate scan ID
  316. * @psoc: psoc object
  317. *
  318. * Public API, allocates a new scan id for caller
  319. *
  320. * Return: newly allocated scan ID
  321. */
  322. wlan_scan_id
  323. wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
  324. /**
  325. * wlan_scan_init_default_params() - Public API to initialize scan params
  326. * @vdev: vdev object
  327. * @req: scan request object
  328. *
  329. * Public API to initialize scan start request with defaults scan params
  330. *
  331. * Return: QDF_STATUS_SUCCESS or error code
  332. */
  333. QDF_STATUS
  334. wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
  335. struct scan_start_request *req);
  336. /**
  337. * wlan_scan_register_requester() - Public API, assigns requester ID
  338. * to caller and registers scan event call back handler
  339. * @psoc: psoc object
  340. * @module_name:name of requester module
  341. * @event_cb: event callback function pointer
  342. * @arg: argument to @event_cb
  343. *
  344. * API, allows other components to allocate requester id.
  345. * Normally used by modules at init time to register their callback
  346. * and get one requester id. @event_cb will be invoked for
  347. * all scan events whose requester id matches with @requester.
  348. *
  349. * Return: assigned non zero requester id for success
  350. * zero (0) for failure
  351. */
  352. wlan_scan_requester
  353. wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
  354. uint8_t *module_name,
  355. scan_event_handler event_cb,
  356. void *arg);
  357. /**
  358. * wlan_scan_unregister_requester() -Public API, reclaims previously
  359. * allocated requester ID
  360. * @psoc: psoc object
  361. * @requester: requester ID to reclaim.
  362. *
  363. * API, reclaims previously allocated requester id.
  364. *
  365. * Return: void
  366. */
  367. void
  368. wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
  369. wlan_scan_requester requester);
  370. #endif