wlan_cfg.c 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  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. /* This is default mapping and can be overridden by HW config
  413. * received from FW */
  414. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0);
  415. if (MAX_PDEV_CNT > 1)
  416. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2);
  417. if (MAX_PDEV_CNT > 2)
  418. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1);
  419. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  420. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  421. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  422. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  423. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  424. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  425. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  426. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  427. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  428. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  429. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  430. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  431. /*Enable checksum offload by default*/
  432. wlan_cfg_ctx->tcp_udp_checksumoffload =
  433. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  434. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  435. wlan_cfg_ctx->defrag_timeout_check =
  436. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  437. wlan_cfg_ctx->rx_defrag_min_timeout =
  438. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  439. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  440. CFG_DP_WBM_RELEASE_RING);
  441. wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
  442. CFG_DP_TCL_CMD_RING);
  443. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  444. CFG_DP_TCL_STATUS_RING);
  445. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  446. CFG_DP_REO_REINJECT_RING);
  447. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  448. CFG_DP_RX_RELEASE_RING);
  449. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  450. CFG_DP_REO_EXCEPTION_RING);
  451. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  452. CFG_DP_REO_CMD_RING);
  453. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  454. CFG_DP_REO_STATUS_RING);
  455. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  456. CFG_DP_RXDMA_REFILL_RING);
  457. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  458. CFG_DP_TX_DESC_LIMIT_0);
  459. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  460. CFG_DP_TX_DESC_LIMIT_1);
  461. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  462. CFG_DP_TX_DESC_LIMIT_2);
  463. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  464. CFG_DP_TX_DEVICE_LIMIT);
  465. wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
  466. CFG_DP_TX_SW_INTERNODE_QUEUE);
  467. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  468. CFG_DP_RXDMA_ERR_DST_RING);
  469. wlan_cfg_ctx->enable_data_stall_detection =
  470. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  471. wlan_cfg_ctx->tx_flow_start_queue_offset =
  472. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  473. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  474. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  475. wlan_cfg_ctx->disable_intra_bss_fwd =
  476. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  477. wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
  478. CFG_DP_RX_SW_DESC_WEIGHT);
  479. wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
  480. wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
  481. wlan_cfg_ctx->is_rx_flow_tag_enabled =
  482. cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
  483. wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
  484. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
  485. wlan_cfg_ctx->rx_flow_search_table_size =
  486. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
  487. wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
  488. cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
  489. wlan_cfg_ctx->mon_drop_thresh =
  490. cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD);
  491. return wlan_cfg_ctx;
  492. }
  493. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  494. {
  495. qdf_mem_free(wlan_cfg_ctx);
  496. }
  497. struct wlan_cfg_dp_pdev_ctxt *
  498. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  499. {
  500. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  501. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  502. if (!wlan_cfg_ctx)
  503. return NULL;
  504. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  505. CFG_DP_RXDMA_BUF_RING);
  506. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  507. CFG_DP_RXDMA_MONITOR_BUF_RING);
  508. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  509. CFG_DP_RXDMA_MONITOR_DST_RING);
  510. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  511. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  512. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  513. CFG_DP_RXDMA_MONITOR_DESC_RING);
  514. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  515. return wlan_cfg_ctx;
  516. }
  517. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  518. {
  519. if (wlan_cfg_ctx)
  520. qdf_mem_free(wlan_cfg_ctx);
  521. }
  522. int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
  523. {
  524. return cfg->mon_drop_thresh;
  525. }
  526. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  527. {
  528. cfg->num_int_ctxts = num;
  529. }
  530. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  531. {
  532. cfg->max_peer_id = val;
  533. }
  534. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  535. {
  536. cfg->max_ast_idx = val;
  537. }
  538. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  539. {
  540. return cfg->max_ast_idx;
  541. }
  542. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  543. int context, int mask)
  544. {
  545. cfg->int_tx_ring_mask[context] = mask;
  546. }
  547. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  548. int context, int mask)
  549. {
  550. cfg->int_rx_ring_mask[context] = mask;
  551. }
  552. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  553. int context, int mask)
  554. {
  555. cfg->int_rx_mon_ring_mask[context] = mask;
  556. }
  557. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  558. int context)
  559. {
  560. return cfg->int_host2rxdma_mon_ring_mask[context];
  561. }
  562. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  563. int context, int mask)
  564. {
  565. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  566. }
  567. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  568. int context)
  569. {
  570. return cfg->int_rxdma2host_mon_ring_mask[context];
  571. }
  572. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  573. int context, int mask)
  574. {
  575. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  576. }
  577. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  578. int context, int mask)
  579. {
  580. cfg->int_rxdma2host_ring_mask[context] = mask;
  581. }
  582. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  583. int context)
  584. {
  585. return cfg->int_rxdma2host_ring_mask[context];
  586. }
  587. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  588. int context, int mask)
  589. {
  590. cfg->int_host2rxdma_ring_mask[context] = mask;
  591. }
  592. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  593. int context)
  594. {
  595. return cfg->int_host2rxdma_ring_mask[context];
  596. }
  597. void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  598. int hw_macid)
  599. {
  600. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  601. cfg->hw_macid[pdev_idx] = hw_macid;
  602. }
  603. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  604. {
  605. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  606. return cfg->hw_macid[pdev_idx];
  607. }
  608. int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
  609. int hw_macid)
  610. {
  611. int idx;
  612. for (idx = 0; idx < MAX_NUM_LMAC_HW; idx++) {
  613. if (cfg->hw_macid[idx] == hw_macid)
  614. return (idx + 1);
  615. }
  616. qdf_assert_always(idx < MAX_PDEV_CNT);
  617. return WLAN_INVALID_PDEV_ID;
  618. }
  619. void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  620. int hw_macid)
  621. {
  622. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  623. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  624. cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
  625. }
  626. int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
  627. {
  628. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  629. return cfg->hw_macid_pdev_id_map[hw_macid];
  630. }
  631. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  632. int context, int mask)
  633. {
  634. cfg->int_ce_ring_mask[context] = mask;
  635. }
  636. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  637. int mask)
  638. {
  639. cfg->int_rx_ring_mask[context] = mask;
  640. }
  641. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  642. int context, int mask)
  643. {
  644. return cfg->int_rx_err_ring_mask[context] = mask;
  645. }
  646. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  647. int context, int mask)
  648. {
  649. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  650. }
  651. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  652. int context, int mask)
  653. {
  654. return cfg->int_reo_status_ring_mask[context] = mask;
  655. }
  656. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  657. {
  658. return cfg->num_int_ctxts;
  659. }
  660. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  661. {
  662. return cfg->int_tx_ring_mask[context];
  663. }
  664. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  665. {
  666. return cfg->int_rx_ring_mask[context];
  667. }
  668. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  669. int context)
  670. {
  671. return cfg->int_rx_err_ring_mask[context];
  672. }
  673. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  674. int context)
  675. {
  676. return cfg->int_rx_wbm_rel_ring_mask[context];
  677. }
  678. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  679. int context)
  680. {
  681. return cfg->int_reo_status_ring_mask[context];
  682. }
  683. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  684. {
  685. return cfg->int_rx_mon_ring_mask[context];
  686. }
  687. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  688. {
  689. return cfg->int_ce_ring_mask[context];
  690. }
  691. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  692. {
  693. return cfg->max_clients;
  694. }
  695. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  696. {
  697. return cfg->max_alloc_size;
  698. }
  699. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  700. {
  701. return cfg->per_pdev_tx_ring;
  702. }
  703. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  704. {
  705. return cfg->per_pdev_lmac_ring;
  706. }
  707. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  708. {
  709. return cfg->num_tcl_data_rings;
  710. }
  711. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  712. {
  713. return cfg->tx_ring_size;
  714. }
  715. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  716. {
  717. return cfg->tx_comp_ring_size;
  718. }
  719. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  720. {
  721. return cfg->per_pdev_rx_ring;
  722. }
  723. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  724. {
  725. return cfg->num_reo_dest_rings;
  726. }
  727. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  728. {
  729. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  730. }
  731. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  732. {
  733. return cfg->num_tx_desc_pool;
  734. }
  735. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  736. {
  737. cfg->num_tx_desc_pool = num_pool;
  738. }
  739. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  740. {
  741. return cfg->num_tx_ext_desc_pool;
  742. }
  743. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  744. {
  745. cfg->num_tx_ext_desc_pool = num_pool;
  746. }
  747. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  748. {
  749. return cfg->reo_dst_ring_size;
  750. }
  751. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  752. int reo_dst_ring_size)
  753. {
  754. cfg->reo_dst_ring_size = reo_dst_ring_size;
  755. }
  756. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  757. bool raw_mode_war)
  758. {
  759. cfg->raw_mode_war = raw_mode_war;
  760. }
  761. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  762. {
  763. return cfg->raw_mode_war;
  764. }
  765. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  766. {
  767. return cfg->num_tx_desc;
  768. }
  769. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  770. {
  771. cfg->num_tx_desc = num_desc;
  772. }
  773. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  774. {
  775. return cfg->min_tx_desc;
  776. }
  777. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  778. {
  779. return cfg->num_tx_ext_desc;
  780. }
  781. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  782. {
  783. cfg->num_tx_ext_desc = num_ext_desc;
  784. }
  785. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  786. {
  787. /* TODO: This should be calculated based on target capabilities */
  788. return cfg->max_peer_id;
  789. }
  790. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  791. {
  792. return cfg->dma_mon_buf_ring_size;
  793. }
  794. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  795. {
  796. return cfg->dma_mon_dest_ring_size;
  797. }
  798. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  799. {
  800. return cfg->dma_mon_status_ring_size;
  801. }
  802. int
  803. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  804. {
  805. return cfg->rxdma_monitor_desc_ring;
  806. }
  807. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  808. {
  809. return cfg->rx_dma_buf_ring_size;
  810. }
  811. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  812. {
  813. return cfg->num_mac_rings;
  814. }
  815. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  816. {
  817. return cfg->gro_enabled;
  818. }
  819. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  820. {
  821. return cfg->lro_enabled;
  822. }
  823. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  824. {
  825. return cfg->ipa_enabled;
  826. }
  827. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  828. {
  829. cfg->rx_hash = val;
  830. }
  831. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  832. {
  833. return cfg->rx_hash;
  834. }
  835. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  836. {
  837. return cfg->nss_enabled;
  838. }
  839. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  840. {
  841. cfg->nss_enabled = nss_enabled;
  842. }
  843. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  844. {
  845. return cfg->nss_cfg;
  846. }
  847. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  848. {
  849. cfg->nss_cfg = nss_cfg;
  850. if (cfg->nss_cfg)
  851. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  852. }
  853. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  854. {
  855. return cfg->int_batch_threshold_tx;
  856. }
  857. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  858. {
  859. return cfg->int_timer_threshold_tx;
  860. }
  861. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  862. {
  863. return cfg->int_batch_threshold_rx;
  864. }
  865. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  866. {
  867. return cfg->int_timer_threshold_rx;
  868. }
  869. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  870. {
  871. return cfg->int_batch_threshold_other;
  872. }
  873. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  874. {
  875. return cfg->int_timer_threshold_other;
  876. }
  877. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  878. {
  879. return cfg->int_timer_threshold_mon;
  880. }
  881. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  882. {
  883. return cfg->tcp_udp_checksumoffload;
  884. }
  885. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  886. {
  887. return cfg->rx_defrag_min_timeout;
  888. }
  889. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  890. {
  891. return cfg->defrag_timeout_check;
  892. }
  893. int
  894. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  895. {
  896. return cfg->wbm_release_ring;
  897. }
  898. int
  899. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  900. {
  901. return cfg->tcl_cmd_ring;
  902. }
  903. int
  904. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  905. {
  906. return cfg->tcl_status_ring;
  907. }
  908. int
  909. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  910. {
  911. return cfg->reo_reinject_ring;
  912. }
  913. int
  914. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  915. {
  916. return cfg->rx_release_ring;
  917. }
  918. int
  919. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  920. {
  921. return cfg->reo_exception_ring;
  922. }
  923. int
  924. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  925. {
  926. return cfg->reo_cmd_ring;
  927. }
  928. int
  929. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  930. {
  931. return cfg->reo_status_ring;
  932. }
  933. int
  934. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  935. {
  936. return cfg->rxdma_refill_ring;
  937. }
  938. int
  939. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  940. {
  941. return cfg->tx_desc_limit_0;
  942. }
  943. int
  944. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  945. {
  946. return cfg->tx_desc_limit_1;
  947. }
  948. int
  949. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  950. {
  951. return cfg->tx_desc_limit_2;
  952. }
  953. int
  954. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  955. {
  956. return cfg->tx_device_limit;
  957. }
  958. int
  959. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  960. {
  961. return cfg->tx_sw_internode_queue;
  962. }
  963. int
  964. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  965. {
  966. return cfg->rxdma_err_dst_ring;
  967. }
  968. int
  969. wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
  970. {
  971. return cfg->rx_sw_desc_weight;
  972. }
  973. bool
  974. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  975. enum cdp_capabilities dp_caps)
  976. {
  977. switch (dp_caps) {
  978. case CDP_CFG_DP_TSO:
  979. return cfg->tso_enabled;
  980. case CDP_CFG_DP_LRO:
  981. return cfg->lro_enabled;
  982. case CDP_CFG_DP_SG:
  983. return cfg->sg_enabled;
  984. case CDP_CFG_DP_GRO:
  985. return cfg->gro_enabled;
  986. case CDP_CFG_DP_OL_TX_CSUM:
  987. return cfg->ol_tx_csum_enabled;
  988. case CDP_CFG_DP_OL_RX_CSUM:
  989. return cfg->ol_rx_csum_enabled;
  990. case CDP_CFG_DP_RAWMODE:
  991. return cfg->rawmode_enabled;
  992. case CDP_CFG_DP_PEER_FLOW_CTRL:
  993. return cfg->peer_flow_ctrl_enabled;
  994. default:
  995. return false;
  996. }
  997. }
  998. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  999. /**
  1000. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  1001. * @cfg: config context
  1002. *
  1003. * Return: stop threshold
  1004. */
  1005. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  1006. {
  1007. return cfg->tx_flow_stop_queue_threshold;
  1008. }
  1009. /**
  1010. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  1011. * for TX to resume
  1012. * @cfg: config context
  1013. *
  1014. * Return: stop threshold
  1015. */
  1016. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  1017. {
  1018. return cfg->tx_flow_start_queue_offset;
  1019. }
  1020. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1021. void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1022. bool val)
  1023. {
  1024. cfg->is_rx_flow_tag_enabled = val;
  1025. }
  1026. uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
  1027. {
  1028. return cfg->rx_toeplitz_hash_key;
  1029. }
  1030. uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
  1031. {
  1032. return cfg->rx_flow_max_search;
  1033. }
  1034. bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1035. {
  1036. return cfg->is_rx_flow_tag_enabled;
  1037. }
  1038. void
  1039. wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
  1040. bool val)
  1041. {
  1042. cfg->is_rx_flow_search_table_per_pdev = val;
  1043. }
  1044. bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
  1045. {
  1046. return cfg->is_rx_flow_search_table_per_pdev;
  1047. }
  1048. void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  1049. uint16_t val)
  1050. {
  1051. cfg->rx_flow_search_table_size = val;
  1052. }
  1053. uint16_t
  1054. wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1055. {
  1056. return cfg->rx_flow_search_table_size;
  1057. }
  1058. void
  1059. wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1060. bool val)
  1061. {
  1062. cfg->is_rx_mon_protocol_flow_tag_enabled = val;
  1063. }
  1064. bool
  1065. wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1066. {
  1067. return cfg->is_rx_mon_protocol_flow_tag_enabled;
  1068. }