dp_htt.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * Copyright (c) 2016-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. #ifndef _DP_HTT_H_
  19. #define _DP_HTT_H_
  20. #include <qdf_types.h>
  21. #include <qdf_lock.h>
  22. #include <qdf_nbuf.h>
  23. #include <htc_api.h>
  24. #define HTT_TX_MUTEX_TYPE qdf_spinlock_t
  25. #define HTT_TX_MUTEX_INIT(_mutex) \
  26. qdf_spinlock_create(_mutex)
  27. #define HTT_TX_MUTEX_ACQUIRE(_mutex) \
  28. qdf_spin_lock_bh(_mutex)
  29. #define HTT_TX_MUTEX_RELEASE(_mutex) \
  30. qdf_spin_unlock_bh(_mutex)
  31. #define HTT_TX_MUTEX_DESTROY(_mutex) \
  32. qdf_spinlock_destroy(_mutex)
  33. #define DP_HTT_MAX_SEND_QUEUE_DEPTH 64
  34. #ifndef HTT_MAC_ADDR_LEN
  35. #define HTT_MAC_ADDR_LEN 6
  36. #endif
  37. #define DP_HTT_HTC_PKT_MISCLIST_SIZE 256
  38. #define HTT_T2H_EXT_STATS_TLV_START_OFFSET 3
  39. struct dp_htt_htc_pkt {
  40. void *soc_ctxt;
  41. qdf_dma_addr_t nbuf_paddr;
  42. HTC_PACKET htc_pkt;
  43. };
  44. struct dp_htt_htc_pkt_union {
  45. union {
  46. struct dp_htt_htc_pkt pkt;
  47. struct dp_htt_htc_pkt_union *next;
  48. } u;
  49. };
  50. struct htt_soc {
  51. void *ctrl_psoc;
  52. void *dp_soc;
  53. void *hal_soc;
  54. HTC_HANDLE htc_soc;
  55. qdf_device_t osdev;
  56. HTC_ENDPOINT_ID htc_endpoint;
  57. struct dp_htt_htc_pkt_union *htt_htc_pkt_freelist;
  58. struct dp_htt_htc_pkt_union *htt_htc_pkt_misclist;
  59. struct {
  60. u_int8_t major;
  61. u_int8_t minor;
  62. } tgt_ver;
  63. struct {
  64. u_int8_t major;
  65. u_int8_t minor;
  66. } wifi_ip_ver;
  67. struct {
  68. int htc_err_cnt;
  69. int htc_pkt_free;
  70. } stats;
  71. HTT_TX_MUTEX_TYPE htt_tx_mutex;
  72. };
  73. /**
  74. * struct htt_rx_ring_tlv_filter - Rx ring TLV filter
  75. * enable/disable.
  76. * @mpdu_start: enable/disable MPDU start TLV
  77. * @msdu_start: enable/disable MSDU start TLV
  78. * @packet: enable/disable PACKET TLV
  79. * @msdu_end: enable/disable MSDU end TLV
  80. * @mpdu_end: enable/disable MPDU end TLV
  81. * @packet_header: enable/disable PACKET header TLV
  82. * @attention: enable/disable ATTENTION TLV
  83. * @ppdu_start: enable/disable PPDU start TLV
  84. * @ppdu_end: enable/disable PPDU end TLV
  85. * @ppdu_end_user_stats: enable/disable PPDU user stats TLV
  86. * @ppdu_end_user_stats_ext: enable/disable PPDU user stats ext TLV
  87. * @ppdu_end_status_done: enable/disable PPDU end status done TLV
  88. * @enable_fp: enable/disable FP packet
  89. * @enable_md: enable/disable MD packet
  90. * @enable_mo: enable/disable MO packet
  91. * @enable_mgmt: enable/disable MGMT packet
  92. * @enable_ctrl: enable/disable CTRL packet
  93. * @enable_data: enable/disable DATA packet
  94. */
  95. struct htt_rx_ring_tlv_filter {
  96. u_int32_t mpdu_start:1,
  97. msdu_start:1,
  98. packet:1,
  99. msdu_end:1,
  100. mpdu_end:1,
  101. packet_header:1,
  102. attention:1,
  103. ppdu_start:1,
  104. ppdu_end:1,
  105. ppdu_end_user_stats:1,
  106. ppdu_end_user_stats_ext:1,
  107. ppdu_end_status_done:1,
  108. header_per_msdu:1,
  109. enable_fp:1,
  110. enable_md:1,
  111. enable_mo:1;
  112. u_int32_t fp_mgmt_filter:16,
  113. mo_mgmt_filter:16;
  114. u_int32_t fp_ctrl_filter:16,
  115. mo_ctrl_filter:16;
  116. u_int32_t fp_data_filter:16,
  117. mo_data_filter:16;
  118. };
  119. void *
  120. htt_soc_attach(void *txrx_soc, void *ctrl_psoc, HTC_HANDLE htc_soc,
  121. void *hal_soc, qdf_device_t osdev);
  122. void htt_soc_detach(void *soc);
  123. int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
  124. int hal_ring_type);
  125. int htt_soc_attach_target(void *htt_soc);
  126. /*
  127. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  128. * config message to target
  129. * @htt_soc: HTT SOC handle
  130. * @pdev_id: PDEV Id
  131. * @hal_srng: Opaque HAL SRNG pointer
  132. * @hal_ring_type: SRNG ring type
  133. * @ring_buf_size: SRNG buffer size
  134. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  135. *
  136. * Return: 0 on success; error code on failure
  137. */
  138. int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
  139. int hal_ring_type, int ring_buf_size,
  140. struct htt_rx_ring_tlv_filter *htt_tlv_filter);
  141. /*
  142. * htt_t2h_stats_handler() - target to host stats work handler
  143. * @context: context (dp soc context)
  144. *
  145. * Return: void
  146. */
  147. void htt_t2h_stats_handler(void *context);
  148. /**
  149. * struct htt_stats_context - htt stats information
  150. * @soc: Size of each descriptor in the pool
  151. * @msg: T2H Ext stats message queue
  152. * @msg_len: T2H Ext stats message length
  153. */
  154. struct htt_stats_context {
  155. struct dp_soc *soc;
  156. qdf_nbuf_queue_t msg;
  157. uint32_t msg_len;
  158. };
  159. #endif /* _DP_HTT_H_ */