aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-11-02 14:36:08 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 17:09:01 -0500
commitb4afffc0cfa3f35ee011d5ed4153e49f5cc3bc96 (patch)
treeda6199c5a8e228b8ecccbe1ffc6fe9ba31b869f4
parent1bdf6c3bece59c96aec3b8b457a9a554f6b2c433 (diff)
ath9k: simpify RX by calling ath_get_virt_hw() once
ath_get_virt_hw() is required on RX to determine for which virtual wiphy an skb came in for. Instead of searching for the hw twice do it only once. Cc: Jouni.Malinen <Jouni.Malinen@atheros.com> 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.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 355dd1834e1d..c910c1047ecc 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -105,23 +105,21 @@ static u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp)
105 * up the frame up to let mac80211 handle the actual error case, be it no 105 * up the frame up to let mac80211 handle the actual error case, be it no
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 */
108static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds, 108static int ath_rx_prepare(struct ieee80211_hw *hw,
109 struct sk_buff *skb, struct ath_desc *ds,
109 struct ieee80211_rx_status *rx_status, bool *decrypt_error, 110 struct ieee80211_rx_status *rx_status, bool *decrypt_error,
110 struct ath_softc *sc) 111 struct ath_softc *sc)
111{ 112{
112 struct ieee80211_hdr *hdr; 113 struct ieee80211_hdr *hdr;
113 u8 ratecode; 114 u8 ratecode;
114 __le16 fc; 115 __le16 fc;
115 struct ieee80211_hw *hw;
116 struct ieee80211_sta *sta; 116 struct ieee80211_sta *sta;
117 struct ath_node *an; 117 struct ath_node *an;
118 int last_rssi = ATH_RSSI_DUMMY_MARKER; 118 int last_rssi = ATH_RSSI_DUMMY_MARKER;
119 119
120
121 hdr = (struct ieee80211_hdr *)skb->data; 120 hdr = (struct ieee80211_hdr *)skb->data;
122 fc = hdr->frame_control; 121 fc = hdr->frame_control;
123 memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); 122 memset(rx_status, 0, sizeof(struct ieee80211_rx_status));
124 hw = ath_get_virt_hw(sc, hdr);
125 123
126 if (ds->ds_rxstat.rs_more) { 124 if (ds->ds_rxstat.rs_more) {
127 /* 125 /*
@@ -616,7 +614,8 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
616 } 614 }
617} 615}
618 616
619static void ath_rx_send_to_mac80211(struct ath_softc *sc, struct sk_buff *skb, 617static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
618 struct ath_softc *sc, struct sk_buff *skb,
620 struct ieee80211_rx_status *rx_status) 619 struct ieee80211_rx_status *rx_status)
621{ 620{
622 struct ieee80211_hdr *hdr; 621 struct ieee80211_hdr *hdr;
@@ -648,7 +647,7 @@ static void ath_rx_send_to_mac80211(struct ath_softc *sc, struct sk_buff *skb,
648 } else { 647 } else {
649 /* Deliver unicast frames based on receiver address */ 648 /* Deliver unicast frames based on receiver address */
650 memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); 649 memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status));
651 ieee80211_rx(ath_get_virt_hw(sc, hdr), skb); 650 ieee80211_rx(hw, skb);
652 } 651 }
653} 652}
654 653
@@ -664,6 +663,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
664 struct ieee80211_rx_status rx_status; 663 struct ieee80211_rx_status rx_status;
665 struct ath_hw *ah = sc->sc_ah; 664 struct ath_hw *ah = sc->sc_ah;
666 struct ath_common *common = ath9k_hw_common(ah); 665 struct ath_common *common = ath9k_hw_common(ah);
666 /*
667 * The hw can techncically differ from common->hw when using ath9k
668 * virtual wiphy so to account for that we iterate over the active
669 * wiphys and find the appropriate wiphy and therefore hw.
670 */
671 struct ieee80211_hw *hw = NULL;
667 struct ieee80211_hdr *hdr; 672 struct ieee80211_hdr *hdr;
668 int hdrlen, padsize, retval; 673 int hdrlen, padsize, retval;
669 bool decrypt_error = false; 674 bool decrypt_error = false;
@@ -743,6 +748,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
743 sc->rx.bufsize, 748 sc->rx.bufsize,
744 DMA_FROM_DEVICE); 749 DMA_FROM_DEVICE);
745 750
751 hdr = (struct ieee80211_hdr *) skb->data;
752 hw = ath_get_virt_hw(sc, hdr);
753
746 /* 754 /*
747 * If we're asked to flush receive queue, directly 755 * If we're asked to flush receive queue, directly
748 * chain it back at the queue without processing it. 756 * chain it back at the queue without processing it.
@@ -757,7 +765,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
757 if (sc->rx.bufsize < ds->ds_rxstat.rs_datalen) 765 if (sc->rx.bufsize < ds->ds_rxstat.rs_datalen)
758 goto requeue; 766 goto requeue;
759 767
760 if (!ath_rx_prepare(skb, ds, &rx_status, &decrypt_error, sc)) 768 if (!ath_rx_prepare(hw, skb, ds,
769 &rx_status, &decrypt_error, sc))
761 goto requeue; 770 goto requeue;
762 771
763 /* Ensure we always have an skb to requeue once we are done 772 /* Ensure we always have an skb to requeue once we are done
@@ -779,7 +788,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
779 skb_put(skb, ds->ds_rxstat.rs_datalen); 788 skb_put(skb, ds->ds_rxstat.rs_datalen);
780 789
781 /* see if any padding is done by the hw and remove it */ 790 /* see if any padding is done by the hw and remove it */
782 hdr = (struct ieee80211_hdr *)skb->data;
783 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 791 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
784 fc = hdr->frame_control; 792 fc = hdr->frame_control;
785 793
@@ -826,7 +834,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
826 bf->bf_mpdu = NULL; 834 bf->bf_mpdu = NULL;
827 ath_print(common, ATH_DBG_FATAL, 835 ath_print(common, ATH_DBG_FATAL,
828 "dma_mapping_error() on RX\n"); 836 "dma_mapping_error() on RX\n");
829 ath_rx_send_to_mac80211(sc, skb, &rx_status); 837 ath_rx_send_to_mac80211(hw, sc, skb, &rx_status);
830 break; 838 break;
831 } 839 }
832 bf->bf_dmacontext = bf->bf_buf_addr; 840 bf->bf_dmacontext = bf->bf_buf_addr;
@@ -847,7 +855,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
847 SC_OP_WAIT_FOR_PSPOLL_DATA))) 855 SC_OP_WAIT_FOR_PSPOLL_DATA)))
848 ath_rx_ps(sc, skb); 856 ath_rx_ps(sc, skb);
849 857
850 ath_rx_send_to_mac80211(sc, skb, &rx_status); 858 ath_rx_send_to_mac80211(hw, sc, skb, &rx_status);
851 859
852requeue: 860requeue:
853 list_move_tail(&bf->list, &sc->rx.rxbuf); 861 list_move_tail(&bf->list, &sc->rx.rxbuf);