ath9k: add some cleanups and minor fixes
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 522-ath9k_per_chain_signal_strength.patch
index 50dbcd9..5a6c503 100644 (file)
 +      int8_t rs_rssi_ctl[3];
 +      int8_t rs_rssi_ext[3];
        u8 rs_isaggr;
+       u8 rs_firstaggr;
        u8 rs_moreaggr;
-       u8 rs_num_delims;
 --- a/drivers/net/wireless/ath/ath9k/recv.c
 +++ b/drivers/net/wireless/ath/ath9k/recv.c
-@@ -939,6 +939,7 @@ static int ath9k_rx_skb_preprocess(struc
-       struct ath_hw *ah = sc->sc_ah;
-       struct ath_common *common = ath9k_hw_common(ah);
-       bool discard_current = sc->rx.discard_next;
+@@ -892,6 +892,7 @@ static void ath9k_process_rssi(struct at
+       struct ath_hw *ah = common->ah;
+       int last_rssi;
+       int rssi = rx_stats->rs_rssi;
 +      int i, j;
  
-       sc->rx.discard_next = rx_stats->rs_more;
-       if (discard_current)
-@@ -968,6 +969,21 @@ static int ath9k_rx_skb_preprocess(struc
-       if (rx_stats->rs_moreaggr)
-               rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
+       /*
+        * RSSI is not available for subframes in an A-MPDU.
+@@ -910,6 +911,20 @@ static void ath9k_process_rssi(struct at
+               return;
+       }
  
 +      for (i = 0, j = 0; i < ARRAY_SIZE(rx_stats->rs_rssi_ctl); i++) {
 +              s8 rssi;
 +
 +              rssi = rx_stats->rs_rssi_ctl[i];
 +              if (rssi != ATH9K_RSSI_BAD) {
-+                  rx_status->chains |= BIT(j);
-+                  rx_status->chain_signal[j] = ah->noise + rssi;
++                  rxs->chains |= BIT(j);
++                  rxs->chain_signal[j] = ah->noise + rssi;
 +              }
 +              j++;
 +      }
 +
-+
-       sc->rx.discard_next = false;
-       return 0;
- }
-@@ -1077,7 +1093,7 @@ static int ath_process_fft(struct ath_so
+       /*
+        * Update Beacon RSSI, this is used by ANI.
+        */
+@@ -1000,7 +1015,7 @@ static int ath_process_fft(struct ath_so
        fft_sample.tlv.length = __cpu_to_be16(length);
  
        fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq);
@@ -79,7 +78,7 @@
                rxs->rs_keyix = MS(rxsp->status11, AR_KeyIdx);
 --- a/drivers/net/wireless/ath/ath9k/mac.c
 +++ b/drivers/net/wireless/ath/ath9k/mac.c
-@@ -554,25 +554,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
+@@ -550,25 +550,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
  
        if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) {
                rs->rs_rssi = ATH9K_RSSI_BAD;
         * hardware stores this as 8 bit signed value.
 --- a/drivers/net/wireless/ath/ath9k/antenna.c
 +++ b/drivers/net/wireless/ath/ath9k/antenna.c
-@@ -546,14 +546,14 @@ void ath_ant_comb_scan(struct ath_softc 
+@@ -744,14 +744,14 @@ void ath_ant_comb_scan(struct ath_softc 
        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_ctl[0];
 +      int alt_rssi = rs->rs_rssi_ctl[1];
        int rx_ant_conf,  main_ant_conf;
-       bool short_scan = false;
+       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) &
 +      main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) &
                         ATH_ANT_RX_MASK;
  
-       /* Record packet only when both main_rssi and  alt_rssi is positive */
+       if (alt_rssi >= antcomb->low_rssi_thresh) {