dp_htt.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  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 MAX_SCHED_STARVE 100000
  118. #define WRAP_DROP_TSF_DELTA 10000
  119. #define MAX_TSF_32 0xFFFFFFFF
  120. #define dp_htt_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_HTT, params)
  121. #define dp_htt_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_HTT, params)
  122. #define dp_htt_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_HTT, params)
  123. #define dp_htt_info(params...) \
  124. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_HTT, ## params)
  125. #define dp_htt_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_HTT, params)
  126. #define dp_htt_tx_stats_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  127. #define dp_htt_tx_stats_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  128. #define dp_htt_tx_stats_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  129. #define dp_htt_tx_stats_info(params...) \
  130. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_HTT_TX_STATS, ## params)
  131. #define dp_htt_tx_stats_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_HTT_TX_STATS, params)
  132. /**
  133. * enum dp_full_mon_config - enum to enable/disable full monitor mode
  134. *
  135. * @DP_FULL_MON_DISABLE: Disable full monitor mode
  136. * @DP_FULL_MON_ENABLE: Enable full monitor mode
  137. */
  138. enum dp_full_mon_config {
  139. DP_FULL_MON_DISABLE,
  140. DP_FULL_MON_ENABLE,
  141. };
  142. struct dp_htt_htc_pkt {
  143. void *soc_ctxt;
  144. qdf_dma_addr_t nbuf_paddr;
  145. HTC_PACKET htc_pkt;
  146. };
  147. struct dp_htt_htc_pkt_union {
  148. union {
  149. struct dp_htt_htc_pkt pkt;
  150. struct dp_htt_htc_pkt_union *next;
  151. } u;
  152. };
  153. struct dp_htt_timestamp {
  154. long *umac_ttt;
  155. long *lmac_ttt;
  156. };
  157. struct htt_soc {
  158. struct cdp_ctrl_objmgr_psoc *ctrl_psoc;
  159. struct dp_soc *dp_soc;
  160. hal_soc_handle_t hal_soc;
  161. struct dp_htt_timestamp pdevid_tt[MAX_PDEV_CNT];
  162. /* htt_logger handle */
  163. struct htt_logger *htt_logger_handle;
  164. HTC_HANDLE htc_soc;
  165. qdf_device_t osdev;
  166. HTC_ENDPOINT_ID htc_endpoint;
  167. struct dp_htt_htc_pkt_union *htt_htc_pkt_freelist;
  168. struct dp_htt_htc_pkt_union *htt_htc_pkt_misclist;
  169. struct {
  170. u_int8_t major;
  171. u_int8_t minor;
  172. } tgt_ver;
  173. struct {
  174. u_int8_t major;
  175. u_int8_t minor;
  176. } wifi_ip_ver;
  177. struct {
  178. int htc_err_cnt;
  179. int htc_pkt_free;
  180. int skip_count;
  181. int fail_count;
  182. /* rtpm put skip count for ver req msg */
  183. int htt_ver_req_put_skip;
  184. } stats;
  185. HTT_TX_MUTEX_TYPE htt_tx_mutex;
  186. };
  187. #ifdef QCA_MONITOR_2_0_SUPPORT
  188. /**
  189. * struct dp_tx_mon_downstream_tlv_config - Enable/Disable TxMon
  190. * downstream TLVs
  191. * tx_fes_setup: TX_FES_SETUP TLV
  192. * tx_peer_entry: TX_PEER_ENTRY TLV
  193. * tx_queue_extension: TX_QUEUE_EXTENSION TLV
  194. * tx_last_mpdu_end: TX_LAST_MPDU_END TLV
  195. * tx_last_mpdu_fetched: TX_LAST_MPDU_FETCHED TLV
  196. * tx_data_sync: TX_DATA_SYNC TLV
  197. * pcu_ppdu_setup_init: PCU_PPDU_SETUP_INIT TLV
  198. * fw2s_mon: FW2S_MON TLV
  199. * tx_loopback_setup: TX_LOOPBACK_SETUP TLV
  200. * sch_critical_tlv_ref: SCH_CRITICAL_TLV_REF TLV
  201. * ndp_preamble_done: NDP_PREAMBLE_DONE TLV
  202. * tx_raw_frame_setup: TX_RAW_OR_NATIVE_FRAME_SETUP TLV
  203. * txpcu_user_setup: TXPCU_USER_SETUP TLV
  204. * rxpcu_setup: RXPCU_SETUP TLV
  205. * rxpcu_setup_complete: RXPCU_SETUP_COMPLETE TLV
  206. * coex_tx_req: COEX_TX_REQ TLV
  207. * rxpcu_user_setup: RXPCU_USER_SETUP TLV
  208. * rxpcu_user_setup_ext: RXPCU_USER_SETUP_EXT TLV
  209. * wur_data: WUR_DATA TLV
  210. * tqm_mpdu_global_start: TQM_MPDU_GLOBAL_START
  211. * tx_fes_setup_complete: TX_FES_SETUP_COMPLETE TLV
  212. * scheduler_end: SCHEDULER_END TLV
  213. * sch_wait_instr_tx_path: SCH_WAIT_INSTR_TX_PATH TLV
  214. *
  215. */
  216. struct dp_tx_mon_downstream_tlv_config {
  217. uint32_t tx_fes_setup:1,
  218. tx_peer_entry:1,
  219. tx_queue_extension:1,
  220. tx_last_mpdu_end:1,
  221. tx_last_mpdu_fetched:1,
  222. tx_data_sync:1,
  223. pcu_ppdu_setup_init:1,
  224. fw2s_mon:1,
  225. tx_loopback_setup:1,
  226. sch_critical_tlv_ref:1,
  227. ndp_preamble_done:1,
  228. tx_raw_frame_setup:1,
  229. txpcu_user_setup:1,
  230. rxpcu_setup:1,
  231. rxpcu_setup_complete:1,
  232. coex_tx_req:1,
  233. rxpcu_user_setup:1,
  234. rxpcu_user_setup_ext:1,
  235. wur_data:1,
  236. tqm_mpdu_global_start:1,
  237. tx_fes_setup_complete:1,
  238. scheduler_end:1,
  239. sch_wait_instr_tx_path:1;
  240. };
  241. /**
  242. * struct dp_tx_mon_upstream_tlv_config - Enable/Disable TxMon
  243. * upstream TLVs
  244. * rx_response_required_info: RX_RESPONSE_REQUIRED_INFO
  245. * TLV
  246. * response_start_status: RESPONSE_START_STATUS TLV
  247. * response_end_status: RESPONSE_END_STATUS TLV
  248. * tx_fes_status_start: TX_FES_STATUS_START TLV
  249. * tx_fes_status_start_ppdu: TX_FES_STATUS_START_PPDU TLV
  250. * tx_fes_status_user_ppdu: TX_FES_STATUS_USER_PPDU TLV
  251. * tx_fes_status_ack_or_ba: TX_FES_STATUS_ACK_OR_BA TLV
  252. * tx_fes_status_1k_ba: TX_FES_STATUS_1K_BA TLV
  253. * tx_fes_status_start_prot: TX_FES_STATUS_START_PROTO TLV
  254. * tx_fes_status_user_response: TX_FES_STATUS_USER_RESPONSE TLV
  255. * rx_frame_bitmap_ack: RX_FRAME_BITMAP_ACK TLV
  256. * rx_frame_1k_bitmap_ack: RX_FRAME_1K_BITMAP_ACK TLV
  257. * coex_tx_status: COEX_TX_STATUS TLV
  258. * recevied_response_info: RECEIVED_RESPONSE_INFO TLV
  259. * recevied_response_info_p2: RECEIVED_RESPONSE_INFO_PART2 TLV
  260. * ofdma_trigger_details: OFDMA_TRIGGER_DETAILS
  261. * recevied_trigger_info: RECEIVED_TRIGGER_INFO
  262. * pdg_tx_request: PDG_TX_REQUEST
  263. * pdg_response: PDG_RESPONSE
  264. * pdg_trig_response: PDG_TRIG_RESPONSE
  265. * trigger_response_tx_done: TRIGGER_RESPONSE_TX_DONE
  266. * prot_tx_end: PROT_TX_END
  267. * ppdu_tx_end: PPDU_TX_END
  268. * r2r_status_end: R2R_STATUS_END
  269. * flush_req: FLUSH_REQ
  270. * mactx_phy_desc: MACTX_PHY_DESC
  271. * mactx_user_desc_cmn: MACTX_USER_DESC_COMMON
  272. * mactx_user_desc_per_usr: MACTX_USER_DESC_PER_USER
  273. * tqm_acked_1k_mpdu: TQM_ACKED_1K_MPDU
  274. * tqm_acked_mpdu: TQM_ACKED_MPDU
  275. * tqm_update_tx_mpdu_count: TQM_UPDATE_TX_MPDU_COUNT
  276. * phytx_ppdu_header_info_request: PHYTX_PPDU_HEADER_INFO_REQUEST
  277. * u_sig_eht_su_mu: U_SIG_EHT_SU_MU
  278. * u_sig_eht_su: U_SIG_EHT_SU
  279. * eht_sig_usr_su: EHT_SIG_USR_SU
  280. * eht_sig_usr_mu_mimo: EHT_SIG_USR_MU_MIMO
  281. * eht_sig_usr_ofdma: EHT_SIG_USR_MU_MIMO
  282. * he_sig_a_su: HE_SIG_A_SU
  283. * he_sig_a_mu_dl: HE_SIG_A_MU_DL
  284. * he_sig_a_mu_ul: HE_SIG_A_MU_UL
  285. * he_sig_b1_mu: HE_SIG_B1_MU
  286. * he_sig_b2_mu: HE_SIG_B2_MU
  287. * he_sig_b2_ofdma: HE_SIG_B2_OFDMA
  288. * vht_sig_b_mu160: VHT_SIG_B_MU160
  289. * vht_sig_b_mu80: VHT_SIG_B_MU80
  290. * vht_sig_b_mu40: VHT_SIG_B_MU40
  291. * vht_sig_b_mu20: VHT_SIG_B_MU20
  292. * vht_sig_b_su160: VHT_SIG_B_SU160
  293. * vht_sig_b_su80: VHT_SIG_B_SU80
  294. * vht_sig_b_su40: VHT_SIG_B_SU40
  295. * vht_sig_b_su20: VHT_SIG_B_SU20
  296. * vht_sig_a: VHT_SIG_A
  297. * ht_sig: HT_SIG
  298. * l_sig_b: L_SIG_B
  299. * l_sig_a: L_SIG_A
  300. * tx_service: TX_SERVICE
  301. * txpcu_buf_status: TXPCU_BUFFER_STATUS
  302. * txpcu_user_buf_status: TXPCU_USER_BUFFER_STATUS
  303. * txdma_stop_request: TXDMA_STOP_REQUEST
  304. * expected_response: EXPECTED_RESPONSE
  305. * tx_mpdu_count_transfer_end: TX_MPDU_COUNT_TRANSFER_END
  306. * rx_trig_info: RX_TRIG_INFO
  307. * rxpcu_tx_setup_clear: RXPCU_TX_SETUP_CLEAR
  308. * rx_frame_bitmap_req: RX_FRAME_BITMAP_REQ
  309. * rx_phy_sleep: RX_PHY_SLEEP
  310. * txpcu_preamble_done: TXPCU_PREAMBLE_DONE
  311. * txpcu_phytx_debug32: TXPCU_PHYTX_DEBUG32
  312. * txpcu_phytx_other_transmit_info32: TXPCU_PHYTX_OTHER_TRANSMIT_INFO32
  313. * rx_ppdu_noack_report: RX_PPDU_NO_ACK_REPORT
  314. * rx_ppdu_ack_report: RX_PPDU_ACK_REPORT
  315. * coex_rx_status: COEX_RX_STATUS
  316. * rx_start_param: RX_START_PARAM
  317. * tx_cbf_info: TX_CBF_INFO
  318. * rxpcu_early_rx_indication: RXPCU_EARLY_RX_INDICATION
  319. * received_response_user_7_0: RECEIVED_RESPONSE_USER_7_0
  320. * received_response_user_15_8: RECEIVED_RESPONSE_USER_15_8
  321. * received_response_user_23_16: RECEIVED_RESPONSE_USER_23_16
  322. * received_response_user_31_24: RECEIVED_RESPONSE_USER_31_24
  323. * received_response_user_36_32: RECEIVED_RESPONSE_USER_36_32
  324. * rx_pm_info: RX_PM_INFO
  325. * rx_preamble: RX_PREAMBLE
  326. * others: OTHERS
  327. * mactx_pre_phy_desc: MACTX_PRE_PHY_DESC
  328. *
  329. */
  330. struct dp_tx_mon_upstream_tlv_config {
  331. uint32_t rx_response_required_info:1,
  332. response_start_status:1,
  333. response_end_status:1,
  334. tx_fes_status_start:1,
  335. tx_fes_status_end:1,
  336. tx_fes_status_start_ppdu:1,
  337. tx_fes_status_user_ppdu:1,
  338. tx_fes_status_ack_or_ba:1,
  339. tx_fes_status_1k_ba:1,
  340. tx_fes_status_start_prot:1,
  341. tx_fes_status_prot:1,
  342. tx_fes_status_user_response:1,
  343. rx_frame_bitmap_ack:1,
  344. rx_frame_1k_bitmap_ack:1,
  345. coex_tx_status:1,
  346. recevied_response_info:1,
  347. recevied_response_info_p2:1,
  348. ofdma_trigger_details:1,
  349. recevied_trigger_info:1,
  350. pdg_tx_request:1,
  351. pdg_response:1,
  352. pdg_trig_response:1,
  353. trigger_response_tx_done:1,
  354. prot_tx_end:1,
  355. ppdu_tx_end:1,
  356. r2r_status_end:1,
  357. flush_req:1,
  358. mactx_phy_desc:1,
  359. mactx_user_desc_cmn:1,
  360. mactx_user_desc_per_usr:1;
  361. uint32_t tqm_acked_1k_mpdu:1,
  362. tqm_acked_mpdu:1,
  363. tqm_update_tx_mpdu_count:1,
  364. phytx_ppdu_header_info_request:1,
  365. u_sig_eht_su_mu:1,
  366. u_sig_eht_su:1,
  367. u_sig_eht_tb:1,
  368. eht_sig_usr_su:1,
  369. eht_sig_usr_mu_mimo:1,
  370. eht_sig_usr_ofdma:1,
  371. he_sig_a_su:1,
  372. he_sig_a_mu_dl:1,
  373. he_sig_a_mu_ul:1,
  374. he_sig_b1_mu:1,
  375. he_sig_b2_mu:1,
  376. he_sig_b2_ofdma:1,
  377. vht_sig_b_mu160:1,
  378. vht_sig_b_mu80:1,
  379. vht_sig_b_mu40:1,
  380. vht_sig_b_mu20:1,
  381. vht_sig_b_su160:1,
  382. vht_sig_b_su80:1,
  383. vht_sig_b_su40:1,
  384. vht_sig_b_su20:1,
  385. vht_sig_a:1,
  386. ht_sig:1,
  387. l_sig_b:1,
  388. l_sig_a:1,
  389. tx_service:1;
  390. uint32_t txpcu_buf_status:1,
  391. txpcu_user_buf_status:1,
  392. txdma_stop_request:1,
  393. expected_response:1,
  394. tx_mpdu_count_transfer_end:1,
  395. rx_trig_info:1,
  396. rxpcu_tx_setup_clear:1,
  397. rx_frame_bitmap_req:1,
  398. rx_phy_sleep:1,
  399. txpcu_preamble_done:1,
  400. txpcu_phytx_debug32:1,
  401. txpcu_phytx_other_transmit_info32:1,
  402. rx_ppdu_noack_report:1,
  403. rx_ppdu_ack_report:1,
  404. coex_rx_status:1,
  405. rx_start_param:1,
  406. tx_cbf_info:1,
  407. rxpcu_early_rx_indication:1,
  408. received_response_user_7_0:1,
  409. received_response_user_15_8:1,
  410. received_response_user_23_16:1,
  411. received_response_user_31_24:1,
  412. received_response_user_36_32:1,
  413. rx_pm_info:1,
  414. rx_preamble:1,
  415. others:1,
  416. mactx_pre_phy_desc:1;
  417. };
  418. /**
  419. * struct dp_tx_mon_wordmask_config - Tx monitor word mask
  420. * tx_fes_setup: TX_FES_SETUP TLV word mask
  421. * tx_peer_entry: TX_PEER_ENTRY TLV word mask
  422. * tx_queue_ext: TX_QUEUE_EXTENSION TLV word mask
  423. * tx_msdu_start: TX_MSDU_START TLV word mask
  424. * tx_mpdu_start: TX_MPDU_START TLV word mask
  425. * pcu_ppdu_setup_init: PCU_PPDU_SETUP TLV word mask
  426. * rxpcu_user_setup: RXPCU_USER_SETUP TLV word mask
  427. */
  428. struct dp_tx_mon_wordmask_config {
  429. uint16_t tx_fes_setup;
  430. uint16_t tx_peer_entry;
  431. uint16_t tx_queue_ext;
  432. uint16_t tx_msdu_start;
  433. uint16_t tx_mpdu_start;
  434. uint16_t pcu_ppdu_setup_init;
  435. uint16_t rxpcu_user_setup;
  436. };
  437. /**
  438. * struct htt_tx_ring_tlv_filter - Tx ring TLV filter
  439. * enable/disable.
  440. * @dtlvs: enable/disable downstream TLVs
  441. * @utlvs: enable/disable upstream TLVs
  442. * @wmask: enable/disbale word mask subscription
  443. * @mgmt_filter: enable/disable mgmt packets
  444. * @data_filter: enable/disable data packets
  445. * @ctrl_filter: enable/disable ctrl packets
  446. * @mgmt_dma_length: configure length for mgmt packet
  447. * @ctrl_dma_length: configure length for ctrl packet
  448. * @data_dma_length: configure length for data packet
  449. * @mgmt_mpdu_end: enable mpdu end tlv for mgmt
  450. * @mgmt_msdu_end: enable msdu end tlv for mgmt
  451. * @mgmt_msdu_start: enable msdu start tlv for mgmt
  452. * @mgmt_mpdu_start: enable mpdu start tlv for mgmt
  453. * @ctrl_mpdu_end: enable mpdu end tlv for ctrl
  454. * @ctrl_msdu_end: enable msdu end tlv for ctrl
  455. * @ctrl_msdu_start: enable msdu start tlv for ctrl
  456. * @ctrl_mpdu_start: enable mpdu start tlv for ctrl
  457. * @data_mpdu_end: enable mpdu end tlv for data
  458. * @data_msdu_end: enable msdu end tlv for data
  459. * @data_msdu_start: enable msdu start tlv for data
  460. * @data_mpdu_start: enable mpdu start tlv for data
  461. * @mgmt_mpdu_log: enable mgmt mpdu level logging
  462. * @ctrl_mpdu_log: enable ctrl mpdu level logging
  463. * @data_mpdu_log: enable data mpdu level logging
  464. *
  465. * NOTE: Do not change the layout of this structure
  466. */
  467. struct htt_tx_ring_tlv_filter {
  468. struct dp_tx_mon_downstream_tlv_config dtlvs;
  469. struct dp_tx_mon_upstream_tlv_config utlvs;
  470. struct dp_tx_mon_wordmask_config wmask;
  471. uint16_t mgmt_filter;
  472. uint16_t data_filter;
  473. uint16_t ctrl_filter;
  474. uint16_t mgmt_dma_length:3,
  475. ctrl_dma_length:3,
  476. data_dma_length:3;
  477. uint16_t mgmt_mpdu_end:1,
  478. mgmt_msdu_end:1,
  479. mgmt_msdu_start:1,
  480. mgmt_mpdu_start:1,
  481. ctrl_mpdu_end:1,
  482. ctrl_msdu_end:1,
  483. ctrl_msdu_start:1,
  484. ctrl_mpdu_start:1,
  485. data_mpdu_end:1,
  486. data_msdu_end:1,
  487. data_msdu_start:1,
  488. data_mpdu_start:1;
  489. uint8_t mgmt_mpdu_log:1,
  490. ctrl_mpdu_log:1,
  491. data_mpdu_log:1;
  492. };
  493. #endif /* QCA_MONITOR_2_0_SUPPORT */
  494. /**
  495. * struct htt_rx_ring_tlv_filter - Rx ring TLV filter
  496. * enable/disable.
  497. * @mpdu_start: enable/disable MPDU start TLV
  498. * @msdu_start: enable/disable MSDU start TLV
  499. * @packet: enable/disable PACKET TLV
  500. * @msdu_end: enable/disable MSDU end TLV
  501. * @mpdu_end: enable/disable MPDU end TLV
  502. * @packet_header: enable/disable PACKET header TLV
  503. * @attention: enable/disable ATTENTION TLV
  504. * @ppdu_start: enable/disable PPDU start TLV
  505. * @ppdu_end: enable/disable PPDU end TLV
  506. * @ppdu_end_user_stats: enable/disable PPDU user stats TLV
  507. * @ppdu_end_user_stats_ext: enable/disable PPDU user stats ext TLV
  508. * @ppdu_end_status_done: enable/disable PPDU end status done TLV
  509. * @enable_fp: enable/disable FP packet
  510. * @enable_md: enable/disable MD packet
  511. * @enable_mo: enable/disable MO packet
  512. * @enable_mgmt: enable/disable MGMT packet
  513. * @enable_ctrl: enable/disable CTRL packet
  514. * @enable_data: enable/disable DATA packet
  515. * @offset_valid: Flag to indicate if below offsets are valid
  516. * @rx_packet_offset: Offset of packet payload
  517. * @rx_header_offset: Offset of rx_header tlv
  518. * @rx_mpdu_end_offset: Offset of rx_mpdu_end tlv
  519. * @rx_mpdu_start_offset: Offset of rx_mpdu_start tlv
  520. * @rx_msdu_end_offset: Offset of rx_msdu_end tlv
  521. * @rx_msdu_start_offset: Offset of rx_msdu_start tlv
  522. * @rx_attn_offset: Offset of rx_attention tlv
  523. * @rx_mpdu_start_wmask: word mask for mpdu start tlv
  524. * @rx_mpdu_end_wmask: word mask for mpdu end tlv
  525. * @rx_msdu_end_tlv: word mask for msdu end tlv
  526. * @rx_pkt_tlv_offset: rx pkt tlv offset
  527. * @mgmt_dma_length: configure length for mgmt packet
  528. * @ctrl_dma_length: configure length for ctrl packet
  529. * @data_dma_length: configure length for data packet
  530. * @mgmt_mpdu_log: enable mgmt mpdu level logging
  531. * @ctrl_mpdu_log: enable ctrl mpdu level logging
  532. * @data_mpdu_log: enable data mpdu level logging
  533. *
  534. * NOTE: Do not change the layout of this structure
  535. */
  536. struct htt_rx_ring_tlv_filter {
  537. u_int32_t mpdu_start:1,
  538. msdu_start:1,
  539. packet:1,
  540. msdu_end:1,
  541. mpdu_end:1,
  542. packet_header:1,
  543. attention:1,
  544. ppdu_start:1,
  545. ppdu_end:1,
  546. ppdu_end_user_stats:1,
  547. ppdu_end_user_stats_ext:1,
  548. ppdu_end_status_done:1,
  549. header_per_msdu:1,
  550. enable_fp:1,
  551. enable_md:1,
  552. enable_mo:1;
  553. u_int32_t fp_mgmt_filter:16,
  554. mo_mgmt_filter:16;
  555. u_int32_t fp_ctrl_filter:16,
  556. mo_ctrl_filter:16;
  557. u_int32_t fp_data_filter:16,
  558. mo_data_filter:16;
  559. u_int16_t md_data_filter;
  560. u_int16_t md_mgmt_filter;
  561. u_int16_t md_ctrl_filter;
  562. bool offset_valid;
  563. uint16_t rx_packet_offset;
  564. uint16_t rx_header_offset;
  565. uint16_t rx_mpdu_end_offset;
  566. uint16_t rx_mpdu_start_offset;
  567. uint16_t rx_msdu_end_offset;
  568. uint16_t rx_msdu_start_offset;
  569. uint16_t rx_attn_offset;
  570. #ifdef QCA_MONITOR_2_0_SUPPORT
  571. uint16_t rx_mpdu_start_wmask;
  572. uint16_t rx_mpdu_end_wmask;
  573. uint16_t rx_msdu_end_wmask;
  574. uint16_t rx_pkt_tlv_offset;
  575. uint16_t mgmt_dma_length:3,
  576. ctrl_dma_length:3,
  577. data_dma_lepngth:3,
  578. mgmt_mpdu_log:1,
  579. ctrl_mpdu_log:1,
  580. data_mpdu_log:1;
  581. #endif
  582. };
  583. /**
  584. * struct dp_htt_rx_flow_fst_setup - Rx FST setup message
  585. * @pdev_id: DP Pdev identifier
  586. * @max_entries: Size of Rx FST in number of entries
  587. * @max_search: Number of collisions allowed
  588. * @base_addr_lo: lower 32-bit physical address
  589. * @base_addr_hi: upper 32-bit physical address
  590. * @ip_da_sa_prefix: IPv4 prefix to map to IPv6 address scheme
  591. * @hash_key_len: Rx FST hash key size
  592. * @hash_key: Rx FST Toeplitz hash key
  593. */
  594. struct dp_htt_rx_flow_fst_setup {
  595. uint8_t pdev_id;
  596. uint32_t max_entries;
  597. uint32_t max_search;
  598. uint32_t base_addr_lo;
  599. uint32_t base_addr_hi;
  600. uint32_t ip_da_sa_prefix;
  601. uint32_t hash_key_len;
  602. uint8_t *hash_key;
  603. };
  604. /**
  605. * enum dp_htt_flow_fst_operation - FST related operations allowed
  606. * @DP_HTT_FST_CACHE_OP_NONE: Cache no-op
  607. * @DP_HTT_FST_CACHE_INVALIDATE_ENTRY: Invalidate single cache entry
  608. * @DP_HTT_FST_CACHE_INVALIDATE_FULL: Invalidate entire cache
  609. * @DP_HTT_FST_ENABLE: Bypass FST is enabled
  610. * @DP_HTT_FST_DISABLE: Disable bypass FST
  611. */
  612. enum dp_htt_flow_fst_operation {
  613. DP_HTT_FST_CACHE_OP_NONE,
  614. DP_HTT_FST_CACHE_INVALIDATE_ENTRY,
  615. DP_HTT_FST_CACHE_INVALIDATE_FULL,
  616. DP_HTT_FST_ENABLE,
  617. DP_HTT_FST_DISABLE
  618. };
  619. /**
  620. * struct dp_htt_rx_flow_fst_setup - Rx FST setup message
  621. * @pdev_id: DP Pdev identifier
  622. * @op_code: FST operation to be performed by FW/HW
  623. * @rx_flow: Rx Flow information on which operation is to be performed
  624. */
  625. struct dp_htt_rx_flow_fst_operation {
  626. uint8_t pdev_id;
  627. enum dp_htt_flow_fst_operation op_code;
  628. struct cdp_rx_flow_info *rx_flow;
  629. };
  630. /**
  631. * struct dp_htt_rx_fisa_config - Rx fisa config
  632. * @pdev_id: DP Pdev identifier
  633. * @fisa_timeout: fisa aggregation timeout
  634. */
  635. struct dp_htt_rx_fisa_cfg {
  636. uint8_t pdev_id;
  637. uint32_t fisa_timeout;
  638. };
  639. QDF_STATUS dp_htt_rx_fisa_config(struct dp_pdev *pdev,
  640. struct dp_htt_rx_fisa_cfg *fisa_config);
  641. /*
  642. * htt_soc_initialize() - SOC level HTT initialization
  643. * @htt_soc: Opaque htt SOC handle
  644. * @ctrl_psoc: Opaque ctrl SOC handle
  645. * @htc_soc: SOC level HTC handle
  646. * @hal_soc: Opaque HAL SOC handle
  647. * @osdev: QDF device
  648. *
  649. * Return: HTT handle on success; NULL on failure
  650. */
  651. void *
  652. htt_soc_initialize(struct htt_soc *htt_soc,
  653. struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
  654. HTC_HANDLE htc_soc,
  655. hal_soc_handle_t hal_soc_hdl, qdf_device_t osdev);
  656. /*
  657. * htt_soc_attach() - attach DP and HTT SOC
  658. * @soc: DP SOC handle
  659. * @htc_hdl: HTC handle
  660. *
  661. * Return: htt_soc handle on Success, NULL on Failure
  662. */
  663. struct htt_soc *htt_soc_attach(struct dp_soc *soc, HTC_HANDLE htc_hdl);
  664. /*
  665. * htt_set_htc_handle_() - set HTC handle
  666. * @htt_hdl: HTT handle/SOC
  667. * @htc_soc: HTC handle
  668. *
  669. * Return: None
  670. */
  671. void htt_set_htc_handle(struct htt_soc *htt_hdl, HTC_HANDLE htc_soc);
  672. /*
  673. * htt_get_htc_handle_() - set HTC handle
  674. * @htt_hdl: HTT handle/SOC
  675. *
  676. * Return: HTC_HANDLE
  677. */
  678. HTC_HANDLE htt_get_htc_handle(struct htt_soc *htt_hdl);
  679. /*
  680. * htt_soc_htc_dealloc() - HTC memory de-alloc
  681. * @htt_soc: SOC level HTT handle
  682. *
  683. * Return: None
  684. */
  685. void htt_soc_htc_dealloc(struct htt_soc *htt_handle);
  686. /*
  687. * htt_soc_htc_prealloc() - HTC memory prealloc
  688. * @htt_soc: SOC level HTT handle
  689. *
  690. * Return: QDF_STATUS_SUCCESS on success or
  691. * QDF_STATUS_E_NO_MEM on allocation failure
  692. */
  693. QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *htt_soc);
  694. void htt_soc_detach(struct htt_soc *soc);
  695. int htt_srng_setup(struct htt_soc *htt_soc, int pdev_id,
  696. hal_ring_handle_t hal_ring_hdl,
  697. int hal_ring_type);
  698. int htt_soc_attach_target(struct htt_soc *htt_soc);
  699. /*
  700. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  701. * config message to target
  702. * @htt_soc: HTT SOC handle
  703. * @pdev_id: PDEV Id
  704. * @hal_srng: Opaque HAL SRNG pointer
  705. * @hal_ring_type: SRNG ring type
  706. * @ring_buf_size: SRNG buffer size
  707. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  708. *
  709. * Return: 0 on success; error code on failure
  710. */
  711. int htt_h2t_rx_ring_cfg(struct htt_soc *htt_soc, int pdev_id,
  712. hal_ring_handle_t hal_ring_hdl,
  713. int hal_ring_type, int ring_buf_size,
  714. struct htt_rx_ring_tlv_filter *htt_tlv_filter);
  715. /*
  716. * htt_t2h_stats_handler() - target to host stats work handler
  717. * @context: context (dp soc context)
  718. *
  719. * Return: void
  720. */
  721. void htt_t2h_stats_handler(void *context);
  722. /**
  723. * struct htt_stats_context - htt stats information
  724. * @soc: Size of each descriptor in the pool
  725. * @msg: T2H Ext stats message queue
  726. * @msg_len: T2H Ext stats message length
  727. */
  728. struct htt_stats_context {
  729. struct dp_soc *soc;
  730. qdf_nbuf_queue_t msg;
  731. uint32_t msg_len;
  732. };
  733. /**
  734. * dp_htt_rx_flow_fst_setup(): Send HTT Rx FST setup message to FW
  735. * @pdev: DP pdev handle
  736. * @fse_setup_info: FST setup parameters
  737. *
  738. * Return: Success when HTT message is sent, error on failure
  739. */
  740. QDF_STATUS
  741. dp_htt_rx_flow_fst_setup(struct dp_pdev *pdev,
  742. struct dp_htt_rx_flow_fst_setup *setup_info);
  743. /**
  744. * dp_htt_rx_flow_fse_operation(): Send HTT Flow Search Entry msg to
  745. * add/del a flow in HW
  746. * @pdev: DP pdev handle
  747. * @fse_op_info: Flow entry parameters
  748. *
  749. * Return: Success when HTT message is sent, error on failure
  750. */
  751. QDF_STATUS
  752. dp_htt_rx_flow_fse_operation(struct dp_pdev *pdev,
  753. struct dp_htt_rx_flow_fst_operation *op_info);
  754. /**
  755. * htt_h2t_full_mon_cfg() - Send full monitor configuarion msg to FW
  756. *
  757. * @htt_soc: HTT Soc handle
  758. * @pdev_id: Radio id
  759. * @dp_full_mon_config: enabled/disable configuration
  760. *
  761. * Return: Success when HTT message is sent, error on failure
  762. */
  763. int htt_h2t_full_mon_cfg(struct htt_soc *htt_soc,
  764. uint8_t pdev_id,
  765. enum dp_full_mon_config);
  766. #endif /* _DP_HTT_H_ */