wlan_scan_api.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. /*
  2. * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022-2023 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_get_scan_entry_by_mac_freq() - API to get scan entry
  41. * info from scan db by mac addr
  42. * @pdev: pointer to pdev object
  43. * @bssid: pointer to mac addr
  44. * @freq: frequency for scan filter
  45. *
  46. * Return: scan entry if found, else NULL
  47. */
  48. struct scan_cache_entry *
  49. wlan_scan_get_scan_entry_by_mac_freq(struct wlan_objmgr_pdev *pdev,
  50. struct qdf_mac_addr *bssid,
  51. uint16_t freq);
  52. /**
  53. * wlan_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime
  54. * @psoc: pointer to psoc object
  55. * @dwell_time: scan active dwell time
  56. *
  57. * Return: none
  58. */
  59. void wlan_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
  60. uint32_t dwell_time);
  61. /**
  62. * wlan_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime
  63. * @psoc: pointer to psoc object
  64. * @dwell_time: scan active dwelltime
  65. *
  66. * Return: scan active dwell time
  67. */
  68. void wlan_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
  69. uint32_t *dwell_time);
  70. #ifdef CONFIG_BAND_6GHZ
  71. /**
  72. * wlan_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime
  73. * @psoc: pointer to psoc object
  74. * @dwell_time: scan active dwell time
  75. *
  76. * Return: QDF_STATUS
  77. */
  78. QDF_STATUS wlan_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  79. uint32_t dwell_time);
  80. /**
  81. * wlan_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime
  82. * @psoc: pointer to psoc object
  83. * @dwell_time: scan active dwelltime
  84. *
  85. * Return: QDF_STATUS
  86. */
  87. QDF_STATUS wlan_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  88. uint32_t *dwell_time);
  89. /**
  90. * wlan_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g
  91. * dwelltime
  92. * @psoc: pointer to psoc object
  93. * @dwell_time: scan passive dwell time
  94. *
  95. * Return: QDF_STATUS
  96. */
  97. QDF_STATUS wlan_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  98. uint32_t dwell_time);
  99. /**
  100. * wlan_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime
  101. * @psoc: pointer to psoc object
  102. * @dwell_time: scan passive dwelltime
  103. *
  104. * Return: QDF_STATUS
  105. */
  106. QDF_STATUS wlan_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
  107. uint32_t *dwell_time);
  108. /**
  109. * wlan_scan_cfg_get_min_dwelltime_6g() - API to get minimum 6g dwelltime
  110. * @psoc: pointer to psoc object
  111. * @min_dwell_time_6ghz: minimum dwelltime 6g
  112. *
  113. * Return: QDF_STATUS
  114. */
  115. void wlan_scan_cfg_get_min_dwelltime_6g(struct wlan_objmgr_psoc *psoc,
  116. uint32_t *min_dwell_time_6ghz);
  117. #else
  118. static inline
  119. void wlan_scan_cfg_get_min_dwelltime_6g(struct wlan_objmgr_psoc *psoc,
  120. uint32_t *min_dwell_time_6ghz)
  121. {
  122. }
  123. #endif
  124. /**
  125. * wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
  126. * @psoc: pointer to psoc object
  127. * @dwell_time: scan active dwell time
  128. *
  129. * Return: none
  130. */
  131. void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  132. uint32_t dwell_time);
  133. /**
  134. * wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
  135. * @psoc: pointer to psoc object
  136. * @dwell_time: scan active dwelltime
  137. *
  138. * Return: scan active dwell time
  139. */
  140. void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  141. uint32_t *dwell_time);
  142. /**
  143. * wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
  144. * @psoc: pointer to psoc object
  145. * @dwell_time: scan passive dwell time
  146. *
  147. * Return: none
  148. */
  149. void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  150. uint32_t dwell_time);
  151. /**
  152. * wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
  153. * @psoc: pointer to psoc object
  154. * @dwell_time: scan passive dwelltime
  155. *
  156. * Return: scan passive dwell time
  157. */
  158. void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  159. uint32_t *dwell_time);
  160. #ifdef WLAN_POLICY_MGR_ENABLE
  161. /*
  162. * wlan_scan_update_pno_dwell_time() - update active and passive dwell time
  163. * depending on active concurrency modes
  164. * @vdev: vdev object pointer
  165. * @req: scan request
  166. *
  167. * Return: void
  168. */
  169. void wlan_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev,
  170. struct pno_scan_req_params *req,
  171. struct scan_default_params *scan_def);
  172. /*
  173. * wlan_scan_update_low_latency_profile_chnlist() - Low latency SAP + scan
  174. * concurrencies
  175. * @vdev: vdev object pointer
  176. * @req: scan request
  177. *
  178. * Return: void
  179. */
  180. void wlan_scan_update_low_latency_profile_chnlist(
  181. struct wlan_objmgr_vdev *vdev,
  182. struct scan_start_request *req);
  183. #else
  184. static inline
  185. void wlan_scan_update_low_latency_profile_chnlist(
  186. struct wlan_objmgr_vdev *vdev,
  187. struct scan_start_request *req)
  188. {
  189. }
  190. #endif
  191. /**
  192. * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
  193. * @psoc: pointer to psoc object
  194. * @dwell_time: scan active dwelltime
  195. *
  196. * Return: scan concurrent active dwell time
  197. */
  198. void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  199. uint32_t *dwell_time);
  200. /**
  201. * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
  202. * @psoc: pointer to psoc object
  203. * @dwell_time: scan active dwelltime
  204. *
  205. * Return: scan concurrent active dwell time
  206. */
  207. void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
  208. uint32_t dwell_time);
  209. /**
  210. * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
  211. * @psoc: pointer to psoc object
  212. * @dwell_time: scan passive dwelltime
  213. *
  214. * Return: scan concurrent passive dwell time
  215. */
  216. void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  217. uint32_t *dwell_time);
  218. /**
  219. * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
  220. * @psoc: pointer to psoc object
  221. * @dwell_time: scan passive dwelltime
  222. *
  223. * Return: scan concurrent passive dwell time
  224. */
  225. void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
  226. uint32_t dwell_time);
  227. /**
  228. * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
  229. * flags honoured
  230. * @psoc: pointer to psoc object
  231. *
  232. * Return: nl scan policy flags honoured or not
  233. */
  234. bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
  235. /**
  236. * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
  237. * @psoc: pointer to psoc object
  238. * @rest_time: scan concurrent max resttime
  239. *
  240. * Return: scan concurrent max rest time
  241. */
  242. void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
  243. uint32_t *rest_time);
  244. /**
  245. * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
  246. * @psoc: pointer to psoc object
  247. * @enable_dfs_scan: DFS scan enabled or not.
  248. *
  249. * Return: None
  250. */
  251. void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  252. bool *enable_dfs_scan);
  253. /**
  254. * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
  255. * @psoc: pointer to psoc object
  256. * @enable_dfs_scan: Set dfs scan enabled or not.
  257. *
  258. * Return: None
  259. */
  260. void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
  261. bool enable_dfs_scan);
  262. /**
  263. * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
  264. * @psoc: pointer to psoc object
  265. * @rest_time: scan concurrent min rest time
  266. *
  267. * Return: scan concurrent min rest time
  268. */
  269. void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
  270. uint32_t *rest_time);
  271. /**
  272. * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
  273. * @psoc: pointer to psoc object
  274. *
  275. * Return: enable/disable snr monitor mode.
  276. */
  277. bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
  278. /**
  279. * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
  280. * scheduler thread
  281. * @psoc: psoc context
  282. * @buf: frame buf
  283. * @rx_param: rx event params
  284. * @frm_type: frame type
  285. *
  286. * handle bcn without posting to scheduler thread, this should be called
  287. * while caller is already in scheduler thread context
  288. *
  289. * Return: success or error code.
  290. */
  291. QDF_STATUS
  292. wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
  293. qdf_nbuf_t buf,
  294. struct mgmt_rx_event_params *rx_param,
  295. enum mgmt_frame_type frm_type);
  296. /**
  297. * wlan_scan_get_aging_time - Get the scan aging time config
  298. * @psoc: psoc context
  299. *
  300. * Return: Scan aging time config
  301. */
  302. qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
  303. /**
  304. * wlan_scan_set_aging_time - Set the scan aging time config
  305. * @psoc: psoc context
  306. * @time: scan aging time
  307. *
  308. * Return: success or error code.
  309. */
  310. QDF_STATUS wlan_scan_set_aging_time(struct wlan_objmgr_psoc *psoc,
  311. qdf_time_t time);
  312. /**
  313. * wlan_scan_purge_results() - purge the scan list
  314. * @scan_list: scan list to be purged
  315. *
  316. * This function purge the temp scan list
  317. *
  318. * Return: QDF_STATUS
  319. */
  320. static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
  321. {
  322. return scm_purge_scan_results(scan_list);
  323. }
  324. /**
  325. * wlan_scan_get_result() - The Public API to get scan results
  326. * @pdev: pdev info
  327. * @filter: Filters
  328. *
  329. * This function fetches scan result
  330. *
  331. * Return: scan list pointer
  332. */
  333. static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
  334. struct scan_filter *filter)
  335. {
  336. return scm_get_scan_result(pdev, filter);
  337. }
  338. /**
  339. * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
  340. * info in the scan entry
  341. * @pdev: pdev object
  342. * @bss_info: bssid info to find the matching scan entry
  343. * @mlme_info: mlme info to be updated.
  344. *
  345. * Return: QDF_STATUS
  346. */
  347. static inline QDF_STATUS
  348. wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
  349. struct bss_info *bss_info,
  350. struct mlme_info *mlme_info)
  351. {
  352. return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
  353. }
  354. /**
  355. * wlan_scan_start() - Public API to start a scan
  356. * @req: start scan req params
  357. *
  358. * The Public API to start a scan. Post a msg to target_if queue
  359. *
  360. * Return: QDF_STATUS.
  361. */
  362. QDF_STATUS wlan_scan_start(struct scan_start_request *req);
  363. /**
  364. * wlan_scan_cancel() - Public API to stop a scan
  365. * @req: stop scan request params
  366. *
  367. * The Public API to stop a scan. Post a msg to target_if queue
  368. *
  369. * Return: QDF_STATUS.
  370. */
  371. QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
  372. /**
  373. * wlan_scan_get_scan_id() - Public API to allocate scan ID
  374. * @psoc: psoc object
  375. *
  376. * Public API, allocates a new scan id for caller
  377. *
  378. * Return: newly allocated scan ID
  379. */
  380. wlan_scan_id
  381. wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
  382. /**
  383. * wlan_scan_init_default_params() - Public API to initialize scan params
  384. * @vdev: vdev object
  385. * @req: scan request object
  386. *
  387. * Public API to initialize scan start request with defaults scan params
  388. *
  389. * Return: QDF_STATUS_SUCCESS or error code
  390. */
  391. QDF_STATUS
  392. wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
  393. struct scan_start_request *req);
  394. /**
  395. * wlan_scan_register_requester() - Public API, assigns requester ID
  396. * to caller and registers scan event call back handler
  397. * @psoc: psoc object
  398. * @module_name:name of requester module
  399. * @event_cb: event callback function pointer
  400. * @arg: argument to @event_cb
  401. *
  402. * API, allows other components to allocate requester id.
  403. * Normally used by modules at init time to register their callback
  404. * and get one requester id. @event_cb will be invoked for
  405. * all scan events whose requester id matches with @requester.
  406. *
  407. * Return: assigned non zero requester id for success
  408. * zero (0) for failure
  409. */
  410. wlan_scan_requester
  411. wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
  412. uint8_t *module_name,
  413. scan_event_handler event_cb,
  414. void *arg);
  415. /**
  416. * wlan_scan_unregister_requester() -Public API, reclaims previously
  417. * allocated requester ID
  418. * @psoc: psoc object
  419. * @requester: requester ID to reclaim.
  420. *
  421. * API, reclaims previously allocated requester id.
  422. *
  423. * Return: void
  424. */
  425. void
  426. wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
  427. wlan_scan_requester requester);
  428. /**
  429. * wlan_scan_cfg_skip_6g_and_indoor_freq() - API to get 6g and indoor freq
  430. * scan ini val
  431. * @psoc: psoc object
  432. *
  433. * Return: skip 6g and indoor freq scan or not
  434. */
  435. bool wlan_scan_cfg_skip_6g_and_indoor_freq(
  436. struct wlan_objmgr_psoc *psoc);
  437. /**
  438. * wlan_scan_register_mbssid_cb() - register api to inform bcn/probe rsp
  439. * @psoc: psoc object
  440. * @cb: callback to be registered
  441. *
  442. * Return: QDF_STATUS
  443. */
  444. QDF_STATUS wlan_scan_register_mbssid_cb(struct wlan_objmgr_psoc *psoc,
  445. update_mbssid_bcn_prb_rsp cb);
  446. /**
  447. * wlan_scan_get_entry_by_mac_addr() - Get bcn/probe rsp from scan db
  448. * @pdev: pdev info
  449. * @bssid: BSSID of the bcn/probe response to be fetched from scan db
  450. * @frame: Frame from scan db with given bssid.
  451. *
  452. * This is a wrapper to fetch the bcn/probe rsp frame with given mac address
  453. * through scm_scan_get_entry_by_mac_addr(). scm_scan_get_entry_by_mac_add()
  454. * allocates memory for the frame and it's caller responsibility to free
  455. * the memory once it's done with the usage i.e. frame->ptr.
  456. *
  457. * Return: QDF_STATUS_SUCCESS if scan entry is present in db
  458. */
  459. QDF_STATUS
  460. wlan_scan_get_entry_by_mac_addr(struct wlan_objmgr_pdev *pdev,
  461. struct qdf_mac_addr *bssid,
  462. struct element_info *frame);
  463. /**
  464. * wlan_scan_get_last_scan_ageout_time() - API to get last scan
  465. * ageout time
  466. * @psoc: psoc object
  467. * @last_scan_ageout_time: last scan ageout time
  468. *
  469. * Return: void
  470. */
  471. void
  472. wlan_scan_get_last_scan_ageout_time(struct wlan_objmgr_psoc *psoc,
  473. uint32_t *last_scan_ageout_time);
  474. /**
  475. * wlan_scan_get_entry_by_bssid() - function to get scan entry by bssid
  476. * @pdev: pdev object
  477. * @bssid: bssid to be fetched from scan db
  478. *
  479. * Return : scan entry if found, else NULL
  480. */
  481. struct scan_cache_entry *
  482. wlan_scan_get_entry_by_bssid(struct wlan_objmgr_pdev *pdev,
  483. struct qdf_mac_addr *bssid);
  484. /**
  485. * wlan_scan_get_mld_addr_by_link_addr() - Function to get MLD address
  486. * in the scan entry from the link BSSID.
  487. * @pdev: pdev object
  488. * @link_addr: Link BSSID to match the scan filter
  489. * @mld_mac_addr: Pointer to fill the MLD address.
  490. *
  491. * A wrapper API which fills @mld_mac_addr with MLD address of scan entry
  492. * whose bssid field matches @link_addr.
  493. *
  494. * Return: QDF_STATUS
  495. */
  496. QDF_STATUS
  497. wlan_scan_get_mld_addr_by_link_addr(struct wlan_objmgr_pdev *pdev,
  498. struct qdf_mac_addr *link_addr,
  499. struct qdf_mac_addr *mld_mac_addr);
  500. /**
  501. * wlan_scan_get_aux_support() - get aux scan policy
  502. * @psoc: psoc object
  503. *
  504. * Set aux scan bits in scan_ctrl_ext_flag value depending on scan type.
  505. *
  506. * Return: true/false
  507. */
  508. bool wlan_scan_get_aux_support(struct wlan_objmgr_psoc *psoc);
  509. #endif