Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / wireless / ath / ath9k / recv.c
index 1a62e351ec77c217598a46fae7bdbcc84c1c6050..262c81595f6d4a9eec218a4039e540c463a94ce1 100644 (file)
@@ -317,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.pcu_lock);
+       spin_lock_init(&sc->sc_pcu_lock);
        sc->sc_flags &= ~SC_OP_RXFLUSH;
        spin_lock_init(&sc->rx.rxbuflock);
 
@@ -528,6 +528,8 @@ 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;
 }
 
@@ -962,36 +964,23 @@ static void ath9k_process_rssi(struct ath_common *common,
                               struct ieee80211_hdr *hdr,
                               struct ath_rx_status *rx_stats)
 {
+       struct ath_wiphy *aphy = hw->priv;
        struct ath_hw *ah = common->ah;
-       struct ieee80211_sta *sta;
-       struct ath_node *an;
-       int last_rssi = ATH_RSSI_DUMMY_MARKER;
+       int last_rssi;
        __le16 fc;
 
+       if (ah->opmode != NL80211_IFTYPE_STATION)
+               return;
+
        fc = hdr->frame_control;
+       if (!ieee80211_is_beacon(fc) ||
+           compare_ether_addr(hdr->addr3, common->curbssid))
+               return;
 
-       rcu_read_lock();
-       /*
-        * XXX: use ieee80211_find_sta! This requires quite a bit of work
-        * under the current ath9k virtual wiphy implementation as we have
-        * no way of tying a vif to wiphy. Typically vifs are attached to
-        * at least one sdata of a wiphy on mac80211 but with ath9k virtual
-        * wiphy you'd have to iterate over every wiphy and each sdata.
-        */
-       if (is_multicast_ether_addr(hdr->addr1))
-               sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
-       else
-               sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, hdr->addr1);
-
-       if (sta) {
-               an = (struct ath_node *) sta->drv_priv;
-               if (rx_stats->rs_rssi != ATH9K_RSSI_BAD &&
-                  !rx_stats->rs_moreaggr)
-                       ATH_RSSI_LPF(an->last_rssi, rx_stats->rs_rssi);
-               last_rssi = an->last_rssi;
-       }
-       rcu_read_unlock();
+       if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
+               ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
 
+       last_rssi = aphy->last_rssi;
        if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
                rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
                                              ATH_RSSI_EP_MULTIPLIER);
@@ -999,8 +988,7 @@ static void ath9k_process_rssi(struct ath_common *common,
                rx_stats->rs_rssi = 0;
 
        /* Update Beacon RSSI, this is used by ANI. */
-       if (ieee80211_is_beacon(fc))
-               ah->stats.avgbrssi = rx_stats->rs_rssi;
+       ah->stats.avgbrssi = rx_stats->rs_rssi;
 }
 
 /*