wlan_cfg.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114
  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. static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
  241. 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
  242. 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
  243. 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
  244. 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
  245. 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
  246. };
  247. /**
  248. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  249. * @psoc - Object manager psoc
  250. * Return: wlan_cfg_ctx - Handle to Configuration context
  251. */
  252. struct wlan_cfg_dp_soc_ctxt *
  253. wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  254. {
  255. int i = 0;
  256. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  257. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  258. if (!wlan_cfg_ctx)
  259. return NULL;
  260. wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
  261. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  262. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  263. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  264. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  265. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  266. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  267. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  268. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  269. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  270. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  271. CFG_DP_TX_EXT_DESC_POOLS);
  272. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  273. wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
  274. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  275. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  276. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  277. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  278. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  279. CFG_DP_TX_COMPL_RING_SIZE);
  280. wlan_cfg_ctx->tx_comp_ring_size_nss =
  281. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  282. wlan_cfg_ctx->int_batch_threshold_tx =
  283. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  284. wlan_cfg_ctx->int_timer_threshold_tx =
  285. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  286. wlan_cfg_ctx->int_batch_threshold_rx =
  287. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  288. wlan_cfg_ctx->int_timer_threshold_rx =
  289. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  290. wlan_cfg_ctx->int_batch_threshold_other =
  291. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  292. wlan_cfg_ctx->int_timer_threshold_other =
  293. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  294. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  295. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i];
  296. wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i];
  297. wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i];
  298. wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i];
  299. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  300. rx_wbm_rel_ring_mask[i];
  301. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  302. reo_status_ring_mask[i];
  303. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  304. rxdma2host_ring_mask[i];
  305. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  306. host2rxdma_ring_mask[i];
  307. wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
  308. host2rxdma_mon_ring_mask[i];
  309. wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
  310. rxdma2host_mon_ring_mask[i];
  311. }
  312. /* This is default mapping and can be overridden by HW config
  313. * received from FW */
  314. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
  315. if (MAX_PDEV_CNT > 1)
  316. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
  317. if (MAX_PDEV_CNT > 2)
  318. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
  319. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  320. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  321. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  322. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  323. wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
  324. wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
  325. wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
  326. wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
  327. wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
  328. wlan_cfg_ctx->peer_flow_ctrl_enabled =
  329. cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
  330. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  331. /*Enable checksum offload by default*/
  332. wlan_cfg_ctx->tcp_udp_checksumoffload =
  333. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  334. wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
  335. wlan_cfg_ctx->defrag_timeout_check =
  336. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  337. wlan_cfg_ctx->rx_defrag_min_timeout =
  338. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  339. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  340. CFG_DP_WBM_RELEASE_RING);
  341. wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
  342. CFG_DP_TCL_CMD_RING);
  343. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  344. CFG_DP_TCL_STATUS_RING);
  345. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  346. CFG_DP_REO_REINJECT_RING);
  347. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  348. CFG_DP_RX_RELEASE_RING);
  349. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  350. CFG_DP_REO_EXCEPTION_RING);
  351. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  352. CFG_DP_REO_CMD_RING);
  353. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  354. CFG_DP_REO_STATUS_RING);
  355. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  356. CFG_DP_RXDMA_REFILL_RING);
  357. wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
  358. CFG_DP_TX_DESC_LIMIT_0);
  359. wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
  360. CFG_DP_TX_DESC_LIMIT_1);
  361. wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
  362. CFG_DP_TX_DESC_LIMIT_2);
  363. wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
  364. CFG_DP_TX_DEVICE_LIMIT);
  365. wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
  366. CFG_DP_TX_SW_INTERNODE_QUEUE);
  367. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  368. CFG_DP_RXDMA_ERR_DST_RING);
  369. wlan_cfg_ctx->enable_data_stall_detection =
  370. cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
  371. wlan_cfg_ctx->tx_flow_start_queue_offset =
  372. cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
  373. wlan_cfg_ctx->tx_flow_stop_queue_threshold =
  374. cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
  375. wlan_cfg_ctx->disable_intra_bss_fwd =
  376. cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
  377. wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
  378. CFG_DP_RX_SW_DESC_WEIGHT);
  379. wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
  380. wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
  381. wlan_cfg_ctx->is_rx_flow_tag_enabled =
  382. cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
  383. wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
  384. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
  385. wlan_cfg_ctx->rx_flow_search_table_size =
  386. cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
  387. wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
  388. cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
  389. return wlan_cfg_ctx;
  390. }
  391. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  392. {
  393. qdf_mem_free(wlan_cfg_ctx);
  394. }
  395. struct wlan_cfg_dp_pdev_ctxt *
  396. wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
  397. {
  398. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  399. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  400. if (!wlan_cfg_ctx)
  401. return NULL;
  402. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  403. CFG_DP_RXDMA_BUF_RING);
  404. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  405. CFG_DP_RXDMA_MONITOR_BUF_RING);
  406. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  407. CFG_DP_RXDMA_MONITOR_DST_RING);
  408. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  409. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  410. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  411. CFG_DP_RXDMA_MONITOR_DESC_RING);
  412. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  413. return wlan_cfg_ctx;
  414. }
  415. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  416. {
  417. if (wlan_cfg_ctx)
  418. qdf_mem_free(wlan_cfg_ctx);
  419. }
  420. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  421. {
  422. cfg->num_int_ctxts = num;
  423. }
  424. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  425. {
  426. cfg->max_peer_id = val;
  427. }
  428. void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  429. {
  430. cfg->max_ast_idx = val;
  431. }
  432. int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
  433. {
  434. return cfg->max_ast_idx;
  435. }
  436. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  437. int context, int mask)
  438. {
  439. cfg->int_tx_ring_mask[context] = mask;
  440. }
  441. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  442. int context, int mask)
  443. {
  444. cfg->int_rx_ring_mask[context] = mask;
  445. }
  446. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  447. int context, int mask)
  448. {
  449. cfg->int_rx_mon_ring_mask[context] = mask;
  450. }
  451. int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  452. int context)
  453. {
  454. return cfg->int_host2rxdma_mon_ring_mask[context];
  455. }
  456. void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  457. int context, int mask)
  458. {
  459. cfg->int_host2rxdma_mon_ring_mask[context] = mask;
  460. }
  461. int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  462. int context)
  463. {
  464. return cfg->int_rxdma2host_mon_ring_mask[context];
  465. }
  466. void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  467. int context, int mask)
  468. {
  469. cfg->int_rxdma2host_mon_ring_mask[context] = mask;
  470. }
  471. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  472. int context, int mask)
  473. {
  474. cfg->int_rxdma2host_ring_mask[context] = mask;
  475. }
  476. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  477. int context)
  478. {
  479. return cfg->int_rxdma2host_ring_mask[context];
  480. }
  481. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  482. int context, int mask)
  483. {
  484. cfg->int_host2rxdma_ring_mask[context] = mask;
  485. }
  486. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  487. int context)
  488. {
  489. return cfg->int_host2rxdma_ring_mask[context];
  490. }
  491. void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  492. int hw_macid)
  493. {
  494. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  495. cfg->hw_macid[pdev_idx] = hw_macid;
  496. }
  497. int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  498. {
  499. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  500. return cfg->hw_macid[pdev_idx];
  501. }
  502. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  503. {
  504. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  505. return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
  506. }
  507. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  508. int context, int mask)
  509. {
  510. cfg->int_ce_ring_mask[context] = mask;
  511. }
  512. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  513. int mask)
  514. {
  515. cfg->int_rx_ring_mask[context] = mask;
  516. }
  517. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  518. int context, int mask)
  519. {
  520. return cfg->int_rx_err_ring_mask[context] = mask;
  521. }
  522. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  523. int context, int mask)
  524. {
  525. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  526. }
  527. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  528. int context, int mask)
  529. {
  530. return cfg->int_reo_status_ring_mask[context] = mask;
  531. }
  532. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  533. {
  534. return cfg->num_int_ctxts;
  535. }
  536. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  537. {
  538. return cfg->int_tx_ring_mask[context];
  539. }
  540. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  541. {
  542. return cfg->int_rx_ring_mask[context];
  543. }
  544. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  545. int context)
  546. {
  547. return cfg->int_rx_err_ring_mask[context];
  548. }
  549. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  550. int context)
  551. {
  552. return cfg->int_rx_wbm_rel_ring_mask[context];
  553. }
  554. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  555. int context)
  556. {
  557. return cfg->int_reo_status_ring_mask[context];
  558. }
  559. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  560. {
  561. return cfg->int_rx_mon_ring_mask[context];
  562. }
  563. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  564. {
  565. return cfg->int_ce_ring_mask[context];
  566. }
  567. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  568. {
  569. return cfg->max_clients;
  570. }
  571. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  572. {
  573. return cfg->max_alloc_size;
  574. }
  575. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  576. {
  577. return cfg->per_pdev_tx_ring;
  578. }
  579. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  580. {
  581. return cfg->per_pdev_lmac_ring;
  582. }
  583. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  584. {
  585. return cfg->num_tcl_data_rings;
  586. }
  587. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  588. {
  589. return cfg->tx_ring_size;
  590. }
  591. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  592. {
  593. return cfg->tx_comp_ring_size;
  594. }
  595. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  596. {
  597. return cfg->per_pdev_rx_ring;
  598. }
  599. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  600. {
  601. return cfg->num_reo_dest_rings;
  602. }
  603. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  604. {
  605. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  606. }
  607. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  608. {
  609. return cfg->num_tx_desc_pool;
  610. }
  611. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  612. {
  613. cfg->num_tx_desc_pool = num_pool;
  614. }
  615. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  616. {
  617. return cfg->num_tx_ext_desc_pool;
  618. }
  619. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  620. {
  621. cfg->num_tx_ext_desc_pool = num_pool;
  622. }
  623. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  624. {
  625. return cfg->reo_dst_ring_size;
  626. }
  627. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  628. int reo_dst_ring_size)
  629. {
  630. cfg->reo_dst_ring_size = reo_dst_ring_size;
  631. }
  632. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  633. bool raw_mode_war)
  634. {
  635. cfg->raw_mode_war = raw_mode_war;
  636. }
  637. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  638. {
  639. return cfg->raw_mode_war;
  640. }
  641. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  642. {
  643. return cfg->num_tx_desc;
  644. }
  645. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  646. {
  647. cfg->num_tx_desc = num_desc;
  648. }
  649. int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  650. {
  651. return cfg->min_tx_desc;
  652. }
  653. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  654. {
  655. return cfg->num_tx_ext_desc;
  656. }
  657. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  658. {
  659. cfg->num_tx_ext_desc = num_ext_desc;
  660. }
  661. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  662. {
  663. /* TODO: This should be calculated based on target capabilities */
  664. return cfg->max_peer_id;
  665. }
  666. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  667. {
  668. return cfg->dma_mon_buf_ring_size;
  669. }
  670. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  671. {
  672. return cfg->dma_mon_dest_ring_size;
  673. }
  674. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  675. {
  676. return cfg->dma_mon_status_ring_size;
  677. }
  678. int
  679. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  680. {
  681. return cfg->rxdma_monitor_desc_ring;
  682. }
  683. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  684. {
  685. return cfg->rx_dma_buf_ring_size;
  686. }
  687. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  688. {
  689. return cfg->num_mac_rings;
  690. }
  691. bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  692. {
  693. return cfg->gro_enabled;
  694. }
  695. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  696. {
  697. return cfg->lro_enabled;
  698. }
  699. bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  700. {
  701. return cfg->ipa_enabled;
  702. }
  703. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  704. {
  705. cfg->rx_hash = val;
  706. }
  707. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  708. {
  709. return cfg->rx_hash;
  710. }
  711. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  712. {
  713. return cfg->nss_enabled;
  714. }
  715. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  716. {
  717. cfg->nss_enabled = nss_enabled;
  718. }
  719. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  720. {
  721. return cfg->nss_cfg;
  722. }
  723. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  724. {
  725. cfg->nss_cfg = nss_cfg;
  726. if (cfg->nss_cfg)
  727. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  728. }
  729. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  730. {
  731. return cfg->int_batch_threshold_tx;
  732. }
  733. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  734. {
  735. return cfg->int_timer_threshold_tx;
  736. }
  737. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  738. {
  739. return cfg->int_batch_threshold_rx;
  740. }
  741. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  742. {
  743. return cfg->int_timer_threshold_rx;
  744. }
  745. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  746. {
  747. return cfg->int_batch_threshold_other;
  748. }
  749. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  750. {
  751. return cfg->int_timer_threshold_other;
  752. }
  753. int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
  754. {
  755. return cfg->int_timer_threshold_mon;
  756. }
  757. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  758. {
  759. return cfg->tcp_udp_checksumoffload;
  760. }
  761. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  762. {
  763. return cfg->rx_defrag_min_timeout;
  764. }
  765. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  766. {
  767. return cfg->defrag_timeout_check;
  768. }
  769. int
  770. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  771. {
  772. return cfg->wbm_release_ring;
  773. }
  774. int
  775. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  776. {
  777. return cfg->tcl_cmd_ring;
  778. }
  779. int
  780. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  781. {
  782. return cfg->tcl_status_ring;
  783. }
  784. int
  785. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  786. {
  787. return cfg->reo_reinject_ring;
  788. }
  789. int
  790. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  791. {
  792. return cfg->rx_release_ring;
  793. }
  794. int
  795. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  796. {
  797. return cfg->reo_exception_ring;
  798. }
  799. int
  800. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  801. {
  802. return cfg->reo_cmd_ring;
  803. }
  804. int
  805. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  806. {
  807. return cfg->reo_status_ring;
  808. }
  809. int
  810. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  811. {
  812. return cfg->rxdma_refill_ring;
  813. }
  814. int
  815. wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
  816. {
  817. return cfg->tx_desc_limit_0;
  818. }
  819. int
  820. wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
  821. {
  822. return cfg->tx_desc_limit_1;
  823. }
  824. int
  825. wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
  826. {
  827. return cfg->tx_desc_limit_2;
  828. }
  829. int
  830. wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
  831. {
  832. return cfg->tx_device_limit;
  833. }
  834. int
  835. wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
  836. {
  837. return cfg->tx_sw_internode_queue;
  838. }
  839. int
  840. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  841. {
  842. return cfg->rxdma_err_dst_ring;
  843. }
  844. int
  845. wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
  846. {
  847. return cfg->rx_sw_desc_weight;
  848. }
  849. bool
  850. wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
  851. enum cdp_capabilities dp_caps)
  852. {
  853. switch (dp_caps) {
  854. case CDP_CFG_DP_TSO:
  855. return cfg->tso_enabled;
  856. case CDP_CFG_DP_LRO:
  857. return cfg->lro_enabled;
  858. case CDP_CFG_DP_SG:
  859. return cfg->sg_enabled;
  860. case CDP_CFG_DP_GRO:
  861. return cfg->gro_enabled;
  862. case CDP_CFG_DP_OL_TX_CSUM:
  863. return cfg->ol_tx_csum_enabled;
  864. case CDP_CFG_DP_OL_RX_CSUM:
  865. return cfg->ol_rx_csum_enabled;
  866. case CDP_CFG_DP_RAWMODE:
  867. return cfg->rawmode_enabled;
  868. case CDP_CFG_DP_PEER_FLOW_CTRL:
  869. return cfg->peer_flow_ctrl_enabled;
  870. default:
  871. return false;
  872. }
  873. }
  874. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  875. /**
  876. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  877. * @cfg: config context
  878. *
  879. * Return: stop threshold
  880. */
  881. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  882. {
  883. return cfg->tx_flow_stop_queue_threshold;
  884. }
  885. /**
  886. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  887. * for TX to resume
  888. * @cfg: config context
  889. *
  890. * Return: stop threshold
  891. */
  892. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  893. {
  894. return cfg->tx_flow_start_queue_offset;
  895. }
  896. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  897. void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  898. bool val)
  899. {
  900. cfg->is_rx_flow_tag_enabled = val;
  901. }
  902. uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
  903. {
  904. return cfg->rx_toeplitz_hash_key;
  905. }
  906. uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
  907. {
  908. return cfg->rx_flow_max_search;
  909. }
  910. bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  911. {
  912. return cfg->is_rx_flow_tag_enabled;
  913. }
  914. void
  915. wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
  916. bool val)
  917. {
  918. cfg->is_rx_flow_search_table_per_pdev = val;
  919. }
  920. bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
  921. {
  922. return cfg->is_rx_flow_search_table_per_pdev;
  923. }
  924. void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  925. uint16_t val)
  926. {
  927. cfg->rx_flow_search_table_size = val;
  928. }
  929. uint16_t
  930. wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  931. {
  932. return cfg->rx_flow_search_table_size;
  933. }
  934. void
  935. wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
  936. bool val)
  937. {
  938. cfg->is_rx_mon_protocol_flow_tag_enabled = val;
  939. }
  940. bool
  941. wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  942. {
  943. return cfg->is_rx_mon_protocol_flow_tag_enabled;
  944. }