recv.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /*
  2. * Copyright (c) 2008 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "core.h"
  17. /*
  18. * Setup and link descriptors.
  19. *
  20. * 11N: we can no longer afford to self link the last descriptor.
  21. * MAC acknowledges BA status as long as it copies frames to host
  22. * buffer (or rx fifo). This can incorrectly acknowledge packets
  23. * to a sender if last desc is self-linked.
  24. */
  25. static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf)
  26. {
  27. struct ath_hal *ah = sc->sc_ah;
  28. struct ath_desc *ds;
  29. struct sk_buff *skb;
  30. ATH_RXBUF_RESET(bf);
  31. ds = bf->bf_desc;
  32. ds->ds_link = 0; /* link to null */
  33. ds->ds_data = bf->bf_buf_addr;
  34. /* virtual addr of the beginning of the buffer. */
  35. skb = bf->bf_mpdu;
  36. ASSERT(skb != NULL);
  37. ds->ds_vdata = skb->data;
  38. /* setup rx descriptors */
  39. ath9k_hw_setuprxdesc(ah, ds,
  40. skb_tailroom(skb), /* buffer size */
  41. 0);
  42. if (sc->sc_rxlink == NULL)
  43. ath9k_hw_putrxbuf(ah, bf->bf_daddr);
  44. else
  45. *sc->sc_rxlink = bf->bf_daddr;
  46. sc->sc_rxlink = &ds->ds_link;
  47. ath9k_hw_rxena(ah);
  48. }
  49. static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len)
  50. {
  51. struct sk_buff *skb;
  52. u32 off;
  53. /*
  54. * Cache-line-align. This is important (for the
  55. * 5210 at least) as not doing so causes bogus data
  56. * in rx'd frames.
  57. */
  58. skb = dev_alloc_skb(len + sc->sc_cachelsz - 1);
  59. if (skb != NULL) {
  60. off = ((unsigned long) skb->data) % sc->sc_cachelsz;
  61. if (off != 0)
  62. skb_reserve(skb, sc->sc_cachelsz - off);
  63. } else {
  64. DPRINTF(sc, ATH_DBG_FATAL,
  65. "%s: skbuff alloc of size %u failed\n",
  66. __func__, len);
  67. return NULL;
  68. }
  69. return skb;
  70. }
  71. static void ath_rx_requeue(struct ath_softc *sc, struct ath_buf *bf)
  72. {
  73. struct sk_buff *skb;
  74. ASSERT(bf != NULL);
  75. if (bf->bf_mpdu == NULL) {
  76. skb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize);
  77. if (skb != NULL) {
  78. bf->bf_mpdu = skb;
  79. bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data,
  80. skb_end_pointer(skb) - skb->head,
  81. PCI_DMA_FROMDEVICE);
  82. bf->bf_dmacontext = bf->bf_buf_addr;
  83. }
  84. }
  85. list_move_tail(&bf->list, &sc->sc_rxbuf);
  86. ath_rx_buf_link(sc, bf);
  87. }
  88. static int ath_rate2idx(struct ath_softc *sc, int rate)
  89. {
  90. int i = 0, cur_band, n_rates;
  91. struct ieee80211_hw *hw = sc->hw;
  92. cur_band = hw->conf.channel->band;
  93. n_rates = sc->sbands[cur_band].n_bitrates;
  94. for (i = 0; i < n_rates; i++) {
  95. if (sc->sbands[cur_band].bitrates[i].bitrate == rate)
  96. break;
  97. }
  98. /*
  99. * NB:mac80211 validates rx rate index against the supported legacy rate
  100. * index only (should be done against ht rates also), return the highest
  101. * legacy rate index for rx rate which does not match any one of the
  102. * supported basic and extended rates to make mac80211 happy.
  103. * The following hack will be cleaned up once the issue with
  104. * the rx rate index validation in mac80211 is fixed.
  105. */
  106. if (i == n_rates)
  107. return n_rates - 1;
  108. return i;
  109. }
  110. /*
  111. * For Decrypt or Demic errors, we only mark packet status here and always push
  112. * up the frame up to let mac80211 handle the actual error case, be it no
  113. * decryption key or real decryption error. This let us keep statistics there.
  114. */
  115. static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
  116. struct ieee80211_rx_status *rx_status, bool *decrypt_error,
  117. struct ath_softc *sc)
  118. {
  119. struct ieee80211_hdr *hdr;
  120. int ratekbps;
  121. u8 ratecode;
  122. __le16 fc;
  123. hdr = (struct ieee80211_hdr *)skb->data;
  124. fc = hdr->frame_control;
  125. memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
  126. if (ds->ds_rxstat.rs_more) {
  127. /*
  128. * Frame spans multiple descriptors; this cannot happen yet
  129. * as we don't support jumbograms. If not in monitor mode,
  130. * discard the frame. Enable this if you want to see
  131. * error frames in Monitor mode.
  132. */
  133. if (sc->sc_ah->ah_opmode != ATH9K_M_MONITOR)
  134. goto rx_next;
  135. } else if (ds->ds_rxstat.rs_status != 0) {
  136. if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC)
  137. rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
  138. if (ds->ds_rxstat.rs_status & ATH9K_RXERR_PHY)
  139. goto rx_next;
  140. if (ds->ds_rxstat.rs_status & ATH9K_RXERR_DECRYPT) {
  141. *decrypt_error = true;
  142. } else if (ds->ds_rxstat.rs_status & ATH9K_RXERR_MIC) {
  143. if (ieee80211_is_ctl(fc))
  144. /*
  145. * Sometimes, we get invalid
  146. * MIC failures on valid control frames.
  147. * Remove these mic errors.
  148. */
  149. ds->ds_rxstat.rs_status &= ~ATH9K_RXERR_MIC;
  150. else
  151. rx_status->flag |= RX_FLAG_MMIC_ERROR;
  152. }
  153. /*
  154. * Reject error frames with the exception of
  155. * decryption and MIC failures. For monitor mode,
  156. * we also ignore the CRC error.
  157. */
  158. if (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR) {
  159. if (ds->ds_rxstat.rs_status &
  160. ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
  161. ATH9K_RXERR_CRC))
  162. goto rx_next;
  163. } else {
  164. if (ds->ds_rxstat.rs_status &
  165. ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC)) {
  166. goto rx_next;
  167. }
  168. }
  169. }
  170. ratecode = ds->ds_rxstat.rs_rate;
  171. ratekbps = sc->sc_hwmap[ratecode].rateKbps;
  172. /* HT rate */
  173. if (ratecode & 0x80) {
  174. if (ds->ds_rxstat.rs_flags & ATH9K_RX_2040)
  175. ratekbps = (ratekbps * 27) / 13;
  176. if (ds->ds_rxstat.rs_flags & ATH9K_RX_GI)
  177. ratekbps = (ratekbps * 10) / 9;
  178. }
  179. rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
  180. rx_status->band = sc->hw->conf.channel->band;
  181. rx_status->freq = sc->hw->conf.channel->center_freq;
  182. rx_status->noise = sc->sc_ani.sc_noise_floor;
  183. rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi;
  184. rx_status->rate_idx = ath_rate2idx(sc, (ratekbps / 100));
  185. rx_status->antenna = ds->ds_rxstat.rs_antenna;
  186. /* at 45 you will be able to use MCS 15 reliably. A more elaborate
  187. * scheme can be used here but it requires tables of SNR/throughput for
  188. * each possible mode used. */
  189. rx_status->qual = ds->ds_rxstat.rs_rssi * 100 / 45;
  190. /* rssi can be more than 45 though, anything above that
  191. * should be considered at 100% */
  192. if (rx_status->qual > 100)
  193. rx_status->qual = 100;
  194. rx_status->flag |= RX_FLAG_TSFT;
  195. return 1;
  196. rx_next:
  197. return 0;
  198. }
  199. static void ath_opmode_init(struct ath_softc *sc)
  200. {
  201. struct ath_hal *ah = sc->sc_ah;
  202. u32 rfilt, mfilt[2];
  203. /* configure rx filter */
  204. rfilt = ath_calcrxfilter(sc);
  205. ath9k_hw_setrxfilter(ah, rfilt);
  206. /* configure bssid mask */
  207. if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
  208. ath9k_hw_setbssidmask(ah, sc->sc_bssidmask);
  209. /* configure operational mode */
  210. ath9k_hw_setopmode(ah);
  211. /* Handle any link-level address change. */
  212. ath9k_hw_setmac(ah, sc->sc_myaddr);
  213. /* calculate and install multicast filter */
  214. mfilt[0] = mfilt[1] = ~0;
  215. ath9k_hw_setmcastfilter(ah, mfilt[0], mfilt[1]);
  216. DPRINTF(sc, ATH_DBG_CONFIG ,
  217. "%s: RX filter 0x%x, MC filter %08x:%08x\n",
  218. __func__, rfilt, mfilt[0], mfilt[1]);
  219. }
  220. int ath_rx_init(struct ath_softc *sc, int nbufs)
  221. {
  222. struct sk_buff *skb;
  223. struct ath_buf *bf;
  224. int error = 0;
  225. do {
  226. spin_lock_init(&sc->sc_rxflushlock);
  227. sc->sc_flags &= ~SC_OP_RXFLUSH;
  228. spin_lock_init(&sc->sc_rxbuflock);
  229. sc->sc_rxbufsize = roundup(IEEE80211_MAX_MPDU_LEN,
  230. min(sc->sc_cachelsz,
  231. (u16)64));
  232. DPRINTF(sc, ATH_DBG_CONFIG, "%s: cachelsz %u rxbufsize %u\n",
  233. __func__, sc->sc_cachelsz, sc->sc_rxbufsize);
  234. /* Initialize rx descriptors */
  235. error = ath_descdma_setup(sc, &sc->sc_rxdma, &sc->sc_rxbuf,
  236. "rx", nbufs, 1);
  237. if (error != 0) {
  238. DPRINTF(sc, ATH_DBG_FATAL,
  239. "%s: failed to allocate rx descriptors: %d\n",
  240. __func__, error);
  241. break;
  242. }
  243. list_for_each_entry(bf, &sc->sc_rxbuf, list) {
  244. skb = ath_rxbuf_alloc(sc, sc->sc_rxbufsize);
  245. if (skb == NULL) {
  246. error = -ENOMEM;
  247. break;
  248. }
  249. bf->bf_mpdu = skb;
  250. bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data,
  251. skb_end_pointer(skb) - skb->head,
  252. PCI_DMA_FROMDEVICE);
  253. bf->bf_dmacontext = bf->bf_buf_addr;
  254. }
  255. sc->sc_rxlink = NULL;
  256. } while (0);
  257. if (error)
  258. ath_rx_cleanup(sc);
  259. return error;
  260. }
  261. void ath_rx_cleanup(struct ath_softc *sc)
  262. {
  263. struct sk_buff *skb;
  264. struct ath_buf *bf;
  265. list_for_each_entry(bf, &sc->sc_rxbuf, list) {
  266. skb = bf->bf_mpdu;
  267. if (skb)
  268. dev_kfree_skb(skb);
  269. }
  270. if (sc->sc_rxdma.dd_desc_len != 0)
  271. ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf);
  272. }
  273. /*
  274. * Calculate the receive filter according to the
  275. * operating mode and state:
  276. *
  277. * o always accept unicast, broadcast, and multicast traffic
  278. * o maintain current state of phy error reception (the hal
  279. * may enable phy error frames for noise immunity work)
  280. * o probe request frames are accepted only when operating in
  281. * hostap, adhoc, or monitor modes
  282. * o enable promiscuous mode according to the interface state
  283. * o accept beacons:
  284. * - when operating in adhoc mode so the 802.11 layer creates
  285. * node table entries for peers,
  286. * - when operating in station mode for collecting rssi data when
  287. * the station is otherwise quiet, or
  288. * - when operating as a repeater so we see repeater-sta beacons
  289. * - when scanning
  290. */
  291. u32 ath_calcrxfilter(struct ath_softc *sc)
  292. {
  293. #define RX_FILTER_PRESERVE (ATH9K_RX_FILTER_PHYERR | ATH9K_RX_FILTER_PHYRADAR)
  294. u32 rfilt;
  295. rfilt = (ath9k_hw_getrxfilter(sc->sc_ah) & RX_FILTER_PRESERVE)
  296. | ATH9K_RX_FILTER_UCAST | ATH9K_RX_FILTER_BCAST
  297. | ATH9K_RX_FILTER_MCAST;
  298. /* If not a STA, enable processing of Probe Requests */
  299. if (sc->sc_ah->ah_opmode != ATH9K_M_STA)
  300. rfilt |= ATH9K_RX_FILTER_PROBEREQ;
  301. /* Can't set HOSTAP into promiscous mode */
  302. if (((sc->sc_ah->ah_opmode != ATH9K_M_HOSTAP) &&
  303. (sc->rx_filter & FIF_PROMISC_IN_BSS)) ||
  304. (sc->sc_ah->ah_opmode == ATH9K_M_MONITOR)) {
  305. rfilt |= ATH9K_RX_FILTER_PROM;
  306. /* ??? To prevent from sending ACK */
  307. rfilt &= ~ATH9K_RX_FILTER_UCAST;
  308. }
  309. if (sc->sc_ah->ah_opmode == ATH9K_M_STA ||
  310. sc->sc_ah->ah_opmode == ATH9K_M_IBSS)
  311. rfilt |= ATH9K_RX_FILTER_BEACON;
  312. /* If in HOSTAP mode, want to enable reception of PSPOLL frames
  313. & beacon frames */
  314. if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP)
  315. rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
  316. return rfilt;
  317. #undef RX_FILTER_PRESERVE
  318. }
  319. int ath_startrecv(struct ath_softc *sc)
  320. {
  321. struct ath_hal *ah = sc->sc_ah;
  322. struct ath_buf *bf, *tbf;
  323. spin_lock_bh(&sc->sc_rxbuflock);
  324. if (list_empty(&sc->sc_rxbuf))
  325. goto start_recv;
  326. sc->sc_rxlink = NULL;
  327. list_for_each_entry_safe(bf, tbf, &sc->sc_rxbuf, list) {
  328. ath_rx_buf_link(sc, bf);
  329. }
  330. /* We could have deleted elements so the list may be empty now */
  331. if (list_empty(&sc->sc_rxbuf))
  332. goto start_recv;
  333. bf = list_first_entry(&sc->sc_rxbuf, struct ath_buf, list);
  334. ath9k_hw_putrxbuf(ah, bf->bf_daddr);
  335. ath9k_hw_rxena(ah);
  336. start_recv:
  337. spin_unlock_bh(&sc->sc_rxbuflock);
  338. ath_opmode_init(sc);
  339. ath9k_hw_startpcureceive(ah);
  340. return 0;
  341. }
  342. bool ath_stoprecv(struct ath_softc *sc)
  343. {
  344. struct ath_hal *ah = sc->sc_ah;
  345. bool stopped;
  346. ath9k_hw_stoppcurecv(ah);
  347. ath9k_hw_setrxfilter(ah, 0);
  348. stopped = ath9k_hw_stopdmarecv(ah);
  349. mdelay(3); /* 3ms is long enough for 1 frame */
  350. sc->sc_rxlink = NULL;
  351. return stopped;
  352. }
  353. void ath_flushrecv(struct ath_softc *sc)
  354. {
  355. spin_lock_bh(&sc->sc_rxflushlock);
  356. sc->sc_flags |= SC_OP_RXFLUSH;
  357. ath_rx_tasklet(sc, 1);
  358. sc->sc_flags &= ~SC_OP_RXFLUSH;
  359. spin_unlock_bh(&sc->sc_rxflushlock);
  360. }
  361. int ath_rx_tasklet(struct ath_softc *sc, int flush)
  362. {
  363. #define PA2DESC(_sc, _pa) \
  364. ((struct ath_desc *)((caddr_t)(_sc)->sc_rxdma.dd_desc + \
  365. ((_pa) - (_sc)->sc_rxdma.dd_desc_paddr)))
  366. struct ath_buf *bf;
  367. struct ath_desc *ds;
  368. struct sk_buff *skb = NULL;
  369. struct ieee80211_rx_status rx_status;
  370. struct ath_hal *ah = sc->sc_ah;
  371. struct ieee80211_hdr *hdr;
  372. int hdrlen, padsize, retval;
  373. bool decrypt_error = false;
  374. u8 keyix;
  375. spin_lock_bh(&sc->sc_rxbuflock);
  376. do {
  377. /* If handling rx interrupt and flush is in progress => exit */
  378. if ((sc->sc_flags & SC_OP_RXFLUSH) && (flush == 0))
  379. break;
  380. if (list_empty(&sc->sc_rxbuf)) {
  381. sc->sc_rxlink = NULL;
  382. break;
  383. }
  384. bf = list_first_entry(&sc->sc_rxbuf, struct ath_buf, list);
  385. ds = bf->bf_desc;
  386. /*
  387. * Must provide the virtual address of the current
  388. * descriptor, the physical address, and the virtual
  389. * address of the next descriptor in the h/w chain.
  390. * This allows the HAL to look ahead to see if the
  391. * hardware is done with a descriptor by checking the
  392. * done bit in the following descriptor and the address
  393. * of the current descriptor the DMA engine is working
  394. * on. All this is necessary because of our use of
  395. * a self-linked list to avoid rx overruns.
  396. */
  397. retval = ath9k_hw_rxprocdesc(ah, ds,
  398. bf->bf_daddr,
  399. PA2DESC(sc, ds->ds_link),
  400. 0);
  401. if (retval == -EINPROGRESS) {
  402. struct ath_buf *tbf;
  403. struct ath_desc *tds;
  404. if (list_is_last(&bf->list, &sc->sc_rxbuf)) {
  405. sc->sc_rxlink = NULL;
  406. break;
  407. }
  408. tbf = list_entry(bf->list.next, struct ath_buf, list);
  409. /*
  410. * On some hardware the descriptor status words could
  411. * get corrupted, including the done bit. Because of
  412. * this, check if the next descriptor's done bit is
  413. * set or not.
  414. *
  415. * If the next descriptor's done bit is set, the current
  416. * descriptor has been corrupted. Force s/w to discard
  417. * this descriptor and continue...
  418. */
  419. tds = tbf->bf_desc;
  420. retval = ath9k_hw_rxprocdesc(ah, tds, tbf->bf_daddr,
  421. PA2DESC(sc, tds->ds_link), 0);
  422. if (retval == -EINPROGRESS) {
  423. break;
  424. }
  425. }
  426. skb = bf->bf_mpdu;
  427. if (!skb)
  428. continue;
  429. /*
  430. * If we're asked to flush receive queue, directly
  431. * chain it back at the queue without processing it.
  432. */
  433. if (flush)
  434. goto rx_next;
  435. if (!ds->ds_rxstat.rs_datalen)
  436. goto rx_next;
  437. /* The status portion of the descriptor could get corrupted. */
  438. if (sc->sc_rxbufsize < ds->ds_rxstat.rs_datalen)
  439. goto rx_next;
  440. if (!ath_rx_prepare(skb, ds, &rx_status, &decrypt_error, sc))
  441. goto rx_next;
  442. /* Sync and unmap the frame */
  443. pci_dma_sync_single_for_cpu(sc->pdev, bf->bf_buf_addr,
  444. skb_tailroom(skb),
  445. PCI_DMA_FROMDEVICE);
  446. pci_unmap_single(sc->pdev, bf->bf_buf_addr,
  447. sc->sc_rxbufsize,
  448. PCI_DMA_FROMDEVICE);
  449. skb_put(skb, ds->ds_rxstat.rs_datalen);
  450. skb->protocol = cpu_to_be16(ETH_P_CONTROL);
  451. /* see if any padding is done by the hw and remove it */
  452. hdr = (struct ieee80211_hdr *)skb->data;
  453. hdrlen = ieee80211_get_hdrlen_from_skb(skb);
  454. if (hdrlen & 3) {
  455. padsize = hdrlen % 4;
  456. memmove(skb->data + padsize, skb->data, hdrlen);
  457. skb_pull(skb, padsize);
  458. }
  459. keyix = ds->ds_rxstat.rs_keyix;
  460. if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) {
  461. rx_status.flag |= RX_FLAG_DECRYPTED;
  462. } else if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_PROTECTED)
  463. && !decrypt_error && skb->len >= hdrlen + 4) {
  464. keyix = skb->data[hdrlen + 3] >> 6;
  465. if (test_bit(keyix, sc->sc_keymap))
  466. rx_status.flag |= RX_FLAG_DECRYPTED;
  467. }
  468. /* Send the frame to mac80211 */
  469. __ieee80211_rx(sc->hw, skb, &rx_status);
  470. bf->bf_mpdu = NULL;
  471. /*
  472. * change the default rx antenna if rx diversity chooses the
  473. * other antenna 3 times in a row.
  474. */
  475. if (sc->sc_defant != ds->ds_rxstat.rs_antenna) {
  476. if (++sc->sc_rxotherant >= 3)
  477. ath_setdefantenna(sc, ds->ds_rxstat.rs_antenna);
  478. } else {
  479. sc->sc_rxotherant = 0;
  480. }
  481. rx_next:
  482. ath_rx_requeue(sc, bf);
  483. } while (1);
  484. spin_unlock_bh(&sc->sc_rxbuflock);
  485. return 0;
  486. #undef PA2DESC
  487. }