dp_htt.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932
  1. /*
  2. * Copyright (c) 2016-2021 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. #include "cdp_txrx_cmn_struct.h"
  25. #include "dp_types.h"
  26. #ifdef HTT_LOGGER
  27. #include "dp_htt_logger.h"
  28. #else
  29. struct htt_logger;
  30. static inline
  31. void htt_interface_logging_init(struct htt_logger **htt_logger_handle,
  32. struct cdp_ctrl_objmgr_psoc *ctrl_psoc)
  33. {
  34. }
  35. static inline
  36. void htt_interface_logging_deinit(struct htt_logger *htt_logger_handle)
  37. {
  38. }
  39. static inline
  40. int htt_command_record(struct htt_logger *h, uint8_t msg_type,
  41. uint8_t *msg_data)
  42. {
  43. return 0;
  44. }
  45. static inline
  46. int htt_event_record(struct htt_logger *h, uint8_t msg_type,
  47. uint8_t *msg_data)
  48. {
  49. return 0;
  50. }
  51. static inline
  52. int htt_wbm_event_record(struct htt_logger *h, uint8_t tx_status,
  53. uint8_t *msg_data)
  54. {
  55. return 0;
  56. }
  57. #endif
  58. void htt_htc_pkt_pool_free(struct htt_soc *soc);
  59. #define HTT_TX_MUTEX_TYPE qdf_spinlock_t
  60. #define HTT_TX_MUTEX_INIT(_mutex) \
  61. qdf_spinlock_create(_mutex)
  62. #define HTT_TX_MUTEX_ACQUIRE(_mutex) \
  63. qdf_spin_lock_bh(_mutex)
  64. #define HTT_TX_MUTEX_RELEASE(_mutex) \
  65. qdf_spin_unlock_bh(_mutex)
  66. #define HTT_TX_MUTEX_DESTROY(_mutex) \
  67. qdf_spinlock_destroy(_mutex)
  68. #define DP_HTT_MAX_SEND_QUEUE_DEPTH 64
  69. #ifndef HTT_MAC_ADDR_LEN
  70. #define HTT_MAC_ADDR_LEN 6
  71. #endif
  72. #define HTT_FRAMECTRL_TYPE_MASK 0x0C
  73. #define HTT_GET_FRAME_CTRL_TYPE(_val) \
  74. (((_val) & HTT_FRAMECTRL_TYPE_MASK) >> 2)
  75. #define FRAME_CTRL_TYPE_MGMT 0x0
  76. #define FRAME_CTRL_TYPE_CTRL 0x1
  77. #define FRAME_CTRL_TYPE_DATA 0x2
  78. #define FRAME_CTRL_TYPE_RESV 0x3
  79. #define HTT_FRAMECTRL_DATATYPE 0x08
  80. #define HTT_PPDU_DESC_MAX_DEPTH 16
  81. #define DP_SCAN_PEER_ID 0xFFFF
  82. #define HTT_RX_DELBA_WIN_SIZE_M 0x0000FC00
  83. #define HTT_RX_DELBA_WIN_SIZE_S 10
  84. #define HTT_RX_DELBA_WIN_SIZE_GET(word) \
  85. (((word) & HTT_RX_DELBA_WIN_SIZE_M) >> HTT_RX_DELBA_WIN_SIZE_S)
  86. /*
  87. * Set the base misclist size to HTT copy engine source ring size
  88. * to guarantee that a packet on the misclist wont be freed while it
  89. * is sitting in the copy engine.
  90. */
  91. #define DP_HTT_HTC_PKT_MISCLIST_SIZE 2048
  92. #define HTT_T2H_MAX_MSG_SIZE 2048
  93. #define HTT_T2H_EXT_STATS_TLV_START_OFFSET 3
  94. /*
  95. * Below offset are based on htt_ppdu_stats_common_tlv
  96. * defined in htt_ppdu_stats.h
  97. */
  98. #define HTT_PPDU_STATS_COMMON_TLV_TLV_HDR_OFFSET 0
  99. #define HTT_PPDU_STATS_COMMON_TLV_PPDU_ID_OFFSET 1
  100. #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_SCH_CMD_ID_OFFSET 2
  101. #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_FRM_TYPE_OFFSET 3
  102. #define HTT_PPDU_STATS_COMMON_TLV_CHAIN_MASK_OFFSET 4
  103. #define HTT_PPDU_STATS_COMMON_TLV_FES_DUR_US_OFFSET 5
  104. #define HTT_PPDU_STATS_COMMON_TLV_SCH_EVAL_START_TSTMP_L32_US_OFFSET 6
  105. #define HTT_PPDU_STATS_COMMON_TLV_SCH_END_TSTMP_US_OFFSET 7
  106. #define HTT_PPDU_STATS_COMMON_TLV_START_TSTMP_L32_US_OFFSET 8
  107. #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_PHY_MODE_OFFSET 9
  108. #define HTT_PPDU_STATS_COMMON_TLV_CCA_DELTA_TIME_US_OFFSET 10
  109. #define HTT_PPDU_STATS_COMMON_TLV_RXFRM_DELTA_TIME_US_OFFSET 11
  110. #define HTT_PPDU_STATS_COMMON_TLV_TXFRM_DELTA_TIME_US_OFFSET 12
  111. #define HTT_PPDU_STATS_COMMON_TLV_RESV_NUM_UL_BEAM_OFFSET 13
  112. #define HTT_PPDU_STATS_COMMON_TLV_START_TSTMP_U32_US_OFFSET 14
  113. #define HTT_PPDU_STATS_COMMON_TLV_BSSCOLOR_OBSS_PSR_OFFSET 15
  114. /* get index for field in htt_ppdu_stats_common_tlv */
  115. #define HTT_GET_STATS_CMN_INDEX(index) \
  116. HTT_PPDU_STATS_COMMON_TLV_##index##_OFFSET
  117. #define HTT_VDEV_STATS_TLV_SOC_DROP_CNT_OFFSET 1
  118. #define HTT_VDEV_STATS_TLV_HDR_OFFSET 0
  119. #define HTT_VDEV_STATS_TLV_VDEV_ID_OFFSET 1
  120. #define HTT_VDEV_STATS_TLV_RX_BYTE_CNT_OFFSET 2
  121. #define HTT_VDEV_STATS_TLV_RX_PKT_CNT_OFFSET 4
  122. #define HTT_VDEV_STATS_TLV_TX_SUCCESS_BYTE_CNT_OFFSET 6
  123. #define HTT_VDEV_STATS_TLV_TX_SUCCESS_PKT_CNT_OFFSET 8
  124. #define HTT_VDEV_STATS_TLV_TX_RETRY_BYTE_CNT_OFFSET 10
  125. #define HTT_VDEV_STATS_TLV_TX_RETRY_PKT_CNT_OFFSET 12
  126. #define HTT_VDEV_STATS_TLV_TX_DROP_BYTE_CNT_OFFSET 14
  127. #define HTT_VDEV_STATS_TLV_TX_DROP_PKT_CNT_OFFSET 16
  128. #define HTT_VDEV_STATS_TLV_TX_AGE_OUT_BYTE_CNT_OFFSET 18
  129. #define HTT_VDEV_STATS_TLV_TX_AGE_OUT_PKT_CNT_OFFSET 20
  130. #define HTT_VDEV_STATS_GET_INDEX(index) \
  131. HTT_VDEV_STATS_TLV_##index##_OFFSET
  132. #define HTT_VDEV_STATS_U32_SHIFT 0x20
  133. #define HTT_VDEV_STATS_U32_MASK 0xFFFFFFFF00000000
  134. #define HTT_VDEV_STATS_L32_MASK 0x00000000FFFFFFFF
  135. #define HTT_VDEV_GET_STATS_U64(msg_word) \
  136. (((((uint64_t)(*(((uint32_t *)msg_word) + 1))) & HTT_VDEV_STATS_L32_MASK) << \
  137. HTT_VDEV_STATS_U32_SHIFT) | ((*(uint32_t *)msg_word) & HTT_VDEV_STATS_L32_MASK))
  138. #define HTT_VDEV_GET_STATS_U32(msg_word) \
  139. ((*(uint32_t *)msg_word) & HTT_VDEV_STATS_L32_MASK)
  140. #define MAX_SCHED_STARVE 100000
  141. #define WRAP_DROP_TSF_DELTA 10000
  142. #define MAX_TSF_32 0xFFFFFFFF
  143. #define dp_htt_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_HTT, params)
  144. #define dp_htt_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_HTT, params)
  145. #define dp_htt_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_HTT, params)
  146. #define dp_htt_info(params...) \
  147. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_HTT, ## params)
  148. #define dp_htt_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_HTT, params)
  149. #define dp_htt_tx_stats_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  150. #define dp_htt_tx_stats_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  151. #define dp_htt_tx_stats_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  152. #define dp_htt_tx_stats_info(params...) \
  153. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_HTT_TX_STATS, ## params)
  154. #define dp_htt_tx_stats_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  155. /**
  156. * enum dp_full_mon_config - enum to enable/disable full monitor mode
  157. *
  158. * @DP_FULL_MON_DISABLE: Disable full monitor mode
  159. * @DP_FULL_MON_ENABLE: Enable full monitor mode
  160. */
  161. enum dp_full_mon_config {
  162. DP_FULL_MON_DISABLE,
  163. DP_FULL_MON_ENABLE,
  164. };
  165. struct dp_htt_htc_pkt {
  166. void *soc_ctxt;
  167. qdf_dma_addr_t nbuf_paddr;
  168. HTC_PACKET htc_pkt;
  169. };
  170. struct dp_htt_htc_pkt_union {
  171. union {
  172. struct dp_htt_htc_pkt pkt;
  173. struct dp_htt_htc_pkt_union *next;
  174. } u;
  175. };
  176. struct dp_htt_timestamp {
  177. long *umac_ttt;
  178. long *lmac_ttt;
  179. };
  180. struct htt_soc {
  181. struct cdp_ctrl_objmgr_psoc *ctrl_psoc;
  182. struct dp_soc *dp_soc;
  183. hal_soc_handle_t hal_soc;
  184. struct dp_htt_timestamp pdevid_tt[MAX_PDEV_CNT];
  185. /* htt_logger handle */
  186. struct htt_logger *htt_logger_handle;
  187. HTC_HANDLE htc_soc;
  188. qdf_device_t osdev;
  189. HTC_ENDPOINT_ID htc_endpoint;
  190. struct dp_htt_htc_pkt_union *htt_htc_pkt_freelist;
  191. struct dp_htt_htc_pkt_union *htt_htc_pkt_misclist;
  192. struct {
  193. u_int8_t major;
  194. u_int8_t minor;
  195. } tgt_ver;
  196. struct {
  197. u_int8_t major;
  198. u_int8_t minor;
  199. } wifi_ip_ver;
  200. struct {
  201. int htc_err_cnt;
  202. int htc_pkt_free;
  203. int skip_count;
  204. int fail_count;
  205. /* rtpm put skip count for ver req msg */
  206. int htt_ver_req_put_skip;
  207. } stats;
  208. HTT_TX_MUTEX_TYPE htt_tx_mutex;
  209. };
  210. #ifdef QCA_MONITOR_2_0_SUPPORT
  211. /**
  212. * struct dp_tx_mon_downstream_tlv_config - Enable/Disable TxMon
  213. * downstream TLVs
  214. * tx_fes_setup: TX_FES_SETUP TLV
  215. * tx_peer_entry: TX_PEER_ENTRY TLV
  216. * tx_queue_extension: TX_QUEUE_EXTENSION TLV
  217. * tx_last_mpdu_end: TX_LAST_MPDU_END TLV
  218. * tx_last_mpdu_fetched: TX_LAST_MPDU_FETCHED TLV
  219. * tx_data_sync: TX_DATA_SYNC TLV
  220. * pcu_ppdu_setup_init: PCU_PPDU_SETUP_INIT TLV
  221. * fw2s_mon: FW2S_MON TLV
  222. * tx_loopback_setup: TX_LOOPBACK_SETUP TLV
  223. * sch_critical_tlv_ref: SCH_CRITICAL_TLV_REF TLV
  224. * ndp_preamble_done: NDP_PREAMBLE_DONE TLV
  225. * tx_raw_frame_setup: TX_RAW_OR_NATIVE_FRAME_SETUP TLV
  226. * txpcu_user_setup: TXPCU_USER_SETUP TLV
  227. * rxpcu_setup: RXPCU_SETUP TLV
  228. * rxpcu_setup_complete: RXPCU_SETUP_COMPLETE TLV
  229. * coex_tx_req: COEX_TX_REQ TLV
  230. * rxpcu_user_setup: RXPCU_USER_SETUP TLV
  231. * rxpcu_user_setup_ext: RXPCU_USER_SETUP_EXT TLV
  232. * wur_data: WUR_DATA TLV
  233. * tqm_mpdu_global_start: TQM_MPDU_GLOBAL_START
  234. * tx_fes_setup_complete: TX_FES_SETUP_COMPLETE TLV
  235. * scheduler_end: SCHEDULER_END TLV
  236. * sch_wait_instr_tx_path: SCH_WAIT_INSTR_TX_PATH TLV
  237. *
  238. */
  239. struct dp_tx_mon_downstream_tlv_config {
  240. uint32_t tx_fes_setup:1,
  241. tx_peer_entry:1,
  242. tx_queue_extension:1,
  243. tx_last_mpdu_end:1,
  244. tx_last_mpdu_fetched:1,
  245. tx_data_sync:1,
  246. pcu_ppdu_setup_init:1,
  247. fw2s_mon:1,
  248. tx_loopback_setup:1,
  249. sch_critical_tlv_ref:1,
  250. ndp_preamble_done:1,
  251. tx_raw_frame_setup:1,
  252. txpcu_user_setup:1,
  253. rxpcu_setup:1,
  254. rxpcu_setup_complete:1,
  255. coex_tx_req:1,
  256. rxpcu_user_setup:1,
  257. rxpcu_user_setup_ext:1,
  258. wur_data:1,
  259. tqm_mpdu_global_start:1,
  260. tx_fes_setup_complete:1,
  261. scheduler_end:1,
  262. sch_wait_instr_tx_path:1;
  263. };
  264. /**
  265. * struct dp_tx_mon_upstream_tlv_config - Enable/Disable TxMon
  266. * upstream TLVs
  267. * rx_response_required_info: RX_RESPONSE_REQUIRED_INFO
  268. * TLV
  269. * response_start_status: RESPONSE_START_STATUS TLV
  270. * response_end_status: RESPONSE_END_STATUS TLV
  271. * tx_fes_status_start: TX_FES_STATUS_START TLV
  272. * tx_fes_status_start_ppdu: TX_FES_STATUS_START_PPDU TLV
  273. * tx_fes_status_user_ppdu: TX_FES_STATUS_USER_PPDU TLV
  274. * tx_fes_status_ack_or_ba: TX_FES_STATUS_ACK_OR_BA TLV
  275. * tx_fes_status_1k_ba: TX_FES_STATUS_1K_BA TLV
  276. * tx_fes_status_start_prot: TX_FES_STATUS_START_PROTO TLV
  277. * tx_fes_status_user_response: TX_FES_STATUS_USER_RESPONSE TLV
  278. * rx_frame_bitmap_ack: RX_FRAME_BITMAP_ACK TLV
  279. * rx_frame_1k_bitmap_ack: RX_FRAME_1K_BITMAP_ACK TLV
  280. * coex_tx_status: COEX_TX_STATUS TLV
  281. * recevied_response_info: RECEIVED_RESPONSE_INFO TLV
  282. * recevied_response_info_p2: RECEIVED_RESPONSE_INFO_PART2 TLV
  283. * ofdma_trigger_details: OFDMA_TRIGGER_DETAILS
  284. * recevied_trigger_info: RECEIVED_TRIGGER_INFO
  285. * pdg_tx_request: PDG_TX_REQUEST
  286. * pdg_response: PDG_RESPONSE
  287. * pdg_trig_response: PDG_TRIG_RESPONSE
  288. * trigger_response_tx_done: TRIGGER_RESPONSE_TX_DONE
  289. * prot_tx_end: PROT_TX_END
  290. * ppdu_tx_end: PPDU_TX_END
  291. * r2r_status_end: R2R_STATUS_END
  292. * flush_req: FLUSH_REQ
  293. * mactx_phy_desc: MACTX_PHY_DESC
  294. * mactx_user_desc_cmn: MACTX_USER_DESC_COMMON
  295. * mactx_user_desc_per_usr: MACTX_USER_DESC_PER_USER
  296. * tqm_acked_1k_mpdu: TQM_ACKED_1K_MPDU
  297. * tqm_acked_mpdu: TQM_ACKED_MPDU
  298. * tqm_update_tx_mpdu_count: TQM_UPDATE_TX_MPDU_COUNT
  299. * phytx_ppdu_header_info_request: PHYTX_PPDU_HEADER_INFO_REQUEST
  300. * u_sig_eht_su_mu: U_SIG_EHT_SU_MU
  301. * u_sig_eht_su: U_SIG_EHT_SU
  302. * eht_sig_usr_su: EHT_SIG_USR_SU
  303. * eht_sig_usr_mu_mimo: EHT_SIG_USR_MU_MIMO
  304. * eht_sig_usr_ofdma: EHT_SIG_USR_MU_MIMO
  305. * he_sig_a_su: HE_SIG_A_SU
  306. * he_sig_a_mu_dl: HE_SIG_A_MU_DL
  307. * he_sig_a_mu_ul: HE_SIG_A_MU_UL
  308. * he_sig_b1_mu: HE_SIG_B1_MU
  309. * he_sig_b2_mu: HE_SIG_B2_MU
  310. * he_sig_b2_ofdma: HE_SIG_B2_OFDMA
  311. * vht_sig_b_mu160: VHT_SIG_B_MU160
  312. * vht_sig_b_mu80: VHT_SIG_B_MU80
  313. * vht_sig_b_mu40: VHT_SIG_B_MU40
  314. * vht_sig_b_mu20: VHT_SIG_B_MU20
  315. * vht_sig_b_su160: VHT_SIG_B_SU160
  316. * vht_sig_b_su80: VHT_SIG_B_SU80
  317. * vht_sig_b_su40: VHT_SIG_B_SU40
  318. * vht_sig_b_su20: VHT_SIG_B_SU20
  319. * vht_sig_a: VHT_SIG_A
  320. * ht_sig: HT_SIG
  321. * l_sig_b: L_SIG_B
  322. * l_sig_a: L_SIG_A
  323. * tx_service: TX_SERVICE
  324. * txpcu_buf_status: TXPCU_BUFFER_STATUS
  325. * txpcu_user_buf_status: TXPCU_USER_BUFFER_STATUS
  326. * txdma_stop_request: TXDMA_STOP_REQUEST
  327. * expected_response: EXPECTED_RESPONSE
  328. * tx_mpdu_count_transfer_end: TX_MPDU_COUNT_TRANSFER_END
  329. * rx_trig_info: RX_TRIG_INFO
  330. * rxpcu_tx_setup_clear: RXPCU_TX_SETUP_CLEAR
  331. * rx_frame_bitmap_req: RX_FRAME_BITMAP_REQ
  332. * rx_phy_sleep: RX_PHY_SLEEP
  333. * txpcu_preamble_done: TXPCU_PREAMBLE_DONE
  334. * txpcu_phytx_debug32: TXPCU_PHYTX_DEBUG32
  335. * txpcu_phytx_other_transmit_info32: TXPCU_PHYTX_OTHER_TRANSMIT_INFO32
  336. * rx_ppdu_noack_report: RX_PPDU_NO_ACK_REPORT
  337. * rx_ppdu_ack_report: RX_PPDU_ACK_REPORT
  338. * coex_rx_status: COEX_RX_STATUS
  339. * rx_start_param: RX_START_PARAM
  340. * tx_cbf_info: TX_CBF_INFO
  341. * rxpcu_early_rx_indication: RXPCU_EARLY_RX_INDICATION
  342. * received_response_user_7_0: RECEIVED_RESPONSE_USER_7_0
  343. * received_response_user_15_8: RECEIVED_RESPONSE_USER_15_8
  344. * received_response_user_23_16: RECEIVED_RESPONSE_USER_23_16
  345. * received_response_user_31_24: RECEIVED_RESPONSE_USER_31_24
  346. * received_response_user_36_32: RECEIVED_RESPONSE_USER_36_32
  347. * rx_pm_info: RX_PM_INFO
  348. * rx_preamble: RX_PREAMBLE
  349. * others: OTHERS
  350. * mactx_pre_phy_desc: MACTX_PRE_PHY_DESC
  351. *
  352. */
  353. struct dp_tx_mon_upstream_tlv_config {
  354. uint32_t rx_response_required_info:1,
  355. response_start_status:1,
  356. response_end_status:1,
  357. tx_fes_status_start:1,
  358. tx_fes_status_end:1,
  359. tx_fes_status_start_ppdu:1,
  360. tx_fes_status_user_ppdu:1,
  361. tx_fes_status_ack_or_ba:1,
  362. tx_fes_status_1k_ba:1,
  363. tx_fes_status_start_prot:1,
  364. tx_fes_status_prot:1,
  365. tx_fes_status_user_response:1,
  366. rx_frame_bitmap_ack:1,
  367. rx_frame_1k_bitmap_ack:1,
  368. coex_tx_status:1,
  369. recevied_response_info:1,
  370. recevied_response_info_p2:1,
  371. ofdma_trigger_details:1,
  372. recevied_trigger_info:1,
  373. pdg_tx_request:1,
  374. pdg_response:1,
  375. pdg_trig_response:1,
  376. trigger_response_tx_done:1,
  377. prot_tx_end:1,
  378. ppdu_tx_end:1,
  379. r2r_status_end:1,
  380. flush_req:1,
  381. mactx_phy_desc:1,
  382. mactx_user_desc_cmn:1,
  383. mactx_user_desc_per_usr:1;
  384. uint32_t tqm_acked_1k_mpdu:1,
  385. tqm_acked_mpdu:1,
  386. tqm_update_tx_mpdu_count:1,
  387. phytx_ppdu_header_info_request:1,
  388. u_sig_eht_su_mu:1,
  389. u_sig_eht_su:1,
  390. u_sig_eht_tb:1,
  391. eht_sig_usr_su:1,
  392. eht_sig_usr_mu_mimo:1,
  393. eht_sig_usr_ofdma:1,
  394. he_sig_a_su:1,
  395. he_sig_a_mu_dl:1,
  396. he_sig_a_mu_ul:1,
  397. he_sig_b1_mu:1,
  398. he_sig_b2_mu:1,
  399. he_sig_b2_ofdma:1,
  400. vht_sig_b_mu160:1,
  401. vht_sig_b_mu80:1,
  402. vht_sig_b_mu40:1,
  403. vht_sig_b_mu20:1,
  404. vht_sig_b_su160:1,
  405. vht_sig_b_su80:1,
  406. vht_sig_b_su40:1,
  407. vht_sig_b_su20:1,
  408. vht_sig_a:1,
  409. ht_sig:1,
  410. l_sig_b:1,
  411. l_sig_a:1,
  412. tx_service:1;
  413. uint32_t txpcu_buf_status:1,
  414. txpcu_user_buf_status:1,
  415. txdma_stop_request:1,
  416. expected_response:1,
  417. tx_mpdu_count_transfer_end:1,
  418. rx_trig_info:1,
  419. rxpcu_tx_setup_clear:1,
  420. rx_frame_bitmap_req:1,
  421. rx_phy_sleep:1,
  422. txpcu_preamble_done:1,
  423. txpcu_phytx_debug32:1,
  424. txpcu_phytx_other_transmit_info32:1,
  425. rx_ppdu_noack_report:1,
  426. rx_ppdu_ack_report:1,
  427. coex_rx_status:1,
  428. rx_start_param:1,
  429. tx_cbf_info:1,
  430. rxpcu_early_rx_indication:1,
  431. received_response_user_7_0:1,
  432. received_response_user_15_8:1,
  433. received_response_user_23_16:1,
  434. received_response_user_31_24:1,
  435. received_response_user_36_32:1,
  436. rx_pm_info:1,
  437. rx_preamble:1,
  438. others:1,
  439. mactx_pre_phy_desc:1;
  440. };
  441. /**
  442. * struct dp_tx_mon_wordmask_config - Tx monitor word mask
  443. * tx_fes_setup: TX_FES_SETUP TLV word mask
  444. * tx_peer_entry: TX_PEER_ENTRY TLV word mask
  445. * tx_queue_ext: TX_QUEUE_EXTENSION TLV word mask
  446. * tx_msdu_start: TX_MSDU_START TLV word mask
  447. * tx_mpdu_start: TX_MPDU_START TLV word mask
  448. * pcu_ppdu_setup_init: PCU_PPDU_SETUP TLV word mask
  449. * rxpcu_user_setup: RXPCU_USER_SETUP TLV word mask
  450. */
  451. struct dp_tx_mon_wordmask_config {
  452. uint16_t tx_fes_setup;
  453. uint16_t tx_peer_entry;
  454. uint16_t tx_queue_ext;
  455. uint16_t tx_msdu_start;
  456. uint16_t tx_mpdu_start;
  457. uint16_t pcu_ppdu_setup_init;
  458. uint16_t rxpcu_user_setup;
  459. };
  460. /**
  461. * struct htt_tx_ring_tlv_filter - Tx ring TLV filter
  462. * enable/disable.
  463. * @dtlvs: enable/disable downstream TLVs
  464. * @utlvs: enable/disable upstream TLVs
  465. * @wmask: enable/disbale word mask subscription
  466. * @mgmt_filter: enable/disable mgmt packets
  467. * @data_filter: enable/disable data packets
  468. * @ctrl_filter: enable/disable ctrl packets
  469. * @mgmt_dma_length: configure length for mgmt packet
  470. * @ctrl_dma_length: configure length for ctrl packet
  471. * @data_dma_length: configure length for data packet
  472. * @mgmt_mpdu_end: enable mpdu end tlv for mgmt
  473. * @mgmt_msdu_end: enable msdu end tlv for mgmt
  474. * @mgmt_msdu_start: enable msdu start tlv for mgmt
  475. * @mgmt_mpdu_start: enable mpdu start tlv for mgmt
  476. * @ctrl_mpdu_end: enable mpdu end tlv for ctrl
  477. * @ctrl_msdu_end: enable msdu end tlv for ctrl
  478. * @ctrl_msdu_start: enable msdu start tlv for ctrl
  479. * @ctrl_mpdu_start: enable mpdu start tlv for ctrl
  480. * @data_mpdu_end: enable mpdu end tlv for data
  481. * @data_msdu_end: enable msdu end tlv for data
  482. * @data_msdu_start: enable msdu start tlv for data
  483. * @data_mpdu_start: enable mpdu start tlv for data
  484. * @mgmt_mpdu_log: enable mgmt mpdu level logging
  485. * @ctrl_mpdu_log: enable ctrl mpdu level logging
  486. * @data_mpdu_log: enable data mpdu level logging
  487. *
  488. * NOTE: Do not change the layout of this structure
  489. */
  490. struct htt_tx_ring_tlv_filter {
  491. struct dp_tx_mon_downstream_tlv_config dtlvs;
  492. struct dp_tx_mon_upstream_tlv_config utlvs;
  493. struct dp_tx_mon_wordmask_config wmask;
  494. uint16_t mgmt_filter;
  495. uint16_t data_filter;
  496. uint16_t ctrl_filter;
  497. uint16_t mgmt_dma_length:3,
  498. ctrl_dma_length:3,
  499. data_dma_length:3;
  500. uint16_t mgmt_mpdu_end:1,
  501. mgmt_msdu_end:1,
  502. mgmt_msdu_start:1,
  503. mgmt_mpdu_start:1,
  504. ctrl_mpdu_end:1,
  505. ctrl_msdu_end:1,
  506. ctrl_msdu_start:1,
  507. ctrl_mpdu_start:1,
  508. data_mpdu_end:1,
  509. data_msdu_end:1,
  510. data_msdu_start:1,
  511. data_mpdu_start:1;
  512. uint8_t mgmt_mpdu_log:1,
  513. ctrl_mpdu_log:1,
  514. data_mpdu_log:1;
  515. };
  516. #endif /* QCA_MONITOR_2_0_SUPPORT */
  517. /**
  518. * struct htt_rx_ring_tlv_filter - Rx ring TLV filter
  519. * enable/disable.
  520. * @mpdu_start: enable/disable MPDU start TLV
  521. * @msdu_start: enable/disable MSDU start TLV
  522. * @packet: enable/disable PACKET TLV
  523. * @msdu_end: enable/disable MSDU end TLV
  524. * @mpdu_end: enable/disable MPDU end TLV
  525. * @packet_header: enable/disable PACKET header TLV
  526. * @attention: enable/disable ATTENTION TLV
  527. * @ppdu_start: enable/disable PPDU start TLV
  528. * @ppdu_end: enable/disable PPDU end TLV
  529. * @ppdu_end_user_stats: enable/disable PPDU user stats TLV
  530. * @ppdu_end_user_stats_ext: enable/disable PPDU user stats ext TLV
  531. * @ppdu_end_status_done: enable/disable PPDU end status done TLV
  532. * @enable_fp: enable/disable FP packet
  533. * @enable_md: enable/disable MD packet
  534. * @enable_mo: enable/disable MO packet
  535. * @enable_mgmt: enable/disable MGMT packet
  536. * @enable_ctrl: enable/disable CTRL packet
  537. * @enable_data: enable/disable DATA packet
  538. * @offset_valid: Flag to indicate if below offsets are valid
  539. * @rx_packet_offset: Offset of packet payload
  540. * @rx_header_offset: Offset of rx_header tlv
  541. * @rx_mpdu_end_offset: Offset of rx_mpdu_end tlv
  542. * @rx_mpdu_start_offset: Offset of rx_mpdu_start tlv
  543. * @rx_msdu_end_offset: Offset of rx_msdu_end tlv
  544. * @rx_msdu_start_offset: Offset of rx_msdu_start tlv
  545. * @rx_attn_offset: Offset of rx_attention tlv
  546. * @rx_mpdu_start_wmask: word mask for mpdu start tlv
  547. * @rx_mpdu_end_wmask: word mask for mpdu end tlv
  548. * @rx_msdu_end_tlv: word mask for msdu end tlv
  549. * @rx_pkt_tlv_offset: rx pkt tlv offset
  550. * @mgmt_dma_length: configure length for mgmt packet
  551. * @ctrl_dma_length: configure length for ctrl packet
  552. * @data_dma_length: configure length for data packet
  553. * @mgmt_mpdu_log: enable mgmt mpdu level logging
  554. * @ctrl_mpdu_log: enable ctrl mpdu level logging
  555. * @data_mpdu_log: enable data mpdu level logging
  556. *
  557. * NOTE: Do not change the layout of this structure
  558. */
  559. struct htt_rx_ring_tlv_filter {
  560. u_int32_t mpdu_start:1,
  561. msdu_start:1,
  562. packet:1,
  563. msdu_end:1,
  564. mpdu_end:1,
  565. packet_header:1,
  566. attention:1,
  567. ppdu_start:1,
  568. ppdu_end:1,
  569. ppdu_end_user_stats:1,
  570. ppdu_end_user_stats_ext:1,
  571. ppdu_end_status_done:1,
  572. header_per_msdu:1,
  573. enable_fp:1,
  574. enable_md:1,
  575. enable_mo:1;
  576. u_int32_t fp_mgmt_filter:16,
  577. mo_mgmt_filter:16;
  578. u_int32_t fp_ctrl_filter:16,
  579. mo_ctrl_filter:16;
  580. u_int32_t fp_data_filter:16,
  581. mo_data_filter:16;
  582. u_int16_t md_data_filter;
  583. u_int16_t md_mgmt_filter;
  584. u_int16_t md_ctrl_filter;
  585. bool offset_valid;
  586. uint16_t rx_packet_offset;
  587. uint16_t rx_header_offset;
  588. uint16_t rx_mpdu_end_offset;
  589. uint16_t rx_mpdu_start_offset;
  590. uint16_t rx_msdu_end_offset;
  591. uint16_t rx_msdu_start_offset;
  592. uint16_t rx_attn_offset;
  593. #ifdef QCA_MONITOR_2_0_SUPPORT
  594. uint16_t rx_mpdu_start_wmask;
  595. uint16_t rx_mpdu_end_wmask;
  596. uint16_t rx_msdu_end_wmask;
  597. uint16_t rx_pkt_tlv_offset;
  598. uint16_t mgmt_dma_length:3,
  599. ctrl_dma_length:3,
  600. data_dma_lepngth:3,
  601. mgmt_mpdu_log:1,
  602. ctrl_mpdu_log:1,
  603. data_mpdu_log:1;
  604. #endif
  605. };
  606. /**
  607. * struct dp_htt_rx_flow_fst_setup - Rx FST setup message
  608. * @pdev_id: DP Pdev identifier
  609. * @max_entries: Size of Rx FST in number of entries
  610. * @max_search: Number of collisions allowed
  611. * @base_addr_lo: lower 32-bit physical address
  612. * @base_addr_hi: upper 32-bit physical address
  613. * @ip_da_sa_prefix: IPv4 prefix to map to IPv6 address scheme
  614. * @hash_key_len: Rx FST hash key size
  615. * @hash_key: Rx FST Toeplitz hash key
  616. */
  617. struct dp_htt_rx_flow_fst_setup {
  618. uint8_t pdev_id;
  619. uint32_t max_entries;
  620. uint32_t max_search;
  621. uint32_t base_addr_lo;
  622. uint32_t base_addr_hi;
  623. uint32_t ip_da_sa_prefix;
  624. uint32_t hash_key_len;
  625. uint8_t *hash_key;
  626. };
  627. /**
  628. * enum dp_htt_flow_fst_operation - FST related operations allowed
  629. * @DP_HTT_FST_CACHE_OP_NONE: Cache no-op
  630. * @DP_HTT_FST_CACHE_INVALIDATE_ENTRY: Invalidate single cache entry
  631. * @DP_HTT_FST_CACHE_INVALIDATE_FULL: Invalidate entire cache
  632. * @DP_HTT_FST_ENABLE: Bypass FST is enabled
  633. * @DP_HTT_FST_DISABLE: Disable bypass FST
  634. */
  635. enum dp_htt_flow_fst_operation {
  636. DP_HTT_FST_CACHE_OP_NONE,
  637. DP_HTT_FST_CACHE_INVALIDATE_ENTRY,
  638. DP_HTT_FST_CACHE_INVALIDATE_FULL,
  639. DP_HTT_FST_ENABLE,
  640. DP_HTT_FST_DISABLE
  641. };
  642. /**
  643. * struct dp_htt_rx_flow_fst_setup - Rx FST setup message
  644. * @pdev_id: DP Pdev identifier
  645. * @op_code: FST operation to be performed by FW/HW
  646. * @rx_flow: Rx Flow information on which operation is to be performed
  647. */
  648. struct dp_htt_rx_flow_fst_operation {
  649. uint8_t pdev_id;
  650. enum dp_htt_flow_fst_operation op_code;
  651. struct cdp_rx_flow_info *rx_flow;
  652. };
  653. /**
  654. * struct dp_htt_rx_fisa_config - Rx fisa config
  655. * @pdev_id: DP Pdev identifier
  656. * @fisa_timeout: fisa aggregation timeout
  657. */
  658. struct dp_htt_rx_fisa_cfg {
  659. uint8_t pdev_id;
  660. uint32_t fisa_timeout;
  661. };
  662. /*
  663. * htt_htc_pkt_alloc() - Allocate HTC packet buffer
  664. * @htt_soc: HTT SOC handle
  665. *
  666. * Return: Pointer to htc packet buffer
  667. */
  668. struct dp_htt_htc_pkt *htt_htc_pkt_alloc(struct htt_soc *soc);
  669. /*
  670. * htt_htc_pkt_free() - Free HTC packet buffer
  671. * @htt_soc: HTT SOC handle
  672. */
  673. void
  674. htt_htc_pkt_free(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt);
  675. #define HTT_HTC_PKT_STATUS_SUCCESS \
  676. ((pkt->htc_pkt.Status != QDF_STATUS_E_CANCELED) && \
  677. (pkt->htc_pkt.Status != QDF_STATUS_E_RESOURCES))
  678. #ifdef ENABLE_CE4_COMP_DISABLE_HTT_HTC_MISC_LIST
  679. static void
  680. htt_htc_misc_pkt_list_add(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt)
  681. {
  682. }
  683. #else /* ENABLE_CE4_COMP_DISABLE_HTT_HTC_MISC_LIST */
  684. /*
  685. * htt_htc_misc_pkt_list_add() - Add pkt to misc list
  686. * @htt_soc: HTT SOC handle
  687. * @dp_htt_htc_pkt: pkt to be added to list
  688. */
  689. void
  690. htt_htc_misc_pkt_list_add(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt);
  691. #endif /* ENABLE_CE4_COMP_DISABLE_HTT_HTC_MISC_LIST */
  692. /**
  693. * DP_HTT_SEND_HTC_PKT() - Send htt packet from host
  694. * @soc : HTT SOC handle
  695. * @pkt: pkt to be send
  696. * @cmd : command to be recorded in dp htt logger
  697. * @buf : Pointer to buffer needs to be recored for above cmd
  698. *
  699. * Return: None
  700. */
  701. static inline QDF_STATUS DP_HTT_SEND_HTC_PKT(struct htt_soc *soc,
  702. struct dp_htt_htc_pkt *pkt,
  703. uint8_t cmd, uint8_t *buf)
  704. {
  705. QDF_STATUS status;
  706. htt_command_record(soc->htt_logger_handle, cmd, buf);
  707. status = htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  708. if (status == QDF_STATUS_SUCCESS && HTT_HTC_PKT_STATUS_SUCCESS)
  709. htt_htc_misc_pkt_list_add(soc, pkt);
  710. else
  711. soc->stats.fail_count++;
  712. return status;
  713. }
  714. QDF_STATUS dp_htt_rx_fisa_config(struct dp_pdev *pdev,
  715. struct dp_htt_rx_fisa_cfg *fisa_config);
  716. /*
  717. * htt_soc_initialize() - SOC level HTT initialization
  718. * @htt_soc: Opaque htt SOC handle
  719. * @ctrl_psoc: Opaque ctrl SOC handle
  720. * @htc_soc: SOC level HTC handle
  721. * @hal_soc: Opaque HAL SOC handle
  722. * @osdev: QDF device
  723. *
  724. * Return: HTT handle on success; NULL on failure
  725. */
  726. void *
  727. htt_soc_initialize(struct htt_soc *htt_soc,
  728. struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
  729. HTC_HANDLE htc_soc,
  730. hal_soc_handle_t hal_soc_hdl, qdf_device_t osdev);
  731. /*
  732. * htt_soc_attach() - attach DP and HTT SOC
  733. * @soc: DP SOC handle
  734. * @htc_hdl: HTC handle
  735. *
  736. * Return: htt_soc handle on Success, NULL on Failure
  737. */
  738. struct htt_soc *htt_soc_attach(struct dp_soc *soc, HTC_HANDLE htc_hdl);
  739. /*
  740. * htt_set_htc_handle_() - set HTC handle
  741. * @htt_hdl: HTT handle/SOC
  742. * @htc_soc: HTC handle
  743. *
  744. * Return: None
  745. */
  746. void htt_set_htc_handle(struct htt_soc *htt_hdl, HTC_HANDLE htc_soc);
  747. /*
  748. * htt_get_htc_handle_() - set HTC handle
  749. * @htt_hdl: HTT handle/SOC
  750. *
  751. * Return: HTC_HANDLE
  752. */
  753. HTC_HANDLE htt_get_htc_handle(struct htt_soc *htt_hdl);
  754. /*
  755. * htt_soc_htc_dealloc() - HTC memory de-alloc
  756. * @htt_soc: SOC level HTT handle
  757. *
  758. * Return: None
  759. */
  760. void htt_soc_htc_dealloc(struct htt_soc *htt_handle);
  761. /*
  762. * htt_soc_htc_prealloc() - HTC memory prealloc
  763. * @htt_soc: SOC level HTT handle
  764. *
  765. * Return: QDF_STATUS_SUCCESS on success or
  766. * QDF_STATUS_E_NO_MEM on allocation failure
  767. */
  768. QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *htt_soc);
  769. void htt_soc_detach(struct htt_soc *soc);
  770. int htt_srng_setup(struct htt_soc *htt_soc, int pdev_id,
  771. hal_ring_handle_t hal_ring_hdl,
  772. int hal_ring_type);
  773. int htt_soc_attach_target(struct htt_soc *htt_soc);
  774. /*
  775. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  776. * config message to target
  777. * @htt_soc: HTT SOC handle
  778. * @pdev_id: PDEV Id
  779. * @hal_srng: Opaque HAL SRNG pointer
  780. * @hal_ring_type: SRNG ring type
  781. * @ring_buf_size: SRNG buffer size
  782. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  783. *
  784. * Return: 0 on success; error code on failure
  785. */
  786. int htt_h2t_rx_ring_cfg(struct htt_soc *htt_soc, int pdev_id,
  787. hal_ring_handle_t hal_ring_hdl,
  788. int hal_ring_type, int ring_buf_size,
  789. struct htt_rx_ring_tlv_filter *htt_tlv_filter);
  790. /*
  791. * htt_t2h_stats_handler() - target to host stats work handler
  792. * @context: context (dp soc context)
  793. *
  794. * Return: void
  795. */
  796. void htt_t2h_stats_handler(void *context);
  797. /**
  798. * struct htt_stats_context - htt stats information
  799. * @soc: Size of each descriptor in the pool
  800. * @msg: T2H Ext stats message queue
  801. * @msg_len: T2H Ext stats message length
  802. */
  803. struct htt_stats_context {
  804. struct dp_soc *soc;
  805. qdf_nbuf_queue_t msg;
  806. uint32_t msg_len;
  807. };
  808. /**
  809. * dp_htt_rx_flow_fst_setup(): Send HTT Rx FST setup message to FW
  810. * @pdev: DP pdev handle
  811. * @fse_setup_info: FST setup parameters
  812. *
  813. * Return: Success when HTT message is sent, error on failure
  814. */
  815. QDF_STATUS
  816. dp_htt_rx_flow_fst_setup(struct dp_pdev *pdev,
  817. struct dp_htt_rx_flow_fst_setup *setup_info);
  818. /**
  819. * dp_htt_rx_flow_fse_operation(): Send HTT Flow Search Entry msg to
  820. * add/del a flow in HW
  821. * @pdev: DP pdev handle
  822. * @fse_op_info: Flow entry parameters
  823. *
  824. * Return: Success when HTT message is sent, error on failure
  825. */
  826. QDF_STATUS
  827. dp_htt_rx_flow_fse_operation(struct dp_pdev *pdev,
  828. struct dp_htt_rx_flow_fst_operation *op_info);
  829. /**
  830. * htt_h2t_full_mon_cfg() - Send full monitor configuarion msg to FW
  831. *
  832. * @htt_soc: HTT Soc handle
  833. * @pdev_id: Radio id
  834. * @dp_full_mon_config: enabled/disable configuration
  835. *
  836. * Return: Success when HTT message is sent, error on failure
  837. */
  838. int htt_h2t_full_mon_cfg(struct htt_soc *htt_soc,
  839. uint8_t pdev_id,
  840. enum dp_full_mon_config);
  841. /**
  842. * dp_h2t_hw_vdev_stats_config_send: Send HTT command to FW for config
  843. of HW vdev stats
  844. * @dpsoc: Datapath soc handle
  845. * @pdev_id: INVALID_PDEV_ID for all pdevs or 0,1,2 for individual pdev
  846. * @enable: flag to specify enable/disable of stats
  847. * @reset: flag to specify if command is for reset of stats
  848. * @reset_bitmask: bitmask of vdev_id(s) for reset of HW stats
  849. *
  850. * Return: QDF_STATUS
  851. */
  852. QDF_STATUS dp_h2t_hw_vdev_stats_config_send(struct dp_soc *dpsoc,
  853. uint8_t pdev_id, bool enable,
  854. bool reset, uint64_t reset_bitmask);
  855. #endif /* _DP_HTT_H_ */