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

Commit f517cf41 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa4: Fix to unmap the page if skb allocation failed"

parents 7870f567 3a8ed18b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1153,6 +1153,7 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
		"lan_repl_rx_empty=%u\n"
		"flow_enable=%u\n"
		"flow_disable=%u\n",
		"rx_page_drop_cnt=%u\n",
		ipa3_ctx->stats.tx_sw_pkts,
		ipa3_ctx->stats.tx_hw_pkts,
		ipa3_ctx->stats.tx_non_linear,
@@ -1168,7 +1169,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf,
		ipa3_ctx->stats.lan_rx_empty,
		ipa3_ctx->stats.lan_repl_rx_empty,
		ipa3_ctx->stats.flow_enable,
		ipa3_ctx->stats.flow_disable);
		ipa3_ctx->stats.flow_disable,
		ipa3_ctx->stats.rx_page_drop_cnt);
	cnt += nbytes;

	for (i = 0; i < IPAHAL_PKT_STATUS_EXCEPTION_MAX; i++) {
+22 −7
Original line number Diff line number Diff line
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -3380,10 +3380,17 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify
		IPAERR("update_truesize not supported\n");

	if (notify->veid >= GSI_VEID_MAX) {
		rx_pkt->sys->free_rx_wrapper(rx_pkt);
		if (!rx_page.is_tmp_alloc)
			init_page_count(rx_page.page);
		IPAERR("notify->veid > GSI_VEID_MAX\n");
		if (!rx_page.is_tmp_alloc) {
			init_page_count(rx_page.page);
		} else {
			dma_unmap_page(ipa3_ctx->pdev, rx_page.dma_addr,
					rx_pkt->len, DMA_FROM_DEVICE);
			__free_pages(rx_pkt->page_data.page,
							IPA_WAN_PAGE_ORDER);
		}
		rx_pkt->sys->free_rx_wrapper(rx_pkt);
		IPA_STATS_INC_CNT(ipa3_ctx->stats.rx_page_drop_cnt);
		return NULL;
	}

@@ -3397,10 +3404,18 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify
		sys->ep->client == IPA_CLIENT_APPS_LAN_CONS) {
		rx_skb = alloc_skb(0, GFP_ATOMIC);
		if (unlikely(!rx_skb)) {
			rx_pkt->sys->free_rx_wrapper(rx_pkt);
			if (!rx_page.is_tmp_alloc)
				init_page_count(rx_page.page);
			IPAERR("skb alloc failure\n");
			list_del(&rx_pkt->link);
			if (!rx_page.is_tmp_alloc) {
				init_page_count(rx_page.page);
			} else {
				dma_unmap_page(ipa3_ctx->pdev, rx_page.dma_addr,
					rx_pkt->len, DMA_FROM_DEVICE);
				__free_pages(rx_pkt->page_data.page,
							IPA_WAN_PAGE_ORDER);
			}
			rx_pkt->sys->free_rx_wrapper(rx_pkt);
			IPA_STATS_INC_CNT(ipa3_ctx->stats.rx_page_drop_cnt);
			return NULL;
		}
	/* go over the list backward to save computations on updating length */
+1 −0
Original line number Diff line number Diff line
@@ -1376,6 +1376,7 @@ struct ipa3_stats {
	u32 flow_enable;
	u32 flow_disable;
	u32 tx_non_linear;
	u32 rx_page_drop_cnt;
	struct ipa3_page_recycle_stats page_recycle_stats[2];
};