Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0dbe1bf6 authored by Bojun Pan's avatar Bojun Pan Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: Fix the double unmap page recycling cleanup on ssr



Fix the issue on ssr where some of the pages get unmapped
twice by mistake.

Change-Id: I9191fde3d908086b6a6755d1217d6776a0e5d23a
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent c128dbdf
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -2435,12 +2435,19 @@ 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;
	struct ipa3_sys_context *sys = rx_pkt->sys;
	int i;

	for (i = 0; i < sys->repl->capacity; i++)
		if (sys->repl->cache[i] == rx_pkt)
			break;
	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);
	if (i < sys->repl->capacity)
		sys->repl->cache[i] = NULL;
}

/**
@@ -2489,16 +2496,19 @@ static void ipa3_cleanup_rx(struct ipa3_sys_context *sys)
		} else {
			for (i = 0; i < sys->repl->capacity; i++) {
				rx_pkt = sys->repl->cache[i];
				if (rx_pkt) {
					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,
					kmem_cache_free(
						ipa3_ctx->rx_pkt_wrapper_cache,
						rx_pkt);
				}
			}
		}
		kfree(sys->repl->cache);
		kfree(sys->repl);
	}