Bug 156904

Summary: [ath] AR9285 antenna diversity algorithm is buggy and chooses a sub-optimal antenna
Product: Base System Reporter: Adrian Chadd <adrian>
Component: wirelessAssignee: freebsd-wireless (Nobody) <wireless>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.txt none

Description Adrian Chadd freebsd_committer freebsd_triage 2011-05-09 11:20:07 UTC
The AR9285 antenna diversity code, ported from Linux ath9k, seems to be making sub-optimal choices for antenna diversity.

An example of normal readings:

ar9285_ant_comb_scan: main: 61, alt: 22, rx_ant_conf: 0, main_ant_conf: 3
ar9285_ant_comb_scan: main: 61, alt: 22, rx_ant_conf: 0, main_ant_conf: 2
ar9285_ant_comb_scan: main: 61, alt: 22, rx_ant_conf: 0, main_ant_conf: 1

Here, an iperf TCP from STA (AR9285) to AP (tplink 11g wifi+adsl device) is around 25mbit. An AR2427 (AR9285 - 11n bits) gets around 30mbit; figuring that difference out can come later.

This matches the RSSI seen in the primary channel of ~ 30; (the hardware reports RSSI in 2* units.)


Then after some packet samples:

ar9285_ant_comb_scan: total_pkt_count=512
ar9285_ant_comb_scan: main_total_rssi=29420
ar9285_ant_comb_scan: alt_total_rssi=11264
ar9285_ant_comb_scan: main_rssi_avg=57
ar9285_ant_comb_scan: alt_alt_rssi_avg=22
ar9285_ant_comb_scan: main_recv_cnt=31
ar9285_ant_comb_scan: alt_recv_cnt=481
ar9285_ant_comb_scan: lna_conf: 2 -> 1
ar9285_ant_comb_scan: main_lna_conf: 1 -> 2
ar9285_ant_comb_scan: fast_div_bias: 2 -> 0

After that, the RSSI drops significantly on the main channel and is raised on the alt channel:

ar9285_ant_comb_scan: main: 47, alt: 41, rx_ant_conf: 0, main_ant_conf: 1
ar9285_ant_comb_scan: main: 45, alt: 41, rx_ant_conf: 0, main_ant_conf: 2
ar9285_ant_comb_scan: main: 45, alt: 41, rx_ant_conf: 0, main_ant_conf: 0

At this point, the iperf performance drops below 15mbit.

There also seems to be some invalid RSSI's creeping up, eg:

ar9285_ant_comb_scan: main: 9, alt: -90, rx_ant_conf: 2, main_ant_conf: 3
ar9285_ant_comb_scan: main: 46, alt: -103, rx_ant_conf: 3, main_ant_conf: 2

Fix: Patch attached with submission follows:
How-To-Repeat: I'm not sure if this is specific to my card and netbook/antenna or not; I'll do some further investigation to see what the root causes are.

But the diversity algorithm shouldn't make a poor antenna setup behave worse.. ?
Comment 1 Adrian Chadd freebsd_committer freebsd_triage 2011-05-11 04:40:03 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-wireless

Bump
Comment 2 Adrian Chadd freebsd_committer freebsd_triage 2011-05-11 07:04:20 UTC
I've disabled the diversity combining algorithm for now. HEAD works
fine now without it - cards that support fast diversity simply leave
it enabled by default (and the hardware does it) but without the
software changing the LNA/gain table/diversity bias configuration.

I think the main/alt logic is mis-classifying packets. I'll do some
further digging and reimplement things before I re-enable it.


Adrian
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:46:15 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.