wlan_cfg.h 14 KB

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