diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-11-02 21:49:56 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-11 17:09:03 -0500 |
commit | 26ab2645b478fd98aa1d10a07eb07f2235bc1f1c (patch) | |
tree | 1e4a7beb11b56727ef3f36e1f00c0349d6b23866 | |
parent | f52de03bf9843673cadff8016a609e1628c139e2 (diff) |
ath9k: do not pass the entire descriptor to ath_rx_prepare()
Its not needed, so just pass the hardware RX status.
We'll be simplfying ath_rx_prepare() with code we can share
between ath9k and ath9k_htc. This will help make that code
easier to read and manage.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index c6904f0d572f..fd45f775e1f6 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -106,7 +106,7 @@ static u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp) | |||
106 | * decryption key or real decryption error. This let us keep statistics there. | 106 | * decryption key or real decryption error. This let us keep statistics there. |
107 | */ | 107 | */ |
108 | static int ath_rx_prepare(struct ieee80211_hw *hw, | 108 | static int ath_rx_prepare(struct ieee80211_hw *hw, |
109 | struct sk_buff *skb, struct ath_desc *ds, | 109 | struct sk_buff *skb, struct ath_rx_status *rx_stats, |
110 | struct ieee80211_rx_status *rx_status, bool *decrypt_error, | 110 | struct ieee80211_rx_status *rx_status, bool *decrypt_error, |
111 | struct ath_softc *sc) | 111 | struct ath_softc *sc) |
112 | { | 112 | { |
@@ -121,7 +121,7 @@ static int ath_rx_prepare(struct ieee80211_hw *hw, | |||
121 | fc = hdr->frame_control; | 121 | fc = hdr->frame_control; |
122 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 122 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
123 | 123 | ||
124 | if (ds->ds_rxstat.rs_more) { | 124 | if (rx_stats->rs_more) { |
125 | /* | 125 | /* |
126 | * Frame spans multiple descriptors; this cannot happen yet | 126 | * Frame spans multiple descriptors; this cannot happen yet |
127 | * as we don't support jumbograms. If not in monitor mode, | 127 | * as we don't support jumbograms. If not in monitor mode, |
@@ -130,22 +130,22 @@ static int ath_rx_prepare(struct ieee80211_hw *hw, | |||
130 | */ | 130 | */ |
131 | if (sc->sc_ah->opmode != NL80211_IFTYPE_MONITOR) | 131 | if (sc->sc_ah->opmode != NL80211_IFTYPE_MONITOR) |
132 | goto rx_next; | 132 | goto rx_next; |
133 | } else if (ds->ds_rxstat.rs_status != 0) { | 133 | } else if (rx_stats->rs_status != 0) { |
134 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC) | 134 | if (rx_stats->rs_status & ATH9K_RXERR_CRC) |
135 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; | 135 | rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; |
136 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_PHY) | 136 | if (rx_stats->rs_status & ATH9K_RXERR_PHY) |
137 | goto rx_next; | 137 | goto rx_next; |
138 | 138 | ||
139 | if (ds->ds_rxstat.rs_status & ATH9K_RXERR_DECRYPT) { | 139 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { |
140 | *decrypt_error = true; | 140 | *decrypt_error = true; |
141 | } else if (ds->ds_rxstat.rs_status & ATH9K_RXERR_MIC) { | 141 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { |
142 | if (ieee80211_is_ctl(fc)) | 142 | if (ieee80211_is_ctl(fc)) |
143 | /* | 143 | /* |
144 | * Sometimes, we get invalid | 144 | * Sometimes, we get invalid |
145 | * MIC failures on valid control frames. | 145 | * MIC failures on valid control frames. |
146 | * Remove these mic errors. | 146 | * Remove these mic errors. |
147 | */ | 147 | */ |
148 | ds->ds_rxstat.rs_status &= ~ATH9K_RXERR_MIC; | 148 | rx_stats->rs_status &= ~ATH9K_RXERR_MIC; |
149 | else | 149 | else |
150 | rx_status->flag |= RX_FLAG_MMIC_ERROR; | 150 | rx_status->flag |= RX_FLAG_MMIC_ERROR; |
151 | } | 151 | } |
@@ -155,26 +155,26 @@ static int ath_rx_prepare(struct ieee80211_hw *hw, | |||
155 | * we also ignore the CRC error. | 155 | * we also ignore the CRC error. |
156 | */ | 156 | */ |
157 | if (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR) { | 157 | if (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR) { |
158 | if (ds->ds_rxstat.rs_status & | 158 | if (rx_stats->rs_status & |
159 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | | 159 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | |
160 | ATH9K_RXERR_CRC)) | 160 | ATH9K_RXERR_CRC)) |
161 | goto rx_next; | 161 | goto rx_next; |
162 | } else { | 162 | } else { |
163 | if (ds->ds_rxstat.rs_status & | 163 | if (rx_stats->rs_status & |
164 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) { | 164 | ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) { |
165 | goto rx_next; | 165 | goto rx_next; |
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | ratecode = ds->ds_rxstat.rs_rate; | 170 | ratecode = rx_stats->rs_rate; |
171 | 171 | ||
172 | if (ratecode & 0x80) { | 172 | if (ratecode & 0x80) { |
173 | /* HT rate */ | 173 | /* HT rate */ |
174 | rx_status->flag |= RX_FLAG_HT; | 174 | rx_status->flag |= RX_FLAG_HT; |
175 | if (ds->ds_rxstat.rs_flags & ATH9K_RX_2040) | 175 | if (rx_stats->rs_flags & ATH9K_RX_2040) |
176 | rx_status->flag |= RX_FLAG_40MHZ; | 176 | rx_status->flag |= RX_FLAG_40MHZ; |
177 | if (ds->ds_rxstat.rs_flags & ATH9K_RX_GI) | 177 | if (rx_stats->rs_flags & ATH9K_RX_GI) |
178 | rx_status->flag |= RX_FLAG_SHORT_GI; | 178 | rx_status->flag |= RX_FLAG_SHORT_GI; |
179 | rx_status->rate_idx = ratecode & 0x7f; | 179 | rx_status->rate_idx = ratecode & 0x7f; |
180 | } else { | 180 | } else { |
@@ -204,31 +204,31 @@ static int ath_rx_prepare(struct ieee80211_hw *hw, | |||
204 | sta = ieee80211_find_sta_by_hw(hw, hdr->addr2); | 204 | sta = ieee80211_find_sta_by_hw(hw, hdr->addr2); |
205 | if (sta) { | 205 | if (sta) { |
206 | an = (struct ath_node *) sta->drv_priv; | 206 | an = (struct ath_node *) sta->drv_priv; |
207 | if (ds->ds_rxstat.rs_rssi != ATH9K_RSSI_BAD && | 207 | if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && |
208 | !ds->ds_rxstat.rs_moreaggr) | 208 | !rx_stats->rs_moreaggr) |
209 | ATH_RSSI_LPF(an->last_rssi, ds->ds_rxstat.rs_rssi); | 209 | ATH_RSSI_LPF(an->last_rssi, rx_stats->rs_rssi); |
210 | last_rssi = an->last_rssi; | 210 | last_rssi = an->last_rssi; |
211 | } | 211 | } |
212 | rcu_read_unlock(); | 212 | rcu_read_unlock(); |
213 | 213 | ||
214 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | 214 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) |
215 | ds->ds_rxstat.rs_rssi = ATH_EP_RND(last_rssi, | 215 | rx_stats->rs_rssi = ATH_EP_RND(last_rssi, |
216 | ATH_RSSI_EP_MULTIPLIER); | 216 | ATH_RSSI_EP_MULTIPLIER); |
217 | if (ds->ds_rxstat.rs_rssi < 0) | 217 | if (rx_stats->rs_rssi < 0) |
218 | ds->ds_rxstat.rs_rssi = 0; | 218 | rx_stats->rs_rssi = 0; |
219 | else if (ds->ds_rxstat.rs_rssi > 127) | 219 | else if (rx_stats->rs_rssi > 127) |
220 | ds->ds_rxstat.rs_rssi = 127; | 220 | rx_stats->rs_rssi = 127; |
221 | 221 | ||
222 | /* Update Beacon RSSI, this is used by ANI. */ | 222 | /* Update Beacon RSSI, this is used by ANI. */ |
223 | if (ieee80211_is_beacon(fc)) | 223 | if (ieee80211_is_beacon(fc)) |
224 | sc->sc_ah->stats.avgbrssi = ds->ds_rxstat.rs_rssi; | 224 | sc->sc_ah->stats.avgbrssi = rx_stats->rs_rssi; |
225 | 225 | ||
226 | rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp); | 226 | rx_status->mactime = ath_extend_tsf(sc, rx_stats->rs_tstamp); |
227 | rx_status->band = hw->conf.channel->band; | 227 | rx_status->band = hw->conf.channel->band; |
228 | rx_status->freq = hw->conf.channel->center_freq; | 228 | rx_status->freq = hw->conf.channel->center_freq; |
229 | rx_status->noise = sc->ani.noise_floor; | 229 | rx_status->noise = sc->ani.noise_floor; |
230 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + ds->ds_rxstat.rs_rssi; | 230 | rx_status->signal = ATH_DEFAULT_NOISE_FLOOR + rx_stats->rs_rssi; |
231 | rx_status->antenna = ds->ds_rxstat.rs_antenna; | 231 | rx_status->antenna = rx_stats->rs_antenna; |
232 | 232 | ||
233 | /* | 233 | /* |
234 | * Theory for reporting quality: | 234 | * Theory for reporting quality: |
@@ -252,9 +252,9 @@ static int ath_rx_prepare(struct ieee80211_hw *hw, | |||
252 | * | 252 | * |
253 | */ | 253 | */ |
254 | if (conf_is_ht(&hw->conf)) | 254 | if (conf_is_ht(&hw->conf)) |
255 | rx_status->qual = ds->ds_rxstat.rs_rssi * 100 / 45; | 255 | rx_status->qual = rx_stats->rs_rssi * 100 / 45; |
256 | else | 256 | else |
257 | rx_status->qual = ds->ds_rxstat.rs_rssi * 100 / 35; | 257 | rx_status->qual = rx_stats->rs_rssi * 100 / 35; |
258 | 258 | ||
259 | /* rssi can be more than 45 though, anything above that | 259 | /* rssi can be more than 45 though, anything above that |
260 | * should be considered at 100% */ | 260 | * should be considered at 100% */ |
@@ -659,6 +659,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
659 | 659 | ||
660 | struct ath_buf *bf; | 660 | struct ath_buf *bf; |
661 | struct ath_desc *ds; | 661 | struct ath_desc *ds; |
662 | struct ath_rx_status *rx_stats; | ||
662 | struct sk_buff *skb = NULL, *requeue_skb; | 663 | struct sk_buff *skb = NULL, *requeue_skb; |
663 | struct ieee80211_rx_status rx_status; | 664 | struct ieee80211_rx_status rx_status; |
664 | struct ath_hw *ah = sc->sc_ah; | 665 | struct ath_hw *ah = sc->sc_ah; |
@@ -750,6 +751,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
750 | 751 | ||
751 | hdr = (struct ieee80211_hdr *) skb->data; | 752 | hdr = (struct ieee80211_hdr *) skb->data; |
752 | hw = ath_get_virt_hw(sc, hdr); | 753 | hw = ath_get_virt_hw(sc, hdr); |
754 | rx_stats = &ds->ds_rxstat; | ||
753 | 755 | ||
754 | /* | 756 | /* |
755 | * If we're asked to flush receive queue, directly | 757 | * If we're asked to flush receive queue, directly |
@@ -758,14 +760,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
758 | if (flush) | 760 | if (flush) |
759 | goto requeue; | 761 | goto requeue; |
760 | 762 | ||
761 | if (!ds->ds_rxstat.rs_datalen) | 763 | if (!rx_stats->rs_datalen) |
762 | goto requeue; | 764 | goto requeue; |
763 | 765 | ||
764 | /* The status portion of the descriptor could get corrupted. */ | 766 | /* The status portion of the descriptor could get corrupted. */ |
765 | if (sc->rx.bufsize < ds->ds_rxstat.rs_datalen) | 767 | if (sc->rx.bufsize < rx_stats->rs_datalen) |
766 | goto requeue; | 768 | goto requeue; |
767 | 769 | ||
768 | if (!ath_rx_prepare(hw, skb, ds, | 770 | if (!ath_rx_prepare(hw, skb, rx_stats, |
769 | &rx_status, &decrypt_error, sc)) | 771 | &rx_status, &decrypt_error, sc)) |
770 | goto requeue; | 772 | goto requeue; |
771 | 773 | ||
@@ -785,7 +787,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
785 | sc->rx.bufsize, | 787 | sc->rx.bufsize, |
786 | DMA_FROM_DEVICE); | 788 | DMA_FROM_DEVICE); |
787 | 789 | ||
788 | skb_put(skb, ds->ds_rxstat.rs_datalen); | 790 | skb_put(skb, rx_stats->rs_datalen); |
789 | 791 | ||
790 | /* see if any padding is done by the hw and remove it */ | 792 | /* see if any padding is done by the hw and remove it */ |
791 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 793 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
@@ -805,7 +807,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
805 | skb_pull(skb, padsize); | 807 | skb_pull(skb, padsize); |
806 | } | 808 | } |
807 | 809 | ||
808 | keyix = ds->ds_rxstat.rs_keyix; | 810 | keyix = rx_stats->rs_keyix; |
809 | 811 | ||
810 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) { | 812 | if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) { |
811 | rx_status.flag |= RX_FLAG_DECRYPTED; | 813 | rx_status.flag |= RX_FLAG_DECRYPTED; |
@@ -845,7 +847,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
845 | */ | 847 | */ |
846 | if (sc->rx.defant != ds->ds_rxstat.rs_antenna) { | 848 | if (sc->rx.defant != ds->ds_rxstat.rs_antenna) { |
847 | if (++sc->rx.rxotherant >= 3) | 849 | if (++sc->rx.rxotherant >= 3) |
848 | ath_setdefantenna(sc, ds->ds_rxstat.rs_antenna); | 850 | ath_setdefantenna(sc, rx_stats->rs_antenna); |
849 | } else { | 851 | } else { |
850 | sc->rx.rxotherant = 0; | 852 | sc->rx.rxotherant = 0; |
851 | } | 853 | } |