hal_reo.c 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374
  1. /*
  2. * Copyright (c) 2016-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. #include "hal_api.h"
  19. #include "hal_hw_headers.h"
  20. #include "hal_reo.h"
  21. #include "hal_tx.h"
  22. #include "hal_rx.h"
  23. #include "qdf_module.h"
  24. /* TODO: See if the following definition is available in HW headers */
  25. #define HAL_REO_OWNED 4
  26. #define HAL_REO_QUEUE_DESC 8
  27. #define HAL_REO_QUEUE_EXT_DESC 9
  28. /* TODO: Using associated link desc counter 1 for Rx. Check with FW on
  29. * how these counters are assigned
  30. */
  31. #define HAL_RX_LINK_DESC_CNTR 1
  32. /* TODO: Following definition should be from HW headers */
  33. #define HAL_DESC_REO_OWNED 4
  34. /**
  35. * hal_uniform_desc_hdr_setup - setup reo_queue_ext descritpro
  36. * @owner - owner info
  37. * @buffer_type - buffer type
  38. */
  39. static inline void hal_uniform_desc_hdr_setup(uint32_t *desc, uint32_t owner,
  40. uint32_t buffer_type)
  41. {
  42. HAL_DESC_SET_FIELD(desc, UNIFORM_DESCRIPTOR_HEADER_0, OWNER,
  43. owner);
  44. HAL_DESC_SET_FIELD(desc, UNIFORM_DESCRIPTOR_HEADER_0, BUFFER_TYPE,
  45. buffer_type);
  46. }
  47. #ifndef TID_TO_WME_AC
  48. #define WME_AC_BE 0 /* best effort */
  49. #define WME_AC_BK 1 /* background */
  50. #define WME_AC_VI 2 /* video */
  51. #define WME_AC_VO 3 /* voice */
  52. #define TID_TO_WME_AC(_tid) ( \
  53. (((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
  54. (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
  55. (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
  56. WME_AC_VO)
  57. #endif
  58. #define HAL_NON_QOS_TID 16
  59. /**
  60. * hal_reo_qdesc_setup - Setup HW REO queue descriptor
  61. *
  62. * @hal_soc: Opaque HAL SOC handle
  63. * @ba_window_size: BlockAck window size
  64. * @start_seq: Starting sequence number
  65. * @hw_qdesc_vaddr: Virtual address of REO queue descriptor memory
  66. * @hw_qdesc_paddr: Physical address of REO queue descriptor memory
  67. * @tid: TID
  68. *
  69. */
  70. void hal_reo_qdesc_setup(hal_soc_handle_t hal_soc_hdl, int tid,
  71. uint32_t ba_window_size,
  72. uint32_t start_seq, void *hw_qdesc_vaddr,
  73. qdf_dma_addr_t hw_qdesc_paddr,
  74. int pn_type)
  75. {
  76. uint32_t *reo_queue_desc = (uint32_t *)hw_qdesc_vaddr;
  77. uint32_t *reo_queue_ext_desc;
  78. uint32_t reg_val;
  79. uint32_t pn_enable;
  80. uint32_t pn_size = 0;
  81. qdf_mem_zero(hw_qdesc_vaddr, sizeof(struct rx_reo_queue));
  82. hal_uniform_desc_hdr_setup(reo_queue_desc, HAL_DESC_REO_OWNED,
  83. HAL_REO_QUEUE_DESC);
  84. /* Fixed pattern in reserved bits for debugging */
  85. HAL_DESC_SET_FIELD(reo_queue_desc, UNIFORM_DESCRIPTOR_HEADER_0,
  86. RESERVED_0A, 0xDDBEEF);
  87. /* This a just a SW meta data and will be copied to REO destination
  88. * descriptors indicated by hardware.
  89. * TODO: Setting TID in this field. See if we should set something else.
  90. */
  91. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_1,
  92. RECEIVE_QUEUE_NUMBER, tid);
  93. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2,
  94. VLD, 1);
  95. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2,
  96. ASSOCIATED_LINK_DESCRIPTOR_COUNTER, HAL_RX_LINK_DESC_CNTR);
  97. /*
  98. * Fields DISABLE_DUPLICATE_DETECTION and SOFT_REORDER_ENABLE will be 0
  99. */
  100. reg_val = TID_TO_WME_AC(tid);
  101. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2, AC, reg_val);
  102. if (ba_window_size < 1)
  103. ba_window_size = 1;
  104. /* WAR to get 2k exception in Non BA case.
  105. * Setting window size to 2 to get 2k jump exception
  106. * when we receive aggregates in Non BA case
  107. */
  108. if ((ba_window_size == 1) && (tid != HAL_NON_QOS_TID))
  109. ba_window_size++;
  110. /* Set RTY bit for non-BA case. Duplicate detection is currently not
  111. * done by HW in non-BA case if RTY bit is not set.
  112. * TODO: This is a temporary War and should be removed once HW fix is
  113. * made to check and discard duplicates even if RTY bit is not set.
  114. */
  115. if (ba_window_size == 1)
  116. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2, RTY, 1);
  117. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2, BA_WINDOW_SIZE,
  118. ba_window_size - 1);
  119. switch (pn_type) {
  120. case HAL_PN_WPA:
  121. pn_enable = 1;
  122. pn_size = PN_SIZE_48;
  123. break;
  124. case HAL_PN_WAPI_EVEN:
  125. case HAL_PN_WAPI_UNEVEN:
  126. pn_enable = 1;
  127. pn_size = PN_SIZE_128;
  128. break;
  129. default:
  130. pn_enable = 0;
  131. break;
  132. }
  133. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2, PN_CHECK_NEEDED,
  134. pn_enable);
  135. if (pn_type == HAL_PN_WAPI_EVEN)
  136. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2,
  137. PN_SHALL_BE_EVEN, 1);
  138. else if (pn_type == HAL_PN_WAPI_UNEVEN)
  139. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2,
  140. PN_SHALL_BE_UNEVEN, 1);
  141. /*
  142. * TODO: Need to check if PN handling in SW needs to be enabled
  143. * So far this is not a requirement
  144. */
  145. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2, PN_SIZE,
  146. pn_size);
  147. /* TODO: Check if RX_REO_QUEUE_2_IGNORE_AMPDU_FLAG need to be set
  148. * based on BA window size and/or AMPDU capabilities
  149. */
  150. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_2,
  151. IGNORE_AMPDU_FLAG, 1);
  152. if (start_seq <= 0xfff)
  153. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_3, SSN,
  154. start_seq);
  155. /* TODO: SVLD should be set to 1 if a valid SSN is received in ADDBA,
  156. * but REO is not delivering packets if we set it to 1. Need to enable
  157. * this once the issue is resolved
  158. */
  159. HAL_DESC_SET_FIELD(reo_queue_desc, RX_REO_QUEUE_3, SVLD, 0);
  160. /* TODO: Check if we should set start PN for WAPI */
  161. #ifdef notyet
  162. /* Setup first queue extension if BA window size is more than 1 */
  163. if (ba_window_size > 1) {
  164. reo_queue_ext_desc =
  165. (uint32_t *)(((struct rx_reo_queue *)reo_queue_desc) +
  166. 1);
  167. qdf_mem_zero(reo_queue_ext_desc,
  168. sizeof(struct rx_reo_queue_ext));
  169. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  170. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  171. }
  172. /* Setup second queue extension if BA window size is more than 105 */
  173. if (ba_window_size > 105) {
  174. reo_queue_ext_desc = (uint32_t *)
  175. (((struct rx_reo_queue_ext *)reo_queue_ext_desc) + 1);
  176. qdf_mem_zero(reo_queue_ext_desc,
  177. sizeof(struct rx_reo_queue_ext));
  178. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  179. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  180. }
  181. /* Setup third queue extension if BA window size is more than 210 */
  182. if (ba_window_size > 210) {
  183. reo_queue_ext_desc = (uint32_t *)
  184. (((struct rx_reo_queue_ext *)reo_queue_ext_desc) + 1);
  185. qdf_mem_zero(reo_queue_ext_desc,
  186. sizeof(struct rx_reo_queue_ext));
  187. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  188. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  189. }
  190. #else
  191. /* TODO: HW queue descriptors are currently allocated for max BA
  192. * window size for all QOS TIDs so that same descriptor can be used
  193. * later when ADDBA request is recevied. This should be changed to
  194. * allocate HW queue descriptors based on BA window size being
  195. * negotiated (0 for non BA cases), and reallocate when BA window
  196. * size changes and also send WMI message to FW to change the REO
  197. * queue descriptor in Rx peer entry as part of dp_rx_tid_update.
  198. */
  199. if (tid != HAL_NON_QOS_TID) {
  200. reo_queue_ext_desc = (uint32_t *)
  201. (((struct rx_reo_queue *)reo_queue_desc) + 1);
  202. qdf_mem_zero(reo_queue_ext_desc, 3 *
  203. sizeof(struct rx_reo_queue_ext));
  204. /* Initialize first reo queue extension descriptor */
  205. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  206. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  207. /* Fixed pattern in reserved bits for debugging */
  208. HAL_DESC_SET_FIELD(reo_queue_ext_desc,
  209. UNIFORM_DESCRIPTOR_HEADER_0, RESERVED_0A, 0xADBEEF);
  210. /* Initialize second reo queue extension descriptor */
  211. reo_queue_ext_desc = (uint32_t *)
  212. (((struct rx_reo_queue_ext *)reo_queue_ext_desc) + 1);
  213. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  214. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  215. /* Fixed pattern in reserved bits for debugging */
  216. HAL_DESC_SET_FIELD(reo_queue_ext_desc,
  217. UNIFORM_DESCRIPTOR_HEADER_0, RESERVED_0A, 0xBDBEEF);
  218. /* Initialize third reo queue extension descriptor */
  219. reo_queue_ext_desc = (uint32_t *)
  220. (((struct rx_reo_queue_ext *)reo_queue_ext_desc) + 1);
  221. hal_uniform_desc_hdr_setup(reo_queue_ext_desc,
  222. HAL_DESC_REO_OWNED, HAL_REO_QUEUE_EXT_DESC);
  223. /* Fixed pattern in reserved bits for debugging */
  224. HAL_DESC_SET_FIELD(reo_queue_ext_desc,
  225. UNIFORM_DESCRIPTOR_HEADER_0, RESERVED_0A, 0xCDBEEF);
  226. }
  227. #endif
  228. }
  229. qdf_export_symbol(hal_reo_qdesc_setup);
  230. /**
  231. * hal_get_ba_aging_timeout - Get BA Aging timeout
  232. *
  233. * @hal_soc: Opaque HAL SOC handle
  234. * @ac: Access category
  235. * @value: window size to get
  236. */
  237. void hal_get_ba_aging_timeout(hal_soc_handle_t hal_soc_hdl, uint8_t ac,
  238. uint32_t *value)
  239. {
  240. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  241. switch (ac) {
  242. case WME_AC_BE:
  243. *value = HAL_REG_READ(soc,
  244. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  245. SEQ_WCSS_UMAC_REO_REG_OFFSET)) / 1000;
  246. break;
  247. case WME_AC_BK:
  248. *value = HAL_REG_READ(soc,
  249. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  250. SEQ_WCSS_UMAC_REO_REG_OFFSET)) / 1000;
  251. break;
  252. case WME_AC_VI:
  253. *value = HAL_REG_READ(soc,
  254. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  255. SEQ_WCSS_UMAC_REO_REG_OFFSET)) / 1000;
  256. break;
  257. case WME_AC_VO:
  258. *value = HAL_REG_READ(soc,
  259. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  260. SEQ_WCSS_UMAC_REO_REG_OFFSET)) / 1000;
  261. break;
  262. default:
  263. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  264. "Invalid AC: %d\n", ac);
  265. }
  266. }
  267. qdf_export_symbol(hal_get_ba_aging_timeout);
  268. /**
  269. * hal_set_ba_aging_timeout - Set BA Aging timeout
  270. *
  271. * @hal_soc: Opaque HAL SOC handle
  272. * @ac: Access category
  273. * ac: 0 - Background, 1 - Best Effort, 2 - Video, 3 - Voice
  274. * @value: Input value to set
  275. */
  276. void hal_set_ba_aging_timeout(hal_soc_handle_t hal_soc_hdl, uint8_t ac,
  277. uint32_t value)
  278. {
  279. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  280. switch (ac) {
  281. case WME_AC_BE:
  282. HAL_REG_WRITE(soc,
  283. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  284. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  285. value * 1000);
  286. break;
  287. case WME_AC_BK:
  288. HAL_REG_WRITE(soc,
  289. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  290. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  291. value * 1000);
  292. break;
  293. case WME_AC_VI:
  294. HAL_REG_WRITE(soc,
  295. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  296. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  297. value * 1000);
  298. break;
  299. case WME_AC_VO:
  300. HAL_REG_WRITE(soc,
  301. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  302. SEQ_WCSS_UMAC_REO_REG_OFFSET),
  303. value * 1000);
  304. break;
  305. default:
  306. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  307. "Invalid AC: %d\n", ac);
  308. }
  309. }
  310. qdf_export_symbol(hal_set_ba_aging_timeout);
  311. #define BLOCK_RES_MASK 0xF
  312. static inline uint8_t hal_find_one_bit(uint8_t x)
  313. {
  314. uint8_t y = (x & (~x + 1)) & BLOCK_RES_MASK;
  315. uint8_t pos;
  316. for (pos = 0; y; y >>= 1)
  317. pos++;
  318. return pos-1;
  319. }
  320. static inline uint8_t hal_find_zero_bit(uint8_t x)
  321. {
  322. uint8_t y = (~x & (x+1)) & BLOCK_RES_MASK;
  323. uint8_t pos;
  324. for (pos = 0; y; y >>= 1)
  325. pos++;
  326. return pos-1;
  327. }
  328. inline void hal_reo_cmd_set_descr_addr(uint32_t *reo_desc,
  329. enum hal_reo_cmd_type type,
  330. uint32_t paddr_lo,
  331. uint8_t paddr_hi)
  332. {
  333. switch (type) {
  334. case CMD_GET_QUEUE_STATS:
  335. HAL_DESC_SET_FIELD(reo_desc, REO_GET_QUEUE_STATS_1,
  336. RX_REO_QUEUE_DESC_ADDR_31_0, paddr_lo);
  337. HAL_DESC_SET_FIELD(reo_desc, REO_GET_QUEUE_STATS_2,
  338. RX_REO_QUEUE_DESC_ADDR_39_32, paddr_hi);
  339. break;
  340. case CMD_FLUSH_QUEUE:
  341. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_QUEUE_1,
  342. FLUSH_DESC_ADDR_31_0, paddr_lo);
  343. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_QUEUE_2,
  344. FLUSH_DESC_ADDR_39_32, paddr_hi);
  345. break;
  346. case CMD_FLUSH_CACHE:
  347. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_1,
  348. FLUSH_ADDR_31_0, paddr_lo);
  349. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  350. FLUSH_ADDR_39_32, paddr_hi);
  351. break;
  352. case CMD_UPDATE_RX_REO_QUEUE:
  353. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_1,
  354. RX_REO_QUEUE_DESC_ADDR_31_0, paddr_lo);
  355. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  356. RX_REO_QUEUE_DESC_ADDR_39_32, paddr_hi);
  357. break;
  358. default:
  359. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  360. "%s: Invalid REO command type", __func__);
  361. break;
  362. }
  363. }
  364. inline int hal_reo_cmd_queue_stats(hal_ring_handle_t hal_ring_hdl,
  365. hal_soc_handle_t hal_soc_hdl,
  366. struct hal_reo_cmd_params *cmd)
  367. {
  368. uint32_t *reo_desc, val;
  369. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  370. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  371. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  372. if (!reo_desc) {
  373. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  374. "%s: Out of cmd ring entries", __func__);
  375. hal_srng_access_end(hal_soc, hal_ring_hdl);
  376. return -EBUSY;
  377. }
  378. HAL_SET_TLV_HDR(reo_desc, WIFIREO_GET_QUEUE_STATS_E,
  379. sizeof(struct reo_get_queue_stats));
  380. /* Offsets of descriptor fields defined in HW headers start from
  381. * the field after TLV header */
  382. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  383. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  384. sizeof(struct reo_get_queue_stats) -
  385. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  386. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  387. REO_STATUS_REQUIRED, cmd->std.need_status);
  388. hal_reo_cmd_set_descr_addr(reo_desc, CMD_GET_QUEUE_STATS,
  389. cmd->std.addr_lo,
  390. cmd->std.addr_hi);
  391. HAL_DESC_SET_FIELD(reo_desc, REO_GET_QUEUE_STATS_2, CLEAR_STATS,
  392. cmd->u.stats_params.clear);
  393. hal_srng_access_end(hal_soc, hal_ring_hdl);
  394. val = reo_desc[CMD_HEADER_DW_OFFSET];
  395. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  396. val);
  397. }
  398. qdf_export_symbol(hal_reo_cmd_queue_stats);
  399. inline int hal_reo_cmd_flush_queue(hal_ring_handle_t hal_ring_hdl,
  400. hal_soc_handle_t hal_soc_hdl,
  401. struct hal_reo_cmd_params *cmd)
  402. {
  403. uint32_t *reo_desc, val;
  404. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  405. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  406. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  407. if (!reo_desc) {
  408. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  409. "%s: Out of cmd ring entries", __func__);
  410. hal_srng_access_end(hal_soc, hal_ring_hdl);
  411. return -EBUSY;
  412. }
  413. HAL_SET_TLV_HDR(reo_desc, WIFIREO_FLUSH_QUEUE_E,
  414. sizeof(struct reo_flush_queue));
  415. /* Offsets of descriptor fields defined in HW headers start from
  416. * the field after TLV header */
  417. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  418. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  419. sizeof(struct reo_flush_queue) -
  420. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  421. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  422. REO_STATUS_REQUIRED, cmd->std.need_status);
  423. hal_reo_cmd_set_descr_addr(reo_desc, CMD_FLUSH_QUEUE, cmd->std.addr_lo,
  424. cmd->std.addr_hi);
  425. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_QUEUE_2,
  426. BLOCK_DESC_ADDR_USAGE_AFTER_FLUSH,
  427. cmd->u.fl_queue_params.block_use_after_flush);
  428. if (cmd->u.fl_queue_params.block_use_after_flush) {
  429. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_QUEUE_2,
  430. BLOCK_RESOURCE_INDEX, cmd->u.fl_queue_params.index);
  431. }
  432. hal_srng_access_end(hal_soc, hal_ring_hdl);
  433. val = reo_desc[CMD_HEADER_DW_OFFSET];
  434. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  435. val);
  436. }
  437. qdf_export_symbol(hal_reo_cmd_flush_queue);
  438. inline int hal_reo_cmd_flush_cache(hal_ring_handle_t hal_ring_hdl,
  439. hal_soc_handle_t hal_soc_hdl,
  440. struct hal_reo_cmd_params *cmd)
  441. {
  442. uint32_t *reo_desc, val;
  443. struct hal_reo_cmd_flush_cache_params *cp;
  444. uint8_t index = 0;
  445. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  446. cp = &cmd->u.fl_cache_params;
  447. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  448. /* We need a cache block resource for this operation, and REO HW has
  449. * only 4 such blocking resources. These resources are managed using
  450. * reo_res_bitmap, and we return failure if none is available.
  451. */
  452. if (cp->block_use_after_flush) {
  453. index = hal_find_zero_bit(hal_soc->reo_res_bitmap);
  454. if (index > 3) {
  455. qdf_print("%s, No blocking resource available!",
  456. __func__);
  457. hal_srng_access_end(hal_soc, hal_ring_hdl);
  458. return -EBUSY;
  459. }
  460. hal_soc->index = index;
  461. }
  462. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  463. if (!reo_desc) {
  464. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  465. "%s: Out of cmd ring entries", __func__);
  466. hal_srng_access_end(hal_soc, hal_ring_hdl);
  467. hal_srng_dump(hal_ring_handle_to_hal_srng(hal_ring_hdl));
  468. return -EBUSY;
  469. }
  470. HAL_SET_TLV_HDR(reo_desc, WIFIREO_FLUSH_CACHE_E,
  471. sizeof(struct reo_flush_cache));
  472. /* Offsets of descriptor fields defined in HW headers start from
  473. * the field after TLV header */
  474. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  475. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  476. sizeof(struct reo_flush_cache) -
  477. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  478. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  479. REO_STATUS_REQUIRED, cmd->std.need_status);
  480. hal_reo_cmd_set_descr_addr(reo_desc, CMD_FLUSH_CACHE, cmd->std.addr_lo,
  481. cmd->std.addr_hi);
  482. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  483. FORWARD_ALL_MPDUS_IN_QUEUE, cp->fwd_mpdus_in_queue);
  484. /* set it to 0 for now */
  485. cp->rel_block_index = 0;
  486. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  487. RELEASE_CACHE_BLOCK_INDEX, cp->rel_block_index);
  488. if (cp->block_use_after_flush) {
  489. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  490. CACHE_BLOCK_RESOURCE_INDEX, index);
  491. }
  492. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  493. FLUSH_WITHOUT_INVALIDATE, cp->flush_no_inval);
  494. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2,
  495. BLOCK_CACHE_USAGE_AFTER_FLUSH, cp->block_use_after_flush);
  496. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2, FLUSH_ENTIRE_CACHE,
  497. cp->flush_all);
  498. hal_srng_access_end(hal_soc, hal_ring_hdl);
  499. val = reo_desc[CMD_HEADER_DW_OFFSET];
  500. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  501. val);
  502. }
  503. qdf_export_symbol(hal_reo_cmd_flush_cache);
  504. inline int hal_reo_cmd_unblock_cache(hal_ring_handle_t hal_ring_hdl,
  505. hal_soc_handle_t hal_soc_hdl,
  506. struct hal_reo_cmd_params *cmd)
  507. {
  508. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  509. uint32_t *reo_desc, val;
  510. uint8_t index = 0;
  511. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  512. if (cmd->u.unblk_cache_params.type == UNBLOCK_RES_INDEX) {
  513. index = hal_find_one_bit(hal_soc->reo_res_bitmap);
  514. if (index > 3) {
  515. hal_srng_access_end(hal_soc, hal_ring_hdl);
  516. qdf_print("%s: No blocking resource to unblock!",
  517. __func__);
  518. return -EBUSY;
  519. }
  520. }
  521. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  522. if (!reo_desc) {
  523. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  524. "%s: Out of cmd ring entries", __func__);
  525. hal_srng_access_end(hal_soc, hal_ring_hdl);
  526. return -EBUSY;
  527. }
  528. HAL_SET_TLV_HDR(reo_desc, WIFIREO_UNBLOCK_CACHE_E,
  529. sizeof(struct reo_unblock_cache));
  530. /* Offsets of descriptor fields defined in HW headers start from
  531. * the field after TLV header */
  532. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  533. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  534. sizeof(struct reo_unblock_cache) -
  535. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  536. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  537. REO_STATUS_REQUIRED, cmd->std.need_status);
  538. HAL_DESC_SET_FIELD(reo_desc, REO_UNBLOCK_CACHE_1,
  539. UNBLOCK_TYPE, cmd->u.unblk_cache_params.type);
  540. if (cmd->u.unblk_cache_params.type == UNBLOCK_RES_INDEX) {
  541. HAL_DESC_SET_FIELD(reo_desc, REO_UNBLOCK_CACHE_1,
  542. CACHE_BLOCK_RESOURCE_INDEX,
  543. cmd->u.unblk_cache_params.index);
  544. }
  545. hal_srng_access_end(hal_soc, hal_ring_hdl);
  546. val = reo_desc[CMD_HEADER_DW_OFFSET];
  547. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  548. val);
  549. }
  550. qdf_export_symbol(hal_reo_cmd_unblock_cache);
  551. inline int hal_reo_cmd_flush_timeout_list(hal_ring_handle_t hal_ring_hdl,
  552. hal_soc_handle_t hal_soc_hdl,
  553. struct hal_reo_cmd_params *cmd)
  554. {
  555. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  556. uint32_t *reo_desc, val;
  557. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  558. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  559. if (!reo_desc) {
  560. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  561. "%s: Out of cmd ring entries", __func__);
  562. hal_srng_access_end(hal_soc, hal_ring_hdl);
  563. return -EBUSY;
  564. }
  565. HAL_SET_TLV_HDR(reo_desc, WIFIREO_FLUSH_TIMEOUT_LIST_E,
  566. sizeof(struct reo_flush_timeout_list));
  567. /* Offsets of descriptor fields defined in HW headers start from
  568. * the field after TLV header */
  569. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  570. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  571. sizeof(struct reo_flush_timeout_list) -
  572. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  573. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  574. REO_STATUS_REQUIRED, cmd->std.need_status);
  575. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_TIMEOUT_LIST_1, AC_TIMOUT_LIST,
  576. cmd->u.fl_tim_list_params.ac_list);
  577. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_TIMEOUT_LIST_2,
  578. MINIMUM_RELEASE_DESC_COUNT,
  579. cmd->u.fl_tim_list_params.min_rel_desc);
  580. HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_TIMEOUT_LIST_2,
  581. MINIMUM_FORWARD_BUF_COUNT,
  582. cmd->u.fl_tim_list_params.min_fwd_buf);
  583. hal_srng_access_end(hal_soc, hal_ring_hdl);
  584. val = reo_desc[CMD_HEADER_DW_OFFSET];
  585. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  586. val);
  587. }
  588. qdf_export_symbol(hal_reo_cmd_flush_timeout_list);
  589. inline int hal_reo_cmd_update_rx_queue(hal_ring_handle_t hal_ring_hdl,
  590. hal_soc_handle_t hal_soc_hdl,
  591. struct hal_reo_cmd_params *cmd)
  592. {
  593. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  594. uint32_t *reo_desc, val;
  595. struct hal_reo_cmd_update_queue_params *p;
  596. p = &cmd->u.upd_queue_params;
  597. hal_srng_access_start(hal_soc_hdl, hal_ring_hdl);
  598. reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
  599. if (!reo_desc) {
  600. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  601. "%s: Out of cmd ring entries", __func__);
  602. hal_srng_access_end(hal_soc, hal_ring_hdl);
  603. return -EBUSY;
  604. }
  605. HAL_SET_TLV_HDR(reo_desc, WIFIREO_UPDATE_RX_REO_QUEUE_E,
  606. sizeof(struct reo_update_rx_reo_queue));
  607. /* Offsets of descriptor fields defined in HW headers start from
  608. * the field after TLV header */
  609. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  610. qdf_mem_zero((reo_desc + NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER),
  611. sizeof(struct reo_update_rx_reo_queue) -
  612. (NUM_OF_DWORDS_UNIFORM_REO_CMD_HEADER << 2));
  613. HAL_DESC_SET_FIELD(reo_desc, UNIFORM_REO_CMD_HEADER_0,
  614. REO_STATUS_REQUIRED, cmd->std.need_status);
  615. hal_reo_cmd_set_descr_addr(reo_desc, CMD_UPDATE_RX_REO_QUEUE,
  616. cmd->std.addr_lo, cmd->std.addr_hi);
  617. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  618. UPDATE_RECEIVE_QUEUE_NUMBER, p->update_rx_queue_num);
  619. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2, UPDATE_VLD,
  620. p->update_vld);
  621. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  622. UPDATE_ASSOCIATED_LINK_DESCRIPTOR_COUNTER,
  623. p->update_assoc_link_desc);
  624. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  625. UPDATE_DISABLE_DUPLICATE_DETECTION,
  626. p->update_disable_dup_detect);
  627. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  628. UPDATE_DISABLE_DUPLICATE_DETECTION,
  629. p->update_disable_dup_detect);
  630. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  631. UPDATE_SOFT_REORDER_ENABLE,
  632. p->update_soft_reorder_enab);
  633. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  634. UPDATE_AC, p->update_ac);
  635. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  636. UPDATE_BAR, p->update_bar);
  637. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  638. UPDATE_BAR, p->update_bar);
  639. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  640. UPDATE_RTY, p->update_rty);
  641. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  642. UPDATE_CHK_2K_MODE, p->update_chk_2k_mode);
  643. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  644. UPDATE_OOR_MODE, p->update_oor_mode);
  645. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  646. UPDATE_BA_WINDOW_SIZE, p->update_ba_window_size);
  647. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  648. UPDATE_PN_CHECK_NEEDED, p->update_pn_check_needed);
  649. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  650. UPDATE_PN_SHALL_BE_EVEN, p->update_pn_even);
  651. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  652. UPDATE_PN_SHALL_BE_UNEVEN, p->update_pn_uneven);
  653. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  654. UPDATE_PN_HANDLING_ENABLE, p->update_pn_hand_enab);
  655. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  656. UPDATE_PN_SIZE, p->update_pn_size);
  657. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  658. UPDATE_IGNORE_AMPDU_FLAG, p->update_ignore_ampdu);
  659. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  660. UPDATE_SVLD, p->update_svld);
  661. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  662. UPDATE_SSN, p->update_ssn);
  663. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  664. UPDATE_SEQ_2K_ERROR_DETECTED_FLAG,
  665. p->update_seq_2k_err_detect);
  666. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  667. UPDATE_PN_VALID, p->update_pn_valid);
  668. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_2,
  669. UPDATE_PN, p->update_pn);
  670. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  671. RECEIVE_QUEUE_NUMBER, p->rx_queue_num);
  672. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  673. VLD, p->vld);
  674. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  675. ASSOCIATED_LINK_DESCRIPTOR_COUNTER,
  676. p->assoc_link_desc);
  677. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  678. DISABLE_DUPLICATE_DETECTION, p->disable_dup_detect);
  679. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  680. SOFT_REORDER_ENABLE, p->soft_reorder_enab);
  681. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3, AC, p->ac);
  682. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  683. BAR, p->bar);
  684. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  685. CHK_2K_MODE, p->chk_2k_mode);
  686. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  687. RTY, p->rty);
  688. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  689. OOR_MODE, p->oor_mode);
  690. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  691. PN_CHECK_NEEDED, p->pn_check_needed);
  692. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  693. PN_SHALL_BE_EVEN, p->pn_even);
  694. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  695. PN_SHALL_BE_UNEVEN, p->pn_uneven);
  696. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  697. PN_HANDLING_ENABLE, p->pn_hand_enab);
  698. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_3,
  699. IGNORE_AMPDU_FLAG, p->ignore_ampdu);
  700. if (p->ba_window_size < 1)
  701. p->ba_window_size = 1;
  702. /*
  703. * WAR to get 2k exception in Non BA case.
  704. * Setting window size to 2 to get 2k jump exception
  705. * when we receive aggregates in Non BA case
  706. */
  707. if (p->ba_window_size == 1)
  708. p->ba_window_size++;
  709. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  710. BA_WINDOW_SIZE, p->ba_window_size - 1);
  711. if (p->pn_size == 24)
  712. p->pn_size = PN_SIZE_24;
  713. else if (p->pn_size == 48)
  714. p->pn_size = PN_SIZE_48;
  715. else if (p->pn_size == 128)
  716. p->pn_size = PN_SIZE_128;
  717. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  718. PN_SIZE, p->pn_size);
  719. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  720. SVLD, p->svld);
  721. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  722. SSN, p->ssn);
  723. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  724. SEQ_2K_ERROR_DETECTED_FLAG, p->seq_2k_err_detect);
  725. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_4,
  726. PN_ERROR_DETECTED_FLAG, p->pn_err_detect);
  727. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_5,
  728. PN_31_0, p->pn_31_0);
  729. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_6,
  730. PN_63_32, p->pn_63_32);
  731. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_7,
  732. PN_95_64, p->pn_95_64);
  733. HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_8,
  734. PN_127_96, p->pn_127_96);
  735. if (hif_pm_runtime_get(hal_soc->hif_handle) == 0) {
  736. hal_srng_access_end(hal_soc_hdl, hal_ring_hdl);
  737. hif_pm_runtime_put(hal_soc->hif_handle);
  738. } else {
  739. hal_srng_access_end_reap(hal_soc_hdl, hal_ring_hdl);
  740. hal_srng_set_event(hal_ring_hdl, HAL_SRNG_FLUSH_EVENT);
  741. hal_srng_inc_flush_cnt(hal_ring_hdl);
  742. }
  743. val = reo_desc[CMD_HEADER_DW_OFFSET];
  744. return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER,
  745. val);
  746. }
  747. qdf_export_symbol(hal_reo_cmd_update_rx_queue);
  748. inline void
  749. hal_reo_queue_stats_status(uint32_t *reo_desc,
  750. struct hal_reo_queue_status *st,
  751. hal_soc_handle_t hal_soc_hdl)
  752. {
  753. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  754. uint32_t val;
  755. /* Offsets of descriptor fields defined in HW headers start
  756. * from the field after TLV header */
  757. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  758. /* header */
  759. hal_reo_status_get_header(reo_desc, HAL_REO_QUEUE_STATS_STATUS_TLV,
  760. &(st->header), hal_soc);
  761. /* SSN */
  762. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_2, SSN)];
  763. st->ssn = HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_2, SSN, val);
  764. /* current index */
  765. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_2,
  766. CURRENT_INDEX)];
  767. st->curr_idx =
  768. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_2,
  769. CURRENT_INDEX, val);
  770. /* PN bits */
  771. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_3,
  772. PN_31_0)];
  773. st->pn_31_0 =
  774. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_3,
  775. PN_31_0, val);
  776. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_4,
  777. PN_63_32)];
  778. st->pn_63_32 =
  779. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_4,
  780. PN_63_32, val);
  781. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_5,
  782. PN_95_64)];
  783. st->pn_95_64 =
  784. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_5,
  785. PN_95_64, val);
  786. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_6,
  787. PN_127_96)];
  788. st->pn_127_96 =
  789. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_6,
  790. PN_127_96, val);
  791. /* timestamps */
  792. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_7,
  793. LAST_RX_ENQUEUE_TIMESTAMP)];
  794. st->last_rx_enq_tstamp =
  795. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_7,
  796. LAST_RX_ENQUEUE_TIMESTAMP, val);
  797. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_8,
  798. LAST_RX_DEQUEUE_TIMESTAMP)];
  799. st->last_rx_deq_tstamp =
  800. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_8,
  801. LAST_RX_DEQUEUE_TIMESTAMP, val);
  802. /* rx bitmap */
  803. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_9,
  804. RX_BITMAP_31_0)];
  805. st->rx_bitmap_31_0 =
  806. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_9,
  807. RX_BITMAP_31_0, val);
  808. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_10,
  809. RX_BITMAP_63_32)];
  810. st->rx_bitmap_63_32 =
  811. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_10,
  812. RX_BITMAP_63_32, val);
  813. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_11,
  814. RX_BITMAP_95_64)];
  815. st->rx_bitmap_95_64 =
  816. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_11,
  817. RX_BITMAP_95_64, val);
  818. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_12,
  819. RX_BITMAP_127_96)];
  820. st->rx_bitmap_127_96 =
  821. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_12,
  822. RX_BITMAP_127_96, val);
  823. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_13,
  824. RX_BITMAP_159_128)];
  825. st->rx_bitmap_159_128 =
  826. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_13,
  827. RX_BITMAP_159_128, val);
  828. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_14,
  829. RX_BITMAP_191_160)];
  830. st->rx_bitmap_191_160 =
  831. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_14,
  832. RX_BITMAP_191_160, val);
  833. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_15,
  834. RX_BITMAP_223_192)];
  835. st->rx_bitmap_223_192 =
  836. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_15,
  837. RX_BITMAP_223_192, val);
  838. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_16,
  839. RX_BITMAP_255_224)];
  840. st->rx_bitmap_255_224 =
  841. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_16,
  842. RX_BITMAP_255_224, val);
  843. /* various counts */
  844. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_17,
  845. CURRENT_MPDU_COUNT)];
  846. st->curr_mpdu_cnt =
  847. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_17,
  848. CURRENT_MPDU_COUNT, val);
  849. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_17,
  850. CURRENT_MSDU_COUNT)];
  851. st->curr_msdu_cnt =
  852. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_17,
  853. CURRENT_MSDU_COUNT, val);
  854. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_18,
  855. TIMEOUT_COUNT)];
  856. st->fwd_timeout_cnt =
  857. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_18,
  858. TIMEOUT_COUNT, val);
  859. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_18,
  860. FORWARD_DUE_TO_BAR_COUNT)];
  861. st->fwd_bar_cnt =
  862. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_18,
  863. FORWARD_DUE_TO_BAR_COUNT, val);
  864. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_18,
  865. DUPLICATE_COUNT)];
  866. st->dup_cnt =
  867. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_18,
  868. DUPLICATE_COUNT, val);
  869. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_19,
  870. FRAMES_IN_ORDER_COUNT)];
  871. st->frms_in_order_cnt =
  872. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_19,
  873. FRAMES_IN_ORDER_COUNT, val);
  874. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_19,
  875. BAR_RECEIVED_COUNT)];
  876. st->bar_rcvd_cnt =
  877. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_19,
  878. BAR_RECEIVED_COUNT, val);
  879. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_20,
  880. MPDU_FRAMES_PROCESSED_COUNT)];
  881. st->mpdu_frms_cnt =
  882. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_20,
  883. MPDU_FRAMES_PROCESSED_COUNT, val);
  884. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_21,
  885. MSDU_FRAMES_PROCESSED_COUNT)];
  886. st->msdu_frms_cnt =
  887. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_21,
  888. MSDU_FRAMES_PROCESSED_COUNT, val);
  889. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_22,
  890. TOTAL_PROCESSED_BYTE_COUNT)];
  891. st->total_cnt =
  892. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_22,
  893. TOTAL_PROCESSED_BYTE_COUNT, val);
  894. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_23,
  895. LATE_RECEIVE_MPDU_COUNT)];
  896. st->late_recv_mpdu_cnt =
  897. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_23,
  898. LATE_RECEIVE_MPDU_COUNT, val);
  899. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_23,
  900. WINDOW_JUMP_2K)];
  901. st->win_jump_2k =
  902. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_23,
  903. WINDOW_JUMP_2K, val);
  904. val = reo_desc[HAL_OFFSET_DW(REO_GET_QUEUE_STATS_STATUS_23,
  905. HOLE_COUNT)];
  906. st->hole_cnt =
  907. HAL_GET_FIELD(REO_GET_QUEUE_STATS_STATUS_23,
  908. HOLE_COUNT, val);
  909. }
  910. qdf_export_symbol(hal_reo_queue_stats_status);
  911. inline void
  912. hal_reo_flush_queue_status(uint32_t *reo_desc,
  913. struct hal_reo_flush_queue_status *st,
  914. hal_soc_handle_t hal_soc_hdl)
  915. {
  916. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  917. uint32_t val;
  918. /* Offsets of descriptor fields defined in HW headers start
  919. * from the field after TLV header */
  920. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  921. /* header */
  922. hal_reo_status_get_header(reo_desc, HAL_REO_FLUSH_QUEUE_STATUS_TLV,
  923. &(st->header), hal_soc);
  924. /* error bit */
  925. val = reo_desc[HAL_OFFSET(REO_FLUSH_QUEUE_STATUS_2,
  926. ERROR_DETECTED)];
  927. st->error = HAL_GET_FIELD(REO_FLUSH_QUEUE_STATUS_2, ERROR_DETECTED,
  928. val);
  929. }
  930. qdf_export_symbol(hal_reo_flush_queue_status);
  931. inline void
  932. hal_reo_flush_cache_status(uint32_t *reo_desc,
  933. struct hal_reo_flush_cache_status *st,
  934. hal_soc_handle_t hal_soc_hdl)
  935. {
  936. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  937. uint32_t val;
  938. /* Offsets of descriptor fields defined in HW headers start
  939. * from the field after TLV header */
  940. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  941. /* header */
  942. hal_reo_status_get_header(reo_desc, HAL_REO_FLUSH_CACHE_STATUS_TLV,
  943. &(st->header), hal_soc);
  944. /* error bit */
  945. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2,
  946. ERROR_DETECTED)];
  947. st->error = HAL_GET_FIELD(REO_FLUSH_QUEUE_STATUS_2, ERROR_DETECTED,
  948. val);
  949. /* block error */
  950. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2,
  951. BLOCK_ERROR_DETAILS)];
  952. st->block_error = HAL_GET_FIELD(REO_FLUSH_CACHE_STATUS_2,
  953. BLOCK_ERROR_DETAILS,
  954. val);
  955. if (!st->block_error)
  956. qdf_set_bit(hal_soc->index,
  957. (unsigned long *)&hal_soc->reo_res_bitmap);
  958. /* cache flush status */
  959. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2,
  960. CACHE_CONTROLLER_FLUSH_STATUS_HIT)];
  961. st->cache_flush_status = HAL_GET_FIELD(REO_FLUSH_CACHE_STATUS_2,
  962. CACHE_CONTROLLER_FLUSH_STATUS_HIT,
  963. val);
  964. /* cache flush descriptor type */
  965. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2,
  966. CACHE_CONTROLLER_FLUSH_STATUS_DESC_TYPE)];
  967. st->cache_flush_status_desc_type =
  968. HAL_GET_FIELD(REO_FLUSH_CACHE_STATUS_2,
  969. CACHE_CONTROLLER_FLUSH_STATUS_DESC_TYPE,
  970. val);
  971. /* cache flush count */
  972. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2,
  973. CACHE_CONTROLLER_FLUSH_COUNT)];
  974. st->cache_flush_cnt =
  975. HAL_GET_FIELD(REO_FLUSH_CACHE_STATUS_2,
  976. CACHE_CONTROLLER_FLUSH_COUNT,
  977. val);
  978. }
  979. qdf_export_symbol(hal_reo_flush_cache_status);
  980. inline void hal_reo_unblock_cache_status(uint32_t *reo_desc,
  981. hal_soc_handle_t hal_soc_hdl,
  982. struct hal_reo_unblk_cache_status *st)
  983. {
  984. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  985. uint32_t val;
  986. /* Offsets of descriptor fields defined in HW headers start
  987. * from the field after TLV header */
  988. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  989. /* header */
  990. hal_reo_status_get_header(reo_desc, HAL_REO_UNBLK_CACHE_STATUS_TLV,
  991. &st->header, hal_soc);
  992. /* error bit */
  993. val = reo_desc[HAL_OFFSET_DW(REO_UNBLOCK_CACHE_STATUS_2,
  994. ERROR_DETECTED)];
  995. st->error = HAL_GET_FIELD(REO_UNBLOCK_CACHE_STATUS_2,
  996. ERROR_DETECTED,
  997. val);
  998. /* unblock type */
  999. val = reo_desc[HAL_OFFSET_DW(REO_UNBLOCK_CACHE_STATUS_2,
  1000. UNBLOCK_TYPE)];
  1001. st->unblock_type = HAL_GET_FIELD(REO_UNBLOCK_CACHE_STATUS_2,
  1002. UNBLOCK_TYPE,
  1003. val);
  1004. if (!st->error && (st->unblock_type == UNBLOCK_RES_INDEX))
  1005. qdf_clear_bit(hal_soc->index,
  1006. (unsigned long *)&hal_soc->reo_res_bitmap);
  1007. }
  1008. qdf_export_symbol(hal_reo_unblock_cache_status);
  1009. inline void hal_reo_flush_timeout_list_status(
  1010. uint32_t *reo_desc,
  1011. struct hal_reo_flush_timeout_list_status *st,
  1012. hal_soc_handle_t hal_soc_hdl)
  1013. {
  1014. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1015. uint32_t val;
  1016. /* Offsets of descriptor fields defined in HW headers start
  1017. * from the field after TLV header */
  1018. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  1019. /* header */
  1020. hal_reo_status_get_header(reo_desc, HAL_REO_TIMOUT_LIST_STATUS_TLV,
  1021. &(st->header), hal_soc);
  1022. /* error bit */
  1023. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_2,
  1024. ERROR_DETECTED)];
  1025. st->error = HAL_GET_FIELD(REO_FLUSH_TIMEOUT_LIST_STATUS_2,
  1026. ERROR_DETECTED,
  1027. val);
  1028. /* list empty */
  1029. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_2,
  1030. TIMOUT_LIST_EMPTY)];
  1031. st->list_empty = HAL_GET_FIELD(REO_FLUSH_TIMEOUT_LIST_STATUS_2,
  1032. TIMOUT_LIST_EMPTY,
  1033. val);
  1034. /* release descriptor count */
  1035. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_3,
  1036. RELEASE_DESC_COUNT)];
  1037. st->rel_desc_cnt = HAL_GET_FIELD(REO_FLUSH_TIMEOUT_LIST_STATUS_3,
  1038. RELEASE_DESC_COUNT,
  1039. val);
  1040. /* forward buf count */
  1041. val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_TIMEOUT_LIST_STATUS_3,
  1042. FORWARD_BUF_COUNT)];
  1043. st->fwd_buf_cnt = HAL_GET_FIELD(REO_FLUSH_TIMEOUT_LIST_STATUS_3,
  1044. FORWARD_BUF_COUNT,
  1045. val);
  1046. }
  1047. qdf_export_symbol(hal_reo_flush_timeout_list_status);
  1048. inline void hal_reo_desc_thres_reached_status(
  1049. uint32_t *reo_desc,
  1050. struct hal_reo_desc_thres_reached_status *st,
  1051. hal_soc_handle_t hal_soc_hdl)
  1052. {
  1053. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1054. uint32_t val;
  1055. /* Offsets of descriptor fields defined in HW headers start
  1056. * from the field after TLV header */
  1057. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  1058. /* header */
  1059. hal_reo_status_get_header(reo_desc,
  1060. HAL_REO_DESC_THRES_STATUS_TLV,
  1061. &(st->header), hal_soc);
  1062. /* threshold index */
  1063. val = reo_desc[HAL_OFFSET_DW(
  1064. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_2,
  1065. THRESHOLD_INDEX)];
  1066. st->thres_index = HAL_GET_FIELD(
  1067. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_2,
  1068. THRESHOLD_INDEX,
  1069. val);
  1070. /* link desc counters */
  1071. val = reo_desc[HAL_OFFSET_DW(
  1072. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_3,
  1073. LINK_DESCRIPTOR_COUNTER0)];
  1074. st->link_desc_counter0 = HAL_GET_FIELD(
  1075. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_3,
  1076. LINK_DESCRIPTOR_COUNTER0,
  1077. val);
  1078. val = reo_desc[HAL_OFFSET_DW(
  1079. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_4,
  1080. LINK_DESCRIPTOR_COUNTER1)];
  1081. st->link_desc_counter1 = HAL_GET_FIELD(
  1082. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_4,
  1083. LINK_DESCRIPTOR_COUNTER1,
  1084. val);
  1085. val = reo_desc[HAL_OFFSET_DW(
  1086. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_5,
  1087. LINK_DESCRIPTOR_COUNTER2)];
  1088. st->link_desc_counter2 = HAL_GET_FIELD(
  1089. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_5,
  1090. LINK_DESCRIPTOR_COUNTER2,
  1091. val);
  1092. val = reo_desc[HAL_OFFSET_DW(
  1093. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_6,
  1094. LINK_DESCRIPTOR_COUNTER_SUM)];
  1095. st->link_desc_counter_sum = HAL_GET_FIELD(
  1096. REO_DESCRIPTOR_THRESHOLD_REACHED_STATUS_6,
  1097. LINK_DESCRIPTOR_COUNTER_SUM,
  1098. val);
  1099. }
  1100. qdf_export_symbol(hal_reo_desc_thres_reached_status);
  1101. inline void
  1102. hal_reo_rx_update_queue_status(uint32_t *reo_desc,
  1103. struct hal_reo_update_rx_queue_status *st,
  1104. hal_soc_handle_t hal_soc_hdl)
  1105. {
  1106. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1107. /* Offsets of descriptor fields defined in HW headers start
  1108. * from the field after TLV header */
  1109. reo_desc += (sizeof(struct tlv_32_hdr) >> 2);
  1110. /* header */
  1111. hal_reo_status_get_header(reo_desc,
  1112. HAL_REO_UPDATE_RX_QUEUE_STATUS_TLV,
  1113. &(st->header), hal_soc);
  1114. }
  1115. qdf_export_symbol(hal_reo_rx_update_queue_status);
  1116. /**
  1117. * hal_reo_init_cmd_ring() - Initialize descriptors of REO command SRNG
  1118. * with command number
  1119. * @hal_soc: Handle to HAL SoC structure
  1120. * @hal_ring: Handle to HAL SRNG structure
  1121. *
  1122. * Return: none
  1123. */
  1124. inline void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl,
  1125. hal_ring_handle_t hal_ring_hdl)
  1126. {
  1127. int cmd_num;
  1128. uint32_t *desc_addr;
  1129. struct hal_srng_params srng_params;
  1130. uint32_t desc_size;
  1131. uint32_t num_desc;
  1132. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  1133. hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
  1134. desc_addr = (uint32_t *)(srng_params.ring_base_vaddr);
  1135. desc_addr += (sizeof(struct tlv_32_hdr) >> 2);
  1136. desc_size = hal_srng_get_entrysize(soc, REO_CMD) >> 2;
  1137. num_desc = srng_params.num_entries;
  1138. cmd_num = 1;
  1139. while (num_desc) {
  1140. /* Offsets of descriptor fields defined in HW headers start
  1141. * from the field after TLV header */
  1142. HAL_DESC_SET_FIELD(desc_addr, UNIFORM_REO_CMD_HEADER_0,
  1143. REO_CMD_NUMBER, cmd_num);
  1144. desc_addr += desc_size;
  1145. num_desc--; cmd_num++;
  1146. }
  1147. soc->reo_res_bitmap = 0;
  1148. }
  1149. qdf_export_symbol(hal_reo_init_cmd_ring);