Loading drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +28 −35 Original line number Diff line number Diff line Loading @@ -400,7 +400,6 @@ int ipa3_send(struct ipa3_sys_context *sys, int i = 0; int j; int result; int fail_dma_wrap = 0; u32 mem_flag = GFP_ATOMIC; const struct ipa_gsi_ep_config *gsi_ep_cfg; Loading Loading @@ -431,7 +430,6 @@ int ipa3_send(struct ipa3_sys_context *sys, spin_lock_bh(&sys->spinlock); for (i = 0; i < num_desc; i++) { fail_dma_wrap = 0; tx_pkt = kmem_cache_zalloc(ipa3_ctx->tx_pkt_wrapper_cache, mem_flag); if (!tx_pkt) { Loading @@ -454,7 +452,7 @@ int ipa3_send(struct ipa3_sys_context *sys, if (ipa_populate_tag_field(&desc[i], tx_pkt, &tag_pyld_ret)) { IPAERR("Failed to populate tag field\n"); goto failure; goto failure_dma_map; } } Loading @@ -470,11 +468,6 @@ int ipa3_send(struct ipa3_sys_context *sys, tx_pkt->mem.base, tx_pkt->mem.size, DMA_TO_DEVICE); if (!tx_pkt->mem.phys_base) { IPAERR("failed to do dma map.\n"); fail_dma_wrap = 1; goto failure; } } else { tx_pkt->mem.phys_base = desc[i].dma_address; Loading @@ -490,17 +483,17 @@ int ipa3_send(struct ipa3_sys_context *sys, desc[i].frag, 0, tx_pkt->mem.size, DMA_TO_DEVICE); if (!tx_pkt->mem.phys_base) { IPAERR("dma map failed\n"); fail_dma_wrap = 1; goto failure; } } else { tx_pkt->mem.phys_base = desc[i].dma_address; tx_pkt->no_unmap_dma = true; } } if (dma_mapping_error(ipa3_ctx->pdev, tx_pkt->mem.phys_base)) { IPAERR("failed to do dma map.\n"); goto failure_dma_map; } tx_pkt->sys = sys; tx_pkt->callback = desc[i].callback; tx_pkt->user1 = desc[i].user1; Loading Loading @@ -561,28 +554,31 @@ int ipa3_send(struct ipa3_sys_context *sys, return 0; failure_dma_map: kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); failure: ipahal_destroy_imm_cmd(tag_pyld_ret); tx_pkt = tx_pkt_first; for (j = 0; j < i; j++) { next_pkt = list_next_entry(tx_pkt, link); list_del(&tx_pkt->link); if (!tx_pkt->no_unmap_dma) { if (desc[j].type != IPA_DATA_DESC_SKB_PAGED) { dma_unmap_single(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); dma_unmap_single(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); } else { dma_unmap_page(ipa3_ctx->pdev, tx_pkt->mem.phys_base, dma_unmap_page(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); } } kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); tx_pkt = next_pkt; } if (j < num_desc) /* last desc failed */ if (fail_dma_wrap) kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); kfree(gsi_xfer_elem_array); spin_unlock_bh(&sys->spinlock); Loading Loading @@ -1825,8 +1821,7 @@ begin: rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { pr_err_ratelimited("%s dma map fail %p for %p sys=%p\n", __func__, (void *)rx_pkt->data.dma_addr, ptr, sys); Loading Loading @@ -1993,8 +1988,7 @@ static void ipa3_alloc_wlan_rx_common_cache(u32 size) ptr = skb_put(rx_pkt->data.skb, IPA_WLAN_RX_BUFF_SZ); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, IPA_WLAN_RX_BUFF_SZ, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading Loading @@ -2065,8 +2059,7 @@ static void ipa3_replenish_rx_cache(struct ipa3_sys_context *sys) rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading Loading @@ -2165,8 +2158,8 @@ static void ipa3_replenish_rx_cache_recycle(struct ipa3_sys_context *sys) ptr = skb_put(rx_pkt->data.skb, sys->rx_buff_sz); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading @@ -2181,8 +2174,8 @@ static void ipa3_replenish_rx_cache_recycle(struct ipa3_sys_context *sys) ptr = skb_put(rx_pkt->data.skb, sys->rx_buff_sz); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +7 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,10 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) entry->hdr, entry->hdr_len, DMA_TO_DEVICE); if (dma_mapping_error(ipa3_ctx->pdev, entry->phys_base)) { IPAERR("dma_map_single failure for entry\n"); goto fail_dma_mapping; } } else { entry->is_hdr_proc_ctx = false; if (list_empty(&htbl->head_free_offset_list[bin])) { Loading Loading @@ -566,6 +570,9 @@ fail_add_proc_ctx: list_del(&entry->link); dma_unmap_single(ipa3_ctx->pdev, entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); fail_dma_mapping: entry->is_hdr_proc_ctx = false; bad_hdr_len: entry->cookie = 0; kmem_cache_free(ipa3_ctx->hdr_cache, entry); Loading Loading
drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +28 −35 Original line number Diff line number Diff line Loading @@ -400,7 +400,6 @@ int ipa3_send(struct ipa3_sys_context *sys, int i = 0; int j; int result; int fail_dma_wrap = 0; u32 mem_flag = GFP_ATOMIC; const struct ipa_gsi_ep_config *gsi_ep_cfg; Loading Loading @@ -431,7 +430,6 @@ int ipa3_send(struct ipa3_sys_context *sys, spin_lock_bh(&sys->spinlock); for (i = 0; i < num_desc; i++) { fail_dma_wrap = 0; tx_pkt = kmem_cache_zalloc(ipa3_ctx->tx_pkt_wrapper_cache, mem_flag); if (!tx_pkt) { Loading @@ -454,7 +452,7 @@ int ipa3_send(struct ipa3_sys_context *sys, if (ipa_populate_tag_field(&desc[i], tx_pkt, &tag_pyld_ret)) { IPAERR("Failed to populate tag field\n"); goto failure; goto failure_dma_map; } } Loading @@ -470,11 +468,6 @@ int ipa3_send(struct ipa3_sys_context *sys, tx_pkt->mem.base, tx_pkt->mem.size, DMA_TO_DEVICE); if (!tx_pkt->mem.phys_base) { IPAERR("failed to do dma map.\n"); fail_dma_wrap = 1; goto failure; } } else { tx_pkt->mem.phys_base = desc[i].dma_address; Loading @@ -490,17 +483,17 @@ int ipa3_send(struct ipa3_sys_context *sys, desc[i].frag, 0, tx_pkt->mem.size, DMA_TO_DEVICE); if (!tx_pkt->mem.phys_base) { IPAERR("dma map failed\n"); fail_dma_wrap = 1; goto failure; } } else { tx_pkt->mem.phys_base = desc[i].dma_address; tx_pkt->no_unmap_dma = true; } } if (dma_mapping_error(ipa3_ctx->pdev, tx_pkt->mem.phys_base)) { IPAERR("failed to do dma map.\n"); goto failure_dma_map; } tx_pkt->sys = sys; tx_pkt->callback = desc[i].callback; tx_pkt->user1 = desc[i].user1; Loading Loading @@ -561,28 +554,31 @@ int ipa3_send(struct ipa3_sys_context *sys, return 0; failure_dma_map: kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); failure: ipahal_destroy_imm_cmd(tag_pyld_ret); tx_pkt = tx_pkt_first; for (j = 0; j < i; j++) { next_pkt = list_next_entry(tx_pkt, link); list_del(&tx_pkt->link); if (!tx_pkt->no_unmap_dma) { if (desc[j].type != IPA_DATA_DESC_SKB_PAGED) { dma_unmap_single(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); dma_unmap_single(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); } else { dma_unmap_page(ipa3_ctx->pdev, tx_pkt->mem.phys_base, dma_unmap_page(ipa3_ctx->pdev, tx_pkt->mem.phys_base, tx_pkt->mem.size, DMA_TO_DEVICE); } } kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); tx_pkt = next_pkt; } if (j < num_desc) /* last desc failed */ if (fail_dma_wrap) kmem_cache_free(ipa3_ctx->tx_pkt_wrapper_cache, tx_pkt); kfree(gsi_xfer_elem_array); spin_unlock_bh(&sys->spinlock); Loading Loading @@ -1825,8 +1821,7 @@ begin: rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { pr_err_ratelimited("%s dma map fail %p for %p sys=%p\n", __func__, (void *)rx_pkt->data.dma_addr, ptr, sys); Loading Loading @@ -1993,8 +1988,7 @@ static void ipa3_alloc_wlan_rx_common_cache(u32 size) ptr = skb_put(rx_pkt->data.skb, IPA_WLAN_RX_BUFF_SZ); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, IPA_WLAN_RX_BUFF_SZ, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading Loading @@ -2065,8 +2059,7 @@ static void ipa3_replenish_rx_cache(struct ipa3_sys_context *sys) rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading Loading @@ -2165,8 +2158,8 @@ static void ipa3_replenish_rx_cache_recycle(struct ipa3_sys_context *sys) ptr = skb_put(rx_pkt->data.skb, sys->rx_buff_sz); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading @@ -2181,8 +2174,8 @@ static void ipa3_replenish_rx_cache_recycle(struct ipa3_sys_context *sys) ptr = skb_put(rx_pkt->data.skb, sys->rx_buff_sz); rx_pkt->data.dma_addr = dma_map_single(ipa3_ctx->pdev, ptr, sys->rx_buff_sz, DMA_FROM_DEVICE); if (rx_pkt->data.dma_addr == 0 || rx_pkt->data.dma_addr == ~0) { if (dma_mapping_error(ipa3_ctx->pdev, rx_pkt->data.dma_addr)) { IPAERR("dma_map_single failure %p for %p\n", (void *)rx_pkt->data.dma_addr, ptr); goto fail_dma_mapping; Loading
drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +7 −0 Original line number Diff line number Diff line Loading @@ -491,6 +491,10 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr) entry->hdr, entry->hdr_len, DMA_TO_DEVICE); if (dma_mapping_error(ipa3_ctx->pdev, entry->phys_base)) { IPAERR("dma_map_single failure for entry\n"); goto fail_dma_mapping; } } else { entry->is_hdr_proc_ctx = false; if (list_empty(&htbl->head_free_offset_list[bin])) { Loading Loading @@ -566,6 +570,9 @@ fail_add_proc_ctx: list_del(&entry->link); dma_unmap_single(ipa3_ctx->pdev, entry->phys_base, entry->hdr_len, DMA_TO_DEVICE); fail_dma_mapping: entry->is_hdr_proc_ctx = false; bad_hdr_len: entry->cookie = 0; kmem_cache_free(ipa3_ctx->hdr_cache, entry); Loading