aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/recv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath9k/recv.c')
-rw-r--r--drivers/net/wireless/ath9k/recv.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c
index 8da08f9b463c..08f676af894f 100644
--- a/drivers/net/wireless/ath9k/recv.c
+++ b/drivers/net/wireless/ath9k/recv.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17#include "core.h" 17#include "ath9k.h"
18 18
19/* 19/*
20 * Setup and link descriptors. 20 * Setup and link descriptors.
@@ -26,7 +26,7 @@
26 */ 26 */
27static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf) 27static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf)
28{ 28{
29 struct ath_hal *ah = sc->sc_ah; 29 struct ath_hw *ah = sc->sc_ah;
30 struct ath_desc *ds; 30 struct ath_desc *ds;
31 struct sk_buff *skb; 31 struct sk_buff *skb;
32 32
@@ -97,11 +97,11 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len)
97 * Unfortunately this means we may get 8 KB here from the 97 * Unfortunately this means we may get 8 KB here from the
98 * kernel... and that is actually what is observed on some 98 * kernel... and that is actually what is observed on some
99 * systems :( */ 99 * systems :( */
100 skb = dev_alloc_skb(len + sc->sc_cachelsz - 1); 100 skb = dev_alloc_skb(len + sc->cachelsz - 1);
101 if (skb != NULL) { 101 if (skb != NULL) {
102 off = ((unsigned long) skb->data) % sc->sc_cachelsz; 102 off = ((unsigned long) skb->data) % sc->cachelsz;
103 if (off != 0) 103 if (off != 0)
104 skb_reserve(skb, sc->sc_cachelsz - off); 104 skb_reserve(skb, sc->cachelsz - off);
105 } else { 105 } else {
106 DPRINTF(sc, ATH_DBG_FATAL, 106 DPRINTF(sc, ATH_DBG_FATAL,
107 "skbuff alloc of size %u failed\n", len); 107 "skbuff alloc of size %u failed\n", len);
@@ -135,7 +135,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
135 * discard the frame. Enable this if you want to see 135 * discard the frame. Enable this if you want to see
136 * error frames in Monitor mode. 136 * error frames in Monitor mode.
137 */ 137 */
138 if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_MONITOR) 138 if (sc->sc_ah->opmode != NL80211_IFTYPE_MONITOR)
139 goto rx_next; 139 goto rx_next;
140 } else if (ds->ds_rxstat.rs_status != 0) { 140 } else if (ds->ds_rxstat.rs_status != 0) {
141 if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC) 141 if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC)
@@ -161,7 +161,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
161 * decryption and MIC failures. For monitor mode, 161 * decryption and MIC failures. For monitor mode,
162 * we also ignore the CRC error. 162 * we also ignore the CRC error.
163 */ 163 */
164 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR) { 164 if (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR) {
165 if (ds->ds_rxstat.rs_status & 165 if (ds->ds_rxstat.rs_status &
166 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC | 166 ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
167 ATH9K_RXERR_CRC)) 167 ATH9K_RXERR_CRC))
@@ -210,7 +210,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
210 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp); 210 rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
211 rx_status->band = sc->hw->conf.channel->band; 211 rx_status->band = sc->hw->conf.channel->band;
212 rx_status->freq = sc->hw->conf.channel->center_freq; 212 rx_status->freq = sc->hw->conf.channel->center_freq;
213 rx_status->noise = sc->sc_ani.sc_noise_floor; 213 rx_status->noise = sc->ani.noise_floor;
214 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi; 214 rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi;
215 rx_status->antenna = ds->ds_rxstat.rs_antenna; 215 rx_status->antenna = ds->ds_rxstat.rs_antenna;
216 216
@@ -233,7 +233,7 @@ rx_next:
233 233
234static void ath_opmode_init(struct ath_softc *sc) 234static void ath_opmode_init(struct ath_softc *sc)
235{ 235{
236 struct ath_hal *ah = sc->sc_ah; 236 struct ath_hw *ah = sc->sc_ah;
237 u32 rfilt, mfilt[2]; 237 u32 rfilt, mfilt[2];
238 238
239 /* configure rx filter */ 239 /* configure rx filter */
@@ -241,14 +241,14 @@ static void ath_opmode_init(struct ath_softc *sc)
241 ath9k_hw_setrxfilter(ah, rfilt); 241 ath9k_hw_setrxfilter(ah, rfilt);
242 242
243 /* configure bssid mask */ 243 /* configure bssid mask */
244 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) 244 if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
245 ath9k_hw_setbssidmask(ah, sc->sc_bssidmask); 245 ath9k_hw_setbssidmask(sc);
246 246
247 /* configure operational mode */ 247 /* configure operational mode */
248 ath9k_hw_setopmode(ah); 248 ath9k_hw_setopmode(ah);
249 249
250 /* Handle any link-level address change. */ 250 /* Handle any link-level address change. */
251 ath9k_hw_setmac(ah, sc->sc_myaddr); 251 ath9k_hw_setmac(ah, sc->sc_ah->macaddr);
252 252
253 /* calculate and install multicast filter */ 253 /* calculate and install multicast filter */
254 mfilt[0] = mfilt[1] = ~0; 254 mfilt[0] = mfilt[1] = ~0;
@@ -267,11 +267,11 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
267 spin_lock_init(&sc->rx.rxbuflock); 267 spin_lock_init(&sc->rx.rxbuflock);
268 268
269 sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN, 269 sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN,
270 min(sc->sc_cachelsz, 270 min(sc->cachelsz,
271 (u16)64)); 271 (u16)64));
272 272
273 DPRINTF(sc, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n", 273 DPRINTF(sc, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n",
274 sc->sc_cachelsz, sc->rx.bufsize); 274 sc->cachelsz, sc->rx.bufsize);
275 275
276 /* Initialize rx descriptors */ 276 /* Initialize rx descriptors */
277 277
@@ -360,25 +360,28 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
360 | ATH9K_RX_FILTER_MCAST; 360 | ATH9K_RX_FILTER_MCAST;
361 361
362 /* If not a STA, enable processing of Probe Requests */ 362 /* If not a STA, enable processing of Probe Requests */
363 if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_STATION) 363 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
364 rfilt |= ATH9K_RX_FILTER_PROBEREQ; 364 rfilt |= ATH9K_RX_FILTER_PROBEREQ;
365 365
366 /* Can't set HOSTAP into promiscous mode */ 366 /* Can't set HOSTAP into promiscous mode */
367 if (((sc->sc_ah->ah_opmode != NL80211_IFTYPE_AP) && 367 if (((sc->sc_ah->opmode != NL80211_IFTYPE_AP) &&
368 (sc->rx.rxfilter & FIF_PROMISC_IN_BSS)) || 368 (sc->rx.rxfilter & FIF_PROMISC_IN_BSS)) ||
369 (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR)) { 369 (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR)) {
370 rfilt |= ATH9K_RX_FILTER_PROM; 370 rfilt |= ATH9K_RX_FILTER_PROM;
371 /* ??? To prevent from sending ACK */ 371 /* ??? To prevent from sending ACK */
372 rfilt &= ~ATH9K_RX_FILTER_UCAST; 372 rfilt &= ~ATH9K_RX_FILTER_UCAST;
373 } 373 }
374 374
375 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION || 375 if (sc->rx.rxfilter & FIF_CONTROL)
376 sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) 376 rfilt |= ATH9K_RX_FILTER_CONTROL;
377
378 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION ||
379 sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)
377 rfilt |= ATH9K_RX_FILTER_BEACON; 380 rfilt |= ATH9K_RX_FILTER_BEACON;
378 381
379 /* If in HOSTAP mode, want to enable reception of PSPOLL frames 382 /* If in HOSTAP mode, want to enable reception of PSPOLL frames
380 & beacon frames */ 383 & beacon frames */
381 if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) 384 if (sc->sc_ah->opmode == NL80211_IFTYPE_AP)
382 rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL); 385 rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
383 386
384 return rfilt; 387 return rfilt;
@@ -388,7 +391,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
388 391
389int ath_startrecv(struct ath_softc *sc) 392int ath_startrecv(struct ath_softc *sc)
390{ 393{
391 struct ath_hal *ah = sc->sc_ah; 394 struct ath_hw *ah = sc->sc_ah;
392 struct ath_buf *bf, *tbf; 395 struct ath_buf *bf, *tbf;
393 396
394 spin_lock_bh(&sc->rx.rxbuflock); 397 spin_lock_bh(&sc->rx.rxbuflock);
@@ -418,7 +421,7 @@ start_recv:
418 421
419bool ath_stoprecv(struct ath_softc *sc) 422bool ath_stoprecv(struct ath_softc *sc)
420{ 423{
421 struct ath_hal *ah = sc->sc_ah; 424 struct ath_hw *ah = sc->sc_ah;
422 bool stopped; 425 bool stopped;
423 426
424 ath9k_hw_stoppcurecv(ah); 427 ath9k_hw_stoppcurecv(ah);
@@ -449,7 +452,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
449 struct ath_desc *ds; 452 struct ath_desc *ds;
450 struct sk_buff *skb = NULL, *requeue_skb; 453 struct sk_buff *skb = NULL, *requeue_skb;
451 struct ieee80211_rx_status rx_status; 454 struct ieee80211_rx_status rx_status;
452 struct ath_hal *ah = sc->sc_ah; 455 struct ath_hw *ah = sc->sc_ah;
453 struct ieee80211_hdr *hdr; 456 struct ieee80211_hdr *hdr;
454 int hdrlen, padsize, retval; 457 int hdrlen, padsize, retval;
455 bool decrypt_error = false; 458 bool decrypt_error = false;
@@ -590,7 +593,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
590 && !decrypt_error && skb->len >= hdrlen + 4) { 593 && !decrypt_error && skb->len >= hdrlen + 4) {
591 keyix = skb->data[hdrlen + 3] >> 6; 594 keyix = skb->data[hdrlen + 3] >> 6;
592 595
593 if (test_bit(keyix, sc->sc_keymap)) 596 if (test_bit(keyix, sc->keymap))
594 rx_status.flag |= RX_FLAG_DECRYPTED; 597 rx_status.flag |= RX_FLAG_DECRYPTED;
595 } 598 }
596 if (ah->sw_mgmt_crypto && 599 if (ah->sw_mgmt_crypto &&