wlan_scan_api.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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. /*
  160. * wlan_scan_update_low_latency_profile_chnlist() - Low latency SAP + scan
  161. * concurrencies
  162. * @vdev: vdev object pointer
  163. * @req: scan request
  164. *
  165. * Return: void
  166. */
  167. void wlan_scan_update_low_latency_profile_chnlist(
  168. struct wlan_objmgr_vdev *vdev,
  169. struct scan_start_request *req);
  170. #else
  171. static inline
  172. void wlan_scan_update_low_latency_profile_chnlist(
  173. struct wlan_objmgr_vdev *vdev,
  174. struct scan_start_request *req)
  175. {
  176. }
  177. #endif
  178. /**
  179. * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
  180. * @psoc: pointer to psoc object
  181. * @dwell_time: scan active dwelltime
  182. *
  183. * Return: scan concurrent active dwell time
  184. */
  185. void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  186. uint32_t *dwell_time);
  187. /**
  188. * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
  189. * @psoc: pointer to psoc object
  190. * @dwell_time: scan active dwelltime
  191. *
  192. * Return: scan concurrent active dwell time
  193. */
  194. void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  195. uint32_t dwell_time);
  196. /**
  197. * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
  198. * @psoc: pointer to psoc object
  199. * @dwell_time: scan passive dwelltime
  200. *
  201. * Return: scan concurrent passive dwell time
  202. */
  203. void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  204. uint32_t *dwell_time);
  205. /**
  206. * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
  207. * @psoc: pointer to psoc object
  208. * @dwell_time: scan passive dwelltime
  209. *
  210. * Return: scan concurrent passive dwell time
  211. */
  212. void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  213. uint32_t dwell_time);
  214. /**
  215. * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
  216. * flags honoured
  217. * @psoc: pointer to psoc object
  218. *
  219. * Return: nl scan policy flags honoured or not
  220. */
  221. bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
  222. /**
  223. * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
  224. * @psoc: pointer to psoc object
  225. * @rest_time: scan concurrent max resttime
  226. *
  227. * Return: scan concurrent max rest time
  228. */
  229. void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
  230. uint32_t *rest_time);
  231. /**
  232. * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
  233. * @psoc: pointer to psoc object
  234. * @enable_dfs_scan: DFS scan enabled or not.
  235. *
  236. * Return: None
  237. */
  238. void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  239. bool *enable_dfs_scan);
  240. /**
  241. * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
  242. * @psoc: pointer to psoc object
  243. * @enable_dfs_scan: Set dfs scan enabled or not.
  244. *
  245. * Return: None
  246. */
  247. void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  248. bool enable_dfs_scan);
  249. /**
  250. * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
  251. * @psoc: pointer to psoc object
  252. * @rest_time: scan concurrent min rest time
  253. *
  254. * Return: scan concurrent min rest time
  255. */
  256. void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
  257. uint32_t *rest_time);
  258. /**
  259. * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
  260. * @psoc: pointer to psoc object
  261. *
  262. * Return: enable/disable snr monitor mode.
  263. */
  264. bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
  265. /**
  266. * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
  267. * scheduler thread
  268. * @psoc: psoc context
  269. * @buf: frame buf
  270. * @rx_param: rx event params
  271. * @frm_type: frame type
  272. *
  273. * handle bcn without posting to scheduler thread, this should be called
  274. * while caller is already in scheduler thread context
  275. *
  276. * Return: success or error code.
  277. */
  278. QDF_STATUS
  279. wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
  280. qdf_nbuf_t buf,
  281. struct mgmt_rx_event_params *rx_param,
  282. enum mgmt_frame_type frm_type);
  283. /**
  284. * wlan_scan_get_aging_time - Get the scan aging time config
  285. * @psoc: psoc context
  286. *
  287. * Return: Scan aging time config
  288. */
  289. qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
  290. /**
  291. * wlan_scan_set_aging_time - Set the scan aging time config
  292. * @psoc: psoc context
  293. * @time: scan aging time
  294. *
  295. * Return: success or error code.
  296. */
  297. QDF_STATUS wlan_scan_set_aging_time(struct wlan_objmgr_psoc *psoc,
  298. qdf_time_t time);
  299. /**
  300. * wlan_scan_purge_results() - purge the scan list
  301. * @scan_list: scan list to be purged
  302. *
  303. * This function purge the temp scan list
  304. *
  305. * Return: QDF_STATUS
  306. */
  307. static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
  308. {
  309. return scm_purge_scan_results(scan_list);
  310. }
  311. /**
  312. * wlan_scan_get_result() - The Public API to get scan results
  313. * @pdev: pdev info
  314. * @filter: Filters
  315. *
  316. * This function fetches scan result
  317. *
  318. * Return: scan list pointer
  319. */
  320. static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
  321. struct scan_filter *filter)
  322. {
  323. return scm_get_scan_result(pdev, filter);
  324. }
  325. /**
  326. * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
  327. * info in the scan entry
  328. * @pdev: pdev object
  329. * @bss_info: bssid info to find the matching scan entry
  330. * @mlme_info: mlme info to be updated.
  331. *
  332. * Return: QDF_STATUS
  333. */
  334. static inline QDF_STATUS
  335. wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
  336. struct bss_info *bss_info,
  337. struct mlme_info *mlme_info)
  338. {
  339. return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
  340. }
  341. /**
  342. * wlan_scan_start() - Public API to start a scan
  343. * @req: start scan req params
  344. *
  345. * The Public API to start a scan. Post a msg to target_if queue
  346. *
  347. * Return: QDF_STATUS.
  348. */
  349. QDF_STATUS wlan_scan_start(struct scan_start_request *req);
  350. /**
  351. * wlan_scan_cancel() - Public API to stop a scan
  352. * @req: stop scan request params
  353. *
  354. * The Public API to stop a scan. Post a msg to target_if queue
  355. *
  356. * Return: QDF_STATUS.
  357. */
  358. QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
  359. /**
  360. * wlan_scan_get_scan_id() - Public API to allocate scan ID
  361. * @psoc: psoc object
  362. *
  363. * Public API, allocates a new scan id for caller
  364. *
  365. * Return: newly allocated scan ID
  366. */
  367. wlan_scan_id
  368. wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
  369. /**
  370. * wlan_scan_init_default_params() - Public API to initialize scan params
  371. * @vdev: vdev object
  372. * @req: scan request object
  373. *
  374. * Public API to initialize scan start request with defaults scan params
  375. *
  376. * Return: QDF_STATUS_SUCCESS or error code
  377. */
  378. QDF_STATUS
  379. wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
  380. struct scan_start_request *req);
  381. /**
  382. * wlan_scan_register_requester() - Public API, assigns requester ID
  383. * to caller and registers scan event call back handler
  384. * @psoc: psoc object
  385. * @module_name:name of requester module
  386. * @event_cb: event callback function pointer
  387. * @arg: argument to @event_cb
  388. *
  389. * API, allows other components to allocate requester id.
  390. * Normally used by modules at init time to register their callback
  391. * and get one requester id. @event_cb will be invoked for
  392. * all scan events whose requester id matches with @requester.
  393. *
  394. * Return: assigned non zero requester id for success
  395. * zero (0) for failure
  396. */
  397. wlan_scan_requester
  398. wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
  399. uint8_t *module_name,
  400. scan_event_handler event_cb,
  401. void *arg);
  402. /**
  403. * wlan_scan_unregister_requester() -Public API, reclaims previously
  404. * allocated requester ID
  405. * @psoc: psoc object
  406. * @requester: requester ID to reclaim.
  407. *
  408. * API, reclaims previously allocated requester id.
  409. *
  410. * Return: void
  411. */
  412. void
  413. wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
  414. wlan_scan_requester requester);
  415. /**
  416. * wlan_scan_cfg_skip_6g_and_indoor_freq() - API to get 6g and indoor freq
  417. * scan ini val
  418. * @psoc: psoc object
  419. *
  420. * Return: skip 6g and indoor freq scan or not
  421. */
  422. bool wlan_scan_cfg_skip_6g_and_indoor_freq(
  423. struct wlan_objmgr_psoc *psoc);
  424. /**
  425. * wlan_scan_get_entry_by_mac_addr() - Get bcn/probe rsp from scan db
  426. * @pdev: pdev info
  427. * @bssid: BSSID of the bcn/probe response to be fetched from scan db
  428. * @frame: Frame from scan db with given bssid.
  429. *
  430. * This is a wrapper to fetch the bcn/probe rsp frame with given mac address
  431. * through scm_scan_get_entry_by_mac_addr(). scm_scan_get_entry_by_mac_add()
  432. * allocates memory for the frame and it's caller responsibility to free
  433. * the memory once it's done with the usage i.e. frame->ptr.
  434. *
  435. * Return: QDF_STATUS_SUCCESS if scan entry is present in db
  436. */
  437. QDF_STATUS
  438. wlan_scan_get_entry_by_mac_addr(struct wlan_objmgr_pdev *pdev,
  439. struct qdf_mac_addr *bssid,
  440. struct element_info *frame);
  441. #endif