wlan_cfg.c 29 KB

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