wlan_dsc_vdev.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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: Driver Synchronization Core (DSC) vdev-level APIs
  20. */
  21. #ifndef __WLAN_DSC_VDEV_H
  22. #define __WLAN_DSC_VDEV_H
  23. #include "qdf_status.h"
  24. /**
  25. * struct dsc_vdev - opaque dsc vdev context
  26. */
  27. struct dsc_vdev;
  28. /**
  29. * dsc_vdev_create() - create a dsc vdev context
  30. * @psoc: parent dsc psoc context
  31. * @out_vdev: opaque double pointer to assign the new context to
  32. *
  33. * Note: this attaches @out_vdev to @psoc
  34. *
  35. * Return: QDF_STATUS
  36. */
  37. QDF_STATUS dsc_vdev_create(struct dsc_psoc *psoc, struct dsc_vdev **out_vdev);
  38. /**
  39. * dsc_vdev_destroy() - destroy a dsc vdev context
  40. * @out_vdev: opaque double pointer to context to destroy and NULL
  41. *
  42. * Note, this:
  43. * - detaches @out_vdev from its parent psoc context
  44. * - aborts all queued transitions on @vdev
  45. * - asserts @vdev has no operations in flight
  46. *
  47. * Return: None
  48. */
  49. void dsc_vdev_destroy(struct dsc_vdev **out_vdev);
  50. /**
  51. * dsc_vdev_trans_start() - start a transition on @vdev
  52. * @vdev: the vdev to start a transition on
  53. * @desc: a unique description of the transition to start
  54. *
  55. * This API immediately aborts if a transition on @vdev is already in flight
  56. *
  57. * Call dsc_vdev_trans_stop() to complete the transition.
  58. *
  59. * Return:
  60. * QDF_STATUS_SUCCESS - transition started succcessfully
  61. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  62. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  63. * QDF_STATUS_E_ALREADY - transition with @desc already in flight
  64. */
  65. QDF_STATUS dsc_vdev_trans_start(struct dsc_vdev *vdev, const char *desc);
  66. /**
  67. * dsc_vdev_trans_start_wait() - start a transition on @vdev, blocking if a
  68. * transition is already in flight
  69. * @vdev: the vdev to start a transition on
  70. * @desc: a unique description of the transition to start
  71. *
  72. * Call dsc_vdev_trans_stop() to complete the transition.
  73. *
  74. * Return:
  75. * QDF_STATUS_SUCCESS - transition started succcessfully
  76. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  77. * QDF_STATUS_E_AGAIN - transition cannot currently be started
  78. * QDF_STATUS_E_ALREADY - transition with @desc already queued or in flight
  79. * QDF_STATUS_E_ABORTED - transition was aborted
  80. */
  81. QDF_STATUS dsc_vdev_trans_start_wait(struct dsc_vdev *vdev, const char *desc);
  82. /**
  83. * dsc_vdev_trans_stop() - complete current transition in flight on @vdev
  84. * @vdev: the vdev to complete the transition on
  85. *
  86. * Note: this asserts a transition is currently in flight on @vdev
  87. *
  88. * Return: None
  89. */
  90. void dsc_vdev_trans_stop(struct dsc_vdev *vdev);
  91. /**
  92. * dsc_vdev_assert_trans_protected() - assert @vdev is protected by a transition
  93. * @vdev: the vdev to check
  94. *
  95. * The protecting transition may be in flight on @vdev or its ancestors.
  96. *
  97. * Return: None
  98. */
  99. void dsc_vdev_assert_trans_protected(struct dsc_vdev *vdev);
  100. /**
  101. * dsc_vdev_op_start() - start an operation on @vdev
  102. * @vdev: the vdev to start an operation on
  103. *
  104. * Return:
  105. * QDF_STATUS_SUCCESS - operation started succcessfully
  106. * QDF_STATUS_E_INVAL - invalid request (causes debug panic)
  107. * QDF_STATUS_E_AGAIN - operation cannot currently be started
  108. * QDF_STATUS_E_NOMEM - out of memory
  109. */
  110. #define dsc_vdev_op_start(vdev) _dsc_vdev_op_start(vdev, __func__)
  111. QDF_STATUS _dsc_vdev_op_start(struct dsc_vdev *vdev, const char *func);
  112. /**
  113. * dsc_vdev_op_stop() - complete operation with matching @func on @vdev
  114. * @vdev: the vdev to stop an operation on
  115. *
  116. * Note: this asserts @func was previously started
  117. *
  118. * Return: None
  119. */
  120. #define dsc_vdev_op_stop(vdev) _dsc_vdev_op_stop(vdev, __func__)
  121. void _dsc_vdev_op_stop(struct dsc_vdev *vdev, const char *func);
  122. /**
  123. * dsc_vdev_wait_for_ops() - blocks until all operations on @vdev have stopped
  124. * @vdev: the vdev to wait for operations on
  125. *
  126. * Note: this asserts that @vdev cannot currently transition
  127. *
  128. * Return: None
  129. */
  130. void dsc_vdev_wait_for_ops(struct dsc_vdev *vdev);
  131. #endif /* __WLAN_DSC_VDEV_H */