wlan_p2p_ucfg_api.h 12 KB

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