msm: ipa3: adding check for holb stats
Adding null checks while getting the holb stats Change-Id: Iba83cd86522679137f66fa1e7844884955fecf4d Signed-off-by: Veerendra Kumar Kamsali <quic_veekum@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
757a544d71
commit
e739dfa5ab
@@ -229,47 +229,51 @@ static int ipa_get_generic_stats(unsigned long arg)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HOLB Discard stats */
|
if(ipa_lnx_agent_ctx.alloc_info.num_holb_drop_stats_clients != 0 ) {
|
||||||
holb_disc_stats_ptr = &generic_stats->holb_stats.holb_disc_stats[0];
|
/* HOLB Discard stats */
|
||||||
for (i = 0; i < IPA_CLIENT_MAX; i++) {
|
holb_disc_stats_ptr = &generic_stats->holb_stats.holb_disc_stats[0];
|
||||||
int ep_idx = ipa_get_ep_mapping(i);
|
for (i = 0; i < IPA_CLIENT_MAX; i++) {
|
||||||
|
int ep_idx = ipa_get_ep_mapping(i);
|
||||||
|
|
||||||
if ((ep_idx == -1) || (!IPA_CLIENT_IS_CONS(i)) ||
|
if ((ep_idx == -1) || (!IPA_CLIENT_IS_CONS(i)) ||
|
||||||
(IPA_CLIENT_IS_TEST(i)))
|
(IPA_CLIENT_IS_TEST(i)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
reg_idx = ipahal_get_ep_reg_idx(ep_idx);
|
reg_idx = ipahal_get_ep_reg_idx(ep_idx);
|
||||||
if (!(ipa3_ctx->hw_stats &&
|
if (!(ipa3_ctx->hw_stats &&
|
||||||
(ipa3_ctx->hw_stats->drop.init.enabled_bitmask[reg_idx] &
|
(ipa3_ctx->hw_stats->drop.init.enabled_bitmask[reg_idx] &
|
||||||
ipahal_get_ep_bit(ep_idx))))
|
ipahal_get_ep_bit(ep_idx))))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
holb_disc_stats_ptr->client_type = i;
|
holb_disc_stats_ptr->client_type = i;
|
||||||
holb_disc_stats_ptr->num_drp_cnt = out->client[i].drop_packet_cnt;
|
holb_disc_stats_ptr->num_drp_cnt = out->client[i].drop_packet_cnt;
|
||||||
holb_disc_stats_ptr->num_drp_bytes = out->client[i].drop_byte_cnt;
|
holb_disc_stats_ptr->num_drp_bytes = out->client[i].drop_byte_cnt;
|
||||||
holb_disc_stats_ptr = (struct holb_discard_stats *)((
|
holb_disc_stats_ptr = (struct holb_discard_stats *)((
|
||||||
uint64_t)holb_disc_stats_ptr + sizeof(struct holb_discard_stats));
|
uint64_t)holb_disc_stats_ptr + sizeof(struct holb_discard_stats));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HOLB Monitor stats */
|
if(ipa_lnx_agent_ctx.alloc_info.num_holb_mon_stats_clients != 0 ) {
|
||||||
holb_mon_stats_ptr = (struct holb_monitor_stats *)(
|
/* HOLB Monitor stats */
|
||||||
(uint64_t)&generic_stats->holb_stats.holb_disc_stats[0] +
|
holb_mon_stats_ptr = (struct holb_monitor_stats *)(
|
||||||
(ipa_lnx_agent_ctx.alloc_info.num_holb_drop_stats_clients *
|
(uint64_t)&generic_stats->holb_stats.holb_disc_stats[0] +
|
||||||
sizeof(struct holb_discard_stats)));
|
(ipa_lnx_agent_ctx.alloc_info.num_holb_drop_stats_clients *
|
||||||
for (i = 0; i < generic_stats->holb_stats.num_holb_mon_clients; i++) {
|
sizeof(struct holb_discard_stats)));
|
||||||
holb_client = &(ipa3_ctx->uc_ctx.holb_monitor.client[i]);
|
for (i = 0; i < generic_stats->holb_stats.num_holb_mon_clients; i++) {
|
||||||
/* Get the client type from gsi_hdl */
|
holb_client = &(ipa3_ctx->uc_ctx.holb_monitor.client[i]);
|
||||||
for (j = 0; j < IPA5_MAX_NUM_PIPES; j++) {
|
/* Get the client type from gsi_hdl */
|
||||||
if (ipa3_ctx->ep[j].gsi_chan_hdl == holb_client->gsi_chan_hdl) {
|
for (j = 0; j < IPA5_MAX_NUM_PIPES; j++) {
|
||||||
holb_mon_stats_ptr->client_type = ipa3_ctx->ep[j].client;
|
if (ipa3_ctx->ep[j].gsi_chan_hdl == holb_client->gsi_chan_hdl) {
|
||||||
break;
|
holb_mon_stats_ptr->client_type = ipa3_ctx->ep[j].client;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
holb_mon_stats_ptr->curr_index = holb_client->current_idx;
|
||||||
|
holb_mon_stats_ptr->num_en_cnt = holb_client->enable_cnt;
|
||||||
|
holb_mon_stats_ptr->num_dis_cnt = holb_client->disable_cnt;
|
||||||
|
holb_mon_stats_ptr = (struct holb_monitor_stats *)((
|
||||||
|
uint64_t)holb_mon_stats_ptr + sizeof(struct holb_monitor_stats));
|
||||||
}
|
}
|
||||||
holb_mon_stats_ptr->curr_index = holb_client->current_idx;
|
|
||||||
holb_mon_stats_ptr->num_en_cnt = holb_client->enable_cnt;
|
|
||||||
holb_mon_stats_ptr->num_dis_cnt = holb_client->disable_cnt;
|
|
||||||
holb_mon_stats_ptr = (struct holb_monitor_stats *)((
|
|
||||||
uint64_t)holb_mon_stats_ptr + sizeof(struct holb_monitor_stats));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(copy_to_user((void __user *)arg,
|
if(copy_to_user((void __user *)arg,
|
||||||
|
Reference in New Issue
Block a user