wlan_scan_api.h 12 KB

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