Revert "ath9k: use split rx buffers to get rid of order-1 skb allocations"
[linux-flexiantxendom0-natty.git] / drivers / net / wireless / ath / ath9k / recv.c
index 70f3fa6..1e0c1e3 100644 (file)
@@ -439,9 +439,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
         * mode interface or when in monitor mode. AP mode does not need this
         * since it receives all in-BSS frames anyway.
         */
-       if (((sc->sc_ah->opmode != NL80211_IFTYPE_AP) &&
-            (sc->rx.rxfilter & FIF_PROMISC_IN_BSS)) ||
-           (sc->sc_ah->is_monitoring))
+       if (sc->sc_ah->is_monitoring)
                rfilt |= ATH9K_RX_FILTER_PROM;
 
        if (sc->rx.rxfilter & FIF_CONTROL)
@@ -515,12 +513,12 @@ start_recv:
 bool ath_stoprecv(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
-       bool stopped;
+       bool stopped, reset = false;
 
        spin_lock_bh(&sc->rx.rxbuflock);
        ath9k_hw_abortpcurecv(ah);
        ath9k_hw_setrxfilter(ah, 0);
-       stopped = ath9k_hw_stopdmarecv(ah);
+       stopped = ath9k_hw_stopdmarecv(ah, &reset);
 
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
                ath_edma_stop_recv(sc);
@@ -528,9 +526,14 @@ bool ath_stoprecv(struct ath_softc *sc)
                sc->rx.rxlink = NULL;
        spin_unlock_bh(&sc->rx.rxbuflock);
 
-       ATH_DBG_WARN(!stopped, "Could not stop RX, we could be "
-                    "confusing the DMA engine when we start RX up\n");
-       return stopped;
+       if (!(ah->ah_flags & AH_UNPLUGGED) &&
+           unlikely(!stopped)) {
+               ath_err(ath9k_hw_common(sc->sc_ah),
+                       "Could not stop RX, we could be "
+                       "confusing the DMA engine when we start RX up\n");
+               ATH_DBG_WARN_ON_ONCE(!stopped);
+       }
+       return stopped && !reset;
 }
 
 void ath_flushrecv(struct ath_softc *sc)
@@ -658,8 +661,7 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)
 }
 
 static void ath_rx_send_to_mac80211(struct ieee80211_hw *hw,
-                                   struct ath_softc *sc, struct sk_buff *skb,
-                                   struct ieee80211_rx_status *rxs)
+                                   struct ath_softc *sc, struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr;
 
@@ -838,6 +840,10 @@ static bool ath9k_rx_accept(struct ath_common *common,
                            struct ath_rx_status *rx_stats,
                            bool *decrypt_error)
 {
+#define is_mc_or_valid_tkip_keyix ((is_mc ||                   \
+               (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \
+               test_bit(rx_stats->rs_keyix, common->tkip_keymap))))
+
        struct ath_hw *ah = common->ah;
        __le16 fc;
        u8 rx_status_len = ah->caps.rx_status_len;
@@ -879,15 +885,18 @@ static bool ath9k_rx_accept(struct ath_common *common,
                if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
                        *decrypt_error = true;
                } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) {
+                       bool is_mc;
                        /*
                         * The MIC error bit is only valid if the frame
                         * is not a control frame or fragment, and it was
                         * decrypted using a valid TKIP key.
                         */
+                       is_mc = !!is_multicast_ether_addr(hdr->addr1);
+
                        if (!ieee80211_is_ctl(fc) &&
                            !ieee80211_has_morefrags(fc) &&
                            !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
-                           test_bit(rx_stats->rs_keyix, common->tkip_keymap))
+                           is_mc_or_valid_tkip_keyix)
                                rxs->flag |= RX_FLAG_MMIC_ERROR;
                        else
                                rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
@@ -1617,7 +1626,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
        struct ath_hw *ah = sc->sc_ah;
        struct ath_common *common = ath9k_hw_common(ah);
        /*
-        * The hw can techncically differ from common->hw when using ath9k
+        * The hw can technically differ from common->hw when using ath9k
         * virtual wiphy so to account for that we iterate over the active
         * wiphys and find the appropriate wiphy and therefore hw.
         */
@@ -1725,7 +1734,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                        bf->bf_mpdu = NULL;
                        bf->bf_buf_addr = 0;
                        ath_err(common, "dma_mapping_error() on RX\n");
-                       ath_rx_send_to_mac80211(hw, sc, skb, rxs);
+                       ath_rx_send_to_mac80211(hw, sc, skb);
                        break;
                }
 
@@ -1741,17 +1750,18 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                }
 
                spin_lock_irqsave(&sc->sc_pm_lock, flags);
-               if (unlikely(ath9k_check_auto_sleep(sc) ||
-                            (sc->ps_flags & (PS_WAIT_FOR_BEACON |
+
+               if ((sc->ps_flags & (PS_WAIT_FOR_BEACON |
                                              PS_WAIT_FOR_CAB |
-                                             PS_WAIT_FOR_PSPOLL_DATA))))
+                                             PS_WAIT_FOR_PSPOLL_DATA)) ||
+                                       unlikely(ath9k_check_auto_sleep(sc)))
                        ath_rx_ps(sc, skb);
                spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
 
                if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
                        ath_ant_comb_scan(sc, &rs);
 
-               ath_rx_send_to_mac80211(hw, sc, skb, rxs);
+               ath_rx_send_to_mac80211(hw, sc, skb);
 
 requeue:
                if (edma) {