wlan_cfg.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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. void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val);
  99. /**
  100. * wlan_cfg_get_num_contexts() - Number of interrupt contexts to be registered
  101. * @wlan_cfg_ctx - Configuration Handle
  102. *
  103. * For WIN, DP_NUM_INTERRUPT_CONTEXTS will be equal to number of CPU cores.
  104. * Each context (for linux it is a NAPI context) will have a tx_ring_mask,
  105. * rx_ring_mask ,and rx_monitor_ring mask to indicate the rings
  106. * that are processed by the handler.
  107. *
  108. * Return: num_contexts
  109. */
  110. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  111. /**
  112. * wlan_cfg_get_tx_ring_mask() - Return Tx interrupt mask mapped to an
  113. * interrupt context
  114. * @wlan_cfg_ctx - Configuration Handle
  115. * @context - Numerical ID identifying the Interrupt/NAPI context
  116. *
  117. * Return: int_tx_ring_mask[context]
  118. */
  119. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  120. int context);
  121. /**
  122. * wlan_cfg_get_rx_ring_mask() - Return Rx interrupt mask mapped to an
  123. * interrupt context
  124. * @wlan_cfg_ctx - Configuration Handle
  125. * @context - Numerical ID identifying the Interrupt/NAPI context
  126. *
  127. * Return: int_rx_ring_mask[context]
  128. */
  129. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  130. int context);
  131. /**
  132. * wlan_cfg_get_rx_mon_ring_mask() - Return Rx monitor ring interrupt mask
  133. * mapped to an interrupt context
  134. * @wlan_cfg_ctx - Configuration Handle
  135. * @context - Numerical ID identifying the Interrupt/NAPI context
  136. *
  137. * Return: int_rx_mon_ring_mask[context]
  138. */
  139. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  140. int context);
  141. /**
  142. * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask
  143. * mapped to an interrupt context
  144. * @wlan_cfg_ctx - Configuration Handle
  145. * @context - Numerical ID identifying the Interrupt/NAPI context
  146. *
  147. * Return: int_ce_ring_mask[context]
  148. */
  149. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  150. int context);
  151. /**
  152. * wlan_cfg_get_max_clients() - Return maximum number of peers/stations
  153. * supported by device
  154. * @wlan_cfg_ctx - Configuration Handle
  155. *
  156. * Return: max_clients
  157. */
  158. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  159. /**
  160. * wlan_cfg_max_alloc_size() - Return Maximum allocation size for any dynamic
  161. * memory allocation request for this device
  162. * @wlan_cfg_ctx - Configuration Handle
  163. *
  164. * Return: max_alloc_size
  165. */
  166. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  167. /*
  168. * wlan_cfg_per_pdev_tx_ring() - Return true if Tx rings are mapped as
  169. * one per radio
  170. * @wlan_cfg_ctx - Configuration Handle
  171. *
  172. * Return: per_pdev_tx_ring
  173. */
  174. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  175. /*
  176. * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings supported by device
  177. * @wlan_cfg_ctx
  178. *
  179. * Return: num_tcl_data_rings
  180. */
  181. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  182. /*
  183. * wlan_cfg_per_pdev_rx_ring() - Return true if Rx rings are mapped as
  184. * one per radio
  185. * @wlan_cfg_ctx
  186. *
  187. * Return: per_pdev_rx_ring
  188. */
  189. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  190. /*
  191. * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device
  192. * @wlan_cfg_ctx - Configuration Handle
  193. *
  194. * Return: num_reo_dest_rings
  195. */
  196. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  197. /*
  198. * wlan_cfg_pkt_type() - Default 802.11 encapsulation type
  199. * @wlan_cfg_ctx - Configuration Handle
  200. *
  201. * Return: htt_pkt_type_ethernet
  202. */
  203. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  204. /*
  205. * wlan_cfg_get_num_tx_desc_pool() - Number of Tx Descriptor pools for the
  206. * device
  207. * @wlan_cfg_ctx - Configuration Handle
  208. *
  209. * Return: num_tx_desc_pool
  210. */
  211. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  212. /*
  213. * wlan_cfg_get_num_tx_ext_desc_pool() - Number of Tx MSDU ext Descriptor
  214. * pools
  215. * @wlan_cfg_ctx - Configuration Handle
  216. *
  217. * Return: num_tx_ext_desc_pool
  218. */
  219. int wlan_cfg_get_num_tx_ext_desc_pool(
  220. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  221. /*
  222. * wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool
  223. * @wlan_cfg_ctx - Configuration Handle
  224. *
  225. * Return: num_tx_desc
  226. */
  227. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  228. /*
  229. * wlan_cfg_get_num_tx_ext_desc() - Number of Tx MSDU extension Descriptors
  230. * per pool
  231. * @wlan_cfg_ctx - Configuration Handle
  232. *
  233. * Return: num_tx_ext_desc
  234. */
  235. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  236. /*
  237. * wlan_cfg_max_peer_id() - Get maximum peer ID
  238. * @cfg: Configuration Handle
  239. *
  240. * Return: maximum peer ID
  241. */
  242. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg);
  243. /*
  244. * wlan_cfg_get_dma_mon_buf_ring_size() - Return Size of monitor buffer ring
  245. * @wlan_cfg_pdev_ctx
  246. *
  247. * Return: dma_mon_buf_ring_size
  248. */
  249. int wlan_cfg_get_dma_mon_buf_ring_size(
  250. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  251. /*
  252. * wlan_cfg_get_dma_mon_dest_ring_size() - Return Size of RxDMA Monitor
  253. * Destination ring
  254. * @wlan_cfg_pdev_ctx
  255. *
  256. * Return: dma_mon_dest_size
  257. */
  258. int wlan_cfg_get_dma_mon_dest_ring_size(
  259. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  260. /*
  261. * wlan_cfg_get_dma_mon_stat_ring_size() - Return size of Monitor Status ring
  262. * @wlan_cfg_pdev_ctx
  263. *
  264. * Return: dma_mon_stat_ring_size
  265. */
  266. int wlan_cfg_get_dma_mon_stat_ring_size(
  267. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  268. /*
  269. * wlan_cfg_get_rx_dma_buf_ring_size() - Return Size of RxDMA buffer ring
  270. * @wlan_cfg_pdev_ctx
  271. *
  272. * Return: rx_dma_buf_ring_size
  273. */
  274. int wlan_cfg_get_rx_dma_buf_ring_size(
  275. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  276. /*
  277. * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings
  278. * per pdev
  279. * @wlan_cfg_pdev_ctx
  280. *
  281. * Return: number of mac DMA rings per pdev
  282. */
  283. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg);
  284. /*
  285. * wlan_cfg_is_lro_enabled - Return LRO enabled/disabled
  286. * @wlan_cfg_pdev_ctx
  287. *
  288. * Return: true - LRO enabled false - LRO disabled
  289. */
  290. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  291. /*
  292. * wlan_cfg_is_lro_enabled - Return RX hash enabled/disabled
  293. * @wlan_cfg_pdev_ctx
  294. *
  295. * Return: true - enabled false - disabled
  296. */
  297. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  298. /*
  299. * wlan_cfg_get_dp_pdev_nss_enabled - Return pdev nss enabled/disabled
  300. * @wlan_cfg_pdev_ctx
  301. *
  302. * Return: 1 - enabled 0 - disabled
  303. */
  304. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg);
  305. /*
  306. * wlan_cfg_set_dp_pdev_nss_enabled - set pdev nss enabled/disabled
  307. * @wlan_cfg_pdev_ctx
  308. */
  309. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled);
  310. /*
  311. * wlan_cfg_get_dp_soc_nss_cfg - Return soc nss config
  312. * @wlan_cfg_pdev_ctx
  313. *
  314. * Return: nss_cfg
  315. */
  316. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg);
  317. /*
  318. * wlan_cfg_set_dp_soc_nss_cfg - set soc nss config
  319. * @wlan_cfg_pdev_ctx
  320. *
  321. */
  322. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg);
  323. #endif