msm: ipa: Add stats for page recycling

Adding stats for page recycling feature that tracks the
total number of packets replenished and tmp allocs for
coalescing and default pipes on Rx path.

Change-Id: Id92f5be4552101877c631628e71cf58e0da0f5d1
Acked-by: Priyadarshini Rajagopal <prajagop@qti.qualcomm.com>
Signed-off-by: Bojun Pan <bojunp@codeaurora.org>
This commit is contained in:
Bojun Pan 2019-08-22 14:53:46 -07:00 • committed by Gerrit - the friendly Code Review server
commit b5766bcabe
4 changed files with 37 additions and 0 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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.

View file

@ -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 */