From a78dc222d75ba99ccb3d84498217abea1da1c8e5 Mon Sep 17 00:00:00 2001 From: Bojun Pan Date: Wed, 7 Aug 2019 10:25:59 -0700 Subject: [PATCH] msm: ipa: Fix the missing page recycling cleanup on ssr Fix the missing handling to cleanup the recycling page on ssr, add a new cleanup_cb of gsi_reset_channel for page. Change-Id: Ied16ffe935ac3e5aecdb45389913b1ff94f284b9 Signed-off-by: Bojun Pan --- drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 63261ba7b3f1..23bae5b7282d 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -2424,6 +2424,25 @@ static void free_rx_pkt(void *chan_user_data, void *xfer_user_data) kmem_cache_free(ipa3_ctx->rx_pkt_wrapper_cache, rx_pkt); } +/** + * free_rx_page() - function to free the page and rx_pkt_wrapper + * + * @chan_user_data: ipa_sys_context used for skb size and skb_free func + * @xfer_uder_data: rx_pkt wrapper to be freed + * + */ +static void free_rx_page(void *chan_user_data, void *xfer_user_data) +{ + struct ipa3_rx_pkt_wrapper *rx_pkt = (struct ipa3_rx_pkt_wrapper *) + xfer_user_data; + + dma_unmap_page(ipa3_ctx->pdev, rx_pkt->page_data.dma_addr, + rx_pkt->len, DMA_FROM_DEVICE); + __free_pages(rx_pkt->page_data.page, + IPA_WAN_PAGE_ORDER); + kmem_cache_free(ipa3_ctx->rx_pkt_wrapper_cache, rx_pkt); +} + /** * ipa3_cleanup_rx() - release RX queue resources * @@ -4450,6 +4469,11 @@ static int ipa_gsi_setup_transfer_ring(struct ipa3_ep_context *ep, if (IPA_CLIENT_IS_CONS(ep->client)) gsi_channel_props.cleanup_cb = free_rx_pkt; + /* overwrite the cleanup_cb for page recycling */ + if (ipa3_ctx->ipa_wan_skb_page && + (IPA_CLIENT_IS_WAN_CONS(ep->client))) + gsi_channel_props.cleanup_cb = free_rx_page; + result = gsi_alloc_channel(&gsi_channel_props, ipa3_ctx->gsi_dev_hdl, &ep->gsi_chan_hdl); if (result != GSI_STATUS_SUCCESS) {