diff --git a/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c b/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c index 8eb0627c8aa3..ea1f07859da7 100644 --- a/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c +++ b/drivers/platform/msm/ipa/ipa_clients/ipa_gsb.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -762,8 +763,6 @@ static void ipa_gsb_tx_dp_notify(void *priv, enum ipa_dp_evt_type evt, /* fetch iface handle from header */ mux_hdr = (struct ipa_gsb_mux_hdr *)skb->data; - /* change to host order */ - *(u32 *)mux_hdr = ntohl(*(u32 *)mux_hdr); hdl = mux_hdr->iface_hdl; if ((hdl < 0) || (hdl >= MAX_SUPPORTED_IFACE) || !ipa_gsb_ctx->iface[hdl]) { @@ -1215,9 +1214,9 @@ static int ipa_bridge_tx_dp_internal(u32 hdl, struct sk_buff *skb, /* add 4 byte header for mux */ mux_hdr = (struct ipa_gsb_mux_hdr *)skb_push(skb, sizeof(struct ipa_gsb_mux_hdr)); + memset(mux_hdr, 0, sizeof(struct ipa_gsb_mux_hdr)); mux_hdr->iface_hdl = (u8)hdl; - /* change to network order */ - *(u32 *)mux_hdr = htonl(*(u32 *)mux_hdr); + mux_hdr->qmap_id = (u8)ipa3_get_qmap_id(ipa_gsb_ctx->prod_hdl); ret = ipa_tx_dp(IPA_CLIENT_ODU_PROD, skb, metadata); if (ret) { diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c index 43884914263e..a83c50716724 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifdef CONFIG_DEBUG_FS @@ -1359,6 +1360,7 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf, "flow_disable=%u\n" "rx_page_drop_cnt=%u\n" "lower_order=%u\n", + "pipe_setup_fail_cnt=%u\n", ipa3_ctx->stats.tx_sw_pkts, ipa3_ctx->stats.tx_hw_pkts, ipa3_ctx->stats.tx_non_linear, @@ -1376,7 +1378,8 @@ static ssize_t ipa3_read_stats(struct file *file, char __user *ubuf, ipa3_ctx->stats.flow_enable, ipa3_ctx->stats.flow_disable, ipa3_ctx->stats.rx_page_drop_cnt, - ipa3_ctx->stats.lower_order + ipa3_ctx->stats.lower_order, + ipa3_ctx->stats.pipe_setup_fail_cnt ); cnt += nbytes; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 53d0644578b4..f5783895557e 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -1383,10 +1383,14 @@ int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl) fail_gen3: ipa3_disable_data_path(ipa_ep_idx); fail_repl: - ep->sys->repl_hdlr = ipa3_replenish_rx_cache; - ep->sys->repl->capacity = 0; - kfree(ep->sys->repl); - ep->sys->repl = NULL; + if (IPA_CLIENT_IS_CONS(ep->client)) + ipa3_cleanup_rx(ep->sys); + + if(ep->sys->repl) { + ep->sys->repl->capacity = 0; + kfree(ep->sys->repl); + ep->sys->repl = NULL; + } fail_page_recycle_repl: if (ep->sys->page_recycle_repl) { ep->sys->page_recycle_repl->capacity = 0; @@ -1410,6 +1414,7 @@ fail_wq: fail_and_disable_clocks: IPA_ACTIVE_CLIENTS_DEC_EP(sys_in->client); fail_gen: + IPA_STATS_INC_CNT(ipa3_ctx->stats.pipe_setup_fail_cnt); return result; } diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c index b90ce38b505c..a3f090def566 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "ipa_i.h" @@ -94,8 +95,10 @@ static int ipa3_hdr_proc_ctx_to_hw_format(struct ipa_mem_buffer *mem, if (unlikely(!entry->hdr || !entry->hdr->offset_entry || !entry->offset_entry || entry->hdr->hdr_len == 0 || - entry->hdr->hdr_len > ipa_hdr_bin_sz[IPA_HDR_BIN_MAX - 1])) + entry->hdr->hdr_len > ipa_hdr_bin_sz[IPA_HDR_BIN_MAX - 1])) { + IPAERR_RL("Found invalid hdr entry\n"); return -EINVAL; + } ret = ipahal_cp_proc_ctx_to_hw_buff(entry->type, mem->base, entry->offset_entry->offset, @@ -128,6 +131,7 @@ static int ipa3_generate_hdr_proc_ctx_hw_tbl(u64 hdr_sys_addr, { u64 hdr_base_addr; gfp_t flag = GFP_KERNEL; + int ret; mem->size = (ipa3_ctx->hdr_proc_ctx_tbl.end) ? : 4; @@ -156,7 +160,12 @@ alloc: memset(aligned_mem->base, 0, aligned_mem->size); hdr_base_addr = (ipa3_ctx->hdr_tbl_lcl) ? IPA_MEM_PART(apps_hdr_ofst) : hdr_sys_addr; - return ipa3_hdr_proc_ctx_to_hw_format(aligned_mem, hdr_base_addr); + ret = ipa3_hdr_proc_ctx_to_hw_format(aligned_mem, hdr_base_addr); + if (ret) { + dma_free_coherent(ipa3_ctx->pdev, mem->size, mem->base, mem->phys_base); + return ret; + } + return ret; } /** diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 10a4650c7335..b979156eb14e 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef _IPA3_I_H_ @@ -1449,6 +1450,7 @@ struct ipa3_stats { u32 rx_page_drop_cnt; struct ipa3_page_recycle_stats page_recycle_stats[2]; u64 lower_order; + u32 pipe_setup_fail_cnt; }; /* offset for each stats */ @@ -2813,6 +2815,7 @@ bool ipa3_is_client_handle_valid(u32 clnt_hdl); enum ipa_client_type ipa3_get_client_mapping(int pipe_idx); enum ipa_client_type ipa3_get_client_by_pipe(int pipe_idx); +u32 ipa3_get_qmap_id(int pipe_idx); void ipa_init_ep_flt_bitmap(void); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 5c3edacfa78a..a71731729c37 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved */ #include @@ -9615,6 +9616,20 @@ u32 ipa3_get_r_rev_version(void) } EXPORT_SYMBOL(ipa3_get_r_rev_version); +u32 ipa3_get_qmap_id(int pipe_idx) +{ + if (pipe_idx >= ipa3_ctx->ipa_num_pipes || pipe_idx < 0) { + IPAERR("Bad pipe index!\n"); + WARN_ON(1); + return -EINVAL; + } + + return ipa3_ctx->ep[pipe_idx].cfg.meta.qmap_id; + +} +EXPORT_SYMBOL(ipa3_get_qmap_id); + + /** * ipa3_ctx_get_type() - to get platform type, hw type * and hw mode diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c index 6d47eac263a0..90f04cc6b3f2 100644 --- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. + * + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ /* @@ -1402,6 +1404,7 @@ static void apps_ipa_packet_receive_notify(void *priv, skb->dev = IPA_NETDEV(); skb->protocol = htons(ETH_P_MAP); skb_set_mac_header(skb, 0); + skb_reset_network_header(skb); if (ipa3_rmnet_res.ipa_napi_enable) { trace_rmnet_ipa_netif_rcv_skb3(skb, dev->stats.rx_packets);