target_if_cfr_6018.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /*
  2. * Copyright (c) 2019 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 _TARGET_IF_CFR_6018_H_
  19. #define _TARGET_IF_CFR_6018_H_
  20. #ifdef WLAN_ENH_CFR_ENABLE
  21. /*
  22. * Memory requirements :
  23. *
  24. * 1. DMA header :
  25. *
  26. * Legacy DMA header(QCA8074V2) : 2 words (length = 8 bytes)
  27. * Enhanced DMA header(QCA6018) : Upto 16 words depending on no. of MU users
  28. * in UL-MU-PPDU (Max length = 64 bytes)
  29. *
  30. * Fixed 4 words for whal_cfir_enhanced_hdr + freeze TLV
  31. * + uplink_user_info TLV (MAX 4)
  32. *
  33. * mu_rx_num_users -> No. of words in CFR DMA header
  34. * 0 -> 12 = 4 + 7(freeze TLV) + 1(for 64-bit alignment)
  35. * 1 -> 12 = 4 + 7(freeze TLV) + 1(user1)
  36. * 2 -> 14 = 4 + 7(freeze TLV) + 2(users 1,2) + 1(for 64-bit alignment)
  37. * 3 -> 14 = 4 + 7(freeze TLV) + 3(users 1,2,3)
  38. * 4 -> 16 = 4 + 7(freeze TLV) + 4(users 1,2,3,4) + 1(for 64-bit alignment)
  39. *
  40. *
  41. * 2. CFR data size for max BW/Nss/Nrx
  42. *
  43. * Cypress : Max BW = 80 MHz
  44. * NSS = 2
  45. * Nrx = 2
  46. * Size of one tone = 4 bytes
  47. *
  48. * a. RTT-H - 2048 bytes
  49. *
  50. * b. Debug-H (MIMO CFR) - 16016 bytes
  51. *
  52. * c. RTT-H + CIR - 10240 bytes = 2048(RTT-H) + 8192(CIR)
  53. */
  54. /* Max 4 users in MU case */
  55. #define CYP_CFR_MU_USERS 4
  56. #define CYP_MAX_HEADER_LENGTH_WORDS 16
  57. /* payload_len = Max(2048, 16016, 10240) = 16064 (64-bit alignment) */
  58. #define CYP_MAX_DATA_LENGTH_BYTES 16064
  59. /* in ms */
  60. #define LUT_AGE_TIMER 3000
  61. #define LUT_AGE_THRESHOLD 3000
  62. #define NUM_LUT_ENTRIES 136
  63. /* Max size :
  64. * 16173 = 93 bytes(csi header) + 64 bytes(cfr header) + 16016 bytes(cfr
  65. * payload)
  66. */
  67. #define STREAMFS_MAX_SUBBUF_CYP 16173
  68. #define STREAMFS_NUM_SUBBUF_CYP 255
  69. /*
  70. * @tag: ucode fills this with 0xBA
  71. *
  72. * @length: length of CFR header in words (32-bit)
  73. *
  74. * @upload_done: ucode sets this to 1 to indicate DMA completion
  75. *
  76. * @capture_type:
  77. *
  78. * 0 - None
  79. * 1 - RTT-H (Nss = 1, Nrx)
  80. * 2 - Debug-H (Nss, Nrx)
  81. * 3 - Reserved
  82. * 5 - RTT-H + CIR(Nss, Nrx)
  83. *
  84. * @preamble_type:
  85. *
  86. * 0 - Legacy
  87. * 1 - HT
  88. * 2 - VHT
  89. * 3 - HE
  90. *
  91. * @nss:
  92. *
  93. * 0 - 1-stream
  94. * 1 - 2-stream
  95. * .. ..
  96. * 7 - 8-stream
  97. *
  98. *@num_chains:
  99. *
  100. * 0 - 1-chain
  101. * 1 - 2-chain
  102. * .. ..
  103. * 7 - 8-chain
  104. *
  105. *@upload_bw_pkt:
  106. *
  107. * 0 - 20 MHz
  108. * 1 - 40 MHz
  109. * 2 - 80 MHz
  110. * 3 - 160 MHz
  111. *
  112. * @sw_peer_id_valid: Indicates whether sw_peer_id field is valid or not,
  113. * sent from MAC to PHY via the MACRX_FREEZE_CAPTURE_CHANNEL TLV
  114. *
  115. * @sw_peer_id: Indicates peer id based on AST search, sent from MAC to PHY
  116. * via the MACRX_FREEZE_CAPTURE_CHANNEL TLV
  117. *
  118. * @phy_ppdu_id: sent from PHY to MAC, copied to MACRX_FREEZE_CAPTURE_CHANNEL
  119. * TLV
  120. *
  121. * @total_bytes: Total size of CFR payload (FFT bins)
  122. *
  123. * @header_version:
  124. *
  125. * 1 - HKV2/Hastings
  126. * 2 - Cypress
  127. *
  128. * @target_id:
  129. *
  130. * 1 - Hastings
  131. * 2 - Cypress
  132. * 3 - Hastings Prime
  133. * 4 - Pine
  134. *
  135. * @cfr_fmt:
  136. *
  137. * 0 - raw (32-bit format)
  138. * 1 - compressed (24-bit format)
  139. *
  140. * @mu_rx_data_incl: Indicates whether CFR header contains UL-MU-MIMO info
  141. *
  142. * @freeze_data_incl: Indicates whether CFR header contains
  143. * MACRX_FREEZE_CAPTURE_CHANNEL TLV
  144. *
  145. * @decimation_factor: FFT bins decimation
  146. * @mu_rx_num_users: Number of users in UL-MU-PPDU
  147. */
  148. struct whal_cfir_enhanced_hdr {
  149. uint16_t tag : 8,
  150. length : 6,
  151. rsvd1 : 2;
  152. uint16_t upload_done : 1,
  153. capture_type : 3,
  154. preamble_type : 2,
  155. nss : 3,
  156. num_chains : 3,
  157. upload_pkt_bw : 3,
  158. sw_peer_id_valid : 1;
  159. uint16_t sw_peer_id : 16;
  160. uint16_t phy_ppdu_id : 16;
  161. uint16_t total_bytes;
  162. uint16_t header_version :4,
  163. target_id :4,
  164. cfr_fmt :1,
  165. rsvd2 :1,
  166. mu_rx_data_incl :1,
  167. freeze_data_incl:1,
  168. rsvd3 :4;
  169. uint16_t mu_rx_num_users :8,
  170. decimation_factor :4,
  171. rsvd4 :4;
  172. uint16_t rsvd5;
  173. };
  174. struct macrx_freeze_capture_channel {
  175. uint16_t freeze : 1, //[0]
  176. capture_reason : 3, //[3:1]
  177. packet_type : 2, //[5:4]
  178. packet_sub_type : 4, //[9:6]
  179. reserved : 5, //[14:10]
  180. sw_peer_id_valid : 1; //[15]
  181. uint16_t sw_peer_id : 16; //[15:0]
  182. uint16_t phy_ppdu_id : 16; //[15:0]
  183. uint16_t packet_ta_lower_16 : 16; //[15:0]
  184. uint16_t packet_ta_mid_16 : 16; //[15:0]
  185. uint16_t packet_ta_upper_16 : 16; //[15:0]
  186. uint16_t packet_ra_lower_16 : 16; //[15:0]
  187. uint16_t packet_ra_mid_16 : 16; //[15:0]
  188. uint16_t packet_ra_upper_16 : 16; //[15:0]
  189. uint16_t tsf_timestamp_15_0 : 16; //[15:0]
  190. uint16_t tsf_timestamp_31_16 : 16; //[15:0]
  191. uint16_t tsf_timestamp_47_32 : 16; //[15:0]
  192. uint16_t tsf_timestamp_63_48 : 16; //[15:0]
  193. uint16_t user_index : 6, //[5:0]
  194. directed : 1, //[6]
  195. reserved_13 : 9; //[15:7]
  196. };
  197. struct uplink_user_setup_info {
  198. uint32_t bw_info_valid : 1, //[0]
  199. uplink_receive_type : 2, //[2:1]
  200. reserved_0a : 1, //[3]
  201. uplink_11ax_mcs : 4, //[7:4]
  202. ru_width : 7, //[14:8]
  203. reserved_0b : 1, //[15]
  204. nss : 3, //[18:16]
  205. stream_offset : 3, //[21:19]
  206. sta_dcm : 1, //[22]
  207. sta_coding : 1, //[23]
  208. ru_start_index : 7, //[30:24]
  209. reserved_0c : 1; //[31]
  210. };
  211. /**
  212. * cfr_6018_init_pdev() - Inits cfr pdev and registers necessary handlers.
  213. * @psoc: pointer to psoc object
  214. * @pdev: pointer to pdev object
  215. *
  216. * Return: Registration status for necessary handlers
  217. */
  218. QDF_STATUS cfr_6018_init_pdev(
  219. struct wlan_objmgr_psoc *psoc,
  220. struct wlan_objmgr_pdev *pdev);
  221. /**
  222. * cfr_6018_deinit_pdev() - De-inits corresponding pdev and handlers.
  223. * @psoc: pointer to psoc object
  224. * @pdev: pointer to pdev object
  225. *
  226. * Return: De-registration status for necessary handlers
  227. */
  228. QDF_STATUS cfr_6018_deinit_pdev(
  229. struct wlan_objmgr_psoc *psoc,
  230. struct wlan_objmgr_pdev *pdev);
  231. /**
  232. * target_if_cfr_start_lut_age_timer() - Start timer to flush aged-out LUT
  233. * entries
  234. * @pdev: pointer to pdev object
  235. *
  236. * Return: None
  237. */
  238. void target_if_cfr_start_lut_age_timer(struct wlan_objmgr_pdev *pdev);
  239. /**
  240. * target_if_cfr_stop_lut_age_timer() - Stop timer to flush aged-out LUT
  241. * entries
  242. * @pdev: pointer to pdev object
  243. *
  244. * Return: None
  245. */
  246. void target_if_cfr_stop_lut_age_timer(struct wlan_objmgr_pdev *pdev);
  247. /**
  248. * target_if_cfr_dump_lut_enh() - Dump all valid LUT entries
  249. * @pdev: objmgr PDEV
  250. *
  251. * Return: none
  252. */
  253. void target_if_cfr_dump_lut_enh(struct wlan_objmgr_pdev *pdev);
  254. /**
  255. * target_if_cfr_config_rcc() - Start repetitive channel capture
  256. * @pdev: pointer to pdev object
  257. * @rcc_param: rcc configurations
  258. *
  259. * Return: Success/Failure status
  260. */
  261. QDF_STATUS target_if_cfr_config_rcc(struct wlan_objmgr_pdev *pdev,
  262. struct cfr_rcc_param *rcc_param);
  263. /**
  264. * target_if_cfr_default_ta_ra_config() - Configure default values to all
  265. * params(BW/NSS/TA/RA) in TA_RA mode
  266. * @rcc_param: rcc configurations
  267. * @allvalid: Indicates whether all TA_RA params are valid or not.
  268. * It could be either 0 or 1.
  269. * 1: should be sent to FW during CFR initialization
  270. * 0: should be set, after a successful commit session.
  271. * @reset_cfg: This bitmap is being used to determine which groups'
  272. * parameters are needed to be reset to its default state.
  273. */
  274. void target_if_cfr_default_ta_ra_config(struct cfr_rcc_param *rcc_param,
  275. bool allvalid, uint16_t reset_cfg);
  276. /**
  277. * target_if_cfr_rx_tlv_process() - Process PPDU status TLVs and store info in
  278. * lookup table
  279. * @pdev: PDEV object
  280. * @nbuf: ppdu info
  281. *
  282. * Return: none
  283. */
  284. void target_if_cfr_rx_tlv_process(struct wlan_objmgr_pdev *pdev, void *nbuf);
  285. /**
  286. * target_if_cfr_update_global_cfg() - Update global config after a successful
  287. * commit
  288. * @pdev: pointer to pdev object
  289. *
  290. * Return: None
  291. */
  292. void target_if_cfr_update_global_cfg(struct wlan_objmgr_pdev *pdev);
  293. #else
  294. static QDF_STATUS cfr_6018_init_pdev(
  295. struct wlan_objmgr_psoc *psoc,
  296. struct wlan_objmgr_pdev *pdev)
  297. {
  298. return QDF_STATUS_SUCCESS;
  299. }
  300. static QDF_STATUS cfr_6018_deinit_pdev(
  301. struct wlan_objmgr_psoc *psoc,
  302. struct wlan_objmgr_pdev *pdev)
  303. {
  304. return QDF_STATUS_SUCCESS;
  305. }
  306. #endif
  307. #endif