wlan_cfg.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266
  1. /*
  2. * Copyright (c) 2016-2020 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. #if defined(CONFIG_HL_SUPPORT)
  19. #include "wlan_tgt_def_config_hl.h"
  20. #else
  21. #include "wlan_tgt_def_config.h"
  22. #endif
  23. #include "qdf_trace.h"
  24. #include "qdf_mem.h"
  25. #include <cdp_txrx_ops.h>
  26. #include "wlan_cfg.h"
  27. #include "cfg_ucfg_api.h"
  28. #include "hal_api.h"
  29. #include "dp_types.h"
  30. /*
  31. * FIX THIS -
  32. * For now, all these configuration parameters are hardcoded.
  33. * Many of these should actually be coming from dts file/ini file
  34. */
  35. /*
  36. * The max allowed size for tx comp ring is 8191.
  37. * This is limitted by h/w ring max size.
  38. * As this is not a power of 2 it does not work with nss offload so the
  39. * nearest available size which is power of 2 is 4096 chosen for nss
  40. */
  41. #define WLAN_CFG_TX_RING_MASK_0 0x1
  42. #define WLAN_CFG_TX_RING_MASK_1 0x2
  43. #define WLAN_CFG_TX_RING_MASK_2 0x4
  44. #define WLAN_CFG_TX_RING_MASK_3 0x0
  45. #define WLAN_CFG_RX_RING_MASK_0 0x1
  46. #define WLAN_CFG_RX_RING_MASK_1 0x2
  47. #define WLAN_CFG_RX_RING_MASK_2 0x4
  48. #define WLAN_CFG_RX_RING_MASK_3 0x8
  49. #define WLAN_CFG_RX_MON_RING_MASK_0 0x1
  50. #define WLAN_CFG_RX_MON_RING_MASK_1 0x2
  51. #define WLAN_CFG_RX_MON_RING_MASK_2 0x4
  52. #define WLAN_CFG_RX_MON_RING_MASK_3 0x0
  53. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0 0x1
  54. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1 0x2
  55. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2 0x4
  56. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0 0x1
  57. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1 0x2
  58. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2 0x4
  59. #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
  60. #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
  61. #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
  62. #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
  63. #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
  64. #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
  65. #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
  66. #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
  67. #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
  68. #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
  69. #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
  70. #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
  71. #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
  72. #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
  73. #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
  74. #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
  75. #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
  76. #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
  77. #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
  78. #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
  79. #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
  80. static const int tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  81. WLAN_CFG_TX_RING_MASK_0, 0, 0, 0, 0, 0, 0};
  82. #ifndef IPA_OFFLOAD
  83. static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  84. 0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, WLAN_CFG_RX_RING_MASK_2, WLAN_CFG_RX_RING_MASK_3, 0, 0};
  85. #else
  86. static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  87. 0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, WLAN_CFG_RX_RING_MASK_2, 0, 0, 0};
  88. #endif
  89. static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  90. 0, WLAN_CFG_RX_MON_RING_MASK_0, WLAN_CFG_RX_MON_RING_MASK_1, 0, 0, 0, 0};
  91. static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  92. 0, 0, 0, 0, 0, 0, 0};
  93. static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  94. 0, 0, 0, 0, 0, WLAN_CFG_RXDMA2HOST_RING_MASK_0, WLAN_CFG_RXDMA2HOST_RING_MASK_1};
  95. static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  96. 0, 0, 0, 0, 0, 0, 0};
  97. static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  98. 0, 0, 0, 0, 0, 0, 0};
  99. static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  100. 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_ERR_RING_MASK_0};
  101. static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  102. 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_WBM_REL_RING_MASK_0};
  103. static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  104. 0, 0, 0, 0, 0, 0, WLAN_CFG_REO_STATUS_RING_MASK_0};
  105. static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  106. 0, 0, 0, 0, 0, 0, 0};
  107. static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  108. 0, 0, 0, 0, 0, 0, 0};
  109. static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  110. 0, 0, 0, 0, 0, 0, 0};
  111. static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  112. 0, 0, 0, 0, 0, 0, 0};
  113. static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  114. 0, 0, 0, 0, 0, 0, 0};
  115. static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  116. 0, 0, 0, 0, 0, 0, 0};
  117. static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  118. 0, 0, 0, 0, 0, 0, 0};
  119. static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  120. 0, 0, 0, 0, 0, 0, 0};
  121. static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  122. 0, 0, 0, 0, 0, 0, 0};
  123. static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  124. 0, 0, 0, 0, 0, 0, 0};
  125. #else
  126. static const int tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  127. WLAN_CFG_TX_RING_MASK_0,
  128. WLAN_CFG_TX_RING_MASK_1,
  129. WLAN_CFG_TX_RING_MASK_2,
  130. WLAN_CFG_TX_RING_MASK_3};
  131. static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  132. WLAN_CFG_RX_RING_MASK_0,
  133. WLAN_CFG_RX_RING_MASK_1,
  134. WLAN_CFG_RX_RING_MASK_2,
  135. WLAN_CFG_RX_RING_MASK_3};
  136. static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  137. 0, 0, 0};
  138. static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  139. 0, 0, 0, 0};
  140. static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  141. 0, 0, 0, 0};
  142. static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  143. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
  144. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
  145. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
  146. static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  147. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
  148. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
  149. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
  150. static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  151. WLAN_CFG_RX_ERR_RING_MASK_0,
  152. WLAN_CFG_RX_ERR_RING_MASK_1,
  153. WLAN_CFG_RX_ERR_RING_MASK_2,
  154. WLAN_CFG_RX_ERR_RING_MASK_3};
  155. static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  156. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  157. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  158. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  159. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  160. static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  161. WLAN_CFG_REO_STATUS_RING_MASK_0,
  162. WLAN_CFG_REO_STATUS_RING_MASK_1,
  163. WLAN_CFG_REO_STATUS_RING_MASK_2,
  164. WLAN_CFG_REO_STATUS_RING_MASK_3};
  165. static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  166. WLAN_CFG_TX_RING_MASK_0,
  167. WLAN_CFG_TX_RING_MASK_1,
  168. WLAN_CFG_TX_RING_MASK_2,
  169. WLAN_CFG_TX_RING_MASK_3};
  170. static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  171. 0,
  172. 0,
  173. 0,
  174. 0,
  175. 0,
  176. 0,
  177. 0,
  178. WLAN_CFG_RX_RING_MASK_0,
  179. WLAN_CFG_RX_RING_MASK_1,
  180. WLAN_CFG_RX_RING_MASK_2,
  181. WLAN_CFG_RX_RING_MASK_3};
  182. static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  183. 0,
  184. 0,
  185. 0,
  186. 0,
  187. WLAN_CFG_RX_MON_RING_MASK_0,
  188. WLAN_CFG_RX_MON_RING_MASK_1,
  189. WLAN_CFG_RX_MON_RING_MASK_2};
  190. static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  191. WLAN_CFG_HOST2RXDMA_RING_MASK_0,
  192. WLAN_CFG_HOST2RXDMA_RING_MASK_1,
  193. WLAN_CFG_HOST2RXDMA_RING_MASK_2,
  194. WLAN_CFG_HOST2RXDMA_RING_MASK_3};
  195. static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  196. WLAN_CFG_RXDMA2HOST_RING_MASK_0,
  197. WLAN_CFG_RXDMA2HOST_RING_MASK_1,
  198. WLAN_CFG_RXDMA2HOST_RING_MASK_2,
  199. WLAN_CFG_RXDMA2HOST_RING_MASK_3};
  200. static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  201. 0,
  202. 0,
  203. 0,
  204. 0,
  205. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
  206. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
  207. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
  208. static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  209. 0,
  210. 0,
  211. 0,
  212. 0,
  213. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
  214. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
  215. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
  216. static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  217. WLAN_CFG_RX_ERR_RING_MASK_0,
  218. WLAN_CFG_RX_ERR_RING_MASK_1,
  219. WLAN_CFG_RX_ERR_RING_MASK_2,
  220. WLAN_CFG_RX_ERR_RING_MASK_3};
  221. static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  222. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  223. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  224. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  225. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  226. static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  227. WLAN_CFG_REO_STATUS_RING_MASK_0,
  228. WLAN_CFG_REO_STATUS_RING_MASK_1,
  229. WLAN_CFG_REO_STATUS_RING_MASK_2,
  230. WLAN_CFG_REO_STATUS_RING_MASK_3};
  231. #endif /* MAX_PDEV_CNT == 1 */
  232. /**
  233. * g_wlan_srng_cfg[] - Per ring_type specific configuration
  234. *
  235. */
  236. struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES];
  237. /* REO_DST ring configuration */
  238. struct wlan_srng_cfg wlan_srng_reo_cfg = {
  239. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING,
  240. .batch_count_threshold = 0,
  241. .low_threshold = 0,
  242. };
  243. /* WBM2SW_RELEASE ring configuration */
  244. struct wlan_srng_cfg wlan_srng_wbm_release_cfg = {
  245. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING,
  246. .batch_count_threshold = 0,
  247. .low_threshold = 0,
  248. };
  249. /* RXDMA_BUF ring configuration */
  250. struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = {
  251. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  252. .batch_count_threshold = 0,
  253. .low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3,
  254. };
  255. /* RXDMA_MONITOR_BUF ring configuration */
  256. struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = {
  257. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  258. .batch_count_threshold = 0,
  259. .low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3,
  260. };
  261. /* RXDMA_MONITOR_STATUS ring configuration */
  262. struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = {
  263. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  264. .batch_count_threshold = 0,
  265. .low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3,
  266. };
  267. /* DEFAULT_CONFIG ring configuration */
  268. struct wlan_srng_cfg wlan_srng_default_cfg = {
  269. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER,
  270. .batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER,
  271. .low_threshold = 0,
  272. };
  273. void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg)
  274. {
  275. g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg;
  276. g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg;
  277. g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg;
  278. g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg;
  279. g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg;
  280. g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg;
  281. g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg;
  282. g_wlan_srng_cfg[TCL_CMD] = wlan_srng_default_cfg;
  283. g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
  284. g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
  285. g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
  286. g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
  287. g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
  288. g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
  289. wlan_srng_rxdma_monitor_buf_cfg;
  290. g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
  291. wlan_srng_rxdma_monitor_status_cfg;
  292. g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
  293. g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
  294. g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
  295. #ifdef WLAN_FEATURE_CIF_CFR
  296. g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
  297. #endif
  298. *wlan_cfg = g_wlan_srng_cfg;
  299. }
  300. static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
  301. 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
  302. 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
  303. 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
  304. 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
  305. 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
  306. };
  307. void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  308. int interrupt_mode,
  309. bool is_monitor_mode) {
  310. int i = 0;
  311. if (interrupt_mode == DP_INTR_INTEGRATED) {
  312. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  313. wlan_cfg_ctx->int_tx_ring_mask[i] =
  314. tx_ring_mask_integrated[i];
  315. wlan_cfg_ctx->int_rx_ring_mask[i] =
  316. rx_ring_mask_integrated[i];
  317. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  318. rx_mon_ring_mask_integrated[i];
  319. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  320. rx_err_ring_mask_integrated[i];
  321. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  322. rx_wbm_rel_ring_mask_integrated[i];
  323. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  324. reo_status_ring_mask_integrated[i];
  325. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  326. rxdma2host_ring_mask_integrated[i];
  327. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  328. host2rxdma_ring_mask_integrated[i];
  329. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  330. host2rxdma_mon_ring_mask_integrated[i];
  331. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  332. rxdma2host_mon_ring_mask_integrated[i];
  333. }
  334. } else if (interrupt_mode == DP_INTR_MSI || interrupt_mode ==
  335. DP_INTR_POLL) {
  336. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  337. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i];
  338. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  339. rx_mon_ring_mask_msi[i];
  340. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  341. rx_err_ring_mask_msi[i];
  342. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  343. rx_wbm_rel_ring_mask_msi[i];
  344. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  345. reo_status_ring_mask_msi[i];
  346. if (is_monitor_mode) {
  347. wlan_cfg_ctx->int_rx_ring_mask[i] = 0;
  348. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0;
  349. } else {
  350. wlan_cfg_ctx->int_rx_ring_mask[i] =
  351. rx_ring_mask_msi[i];
  352. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  353. rxdma2host_ring_mask_msi[i];
  354. }
  355. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  356. host2rxdma_ring_mask_msi[i];
  357. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  358. host2rxdma_mon_ring_mask_msi[i];
  359. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  360. rxdma2host_mon_ring_mask_msi[i];
  361. }
  362. } else {
  363. qdf_err("Interrupt mode %d", interrupt_mode);
  364. }
  365. }
  366. /**
  367. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  368. * @psoc - Object manager psoc
  369. * Return: wlan_cfg_ctx - Handle to Configuration context
  370. */
  371. struct wlan_cfg_dp_soc_ctxt *
  372. wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  373. {
  374. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  375. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  376. if (!wlan_cfg_ctx)
  377. return NULL;
  378. wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
  379. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  380. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  381. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  382. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  383. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  384. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  385. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  386. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  387. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  388. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  389. CFG_DP_TX_EXT_DESC_POOLS);
  390. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  391. wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
  392. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  393. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  394. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  395. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  396. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  397. CFG_DP_TX_COMPL_RING_SIZE);
  398. wlan_cfg_ctx->tx_comp_ring_size_nss =
  399. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  400. wlan_cfg_ctx->int_batch_threshold_tx =
  401. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  402. wlan_cfg_ctx->int_timer_threshold_tx =
  403. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  404. wlan_cfg_ctx->int_batch_threshold_rx =
  405. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  406. wlan_cfg_ctx->int_timer_threshold_rx =
  407. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  408. wlan_cfg_ctx->int_batch_threshold_other =
  409. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  410. wlan_cfg_ctx->int_timer_threshold_other =
  411. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  412. wlan_cfg_ctx->pktlog_buffer_size =
  413. cfg_get(psoc, CFG_DP_PKTLOG_BUFFER_SIZE);
  414. /* This is default mapping and can be overridden by HW config
  415. * received from FW */
  416. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0);
  417. if (MAX_PDEV_CNT > 1)
  418. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2);
  419. if (MAX_PDEV_CNT > 2)
  420. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1);
  421. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  422. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  423. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  424. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  425. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  426. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  427. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  428. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  429. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  430. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  431. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  432. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  433. /*Enable checksum offload by default*/
  434. wlan_cfg_ctx->tcp_udp_checksumoffload =
  435. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  436. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  437. wlan_cfg_ctx->defrag_timeout_check =
  438. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  439. wlan_cfg_ctx->rx_defrag_min_timeout =
  440. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  441. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  442. CFG_DP_WBM_RELEASE_RING);
  443. wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
  444. CFG_DP_TCL_CMD_RING);
  445. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  446. CFG_DP_TCL_STATUS_RING);
  447. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  448. CFG_DP_REO_REINJECT_RING);
  449. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  450. CFG_DP_RX_RELEASE_RING);
  451. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  452. CFG_DP_REO_EXCEPTION_RING);
  453. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  454. CFG_DP_REO_CMD_RING);
  455. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  456. CFG_DP_REO_STATUS_RING);
  457. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  458. CFG_DP_RXDMA_REFILL_RING);
  459. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  460. CFG_DP_TX_DESC_LIMIT_0);
  461. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  462. CFG_DP_TX_DESC_LIMIT_1);
  463. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  464. CFG_DP_TX_DESC_LIMIT_2);
  465. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  466. CFG_DP_TX_DEVICE_LIMIT);
  467. wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
  468. CFG_DP_TX_SW_INTERNODE_QUEUE);
  469. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  470. CFG_DP_RXDMA_ERR_DST_RING);
  471. wlan_cfg_ctx->enable_data_stall_detection =
  472. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  473. wlan_cfg_ctx->tx_flow_start_queue_offset =
  474. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  475. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  476. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  477. wlan_cfg_ctx->disable_intra_bss_fwd =
  478. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  479. wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
  480. CFG_DP_RX_SW_DESC_WEIGHT);
  481. wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
  482. wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
  483. wlan_cfg_ctx->is_rx_flow_tag_enabled =
  484. cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
  485. wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
  486. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
  487. wlan_cfg_ctx->rx_flow_search_table_size =
  488. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
  489. wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
  490. cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
  491. wlan_cfg_ctx->mon_drop_thresh =
  492. cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD);
  493. return wlan_cfg_ctx;
  494. }
  495. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  496. {
  497. qdf_mem_free(wlan_cfg_ctx);
  498. }
  499. struct wlan_cfg_dp_pdev_ctxt *
  500. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  501. {
  502. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  503. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  504. if (!wlan_cfg_ctx)
  505. return NULL;
  506. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  507. CFG_DP_RXDMA_BUF_RING);
  508. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  509. CFG_DP_RXDMA_MONITOR_BUF_RING);
  510. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  511. CFG_DP_RXDMA_MONITOR_DST_RING);
  512. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  513. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  514. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  515. CFG_DP_RXDMA_MONITOR_DESC_RING);
  516. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  517. return wlan_cfg_ctx;
  518. }
  519. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  520. {
  521. if (wlan_cfg_ctx)
  522. qdf_mem_free(wlan_cfg_ctx);
  523. }
  524. int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
  525. {
  526. return cfg->mon_drop_thresh;
  527. }
  528. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  529. {
  530. cfg->num_int_ctxts = num;
  531. }
  532. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  533. {
  534. cfg->max_peer_id = val;
  535. }
  536. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  537. {
  538. cfg->max_ast_idx = val;
  539. }
  540. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  541. {
  542. return cfg->max_ast_idx;
  543. }
  544. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  545. int context, int mask)
  546. {
  547. cfg->int_tx_ring_mask[context] = mask;
  548. }
  549. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  550. int context, int mask)
  551. {
  552. cfg->int_rx_ring_mask[context] = mask;
  553. }
  554. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  555. int context, int mask)
  556. {
  557. cfg->int_rx_mon_ring_mask[context] = mask;
  558. }
  559. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  560. int context)
  561. {
  562. return cfg->int_host2rxdma_mon_ring_mask[context];
  563. }
  564. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  565. int context, int mask)
  566. {
  567. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  568. }
  569. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  570. int context)
  571. {
  572. return cfg->int_rxdma2host_mon_ring_mask[context];
  573. }
  574. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  575. int context, int mask)
  576. {
  577. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  578. }
  579. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  580. int context, int mask)
  581. {
  582. cfg->int_rxdma2host_ring_mask[context] = mask;
  583. }
  584. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  585. int context)
  586. {
  587. return cfg->int_rxdma2host_ring_mask[context];
  588. }
  589. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  590. int context, int mask)
  591. {
  592. cfg->int_host2rxdma_ring_mask[context] = mask;
  593. }
  594. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  595. int context)
  596. {
  597. return cfg->int_host2rxdma_ring_mask[context];
  598. }
  599. void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  600. int hw_macid)
  601. {
  602. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  603. cfg->hw_macid[pdev_idx] = hw_macid;
  604. }
  605. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  606. {
  607. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  608. return cfg->hw_macid[pdev_idx];
  609. }
  610. int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
  611. int hw_macid)
  612. {
  613. int idx;
  614. for (idx = 0; idx < MAX_NUM_LMAC_HW; idx++) {
  615. if (cfg->hw_macid[idx] == hw_macid)
  616. return (idx + 1);
  617. }
  618. qdf_assert_always(idx < MAX_PDEV_CNT);
  619. return WLAN_INVALID_PDEV_ID;
  620. }
  621. void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  622. int hw_macid)
  623. {
  624. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  625. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  626. cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
  627. }
  628. int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
  629. {
  630. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  631. return cfg->hw_macid_pdev_id_map[hw_macid];
  632. }
  633. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  634. int context, int mask)
  635. {
  636. cfg->int_ce_ring_mask[context] = mask;
  637. }
  638. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  639. int mask)
  640. {
  641. cfg->int_rx_ring_mask[context] = mask;
  642. }
  643. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  644. int context, int mask)
  645. {
  646. return cfg->int_rx_err_ring_mask[context] = mask;
  647. }
  648. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  649. int context, int mask)
  650. {
  651. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  652. }
  653. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  654. int context, int mask)
  655. {
  656. return cfg->int_reo_status_ring_mask[context] = mask;
  657. }
  658. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  659. {
  660. return cfg->num_int_ctxts;
  661. }
  662. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  663. {
  664. return cfg->int_tx_ring_mask[context];
  665. }
  666. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  667. {
  668. return cfg->int_rx_ring_mask[context];
  669. }
  670. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  671. int context)
  672. {
  673. return cfg->int_rx_err_ring_mask[context];
  674. }
  675. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  676. int context)
  677. {
  678. return cfg->int_rx_wbm_rel_ring_mask[context];
  679. }
  680. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  681. int context)
  682. {
  683. return cfg->int_reo_status_ring_mask[context];
  684. }
  685. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  686. {
  687. return cfg->int_rx_mon_ring_mask[context];
  688. }
  689. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  690. {
  691. return cfg->int_ce_ring_mask[context];
  692. }
  693. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  694. {
  695. return cfg->max_clients;
  696. }
  697. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  698. {
  699. return cfg->max_alloc_size;
  700. }
  701. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  702. {
  703. return cfg->per_pdev_tx_ring;
  704. }
  705. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  706. {
  707. return cfg->per_pdev_lmac_ring;
  708. }
  709. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  710. {
  711. return cfg->num_tcl_data_rings;
  712. }
  713. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  714. {
  715. return cfg->tx_ring_size;
  716. }
  717. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  718. {
  719. return cfg->tx_comp_ring_size;
  720. }
  721. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  722. {
  723. return cfg->per_pdev_rx_ring;
  724. }
  725. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  726. {
  727. return cfg->num_reo_dest_rings;
  728. }
  729. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  730. {
  731. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  732. }
  733. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  734. {
  735. return cfg->num_tx_desc_pool;
  736. }
  737. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  738. {
  739. cfg->num_tx_desc_pool = num_pool;
  740. }
  741. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  742. {
  743. return cfg->num_tx_ext_desc_pool;
  744. }
  745. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  746. {
  747. cfg->num_tx_ext_desc_pool = num_pool;
  748. }
  749. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  750. {
  751. return cfg->reo_dst_ring_size;
  752. }
  753. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  754. int reo_dst_ring_size)
  755. {
  756. cfg->reo_dst_ring_size = reo_dst_ring_size;
  757. }
  758. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  759. bool raw_mode_war)
  760. {
  761. cfg->raw_mode_war = raw_mode_war;
  762. }
  763. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  764. {
  765. return cfg->raw_mode_war;
  766. }
  767. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  768. {
  769. return cfg->num_tx_desc;
  770. }
  771. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  772. {
  773. cfg->num_tx_desc = num_desc;
  774. }
  775. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  776. {
  777. return cfg->min_tx_desc;
  778. }
  779. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  780. {
  781. return cfg->num_tx_ext_desc;
  782. }
  783. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  784. {
  785. cfg->num_tx_ext_desc = num_ext_desc;
  786. }
  787. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  788. {
  789. /* TODO: This should be calculated based on target capabilities */
  790. return cfg->max_peer_id;
  791. }
  792. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  793. {
  794. return cfg->dma_mon_buf_ring_size;
  795. }
  796. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  797. {
  798. return cfg->dma_mon_dest_ring_size;
  799. }
  800. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  801. {
  802. return cfg->dma_mon_status_ring_size;
  803. }
  804. int
  805. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  806. {
  807. return cfg->rxdma_monitor_desc_ring;
  808. }
  809. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  810. {
  811. return cfg->rx_dma_buf_ring_size;
  812. }
  813. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  814. {
  815. return cfg->num_mac_rings;
  816. }
  817. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  818. {
  819. return cfg->gro_enabled;
  820. }
  821. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  822. {
  823. return cfg->lro_enabled;
  824. }
  825. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  826. {
  827. return cfg->ipa_enabled;
  828. }
  829. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  830. {
  831. cfg->rx_hash = val;
  832. }
  833. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  834. {
  835. return cfg->rx_hash;
  836. }
  837. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  838. {
  839. return cfg->nss_enabled;
  840. }
  841. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  842. {
  843. cfg->nss_enabled = nss_enabled;
  844. }
  845. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  846. {
  847. return cfg->nss_cfg;
  848. }
  849. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  850. {
  851. cfg->nss_cfg = nss_cfg;
  852. if (cfg->nss_cfg)
  853. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  854. }
  855. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  856. {
  857. return cfg->int_batch_threshold_tx;
  858. }
  859. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  860. {
  861. return cfg->int_timer_threshold_tx;
  862. }
  863. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  864. {
  865. return cfg->int_batch_threshold_rx;
  866. }
  867. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  868. {
  869. return cfg->int_timer_threshold_rx;
  870. }
  871. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  872. {
  873. return cfg->int_batch_threshold_other;
  874. }
  875. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  876. {
  877. return cfg->int_timer_threshold_other;
  878. }
  879. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  880. {
  881. return cfg->int_timer_threshold_mon;
  882. }
  883. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  884. {
  885. return cfg->tcp_udp_checksumoffload;
  886. }
  887. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  888. {
  889. return cfg->rx_defrag_min_timeout;
  890. }
  891. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  892. {
  893. return cfg->defrag_timeout_check;
  894. }
  895. int
  896. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  897. {
  898. return cfg->wbm_release_ring;
  899. }
  900. int
  901. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  902. {
  903. return cfg->tcl_cmd_ring;
  904. }
  905. int
  906. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  907. {
  908. return cfg->tcl_status_ring;
  909. }
  910. int
  911. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  912. {
  913. return cfg->reo_reinject_ring;
  914. }
  915. int
  916. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  917. {
  918. return cfg->rx_release_ring;
  919. }
  920. int
  921. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  922. {
  923. return cfg->reo_exception_ring;
  924. }
  925. int
  926. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  927. {
  928. return cfg->reo_cmd_ring;
  929. }
  930. int
  931. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  932. {
  933. return cfg->reo_status_ring;
  934. }
  935. int
  936. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  937. {
  938. return cfg->rxdma_refill_ring;
  939. }
  940. int
  941. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  942. {
  943. return cfg->tx_desc_limit_0;
  944. }
  945. int
  946. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  947. {
  948. return cfg->tx_desc_limit_1;
  949. }
  950. int
  951. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  952. {
  953. return cfg->tx_desc_limit_2;
  954. }
  955. int
  956. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  957. {
  958. return cfg->tx_device_limit;
  959. }
  960. int
  961. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  962. {
  963. return cfg->tx_sw_internode_queue;
  964. }
  965. int
  966. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  967. {
  968. return cfg->rxdma_err_dst_ring;
  969. }
  970. int
  971. wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
  972. {
  973. return cfg->rx_sw_desc_weight;
  974. }
  975. bool
  976. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  977. enum cdp_capabilities dp_caps)
  978. {
  979. switch (dp_caps) {
  980. case CDP_CFG_DP_TSO:
  981. return cfg->tso_enabled;
  982. case CDP_CFG_DP_LRO:
  983. return cfg->lro_enabled;
  984. case CDP_CFG_DP_SG:
  985. return cfg->sg_enabled;
  986. case CDP_CFG_DP_GRO:
  987. return cfg->gro_enabled;
  988. case CDP_CFG_DP_OL_TX_CSUM:
  989. return cfg->ol_tx_csum_enabled;
  990. case CDP_CFG_DP_OL_RX_CSUM:
  991. return cfg->ol_rx_csum_enabled;
  992. case CDP_CFG_DP_RAWMODE:
  993. return cfg->rawmode_enabled;
  994. case CDP_CFG_DP_PEER_FLOW_CTRL:
  995. return cfg->peer_flow_ctrl_enabled;
  996. default:
  997. return false;
  998. }
  999. }
  1000. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  1001. /**
  1002. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  1003. * @cfg: config context
  1004. *
  1005. * Return: stop threshold
  1006. */
  1007. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  1008. {
  1009. return cfg->tx_flow_stop_queue_threshold;
  1010. }
  1011. /**
  1012. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  1013. * for TX to resume
  1014. * @cfg: config context
  1015. *
  1016. * Return: stop threshold
  1017. */
  1018. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  1019. {
  1020. return cfg->tx_flow_start_queue_offset;
  1021. }
  1022. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1023. void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1024. bool val)
  1025. {
  1026. cfg->is_rx_flow_tag_enabled = val;
  1027. }
  1028. uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
  1029. {
  1030. return cfg->rx_toeplitz_hash_key;
  1031. }
  1032. uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
  1033. {
  1034. return cfg->rx_flow_max_search;
  1035. }
  1036. bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1037. {
  1038. return cfg->is_rx_flow_tag_enabled;
  1039. }
  1040. void
  1041. wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
  1042. bool val)
  1043. {
  1044. cfg->is_rx_flow_search_table_per_pdev = val;
  1045. }
  1046. bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
  1047. {
  1048. return cfg->is_rx_flow_search_table_per_pdev;
  1049. }
  1050. void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  1051. uint16_t val)
  1052. {
  1053. cfg->rx_flow_search_table_size = val;
  1054. }
  1055. uint16_t
  1056. wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1057. {
  1058. return cfg->rx_flow_search_table_size;
  1059. }
  1060. void
  1061. wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1062. bool val)
  1063. {
  1064. cfg->is_rx_mon_protocol_flow_tag_enabled = val;
  1065. }
  1066. bool
  1067. wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1068. {
  1069. return cfg->is_rx_mon_protocol_flow_tag_enabled;
  1070. }