diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 8bebe6b9c035..5802d755ff47 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -6278,6 +6278,10 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p, ipa3_ctx->wan_rx_ring_size = resource_p->wan_rx_ring_size; ipa3_ctx->lan_rx_ring_size = resource_p->lan_rx_ring_size; ipa3_ctx->ipa_wan_skb_page = resource_p->ipa_wan_skb_page; + ipa3_ctx->stats.page_recycle_stats[0].total_replenished = 0; + ipa3_ctx->stats.page_recycle_stats[0].tmp_alloc = 0; + ipa3_ctx->stats.page_recycle_stats[1].total_replenished = 0; + ipa3_ctx->stats.page_recycle_stats[1].tmp_alloc = 0; ipa3_ctx->skip_uc_pipe_reset = resource_p->skip_uc_pipe_reset; ipa3_ctx->tethered_flow_control = resource_p->tethered_flow_control; ipa3_ctx->ee = resource_p->ee; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c index 8364ecd5b5a1..5473da411932 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c @@ -1467,6 +1467,26 @@ static ssize_t ipa3_read_odlstats(struct file *file, char __user *ubuf, return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt); } +static ssize_t ipa3_read_page_recycle_stats(struct file *file, + char __user *ubuf, size_t count, loff_t *ppos) +{ + int nbytes; + int cnt = 0; + + nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN, + "COAL : Total number of packets replenished =%llu\n" + "COAL : Number of tmp alloc packets =%llu\n" + "DEF : Total number of packets replenished =%llu\n" + "DEF : Number of tmp alloc packets =%llu\n", + ipa3_ctx->stats.page_recycle_stats[0].total_replenished, + ipa3_ctx->stats.page_recycle_stats[0].tmp_alloc, + ipa3_ctx->stats.page_recycle_stats[1].total_replenished, + ipa3_ctx->stats.page_recycle_stats[1].tmp_alloc); + + cnt += nbytes; + + return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt); +} static ssize_t ipa3_read_wstats(struct file *file, char __user *ubuf, size_t count, loff_t *ppos) { @@ -2652,6 +2672,10 @@ static const struct ipa3_debugfs_file debugfs_files[] = { "odlstats", IPA_READ_ONLY_MODE, NULL, { .read = ipa3_read_odlstats, } + }, { + "page_recycle_stats", IPA_READ_ONLY_MODE, NULL, { + .read = ipa3_read_page_recycle_stats, + } }, { "wdi", IPA_READ_ONLY_MODE, NULL, { .read = ipa3_read_wdi, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index f469cf635dc7..8a3fccc1b80d 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -1950,10 +1950,12 @@ static void ipa3_replenish_rx_page_recycle(struct ipa3_sys_context *sys) u32 curr_wq; int idx = 0; struct page *cur_page; + u32 stats_i = 0; /* start replenish only when buffers go lower than the threshold */ if (sys->rx_pool_sz - sys->len < IPA_REPL_XFER_THRESH) return; + stats_i = (sys->ep->client == IPA_CLIENT_APPS_WAN_COAL_CONS) ? 0 : 1; spin_lock_bh(&sys->spinlock); rx_len_cached = sys->len; @@ -1973,6 +1975,7 @@ static void ipa3_replenish_rx_page_recycle(struct ipa3_sys_context *sys) * Could not find idle page at curr index. * Allocate a new one. */ + ipa3_ctx->stats.page_recycle_stats[stats_i].tmp_alloc++; if (curr_wq == atomic_read(&sys->repl->tail_idx)) break; rx_pkt = sys->repl->cache[curr_wq]; @@ -1993,6 +1996,7 @@ static void ipa3_replenish_rx_page_recycle(struct ipa3_sys_context *sys) gsi_xfer_elem_array[idx].xfer_user_data = rx_pkt; rx_len_cached++; idx++; + ipa3_ctx->stats.page_recycle_stats[stats_i].total_replenished++; /* * gsi_xfer_elem_buffer has a size of IPA_REPL_XFER_THRESH. * If this size is reached we need to queue the xfers. diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index 36344c98411e..2e2e8db0684a 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -1272,6 +1272,10 @@ enum ipa3_config_this_ep { IPA_DO_NOT_CONFIGURE_THIS_EP, }; +struct ipa3_page_recycle_stats { + u64 total_replenished; + u64 tmp_alloc; +}; struct ipa3_stats { u32 tx_sw_pkts; u32 tx_hw_pkts; @@ -1292,6 +1296,7 @@ struct ipa3_stats { u32 flow_enable; u32 flow_disable; u32 tx_non_linear; + struct ipa3_page_recycle_stats page_recycle_stats[2]; }; /* offset for each stats */