]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ath9k: add support for reporting per-chain signal strength
authorFelix Fietkau <nbd@openwrt.org>
Sat, 14 Dec 2013 17:03:36 +0000 (18:03 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 18 Dec 2013 20:23:19 +0000 (15:23 -0500)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/antenna.c
drivers/net/wireless/ath/ath9k/ar9003_mac.c
drivers/net/wireless/ath/ath9k/dfs.c
drivers/net/wireless/ath/ath9k/mac.c
drivers/net/wireless/ath/ath9k/mac.h
drivers/net/wireless/ath/ath9k/recv.c

index bd048cc69a334d6234b6967ecff5e1aec8b75fbe..a3668433dc02b6c35df882367e6f441a811ce6f8 100644 (file)
@@ -724,14 +724,14 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
        struct ath_ant_comb *antcomb = &sc->ant_comb;
        int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set;
        int curr_main_set;
-       int main_rssi = rs->rs_rssi_ctl0;
-       int alt_rssi = rs->rs_rssi_ctl1;
+       int main_rssi = rs->rs_rssi_ctl[0];
+       int alt_rssi = rs->rs_rssi_ctl[1];
        int rx_ant_conf,  main_ant_conf;
        bool short_scan = false, ret;
 
-       rx_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_CURRENT_SHIFT) &
+       rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) &
                       ATH_ANT_RX_MASK;
-       main_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_MAIN_SHIFT) &
+       main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) &
                         ATH_ANT_RX_MASK;
 
        if (alt_rssi >= antcomb->low_rssi_thresh) {
index f6c5c1b50471ee2f876d24238b6912182c449f13..6eb8657681bf5023e2a1c2cb311e6f06241fd2a5 100644 (file)
@@ -476,12 +476,12 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 
        /* XXX: Keycache */
        rxs->rs_rssi = MS(rxsp->status5, AR_RxRSSICombined);
-       rxs->rs_rssi_ctl0 = MS(rxsp->status1, AR_RxRSSIAnt00);
-       rxs->rs_rssi_ctl1 = MS(rxsp->status1, AR_RxRSSIAnt01);
-       rxs->rs_rssi_ctl2 = MS(rxsp->status1, AR_RxRSSIAnt02);
-       rxs->rs_rssi_ext0 = MS(rxsp->status5, AR_RxRSSIAnt10);
-       rxs->rs_rssi_ext1 = MS(rxsp->status5, AR_RxRSSIAnt11);
-       rxs->rs_rssi_ext2 = MS(rxsp->status5, AR_RxRSSIAnt12);
+       rxs->rs_rssi_ctl[0] = MS(rxsp->status1, AR_RxRSSIAnt00);
+       rxs->rs_rssi_ctl[1] = MS(rxsp->status1, AR_RxRSSIAnt01);
+       rxs->rs_rssi_ctl[2] = MS(rxsp->status1, AR_RxRSSIAnt02);
+       rxs->rs_rssi_ext[0] = MS(rxsp->status5, AR_RxRSSIAnt10);
+       rxs->rs_rssi_ext[1] = MS(rxsp->status5, AR_RxRSSIAnt11);
+       rxs->rs_rssi_ext[2] = MS(rxsp->status5, AR_RxRSSIAnt12);
 
        if (rxsp->status11 & AR_RxKeyIdxValid)
                rxs->rs_keyix = MS(rxsp->status11, AR_KeyIdx);
index 7187d3671512eae62e3e1da59bb1aea9866a7be8..857bb28b389411ea2e1586abd3f5c749c0127327 100644 (file)
@@ -158,8 +158,8 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
                return;
        }
 
-       ard.rssi = rs->rs_rssi_ctl0;
-       ard.ext_rssi = rs->rs_rssi_ext0;
+       ard.rssi = rs->rs_rssi_ctl[0];
+       ard.ext_rssi = rs->rs_rssi_ext[0];
 
        /*
         * hardware stores this as 8 bit signed value.
index 6a18f9d3e9cc952ef116f9fda1bf56f37526d8bc..a8504822b4fdca0010f822dabf4eee52bf831804 100644 (file)
@@ -550,25 +550,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 
        if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) {
                rs->rs_rssi = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ctl0 = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ctl1 = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ctl2 = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ext0 = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ext1 = ATH9K_RSSI_BAD;
-               rs->rs_rssi_ext2 = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ctl[0] = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ctl[1] = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ctl[2] = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ext[0] = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ext[1] = ATH9K_RSSI_BAD;
+               rs->rs_rssi_ext[2] = ATH9K_RSSI_BAD;
        } else {
                rs->rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined);
-               rs->rs_rssi_ctl0 = MS(ads.ds_rxstatus0,
+               rs->rs_rssi_ctl[0] = MS(ads.ds_rxstatus0,
                                                AR_RxRSSIAnt00);
-               rs->rs_rssi_ctl1 = MS(ads.ds_rxstatus0,
+               rs->rs_rssi_ctl[1] = MS(ads.ds_rxstatus0,
                                                AR_RxRSSIAnt01);
-               rs->rs_rssi_ctl2 = MS(ads.ds_rxstatus0,
+               rs->rs_rssi_ctl[2] = MS(ads.ds_rxstatus0,
                                                AR_RxRSSIAnt02);
-               rs->rs_rssi_ext0 = MS(ads.ds_rxstatus4,
+               rs->rs_rssi_ext[0] = MS(ads.ds_rxstatus4,
                                                AR_RxRSSIAnt10);
-               rs->rs_rssi_ext1 = MS(ads.ds_rxstatus4,
+               rs->rs_rssi_ext[1] = MS(ads.ds_rxstatus4,
                                                AR_RxRSSIAnt11);
-               rs->rs_rssi_ext2 = MS(ads.ds_rxstatus4,
+               rs->rs_rssi_ext[2] = MS(ads.ds_rxstatus4,
                                                AR_RxRSSIAnt12);
        }
        if (ads.ds_rxstatus8 & AR_RxKeyIdxValid)
index e3eed81f24391c61b1389a749d471cf4ad662056..10271373a0cd1081fa89b53ee35992982fd7679b 100644 (file)
@@ -133,12 +133,8 @@ struct ath_rx_status {
        u8 rs_rate;
        u8 rs_antenna;
        u8 rs_more;
-       int8_t rs_rssi_ctl0;
-       int8_t rs_rssi_ctl1;
-       int8_t rs_rssi_ctl2;
-       int8_t rs_rssi_ext0;
-       int8_t rs_rssi_ext1;
-       int8_t rs_rssi_ext2;
+       int8_t rs_rssi_ctl[3];
+       int8_t rs_rssi_ext[3];
        u8 rs_isaggr;
        u8 rs_firstaggr;
        u8 rs_moreaggr;
index 95ddca5495d492cb5a1bf4bb99d8ee3283a9e1ec..2410224b6defb48866cb9b9afeeec05f54df44f7 100644 (file)
@@ -906,6 +906,7 @@ static void ath9k_process_rssi(struct ath_common *common,
        struct ath_hw *ah = common->ah;
        int last_rssi;
        int rssi = rx_stats->rs_rssi;
+       int i, j;
 
        /*
         * RSSI is not available for subframes in an A-MPDU.
@@ -924,6 +925,20 @@ static void ath9k_process_rssi(struct ath_common *common,
                return;
        }
 
+       for (i = 0, j = 0; i < ARRAY_SIZE(rx_stats->rs_rssi_ctl); i++) {
+               s8 rssi;
+
+               if (!(ah->rxchainmask & BIT(i)))
+                       continue;
+
+               rssi = rx_stats->rs_rssi_ctl[i];
+               if (rssi != ATH9K_RSSI_BAD) {
+                   rxs->chains |= BIT(j);
+                   rxs->chain_signal[j] = ah->noise + rssi;
+               }
+               j++;
+       }
+
        /*
         * Update Beacon RSSI, this is used by ANI.
         */
@@ -1073,14 +1088,14 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
                fft_sample_40.channel_type = chan_type;
 
                if (chan_type == NL80211_CHAN_HT40PLUS) {
-                       lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
-                       upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
+                       lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
+                       upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
 
                        fft_sample_40.lower_noise = ah->noise;
                        fft_sample_40.upper_noise = ext_nf;
                } else {
-                       lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext0);
-                       upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
+                       lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
+                       upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
 
                        fft_sample_40.lower_noise = ext_nf;
                        fft_sample_40.upper_noise = ah->noise;
@@ -1116,7 +1131,7 @@ static int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
                fft_sample_20.tlv.length = __cpu_to_be16(length);
                fft_sample_20.freq = __cpu_to_be16(freq);
 
-               fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
+               fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
                fft_sample_20.noise = ah->noise;
 
                mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;