wlan_scan_api.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. /*
  2. * Copyright (c) 2017-2020 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. /**
  121. * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
  122. * @psoc: pointer to psoc object
  123. * @dwell_time: scan active dwelltime
  124. *
  125. * Return: scan concurrent active dwell time
  126. */
  127. void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  128. uint32_t *dwell_time);
  129. /**
  130. * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
  131. * @psoc: pointer to psoc object
  132. * @dwell_time: scan active dwelltime
  133. *
  134. * Return: scan concurrent active dwell time
  135. */
  136. void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  137. uint32_t dwell_time);
  138. /**
  139. * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
  140. * @psoc: pointer to psoc object
  141. * @dwell_time: scan passive dwelltime
  142. *
  143. * Return: scan concurrent passive dwell time
  144. */
  145. void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  146. uint32_t *dwell_time);
  147. /**
  148. * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
  149. * @psoc: pointer to psoc object
  150. * @dwell_time: scan passive dwelltime
  151. *
  152. * Return: scan concurrent passive dwell time
  153. */
  154. void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  155. uint32_t dwell_time);
  156. /**
  157. * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
  158. * flags honoured
  159. * @psoc: pointer to psoc object
  160. *
  161. * Return: nl scan policy flags honoured or not
  162. */
  163. bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
  164. /**
  165. * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
  166. * @psoc: pointer to psoc object
  167. * @rest_time: scan concurrent max resttime
  168. *
  169. * Return: scan concurrent max rest time
  170. */
  171. void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
  172. uint32_t *rest_time);
  173. /**
  174. * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
  175. * @psoc: pointer to psoc object
  176. * @enable_dfs_scan: DFS scan enabled or not.
  177. *
  178. * Return: None
  179. */
  180. void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  181. bool *enable_dfs_scan);
  182. /**
  183. * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
  184. * @psoc: pointer to psoc object
  185. * @enable_dfs_scan: Set dfs scan enabled or not.
  186. *
  187. * Return: None
  188. */
  189. void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  190. bool enable_dfs_scan);
  191. /**
  192. * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
  193. * @psoc: pointer to psoc object
  194. * @rest_time: scan concurrent min rest time
  195. *
  196. * Return: scan concurrent min rest time
  197. */
  198. void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
  199. uint32_t *rest_time);
  200. /**
  201. * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
  202. * @psoc: pointer to psoc object
  203. *
  204. * Return: enable/disable snr monitor mode.
  205. */
  206. bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
  207. /**
  208. * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
  209. * scheduler thread
  210. * @psoc: psoc context
  211. * @buf: frame buf
  212. * @params: rx event params
  213. * @frm_type: frame type
  214. *
  215. * handle bcn without posting to scheduler thread, this should be called
  216. * while caller is already in scheduler thread context
  217. *
  218. * Return: success or error code.
  219. */
  220. QDF_STATUS
  221. wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
  222. qdf_nbuf_t buf,
  223. struct mgmt_rx_event_params *rx_param,
  224. enum mgmt_frame_type frm_type);
  225. /**
  226. * wlan_scan_get_aging_time - Get the scan aging time config
  227. * @psoc: psoc context
  228. *
  229. * Return: Scan aging time config
  230. */
  231. qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
  232. /**
  233. * wlan_scan_purge_results() - purge the scan list
  234. * @scan_list: scan list to be purged
  235. *
  236. * This function purge the temp scan list
  237. *
  238. * Return: QDF_STATUS
  239. */
  240. static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
  241. {
  242. return scm_purge_scan_results(scan_list);
  243. }
  244. /**
  245. * wlan_scan_get_result() - The Public API to get scan results
  246. * @pdev: pdev info
  247. * @filter: Filters
  248. *
  249. * This function fetches scan result
  250. *
  251. * Return: scan list pointer
  252. */
  253. static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
  254. struct scan_filter *filter)
  255. {
  256. return scm_get_scan_result(pdev, filter);
  257. }
  258. /**
  259. * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
  260. * info in the scan entry
  261. * @pdev: pdev object
  262. * @bss_info: bssid info to find the matching scan entry
  263. * @mlme_info: mlme info to be updated.
  264. *
  265. * Return: QDF_STATUS
  266. */
  267. static inline QDF_STATUS
  268. wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
  269. struct bss_info *bss_info,
  270. struct mlme_info *mlme_info)
  271. {
  272. return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
  273. }
  274. /**
  275. * wlan_scan_start() - Public API to start a scan
  276. * @req: start scan req params
  277. *
  278. * The Public API to start a scan. Post a msg to target_if queue
  279. *
  280. * Return: QDF_STATUS.
  281. */
  282. QDF_STATUS wlan_scan_start(struct scan_start_request *req);
  283. /**
  284. * wlan_scan_cancel() - Public API to stop a scan
  285. * @req: stop scan request params
  286. *
  287. * The Public API to stop a scan. Post a msg to target_if queue
  288. *
  289. * Return: QDF_STATUS.
  290. */
  291. QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
  292. /**
  293. * wlan_scan_get_scan_id() - Public API to allocate scan ID
  294. * @psoc: psoc object
  295. *
  296. * Public API, allocates a new scan id for caller
  297. *
  298. * Return: newly allocated scan ID
  299. */
  300. wlan_scan_id
  301. wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
  302. /**
  303. * wlan_scan_init_default_params() - Public API to initialize scan params
  304. * @vdev: vdev object
  305. * @req: scan request object
  306. *
  307. * Public API to initialize scan start request with defaults scan params
  308. *
  309. * Return: QDF_STATUS_SUCCESS or error code
  310. */
  311. QDF_STATUS
  312. wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
  313. struct scan_start_request *req);
  314. /**
  315. * wlan_scan_register_requester() - Public API, assigns requester ID
  316. * to caller and registers scan event call back handler
  317. * @psoc: psoc object
  318. * @module_name:name of requester module
  319. * @event_cb: event callback function pointer
  320. * @arg: argument to @event_cb
  321. *
  322. * API, allows other components to allocate requester id.
  323. * Normally used by modules at init time to register their callback
  324. * and get one requester id. @event_cb will be invoked for
  325. * all scan events whose requester id matches with @requester.
  326. *
  327. * Return: assigned non zero requester id for success
  328. * zero (0) for failure
  329. */
  330. wlan_scan_requester
  331. wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
  332. uint8_t *module_name,
  333. scan_event_handler event_cb,
  334. void *arg);
  335. /**
  336. * wlan_scan_unregister_requester() -Public API, reclaims previously
  337. * allocated requester ID
  338. * @psoc: psoc object
  339. * @requester: requester ID to reclaim.
  340. *
  341. * API, reclaims previously allocated requester id.
  342. *
  343. * Return: void
  344. */
  345. void
  346. wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
  347. wlan_scan_requester requester);
  348. #endif