dp_ipa.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. /*
  2. * Copyright (c) 2017-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 any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _DP_IPA_H_
  18. #define _DP_IPA_H_
  19. #if defined(QCA_WIFI_KIWI) || defined(QCA_WIFI_KIWI_V2)
  20. /* Index into soc->tcl_data_ring[] */
  21. #define IPA_TCL_DATA_RING_IDX 3
  22. #else
  23. #define IPA_TCL_DATA_RING_IDX 2
  24. #endif
  25. /* Index into soc->tx_comp_ring[] */
  26. #define IPA_TX_COMP_RING_IDX IPA_TCL_DATA_RING_IDX
  27. #ifdef IPA_OFFLOAD
  28. #define DP_IPA_MAX_IFACE 3
  29. #define IPA_REO_DEST_RING_IDX 3
  30. #define IPA_REO_DEST_RING_IDX_2 7
  31. #define IPA_RX_REFILL_BUF_RING_IDX 2
  32. #define IPA_ALT_REO_DEST_RING_IDX 2
  33. #define IPA_RX_ALT_REFILL_BUF_RING_IDX 3
  34. /* Adding delay before disabling ipa pipes if any Tx Completions are pending */
  35. #define TX_COMP_DRAIN_WAIT_MS 50
  36. #define TX_COMP_DRAIN_WAIT_TIMEOUT_MS 100
  37. #ifdef IPA_WDI3_TX_TWO_PIPES
  38. #if defined(QCA_WIFI_KIWI) || defined(QCA_WIFI_KIWI_V2)
  39. /* Index into soc->tcl_data_ring[] and soc->tx_comp_ring[] */
  40. #define IPA_TX_ALT_RING_IDX 4
  41. #define IPA_TX_ALT_COMP_RING_IDX IPA_TX_ALT_RING_IDX
  42. #elif defined(QCA_WIFI_QCN9224)
  43. #define IPA_TX_ALT_RING_IDX 3
  44. #define IPA_TX_ALT_COMP_RING_IDX IPA_TX_ALT_RING_IDX
  45. #else /* !KIWI */
  46. #define IPA_TX_ALT_RING_IDX 1
  47. /*
  48. * must be same as IPA_TX_ALT_RING_IDX as tcl and wbm ring
  49. * are initialized with same index as a pair.
  50. */
  51. #define IPA_TX_ALT_COMP_RING_IDX 1
  52. #endif /* KIWI */
  53. #define IPA_SESSION_ID_SHIFT 1
  54. #endif /* IPA_WDI3_TX_TWO_PIPES */
  55. /**
  56. * struct dp_ipa_uc_tx_hdr - full tx header registered to IPA hardware
  57. * @eth: ether II header
  58. */
  59. struct dp_ipa_uc_tx_hdr {
  60. struct ethhdr eth;
  61. } __packed;
  62. /**
  63. * struct dp_ipa_uc_tx_vlan_hdr - full tx header registered to IPA hardware
  64. * @eth: ether II header
  65. */
  66. struct dp_ipa_uc_tx_vlan_hdr {
  67. struct vlan_ethhdr eth;
  68. } __packed;
  69. /**
  70. * struct dp_ipa_uc_rx_hdr - full rx header registered to IPA hardware
  71. * @eth: ether II header
  72. */
  73. struct dp_ipa_uc_rx_hdr {
  74. struct ethhdr eth;
  75. } __packed;
  76. #define DP_IPA_UC_WLAN_TX_HDR_LEN sizeof(struct dp_ipa_uc_tx_hdr)
  77. #define DP_IPA_UC_WLAN_TX_VLAN_HDR_LEN sizeof(struct dp_ipa_uc_tx_vlan_hdr)
  78. #define DP_IPA_UC_WLAN_RX_HDR_LEN sizeof(struct dp_ipa_uc_rx_hdr)
  79. /* 28 <bytes of rx_msdu_end_tlv> + 16 <bytes of attn tlv> +
  80. * 52 <bytes of rx_mpdu_start_tlv> + <L2 Header>
  81. */
  82. #define DP_IPA_UC_WLAN_RX_HDR_LEN_AST 110
  83. #define DP_IPA_UC_WLAN_RX_HDR_LEN_AST_VLAN 114
  84. #define DP_IPA_UC_WLAN_HDR_DES_MAC_OFFSET 0
  85. #define DP_IPA_HDL_INVALID 0xFF
  86. #define DP_IPA_HDL_FIRST 0
  87. #define DP_IPA_HDL_SECOND 1
  88. #define DP_IPA_HDL_THIRD 2
  89. /**
  90. * wlan_ipa_get_hdl() - Get ipa handle from IPA component
  91. * @psoc: control psoc object
  92. * @pdev_id: pdev id
  93. *
  94. * IPA component will return the IPA handle based on pdev_id
  95. *
  96. * Return: IPA handle
  97. */
  98. qdf_ipa_wdi_hdl_t wlan_ipa_get_hdl(void *psoc, uint8_t pdev_id);
  99. /**
  100. * dp_ipa_get_resource() - Client request resource information
  101. * @soc_hdl: data path soc handle
  102. * @pdev_id: device instance id
  103. *
  104. * IPA client will request IPA UC related resource information
  105. * Resource information will be distributed to IPA module
  106. * All of the required resources should be pre-allocated
  107. *
  108. * Return: QDF_STATUS
  109. */
  110. QDF_STATUS dp_ipa_get_resource(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  111. /**
  112. * dp_ipa_set_doorbell_paddr() - Set doorbell register physical address to SRNG
  113. * @soc_hdl: data path soc handle
  114. * @pdev_id: device instance id
  115. *
  116. * Set TX_COMP_DOORBELL register physical address to WBM Head_Ptr_MemAddr_LSB
  117. * Set RX_READ_DOORBELL register physical address to REO Head_Ptr_MemAddr_LSB
  118. *
  119. * Return: QDF_STATUS
  120. */
  121. QDF_STATUS dp_ipa_set_doorbell_paddr(struct cdp_soc_t *soc_hdl,
  122. uint8_t pdev_id);
  123. /**
  124. * dp_ipa_iounmap_doorbell_vaddr() - unmap ipa RX db vaddr
  125. * @soc_hdl: data path soc handle
  126. * @pdev_id: device instance id
  127. *
  128. * Return: QDF_STATUS
  129. */
  130. QDF_STATUS dp_ipa_iounmap_doorbell_vaddr(struct cdp_soc_t *soc_hdl,
  131. uint8_t pdev_id);
  132. /**
  133. * dp_ipa_op_response() - Handle OP command response from firmware
  134. * @soc_hdl: data path soc handle
  135. * @pdev_id: device instance id
  136. * @op_msg: op response message from firmware
  137. *
  138. * Return: QDF_STATUS
  139. */
  140. QDF_STATUS dp_ipa_op_response(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  141. uint8_t *op_msg);
  142. /**
  143. * dp_ipa_register_op_cb() - Register OP handler function
  144. * @soc_hdl: data path soc handle
  145. * @pdev_id: device instance id
  146. * @op_cb: handler function pointer
  147. * @usr_ctxt: user context passed back to handler function
  148. *
  149. * Return: QDF_STATUS
  150. */
  151. QDF_STATUS dp_ipa_register_op_cb(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  152. ipa_uc_op_cb_type op_cb, void *usr_ctxt);
  153. /**
  154. * dp_ipa_deregister_op_cb() - Deregister OP handler function
  155. * @soc_hdl: data path soc handle
  156. * @pdev_id: device instance id
  157. *
  158. * Return: none
  159. */
  160. void dp_ipa_deregister_op_cb(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  161. /**
  162. * dp_ipa_get_stat() - Get firmware wdi status
  163. * @soc_hdl: data path soc handle
  164. * @pdev_id: device instance id
  165. *
  166. * Return: QDF_STATUS
  167. */
  168. QDF_STATUS dp_ipa_get_stat(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  169. /**
  170. * dp_tx_send_ipa_data_frame() - send IPA data frame
  171. * @soc_hdl: datapath soc handle
  172. * @vdev_id: virtual device/interface id
  173. * @skb: skb
  174. *
  175. * Return: skb/ NULL is for success
  176. */
  177. qdf_nbuf_t dp_tx_send_ipa_data_frame(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  178. qdf_nbuf_t skb);
  179. /**
  180. * dp_ipa_enable_autonomy() - Enable autonomy RX path
  181. * @soc_hdl: data path soc handle
  182. * @pdev_id: device instance id
  183. *
  184. * Set all RX packet route to IPA REO ring
  185. * Program Destination_Ring_Ctrl_IX_0 REO register to point IPA REO ring
  186. *
  187. * Return: QDF_STATUS
  188. */
  189. QDF_STATUS dp_ipa_enable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  190. /**
  191. * dp_ipa_disable_autonomy() - Disable autonomy RX path
  192. * @soc_hdl: data path soc handle
  193. * @pdev_id: device instance id
  194. *
  195. * Disable RX packet routing to IPA REO
  196. * Program Destination_Ring_Ctrl_IX_0 REO register to disable
  197. *
  198. * Return: QDF_STATUS
  199. */
  200. QDF_STATUS dp_ipa_disable_autonomy(struct cdp_soc_t *soc_hdl, uint8_t pdev_id);
  201. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
  202. defined(CONFIG_IPA_WDI_UNIFIED_API)
  203. /**
  204. * dp_ipa_setup() - Setup and connect IPA pipes
  205. * @soc_hdl: data path soc handle
  206. * @pdev_id: device instance id
  207. * @ipa_i2w_cb: IPA to WLAN callback
  208. * @ipa_w2i_cb: WLAN to IPA callback
  209. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  210. * @ipa_desc_size: IPA descriptor size
  211. * @ipa_priv: handle to the HTT instance
  212. * @is_rm_enabled: Is IPA RM enabled or not
  213. * @tx_pipe_handle: pointer to Tx pipe handle
  214. * @rx_pipe_handle: pointer to Rx pipe handle
  215. * @is_smmu_enabled: Is SMMU enabled or not
  216. * @sys_in: parameters to setup sys pipe in mcc mode
  217. * @over_gsi:
  218. * @hdl: IPA handle
  219. * @id: IPA instance id
  220. * @ipa_ast_notify_cb: IPA to WLAN callback for ast create and update
  221. *
  222. * Return: QDF_STATUS
  223. */
  224. QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  225. void *ipa_i2w_cb, void *ipa_w2i_cb,
  226. void *ipa_wdi_meter_notifier_cb,
  227. uint32_t ipa_desc_size, void *ipa_priv,
  228. bool is_rm_enabled, uint32_t *tx_pipe_handle,
  229. uint32_t *rx_pipe_handle,
  230. bool is_smmu_enabled,
  231. qdf_ipa_sys_connect_params_t *sys_in, bool over_gsi,
  232. qdf_ipa_wdi_hdl_t hdl, qdf_ipa_wdi_hdl_t id,
  233. void *ipa_ast_notify_cb);
  234. #else /* CONFIG_IPA_WDI_UNIFIED_API */
  235. /**
  236. * dp_ipa_setup() - Setup and connect IPA pipes
  237. * @soc_hdl: data path soc handle
  238. * @pdev_id: device instance id
  239. * @ipa_i2w_cb: IPA to WLAN callback
  240. * @ipa_w2i_cb: WLAN to IPA callback
  241. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  242. * @ipa_desc_size: IPA descriptor size
  243. * @ipa_priv: handle to the HTT instance
  244. * @is_rm_enabled: Is IPA RM enabled or not
  245. * @tx_pipe_handle: pointer to Tx pipe handle
  246. * @rx_pipe_handle: pointer to Rx pipe handle
  247. *
  248. * Return: QDF_STATUS
  249. */
  250. QDF_STATUS dp_ipa_setup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  251. void *ipa_i2w_cb, void *ipa_w2i_cb,
  252. void *ipa_wdi_meter_notifier_cb,
  253. uint32_t ipa_desc_size, void *ipa_priv,
  254. bool is_rm_enabled, uint32_t *tx_pipe_handle,
  255. uint32_t *rx_pipe_handle);
  256. #endif /* CONFIG_IPA_WDI_UNIFIED_API */
  257. /**
  258. * dp_ipa_cleanup() - Disconnect IPA pipes
  259. * @soc_hdl: dp soc handle
  260. * @pdev_id: dp pdev id
  261. * @tx_pipe_handle: Tx pipe handle
  262. * @rx_pipe_handle: Rx pipe handle
  263. * @hdl: IPA handle
  264. *
  265. * Return: QDF_STATUS
  266. */
  267. QDF_STATUS dp_ipa_cleanup(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  268. uint32_t tx_pipe_handle, uint32_t rx_pipe_handle,
  269. qdf_ipa_wdi_hdl_t hdl);
  270. /**
  271. * dp_ipa_setup_iface() - Setup IPA header and register interface
  272. * @ifname: Interface name
  273. * @mac_addr: Interface MAC address
  274. * @prod_client: IPA prod client type
  275. * @cons_client: IPA cons client type
  276. * @session_id: Session ID
  277. * @is_ipv6_enabled: Is IPV6 enabled or not
  278. * @hdl: IPA handle
  279. *
  280. * Return: QDF_STATUS
  281. */
  282. QDF_STATUS dp_ipa_setup_iface(char *ifname, uint8_t *mac_addr,
  283. qdf_ipa_client_type_t prod_client,
  284. qdf_ipa_client_type_t cons_client,
  285. uint8_t session_id, bool is_ipv6_enabled,
  286. qdf_ipa_wdi_hdl_t hdl);
  287. /**
  288. * dp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
  289. * @ifname: Interface name
  290. * @is_ipv6_enabled: Is IPV6 enabled or not
  291. * @hdl: IPA handle
  292. *
  293. * Return: QDF_STATUS
  294. */
  295. QDF_STATUS dp_ipa_cleanup_iface(char *ifname, bool is_ipv6_enabled,
  296. qdf_ipa_wdi_hdl_t hdl);
  297. /**
  298. * dp_ipa_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  299. * @soc_hdl: handle to the soc
  300. * @pdev_id: pdev id number, to get the handle
  301. * @hdl: IPA handle
  302. *
  303. * Return: QDF_STATUS
  304. */
  305. QDF_STATUS dp_ipa_enable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  306. qdf_ipa_wdi_hdl_t hdl);
  307. /**
  308. * dp_ipa_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  309. * @soc_hdl: handle to the soc
  310. * @pdev_id: pdev id number, to get the handle
  311. * @hdl: IPA handle
  312. *
  313. * Return: QDF_STATUS
  314. */
  315. QDF_STATUS dp_ipa_disable_pipes(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
  316. qdf_ipa_wdi_hdl_t hdl);
  317. /**
  318. * dp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
  319. * @client: Client type
  320. * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
  321. * @hdl: IPA handle
  322. *
  323. * Return: QDF_STATUS
  324. */
  325. QDF_STATUS dp_ipa_set_perf_level(int client, uint32_t max_supported_bw_mbps,
  326. qdf_ipa_wdi_hdl_t hdl);
  327. #ifdef IPA_OPT_WIFI_DP
  328. QDF_STATUS dp_ipa_rx_super_rule_setup(struct cdp_soc_t *soc_hdl,
  329. void *flt_params);
  330. int dp_ipa_pcie_link_up(struct cdp_soc_t *soc_hdl);
  331. void dp_ipa_pcie_link_down(struct cdp_soc_t *soc_hdl);
  332. #endif
  333. #ifdef QCA_SUPPORT_WDS_EXTENDED
  334. /**
  335. * dp_ipa_rx_wdsext_iface() - Forward RX exception packets to wdsext interface
  336. * @soc_hdl: data path SoC handle
  337. * @peer_id: Peer ID to get respective peer
  338. * @skb: socket buffer
  339. *
  340. * Return: bool
  341. */
  342. bool dp_ipa_rx_wdsext_iface(struct cdp_soc_t *soc_hdl, uint8_t peer_id,
  343. qdf_nbuf_t skb);
  344. #endif
  345. /**
  346. * dp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
  347. *
  348. * @soc_hdl: data path soc handle
  349. * @vdev_id: virtual device/interface id
  350. * @nbuf: pointer to skb of ethernet packet received from IPA RX path
  351. * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
  352. *
  353. * This function performs intra-bss forwarding for WDI 3.0 IPA RX path.
  354. *
  355. * Return: true if packet is intra-bss fwd-ed and no need to pass to
  356. * network stack. false if packet needs to be passed to network stack.
  357. */
  358. bool dp_ipa_rx_intrabss_fwd(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  359. qdf_nbuf_t nbuf, bool *fwd_success);
  360. int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev);
  361. int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev);
  362. /**
  363. * dp_ipa_ring_resource_setup() - setup IPA ring resources
  364. * @soc: data path SoC handle
  365. * @pdev:
  366. *
  367. * Return: status
  368. */
  369. int dp_ipa_ring_resource_setup(struct dp_soc *soc,
  370. struct dp_pdev *pdev);
  371. bool dp_reo_remap_config(struct dp_soc *soc, uint32_t *remap0,
  372. uint32_t *remap1, uint32_t *remap2);
  373. bool dp_ipa_is_mdm_platform(void);
  374. /**
  375. * dp_ipa_handle_rx_reo_reinject() - Handle RX REO reinject skb buffer
  376. * @soc: soc
  377. * @nbuf: skb
  378. *
  379. * Return: nbuf if success and otherwise NULL
  380. */
  381. qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc, qdf_nbuf_t nbuf);
  382. QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
  383. qdf_nbuf_t nbuf,
  384. uint32_t size,
  385. bool create,
  386. const char *func,
  387. uint32_t line);
  388. /**
  389. * dp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for IPA
  390. * allocated TX buffers
  391. * @soc_hdl: handle to the soc
  392. * @pdev_id: pdev id number, to get the handle
  393. * @func: caller function
  394. * @line: line number
  395. *
  396. * Return: QDF_STATUS
  397. */
  398. QDF_STATUS dp_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
  399. uint8_t pdev_id, const char *func,
  400. uint32_t line);
  401. /**
  402. * dp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for IPA
  403. * allocated TX buffers
  404. * @soc_hdl: handle to the soc
  405. * @pdev_id: pdev id number, to get the handle
  406. * @func: caller function
  407. * @line: line number
  408. *
  409. * Return: QDF_STATUS
  410. */
  411. QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
  412. uint8_t pdev_id, const char *func,
  413. uint32_t line);
  414. QDF_STATUS dp_ipa_rx_buf_pool_smmu_mapping(struct cdp_soc_t *soc_hdl,
  415. uint8_t pdev_id,
  416. bool create,
  417. const char *func,
  418. uint32_t line);
  419. QDF_STATUS dp_ipa_set_smmu_mapped(struct cdp_soc_t *soc, int val);
  420. int dp_ipa_get_smmu_mapped(struct cdp_soc_t *soc);
  421. #ifndef QCA_OL_DP_SRNG_LOCK_LESS_ACCESS
  422. static inline void
  423. dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
  424. {
  425. if (soc->ipa_rx_buf_map_lock_initialized)
  426. qdf_spin_lock_bh(&soc->ipa_rx_buf_map_lock);
  427. }
  428. static inline void
  429. dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
  430. {
  431. if (soc->ipa_rx_buf_map_lock_initialized)
  432. qdf_spin_unlock_bh(&soc->ipa_rx_buf_map_lock);
  433. }
  434. static inline void
  435. dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
  436. uint32_t reo_ring_num)
  437. {
  438. if (!soc->ipa_reo_ctx_lock_required[reo_ring_num])
  439. return;
  440. qdf_spin_lock_bh(&soc->ipa_rx_buf_map_lock);
  441. }
  442. static inline void
  443. dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
  444. uint32_t reo_ring_num)
  445. {
  446. if (!soc->ipa_reo_ctx_lock_required[reo_ring_num])
  447. return;
  448. qdf_spin_unlock_bh(&soc->ipa_rx_buf_map_lock);
  449. }
  450. #else
  451. static inline void
  452. dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
  453. {
  454. }
  455. static inline void
  456. dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
  457. {
  458. }
  459. static inline void
  460. dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
  461. uint32_t reo_ring_num)
  462. {
  463. }
  464. static inline void
  465. dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
  466. uint32_t reo_ring_num)
  467. {
  468. }
  469. #endif
  470. #ifdef IPA_WDS_EASYMESH_FEATURE
  471. /**
  472. * dp_ipa_ast_create() - Create/update AST entry in AST table
  473. * for learning/roaming packets from IPA
  474. * @soc_hdl: data path soc handle
  475. * @data: Structure used for updating the AST table
  476. *
  477. * Create/update AST entry in AST table for learning/roaming packets from IPA
  478. *
  479. * Return: QDF_STATUS
  480. */
  481. QDF_STATUS dp_ipa_ast_create(struct cdp_soc_t *soc_hdl,
  482. qdf_ipa_ast_info_type_t *data);
  483. /**
  484. * dp_ipa_ast_notify_cb() - Provide ast notify cb to IPA
  485. * @pipe_in: WDI conn pipe in params
  486. * @ipa_ast_notify_cb: ipa ast notify cb
  487. *
  488. * Return: None
  489. */
  490. static inline void
  491. dp_ipa_ast_notify_cb(qdf_ipa_wdi_conn_in_params_t *pipe_in,
  492. void *ipa_ast_notify_cb)
  493. {
  494. QDF_IPA_WDI_CONN_IN_PARAMS_AST_NOTIFY(pipe_in) = ipa_ast_notify_cb;
  495. }
  496. #else
  497. static inline void
  498. dp_ipa_ast_notify_cb(qdf_ipa_wdi_conn_in_params_t *pipe_in,
  499. void *ipa_ast_notify_cb)
  500. {
  501. }
  502. #endif
  503. #ifdef IPA_OPT_WIFI_DP
  504. static inline void dp_ipa_opt_dp_ixo_remap(uint8_t *ix0_map)
  505. {
  506. ix0_map[0] = REO_REMAP_SW1;
  507. ix0_map[1] = REO_REMAP_SW1;
  508. ix0_map[2] = REO_REMAP_SW2;
  509. ix0_map[3] = REO_REMAP_SW3;
  510. ix0_map[4] = REO_REMAP_SW4;
  511. ix0_map[5] = REO_REMAP_RELEASE;
  512. ix0_map[6] = REO_REMAP_FW;
  513. ix0_map[7] = REO_REMAP_FW;
  514. }
  515. #else
  516. static inline void dp_ipa_opt_dp_ixo_remap(uint8_t *ix0_map)
  517. {
  518. }
  519. #endif
  520. #ifdef QCA_ENHANCED_STATS_SUPPORT
  521. /**
  522. * dp_ipa_txrx_get_peer_stats - fetch peer stats
  523. * @soc: soc handle
  524. * @vdev_id: id of vdev handle
  525. * @peer_mac: peer mac address
  526. * @peer_stats: buffer to hold peer stats
  527. *
  528. * Return: status success/failure
  529. */
  530. QDF_STATUS dp_ipa_txrx_get_peer_stats(struct cdp_soc_t *soc, uint8_t vdev_id,
  531. uint8_t *peer_mac,
  532. struct cdp_peer_stats *peer_stats);
  533. /**
  534. * dp_ipa_txrx_get_vdev_stats - fetch vdev stats
  535. * @soc_hdl: soc handle
  536. * @vdev_id: id of vdev handle
  537. * @buf: buffer to hold vdev stats
  538. * @is_aggregate: for aggregation
  539. *
  540. * Return: int
  541. */
  542. int dp_ipa_txrx_get_vdev_stats(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  543. void *buf, bool is_aggregate);
  544. /**
  545. * dp_ipa_txrx_get_pdev_stats() - fetch pdev stats
  546. * @soc: DP soc handle
  547. * @pdev_id: id of DP pdev handle
  548. * @pdev_stats: buffer to hold pdev stats
  549. *
  550. * Return: status success/failure
  551. */
  552. QDF_STATUS dp_ipa_txrx_get_pdev_stats(struct cdp_soc_t *soc, uint8_t pdev_id,
  553. struct cdp_pdev_stats *pdev_stats);
  554. /**
  555. * dp_ipa_update_peer_rx_stats() - update peer rx stats
  556. * @soc: soc handle
  557. * @vdev_id: vdev id
  558. * @peer_mac: Peer Mac Address
  559. * @nbuf: data nbuf
  560. *
  561. * Return: status success/failure
  562. */
  563. QDF_STATUS dp_ipa_update_peer_rx_stats(struct cdp_soc_t *soc, uint8_t vdev_id,
  564. uint8_t *peer_mac, qdf_nbuf_t nbuf);
  565. #endif
  566. /**
  567. * dp_ipa_get_wdi_version() - Get WDI version
  568. * @soc_hdl: data path soc handle
  569. * @wdi_ver: Out parameter for wdi version
  570. *
  571. * Get WDI version based on soc arch
  572. *
  573. * Return: None
  574. */
  575. void dp_ipa_get_wdi_version(struct cdp_soc_t *soc_hdl, uint8_t *wdi_ver);
  576. /**
  577. * dp_ipa_is_ring_ipa_tx() - Check if the TX ring is used by IPA
  578. *
  579. * @soc: DP SoC
  580. * @ring_id: TX ring id
  581. *
  582. * Return: bool
  583. */
  584. bool dp_ipa_is_ring_ipa_tx(struct dp_soc *soc, uint8_t ring_id);
  585. #else
  586. static inline int dp_ipa_uc_detach(struct dp_soc *soc, struct dp_pdev *pdev)
  587. {
  588. return QDF_STATUS_SUCCESS;
  589. }
  590. static inline int dp_ipa_uc_attach(struct dp_soc *soc, struct dp_pdev *pdev)
  591. {
  592. return QDF_STATUS_SUCCESS;
  593. }
  594. static inline int dp_ipa_ring_resource_setup(struct dp_soc *soc,
  595. struct dp_pdev *pdev)
  596. {
  597. return 0;
  598. }
  599. static inline QDF_STATUS dp_ipa_handle_rx_buf_smmu_mapping(struct dp_soc *soc,
  600. qdf_nbuf_t nbuf,
  601. uint32_t size,
  602. bool create,
  603. const char *func,
  604. uint32_t line)
  605. {
  606. return QDF_STATUS_SUCCESS;
  607. }
  608. static inline void
  609. dp_ipa_rx_buf_smmu_mapping_lock(struct dp_soc *soc)
  610. {
  611. }
  612. static inline void
  613. dp_ipa_rx_buf_smmu_mapping_unlock(struct dp_soc *soc)
  614. {
  615. }
  616. static inline void
  617. dp_ipa_reo_ctx_buf_mapping_lock(struct dp_soc *soc,
  618. uint32_t reo_ring_num)
  619. {
  620. }
  621. static inline void
  622. dp_ipa_reo_ctx_buf_mapping_unlock(struct dp_soc *soc,
  623. uint32_t reo_ring_num)
  624. {
  625. }
  626. static inline qdf_nbuf_t dp_ipa_handle_rx_reo_reinject(struct dp_soc *soc,
  627. qdf_nbuf_t nbuf)
  628. {
  629. return nbuf;
  630. }
  631. static inline QDF_STATUS dp_ipa_tx_buf_smmu_mapping(struct cdp_soc_t *soc_hdl,
  632. uint8_t pdev_id,
  633. const char *func,
  634. uint32_t line)
  635. {
  636. return QDF_STATUS_SUCCESS;
  637. }
  638. static inline QDF_STATUS dp_ipa_tx_buf_smmu_unmapping(struct cdp_soc_t *soc_hdl,
  639. uint8_t pdev_id,
  640. const char *func,
  641. uint32_t line)
  642. {
  643. return QDF_STATUS_SUCCESS;
  644. }
  645. static inline QDF_STATUS dp_ipa_rx_buf_pool_smmu_mapping(
  646. struct cdp_soc_t *soc_hdl,
  647. uint8_t pdev_id,
  648. bool create,
  649. const char *func,
  650. uint32_t line)
  651. {
  652. return QDF_STATUS_SUCCESS;
  653. }
  654. static inline QDF_STATUS dp_ipa_set_smmu_mapped(struct cdp_soc_t *soc, int val)
  655. {
  656. return QDF_STATUS_SUCCESS;
  657. }
  658. static inline int dp_ipa_get_smmu_mapped(struct cdp_soc_t *soc)
  659. {
  660. return QDF_STATUS_SUCCESS;
  661. }
  662. #ifdef IPA_WDS_EASYMESH_FEATURE
  663. static inline QDF_STATUS dp_ipa_ast_create(struct cdp_soc_t *soc_hdl,
  664. qdf_ipa_ast_info_type_t *data)
  665. {
  666. return QDF_STATUS_SUCCESS;
  667. }
  668. #endif
  669. static inline void dp_ipa_get_wdi_version(struct cdp_soc_t *soc_hdl,
  670. uint8_t *wdi_ver)
  671. {
  672. }
  673. static inline bool
  674. dp_ipa_is_ring_ipa_tx(struct dp_soc *soc, uint8_t ring_id)
  675. {
  676. return false;
  677. }
  678. #endif
  679. #endif /* _DP_IPA_H_ */