]> git.karo-electronics.de Git - linux-beck.git/blobdiff - drivers/net/wireless/ath/ath9k/recv.c
ath9k: lock reset and PCU start/stopping
[linux-beck.git] / drivers / net / wireless / ath / ath9k / recv.c
index 7c90eaf9ec55cb2409a055850d373ffcd219f93c..fddb0129bb57c43efa1148401a3ebf1e80f38239 100644 (file)
@@ -268,6 +268,7 @@ static int ath_rx_edma_init(struct ath_softc *sc, int nbufs)
                                                bf->bf_buf_addr))) {
                                dev_kfree_skb_any(skb);
                                bf->bf_mpdu = NULL;
+                               bf->bf_buf_addr = 0;
                                ath_print(common, ATH_DBG_FATAL,
                                        "dma_mapping_error() on RX init\n");
                                error = -ENOMEM;
@@ -296,19 +297,17 @@ static void ath_edma_start_recv(struct ath_softc *sc)
        ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP,
                              sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize);
 
-       spin_unlock_bh(&sc->rx.rxbuflock);
-
        ath_opmode_init(sc);
 
        ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_OFFCHANNEL));
+
+       spin_unlock_bh(&sc->rx.rxbuflock);
 }
 
 static void ath_edma_stop_recv(struct ath_softc *sc)
 {
-       spin_lock_bh(&sc->rx.rxbuflock);
        ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP);
        ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP);
-       spin_unlock_bh(&sc->rx.rxbuflock);
 }
 
 int ath_rx_init(struct ath_softc *sc, int nbufs)
@@ -318,7 +317,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
        struct ath_buf *bf;
        int error = 0;
 
-       spin_lock_init(&sc->rx.rxflushlock);
+       spin_lock_init(&sc->rx.pcu_lock);
        sc->sc_flags &= ~SC_OP_RXFLUSH;
        spin_lock_init(&sc->rx.rxbuflock);
 
@@ -358,12 +357,12 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
                                                        bf->bf_buf_addr))) {
                                dev_kfree_skb_any(skb);
                                bf->bf_mpdu = NULL;
+                               bf->bf_buf_addr = 0;
                                ath_print(common, ATH_DBG_FATAL,
                                          "dma_mapping_error() on RX init\n");
                                error = -ENOMEM;
                                goto err;
                        }
-                       bf->bf_dmacontext = bf->bf_buf_addr;
                }
                sc->rx.rxlink = NULL;
        }
@@ -393,6 +392,8 @@ void ath_rx_cleanup(struct ath_softc *sc)
                                                common->rx_bufsize,
                                                DMA_FROM_DEVICE);
                                dev_kfree_skb(skb);
+                               bf->bf_buf_addr = 0;
+                               bf->bf_mpdu = NULL;
                        }
                }
 
@@ -503,10 +504,11 @@ int ath_startrecv(struct ath_softc *sc)
        ath9k_hw_rxena(ah);
 
 start_recv:
-       spin_unlock_bh(&sc->rx.rxbuflock);
        ath_opmode_init(sc);
        ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_OFFCHANNEL));
 
+       spin_unlock_bh(&sc->rx.rxbuflock);
+
        return 0;
 }
 
@@ -515,6 +517,7 @@ bool ath_stoprecv(struct ath_softc *sc)
        struct ath_hw *ah = sc->sc_ah;
        bool stopped;
 
+       spin_lock_bh(&sc->rx.rxbuflock);
        ath9k_hw_stoppcurecv(ah);
        ath9k_hw_setrxfilter(ah, 0);
        stopped = ath9k_hw_stopdmarecv(ah);
@@ -523,19 +526,18 @@ bool ath_stoprecv(struct ath_softc *sc)
                ath_edma_stop_recv(sc);
        else
                sc->rx.rxlink = NULL;
+       spin_unlock_bh(&sc->rx.rxbuflock);
 
        return stopped;
 }
 
 void ath_flushrecv(struct ath_softc *sc)
 {
-       spin_lock_bh(&sc->rx.rxflushlock);
        sc->sc_flags |= SC_OP_RXFLUSH;
        if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
                ath_rx_tasklet(sc, 1, true);
        ath_rx_tasklet(sc, 1, false);
        sc->sc_flags &= ~SC_OP_RXFLUSH;
-       spin_unlock_bh(&sc->rx.rxflushlock);
 }
 
 static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb)
@@ -1734,12 +1736,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                          bf->bf_buf_addr))) {
                        dev_kfree_skb_any(requeue_skb);
                        bf->bf_mpdu = NULL;
+                       bf->bf_buf_addr = 0;
                        ath_print(common, ATH_DBG_FATAL,
                                  "dma_mapping_error() on RX\n");
                        ath_rx_send_to_mac80211(hw, sc, skb, rxs);
                        break;
                }
-               bf->bf_dmacontext = bf->bf_buf_addr;
 
                /*
                 * change the default rx antenna if rx diversity chooses the