ACS: Avoid invalid interference factor when survey channel time is zero
When the channel time is zero the interference factor calculation falls under divide by zero operation which results in invalid (NaN = not-a-number) interference factor value. This leads to wrong ideal channel selection in ACS during the scenario described below. Scenario: In VHT80 mode, the channel 36 (first channel) gets the channel time as zero which causes the interfactor factor to be an invalid number (NaN). Any operations (like addition, mulitplication, divide, etc.) with NaN value results in a NaN value, so that average factor for the primary channel 36 got the invalid value (NaN). Since channel 36 is the first channel, ideal factor is assigned as NaN in the first iteration. The following iteration condition check (factor < ideal_factor) with a NaN value fail for all other primary channels. This results in channel 36 being chosen as the ideal channel in ACS which holds a NaN value. Logs: ACS: Survey analysis for channel 36 (5180 MHz) ACS: 1: min_nf=-103 interference_factor=nan nf=0 time=0 busy=0 rx=0 ACS: 2: min_nf=-103 interference_factor=0.615385 nf=-102 time=13 busy=8 rx=0 ACS: 3: min_nf=-103 interference_factor=2.45455 nf=0 time=22 busy=16 rx=0 ACS: 4: min_nf=-103 interference_factor=0.785714 nf=-103 time=42 busy=33 rx=0 ACS: 5: min_nf=-103 interference_factor=nan nf=0 time=0 busy=0 rx=0 ACS: * interference factor average: nan ... ACS: * channel 36: total interference = nan .. ACS: * channel 149: total interference = 5.93174e-21 .. ACS: Ideal channel is 36 (5180 MHz) with total interference factor of nan Signed-off-by: Karthikeyan Periyasamy <periyasa@codeaurora.org>
This commit is contained in:
parent
6965705bf5
commit
c4dd3afa3c
1 changed files with 1 additions and 1 deletions
|
@ -314,7 +314,7 @@ acs_survey_interference_factor(struct freq_survey *survey, s8 min_nf)
|
|||
|
||||
/* TODO: figure out the best multiplier for noise floor base */
|
||||
factor = pow(10, survey->nf / 5.0L) +
|
||||
(busy / total) *
|
||||
(total ? (busy / total) : 0) *
|
||||
pow(2, pow(10, (long double) survey->nf / 10.0L) -
|
||||
pow(10, (long double) min_nf / 10.0L));
|
||||
|
||||
|
|
Loading…
Reference in a new issue