wlan_cfg.c 28 KB

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