cdp_txrx_ppe.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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_update_dev_stats() - Update dev stats for PPE-DS mode.
  44. * @soc: data path soc handle
  45. * @vp_params: VP params
  46. * @vdev_id: vdev id
  47. * @stats: stats pointer from ppe
  48. *
  49. * return: void
  50. */
  51. static inline
  52. void cdp_ppesds_update_dev_stats(struct cdp_soc_t *soc,
  53. struct cdp_ds_vp_params *vp_params,
  54. uint16_t vdev_id, void *stats)
  55. {
  56. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  57. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  58. "%s invalid instance", __func__);
  59. return;
  60. }
  61. if (soc->ops->ppeds_ops->ppeds_stats_sync)
  62. return soc->ops->ppeds_ops->ppeds_stats_sync(soc,
  63. vdev_id,
  64. vp_params,
  65. stats);
  66. }
  67. /**
  68. * cdp_ppesds_entry_attach() - attach the ppe vp interface.
  69. * @soc: data path soc handle
  70. * @vdev_id: vdev id
  71. * @vpai: PPE VP opaque
  72. * @ppe_vp_num: Allocated VP Port number
  73. * @vp_params: VP params
  74. *
  75. * return: qdf_status where vp entry got allocated or not.
  76. */
  77. static inline
  78. QDF_STATUS cdp_ppesds_entry_attach(struct cdp_soc_t *soc, uint8_t vdev_id,
  79. void *vpai, int32_t *ppe_vp_num,
  80. struct cdp_ds_vp_params *vp_params)
  81. {
  82. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  83. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  84. "%s invalid instance", __func__);
  85. return QDF_STATUS_E_NOSUPPORT;
  86. }
  87. if (soc->ops->ppeds_ops->ppeds_entry_attach)
  88. return soc->ops->ppeds_ops->ppeds_entry_attach(soc, vdev_id,
  89. vpai,
  90. ppe_vp_num,
  91. vp_params);
  92. return QDF_STATUS_E_INVAL;
  93. }
  94. /**
  95. * cdp_ppesds_entry_detach() - Detach the PPE VP interface.
  96. * @soc: data path soc handle
  97. * @vdev_id: vdev ID
  98. * @vp_params: VP params
  99. *
  100. * return: void
  101. */
  102. static inline
  103. void cdp_ppesds_entry_detach(struct cdp_soc_t *soc, uint8_t vdev_id,
  104. struct cdp_ds_vp_params *vp_params)
  105. {
  106. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  107. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  108. "%s invalid instance", __func__);
  109. return;
  110. }
  111. if (soc->ops->ppeds_ops->ppeds_entry_detach)
  112. return soc->ops->ppeds_ops->ppeds_entry_detach(soc,
  113. vdev_id,
  114. vp_params);
  115. }
  116. /**
  117. * cdp_ppeds_attached() - Check whether ppeds attached
  118. * @soc: data path soc handle
  119. *
  120. * return: true for ppeds attached otherwise false.
  121. */
  122. static inline
  123. QDF_STATUS cdp_ppeds_attached(struct cdp_soc_t *soc)
  124. {
  125. if (!soc || !soc->ops || !soc->ops->ppeds_ops)
  126. return false;
  127. return true;
  128. }
  129. /**
  130. * cdp_ppesds_set_int_pri2tid() - Set the INT_PRI to TID
  131. * @soc: data path soc handle
  132. * @pri2tid: PRI2TID table
  133. *
  134. * return: void
  135. */
  136. static inline
  137. void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc,
  138. uint8_t *pri2tid)
  139. {
  140. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  141. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  142. "%s invalid instance", __func__);
  143. return;
  144. }
  145. if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid)
  146. return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid);
  147. }
  148. /**
  149. * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID
  150. * @soc: data path soc handle
  151. * @pri: Priority index
  152. * @tid: TID mapped to the input priority
  153. *
  154. * return: void
  155. */
  156. static inline
  157. void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc,
  158. uint8_t pri, uint8_t tid)
  159. {
  160. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  161. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  162. "%s invalid instance", __func__);
  163. }
  164. if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid)
  165. return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri,
  166. tid);
  167. }
  168. /**
  169. * cdp_ppesds_entry_dump() - Dump the PPE VP entries
  170. * @soc: data path soc handle
  171. *
  172. * return: void
  173. */
  174. static inline
  175. void cdp_ppesds_entry_dump(struct cdp_soc_t *soc)
  176. {
  177. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  178. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  179. "%s invalid instance", __func__);
  180. return;
  181. }
  182. if (soc->ops->ppeds_ops->ppeds_entry_dump)
  183. soc->ops->ppeds_ops->ppeds_entry_dump(soc);
  184. }
  185. /**
  186. * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table
  187. * @soc: data path soc handle
  188. * @vdev_id: vdev id
  189. * @val: Boolean value to enable/disable
  190. *
  191. * return: QDF_STATUS
  192. */
  193. static inline
  194. QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc,
  195. uint8_t vdev_id, bool val)
  196. {
  197. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  198. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  199. "%s invalid instance", __func__);
  200. return QDF_STATUS_E_INVAL;
  201. }
  202. if (soc->ops->ppeds_ops->ppeds_enable_pri2tid)
  203. return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id,
  204. val);
  205. return QDF_STATUS_E_NOSUPPORT;
  206. }
  207. #endif /* _CDP_TXRX_PPE_H_ */