aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-11-03 18:57:16 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 17:09:04 -0500
commit712c13a86affe69dd8462631808edd5825b5e1cb (patch)
treebe56ba014a3ffd3f162bc7e606e1f1dc5f2eee35 /drivers/net/wireless
parent3d536acf45ba65acb15fc65bf46f8d6c7ad6c463 (diff)
ath9k: use the ieee80211_hw to get to an sband on ath_rx_prepare()
No need to use the private driver structure to get to an sband. This will make it easier to share this code with ath9k_htc. With the sc gone we can now just pass the common structure to ath_rx_prepare(). Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 403debb4ec11..fa78914cbfb1 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -91,18 +91,19 @@ static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
91 * up the frame up to let mac80211 handle the actual error case, be it no 91 * up the frame up to let mac80211 handle the actual error case, be it no
92 * decryption key or real decryption error. This let us keep statistics there. 92 * decryption key or real decryption error. This let us keep statistics there.
93 */ 93 */
94static int ath_rx_prepare(struct ieee80211_hw *hw, 94static int ath_rx_prepare(struct ath_common *common,
95 struct ieee80211_hw *hw,
95 struct sk_buff *skb, struct ath_rx_status *rx_stats, 96 struct sk_buff *skb, struct ath_rx_status *rx_stats,
96 struct ieee80211_rx_status *rx_status, bool *decrypt_error, 97 struct ieee80211_rx_status *rx_status,
97 struct ath_softc *sc) 98 bool *decrypt_error)
98{ 99{
100 struct ath_hw *ah = common->ah;
99 struct ieee80211_hdr *hdr; 101 struct ieee80211_hdr *hdr;
100 u8 ratecode; 102 u8 ratecode;
101 __le16 fc; 103 __le16 fc;
102 struct ieee80211_sta *sta; 104 struct ieee80211_sta *sta;
103 struct ath_node *an; 105 struct ath_node *an;
104 int last_rssi = ATH_RSSI_DUMMY_MARKER; 106 int last_rssi = ATH_RSSI_DUMMY_MARKER;
105 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
106 107
107 hdr = (struct ieee80211_hdr *)skb->data; 108 hdr = (struct ieee80211_hdr *)skb->data;
108 fc = hdr->frame_control; 109 fc = hdr->frame_control;
@@ -115,7 +116,7 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
115 * discard the frame. Enable this if you want to see 116 * discard the frame. Enable this if you want to see
116 * error frames in Monitor mode. 117 * error frames in Monitor mode.
117 */ 118 */
118 if (sc->sc_ah->opmode != NL80211_IFTYPE_MONITOR) 119 if (ah->opmode != NL80211_IFTYPE_MONITOR)
119 goto rx_next; 120 goto rx_next;
120 } else if (rx_stats->rs_status != 0) { 121 } else if (rx_stats->rs_status != 0) {
121 if (rx_stats->rs_status & ATH9K_RXERR_CRC) 122 if (rx_stats->rs_status & ATH9K_RXERR_CRC)
@@ -141,7 +142,7 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
141 * decryption and MIC failures. For monitor mode, 142 * decryption and MIC failures. For monitor mode,
142 * we also ignore the CRC error. 143 * we also ignore the CRC error.
143 */ 144 */
144 if (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR) { 145 if (ah->opmode == NL80211_IFTYPE_MONITOR) {
145 if (rx_stats->rs_status & 146 if (rx_stats->rs_status &
146 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | 147 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
147 ATH9K_RXERR_CRC)) 148 ATH9K_RXERR_CRC))
@@ -165,20 +166,20 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
165 rx_status->flag |= RX_FLAG_SHORT_GI; 166 rx_status->flag |= RX_FLAG_SHORT_GI;
166 rx_status->rate_idx = ratecode & 0x7f; 167 rx_status->rate_idx = ratecode & 0x7f;
167 } else { 168 } else {
168 int i = 0, cur_band, n_rates; 169 struct ieee80211_supported_band *sband;
170 unsigned int i = 0;
171 enum ieee80211_band band;
169 172
170 cur_band = hw->conf.channel->band; 173 band = hw->conf.channel->band;
171 n_rates = sc->sbands[cur_band].n_bitrates; 174 sband = hw->wiphy->bands[band];
172 175
173 for (i = 0; i < n_rates; i++) { 176 for (i = 0; i < sband->n_bitrates; i++) {
174 if (sc->sbands[cur_band].bitrates[i].hw_value == 177 if (sband->bitrates[i].hw_value == rx_stats->rs_rate) {
175 ratecode) {
176 rx_status->rate_idx = i; 178 rx_status->rate_idx = i;
177 break; 179 break;
178 } 180 }
179 181 if (sband->bitrates[i].hw_value_short ==
180 if (sc->sbands[cur_band].bitrates[i].hw_value_short == 182 rx_stats->rs_rate) {
181 ratecode) {
182 rx_status->rate_idx = i; 183 rx_status->rate_idx = i;
183 rx_status->flag |= RX_FLAG_SHORTPRE; 184 rx_status->flag |= RX_FLAG_SHORTPRE;
184 break; 185 break;
@@ -208,9 +209,9 @@ static int ath_rx_prepare(struct ieee80211_hw *hw,
208 209
209 /* Update Beacon RSSI, this is used by ANI. */ 210 /* Update Beacon RSSI, this is used by ANI. */
210 if (ieee80211_is_beacon(fc)) 211 if (ieee80211_is_beacon(fc))
211 sc->sc_ah->stats.avgbrssi = rx_stats->rs_rssi; 212 ah->stats.avgbrssi = rx_stats->rs_rssi;
212 213
213 rx_status->mactime = ath9k_hw_extend_tsf(sc->sc_ah, rx_stats->rs_tstamp); 214 rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp);
214 rx_status->band = hw->conf.channel->band; 215 rx_status->band = hw->conf.channel->band;
215 rx_status->freq = hw->conf.channel->center_freq; 216 rx_status->freq = hw->conf.channel->center_freq;
216 rx_status->noise = common->ani.noise_floor; 217 rx_status->noise = common->ani.noise_floor;
@@ -754,8 +755,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
754 if (sc->rx.bufsize < rx_stats->rs_datalen) 755 if (sc->rx.bufsize < rx_stats->rs_datalen)
755 goto requeue; 756 goto requeue;
756 757
757 if (!ath_rx_prepare(hw, skb, rx_stats, 758 if (!ath_rx_prepare(common, hw, skb, rx_stats,
758 &rx_status, &decrypt_error, sc)) 759 &rx_status, &decrypt_error))
759 goto requeue; 760 goto requeue;
760 761
761 /* Ensure we always have an skb to requeue once we are done 762 /* Ensure we always have an skb to requeue once we are done