wlan_scan_api.h 16 KB

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