aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/recv.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-05-14 14:28:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-20 14:46:24 -0400
commit9d64a3cfaf3edb548b68ef4eedbadbb875eaa10e (patch)
tree61fe29371cff7252802759d064f5beb7ba50f869 /drivers/net/wireless/ath/ath9k/recv.c
parentd8959fbfbad5f75c7df673aaf5112ba5e405ad34 (diff)
ath9k: Clean up RX processing a bit
This makes use of the local fc variable in bit more places and uses a common helper macro. The part of RX process that delivers skb's to mac80211 is moved to a separate function in preparation for future changes that will need to do this from two places. The modifications here should not result in any functional changes. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/recv.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 76abbbec9fd7..58bb26c72771 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -473,6 +473,37 @@ void ath_flushrecv(struct ath_softc *sc)
473 spin_unlock_bh(&sc->rx.rxflushlock); 473 spin_unlock_bh(&sc->rx.rxflushlock);
474} 474}
475 475
476static void ath_rx_send_to_mac80211(struct ath_softc *sc, struct sk_buff *skb,
477 struct ieee80211_rx_status *rx_status)
478{
479 struct ieee80211_hdr *hdr;
480
481 hdr = (struct ieee80211_hdr *)skb->data;
482
483 /* Send the frame to mac80211 */
484 if (is_multicast_ether_addr(hdr->addr1)) {
485 int i;
486 /*
487 * Deliver broadcast/multicast frames to all suitable
488 * virtual wiphys.
489 */
490 /* TODO: filter based on channel configuration */
491 for (i = 0; i < sc->num_sec_wiphy; i++) {
492 struct ath_wiphy *aphy = sc->sec_wiphy[i];
493 struct sk_buff *nskb;
494 if (aphy == NULL)
495 continue;
496 nskb = skb_copy(skb, GFP_ATOMIC);
497 if (nskb)
498 __ieee80211_rx(aphy->hw, nskb, rx_status);
499 }
500 __ieee80211_rx(sc->hw, skb, rx_status);
501 } else {
502 /* Deliver unicast frames based on receiver address */
503 __ieee80211_rx(ath_get_virt_hw(sc, hdr), skb, rx_status);
504 }
505}
506
476int ath_rx_tasklet(struct ath_softc *sc, int flush) 507int ath_rx_tasklet(struct ath_softc *sc, int flush)
477{ 508{
478#define PA2DESC(_sc, _pa) \ 509#define PA2DESC(_sc, _pa) \
@@ -622,7 +653,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
622 653
623 if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) { 654 if (!(keyix == ATH9K_RXKEYIX_INVALID) && !decrypt_error) {
624 rx_status.flag |= RX_FLAG_DECRYPTED; 655 rx_status.flag |= RX_FLAG_DECRYPTED;
625 } else if ((le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_PROTECTED) 656 } else if (ieee80211_has_protected(fc)
626 && !decrypt_error && skb->len >= hdrlen + 4) { 657 && !decrypt_error && skb->len >= hdrlen + 4) {
627 keyix = skb->data[hdrlen + 3] >> 6; 658 keyix = skb->data[hdrlen + 3] >> 6;
628 659
@@ -631,35 +662,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
631 } 662 }
632 if (ah->sw_mgmt_crypto && 663 if (ah->sw_mgmt_crypto &&
633 (rx_status.flag & RX_FLAG_DECRYPTED) && 664 (rx_status.flag & RX_FLAG_DECRYPTED) &&
634 ieee80211_is_mgmt(hdr->frame_control)) { 665 ieee80211_is_mgmt(fc)) {
635 /* Use software decrypt for management frames. */ 666 /* Use software decrypt for management frames. */
636 rx_status.flag &= ~RX_FLAG_DECRYPTED; 667 rx_status.flag &= ~RX_FLAG_DECRYPTED;
637 } 668 }
638 669
639 /* Send the frame to mac80211 */ 670 ath_rx_send_to_mac80211(sc, skb, &rx_status);
640 if (is_multicast_ether_addr(hdr->addr1)) {
641 int i;
642 /*
643 * Deliver broadcast/multicast frames to all suitable
644 * virtual wiphys.
645 */
646 /* TODO: filter based on channel configuration */
647 for (i = 0; i < sc->num_sec_wiphy; i++) {
648 struct ath_wiphy *aphy = sc->sec_wiphy[i];
649 struct sk_buff *nskb;
650 if (aphy == NULL)
651 continue;
652 nskb = skb_copy(skb, GFP_ATOMIC);
653 if (nskb)
654 __ieee80211_rx(aphy->hw, nskb,
655 &rx_status);
656 }
657 __ieee80211_rx(sc->hw, skb, &rx_status);
658 } else {
659 /* Deliver unicast frames based on receiver address */
660 __ieee80211_rx(ath_get_virt_hw(sc, hdr), skb,
661 &rx_status);
662 }
663 671
664 /* We will now give hardware our shiny new allocated skb */ 672 /* We will now give hardware our shiny new allocated skb */
665 bf->bf_mpdu = requeue_skb; 673 bf->bf_mpdu = requeue_skb;