wlan_cfg.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492
  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. 0,
  133. 0,
  134. 0,
  135. 0,
  136. WLAN_CFG_RX_RING_MASK_0,
  137. WLAN_CFG_RX_RING_MASK_1,
  138. WLAN_CFG_RX_RING_MASK_2,
  139. WLAN_CFG_RX_RING_MASK_3};
  140. static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  141. 0,
  142. 0,
  143. 0,
  144. WLAN_CFG_RX_MON_RING_MASK_0,
  145. WLAN_CFG_RX_MON_RING_MASK_1,
  146. WLAN_CFG_RX_MON_RING_MASK_2};
  147. static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  148. 0,
  149. 0,
  150. 0,
  151. WLAN_CFG_HOST2RXDMA_RING_MASK_0,
  152. WLAN_CFG_HOST2RXDMA_RING_MASK_1,
  153. WLAN_CFG_HOST2RXDMA_RING_MASK_2,
  154. WLAN_CFG_HOST2RXDMA_RING_MASK_3};
  155. static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  156. 0,
  157. 0,
  158. 0,
  159. WLAN_CFG_RXDMA2HOST_RING_MASK_0,
  160. WLAN_CFG_RXDMA2HOST_RING_MASK_1,
  161. WLAN_CFG_RXDMA2HOST_RING_MASK_2,
  162. WLAN_CFG_RXDMA2HOST_RING_MASK_3};
  163. static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  164. 0,
  165. 0,
  166. 0,
  167. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
  168. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
  169. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
  170. static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  171. 0,
  172. 0,
  173. 0,
  174. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
  175. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
  176. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
  177. static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  178. 0,
  179. 0,
  180. 0,
  181. WLAN_CFG_RX_ERR_RING_MASK_0,
  182. WLAN_CFG_RX_ERR_RING_MASK_1,
  183. WLAN_CFG_RX_ERR_RING_MASK_2,
  184. WLAN_CFG_RX_ERR_RING_MASK_3};
  185. static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  186. 0,
  187. 0,
  188. 0,
  189. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  190. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  191. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  192. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  193. static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
  194. 0,
  195. 0,
  196. 0,
  197. WLAN_CFG_REO_STATUS_RING_MASK_0,
  198. WLAN_CFG_REO_STATUS_RING_MASK_1,
  199. WLAN_CFG_REO_STATUS_RING_MASK_2,
  200. WLAN_CFG_REO_STATUS_RING_MASK_3};
  201. static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  202. WLAN_CFG_TX_RING_MASK_0,
  203. WLAN_CFG_TX_RING_MASK_1,
  204. WLAN_CFG_TX_RING_MASK_2,
  205. WLAN_CFG_TX_RING_MASK_3};
  206. static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  207. 0,
  208. 0,
  209. 0,
  210. 0,
  211. 0,
  212. 0,
  213. 0,
  214. WLAN_CFG_RX_RING_MASK_0,
  215. WLAN_CFG_RX_RING_MASK_1,
  216. WLAN_CFG_RX_RING_MASK_2,
  217. WLAN_CFG_RX_RING_MASK_3};
  218. static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  219. 0,
  220. 0,
  221. 0,
  222. 0,
  223. WLAN_CFG_RX_MON_RING_MASK_0,
  224. WLAN_CFG_RX_MON_RING_MASK_1,
  225. WLAN_CFG_RX_MON_RING_MASK_2};
  226. static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  227. WLAN_CFG_HOST2RXDMA_RING_MASK_0,
  228. WLAN_CFG_HOST2RXDMA_RING_MASK_1,
  229. WLAN_CFG_HOST2RXDMA_RING_MASK_2,
  230. WLAN_CFG_HOST2RXDMA_RING_MASK_3};
  231. static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  232. WLAN_CFG_RXDMA2HOST_RING_MASK_0,
  233. WLAN_CFG_RXDMA2HOST_RING_MASK_1,
  234. WLAN_CFG_RXDMA2HOST_RING_MASK_2,
  235. WLAN_CFG_RXDMA2HOST_RING_MASK_3};
  236. static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  237. 0,
  238. 0,
  239. 0,
  240. 0,
  241. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
  242. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
  243. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
  244. static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  245. 0,
  246. 0,
  247. 0,
  248. 0,
  249. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
  250. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
  251. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
  252. static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  253. WLAN_CFG_RX_ERR_RING_MASK_0,
  254. WLAN_CFG_RX_ERR_RING_MASK_1,
  255. WLAN_CFG_RX_ERR_RING_MASK_2,
  256. WLAN_CFG_RX_ERR_RING_MASK_3};
  257. static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  258. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  259. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  260. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  261. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  262. static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
  263. WLAN_CFG_REO_STATUS_RING_MASK_0,
  264. WLAN_CFG_REO_STATUS_RING_MASK_1,
  265. WLAN_CFG_REO_STATUS_RING_MASK_2,
  266. WLAN_CFG_REO_STATUS_RING_MASK_3};
  267. #endif /* MAX_PDEV_CNT == 1 */
  268. /**
  269. * g_wlan_srng_cfg[] - Per ring_type specific configuration
  270. *
  271. */
  272. struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES];
  273. /* REO_DST ring configuration */
  274. struct wlan_srng_cfg wlan_srng_reo_cfg = {
  275. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING,
  276. .batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_REO_RING,
  277. .low_threshold = 0,
  278. };
  279. /* WBM2SW_RELEASE ring configuration */
  280. struct wlan_srng_cfg wlan_srng_wbm_release_cfg = {
  281. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING,
  282. .batch_count_threshold = 0,
  283. .low_threshold = 0,
  284. };
  285. /* RXDMA_BUF ring configuration */
  286. struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = {
  287. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  288. .batch_count_threshold = 0,
  289. .low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3,
  290. };
  291. /* RXDMA_MONITOR_BUF ring configuration */
  292. struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = {
  293. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  294. .batch_count_threshold = 0,
  295. .low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3,
  296. };
  297. /* RXDMA_MONITOR_STATUS ring configuration */
  298. struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = {
  299. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  300. .batch_count_threshold = 0,
  301. .low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3,
  302. };
  303. /* DEFAULT_CONFIG ring configuration */
  304. struct wlan_srng_cfg wlan_srng_default_cfg = {
  305. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER,
  306. .batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER,
  307. .low_threshold = 0,
  308. };
  309. void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg)
  310. {
  311. g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg;
  312. g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg;
  313. g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg;
  314. g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg;
  315. g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg;
  316. g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg;
  317. g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg;
  318. g_wlan_srng_cfg[TCL_CMD_CREDIT] = wlan_srng_default_cfg;
  319. g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
  320. g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
  321. g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
  322. g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
  323. g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
  324. g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
  325. wlan_srng_rxdma_monitor_buf_cfg;
  326. g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
  327. wlan_srng_rxdma_monitor_status_cfg;
  328. g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
  329. g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
  330. g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
  331. #ifdef WLAN_FEATURE_CIF_CFR
  332. g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
  333. #endif
  334. *wlan_cfg = g_wlan_srng_cfg;
  335. }
  336. static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
  337. 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
  338. 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
  339. 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
  340. 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
  341. 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
  342. };
  343. void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  344. int interrupt_mode,
  345. bool is_monitor_mode) {
  346. int i = 0;
  347. if (interrupt_mode == DP_INTR_INTEGRATED) {
  348. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  349. wlan_cfg_ctx->int_tx_ring_mask[i] =
  350. tx_ring_mask_integrated[i];
  351. wlan_cfg_ctx->int_rx_ring_mask[i] =
  352. rx_ring_mask_integrated[i];
  353. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  354. rx_mon_ring_mask_integrated[i];
  355. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  356. rx_err_ring_mask_integrated[i];
  357. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  358. rx_wbm_rel_ring_mask_integrated[i];
  359. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  360. reo_status_ring_mask_integrated[i];
  361. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  362. rxdma2host_ring_mask_integrated[i];
  363. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  364. host2rxdma_ring_mask_integrated[i];
  365. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  366. host2rxdma_mon_ring_mask_integrated[i];
  367. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  368. rxdma2host_mon_ring_mask_integrated[i];
  369. }
  370. } else if (interrupt_mode == DP_INTR_MSI || interrupt_mode ==
  371. DP_INTR_POLL) {
  372. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  373. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i];
  374. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  375. rx_mon_ring_mask_msi[i];
  376. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  377. rx_err_ring_mask_msi[i];
  378. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  379. rx_wbm_rel_ring_mask_msi[i];
  380. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  381. reo_status_ring_mask_msi[i];
  382. if (is_monitor_mode) {
  383. wlan_cfg_ctx->int_rx_ring_mask[i] = 0;
  384. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0;
  385. } else {
  386. wlan_cfg_ctx->int_rx_ring_mask[i] =
  387. rx_ring_mask_msi[i];
  388. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  389. rxdma2host_ring_mask_msi[i];
  390. }
  391. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  392. host2rxdma_ring_mask_msi[i];
  393. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  394. host2rxdma_mon_ring_mask_msi[i];
  395. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  396. rxdma2host_mon_ring_mask_msi[i];
  397. }
  398. } else {
  399. qdf_err("Interrupt mode %d", interrupt_mode);
  400. }
  401. }
  402. /**
  403. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  404. * @psoc - Object manager psoc
  405. * Return: wlan_cfg_ctx - Handle to Configuration context
  406. */
  407. struct wlan_cfg_dp_soc_ctxt *
  408. wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  409. {
  410. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  411. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  412. if (!wlan_cfg_ctx)
  413. return NULL;
  414. wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
  415. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  416. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  417. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  418. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  419. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  420. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  421. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  422. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  423. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  424. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  425. CFG_DP_TX_EXT_DESC_POOLS);
  426. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  427. wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
  428. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  429. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  430. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  431. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  432. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  433. CFG_DP_TX_COMPL_RING_SIZE);
  434. wlan_cfg_ctx->tx_comp_ring_size_nss =
  435. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  436. wlan_cfg_ctx->int_batch_threshold_tx =
  437. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  438. wlan_cfg_ctx->int_timer_threshold_tx =
  439. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  440. wlan_cfg_ctx->int_batch_threshold_rx =
  441. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  442. wlan_cfg_ctx->int_timer_threshold_rx =
  443. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  444. wlan_cfg_ctx->int_batch_threshold_other =
  445. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  446. wlan_cfg_ctx->int_timer_threshold_other =
  447. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  448. wlan_cfg_ctx->pktlog_buffer_size =
  449. cfg_get(psoc, CFG_DP_PKTLOG_BUFFER_SIZE);
  450. /* This is default mapping and can be overridden by HW config
  451. * received from FW */
  452. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0);
  453. if (MAX_PDEV_CNT > 1)
  454. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2);
  455. if (MAX_PDEV_CNT > 2)
  456. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1);
  457. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  458. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  459. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  460. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  461. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  462. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  463. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  464. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  465. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  466. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  467. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  468. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  469. wlan_cfg_ctx->p2p_tcp_udp_checksumoffload =
  470. cfg_get(psoc, CFG_DP_P2P_TCP_UDP_CKSUM_OFFLOAD);
  471. wlan_cfg_ctx->nan_tcp_udp_checksumoffload =
  472. cfg_get(psoc, CFG_DP_NAN_TCP_UDP_CKSUM_OFFLOAD);
  473. wlan_cfg_ctx->tcp_udp_checksumoffload =
  474. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  475. wlan_cfg_ctx->legacy_mode_checksumoffload_disable =
  476. cfg_get(psoc, CFG_DP_LEGACY_MODE_CSUM_DISABLE);
  477. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  478. wlan_cfg_ctx->defrag_timeout_check =
  479. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  480. wlan_cfg_ctx->rx_defrag_min_timeout =
  481. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  482. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  483. CFG_DP_WBM_RELEASE_RING);
  484. wlan_cfg_ctx->tcl_cmd_credit_ring = cfg_get(psoc,
  485. CFG_DP_TCL_CMD_CREDIT_RING);
  486. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  487. CFG_DP_TCL_STATUS_RING);
  488. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  489. CFG_DP_REO_REINJECT_RING);
  490. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  491. CFG_DP_RX_RELEASE_RING);
  492. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  493. CFG_DP_REO_EXCEPTION_RING);
  494. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  495. CFG_DP_REO_CMD_RING);
  496. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  497. CFG_DP_REO_STATUS_RING);
  498. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  499. CFG_DP_RXDMA_REFILL_RING);
  500. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  501. CFG_DP_TX_DESC_LIMIT_0);
  502. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  503. CFG_DP_TX_DESC_LIMIT_1);
  504. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  505. CFG_DP_TX_DESC_LIMIT_2);
  506. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  507. CFG_DP_TX_DEVICE_LIMIT);
  508. wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
  509. CFG_DP_TX_SW_INTERNODE_QUEUE);
  510. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  511. CFG_DP_RXDMA_ERR_DST_RING);
  512. wlan_cfg_ctx->enable_data_stall_detection =
  513. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  514. wlan_cfg_ctx->tx_flow_start_queue_offset =
  515. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  516. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  517. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  518. wlan_cfg_ctx->disable_intra_bss_fwd =
  519. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  520. wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
  521. CFG_DP_RX_SW_DESC_WEIGHT);
  522. wlan_cfg_ctx->rx_sw_desc_num = cfg_get(psoc,
  523. CFG_DP_RX_SW_DESC_NUM);
  524. wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
  525. wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
  526. wlan_cfg_ctx->is_rx_flow_tag_enabled =
  527. cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
  528. wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
  529. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
  530. wlan_cfg_ctx->rx_flow_search_table_size =
  531. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
  532. wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
  533. cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
  534. wlan_cfg_ctx->mon_drop_thresh =
  535. cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD);
  536. wlan_cfg_ctx->is_rx_fisa_enabled = cfg_get(psoc, CFG_DP_RX_FISA_ENABLE);
  537. wlan_cfg_ctx->reo_rings_mapping = cfg_get(psoc, CFG_DP_REO_RINGS_MAP);
  538. wlan_cfg_ctx->pext_stats_enabled = cfg_get(psoc, CFG_DP_PEER_EXT_STATS);
  539. wlan_cfg_ctx->is_rx_buff_pool_enabled =
  540. cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
  541. wlan_cfg_ctx->rx_pending_high_threshold =
  542. cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD);
  543. wlan_cfg_ctx->rx_pending_low_threshold =
  544. cfg_get(psoc, CFG_DP_RX_PENDING_LO_THRESHOLD);
  545. wlan_cfg_ctx->is_poll_mode_enabled =
  546. cfg_get(psoc, CFG_DP_POLL_MODE_ENABLE);
  547. wlan_cfg_ctx->is_swlm_enabled = cfg_get(psoc, CFG_DP_SWLM_ENABLE);
  548. wlan_cfg_ctx->fst_in_cmem = cfg_get(psoc, CFG_DP_RX_FST_IN_CMEM);
  549. wlan_cfg_ctx->tx_per_pkt_vdev_id_check =
  550. cfg_get(psoc, CFG_DP_TX_PER_PKT_VDEV_ID_CHECK);
  551. wlan_cfg_ctx->radio0_rx_default_reo =
  552. cfg_get(psoc, CFG_DP_RX_RADIO_0_DEFAULT_REO);
  553. wlan_cfg_ctx->radio1_rx_default_reo =
  554. cfg_get(psoc, CFG_DP_RX_RADIO_1_DEFAULT_REO);
  555. wlan_cfg_ctx->radio2_rx_default_reo =
  556. cfg_get(psoc, CFG_DP_RX_RADIO_2_DEFAULT_REO);
  557. wlan_cfg_ctx->wow_check_rx_pending_enable =
  558. cfg_get(psoc, CFG_DP_WOW_CHECK_RX_PENDING);
  559. wlan_cfg_ctx->send_icmp_req_to_fw =
  560. cfg_get(psoc, CFG_DP_SEND_ICMP_REQ_TO_FW);
  561. return wlan_cfg_ctx;
  562. }
  563. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  564. {
  565. qdf_mem_free(wlan_cfg_ctx);
  566. }
  567. struct wlan_cfg_dp_pdev_ctxt *
  568. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  569. {
  570. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  571. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  572. if (!wlan_cfg_ctx)
  573. return NULL;
  574. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  575. CFG_DP_RXDMA_BUF_RING);
  576. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  577. CFG_DP_RXDMA_MONITOR_BUF_RING);
  578. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  579. CFG_DP_RXDMA_MONITOR_DST_RING);
  580. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  581. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  582. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  583. CFG_DP_RXDMA_MONITOR_DESC_RING);
  584. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  585. return wlan_cfg_ctx;
  586. }
  587. void wlan_cfg_set_mon_delayed_replenish_entries(
  588. struct wlan_cfg_dp_soc_ctxt *cfg,
  589. uint32_t val)
  590. {
  591. cfg->delayed_replenish_entries = val;
  592. }
  593. int wlan_cfg_get_mon_delayed_replenish_entries(struct wlan_cfg_dp_soc_ctxt *cfg)
  594. {
  595. return cfg->delayed_replenish_entries;
  596. }
  597. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  598. {
  599. if (wlan_cfg_ctx)
  600. qdf_mem_free(wlan_cfg_ctx);
  601. }
  602. int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
  603. {
  604. return cfg->mon_drop_thresh;
  605. }
  606. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  607. {
  608. cfg->num_int_ctxts = num;
  609. }
  610. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  611. {
  612. cfg->max_peer_id = val;
  613. }
  614. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  615. {
  616. cfg->max_ast_idx = val;
  617. }
  618. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  619. {
  620. return cfg->max_ast_idx;
  621. }
  622. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  623. int context, int mask)
  624. {
  625. cfg->int_tx_ring_mask[context] = mask;
  626. }
  627. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  628. int context, int mask)
  629. {
  630. cfg->int_rx_ring_mask[context] = mask;
  631. }
  632. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  633. int context, int mask)
  634. {
  635. cfg->int_rx_mon_ring_mask[context] = mask;
  636. }
  637. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  638. int context)
  639. {
  640. return cfg->int_host2rxdma_mon_ring_mask[context];
  641. }
  642. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  643. int context, int mask)
  644. {
  645. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  646. }
  647. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  648. int context)
  649. {
  650. return cfg->int_rxdma2host_mon_ring_mask[context];
  651. }
  652. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  653. int context, int mask)
  654. {
  655. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  656. }
  657. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  658. int context, int mask)
  659. {
  660. cfg->int_rxdma2host_ring_mask[context] = mask;
  661. }
  662. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  663. int context)
  664. {
  665. return cfg->int_rxdma2host_ring_mask[context];
  666. }
  667. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  668. int context, int mask)
  669. {
  670. cfg->int_host2rxdma_ring_mask[context] = mask;
  671. }
  672. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  673. int context)
  674. {
  675. return cfg->int_host2rxdma_ring_mask[context];
  676. }
  677. void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  678. int hw_macid)
  679. {
  680. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  681. cfg->hw_macid[pdev_idx] = hw_macid;
  682. }
  683. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  684. {
  685. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  686. return cfg->hw_macid[pdev_idx];
  687. }
  688. int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
  689. int hw_macid)
  690. {
  691. int idx;
  692. for (idx = 0; idx < MAX_PDEV_CNT; idx++) {
  693. if (cfg->hw_macid[idx] == hw_macid)
  694. return (idx + 1);
  695. }
  696. qdf_assert_always(idx < MAX_PDEV_CNT);
  697. return WLAN_INVALID_PDEV_ID;
  698. }
  699. void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  700. int hw_macid)
  701. {
  702. qdf_assert_always((pdev_idx < MAX_PDEV_CNT) ||
  703. (pdev_idx == INVALID_PDEV_ID));
  704. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  705. cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
  706. }
  707. int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
  708. {
  709. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  710. return cfg->hw_macid_pdev_id_map[hw_macid];
  711. }
  712. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  713. int context, int mask)
  714. {
  715. cfg->int_ce_ring_mask[context] = mask;
  716. }
  717. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  718. int mask)
  719. {
  720. cfg->int_rx_ring_mask[context] = mask;
  721. }
  722. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  723. int context, int mask)
  724. {
  725. return cfg->int_rx_err_ring_mask[context] = mask;
  726. }
  727. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  728. int context, int mask)
  729. {
  730. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  731. }
  732. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  733. int context, int mask)
  734. {
  735. return cfg->int_reo_status_ring_mask[context] = mask;
  736. }
  737. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  738. {
  739. return cfg->num_int_ctxts;
  740. }
  741. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  742. {
  743. return cfg->int_tx_ring_mask[context];
  744. }
  745. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  746. {
  747. return cfg->int_rx_ring_mask[context];
  748. }
  749. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  750. int context)
  751. {
  752. return cfg->int_rx_err_ring_mask[context];
  753. }
  754. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  755. int context)
  756. {
  757. return cfg->int_rx_wbm_rel_ring_mask[context];
  758. }
  759. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  760. int context)
  761. {
  762. return cfg->int_reo_status_ring_mask[context];
  763. }
  764. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  765. {
  766. return cfg->int_rx_mon_ring_mask[context];
  767. }
  768. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  769. {
  770. return cfg->int_ce_ring_mask[context];
  771. }
  772. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  773. {
  774. return cfg->max_clients;
  775. }
  776. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  777. {
  778. return cfg->max_alloc_size;
  779. }
  780. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  781. {
  782. return cfg->per_pdev_tx_ring;
  783. }
  784. uint32_t
  785. wlan_cfg_rx_pending_hl_threshold(struct wlan_cfg_dp_soc_ctxt *cfg)
  786. {
  787. return cfg->rx_pending_high_threshold;
  788. }
  789. uint32_t
  790. wlan_cfg_rx_pending_lo_threshold(struct wlan_cfg_dp_soc_ctxt *cfg)
  791. {
  792. return cfg->rx_pending_low_threshold;
  793. }
  794. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  795. {
  796. return cfg->per_pdev_lmac_ring;
  797. }
  798. #ifdef DP_MEMORY_OPT
  799. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  800. {
  801. return 1;
  802. }
  803. #else
  804. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  805. {
  806. return cfg->num_tcl_data_rings;
  807. }
  808. #endif
  809. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  810. {
  811. return cfg->tx_ring_size;
  812. }
  813. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  814. {
  815. return cfg->tx_comp_ring_size;
  816. }
  817. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  818. {
  819. return cfg->per_pdev_rx_ring;
  820. }
  821. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  822. {
  823. return cfg->num_reo_dest_rings;
  824. }
  825. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  826. {
  827. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  828. }
  829. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  830. {
  831. return cfg->num_tx_desc_pool;
  832. }
  833. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  834. {
  835. cfg->num_tx_desc_pool = num_pool;
  836. }
  837. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  838. {
  839. return cfg->num_tx_ext_desc_pool;
  840. }
  841. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  842. {
  843. cfg->num_tx_ext_desc_pool = num_pool;
  844. }
  845. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  846. {
  847. return cfg->reo_dst_ring_size;
  848. }
  849. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  850. int reo_dst_ring_size)
  851. {
  852. cfg->reo_dst_ring_size = reo_dst_ring_size;
  853. }
  854. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  855. bool raw_mode_war)
  856. {
  857. cfg->raw_mode_war = raw_mode_war;
  858. }
  859. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  860. {
  861. return cfg->raw_mode_war;
  862. }
  863. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  864. {
  865. return cfg->num_tx_desc;
  866. }
  867. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  868. {
  869. cfg->num_tx_desc = num_desc;
  870. }
  871. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  872. {
  873. return cfg->min_tx_desc;
  874. }
  875. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  876. {
  877. return cfg->num_tx_ext_desc;
  878. }
  879. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  880. {
  881. cfg->num_tx_ext_desc = num_ext_desc;
  882. }
  883. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  884. {
  885. /* TODO: This should be calculated based on target capabilities */
  886. return cfg->max_peer_id;
  887. }
  888. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  889. {
  890. return cfg->dma_mon_buf_ring_size;
  891. }
  892. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  893. {
  894. return cfg->dma_mon_dest_ring_size;
  895. }
  896. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  897. {
  898. return cfg->dma_mon_status_ring_size;
  899. }
  900. int
  901. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  902. {
  903. return cfg->rxdma_monitor_desc_ring;
  904. }
  905. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  906. {
  907. return cfg->rx_dma_buf_ring_size;
  908. }
  909. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  910. {
  911. return cfg->num_mac_rings;
  912. }
  913. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  914. {
  915. return cfg->gro_enabled;
  916. }
  917. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  918. {
  919. return cfg->lro_enabled;
  920. }
  921. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  922. {
  923. return cfg->ipa_enabled;
  924. }
  925. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  926. {
  927. cfg->rx_hash = val;
  928. }
  929. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  930. {
  931. return cfg->rx_hash;
  932. }
  933. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  934. {
  935. return cfg->nss_enabled;
  936. }
  937. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  938. {
  939. cfg->nss_enabled = nss_enabled;
  940. }
  941. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  942. {
  943. return cfg->nss_cfg;
  944. }
  945. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  946. {
  947. cfg->nss_cfg = nss_cfg;
  948. if (cfg->nss_cfg)
  949. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  950. }
  951. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  952. {
  953. return cfg->int_batch_threshold_tx;
  954. }
  955. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  956. {
  957. return cfg->int_timer_threshold_tx;
  958. }
  959. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  960. {
  961. return cfg->int_batch_threshold_rx;
  962. }
  963. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  964. {
  965. return cfg->int_timer_threshold_rx;
  966. }
  967. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  968. {
  969. return cfg->int_batch_threshold_other;
  970. }
  971. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  972. {
  973. return cfg->int_timer_threshold_other;
  974. }
  975. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  976. {
  977. return cfg->int_timer_threshold_mon;
  978. }
  979. int wlan_cfg_get_p2p_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  980. {
  981. return cfg->p2p_tcp_udp_checksumoffload;
  982. }
  983. int wlan_cfg_get_nan_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  984. {
  985. return cfg->nan_tcp_udp_checksumoffload;
  986. }
  987. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  988. {
  989. return cfg->tcp_udp_checksumoffload;
  990. }
  991. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  992. {
  993. return cfg->rx_defrag_min_timeout;
  994. }
  995. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  996. {
  997. return cfg->defrag_timeout_check;
  998. }
  999. int
  1000. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1001. {
  1002. return cfg->wbm_release_ring;
  1003. }
  1004. int
  1005. wlan_cfg_get_dp_soc_tcl_cmd_credit_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1006. {
  1007. return cfg->tcl_cmd_credit_ring;
  1008. }
  1009. int
  1010. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1011. {
  1012. return cfg->tcl_status_ring;
  1013. }
  1014. int
  1015. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1016. {
  1017. return cfg->reo_reinject_ring;
  1018. }
  1019. int
  1020. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1021. {
  1022. return cfg->rx_release_ring;
  1023. }
  1024. int
  1025. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1026. {
  1027. return cfg->reo_exception_ring;
  1028. }
  1029. int
  1030. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1031. {
  1032. return cfg->reo_cmd_ring;
  1033. }
  1034. int
  1035. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1036. {
  1037. return cfg->reo_status_ring;
  1038. }
  1039. int
  1040. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1041. {
  1042. return cfg->rxdma_refill_ring;
  1043. }
  1044. int
  1045. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  1046. {
  1047. return cfg->tx_desc_limit_0;
  1048. }
  1049. int
  1050. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  1051. {
  1052. return cfg->tx_desc_limit_1;
  1053. }
  1054. int
  1055. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  1056. {
  1057. return cfg->tx_desc_limit_2;
  1058. }
  1059. int
  1060. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  1061. {
  1062. return cfg->tx_device_limit;
  1063. }
  1064. int
  1065. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  1066. {
  1067. return cfg->tx_sw_internode_queue;
  1068. }
  1069. int
  1070. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1071. {
  1072. return cfg->rxdma_err_dst_ring;
  1073. }
  1074. int
  1075. wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
  1076. {
  1077. return cfg->rx_sw_desc_weight;
  1078. }
  1079. int
  1080. wlan_cfg_get_dp_soc_rx_sw_desc_num(struct wlan_cfg_dp_soc_ctxt *cfg)
  1081. {
  1082. return cfg->rx_sw_desc_num;
  1083. }
  1084. uint32_t
  1085. wlan_cfg_get_reo_rings_mapping(struct wlan_cfg_dp_soc_ctxt *cfg)
  1086. {
  1087. return cfg->reo_rings_mapping;
  1088. }
  1089. bool
  1090. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  1091. enum cdp_capabilities dp_caps)
  1092. {
  1093. switch (dp_caps) {
  1094. case CDP_CFG_DP_TSO:
  1095. return cfg->tso_enabled;
  1096. case CDP_CFG_DP_LRO:
  1097. return cfg->lro_enabled;
  1098. case CDP_CFG_DP_SG:
  1099. return cfg->sg_enabled;
  1100. case CDP_CFG_DP_GRO:
  1101. return cfg->gro_enabled;
  1102. case CDP_CFG_DP_OL_TX_CSUM:
  1103. return cfg->ol_tx_csum_enabled;
  1104. case CDP_CFG_DP_OL_RX_CSUM:
  1105. return cfg->ol_rx_csum_enabled;
  1106. case CDP_CFG_DP_RAWMODE:
  1107. return cfg->rawmode_enabled;
  1108. case CDP_CFG_DP_PEER_FLOW_CTRL:
  1109. return cfg->peer_flow_ctrl_enabled;
  1110. default:
  1111. return false;
  1112. }
  1113. }
  1114. void wlan_cfg_set_tso_desc_attach_defer(struct wlan_cfg_dp_soc_ctxt *cfg,
  1115. bool val)
  1116. {
  1117. cfg->is_tso_desc_attach_defer = val;
  1118. }
  1119. bool wlan_cfg_is_tso_desc_attach_defer(struct wlan_cfg_dp_soc_ctxt *cfg)
  1120. {
  1121. return cfg->is_tso_desc_attach_defer;
  1122. }
  1123. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  1124. /**
  1125. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  1126. * @cfg: config context
  1127. *
  1128. * Return: stop threshold
  1129. */
  1130. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  1131. {
  1132. return cfg->tx_flow_stop_queue_threshold;
  1133. }
  1134. /**
  1135. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  1136. * for TX to resume
  1137. * @cfg: config context
  1138. *
  1139. * Return: stop threshold
  1140. */
  1141. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  1142. {
  1143. return cfg->tx_flow_start_queue_offset;
  1144. }
  1145. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1146. void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1147. bool val)
  1148. {
  1149. cfg->is_rx_flow_tag_enabled = val;
  1150. }
  1151. uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
  1152. {
  1153. return cfg->rx_toeplitz_hash_key;
  1154. }
  1155. uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
  1156. {
  1157. return cfg->rx_flow_max_search;
  1158. }
  1159. bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1160. {
  1161. return cfg->is_rx_flow_tag_enabled;
  1162. }
  1163. #ifdef WLAN_SUPPORT_RX_FISA
  1164. bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1165. {
  1166. return (bool)(cfg->is_rx_fisa_enabled);
  1167. }
  1168. #else
  1169. bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1170. {
  1171. return false;
  1172. }
  1173. #endif
  1174. bool wlan_cfg_is_poll_mode_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1175. {
  1176. return (bool)(cfg->is_poll_mode_enabled);
  1177. }
  1178. void
  1179. wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
  1180. bool val)
  1181. {
  1182. cfg->is_rx_flow_search_table_per_pdev = val;
  1183. }
  1184. bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
  1185. {
  1186. return cfg->is_rx_flow_search_table_per_pdev;
  1187. }
  1188. void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  1189. uint16_t val)
  1190. {
  1191. cfg->rx_flow_search_table_size = val;
  1192. }
  1193. uint16_t
  1194. wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1195. {
  1196. return cfg->rx_flow_search_table_size;
  1197. }
  1198. void
  1199. wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1200. bool val)
  1201. {
  1202. cfg->is_rx_mon_protocol_flow_tag_enabled = val;
  1203. }
  1204. bool
  1205. wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1206. {
  1207. return cfg->is_rx_mon_protocol_flow_tag_enabled;
  1208. }
  1209. void
  1210. wlan_cfg_set_tx_per_pkt_vdev_id_check(struct wlan_cfg_dp_soc_ctxt *cfg,
  1211. bool val)
  1212. {
  1213. cfg->tx_per_pkt_vdev_id_check = val;
  1214. }
  1215. bool
  1216. wlan_cfg_is_tx_per_pkt_vdev_id_check_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1217. {
  1218. return cfg->tx_per_pkt_vdev_id_check;
  1219. }
  1220. void
  1221. wlan_cfg_set_peer_ext_stats(struct wlan_cfg_dp_soc_ctxt *cfg,
  1222. bool val)
  1223. {
  1224. cfg->pext_stats_enabled = val;
  1225. }
  1226. bool
  1227. wlan_cfg_is_peer_ext_stats_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1228. {
  1229. return cfg->pext_stats_enabled;
  1230. }
  1231. bool wlan_cfg_is_fst_in_cmem_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1232. {
  1233. return cfg->fst_in_cmem;
  1234. }
  1235. #ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
  1236. bool wlan_cfg_is_rx_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1237. {
  1238. return cfg->is_rx_buff_pool_enabled;
  1239. }
  1240. #else
  1241. bool wlan_cfg_is_rx_buffer_pool_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1242. {
  1243. return false;
  1244. }
  1245. #endif /* WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL */
  1246. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  1247. bool wlan_cfg_is_swlm_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1248. {
  1249. return (bool)(cfg->is_swlm_enabled);
  1250. }
  1251. #else
  1252. bool wlan_cfg_is_swlm_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1253. {
  1254. return false;
  1255. }
  1256. #endif
  1257. uint8_t wlan_cfg_radio0_default_reo_get(struct wlan_cfg_dp_soc_ctxt *cfg)
  1258. {
  1259. return cfg->radio0_rx_default_reo;
  1260. }
  1261. uint8_t wlan_cfg_radio1_default_reo_get(struct wlan_cfg_dp_soc_ctxt *cfg)
  1262. {
  1263. return cfg->radio1_rx_default_reo;
  1264. }
  1265. uint8_t wlan_cfg_radio2_default_reo_get(struct wlan_cfg_dp_soc_ctxt *cfg)
  1266. {
  1267. return cfg->radio2_rx_default_reo;
  1268. }
  1269. #ifdef WLAN_DP_FEATURE_SEND_ICMP_TO_FW
  1270. int wlan_cfg_send_icmp_req_to_fw(struct wlan_cfg_dp_soc_ctxt *cfg)
  1271. {
  1272. return cfg->send_icmp_req_to_fw;
  1273. }
  1274. #endif /* WLAN_DP_FEATURE_SEND_ICMP_TO_FW */