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

Commit 0f390457 authored by Sivan Reinstein's avatar Sivan Reinstein
Browse files

msm: ipa: adjust the RX replenish threshold according to IPA WM



In IPA2.6L, a HOLB mitigation mechanism has been added. Its purpose
is to monitor IPA Producer (From IPA) pipes which are running low
on descriptors below a certain WM value and stop the IPA Consumers
(To IPA) from sending more packets in order to avoid IPA to get
stalled (Until the IPA Producers replenish more descriptors).
This change takes into account the IPA WM values and sets the
threshold accordingly in the SW.

CRs-fixed: 828067
Change-Id: Idb99777dbb3d3e7f08a4695a91a78f1075637a97
Signed-off-by: default avatarSivan Reinstein <sivanr@codeaurora.org>
Acked-by: default avatarDavid Arinzon <darinzon@qti.qualcomm.com>
parent 86fdf692
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -1052,6 +1052,12 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
		ep->connect.source = ipa_ctx->bam_handle;
		ep->connect.dest_pipe_index = ipa_ctx->a5_pipe_index++;
		ep->connect.src_pipe_index = ipa_ep_idx;
		/*
		 * Determine how many buffers/descriptors remaining will
		 * cause to drop below the yellow WM bar.
		 */
		ep->rx_replenish_threshold = ipa_get_sys_yellow_wm()
						/ ep->sys->rx_buff_sz;
	} else {
		ep->connect.mode = SPS_MODE_DEST;
		ep->connect.source = SPS_DEV_HANDLE_MEM;
@@ -1771,6 +1777,7 @@ static void ipa_fast_replenish_rx_cache(struct ipa_sys_context *sys)

	queue_work(sys->repl_wq, &sys->repl_work);

	if (rx_len_cached <= sys->ep->rx_replenish_threshold) {
		if (rx_len_cached == 0) {
			if (sys->ep->client == IPA_CLIENT_APPS_WAN_CONS)
				IPA_STATS_INC_CNT(ipa_ctx->stats.wan_rx_empty);
@@ -1778,6 +1785,7 @@ static void ipa_fast_replenish_rx_cache(struct ipa_sys_context *sys)
				IPA_STATS_INC_CNT(ipa_ctx->stats.lan_rx_empty);
			else
				WARN_ON(1);
		}
		queue_delayed_work(sys->wq, &sys->replenish_rx_work,
			msecs_to_jiffies(1));
	}
+6 −1
Original line number Diff line number Diff line
@@ -498,6 +498,10 @@ struct ipa_wlan_comm_memb {
 * @skip_ep_cfg: boolean field that determines if EP should be configured
 *  by IPA driver
 * @keep_ipa_awake: when true, IPA will not be clock gated
 * @rx_replenish_threshold: Indicates the WM value which requires the RX
 *                          descriptors replenish function to be called to
 *                          avoid the RX pipe to run out of descriptors
 *                          and cause HOLB.
 */
struct ipa_ep_context {
	int valid;
@@ -525,7 +529,7 @@ struct ipa_ep_context {
	bool keep_ipa_awake;
	struct ipa_wlan_stats wstats;
	u32 wdi_state;

	u32 rx_replenish_threshold;
	/* sys MUST be the last element of this struct */
	struct ipa_sys_context *sys;
};
@@ -1583,6 +1587,7 @@ int ipa_uc_mhi_stop_event_update_channel(int channelHandle);
int ipa_uc_mhi_print_stats(char *dbg_buff, int size);
int ipa_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len);
u32 ipa_get_num_pipes(void);
u32 ipa_get_sys_yellow_wm(void);
int ipa_smmu_map_peer_bam(unsigned long dev);
int ipa_smmu_unmap_peer_bam(unsigned long dev);
struct ipa_smmu_cb_ctx *ipa_get_wlan_smmu_ctx(void);
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@
 * IPA HW 2.6/2.6L Registers
 */
#define IPA_ENABLED_PIPES_OFST 0x000005DC
#define IPA_YELLOW_MARKER_SYS_CFG_OFST 0x00000728
/*
 * End of IPA 2.6/2.6L Registers
 */
+16 −0
Original line number Diff line number Diff line
@@ -4877,3 +4877,19 @@ int ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
	return res;
}
EXPORT_SYMBOL(ipa_disable_apps_wan_cons_deaggr);

/**
 * ipa_get_sys_yellow_wm()- Return yellow WM value for IPA SYS pipes.
 *
 * Return value: IPA_YELLOW_MARKER_SYS_CFG_OFST register if IPA_HW_v2.6L,
 *               0 otherwise.
 */
u32 ipa_get_sys_yellow_wm(void)
{
	if (ipa_ctx->ipa_hw_type == IPA_HW_v2_6L)
		return ipa_read_reg(ipa_ctx->mmio,
			IPA_YELLOW_MARKER_SYS_CFG_OFST);
	else
		return 0;
}
EXPORT_SYMBOL(ipa_get_sys_yellow_wm);