wlan_cfg.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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. int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  100. int context, int mask);
  101. int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  102. int context, int mask);
  103. int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  104. int context, int mask);
  105. int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  106. int context);
  107. int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  108. int context);
  109. int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  110. int context);
  111. /**
  112. * wlan_cfg_get_num_contexts() - Number of interrupt contexts to be registered
  113. * @wlan_cfg_ctx - Configuration Handle
  114. *
  115. * For WIN, DP_NUM_INTERRUPT_CONTEXTS will be equal to number of CPU cores.
  116. * Each context (for linux it is a NAPI context) will have a tx_ring_mask,
  117. * rx_ring_mask ,and rx_monitor_ring mask to indicate the rings
  118. * that are processed by the handler.
  119. *
  120. * Return: num_contexts
  121. */
  122. int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  123. /**
  124. * wlan_cfg_get_tx_ring_mask() - Return Tx interrupt mask mapped to an
  125. * interrupt context
  126. * @wlan_cfg_ctx - Configuration Handle
  127. * @context - Numerical ID identifying the Interrupt/NAPI context
  128. *
  129. * Return: int_tx_ring_mask[context]
  130. */
  131. int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  132. int context);
  133. /**
  134. * wlan_cfg_get_rx_ring_mask() - Return Rx interrupt mask mapped to an
  135. * interrupt context
  136. * @wlan_cfg_ctx - Configuration Handle
  137. * @context - Numerical ID identifying the Interrupt/NAPI context
  138. *
  139. * Return: int_rx_ring_mask[context]
  140. */
  141. int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  142. int context);
  143. /**
  144. * wlan_cfg_get_rx_mon_ring_mask() - Return Rx monitor ring interrupt mask
  145. * mapped to an interrupt context
  146. * @wlan_cfg_ctx - Configuration Handle
  147. * @context - Numerical ID identifying the Interrupt/NAPI context
  148. *
  149. * Return: int_rx_mon_ring_mask[context]
  150. */
  151. int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  152. int context);
  153. /**
  154. * wlan_cfg_set_rxdma2host_ring_mask() - Set rxdma2host ring interrupt mask
  155. * for the given interrupt context
  156. * @wlan_cfg_ctx - Configuration Handle
  157. * @context - Numerical ID identifying the Interrupt/NAPI context
  158. *
  159. */
  160. void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  161. int context, int mask);
  162. /**
  163. * wlan_cfg_get_rxdma2host_ring_mask() - Return rxdma2host ring interrupt mask
  164. * mapped to an interrupt context
  165. * @wlan_cfg_ctx - Configuration Handle
  166. * @context - Numerical ID identifying the Interrupt/NAPI context
  167. *
  168. * Return: int_rxdma2host_ring_mask[context]
  169. */
  170. int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
  171. int context);
  172. /**
  173. * wlan_cfg_set_hw_macid() - Set HW MAC Id for the given PDEV index
  174. *
  175. * @wlan_cfg_ctx - Configuration Handle
  176. * @pdev_idx - Index of SW PDEV
  177. * @hw_macid - HW MAC Id
  178. *
  179. */
  180. void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
  181. int hw_macid);
  182. /**
  183. * wlan_cfg_get_hw_macid() - Get HW MAC Id for the given PDEV index
  184. *
  185. * @wlan_cfg_ctx - Configuration Handle
  186. * @pdev_idx - Index of SW PDEV
  187. *
  188. * Return: HW MAC Id
  189. */
  190. int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx);
  191. /**
  192. * wlan_cfg_get_hw_mac_idx() - Get 0 based HW MAC index for the given
  193. * PDEV index
  194. *
  195. * @wlan_cfg_ctx - Configuration Handle
  196. * @pdev_idx - Index of SW PDEV
  197. *
  198. * Return: HW MAC index
  199. */
  200. int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx);
  201. /**
  202. * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask
  203. * mapped to an interrupt context
  204. * @wlan_cfg_ctx - Configuration Handle
  205. * @context - Numerical ID identifying the Interrupt/NAPI context
  206. *
  207. * Return: int_ce_ring_mask[context]
  208. */
  209. int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
  210. int context);
  211. /**
  212. * wlan_cfg_get_max_clients() - Return maximum number of peers/stations
  213. * supported by device
  214. * @wlan_cfg_ctx - Configuration Handle
  215. *
  216. * Return: max_clients
  217. */
  218. uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  219. /**
  220. * wlan_cfg_max_alloc_size() - Return Maximum allocation size for any dynamic
  221. * memory allocation request for this device
  222. * @wlan_cfg_ctx - Configuration Handle
  223. *
  224. * Return: max_alloc_size
  225. */
  226. uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  227. /*
  228. * wlan_cfg_per_pdev_tx_ring() - Return true if Tx rings are mapped as
  229. * one per radio
  230. * @wlan_cfg_ctx - Configuration Handle
  231. *
  232. * Return: per_pdev_tx_ring
  233. */
  234. int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  235. /*
  236. * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings supported by device
  237. * @wlan_cfg_ctx
  238. *
  239. * Return: num_tcl_data_rings
  240. */
  241. int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  242. /*
  243. * wlan_cfg_per_pdev_rx_ring() - Return true if Rx rings are mapped as
  244. * one per radio
  245. * @wlan_cfg_ctx
  246. *
  247. * Return: per_pdev_rx_ring
  248. */
  249. int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  250. /*
  251. * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device
  252. * @wlan_cfg_ctx - Configuration Handle
  253. *
  254. * Return: num_reo_dest_rings
  255. */
  256. int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  257. /*
  258. * wlan_cfg_pkt_type() - Default 802.11 encapsulation type
  259. * @wlan_cfg_ctx - Configuration Handle
  260. *
  261. * Return: htt_pkt_type_ethernet
  262. */
  263. int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  264. /*
  265. * wlan_cfg_get_num_tx_desc_pool() - Number of Tx Descriptor pools for the
  266. * device
  267. * @wlan_cfg_ctx - Configuration Handle
  268. *
  269. * Return: num_tx_desc_pool
  270. */
  271. int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  272. /*
  273. * wlan_cfg_get_num_tx_ext_desc_pool() - Number of Tx MSDU ext Descriptor
  274. * pools
  275. * @wlan_cfg_ctx - Configuration Handle
  276. *
  277. * Return: num_tx_ext_desc_pool
  278. */
  279. int wlan_cfg_get_num_tx_ext_desc_pool(
  280. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  281. /*
  282. * wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool
  283. * @wlan_cfg_ctx - Configuration Handle
  284. *
  285. * Return: num_tx_desc
  286. */
  287. int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  288. /*
  289. * wlan_cfg_get_num_tx_ext_desc() - Number of Tx MSDU extension Descriptors
  290. * per pool
  291. * @wlan_cfg_ctx - Configuration Handle
  292. *
  293. * Return: num_tx_ext_desc
  294. */
  295. int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx);
  296. /*
  297. * wlan_cfg_max_peer_id() - Get maximum peer ID
  298. * @cfg: Configuration Handle
  299. *
  300. * Return: maximum peer ID
  301. */
  302. uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg);
  303. /*
  304. * wlan_cfg_get_dma_mon_buf_ring_size() - Return Size of monitor buffer ring
  305. * @wlan_cfg_pdev_ctx
  306. *
  307. * Return: dma_mon_buf_ring_size
  308. */
  309. int wlan_cfg_get_dma_mon_buf_ring_size(
  310. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  311. /*
  312. * wlan_cfg_get_dma_mon_dest_ring_size() - Return Size of RxDMA Monitor
  313. * Destination ring
  314. * @wlan_cfg_pdev_ctx
  315. *
  316. * Return: dma_mon_dest_size
  317. */
  318. int wlan_cfg_get_dma_mon_dest_ring_size(
  319. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  320. /*
  321. * wlan_cfg_get_dma_mon_stat_ring_size() - Return size of Monitor Status ring
  322. * @wlan_cfg_pdev_ctx
  323. *
  324. * Return: dma_mon_stat_ring_size
  325. */
  326. int wlan_cfg_get_dma_mon_stat_ring_size(
  327. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  328. /*
  329. * wlan_cfg_get_rx_dma_buf_ring_size() - Return Size of RxDMA buffer ring
  330. * @wlan_cfg_pdev_ctx
  331. *
  332. * Return: rx_dma_buf_ring_size
  333. */
  334. int wlan_cfg_get_rx_dma_buf_ring_size(
  335. struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
  336. /*
  337. * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings
  338. * per pdev
  339. * @wlan_cfg_pdev_ctx
  340. *
  341. * Return: number of mac DMA rings per pdev
  342. */
  343. int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg);
  344. /*
  345. * wlan_cfg_is_lro_enabled - Return LRO enabled/disabled
  346. * @wlan_cfg_pdev_ctx
  347. *
  348. * Return: true - LRO enabled false - LRO disabled
  349. */
  350. bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  351. /*
  352. * wlan_cfg_is_lro_enabled - Return RX hash enabled/disabled
  353. * @wlan_cfg_pdev_ctx
  354. *
  355. * Return: true - enabled false - disabled
  356. */
  357. bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg);
  358. /*
  359. * wlan_cfg_get_dp_pdev_nss_enabled - Return pdev nss enabled/disabled
  360. * @wlan_cfg_pdev_ctx
  361. *
  362. * Return: 1 - enabled 0 - disabled
  363. */
  364. int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg);
  365. /*
  366. * wlan_cfg_set_dp_pdev_nss_enabled - set pdev nss enabled/disabled
  367. * @wlan_cfg_pdev_ctx
  368. */
  369. void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled);
  370. /*
  371. * wlan_cfg_get_dp_soc_nss_cfg - Return soc nss config
  372. * @wlan_cfg_pdev_ctx
  373. *
  374. * Return: nss_cfg
  375. */
  376. int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg);
  377. /*
  378. * wlan_cfg_set_dp_soc_nss_cfg - set soc nss config
  379. * @wlan_cfg_pdev_ctx
  380. *
  381. */
  382. void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg);
  383. /*
  384. * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for Tx
  385. * @wlan_cfg_soc_ctx
  386. *
  387. * Return: Batch threshold
  388. */
  389. int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg);
  390. /*
  391. * wlan_cfg_get_int_timer_threshold_tx - Get interrupt mitigation cfg for Tx
  392. * @wlan_cfg_soc_ctx
  393. *
  394. * Return: Timer threshold
  395. */
  396. int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg);
  397. /*
  398. * wlan_cfg_get_int_batch_threshold_rx - Get interrupt mitigation cfg for Rx
  399. * @wlan_cfg_soc_ctx
  400. *
  401. * Return: Batch threshold
  402. */
  403. int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg);
  404. /*
  405. * wlan_cfg_get_int_batch_threshold_rx - Get interrupt mitigation cfg for Rx
  406. * @wlan_cfg_soc_ctx
  407. *
  408. * Return: Timer threshold
  409. */
  410. int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg);
  411. /*
  412. * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for other srngs
  413. * @wlan_cfg_soc_ctx
  414. *
  415. * Return: Batch threshold
  416. */
  417. int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg);
  418. /*
  419. * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for other srngs
  420. * @wlan_cfg_soc_ctx
  421. *
  422. * Return: Timer threshold
  423. */
  424. int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg);
  425. /*
  426. * wlan_cfg_tx_ring_size - Get Tx DMA ring size (TCL Data Ring)
  427. * @wlan_cfg_soc_ctx
  428. *
  429. * Return: Tx Ring Size
  430. */
  431. int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg);
  432. /*
  433. * wlan_cfg_tx_comp_ring_size - Get Tx completion ring size (WBM Ring)
  434. * @wlan_cfg_soc_ctx
  435. *
  436. * Return: Tx Completion ring size
  437. */
  438. int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg);
  439. #endif