wlan_cfg.c 28 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  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->tx_sw_internode_queue = cfg_get(psoc,
  359. CFG_DP_TX_SW_INTERNODE_QUEUE);
  360. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  361. CFG_DP_RXDMA_ERR_DST_RING);
  362. wlan_cfg_ctx->enable_data_stall_detection =
  363. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  364. wlan_cfg_ctx->tx_flow_start_queue_offset =
  365. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  366. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  367. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  368. wlan_cfg_ctx->disable_intra_bss_fwd =
  369. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  370. return wlan_cfg_ctx;
  371. }
  372. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  373. {
  374. qdf_mem_free(wlan_cfg_ctx);
  375. }
  376. struct wlan_cfg_dp_pdev_ctxt *
  377. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  378. {
  379. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  380. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  381. if (!wlan_cfg_ctx)
  382. return NULL;
  383. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  384. CFG_DP_RXDMA_BUF_RING);
  385. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  386. CFG_DP_RXDMA_MONITOR_BUF_RING);
  387. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  388. CFG_DP_RXDMA_MONITOR_DST_RING);
  389. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  390. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  391. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  392. CFG_DP_RXDMA_MONITOR_DESC_RING);
  393. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  394. return wlan_cfg_ctx;
  395. }
  396. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  397. {
  398. if (wlan_cfg_ctx)
  399. qdf_mem_free(wlan_cfg_ctx);
  400. }
  401. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  402. {
  403. cfg->num_int_ctxts = num;
  404. }
  405. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  406. {
  407. cfg->max_peer_id = val;
  408. }
  409. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  410. {
  411. cfg->max_ast_idx = val;
  412. }
  413. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  414. {
  415. return cfg->max_ast_idx;
  416. }
  417. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  418. int context, int mask)
  419. {
  420. cfg->int_tx_ring_mask[context] = mask;
  421. }
  422. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  423. int context, int mask)
  424. {
  425. cfg->int_rx_ring_mask[context] = mask;
  426. }
  427. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  428. int context, int mask)
  429. {
  430. cfg->int_rx_mon_ring_mask[context] = mask;
  431. }
  432. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  433. int context)
  434. {
  435. return cfg->int_host2rxdma_mon_ring_mask[context];
  436. }
  437. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  438. int context, int mask)
  439. {
  440. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  441. }
  442. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  443. int context)
  444. {
  445. return cfg->int_rxdma2host_mon_ring_mask[context];
  446. }
  447. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  448. int context, int mask)
  449. {
  450. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  451. }
  452. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  453. int context, int mask)
  454. {
  455. cfg->int_rxdma2host_ring_mask[context] = mask;
  456. }
  457. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  458. int context)
  459. {
  460. return cfg->int_rxdma2host_ring_mask[context];
  461. }
  462. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  463. int context, int mask)
  464. {
  465. cfg->int_host2rxdma_ring_mask[context] = mask;
  466. }
  467. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  468. int context)
  469. {
  470. return cfg->int_host2rxdma_ring_mask[context];
  471. }
  472. void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  473. int hw_macid)
  474. {
  475. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  476. cfg->hw_macid[pdev_idx] = hw_macid;
  477. }
  478. int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  479. {
  480. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  481. return cfg->hw_macid[pdev_idx];
  482. }
  483. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  484. {
  485. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  486. return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
  487. }
  488. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  489. int context, int mask)
  490. {
  491. cfg->int_ce_ring_mask[context] = mask;
  492. }
  493. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  494. int mask)
  495. {
  496. cfg->int_rx_ring_mask[context] = mask;
  497. }
  498. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  499. int context, int mask)
  500. {
  501. return cfg->int_rx_err_ring_mask[context] = mask;
  502. }
  503. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  504. int context, int mask)
  505. {
  506. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  507. }
  508. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  509. int context, int mask)
  510. {
  511. return cfg->int_reo_status_ring_mask[context] = mask;
  512. }
  513. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  514. {
  515. return cfg->num_int_ctxts;
  516. }
  517. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  518. {
  519. return cfg->int_tx_ring_mask[context];
  520. }
  521. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  522. {
  523. return cfg->int_rx_ring_mask[context];
  524. }
  525. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  526. int context)
  527. {
  528. return cfg->int_rx_err_ring_mask[context];
  529. }
  530. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  531. int context)
  532. {
  533. return cfg->int_rx_wbm_rel_ring_mask[context];
  534. }
  535. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  536. int context)
  537. {
  538. return cfg->int_reo_status_ring_mask[context];
  539. }
  540. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  541. {
  542. return cfg->int_rx_mon_ring_mask[context];
  543. }
  544. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  545. {
  546. return cfg->int_ce_ring_mask[context];
  547. }
  548. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  549. {
  550. return cfg->max_clients;
  551. }
  552. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  553. {
  554. return cfg->max_alloc_size;
  555. }
  556. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  557. {
  558. return cfg->per_pdev_tx_ring;
  559. }
  560. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  561. {
  562. return cfg->per_pdev_lmac_ring;
  563. }
  564. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  565. {
  566. return cfg->num_tcl_data_rings;
  567. }
  568. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  569. {
  570. return cfg->tx_ring_size;
  571. }
  572. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  573. {
  574. return cfg->tx_comp_ring_size;
  575. }
  576. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  577. {
  578. return cfg->per_pdev_rx_ring;
  579. }
  580. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  581. {
  582. return cfg->num_reo_dest_rings;
  583. }
  584. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  585. {
  586. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  587. }
  588. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  589. {
  590. return cfg->num_tx_desc_pool;
  591. }
  592. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  593. {
  594. cfg->num_tx_desc_pool = num_pool;
  595. }
  596. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  597. {
  598. return cfg->num_tx_ext_desc_pool;
  599. }
  600. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  601. {
  602. cfg->num_tx_ext_desc_pool = num_pool;
  603. }
  604. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  605. {
  606. return cfg->reo_dst_ring_size;
  607. }
  608. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  609. int reo_dst_ring_size)
  610. {
  611. cfg->reo_dst_ring_size = reo_dst_ring_size;
  612. }
  613. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  614. bool raw_mode_war)
  615. {
  616. cfg->raw_mode_war = raw_mode_war;
  617. }
  618. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  619. {
  620. return cfg->raw_mode_war;
  621. }
  622. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  623. {
  624. return cfg->num_tx_desc;
  625. }
  626. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  627. {
  628. cfg->num_tx_desc = num_desc;
  629. }
  630. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  631. {
  632. return cfg->min_tx_desc;
  633. }
  634. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  635. {
  636. return cfg->num_tx_ext_desc;
  637. }
  638. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  639. {
  640. cfg->num_tx_ext_desc = num_ext_desc;
  641. }
  642. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  643. {
  644. /* TODO: This should be calculated based on target capabilities */
  645. return cfg->max_peer_id;
  646. }
  647. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  648. {
  649. return cfg->dma_mon_buf_ring_size;
  650. }
  651. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  652. {
  653. return cfg->dma_mon_dest_ring_size;
  654. }
  655. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  656. {
  657. return cfg->dma_mon_status_ring_size;
  658. }
  659. int
  660. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  661. {
  662. return cfg->rxdma_monitor_desc_ring;
  663. }
  664. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  665. {
  666. return cfg->rx_dma_buf_ring_size;
  667. }
  668. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  669. {
  670. return cfg->num_mac_rings;
  671. }
  672. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  673. {
  674. return cfg->gro_enabled;
  675. }
  676. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  677. {
  678. return cfg->lro_enabled;
  679. }
  680. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  681. {
  682. return cfg->ipa_enabled;
  683. }
  684. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  685. {
  686. cfg->rx_hash = val;
  687. }
  688. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  689. {
  690. return cfg->rx_hash;
  691. }
  692. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  693. {
  694. return cfg->nss_enabled;
  695. }
  696. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  697. {
  698. cfg->nss_enabled = nss_enabled;
  699. }
  700. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  701. {
  702. return cfg->nss_cfg;
  703. }
  704. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  705. {
  706. cfg->nss_cfg = nss_cfg;
  707. if (cfg->nss_cfg)
  708. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  709. }
  710. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  711. {
  712. return cfg->int_batch_threshold_tx;
  713. }
  714. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  715. {
  716. return cfg->int_timer_threshold_tx;
  717. }
  718. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  719. {
  720. return cfg->int_batch_threshold_rx;
  721. }
  722. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  723. {
  724. return cfg->int_timer_threshold_rx;
  725. }
  726. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  727. {
  728. return cfg->int_batch_threshold_other;
  729. }
  730. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  731. {
  732. return cfg->int_timer_threshold_other;
  733. }
  734. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  735. {
  736. return cfg->int_timer_threshold_mon;
  737. }
  738. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  739. {
  740. return cfg->tcp_udp_checksumoffload;
  741. }
  742. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  743. {
  744. return cfg->rx_defrag_min_timeout;
  745. }
  746. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  747. {
  748. return cfg->defrag_timeout_check;
  749. }
  750. int
  751. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  752. {
  753. return cfg->wbm_release_ring;
  754. }
  755. int
  756. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  757. {
  758. return cfg->tcl_cmd_ring;
  759. }
  760. int
  761. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  762. {
  763. return cfg->tcl_status_ring;
  764. }
  765. int
  766. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  767. {
  768. return cfg->reo_reinject_ring;
  769. }
  770. int
  771. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  772. {
  773. return cfg->rx_release_ring;
  774. }
  775. int
  776. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  777. {
  778. return cfg->reo_exception_ring;
  779. }
  780. int
  781. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  782. {
  783. return cfg->reo_cmd_ring;
  784. }
  785. int
  786. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  787. {
  788. return cfg->reo_status_ring;
  789. }
  790. int
  791. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  792. {
  793. return cfg->rxdma_refill_ring;
  794. }
  795. int
  796. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  797. {
  798. return cfg->tx_desc_limit_0;
  799. }
  800. int
  801. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  802. {
  803. return cfg->tx_desc_limit_1;
  804. }
  805. int
  806. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  807. {
  808. return cfg->tx_desc_limit_2;
  809. }
  810. int
  811. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  812. {
  813. return cfg->tx_device_limit;
  814. }
  815. int
  816. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  817. {
  818. return cfg->tx_sw_internode_queue;
  819. }
  820. int
  821. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  822. {
  823. return cfg->rxdma_err_dst_ring;
  824. }
  825. bool
  826. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  827. enum cdp_capabilities dp_caps)
  828. {
  829. switch (dp_caps) {
  830. case CDP_CFG_DP_TSO:
  831. return cfg->tso_enabled;
  832. case CDP_CFG_DP_LRO:
  833. return cfg->lro_enabled;
  834. case CDP_CFG_DP_SG:
  835. return cfg->sg_enabled;
  836. case CDP_CFG_DP_GRO:
  837. return cfg->gro_enabled;
  838. case CDP_CFG_DP_OL_TX_CSUM:
  839. return cfg->ol_tx_csum_enabled;
  840. case CDP_CFG_DP_OL_RX_CSUM:
  841. return cfg->ol_rx_csum_enabled;
  842. case CDP_CFG_DP_RAWMODE:
  843. return cfg->rawmode_enabled;
  844. case CDP_CFG_DP_PEER_FLOW_CTRL:
  845. return cfg->peer_flow_ctrl_enabled;
  846. default:
  847. return false;
  848. }
  849. }
  850. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  851. /**
  852. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  853. * @cfg: config context
  854. *
  855. * Return: stop threshold
  856. */
  857. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  858. {
  859. return cfg->tx_flow_stop_queue_threshold;
  860. }
  861. /**
  862. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  863. * for TX to resume
  864. * @cfg: config context
  865. *
  866. * Return: stop threshold
  867. */
  868. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  869. {
  870. return cfg->tx_flow_start_queue_offset;
  871. }
  872. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */