diff options
author | Rachit Kankane <rkankane@codeaurora.org> | 2020-04-07 21:43:03 +0530 |
---|---|---|
committer | chenpaul <chenpaul@google.com> | 2020-04-30 13:33:49 +0800 |
commit | a8be67677302f4880d36f4865706bbc44c481fbf (patch) | |
tree | 529e5bf623d016b2cac9c41202e3a778c9e46a95 | |
parent | 0f6fe7840f27ba23d516316620c6fb92126a4f4d (diff) | |
download | qcacld-a8be67677302f4880d36f4865706bbc44c481fbf.tar.gz |
qcacld-3.0: Copy peer and radio stats correctly
Copy WMI_LINK_STATS_ALL_PEER stats and number of channels in
radio stats properly to the buffer.
Bug: 153415344
Bug: 155025263
Bug: 155046601
Change-Id: I3219e3c46e93d43f2684ab51a2c5d98a63a3f88e
CRs-Fixed: 2649207
-rw-r--r-- | core/hdd/src/wlan_hdd_stats.c | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 4fbf6bba18..12f11f4556 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -962,6 +962,8 @@ static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter, if (radiostat->numChannels) { ret = hdd_llstats_radio_fill_channels(adapter, radiostat, vendor_event); + qdf_mem_free(radiostat->channels); + radiostat->channels = NULL; if (ret) goto failure; } @@ -1049,19 +1051,46 @@ static void hdd_process_ll_stats(tSirLLStatsResults *results, return; if (results->paramId & WMI_LINK_STATS_RADIO) { + tpSirWifiRadioStat rs_results, stat_result; + u64 channel_size = 0; + int i; stats = qdf_mem_malloc(sizeof(*stats)); if (!stats) goto exit; stat_size = sizeof(tSirWifiRadioStat) * results->num_radio; stats->result_param_id = WMI_LINK_STATS_RADIO; - stats->result = qdf_mem_malloc(stat_size); - if (!stats->result) { + stat_result = qdf_mem_malloc(stat_size); + if (!stat_result) { qdf_mem_free(stats); goto exit; } - + stats->result = stat_result; + rs_results = (tpSirWifiRadioStat)results->results; qdf_mem_copy(stats->result, results->results, stat_size); + for (i = 0; i < results->num_radio; i++) { + channel_size = rs_results->numChannels * + sizeof(tSirWifiChannelStats); + if (channel_size) { + stat_result->channels = + qdf_mem_malloc(channel_size); + if (!stat_result->channels) { + while (i-- > 0) { + stat_result--; + qdf_mem_free(stat_result-> + channels); + } + qdf_mem_free(stats->result); + qdf_mem_free(stats); + goto exit; + } + qdf_mem_copy(stat_result->channels, + rs_results->channels, + channel_size); + } + rs_results++; + stat_result++; + } stats->stats_nradio_npeer.no_of_radios = results->num_radio; stats->more_data = results->moreResultToFollow; if (!results->moreResultToFollow) @@ -1087,7 +1116,7 @@ static void hdd_process_ll_stats(tSirLLStatsResults *results, tpSirWifiPeerStat peer_stat = (tpSirWifiPeerStat) results->results; tpSirWifiPeerInfo peer_info = NULL; - u32 num_rate = 0, peers, rates; + u64 num_rate = 0, peers, rates; int i; stats = qdf_mem_malloc(sizeof(*stats)); if (!stats) @@ -1113,8 +1142,7 @@ static void hdd_process_ll_stats(tSirLLStatsResults *results, goto exit; } - qdf_mem_copy(stats->result, results->results, - sizeof(tSirWifiPeerStat)); + qdf_mem_copy(stats->result, results->results, stat_size); stats->more_data = results->moreResultToFollow; if (!results->moreResultToFollow) priv->request_bitmap &= ~stats->result_param_id; @@ -1420,14 +1448,26 @@ nla_policy }; static void wlan_hdd_handle_ll_stats(struct hdd_adapter *adapter, - struct hdd_ll_stats *stats) + struct hdd_ll_stats *stats, + int ret) { switch (stats->result_param_id) { case WMI_LINK_STATS_RADIO: + { + tpSirWifiRadioStat radio_stat = stats->result; + int i, num_radio = stats->stats_nradio_npeer.no_of_radios; + + if (ret == -ETIMEDOUT) { + for (i = 0; i < num_radio; i++) { + if (radio_stat->numChannels) + qdf_mem_free(radio_stat->channels); + radio_stat++; + } + return; + } hdd_link_layer_process_radio_stats(adapter, stats->more_data, - stats->result, - stats->stats_nradio_npeer. - no_of_radios); + radio_stat, num_radio); + } break; case WMI_LINK_STATS_IFACE: hdd_link_layer_process_iface_stats(adapter, stats->result, @@ -1498,8 +1538,7 @@ static int wlan_hdd_send_ll_stats_req(struct hdd_adapter *adapter, while (QDF_IS_STATUS_SUCCESS(status)) { stats = qdf_container_of(ll_node, struct hdd_ll_stats, ll_stats_node); - if (ret != -ETIMEDOUT) - wlan_hdd_handle_ll_stats(adapter, stats); + wlan_hdd_handle_ll_stats(adapter, stats, ret); qdf_mem_free(stats->result); qdf_mem_free(stats); qdf_spin_lock(&priv->ll_stats_lock); |