hal_api_mon.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /*
  2. * Copyright (c) 2017-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 _HAL_API_MON_H_
  19. #define _HAL_API_MON_H_
  20. #include "qdf_types.h"
  21. #include "hal_internal.h"
  22. #include <target_type.h>
  23. #define HAL_RX_PHY_DATA_RADAR 0x01
  24. #define HAL_SU_MU_CODING_LDPC 0x01
  25. #define HAL_RX_FCS_LEN (4)
  26. #define KEY_EXTIV 0x20
  27. #define HAL_RX_USER_TLV32_TYPE_OFFSET 0x00000000
  28. #define HAL_RX_USER_TLV32_TYPE_LSB 1
  29. #define HAL_RX_USER_TLV32_TYPE_MASK 0x000003FE
  30. #define HAL_RX_USER_TLV32_LEN_OFFSET 0x00000000
  31. #define HAL_RX_USER_TLV32_LEN_LSB 10
  32. #define HAL_RX_USER_TLV32_LEN_MASK 0x003FFC00
  33. #define HAL_RX_USER_TLV32_USERID_OFFSET 0x00000000
  34. #define HAL_RX_USER_TLV32_USERID_LSB 26
  35. #define HAL_RX_USER_TLV32_USERID_MASK 0xFC000000
  36. #define HAL_ALIGN(x, a) HAL_ALIGN_MASK(x, (a)-1)
  37. #define HAL_ALIGN_MASK(x, mask) (typeof(x))(((uint32)(x) + (mask)) & ~(mask))
  38. #define HAL_RX_TLV32_HDR_SIZE 4
  39. #define HAL_RX_GET_USER_TLV32_TYPE(rx_status_tlv_ptr) \
  40. ((*((uint32_t *)(rx_status_tlv_ptr)) & \
  41. HAL_RX_USER_TLV32_TYPE_MASK) >> \
  42. HAL_RX_USER_TLV32_TYPE_LSB)
  43. #define HAL_RX_GET_USER_TLV32_LEN(rx_status_tlv_ptr) \
  44. ((*((uint32_t *)(rx_status_tlv_ptr)) & \
  45. HAL_RX_USER_TLV32_LEN_MASK) >> \
  46. HAL_RX_USER_TLV32_LEN_LSB)
  47. #define HAL_RX_GET_USER_TLV32_USERID(rx_status_tlv_ptr) \
  48. ((*((uint32_t *)(rx_status_tlv_ptr)) & \
  49. HAL_RX_USER_TLV32_USERID_MASK) >> \
  50. HAL_RX_USER_TLV32_USERID_LSB)
  51. #define HAL_TLV_STATUS_PPDU_NOT_DONE 0
  52. #define HAL_TLV_STATUS_PPDU_DONE 1
  53. #define HAL_TLV_STATUS_BUF_DONE 2
  54. #define HAL_TLV_STATUS_PPDU_NON_STD_DONE 3
  55. #define HAL_TLV_STATUS_PPDU_START 4
  56. #define HAL_TLV_STATUS_HEADER 5
  57. #define HAL_TLV_STATUS_MPDU_END 6
  58. #define HAL_TLV_STATUS_MSDU_START 7
  59. #define HAL_TLV_STATUS_MSDU_END 8
  60. #define HAL_MAX_UL_MU_USERS 37
  61. #define HAL_RX_PKT_TYPE_11A 0
  62. #define HAL_RX_PKT_TYPE_11B 1
  63. #define HAL_RX_PKT_TYPE_11N 2
  64. #define HAL_RX_PKT_TYPE_11AC 3
  65. #define HAL_RX_PKT_TYPE_11AX 4
  66. #define HAL_RX_RECEPTION_TYPE_SU 0
  67. #define HAL_RX_RECEPTION_TYPE_MU_MIMO 1
  68. #define HAL_RX_RECEPTION_TYPE_OFDMA 2
  69. #define HAL_RX_RECEPTION_TYPE_MU_OFDMA 3
  70. /* Multiply rate by 2 to avoid float point
  71. * and get rate in units of 500kbps
  72. */
  73. #define HAL_11B_RATE_0MCS 11*2
  74. #define HAL_11B_RATE_1MCS 5.5*2
  75. #define HAL_11B_RATE_2MCS 2*2
  76. #define HAL_11B_RATE_3MCS 1*2
  77. #define HAL_11B_RATE_4MCS 11*2
  78. #define HAL_11B_RATE_5MCS 5.5*2
  79. #define HAL_11B_RATE_6MCS 2*2
  80. #define HAL_11A_RATE_0MCS 48*2
  81. #define HAL_11A_RATE_1MCS 24*2
  82. #define HAL_11A_RATE_2MCS 12*2
  83. #define HAL_11A_RATE_3MCS 6*2
  84. #define HAL_11A_RATE_4MCS 54*2
  85. #define HAL_11A_RATE_5MCS 36*2
  86. #define HAL_11A_RATE_6MCS 18*2
  87. #define HAL_11A_RATE_7MCS 9*2
  88. #define HAL_LEGACY_MCS0 0
  89. #define HAL_LEGACY_MCS1 1
  90. #define HAL_LEGACY_MCS2 2
  91. #define HAL_LEGACY_MCS3 3
  92. #define HAL_LEGACY_MCS4 4
  93. #define HAL_LEGACY_MCS5 5
  94. #define HAL_LEGACY_MCS6 6
  95. #define HAL_LEGACY_MCS7 7
  96. #define HE_GI_0_8 0
  97. #define HE_GI_0_4 1
  98. #define HE_GI_1_6 2
  99. #define HE_GI_3_2 3
  100. #define HT_SGI_PRESENT 0x80
  101. #define HE_LTF_1_X 0
  102. #define HE_LTF_2_X 1
  103. #define HE_LTF_4_X 2
  104. #define HE_LTF_UNKNOWN 3
  105. #define VHT_SIG_SU_NSS_MASK 0x7
  106. #define HT_SIG_SU_NSS_SHIFT 0x3
  107. #define HAL_TID_INVALID 31
  108. #define HAL_AST_IDX_INVALID 0xFFFF
  109. #ifdef GET_MSDU_AGGREGATION
  110. #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)\
  111. {\
  112. struct rx_msdu_end *rx_msdu_end;\
  113. bool first_msdu, last_msdu; \
  114. rx_msdu_end = &rx_desc->msdu_end_tlv.rx_msdu_end;\
  115. first_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_5, FIRST_MSDU);\
  116. last_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_5, LAST_MSDU);\
  117. if (first_msdu && last_msdu)\
  118. rs->rs_flags &= (~IEEE80211_AMSDU_FLAG);\
  119. else\
  120. rs->rs_flags |= (IEEE80211_AMSDU_FLAG); \
  121. } \
  122. #else
  123. #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)
  124. #endif
  125. #define HAL_RX_MPDU_FCS_BITMAP_0_31_OFFSET 0x00000000FFFFFFFF
  126. #define HAL_RX_MPDU_FCS_BITMAP_LSB 32
  127. #define HAL_RX_MPDU_FCS_BITMAP_32_63_OFFSET 0xFFFFFFFF00000000
  128. /* Max MPDUs per status buffer */
  129. #define HAL_RX_MAX_MPDU 64
  130. /* Max pilot count */
  131. #define HAL_RX_MAX_SU_EVM_COUNT 32
  132. /*
  133. * Struct hal_rx_su_evm_info - SU evm info
  134. * @number_of_symbols: number of symbols
  135. * @nss_count: nss count
  136. * @pilot_count: pilot count
  137. * @pilot_evm: Array of pilot evm values
  138. */
  139. struct hal_rx_su_evm_info {
  140. uint32_t number_of_symbols;
  141. uint8_t nss_count;
  142. uint8_t pilot_count;
  143. uint32_t pilot_evm[HAL_RX_MAX_SU_EVM_COUNT];
  144. };
  145. enum {
  146. DP_PPDU_STATUS_START,
  147. DP_PPDU_STATUS_DONE,
  148. };
  149. static inline
  150. uint32_t HAL_RX_MON_HW_RX_DESC_SIZE(void)
  151. {
  152. /* return the HW_RX_DESC size */
  153. return sizeof(struct rx_pkt_tlvs);
  154. }
  155. static inline
  156. uint8_t *HAL_RX_MON_DEST_GET_DESC(uint8_t *data)
  157. {
  158. return data;
  159. }
  160. static inline
  161. uint32_t HAL_RX_DESC_GET_MPDU_LENGTH_ERR(void *hw_desc_addr)
  162. {
  163. struct rx_attention *rx_attn;
  164. struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)hw_desc_addr;
  165. rx_attn = &rx_desc->attn_tlv.rx_attn;
  166. return HAL_RX_GET(rx_attn, RX_ATTENTION_1, MPDU_LENGTH_ERR);
  167. }
  168. static inline
  169. uint32_t HAL_RX_DESC_GET_MPDU_FCS_ERR(void *hw_desc_addr)
  170. {
  171. struct rx_attention *rx_attn;
  172. struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)hw_desc_addr;
  173. rx_attn = &rx_desc->attn_tlv.rx_attn;
  174. return HAL_RX_GET(rx_attn, RX_ATTENTION_1, FCS_ERR);
  175. }
  176. /*
  177. * HAL_RX_HW_DESC_MPDU_VALID() - check MPDU start TLV tag in MPDU
  178. * start TLV of Hardware TLV descriptor
  179. * @hw_desc_addr: Hardware desciptor address
  180. *
  181. * Return: bool: if TLV tag match
  182. */
  183. static inline
  184. bool HAL_RX_HW_DESC_MPDU_VALID(void *hw_desc_addr)
  185. {
  186. struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)hw_desc_addr;
  187. uint32_t tlv_tag;
  188. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(
  189. &rx_desc->mpdu_start_tlv);
  190. return tlv_tag == WIFIRX_MPDU_START_E ? true : false;
  191. }
  192. static inline
  193. uint32_t HAL_RX_HW_DESC_GET_PPDUID_GET(void *hw_desc_addr)
  194. {
  195. struct rx_mpdu_info *rx_mpdu_info;
  196. struct rx_pkt_tlvs *rx_desc = (struct rx_pkt_tlvs *)hw_desc_addr;
  197. rx_mpdu_info =
  198. &rx_desc->mpdu_start_tlv.rx_mpdu_start.rx_mpdu_info_details;
  199. return HAL_RX_GET(rx_mpdu_info, RX_MPDU_INFO_0, PHY_PPDU_ID);
  200. }
  201. /* TODO: Move all Rx descriptor functions to hal_rx.h to avoid duplication */
  202. #define HAL_RX_BUFFER_ADDR_31_0_GET(buff_addr_info) \
  203. (_HAL_MS((*_OFFSET_TO_WORD_PTR(buff_addr_info, \
  204. BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET)), \
  205. BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_MASK, \
  206. BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_LSB))
  207. #define HAL_RX_REO_ENT_BUFFER_ADDR_39_32_GET(reo_ent_desc) \
  208. (HAL_RX_BUFFER_ADDR_39_32_GET(& \
  209. (((struct reo_entrance_ring *)reo_ent_desc) \
  210. ->reo_level_mpdu_frame_info.msdu_link_desc_addr_info)))
  211. #define HAL_RX_REO_ENT_BUFFER_ADDR_31_0_GET(reo_ent_desc) \
  212. (HAL_RX_BUFFER_ADDR_31_0_GET(& \
  213. (((struct reo_entrance_ring *)reo_ent_desc) \
  214. ->reo_level_mpdu_frame_info.msdu_link_desc_addr_info)))
  215. #define HAL_RX_REO_ENT_BUF_COOKIE_GET(reo_ent_desc) \
  216. (HAL_RX_BUF_COOKIE_GET(& \
  217. (((struct reo_entrance_ring *)reo_ent_desc) \
  218. ->reo_level_mpdu_frame_info.msdu_link_desc_addr_info)))
  219. /**
  220. * hal_rx_reo_ent_buf_paddr_get: Gets the physical address and
  221. * cookie from the REO entrance ring element
  222. *
  223. * @ hal_rx_desc_cookie: Opaque cookie pointer used by HAL to get to
  224. * the current descriptor
  225. * @ buf_info: structure to return the buffer information
  226. * @ msdu_cnt: pointer to msdu count in MPDU
  227. * Return: void
  228. */
  229. static inline
  230. void hal_rx_reo_ent_buf_paddr_get(void *rx_desc,
  231. struct hal_buf_info *buf_info,
  232. void **pp_buf_addr_info,
  233. uint32_t *msdu_cnt
  234. )
  235. {
  236. struct reo_entrance_ring *reo_ent_ring =
  237. (struct reo_entrance_ring *)rx_desc;
  238. struct buffer_addr_info *buf_addr_info;
  239. struct rx_mpdu_desc_info *rx_mpdu_desc_info_details;
  240. uint32_t loop_cnt;
  241. rx_mpdu_desc_info_details =
  242. &reo_ent_ring->reo_level_mpdu_frame_info.rx_mpdu_desc_info_details;
  243. *msdu_cnt = HAL_RX_GET(rx_mpdu_desc_info_details,
  244. RX_MPDU_DESC_INFO_0, MSDU_COUNT);
  245. loop_cnt = HAL_RX_GET(reo_ent_ring, REO_ENTRANCE_RING_7, LOOPING_COUNT);
  246. buf_addr_info =
  247. &reo_ent_ring->reo_level_mpdu_frame_info.msdu_link_desc_addr_info;
  248. buf_info->paddr =
  249. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  250. ((uint64_t)
  251. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  252. buf_info->sw_cookie = HAL_RX_BUF_COOKIE_GET(buf_addr_info);
  253. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  254. "[%s][%d] ReoAddr=%pK, addrInfo=%pK, paddr=0x%llx, loopcnt=%d",
  255. __func__, __LINE__, reo_ent_ring, buf_addr_info,
  256. (unsigned long long)buf_info->paddr, loop_cnt);
  257. *pp_buf_addr_info = (void *)buf_addr_info;
  258. }
  259. static inline
  260. void hal_rx_mon_next_link_desc_get(void *rx_msdu_link_desc,
  261. struct hal_buf_info *buf_info, void **pp_buf_addr_info)
  262. {
  263. struct rx_msdu_link *msdu_link =
  264. (struct rx_msdu_link *)rx_msdu_link_desc;
  265. struct buffer_addr_info *buf_addr_info;
  266. buf_addr_info = &msdu_link->next_msdu_link_desc_addr_info;
  267. buf_info->paddr =
  268. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  269. ((uint64_t)
  270. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  271. buf_info->sw_cookie = HAL_RX_BUF_COOKIE_GET(buf_addr_info);
  272. *pp_buf_addr_info = (void *)buf_addr_info;
  273. }
  274. /**
  275. * hal_rx_msdu_link_desc_set: Retrieves MSDU Link Descriptor to WBM
  276. *
  277. * @ soc : HAL version of the SOC pointer
  278. * @ src_srng_desc : void pointer to the WBM Release Ring descriptor
  279. * @ buf_addr_info : void pointer to the buffer_addr_info
  280. *
  281. * Return: void
  282. */
  283. static inline void hal_rx_mon_msdu_link_desc_set(struct hal_soc *soc,
  284. void *src_srng_desc, void *buf_addr_info)
  285. {
  286. struct buffer_addr_info *wbm_srng_buffer_addr_info =
  287. (struct buffer_addr_info *)src_srng_desc;
  288. uint64_t paddr;
  289. struct buffer_addr_info *p_buffer_addr_info =
  290. (struct buffer_addr_info *)buf_addr_info;
  291. paddr =
  292. (HAL_RX_BUFFER_ADDR_31_0_GET(buf_addr_info) |
  293. ((uint64_t)
  294. (HAL_RX_BUFFER_ADDR_39_32_GET(buf_addr_info)) << 32));
  295. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  296. "[%s][%d] src_srng_desc=%pK, buf_addr=0x%llx, cookie=0x%llx",
  297. __func__, __LINE__, src_srng_desc, (unsigned long long)paddr,
  298. (unsigned long long)p_buffer_addr_info->sw_buffer_cookie);
  299. /* Structure copy !!! */
  300. *wbm_srng_buffer_addr_info =
  301. *((struct buffer_addr_info *)buf_addr_info);
  302. }
  303. static inline
  304. uint32 hal_get_rx_msdu_link_desc_size(void)
  305. {
  306. return sizeof(struct rx_msdu_link);
  307. }
  308. enum {
  309. HAL_PKT_TYPE_OFDM = 0,
  310. HAL_PKT_TYPE_CCK,
  311. HAL_PKT_TYPE_HT,
  312. HAL_PKT_TYPE_VHT,
  313. HAL_PKT_TYPE_HE,
  314. };
  315. enum {
  316. HAL_SGI_0_8_US,
  317. HAL_SGI_0_4_US,
  318. HAL_SGI_1_6_US,
  319. HAL_SGI_3_2_US,
  320. };
  321. enum {
  322. HAL_FULL_RX_BW_20,
  323. HAL_FULL_RX_BW_40,
  324. HAL_FULL_RX_BW_80,
  325. HAL_FULL_RX_BW_160,
  326. };
  327. enum {
  328. HAL_RX_TYPE_SU,
  329. HAL_RX_TYPE_MU_MIMO,
  330. HAL_RX_TYPE_MU_OFDMA,
  331. HAL_RX_TYPE_MU_OFDMA_MIMO,
  332. };
  333. /**
  334. * enum
  335. * @HAL_RX_MON_PPDU_START: PPDU start TLV is decoded in HAL
  336. * @HAL_RX_MON_PPDU_END: PPDU end TLV is decided in HAL
  337. */
  338. enum {
  339. HAL_RX_MON_PPDU_START = 0,
  340. HAL_RX_MON_PPDU_END,
  341. };
  342. struct hal_rx_ppdu_common_info {
  343. uint32_t ppdu_id;
  344. uint32_t ppdu_timestamp;
  345. uint32_t mpdu_cnt_fcs_ok;
  346. uint32_t mpdu_cnt_fcs_err;
  347. uint64_t mpdu_fcs_ok_bitmap;
  348. uint32_t last_ppdu_id;
  349. uint32_t mpdu_cnt;
  350. };
  351. /**
  352. * struct hal_rx_msdu_payload_info - msdu payload info
  353. * @first_msdu_payload: pointer to first msdu payload
  354. * @payload_len: payload len
  355. * @nbuf: status network buffer to which msdu belongs to
  356. */
  357. struct hal_rx_msdu_payload_info {
  358. uint8_t *first_msdu_payload;
  359. uint32_t payload_len;
  360. qdf_nbuf_t nbuf;
  361. };
  362. /**
  363. * struct hal_rx_nac_info - struct for neighbour info
  364. * @fc_valid: flag indicate if it has valid frame control information
  365. * @frame_control: frame control from each MPDU
  366. * @to_ds_flag: flag indicate to_ds bit
  367. * @mac_addr2_valid: flag indicate if mac_addr2 is valid
  368. * @mac_addr2: mac address2 in wh
  369. */
  370. struct hal_rx_nac_info {
  371. uint8_t fc_valid;
  372. uint16_t frame_control;
  373. uint8_t to_ds_flag;
  374. uint8_t mac_addr2_valid;
  375. uint8_t mac_addr2[QDF_MAC_ADDR_SIZE];
  376. };
  377. /**
  378. * struct hal_rx_ppdu_msdu_info - struct for msdu info from HW TLVs
  379. * @cce_metadata: cached metadata value received in the MSDU_END TLV
  380. */
  381. struct hal_rx_ppdu_msdu_info {
  382. uint16_t cce_metadata;
  383. };
  384. struct hal_rx_ppdu_info {
  385. struct hal_rx_ppdu_common_info com_info;
  386. struct mon_rx_status rx_status;
  387. struct mon_rx_user_status rx_user_status[HAL_MAX_UL_MU_USERS];
  388. struct hal_rx_msdu_payload_info msdu_info;
  389. struct hal_rx_msdu_payload_info fcs_ok_msdu_info;
  390. struct hal_rx_nac_info nac_info;
  391. /* status ring PPDU start and end state */
  392. uint32_t rx_state;
  393. /* MU user id for status ring TLV */
  394. uint32_t user_id;
  395. /* MPDU/MSDU truncated to 128 bytes header start addr in status skb */
  396. unsigned char *data;
  397. /* MPDU/MSDU truncated to 128 bytes header real length */
  398. uint32_t hdr_len;
  399. /* MPDU FCS error */
  400. bool fcs_err;
  401. struct hal_rx_ppdu_msdu_info rx_msdu_info[HAL_MAX_UL_MU_USERS];
  402. /* first msdu payload for all mpdus in ppdu */
  403. struct hal_rx_msdu_payload_info ppdu_msdu_info[HAL_RX_MAX_MPDU];
  404. /* evm info */
  405. struct hal_rx_su_evm_info evm_info;
  406. };
  407. static inline uint32_t
  408. hal_get_rx_status_buf_size(void) {
  409. /* RX status buffer size is hard coded for now */
  410. return 2048;
  411. }
  412. static inline uint8_t*
  413. hal_rx_status_get_next_tlv(uint8_t *rx_tlv) {
  414. uint32_t tlv_len, tlv_tag;
  415. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv);
  416. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
  417. /* The actual length of PPDU_END is the combined length of many PHY
  418. * TLVs that follow. Skip the TLV header and
  419. * rx_rxpcu_classification_overview that follows the header to get to
  420. * next TLV.
  421. */
  422. if (tlv_tag == WIFIRX_PPDU_END_E)
  423. tlv_len = sizeof(struct rx_rxpcu_classification_overview);
  424. return (uint8_t *)(((unsigned long)(rx_tlv + tlv_len +
  425. HAL_RX_TLV32_HDR_SIZE + 3)) & (~((unsigned long)3)));
  426. }
  427. /**
  428. * hal_rx_proc_phyrx_other_receive_info_tlv()
  429. * - process other receive info TLV
  430. * @rx_tlv_hdr: pointer to TLV header
  431. * @ppdu_info: pointer to ppdu_info
  432. *
  433. * Return: None
  434. */
  435. static inline void hal_rx_proc_phyrx_other_receive_info_tlv(struct hal_soc *hal_soc,
  436. void *rx_tlv_hdr,
  437. struct hal_rx_ppdu_info
  438. *ppdu_info)
  439. {
  440. hal_soc->ops->hal_rx_proc_phyrx_other_receive_info_tlv(rx_tlv_hdr,
  441. (void *)ppdu_info);
  442. }
  443. /**
  444. * hal_rx_status_get_tlv_info() - process receive info TLV
  445. * @rx_tlv_hdr: pointer to TLV header
  446. * @ppdu_info: pointer to ppdu_info
  447. * @hal_soc: HAL soc handle
  448. * @nbuf: PPDU status netowrk buffer
  449. *
  450. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE or HAL_TLV_STATUS_PPDU_DONE from tlv
  451. */
  452. static inline uint32_t
  453. hal_rx_status_get_tlv_info(void *rx_tlv_hdr, void *ppdu_info,
  454. struct hal_soc *hal_soc,
  455. qdf_nbuf_t nbuf)
  456. {
  457. return hal_soc->ops->hal_rx_status_get_tlv_info(rx_tlv_hdr,
  458. ppdu_info, hal_soc,
  459. nbuf);
  460. }
  461. static inline
  462. uint32_t hal_get_rx_status_done_tlv_size(void *hal_soc)
  463. {
  464. return HAL_RX_TLV32_HDR_SIZE;
  465. }
  466. static inline QDF_STATUS
  467. hal_get_rx_status_done(uint8_t *rx_tlv)
  468. {
  469. uint32_t tlv_tag;
  470. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv);
  471. if (tlv_tag == WIFIRX_STATUS_BUFFER_DONE_E)
  472. return QDF_STATUS_SUCCESS;
  473. else
  474. return QDF_STATUS_E_EMPTY;
  475. }
  476. static inline QDF_STATUS
  477. hal_clear_rx_status_done(uint8_t *rx_tlv)
  478. {
  479. *(uint32_t *)rx_tlv = 0;
  480. return QDF_STATUS_SUCCESS;
  481. }
  482. #endif