wlan_mlme_cmn.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. /*
  2. * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /**
  17. * DOC: Define Common MLME structure and APIs
  18. */
  19. #ifndef _WLAN_MLME_CMN_H_
  20. #define _WLAN_MLME_CMN_H_
  21. #include <include/wlan_psoc_mlme.h>
  22. #include <include/wlan_pdev_mlme.h>
  23. #include <include/wlan_vdev_mlme.h>
  24. #ifdef FEATURE_CM_ENABLE
  25. #include "wlan_cm_public_struct.h"
  26. #endif
  27. /**
  28. * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure
  29. * @mlme_psoc_ext_hdl_create: callback to invoke creation of legacy
  30. * psoc object
  31. * @mlme_psoc_ext_hdl_destroy: callback to invoke destroy of legacy
  32. * psoc object
  33. * @mlme_pdev_ext_hdl_create: callback to invoke creation of legacy
  34. * pdev object
  35. * @mlme_pdev_ext_hdl_destroy: callback to invoke destroy of legacy
  36. * pdev object
  37. * @mlme_vdev_ext_hdl_create: callback to invoke creation of legacy
  38. * vdev object
  39. * @mlme_vdev_ext_hdl_post_create: callback to invoke post creation actions
  40. * of legacy vdev object
  41. * @mlme_vdev_ext_hdl_destroy: callback to invoke destroy of legacy
  42. * vdev object
  43. * @mlme_vdev_start_fw_send: callback to invoke vdev start command
  44. * @mlme_vdev_stop_fw_send: callback to invoke vdev stop command
  45. * @mlme_vdev_down_fw_send: callback to invoke vdev down command
  46. * @mlme_multivdev_restart_fw_send: callback to invoke multivdev restart
  47. * command
  48. * @mlme_vdev_enqueue_exp_cmd: callback to enqueue exception command
  49. * required by serialization
  50. * @mlme_multi_vdev_restart_resp: callback to process multivdev restart
  51. * response
  52. * @mlme_cm_ext_connect_start: Callback to start connect request
  53. * @mlme_cm_ext_connect_active: Callback to indicate connect active
  54. * @mlme_cm_ext_bss_peer_create_req: Callback to bss peer create request
  55. * @mlme_cm_ext_connect_req: Callback for connect request to LIM
  56. * @mlme_cm_ext_connect_complete: Callback to indicate connect complete
  57. * @mlme_cm_ext_disconnect_start : Callback to start disconnect request
  58. * @mlme_cm_ext_disconnect_active: Callback to indicate disconnect active
  59. * @mlme_cm_ext_bss_peer_delete_req: Callback to bss peer delete request
  60. * @mlme_cm_ext_disconnect_complete: Callback to indicate disconnect
  61. * complete
  62. * @mlme_cm_ext_osif_connect: Callback to indicate connect complete
  63. * @mlme_cm_ext_osif_disconnect: Callback to indicate disconnect complete
  64. * @mlme_cm_ext_vdev_down: Callback to send vdev down to FW
  65. */
  66. struct mlme_ext_ops {
  67. QDF_STATUS (*mlme_psoc_ext_hdl_create)(
  68. struct psoc_mlme_obj *psoc_mlme);
  69. QDF_STATUS (*mlme_psoc_ext_hdl_destroy)(
  70. struct psoc_mlme_obj *pdev_mlme);
  71. QDF_STATUS (*mlme_pdev_ext_hdl_create)(
  72. struct pdev_mlme_obj *pdev_mlme);
  73. QDF_STATUS (*mlme_pdev_ext_hdl_destroy)(
  74. struct pdev_mlme_obj *pdev_mlme);
  75. QDF_STATUS (*mlme_vdev_ext_hdl_create)(
  76. struct vdev_mlme_obj *vdev_mlme);
  77. QDF_STATUS (*mlme_vdev_ext_hdl_post_create)(
  78. struct vdev_mlme_obj *vdev_mlme);
  79. QDF_STATUS (*mlme_vdev_ext_hdl_destroy)(
  80. struct vdev_mlme_obj *vdev_mlme);
  81. QDF_STATUS (*mlme_vdev_start_fw_send)(
  82. struct wlan_objmgr_vdev *vdev, uint8_t restart);
  83. QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev);
  84. QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev);
  85. QDF_STATUS (*mlme_multivdev_restart_fw_send)(
  86. struct wlan_objmgr_pdev *pdev);
  87. QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)(
  88. struct vdev_mlme_obj *vdev_mlme,
  89. uint8_t cmd_type);
  90. QDF_STATUS (*mlme_vdev_ext_delete_rsp)(
  91. struct wlan_objmgr_psoc *psoc,
  92. struct vdev_delete_response *rsp);
  93. QDF_STATUS (*mlme_multi_vdev_restart_resp)(
  94. struct wlan_objmgr_psoc *psoc,
  95. struct multi_vdev_restart_resp *resp);
  96. #ifdef FEATURE_CM_ENABLE
  97. QDF_STATUS (*mlme_cm_ext_connect_start)(
  98. struct wlan_objmgr_vdev *vdev,
  99. struct wlan_cm_connect_req *cm_conn_req);
  100. QDF_STATUS (*mlme_cm_ext_connect_active)(
  101. struct wlan_objmgr_vdev *vdev,
  102. struct wlan_cm_vdev_connect_req *vdev_connect_req);
  103. QDF_STATUS (*mlme_cm_ext_bss_peer_create_req)(
  104. struct wlan_objmgr_vdev *vdev,
  105. struct qdf_mac_addr *peer_mac);
  106. QDF_STATUS (*mlme_cm_ext_connect_req)(
  107. struct wlan_objmgr_vdev *vdev,
  108. struct wlan_cm_vdev_connect_req *vdev_connect_req);
  109. QDF_STATUS (*mlme_cm_ext_connect_complete)(
  110. struct wlan_objmgr_vdev *vdev,
  111. struct wlan_cm_connect_rsp *connect_rsp);
  112. QDF_STATUS (*mlme_cm_ext_disconnect_start)(
  113. struct wlan_objmgr_vdev *vdev,
  114. struct wlan_cm_disconnect_req *cm_conn_req);
  115. QDF_STATUS (*mlme_cm_ext_disconnect_active)
  116. (struct wlan_objmgr_vdev *vdev,
  117. struct wlan_cm_vdev_discon_req *vdev_disconnect_req);
  118. QDF_STATUS (*mlme_cm_ext_bss_peer_delete_req)(
  119. struct wlan_objmgr_vdev *vdev);
  120. QDF_STATUS (*mlme_cm_ext_disconnect_complete)(
  121. struct wlan_objmgr_vdev *vdev,
  122. struct wlan_cm_discon_rsp *cm_disconnect_rsp);
  123. QDF_STATUS (*mlme_cm_ext_osif_connect)(
  124. struct wlan_objmgr_vdev *vdev,
  125. struct wlan_cm_connect_rsp *cm_connect_rsp);
  126. QDF_STATUS (*mlme_cm_ext_osif_disconnect)(
  127. struct wlan_objmgr_vdev *vdev,
  128. struct wlan_cm_discon_rsp *cm_disconnect_rsp);
  129. QDF_STATUS (*mlme_cm_ext_vdev_down)(
  130. struct wlan_objmgr_vdev *vdev);
  131. #endif
  132. };
  133. /**
  134. * mlme_psoc_ops_ext_hdl_create() - Alloc PSOC mlme ext handle
  135. * @psoc_mlme: PSOC MLME comp object
  136. *
  137. * API to allocate PSOC MLME ext handle
  138. *
  139. * Return: SUCCESS on successful allocation
  140. * Else FAILURE
  141. */
  142. QDF_STATUS mlme_psoc_ops_ext_hdl_create(struct psoc_mlme_obj *psoc_mlme);
  143. /**
  144. * mlme_psoc_ops_ext_hdl_destroy() - Destroy PSOC mlme ext handle
  145. * @psoc_mlme: PSOC MLME comp object
  146. *
  147. * API to free psoc MLME ext handle
  148. *
  149. * Return: SUCCESS on successful free
  150. * Else FAILURE
  151. */
  152. QDF_STATUS mlme_psoc_ops_ext_hdl_destroy(struct psoc_mlme_obj *psoc_mlme);
  153. /**
  154. * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle
  155. * @pdev_mlme_obj: PDEV MLME comp object
  156. *
  157. * API to allocate PDEV MLME ext handle
  158. *
  159. * Return: SUCCESS on successful allocation
  160. * Else FAILURE
  161. */
  162. QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme);
  163. /**
  164. * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle
  165. * @pdev_mlme_obj: PDEV MLME comp object
  166. *
  167. * API to free pdev MLME ext handle
  168. *
  169. * Return: SUCCESS on successful free
  170. * Else FAILURE
  171. */
  172. QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme);
  173. /**
  174. * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle
  175. * @vdev_mlme_obj: VDEV MLME comp object
  176. *
  177. * API to allocate VDEV MLME ext handle
  178. *
  179. * Return: SUCCESS on successful allocation
  180. * Else FAILURE
  181. */
  182. QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme);
  183. /**
  184. * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc
  185. * operations
  186. * @vdev_mlme_obj: VDEV MLME comp object
  187. *
  188. * API to perform post vdev MLME ext handle allocation operations
  189. *
  190. * Return: SUCCESS on initialization successful
  191. * Else FAILURE
  192. */
  193. QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme);
  194. /**
  195. * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle
  196. * @vdev_mlme_obj: VDEV MLME comp object
  197. *
  198. * API to free vdev MLME ext handle
  199. *
  200. * Return: SUCCESS on successful free
  201. * Else FAILURE
  202. */
  203. QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme);
  204. /**
  205. * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd
  206. * @vdev_mlme_obj: VDEV MLME comp object
  207. * @cmd_type: Serialization command type
  208. *
  209. * API to enqueue the exception serialization command, used by
  210. * mlme-serialization wrapper layer
  211. *
  212. * Return: SUCCESS on successful enqueuing the command
  213. * Else FAILURE
  214. */
  215. QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
  216. uint8_t cmd_type);
  217. /**
  218. * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW
  219. * @vdev: VDEV object
  220. *
  221. * API to send WMI start/restart command to FW
  222. *
  223. * Return: SUCCESS on successful sending the command
  224. * Else FAILURE
  225. */
  226. QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev,
  227. uint8_t restart);
  228. /**
  229. * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart
  230. * commmand to FW
  231. * @pdev: PDEV object
  232. *
  233. * API to send WMI multivdev restart command to FW
  234. *
  235. * Return: SUCCESS on successful sending the command
  236. * Else FAILURE
  237. */
  238. QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send(
  239. struct wlan_objmgr_pdev *pdev);
  240. /**
  241. * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW
  242. * @vdev: VDEV object
  243. *
  244. * API to send WMI stop command to FW
  245. *
  246. * Return: SUCCESS on successful sending the command
  247. * Else FAILURE
  248. */
  249. QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev);
  250. /**
  251. * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW
  252. * @vdev: VDEV object
  253. *
  254. * API to send WMI down command to FW
  255. *
  256. * Return: SUCCESS on successful sending the command
  257. * Else FAILURE
  258. */
  259. QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev);
  260. /*
  261. * mlme_vdev_ops_ext_hdl_multivdev_restart_resp() - Handler multivdev restart
  262. * response event
  263. * @psoc: PSOC object manager handle
  264. * @resp: Restart response event
  265. *
  266. * Return: Success on successful handling of the response event,
  267. * Else failure
  268. */
  269. QDF_STATUS mlme_vdev_ops_ext_hdl_multivdev_restart_resp(
  270. struct wlan_objmgr_psoc *psoc,
  271. struct multi_vdev_restart_resp *resp);
  272. /**
  273. * mlme_set_ops_register_cb - Sets ops registration callback
  274. * @ops_cb: Function pointer
  275. *
  276. * API to set ops registration call back
  277. *
  278. * Return: void
  279. */
  280. typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void);
  281. void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb);
  282. /**
  283. * wlan_cmn_mlme_init - Initializes MLME component
  284. *
  285. * Registers callbacks with object manager for create/destroy
  286. *
  287. * Return: SUCCESS on successful registration
  288. * FAILURE, if registration fails
  289. */
  290. QDF_STATUS wlan_cmn_mlme_init(void);
  291. /**
  292. * wlan_cmn_mlme_deinit - Uninitializes MLME component
  293. *
  294. * Unregisters callbacks with object manager for create/destroy
  295. *
  296. * Return: SUCCESS on successful registration
  297. * FAILURE, if registration fails
  298. */
  299. QDF_STATUS wlan_cmn_mlme_deinit(void);
  300. /**
  301. * mlme_vdev_ops_ext_hdl_delete_rsp - Vdev Delete response ext handler
  302. * @psoc: PSOC object
  303. * @rsp: Vdev delete response received from the firmware
  304. *
  305. * API to invoke the legacy delete response handler for legacy cleanup
  306. *
  307. * Return: SUCCESS on successful deletion
  308. * FAILURE, if deletion fails
  309. */
  310. QDF_STATUS mlme_vdev_ops_ext_hdl_delete_rsp(struct wlan_objmgr_psoc *psoc,
  311. struct vdev_delete_response *rsp);
  312. #ifdef FEATURE_CM_ENABLE
  313. /**
  314. * mlme_cm_ops_ext_connect_start - Connection manager connect start
  315. * handler
  316. * @vdev: VDEV object
  317. * @req: Connection manager connect request
  318. *
  319. * Return: QDF_STATUS
  320. */
  321. QDF_STATUS mlme_cm_ops_ext_connect_start(struct wlan_objmgr_vdev *vdev,
  322. struct wlan_cm_connect_req *req);
  323. /**
  324. * mlme_cm_ops_ext_connect_active - Connection manager indicate connect
  325. * active handler
  326. * @vdev: VDEV object
  327. * @req: Vdev connect request
  328. *
  329. * Return: QDF_STATUS
  330. */
  331. QDF_STATUS mlme_cm_ops_ext_connect_active(struct wlan_objmgr_vdev *vdev,
  332. struct wlan_cm_vdev_connect_req *req);
  333. /**
  334. * mlme_cm_ops_ext_bss_peer_create_req - Connection manager bss peer
  335. * create request handler
  336. * @vdev: VDEV object
  337. * @peer_mac: Peer mac address
  338. *
  339. * Return: QDF_STATUS
  340. */
  341. QDF_STATUS mlme_cm_ops_ext_bss_peer_create_req(struct wlan_objmgr_vdev *vdev,
  342. struct qdf_mac_addr *peer_mac);
  343. /**
  344. * mlme_cm_ops_ext_connect_req - Connection manager connect request handler
  345. * @vdev: VDEV object
  346. * @req: Vdev connect request
  347. *
  348. * Return: QDF_STATUS
  349. */
  350. QDF_STATUS mlme_cm_ops_ext_connect_req(struct wlan_objmgr_vdev *vdev,
  351. struct wlan_cm_vdev_connect_req *req);
  352. /**
  353. * mlme_cm_ops_ext_connect_complete - Connection manager connect complete
  354. * handler
  355. * @vdev: VDEV object
  356. * @rsp: Connection manager connect response
  357. *
  358. * Return: QDF_STATUS
  359. */
  360. QDF_STATUS mlme_cm_ops_ext_connect_complete(struct wlan_objmgr_vdev *vdev,
  361. struct wlan_cm_connect_rsp *rsp);
  362. /**
  363. * mlme_cm_ops_ext_disconnect_start - Connection manager disconnect start
  364. * handler
  365. * @vdev: VDEV object
  366. * @req: Connection manager disconnect request
  367. *
  368. * Return: QDF_STATUS
  369. */
  370. QDF_STATUS mlme_cm_ops_ext_disconnect_start(struct wlan_objmgr_vdev *vdev,
  371. struct wlan_cm_disconnect_req *req);
  372. /**
  373. * mlme_cm_ops_ext_disconnect_active - Connection manager disconnect
  374. * active handler
  375. * @vdev: VDEV object
  376. * @req: vdev disconnect request
  377. *
  378. * Return: QDF_STATUS
  379. */
  380. QDF_STATUS
  381. mlme_cm_ops_ext_disconnect_active(struct wlan_objmgr_vdev *vdev,
  382. struct wlan_cm_vdev_discon_req *req);
  383. /**
  384. * mlme_cm_ops_ext_bss_peer_delete_req - Connection manager bss peer delete
  385. * request handler
  386. * @vdev: VDEV object
  387. *
  388. * Return: QDF_STATUS
  389. */
  390. QDF_STATUS
  391. mlme_cm_ops_ext_bss_peer_delete_req(struct wlan_objmgr_vdev *vdev);
  392. /**
  393. * mlme_cm_ops_ext_disconnect_complete - Connection manager disconnect
  394. * complete handler
  395. * @vdev: VDEV object
  396. * @rsp: Connection manager disconnect response
  397. *
  398. * Return: QDF_STATUS
  399. */
  400. QDF_STATUS mlme_cm_ops_ext_disconnect_complete(struct wlan_objmgr_vdev *vdev,
  401. struct wlan_cm_discon_rsp *rsp);
  402. /**
  403. * mlme_cm_ops_ext_osif_connect - Connection manager osif connect handler
  404. * @vdev: VDEV object
  405. * @rsp: Connection manager connect response
  406. *
  407. * Return: QDF_STATUS
  408. */
  409. QDF_STATUS mlme_cm_ops_ext_osif_connect(struct wlan_objmgr_vdev *vdev,
  410. struct wlan_cm_connect_rsp *rsp);
  411. /**
  412. * mlme_cm_ops_ext_osif_disconnect - Connection manager osif disconnect
  413. * handler
  414. * @vdev: VDEV object
  415. * @rsp: Connection manager disconnect response
  416. *
  417. * Return: QDF_STATUS
  418. */
  419. QDF_STATUS mlme_cm_ops_ext_osif_disconnect(struct wlan_objmgr_vdev *vdev,
  420. struct wlan_cm_discon_rsp *rsp);
  421. /**
  422. * mlme_cm_ops_ext_osif_disconnect - Function to send vdev down to FW
  423. * @vdev: VDEV object
  424. *
  425. * Return: QDF_STATUS
  426. */
  427. QDF_STATUS mlme_cm_ext_vdev_down(struct wlan_objmgr_vdev *vdev);
  428. #endif
  429. #endif