cdp_txrx_ppe.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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. #ifndef _CDP_TXRX_PPE_H_
  17. #define _CDP_TXRX_PPE_H_
  18. /**
  19. * cdp_ppesds_vp_setup_fw_recovery() - Setup DS VP on FW recovery.
  20. * @soc: data path soc handle
  21. * @vdev_id: vdev id
  22. * @profile_idx: DS profile index.
  23. *
  24. * return: qdf_status where DS VP setup is done or not.
  25. */
  26. static inline
  27. QDF_STATUS cdp_ppesds_vp_setup_fw_recovery(struct cdp_soc_t *soc,
  28. uint8_t vdev_id,
  29. uint16_t profile_idx)
  30. {
  31. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  32. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  33. "%s invalid instance", __func__);
  34. return QDF_STATUS_E_NOSUPPORT;
  35. }
  36. if (soc->ops->ppeds_ops->ppeds_vp_setup_recovery)
  37. return soc->ops->ppeds_ops->ppeds_vp_setup_recovery(soc,
  38. vdev_id,
  39. profile_idx);
  40. return QDF_STATUS_E_INVAL;
  41. }
  42. /**
  43. * cdp_ppesds_entry_attach() - attach the ppe vp interface.
  44. * @soc: data path soc handle
  45. * @vdev_id: vdev id
  46. * @vpai: PPE VP opaque
  47. * @ppe_vp_num: Allocated VP Port number
  48. * @vp_params: VP params
  49. *
  50. * return: qdf_status where vp entry got allocated or not.
  51. */
  52. static inline
  53. QDF_STATUS cdp_ppesds_entry_attach(struct cdp_soc_t *soc, uint8_t vdev_id,
  54. void *vpai, int32_t *ppe_vp_num,
  55. struct cdp_ds_vp_params *vp_params)
  56. {
  57. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  58. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  59. "%s invalid instance", __func__);
  60. return QDF_STATUS_E_NOSUPPORT;
  61. }
  62. if (soc->ops->ppeds_ops->ppeds_entry_attach)
  63. return soc->ops->ppeds_ops->ppeds_entry_attach(soc, vdev_id,
  64. vpai,
  65. ppe_vp_num,
  66. vp_params);
  67. return QDF_STATUS_E_INVAL;
  68. }
  69. /**
  70. * cdp_ppesds_entry_detach() - Detach the PPE VP interface.
  71. * @soc: data path soc handle
  72. * @vdev_id: vdev ID
  73. * @vp_params: VP params
  74. *
  75. * return: void
  76. */
  77. static inline
  78. void cdp_ppesds_entry_detach(struct cdp_soc_t *soc, uint8_t vdev_id,
  79. struct cdp_ds_vp_params *vp_params)
  80. {
  81. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  82. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  83. "%s invalid instance", __func__);
  84. return;
  85. }
  86. if (soc->ops->ppeds_ops->ppeds_entry_detach)
  87. return soc->ops->ppeds_ops->ppeds_entry_detach(soc,
  88. vdev_id,
  89. vp_params);
  90. }
  91. /**
  92. * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID
  93. * @soc: data path soc handle
  94. * @pri2tid: PRI2TID table
  95. *
  96. * return: void
  97. */
  98. static inline
  99. void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc,
  100. uint8_t *pri2tid)
  101. {
  102. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  103. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  104. "%s invalid instance", __func__);
  105. return;
  106. }
  107. if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid)
  108. return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid);
  109. }
  110. /**
  111. * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID
  112. * @soc: data path soc handle
  113. * @pri: Priority index
  114. * @tid: TID mapped to the input priority
  115. *
  116. * return: void
  117. */
  118. static inline
  119. void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc,
  120. uint8_t pri, uint8_t tid)
  121. {
  122. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  123. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  124. "%s invalid instance", __func__);
  125. }
  126. if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid)
  127. return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri,
  128. tid);
  129. }
  130. /**
  131. * cdp_ppesds_entry_dump() - Dump the PPE VP entries
  132. * @soc: data path soc handle
  133. *
  134. * return: void
  135. */
  136. static inline
  137. void cdp_ppesds_entry_dump(struct cdp_soc_t *soc)
  138. {
  139. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  140. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  141. "%s invalid instance", __func__);
  142. return;
  143. }
  144. if (soc->ops->ppeds_ops->ppeds_entry_dump)
  145. soc->ops->ppeds_ops->ppeds_entry_dump(soc);
  146. }
  147. /**
  148. * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table
  149. * @soc: data path soc handle
  150. * @vdev_id: vdev id
  151. * @val: Boolean value to enable/disable
  152. *
  153. * return: QDF_STATUS
  154. */
  155. static inline
  156. QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc,
  157. uint8_t vdev_id, bool val)
  158. {
  159. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  160. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  161. "%s invalid instance", __func__);
  162. return QDF_STATUS_E_INVAL;
  163. }
  164. if (soc->ops->ppeds_ops->ppeds_enable_pri2tid)
  165. return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id,
  166. val);
  167. return QDF_STATUS_E_NOSUPPORT;
  168. }
  169. #endif /* _CDP_TXRX_PPE_H_ */