wlan_scan_api.h 13 KB

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