wlan_dsc_vdev.h 4.6 KB

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