dp_rings.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 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 smp_processor_id();
  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. #ifndef WLAN_SOFTUMAC_SUPPORT
  96. /**
  97. * dp_service_lmac_rings()- timer to reap lmac rings
  98. * @arg: SoC Handle
  99. *
  100. * Return:
  101. *
  102. */
  103. void dp_service_lmac_rings(void *arg);
  104. /**
  105. * dp_service_srngs() - Top level interrupt handler for DP Ring interrupts
  106. * @dp_ctx: DP SOC handle
  107. * @dp_budget: Number of frames/descriptors that can be processed in one shot
  108. * @cpu: CPU on which this instance is running
  109. *
  110. * Return: remaining budget/quota for the soc device
  111. */
  112. uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget, int cpu);
  113. /**
  114. * dp_soc_attach_poll() - Register handlers for DP interrupts
  115. * @txrx_soc: DP SOC handle
  116. *
  117. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  118. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  119. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  120. *
  121. * Return: 0 for success, nonzero for failure.
  122. */
  123. QDF_STATUS dp_soc_attach_poll(struct cdp_soc_t *txrx_soc);
  124. /**
  125. * dp_soc_interrupt_attach() - Register handlers for DP interrupts
  126. * @txrx_soc: DP SOC handle
  127. *
  128. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  129. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  130. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  131. *
  132. * Return: 0 for success. nonzero for failure.
  133. */
  134. QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc);
  135. /**
  136. * dp_hw_link_desc_ring_free() - Free h/w link desc rings
  137. * @soc: DP SOC handle
  138. *
  139. * Return: none
  140. */
  141. void dp_hw_link_desc_ring_free(struct dp_soc *soc);
  142. /**
  143. * dp_hw_link_desc_ring_alloc() - Allocate hw link desc rings
  144. * @soc: DP SOC handle
  145. *
  146. * Allocate memory for WBM_IDLE_LINK srng ring if the number of
  147. * link descriptors is less then the max_allocated size. else
  148. * allocate memory for wbm_idle_scatter_buffer.
  149. *
  150. * Return: QDF_STATUS_SUCCESS: success
  151. * QDF_STATUS_E_NO_MEM: No memory (Failure)
  152. */
  153. QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc);
  154. /**
  155. * dp_hw_link_desc_ring_init() - Initialize hw link desc rings
  156. * @soc: DP SOC handle
  157. *
  158. * Return: QDF_STATUS_SUCCESS: success
  159. * QDF_STATUS_E_FAILURE: failure
  160. */
  161. QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc);
  162. /**
  163. * dp_hw_link_desc_ring_deinit() - Reset hw link desc rings
  164. * @soc: DP SOC handle
  165. *
  166. * Return: None
  167. */
  168. void dp_hw_link_desc_ring_deinit(struct dp_soc *soc);
  169. /**
  170. * dp_ipa_hal_tx_init_alt_data_ring() - IPA hal init data rings
  171. * @soc: DP SOC handle
  172. *
  173. * Return: None
  174. */
  175. void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc);
  176. /*
  177. * dp_soc_reset_ring_map() - Reset cpu ring map
  178. * @soc: Datapath soc handler
  179. *
  180. * This api resets the default cpu ring map
  181. */
  182. void dp_soc_reset_cpu_ring_map(struct dp_soc *soc);
  183. /*
  184. * dp_soc_reset_ipa_vlan_intr_mask() - reset interrupt mask for IPA offloaded
  185. * ring for vlan tagged traffic
  186. * @dp_soc - DP Soc handle
  187. *
  188. * Return: Return void
  189. */
  190. void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc);
  191. /*
  192. * dp_soc_reset_intr_mask() - reset interrupt mask
  193. * @dp_soc - DP Soc handle
  194. *
  195. * Return: Return void
  196. */
  197. void dp_soc_reset_intr_mask(struct dp_soc *soc);
  198. /*
  199. * dp_reo_frag_dst_set() - configure reo register to set the
  200. * fragment destination ring
  201. * @soc : Datapath soc
  202. * @frag_dst_ring : output parameter to set fragment destination ring
  203. *
  204. * Based on offload_radio below fragment destination rings is selected
  205. * 0 - TCL
  206. * 1 - SW1
  207. * 2 - SW2
  208. * 3 - SW3
  209. * 4 - SW4
  210. * 5 - Release
  211. * 6 - FW
  212. * 7 - alternate select
  213. *
  214. * return: void
  215. */
  216. void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring);
  217. /**
  218. * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
  219. * @pdev: DP_PDEV handle
  220. *
  221. * Return: void
  222. */
  223. void
  224. dp_dscp_tid_map_setup(struct dp_pdev *pdev);
  225. /**
  226. * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
  227. * @pdev: DP_PDEV handle
  228. *
  229. * Return: void
  230. */
  231. void
  232. dp_pcp_tid_map_setup(struct dp_pdev *pdev);
  233. /**
  234. * dp_soc_deinit() - Deinitialize txrx SOC
  235. * @txrx_soc: Opaque DP SOC handle
  236. *
  237. * Return: None
  238. */
  239. void dp_soc_deinit(void *txrx_soc);
  240. #ifdef QCA_HOST2FW_RXBUF_RING
  241. void
  242. dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
  243. int lmac_id);
  244. #endif
  245. /*
  246. * dp_peer_setup_wifi3() - initialize the peer
  247. * @soc_hdl: soc handle object
  248. * @vdev_id : vdev_id of vdev object
  249. * @peer_mac: Peer's mac address
  250. * @peer_setup_info: peer setup info for MLO
  251. *
  252. * Return: QDF_STATUS
  253. */
  254. QDF_STATUS
  255. dp_peer_setup_wifi3(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  256. uint8_t *peer_mac,
  257. struct cdp_peer_setup_info *setup_info);
  258. uint32_t dp_get_tx_rings_grp_bitmap(struct cdp_soc_t *soc_hdl);
  259. /*
  260. * dp_set_ba_aging_timeout() - set ba aging timeout per AC
  261. * @txrx_soc: cdp soc handle
  262. * @ac: Access category
  263. * @value: timeout value in millisec
  264. *
  265. * Return: void
  266. */
  267. void dp_set_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
  268. uint8_t ac, uint32_t value);
  269. /*
  270. * dp_get_ba_aging_timeout() - get ba aging timeout per AC
  271. * @txrx_soc: cdp soc handle
  272. * @ac: access category
  273. * @value: timeout value in millisec
  274. *
  275. * Return: void
  276. */
  277. void dp_get_ba_aging_timeout(struct cdp_soc_t *txrx_soc,
  278. uint8_t ac, uint32_t *value);
  279. /*
  280. * dp_set_pdev_reo_dest() - set the reo destination ring for this pdev
  281. * @txrx_soc: cdp soc handle
  282. * @pdev_id: id of physical device object
  283. * @val: reo destination ring index (1 - 4)
  284. *
  285. * Return: QDF_STATUS
  286. */
  287. QDF_STATUS
  288. dp_set_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id,
  289. enum cdp_host_reo_dest_ring val);
  290. /*
  291. * dp_get_pdev_reo_dest() - get the reo destination for this pdev
  292. * @txrx_soc: cdp soc handle
  293. * @pdev_id: id of physical device object
  294. *
  295. * Return: reo destination ring index
  296. */
  297. enum cdp_host_reo_dest_ring
  298. dp_get_pdev_reo_dest(struct cdp_soc_t *txrx_soc, uint8_t pdev_id);
  299. /**
  300. * dp_set_pdev_pcp_tid_map_wifi3(): update pcp tid map in pdev
  301. * @psoc: dp soc handle
  302. * @pdev_id: id of DP_PDEV handle
  303. * @pcp: pcp value
  304. * @tid: tid value passed by the user
  305. *
  306. * Return: QDF_STATUS_SUCCESS on success
  307. */
  308. QDF_STATUS dp_set_pdev_pcp_tid_map_wifi3(ol_txrx_soc_handle psoc,
  309. uint8_t pdev_id,
  310. uint8_t pcp, uint8_t tid);
  311. /**
  312. * dp_set_vdev_pcp_tid_map_wifi3(): update pcp tid map in vdev
  313. * @soc_hdl: DP soc handle
  314. * @vdev_id: id of DP_VDEV handle
  315. * @pcp: pcp value
  316. * @tid: tid value passed by the user
  317. *
  318. * Return: QDF_STATUS_SUCCESS on success
  319. */
  320. QDF_STATUS dp_set_vdev_pcp_tid_map_wifi3(struct cdp_soc_t *soc_hdl,
  321. uint8_t vdev_id,
  322. uint8_t pcp, uint8_t tid);
  323. /* *
  324. * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
  325. * @soc: dp soc.
  326. * @pdev: dp pdev.
  327. *
  328. * Return: None.
  329. */
  330. void
  331. dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev);
  332. /**
  333. * dp_display_srng_info() - Dump the srng HP TP info
  334. * @soc_hdl: CDP Soc handle
  335. *
  336. * This function dumps the SW hp/tp values for the important rings.
  337. * HW hp/tp values are not being dumped, since it can lead to
  338. * READ NOC error when UMAC is in low power state. MCC does not have
  339. * device force wake working yet.
  340. *
  341. * Return: none
  342. */
  343. void dp_display_srng_info(struct cdp_soc_t *soc_hdl);
  344. #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
  345. void dp_drain_txrx(struct cdp_soc_t *soc_handle);
  346. /*
  347. * dp_update_ring_hptp() - update dp rings hptp
  348. * @soc: dp soc handler
  349. * @force_flush_tx: force flush the Tx ring hp
  350. */
  351. void dp_update_ring_hptp(struct dp_soc *soc, bool force_flush_tx);
  352. #endif
  353. #ifdef WLAN_FEATURE_STATS_EXT
  354. /**
  355. * dp_request_rx_hw_stats - request rx hardware stats
  356. * @soc_hdl: soc handle
  357. * @vdev_id: vdev id
  358. *
  359. * Return: None
  360. */
  361. QDF_STATUS
  362. dp_request_rx_hw_stats(struct cdp_soc_t *soc_hdl, uint8_t vdev_id);
  363. #endif
  364. /**
  365. * dp_reset_rx_hw_ext_stats - Reset rx hardware ext stats
  366. * @soc_hdl: soc handle
  367. *
  368. * Return: None
  369. */
  370. void dp_reset_rx_hw_ext_stats(struct cdp_soc_t *soc_hdl);
  371. void dp_pdev_set_default_reo(struct dp_pdev *pdev);
  372. /**
  373. * dp_soc_init() - Initialize txrx SOC
  374. * @soc: Opaque DP SOC handle
  375. * @htc_handle: Opaque HTC handle
  376. * @hif_handle: Opaque HIF handle
  377. *
  378. * Return: DP SOC handle on success, NULL on failure
  379. */
  380. void *dp_soc_init(struct dp_soc *soc, HTC_HANDLE htc_handle,
  381. struct hif_opaque_softc *hif_handle);
  382. void dp_tx_init_cmd_credit_ring(struct dp_soc *soc);
  383. /**
  384. * dp_soc_srng_deinit() - de-initialize soc srng rings
  385. * @soc: Datapath soc handle
  386. *
  387. */
  388. void dp_soc_srng_deinit(struct dp_soc *soc);
  389. /**
  390. * dp_soc_srng_init() - Initialize soc level srng rings
  391. * @soc: Datapath soc handle
  392. *
  393. * return: QDF_STATUS_SUCCESS on success
  394. * QDF_STATUS_E_FAILURE on failure
  395. */
  396. QDF_STATUS dp_soc_srng_init(struct dp_soc *soc);
  397. /**
  398. * dp_soc_srng_free() - free soc level srng rings
  399. * @soc: Datapath soc handle
  400. *
  401. */
  402. void dp_soc_srng_free(struct dp_soc *soc);
  403. /**
  404. * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
  405. * @soc: Datapath soc handle
  406. *
  407. * return: QDF_STATUS_SUCCESS on success
  408. * QDF_STATUS_E_NOMEM on failure
  409. */
  410. QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc);
  411. /**
  412. * dp_soc_cfg_attach() - set target specific configuration in
  413. * dp soc cfg.
  414. * @soc: dp soc handle
  415. */
  416. void dp_soc_cfg_attach(struct dp_soc *soc);
  417. /**
  418. * dp_soc_set_interrupt_mode() - Set the interrupt mode in soc
  419. * @soc: DP soc handle
  420. *
  421. * Set the appropriate interrupt mode flag in the soc
  422. */
  423. void dp_soc_set_interrupt_mode(struct dp_soc *soc);
  424. #else /* WLAN_SOFTUMAC_SUPPORT */
  425. static inline void dp_service_lmac_rings(void *arg)
  426. {
  427. }
  428. static inline
  429. uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget, int cpu)
  430. {
  431. return 0;
  432. }
  433. static inline void dp_soc_interrupt_detach(struct cdp_soc_t *txrx_soc)
  434. {
  435. struct dp_soc *soc = (struct dp_soc *)txrx_soc;
  436. if (soc->intr_mode == DP_INTR_POLL)
  437. qdf_timer_free(&soc->int_timer);
  438. qdf_mem_set(&soc->mon_intr_id_lmac_map,
  439. sizeof(soc->mon_intr_id_lmac_map),
  440. DP_MON_INVALID_LMAC_ID);
  441. }
  442. /*
  443. * dp_soc_interrupt_attach() - Register handlers for DP interrupts
  444. * @txrx_soc: DP SOC handle
  445. *
  446. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  447. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  448. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  449. *
  450. * Return: 0 for success. nonzero for failure.
  451. */
  452. static inline QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc)
  453. {
  454. struct dp_soc *soc = (struct dp_soc *)txrx_soc;
  455. qdf_mem_set(&soc->mon_intr_id_lmac_map,
  456. sizeof(soc->mon_intr_id_lmac_map),
  457. DP_MON_INVALID_LMAC_ID);
  458. return QDF_STATUS_SUCCESS;
  459. }
  460. static inline void dp_hw_link_desc_ring_free(struct dp_soc *soc)
  461. {
  462. }
  463. static inline QDF_STATUS dp_hw_link_desc_ring_alloc(struct dp_soc *soc)
  464. {
  465. return QDF_STATUS_SUCCESS;
  466. }
  467. static inline QDF_STATUS dp_hw_link_desc_ring_init(struct dp_soc *soc)
  468. {
  469. return QDF_STATUS_SUCCESS;
  470. }
  471. static inline void dp_hw_link_desc_ring_deinit(struct dp_soc *soc)
  472. {
  473. }
  474. static inline void dp_ipa_hal_tx_init_alt_data_ring(struct dp_soc *soc)
  475. {
  476. }
  477. static inline void dp_soc_reset_cpu_ring_map(struct dp_soc *soc)
  478. {
  479. }
  480. static inline void dp_soc_reset_ipa_vlan_intr_mask(struct dp_soc *soc)
  481. {
  482. }
  483. static inline void dp_soc_reset_intr_mask(struct dp_soc *soc)
  484. {
  485. }
  486. static inline
  487. void dp_reo_frag_dst_set(struct dp_soc *soc, uint8_t *frag_dst_ring)
  488. {
  489. }
  490. /**
  491. * dp_dscp_tid_map_setup(): Initialize the dscp-tid maps
  492. * @pdev: DP_PDEV handle
  493. *
  494. * Return: void
  495. */
  496. static inline void
  497. dp_dscp_tid_map_setup(struct dp_pdev *pdev)
  498. {
  499. }
  500. /**
  501. * dp_pcp_tid_map_setup(): Initialize the pcp-tid maps
  502. * @pdev: DP_PDEV handle
  503. *
  504. * Return: void
  505. */
  506. static inline void
  507. dp_pcp_tid_map_setup(struct dp_pdev *pdev)
  508. {
  509. }
  510. #ifdef QCA_HOST2FW_RXBUF_RING
  511. static inline void
  512. dp_htt_setup_rxdma_err_dst_ring(struct dp_soc *soc, int mac_id,
  513. int lmac_id)
  514. {
  515. }
  516. #endif
  517. /* *
  518. * dp_dump_wbm_idle_hptp() -dump wbm idle ring, hw hp tp info.
  519. * @soc: dp soc.
  520. * @pdev: dp pdev.
  521. *
  522. * Return: None.
  523. */
  524. static inline void
  525. dp_dump_wbm_idle_hptp(struct dp_soc *soc, struct dp_pdev *pdev)
  526. {
  527. }
  528. static inline void dp_pdev_set_default_reo(struct dp_pdev *pdev)
  529. {
  530. }
  531. static inline void dp_tx_init_cmd_credit_ring(struct dp_soc *soc)
  532. {
  533. }
  534. /**
  535. * dp_soc_srng_deinit() - de-initialize soc srng rings
  536. * @soc: Datapath soc handle
  537. *
  538. */
  539. static inline void dp_soc_srng_deinit(struct dp_soc *soc)
  540. {
  541. }
  542. /**
  543. * dp_soc_srng_init() - Initialize soc level srng rings
  544. * @soc: Datapath soc handle
  545. *
  546. * return: QDF_STATUS_SUCCESS on success
  547. * QDF_STATUS_E_FAILURE on failure
  548. */
  549. static inline QDF_STATUS dp_soc_srng_init(struct dp_soc *soc)
  550. {
  551. dp_enable_verbose_debug(soc);
  552. return QDF_STATUS_SUCCESS;
  553. }
  554. /**
  555. * dp_soc_srng_free() - free soc level srng rings
  556. * @soc: Datapath soc handle
  557. *
  558. */
  559. static inline void dp_soc_srng_free(struct dp_soc *soc)
  560. {
  561. }
  562. /**
  563. * dp_soc_srng_alloc() - Allocate memory for soc level srng rings
  564. * @soc: Datapath soc handle
  565. *
  566. * return: QDF_STATUS_SUCCESS on success
  567. * QDF_STATUS_E_NOMEM on failure
  568. */
  569. static inline QDF_STATUS dp_soc_srng_alloc(struct dp_soc *soc)
  570. {
  571. return QDF_STATUS_SUCCESS;
  572. }
  573. /*
  574. * dp_soc_attach_poll() - Register handlers for DP interrupts
  575. * @txrx_soc: DP SOC handle
  576. *
  577. * Host driver will register for “DP_NUM_INTERRUPT_CONTEXTS” number of NAPI
  578. * contexts. Each NAPI context will have a tx_ring_mask , rx_ring_mask ,and
  579. * rx_monitor_ring mask to indicate the rings that are processed by the handler.
  580. *
  581. * Return: 0 for success, nonzero for failure.
  582. */
  583. static inline QDF_STATUS dp_soc_attach_poll(struct cdp_soc_t *txrx_soc)
  584. {
  585. struct dp_soc *soc = (struct dp_soc *)txrx_soc;
  586. uint32_t lmac_id = 0;
  587. int i;
  588. qdf_mem_set(&soc->mon_intr_id_lmac_map,
  589. sizeof(soc->mon_intr_id_lmac_map), DP_MON_INVALID_LMAC_ID);
  590. soc->intr_mode = DP_INTR_POLL;
  591. for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) {
  592. soc->intr_ctx[i].rx_mon_ring_mask =
  593. wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, i);
  594. if (dp_is_mon_mask_valid(soc, &soc->intr_ctx[i])) {
  595. hif_event_history_init(soc->hif_handle, i);
  596. soc->mon_intr_id_lmac_map[lmac_id] = i;
  597. lmac_id++;
  598. }
  599. }
  600. qdf_timer_init(soc->osdev, &soc->int_timer,
  601. dp_interrupt_timer, (void *)soc,
  602. QDF_TIMER_TYPE_WAKE_APPS);
  603. return QDF_STATUS_SUCCESS;
  604. }
  605. static inline void dp_soc_set_interrupt_mode(struct dp_soc *soc)
  606. {
  607. soc->intr_mode = DP_INTR_INTEGRATED;
  608. if (!(soc->wlan_cfg_ctx->napi_enabled) ||
  609. (dp_is_monitor_mode_using_poll(soc) &&
  610. soc->cdp_soc.ol_ops->get_con_mode &&
  611. soc->cdp_soc.ol_ops->get_con_mode() == QDF_GLOBAL_MONITOR_MODE)) {
  612. soc->intr_mode = DP_INTR_POLL;
  613. } else {
  614. soc->intr_mode = DP_INTR_MSI;
  615. }
  616. }
  617. /**
  618. * dp_display_srng_info() - Dump the ring Read/Write idx info
  619. * @soc_hdl: CDP Soc handle
  620. *
  621. * This function dumps the SW Read/Write idx for the important rings.
  622. *
  623. * Return: none
  624. */
  625. static inline void dp_display_srng_info(struct cdp_soc_t *soc_hdl)
  626. {
  627. /*TODO add support display SOFTUMAC data rings info*/
  628. }
  629. #if defined(DP_POWER_SAVE) || defined(FEATURE_RUNTIME_PM)
  630. static inline void dp_drain_txrx(struct cdp_soc_t *soc_handle)
  631. {
  632. }
  633. #endif
  634. #endif /* WLAN_SOFTUMAC_SUPPORT */
  635. #endif /* _DP_RINGS_H_ */