WIFI-2954 - Fix channel survey dump

Channel time, busy and other survey counters are showing incorrect values (less than previous or sometimes zero).
Consecutive survey dumps are expected to return monotonically increasing counter values.

Root Cause:
Clear on read in ath10k was leading to this issue.

Solution: Use the non-clearing
WMI_BSS_SURVEY_REQ_TYPE_READ wmi_bss_survey_req_type

Note: ath11k already has this fix.

Patch also fixes the utilization percentage calculation for different survey parameters in opensync

Signed-off-by: Yashvardhan <yashvardhan@netexperience.com>
This commit is contained in:
Yashvardhan
2021-07-06 19:28:57 -07:00
committed by Rick Sommerville
parent 3cefdead18
commit 6ca49d80fc
4 changed files with 52 additions and 24 deletions

View File

@@ -0,0 +1,11 @@
--- a/ath10k-5.7/mac.c 2021-07-06 11:12:56.022146449 -0700
+++ b/ath10k-5.7/mac.c 2021-07-06 19:37:52.352753693 -0700
@@ -8286,7 +8286,7 @@
struct ieee80211_channel *channel)
{
int ret;
- enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR;
+ enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ;
lockdep_assert_held(&ar->conf_mutex);

View File

@@ -45,14 +45,14 @@ typedef struct
typedef struct
{
DPP_TARGET_SURVEY_RECORD_COMMON_STRUCT;
uint32_t chan_active;
uint32_t chan_busy;
uint32_t chan_busy_ext;
uint32_t chan_self;
uint32_t chan_rx;
uint32_t chan_tx;
uint64_t chan_active;
uint64_t chan_busy;
uint64_t chan_busy_ext;
uint64_t chan_self;
uint64_t chan_rx;
uint64_t chan_tx;
uint32_t chan_noise;
uint32_t duration_ms;
uint64_t duration_ms;
} target_survey_record_t;
typedef void target_capacity_data_t;

View File

@@ -242,9 +242,9 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
while (!ds_dlist_is_empty(&raw_survey_list)) {
survey = ds_dlist_head(&raw_survey_list);
ds_dlist_remove(&raw_survey_list, survey);
LOGD("Survey entry dur %d busy %d tx %d rx %d chan %d active %d type %d",
LOGD("Survey entry dur %llu busy %llu tx %llu rx %llu rx_self %llu chan %d type %d",
survey->duration_ms, survey->chan_busy, survey->chan_tx, survey->chan_rx,
survey->info.chan, survey->chan_active, scan_type );
survey->chan_self, survey->info.chan, scan_type);
if ((scan_type == RADIO_SCAN_TYPE_ONCHAN) && (survey->duration_ms != 0)) {
if (survey->info.chan == chan_list[0]) {
ds_dlist_insert_tail(survey_list, survey);
@@ -267,25 +267,42 @@ bool target_stats_survey_get(radio_entry_t *radio_cfg, uint32_t *chan_list,
}
#define PERCENT(v1, v2) (v2 > 0 ? ((v1 > v2) ? 100 : (v1*100/v2)) : 0)
#define DELTA(n, p) ((n) < (p) ? (n) : (n) - (p))
bool target_stats_survey_convert(radio_entry_t *radio_cfg, radio_scan_type_t scan_type,
target_survey_record_t *data_new, target_survey_record_t *data_old,
dpp_survey_record_t *survey_record)
{
LOGD("Survey convert scan_type %d chan %d", scan_type, data_new->info.chan);
target_survey_record_t delta;
LOGD("Survey convert scan_type %d chan %d duration_new:%llu duration_old:%llu "
"busy_new %llu busy_old:%llu tx_new %llu tx_old:%llu rx_new %llu rx_old:%llu "
"rx_self_new %llu rx_self_old:%llu",
scan_type, data_new->info.chan, data_new->duration_ms, data_old->duration_ms,
data_new->chan_busy, data_old->chan_busy, data_new->chan_tx, data_old->chan_tx,
data_new->chan_rx, data_old->chan_rx, data_new->chan_self, data_old->chan_self);
memset(&delta, 0, sizeof(delta));
delta.duration_ms = DELTA(data_new->duration_ms, data_old->duration_ms);
delta.chan_busy = DELTA(data_new->chan_busy, data_old->chan_busy);
delta.chan_busy_ext = DELTA(data_new->chan_busy_ext, data_old->chan_busy_ext);
delta.chan_tx = DELTA(data_new->chan_tx, data_old->chan_tx);
delta.chan_rx = DELTA(data_new->chan_rx, data_old->chan_rx);
delta.chan_self = DELTA(data_new->chan_self, data_old->chan_self);
survey_record->info.chan = data_new->info.chan;
survey_record->chan_tx = PERCENT(data_new->chan_tx, data_new->duration_ms);
survey_record->chan_self = PERCENT(data_new->chan_self, data_new->duration_ms);
survey_record->chan_rx = PERCENT(data_new->chan_rx, data_new->duration_ms);
survey_record->chan_busy_ext = PERCENT(data_new->chan_busy_ext, data_new->duration_ms);
survey_record->chan_busy = PERCENT(data_new->chan_busy, data_new->duration_ms);
survey_record->chan_tx = PERCENT(delta.chan_tx, delta.duration_ms);
survey_record->chan_self = PERCENT(delta.chan_self, delta.duration_ms);
survey_record->chan_rx = PERCENT(delta.chan_rx, delta.duration_ms);
survey_record->chan_busy_ext = PERCENT(delta.chan_busy_ext, delta.duration_ms);
survey_record->chan_busy = PERCENT(delta.chan_busy, delta.duration_ms);
survey_record->chan_noise = data_new->chan_noise;
survey_record->duration_ms = data_new->duration_ms;
survey_record->duration_ms = delta.duration_ms;
return true;
}
/******************************************************************************
* NEIGHBORS definitions
*****************************************************************************/

View File

@@ -44,14 +44,14 @@ typedef struct
typedef struct
{
DPP_TARGET_SURVEY_RECORD_COMMON_STRUCT;
uint32_t chan_active;
uint32_t chan_busy;
uint32_t chan_busy_ext;
uint32_t chan_self;
uint32_t chan_rx;
uint32_t chan_tx;
uint64_t chan_active;
uint64_t chan_busy;
uint64_t chan_busy_ext;
uint64_t chan_self;
uint64_t chan_rx;
uint64_t chan_tx;
uint32_t chan_noise;
uint32_t duration_ms;
uint64_t duration_ms;
uint32_t chan_in_use;
} target_survey_record_t;