Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10620e6d authored by Bojun Pan's avatar Bojun Pan
Browse files

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: default avatarPriyadarshini Rajagopal <prajagop@qti.qualcomm.com>
Signed-off-by: default avatarBojun Pan <bojunp@codeaurora.org>
parent 6b3f84f4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -6405,6 +6405,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;
+24 −0
Original line number Diff line number Diff line
@@ -1208,6 +1208,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)
{
@@ -2498,6 +2518,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,
+4 −0
Original line number Diff line number Diff line
@@ -1968,10 +1968,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;
@@ -1991,6 +1993,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];
@@ -2011,6 +2014,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.
+5 −0
Original line number Diff line number Diff line
@@ -1276,6 +1276,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;
@@ -1296,6 +1300,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 */