htt.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. /*
  2. * Copyright (c) 2011, 2014-2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file htt.c
  28. * @brief Provide functions to create+init and destroy a HTT instance.
  29. * @details
  30. * This file contains functions for creating a HTT instance; initializing
  31. * the HTT instance, e.g. by allocating a pool of HTT tx descriptors and
  32. * connecting the HTT service with HTC; and deleting a HTT instance.
  33. */
  34. #include <qdf_mem.h> /* qdf_mem_malloc */
  35. #include <qdf_types.h> /* qdf_device_t, qdf_print */
  36. #include <htt.h> /* htt_tx_msdu_desc_t */
  37. #include <ol_cfg.h>
  38. #include <ol_txrx_htt_api.h> /* ol_tx_dowload_done_ll, etc. */
  39. #include <ol_htt_api.h>
  40. #include <htt_internal.h>
  41. #include <ol_htt_tx_api.h>
  42. #include "hif.h"
  43. #define HTT_HTC_PKT_POOL_INIT_SIZE 100 /* enough for a large A-MPDU */
  44. A_STATUS(*htt_h2t_rx_ring_cfg_msg)(struct htt_pdev_t *pdev);
  45. #ifdef IPA_OFFLOAD
  46. A_STATUS htt_ipa_config(htt_pdev_handle pdev, A_STATUS status)
  47. {
  48. if ((A_OK == status) &&
  49. ol_cfg_ipa_uc_offload_enabled(pdev->ctrl_pdev))
  50. status = htt_h2t_ipa_uc_rsc_cfg_msg(pdev);
  51. return status;
  52. }
  53. #define HTT_IPA_CONFIG htt_ipa_config
  54. #else
  55. #define HTT_IPA_CONFIG(pdev, status) status /* no-op */
  56. #endif /* IPA_OFFLOAD */
  57. struct htt_htc_pkt *htt_htc_pkt_alloc(struct htt_pdev_t *pdev)
  58. {
  59. struct htt_htc_pkt_union *pkt = NULL;
  60. HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex);
  61. if (pdev->htt_htc_pkt_freelist) {
  62. pkt = pdev->htt_htc_pkt_freelist;
  63. pdev->htt_htc_pkt_freelist = pdev->htt_htc_pkt_freelist->u.next;
  64. }
  65. HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
  66. if (pkt == NULL)
  67. pkt = qdf_mem_malloc(sizeof(*pkt));
  68. return &pkt->u.pkt; /* not actually a dereference */
  69. }
  70. void htt_htc_pkt_free(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
  71. {
  72. struct htt_htc_pkt_union *u_pkt = (struct htt_htc_pkt_union *)pkt;
  73. HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex);
  74. u_pkt->u.next = pdev->htt_htc_pkt_freelist;
  75. pdev->htt_htc_pkt_freelist = u_pkt;
  76. HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
  77. }
  78. void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev)
  79. {
  80. struct htt_htc_pkt_union *pkt, *next;
  81. pkt = pdev->htt_htc_pkt_freelist;
  82. while (pkt) {
  83. next = pkt->u.next;
  84. qdf_mem_free(pkt);
  85. pkt = next;
  86. }
  87. pdev->htt_htc_pkt_freelist = NULL;
  88. }
  89. #ifdef ATH_11AC_TXCOMPACT
  90. void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt)
  91. {
  92. struct htt_htc_pkt_union *u_pkt = (struct htt_htc_pkt_union *)pkt;
  93. HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex);
  94. if (pdev->htt_htc_pkt_misclist) {
  95. u_pkt->u.next = pdev->htt_htc_pkt_misclist;
  96. pdev->htt_htc_pkt_misclist = u_pkt;
  97. } else {
  98. pdev->htt_htc_pkt_misclist = u_pkt;
  99. }
  100. HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex);
  101. }
  102. void htt_htc_misc_pkt_pool_free(struct htt_pdev_t *pdev)
  103. {
  104. struct htt_htc_pkt_union *pkt, *next;
  105. qdf_nbuf_t netbuf;
  106. pkt = pdev->htt_htc_pkt_misclist;
  107. while (pkt) {
  108. next = pkt->u.next;
  109. netbuf = (qdf_nbuf_t) (pkt->u.pkt.htc_pkt.pNetBufContext);
  110. qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE);
  111. qdf_nbuf_free(netbuf);
  112. qdf_mem_free(pkt);
  113. pkt = next;
  114. }
  115. pdev->htt_htc_pkt_misclist = NULL;
  116. }
  117. #endif
  118. /**
  119. * htt_pdev_alloc() - allocate HTT pdev
  120. * @txrx_pdev: txrx pdev
  121. * @ctrl_pdev: cfg pdev
  122. * @htc_pdev: HTC pdev
  123. * @osdev: os device
  124. *
  125. * Return: HTT pdev handle
  126. */
  127. htt_pdev_handle
  128. htt_pdev_alloc(ol_txrx_pdev_handle txrx_pdev,
  129. ol_pdev_handle ctrl_pdev,
  130. HTC_HANDLE htc_pdev, qdf_device_t osdev)
  131. {
  132. struct htt_pdev_t *pdev;
  133. pdev = qdf_mem_malloc(sizeof(*pdev));
  134. if (!pdev)
  135. goto fail1;
  136. pdev->osdev = osdev;
  137. pdev->ctrl_pdev = ctrl_pdev;
  138. pdev->txrx_pdev = txrx_pdev;
  139. pdev->htc_pdev = htc_pdev;
  140. qdf_mem_set(&pdev->stats, sizeof(pdev->stats), 0);
  141. pdev->htt_htc_pkt_freelist = NULL;
  142. #ifdef ATH_11AC_TXCOMPACT
  143. pdev->htt_htc_pkt_misclist = NULL;
  144. #endif
  145. pdev->cfg.default_tx_comp_req =
  146. !ol_cfg_tx_free_at_download(pdev->ctrl_pdev);
  147. pdev->cfg.is_full_reorder_offload =
  148. ol_cfg_is_full_reorder_offload(pdev->ctrl_pdev);
  149. qdf_print("is_full_reorder_offloaded? %d\n",
  150. (int)pdev->cfg.is_full_reorder_offload);
  151. pdev->cfg.ce_classify_enabled =
  152. ol_cfg_is_ce_classify_enabled(ctrl_pdev);
  153. qdf_print("ce_classify_enabled %d\n",
  154. pdev->cfg.ce_classify_enabled);
  155. pdev->targetdef = htc_get_targetdef(htc_pdev);
  156. #if defined(HELIUMPLUS_PADDR64)
  157. /* TODO: OKA: Remove hard-coding */
  158. HTT_SET_WIFI_IP(pdev, 2, 0);
  159. #endif /* defined(HELIUMPLUS_PADDR64) */
  160. /*
  161. * Connect to HTC service.
  162. * This has to be done before calling htt_rx_attach,
  163. * since htt_rx_attach involves sending a rx ring configure
  164. * message to the target.
  165. */
  166. /* AR6004 don't need HTT layer. */
  167. #ifndef AR6004_HW
  168. if (htt_htc_attach(pdev))
  169. goto fail2;
  170. if (hif_ce_fastpath_cb_register(htt_t2h_msg_handler_fast, pdev))
  171. qdf_print("failed to register fastpath callback\n");
  172. #endif
  173. return pdev;
  174. fail2:
  175. qdf_mem_free(pdev);
  176. fail1:
  177. return NULL;
  178. }
  179. /**
  180. * htt_attach() - Allocate and setup HTT TX/RX descriptors
  181. * @pdev: pdev ptr
  182. * @desc_pool_size: size of tx descriptors
  183. *
  184. * Return: 0 for success or error code.
  185. */
  186. int
  187. htt_attach(struct htt_pdev_t *pdev, int desc_pool_size)
  188. {
  189. int i;
  190. enum wlan_frm_fmt frm_type;
  191. int ret = 0;
  192. ret = htt_tx_attach(pdev, desc_pool_size);
  193. if (ret)
  194. goto fail1;
  195. ret = htt_rx_attach(pdev);
  196. if (ret)
  197. goto fail2;
  198. HTT_TX_MUTEX_INIT(&pdev->htt_tx_mutex);
  199. HTT_TX_NBUF_QUEUE_MUTEX_INIT(pdev);
  200. /* pre-allocate some HTC_PACKET objects */
  201. for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) {
  202. struct htt_htc_pkt_union *pkt;
  203. pkt = qdf_mem_malloc(sizeof(*pkt));
  204. if (!pkt)
  205. break;
  206. htt_htc_pkt_free(pdev, &pkt->u.pkt);
  207. }
  208. /*
  209. * LL - download just the initial portion of the frame.
  210. * Download enough to cover the encapsulation headers checked
  211. * by the target's tx classification descriptor engine.
  212. */
  213. /* account for the 802.3 or 802.11 header */
  214. frm_type = ol_cfg_frame_type(pdev->ctrl_pdev);
  215. if (frm_type == wlan_frm_fmt_native_wifi) {
  216. pdev->download_len = HTT_TX_HDR_SIZE_NATIVE_WIFI;
  217. } else if (frm_type == wlan_frm_fmt_802_3) {
  218. pdev->download_len = HTT_TX_HDR_SIZE_ETHERNET;
  219. } else {
  220. qdf_print("Unexpected frame type spec: %d\n", frm_type);
  221. HTT_ASSERT0(0);
  222. }
  223. /*
  224. * Account for the optional L2 / ethernet header fields:
  225. * 802.1Q, LLC/SNAP
  226. */
  227. pdev->download_len +=
  228. HTT_TX_HDR_SIZE_802_1Q + HTT_TX_HDR_SIZE_LLC_SNAP;
  229. /*
  230. * Account for the portion of the L3 (IP) payload that the
  231. * target needs for its tx classification.
  232. */
  233. pdev->download_len += ol_cfg_tx_download_size(pdev->ctrl_pdev);
  234. /*
  235. * Account for the HTT tx descriptor, including the
  236. * HTC header + alignment padding.
  237. */
  238. pdev->download_len += sizeof(struct htt_host_tx_desc_t);
  239. /*
  240. * The TXCOMPACT htt_tx_sched function uses pdev->download_len
  241. * to apply for all requeued tx frames. Thus,
  242. * pdev->download_len has to be the largest download length of
  243. * any tx frame that will be downloaded.
  244. * This maximum download length is for management tx frames,
  245. * which have an 802.11 header.
  246. */
  247. #ifdef ATH_11AC_TXCOMPACT
  248. pdev->download_len = sizeof(struct htt_host_tx_desc_t)
  249. + HTT_TX_HDR_SIZE_OUTER_HDR_MAX /* worst case */
  250. + HTT_TX_HDR_SIZE_802_1Q
  251. + HTT_TX_HDR_SIZE_LLC_SNAP
  252. + ol_cfg_tx_download_size(pdev->ctrl_pdev);
  253. #endif
  254. pdev->tx_send_complete_part2 = ol_tx_download_done_ll;
  255. /*
  256. * For LL, the FW rx desc is alongside the HW rx desc fields in
  257. * the htt_host_rx_desc_base struct/.
  258. */
  259. pdev->rx_fw_desc_offset = RX_STD_DESC_FW_MSDU_OFFSET;
  260. htt_h2t_rx_ring_cfg_msg = htt_h2t_rx_ring_cfg_msg_ll;
  261. return 0;
  262. fail2:
  263. htt_tx_detach(pdev);
  264. fail1:
  265. return ret;
  266. }
  267. A_STATUS htt_attach_target(htt_pdev_handle pdev)
  268. {
  269. A_STATUS status;
  270. status = htt_h2t_ver_req_msg(pdev);
  271. if (status != A_OK)
  272. return status;
  273. #if defined(HELIUMPLUS_PADDR64)
  274. /*
  275. * Send the frag_desc info to target.
  276. */
  277. htt_h2t_frag_desc_bank_cfg_msg(pdev);
  278. #endif /* defined(HELIUMPLUS_PADDR64) */
  279. /*
  280. * If applicable, send the rx ring config message to the target.
  281. * The host could wait for the HTT version number confirmation message
  282. * from the target before sending any further HTT messages, but it's
  283. * reasonable to assume that the host and target HTT version numbers
  284. * match, and proceed immediately with the remaining configuration
  285. * handshaking.
  286. */
  287. status = htt_h2t_rx_ring_cfg_msg(pdev);
  288. status = HTT_IPA_CONFIG(pdev, status);
  289. return status;
  290. }
  291. void htt_detach(htt_pdev_handle pdev)
  292. {
  293. htt_rx_detach(pdev);
  294. htt_tx_detach(pdev);
  295. htt_htc_pkt_pool_free(pdev);
  296. #ifdef ATH_11AC_TXCOMPACT
  297. htt_htc_misc_pkt_pool_free(pdev);
  298. #endif
  299. HTT_TX_MUTEX_DESTROY(&pdev->htt_tx_mutex);
  300. HTT_TX_NBUF_QUEUE_MUTEX_DESTROY(pdev);
  301. htt_rx_dbg_rxbuf_deinit(pdev);
  302. }
  303. /**
  304. * htt_pdev_free() - Free HTT pdev
  305. * @pdev: htt pdev
  306. *
  307. * Return: none
  308. */
  309. void htt_pdev_free(htt_pdev_handle pdev)
  310. {
  311. qdf_mem_free(pdev);
  312. }
  313. void htt_detach_target(htt_pdev_handle pdev)
  314. {
  315. }
  316. #ifdef WLAN_FEATURE_FASTPATH
  317. /**
  318. * htt_pkt_dl_len_get() HTT packet download length for fastpath case
  319. *
  320. * @htt_dev: pointer to htt device.
  321. *
  322. * As fragment one already downloaded HTT/HTC header, download length is
  323. * remaining bytes.
  324. *
  325. * Return: download length
  326. */
  327. int htt_pkt_dl_len_get(struct htt_pdev_t *htt_dev)
  328. {
  329. return htt_dev->download_len - sizeof(struct htt_host_tx_desc_t);
  330. }
  331. #else
  332. int htt_pkt_dl_len_get(struct htt_pdev_t *htt_dev)
  333. {
  334. return 0;
  335. }
  336. #endif
  337. int htt_htc_attach(struct htt_pdev_t *pdev)
  338. {
  339. HTC_SERVICE_CONNECT_REQ connect;
  340. HTC_SERVICE_CONNECT_RESP response;
  341. A_STATUS status;
  342. qdf_mem_set(&connect, sizeof(connect), 0);
  343. qdf_mem_set(&response, sizeof(response), 0);
  344. connect.pMetaData = NULL;
  345. connect.MetaDataLength = 0;
  346. connect.EpCallbacks.pContext = pdev;
  347. connect.EpCallbacks.EpTxComplete = htt_h2t_send_complete;
  348. connect.EpCallbacks.EpTxCompleteMultiple = NULL;
  349. connect.EpCallbacks.EpRecv = htt_t2h_msg_handler;
  350. connect.EpCallbacks.ep_resume_tx_queue = htt_tx_resume_handler;
  351. /* rx buffers currently are provided by HIF, not by EpRecvRefill */
  352. connect.EpCallbacks.EpRecvRefill = NULL;
  353. connect.EpCallbacks.RecvRefillWaterMark = 1;
  354. /* N/A, fill is done by HIF */
  355. connect.EpCallbacks.EpSendFull = htt_h2t_full;
  356. /*
  357. * Specify how deep to let a queue get before htc_send_pkt will
  358. * call the EpSendFull function due to excessive send queue depth.
  359. */
  360. connect.MaxSendQueueDepth = HTT_MAX_SEND_QUEUE_DEPTH;
  361. /* disable flow control for HTT data message service */
  362. #ifndef HIF_SDIO
  363. connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL;
  364. #endif
  365. /* connect to control service */
  366. connect.service_id = HTT_DATA_MSG_SVC;
  367. status = htc_connect_service(pdev->htc_pdev, &connect, &response);
  368. if (status != A_OK)
  369. return -EIO; /* failure */
  370. pdev->htc_endpoint = response.Endpoint;
  371. return 0; /* success */
  372. }
  373. #if HTT_DEBUG_LEVEL > 5
  374. void htt_display(htt_pdev_handle pdev, int indent)
  375. {
  376. qdf_print("%*s%s:\n", indent, " ", "HTT");
  377. qdf_print("%*stx desc pool: %d elems of %d bytes, %d allocated\n",
  378. indent + 4, " ",
  379. pdev->tx_descs.pool_elems,
  380. pdev->tx_descs.size, pdev->tx_descs.alloc_cnt);
  381. qdf_print("%*srx ring: space for %d elems, filled with %d buffers\n",
  382. indent + 4, " ",
  383. pdev->rx_ring.size, pdev->rx_ring.fill_level);
  384. qdf_print("%*sat %p (%#x paddr)\n", indent + 8, " ",
  385. pdev->rx_ring.buf.paddrs_ring, pdev->rx_ring.base_paddr);
  386. qdf_print("%*snetbuf ring @ %p\n", indent + 8, " ",
  387. pdev->rx_ring.buf.netbufs_ring);
  388. qdf_print("%*sFW_IDX shadow register: vaddr = %p, paddr = %#x\n",
  389. indent + 8, " ",
  390. pdev->rx_ring.alloc_idx.vaddr, pdev->rx_ring.alloc_idx.paddr);
  391. qdf_print("%*sSW enqueue idx= %d, SW dequeue idx: desc= %d, buf= %d\n",
  392. indent + 8, " ", *pdev->rx_ring.alloc_idx.vaddr,
  393. pdev->rx_ring.sw_rd_idx.msdu_desc,
  394. pdev->rx_ring.sw_rd_idx.msdu_payld);
  395. }
  396. #endif
  397. #ifdef IPA_OFFLOAD
  398. /**
  399. * htt_ipa_uc_attach() - Allocate UC data path resources
  400. * @pdev: handle to the HTT instance
  401. *
  402. * Return: 0 success
  403. * none 0 fail
  404. */
  405. int htt_ipa_uc_attach(struct htt_pdev_t *pdev)
  406. {
  407. int error;
  408. /* TX resource attach */
  409. error = htt_tx_ipa_uc_attach(
  410. pdev,
  411. ol_cfg_ipa_uc_tx_buf_size(pdev->ctrl_pdev),
  412. ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev),
  413. ol_cfg_ipa_uc_tx_partition_base(pdev->ctrl_pdev));
  414. if (error) {
  415. qdf_print("HTT IPA UC TX attach fail code %d\n", error);
  416. HTT_ASSERT0(0);
  417. return error;
  418. }
  419. /* RX resource attach */
  420. error = htt_rx_ipa_uc_attach(
  421. pdev,
  422. ol_cfg_ipa_uc_rx_ind_ring_size(pdev->ctrl_pdev));
  423. if (error) {
  424. qdf_print("HTT IPA UC RX attach fail code %d\n", error);
  425. htt_tx_ipa_uc_detach(pdev);
  426. HTT_ASSERT0(0);
  427. return error;
  428. }
  429. return 0; /* success */
  430. }
  431. /**
  432. * htt_ipa_uc_attach() - Remove UC data path resources
  433. * @pdev: handle to the HTT instance
  434. *
  435. * Return: None
  436. */
  437. void htt_ipa_uc_detach(struct htt_pdev_t *pdev)
  438. {
  439. /* TX IPA micro controller detach */
  440. htt_tx_ipa_uc_detach(pdev);
  441. /* RX IPA micro controller detach */
  442. htt_rx_ipa_uc_detach(pdev);
  443. }
  444. /**
  445. * htt_ipa_uc_get_resource() - Get uc resource from htt and lower layer
  446. * @pdev: handle to the HTT instance
  447. * @ce_sr_base_paddr: copy engine source ring base physical address
  448. * @ce_sr_ring_size: copy engine source ring size
  449. * @ce_reg_paddr: copy engine register physical address
  450. * @tx_comp_ring_base_paddr: tx comp ring base physical address
  451. * @tx_comp_ring_size: tx comp ring size
  452. * @tx_num_alloc_buffer: number of allocated tx buffer
  453. * @rx_rdy_ring_base_paddr: rx ready ring base physical address
  454. * @rx_rdy_ring_size: rx ready ring size
  455. * @rx_proc_done_idx_paddr: rx process done index physical address
  456. * @rx_proc_done_idx_vaddr: rx process done index virtual address
  457. * @rx2_rdy_ring_base_paddr: rx done ring base physical address
  458. * @rx2_rdy_ring_size: rx done ring size
  459. * @rx2_proc_done_idx_paddr: rx done index physical address
  460. * @rx2_proc_done_idx_vaddr: rx done index virtual address
  461. *
  462. * Return: 0 success
  463. */
  464. int
  465. htt_ipa_uc_get_resource(htt_pdev_handle pdev,
  466. qdf_dma_addr_t *ce_sr_base_paddr,
  467. uint32_t *ce_sr_ring_size,
  468. qdf_dma_addr_t *ce_reg_paddr,
  469. qdf_dma_addr_t *tx_comp_ring_base_paddr,
  470. uint32_t *tx_comp_ring_size,
  471. uint32_t *tx_num_alloc_buffer,
  472. qdf_dma_addr_t *rx_rdy_ring_base_paddr,
  473. uint32_t *rx_rdy_ring_size,
  474. qdf_dma_addr_t *rx_proc_done_idx_paddr,
  475. void **rx_proc_done_idx_vaddr,
  476. qdf_dma_addr_t *rx2_rdy_ring_base_paddr,
  477. uint32_t *rx2_rdy_ring_size,
  478. qdf_dma_addr_t *rx2_proc_done_idx_paddr,
  479. void **rx2_proc_done_idx_vaddr)
  480. {
  481. /* Release allocated resource to client */
  482. *tx_comp_ring_base_paddr =
  483. pdev->ipa_uc_tx_rsc.tx_comp_base.paddr;
  484. *tx_comp_ring_size =
  485. (uint32_t) ol_cfg_ipa_uc_tx_max_buf_cnt(pdev->ctrl_pdev);
  486. *tx_num_alloc_buffer = (uint32_t) pdev->ipa_uc_tx_rsc.alloc_tx_buf_cnt;
  487. *rx_rdy_ring_base_paddr =
  488. pdev->ipa_uc_rx_rsc.rx_ind_ring_base.paddr;
  489. *rx_rdy_ring_size = (uint32_t) pdev->ipa_uc_rx_rsc.rx_ind_ring_size;
  490. *rx_proc_done_idx_paddr =
  491. pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.paddr;
  492. *rx_proc_done_idx_vaddr =
  493. (void *)pdev->ipa_uc_rx_rsc.rx_ipa_prc_done_idx.vaddr;
  494. *rx2_rdy_ring_base_paddr =
  495. pdev->ipa_uc_rx_rsc.rx2_ind_ring_base.paddr;
  496. *rx2_rdy_ring_size = (uint32_t) pdev->ipa_uc_rx_rsc.rx2_ind_ring_size;
  497. *rx2_proc_done_idx_paddr =
  498. pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.paddr;
  499. *rx2_proc_done_idx_vaddr =
  500. (void *)pdev->ipa_uc_rx_rsc.rx2_ipa_prc_done_idx.vaddr;
  501. /* Get copy engine, bus resource */
  502. htc_ipa_get_ce_resource(pdev->htc_pdev,
  503. ce_sr_base_paddr,
  504. ce_sr_ring_size, ce_reg_paddr);
  505. return 0;
  506. }
  507. /**
  508. * htt_ipa_uc_set_doorbell_paddr() - Propagate IPA doorbell address
  509. * @pdev: handle to the HTT instance
  510. * @ipa_uc_tx_doorbell_paddr: TX doorbell base physical address
  511. * @ipa_uc_rx_doorbell_paddr: RX doorbell base physical address
  512. *
  513. * Return: 0 success
  514. */
  515. int
  516. htt_ipa_uc_set_doorbell_paddr(htt_pdev_handle pdev,
  517. qdf_dma_addr_t ipa_uc_tx_doorbell_paddr,
  518. qdf_dma_addr_t ipa_uc_rx_doorbell_paddr)
  519. {
  520. pdev->ipa_uc_tx_rsc.tx_comp_idx_paddr = ipa_uc_tx_doorbell_paddr;
  521. pdev->ipa_uc_rx_rsc.rx_rdy_idx_paddr = ipa_uc_rx_doorbell_paddr;
  522. return 0;
  523. }
  524. #endif /* IPA_OFFLOAD */