wlan_cfg.c 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286
  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_CREDIT] = wlan_srng_default_cfg;
  283. g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
  284. g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
  285. g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
  286. g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
  287. g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
  288. g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
  289. wlan_srng_rxdma_monitor_buf_cfg;
  290. g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
  291. wlan_srng_rxdma_monitor_status_cfg;
  292. g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
  293. g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
  294. g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
  295. #ifdef WLAN_FEATURE_CIF_CFR
  296. g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
  297. #endif
  298. *wlan_cfg = g_wlan_srng_cfg;
  299. }
  300. static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
  301. 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
  302. 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
  303. 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
  304. 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
  305. 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
  306. };
  307. void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  308. int interrupt_mode,
  309. bool is_monitor_mode) {
  310. int i = 0;
  311. if (interrupt_mode == DP_INTR_INTEGRATED) {
  312. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  313. wlan_cfg_ctx->int_tx_ring_mask[i] =
  314. tx_ring_mask_integrated[i];
  315. wlan_cfg_ctx->int_rx_ring_mask[i] =
  316. rx_ring_mask_integrated[i];
  317. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  318. rx_mon_ring_mask_integrated[i];
  319. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  320. rx_err_ring_mask_integrated[i];
  321. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  322. rx_wbm_rel_ring_mask_integrated[i];
  323. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  324. reo_status_ring_mask_integrated[i];
  325. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  326. rxdma2host_ring_mask_integrated[i];
  327. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  328. host2rxdma_ring_mask_integrated[i];
  329. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  330. host2rxdma_mon_ring_mask_integrated[i];
  331. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  332. rxdma2host_mon_ring_mask_integrated[i];
  333. }
  334. } else if (interrupt_mode == DP_INTR_MSI || interrupt_mode ==
  335. DP_INTR_POLL) {
  336. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  337. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i];
  338. wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
  339. rx_mon_ring_mask_msi[i];
  340. wlan_cfg_ctx->int_rx_err_ring_mask[i] =
  341. rx_err_ring_mask_msi[i];
  342. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  343. rx_wbm_rel_ring_mask_msi[i];
  344. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  345. reo_status_ring_mask_msi[i];
  346. if (is_monitor_mode) {
  347. wlan_cfg_ctx->int_rx_ring_mask[i] = 0;
  348. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0;
  349. } else {
  350. wlan_cfg_ctx->int_rx_ring_mask[i] =
  351. rx_ring_mask_msi[i];
  352. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  353. rxdma2host_ring_mask_msi[i];
  354. }
  355. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  356. host2rxdma_ring_mask_msi[i];
  357. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  358. host2rxdma_mon_ring_mask_msi[i];
  359. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  360. rxdma2host_mon_ring_mask_msi[i];
  361. }
  362. } else {
  363. qdf_err("Interrupt mode %d", interrupt_mode);
  364. }
  365. }
  366. /**
  367. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  368. * @psoc - Object manager psoc
  369. * Return: wlan_cfg_ctx - Handle to Configuration context
  370. */
  371. struct wlan_cfg_dp_soc_ctxt *
  372. wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  373. {
  374. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  375. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  376. if (!wlan_cfg_ctx)
  377. return NULL;
  378. wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
  379. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  380. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  381. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  382. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  383. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  384. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  385. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  386. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  387. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  388. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  389. CFG_DP_TX_EXT_DESC_POOLS);
  390. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  391. wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
  392. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  393. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  394. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  395. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  396. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  397. CFG_DP_TX_COMPL_RING_SIZE);
  398. wlan_cfg_ctx->tx_comp_ring_size_nss =
  399. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  400. wlan_cfg_ctx->int_batch_threshold_tx =
  401. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  402. wlan_cfg_ctx->int_timer_threshold_tx =
  403. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  404. wlan_cfg_ctx->int_batch_threshold_rx =
  405. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  406. wlan_cfg_ctx->int_timer_threshold_rx =
  407. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  408. wlan_cfg_ctx->int_batch_threshold_other =
  409. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  410. wlan_cfg_ctx->int_timer_threshold_other =
  411. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  412. wlan_cfg_ctx->pktlog_buffer_size =
  413. cfg_get(psoc, CFG_DP_PKTLOG_BUFFER_SIZE);
  414. /* This is default mapping and can be overridden by HW config
  415. * received from FW */
  416. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0);
  417. if (MAX_PDEV_CNT > 1)
  418. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2);
  419. if (MAX_PDEV_CNT > 2)
  420. wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1);
  421. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  422. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  423. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  424. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  425. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  426. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  427. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  428. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  429. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  430. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  431. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  432. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  433. /*Enable checksum offload by default*/
  434. wlan_cfg_ctx->tcp_udp_checksumoffload =
  435. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  436. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  437. wlan_cfg_ctx->defrag_timeout_check =
  438. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  439. wlan_cfg_ctx->rx_defrag_min_timeout =
  440. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  441. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  442. CFG_DP_WBM_RELEASE_RING);
  443. wlan_cfg_ctx->tcl_cmd_credit_ring = cfg_get(psoc,
  444. CFG_DP_TCL_CMD_CREDIT_RING);
  445. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  446. CFG_DP_TCL_STATUS_RING);
  447. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  448. CFG_DP_REO_REINJECT_RING);
  449. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  450. CFG_DP_RX_RELEASE_RING);
  451. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  452. CFG_DP_REO_EXCEPTION_RING);
  453. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  454. CFG_DP_REO_CMD_RING);
  455. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  456. CFG_DP_REO_STATUS_RING);
  457. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  458. CFG_DP_RXDMA_REFILL_RING);
  459. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  460. CFG_DP_TX_DESC_LIMIT_0);
  461. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  462. CFG_DP_TX_DESC_LIMIT_1);
  463. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  464. CFG_DP_TX_DESC_LIMIT_2);
  465. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  466. CFG_DP_TX_DEVICE_LIMIT);
  467. wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
  468. CFG_DP_TX_SW_INTERNODE_QUEUE);
  469. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  470. CFG_DP_RXDMA_ERR_DST_RING);
  471. wlan_cfg_ctx->enable_data_stall_detection =
  472. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  473. wlan_cfg_ctx->tx_flow_start_queue_offset =
  474. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  475. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  476. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  477. wlan_cfg_ctx->disable_intra_bss_fwd =
  478. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  479. wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
  480. CFG_DP_RX_SW_DESC_WEIGHT);
  481. wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
  482. wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
  483. wlan_cfg_ctx->is_rx_flow_tag_enabled =
  484. cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
  485. wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
  486. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
  487. wlan_cfg_ctx->rx_flow_search_table_size =
  488. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
  489. wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
  490. cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
  491. wlan_cfg_ctx->mon_drop_thresh =
  492. cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD);
  493. wlan_cfg_ctx->is_rx_fisa_enabled = cfg_get(psoc, CFG_DP_RX_FISA_ENABLE);
  494. return wlan_cfg_ctx;
  495. }
  496. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  497. {
  498. qdf_mem_free(wlan_cfg_ctx);
  499. }
  500. struct wlan_cfg_dp_pdev_ctxt *
  501. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  502. {
  503. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  504. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  505. if (!wlan_cfg_ctx)
  506. return NULL;
  507. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  508. CFG_DP_RXDMA_BUF_RING);
  509. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  510. CFG_DP_RXDMA_MONITOR_BUF_RING);
  511. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  512. CFG_DP_RXDMA_MONITOR_DST_RING);
  513. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  514. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  515. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  516. CFG_DP_RXDMA_MONITOR_DESC_RING);
  517. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  518. return wlan_cfg_ctx;
  519. }
  520. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  521. {
  522. if (wlan_cfg_ctx)
  523. qdf_mem_free(wlan_cfg_ctx);
  524. }
  525. int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
  526. {
  527. return cfg->mon_drop_thresh;
  528. }
  529. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  530. {
  531. cfg->num_int_ctxts = num;
  532. }
  533. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  534. {
  535. cfg->max_peer_id = val;
  536. }
  537. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  538. {
  539. cfg->max_ast_idx = val;
  540. }
  541. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  542. {
  543. return cfg->max_ast_idx;
  544. }
  545. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  546. int context, int mask)
  547. {
  548. cfg->int_tx_ring_mask[context] = mask;
  549. }
  550. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  551. int context, int mask)
  552. {
  553. cfg->int_rx_ring_mask[context] = mask;
  554. }
  555. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  556. int context, int mask)
  557. {
  558. cfg->int_rx_mon_ring_mask[context] = mask;
  559. }
  560. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  561. int context)
  562. {
  563. return cfg->int_host2rxdma_mon_ring_mask[context];
  564. }
  565. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  566. int context, int mask)
  567. {
  568. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  569. }
  570. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  571. int context)
  572. {
  573. return cfg->int_rxdma2host_mon_ring_mask[context];
  574. }
  575. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  576. int context, int mask)
  577. {
  578. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  579. }
  580. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  581. int context, int mask)
  582. {
  583. cfg->int_rxdma2host_ring_mask[context] = mask;
  584. }
  585. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  586. int context)
  587. {
  588. return cfg->int_rxdma2host_ring_mask[context];
  589. }
  590. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  591. int context, int mask)
  592. {
  593. cfg->int_host2rxdma_ring_mask[context] = mask;
  594. }
  595. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  596. int context)
  597. {
  598. return cfg->int_host2rxdma_ring_mask[context];
  599. }
  600. void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  601. int hw_macid)
  602. {
  603. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  604. cfg->hw_macid[pdev_idx] = hw_macid;
  605. }
  606. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  607. {
  608. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  609. return cfg->hw_macid[pdev_idx];
  610. }
  611. int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
  612. int hw_macid)
  613. {
  614. int idx;
  615. for (idx = 0; idx < MAX_PDEV_CNT; idx++) {
  616. if (cfg->hw_macid[idx] == hw_macid)
  617. return (idx + 1);
  618. }
  619. qdf_assert_always(idx < MAX_PDEV_CNT);
  620. return WLAN_INVALID_PDEV_ID;
  621. }
  622. void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  623. int hw_macid)
  624. {
  625. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  626. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  627. cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
  628. }
  629. int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
  630. {
  631. qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
  632. return cfg->hw_macid_pdev_id_map[hw_macid];
  633. }
  634. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  635. int context, int mask)
  636. {
  637. cfg->int_ce_ring_mask[context] = mask;
  638. }
  639. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  640. int mask)
  641. {
  642. cfg->int_rx_ring_mask[context] = mask;
  643. }
  644. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  645. int context, int mask)
  646. {
  647. return cfg->int_rx_err_ring_mask[context] = mask;
  648. }
  649. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  650. int context, int mask)
  651. {
  652. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  653. }
  654. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  655. int context, int mask)
  656. {
  657. return cfg->int_reo_status_ring_mask[context] = mask;
  658. }
  659. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  660. {
  661. return cfg->num_int_ctxts;
  662. }
  663. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  664. {
  665. return cfg->int_tx_ring_mask[context];
  666. }
  667. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  668. {
  669. return cfg->int_rx_ring_mask[context];
  670. }
  671. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  672. int context)
  673. {
  674. return cfg->int_rx_err_ring_mask[context];
  675. }
  676. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  677. int context)
  678. {
  679. return cfg->int_rx_wbm_rel_ring_mask[context];
  680. }
  681. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  682. int context)
  683. {
  684. return cfg->int_reo_status_ring_mask[context];
  685. }
  686. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  687. {
  688. return cfg->int_rx_mon_ring_mask[context];
  689. }
  690. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  691. {
  692. return cfg->int_ce_ring_mask[context];
  693. }
  694. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  695. {
  696. return cfg->max_clients;
  697. }
  698. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  699. {
  700. return cfg->max_alloc_size;
  701. }
  702. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  703. {
  704. return cfg->per_pdev_tx_ring;
  705. }
  706. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  707. {
  708. return cfg->per_pdev_lmac_ring;
  709. }
  710. #ifdef DP_MEMORY_OPT
  711. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  712. {
  713. return 1;
  714. }
  715. #else
  716. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  717. {
  718. return cfg->num_tcl_data_rings;
  719. }
  720. #endif
  721. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  722. {
  723. return cfg->tx_ring_size;
  724. }
  725. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  726. {
  727. return cfg->tx_comp_ring_size;
  728. }
  729. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  730. {
  731. return cfg->per_pdev_rx_ring;
  732. }
  733. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  734. {
  735. return cfg->num_reo_dest_rings;
  736. }
  737. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  738. {
  739. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  740. }
  741. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  742. {
  743. return cfg->num_tx_desc_pool;
  744. }
  745. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  746. {
  747. cfg->num_tx_desc_pool = num_pool;
  748. }
  749. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  750. {
  751. return cfg->num_tx_ext_desc_pool;
  752. }
  753. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  754. {
  755. cfg->num_tx_ext_desc_pool = num_pool;
  756. }
  757. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  758. {
  759. return cfg->reo_dst_ring_size;
  760. }
  761. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  762. int reo_dst_ring_size)
  763. {
  764. cfg->reo_dst_ring_size = reo_dst_ring_size;
  765. }
  766. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  767. bool raw_mode_war)
  768. {
  769. cfg->raw_mode_war = raw_mode_war;
  770. }
  771. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  772. {
  773. return cfg->raw_mode_war;
  774. }
  775. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  776. {
  777. return cfg->num_tx_desc;
  778. }
  779. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  780. {
  781. cfg->num_tx_desc = num_desc;
  782. }
  783. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  784. {
  785. return cfg->min_tx_desc;
  786. }
  787. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  788. {
  789. return cfg->num_tx_ext_desc;
  790. }
  791. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  792. {
  793. cfg->num_tx_ext_desc = num_ext_desc;
  794. }
  795. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  796. {
  797. /* TODO: This should be calculated based on target capabilities */
  798. return cfg->max_peer_id;
  799. }
  800. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  801. {
  802. return cfg->dma_mon_buf_ring_size;
  803. }
  804. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  805. {
  806. return cfg->dma_mon_dest_ring_size;
  807. }
  808. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  809. {
  810. return cfg->dma_mon_status_ring_size;
  811. }
  812. int
  813. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  814. {
  815. return cfg->rxdma_monitor_desc_ring;
  816. }
  817. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  818. {
  819. return cfg->rx_dma_buf_ring_size;
  820. }
  821. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  822. {
  823. return cfg->num_mac_rings;
  824. }
  825. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  826. {
  827. return cfg->gro_enabled;
  828. }
  829. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  830. {
  831. return cfg->lro_enabled;
  832. }
  833. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  834. {
  835. return cfg->ipa_enabled;
  836. }
  837. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  838. {
  839. cfg->rx_hash = val;
  840. }
  841. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  842. {
  843. return cfg->rx_hash;
  844. }
  845. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  846. {
  847. return cfg->nss_enabled;
  848. }
  849. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  850. {
  851. cfg->nss_enabled = nss_enabled;
  852. }
  853. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  854. {
  855. return cfg->nss_cfg;
  856. }
  857. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  858. {
  859. cfg->nss_cfg = nss_cfg;
  860. if (cfg->nss_cfg)
  861. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  862. }
  863. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  864. {
  865. return cfg->int_batch_threshold_tx;
  866. }
  867. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  868. {
  869. return cfg->int_timer_threshold_tx;
  870. }
  871. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  872. {
  873. return cfg->int_batch_threshold_rx;
  874. }
  875. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  876. {
  877. return cfg->int_timer_threshold_rx;
  878. }
  879. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  880. {
  881. return cfg->int_batch_threshold_other;
  882. }
  883. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  884. {
  885. return cfg->int_timer_threshold_other;
  886. }
  887. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  888. {
  889. return cfg->int_timer_threshold_mon;
  890. }
  891. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  892. {
  893. return cfg->tcp_udp_checksumoffload;
  894. }
  895. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  896. {
  897. return cfg->rx_defrag_min_timeout;
  898. }
  899. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  900. {
  901. return cfg->defrag_timeout_check;
  902. }
  903. int
  904. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  905. {
  906. return cfg->wbm_release_ring;
  907. }
  908. int
  909. wlan_cfg_get_dp_soc_tcl_cmd_credit_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  910. {
  911. return cfg->tcl_cmd_credit_ring;
  912. }
  913. int
  914. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  915. {
  916. return cfg->tcl_status_ring;
  917. }
  918. int
  919. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  920. {
  921. return cfg->reo_reinject_ring;
  922. }
  923. int
  924. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  925. {
  926. return cfg->rx_release_ring;
  927. }
  928. int
  929. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  930. {
  931. return cfg->reo_exception_ring;
  932. }
  933. int
  934. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  935. {
  936. return cfg->reo_cmd_ring;
  937. }
  938. int
  939. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  940. {
  941. return cfg->reo_status_ring;
  942. }
  943. int
  944. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  945. {
  946. return cfg->rxdma_refill_ring;
  947. }
  948. int
  949. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  950. {
  951. return cfg->tx_desc_limit_0;
  952. }
  953. int
  954. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  955. {
  956. return cfg->tx_desc_limit_1;
  957. }
  958. int
  959. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  960. {
  961. return cfg->tx_desc_limit_2;
  962. }
  963. int
  964. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  965. {
  966. return cfg->tx_device_limit;
  967. }
  968. int
  969. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  970. {
  971. return cfg->tx_sw_internode_queue;
  972. }
  973. int
  974. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  975. {
  976. return cfg->rxdma_err_dst_ring;
  977. }
  978. int
  979. wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
  980. {
  981. return cfg->rx_sw_desc_weight;
  982. }
  983. bool
  984. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  985. enum cdp_capabilities dp_caps)
  986. {
  987. switch (dp_caps) {
  988. case CDP_CFG_DP_TSO:
  989. return cfg->tso_enabled;
  990. case CDP_CFG_DP_LRO:
  991. return cfg->lro_enabled;
  992. case CDP_CFG_DP_SG:
  993. return cfg->sg_enabled;
  994. case CDP_CFG_DP_GRO:
  995. return cfg->gro_enabled;
  996. case CDP_CFG_DP_OL_TX_CSUM:
  997. return cfg->ol_tx_csum_enabled;
  998. case CDP_CFG_DP_OL_RX_CSUM:
  999. return cfg->ol_rx_csum_enabled;
  1000. case CDP_CFG_DP_RAWMODE:
  1001. return cfg->rawmode_enabled;
  1002. case CDP_CFG_DP_PEER_FLOW_CTRL:
  1003. return cfg->peer_flow_ctrl_enabled;
  1004. default:
  1005. return false;
  1006. }
  1007. }
  1008. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  1009. /**
  1010. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  1011. * @cfg: config context
  1012. *
  1013. * Return: stop threshold
  1014. */
  1015. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  1016. {
  1017. return cfg->tx_flow_stop_queue_threshold;
  1018. }
  1019. /**
  1020. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  1021. * for TX to resume
  1022. * @cfg: config context
  1023. *
  1024. * Return: stop threshold
  1025. */
  1026. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  1027. {
  1028. return cfg->tx_flow_start_queue_offset;
  1029. }
  1030. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  1031. void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1032. bool val)
  1033. {
  1034. cfg->is_rx_flow_tag_enabled = val;
  1035. }
  1036. uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
  1037. {
  1038. return cfg->rx_toeplitz_hash_key;
  1039. }
  1040. uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
  1041. {
  1042. return cfg->rx_flow_max_search;
  1043. }
  1044. bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1045. {
  1046. return cfg->is_rx_flow_tag_enabled;
  1047. }
  1048. #ifdef WLAN_SUPPORT_RX_FISA
  1049. bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1050. {
  1051. return (bool)(cfg->is_rx_fisa_enabled);
  1052. }
  1053. #else
  1054. bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1055. {
  1056. return false;
  1057. }
  1058. #endif
  1059. void
  1060. wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
  1061. bool val)
  1062. {
  1063. cfg->is_rx_flow_search_table_per_pdev = val;
  1064. }
  1065. bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
  1066. {
  1067. return cfg->is_rx_flow_search_table_per_pdev;
  1068. }
  1069. void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  1070. uint16_t val)
  1071. {
  1072. cfg->rx_flow_search_table_size = val;
  1073. }
  1074. uint16_t
  1075. wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  1076. {
  1077. return cfg->rx_flow_search_table_size;
  1078. }
  1079. void
  1080. wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  1081. bool val)
  1082. {
  1083. cfg->is_rx_mon_protocol_flow_tag_enabled = val;
  1084. }
  1085. bool
  1086. wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  1087. {
  1088. return cfg->is_rx_mon_protocol_flow_tag_enabled;
  1089. }