wlan_cfg.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. /*
  2. * Copyright (c) 2013-2017 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. #ifndef __WLAN_CFG_H
  19. #define __WLAN_CFG_H
  20. /*
  21. * Temporary place holders. These should come either from target config
  22. * or platform configuration
  23. */
  24. #if defined(CONFIG_MCL)
  25. #define MAX_PDEV_CNT 1
  26. #else
  27. #define MAX_PDEV_CNT 3
  28. #endif
  29. /* Tx configuration */
  30. #define MAX_LINK_DESC_BANKS 8
  31. #define MAX_TXDESC_POOLS 4
  32. #define MAX_TCL_DATA_RINGS 4
  33. #define DP_MAX_TX_RINGS 8
  34. #define MAX_TX_HW_QUEUES 3
  35. /* Rx configuration */
  36. #define MAX_RXDESC_POOLS 4
  37. #define MAX_REO_DEST_RINGS 4
  38. #define DP_MAX_RX_RINGS 8
  39. #define MAX_RX_MAC_RINGS 2
  40. /* Miscellaneous configuration */
  41. #define MAX_IDLE_SCATTER_BUFS 16
  42. #define DP_MAX_IRQ_PER_CONTEXT 12
  43. #define DP_MAX_INTERRUPT_CONTEXTS 8
  44. #define DP_MAX_INTERRUPT_CONTEXTS 8
  45. #define MAX_HTT_METADATA_LEN 32
  46. #define MAX_NUM_PEER_ID_PER_PEER 8
  47. #define DP_MAX_TIDS 17
  48. #define DP_NON_QOS_TID 16
  49. struct wlan_cfg_dp_pdev_ctxt;
  50. struct wlan_cfg_dp_soc_ctxt;
  51. /**
  52. * wlan_cfg_soc_attach() - Attach configuration interface for SoC
  53. *
  54. * Allocates context for Soc configuration parameters,
  55. * Read configuration information from device tree/ini file and
  56. * returns back handle
  57. *
  58. * Return: Handle to configuration context
  59. */
  60. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void);
  61. /**
  62. * wlan_cfg_soc_detach() - Detach soc configuration handle
  63. * @wlan_cfg_ctx: soc configuration handle
  64. *
  65. * De-allocates memory allocated for SoC configuration
  66. *
  67. * Return:none
  68. */
  69. void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  70. /**
  71. * wlan_cfg_pdev_attach() Attach configuration interface for pdev
  72. *
  73. * Allocates context for pdev configuration parameters,
  74. * Read configuration information from device tree/ini file and
  75. * returns back handle
  76. *
  77. * Return: Handle to configuration context
  78. */
  79. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void);
  80. /**
  81. * wlan_cfg_pdev_detach() Detach and free pdev configuration handle
  82. * @wlan_cfg_pdev_ctx - PDEV Configuration Handle
  83. *
  84. * Return: void
  85. */
  86. void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  87. void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num);
  88. void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  89. int context, int mask);
  90. void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  91. int context, int mask);
  92. void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  93. int context, int mask);
  94. void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  95. int context, int mask);
  96. void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
  97. int mask);
  98. /**
  99. * wlan_cfg_get_num_contexts() - Number of interrupt contexts to be registered
  100. * @wlan_cfg_ctx - Configuration Handle
  101. *
  102. * For WIN, DP_NUM_INTERRUPT_CONTEXTS will be equal to number of CPU cores.
  103. * Each context (for linux it is a NAPI context) will have a tx_ring_mask,
  104. * rx_ring_mask ,and rx_monitor_ring mask to indicate the rings
  105. * that are processed by the handler.
  106. *
  107. * Return: num_contexts
  108. */
  109. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  110. /**
  111. * wlan_cfg_get_tx_ring_mask() - Return Tx interrupt mask mapped to an
  112. * interrupt context
  113. * @wlan_cfg_ctx - Configuration Handle
  114. * @context - Numerical ID identifying the Interrupt/NAPI context
  115. *
  116. * Return: int_tx_ring_mask[context]
  117. */
  118. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  119. int context);
  120. /**
  121. * wlan_cfg_get_rx_ring_mask() - Return Rx interrupt mask mapped to an
  122. * interrupt context
  123. * @wlan_cfg_ctx - Configuration Handle
  124. * @context - Numerical ID identifying the Interrupt/NAPI context
  125. *
  126. * Return: int_rx_ring_mask[context]
  127. */
  128. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  129. int context);
  130. /**
  131. * wlan_cfg_get_rx_mon_ring_mask() - Return Rx monitor ring interrupt mask
  132. * mapped to an interrupt context
  133. * @wlan_cfg_ctx - Configuration Handle
  134. * @context - Numerical ID identifying the Interrupt/NAPI context
  135. *
  136. * Return: int_rx_mon_ring_mask[context]
  137. */
  138. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  139. int context);
  140. /**
  141. * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask
  142. * mapped to an interrupt context
  143. * @wlan_cfg_ctx - Configuration Handle
  144. * @context - Numerical ID identifying the Interrupt/NAPI context
  145. *
  146. * Return: int_ce_ring_mask[context]
  147. */
  148. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  149. int context);
  150. /**
  151. * wlan_cfg_get_max_clients() - Return maximum number of peers/stations
  152. * supported by device
  153. * @wlan_cfg_ctx - Configuration Handle
  154. *
  155. * Return: max_clients
  156. */
  157. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  158. /**
  159. * wlan_cfg_max_alloc_size() - Return Maximum allocation size for any dynamic
  160. * memory allocation request for this device
  161. * @wlan_cfg_ctx - Configuration Handle
  162. *
  163. * Return: max_alloc_size
  164. */
  165. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  166. /*
  167. * wlan_cfg_per_pdev_tx_ring() - Return true if Tx rings are mapped as
  168. * one per radio
  169. * @wlan_cfg_ctx - Configuration Handle
  170. *
  171. * Return: per_pdev_tx_ring
  172. */
  173. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  174. /*
  175. * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings supported by device
  176. * @wlan_cfg_ctx
  177. *
  178. * Return: num_tcl_data_rings
  179. */
  180. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  181. /*
  182. * wlan_cfg_per_pdev_rx_ring() - Return true if Rx rings are mapped as
  183. * one per radio
  184. * @wlan_cfg_ctx
  185. *
  186. * Return: per_pdev_rx_ring
  187. */
  188. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  189. /*
  190. * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device
  191. * @wlan_cfg_ctx - Configuration Handle
  192. *
  193. * Return: num_reo_dest_rings
  194. */
  195. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  196. /*
  197. * wlan_cfg_pkt_type() - Default 802.11 encapsulation type
  198. * @wlan_cfg_ctx - Configuration Handle
  199. *
  200. * Return: htt_pkt_type_ethernet
  201. */
  202. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  203. /*
  204. * wlan_cfg_get_num_tx_desc_pool() - Number of Tx Descriptor pools for the
  205. * device
  206. * @wlan_cfg_ctx - Configuration Handle
  207. *
  208. * Return: num_tx_desc_pool
  209. */
  210. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  211. /*
  212. * wlan_cfg_get_num_tx_ext_desc_pool() - Number of Tx MSDU ext Descriptor
  213. * pools
  214. * @wlan_cfg_ctx - Configuration Handle
  215. *
  216. * Return: num_tx_ext_desc_pool
  217. */
  218. int wlan_cfg_get_num_tx_ext_desc_pool(
  219. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  220. /*
  221. * wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool
  222. * @wlan_cfg_ctx - Configuration Handle
  223. *
  224. * Return: num_tx_desc
  225. */
  226. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  227. /*
  228. * wlan_cfg_get_num_tx_ext_desc() - Number of Tx MSDU extension Descriptors
  229. * per pool
  230. * @wlan_cfg_ctx - Configuration Handle
  231. *
  232. * Return: num_tx_ext_desc
  233. */
  234. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  235. /*
  236. * wlan_cfg_max_peer_id() - Get maximum peer ID
  237. * @cfg: Configuration Handle
  238. *
  239. * Return: maximum peer ID
  240. */
  241. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg);
  242. /*
  243. * wlan_cfg_get_dma_mon_buf_ring_size() - Return Size of monitor buffer ring
  244. * @wlan_cfg_pdev_ctx
  245. *
  246. * Return: dma_mon_buf_ring_size
  247. */
  248. int wlan_cfg_get_dma_mon_buf_ring_size(
  249. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  250. /*
  251. * wlan_cfg_get_dma_mon_dest_ring_size() - Return Size of RxDMA Monitor
  252. * Destination ring
  253. * @wlan_cfg_pdev_ctx
  254. *
  255. * Return: dma_mon_dest_size
  256. */
  257. int wlan_cfg_get_dma_mon_dest_ring_size(
  258. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  259. /*
  260. * wlan_cfg_get_dma_mon_stat_ring_size() - Return size of Monitor Status ring
  261. * @wlan_cfg_pdev_ctx
  262. *
  263. * Return: dma_mon_stat_ring_size
  264. */
  265. int wlan_cfg_get_dma_mon_stat_ring_size(
  266. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  267. /*
  268. * wlan_cfg_get_rx_dma_buf_ring_size() - Return Size of RxDMA buffer ring
  269. * @wlan_cfg_pdev_ctx
  270. *
  271. * Return: rx_dma_buf_ring_size
  272. */
  273. int wlan_cfg_get_rx_dma_buf_ring_size(
  274. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  275. /*
  276. * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings
  277. * per pdev
  278. * @wlan_cfg_pdev_ctx
  279. *
  280. * Return: number of mac DMA rings per pdev
  281. */
  282. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg);
  283. /*
  284. * wlan_cfg_is_lro_enabled - Return LRO enabled/disabled
  285. * @wlan_cfg_pdev_ctx
  286. *
  287. * Return: true - LRO enabled false - LRO disabled
  288. */
  289. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  290. /*
  291. * wlan_cfg_is_lro_enabled - Return RX hash enabled/disabled
  292. * @wlan_cfg_pdev_ctx
  293. *
  294. * Return: true - enabled false - disabled
  295. */
  296. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  297. #endif