mac80211: update to wireless-testing 2013-06-27, fix ATH_USER_REGD handling
[openwrt/svn-archive/archive.git] / package / kernel / mac80211 / patches / 522-ath9k_per_chain_signal_strength.patch
1 --- a/drivers/net/wireless/ath/ath9k/mac.h
2 +++ b/drivers/net/wireless/ath/ath9k/mac.h
3 @@ -133,12 +133,8 @@ struct ath_rx_status {
4 u8 rs_rate;
5 u8 rs_antenna;
6 u8 rs_more;
7 - int8_t rs_rssi_ctl0;
8 - int8_t rs_rssi_ctl1;
9 - int8_t rs_rssi_ctl2;
10 - int8_t rs_rssi_ext0;
11 - int8_t rs_rssi_ext1;
12 - int8_t rs_rssi_ext2;
13 + int8_t rs_rssi_ctl[3];
14 + int8_t rs_rssi_ext[3];
15 u8 rs_isaggr;
16 u8 rs_moreaggr;
17 u8 rs_num_delims;
18 --- a/drivers/net/wireless/ath/ath9k/recv.c
19 +++ b/drivers/net/wireless/ath/ath9k/recv.c
20 @@ -939,6 +939,7 @@ static int ath9k_rx_skb_preprocess(struc
21 struct ath_hw *ah = sc->sc_ah;
22 struct ath_common *common = ath9k_hw_common(ah);
23 bool discard_current = sc->rx.discard_next;
24 + int i, j;
25
26 sc->rx.discard_next = rx_stats->rs_more;
27 if (discard_current)
28 @@ -968,6 +969,21 @@ static int ath9k_rx_skb_preprocess(struc
29 if (rx_stats->rs_moreaggr)
30 rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL;
31
32 + for (i = 0, j = 0; i < ARRAY_SIZE(rx_stats->rs_rssi_ctl); i++) {
33 + s8 rssi;
34 +
35 + if (!(ah->rxchainmask & BIT(i)))
36 + continue;
37 +
38 + rssi = rx_stats->rs_rssi_ctl[i];
39 + if (rssi != ATH9K_RSSI_BAD) {
40 + rx_status->chains |= BIT(j);
41 + rx_status->chain_signal[j] = ah->noise + rssi;
42 + }
43 + j++;
44 + }
45 +
46 +
47 sc->rx.discard_next = false;
48 return 0;
49 }
50 @@ -1077,7 +1093,7 @@ static int ath_process_fft(struct ath_so
51 fft_sample.tlv.length = __cpu_to_be16(length);
52
53 fft_sample.freq = __cpu_to_be16(ah->curchan->chan->center_freq);
54 - fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl0);
55 + fft_sample.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
56 fft_sample.noise = ah->noise;
57
58 switch (len - SPECTRAL_HT20_TOTAL_DATA_LEN) {
59 --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
60 +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
61 @@ -476,12 +476,12 @@ int ath9k_hw_process_rxdesc_edma(struct
62
63 /* XXX: Keycache */
64 rxs->rs_rssi = MS(rxsp->status5, AR_RxRSSICombined);
65 - rxs->rs_rssi_ctl0 = MS(rxsp->status1, AR_RxRSSIAnt00);
66 - rxs->rs_rssi_ctl1 = MS(rxsp->status1, AR_RxRSSIAnt01);
67 - rxs->rs_rssi_ctl2 = MS(rxsp->status1, AR_RxRSSIAnt02);
68 - rxs->rs_rssi_ext0 = MS(rxsp->status5, AR_RxRSSIAnt10);
69 - rxs->rs_rssi_ext1 = MS(rxsp->status5, AR_RxRSSIAnt11);
70 - rxs->rs_rssi_ext2 = MS(rxsp->status5, AR_RxRSSIAnt12);
71 + rxs->rs_rssi_ctl[0] = MS(rxsp->status1, AR_RxRSSIAnt00);
72 + rxs->rs_rssi_ctl[1] = MS(rxsp->status1, AR_RxRSSIAnt01);
73 + rxs->rs_rssi_ctl[2] = MS(rxsp->status1, AR_RxRSSIAnt02);
74 + rxs->rs_rssi_ext[0] = MS(rxsp->status5, AR_RxRSSIAnt10);
75 + rxs->rs_rssi_ext[1] = MS(rxsp->status5, AR_RxRSSIAnt11);
76 + rxs->rs_rssi_ext[2] = MS(rxsp->status5, AR_RxRSSIAnt12);
77
78 if (rxsp->status11 & AR_RxKeyIdxValid)
79 rxs->rs_keyix = MS(rxsp->status11, AR_KeyIdx);
80 --- a/drivers/net/wireless/ath/ath9k/mac.c
81 +++ b/drivers/net/wireless/ath/ath9k/mac.c
82 @@ -554,25 +554,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
83
84 if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) {
85 rs->rs_rssi = ATH9K_RSSI_BAD;
86 - rs->rs_rssi_ctl0 = ATH9K_RSSI_BAD;
87 - rs->rs_rssi_ctl1 = ATH9K_RSSI_BAD;
88 - rs->rs_rssi_ctl2 = ATH9K_RSSI_BAD;
89 - rs->rs_rssi_ext0 = ATH9K_RSSI_BAD;
90 - rs->rs_rssi_ext1 = ATH9K_RSSI_BAD;
91 - rs->rs_rssi_ext2 = ATH9K_RSSI_BAD;
92 + rs->rs_rssi_ctl[0] = ATH9K_RSSI_BAD;
93 + rs->rs_rssi_ctl[1] = ATH9K_RSSI_BAD;
94 + rs->rs_rssi_ctl[2] = ATH9K_RSSI_BAD;
95 + rs->rs_rssi_ext[0] = ATH9K_RSSI_BAD;
96 + rs->rs_rssi_ext[1] = ATH9K_RSSI_BAD;
97 + rs->rs_rssi_ext[2] = ATH9K_RSSI_BAD;
98 } else {
99 rs->rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined);
100 - rs->rs_rssi_ctl0 = MS(ads.ds_rxstatus0,
101 + rs->rs_rssi_ctl[0] = MS(ads.ds_rxstatus0,
102 AR_RxRSSIAnt00);
103 - rs->rs_rssi_ctl1 = MS(ads.ds_rxstatus0,
104 + rs->rs_rssi_ctl[1] = MS(ads.ds_rxstatus0,
105 AR_RxRSSIAnt01);
106 - rs->rs_rssi_ctl2 = MS(ads.ds_rxstatus0,
107 + rs->rs_rssi_ctl[2] = MS(ads.ds_rxstatus0,
108 AR_RxRSSIAnt02);
109 - rs->rs_rssi_ext0 = MS(ads.ds_rxstatus4,
110 + rs->rs_rssi_ext[0] = MS(ads.ds_rxstatus4,
111 AR_RxRSSIAnt10);
112 - rs->rs_rssi_ext1 = MS(ads.ds_rxstatus4,
113 + rs->rs_rssi_ext[1] = MS(ads.ds_rxstatus4,
114 AR_RxRSSIAnt11);
115 - rs->rs_rssi_ext2 = MS(ads.ds_rxstatus4,
116 + rs->rs_rssi_ext[2] = MS(ads.ds_rxstatus4,
117 AR_RxRSSIAnt12);
118 }
119 if (ads.ds_rxstatus8 & AR_RxKeyIdxValid)
120 --- a/drivers/net/wireless/ath/ath9k/dfs.c
121 +++ b/drivers/net/wireless/ath/ath9k/dfs.c
122 @@ -158,8 +158,8 @@ void ath9k_dfs_process_phyerr(struct ath
123 return;
124 }
125
126 - ard.rssi = rs->rs_rssi_ctl0;
127 - ard.ext_rssi = rs->rs_rssi_ext0;
128 + ard.rssi = rs->rs_rssi_ctl[0];
129 + ard.ext_rssi = rs->rs_rssi_ext[0];
130
131 /*
132 * hardware stores this as 8 bit signed value.
133 --- a/drivers/net/wireless/ath/ath9k/antenna.c
134 +++ b/drivers/net/wireless/ath/ath9k/antenna.c
135 @@ -546,14 +546,14 @@ void ath_ant_comb_scan(struct ath_softc
136 struct ath_ant_comb *antcomb = &sc->ant_comb;
137 int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set;
138 int curr_main_set;
139 - int main_rssi = rs->rs_rssi_ctl0;
140 - int alt_rssi = rs->rs_rssi_ctl1;
141 + int main_rssi = rs->rs_rssi_ctl[0];
142 + int alt_rssi = rs->rs_rssi_ctl[1];
143 int rx_ant_conf, main_ant_conf;
144 bool short_scan = false;
145
146 - rx_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_CURRENT_SHIFT) &
147 + rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) &
148 ATH_ANT_RX_MASK;
149 - main_ant_conf = (rs->rs_rssi_ctl2 >> ATH_ANT_RX_MAIN_SHIFT) &
150 + main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) &
151 ATH_ANT_RX_MASK;
152
153 /* Record packet only when both main_rssi and alt_rssi is positive */