wlan_vdev_mlme.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. /*
  2. * Copyright (c) 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: Define VDEV MLME structure and APIs
  20. */
  21. #ifndef _WLAN_VDEV_MLME_H_
  22. #define _WLAN_VDEV_MLME_H_
  23. struct vdev_mlme_obj;
  24. /**
  25. * struct vdev_mlme_proto - VDEV protocol strucutre
  26. */
  27. struct vdev_mlme_proto {
  28. };
  29. /**
  30. * enum beacon_update_op - Beacon update op type
  31. * @BEACON_INIT: Initialize beacon
  32. * @BEACON_REINIT: Re-initialize beacon
  33. * @BEACON_UPDATE: Update dynamic fields of beacon
  34. * @BEACON_CSA: Enable CSA IE
  35. * @BEACON_FREE: Beacon buffer free
  36. */
  37. enum beacon_update_op {
  38. BEACON_INIT,
  39. BEACON_REINIT,
  40. BEACON_UPDATE,
  41. BEACON_CSA,
  42. BEACON_FREE,
  43. };
  44. /**
  45. * struct vdev_mlme_ops - VDEV MLME operation callbacks strucutre
  46. * @mlme_vdev_validate_basic_params: callback to validate basic params of VDEV
  47. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  48. * @mlme_vdev_start_send: callback to initiate actions of VDEV MLME
  49. * start operation
  50. * @mlme_vdev_restart_send: callback to initiate actions of VDEV MLME
  51. * restart operation
  52. * @mlme_vdev_start_continue: callback to initiate operations on
  53. * LMAC/FW start response
  54. * @mlme_vdev_up_send: callback to initiate actions of VDEV MLME
  55. * up operation
  56. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving to
  57. * UP state
  58. * @mlme_vdev_update_beacon: callback to initiate beacon update
  59. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  60. * peers
  61. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  62. * @mlme_vdev_stop_send: callback to initiate actions of VDEV MLME
  63. * stop operation
  64. * @mlme_vdev_stop_continue: callback to initiate operations on
  65. * LMAC/FW stop response
  66. * @mlme_vdev_bss_peer_delete_continue:callback to initiate operations on BSS
  67. * peer delete completion
  68. * @mlme_vdev_down_send: callback to initiate actions of VDEV MLME
  69. * down operation
  70. * @mlme_vdev_legacy_hdl_create: callback to invoke creation of legacy
  71. * vdev object
  72. * @mlme_vdev_legacy_hdl_post_create: callback to invoke post creation actions
  73. * of legacy vdev object
  74. * @mlme_vdev_legacy_hdl_destroy: callback to invoke destroy of legacy
  75. * vdev object
  76. */
  77. struct vdev_mlme_ops {
  78. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  79. struct vdev_mlme_obj *vdev_mlme);
  80. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  81. struct vdev_mlme_obj *vdev_mlme);
  82. QDF_STATUS (*mlme_vdev_start_send)(struct vdev_mlme_obj *vdev_mlme);
  83. QDF_STATUS (*mlme_vdev_restart_send)(struct vdev_mlme_obj *vdev_mlme);
  84. QDF_STATUS (*mlme_vdev_start_continue)(struct vdev_mlme_obj *vdev_mlme);
  85. QDF_STATUS (*mlme_vdev_up_send)(struct vdev_mlme_obj *vdev_mlme);
  86. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  87. struct vdev_mlme_obj *vdev_mlme);
  88. QDF_STATUS (*mlme_vdev_update_beacon)(struct vdev_mlme_obj *vdev_mlme,
  89. enum beacon_update_op op);
  90. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  91. struct vdev_mlme_obj *vdev_mlme);
  92. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  93. struct vdev_mlme_obj *vdev_mlme);
  94. QDF_STATUS (*mlme_vdev_stop_send)(struct vdev_mlme_obj *vdev_mlme);
  95. QDF_STATUS (*mlme_vdev_stop_continue)(struct vdev_mlme_obj *vdev_mlme);
  96. QDF_STATUS (*mlme_vdev_bss_peer_delete_continue)(
  97. struct vdev_mlme_obj *vdev_mlme);
  98. QDF_STATUS (*mlme_vdev_down_send)(struct vdev_mlme_obj *vdev_mlme);
  99. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  100. struct vdev_mlme_obj *vdev_mlme);
  101. QDF_STATUS (*mlme_vdev_legacy_hdl_create)(
  102. struct vdev_mlme_obj *vdev_mlme);
  103. QDF_STATUS (*mlme_vdev_legacy_hdl_post_create)(
  104. struct vdev_mlme_obj *vdev_mlme);
  105. QDF_STATUS (*mlme_vdev_legacy_hdl_destroy)(
  106. struct vdev_mlme_obj *vdev_mlme);
  107. };
  108. /**
  109. * struct vdev_mlme_obj - VDEV MLME component object
  110. * @vdev_proto: VDEV MLME proto substructure
  111. * @sm_lock: VDEV SM lock
  112. * @sm_hdl: VDEV SM handle
  113. * @ops: VDEV MLME callback table
  114. * @legacy_vdev_ptr: VDEV MLME legacy pointer
  115. */
  116. struct vdev_mlme_obj {
  117. struct vdev_mlme_proto vdev_proto;
  118. #ifdef VDEV_SM_LOCK_SUPPORT
  119. qdf_spinlock_t sm_lock;
  120. #endif
  121. struct wlan_sm *sm_hdl;
  122. struct wlan_objmgr_vdev *vdev;
  123. struct vdev_mlme_ops *ops;
  124. void *legacy_vdev_ptr;
  125. };
  126. /**
  127. * mlme_vdev_validate_basic_params - Validate basic params
  128. * @vdev_mlme_obj: VDEV MLME comp object
  129. *
  130. * API validate MLME VDEV basic parameters
  131. *
  132. * Return: SUCCESS on successful validation
  133. * FAILURE, if any parameter is not initialized
  134. */
  135. static inline QDF_STATUS mlme_vdev_validate_basic_params(
  136. struct vdev_mlme_obj *vdev_mlme)
  137. {
  138. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  139. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_validate_basic_params)
  140. ret = vdev_mlme->ops->mlme_vdev_validate_basic_params(
  141. vdev_mlme);
  142. return ret;
  143. }
  144. /**
  145. * mlme_vdev_reset_proto_params - Reset VDEV protocol params
  146. * @vdev_mlme_obj: VDEV MLME comp object
  147. *
  148. * API resets the protocol params fo vdev
  149. *
  150. * Return: SUCCESS on successful reset
  151. * FAILURE, if it fails due to any
  152. */
  153. static inline QDF_STATUS mlme_vdev_reset_proto_params(
  154. struct vdev_mlme_obj *vdev_mlme)
  155. {
  156. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  157. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_reset_proto_params)
  158. ret = vdev_mlme->ops->mlme_vdev_reset_proto_params(vdev_mlme);
  159. return ret;
  160. }
  161. /**
  162. * mlme_vdev_start_send - Invokes VDEV start operation
  163. * @vdev_mlme_obj: VDEV MLME comp object
  164. *
  165. * API invokes VDEV start operation
  166. *
  167. * Return: SUCCESS on successful completion of start operation
  168. * FAILURE, if it fails due to any
  169. */
  170. static inline QDF_STATUS mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme)
  171. {
  172. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  173. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_send)
  174. ret = vdev_mlme->ops->mlme_vdev_start_send(vdev_mlme);
  175. return ret;
  176. }
  177. /**
  178. * mlme_vdev_restart_send - Invokes VDEV restart operation
  179. * @vdev_mlme_obj: VDEV MLME comp object
  180. *
  181. * API invokes VDEV restart operation
  182. *
  183. * Return: SUCCESS on successful completion of restart operation
  184. * FAILURE, if it fails due to any
  185. */
  186. static inline QDF_STATUS mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme)
  187. {
  188. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  189. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_restart_send)
  190. ret = vdev_mlme->ops->mlme_vdev_restart_send(vdev_mlme);
  191. return ret;
  192. }
  193. /**
  194. * mlme_vdev_start_continue - VDEV start response handling
  195. * @vdev_mlme_obj: VDEV MLME comp object
  196. *
  197. * API invokes VDEV start response actions
  198. *
  199. * Return: SUCCESS on successful completion of start response operation
  200. * FAILURE, if it fails due to any
  201. */
  202. static inline QDF_STATUS mlme_vdev_start_continue(
  203. struct vdev_mlme_obj *vdev_mlme)
  204. {
  205. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  206. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_continue)
  207. ret = vdev_mlme->ops->mlme_vdev_start_continue(vdev_mlme);
  208. return ret;
  209. }
  210. /**
  211. * mlme_vdev_up_send - VDEV up operation
  212. * @vdev_mlme_obj: VDEV MLME comp object
  213. *
  214. * API invokes VDEV up operations
  215. *
  216. * Return: SUCCESS on successful completion of up operation
  217. * FAILURE, if it fails due to any
  218. */
  219. static inline QDF_STATUS mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme)
  220. {
  221. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  222. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_up_send)
  223. ret = vdev_mlme->ops->mlme_vdev_up_send(vdev_mlme);
  224. return ret;
  225. }
  226. /**
  227. * mlme_vdev_notify_up_complete - VDEV up state transition notification
  228. * @vdev_mlme_obj: VDEV MLME comp object
  229. *
  230. * API notifies MLME on moving to UP state
  231. *
  232. * Return: SUCCESS on successful completion of up notification
  233. * FAILURE, if it fails due to any
  234. */
  235. static inline QDF_STATUS mlme_vdev_notify_up_complete(
  236. struct vdev_mlme_obj *vdev_mlme)
  237. {
  238. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  239. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_notify_up_complete)
  240. ret = vdev_mlme->ops->mlme_vdev_notify_up_complete(vdev_mlme);
  241. return ret;
  242. }
  243. /**
  244. * mlme_vdev_update_beacon - Updates beacon
  245. * @vdev_mlme_obj: VDEV MLME comp object
  246. * @op: beacon update type
  247. *
  248. * API updates/allocates/frees the beacon
  249. *
  250. * Return: SUCCESS on successful update of beacon
  251. * FAILURE, if it fails due to any
  252. */
  253. static inline QDF_STATUS mlme_vdev_update_beacon(
  254. struct vdev_mlme_obj *vdev_mlme,
  255. enum beacon_update_op op)
  256. {
  257. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  258. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_update_beacon)
  259. ret = vdev_mlme->ops->mlme_vdev_update_beacon(vdev_mlme, op);
  260. return ret;
  261. }
  262. /**
  263. * mlme_vdev_disconnect_peers - Disconnect peers
  264. * @vdev_mlme_obj: VDEV MLME comp object
  265. *
  266. * API trigger stations disconnection with AP VDEV or AP disconnection with STA
  267. * VDEV
  268. *
  269. * Return: SUCCESS on successful invocation of station disconnection
  270. * FAILURE, if it fails due to any
  271. */
  272. static inline QDF_STATUS mlme_vdev_disconnect_peers(
  273. struct vdev_mlme_obj *vdev_mlme)
  274. {
  275. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  276. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_disconnect_peers)
  277. ret = vdev_mlme->ops->mlme_vdev_disconnect_peers(vdev_mlme);
  278. return ret;
  279. }
  280. /**
  281. * mlme_vdev_dfs_cac_timer_stop - Stop CAC timer
  282. * @vdev_mlme_obj: VDEV MLME comp object
  283. *
  284. * API stops the CAC timer through DFS API
  285. *
  286. * Return: SUCCESS on successful CAC timer stop
  287. * FAILURE, if it fails due to any
  288. */
  289. static inline QDF_STATUS mlme_vdev_dfs_cac_timer_stop(
  290. struct vdev_mlme_obj *vdev_mlme)
  291. {
  292. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  293. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop)
  294. ret = vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop(vdev_mlme);
  295. return ret;
  296. }
  297. /**
  298. * mlme_vdev_stop_send - Invokes VDEV stop operation
  299. * @vdev_mlme_obj: VDEV MLME comp object
  300. *
  301. * API invokes VDEV stop operation
  302. *
  303. * Return: SUCCESS on successful completion of stop operation
  304. * FAILURE, if it fails due to any
  305. */
  306. static inline QDF_STATUS mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme)
  307. {
  308. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  309. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_send)
  310. ret = vdev_mlme->ops->mlme_vdev_stop_send(vdev_mlme);
  311. return ret;
  312. }
  313. /**
  314. * mlme_vdev_stop_continue - VDEV stop response handling
  315. * @vdev_mlme_obj: VDEV MLME comp object
  316. *
  317. * API invokes VDEV stop response actions
  318. *
  319. * Return: SUCCESS on successful completion of stop response operation
  320. * FAILURE, if it fails due to any
  321. */
  322. static inline QDF_STATUS mlme_vdev_stop_continue(
  323. struct vdev_mlme_obj *vdev_mlme)
  324. {
  325. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  326. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_continue)
  327. ret = vdev_mlme->ops->mlme_vdev_stop_continue(vdev_mlme);
  328. return ret;
  329. }
  330. /**
  331. * mlme_vdev_bss_peer_delete_continue - VDEV BSS peer delete complete
  332. * @vdev_mlme_obj: VDEV MLME comp object
  333. *
  334. * API invokes VDEV BSS peer delete complete operation
  335. *
  336. * Return: SUCCESS on successful completion of BSS peer delete handling
  337. * FAILURE, if it fails due to any
  338. */
  339. static inline QDF_STATUS mlme_vdev_bss_peer_delete_continue(
  340. struct vdev_mlme_obj *vdev_mlme)
  341. {
  342. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  343. if ((vdev_mlme->ops) &&
  344. vdev_mlme->ops->mlme_vdev_bss_peer_delete_continue)
  345. ret = vdev_mlme->ops->mlme_vdev_bss_peer_delete_continue(
  346. vdev_mlme);
  347. return ret;
  348. }
  349. /**
  350. * mlme_vdev_down_send - VDEV down operation
  351. * @vdev_mlme_obj: VDEV MLME comp object
  352. *
  353. * API invokes VDEV down operation
  354. *
  355. * Return: SUCCESS on successful completion of VDEV down operation
  356. * FAILURE, if it fails due to any
  357. */
  358. static inline QDF_STATUS mlme_vdev_down_send(struct vdev_mlme_obj *vdev_mlme)
  359. {
  360. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  361. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_down_send)
  362. ret = vdev_mlme->ops->mlme_vdev_down_send(vdev_mlme);
  363. return ret;
  364. }
  365. /**
  366. * mlme_vdev_notify_down_complete - VDEV init state transition notification
  367. * @vdev_mlme_obj: VDEV MLME comp object
  368. *
  369. * API notifies MLME on moving to INIT state
  370. *
  371. * Return: SUCCESS on successful completion of down notification
  372. * FAILURE, if it fails due to any
  373. */
  374. static inline QDF_STATUS mlme_vdev_notify_down_complete(
  375. struct vdev_mlme_obj *vdev_mlme)
  376. {
  377. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  378. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_notify_down_complete)
  379. ret = vdev_mlme->ops->mlme_vdev_notify_down_complete(vdev_mlme);
  380. return ret;
  381. }
  382. /**
  383. * mlme_vdev_legacy_hdl_create - VDEV legacy pointer allocation
  384. * @vdev_mlme_obj: VDEV MLME comp object
  385. *
  386. * API invokes legacy pointer allocation and initialization
  387. *
  388. * Return: SUCCESS on successful creation of legacy handle
  389. * FAILURE, if it fails due to any
  390. */
  391. static inline QDF_STATUS mlme_vdev_legacy_hdl_create(
  392. struct vdev_mlme_obj *vdev_mlme)
  393. {
  394. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  395. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_legacy_hdl_create)
  396. ret = vdev_mlme->ops->mlme_vdev_legacy_hdl_create(vdev_mlme);
  397. return ret;
  398. }
  399. /**
  400. * mlme_vdev_legacy_hdl_post_create - VDEV post legacy pointer allocation
  401. * @vdev_mlme_obj: VDEV MLME comp object
  402. *
  403. * API invokes post legacy pointer allocation operation
  404. *
  405. * Return: SUCCESS on successful creation of legacy handle
  406. * FAILURE, if it fails due to any
  407. */
  408. static inline QDF_STATUS mlme_vdev_legacy_hdl_post_create(
  409. struct vdev_mlme_obj *vdev_mlme)
  410. {
  411. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  412. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_legacy_hdl_post_create)
  413. ret = vdev_mlme->ops->mlme_vdev_legacy_hdl_post_create(
  414. vdev_mlme);
  415. return ret;
  416. }
  417. /**
  418. * mlme_vdev_legacy_hdl_destroy - VDEV legacy pointer free
  419. * @vdev_mlme_obj: VDEV MLME comp object
  420. *
  421. * API invokes legacy pointer free
  422. *
  423. * Return: SUCCESS on successful free of legacy handle
  424. * FAILURE, if it fails due to any
  425. */
  426. static inline QDF_STATUS mlme_vdev_legacy_hdl_destroy(
  427. struct vdev_mlme_obj *vdev_mlme)
  428. {
  429. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  430. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_legacy_hdl_destroy)
  431. ret = vdev_mlme->ops->mlme_vdev_legacy_hdl_destroy(vdev_mlme);
  432. return ret;
  433. }
  434. #endif