cdp_txrx_ppe.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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_ppesds_set_int_pri2tid() - Set the INT_PRI to TID
  118. * @soc: data path soc handle
  119. * @pri2tid: PRI2TID table
  120. *
  121. * return: void
  122. */
  123. static inline
  124. void cdp_ppesds_set_int_pri2tid(struct cdp_soc_t *soc,
  125. uint8_t *pri2tid)
  126. {
  127. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  128. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  129. "%s invalid instance", __func__);
  130. return;
  131. }
  132. if (soc->ops->ppeds_ops->ppeds_set_int_pri2tid)
  133. return soc->ops->ppeds_ops->ppeds_set_int_pri2tid(soc, pri2tid);
  134. }
  135. /**
  136. * cdp_ppesds_update_int_pri2tid() - Update the INT_PRI to TID
  137. * @soc: data path soc handle
  138. * @pri: Priority index
  139. * @tid: TID mapped to the input priority
  140. *
  141. * return: void
  142. */
  143. static inline
  144. void cdp_ppesds_update_int_pri2tid(struct cdp_soc_t *soc,
  145. uint8_t pri, uint8_t tid)
  146. {
  147. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  148. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  149. "%s invalid instance", __func__);
  150. }
  151. if (soc->ops->ppeds_ops->ppeds_update_int_pri2tid)
  152. return soc->ops->ppeds_ops->ppeds_update_int_pri2tid(soc, pri,
  153. tid);
  154. }
  155. /**
  156. * cdp_ppesds_entry_dump() - Dump the PPE VP entries
  157. * @soc: data path soc handle
  158. *
  159. * return: void
  160. */
  161. static inline
  162. void cdp_ppesds_entry_dump(struct cdp_soc_t *soc)
  163. {
  164. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  165. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  166. "%s invalid instance", __func__);
  167. return;
  168. }
  169. if (soc->ops->ppeds_ops->ppeds_entry_dump)
  170. soc->ops->ppeds_ops->ppeds_entry_dump(soc);
  171. }
  172. /**
  173. * cdp_ppesds_enable_pri2tid() - Enable PPE VP PRI2TID table
  174. * @soc: data path soc handle
  175. * @vdev_id: vdev id
  176. * @val: Boolean value to enable/disable
  177. *
  178. * return: QDF_STATUS
  179. */
  180. static inline
  181. QDF_STATUS cdp_ppesds_enable_pri2tid(struct cdp_soc_t *soc,
  182. uint8_t vdev_id, bool val)
  183. {
  184. if (!soc || !soc->ops || !soc->ops->ppeds_ops) {
  185. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  186. "%s invalid instance", __func__);
  187. return QDF_STATUS_E_INVAL;
  188. }
  189. if (soc->ops->ppeds_ops->ppeds_enable_pri2tid)
  190. return soc->ops->ppeds_ops->ppeds_enable_pri2tid(soc, vdev_id,
  191. val);
  192. return QDF_STATUS_E_NOSUPPORT;
  193. }
  194. #endif /* _CDP_TXRX_PPE_H_ */