diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c index 098c82d32c..6a7e4a1390 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c @@ -1835,35 +1835,44 @@ int ipa_drop_stats_init(void) u32 reg_idx; u32 mask, pipe_bitmask[IPA_EP_ARR_SIZE] = {0}; - /* If HOLB Monitoring is enabled, enable drop stats for USB and WLAN. */ - if (ipa3_ctx->uc_ctx.ipa_use_uc_holb_monitor) { - mask = ipa_hw_stats_get_ep_bit_n_idx( - IPA_CLIENT_USB_CONS, - ®_idx); - pipe_bitmask[reg_idx] |= mask; + mask = ipa_hw_stats_get_ep_bit_n_idx( + IPA_CLIENT_USB_CONS, + ®_idx); + pipe_bitmask[reg_idx] |= mask; + if (ipa3_ctx->ipa_wdi3_5g_holb_timeout || ipa3_ctx->uc_ctx.ipa_use_uc_holb_monitor) { mask = ipa_hw_stats_get_ep_bit_n_idx( IPA_CLIENT_WLAN2_CONS, ®_idx); pipe_bitmask[reg_idx] |= mask; } - if (ipa3_ctx->use_tput_est_ep) { + + if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_MDM) { + if (ipa3_ctx->ipa_wdi3_2g_holb_timeout) { + mask = ipa_hw_stats_get_ep_bit_n_idx( + IPA_CLIENT_WLAN2_CONS1, + ®_idx); + pipe_bitmask[reg_idx] |= mask; + } + + if (ipa3_ctx->use_tput_est_ep) { + mask = ipa_hw_stats_get_ep_bit_n_idx( + IPA_CLIENT_TPUT_CONS, + ®_idx); + pipe_bitmask[reg_idx] |= mask; + + } + } else { mask = ipa_hw_stats_get_ep_bit_n_idx( - IPA_CLIENT_TPUT_CONS, + IPA_CLIENT_USB_DPL_CONS, + ®_idx); + pipe_bitmask[reg_idx] |= mask; + + mask = ipa_hw_stats_get_ep_bit_n_idx( + IPA_CLIENT_ODL_DPL_CONS, ®_idx); pipe_bitmask[reg_idx] |= mask; } - /* Always enable drop stats for USB DPL Pipe. */ - mask = ipa_hw_stats_get_ep_bit_n_idx( - IPA_CLIENT_USB_DPL_CONS, - ®_idx); - pipe_bitmask[reg_idx] |= mask; - - /* Always enable drop stats for ODL DPL Pipe. */ - mask = ipa_hw_stats_get_ep_bit_n_idx( - IPA_CLIENT_ODL_DPL_CONS, - ®_idx); - pipe_bitmask[reg_idx] |= mask; /* Currently we have option to enable drop stats using debugfs. * To enable drop stats for a different pipe, first user needs @@ -1886,6 +1895,7 @@ int ipa_init_drop_stats(u32 *pipe_bitmask) {0}; struct ipahal_imm_cmd_pyld *coal_cmd_pyld = NULL; struct ipa3_desc desc[IPA_INIT_DROP_STATS_MAX_CMD_NUM] = { {0} }; + struct ipa_hw_stats_drop tmp_drop; dma_addr_t dma_address; int ret, i; int num_cmd = 0; @@ -1896,28 +1906,34 @@ int ipa_init_drop_stats(u32 *pipe_bitmask) if (!pipe_bitmask) return -EPERM; - /* reset driver's cache */ - memset(&ipa3_ctx->hw_stats->drop, 0, sizeof(ipa3_ctx->hw_stats->drop)); + /* check if IPA has enough space for # of pipes drop stats enabled*/ + memset(&tmp_drop, 0, sizeof(tmp_drop)); for (i = 0; i < IPA5_PIPE_REG_NUM; i++) { - ipa3_ctx->hw_stats->drop.init.enabled_bitmask[i] = - pipe_bitmask[i]; + tmp_drop.init.enabled_bitmask[i] = pipe_bitmask[i]; IPADBG_LOW("pipe_bitmask[%d]=0x%x\n", i, pipe_bitmask[i]); } pyld = ipahal_stats_generate_init_pyld(IPAHAL_HW_STATS_DROP, - &ipa3_ctx->hw_stats->drop.init, false); + &tmp_drop.init, false); if (!pyld) { IPAERR("failed to generate pyld\n"); return -EPERM; } if (pyld->len > IPA_MEM_PART(stats_drop_size)) { - IPAERR("SRAM partition too small: %d needed %d\n", - IPA_MEM_PART(stats_drop_size), pyld->len); + IPAERR("SRAM partition too small: %d bytes (%d pipes)." + "Tried to add %d bytes (%d pipes)." + "Please disable some stats before adding new ones.\n", + IPA_MEM_PART(stats_drop_size), IPA_MEM_PART(stats_drop_size)/8, + pyld->len, pyld->len/8); ret = -EPERM; goto destroy_init_pyld; } + /* reset driver's cache and copy the bitmask of new drop enabled pipes */ + memset(&ipa3_ctx->hw_stats->drop, 0, sizeof(ipa3_ctx->hw_stats->drop)); + ipa3_ctx->hw_stats->drop = tmp_drop; + dma_address = dma_map_single(ipa3_ctx->pdev, pyld->data, pyld->len, @@ -2629,11 +2645,21 @@ static ssize_t ipa_debugfs_print_drop_stats(struct file *file, ipahal_get_ep_bit(ep_idx))) continue; - - nbytes += scnprintf(dbg_buff + nbytes, - IPA_MAX_MSG_LEN - nbytes, - "%s:\n", - ipa_clients_strings[i]); + /* Use more descriptive names for WLAN2_CONS pipes */ + if(i == IPA_CLIENT_WLAN2_CONS) { + nbytes += scnprintf(dbg_buff + nbytes, + IPA_MAX_MSG_LEN - nbytes, + "IPA_CLIENT_WLAN2_HIGHSPEED_CONS:\n"); + } else if(i == IPA_CLIENT_WLAN2_CONS1) { + nbytes += scnprintf(dbg_buff + nbytes, + IPA_MAX_MSG_LEN - nbytes, + " IPA_CLIENT_WLAN2_LOWSPEED_CONS:\n"); + } else { + nbytes += scnprintf(dbg_buff + nbytes, + IPA_MAX_MSG_LEN - nbytes, + "%s:\n", + ipa_clients_strings[i]); + } nbytes += scnprintf(dbg_buff + nbytes, IPA_MAX_MSG_LEN - nbytes,