dp_htt.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (c) 2016-2017 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. struct dp_htt_htc_pkt {
  38. void *soc_ctxt;
  39. qdf_dma_addr_t nbuf_paddr;
  40. HTC_PACKET htc_pkt;
  41. };
  42. struct dp_htt_htc_pkt_union {
  43. union {
  44. struct dp_htt_htc_pkt pkt;
  45. struct dp_htt_htc_pkt_union *next;
  46. } u;
  47. };
  48. struct htt_soc {
  49. void *osif_soc;
  50. void *dp_soc;
  51. void *hal_soc;
  52. HTC_HANDLE htc_soc;
  53. qdf_device_t osdev;
  54. HTC_ENDPOINT_ID htc_endpoint;
  55. struct dp_htt_htc_pkt_union *htt_htc_pkt_freelist;
  56. struct {
  57. u_int8_t major;
  58. u_int8_t minor;
  59. } tgt_ver;
  60. struct {
  61. u_int8_t major;
  62. u_int8_t minor;
  63. } wifi_ip_ver;
  64. struct {
  65. int htc_err_cnt;
  66. } stats;
  67. HTT_TX_MUTEX_TYPE htt_tx_mutex;
  68. };
  69. /**
  70. * struct htt_rx_ring_tlv_filter - Rx ring TLV filter
  71. * enable/disable.
  72. * @mpdu_start: enable/disable MPDU start TLV
  73. * @msdu_start: enable/disable MSDU start TLV
  74. * @packet: enable/disable PACKET TLV
  75. * @msdu_end: enable/disable MSDU end TLV
  76. * @mpdu_end: enable/disable MPDU end TLV
  77. * @packet_header: enable/disable PACKET header TLV
  78. * @attention: enable/disable ATTENTION TLV
  79. * @ppdu_start: enable/disable PPDU start TLV
  80. * @ppdu_end: enable/disable PPDU end TLV
  81. * @ppdu_end_user_stats: enable/disable PPDU user stats TLV
  82. * @ppdu_end_user_stats_ext: enable/disable PPDU user stats ext TLV
  83. * @ppdu_end_status_done: enable/disable PPDU end status done TLV
  84. * @enable_fp: enable/disable FP packet
  85. * @enable_md: enable/disable MD packet
  86. * @enable_mo: enable/disable MO packet
  87. */
  88. struct htt_rx_ring_tlv_filter {
  89. u_int32_t mpdu_start:1,
  90. msdu_start:1,
  91. packet:1,
  92. msdu_end:1,
  93. mpdu_end:1,
  94. packet_header:1,
  95. attention:1,
  96. ppdu_start:1,
  97. ppdu_end:1,
  98. ppdu_end_user_stats:1,
  99. ppdu_end_user_stats_ext:1,
  100. ppdu_end_status_done:1,
  101. enable_fp:1,
  102. enable_md:1,
  103. enable_mo:1;
  104. };
  105. void *
  106. htt_soc_attach(void *txrx_soc, void *osif_soc, HTC_HANDLE htc_soc,
  107. void *hal_soc, qdf_device_t osdev);
  108. void htt_soc_detach(void *soc);
  109. int htt_srng_setup(void *htt_soc, int pdev_id, void *hal_srng,
  110. int hal_ring_type);
  111. int htt_soc_attach_target(void *htt_soc);
  112. /*
  113. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  114. * config message to target
  115. * @htt_soc: HTT SOC handle
  116. * @pdev_id: PDEV Id
  117. * @hal_srng: Opaque HAL SRNG pointer
  118. * @hal_ring_type: SRNG ring type
  119. * @ring_buf_size: SRNG buffer size
  120. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  121. *
  122. * Return: 0 on success; error code on failure
  123. */
  124. int htt_h2t_rx_ring_cfg(void *htt_soc, int pdev_id, void *hal_srng,
  125. int hal_ring_type, int ring_buf_size,
  126. struct htt_rx_ring_tlv_filter *htt_tlv_filter);
  127. #endif /* _DP_HTT_H_ */