Snap for 7519874 from ad9fbe71051ec885fee4f4b3df4cf47b0041adc3 to sc-release
Change-Id: I3add9fb8b211742aa41e5b768d6272a8455a1c4e
diff --git a/qcwcn/wifi_hal/llstats.cpp b/qcwcn/wifi_hal/llstats.cpp
index 50b8149..d9e2441 100644
--- a/qcwcn/wifi_hal/llstats.cpp
+++ b/qcwcn/wifi_hal/llstats.cpp
@@ -54,6 +54,7 @@
memset(&mHandler, 0,sizeof(mHandler));
mRadioStatsSize = 0;
mNumRadios = 0;
+ mNumRadiosAllocated = 0;
}
LLStatsCommand::~LLStatsCommand()
@@ -863,6 +864,11 @@
/* Indicate stats to framework only if both radio and iface stats
* are present */
if (mResultsParams.radio_stat && mResultsParams.iface_stat) {
+ if (mNumRadios > mNumRadiosAllocated) {
+ ALOGE("%s: Force reset mNumRadios=%d to allocated=%d",
+ __FUNCTION__, mNumRadios, mNumRadiosAllocated);
+ mNumRadios = mNumRadiosAllocated;
+ }
mHandler.on_link_stats_results(mRequestId,
mResultsParams.iface_stat, mNumRadios,
mResultsParams.radio_stat);
@@ -881,6 +887,11 @@
if(mResultsParams.radio_stat)
{
wifi_radio_stat *radioStat = mResultsParams.radio_stat;
+ if (mNumRadios > mNumRadiosAllocated) {
+ ALOGE("%s: Force reset mNumRadios=%d to allocated=%d",
+ __FUNCTION__, mNumRadios, mNumRadiosAllocated);
+ mNumRadios = mNumRadiosAllocated;
+ }
for (u8 radio = 0; radio < mNumRadios; radio++) {
if (radioStat->tx_time_per_levels) {
free(radioStat->tx_time_per_levels);
@@ -894,6 +905,7 @@
mResultsParams.radio_stat = NULL;
mRadioStatsSize = 0;
mNumRadios = 0;
+ mNumRadiosAllocated = 0;
}
if(mResultsParams.iface_stat)
{
@@ -978,6 +990,7 @@
+ mRadioStatsSize);
memset(radioStatsBuf, 0, resultsBufSize);
mRadioStatsSize += resultsBufSize;
+ mNumRadiosAllocated ++;
if (tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_TX_LEVELS])
radioStatsBuf->num_tx_levels = nla_get_u32(tb_vendor[
diff --git a/qcwcn/wifi_hal/llstatscommand.h b/qcwcn/wifi_hal/llstatscommand.h
index 5d4c480..86b9672 100644
--- a/qcwcn/wifi_hal/llstatscommand.h
+++ b/qcwcn/wifi_hal/llstatscommand.h
@@ -83,7 +83,10 @@
u32 mRadioStatsSize;
+ // mNumRadios is decoded from tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_NUM_RADIOS]
+ // nNumRadiosAllocated is the actual radio stats received.
u8 mNumRadios;
+ u8 mNumRadiosAllocated;
LLStatsCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd);