tcl_status_ring.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /*
  2. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _TCL_STATUS_RING_H_
  17. #define _TCL_STATUS_RING_H_
  18. #if !defined(__ASSEMBLER__)
  19. #endif
  20. #define NUM_OF_DWORDS_TCL_STATUS_RING 8
  21. struct tcl_status_ring {
  22. #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
  23. uint32_t gse_ctrl : 4, // [3:0]
  24. ase_fse_sel : 1, // [4:4]
  25. cache_op_res : 2, // [6:5]
  26. index_search_en : 1, // [7:7]
  27. msdu_cnt_n : 24; // [31:8]
  28. uint32_t msdu_byte_cnt_n : 32; // [31:0]
  29. uint32_t msdu_timestmp_n : 32; // [31:0]
  30. uint32_t cmd_meta_data_31_0 : 32; // [31:0]
  31. uint32_t cmd_meta_data_63_32 : 32; // [31:0]
  32. uint32_t hash_indx_val : 20, // [19:0]
  33. cache_set_num : 4, // [23:20]
  34. reserved_5a : 8; // [31:24]
  35. uint32_t reserved_6a : 32; // [31:0]
  36. uint32_t reserved_7a : 20, // [19:0]
  37. ring_id : 8, // [27:20]
  38. looping_count : 4; // [31:28]
  39. #else
  40. uint32_t msdu_cnt_n : 24, // [31:8]
  41. index_search_en : 1, // [7:7]
  42. cache_op_res : 2, // [6:5]
  43. ase_fse_sel : 1, // [4:4]
  44. gse_ctrl : 4; // [3:0]
  45. uint32_t msdu_byte_cnt_n : 32; // [31:0]
  46. uint32_t msdu_timestmp_n : 32; // [31:0]
  47. uint32_t cmd_meta_data_31_0 : 32; // [31:0]
  48. uint32_t cmd_meta_data_63_32 : 32; // [31:0]
  49. uint32_t reserved_5a : 8, // [31:24]
  50. cache_set_num : 4, // [23:20]
  51. hash_indx_val : 20; // [19:0]
  52. uint32_t reserved_6a : 32; // [31:0]
  53. uint32_t looping_count : 4, // [31:28]
  54. ring_id : 8, // [27:20]
  55. reserved_7a : 20; // [19:0]
  56. #endif
  57. };
  58. /* Description GSE_CTRL
  59. GSE control operations. This includes cache operations and
  60. table entry statistics read/clear operation.
  61. <enum 0 rd_stat> Report or Read statistics
  62. <enum 1 srch_dis> Search disable. Report only Hash
  63. <enum 2 Wr_bk_single> Write Back single entry
  64. <enum 3 wr_bk_all> Write Back entire cache entry
  65. <enum 4 inval_single> Invalidate single cache entry
  66. <enum 5 inval_all> Invalidate entire cache
  67. <enum 6 wr_bk_inval_single> Write back and Invalidate single
  68. entry in cache
  69. <enum 7 wr_bk_inval_all> write back and invalidate entire
  70. cache
  71. <enum 8 clr_stat_single> Clear statistics for single entry
  72. <legal 0-8>
  73. Rest of the values reserved.
  74. For all single entry control operations (write back, Invalidate
  75. or both)Statistics will be reported
  76. */
  77. #define TCL_STATUS_RING_GSE_CTRL_OFFSET 0x00000000
  78. #define TCL_STATUS_RING_GSE_CTRL_LSB 0
  79. #define TCL_STATUS_RING_GSE_CTRL_MSB 3
  80. #define TCL_STATUS_RING_GSE_CTRL_MASK 0x0000000f
  81. /* Description ASE_FSE_SEL
  82. Search Engine for which operation is done.
  83. 1'b0: Address Search Engine Result
  84. 1'b1: Flow Search Engine result
  85. */
  86. #define TCL_STATUS_RING_ASE_FSE_SEL_OFFSET 0x00000000
  87. #define TCL_STATUS_RING_ASE_FSE_SEL_LSB 4
  88. #define TCL_STATUS_RING_ASE_FSE_SEL_MSB 4
  89. #define TCL_STATUS_RING_ASE_FSE_SEL_MASK 0x00000010
  90. /* Description CACHE_OP_RES
  91. Cache operation result. Following are results of cache operation.
  92. <enum 0 op_done> Operation successful
  93. <enum 1 not_fnd> Entry not found in Table
  94. <enum 2 timeout_er> Timeout Error
  95. <legal 0-2>
  96. */
  97. #define TCL_STATUS_RING_CACHE_OP_RES_OFFSET 0x00000000
  98. #define TCL_STATUS_RING_CACHE_OP_RES_LSB 5
  99. #define TCL_STATUS_RING_CACHE_OP_RES_MSB 6
  100. #define TCL_STATUS_RING_CACHE_OP_RES_MASK 0x00000060
  101. /* Description INDEX_SEARCH_EN
  102. When this bit is set to 1 control_buffer_addr[19:0] will
  103. be considered as index of the AST or Flow table and GSE
  104. commands will be executed accordingly on the entry pointed
  105. by the index.
  106. This feature is disabled by setting this bit to 0.
  107. <enum 0 index_based_cmd_disable>
  108. <enum 1 index_based_cmd_enable>
  109. <legal all>
  110. */
  111. #define TCL_STATUS_RING_INDEX_SEARCH_EN_OFFSET 0x00000000
  112. #define TCL_STATUS_RING_INDEX_SEARCH_EN_LSB 7
  113. #define TCL_STATUS_RING_INDEX_SEARCH_EN_MSB 7
  114. #define TCL_STATUS_RING_INDEX_SEARCH_EN_MASK 0x00000080
  115. /* Description MSDU_CNT_N
  116. MSDU count of Entry. Valid when GSE_CTRL is 4'b0111 and
  117. 4'b1000
  118. */
  119. #define TCL_STATUS_RING_MSDU_CNT_N_OFFSET 0x00000000
  120. #define TCL_STATUS_RING_MSDU_CNT_N_LSB 8
  121. #define TCL_STATUS_RING_MSDU_CNT_N_MSB 31
  122. #define TCL_STATUS_RING_MSDU_CNT_N_MASK 0xffffff00
  123. /* Description MSDU_BYTE_CNT_N
  124. MSDU byte count for entry 1. Valid when GSE_CTRL is 4'b0111
  125. and 4'b1000
  126. */
  127. #define TCL_STATUS_RING_MSDU_BYTE_CNT_N_OFFSET 0x00000004
  128. #define TCL_STATUS_RING_MSDU_BYTE_CNT_N_LSB 0
  129. #define TCL_STATUS_RING_MSDU_BYTE_CNT_N_MSB 31
  130. #define TCL_STATUS_RING_MSDU_BYTE_CNT_N_MASK 0xffffffff
  131. /* Description MSDU_TIMESTMP_N
  132. MSDU timestamp for entry 1. Valid when GSE_CTRL is 4'b0111
  133. and 4'b1000
  134. */
  135. #define TCL_STATUS_RING_MSDU_TIMESTMP_N_OFFSET 0x00000008
  136. #define TCL_STATUS_RING_MSDU_TIMESTMP_N_LSB 0
  137. #define TCL_STATUS_RING_MSDU_TIMESTMP_N_MSB 31
  138. #define TCL_STATUS_RING_MSDU_TIMESTMP_N_MASK 0xffffffff
  139. /* Description CMD_META_DATA_31_0
  140. Meta data from input ring
  141. <legal all>
  142. */
  143. #define TCL_STATUS_RING_CMD_META_DATA_31_0_OFFSET 0x0000000c
  144. #define TCL_STATUS_RING_CMD_META_DATA_31_0_LSB 0
  145. #define TCL_STATUS_RING_CMD_META_DATA_31_0_MSB 31
  146. #define TCL_STATUS_RING_CMD_META_DATA_31_0_MASK 0xffffffff
  147. /* Description CMD_META_DATA_63_32
  148. Meta data from input ring
  149. <legal all>
  150. */
  151. #define TCL_STATUS_RING_CMD_META_DATA_63_32_OFFSET 0x00000010
  152. #define TCL_STATUS_RING_CMD_META_DATA_63_32_LSB 0
  153. #define TCL_STATUS_RING_CMD_META_DATA_63_32_MSB 31
  154. #define TCL_STATUS_RING_CMD_META_DATA_63_32_MASK 0xffffffff
  155. /* Description HASH_INDX_VAL
  156. Index of entry in the table in case of search pass (or)
  157. Hash value of the entry in table in case of search failed
  158. or search disable.
  159. <legal all>
  160. */
  161. #define TCL_STATUS_RING_HASH_INDX_VAL_OFFSET 0x00000014
  162. #define TCL_STATUS_RING_HASH_INDX_VAL_LSB 0
  163. #define TCL_STATUS_RING_HASH_INDX_VAL_MSB 19
  164. #define TCL_STATUS_RING_HASH_INDX_VAL_MASK 0x000fffff
  165. /* Description CACHE_SET_NUM
  166. Cache set number copied from TCL_GSE_CMD
  167. */
  168. #define TCL_STATUS_RING_CACHE_SET_NUM_OFFSET 0x00000014
  169. #define TCL_STATUS_RING_CACHE_SET_NUM_LSB 20
  170. #define TCL_STATUS_RING_CACHE_SET_NUM_MSB 23
  171. #define TCL_STATUS_RING_CACHE_SET_NUM_MASK 0x00f00000
  172. /* Description RESERVED_5A
  173. <legal 0>
  174. */
  175. #define TCL_STATUS_RING_RESERVED_5A_OFFSET 0x00000014
  176. #define TCL_STATUS_RING_RESERVED_5A_LSB 24
  177. #define TCL_STATUS_RING_RESERVED_5A_MSB 31
  178. #define TCL_STATUS_RING_RESERVED_5A_MASK 0xff000000
  179. /* Description RESERVED_6A
  180. <legal 0>
  181. */
  182. #define TCL_STATUS_RING_RESERVED_6A_OFFSET 0x00000018
  183. #define TCL_STATUS_RING_RESERVED_6A_LSB 0
  184. #define TCL_STATUS_RING_RESERVED_6A_MSB 31
  185. #define TCL_STATUS_RING_RESERVED_6A_MASK 0xffffffff
  186. /* Description RESERVED_7A
  187. <legal 0>
  188. */
  189. #define TCL_STATUS_RING_RESERVED_7A_OFFSET 0x0000001c
  190. #define TCL_STATUS_RING_RESERVED_7A_LSB 0
  191. #define TCL_STATUS_RING_RESERVED_7A_MSB 19
  192. #define TCL_STATUS_RING_RESERVED_7A_MASK 0x000fffff
  193. /* Description RING_ID
  194. The buffer pointer ring ID.
  195. Helps with debugging when dumping ring contents.
  196. <legal all>
  197. */
  198. #define TCL_STATUS_RING_RING_ID_OFFSET 0x0000001c
  199. #define TCL_STATUS_RING_RING_ID_LSB 20
  200. #define TCL_STATUS_RING_RING_ID_MSB 27
  201. #define TCL_STATUS_RING_RING_ID_MASK 0x0ff00000
  202. /* Description LOOPING_COUNT
  203. A count value that indicates the number of times the producer
  204. of entries into the Ring has looped around the ring.
  205. At initialization time, this value is set to 0. On the first
  206. loop, this value is set to 1. After the max value is reached
  207. allowed by the number of bits for this field, the count
  208. value continues with 0 again.
  209. In case SW is the consumer of the ring entries, it can use
  210. this field to figure out up to where the producer of entries
  211. has created new entries. This eliminates the need to check
  212. where the "head pointer' of the ring is located once the
  213. SW starts processing an interrupt indicating that new entries
  214. have been put into this ring...
  215. Also note that SW if it wants only needs to look at the
  216. LSB bit of this count value.
  217. <legal all>
  218. */
  219. #define TCL_STATUS_RING_LOOPING_COUNT_OFFSET 0x0000001c
  220. #define TCL_STATUS_RING_LOOPING_COUNT_LSB 28
  221. #define TCL_STATUS_RING_LOOPING_COUNT_MSB 31
  222. #define TCL_STATUS_RING_LOOPING_COUNT_MASK 0xf0000000
  223. #endif // TCL_STATUS_RING