ath9k: make the regulatory override less intrusive - allow it to parse CTLs
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 553-ath9k_no_node_rssi.patch
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];
5 u16 maxampdu;
6 u8 mpdudensity;
7 - int last_rssi;
8 };
9
10 #define AGGR_CLEANUP BIT(1)
11 @@ -666,6 +665,7 @@ struct ath_wiphy {
12 bool idle;
13 int chan_idx;
14 int chan_is_ht;
15 + int last_rssi;
16 };
17
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;
26 }
27 }
28
29 @@ -822,9 +821,11 @@ static u32 ath_get_extchanmode(struct at
30 }
31
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)
36 {
37 + struct ath_wiphy *aphy = hw->priv;
38 struct ath_hw *ah = sc->sc_ah;
39 struct ath_common *common = ath9k_hw_common(ah);
40
41 @@ -848,6 +849,7 @@ static void ath9k_bss_assoc_info(struct
42 ath_beacon_config(sc, vif);
43
44 /* Reset rssi stats */
45 + aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
46 sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
47
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",
52 bss_conf->assoc);
53 - ath9k_bss_assoc_info(sc, vif, bss_conf);
54 + ath9k_bss_assoc_info(sc, hw, vif, bss_conf);
55 }
56
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)
63 {
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;
69 + int last_rssi;
70 __le16 fc;
71
72 - fc = hdr->frame_control;
73 + if (ah->opmode != NL80211_IFTYPE_STATION)
74 + return;
75
76 - rcu_read_lock();
77 - /*
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.
83 - */
84 - if (is_multicast_ether_addr(hdr->addr1))
85 - sta = ieee80211_find_sta_by_ifaddr(hw, hdr->addr2, NULL);
86 - else
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))
91 + return;
92
93 - if (sta) {
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;
99 - }
100 - rcu_read_unlock();
101 + if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)
102 + ATH_RSSI_LPF(aphy->last_rssi, rx_stats->rs_rssi);
103
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;
110
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;
115 }
116
117 /*
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)
122 {
123 struct ieee80211_hw *hw = sc->hw;
124 + struct ath_wiphy *aphy = hw->priv;
125 struct ath_common *common;
126 struct ath_hw *ah;
127 int error = 0;
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;
133
134 ath_init_leds(sc);
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
139 aphy->sc = sc;
140 aphy->hw = hw;
141 sc->sec_wiphy[i] = aphy;
142 + aphy->last_rssi = ATH_RSSI_DUMMY_MARKER;
143 spin_unlock_bh(&sc->wiphy_lock);
144
145 memcpy(addr, common->macaddr, ETH_ALEN);