dp_rings.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _DP_RINGS_H_
  20. #define _DP_RINGS_H_
  21. #include <dp_types.h>
  22. #include <dp_internal.h>
  23. #ifdef WIFI_MONITOR_SUPPORT
  24. #include <dp_mon.h>
  25. #endif
  26. #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
  27. static inline bool dp_is_mon_mask_valid(struct dp_soc *soc,
  28. struct dp_intr *intr_ctx)
  29. {
  30. if (intr_ctx->rx_mon_ring_mask)
  31. return true;
  32. return false;
  33. }
  34. #else
  35. static inline bool dp_is_mon_mask_valid(struct dp_soc *soc,
  36. struct dp_intr *intr_ctx)
  37. {
  38. return false;
  39. }
  40. #endif
  41. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  42. /**
  43. * dp_srng_get_cpu() - Get the smp processor id for srng processing
  44. *
  45. * Return: smp processor id
  46. */
  47. static inline int dp_srng_get_cpu(void)
  48. {
  49. return qdf_get_cpu();
  50. }
  51. #else /* QCA_HOST_MODE_WIFI_DISABLED */
  52. /**
  53. * dp_srng_get_cpu() - Get the smp processor id for srng processing
  54. *
  55. * Return: smp processor id
  56. */
  57. static inline int dp_srng_get_cpu(void)
  58. {
  59. return 0;
  60. }
  61. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  62. /**
  63. * dp_interrupt_timer() - timer poll for interrupts
  64. * @arg: SoC Handle
  65. *
  66. * Return:
  67. *
  68. */
  69. void dp_interrupt_timer(void *arg);
  70. /**
  71. * dp_soc_print_inactive_objects() - prints inactive peer and vdev list
  72. * @soc: DP SOC handle
  73. *
  74. */
  75. void dp_soc_print_inactive_objects(struct dp_soc *soc);
  76. /**
  77. * dp_get_tx_pending() - read pending tx
  78. * @pdev_handle: Datapath PDEV handle
  79. *
  80. * Return: outstanding tx
  81. */
  82. int32_t dp_get_tx_pending(struct cdp_pdev *pdev_handle);
  83. /**
  84. * dp_find_missing_tx_comp() - check for leaked descriptor in tx path
  85. * @soc: DP SOC context
  86. *
  87. * Parse through descriptors in all pools and validate magic number and
  88. * completion time. Trigger self recovery if magic value is corrupted.
  89. *
  90. * Return: None.
  91. */
  92. void dp_find_missing_tx_comp(struct dp_soc *soc);
  93. void dp_enable_verbose_debug(struct dp_soc *soc);
  94. QDF_STATUS dp_peer_legacy_setup(struct dp_soc *soc, struct dp_peer *peer);
  95. uint32_t dp_service_srngs_wrapper(void *dp_ctx, uint32_t dp_budget, int cpu);
  96. void dp_soc_interrupt_map_calculate(struct dp_soc *soc, int intr_ctx_num,
  97. int *irq_id_map, int *num_irq);
  98. void dp_srng_msi_setup(struct dp_soc *soc, struct dp_srng *srng,
  99. struct hal_srng_params *ring_params,
  100. int ring_type, int ring_num);
  101. void
  102. dp_srng_configure_interrupt_thresholds(struct dp_soc *soc,
  103. struct hal_srng_params *ring_params,
  104. int ring_type, int ring_num,
  105. int num_entries);
  106. int dp_process_lmac_rings(struct dp_intr *int_ctx, int total_budget);
  107. /**
  108. * dp_service_lmac_rings()- timer to reap lmac rings
  109. * @arg: SoC Handle
  110. *
  111. * Return:
  112. *
  113. */
  114. void dp_service_lmac_rings(void *arg);
  115. /**
  116. * dp_service_srngs() - Top level interrupt handler for DP Ring interrupts
  117. * @dp_ctx: DP SOC handle
  118. * @dp_budget: Number of frames/descriptors that can be processed in one shot
  119. * @cpu: CPU on which this instance is running
  120. *
  121. * Return: remaining budget/quota for the soc device
  122. */
  123. uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget, int cpu);
  124. /**
  125. * dp_soc_set_interrupt_mode() - Set the interrupt mode in soc
  126. * @soc: DP soc handle
  127. *
  128. * Set the appropriate interrupt mode flag in the soc
  129. */
  130. void dp_soc_set_interrupt_mode(struct dp_soc *soc);
  131. /**
  132. * dp_srng_find_ring_in_mask() - find which ext_group a ring belongs
  133. * @ring_num: ring num of the ring being queried
  134. * @grp_mask: the grp_mask array for the ring type in question.
  135. *
  136. * The grp_mask array is indexed by group number and the bit fields correspond
  137. * to ring numbers. We are finding which interrupt group a ring belongs to.
  138. *
  139. * Return: the index in the grp_mask array with the ring number.
  140. * -QDF_STATUS_E_NOENT if no entry is found
  141. */
  142. static inline int dp_srng_find_ring_in_mask(int ring_num, uint8_t *grp_mask)
  143. {
  144. int ext_group_num;
  145. uint8_t mask = 1 << ring_num;
  146. for (ext_group_num = 0; ext_group_num < WLAN_CFG_INT_NUM_CONTEXTS;
  147. ext_group_num++) {
  148. if (mask & grp_mask[ext_group_num])
  149. return ext_group_num;
  150. }
  151. return -QDF_STATUS_E_NOENT;
  152. }
  153. /* MCL specific functions */
  154. #if defined(DP_CON_MON)
  155. #ifdef DP_CON_MON_MSI_ENABLED
  156. /**
  157. * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
  158. * @soc: pointer to dp_soc handle
  159. * @intr_ctx_num: interrupt context number for which mon mask is needed
  160. *
  161. * For MCL, monitor mode rings are being processed in timer contexts (polled).
  162. * This function is returning 0, since in interrupt mode(softirq based RX),
  163. * we donot want to process monitor mode rings in a softirq.
  164. *
  165. * So, in case packet log is enabled for SAP/STA/P2P modes,
  166. * regular interrupt processing will not process monitor mode rings. It would be
  167. * done in a separate timer context.
  168. *
  169. * Return: 0
  170. */
  171. static inline uint32_t
  172. dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc, int intr_ctx_num)
  173. {
  174. return wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num);
  175. }
  176. #else
  177. /**
  178. * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
  179. * @soc: pointer to dp_soc handle
  180. * @intr_ctx_num: interrupt context number for which mon mask is needed
  181. *
  182. * For MCL, monitor mode rings are being processed in timer contexts (polled).
  183. * This function is returning 0, since in interrupt mode(softirq based RX),
  184. * we donot want to process monitor mode rings in a softirq.
  185. *
  186. * So, in case packet log is enabled for SAP/STA/P2P modes,
  187. * regular interrupt processing will not process monitor mode rings. It would be
  188. * done in a separate timer context.
  189. *
  190. * Return: 0
  191. */
  192. static inline uint32_t
  193. dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc, int intr_ctx_num)
  194. {
  195. return 0;
  196. }
  197. #endif
  198. #else
  199. /**
  200. * dp_soc_get_mon_mask_for_interrupt_mode() - get mon mode mask for intr mode
  201. * @soc: pointer to dp_soc handle
  202. * @intr_ctx_num: interrupt context number for which mon mask is needed
  203. *
  204. * Return: mon mask value
  205. */
  206. static inline
  207. uint32_t dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc,
  208. int intr_ctx_num)
  209. {
  210. return wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num);
  211. }
  212. #endif
  213. #ifdef DISABLE_MON_RING_MSI_CFG
  214. /**
  215. * dp_skip_msi_cfg() - Check if msi cfg has to be skipped for ring_type
  216. * @soc: DP SoC context
  217. * @ring_type: sring type
  218. *
  219. * Return: True if msi cfg should be skipped for srng type else false
  220. */
  221. static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
  222. {
  223. if (ring_type == RXDMA_MONITOR_STATUS)
  224. return true;
  225. return false;
  226. }
  227. #else
  228. #ifdef DP_CON_MON_MSI_ENABLED
  229. #ifdef WLAN_SOFTUMAC_SUPPORT
  230. static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
  231. {
  232. if (soc->cdp_soc.ol_ops->get_con_mode &&
  233. soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) {
  234. if (ring_type != RXDMA_MONITOR_STATUS)
  235. return true;
  236. } else if (ring_type == RXDMA_MONITOR_STATUS &&
  237. !dp_mon_mode_local_pkt_capture(soc)) {
  238. return true;
  239. }
  240. return false;
  241. }
  242. #else
  243. static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
  244. {
  245. if (soc->cdp_soc.ol_ops->get_con_mode &&
  246. soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) {
  247. if (ring_type == REO_DST || ring_type == RXDMA_DST)
  248. return true;
  249. } else if (ring_type == RXDMA_MONITOR_STATUS &&
  250. !dp_mon_mode_local_pkt_capture(soc)) {
  251. return true;
  252. }
  253. return false;
  254. }
  255. #endif
  256. #else
  257. static inline bool dp_skip_msi_cfg(struct dp_soc *soc, int ring_type)
  258. {
  259. return false;
  260. }
  261. #endif /* DP_CON_MON_MSI_ENABLED */
  262. #endif /* DISABLE_MON_RING_MSI_CFG */
  263. /**
  264. * dp_is_msi_group_number_invalid() - check msi_group_number valid or not
  265. * @soc: dp_soc
  266. * @msi_group_number: MSI group number.
  267. * @msi_data_count: MSI data count.
  268. *
  269. * Return: true if msi_group_number is invalid.
  270. */
  271. static inline bool dp_is_msi_group_number_invalid(struct dp_soc *soc,
  272. int msi_group_number,
  273. int msi_data_count)
  274. {
  275. if (soc && soc->osdev && soc->osdev->dev &&
  276. pld_is_one_msi(soc->osdev->dev))
  277. return false;
  278. return msi_group_number > msi_data_count;
  279. }
  280. #ifndef WLAN_SOFTUMAC_SUPPORT
  281. /**
  282. * dp_soc_attach_poll() - Register handlers for DP interrupts
  283. * @txrx_soc: DP SOC handle
  284. *
  285. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  286. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  287. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  288. *
  289. * Return: 0 for success, nonzero for failure.
  290. */
  291. QDF_STATUS dp_soc_attach_poll(struct cdp_soc_t *txrx_soc);
  292. /**
  293. * dp_soc_interrupt_attach() - Register handlers for DP interrupts
  294. * @txrx_soc: DP SOC handle
  295. *
  296. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  297. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  298. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  299. *
  300. * Return: 0 for success. nonzero for failure.
  301. */
  302. QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc);
  303. /**
  304. * dp_hw_link_desc_ring_free() - Free h/w link desc rings
  305. * @soc: DP SOC handle
  306. *
  307. * Return: none
  308. */
  309. void dp_hw_link_desc_ring_free(struct dp_soc *soc);
  310. /**
  311. * dp_hw_link_desc_ring_alloc() - Allocate hw link desc rings
  312. * @soc: DP SOC handle
  313. *
  314. * Allocate memory for WBM_IDLE_LINK srng ring if the number of
  315. * link descriptors is less then the max_allocated size. else
  316. * allocate memory for wbm_idle_scatter_buffer.
  317. *
  318. * Return: QDF_STATUS_SUCCESS: success
  319. * QDF_STATUS_E_NO_MEM: No memory (Failure)
  320. */
  321. QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc);
  322. /**
  323. * dp_hw_link_desc_ring_init() - Initialize hw link desc rings
  324. * @soc: DP SOC handle
  325. *
  326. * Return: QDF_STATUS_SUCCESS: success
  327. * QDF_STATUS_E_FAILURE: failure
  328. */
  329. QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc);
  330. /**
  331. * dp_hw_link_desc_ring_deinit() - Reset hw link desc rings
  332. * @soc: DP SOC handle
  333. *
  334. * Return: None
  335. */
  336. void dp_hw_link_desc_ring_deinit(struct dp_soc *soc);
  337. /**
  338. * dp_ipa_hal_tx_init_alt_data_ring() - IPA hal init data rings
  339. * @soc: DP SOC handle
  340. *
  341. * Return: None
  342. */
  343. void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc);
  344. /*
  345. * dp_soc_reset_ring_map() - Reset cpu ring map
  346. * @soc: Datapath soc handler
  347. *
  348. * This api resets the default cpu ring map
  349. */
  350. void dp_soc_reset_cpu_ring_map(struct dp_soc *soc);
  351. /*
  352. * dp_soc_reset_ipa_vlan_intr_mask() - reset interrupt mask for IPA offloaded
  353. * ring for vlan tagged traffic
  354. * @dp_soc - DP Soc handle
  355. *
  356. * Return: Return void
  357. */
  358. void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc);
  359. /*
  360. * dp_soc_reset_intr_mask() - reset interrupt mask
  361. * @dp_soc - DP Soc handle
  362. *
  363. * Return: Return void
  364. */
  365. void dp_soc_reset_intr_mask(struct dp_soc *soc);
  366. /*
  367. * dp_reo_frag_dst_set() - configure reo register to set the
  368. * fragment destination ring
  369. * @soc : Datapath soc
  370. * @frag_dst_ring : output parameter to set fragment destination ring
  371. *
  372. * Based on offload_radio below fragment destination rings is selected
  373. * 0 - TCL
  374. * 1 - SW1
  375. * 2 - SW2
  376. * 3 - SW3
  377. * 4 - SW4
  378. * 5 - Release
  379. * 6 - FW
  380. * 7 - alternate select
  381. *
  382. * return: void
  383. */
  384. void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring);
  385. /**
  386. * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
  387. * @pdev: DP_PDEV handle
  388. *
  389. * Return: void
  390. */
  391. void
  392. dp_dscp_tid_map_setup(struct dp_pdev *pdev);
  393. /**
  394. * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
  395. * @pdev: DP_PDEV handle
  396. *
  397. * Return: void
  398. */
  399. void
  400. dp_pcp_tid_map_setup(struct dp_pdev *pdev);
  401. /**
  402. * dp_soc_deinit() - Deinitialize txrx SOC
  403. * @txrx_soc: Opaque DP SOC handle
  404. *
  405. * Return: None
  406. */
  407. void dp_soc_deinit(void *txrx_soc);
  408. #ifdef QCA_HOST2FW_RXBUF_RING
  409. void
  410. dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
  411. int lmac_id);
  412. #endif
  413. /*
  414. * dp_peer_setup_wifi3() - initialize the peer
  415. * @soc_hdl: soc handle object
  416. * @vdev_id : vdev_id of vdev object
  417. * @peer_mac: Peer's mac address
  418. * @peer_setup_info: peer setup info for MLO
  419. *
  420. * Return: QDF_STATUS
  421. */
  422. QDF_STATUS
  423. dp_peer_setup_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  424. uint8_t *peer_mac,
  425. struct cdp_peer_setup_info *setup_info);
  426. uint32_t dp_get_tx_rings_grp_bitmap(struct cdp_soc_t *soc_hdl);
  427. /*
  428. * dp_set_ba_aging_timeout() - set ba aging timeout per AC
  429. * @txrx_soc: cdp soc handle
  430. * @ac: Access category
  431. * @value: timeout value in millisec
  432. *
  433. * Return: void
  434. */
  435. void dp_set_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
  436. uint8_t ac, uint32_t value);
  437. /*
  438. * dp_get_ba_aging_timeout() - get ba aging timeout per AC
  439. * @txrx_soc: cdp soc handle
  440. * @ac: access category
  441. * @value: timeout value in millisec
  442. *
  443. * Return: void
  444. */
  445. void dp_get_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
  446. uint8_t ac, uint32_t *value);
  447. /*
  448. * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev
  449. * @txrx_soc: cdp soc handle
  450. * @pdev_id: id of physical device object
  451. * @val: reo destination ring index (1 - 4)
  452. *
  453. * Return: QDF_STATUS
  454. */
  455. QDF_STATUS
  456. dp_set_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id,
  457. enum cdp_host_reo_dest_ring val);
  458. /*
  459. * dp_get_pdev_reo_dest() - get the reo destination for this pdev
  460. * @txrx_soc: cdp soc handle
  461. * @pdev_id: id of physical device object
  462. *
  463. * Return: reo destination ring index
  464. */
  465. enum cdp_host_reo_dest_ring
  466. dp_get_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id);
  467. /**
  468. * dp_set_pdev_pcp_tid_map_wifi3(): update pcp tid map in pdev
  469. * @psoc: dp soc handle
  470. * @pdev_id: id of DP_PDEV handle
  471. * @pcp: pcp value
  472. * @tid: tid value passed by the user
  473. *
  474. * Return: QDF_STATUS_SUCCESS on success
  475. */
  476. QDF_STATUS dp_set_pdev_pcp_tid_map_wifi3(ol_txrx_soc_handle psoc,
  477. uint8_t pdev_id,
  478. uint8_t pcp, uint8_t tid);
  479. /**
  480. * dp_set_vdev_pcp_tid_map_wifi3(): update pcp tid map in vdev
  481. * @soc_hdl: DP soc handle
  482. * @vdev_id: id of DP_VDEV handle
  483. * @pcp: pcp value
  484. * @tid: tid value passed by the user
  485. *
  486. * Return: QDF_STATUS_SUCCESS on success
  487. */
  488. QDF_STATUS dp_set_vdev_pcp_tid_map_wifi3(struct cdp_soc_t *soc_hdl,
  489. uint8_t vdev_id,
  490. uint8_t pcp, uint8_t tid);
  491. /* *
  492. * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
  493. * @soc: dp soc.
  494. * @pdev: dp pdev.
  495. *
  496. * Return: None.
  497. */
  498. void
  499. dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev);
  500. /**
  501. * dp_display_srng_info() - Dump the srng HP TP info
  502. * @soc_hdl: CDP Soc handle
  503. *
  504. * This function dumps the SW hp/tp values for the important rings.
  505. * HW hp/tp values are not being dumped, since it can lead to
  506. * READ NOC error when UMAC is in low power state. MCC does not have
  507. * device force wake working yet.
  508. *
  509. * Return: rings are empty
  510. */
  511. bool dp_display_srng_info(struct cdp_soc_t *soc_hdl);
  512. #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
  513. QDF_STATUS dp_drain_txrx(struct cdp_soc_t *soc_handle, uint8_t rx_only);
  514. /*
  515. * dp_update_ring_hptp() - update dp rings hptp
  516. * @soc: dp soc handler
  517. * @force_flush_tx: force flush the Tx ring hp
  518. */
  519. void dp_update_ring_hptp(struct dp_soc *soc, bool force_flush_tx);
  520. #endif
  521. /*
  522. * dp_flush_tcl_ring() - flush TCL ring hp
  523. * @pdev: dp pdev
  524. * @ring_id: TCL ring id
  525. *
  526. * Return: 0 on success and error code on failure
  527. */
  528. int dp_flush_tcl_ring(struct dp_pdev *pdev, int ring_id);
  529. #ifdef WLAN_FEATURE_STATS_EXT
  530. /**
  531. * dp_request_rx_hw_stats - request rx hardware stats
  532. * @soc_hdl: soc handle
  533. * @vdev_id: vdev id
  534. *
  535. * Return: None
  536. */
  537. QDF_STATUS
  538. dp_request_rx_hw_stats(struct cdp_soc_t *soc_hdl, uint8_t vdev_id);
  539. #endif
  540. /**
  541. * dp_reset_rx_hw_ext_stats - Reset rx hardware ext stats
  542. * @soc_hdl: soc handle
  543. *
  544. * Return: None
  545. */
  546. void dp_reset_rx_hw_ext_stats(struct cdp_soc_t *soc_hdl);
  547. void dp_pdev_set_default_reo(struct dp_pdev *pdev);
  548. /**
  549. * dp_soc_init() - Initialize txrx SOC
  550. * @soc: Opaque DP SOC handle
  551. * @htc_handle: Opaque HTC handle
  552. * @hif_handle: Opaque HIF handle
  553. *
  554. * Return: DP SOC handle on success, NULL on failure
  555. */
  556. void *dp_soc_init(struct dp_soc *soc, HTC_HANDLE htc_handle,
  557. struct hif_opaque_softc *hif_handle);
  558. void dp_tx_init_cmd_credit_ring(struct dp_soc *soc);
  559. /**
  560. * dp_soc_srng_deinit() - de-initialize soc srng rings
  561. * @soc: Datapath soc handle
  562. *
  563. */
  564. void dp_soc_srng_deinit(struct dp_soc *soc);
  565. /**
  566. * dp_soc_srng_init() - Initialize soc level srng rings
  567. * @soc: Datapath soc handle
  568. *
  569. * return: QDF_STATUS_SUCCESS on success
  570. * QDF_STATUS_E_FAILURE on failure
  571. */
  572. QDF_STATUS dp_soc_srng_init(struct dp_soc *soc);
  573. /**
  574. * dp_soc_srng_free() - free soc level srng rings
  575. * @soc: Datapath soc handle
  576. *
  577. */
  578. void dp_soc_srng_free(struct dp_soc *soc);
  579. /**
  580. * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
  581. * @soc: Datapath soc handle
  582. *
  583. * return: QDF_STATUS_SUCCESS on success
  584. * QDF_STATUS_E_NOMEM on failure
  585. */
  586. QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc);
  587. /**
  588. * dp_soc_cfg_attach() - set target specific configuration in
  589. * dp soc cfg.
  590. * @soc: dp soc handle
  591. */
  592. void dp_soc_cfg_attach(struct dp_soc *soc);
  593. #else /* WLAN_SOFTUMAC_SUPPORT */
  594. static inline void dp_hw_link_desc_ring_free(struct dp_soc *soc)
  595. {
  596. }
  597. static inline QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc)
  598. {
  599. return QDF_STATUS_SUCCESS;
  600. }
  601. static inline QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc)
  602. {
  603. return QDF_STATUS_SUCCESS;
  604. }
  605. static inline void dp_hw_link_desc_ring_deinit(struct dp_soc *soc)
  606. {
  607. }
  608. static inline void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc)
  609. {
  610. }
  611. static inline void dp_soc_reset_cpu_ring_map(struct dp_soc *soc)
  612. {
  613. }
  614. static inline void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc)
  615. {
  616. }
  617. static inline void dp_soc_reset_intr_mask(struct dp_soc *soc)
  618. {
  619. }
  620. static inline
  621. void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring)
  622. {
  623. }
  624. /**
  625. * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
  626. * @pdev: DP_PDEV handle
  627. *
  628. * Return: void
  629. */
  630. static inline void
  631. dp_dscp_tid_map_setup(struct dp_pdev *pdev)
  632. {
  633. }
  634. /**
  635. * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
  636. * @pdev: DP_PDEV handle
  637. *
  638. * Return: void
  639. */
  640. static inline void
  641. dp_pcp_tid_map_setup(struct dp_pdev *pdev)
  642. {
  643. }
  644. #ifdef QCA_HOST2FW_RXBUF_RING
  645. static inline void
  646. dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
  647. int lmac_id)
  648. {
  649. if ((soc->cdp_soc.ol_ops->get_con_mode &&
  650. soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE) &&
  651. soc->rxdma_err_dst_ring[lmac_id].hal_srng)
  652. htt_srng_setup(soc->htt_handle, mac_id,
  653. soc->rxdma_err_dst_ring[lmac_id].hal_srng,
  654. RXDMA_DST);
  655. }
  656. #endif
  657. /* *
  658. * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
  659. * @soc: dp soc.
  660. * @pdev: dp pdev.
  661. *
  662. * Return: None.
  663. */
  664. static inline void
  665. dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev)
  666. {
  667. }
  668. static inline void dp_pdev_set_default_reo(struct dp_pdev *pdev)
  669. {
  670. }
  671. static inline void dp_tx_init_cmd_credit_ring(struct dp_soc *soc)
  672. {
  673. }
  674. /**
  675. * dp_soc_srng_deinit() - de-initialize soc srng rings
  676. * @soc: Datapath soc handle
  677. *
  678. */
  679. static inline void dp_soc_srng_deinit(struct dp_soc *soc)
  680. {
  681. }
  682. /**
  683. * dp_soc_srng_init() - Initialize soc level srng rings
  684. * @soc: Datapath soc handle
  685. *
  686. * return: QDF_STATUS_SUCCESS on success
  687. * QDF_STATUS_E_FAILURE on failure
  688. */
  689. static inline QDF_STATUS dp_soc_srng_init(struct dp_soc *soc)
  690. {
  691. dp_enable_verbose_debug(soc);
  692. return QDF_STATUS_SUCCESS;
  693. }
  694. /**
  695. * dp_soc_srng_free() - free soc level srng rings
  696. * @soc: Datapath soc handle
  697. *
  698. */
  699. static inline void dp_soc_srng_free(struct dp_soc *soc)
  700. {
  701. }
  702. /**
  703. * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
  704. * @soc: Datapath soc handle
  705. *
  706. * return: QDF_STATUS_SUCCESS on success
  707. * QDF_STATUS_E_NOMEM on failure
  708. */
  709. static inline QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc)
  710. {
  711. return QDF_STATUS_SUCCESS;
  712. }
  713. /**
  714. * dp_display_srng_info() - Dump the ring Read/Write idx info
  715. * @soc_hdl: CDP Soc handle
  716. *
  717. * This function dumps the SW Read/Write idx for the important rings.
  718. *
  719. * Return: rings are empty
  720. */
  721. static inline bool dp_display_srng_info(struct cdp_soc_t *soc_hdl)
  722. {
  723. /*TODO add support display SOFTUMAC data rings info*/
  724. return true;
  725. }
  726. #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
  727. static inline QDF_STATUS dp_drain_txrx(struct cdp_soc_t *soc_handle,
  728. uint8_t rx_only)
  729. {
  730. return QDF_STATUS_SUCCESS;
  731. }
  732. #endif
  733. #endif /* WLAN_SOFTUMAC_SUPPORT */
  734. #if defined(WLAN_FEATURE_NEAR_FULL_IRQ) && !defined(WLAN_SOFTUMAC_SUPPORT)
  735. void dp_srng_msi2_setup(struct dp_soc *soc,
  736. struct hal_srng_params *ring_params,
  737. int ring_type, int ring_num, int nf_msi_grp_num);
  738. void dp_srng_set_msi2_ring_params(struct dp_soc *soc,
  739. struct hal_srng_params *ring_params,
  740. qdf_dma_addr_t msi2_addr,
  741. uint32_t msi2_data);
  742. uint8_t *dp_srng_get_near_full_irq_mask(struct dp_soc *soc,
  743. enum hal_ring_type ring_type,
  744. int ring_num);
  745. void
  746. dp_srng_configure_nf_interrupt_thresholds(struct dp_soc *soc,
  747. struct hal_srng_params *ring_params,
  748. int ring_type);
  749. #else
  750. static inline void
  751. dp_srng_msi2_setup(struct dp_soc *soc,
  752. struct hal_srng_params *ring_params,
  753. int ring_type, int ring_num, int nf_msi_grp_num)
  754. {
  755. }
  756. static inline void
  757. dp_srng_set_msi2_ring_params(struct dp_soc *soc,
  758. struct hal_srng_params *ring_params,
  759. qdf_dma_addr_t msi2_addr,
  760. uint32_t msi2_data)
  761. {
  762. }
  763. static inline
  764. uint8_t *dp_srng_get_near_full_irq_mask(struct dp_soc *soc,
  765. enum hal_ring_type ring_type,
  766. int ring_num)
  767. {
  768. return NULL;
  769. }
  770. static inline void
  771. dp_srng_configure_nf_interrupt_thresholds(struct dp_soc *soc,
  772. struct hal_srng_params *ring_params,
  773. int ring_type)
  774. {
  775. }
  776. #endif
  777. #ifdef WLAN_SUPPORT_DPDK
  778. /*
  779. * dp_soc_reset_dpdk_intr_mask() - reset interrupt mask
  780. * @dp_soc - DP Soc handle
  781. *
  782. * Return: Return void
  783. */
  784. void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc);
  785. #else
  786. static inline void dp_soc_reset_dpdk_intr_mask(struct dp_soc *soc)
  787. { }
  788. #endif
  789. #endif /* _DP_RINGS_H_ */