diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c index 510b4c584764..1c93ac16d419 100644 --- a/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v2/ipa_dp.c @@ -1165,7 +1165,7 @@ void ipa_update_repl_threshold(enum ipa_client_type ipa_client) * 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->rx_replenish_threshold = ipa_get_sys_yellow_wm(ep->sys) / ep->sys->rx_buff_sz; } @@ -1361,7 +1361,7 @@ int ipa2_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl) * 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->rx_replenish_threshold = ipa_get_sys_yellow_wm(ep->sys) / ep->sys->rx_buff_sz; /* Only when the WAN pipes are setup, actual threshold will * be read from the register. So update LAN_CONS ep again with diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h index f2dcb2438b9a..f94418efc927 100644 --- a/drivers/platform/msm/ipa/ipa_v2/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v2/ipa_i.h @@ -1911,7 +1911,7 @@ int ipa2_uc_mhi_stop_event_update_channel(int channelHandle); int ipa2_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); +u32 ipa_get_sys_yellow_wm(struct ipa_sys_context *sys); struct ipa_smmu_cb_ctx *ipa2_get_smmu_ctx(void); struct ipa_smmu_cb_ctx *ipa2_get_wlan_smmu_ctx(void); struct ipa_smmu_cb_ctx *ipa2_get_uc_smmu_ctx(void); diff --git a/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c index 0c5d47ddd9c8..0dd10743a01e 100644 --- a/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v2/ipa_utils.c @@ -44,6 +44,8 @@ #define IPA_EOT_COAL_GRAN_MIN (1) #define IPA_EOT_COAL_GRAN_MAX (16) +#define IPA_DEFAULT_SYS_YELLOW_WM 32 + #define IPA_AGGR_BYTE_LIMIT (\ IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_BMSK >> \ IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_SHFT) @@ -5074,15 +5076,19 @@ int ipa2_bind_api_controller(enum ipa_hw_type ipa_hw_type, * 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. + * IPA_DEFAULT_SYS_YELLOW_WM otherwise. */ -u32 ipa_get_sys_yellow_wm(void) +u32 ipa_get_sys_yellow_wm(struct ipa_sys_context *sys) { - if (ipa_ctx->ipa_hw_type == IPA_HW_v2_6L) + 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; + } else { + if (!sys) + return 0; + + return IPA_DEFAULT_SYS_YELLOW_WM * sys->rx_buff_sz; + } } EXPORT_SYMBOL(ipa_get_sys_yellow_wm); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 11ae7efa4a0a..82df3768ba26 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -68,6 +68,8 @@ /* The below virtual channel cannot be used by any entity */ #define IPA_GSI_CH_20_WA_VIRT_CHAN 29 +#define IPA_DEFAULT_SYS_YELLOW_WM 32 + static struct sk_buff *ipa3_get_skb_ipa_rx(unsigned int len, gfp_t flags); static void ipa3_replenish_wlan_rx_cache(struct ipa3_sys_context *sys); static void ipa3_replenish_rx_cache(struct ipa3_sys_context *sys); @@ -2300,7 +2302,7 @@ static void ipa3_fast_replenish_rx_cache(struct ipa3_sys_context *sys) queue_work(sys->repl_wq, &sys->repl_work); - if (rx_len_cached == 0) { + if (rx_len_cached <= IPA_DEFAULT_SYS_YELLOW_WM) { if (sys->ep->client == IPA_CLIENT_APPS_WAN_CONS) IPA_STATS_INC_CNT(ipa3_ctx->stats.wan_rx_empty); else if (sys->ep->client == IPA_CLIENT_APPS_LAN_CONS)