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

This commit is contained in:
qctecmdr 2020-01-24 17:58:35 -08:00 • committed by Gerrit - the friendly Code Review server
commit bd193f8ca9
3 changed files with 25 additions and 7 deletions

View file

@ -1427,6 +1427,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,
@ -1442,7 +1443,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++) {

View file

@ -3398,10 +3398,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;
}
@ -3415,10 +3422,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 */

View file

@ -1397,6 +1397,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];
};