wlan_p2p_ucfg_api.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  1. /*
  2. * Copyright (c) 2017-2018 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 p2p north bound interface definitions
  20. */
  21. #ifndef _WLAN_P2P_UCFG_API_H_
  22. #define _WLAN_P2P_UCFG_API_H_
  23. #include <qdf_types.h>
  24. struct wlan_objmgr_psoc;
  25. struct p2p_roc_req;
  26. struct p2p_event;
  27. struct p2p_rx_mgmt_frame;
  28. struct p2p_tx_cnf;
  29. struct p2p_mgmt_tx;
  30. struct p2p_ps_config;
  31. struct p2p_lo_start;
  32. struct p2p_lo_event;
  33. struct p2p_protocol_callbacks;
  34. /**
  35. * p2p_rx_callback() - Callback for rx mgmt frame
  36. * @user_data: user data associated to this rx mgmt frame.
  37. * @rx_frame: RX mgmt frame
  38. *
  39. * This callback will be used to give rx frames to hdd.
  40. *
  41. * Return: None
  42. */
  43. typedef void (*p2p_rx_callback)(void *user_data,
  44. struct p2p_rx_mgmt_frame *rx_frame);
  45. /**
  46. * p2p_action_tx_cnf_callback() - Callback for tx confirmation
  47. * @user_data: user data associated to this tx confirmation
  48. * @tx_cnf: tx confirmation information
  49. *
  50. * This callback will be used to give tx mgmt frame confirmation to
  51. * hdd.
  52. *
  53. * Return: None
  54. */
  55. typedef void (*p2p_action_tx_cnf_callback)(void *user_data,
  56. struct p2p_tx_cnf *tx_cnf);
  57. /**
  58. * p2p_lo_event_callback() - Callback for listen offload event
  59. * @user_data: user data associated to this lo event
  60. * @p2p_lo_event: listen offload event information
  61. *
  62. * This callback will be used to give listen offload event to hdd.
  63. *
  64. * Return: None
  65. */
  66. typedef void (*p2p_lo_event_callback)(void *user_data,
  67. struct p2p_lo_event *p2p_lo_event);
  68. /**
  69. * p2p_event_callback() - Callback for P2P event
  70. * @user_data: user data associated to this p2p event
  71. * @p2p_event: p2p event information
  72. *
  73. * This callback will be used to give p2p event to hdd.
  74. *
  75. * Return: None
  76. */
  77. typedef void (*p2p_event_callback)(void *user_data,
  78. struct p2p_event *p2p_event);
  79. /**
  80. * struct p2p_start_param - p2p soc start parameters. Below callbacks
  81. * will be registered by the HDD
  82. * @rx_callback: Function pointer to hdd rx callback. This
  83. * function will be used to give rx frames to hdd
  84. * @rx_cb_data: RX callback user data
  85. * @event_cb: Founction pointer to hdd p2p event callback.
  86. * This function will be used to give p2p event
  87. * to hdd
  88. * @event_cb_data: Pointer to p2p event callback user data
  89. * @tx_cnf_cb: Function pointer to hdd tx confirm callback.
  90. * This function will be used to give tx confirm
  91. * to hdd
  92. * @tx_cnf_cb_data: Pointer to p2p tx confirm callback user data
  93. * @lo_event_cb: Founction pointer to p2p listen offload
  94. * callback. This function will be used to give
  95. * listen offload stopped event to hdd
  96. * @lo_event_cb_data: Pointer to p2p listen offload callback user data
  97. */
  98. struct p2p_start_param {
  99. p2p_rx_callback rx_cb;
  100. void *rx_cb_data;
  101. p2p_event_callback event_cb;
  102. void *event_cb_data;
  103. p2p_action_tx_cnf_callback tx_cnf_cb;
  104. void *tx_cnf_cb_data;
  105. #ifdef FEATURE_P2P_LISTEN_OFFLOAD
  106. p2p_lo_event_callback lo_event_cb;
  107. void *lo_event_cb_data;
  108. #endif
  109. };
  110. /**
  111. * ucfg_p2p_init() - P2P component initialization
  112. *
  113. * This function gets called when dispatcher initializing.
  114. *
  115. * Return: QDF_STATUS_SUCCESS - in case of success
  116. */
  117. QDF_STATUS ucfg_p2p_init(void);
  118. /**
  119. * ucfg_p2p_deinit() - P2P component de-init
  120. *
  121. * This function gets called when dispatcher de-init.
  122. *
  123. * Return: QDF_STATUS_SUCCESS - in case of success
  124. */
  125. QDF_STATUS ucfg_p2p_deinit(void);
  126. /**
  127. * ucfg_p2p_psoc_open() - Open P2P component
  128. * @soc: soc context
  129. *
  130. * This function gets called when dispatcher opening.
  131. *
  132. * Return: QDF_STATUS_SUCCESS - in case of success
  133. */
  134. QDF_STATUS ucfg_p2p_psoc_open(struct wlan_objmgr_psoc *soc);
  135. /**
  136. * ucfg_p2p_psoc_close() - Close P2P component
  137. * @soc: soc context
  138. *
  139. * This function gets called when dispatcher closing.
  140. *
  141. * Return: QDF_STATUS_SUCCESS - in case of success
  142. */
  143. QDF_STATUS ucfg_p2p_psoc_close(struct wlan_objmgr_psoc *soc);
  144. /**
  145. * ucfg_p2p_psoc_start() - Start P2P component
  146. * @soc: soc context
  147. * @req: P2P start parameters
  148. *
  149. * This function gets called when up layer starting up.
  150. *
  151. * Return: QDF_STATUS_SUCCESS - in case of success
  152. */
  153. QDF_STATUS ucfg_p2p_psoc_start(struct wlan_objmgr_psoc *soc,
  154. struct p2p_start_param *req);
  155. /**
  156. * ucfg_p2p_psoc_stop() - Stop P2P component
  157. * @soc: soc context
  158. *
  159. * This function gets called when up layer exit.
  160. *
  161. * Return: QDF_STATUS_SUCCESS - in case of success
  162. */
  163. QDF_STATUS ucfg_p2p_psoc_stop(struct wlan_objmgr_psoc *soc);
  164. /**
  165. * ucfg_p2p_roc_req() - Roc request
  166. * @soc: soc context
  167. * @roc_req: Roc request parameters
  168. * @cookie: return cookie to caller
  169. *
  170. * This function delivers roc request to P2P component.
  171. *
  172. * Return: QDF_STATUS_SUCCESS - in case of success
  173. */
  174. QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
  175. struct p2p_roc_req *roc_req, uint64_t *cookie);
  176. /**
  177. * ucfg_p2p_roc_cancel_req() - Cancel roc request
  178. * @soc: soc context
  179. * @cookie: Find out the roc request by cookie
  180. *
  181. * This function delivers cancel roc request to P2P component.
  182. *
  183. * Return: QDF_STATUS_SUCCESS - in case of success
  184. */
  185. QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
  186. uint64_t cookie);
  187. /**
  188. * ucfg_p2p_cleanup_roc_by_vdev() - Cleanup roc request by vdev
  189. * @vdev: pointer to vdev object
  190. *
  191. * This function call P2P API to cleanup roc request by vdev
  192. *
  193. * Return: QDF_STATUS_SUCCESS - in case of success
  194. */
  195. QDF_STATUS ucfg_p2p_cleanup_roc_by_vdev(struct wlan_objmgr_vdev *vdev);
  196. /**
  197. * ucfg_p2p_cleanup_roc_by_poc() - Cleanup roc request by psoc
  198. * @psoc: pointer to psoc object
  199. *
  200. * This function call P2P API to cleanup roc request by psoc
  201. *
  202. * Return: QDF_STATUS_SUCCESS - in case of success
  203. */
  204. QDF_STATUS ucfg_p2p_cleanup_roc_by_psoc(struct wlan_objmgr_psoc *psoc);
  205. /**
  206. * ucfg_p2p_cleanup_tx_by_vdev() - Cleanup tx request by vdev
  207. * @vdev: pointer to vdev object
  208. *
  209. * This function call P2P API to cleanup tx action frame request by vdev
  210. *
  211. * Return: QDF_STATUS_SUCCESS - in case of success
  212. */
  213. QDF_STATUS ucfg_p2p_cleanup_tx_by_vdev(struct wlan_objmgr_vdev *vdev);
  214. /**
  215. * ucfg_p2p_cleanup_tx_by_poc() - Cleanup tx request by psoc
  216. * @psoc: pointer to psoc object
  217. *
  218. * This function call P2P API to cleanup tx action frame request by psoc
  219. *
  220. * Return: QDF_STATUS_SUCCESS - in case of success
  221. */
  222. QDF_STATUS ucfg_p2p_cleanup_tx_by_psoc(struct wlan_objmgr_psoc *psoc);
  223. /**
  224. * ucfg_p2p_mgmt_tx() - Mgmt frame tx request
  225. * @soc: soc context
  226. * @mgmt_frm: TX mgmt frame parameters
  227. * @cookie: Return the cookie to caller
  228. *
  229. * This function delivers mgmt frame tx request to P2P component.
  230. *
  231. * Return: QDF_STATUS_SUCCESS - in case of success
  232. */
  233. QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
  234. struct p2p_mgmt_tx *mgmt_frm, uint64_t *cookie);
  235. /**
  236. * ucfg_p2p_mgmt_tx_cancel() - Cancel mgmt frame tx request
  237. * @soc: soc context
  238. * @vdev: vdev object
  239. * @cookie: Find out the mgmt tx request by cookie
  240. *
  241. * This function delivers cancel mgmt frame tx request request to P2P
  242. * component.
  243. *
  244. * Return: QDF_STATUS_SUCCESS - in case of success
  245. */
  246. QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
  247. struct wlan_objmgr_vdev *vdev, uint64_t cookie);
  248. /**
  249. * ucfg_p2p_set_ps() - P2P set power save
  250. * @soc: soc context
  251. * @ps_config: power save configure
  252. *
  253. * This function delivers p2p power save request to P2P component.
  254. *
  255. * Return: QDF_STATUS_SUCCESS - in case of success
  256. */
  257. QDF_STATUS ucfg_p2p_set_ps(struct wlan_objmgr_psoc *soc,
  258. struct p2p_ps_config *ps_config);
  259. #ifdef FEATURE_P2P_LISTEN_OFFLOAD
  260. /**
  261. * ucfg_p2p_lo_start() - Listen offload start request
  262. * @soc: soc context
  263. * @p2p_lo_start: lo start parameters
  264. *
  265. * This function delivers listen offload start request to P2P
  266. * component.
  267. *
  268. * Return: QDF_STATUS_SUCCESS - in case of success
  269. */
  270. QDF_STATUS ucfg_p2p_lo_start(struct wlan_objmgr_psoc *soc,
  271. struct p2p_lo_start *p2p_lo_start);
  272. /**
  273. * ucfg_p2p_lo_stop() - Listen offload stop request
  274. * @soc: soc context
  275. * @vdev_id: vdev id
  276. *
  277. * This function delivers listen offload stop request to P2P component.
  278. *
  279. * Return: QDF_STATUS_SUCCESS - in case of success
  280. */
  281. QDF_STATUS ucfg_p2p_lo_stop(struct wlan_objmgr_psoc *soc,
  282. uint32_t vdev_id);
  283. #endif
  284. /**
  285. * p2p_peer_authorized() - Process peer authorized event
  286. * @vdev: vdev structure to which peer is associated
  287. * @mac_addr: peer mac address
  288. *
  289. * This function handles disables noa whenever a legacy station
  290. * complete 4-way handshake after association.
  291. *
  292. * Return: void
  293. */
  294. void p2p_peer_authorized(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr);
  295. /**
  296. * ucfg_p2p_set_noa() - Disable/Enable NOA
  297. * @soc: soc context
  298. * @vdev_id: vdev id
  299. * @disable_noa: TRUE - Disable NoA, FALSE - Enable NoA
  300. *
  301. * This function send wmi command to enable / disable NoA.
  302. *
  303. * Return: QDF_STATUS_SUCCESS - in case of success
  304. */
  305. QDF_STATUS ucfg_p2p_set_noa(struct wlan_objmgr_psoc *soc,
  306. uint32_t vdev_id, bool disable_noa);
  307. /**
  308. * ucfg_p2p_check_random_mac() - check random mac addr or not
  309. * @soc: soc context
  310. * @vdev_id: vdev id
  311. * @random_mac_addr: mac addr to be checked
  312. *
  313. * This function check the input addr is random mac addr or not for vdev.
  314. *
  315. * Return: true if addr is random mac address else false.
  316. */
  317. bool ucfg_p2p_check_random_mac(struct wlan_objmgr_psoc *soc, uint32_t vdev_id,
  318. uint8_t *random_mac_addr);
  319. /**
  320. * ucfg_p2p_register_callbacks() - register p2p callbacks
  321. * @soc: soc context
  322. * @cb_obj: p2p_protocol_callbacks struct
  323. *
  324. * This function registers lim callbacks to p2p components to provide
  325. * protocol information.
  326. *
  327. * Return: QDF_STATUS_SUCCESS - in case of success
  328. */
  329. QDF_STATUS ucfg_p2p_register_callbacks(struct wlan_objmgr_psoc *soc,
  330. struct p2p_protocol_callbacks *cb_obj);
  331. /**
  332. * ucfg_p2p_status_scan() - Show P2P connection status when scanning
  333. * @vdev: vdev context
  334. *
  335. * This function shows P2P connection status when scanning.
  336. *
  337. * Return: QDF_STATUS_SUCCESS - in case of success
  338. */
  339. QDF_STATUS ucfg_p2p_status_scan(struct wlan_objmgr_vdev *vdev);
  340. /**
  341. * ucfg_p2p_status_connect() - Update P2P connection status
  342. * @vdev: vdev context
  343. *
  344. * Updates P2P connection status by up layer when connecting.
  345. *
  346. * Return: QDF_STATUS_SUCCESS - in case of success
  347. */
  348. QDF_STATUS ucfg_p2p_status_connect(struct wlan_objmgr_vdev *vdev);
  349. /**
  350. * ucfg_p2p_status_disconnect() - Update P2P connection status
  351. * @vdev: vdev context
  352. *
  353. * Updates P2P connection status by up layer when disconnecting.
  354. *
  355. * Return: QDF_STATUS_SUCCESS - in case of success
  356. */
  357. QDF_STATUS ucfg_p2p_status_disconnect(struct wlan_objmgr_vdev *vdev);
  358. /**
  359. * ucfg_p2p_status_start_bss() - Update P2P connection status
  360. * @vdev: vdev context
  361. *
  362. * Updates P2P connection status by up layer when starting bss.
  363. *
  364. * Return: QDF_STATUS_SUCCESS - in case of success
  365. */
  366. QDF_STATUS ucfg_p2p_status_start_bss(struct wlan_objmgr_vdev *vdev);
  367. /**
  368. * ucfg_p2p_status_stop_bss() - Update P2P connection status
  369. * @vdev: vdev context
  370. *
  371. * Updates P2P connection status by up layer when stopping bss.
  372. *
  373. * Return: QDF_STATUS_SUCCESS - in case of success
  374. */
  375. QDF_STATUS ucfg_p2p_status_stop_bss(struct wlan_objmgr_vdev *vdev);
  376. #endif /* _WLAN_P2P_UCFG_API_H_ */