wlan_cfg.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022
  1. /*
  2. * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #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. /*
  30. * FIX THIS -
  31. * For now, all these configuration parameters are hardcoded.
  32. * Many of these should actually be coming from dts file/ini file
  33. */
  34. /*
  35. * The max allowed size for tx comp ring is 8191.
  36. * This is limitted by h/w ring max size.
  37. * As this is not a power of 2 it does not work with nss offload so the
  38. * nearest available size which is power of 2 is 4096 chosen for nss
  39. */
  40. #define WLAN_CFG_TX_RING_MASK_0 0x1
  41. #define WLAN_CFG_TX_RING_MASK_1 0x2
  42. #define WLAN_CFG_TX_RING_MASK_2 0x4
  43. #define WLAN_CFG_TX_RING_MASK_3 0x0
  44. #define WLAN_CFG_RX_RING_MASK_0 0x1
  45. #define WLAN_CFG_RX_RING_MASK_1 0x2
  46. #define WLAN_CFG_RX_RING_MASK_2 0x4
  47. #define WLAN_CFG_RX_RING_MASK_3 0x8
  48. #define WLAN_CFG_RX_MON_RING_MASK_0 0x1
  49. #define WLAN_CFG_RX_MON_RING_MASK_1 0x2
  50. #define WLAN_CFG_RX_MON_RING_MASK_2 0x4
  51. #define WLAN_CFG_RX_MON_RING_MASK_3 0x0
  52. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0 0x1
  53. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1 0x2
  54. #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2 0x4
  55. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0 0x1
  56. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1 0x2
  57. #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2 0x4
  58. #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
  59. #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
  60. #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
  61. #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
  62. #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
  63. #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
  64. #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
  65. #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
  66. #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
  67. #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
  68. #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
  69. #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
  70. #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
  71. #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
  72. #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
  73. #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
  74. #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
  75. #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
  76. #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
  77. #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
  78. #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
  79. static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  80. WLAN_CFG_TX_RING_MASK_0, 0, 0, 0, 0, 0, 0};
  81. #ifndef IPA_OFFLOAD
  82. static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  83. 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};
  84. #else
  85. static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  86. 0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, WLAN_CFG_RX_RING_MASK_2, 0, 0, 0};
  87. #endif
  88. static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  89. 0, WLAN_CFG_RX_MON_RING_MASK_0, WLAN_CFG_RX_MON_RING_MASK_1, 0, 0, 0, 0};
  90. static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  91. 0, 0, 0, 0, 0, 0, 0};
  92. static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  93. 0, 0, 0, 0, 0, WLAN_CFG_RXDMA2HOST_RING_MASK_0, WLAN_CFG_RXDMA2HOST_RING_MASK_1};
  94. static const int host2rxdma_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  95. 0, 0, 0, 0, 0, 0, 0};
  96. static const int rxdma2host_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  97. 0, 0, 0, 0, 0, 0, 0};
  98. static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  99. 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_ERR_RING_MASK_0};
  100. static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  101. 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_WBM_REL_RING_MASK_0};
  102. static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  103. 0, 0, 0, 0, 0, 0, WLAN_CFG_REO_STATUS_RING_MASK_0};
  104. #else
  105. static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  106. WLAN_CFG_TX_RING_MASK_0,
  107. WLAN_CFG_TX_RING_MASK_1,
  108. WLAN_CFG_TX_RING_MASK_2,
  109. WLAN_CFG_TX_RING_MASK_3};
  110. static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  111. 0,
  112. 0,
  113. 0,
  114. 0,
  115. 0,
  116. 0,
  117. 0,
  118. WLAN_CFG_RX_RING_MASK_0,
  119. WLAN_CFG_RX_RING_MASK_1,
  120. WLAN_CFG_RX_RING_MASK_2,
  121. WLAN_CFG_RX_RING_MASK_3};
  122. static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  123. 0,
  124. 0,
  125. 0,
  126. 0,
  127. WLAN_CFG_RX_MON_RING_MASK_0,
  128. WLAN_CFG_RX_MON_RING_MASK_1,
  129. WLAN_CFG_RX_MON_RING_MASK_2};
  130. static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  131. WLAN_CFG_HOST2RXDMA_RING_MASK_0,
  132. WLAN_CFG_HOST2RXDMA_RING_MASK_1,
  133. WLAN_CFG_HOST2RXDMA_RING_MASK_2,
  134. WLAN_CFG_HOST2RXDMA_RING_MASK_3};
  135. static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  136. WLAN_CFG_RXDMA2HOST_RING_MASK_0,
  137. WLAN_CFG_RXDMA2HOST_RING_MASK_1,
  138. WLAN_CFG_RXDMA2HOST_RING_MASK_2,
  139. WLAN_CFG_RXDMA2HOST_RING_MASK_3};
  140. static const int host2rxdma_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  141. 0,
  142. 0,
  143. 0,
  144. 0,
  145. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
  146. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
  147. WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
  148. static const int rxdma2host_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  149. 0,
  150. 0,
  151. 0,
  152. 0,
  153. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
  154. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
  155. WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
  156. static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  157. WLAN_CFG_RX_ERR_RING_MASK_0,
  158. WLAN_CFG_RX_ERR_RING_MASK_1,
  159. WLAN_CFG_RX_ERR_RING_MASK_2,
  160. WLAN_CFG_RX_ERR_RING_MASK_3};
  161. static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  162. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  163. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  164. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  165. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  166. static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  167. WLAN_CFG_REO_STATUS_RING_MASK_0,
  168. WLAN_CFG_REO_STATUS_RING_MASK_1,
  169. WLAN_CFG_REO_STATUS_RING_MASK_2,
  170. WLAN_CFG_REO_STATUS_RING_MASK_3};
  171. #endif /* MAX_PDEV_CNT == 1 */
  172. /**
  173. * g_wlan_srng_cfg[] - Per ring_type specific configuration
  174. *
  175. */
  176. struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES];
  177. /* REO_DST ring configuration */
  178. struct wlan_srng_cfg wlan_srng_reo_cfg = {
  179. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING,
  180. .batch_count_threshold = 0,
  181. .low_threshold = 0,
  182. };
  183. /* WBM2SW_RELEASE ring configuration */
  184. struct wlan_srng_cfg wlan_srng_wbm_release_cfg = {
  185. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING,
  186. .batch_count_threshold = 0,
  187. .low_threshold = 0,
  188. };
  189. /* RXDMA_BUF ring configuration */
  190. struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = {
  191. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  192. .batch_count_threshold = 0,
  193. .low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3,
  194. };
  195. /* RXDMA_MONITOR_BUF ring configuration */
  196. struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = {
  197. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  198. .batch_count_threshold = 0,
  199. .low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3,
  200. };
  201. /* RXDMA_MONITOR_STATUS ring configuration */
  202. struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = {
  203. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
  204. .batch_count_threshold = 0,
  205. .low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3,
  206. };
  207. /* DEFAULT_CONFIG ring configuration */
  208. struct wlan_srng_cfg wlan_srng_default_cfg = {
  209. .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER,
  210. .batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER,
  211. .low_threshold = 0,
  212. };
  213. void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg)
  214. {
  215. g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg;
  216. g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg;
  217. g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg;
  218. g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg;
  219. g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg;
  220. g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg;
  221. g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg;
  222. g_wlan_srng_cfg[TCL_CMD] = wlan_srng_default_cfg;
  223. g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
  224. g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
  225. g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
  226. g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
  227. g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
  228. g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
  229. wlan_srng_rxdma_monitor_buf_cfg;
  230. g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
  231. wlan_srng_rxdma_monitor_status_cfg;
  232. g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
  233. g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
  234. g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
  235. #ifdef WLAN_FEATURE_CIF_CFR
  236. g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
  237. #endif
  238. *wlan_cfg = g_wlan_srng_cfg;
  239. }
  240. /**
  241. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  242. * @psoc - Object manager psoc
  243. * Return: wlan_cfg_ctx - Handle to Configuration context
  244. */
  245. struct wlan_cfg_dp_soc_ctxt *
  246. wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  247. {
  248. int i = 0;
  249. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  250. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  251. if (!wlan_cfg_ctx)
  252. return NULL;
  253. wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
  254. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  255. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  256. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  257. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  258. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  259. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  260. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  261. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  262. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  263. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  264. CFG_DP_TX_EXT_DESC_POOLS);
  265. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  266. wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
  267. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  268. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  269. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  270. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  271. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  272. CFG_DP_TX_COMPL_RING_SIZE);
  273. wlan_cfg_ctx->tx_comp_ring_size_nss =
  274. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  275. wlan_cfg_ctx->int_batch_threshold_tx =
  276. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  277. wlan_cfg_ctx->int_timer_threshold_tx =
  278. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  279. wlan_cfg_ctx->int_batch_threshold_rx =
  280. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  281. wlan_cfg_ctx->int_timer_threshold_rx =
  282. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  283. wlan_cfg_ctx->int_batch_threshold_other =
  284. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  285. wlan_cfg_ctx->int_timer_threshold_other =
  286. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  287. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  288. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i];
  289. wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i];
  290. wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i];
  291. wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i];
  292. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  293. rx_wbm_rel_ring_mask[i];
  294. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  295. reo_status_ring_mask[i];
  296. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  297. rxdma2host_ring_mask[i];
  298. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  299. host2rxdma_ring_mask[i];
  300. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  301. host2rxdma_mon_ring_mask[i];
  302. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  303. rxdma2host_mon_ring_mask[i];
  304. }
  305. /* This is default mapping and can be overridden by HW config
  306. * received from FW */
  307. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
  308. if (MAX_PDEV_CNT > 1)
  309. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
  310. if (MAX_PDEV_CNT > 2)
  311. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
  312. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  313. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  314. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  315. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  316. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  317. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  318. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  319. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  320. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  321. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  322. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  323. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  324. /*Enable checksum offload by default*/
  325. wlan_cfg_ctx->tcp_udp_checksumoffload =
  326. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  327. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  328. wlan_cfg_ctx->defrag_timeout_check =
  329. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  330. wlan_cfg_ctx->rx_defrag_min_timeout =
  331. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  332. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  333. CFG_DP_WBM_RELEASE_RING);
  334. wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
  335. CFG_DP_TCL_CMD_RING);
  336. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  337. CFG_DP_TCL_STATUS_RING);
  338. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  339. CFG_DP_REO_REINJECT_RING);
  340. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  341. CFG_DP_RX_RELEASE_RING);
  342. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  343. CFG_DP_REO_EXCEPTION_RING);
  344. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  345. CFG_DP_REO_CMD_RING);
  346. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  347. CFG_DP_REO_STATUS_RING);
  348. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  349. CFG_DP_RXDMA_REFILL_RING);
  350. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  351. CFG_DP_TX_DESC_LIMIT_0);
  352. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  353. CFG_DP_TX_DESC_LIMIT_1);
  354. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  355. CFG_DP_TX_DESC_LIMIT_2);
  356. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  357. CFG_DP_TX_DEVICE_LIMIT);
  358. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  359. CFG_DP_RXDMA_ERR_DST_RING);
  360. wlan_cfg_ctx->enable_data_stall_detection =
  361. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  362. wlan_cfg_ctx->tx_flow_start_queue_offset =
  363. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  364. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  365. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  366. wlan_cfg_ctx->disable_intra_bss_fwd =
  367. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  368. return wlan_cfg_ctx;
  369. }
  370. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  371. {
  372. qdf_mem_free(wlan_cfg_ctx);
  373. }
  374. struct wlan_cfg_dp_pdev_ctxt *
  375. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  376. {
  377. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  378. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  379. if (!wlan_cfg_ctx)
  380. return NULL;
  381. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  382. CFG_DP_RXDMA_BUF_RING);
  383. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  384. CFG_DP_RXDMA_MONITOR_BUF_RING);
  385. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  386. CFG_DP_RXDMA_MONITOR_DST_RING);
  387. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  388. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  389. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  390. CFG_DP_RXDMA_MONITOR_DESC_RING);
  391. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  392. return wlan_cfg_ctx;
  393. }
  394. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  395. {
  396. if (wlan_cfg_ctx)
  397. qdf_mem_free(wlan_cfg_ctx);
  398. }
  399. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  400. {
  401. cfg->num_int_ctxts = num;
  402. }
  403. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  404. {
  405. cfg->max_peer_id = val;
  406. }
  407. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  408. {
  409. cfg->max_ast_idx = val;
  410. }
  411. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  412. {
  413. return cfg->max_ast_idx;
  414. }
  415. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  416. int context, int mask)
  417. {
  418. cfg->int_tx_ring_mask[context] = mask;
  419. }
  420. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  421. int context, int mask)
  422. {
  423. cfg->int_rx_ring_mask[context] = mask;
  424. }
  425. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  426. int context, int mask)
  427. {
  428. cfg->int_rx_mon_ring_mask[context] = mask;
  429. }
  430. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  431. int context)
  432. {
  433. return cfg->int_host2rxdma_mon_ring_mask[context];
  434. }
  435. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  436. int context, int mask)
  437. {
  438. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  439. }
  440. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  441. int context)
  442. {
  443. return cfg->int_rxdma2host_mon_ring_mask[context];
  444. }
  445. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  446. int context, int mask)
  447. {
  448. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  449. }
  450. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  451. int context, int mask)
  452. {
  453. cfg->int_rxdma2host_ring_mask[context] = mask;
  454. }
  455. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  456. int context)
  457. {
  458. return cfg->int_rxdma2host_ring_mask[context];
  459. }
  460. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  461. int context, int mask)
  462. {
  463. cfg->int_host2rxdma_ring_mask[context] = mask;
  464. }
  465. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  466. int context)
  467. {
  468. return cfg->int_host2rxdma_ring_mask[context];
  469. }
  470. void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  471. int hw_macid)
  472. {
  473. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  474. cfg->hw_macid[pdev_idx] = hw_macid;
  475. }
  476. int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  477. {
  478. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  479. return cfg->hw_macid[pdev_idx];
  480. }
  481. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  482. {
  483. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  484. return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
  485. }
  486. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  487. int context, int mask)
  488. {
  489. cfg->int_ce_ring_mask[context] = mask;
  490. }
  491. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  492. int mask)
  493. {
  494. cfg->int_rx_ring_mask[context] = mask;
  495. }
  496. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  497. int context, int mask)
  498. {
  499. return cfg->int_rx_err_ring_mask[context] = mask;
  500. }
  501. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  502. int context, int mask)
  503. {
  504. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  505. }
  506. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  507. int context, int mask)
  508. {
  509. return cfg->int_reo_status_ring_mask[context] = mask;
  510. }
  511. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  512. {
  513. return cfg->num_int_ctxts;
  514. }
  515. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  516. {
  517. return cfg->int_tx_ring_mask[context];
  518. }
  519. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  520. {
  521. return cfg->int_rx_ring_mask[context];
  522. }
  523. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  524. int context)
  525. {
  526. return cfg->int_rx_err_ring_mask[context];
  527. }
  528. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  529. int context)
  530. {
  531. return cfg->int_rx_wbm_rel_ring_mask[context];
  532. }
  533. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  534. int context)
  535. {
  536. return cfg->int_reo_status_ring_mask[context];
  537. }
  538. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  539. {
  540. return cfg->int_rx_mon_ring_mask[context];
  541. }
  542. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  543. {
  544. return cfg->int_ce_ring_mask[context];
  545. }
  546. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  547. {
  548. return cfg->max_clients;
  549. }
  550. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  551. {
  552. return cfg->max_alloc_size;
  553. }
  554. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  555. {
  556. return cfg->per_pdev_tx_ring;
  557. }
  558. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  559. {
  560. return cfg->per_pdev_lmac_ring;
  561. }
  562. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  563. {
  564. return cfg->num_tcl_data_rings;
  565. }
  566. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  567. {
  568. return cfg->tx_ring_size;
  569. }
  570. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  571. {
  572. return cfg->tx_comp_ring_size;
  573. }
  574. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  575. {
  576. return cfg->per_pdev_rx_ring;
  577. }
  578. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  579. {
  580. return cfg->num_reo_dest_rings;
  581. }
  582. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  583. {
  584. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  585. }
  586. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  587. {
  588. return cfg->num_tx_desc_pool;
  589. }
  590. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  591. {
  592. cfg->num_tx_desc_pool = num_pool;
  593. }
  594. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  595. {
  596. return cfg->num_tx_ext_desc_pool;
  597. }
  598. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  599. {
  600. cfg->num_tx_ext_desc_pool = num_pool;
  601. }
  602. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  603. {
  604. return cfg->reo_dst_ring_size;
  605. }
  606. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  607. int reo_dst_ring_size)
  608. {
  609. cfg->reo_dst_ring_size = reo_dst_ring_size;
  610. }
  611. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  612. bool raw_mode_war)
  613. {
  614. cfg->raw_mode_war = raw_mode_war;
  615. }
  616. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  617. {
  618. return cfg->raw_mode_war;
  619. }
  620. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  621. {
  622. return cfg->num_tx_desc;
  623. }
  624. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  625. {
  626. cfg->num_tx_desc = num_desc;
  627. }
  628. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  629. {
  630. return cfg->min_tx_desc;
  631. }
  632. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  633. {
  634. return cfg->num_tx_ext_desc;
  635. }
  636. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  637. {
  638. cfg->num_tx_ext_desc = num_ext_desc;
  639. }
  640. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  641. {
  642. /* TODO: This should be calculated based on target capabilities */
  643. return cfg->max_peer_id;
  644. }
  645. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  646. {
  647. return cfg->dma_mon_buf_ring_size;
  648. }
  649. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  650. {
  651. return cfg->dma_mon_dest_ring_size;
  652. }
  653. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  654. {
  655. return cfg->dma_mon_status_ring_size;
  656. }
  657. int
  658. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  659. {
  660. return cfg->rxdma_monitor_desc_ring;
  661. }
  662. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  663. {
  664. return cfg->rx_dma_buf_ring_size;
  665. }
  666. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  667. {
  668. return cfg->num_mac_rings;
  669. }
  670. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  671. {
  672. return cfg->gro_enabled;
  673. }
  674. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  675. {
  676. return cfg->lro_enabled;
  677. }
  678. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  679. {
  680. return cfg->ipa_enabled;
  681. }
  682. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  683. {
  684. cfg->rx_hash = val;
  685. }
  686. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  687. {
  688. return cfg->rx_hash;
  689. }
  690. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  691. {
  692. return cfg->nss_enabled;
  693. }
  694. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  695. {
  696. cfg->nss_enabled = nss_enabled;
  697. }
  698. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  699. {
  700. return cfg->nss_cfg;
  701. }
  702. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  703. {
  704. cfg->nss_cfg = nss_cfg;
  705. if (cfg->nss_cfg)
  706. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  707. }
  708. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  709. {
  710. return cfg->int_batch_threshold_tx;
  711. }
  712. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  713. {
  714. return cfg->int_timer_threshold_tx;
  715. }
  716. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  717. {
  718. return cfg->int_batch_threshold_rx;
  719. }
  720. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  721. {
  722. return cfg->int_timer_threshold_rx;
  723. }
  724. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  725. {
  726. return cfg->int_batch_threshold_other;
  727. }
  728. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  729. {
  730. return cfg->int_timer_threshold_other;
  731. }
  732. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  733. {
  734. return cfg->int_timer_threshold_mon;
  735. }
  736. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  737. {
  738. return cfg->tcp_udp_checksumoffload;
  739. }
  740. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  741. {
  742. return cfg->rx_defrag_min_timeout;
  743. }
  744. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  745. {
  746. return cfg->defrag_timeout_check;
  747. }
  748. int
  749. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  750. {
  751. return cfg->wbm_release_ring;
  752. }
  753. int
  754. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  755. {
  756. return cfg->tcl_cmd_ring;
  757. }
  758. int
  759. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  760. {
  761. return cfg->tcl_status_ring;
  762. }
  763. int
  764. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  765. {
  766. return cfg->reo_reinject_ring;
  767. }
  768. int
  769. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  770. {
  771. return cfg->rx_release_ring;
  772. }
  773. int
  774. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  775. {
  776. return cfg->reo_exception_ring;
  777. }
  778. int
  779. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  780. {
  781. return cfg->reo_cmd_ring;
  782. }
  783. int
  784. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  785. {
  786. return cfg->reo_status_ring;
  787. }
  788. int
  789. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  790. {
  791. return cfg->rxdma_refill_ring;
  792. }
  793. int
  794. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  795. {
  796. return cfg->tx_desc_limit_0;
  797. }
  798. int
  799. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  800. {
  801. return cfg->tx_desc_limit_1;
  802. }
  803. int
  804. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  805. {
  806. return cfg->tx_desc_limit_2;
  807. }
  808. int
  809. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  810. {
  811. return cfg->tx_device_limit;
  812. }
  813. int
  814. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  815. {
  816. return cfg->rxdma_err_dst_ring;
  817. }
  818. bool
  819. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  820. enum cdp_capabilities dp_caps)
  821. {
  822. switch (dp_caps) {
  823. case CDP_CFG_DP_TSO:
  824. return cfg->tso_enabled;
  825. case CDP_CFG_DP_LRO:
  826. return cfg->lro_enabled;
  827. case CDP_CFG_DP_SG:
  828. return cfg->sg_enabled;
  829. case CDP_CFG_DP_GRO:
  830. return cfg->gro_enabled;
  831. case CDP_CFG_DP_OL_TX_CSUM:
  832. return cfg->ol_tx_csum_enabled;
  833. case CDP_CFG_DP_OL_RX_CSUM:
  834. return cfg->ol_rx_csum_enabled;
  835. case CDP_CFG_DP_RAWMODE:
  836. return cfg->rawmode_enabled;
  837. case CDP_CFG_DP_PEER_FLOW_CTRL:
  838. return cfg->peer_flow_ctrl_enabled;
  839. default:
  840. return false;
  841. }
  842. }
  843. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  844. /**
  845. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  846. * @cfg: config context
  847. *
  848. * Return: stop threshold
  849. */
  850. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  851. {
  852. return cfg->tx_flow_stop_queue_threshold;
  853. }
  854. /**
  855. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  856. * for TX to resume
  857. * @cfg: config context
  858. *
  859. * Return: stop threshold
  860. */
  861. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  862. {
  863. return cfg->tx_flow_start_queue_offset;
  864. }
  865. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */