wlan_dsc_vdev.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Copyright (c) 2018-2019, 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: Driver Synchronization Core (DSC) vdev-level APIs
  21. */
  22. #ifndef __WLAN_DSC_VDEV_H
  23. #define __WLAN_DSC_VDEV_H
  24. #include "qdf_status.h"
  25. #include "wlan_dsc_psoc.h"
  26. /*
  27. * struct dsc_vdev - opaque dsc vdev context
  28. */
  29. struct dsc_vdev;
  30. /**
  31. * dsc_vdev_create() - create a dsc vdev context
  32. * @psoc: parent dsc psoc context
  33. * @out_vdev: opaque double pointer to assign the new context to
  34. *
  35. * Note: this attaches @out_vdev to @psoc
  36. *
  37. * Return: QDF_STATUS
  38. */
  39. QDF_STATUS dsc_vdev_create(struct dsc_psoc *psoc, struct dsc_vdev **out_vdev);
  40. /**
  41. * dsc_vdev_destroy() - destroy a dsc vdev context
  42. * @out_vdev: opaque double pointer to context to destroy and NULL
  43. *
  44. * Note, this:
  45. * - detaches @out_vdev from its parent psoc context
  46. * - aborts all queued transitions on @vdev
  47. * - asserts @vdev has no operations in flight
  48. *
  49. * Return: None
  50. */
  51. void dsc_vdev_destroy(struct dsc_vdev **out_vdev);
  52. /**
  53. * dsc_vdev_trans_start() - start a transition on @vdev
  54. * @vdev: the vdev to start a transition on
  55. * @desc: a unique description of the transition to start
  56. *
  57. * This API immediately aborts if a transition on @vdev is already in flight
  58. *
  59. * Call dsc_vdev_trans_stop() to complete the transition.
  60. *
  61. * Return:
  62. * QDF_STATUS_SUCCESS - transition started successfully
  63. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  64. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  65. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  66. */
  67. QDF_STATUS dsc_vdev_trans_start(struct dsc_vdev *vdev, const char *desc);
  68. /**
  69. * dsc_vdev_trans_start_wait() - start a transition on @vdev, blocking if a
  70. * transition is already in flight
  71. * @vdev: the vdev to start a transition on
  72. * @desc: a unique description of the transition to start
  73. *
  74. * Call dsc_vdev_trans_stop() to complete the transition.
  75. *
  76. * Return:
  77. * QDF_STATUS_SUCCESS - transition started successfully
  78. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  79. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  80. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  81. * QDF_STATUS_E_ABORTED - transition was aborted
  82. */
  83. QDF_STATUS dsc_vdev_trans_start_wait(struct dsc_vdev *vdev, const char *desc);
  84. /**
  85. * dsc_vdev_trans_stop() - complete current transition in flight on @vdev
  86. * @vdev: the vdev to complete the transition on
  87. *
  88. * Note: this asserts a transition is currently in flight on @vdev
  89. *
  90. * Return: None
  91. */
  92. void dsc_vdev_trans_stop(struct dsc_vdev *vdev);
  93. /**
  94. * dsc_vdev_assert_trans_protected() - assert @vdev is protected by a transition
  95. * @vdev: the vdev to check
  96. *
  97. * The protecting transition may be in flight on @vdev or its ancestors.
  98. *
  99. * Return: None
  100. */
  101. void dsc_vdev_assert_trans_protected(struct dsc_vdev *vdev);
  102. /**
  103. * dsc_vdev_op_start() - start an operation on @vdev
  104. * @vdev: the vdev to start an operation on
  105. *
  106. * Return:
  107. * QDF_STATUS_SUCCESS - operation started successfully
  108. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  109. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  110. * QDF_STATUS_E_NOMEM - out of memory
  111. */
  112. #define dsc_vdev_op_start(vdev) _dsc_vdev_op_start(vdev, __func__)
  113. QDF_STATUS _dsc_vdev_op_start(struct dsc_vdev *vdev, const char *func);
  114. /**
  115. * dsc_vdev_op_stop() - complete operation with matching @func on @vdev
  116. * @vdev: the vdev to stop an operation on
  117. *
  118. * Note: this asserts @func was previously started
  119. *
  120. * Return: None
  121. */
  122. #define dsc_vdev_op_stop(vdev) _dsc_vdev_op_stop(vdev, __func__)
  123. void _dsc_vdev_op_stop(struct dsc_vdev *vdev, const char *func);
  124. /**
  125. * dsc_vdev_wait_for_ops() - blocks until all operations on @vdev have stopped
  126. * @vdev: the vdev to wait for operations on
  127. *
  128. * Note: this asserts that @vdev cannot currently transition
  129. *
  130. * Return: None
  131. */
  132. void dsc_vdev_wait_for_ops(struct dsc_vdev *vdev);
  133. /**
  134. * dsc_vdev_get_cached_cmd() - Get north bound cmd cached during SSR
  135. * @vdev: Pointer to the dsc vdev
  136. *
  137. * This api will be invoked after completion of SSR re-initialization to get
  138. * the last north bound command received during SSR
  139. *
  140. * Return: North bound command ID
  141. */
  142. uint8_t dsc_vdev_get_cached_cmd(struct dsc_vdev *vdev);
  143. /**
  144. * dsc_vdev_cache_command() - Cache north bound command during SSR
  145. * @vdev: Pointer to the dsc vdev corresponding to the network interface
  146. * @cmd_id: North bound command ID
  147. *
  148. * This api will be invoked when a north bound command is received during SSR
  149. * and it should be handled after SSR re-initialization.
  150. *
  151. * Return: None
  152. */
  153. void dsc_vdev_cache_command(struct dsc_vdev *vdev, uint8_t cmd_id);
  154. /*
  155. * dsc_vdev_wait_for_uptree_ops() - Wait for any uptree operations
  156. * @vdev: The DSC vdev
  157. *
  158. * This function checks and waits for any uptree operations if there is any
  159. * uptree operation is in progress.
  160. *
  161. * Return: None.
  162. */
  163. void dsc_vdev_wait_for_uptree_ops(struct dsc_vdev *vdev);
  164. #endif /* __WLAN_DSC_VDEV_H */