1 --- a/drivers/net/wireless/ath/ath9k/ath9k.h
2 +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
3 @@ -271,7 +271,6 @@ struct ath_node {
4 struct ath_atx_ac ac[WME_NUM_AC];
10 #define AGGR_CLEANUP BIT(1)
11 @@ -666,6 +665,7 @@ struct ath_wiphy {
18 void ath9k_tasklet(unsigned long data);
19 --- a/drivers/net/wireless/ath/ath9k/main.c
20 +++ b/drivers/net/wireless/ath/ath9k/main.c
21 @@ -553,7 +553,6 @@ static void ath_node_attach(struct ath_s
22 an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
23 sta->ht_cap.ampdu_factor);
24 an->mpdudensity = parse_mpdudensity(sta->ht_cap.ampdu_density);
25 - an->last_rssi = ATH_RSSI_DUMMY_MARKER;
29 @@ -822,9 +821,11 @@ static u32 ath_get_extchanmode(struct at
32 static void ath9k_bss_assoc_info(struct ath_softc *sc,
33 + struct ieee80211_hw *hw,
34 struct ieee80211_vif *vif,
35 struct ieee80211_bss_conf *bss_conf)
37 + struct ath_wiphy *aphy = hw->priv;
38 struct ath_hw *ah = sc->sc_ah;
39 struct ath_common *common = ath9k_hw_common(ah);
41 @@ -848,6 +849,7 @@ static void ath9k_bss_assoc_info(struct
42 ath_beacon_config(sc, vif);
44 /* Reset rssi stats */
45 + aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
46 sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
48 sc->sc_flags |= SC_OP_ANI_RUN;
49 @@ -1969,7 +1971,7 @@ static void ath9k_bss_info_changed(struc
50 if (changed & BSS_CHANGED_ASSOC) {
51 ath_print(common, ATH_DBG_CONFIG, "BSS Changed ASSOC %d\n",
53 - ath9k_bss_assoc_info(sc, vif, bss_conf);
54 + ath9k_bss_assoc_info(sc, hw, vif, bss_conf);
57 mutex_unlock(&sc->mutex);
58 --- a/drivers/net/wireless/ath/ath9k/recv.c
59 +++ b/drivers/net/wireless/ath/ath9k/recv.c
60 @@ -960,36 +960,23 @@ static void ath9k_process_rssi(struct at
61 struct ieee80211_hdr *hdr,
62 struct ath_rx_status *rx_stats)
64 + struct ath_wiphy *aphy = hw->priv;
65 struct ath_hw *ah = common->ah;
66 - struct ieee80211_sta *sta;
67 - struct ath_node *an;
68 - int last_rssi = ATH_RSSI_DUMMY_MARKER;
72 - fc = hdr->frame_control;
73 + if (ah->opmode != NL80211_IFTYPE_STATION)
78 - * XXX: use ieee80211_find_sta! This requires quite a bit of work
79 - * under the current ath9k virtual wiphy implementation as we have
80 - * no way of tying a vif to wiphy. Typically vifs are attached to
81 - * at least one sdata of a wiphy on mac80211 but with ath9k virtual
82 - * wiphy you'd have to iterate over every wiphy and each sdata.
84 - if (is_multicast_ether_addr(hdr->addr1))
85 - sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
87 - sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, hdr->addr1);
88 + fc = hdr->frame_control;
89 + if (!ieee80211_is_beacon(fc) ||
90 + compare_ether_addr(hdr->addr3, common->curbssid))
94 - an = (struct ath_node *) sta->drv_priv;
95 - if (rx_stats->rs_rssi != ATH9K_RSSI_BAD &&
96 - !rx_stats->rs_moreaggr)
97 - ATH_RSSI_LPF(an->last_rssi, rx_stats->rs_rssi);
98 - last_rssi = an->last_rssi;
101 + if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
102 + ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
104 + last_rssi = aphy->last_rssi;
105 if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
106 rx_stats->rs_rssi = ATH_EP_RND(last_rssi,
107 ATH_RSSI_EP_MULTIPLIER);
108 @@ -997,8 +984,7 @@ static void ath9k_process_rssi(struct at
109 rx_stats->rs_rssi = 0;
111 /* Update Beacon RSSI, this is used by ANI. */
112 - if (ieee80211_is_beacon(fc))
113 - ah->stats.avgbrssi = rx_stats->rs_rssi;
114 + ah->stats.avgbrssi = rx_stats->rs_rssi;
118 --- a/drivers/net/wireless/ath/ath9k/init.c
119 +++ b/drivers/net/wireless/ath/ath9k/init.c
120 @@ -729,6 +729,7 @@ int ath9k_init_device(u16 devid, struct
121 const struct ath_bus_ops *bus_ops)
123 struct ieee80211_hw *hw = sc->hw;
124 + struct ath_wiphy *aphy = hw->priv;
125 struct ath_common *common;
128 @@ -781,6 +782,7 @@ int ath9k_init_device(u16 devid, struct
129 INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
130 INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
131 sc->wiphy_scheduler_int = msecs_to_jiffies(500);
132 + aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
135 ath_start_rfkill_poll(sc);
136 --- a/drivers/net/wireless/ath/ath9k/virtual.c
137 +++ b/drivers/net/wireless/ath/ath9k/virtual.c
138 @@ -107,6 +107,7 @@ int ath9k_wiphy_add(struct ath_softc *sc
141 sc->sec_wiphy[i] = aphy;
142 + aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
143 spin_unlock_bh(&sc->wiphy_lock);
145 memcpy(addr, common->macaddr, ETH_ALEN);