wlan_cfg.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. /*
  2. * Copyright (c) 2016-2018 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 "wlan_cfg.h"
  26. #include "cfg_ucfg_api.h"
  27. /*
  28. * FIX THIS -
  29. * For now, all these configuration parameters are hardcoded.
  30. * Many of these should actually be coming from dts file/ini file
  31. */
  32. /*
  33. * The max allowed size for tx comp ring is 8191.
  34. * This is limitted by h/w ring max size.
  35. * As this is not a power of 2 it does not work with nss offload so the
  36. * nearest available size which is power of 2 is 4096 chosen for nss
  37. */
  38. #define WLAN_CFG_TX_RING_MASK_0 0x1
  39. #define WLAN_CFG_TX_RING_MASK_1 0x2
  40. #define WLAN_CFG_TX_RING_MASK_2 0x4
  41. #define WLAN_CFG_TX_RING_MASK_3 0x0
  42. #define WLAN_CFG_RX_RING_MASK_0 0x1
  43. #define WLAN_CFG_RX_RING_MASK_1 0x2
  44. #define WLAN_CFG_RX_RING_MASK_2 0x4
  45. #define WLAN_CFG_RX_RING_MASK_3 0x8
  46. #define WLAN_CFG_RX_MON_RING_MASK_0 0x1
  47. #define WLAN_CFG_RX_MON_RING_MASK_1 0x2
  48. #define WLAN_CFG_RX_MON_RING_MASK_2 0x4
  49. #define WLAN_CFG_RX_MON_RING_MASK_3 0x0
  50. #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
  51. #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
  52. #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
  53. #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
  54. #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
  55. #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
  56. #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
  57. #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
  58. #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
  59. #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
  60. #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
  61. #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
  62. #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
  63. #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
  64. #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
  65. #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
  66. #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
  67. #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
  68. #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
  69. #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
  70. #ifdef CONFIG_MCL
  71. static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  72. 0,
  73. WLAN_CFG_TX_RING_MASK_0,
  74. 0,
  75. 0,
  76. 0,
  77. 0,
  78. 0};
  79. static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  80. 0,
  81. 0,
  82. WLAN_CFG_RX_RING_MASK_0,
  83. 0,
  84. WLAN_CFG_RX_RING_MASK_1,
  85. WLAN_CFG_RX_RING_MASK_2,
  86. WLAN_CFG_RX_RING_MASK_3};
  87. static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  88. 0,
  89. 0,
  90. 0,
  91. WLAN_CFG_RX_MON_RING_MASK_0,
  92. WLAN_CFG_RX_MON_RING_MASK_1,
  93. WLAN_CFG_RX_MON_RING_MASK_2,
  94. WLAN_CFG_RX_MON_RING_MASK_3};
  95. #else
  96. static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  97. WLAN_CFG_TX_RING_MASK_0,
  98. WLAN_CFG_TX_RING_MASK_1,
  99. WLAN_CFG_TX_RING_MASK_2,
  100. WLAN_CFG_TX_RING_MASK_3};
  101. static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  102. WLAN_CFG_RX_RING_MASK_0,
  103. WLAN_CFG_RX_RING_MASK_1,
  104. WLAN_CFG_RX_RING_MASK_2,
  105. WLAN_CFG_RX_RING_MASK_3};
  106. static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  107. 0,
  108. 0,
  109. 0,
  110. 0,
  111. WLAN_CFG_RX_MON_RING_MASK_0,
  112. WLAN_CFG_RX_MON_RING_MASK_1,
  113. WLAN_CFG_RX_MON_RING_MASK_2};
  114. #endif
  115. static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  116. WLAN_CFG_RX_ERR_RING_MASK_0,
  117. WLAN_CFG_RX_ERR_RING_MASK_1,
  118. WLAN_CFG_RX_ERR_RING_MASK_2,
  119. WLAN_CFG_RX_ERR_RING_MASK_3};
  120. static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  121. WLAN_CFG_RX_WBM_REL_RING_MASK_0,
  122. WLAN_CFG_RX_WBM_REL_RING_MASK_1,
  123. WLAN_CFG_RX_WBM_REL_RING_MASK_2,
  124. WLAN_CFG_RX_WBM_REL_RING_MASK_3};
  125. static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  126. WLAN_CFG_REO_STATUS_RING_MASK_0,
  127. WLAN_CFG_REO_STATUS_RING_MASK_1,
  128. WLAN_CFG_REO_STATUS_RING_MASK_2,
  129. WLAN_CFG_REO_STATUS_RING_MASK_3};
  130. static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  131. WLAN_CFG_RXDMA2HOST_RING_MASK_0,
  132. WLAN_CFG_RXDMA2HOST_RING_MASK_1,
  133. WLAN_CFG_RXDMA2HOST_RING_MASK_2,
  134. WLAN_CFG_RXDMA2HOST_RING_MASK_3};
  135. static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
  136. WLAN_CFG_HOST2RXDMA_RING_MASK_0,
  137. WLAN_CFG_HOST2RXDMA_RING_MASK_1,
  138. WLAN_CFG_HOST2RXDMA_RING_MASK_2,
  139. WLAN_CFG_HOST2RXDMA_RING_MASK_3};
  140. /**
  141. * struct wlan_cfg_dp_pdev_ctxt - Configuration parameters for pdev (radio)
  142. * @rx_dma_buf_ring_size - Size of RxDMA buffer ring
  143. * @dma_mon_buf_ring_size - Size of RxDMA Monitor buffer ring
  144. * @dma_mon_dest_ring_size - Size of RxDMA Monitor Destination ring
  145. * @dma_mon_status_ring_size - Size of RxDMA Monitor Status ring
  146. * @rxdma_monitor_desc_ring - rxdma monitor desc ring size
  147. */
  148. struct wlan_cfg_dp_pdev_ctxt {
  149. int rx_dma_buf_ring_size;
  150. int dma_mon_buf_ring_size;
  151. int dma_mon_dest_ring_size;
  152. int dma_mon_status_ring_size;
  153. int rxdma_monitor_desc_ring;
  154. int num_mac_rings;
  155. int nss_enabled;
  156. };
  157. /**
  158. * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
  159. * @psoc - Object manager psoc
  160. * Return: wlan_cfg_ctx - Handle to Configuration context
  161. */
  162. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc)
  163. {
  164. int i = 0;
  165. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
  166. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
  167. if (wlan_cfg_ctx == NULL)
  168. return NULL;
  169. wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
  170. wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
  171. wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
  172. wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
  173. wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
  174. wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
  175. wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
  176. wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
  177. wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
  178. wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
  179. CFG_DP_TX_EXT_DESC_POOLS);
  180. wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
  181. wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
  182. wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
  183. wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
  184. wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
  185. wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
  186. CFG_DP_TX_COMPL_RING_SIZE);
  187. wlan_cfg_ctx->tx_comp_ring_size_nss =
  188. cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
  189. wlan_cfg_ctx->int_batch_threshold_tx =
  190. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
  191. wlan_cfg_ctx->int_timer_threshold_tx =
  192. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
  193. wlan_cfg_ctx->int_batch_threshold_rx =
  194. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
  195. wlan_cfg_ctx->int_timer_threshold_rx =
  196. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
  197. wlan_cfg_ctx->int_batch_threshold_other =
  198. cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
  199. wlan_cfg_ctx->int_timer_threshold_other =
  200. cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
  201. for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
  202. wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i];
  203. wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i];
  204. wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i];
  205. wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i];
  206. wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
  207. rx_wbm_rel_ring_mask[i];
  208. wlan_cfg_ctx->int_reo_status_ring_mask[i] =
  209. reo_status_ring_mask[i];
  210. wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
  211. rxdma2host_ring_mask[i];
  212. wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
  213. host2rxdma_ring_mask[i];
  214. }
  215. /* This is default mapping and can be overridden by HW config
  216. * received from FW */
  217. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
  218. if (MAX_PDEV_CNT > 1)
  219. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
  220. if (MAX_PDEV_CNT > 2)
  221. wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
  222. wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
  223. wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
  224. wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
  225. wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
  226. wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
  227. /*Enable checksum offload by default*/
  228. wlan_cfg_ctx->tcp_udp_checksumoffload =
  229. cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
  230. wlan_cfg_ctx->defrag_timeout_check =
  231. cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
  232. wlan_cfg_ctx->rx_defrag_min_timeout =
  233. cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
  234. wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
  235. CFG_DP_WBM_RELEASE_RING);
  236. wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
  237. CFG_DP_TCL_CMD_RING);
  238. wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
  239. CFG_DP_TCL_STATUS_RING);
  240. wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
  241. CFG_DP_REO_REINJECT_RING);
  242. wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
  243. CFG_DP_RX_RELEASE_RING);
  244. wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
  245. CFG_DP_REO_EXCEPTION_RING);
  246. wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
  247. CFG_DP_REO_CMD_RING);
  248. wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
  249. CFG_DP_REO_STATUS_RING);
  250. wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
  251. CFG_DP_RXDMA_REFILL_RING);
  252. wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
  253. CFG_DP_RXDMA_ERR_DST_RING);
  254. return wlan_cfg_ctx;
  255. }
  256. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
  257. {
  258. qdf_mem_free(wlan_cfg_ctx);
  259. }
  260. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *psoc)
  261. {
  262. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
  263. qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
  264. if (wlan_cfg_ctx == NULL)
  265. return NULL;
  266. wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
  267. CFG_DP_RXDMA_BUF_RING);
  268. wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
  269. CFG_DP_RXDMA_MONITOR_BUF_RING);
  270. wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
  271. CFG_DP_RXDMA_MONITOR_DST_RING);
  272. wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
  273. CFG_DP_RXDMA_MONITOR_STATUS_RING);
  274. wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
  275. CFG_DP_RXDMA_MONITOR_DESC_RING);
  276. wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
  277. return wlan_cfg_ctx;
  278. }
  279. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
  280. {
  281. qdf_mem_free(wlan_cfg_ctx);
  282. }
  283. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
  284. {
  285. cfg->num_int_ctxts = num;
  286. }
  287. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
  288. {
  289. cfg->max_peer_id = val;;
  290. }
  291. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  292. int context, int mask)
  293. {
  294. cfg->int_tx_ring_mask[context] = mask;
  295. }
  296. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  297. int context, int mask)
  298. {
  299. cfg->int_rx_ring_mask[context] = mask;
  300. }
  301. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  302. int context, int mask)
  303. {
  304. cfg->int_rx_mon_ring_mask[context] = mask;
  305. }
  306. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  307. int context, int mask)
  308. {
  309. cfg->int_rxdma2host_ring_mask[context] = mask;
  310. }
  311. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  312. int context)
  313. {
  314. return cfg->int_rxdma2host_ring_mask[context];
  315. }
  316. void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  317. int context, int mask)
  318. {
  319. cfg->int_host2rxdma_ring_mask[context] = mask;
  320. }
  321. int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  322. int context)
  323. {
  324. return cfg->int_host2rxdma_ring_mask[context];
  325. }
  326. void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  327. int hw_macid)
  328. {
  329. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  330. cfg->hw_macid[pdev_idx] = hw_macid;
  331. }
  332. int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  333. {
  334. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  335. return cfg->hw_macid[pdev_idx];
  336. }
  337. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
  338. {
  339. qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
  340. return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
  341. }
  342. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  343. int context, int mask)
  344. {
  345. cfg->int_ce_ring_mask[context] = mask;
  346. }
  347. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  348. int mask)
  349. {
  350. cfg->int_rx_ring_mask[context] = mask;
  351. }
  352. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  353. int context, int mask)
  354. {
  355. return cfg->int_rx_err_ring_mask[context] = mask;
  356. }
  357. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  358. int context, int mask)
  359. {
  360. return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
  361. }
  362. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  363. int context, int mask)
  364. {
  365. return cfg->int_reo_status_ring_mask[context] = mask;
  366. }
  367. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
  368. {
  369. return cfg->num_int_ctxts;
  370. }
  371. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  372. {
  373. return cfg->int_tx_ring_mask[context];
  374. }
  375. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  376. {
  377. return cfg->int_rx_ring_mask[context];
  378. }
  379. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  380. int context)
  381. {
  382. return cfg->int_rx_err_ring_mask[context];
  383. }
  384. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  385. int context)
  386. {
  387. return cfg->int_rx_wbm_rel_ring_mask[context];
  388. }
  389. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  390. int context)
  391. {
  392. return cfg->int_reo_status_ring_mask[context];
  393. }
  394. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  395. {
  396. return cfg->int_rx_mon_ring_mask[context];
  397. }
  398. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
  399. {
  400. return cfg->int_ce_ring_mask[context];
  401. }
  402. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
  403. {
  404. return cfg->max_clients;
  405. }
  406. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  407. {
  408. return cfg->max_alloc_size;
  409. }
  410. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  411. {
  412. return cfg->per_pdev_tx_ring;
  413. }
  414. int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  415. {
  416. return cfg->per_pdev_lmac_ring;
  417. }
  418. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  419. {
  420. return cfg->num_tcl_data_rings;
  421. }
  422. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  423. {
  424. return cfg->tx_ring_size;
  425. }
  426. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  427. {
  428. return cfg->tx_comp_ring_size;
  429. }
  430. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
  431. {
  432. return cfg->per_pdev_rx_ring;
  433. }
  434. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
  435. {
  436. return cfg->num_reo_dest_rings;
  437. }
  438. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
  439. {
  440. return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
  441. }
  442. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  443. {
  444. return cfg->num_tx_desc_pool;
  445. }
  446. void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  447. {
  448. cfg->num_tx_desc_pool = num_pool;
  449. }
  450. int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
  451. {
  452. return cfg->num_tx_ext_desc_pool;
  453. }
  454. void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
  455. {
  456. cfg->num_tx_ext_desc_pool = num_pool;
  457. }
  458. int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  459. {
  460. return cfg->reo_dst_ring_size;
  461. }
  462. void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
  463. int reo_dst_ring_size)
  464. {
  465. cfg->reo_dst_ring_size = reo_dst_ring_size;
  466. }
  467. void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
  468. bool raw_mode_war)
  469. {
  470. cfg->raw_mode_war = raw_mode_war;
  471. }
  472. bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
  473. {
  474. return cfg->raw_mode_war;
  475. }
  476. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  477. {
  478. return cfg->num_tx_desc;
  479. }
  480. void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
  481. {
  482. cfg->num_tx_desc = num_desc;
  483. }
  484. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
  485. {
  486. return cfg->num_tx_ext_desc;
  487. }
  488. void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
  489. {
  490. cfg->num_tx_ext_desc = num_ext_desc;
  491. }
  492. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
  493. {
  494. /* TODO: This should be calculated based on target capabilities */
  495. return cfg->max_peer_id;
  496. }
  497. int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  498. {
  499. return cfg->dma_mon_buf_ring_size;
  500. }
  501. int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  502. {
  503. return cfg->dma_mon_dest_ring_size;
  504. }
  505. int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  506. {
  507. return cfg->dma_mon_status_ring_size;
  508. }
  509. int
  510. wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  511. {
  512. return cfg->rxdma_monitor_desc_ring;
  513. }
  514. int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
  515. {
  516. return cfg->rx_dma_buf_ring_size;
  517. }
  518. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
  519. {
  520. return cfg->num_mac_rings;
  521. }
  522. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  523. {
  524. return cfg->lro_enabled;
  525. }
  526. void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
  527. {
  528. cfg->rx_hash = val;
  529. }
  530. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
  531. {
  532. return cfg->rx_hash;
  533. }
  534. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
  535. {
  536. return cfg->nss_enabled;
  537. }
  538. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
  539. {
  540. cfg->nss_enabled = nss_enabled;
  541. }
  542. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
  543. {
  544. return cfg->nss_cfg;
  545. }
  546. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
  547. {
  548. cfg->nss_cfg = nss_cfg;
  549. if (cfg->nss_cfg)
  550. cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
  551. }
  552. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  553. {
  554. return cfg->int_batch_threshold_tx;
  555. }
  556. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
  557. {
  558. return cfg->int_timer_threshold_tx;
  559. }
  560. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  561. {
  562. return cfg->int_batch_threshold_rx;
  563. }
  564. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
  565. {
  566. return cfg->int_timer_threshold_rx;
  567. }
  568. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  569. {
  570. return cfg->int_batch_threshold_other;
  571. }
  572. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
  573. {
  574. return cfg->int_timer_threshold_other;
  575. }
  576. int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
  577. {
  578. return cfg->tcp_udp_checksumoffload;
  579. }
  580. int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
  581. {
  582. return cfg->rx_defrag_min_timeout;
  583. }
  584. int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
  585. {
  586. return cfg->defrag_timeout_check;
  587. }
  588. int
  589. wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  590. {
  591. return cfg->wbm_release_ring;
  592. }
  593. int
  594. wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  595. {
  596. return cfg->tcl_cmd_ring;
  597. }
  598. int
  599. wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  600. {
  601. return cfg->tcl_status_ring;
  602. }
  603. int
  604. wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  605. {
  606. return cfg->reo_reinject_ring;
  607. }
  608. int
  609. wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  610. {
  611. return cfg->rx_release_ring;
  612. }
  613. int
  614. wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  615. {
  616. return cfg->reo_exception_ring;
  617. }
  618. int
  619. wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  620. {
  621. return cfg->reo_cmd_ring;
  622. }
  623. int
  624. wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  625. {
  626. return cfg->reo_status_ring;
  627. }
  628. int
  629. wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  630. {
  631. return cfg->rxdma_refill_ring;
  632. }
  633. int
  634. wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
  635. {
  636. return cfg->rxdma_err_dst_ring;
  637. }
  638. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  639. /**
  640. * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
  641. * @cfg: config context
  642. *
  643. * Return: stop threshold
  644. */
  645. int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
  646. {
  647. return cfg->tx_flow_stop_queue_threshold;
  648. }
  649. /**
  650. * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
  651. * for TX to resume
  652. * @cfg: config context
  653. *
  654. * Return: stop threshold
  655. */
  656. int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
  657. {
  658. return cfg->tx_flow_start_queue_offset;
  659. }
  660. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */