aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c10
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--include/linux/nl80211.h6
-rw-r--r--include/net/cfg80211.h2
-rw-r--r--include/net/mac80211.h29
-rw-r--r--net/mac80211/Kconfig56
-rw-r--r--net/mac80211/Makefile6
-rw-r--r--net/mac80211/agg-rx.c34
-rw-r--r--net/mac80211/agg-tx.c72
-rw-r--r--net/mac80211/cfg.c30
-rw-r--r--net/mac80211/debug.h170
-rw-r--r--net/mac80211/debugfs_netdev.c5
-rw-r--r--net/mac80211/driver-ops.h17
-rw-r--r--net/mac80211/driver-trace.c9
-rw-r--r--net/mac80211/ht.c10
-rw-r--r--net/mac80211/ibss.c89
-rw-r--r--net/mac80211/ieee80211_i.h1
-rw-r--r--net/mac80211/iface.c21
-rw-r--r--net/mac80211/key.c4
-rw-r--r--net/mac80211/mesh.c4
-rw-r--r--net/mac80211/mesh_hwmp.c42
-rw-r--r--net/mac80211/mesh_pathtbl.c30
-rw-r--r--net/mac80211/mesh_plink.c61
-rw-r--r--net/mac80211/mesh_sync.c47
-rw-r--r--net/mac80211/mlme.c203
-rw-r--r--net/mac80211/offchannel.c1
-rw-r--r--net/mac80211/rx.c71
-rw-r--r--net/mac80211/sta_info.c44
-rw-r--r--net/mac80211/status.c11
-rw-r--r--net/mac80211/tkip.c43
-rw-r--r--net/mac80211/trace.c75
-rw-r--r--net/mac80211/trace.h (renamed from net/mac80211/driver-trace.h)67
-rw-r--r--net/mac80211/tx.c49
-rw-r--r--net/wireless/nl80211.c9
34 files changed, 768 insertions, 562 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index a0b7cfd34685..5bddf53ece1d 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -678,8 +678,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
678 continue; 678 continue;
679 679
680 if (data2->idle || !data2->started || 680 if (data2->idle || !data2->started ||
681 !hwsim_ps_rx_ok(data2, skb) || 681 !hwsim_ps_rx_ok(data2, skb) || !data2->channel ||
682 !data->channel || !data2->channel ||
683 data->channel->center_freq != data2->channel->center_freq || 682 data->channel->center_freq != data2->channel->center_freq ||
684 !(data->group & data2->group)) 683 !(data->group & data2->group))
685 continue; 684 continue;
@@ -1486,7 +1485,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
1486 struct mac80211_hwsim_data *data2; 1485 struct mac80211_hwsim_data *data2;
1487 struct ieee80211_tx_info *txi; 1486 struct ieee80211_tx_info *txi;
1488 struct hwsim_tx_rate *tx_attempts; 1487 struct hwsim_tx_rate *tx_attempts;
1489 struct sk_buff __user *ret_skb; 1488 unsigned long ret_skb_ptr;
1490 struct sk_buff *skb, *tmp; 1489 struct sk_buff *skb, *tmp;
1491 struct mac_address *src; 1490 struct mac_address *src;
1492 unsigned int hwsim_flags; 1491 unsigned int hwsim_flags;
@@ -1504,8 +1503,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
1504 info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER]); 1503 info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER]);
1505 hwsim_flags = nla_get_u32(info->attrs[HWSIM_ATTR_FLAGS]); 1504 hwsim_flags = nla_get_u32(info->attrs[HWSIM_ATTR_FLAGS]);
1506 1505
1507 ret_skb = (struct sk_buff __user *) 1506 ret_skb_ptr = nla_get_u64(info->attrs[HWSIM_ATTR_COOKIE]);
1508 (unsigned long) nla_get_u64(info->attrs[HWSIM_ATTR_COOKIE]);
1509 1507
1510 data2 = get_hwsim_data_ref_from_addr(src); 1508 data2 = get_hwsim_data_ref_from_addr(src);
1511 1509
@@ -1514,7 +1512,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
1514 1512
1515 /* look for the skb matching the cookie passed back from user */ 1513 /* look for the skb matching the cookie passed back from user */
1516 skb_queue_walk_safe(&data2->pending, skb, tmp) { 1514 skb_queue_walk_safe(&data2->pending, skb, tmp) {
1517 if (skb == ret_skb) { 1515 if ((unsigned long)skb == ret_skb_ptr) {
1518 skb_unlink(skb, &data2->pending); 1516 skb_unlink(skb, &data2->pending);
1519 found = true; 1517 found = true;
1520 break; 1518 break;
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 6e0601189db9..318fc1f705b1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1633,6 +1633,8 @@ enum ieee80211_sa_query_action {
1633#define WLAN_OUI_TYPE_WFA_P2P 9 1633#define WLAN_OUI_TYPE_WFA_P2P 9
1634#define WLAN_OUI_MICROSOFT 0x0050f2 1634#define WLAN_OUI_MICROSOFT 0x0050f2
1635#define WLAN_OUI_TYPE_MICROSOFT_WPA 1 1635#define WLAN_OUI_TYPE_MICROSOFT_WPA 1
1636#define WLAN_OUI_TYPE_MICROSOFT_WMM 2
1637#define WLAN_OUI_TYPE_MICROSOFT_WPS 4
1636 1638
1637/* 1639/*
1638 * WMM/802.11e Tspec Element 1640 * WMM/802.11e Tspec Element
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index b7c3b737ddde..c0fc5d277338 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1542,6 +1542,9 @@ enum nl80211_attrs {
1542 1542
1543#define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10 1543#define NL80211_MIN_REMAIN_ON_CHANNEL_TIME 10
1544 1544
1545/* default RSSI threshold for scan results if none specified. */
1546#define NL80211_SCAN_RSSI_THOLD_OFF -300
1547
1545/** 1548/**
1546 * enum nl80211_iftype - (virtual) interface types 1549 * enum nl80211_iftype - (virtual) interface types
1547 * 1550 *
@@ -1974,6 +1977,8 @@ enum nl80211_reg_rule_attr {
1974 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved 1977 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
1975 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, 1978 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
1976 * only report BSS with matching SSID. 1979 * only report BSS with matching SSID.
1980 * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a
1981 * BSS in scan results. Filtering is turned off if not specified.
1977 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter 1982 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
1978 * attribute number currently defined 1983 * attribute number currently defined
1979 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use 1984 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
@@ -1982,6 +1987,7 @@ enum nl80211_sched_scan_match_attr {
1982 __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, 1987 __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID,
1983 1988
1984 NL80211_SCHED_SCAN_MATCH_ATTR_SSID, 1989 NL80211_SCHED_SCAN_MATCH_ATTR_SSID,
1990 NL80211_SCHED_SCAN_MATCH_ATTR_RSSI,
1985 1991
1986 /* keep last */ 1992 /* keep last */
1987 __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, 1993 __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f0163a10b8ce..061c01957e54 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1027,6 +1027,7 @@ struct cfg80211_match_set {
1027 * @wiphy: the wiphy this was for 1027 * @wiphy: the wiphy this was for
1028 * @dev: the interface 1028 * @dev: the interface
1029 * @channels: channels to scan 1029 * @channels: channels to scan
1030 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1030 */ 1031 */
1031struct cfg80211_sched_scan_request { 1032struct cfg80211_sched_scan_request {
1032 struct cfg80211_ssid *ssids; 1033 struct cfg80211_ssid *ssids;
@@ -1037,6 +1038,7 @@ struct cfg80211_sched_scan_request {
1037 size_t ie_len; 1038 size_t ie_len;
1038 struct cfg80211_match_set *match_sets; 1039 struct cfg80211_match_set *match_sets;
1039 int n_match_sets; 1040 int n_match_sets;
1041 s32 rssi_thold;
1040 1042
1041 /* internal */ 1043 /* internal */
1042 struct wiphy *wiphy; 1044 struct wiphy *wiphy;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 6914f9978aea..670a58ba8a41 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2254,6 +2254,9 @@ enum ieee80211_rate_control_changed {
2254 * @get_et_strings: Ethtool API to get a set of strings to describe stats 2254 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2255 * and perhaps other supported types of ethtool data-sets. 2255 * and perhaps other supported types of ethtool data-sets.
2256 * 2256 *
2257 * @get_rssi: Get current signal strength in dBm, the function is optional
2258 * and can sleep.
2259 *
2257 */ 2260 */
2258struct ieee80211_ops { 2261struct ieee80211_ops {
2259 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2262 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -2393,6 +2396,8 @@ struct ieee80211_ops {
2393 void (*get_et_strings)(struct ieee80211_hw *hw, 2396 void (*get_et_strings)(struct ieee80211_hw *hw,
2394 struct ieee80211_vif *vif, 2397 struct ieee80211_vif *vif,
2395 u32 sset, u8 *data); 2398 u32 sset, u8 *data);
2399 int (*get_rssi)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2400 struct ieee80211_sta *sta, s8 *rssi_dbm);
2396}; 2401};
2397 2402
2398/** 2403/**
@@ -3843,28 +3848,4 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
3843 */ 3848 */
3844int ieee80211_ave_rssi(struct ieee80211_vif *vif); 3849int ieee80211_ave_rssi(struct ieee80211_vif *vif);
3845 3850
3846/* Extra debugging macros */
3847
3848#ifdef CONFIG_MAC80211_HT_DEBUG
3849#define ht_vdbg(fmt, ...) \
3850 pr_debug(fmt, ##__VA_ARGS__)
3851#else
3852#define ht_vdbg(fmt, ...) \
3853do { \
3854 if (0) \
3855 pr_debug(fmt, ##__VA_ARGS__); \
3856} while (0)
3857#endif
3858
3859#ifdef CONFIG_MAC80211_IBSS_DEBUG
3860#define ibss_vdbg(fmt, ...) \
3861 pr_debug(fmt, ##__VA_ARGS__)
3862#else
3863#define ibss_vdbg(fmt, ...) \
3864do { \
3865 if (0) \
3866 pr_debug(fmt, ##__VA_ARGS__); \
3867} while (0)
3868#endif
3869
3870#endif /* MAC80211_H */ 3851#endif /* MAC80211_H */
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 8d249d705980..63af25458fda 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -107,6 +107,19 @@ config MAC80211_DEBUGFS
107 107
108 Say N unless you know you need this. 108 Say N unless you know you need this.
109 109
110config MAC80211_MESSAGE_TRACING
111 bool "Trace all mac80211 debug messages"
112 depends on MAC80211
113 ---help---
114 Select this option to have mac80211 register the
115 mac80211_msg trace subsystem with tracepoints to
116 collect all debugging messages, independent of
117 printing them into the kernel log.
118
119 The overhead in this option is that all the messages
120 need to be present in the binary and formatted at
121 runtime for tracing.
122
110menuconfig MAC80211_DEBUG_MENU 123menuconfig MAC80211_DEBUG_MENU
111 bool "Select mac80211 debugging features" 124 bool "Select mac80211 debugging features"
112 depends on MAC80211 125 depends on MAC80211
@@ -140,26 +153,35 @@ config MAC80211_VERBOSE_DEBUG
140 153
141 Do not select this option. 154 Do not select this option.
142 155
143config MAC80211_HT_DEBUG 156config MAC80211_MLME_DEBUG
144 bool "Verbose HT debugging" 157 bool "Verbose managed MLME output"
145 depends on MAC80211_DEBUG_MENU 158 depends on MAC80211_DEBUG_MENU
146 ---help--- 159 ---help---
147 This option enables 802.11n High Throughput features 160 Selecting this option causes mac80211 to print out
148 debug tracing output. 161 debugging messages for the managed-mode MLME. It
149 162 should not be selected on production systems as some
150 It should not be selected on production systems as some
151 of the messages are remotely triggerable. 163 of the messages are remotely triggerable.
152 164
153 Do not select this option. 165 Do not select this option.
154 166
155config MAC80211_TKIP_DEBUG 167config MAC80211_STA_DEBUG
156 bool "Verbose TKIP debugging" 168 bool "Verbose station debugging"
157 depends on MAC80211_DEBUG_MENU 169 depends on MAC80211_DEBUG_MENU
158 ---help--- 170 ---help---
159 Selecting this option causes mac80211 to print out 171 Selecting this option causes mac80211 to print out
160 very verbose TKIP debugging messages. It should not 172 debugging messages for station addition/removal.
161 be selected on production systems as those messages 173
162 are remotely triggerable. 174 Do not select this option.
175
176config MAC80211_HT_DEBUG
177 bool "Verbose HT debugging"
178 depends on MAC80211_DEBUG_MENU
179 ---help---
180 This option enables 802.11n High Throughput features
181 debug tracing output.
182
183 It should not be selected on production systems as some
184 of the messages are remotely triggerable.
163 185
164 Do not select this option. 186 Do not select this option.
165 187
@@ -174,7 +196,7 @@ config MAC80211_IBSS_DEBUG
174 196
175 Do not select this option. 197 Do not select this option.
176 198
177config MAC80211_VERBOSE_PS_DEBUG 199config MAC80211_PS_DEBUG
178 bool "Verbose powersave mode debugging" 200 bool "Verbose powersave mode debugging"
179 depends on MAC80211_DEBUG_MENU 201 depends on MAC80211_DEBUG_MENU
180 ---help--- 202 ---help---
@@ -186,7 +208,7 @@ config MAC80211_VERBOSE_PS_DEBUG
186 208
187 Do not select this option. 209 Do not select this option.
188 210
189config MAC80211_VERBOSE_MPL_DEBUG 211config MAC80211_MPL_DEBUG
190 bool "Verbose mesh peer link debugging" 212 bool "Verbose mesh peer link debugging"
191 depends on MAC80211_DEBUG_MENU 213 depends on MAC80211_DEBUG_MENU
192 depends on MAC80211_MESH 214 depends on MAC80211_MESH
@@ -199,7 +221,7 @@ config MAC80211_VERBOSE_MPL_DEBUG
199 221
200 Do not select this option. 222 Do not select this option.
201 223
202config MAC80211_VERBOSE_MPATH_DEBUG 224config MAC80211_MPATH_DEBUG
203 bool "Verbose mesh path debugging" 225 bool "Verbose mesh path debugging"
204 depends on MAC80211_DEBUG_MENU 226 depends on MAC80211_DEBUG_MENU
205 depends on MAC80211_MESH 227 depends on MAC80211_MESH
@@ -212,7 +234,7 @@ config MAC80211_VERBOSE_MPATH_DEBUG
212 234
213 Do not select this option. 235 Do not select this option.
214 236
215config MAC80211_VERBOSE_MHWMP_DEBUG 237config MAC80211_MHWMP_DEBUG
216 bool "Verbose mesh HWMP routing debugging" 238 bool "Verbose mesh HWMP routing debugging"
217 depends on MAC80211_DEBUG_MENU 239 depends on MAC80211_DEBUG_MENU
218 depends on MAC80211_MESH 240 depends on MAC80211_MESH
@@ -225,7 +247,7 @@ config MAC80211_VERBOSE_MHWMP_DEBUG
225 247
226 Do not select this option. 248 Do not select this option.
227 249
228config MAC80211_VERBOSE_MESH_SYNC_DEBUG 250config MAC80211_MESH_SYNC_DEBUG
229 bool "Verbose mesh mesh synchronization debugging" 251 bool "Verbose mesh mesh synchronization debugging"
230 depends on MAC80211_DEBUG_MENU 252 depends on MAC80211_DEBUG_MENU
231 depends on MAC80211_MESH 253 depends on MAC80211_MESH
@@ -236,7 +258,7 @@ config MAC80211_VERBOSE_MESH_SYNC_DEBUG
236 258
237 Do not select this option. 259 Do not select this option.
238 260
239config MAC80211_VERBOSE_TDLS_DEBUG 261config MAC80211_TDLS_DEBUG
240 bool "Verbose TDLS debugging" 262 bool "Verbose TDLS debugging"
241 depends on MAC80211_DEBUG_MENU 263 depends on MAC80211_DEBUG_MENU
242 ---help--- 264 ---help---
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 2b1470bac178..a7dd110faafa 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -24,7 +24,7 @@ mac80211-y := \
24 wme.o \ 24 wme.o \
25 event.o \ 25 event.o \
26 chan.o \ 26 chan.o \
27 driver-trace.o mlme.o 27 trace.o mlme.o
28 28
29mac80211-$(CONFIG_MAC80211_LEDS) += led.o 29mac80211-$(CONFIG_MAC80211_LEDS) += led.o
30mac80211-$(CONFIG_MAC80211_DEBUGFS) += \ 30mac80211-$(CONFIG_MAC80211_DEBUGFS) += \
@@ -42,7 +42,7 @@ mac80211-$(CONFIG_MAC80211_MESH) += \
42 42
43mac80211-$(CONFIG_PM) += pm.o 43mac80211-$(CONFIG_PM) += pm.o
44 44
45CFLAGS_driver-trace.o := -I$(src) 45CFLAGS_trace.o := -I$(src)
46 46
47# objects for PID algorithm 47# objects for PID algorithm
48rc80211_pid-y := rc80211_pid_algo.o 48rc80211_pid-y := rc80211_pid_algo.o
@@ -58,4 +58,4 @@ mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
58mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) 58mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
59mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) 59mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y)
60 60
61ccflags-y += -D__CHECK_ENDIAN__ 61ccflags-y += -D__CHECK_ENDIAN__ -DDEBUG
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 32ef11d69798..186d9919b043 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -74,15 +74,17 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
74 74
75 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); 75 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
76 76
77 ht_vdbg("Rx BA session stop requested for %pM tid %u %s reason: %d\n", 77 ht_dbg(sta->sdata,
78 sta->sta.addr, tid, 78 "Rx BA session stop requested for %pM tid %u %s reason: %d\n",
79 initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator", 79 sta->sta.addr, tid,
80 (int)reason); 80 initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
81 (int)reason);
81 82
82 if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, 83 if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
83 &sta->sta, tid, NULL, 0)) 84 &sta->sta, tid, NULL, 0))
84 pr_debug("HW problem - can not stop rx aggregation for tid %d\n", 85 sdata_info(sta->sdata,
85 tid); 86 "HW problem - can not stop rx aggregation for tid %d\n",
87 tid);
86 88
87 /* check if this is a self generated aggregation halt */ 89 /* check if this is a self generated aggregation halt */
88 if (initiator == WLAN_BACK_RECIPIENT && tx) 90 if (initiator == WLAN_BACK_RECIPIENT && tx)
@@ -157,7 +159,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
157 } 159 }
158 rcu_read_unlock(); 160 rcu_read_unlock();
159 161
160 ht_vdbg("rx session timer expired on tid %d\n", (u16)*ptid); 162 ht_dbg(sta->sdata, "rx session timer expired on tid %d\n", (u16)*ptid);
161 163
162 set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); 164 set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired);
163 ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); 165 ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
@@ -245,7 +247,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
245 status = WLAN_STATUS_REQUEST_DECLINED; 247 status = WLAN_STATUS_REQUEST_DECLINED;
246 248
247 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { 249 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
248 ht_vdbg("Suspend in progress - Denying ADDBA request\n"); 250 ht_dbg(sta->sdata, "Suspend in progress - Denying ADDBA request\n");
249 goto end_no_lock; 251 goto end_no_lock;
250 } 252 }
251 253
@@ -257,10 +259,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
257 (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || 259 (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) ||
258 (buf_size > IEEE80211_MAX_AMPDU_BUF)) { 260 (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
259 status = WLAN_STATUS_INVALID_QOS_PARAM; 261 status = WLAN_STATUS_INVALID_QOS_PARAM;
260#ifdef CONFIG_MAC80211_HT_DEBUG 262 ht_dbg_ratelimited(sta->sdata,
261 net_dbg_ratelimited("AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", 263 "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n",
262 mgmt->sa, tid, ba_policy, buf_size); 264 mgmt->sa, tid, ba_policy, buf_size);
263#endif /* CONFIG_MAC80211_HT_DEBUG */
264 goto end_no_lock; 265 goto end_no_lock;
265 } 266 }
266 /* determine default buffer size */ 267 /* determine default buffer size */
@@ -275,10 +276,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
275 mutex_lock(&sta->ampdu_mlme.mtx); 276 mutex_lock(&sta->ampdu_mlme.mtx);
276 277
277 if (sta->ampdu_mlme.tid_rx[tid]) { 278 if (sta->ampdu_mlme.tid_rx[tid]) {
278#ifdef CONFIG_MAC80211_HT_DEBUG 279 ht_dbg_ratelimited(sta->sdata,
279 net_dbg_ratelimited("unexpected AddBA Req from %pM on tid %u\n", 280 "unexpected AddBA Req from %pM on tid %u\n",
280 mgmt->sa, tid); 281 mgmt->sa, tid);
281#endif /* CONFIG_MAC80211_HT_DEBUG */
282 282
283 /* delete existing Rx BA session on the same tid */ 283 /* delete existing Rx BA session on the same tid */
284 ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, 284 ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT,
@@ -317,7 +317,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
317 317
318 ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, 318 ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START,
319 &sta->sta, tid, &start_seq_num, 0); 319 &sta->sta, tid, &start_seq_num, 0);
320 ht_vdbg("Rx A-MPDU request on tid %d result %d\n", tid, ret); 320 ht_dbg(sta->sdata, "Rx A-MPDU request on tid %d result %d\n", tid, ret);
321 if (ret) { 321 if (ret) {
322 kfree(tid_agg_rx->reorder_buf); 322 kfree(tid_agg_rx->reorder_buf);
323 kfree(tid_agg_rx->reorder_time); 323 kfree(tid_agg_rx->reorder_time);
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index da07f01cfe4d..5cc1bf7d8033 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -184,8 +184,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
184 184
185 spin_unlock_bh(&sta->lock); 185 spin_unlock_bh(&sta->lock);
186 186
187 ht_vdbg("Tx BA session stop requested for %pM tid %u\n", 187 ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n",
188 sta->sta.addr, tid); 188 sta->sta.addr, tid);
189 189
190 del_timer_sync(&tid_tx->addba_resp_timer); 190 del_timer_sync(&tid_tx->addba_resp_timer);
191 del_timer_sync(&tid_tx->session_timer); 191 del_timer_sync(&tid_tx->session_timer);
@@ -251,12 +251,13 @@ static void sta_addba_resp_timer_expired(unsigned long data)
251 if (!tid_tx || 251 if (!tid_tx ||
252 test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { 252 test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) {
253 rcu_read_unlock(); 253 rcu_read_unlock();
254 ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n", 254 ht_dbg(sta->sdata,
255 tid); 255 "timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
256 tid);
256 return; 257 return;
257 } 258 }
258 259
259 ht_vdbg("addBA response timer expired on tid %d\n", tid); 260 ht_dbg(sta->sdata, "addBA response timer expired on tid %d\n", tid);
260 261
261 ieee80211_stop_tx_ba_session(&sta->sta, tid); 262 ieee80211_stop_tx_ba_session(&sta->sta, tid);
262 rcu_read_unlock(); 263 rcu_read_unlock();
@@ -316,8 +317,9 @@ ieee80211_agg_splice_packets(struct ieee80211_sub_if_data *sdata,
316 317
317 ieee80211_stop_queue_agg(sdata, tid); 318 ieee80211_stop_queue_agg(sdata, tid);
318 319
319 if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates" 320 if (WARN(!tid_tx,
320 " from the pending queue\n", tid)) 321 "TID %d gone but expected when splicing aggregates from the pending queue\n",
322 tid))
321 return; 323 return;
322 324
323 if (!skb_queue_empty(&tid_tx->pending)) { 325 if (!skb_queue_empty(&tid_tx->pending)) {
@@ -365,7 +367,8 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
365 ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, 367 ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START,
366 &sta->sta, tid, &start_seq_num, 0); 368 &sta->sta, tid, &start_seq_num, 0);
367 if (ret) { 369 if (ret) {
368 ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid); 370 ht_dbg(sdata,
371 "BA request denied - HW unavailable for tid %d\n", tid);
369 spin_lock_bh(&sta->lock); 372 spin_lock_bh(&sta->lock);
370 ieee80211_agg_splice_packets(sdata, tid_tx, tid); 373 ieee80211_agg_splice_packets(sdata, tid_tx, tid);
371 ieee80211_assign_tid_tx(sta, tid, NULL); 374 ieee80211_assign_tid_tx(sta, tid, NULL);
@@ -378,7 +381,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
378 381
379 /* activate the timer for the recipient's addBA response */ 382 /* activate the timer for the recipient's addBA response */
380 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); 383 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
381 ht_vdbg("activated addBA response timer on tid %d\n", tid); 384 ht_dbg(sdata, "activated addBA response timer on tid %d\n", tid);
382 385
383 spin_lock_bh(&sta->lock); 386 spin_lock_bh(&sta->lock);
384 sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; 387 sta->ampdu_mlme.last_addba_req_time[tid] = jiffies;
@@ -425,7 +428,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data)
425 428
426 rcu_read_unlock(); 429 rcu_read_unlock();
427 430
428 ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid); 431 ht_dbg(sta->sdata, "tx session timer expired on tid %d\n", (u16)*ptid);
429 432
430 ieee80211_stop_tx_ba_session(&sta->sta, *ptid); 433 ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
431} 434}
@@ -449,8 +452,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
449 (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) 452 (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
450 return -EINVAL; 453 return -EINVAL;
451 454
452 ht_vdbg("Open BA session requested for %pM tid %u\n", 455 ht_dbg(sdata, "Open BA session requested for %pM tid %u\n",
453 pubsta->addr, tid); 456 pubsta->addr, tid);
454 457
455 if (sdata->vif.type != NL80211_IFTYPE_STATION && 458 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
456 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && 459 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
@@ -460,7 +463,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
460 return -EINVAL; 463 return -EINVAL;
461 464
462 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { 465 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
463 ht_vdbg("BA sessions blocked - Denying BA session request\n"); 466 ht_dbg(sdata,
467 "BA sessions blocked - Denying BA session request\n");
464 return -EINVAL; 468 return -EINVAL;
465 } 469 }
466 470
@@ -478,8 +482,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
478 */ 482 */
479 if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && 483 if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC &&
480 !sta->sta.ht_cap.ht_supported) { 484 !sta->sta.ht_cap.ht_supported) {
481 ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n", 485 ht_dbg(sdata,
482 pubsta->addr); 486 "BA request denied - IBSS STA %pM does not advertise HT support\n",
487 pubsta->addr);
483 return -EINVAL; 488 return -EINVAL;
484 } 489 }
485 490
@@ -499,8 +504,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
499 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && 504 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
500 time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + 505 time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
501 HT_AGG_RETRIES_PERIOD)) { 506 HT_AGG_RETRIES_PERIOD)) {
502 ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n", 507 ht_dbg(sdata,
503 sta->ampdu_mlme.addba_req_num[tid], tid); 508 "BA request denied - waiting a grace period after %d failed requests on tid %u\n",
509 sta->ampdu_mlme.addba_req_num[tid], tid);
504 ret = -EBUSY; 510 ret = -EBUSY;
505 goto err_unlock_sta; 511 goto err_unlock_sta;
506 } 512 }
@@ -508,8 +514,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
508 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 514 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
509 /* check if the TID is not in aggregation flow already */ 515 /* check if the TID is not in aggregation flow already */
510 if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { 516 if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {
511 ht_vdbg("BA request denied - session is not idle on tid %u\n", 517 ht_dbg(sdata,
512 tid); 518 "BA request denied - session is not idle on tid %u\n",
519 tid);
513 ret = -EAGAIN; 520 ret = -EAGAIN;
514 goto err_unlock_sta; 521 goto err_unlock_sta;
515 } 522 }
@@ -564,7 +571,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
564 571
565 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 572 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
566 573
567 ht_vdbg("Aggregation is on for tid %d\n", tid); 574 ht_dbg(sta->sdata, "Aggregation is on for tid %d\n", tid);
568 575
569 drv_ampdu_action(local, sta->sdata, 576 drv_ampdu_action(local, sta->sdata,
570 IEEE80211_AMPDU_TX_OPERATIONAL, 577 IEEE80211_AMPDU_TX_OPERATIONAL,
@@ -598,7 +605,8 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
598 trace_api_start_tx_ba_cb(sdata, ra, tid); 605 trace_api_start_tx_ba_cb(sdata, ra, tid);
599 606
600 if (tid >= STA_TID_NUM) { 607 if (tid >= STA_TID_NUM) {
601 ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM); 608 ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
609 tid, STA_TID_NUM);
602 return; 610 return;
603 } 611 }
604 612
@@ -606,7 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
606 sta = sta_info_get_bss(sdata, ra); 614 sta = sta_info_get_bss(sdata, ra);
607 if (!sta) { 615 if (!sta) {
608 mutex_unlock(&local->sta_mtx); 616 mutex_unlock(&local->sta_mtx);
609 ht_vdbg("Could not find station: %pM\n", ra); 617 ht_dbg(sdata, "Could not find station: %pM\n", ra);
610 return; 618 return;
611 } 619 }
612 620
@@ -614,7 +622,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
614 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 622 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
615 623
616 if (WARN_ON(!tid_tx)) { 624 if (WARN_ON(!tid_tx)) {
617 ht_vdbg("addBA was not requested!\n"); 625 ht_dbg(sdata, "addBA was not requested!\n");
618 goto unlock; 626 goto unlock;
619 } 627 }
620 628
@@ -714,17 +722,18 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
714 trace_api_stop_tx_ba_cb(sdata, ra, tid); 722 trace_api_stop_tx_ba_cb(sdata, ra, tid);
715 723
716 if (tid >= STA_TID_NUM) { 724 if (tid >= STA_TID_NUM) {
717 ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM); 725 ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
726 tid, STA_TID_NUM);
718 return; 727 return;
719 } 728 }
720 729
721 ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid); 730 ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", ra, tid);
722 731
723 mutex_lock(&local->sta_mtx); 732 mutex_lock(&local->sta_mtx);
724 733
725 sta = sta_info_get_bss(sdata, ra); 734 sta = sta_info_get_bss(sdata, ra);
726 if (!sta) { 735 if (!sta) {
727 ht_vdbg("Could not find station: %pM\n", ra); 736 ht_dbg(sdata, "Could not find station: %pM\n", ra);
728 goto unlock; 737 goto unlock;
729 } 738 }
730 739
@@ -733,7 +742,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
733 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 742 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
734 743
735 if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 744 if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
736 ht_vdbg("unexpected callback to A-MPDU stop\n"); 745 ht_dbg(sdata, "unexpected callback to A-MPDU stop\n");
737 goto unlock_sta; 746 goto unlock_sta;
738 } 747 }
739 748
@@ -809,13 +818,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
809 goto out; 818 goto out;
810 819
811 if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { 820 if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
812 ht_vdbg("wrong addBA response token, tid %d\n", tid); 821 ht_dbg(sta->sdata, "wrong addBA response token, tid %d\n", tid);
813 goto out; 822 goto out;
814 } 823 }
815 824
816 del_timer_sync(&tid_tx->addba_resp_timer); 825 del_timer_sync(&tid_tx->addba_resp_timer);
817 826
818 ht_vdbg("switched off addBA timer for tid %d\n", tid); 827 ht_dbg(sta->sdata, "switched off addBA timer for tid %d\n", tid);
819 828
820 /* 829 /*
821 * addba_resp_timer may have fired before we got here, and 830 * addba_resp_timer may have fired before we got here, and
@@ -824,8 +833,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
824 */ 833 */
825 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || 834 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
826 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 835 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
827 ht_vdbg("got addBA resp for tid %d but we already gave up\n", 836 ht_dbg(sta->sdata,
828 tid); 837 "got addBA resp for tid %d but we already gave up\n",
838 tid);
829 goto out; 839 goto out;
830 } 840 }
831 841
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index d197dbeef9ce..c2a2dcbfdf01 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -353,6 +353,7 @@ void sta_set_rate_info_tx(struct sta_info *sta,
353static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) 353static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
354{ 354{
355 struct ieee80211_sub_if_data *sdata = sta->sdata; 355 struct ieee80211_sub_if_data *sdata = sta->sdata;
356 struct ieee80211_local *local = sdata->local;
356 struct timespec uptime; 357 struct timespec uptime;
357 358
358 sinfo->generation = sdata->local->sta_generation; 359 sinfo->generation = sdata->local->sta_generation;
@@ -388,7 +389,9 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
388 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || 389 if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
389 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { 390 (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
390 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; 391 sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
391 sinfo->signal = (s8)sta->last_signal; 392 if (!local->ops->get_rssi ||
393 drv_get_rssi(local, sdata, &sta->sta, &sinfo->signal))
394 sinfo->signal = (s8)sta->last_signal;
392 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); 395 sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);
393 } 396 }
394 397
@@ -517,7 +520,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
517 * network device. 520 * network device.
518 */ 521 */
519 522
520 rcu_read_lock(); 523 mutex_lock(&local->sta_mtx);
521 524
522 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 525 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
523 sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid); 526 sta = sta_info_get_bss(sdata, sdata->u.mgd.bssid);
@@ -546,7 +549,7 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
546 data[i] = (u8)sinfo.signal_avg; 549 data[i] = (u8)sinfo.signal_avg;
547 i++; 550 i++;
548 } else { 551 } else {
549 list_for_each_entry_rcu(sta, &local->sta_list, list) { 552 list_for_each_entry(sta, &local->sta_list, list) {
550 /* Make sure this station belongs to the proper dev */ 553 /* Make sure this station belongs to the proper dev */
551 if (sta->sdata->dev != dev) 554 if (sta->sdata->dev != dev)
552 continue; 555 continue;
@@ -603,7 +606,7 @@ do_survey:
603 else 606 else
604 data[i++] = -1LL; 607 data[i++] = -1LL;
605 608
606 rcu_read_unlock(); 609 mutex_unlock(&local->sta_mtx);
607 610
608 if (WARN_ON(i != STA_STATS_LEN)) 611 if (WARN_ON(i != STA_STATS_LEN))
609 return; 612 return;
@@ -629,10 +632,11 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
629 int idx, u8 *mac, struct station_info *sinfo) 632 int idx, u8 *mac, struct station_info *sinfo)
630{ 633{
631 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 634 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
635 struct ieee80211_local *local = sdata->local;
632 struct sta_info *sta; 636 struct sta_info *sta;
633 int ret = -ENOENT; 637 int ret = -ENOENT;
634 638
635 rcu_read_lock(); 639 mutex_lock(&local->sta_mtx);
636 640
637 sta = sta_info_get_by_idx(sdata, idx); 641 sta = sta_info_get_by_idx(sdata, idx);
638 if (sta) { 642 if (sta) {
@@ -641,7 +645,7 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
641 sta_set_sinfo(sta, sinfo); 645 sta_set_sinfo(sta, sinfo);
642 } 646 }
643 647
644 rcu_read_unlock(); 648 mutex_unlock(&local->sta_mtx);
645 649
646 return ret; 650 return ret;
647} 651}
@@ -658,10 +662,11 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
658 u8 *mac, struct station_info *sinfo) 662 u8 *mac, struct station_info *sinfo)
659{ 663{
660 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 664 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
665 struct ieee80211_local *local = sdata->local;
661 struct sta_info *sta; 666 struct sta_info *sta;
662 int ret = -ENOENT; 667 int ret = -ENOENT;
663 668
664 rcu_read_lock(); 669 mutex_lock(&local->sta_mtx);
665 670
666 sta = sta_info_get_bss(sdata, mac); 671 sta = sta_info_get_bss(sdata, mac);
667 if (sta) { 672 if (sta) {
@@ -669,7 +674,7 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
669 sta_set_sinfo(sta, sinfo); 674 sta_set_sinfo(sta, sinfo);
670 } 675 }
671 676
672 rcu_read_unlock(); 677 mutex_unlock(&local->sta_mtx);
673 678
674 return ret; 679 return ret;
675} 680}
@@ -2769,9 +2774,8 @@ static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2769 !sdata->u.mgd.associated) 2774 !sdata->u.mgd.associated)
2770 return -EINVAL; 2775 return -EINVAL;
2771 2776
2772#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG 2777 tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n",
2773 pr_debug("TDLS mgmt action %d peer %pM\n", action_code, peer); 2778 action_code, peer);
2774#endif
2775 2779
2776 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 2780 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
2777 max(sizeof(struct ieee80211_mgmt), 2781 max(sizeof(struct ieee80211_mgmt),
@@ -2880,9 +2884,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
2880 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2884 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2881 return -EINVAL; 2885 return -EINVAL;
2882 2886
2883#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG 2887 tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer);
2884 pr_debug("TDLS oper %d peer %pM\n", oper, peer);
2885#endif
2886 2888
2887 switch (oper) { 2889 switch (oper) {
2888 case NL80211_TDLS_ENABLE_LINK: 2890 case NL80211_TDLS_ENABLE_LINK:
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h
new file mode 100644
index 000000000000..8f383a576016
--- /dev/null
+++ b/net/mac80211/debug.h
@@ -0,0 +1,170 @@
1#ifndef __MAC80211_DEBUG_H
2#define __MAC80211_DEBUG_H
3#include <net/cfg80211.h>
4
5#ifdef CONFIG_MAC80211_IBSS_DEBUG
6#define MAC80211_IBSS_DEBUG 1
7#else
8#define MAC80211_IBSS_DEBUG 0
9#endif
10
11#ifdef CONFIG_MAC80211_PS_DEBUG
12#define MAC80211_PS_DEBUG 1
13#else
14#define MAC80211_PS_DEBUG 0
15#endif
16
17#ifdef CONFIG_MAC80211_HT_DEBUG
18#define MAC80211_HT_DEBUG 1
19#else
20#define MAC80211_HT_DEBUG 0
21#endif
22
23#ifdef CONFIG_MAC80211_MPL_DEBUG
24#define MAC80211_MPL_DEBUG 1
25#else
26#define MAC80211_MPL_DEBUG 0
27#endif
28
29#ifdef CONFIG_MAC80211_MPATH_DEBUG
30#define MAC80211_MPATH_DEBUG 1
31#else
32#define MAC80211_MPATH_DEBUG 0
33#endif
34
35#ifdef CONFIG_MAC80211_MHWMP_DEBUG
36#define MAC80211_MHWMP_DEBUG 1
37#else
38#define MAC80211_MHWMP_DEBUG 0
39#endif
40
41#ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
42#define MAC80211_MESH_SYNC_DEBUG 1
43#else
44#define MAC80211_MESH_SYNC_DEBUG 0
45#endif
46
47#ifdef CONFIG_MAC80211_TDLS_DEBUG
48#define MAC80211_TDLS_DEBUG 1
49#else
50#define MAC80211_TDLS_DEBUG 0
51#endif
52
53#ifdef CONFIG_MAC80211_STA_DEBUG
54#define MAC80211_STA_DEBUG 1
55#else
56#define MAC80211_STA_DEBUG 0
57#endif
58
59#ifdef CONFIG_MAC80211_MLME_DEBUG
60#define MAC80211_MLME_DEBUG 1
61#else
62#define MAC80211_MLME_DEBUG 0
63#endif
64
65#ifdef CONFIG_MAC80211_MESSAGE_TRACING
66void __sdata_info(const char *fmt, ...) __printf(1, 2);
67void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3);
68void __sdata_err(const char *fmt, ...) __printf(1, 2);
69void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
70 __printf(3, 4);
71
72#define _sdata_info(sdata, fmt, ...) \
73 __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
74#define _sdata_dbg(print, sdata, fmt, ...) \
75 __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__)
76#define _sdata_err(sdata, fmt, ...) \
77 __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
78#define _wiphy_dbg(print, wiphy, fmt, ...) \
79 __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__)
80#else
81#define _sdata_info(sdata, fmt, ...) \
82do { \
83 pr_info("%s: " fmt, \
84 (sdata)->name, ##__VA_ARGS__); \
85} while (0)
86
87#define _sdata_dbg(print, sdata, fmt, ...) \
88do { \
89 if (print) \
90 pr_debug("%s: " fmt, \
91 (sdata)->name, ##__VA_ARGS__); \
92} while (0)
93
94#define _sdata_err(sdata, fmt, ...) \
95do { \
96 pr_err("%s: " fmt, \
97 (sdata)->name, ##__VA_ARGS__); \
98} while (0)
99
100#define _wiphy_dbg(print, wiphy, fmt, ...) \
101do { \
102 if (print) \
103 wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \
104} while (0)
105#endif
106
107#define sdata_info(sdata, fmt, ...) \
108 _sdata_info(sdata, fmt, ##__VA_ARGS__)
109#define sdata_err(sdata, fmt, ...) \
110 _sdata_err(sdata, fmt, ##__VA_ARGS__)
111#define sdata_dbg(sdata, fmt, ...) \
112 _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
113
114#define ht_dbg(sdata, fmt, ...) \
115 _sdata_dbg(MAC80211_HT_DEBUG, \
116 sdata, fmt, ##__VA_ARGS__)
117
118#define ht_dbg_ratelimited(sdata, fmt, ...) \
119 _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \
120 sdata, fmt, ##__VA_ARGS__)
121
122#define ibss_dbg(sdata, fmt, ...) \
123 _sdata_dbg(MAC80211_IBSS_DEBUG, \
124 sdata, fmt, ##__VA_ARGS__)
125
126#define ps_dbg(sdata, fmt, ...) \
127 _sdata_dbg(MAC80211_PS_DEBUG, \
128 sdata, fmt, ##__VA_ARGS__)
129
130#define ps_dbg_hw(hw, fmt, ...) \
131 _wiphy_dbg(MAC80211_PS_DEBUG, \
132 (hw)->wiphy, fmt, ##__VA_ARGS__)
133
134#define ps_dbg_ratelimited(sdata, fmt, ...) \
135 _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \
136 sdata, fmt, ##__VA_ARGS__)
137
138#define mpl_dbg(sdata, fmt, ...) \
139 _sdata_dbg(MAC80211_MPL_DEBUG, \
140 sdata, fmt, ##__VA_ARGS__)
141
142#define mpath_dbg(sdata, fmt, ...) \
143 _sdata_dbg(MAC80211_MPATH_DEBUG, \
144 sdata, fmt, ##__VA_ARGS__)
145
146#define mhwmp_dbg(sdata, fmt, ...) \
147 _sdata_dbg(MAC80211_MHWMP_DEBUG, \
148 sdata, fmt, ##__VA_ARGS__)
149
150#define msync_dbg(sdata, fmt, ...) \
151 _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \
152 sdata, fmt, ##__VA_ARGS__)
153
154#define tdls_dbg(sdata, fmt, ...) \
155 _sdata_dbg(MAC80211_TDLS_DEBUG, \
156 sdata, fmt, ##__VA_ARGS__)
157
158#define sta_dbg(sdata, fmt, ...) \
159 _sdata_dbg(MAC80211_STA_DEBUG, \
160 sdata, fmt, ##__VA_ARGS__)
161
162#define mlme_dbg(sdata, fmt, ...) \
163 _sdata_dbg(MAC80211_MLME_DEBUG, \
164 sdata, fmt, ##__VA_ARGS__)
165
166#define mlme_dbg_ratelimited(sdata, fmt, ...) \
167 _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \
168 sdata, fmt, ##__VA_ARGS__)
169
170#endif /* __MAC80211_DEBUG_H */
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 512c894893d6..6d5aec9418ee 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -695,6 +695,7 @@ void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata)
695 695
696 sprintf(buf, "netdev:%s", sdata->name); 696 sprintf(buf, "netdev:%s", sdata->name);
697 if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) 697 if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
698 pr_err("mac80211: debugfs: failed to rename debugfs " 698 sdata_err(sdata,
699 "dir to %s\n", buf); 699 "debugfs: failed to rename debugfs dir to %s\n",
700 buf);
700} 701}
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 6d33a0c743ab..44e8c1242781 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -3,7 +3,7 @@
3 3
4#include <net/mac80211.h> 4#include <net/mac80211.h>
5#include "ieee80211_i.h" 5#include "ieee80211_i.h"
6#include "driver-trace.h" 6#include "trace.h"
7 7
8static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) 8static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
9{ 9{
@@ -845,4 +845,19 @@ drv_allow_buffered_frames(struct ieee80211_local *local,
845 more_data); 845 more_data);
846 trace_drv_return_void(local); 846 trace_drv_return_void(local);
847} 847}
848
849static inline int drv_get_rssi(struct ieee80211_local *local,
850 struct ieee80211_sub_if_data *sdata,
851 struct ieee80211_sta *sta,
852 s8 *rssi_dbm)
853{
854 int ret;
855
856 might_sleep();
857
858 ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm);
859 trace_drv_get_rssi(local, sta, *rssi_dbm, ret);
860
861 return ret;
862}
848#endif /* __MAC80211_DRIVER_OPS */ 863#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/driver-trace.c b/net/mac80211/driver-trace.c
deleted file mode 100644
index 8ed8711b1a6d..000000000000
--- a/net/mac80211/driver-trace.c
+++ /dev/null
@@ -1,9 +0,0 @@
1/* bug in tracepoint.h, it should include this */
2#include <linux/module.h>
3
4/* sparse isn't too happy with all macros... */
5#ifndef __CHECKER__
6#include "driver-ops.h"
7#define CREATE_TRACE_POINTS
8#include "driver-trace.h"
9#endif
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 6f8615c54b22..4b4538d63925 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -305,12 +305,10 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
305 tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; 305 tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12;
306 initiator = (params & IEEE80211_DELBA_PARAM_INITIATOR_MASK) >> 11; 306 initiator = (params & IEEE80211_DELBA_PARAM_INITIATOR_MASK) >> 11;
307 307
308#ifdef CONFIG_MAC80211_HT_DEBUG 308 ht_dbg_ratelimited(sdata, "delba from %pM (%s) tid %d reason code %d\n",
309 net_dbg_ratelimited("delba from %pM (%s) tid %d reason code %d\n", 309 mgmt->sa, initiator ? "initiator" : "recipient",
310 mgmt->sa, initiator ? "initiator" : "recipient", 310 tid,
311 tid, 311 le16_to_cpu(mgmt->u.action.u.delba.reason_code));
312 le16_to_cpu(mgmt->u.action.u.delba.reason_code));
313#endif /* CONFIG_MAC80211_HT_DEBUG */
314 312
315 if (initiator == WLAN_BACK_INITIATOR) 313 if (initiator == WLAN_BACK_INITIATOR)
316 __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0, 314 __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0,
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index ff46ff424941..5746d62faba1 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -261,11 +261,7 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
261 261
262 memcpy(addr, sta->sta.addr, ETH_ALEN); 262 memcpy(addr, sta->sta.addr, ETH_ALEN);
263 263
264#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 264 ibss_dbg(sdata, "Adding new IBSS station %pM\n", addr);
265 wiphy_debug(sdata->local->hw.wiphy,
266 "Adding new IBSS station %pM (dev=%s)\n",
267 addr, sdata->name);
268#endif
269 265
270 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); 266 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
271 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); 267 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
@@ -280,8 +276,9 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
280 if (sta_info_insert_rcu(sta)) 276 if (sta_info_insert_rcu(sta))
281 return sta_info_get(sdata, addr); 277 return sta_info_get(sdata, addr);
282 if (auth && !sdata->u.ibss.auth_frame_registrations) { 278 if (auth && !sdata->u.ibss.auth_frame_registrations) {
283 ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", 279 ibss_dbg(sdata,
284 sdata->vif.addr, sdata->u.ibss.bssid, addr); 280 "TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
281 sdata->vif.addr, sdata->u.ibss.bssid, addr);
285 ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, 282 ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
286 addr, sdata->u.ibss.bssid, NULL, 0, 0); 283 addr, sdata->u.ibss.bssid, NULL, 0, 0);
287 } 284 }
@@ -304,7 +301,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
304 * allow new one to be added. 301 * allow new one to be added.
305 */ 302 */
306 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { 303 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
307 net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", 304 net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
308 sdata->name, addr); 305 sdata->name, addr);
309 rcu_read_lock(); 306 rcu_read_lock();
310 return NULL; 307 return NULL;
@@ -351,9 +348,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
351 348
352 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) 349 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
353 return; 350 return;
354 ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", 351 ibss_dbg(sdata,
355 sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, 352 "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
356 auth_transaction); 353 mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
357 sta_info_destroy_addr(sdata, mgmt->sa); 354 sta_info_destroy_addr(sdata, mgmt->sa);
358 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); 355 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false);
359 rcu_read_unlock(); 356 rcu_read_unlock();
@@ -416,10 +413,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
416 ieee80211_mandatory_rates(local, band); 413 ieee80211_mandatory_rates(local, band);
417 414
418 if (sta->sta.supp_rates[band] != prev_rates) { 415 if (sta->sta.supp_rates[band] != prev_rates) {
419 ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", 416 ibss_dbg(sdata,
420 sdata->name, sta->sta.addr, 417 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
421 prev_rates, 418 sta->sta.addr, prev_rates,
422 sta->sta.supp_rates[band]); 419 sta->sta.supp_rates[band]);
423 rates_updated = true; 420 rates_updated = true;
424 } 421 }
425 } else { 422 } else {
@@ -534,16 +531,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
534 rx_timestamp = drv_get_tsf(local, sdata); 531 rx_timestamp = drv_get_tsf(local, sdata);
535 } 532 }
536 533
537 ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", 534 ibss_dbg(sdata,
538 mgmt->sa, mgmt->bssid, 535 "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
539 (unsigned long long)rx_timestamp, 536 mgmt->sa, mgmt->bssid,
540 (unsigned long long)beacon_timestamp, 537 (unsigned long long)rx_timestamp,
541 (unsigned long long)(rx_timestamp - beacon_timestamp), 538 (unsigned long long)beacon_timestamp,
542 jiffies); 539 (unsigned long long)(rx_timestamp - beacon_timestamp),
540 jiffies);
543 541
544 if (beacon_timestamp > rx_timestamp) { 542 if (beacon_timestamp > rx_timestamp) {
545 ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", 543 ibss_dbg(sdata,
546 sdata->name, mgmt->bssid); 544 "beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n",
545 mgmt->bssid);
547 ieee80211_sta_join_ibss(sdata, bss); 546 ieee80211_sta_join_ibss(sdata, bss);
548 supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); 547 supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
549 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 548 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
@@ -569,7 +568,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
569 * allow new one to be added. 568 * allow new one to be added.
570 */ 569 */
571 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { 570 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
572 net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", 571 net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
573 sdata->name, addr); 572 sdata->name, addr);
574 return; 573 return;
575 } 574 }
@@ -645,8 +644,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
645 if (ifibss->fixed_channel) 644 if (ifibss->fixed_channel)
646 return; 645 return;
647 646
648 pr_debug("%s: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n", 647 sdata_info(sdata,
649 sdata->name); 648 "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n");
650 649
651 ieee80211_request_internal_scan(sdata, 650 ieee80211_request_internal_scan(sdata,
652 ifibss->ssid, ifibss->ssid_len, NULL); 651 ifibss->ssid, ifibss->ssid_len, NULL);
@@ -674,8 +673,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
674 bssid[0] |= 0x02; 673 bssid[0] |= 0x02;
675 } 674 }
676 675
677 pr_debug("%s: Creating new IBSS network, BSSID %pM\n", 676 sdata_info(sdata, "Creating new IBSS network, BSSID %pM\n", bssid);
678 sdata->name, bssid);
679 677
680 capability = WLAN_CAPABILITY_IBSS; 678 capability = WLAN_CAPABILITY_IBSS;
681 679
@@ -706,8 +704,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
706 lockdep_assert_held(&ifibss->mtx); 704 lockdep_assert_held(&ifibss->mtx);
707 705
708 active_ibss = ieee80211_sta_active_ibss(sdata); 706 active_ibss = ieee80211_sta_active_ibss(sdata);
709 ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n", 707 ibss_dbg(sdata, "sta_find_ibss (active_ibss=%d)\n", active_ibss);
710 sdata->name, active_ibss);
711 708
712 if (active_ibss) 709 if (active_ibss)
713 return; 710 return;
@@ -730,23 +727,24 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
730 struct ieee80211_bss *bss; 727 struct ieee80211_bss *bss;
731 728
732 bss = (void *)cbss->priv; 729 bss = (void *)cbss->priv;
733 ibss_vdbg(" sta_find_ibss: selected %pM current %pM\n", 730 ibss_dbg(sdata,
734 cbss->bssid, ifibss->bssid); 731 "sta_find_ibss: selected %pM current %pM\n",
735 pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", 732 cbss->bssid, ifibss->bssid);
736 sdata->name, cbss->bssid); 733 sdata_info(sdata,
734 "Selected IBSS BSSID %pM based on configured SSID\n",
735 cbss->bssid);
737 736
738 ieee80211_sta_join_ibss(sdata, bss); 737 ieee80211_sta_join_ibss(sdata, bss);
739 ieee80211_rx_bss_put(local, bss); 738 ieee80211_rx_bss_put(local, bss);
740 return; 739 return;
741 } 740 }
742 741
743 ibss_vdbg(" did not try to join ibss\n"); 742 ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n");
744 743
745 /* Selected IBSS not found in current scan results - try to scan */ 744 /* Selected IBSS not found in current scan results - try to scan */
746 if (time_after(jiffies, ifibss->last_scan_completed + 745 if (time_after(jiffies, ifibss->last_scan_completed +
747 IEEE80211_SCAN_INTERVAL)) { 746 IEEE80211_SCAN_INTERVAL)) {
748 pr_debug("%s: Trigger new scan to find an IBSS to join\n", 747 sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
749 sdata->name);
750 748
751 ieee80211_request_internal_scan(sdata, 749 ieee80211_request_internal_scan(sdata,
752 ifibss->ssid, ifibss->ssid_len, 750 ifibss->ssid, ifibss->ssid_len,
@@ -760,9 +758,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
760 ieee80211_sta_create_ibss(sdata); 758 ieee80211_sta_create_ibss(sdata);
761 return; 759 return;
762 } 760 }
763 pr_debug("%s: IBSS not allowed on %d MHz\n", 761 sdata_info(sdata, "IBSS not allowed on %d MHz\n",
764 sdata->name, 762 local->hw.conf.channel->center_freq);
765 local->hw.conf.channel->center_freq);
766 763
767 /* No IBSS found - decrease scan interval and continue 764 /* No IBSS found - decrease scan interval and continue
768 * scanning. */ 765 * scanning. */
@@ -797,9 +794,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
797 794
798 tx_last_beacon = drv_tx_last_beacon(local); 795 tx_last_beacon = drv_tx_last_beacon(local);
799 796
800 ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", 797 ibss_dbg(sdata,
801 sdata->name, mgmt->sa, mgmt->da, 798 "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
802 mgmt->bssid, tx_last_beacon); 799 mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
803 800
804 if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) 801 if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
805 return; 802 return;
@@ -812,8 +809,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
812 pos = mgmt->u.probe_req.variable; 809 pos = mgmt->u.probe_req.variable;
813 if (pos[0] != WLAN_EID_SSID || 810 if (pos[0] != WLAN_EID_SSID ||
814 pos + 2 + pos[1] > end) { 811 pos + 2 + pos[1] > end) {
815 ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n", 812 ibss_dbg(sdata, "Invalid SSID IE in ProbeReq from %pM\n",
816 sdata->name, mgmt->sa); 813 mgmt->sa);
817 return; 814 return;
818 } 815 }
819 if (pos[1] != 0 && 816 if (pos[1] != 0 &&
@@ -830,7 +827,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
830 827
831 resp = (struct ieee80211_mgmt *) skb->data; 828 resp = (struct ieee80211_mgmt *) skb->data;
832 memcpy(resp->da, mgmt->sa, ETH_ALEN); 829 memcpy(resp->da, mgmt->sa, ETH_ALEN);
833 ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da); 830 ibss_dbg(sdata, "Sending ProbeResp to %pM\n", resp->da);
834 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 831 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
835 ieee80211_tx_skb(sdata, skb); 832 ieee80211_tx_skb(sdata, skb);
836} 833}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 36ce2bb066bf..f834a005e1c5 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -30,6 +30,7 @@
30#include <net/mac80211.h> 30#include <net/mac80211.h>
31#include "key.h" 31#include "key.h"
32#include "sta_info.h" 32#include "sta_info.h"
33#include "debug.h"
33 34
34struct ieee80211_local; 35struct ieee80211_local;
35 36
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 728d3eac1f59..58c2ab3d483a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -57,9 +57,6 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
57 return -EINVAL; 57 return -EINVAL;
58 } 58 }
59 59
60#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
61 pr_debug("%s: setting MTU %d\n", dev->name, new_mtu);
62#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
63 dev->mtu = new_mtu; 60 dev->mtu = new_mtu;
64 return 0; 61 return 0;
65} 62}
@@ -100,15 +97,12 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
100{ 97{
101 struct ieee80211_local *local = sdata->local; 98 struct ieee80211_local *local = sdata->local;
102 struct ieee80211_sub_if_data *nsdata; 99 struct ieee80211_sub_if_data *nsdata;
103 struct net_device *dev = sdata->dev;
104 100
105 ASSERT_RTNL(); 101 ASSERT_RTNL();
106 102
107 /* we hold the RTNL here so can safely walk the list */ 103 /* we hold the RTNL here so can safely walk the list */
108 list_for_each_entry(nsdata, &local->interfaces, list) { 104 list_for_each_entry(nsdata, &local->interfaces, list) {
109 struct net_device *ndev = nsdata->dev; 105 if (nsdata != sdata && ieee80211_sdata_running(nsdata)) {
110
111 if (ndev != dev && ieee80211_sdata_running(nsdata)) {
112 /* 106 /*
113 * Allow only a single IBSS interface to be up at any 107 * Allow only a single IBSS interface to be up at any
114 * time. This is restricted because beacon distribution 108 * time. This is restricted because beacon distribution
@@ -127,7 +121,8 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
127 * The remaining checks are only performed for interfaces 121 * The remaining checks are only performed for interfaces
128 * with the same MAC address. 122 * with the same MAC address.
129 */ 123 */
130 if (!ether_addr_equal(dev->dev_addr, ndev->dev_addr)) 124 if (!ether_addr_equal(sdata->vif.addr,
125 nsdata->vif.addr))
131 continue; 126 continue;
132 127
133 /* 128 /*
@@ -1223,7 +1218,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1223 1218
1224 if (__ffs64(mask) + hweight64(mask) != fls64(mask)) { 1219 if (__ffs64(mask) + hweight64(mask) != fls64(mask)) {
1225 /* not a contiguous mask ... not handled now! */ 1220 /* not a contiguous mask ... not handled now! */
1226 pr_debug("not contiguous\n"); 1221 pr_info("not contiguous\n");
1227 break; 1222 break;
1228 } 1223 }
1229 1224
@@ -1414,10 +1409,6 @@ static u32 ieee80211_idle_off(struct ieee80211_local *local,
1414 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) 1409 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE))
1415 return 0; 1410 return 0;
1416 1411
1417#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1418 wiphy_debug(local->hw.wiphy, "device no longer idle - %s\n", reason);
1419#endif
1420
1421 local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; 1412 local->hw.conf.flags &= ~IEEE80211_CONF_IDLE;
1422 return IEEE80211_CONF_CHANGE_IDLE; 1413 return IEEE80211_CONF_CHANGE_IDLE;
1423} 1414}
@@ -1427,10 +1418,6 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local)
1427 if (local->hw.conf.flags & IEEE80211_CONF_IDLE) 1418 if (local->hw.conf.flags & IEEE80211_CONF_IDLE)
1428 return 0; 1419 return 0;
1429 1420
1430#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1431 wiphy_debug(local->hw.wiphy, "device now idle\n");
1432#endif
1433
1434 drv_flush(local, false); 1421 drv_flush(local, false);
1435 1422
1436 local->hw.conf.flags |= IEEE80211_CONF_IDLE; 1423 local->hw.conf.flags |= IEEE80211_CONF_IDLE;
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 5bb600d93d77..b3b7e526e245 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -139,7 +139,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
139 } 139 }
140 140
141 if (ret != -ENOSPC && ret != -EOPNOTSUPP) 141 if (ret != -ENOSPC && ret != -EOPNOTSUPP)
142 wiphy_err(key->local->hw.wiphy, 142 sdata_err(sdata,
143 "failed to set key (%d, %pM) to hardware (%d)\n", 143 "failed to set key (%d, %pM) to hardware (%d)\n",
144 key->conf.keyidx, 144 key->conf.keyidx,
145 sta ? sta->sta.addr : bcast_addr, ret); 145 sta ? sta->sta.addr : bcast_addr, ret);
@@ -186,7 +186,7 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
186 sta ? &sta->sta : NULL, &key->conf); 186 sta ? &sta->sta : NULL, &key->conf);
187 187
188 if (ret) 188 if (ret)
189 wiphy_err(key->local->hw.wiphy, 189 sdata_err(sdata,
190 "failed to remove key (%d, %pM) from hardware (%d)\n", 190 "failed to remove key (%d, %pM) from hardware (%d)\n",
191 key->conf.keyidx, 191 key->conf.keyidx,
192 sta ? sta->sta.addr : bcast_addr, ret); 192 sta ? sta->sta.addr : bcast_addr, ret);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index ae40a83675e9..764593d65fc3 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -523,10 +523,6 @@ static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata,
523{ 523{
524 bool free_plinks; 524 bool free_plinks;
525 525
526#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
527 pr_debug("%s: running mesh housekeeping\n", sdata->name);
528#endif
529
530 ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); 526 ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT);
531 mesh_path_expire(sdata); 527 mesh_path_expire(sdata);
532 528
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index aed1821bd6f1..fb7b6a11d0ba 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -13,13 +13,6 @@
13#include "wme.h" 13#include "wme.h"
14#include "mesh.h" 14#include "mesh.h"
15 15
16#ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG
17#define mhwmp_dbg(fmt, args...) \
18 pr_debug("Mesh HWMP (%s): " fmt "\n", sdata->name, ##args)
19#else
20#define mhwmp_dbg(fmt, args...) do { (void)(0); } while (0)
21#endif
22
23#define TEST_FRAME_LEN 8192 16#define TEST_FRAME_LEN 8192
24#define MAX_METRIC 0xffffffff 17#define MAX_METRIC 0xffffffff
25#define ARITH_SHIFT 8 18#define ARITH_SHIFT 8
@@ -144,19 +137,19 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
144 137
145 switch (action) { 138 switch (action) {
146 case MPATH_PREQ: 139 case MPATH_PREQ:
147 mhwmp_dbg("sending PREQ to %pM", target); 140 mhwmp_dbg(sdata, "sending PREQ to %pM\n", target);
148 ie_len = 37; 141 ie_len = 37;
149 pos = skb_put(skb, 2 + ie_len); 142 pos = skb_put(skb, 2 + ie_len);
150 *pos++ = WLAN_EID_PREQ; 143 *pos++ = WLAN_EID_PREQ;
151 break; 144 break;
152 case MPATH_PREP: 145 case MPATH_PREP:
153 mhwmp_dbg("sending PREP to %pM", target); 146 mhwmp_dbg(sdata, "sending PREP to %pM\n", target);
154 ie_len = 31; 147 ie_len = 31;
155 pos = skb_put(skb, 2 + ie_len); 148 pos = skb_put(skb, 2 + ie_len);
156 *pos++ = WLAN_EID_PREP; 149 *pos++ = WLAN_EID_PREP;
157 break; 150 break;
158 case MPATH_RANN: 151 case MPATH_RANN:
159 mhwmp_dbg("sending RANN from %pM", orig_addr); 152 mhwmp_dbg(sdata, "sending RANN from %pM\n", orig_addr);
160 ie_len = sizeof(struct ieee80211_rann_ie); 153 ie_len = sizeof(struct ieee80211_rann_ie);
161 pos = skb_put(skb, 2 + ie_len); 154 pos = skb_put(skb, 2 + ie_len);
162 *pos++ = WLAN_EID_RANN; 155 *pos++ = WLAN_EID_RANN;
@@ -535,10 +528,10 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
535 flags = PREQ_IE_FLAGS(preq_elem); 528 flags = PREQ_IE_FLAGS(preq_elem);
536 root_is_gate = !!(flags & RANN_FLAG_IS_GATE); 529 root_is_gate = !!(flags & RANN_FLAG_IS_GATE);
537 530
538 mhwmp_dbg("received PREQ from %pM", orig_addr); 531 mhwmp_dbg(sdata, "received PREQ from %pM\n", orig_addr);
539 532
540 if (ether_addr_equal(target_addr, sdata->vif.addr)) { 533 if (ether_addr_equal(target_addr, sdata->vif.addr)) {
541 mhwmp_dbg("PREQ is for us"); 534 mhwmp_dbg(sdata, "PREQ is for us\n");
542 forward = false; 535 forward = false;
543 reply = true; 536 reply = true;
544 metric = 0; 537 metric = 0;
@@ -590,7 +583,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
590 lifetime = PREQ_IE_LIFETIME(preq_elem); 583 lifetime = PREQ_IE_LIFETIME(preq_elem);
591 ttl = ifmsh->mshcfg.element_ttl; 584 ttl = ifmsh->mshcfg.element_ttl;
592 if (ttl != 0) { 585 if (ttl != 0) {
593 mhwmp_dbg("replying to the PREQ"); 586 mhwmp_dbg(sdata, "replying to the PREQ\n");
594 mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, 587 mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr,
595 cpu_to_le32(orig_sn), 0, target_addr, 588 cpu_to_le32(orig_sn), 0, target_addr,
596 cpu_to_le32(target_sn), mgmt->sa, 0, ttl, 589 cpu_to_le32(target_sn), mgmt->sa, 0, ttl,
@@ -611,7 +604,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
611 ifmsh->mshstats.dropped_frames_ttl++; 604 ifmsh->mshstats.dropped_frames_ttl++;
612 return; 605 return;
613 } 606 }
614 mhwmp_dbg("forwarding the PREQ from %pM", orig_addr); 607 mhwmp_dbg(sdata, "forwarding the PREQ from %pM\n", orig_addr);
615 --ttl; 608 --ttl;
616 preq_id = PREQ_IE_PREQ_ID(preq_elem); 609 preq_id = PREQ_IE_PREQ_ID(preq_elem);
617 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; 610 hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1;
@@ -658,7 +651,8 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
658 u8 next_hop[ETH_ALEN]; 651 u8 next_hop[ETH_ALEN];
659 u32 target_sn, orig_sn, lifetime; 652 u32 target_sn, orig_sn, lifetime;
660 653
661 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); 654 mhwmp_dbg(sdata, "received PREP from %pM\n",
655 PREP_IE_ORIG_ADDR(prep_elem));
662 656
663 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 657 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
664 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 658 if (ether_addr_equal(orig_addr, sdata->vif.addr))
@@ -784,8 +778,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
784 if (ether_addr_equal(orig_addr, sdata->vif.addr)) 778 if (ether_addr_equal(orig_addr, sdata->vif.addr))
785 return; 779 return;
786 780
787 mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", 781 mhwmp_dbg(sdata,
788 orig_addr, mgmt->sa, root_is_gate); 782 "received RANN from %pM via neighbour %pM (is_gate=%d)\n",
783 orig_addr, mgmt->sa, root_is_gate);
789 784
790 rcu_read_lock(); 785 rcu_read_lock();
791 sta = sta_info_get(sdata, mgmt->sa); 786 sta = sta_info_get(sdata, mgmt->sa);
@@ -818,8 +813,9 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
818 root_path_confirmation_jiffies(sdata)) || 813 root_path_confirmation_jiffies(sdata)) ||
819 time_before(jiffies, mpath->last_preq_to_root))) && 814 time_before(jiffies, mpath->last_preq_to_root))) &&
820 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) { 815 !(mpath->flags & MESH_PATH_FIXED) && (ttl != 0)) {
821 mhwmp_dbg("%s time to refresh root mpath %pM", sdata->name, 816 mhwmp_dbg(sdata,
822 orig_addr); 817 "time to refresh root mpath %pM\n",
818 orig_addr);
823 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); 819 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
824 mpath->last_preq_to_root = jiffies; 820 mpath->last_preq_to_root = jiffies;
825 } 821 }
@@ -926,7 +922,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
926 922
927 preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); 923 preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC);
928 if (!preq_node) { 924 if (!preq_node) {
929 mhwmp_dbg("could not allocate PREQ node"); 925 mhwmp_dbg(sdata, "could not allocate PREQ node\n");
930 return; 926 return;
931 } 927 }
932 928
@@ -935,7 +931,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
935 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); 931 spin_unlock_bh(&ifmsh->mesh_preq_queue_lock);
936 kfree(preq_node); 932 kfree(preq_node);
937 if (printk_ratelimit()) 933 if (printk_ratelimit())
938 mhwmp_dbg("PREQ node queue full"); 934 mhwmp_dbg(sdata, "PREQ node queue full\n");
939 return; 935 return;
940 } 936 }
941 937
@@ -1183,7 +1179,7 @@ void mesh_path_timer(unsigned long data)
1183 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { 1179 if (!mpath->is_gate && mesh_gate_num(sdata) > 0) {
1184 ret = mesh_path_send_to_gates(mpath); 1180 ret = mesh_path_send_to_gates(mpath);
1185 if (ret) 1181 if (ret)
1186 mhwmp_dbg("no gate was reachable"); 1182 mhwmp_dbg(sdata, "no gate was reachable\n");
1187 } else 1183 } else
1188 mesh_path_flush_pending(mpath); 1184 mesh_path_flush_pending(mpath);
1189 } 1185 }
@@ -1221,7 +1217,7 @@ mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
1221 0, cpu_to_le32(ifmsh->preq_id++), sdata); 1217 0, cpu_to_le32(ifmsh->preq_id++), sdata);
1222 break; 1218 break;
1223 default: 1219 default:
1224 mhwmp_dbg("Proactive mechanism not supported"); 1220 mhwmp_dbg(sdata, "Proactive mechanism not supported\n");
1225 return; 1221 return;
1226 } 1222 }
1227} 1223}
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index 572f706fd65b..c9ae931dd693 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -18,12 +18,6 @@
18#include "ieee80211_i.h" 18#include "ieee80211_i.h"
19#include "mesh.h" 19#include "mesh.h"
20 20
21#ifdef CONFIG_MAC80211_VERBOSE_MPATH_DEBUG
22#define mpath_dbg(fmt, args...) pr_debug(fmt, ##args)
23#else
24#define mpath_dbg(fmt, args...) do { (void)(0); } while (0)
25#endif
26
27/* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */ 21/* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */
28#define INIT_PATHS_SIZE_ORDER 2 22#define INIT_PATHS_SIZE_ORDER 2
29 23
@@ -322,9 +316,8 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath,
322 316
323 spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); 317 spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags);
324 skb_queue_splice(&gateq, &gate_mpath->frame_queue); 318 skb_queue_splice(&gateq, &gate_mpath->frame_queue);
325 mpath_dbg("Mpath queue for gate %pM has %d frames\n", 319 mpath_dbg(gate_mpath->sdata, "Mpath queue for gate %pM has %d frames\n",
326 gate_mpath->dst, 320 gate_mpath->dst, skb_queue_len(&gate_mpath->frame_queue));
327 skb_queue_len(&gate_mpath->frame_queue));
328 spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); 321 spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags);
329 322
330 if (!copy) 323 if (!copy)
@@ -446,9 +439,9 @@ int mesh_path_add_gate(struct mesh_path *mpath)
446 hlist_add_head_rcu(&new_gate->list, tbl->known_gates); 439 hlist_add_head_rcu(&new_gate->list, tbl->known_gates);
447 spin_unlock_bh(&tbl->gates_lock); 440 spin_unlock_bh(&tbl->gates_lock);
448 rcu_read_unlock(); 441 rcu_read_unlock();
449 mpath_dbg("Mesh path (%s): Recorded new gate: %pM. %d known gates\n", 442 mpath_dbg(mpath->sdata,
450 mpath->sdata->name, mpath->dst, 443 "Mesh path: Recorded new gate: %pM. %d known gates\n",
451 mpath->sdata->u.mesh.num_gates); 444 mpath->dst, mpath->sdata->u.mesh.num_gates);
452 return 0; 445 return 0;
453err_rcu: 446err_rcu:
454 rcu_read_unlock(); 447 rcu_read_unlock();
@@ -477,8 +470,8 @@ static int mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath)
477 spin_unlock_bh(&tbl->gates_lock); 470 spin_unlock_bh(&tbl->gates_lock);
478 mpath->sdata->u.mesh.num_gates--; 471 mpath->sdata->u.mesh.num_gates--;
479 mpath->is_gate = false; 472 mpath->is_gate = false;
480 mpath_dbg("Mesh path (%s): Deleted gate: %pM. " 473 mpath_dbg(mpath->sdata,
481 "%d known gates\n", mpath->sdata->name, 474 "Mesh path: Deleted gate: %pM. %d known gates\n",
482 mpath->dst, mpath->sdata->u.mesh.num_gates); 475 mpath->dst, mpath->sdata->u.mesh.num_gates);
483 break; 476 break;
484 } 477 }
@@ -946,19 +939,20 @@ int mesh_path_send_to_gates(struct mesh_path *mpath)
946 continue; 939 continue;
947 940
948 if (gate->mpath->flags & MESH_PATH_ACTIVE) { 941 if (gate->mpath->flags & MESH_PATH_ACTIVE) {
949 mpath_dbg("Forwarding to %pM\n", gate->mpath->dst); 942 mpath_dbg(sdata, "Forwarding to %pM\n", gate->mpath->dst);
950 mesh_path_move_to_queue(gate->mpath, from_mpath, copy); 943 mesh_path_move_to_queue(gate->mpath, from_mpath, copy);
951 from_mpath = gate->mpath; 944 from_mpath = gate->mpath;
952 copy = true; 945 copy = true;
953 } else { 946 } else {
954 mpath_dbg("Not forwarding %p\n", gate->mpath); 947 mpath_dbg(sdata,
955 mpath_dbg("flags %x\n", gate->mpath->flags); 948 "Not forwarding %p (flags %#x)\n",
949 gate->mpath, gate->mpath->flags);
956 } 950 }
957 } 951 }
958 952
959 hlist_for_each_entry_rcu(gate, n, known_gates, list) 953 hlist_for_each_entry_rcu(gate, n, known_gates, list)
960 if (gate->mpath->sdata == sdata) { 954 if (gate->mpath->sdata == sdata) {
961 mpath_dbg("Sending to %pM\n", gate->mpath->dst); 955 mpath_dbg(sdata, "Sending to %pM\n", gate->mpath->dst);
962 mesh_path_tx_pending(gate->mpath); 956 mesh_path_tx_pending(gate->mpath);
963 } 957 }
964 958
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index be4fad128c34..a1dbd1540276 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -13,12 +13,6 @@
13#include "rate.h" 13#include "rate.h"
14#include "mesh.h" 14#include "mesh.h"
15 15
16#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
17#define mpl_dbg(fmt, args...) pr_debug(fmt, ##args)
18#else
19#define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
20#endif
21
22#define PLINK_GET_LLID(p) (p + 2) 16#define PLINK_GET_LLID(p) (p + 2)
23#define PLINK_GET_PLID(p) (p + 4) 17#define PLINK_GET_PLID(p) (p + 4)
24 18
@@ -134,12 +128,14 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
134 128
135 switch (sta->ch_type) { 129 switch (sta->ch_type) {
136 case NL80211_CHAN_NO_HT: 130 case NL80211_CHAN_NO_HT:
137 mpl_dbg("mesh_plink %pM: nonHT sta (%pM) is present", 131 mpl_dbg(sdata,
132 "mesh_plink %pM: nonHT sta (%pM) is present\n",
138 sdata->vif.addr, sta->sta.addr); 133 sdata->vif.addr, sta->sta.addr);
139 non_ht_sta = true; 134 non_ht_sta = true;
140 goto out; 135 goto out;
141 case NL80211_CHAN_HT20: 136 case NL80211_CHAN_HT20:
142 mpl_dbg("mesh_plink %pM: HT20 sta (%pM) is present", 137 mpl_dbg(sdata,
138 "mesh_plink %pM: HT20 sta (%pM) is present\n",
143 sdata->vif.addr, sta->sta.addr); 139 sdata->vif.addr, sta->sta.addr);
144 ht20_sta = true; 140 ht20_sta = true;
145 default: 141 default:
@@ -160,7 +156,8 @@ out:
160 sdata->vif.bss_conf.ht_operation_mode = ht_opmode; 156 sdata->vif.bss_conf.ht_operation_mode = ht_opmode;
161 sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; 157 sdata->u.mesh.mshcfg.ht_opmode = ht_opmode;
162 changed = BSS_CHANGED_HT; 158 changed = BSS_CHANGED_HT;
163 mpl_dbg("mesh_plink %pM: protection mode changed to %d", 159 mpl_dbg(sdata,
160 "mesh_plink %pM: protection mode changed to %d\n",
164 sdata->vif.addr, ht_opmode); 161 sdata->vif.addr, ht_opmode);
165 } 162 }
166 163
@@ -437,7 +434,8 @@ static void mesh_plink_timer(unsigned long data)
437 spin_unlock_bh(&sta->lock); 434 spin_unlock_bh(&sta->lock);
438 return; 435 return;
439 } 436 }
440 mpl_dbg("Mesh plink timer for %pM fired on state %d\n", 437 mpl_dbg(sta->sdata,
438 "Mesh plink timer for %pM fired on state %d\n",
441 sta->sta.addr, sta->plink_state); 439 sta->sta.addr, sta->plink_state);
442 reason = 0; 440 reason = 0;
443 llid = sta->llid; 441 llid = sta->llid;
@@ -450,7 +448,8 @@ static void mesh_plink_timer(unsigned long data)
450 /* retry timer */ 448 /* retry timer */
451 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { 449 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
452 u32 rand; 450 u32 rand;
453 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n", 451 mpl_dbg(sta->sdata,
452 "Mesh plink for %pM (retry, timeout): %d %d\n",
454 sta->sta.addr, sta->plink_retries, 453 sta->sta.addr, sta->plink_retries,
455 sta->plink_timeout); 454 sta->plink_timeout);
456 get_random_bytes(&rand, sizeof(u32)); 455 get_random_bytes(&rand, sizeof(u32));
@@ -530,7 +529,8 @@ int mesh_plink_open(struct sta_info *sta)
530 sta->plink_state = NL80211_PLINK_OPN_SNT; 529 sta->plink_state = NL80211_PLINK_OPN_SNT;
531 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); 530 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
532 spin_unlock_bh(&sta->lock); 531 spin_unlock_bh(&sta->lock);
533 mpl_dbg("Mesh plink: starting establishment with %pM\n", 532 mpl_dbg(sdata,
533 "Mesh plink: starting establishment with %pM\n",
534 sta->sta.addr); 534 sta->sta.addr);
535 535
536 return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, 536 return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
@@ -565,7 +565,6 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
565 u8 *baseaddr; 565 u8 *baseaddr;
566 u32 changed = 0; 566 u32 changed = 0;
567 __le16 plid, llid, reason; 567 __le16 plid, llid, reason;
568#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
569 static const char *mplstates[] = { 568 static const char *mplstates[] = {
570 [NL80211_PLINK_LISTEN] = "LISTEN", 569 [NL80211_PLINK_LISTEN] = "LISTEN",
571 [NL80211_PLINK_OPN_SNT] = "OPN-SNT", 570 [NL80211_PLINK_OPN_SNT] = "OPN-SNT",
@@ -575,14 +574,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
575 [NL80211_PLINK_HOLDING] = "HOLDING", 574 [NL80211_PLINK_HOLDING] = "HOLDING",
576 [NL80211_PLINK_BLOCKED] = "BLOCKED" 575 [NL80211_PLINK_BLOCKED] = "BLOCKED"
577 }; 576 };
578#endif
579 577
580 /* need action_code, aux */ 578 /* need action_code, aux */
581 if (len < IEEE80211_MIN_ACTION_SIZE + 3) 579 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
582 return; 580 return;
583 581
584 if (is_multicast_ether_addr(mgmt->da)) { 582 if (is_multicast_ether_addr(mgmt->da)) {
585 mpl_dbg("Mesh plink: ignore frame from multicast address"); 583 mpl_dbg(sdata,
584 "Mesh plink: ignore frame from multicast address\n");
586 return; 585 return;
587 } 586 }
588 587
@@ -595,12 +594,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
595 } 594 }
596 ieee802_11_parse_elems(baseaddr, len - baselen, &elems); 595 ieee802_11_parse_elems(baseaddr, len - baselen, &elems);
597 if (!elems.peering) { 596 if (!elems.peering) {
598 mpl_dbg("Mesh plink: missing necessary peer link ie\n"); 597 mpl_dbg(sdata,
598 "Mesh plink: missing necessary peer link ie\n");
599 return; 599 return;
600 } 600 }
601 if (elems.rsn_len && 601 if (elems.rsn_len &&
602 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { 602 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
603 mpl_dbg("Mesh plink: can't establish link with secure peer\n"); 603 mpl_dbg(sdata,
604 "Mesh plink: can't establish link with secure peer\n");
604 return; 605 return;
605 } 606 }
606 607
@@ -610,14 +611,15 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
610 (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) || 611 (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) ||
611 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6 612 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6
612 && ie_len != 8)) { 613 && ie_len != 8)) {
613 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n", 614 mpl_dbg(sdata,
614 ftype, ie_len); 615 "Mesh plink: incorrect plink ie length %d %d\n",
616 ftype, ie_len);
615 return; 617 return;
616 } 618 }
617 619
618 if (ftype != WLAN_SP_MESH_PEERING_CLOSE && 620 if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
619 (!elems.mesh_id || !elems.mesh_config)) { 621 (!elems.mesh_id || !elems.mesh_config)) {
620 mpl_dbg("Mesh plink: missing necessary ie\n"); 622 mpl_dbg(sdata, "Mesh plink: missing necessary ie\n");
621 return; 623 return;
622 } 624 }
623 /* Note the lines below are correct, the llid in the frame is the plid 625 /* Note the lines below are correct, the llid in the frame is the plid
@@ -632,21 +634,21 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
632 634
633 sta = sta_info_get(sdata, mgmt->sa); 635 sta = sta_info_get(sdata, mgmt->sa);
634 if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) { 636 if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) {
635 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); 637 mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n");
636 rcu_read_unlock(); 638 rcu_read_unlock();
637 return; 639 return;
638 } 640 }
639 641
640 if (ftype == WLAN_SP_MESH_PEERING_OPEN && 642 if (ftype == WLAN_SP_MESH_PEERING_OPEN &&
641 !rssi_threshold_check(sta, sdata)) { 643 !rssi_threshold_check(sta, sdata)) {
642 mpl_dbg("Mesh plink: %pM does not meet rssi threshold\n", 644 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n",
643 mgmt->sa); 645 mgmt->sa);
644 rcu_read_unlock(); 646 rcu_read_unlock();
645 return; 647 return;
646 } 648 }
647 649
648 if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) { 650 if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) {
649 mpl_dbg("Mesh plink: Action frame from non-authed peer\n"); 651 mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n");
650 rcu_read_unlock(); 652 rcu_read_unlock();
651 return; 653 return;
652 } 654 }
@@ -683,7 +685,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
683 } else if (!sta) { 685 } else if (!sta) {
684 /* ftype == WLAN_SP_MESH_PEERING_OPEN */ 686 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
685 if (!mesh_plink_free_count(sdata)) { 687 if (!mesh_plink_free_count(sdata)) {
686 mpl_dbg("Mesh plink error: no more free plinks\n"); 688 mpl_dbg(sdata, "Mesh plink error: no more free plinks\n");
687 rcu_read_unlock(); 689 rcu_read_unlock();
688 return; 690 return;
689 } 691 }
@@ -724,7 +726,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
724 event = CLS_ACPT; 726 event = CLS_ACPT;
725 break; 727 break;
726 default: 728 default:
727 mpl_dbg("Mesh plink: unknown frame subtype\n"); 729 mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n");
728 rcu_read_unlock(); 730 rcu_read_unlock();
729 return; 731 return;
730 } 732 }
@@ -734,13 +736,14 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
734 /* allocate sta entry if necessary and update info */ 736 /* allocate sta entry if necessary and update info */
735 sta = mesh_peer_init(sdata, mgmt->sa, &elems); 737 sta = mesh_peer_init(sdata, mgmt->sa, &elems);
736 if (!sta) { 738 if (!sta) {
737 mpl_dbg("Mesh plink: failed to init peer!\n"); 739 mpl_dbg(sdata, "Mesh plink: failed to init peer!\n");
738 rcu_read_unlock(); 740 rcu_read_unlock();
739 return; 741 return;
740 } 742 }
741 } 743 }
742 744
743 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", 745 mpl_dbg(sdata,
746 "Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n",
744 mgmt->sa, mplstates[sta->plink_state], 747 mgmt->sa, mplstates[sta->plink_state],
745 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), 748 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
746 event); 749 event);
@@ -851,7 +854,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
851 mesh_plink_inc_estab_count(sdata); 854 mesh_plink_inc_estab_count(sdata);
852 changed |= mesh_set_ht_prot_mode(sdata); 855 changed |= mesh_set_ht_prot_mode(sdata);
853 changed |= BSS_CHANGED_BEACON; 856 changed |= BSS_CHANGED_BEACON;
854 mpl_dbg("Mesh plink with %pM ESTABLISHED\n", 857 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n",
855 sta->sta.addr); 858 sta->sta.addr);
856 break; 859 break;
857 default: 860 default:
@@ -887,7 +890,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
887 mesh_plink_inc_estab_count(sdata); 890 mesh_plink_inc_estab_count(sdata);
888 changed |= mesh_set_ht_prot_mode(sdata); 891 changed |= mesh_set_ht_prot_mode(sdata);
889 changed |= BSS_CHANGED_BEACON; 892 changed |= BSS_CHANGED_BEACON;
890 mpl_dbg("Mesh plink with %pM ESTABLISHED\n", 893 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n",
891 sta->sta.addr); 894 sta->sta.addr);
892 mesh_plink_frame_tx(sdata, 895 mesh_plink_frame_tx(sdata,
893 WLAN_SP_MESH_PEERING_CONFIRM, 896 WLAN_SP_MESH_PEERING_CONFIRM,
diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index 0ccdad49f987..accfa00ffcdf 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -12,13 +12,6 @@
12#include "mesh.h" 12#include "mesh.h"
13#include "driver-ops.h" 13#include "driver-ops.h"
14 14
15#ifdef CONFIG_MAC80211_VERBOSE_MESH_SYNC_DEBUG
16#define msync_dbg(fmt, args...) \
17 pr_debug("Mesh sync (%s): " fmt "\n", sdata->name, ##args)
18#else
19#define msync_dbg(fmt, args...) do { (void)(0); } while (0)
20#endif
21
22/* This is not in the standard. It represents a tolerable tbtt drift below 15/* This is not in the standard. It represents a tolerable tbtt drift below
23 * which we do no TSF adjustment. 16 * which we do no TSF adjustment.
24 */ 17 */
@@ -65,14 +58,14 @@ void mesh_sync_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
65 spin_lock_bh(&ifmsh->sync_offset_lock); 58 spin_lock_bh(&ifmsh->sync_offset_lock);
66 59
67 if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) { 60 if (ifmsh->sync_offset_clockdrift_max < beacon_int_fraction) {
68 msync_dbg("TBTT : max clockdrift=%lld; adjusting", 61 msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting\n",
69 (long long) ifmsh->sync_offset_clockdrift_max); 62 (long long) ifmsh->sync_offset_clockdrift_max);
70 tsfdelta = -ifmsh->sync_offset_clockdrift_max; 63 tsfdelta = -ifmsh->sync_offset_clockdrift_max;
71 ifmsh->sync_offset_clockdrift_max = 0; 64 ifmsh->sync_offset_clockdrift_max = 0;
72 } else { 65 } else {
73 msync_dbg("TBTT : max clockdrift=%lld; adjusting by %llu", 66 msync_dbg(sdata, "TBTT : max clockdrift=%lld; adjusting by %llu\n",
74 (long long) ifmsh->sync_offset_clockdrift_max, 67 (long long) ifmsh->sync_offset_clockdrift_max,
75 (unsigned long long) beacon_int_fraction); 68 (unsigned long long) beacon_int_fraction);
76 tsfdelta = -beacon_int_fraction; 69 tsfdelta = -beacon_int_fraction;
77 ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction; 70 ifmsh->sync_offset_clockdrift_max -= beacon_int_fraction;
78 } 71 }
@@ -120,7 +113,7 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
120 113
121 if (elems->mesh_config && mesh_peer_tbtt_adjusting(elems)) { 114 if (elems->mesh_config && mesh_peer_tbtt_adjusting(elems)) {
122 clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); 115 clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
123 msync_dbg("STA %pM : is adjusting TBTT", sta->sta.addr); 116 msync_dbg(sdata, "STA %pM : is adjusting TBTT\n", sta->sta.addr);
124 goto no_sync; 117 goto no_sync;
125 } 118 }
126 119
@@ -169,7 +162,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
169 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) { 162 if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
170 s64 t_clockdrift = sta->t_offset_setpoint 163 s64 t_clockdrift = sta->t_offset_setpoint
171 - sta->t_offset; 164 - sta->t_offset;
172 msync_dbg("STA %pM : sta->t_offset=%lld, sta->t_offset_setpoint=%lld, t_clockdrift=%lld", 165 msync_dbg(sdata,
166 "STA %pM : sta->t_offset=%lld, sta->t_offset_setpoint=%lld, t_clockdrift=%lld\n",
173 sta->sta.addr, 167 sta->sta.addr,
174 (long long) sta->t_offset, 168 (long long) sta->t_offset,
175 (long long) 169 (long long)
@@ -178,7 +172,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
178 172
179 if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT || 173 if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT ||
180 t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) { 174 t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) {
181 msync_dbg("STA %pM : t_clockdrift=%lld too large, setpoint reset", 175 msync_dbg(sdata,
176 "STA %pM : t_clockdrift=%lld too large, setpoint reset\n",
182 sta->sta.addr, 177 sta->sta.addr,
183 (long long) t_clockdrift); 178 (long long) t_clockdrift);
184 clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); 179 clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
@@ -197,8 +192,8 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
197 } else { 192 } else {
198 sta->t_offset_setpoint = sta->t_offset - TOFFSET_SET_MARGIN; 193 sta->t_offset_setpoint = sta->t_offset - TOFFSET_SET_MARGIN;
199 set_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN); 194 set_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
200 msync_dbg("STA %pM : offset was invalid, " 195 msync_dbg(sdata,
201 " sta->t_offset=%lld", 196 "STA %pM : offset was invalid, sta->t_offset=%lld\n",
202 sta->sta.addr, 197 sta->sta.addr,
203 (long long) sta->t_offset); 198 (long long) sta->t_offset);
204 rcu_read_unlock(); 199 rcu_read_unlock();
@@ -226,17 +221,15 @@ static void mesh_sync_offset_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
226 * to the driver tsf setter, we punt 221 * to the driver tsf setter, we punt
227 * the tsf adjustment to the mesh tasklet 222 * the tsf adjustment to the mesh tasklet
228 */ 223 */
229 msync_dbg("TBTT : kicking off TBTT " 224 msync_dbg(sdata,
230 "adjustment with " 225 "TBTT : kicking off TBTT adjustment with clockdrift_max=%lld\n",
231 "clockdrift_max=%lld", 226 ifmsh->sync_offset_clockdrift_max);
232 ifmsh->sync_offset_clockdrift_max);
233 set_bit(MESH_WORK_DRIFT_ADJUST, 227 set_bit(MESH_WORK_DRIFT_ADJUST,
234 &ifmsh->wrkq_flags); 228 &ifmsh->wrkq_flags);
235 } else { 229 } else {
236 msync_dbg("TBTT : max clockdrift=%lld; " 230 msync_dbg(sdata,
237 "too small to adjust", 231 "TBTT : max clockdrift=%lld; too small to adjust\n",
238 (long long) 232 (long long)ifmsh->sync_offset_clockdrift_max);
239 ifmsh->sync_offset_clockdrift_max);
240 ifmsh->sync_offset_clockdrift_max = 0; 233 ifmsh->sync_offset_clockdrift_max = 0;
241 } 234 }
242 spin_unlock_bh(&ifmsh->sync_offset_lock); 235 spin_unlock_bh(&ifmsh->sync_offset_lock);
@@ -268,7 +261,7 @@ static void mesh_sync_vendor_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
268 const u8 *oui; 261 const u8 *oui;
269 262
270 WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); 263 WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR);
271 msync_dbg("called mesh_sync_vendor_rx_bcn_presp"); 264 msync_dbg(sdata, "called mesh_sync_vendor_rx_bcn_presp\n");
272 oui = mesh_get_vendor_oui(sdata); 265 oui = mesh_get_vendor_oui(sdata);
273 /* here you would implement the vendor offset tracking for this oui */ 266 /* here you would implement the vendor offset tracking for this oui */
274} 267}
@@ -278,7 +271,7 @@ static void mesh_sync_vendor_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
278 const u8 *oui; 271 const u8 *oui;
279 272
280 WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR); 273 WARN_ON(sdata->u.mesh.mesh_sp_id != IEEE80211_SYNC_METHOD_VENDOR);
281 msync_dbg("called mesh_sync_vendor_adjust_tbtt"); 274 msync_dbg(sdata, "called mesh_sync_vendor_adjust_tbtt\n");
282 oui = mesh_get_vendor_oui(sdata); 275 oui = mesh_get_vendor_oui(sdata);
283 /* here you would implement the vendor tsf adjustment for this oui */ 276 /* here you would implement the vendor tsf adjustment for this oui */
284} 277}
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 8149a37c93ee..f1a80da4e56a 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1186,19 +1186,16 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
1186 params.txop = get_unaligned_le16(pos + 2); 1186 params.txop = get_unaligned_le16(pos + 2);
1187 params.uapsd = uapsd; 1187 params.uapsd = uapsd;
1188 1188
1189#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1189 mlme_dbg(sdata,
1190 wiphy_debug(local->hw.wiphy, 1190 "WMM queue=%d aci=%d acm=%d aifs=%d cWmin=%d cWmax=%d txop=%d uapsd=%d\n",
1191 "WMM queue=%d aci=%d acm=%d aifs=%d " 1191 queue, aci, acm,
1192 "cWmin=%d cWmax=%d txop=%d uapsd=%d\n", 1192 params.aifs, params.cw_min, params.cw_max,
1193 queue, aci, acm, 1193 params.txop, params.uapsd);
1194 params.aifs, params.cw_min, params.cw_max,
1195 params.txop, params.uapsd);
1196#endif
1197 sdata->tx_conf[queue] = params; 1194 sdata->tx_conf[queue] = params;
1198 if (drv_conf_tx(local, sdata, queue, &params)) 1195 if (drv_conf_tx(local, sdata, queue, &params))
1199 wiphy_debug(local->hw.wiphy, 1196 sdata_err(sdata,
1200 "failed to set TX queue parameters for queue %d\n", 1197 "failed to set TX queue parameters for queue %d\n",
1201 queue); 1198 queue);
1202 } 1199 }
1203 1200
1204 /* enable WMM or activate new settings */ 1201 /* enable WMM or activate new settings */
@@ -1567,11 +1564,10 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
1567 goto out; 1564 goto out;
1568 } 1565 }
1569 1566
1570#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1571 if (beacon) 1567 if (beacon)
1572 net_dbg_ratelimited("%s: detected beacon loss from AP - sending probe request\n", 1568 mlme_dbg_ratelimited(sdata,
1573 sdata->name); 1569 "detected beacon loss from AP - sending probe request\n");
1574#endif 1570
1575 ieee80211_cqm_rssi_notify(&sdata->vif, 1571 ieee80211_cqm_rssi_notify(&sdata->vif,
1576 NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL); 1572 NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL);
1577 1573
@@ -1656,7 +1652,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata)
1656 1652
1657 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); 1653 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
1658 1654
1659 pr_debug("%s: Connection to AP %pM lost\n", sdata->name, bssid); 1655 sdata_info(sdata, "Connection to AP %pM lost\n", bssid);
1660 1656
1661 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, 1657 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
1662 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 1658 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
@@ -1790,8 +1786,8 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1790 return RX_MGMT_NONE; 1786 return RX_MGMT_NONE;
1791 1787
1792 if (status_code != WLAN_STATUS_SUCCESS) { 1788 if (status_code != WLAN_STATUS_SUCCESS) {
1793 pr_debug("%s: %pM denied authentication (status %d)\n", 1789 sdata_info(sdata, "%pM denied authentication (status %d)\n",
1794 sdata->name, mgmt->sa, status_code); 1790 mgmt->sa, status_code);
1795 ieee80211_destroy_auth_data(sdata, false); 1791 ieee80211_destroy_auth_data(sdata, false);
1796 return RX_MGMT_CFG80211_RX_AUTH; 1792 return RX_MGMT_CFG80211_RX_AUTH;
1797 } 1793 }
@@ -1814,7 +1810,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1814 return RX_MGMT_NONE; 1810 return RX_MGMT_NONE;
1815 } 1811 }
1816 1812
1817 pr_debug("%s: authenticated\n", sdata->name); 1813 sdata_info(sdata, "authenticated\n");
1818 ifmgd->auth_data->done = true; 1814 ifmgd->auth_data->done = true;
1819 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; 1815 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
1820 run_again(ifmgd, ifmgd->auth_data->timeout); 1816 run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -1827,7 +1823,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1827 goto out_err; 1823 goto out_err;
1828 } 1824 }
1829 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) { 1825 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
1830 pr_debug("%s: failed moving %pM to auth\n", sdata->name, bssid); 1826 sdata_info(sdata, "failed moving %pM to auth\n", bssid);
1831 goto out_err; 1827 goto out_err;
1832 } 1828 }
1833 mutex_unlock(&sdata->local->sta_mtx); 1829 mutex_unlock(&sdata->local->sta_mtx);
@@ -1861,8 +1857,8 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1861 1857
1862 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); 1858 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
1863 1859
1864 pr_debug("%s: deauthenticated from %pM (Reason: %u)\n", 1860 sdata_info(sdata, "deauthenticated from %pM (Reason: %u)\n",
1865 sdata->name, bssid, reason_code); 1861 bssid, reason_code);
1866 1862
1867 ieee80211_set_disassoc(sdata, 0, 0, false, NULL); 1863 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
1868 1864
@@ -1892,8 +1888,8 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1892 1888
1893 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1889 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
1894 1890
1895 pr_debug("%s: disassociated from %pM (Reason: %u)\n", 1891 sdata_info(sdata, "disassociated from %pM (Reason: %u)\n",
1896 sdata->name, mgmt->sa, reason_code); 1892 mgmt->sa, reason_code);
1897 1893
1898 ieee80211_set_disassoc(sdata, 0, 0, false, NULL); 1894 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
1899 1895
@@ -1985,15 +1981,15 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
1985 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); 1981 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
1986 1982
1987 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) 1983 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
1988 pr_debug("%s: invalid AID value 0x%x; bits 15:14 not set\n", 1984 sdata_info(sdata, "invalid AID value 0x%x; bits 15:14 not set\n",
1989 sdata->name, aid); 1985 aid);
1990 aid &= ~(BIT(15) | BIT(14)); 1986 aid &= ~(BIT(15) | BIT(14));
1991 1987
1992 ifmgd->broken_ap = false; 1988 ifmgd->broken_ap = false;
1993 1989
1994 if (aid == 0 || aid > IEEE80211_MAX_AID) { 1990 if (aid == 0 || aid > IEEE80211_MAX_AID) {
1995 pr_debug("%s: invalid AID value %d (out of range), turn off PS\n", 1991 sdata_info(sdata, "invalid AID value %d (out of range), turn off PS\n",
1996 sdata->name, aid); 1992 aid);
1997 aid = 0; 1993 aid = 0;
1998 ifmgd->broken_ap = true; 1994 ifmgd->broken_ap = true;
1999 } 1995 }
@@ -2002,8 +1998,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2002 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 1998 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
2003 1999
2004 if (!elems.supp_rates) { 2000 if (!elems.supp_rates) {
2005 pr_debug("%s: no SuppRates element in AssocResp\n", 2001 sdata_info(sdata, "no SuppRates element in AssocResp\n");
2006 sdata->name);
2007 return false; 2002 return false;
2008 } 2003 }
2009 2004
@@ -2043,8 +2038,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2043 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) 2038 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
2044 err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); 2039 err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
2045 if (err) { 2040 if (err) {
2046 pr_debug("%s: failed to move station %pM to desired state\n", 2041 sdata_info(sdata,
2047 sdata->name, sta->sta.addr); 2042 "failed to move station %pM to desired state\n",
2043 sta->sta.addr);
2048 WARN_ON(__sta_info_destroy(sta)); 2044 WARN_ON(__sta_info_destroy(sta));
2049 mutex_unlock(&sdata->local->sta_mtx); 2045 mutex_unlock(&sdata->local->sta_mtx);
2050 return false; 2046 return false;
@@ -2127,9 +2123,10 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2127 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 2123 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
2128 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); 2124 aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
2129 2125
2130 pr_debug("%s: RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n", 2126 sdata_info(sdata,
2131 sdata->name, reassoc ? "Rea" : "A", mgmt->sa, 2127 "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n",
2132 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); 2128 reassoc ? "Rea" : "A", mgmt->sa,
2129 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
2133 2130
2134 pos = mgmt->u.assoc_resp.variable; 2131 pos = mgmt->u.assoc_resp.variable;
2135 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 2132 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
@@ -2140,8 +2137,9 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2140 u32 tu, ms; 2137 u32 tu, ms;
2141 tu = get_unaligned_le32(elems.timeout_int + 1); 2138 tu = get_unaligned_le32(elems.timeout_int + 1);
2142 ms = tu * 1024 / 1000; 2139 ms = tu * 1024 / 1000;
2143 pr_debug("%s: %pM rejected association temporarily; comeback duration %u TU (%u ms)\n", 2140 sdata_info(sdata,
2144 sdata->name, mgmt->sa, tu, ms); 2141 "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n",
2142 mgmt->sa, tu, ms);
2145 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); 2143 assoc_data->timeout = jiffies + msecs_to_jiffies(ms);
2146 if (ms > IEEE80211_ASSOC_TIMEOUT) 2144 if (ms > IEEE80211_ASSOC_TIMEOUT)
2147 run_again(ifmgd, assoc_data->timeout); 2145 run_again(ifmgd, assoc_data->timeout);
@@ -2151,11 +2149,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2151 *bss = assoc_data->bss; 2149 *bss = assoc_data->bss;
2152 2150
2153 if (status_code != WLAN_STATUS_SUCCESS) { 2151 if (status_code != WLAN_STATUS_SUCCESS) {
2154 pr_debug("%s: %pM denied association (code=%d)\n", 2152 sdata_info(sdata, "%pM denied association (code=%d)\n",
2155 sdata->name, mgmt->sa, status_code); 2153 mgmt->sa, status_code);
2156 ieee80211_destroy_assoc_data(sdata, false); 2154 ieee80211_destroy_assoc_data(sdata, false);
2157 } else { 2155 } else {
2158 pr_debug("%s: associated\n", sdata->name); 2156 sdata_info(sdata, "associated\n");
2159 2157
2160 if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) { 2158 if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
2161 /* oops -- internal error -- send timeout for now */ 2159 /* oops -- internal error -- send timeout for now */
@@ -2263,7 +2261,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2263 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && 2261 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
2264 ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) { 2262 ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) {
2265 /* got probe response, continue with auth */ 2263 /* got probe response, continue with auth */
2266 pr_debug("%s: direct probe responded\n", sdata->name); 2264 sdata_info(sdata, "direct probe responded\n");
2267 ifmgd->auth_data->tries = 0; 2265 ifmgd->auth_data->tries = 0;
2268 ifmgd->auth_data->timeout = jiffies; 2266 ifmgd->auth_data->timeout = jiffies;
2269 run_again(ifmgd, ifmgd->auth_data->timeout); 2267 run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -2399,10 +2397,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2399 } 2397 }
2400 2398
2401 if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) { 2399 if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) {
2402#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2400 mlme_dbg_ratelimited(sdata,
2403 net_dbg_ratelimited("%s: cancelling probereq poll due to a received beacon\n", 2401 "cancelling probereq poll due to a received beacon\n");
2404 sdata->name);
2405#endif
2406 mutex_lock(&local->mtx); 2402 mutex_lock(&local->mtx);
2407 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; 2403 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL;
2408 ieee80211_run_deferred_scan(local); 2404 ieee80211_run_deferred_scan(local);
@@ -2625,8 +2621,8 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
2625 auth_data->tries++; 2621 auth_data->tries++;
2626 2622
2627 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { 2623 if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) {
2628 pr_debug("%s: authentication with %pM timed out\n", 2624 sdata_info(sdata, "authentication with %pM timed out\n",
2629 sdata->name, auth_data->bss->bssid); 2625 auth_data->bss->bssid);
2630 2626
2631 /* 2627 /*
2632 * Most likely AP is not in the range so remove the 2628 * Most likely AP is not in the range so remove the
@@ -2638,9 +2634,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
2638 } 2634 }
2639 2635
2640 if (auth_data->bss->proberesp_ies) { 2636 if (auth_data->bss->proberesp_ies) {
2641 pr_debug("%s: send auth to %pM (try %d/%d)\n", 2637 sdata_info(sdata, "send auth to %pM (try %d/%d)\n",
2642 sdata->name, auth_data->bss->bssid, auth_data->tries, 2638 auth_data->bss->bssid, auth_data->tries,
2643 IEEE80211_AUTH_MAX_TRIES); 2639 IEEE80211_AUTH_MAX_TRIES);
2644 2640
2645 auth_data->expected_transaction = 2; 2641 auth_data->expected_transaction = 2;
2646 ieee80211_send_auth(sdata, 1, auth_data->algorithm, 2642 ieee80211_send_auth(sdata, 1, auth_data->algorithm,
@@ -2650,9 +2646,9 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata)
2650 } else { 2646 } else {
2651 const u8 *ssidie; 2647 const u8 *ssidie;
2652 2648
2653 pr_debug("%s: direct probe to %pM (try %d/%i)\n", 2649 sdata_info(sdata, "direct probe to %pM (try %d/%i)\n",
2654 sdata->name, auth_data->bss->bssid, auth_data->tries, 2650 auth_data->bss->bssid, auth_data->tries,
2655 IEEE80211_AUTH_MAX_TRIES); 2651 IEEE80211_AUTH_MAX_TRIES);
2656 2652
2657 ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); 2653 ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID);
2658 if (!ssidie) 2654 if (!ssidie)
@@ -2680,8 +2676,8 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata)
2680 2676
2681 assoc_data->tries++; 2677 assoc_data->tries++;
2682 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { 2678 if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) {
2683 pr_debug("%s: association with %pM timed out\n", 2679 sdata_info(sdata, "association with %pM timed out\n",
2684 sdata->name, assoc_data->bss->bssid); 2680 assoc_data->bss->bssid);
2685 2681
2686 /* 2682 /*
2687 * Most likely AP is not in the range so remove the 2683 * Most likely AP is not in the range so remove the
@@ -2692,9 +2688,9 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata)
2692 return -ETIMEDOUT; 2688 return -ETIMEDOUT;
2693 } 2689 }
2694 2690
2695 pr_debug("%s: associate with %pM (try %d/%d)\n", 2691 sdata_info(sdata, "associate with %pM (try %d/%d)\n",
2696 sdata->name, assoc_data->bss->bssid, assoc_data->tries, 2692 assoc_data->bss->bssid, assoc_data->tries,
2697 IEEE80211_ASSOC_MAX_TRIES); 2693 IEEE80211_ASSOC_MAX_TRIES);
2698 ieee80211_send_assoc(sdata); 2694 ieee80211_send_assoc(sdata);
2699 2695
2700 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; 2696 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
@@ -2767,45 +2763,31 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
2767 ieee80211_reset_ap_probe(sdata); 2763 ieee80211_reset_ap_probe(sdata);
2768 else if (ifmgd->nullfunc_failed) { 2764 else if (ifmgd->nullfunc_failed) {
2769 if (ifmgd->probe_send_count < max_tries) { 2765 if (ifmgd->probe_send_count < max_tries) {
2770#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2766 mlme_dbg(sdata,
2771 wiphy_debug(local->hw.wiphy, 2767 "No ack for nullfunc frame to AP %pM, try %d/%i\n",
2772 "%s: No ack for nullfunc frame to" 2768 bssid, ifmgd->probe_send_count,
2773 " AP %pM, try %d/%i\n", 2769 max_tries);
2774 sdata->name, bssid,
2775 ifmgd->probe_send_count, max_tries);
2776#endif
2777 ieee80211_mgd_probe_ap_send(sdata); 2770 ieee80211_mgd_probe_ap_send(sdata);
2778 } else { 2771 } else {
2779#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2772 mlme_dbg(sdata,
2780 wiphy_debug(local->hw.wiphy, 2773 "No ack for nullfunc frame to AP %pM, disconnecting.\n",
2781 "%s: No ack for nullfunc frame to" 2774 bssid);
2782 " AP %pM, disconnecting.\n",
2783 sdata->name, bssid);
2784#endif
2785 ieee80211_sta_connection_lost(sdata, bssid, 2775 ieee80211_sta_connection_lost(sdata, bssid,
2786 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); 2776 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
2787 } 2777 }
2788 } else if (time_is_after_jiffies(ifmgd->probe_timeout)) 2778 } else if (time_is_after_jiffies(ifmgd->probe_timeout))
2789 run_again(ifmgd, ifmgd->probe_timeout); 2779 run_again(ifmgd, ifmgd->probe_timeout);
2790 else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { 2780 else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) {
2791#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2781 mlme_dbg(sdata,
2792 wiphy_debug(local->hw.wiphy, 2782 "Failed to send nullfunc to AP %pM after %dms, disconnecting\n",
2793 "%s: Failed to send nullfunc to AP %pM" 2783 bssid, probe_wait_ms);
2794 " after %dms, disconnecting.\n",
2795 sdata->name,
2796 bssid, probe_wait_ms);
2797#endif
2798 ieee80211_sta_connection_lost(sdata, bssid, 2784 ieee80211_sta_connection_lost(sdata, bssid,
2799 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); 2785 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
2800 } else if (ifmgd->probe_send_count < max_tries) { 2786 } else if (ifmgd->probe_send_count < max_tries) {
2801#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2787 mlme_dbg(sdata,
2802 wiphy_debug(local->hw.wiphy, 2788 "No probe response from AP %pM after %dms, try %d/%i\n",
2803 "%s: No probe response from AP %pM" 2789 bssid, probe_wait_ms,
2804 " after %dms, try %d/%i\n", 2790 ifmgd->probe_send_count, max_tries);
2805 sdata->name,
2806 bssid, probe_wait_ms,
2807 ifmgd->probe_send_count, max_tries);
2808#endif
2809 ieee80211_mgd_probe_ap_send(sdata); 2791 ieee80211_mgd_probe_ap_send(sdata);
2810 } else { 2792 } else {
2811 /* 2793 /*
@@ -2920,11 +2902,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
2920 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; 2902 sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME;
2921 mutex_lock(&ifmgd->mtx); 2903 mutex_lock(&ifmgd->mtx);
2922 if (ifmgd->associated) { 2904 if (ifmgd->associated) {
2923#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2905 mlme_dbg(sdata,
2924 wiphy_debug(sdata->local->hw.wiphy, 2906 "driver requested disconnect after resume\n");
2925 "%s: driver requested disconnect after resume.\n",
2926 sdata->name);
2927#endif
2928 ieee80211_sta_connection_lost(sdata, 2907 ieee80211_sta_connection_lost(sdata,
2929 ifmgd->associated->bssid, 2908 ifmgd->associated->bssid,
2930 WLAN_REASON_UNSPECIFIED); 2909 WLAN_REASON_UNSPECIFIED);
@@ -3065,10 +3044,11 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3065 * since we look at probe response/beacon data here 3044 * since we look at probe response/beacon data here
3066 * it should be OK. 3045 * it should be OK.
3067 */ 3046 */
3068 pr_debug("%s: Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", 3047 sdata_info(sdata,
3069 sdata->name, cbss->channel->center_freq, 3048 "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n",
3070 ht_cfreq, ht_oper->primary_chan, 3049 cbss->channel->center_freq,
3071 cbss->channel->band); 3050 ht_cfreq, ht_oper->primary_chan,
3051 cbss->channel->band);
3072 ht_oper = NULL; 3052 ht_oper = NULL;
3073 } 3053 }
3074 } 3054 }
@@ -3092,8 +3072,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3092 if (!ieee80211_set_channel_type(local, sdata, channel_type)) { 3072 if (!ieee80211_set_channel_type(local, sdata, channel_type)) {
3093 /* can only fail due to HT40+/- mismatch */ 3073 /* can only fail due to HT40+/- mismatch */
3094 channel_type = NL80211_CHAN_HT20; 3074 channel_type = NL80211_CHAN_HT20;
3095 pr_debug("%s: disabling 40 MHz due to multi-vif mismatch\n", 3075 sdata_info(sdata,
3096 sdata->name); 3076 "disabling 40 MHz due to multi-vif mismatch\n");
3097 ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ; 3077 ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
3098 WARN_ON(!ieee80211_set_channel_type(local, sdata, 3078 WARN_ON(!ieee80211_set_channel_type(local, sdata,
3099 channel_type)); 3079 channel_type));
@@ -3122,8 +3102,8 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3122 * we can connect -- with a warning. 3102 * we can connect -- with a warning.
3123 */ 3103 */
3124 if (!basic_rates && min_rate_index >= 0) { 3104 if (!basic_rates && min_rate_index >= 0) {
3125 pr_debug("%s: No basic rates, using min rate instead\n", 3105 sdata_info(sdata,
3126 sdata->name); 3106 "No basic rates, using min rate instead\n");
3127 basic_rates = BIT(min_rate_index); 3107 basic_rates = BIT(min_rate_index);
3128 } 3108 }
3129 3109
@@ -3149,8 +3129,9 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
3149 err = sta_info_insert(sta); 3129 err = sta_info_insert(sta);
3150 sta = NULL; 3130 sta = NULL;
3151 if (err) { 3131 if (err) {
3152 pr_debug("%s: failed to insert STA entry for the AP (error %d)\n", 3132 sdata_info(sdata,
3153 sdata->name, err); 3133 "failed to insert STA entry for the AP (error %d)\n",
3134 err);
3154 return err; 3135 return err;
3155 } 3136 }
3156 } else 3137 } else
@@ -3228,7 +3209,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
3228 if (ifmgd->associated) 3209 if (ifmgd->associated)
3229 ieee80211_set_disassoc(sdata, 0, 0, false, NULL); 3210 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
3230 3211
3231 pr_debug("%s: authenticate with %pM\n", sdata->name, req->bss->bssid); 3212 sdata_info(sdata, "authenticate with %pM\n", req->bss->bssid);
3232 3213
3233 err = ieee80211_prep_connection(sdata, req->bss, false); 3214 err = ieee80211_prep_connection(sdata, req->bss, false);
3234 if (err) 3215 if (err)
@@ -3410,8 +3391,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3410 * Wait up to one beacon interval ... 3391 * Wait up to one beacon interval ...
3411 * should this be more if we miss one? 3392 * should this be more if we miss one?
3412 */ 3393 */
3413 pr_debug("%s: waiting for beacon from %pM\n", 3394 sdata_info(sdata, "waiting for beacon from %pM\n",
3414 sdata->name, ifmgd->bssid); 3395 ifmgd->bssid);
3415 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); 3396 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval);
3416 } else { 3397 } else {
3417 assoc_data->have_beacon = true; 3398 assoc_data->have_beacon = true;
@@ -3430,8 +3411,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3430 corrupt_type = "beacon"; 3411 corrupt_type = "beacon";
3431 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) 3412 } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP)
3432 corrupt_type = "probe response"; 3413 corrupt_type = "probe response";
3433 pr_debug("%s: associating with AP with corrupt %s\n", 3414 sdata_info(sdata, "associating with AP with corrupt %s\n",
3434 sdata->name, corrupt_type); 3415 corrupt_type);
3435 } 3416 }
3436 3417
3437 err = 0; 3418 err = 0;
@@ -3460,8 +3441,9 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
3460 return 0; 3441 return 0;
3461 } 3442 }
3462 3443
3463 pr_debug("%s: deauthenticating from %pM by local choice (reason=%d)\n", 3444 sdata_info(sdata,
3464 sdata->name, req->bssid, req->reason_code); 3445 "deauthenticating from %pM by local choice (reason=%d)\n",
3446 req->bssid, req->reason_code);
3465 3447
3466 if (ifmgd->associated && 3448 if (ifmgd->associated &&
3467 ether_addr_equal(ifmgd->associated->bssid, req->bssid)) 3449 ether_addr_equal(ifmgd->associated->bssid, req->bssid))
@@ -3503,8 +3485,9 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
3503 return -ENOLINK; 3485 return -ENOLINK;
3504 } 3486 }
3505 3487
3506 pr_debug("%s: disassociating from %pM by local choice (reason=%d)\n", 3488 sdata_info(sdata,
3507 sdata->name, req->bss->bssid, req->reason_code); 3489 "disassociating from %pM by local choice (reason=%d)\n",
3490 req->bss->bssid, req->reason_code);
3508 3491
3509 memcpy(bssid, req->bss->bssid, ETH_ALEN); 3492 memcpy(bssid, req->bss->bssid, ETH_ALEN);
3510 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC, 3493 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC,
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 7f93626ddc61..b0fb6a2b89ad 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -15,7 +15,6 @@
15#include <linux/export.h> 15#include <linux/export.h>
16#include <net/mac80211.h> 16#include <net/mac80211.h>
17#include "ieee80211_i.h" 17#include "ieee80211_i.h"
18#include "driver-trace.h"
19#include "driver-ops.h" 18#include "driver-ops.h"
20 19
21/* 20/*
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 446a327b3de0..ab5185054e6c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -554,11 +554,11 @@ static inline u16 seq_sub(u16 sq1, u16 sq2)
554} 554}
555 555
556 556
557static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw, 557static void ieee80211_release_reorder_frame(struct ieee80211_sub_if_data *sdata,
558 struct tid_ampdu_rx *tid_agg_rx, 558 struct tid_ampdu_rx *tid_agg_rx,
559 int index) 559 int index)
560{ 560{
561 struct ieee80211_local *local = hw_to_local(hw); 561 struct ieee80211_local *local = sdata->local;
562 struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; 562 struct sk_buff *skb = tid_agg_rx->reorder_buf[index];
563 struct ieee80211_rx_status *status; 563 struct ieee80211_rx_status *status;
564 564
@@ -578,7 +578,7 @@ no_frame:
578 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); 578 tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num);
579} 579}
580 580
581static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw, 581static void ieee80211_release_reorder_frames(struct ieee80211_sub_if_data *sdata,
582 struct tid_ampdu_rx *tid_agg_rx, 582 struct tid_ampdu_rx *tid_agg_rx,
583 u16 head_seq_num) 583 u16 head_seq_num)
584{ 584{
@@ -589,7 +589,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
589 while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { 589 while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) {
590 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % 590 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
591 tid_agg_rx->buf_size; 591 tid_agg_rx->buf_size;
592 ieee80211_release_reorder_frame(hw, tid_agg_rx, index); 592 ieee80211_release_reorder_frame(sdata, tid_agg_rx, index);
593 } 593 }
594} 594}
595 595
@@ -604,7 +604,7 @@ static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw,
604 */ 604 */
605#define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10) 605#define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10)
606 606
607static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, 607static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata,
608 struct tid_ampdu_rx *tid_agg_rx) 608 struct tid_ampdu_rx *tid_agg_rx)
609{ 609{
610 int index, j; 610 int index, j;
@@ -632,12 +632,9 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
632 HT_RX_REORDER_BUF_TIMEOUT)) 632 HT_RX_REORDER_BUF_TIMEOUT))
633 goto set_release_timer; 633 goto set_release_timer;
634 634
635#ifdef CONFIG_MAC80211_HT_DEBUG 635 ht_dbg_ratelimited(sdata,
636 if (net_ratelimit()) 636 "release an RX reorder frame due to timeout on earlier frames\n");
637 wiphy_debug(hw->wiphy, 637 ieee80211_release_reorder_frame(sdata, tid_agg_rx, j);
638 "release an RX reorder frame due to timeout on earlier frames\n");
639#endif
640 ieee80211_release_reorder_frame(hw, tid_agg_rx, j);
641 638
642 /* 639 /*
643 * Increment the head seq# also for the skipped slots. 640 * Increment the head seq# also for the skipped slots.
@@ -647,7 +644,7 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
647 skipped = 0; 644 skipped = 0;
648 } 645 }
649 } else while (tid_agg_rx->reorder_buf[index]) { 646 } else while (tid_agg_rx->reorder_buf[index]) {
650 ieee80211_release_reorder_frame(hw, tid_agg_rx, index); 647 ieee80211_release_reorder_frame(sdata, tid_agg_rx, index);
651 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % 648 index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) %
652 tid_agg_rx->buf_size; 649 tid_agg_rx->buf_size;
653 } 650 }
@@ -677,7 +674,7 @@ static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw,
677 * rcu_read_lock protection. It returns false if the frame 674 * rcu_read_lock protection. It returns false if the frame
678 * can be processed immediately, true if it was consumed. 675 * can be processed immediately, true if it was consumed.
679 */ 676 */
680static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, 677static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_sub_if_data *sdata,
681 struct tid_ampdu_rx *tid_agg_rx, 678 struct tid_ampdu_rx *tid_agg_rx,
682 struct sk_buff *skb) 679 struct sk_buff *skb)
683{ 680{
@@ -706,7 +703,8 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
706 if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) { 703 if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) {
707 head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size)); 704 head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size));
708 /* release stored frames up to new head to stack */ 705 /* release stored frames up to new head to stack */
709 ieee80211_release_reorder_frames(hw, tid_agg_rx, head_seq_num); 706 ieee80211_release_reorder_frames(sdata, tid_agg_rx,
707 head_seq_num);
710 } 708 }
711 709
712 /* Now the new frame is always in the range of the reordering buffer */ 710 /* Now the new frame is always in the range of the reordering buffer */
@@ -736,7 +734,7 @@ static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
736 tid_agg_rx->reorder_buf[index] = skb; 734 tid_agg_rx->reorder_buf[index] = skb;
737 tid_agg_rx->reorder_time[index] = jiffies; 735 tid_agg_rx->reorder_time[index] = jiffies;
738 tid_agg_rx->stored_mpdu_num++; 736 tid_agg_rx->stored_mpdu_num++;
739 ieee80211_sta_reorder_release(hw, tid_agg_rx); 737 ieee80211_sta_reorder_release(sdata, tid_agg_rx);
740 738
741 out: 739 out:
742 spin_unlock(&tid_agg_rx->reorder_lock); 740 spin_unlock(&tid_agg_rx->reorder_lock);
@@ -751,7 +749,6 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx)
751{ 749{
752 struct sk_buff *skb = rx->skb; 750 struct sk_buff *skb = rx->skb;
753 struct ieee80211_local *local = rx->local; 751 struct ieee80211_local *local = rx->local;
754 struct ieee80211_hw *hw = &local->hw;
755 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 752 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
756 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 753 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
757 struct sta_info *sta = rx->sta; 754 struct sta_info *sta = rx->sta;
@@ -813,7 +810,7 @@ static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx)
813 * sure that we cannot get to it any more before doing 810 * sure that we cannot get to it any more before doing
814 * anything with it. 811 * anything with it.
815 */ 812 */
816 if (ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb)) 813 if (ieee80211_sta_manage_reorder_buf(rx->sdata, tid_agg_rx, skb))
817 return; 814 return;
818 815
819 dont_reorder: 816 dont_reorder:
@@ -1136,24 +1133,18 @@ static void ap_sta_ps_start(struct sta_info *sta)
1136 set_sta_flag(sta, WLAN_STA_PS_STA); 1133 set_sta_flag(sta, WLAN_STA_PS_STA);
1137 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) 1134 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
1138 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); 1135 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
1139#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 1136 ps_dbg(sdata, "STA %pM aid %d enters power save mode\n",
1140 pr_debug("%s: STA %pM aid %d enters power save mode\n", 1137 sta->sta.addr, sta->sta.aid);
1141 sdata->name, sta->sta.addr, sta->sta.aid);
1142#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1143} 1138}
1144 1139
1145static void ap_sta_ps_end(struct sta_info *sta) 1140static void ap_sta_ps_end(struct sta_info *sta)
1146{ 1141{
1147#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 1142 ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n",
1148 pr_debug("%s: STA %pM aid %d exits power save mode\n", 1143 sta->sta.addr, sta->sta.aid);
1149 sta->sdata->name, sta->sta.addr, sta->sta.aid);
1150#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1151 1144
1152 if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { 1145 if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
1153#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 1146 ps_dbg(sta->sdata, "STA %pM aid %d driver-ps-blocked\n",
1154 pr_debug("%s: STA %pM aid %d driver-ps-blocked\n", 1147 sta->sta.addr, sta->sta.aid);
1155 sta->sdata->name, sta->sta.addr, sta->sta.aid);
1156#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
1157 return; 1148 return;
1158 } 1149 }
1159 1150
@@ -1383,17 +1374,8 @@ ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata,
1383 if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX) 1374 if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX)
1384 sdata->fragment_next = 0; 1375 sdata->fragment_next = 0;
1385 1376
1386 if (!skb_queue_empty(&entry->skb_list)) { 1377 if (!skb_queue_empty(&entry->skb_list))
1387#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1388 struct ieee80211_hdr *hdr =
1389 (struct ieee80211_hdr *) entry->skb_list.next->data;
1390 pr_debug("%s: RX reassembly removed oldest fragment entry (idx=%d age=%lu seq=%d last_frag=%d addr1=%pM addr2=%pM\n",
1391 sdata->name, idx,
1392 jiffies - entry->first_frag_time, entry->seq,
1393 entry->last_frag, hdr->addr1, hdr->addr2);
1394#endif
1395 __skb_queue_purge(&entry->skb_list); 1378 __skb_queue_purge(&entry->skb_list);
1396 }
1397 1379
1398 __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */ 1380 __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */
1399 *skb = NULL; 1381 *skb = NULL;
@@ -1751,7 +1733,7 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
1751 */ 1733 */
1752 xmit_skb = skb_copy(skb, GFP_ATOMIC); 1734 xmit_skb = skb_copy(skb, GFP_ATOMIC);
1753 if (!xmit_skb) 1735 if (!xmit_skb)
1754 net_dbg_ratelimited("%s: failed to clone multicast frame\n", 1736 net_info_ratelimited("%s: failed to clone multicast frame\n",
1755 dev->name); 1737 dev->name);
1756 } else { 1738 } else {
1757 dsta = sta_info_get(sdata, skb->data); 1739 dsta = sta_info_get(sdata, skb->data);
@@ -1955,7 +1937,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
1955 1937
1956 fwd_skb = skb_copy(skb, GFP_ATOMIC); 1938 fwd_skb = skb_copy(skb, GFP_ATOMIC);
1957 if (!fwd_skb) { 1939 if (!fwd_skb) {
1958 net_dbg_ratelimited("%s: failed to clone mesh frame\n", 1940 net_info_ratelimited("%s: failed to clone mesh frame\n",
1959 sdata->name); 1941 sdata->name);
1960 goto out; 1942 goto out;
1961 } 1943 }
@@ -2058,8 +2040,6 @@ ieee80211_rx_h_data(struct ieee80211_rx_data *rx)
2058static ieee80211_rx_result debug_noinline 2040static ieee80211_rx_result debug_noinline
2059ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) 2041ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
2060{ 2042{
2061 struct ieee80211_local *local = rx->local;
2062 struct ieee80211_hw *hw = &local->hw;
2063 struct sk_buff *skb = rx->skb; 2043 struct sk_buff *skb = rx->skb;
2064 struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data; 2044 struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data;
2065 struct tid_ampdu_rx *tid_agg_rx; 2045 struct tid_ampdu_rx *tid_agg_rx;
@@ -2096,7 +2076,8 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
2096 2076
2097 spin_lock(&tid_agg_rx->reorder_lock); 2077 spin_lock(&tid_agg_rx->reorder_lock);
2098 /* release stored frames up to start of BAR */ 2078 /* release stored frames up to start of BAR */
2099 ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num); 2079 ieee80211_release_reorder_frames(rx->sdata, tid_agg_rx,
2080 start_seq_num);
2100 spin_unlock(&tid_agg_rx->reorder_lock); 2081 spin_unlock(&tid_agg_rx->reorder_lock);
2101 2082
2102 kfree_skb(skb); 2083 kfree_skb(skb);
@@ -2747,7 +2728,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
2747 return; 2728 return;
2748 2729
2749 spin_lock(&tid_agg_rx->reorder_lock); 2730 spin_lock(&tid_agg_rx->reorder_lock);
2750 ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx); 2731 ieee80211_sta_reorder_release(sta->sdata, tid_agg_rx);
2751 spin_unlock(&tid_agg_rx->reorder_lock); 2732 spin_unlock(&tid_agg_rx->reorder_lock);
2752 2733
2753 ieee80211_rx_handlers(&rx); 2734 ieee80211_rx_handlers(&rx);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 77dcf2f89d42..06fa75ceb025 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -169,9 +169,7 @@ void sta_info_free(struct ieee80211_local *local, struct sta_info *sta)
169 if (sta->rate_ctrl) 169 if (sta->rate_ctrl)
170 rate_control_free_sta(sta); 170 rate_control_free_sta(sta);
171 171
172#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 172 sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr);
173 wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr);
174#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
175 173
176 kfree(sta); 174 kfree(sta);
177} 175}
@@ -278,9 +276,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
278 for (i = 0; i < NUM_RX_DATA_QUEUES; i++) 276 for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
279 sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); 277 sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX);
280 278
281#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 279 sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr);
282 wiphy_debug(local->hw.wiphy, "Allocated STA %pM\n", sta->sta.addr);
283#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
284 280
285#ifdef CONFIG_MAC80211_MESH 281#ifdef CONFIG_MAC80211_MESH
286 sta->plink_state = NL80211_PLINK_LISTEN; 282 sta->plink_state = NL80211_PLINK_LISTEN;
@@ -333,8 +329,9 @@ static int sta_info_insert_drv_state(struct ieee80211_local *local,
333 } 329 }
334 330
335 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { 331 if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
336 pr_debug("%s: failed to move IBSS STA %pM to state %d (%d) - keeping it anyway\n", 332 sdata_info(sdata,
337 sdata->name, sta->sta.addr, state + 1, err); 333 "failed to move IBSS STA %pM to state %d (%d) - keeping it anyway\n",
334 sta->sta.addr, state + 1, err);
338 err = 0; 335 err = 0;
339 } 336 }
340 337
@@ -389,9 +386,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
389 sinfo.generation = local->sta_generation; 386 sinfo.generation = local->sta_generation;
390 cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); 387 cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
391 388
392#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 389 sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr);
393 wiphy_debug(local->hw.wiphy, "Inserted STA %pM\n", sta->sta.addr);
394#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
395 390
396 /* move reference to rcu-protected */ 391 /* move reference to rcu-protected */
397 rcu_read_lock(); 392 rcu_read_lock();
@@ -617,9 +612,8 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local,
617 break; 612 break;
618 613
619 local->total_ps_buffered--; 614 local->total_ps_buffered--;
620#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 615 ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n",
621 pr_debug("Buffered frame expired (STA %pM)\n", sta->sta.addr); 616 sta->sta.addr);
622#endif
623 dev_kfree_skb(skb); 617 dev_kfree_skb(skb);
624 } 618 }
625 619
@@ -745,9 +739,8 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
745 mesh_accept_plinks_update(sdata); 739 mesh_accept_plinks_update(sdata);
746#endif 740#endif
747 741
748#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 742 sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr);
749 wiphy_debug(local->hw.wiphy, "Removed STA %pM\n", sta->sta.addr); 743
750#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
751 cancel_work_sync(&sta->drv_unblock_wk); 744 cancel_work_sync(&sta->drv_unblock_wk);
752 745
753 cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); 746 cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL);
@@ -887,8 +880,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
887 continue; 880 continue;
888 881
889 if (time_after(jiffies, sta->last_rx + exp_time)) { 882 if (time_after(jiffies, sta->last_rx + exp_time)) {
890 ibss_vdbg("%s: expiring inactive STA %pM\n", 883 ibss_dbg(sdata, "expiring inactive STA %pM\n",
891 sdata->name, sta->sta.addr); 884 sta->sta.addr);
892 WARN_ON(__sta_info_destroy(sta)); 885 WARN_ON(__sta_info_destroy(sta));
893 } 886 }
894 } 887 }
@@ -986,10 +979,9 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta)
986 979
987 sta_info_recalc_tim(sta); 980 sta_info_recalc_tim(sta);
988 981
989#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 982 ps_dbg(sdata,
990 pr_debug("%s: STA %pM aid %d sending %d filtered/%d PS frames since STA not sleeping anymore\n", 983 "STA %pM aid %d sending %d filtered/%d PS frames since STA not sleeping anymore\n",
991 sdata->name, sta->sta.addr, sta->sta.aid, filtered, buffered); 984 sta->sta.addr, sta->sta.aid, filtered, buffered);
992#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
993} 985}
994 986
995static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, 987static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata,
@@ -1379,10 +1371,8 @@ int sta_info_move_state(struct sta_info *sta,
1379 return -EINVAL; 1371 return -EINVAL;
1380 } 1372 }
1381 1373
1382#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1374 sta_dbg(sta->sdata, "moving STA %pM to state %d\n",
1383 pr_debug("%s: moving STA %pM to state %d\n", 1375 sta->sta.addr, new_state);
1384 sta->sdata->name, sta->sta.addr, new_state);
1385#endif
1386 1376
1387 /* 1377 /*
1388 * notify the driver before the actual changes so it can 1378 * notify the driver before the actual changes so it can
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 6b4f42527887..2ed2f27fe8a7 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -155,13 +155,10 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local,
155 return; 155 return;
156 } 156 }
157 157
158#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 158 ps_dbg_ratelimited(sta->sdata,
159 if (net_ratelimit()) 159 "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n",
160 wiphy_debug(local->hw.wiphy, 160 skb_queue_len(&sta->tx_filtered[ac]),
161 "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", 161 !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies);
162 skb_queue_len(&sta->tx_filtered[ac]),
163 !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies);
164#endif
165 dev_kfree_skb(skb); 162 dev_kfree_skb(skb);
166} 163}
167 164
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 68be47ca208f..57e14d59e12f 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -260,16 +260,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
260 keyid = pos[3]; 260 keyid = pos[3];
261 iv32 = get_unaligned_le32(pos + 4); 261 iv32 = get_unaligned_le32(pos + 4);
262 pos += 8; 262 pos += 8;
263#ifdef CONFIG_MAC80211_TKIP_DEBUG
264 {
265 int i;
266 pr_debug("TKIP decrypt: data(len=%zd)", payload_len);
267 for (i = 0; i < payload_len; i++)
268 printk(" %02x", payload[i]);
269 printk("\n");
270 pr_debug("TKIP decrypt: iv16=%04x iv32=%08x\n", iv16, iv32);
271 }
272#endif
273 263
274 if (!(keyid & (1 << 5))) 264 if (!(keyid & (1 << 5)))
275 return TKIP_DECRYPT_NO_EXT_IV; 265 return TKIP_DECRYPT_NO_EXT_IV;
@@ -280,15 +270,8 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
280 if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && 270 if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT &&
281 (iv32 < key->u.tkip.rx[queue].iv32 || 271 (iv32 < key->u.tkip.rx[queue].iv32 ||
282 (iv32 == key->u.tkip.rx[queue].iv32 && 272 (iv32 == key->u.tkip.rx[queue].iv32 &&
283 iv16 <= key->u.tkip.rx[queue].iv16))) { 273 iv16 <= key->u.tkip.rx[queue].iv16)))
284#ifdef CONFIG_MAC80211_TKIP_DEBUG
285 pr_debug("TKIP replay detected for RX frame from %pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n",
286 ta, iv32, iv16,
287 key->u.tkip.rx[queue].iv32,
288 key->u.tkip.rx[queue].iv16);
289#endif
290 return TKIP_DECRYPT_REPLAY; 274 return TKIP_DECRYPT_REPLAY;
291 }
292 275
293 if (only_iv) { 276 if (only_iv) {
294 res = TKIP_DECRYPT_OK; 277 res = TKIP_DECRYPT_OK;
@@ -300,21 +283,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
300 key->u.tkip.rx[queue].iv32 != iv32) { 283 key->u.tkip.rx[queue].iv32 != iv32) {
301 /* IV16 wrapped around - perform TKIP phase 1 */ 284 /* IV16 wrapped around - perform TKIP phase 1 */
302 tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); 285 tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32);
303#ifdef CONFIG_MAC80211_TKIP_DEBUG
304 {
305 int i;
306 u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY;
307 pr_debug("TKIP decrypt: Phase1 TA=%pM TK=", ta);
308 for (i = 0; i < 16; i++)
309 printk("%02x ",
310 key->conf.key[key_offset + i]);
311 printk("\n");
312 pr_debug("TKIP decrypt: P1K=");
313 for (i = 0; i < 5; i++)
314 printk("%04x ", key->u.tkip.rx[queue].p1k[i]);
315 printk("\n");
316 }
317#endif
318 } 286 }
319 if (key->local->ops->update_tkip_key && 287 if (key->local->ops->update_tkip_key &&
320 key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && 288 key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE &&
@@ -330,15 +298,6 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
330 } 298 }
331 299
332 tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); 300 tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key);
333#ifdef CONFIG_MAC80211_TKIP_DEBUG
334 {
335 int i;
336 pr_debug("TKIP decrypt: Phase2 rc4key=");
337 for (i = 0; i < 16; i++)
338 printk("%02x ", rc4key[i]);
339 printk("\n");
340 }
341#endif
342 301
343 res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); 302 res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12);
344 done: 303 done:
diff --git a/net/mac80211/trace.c b/net/mac80211/trace.c
new file mode 100644
index 000000000000..386e45d8a958
--- /dev/null
+++ b/net/mac80211/trace.c
@@ -0,0 +1,75 @@
1/* bug in tracepoint.h, it should include this */
2#include <linux/module.h>
3
4/* sparse isn't too happy with all macros... */
5#ifndef __CHECKER__
6#include <net/cfg80211.h>
7#include "driver-ops.h"
8#include "debug.h"
9#define CREATE_TRACE_POINTS
10#include "trace.h"
11
12#ifdef CONFIG_MAC80211_MESSAGE_TRACING
13void __sdata_info(const char *fmt, ...)
14{
15 struct va_format vaf = {
16 .fmt = fmt,
17 };
18 va_list args;
19
20 va_start(args, fmt);
21 vaf.va = &args;
22
23 pr_info("%pV", &vaf);
24 trace_mac80211_info(&vaf);
25 va_end(args);
26}
27
28void __sdata_dbg(bool print, const char *fmt, ...)
29{
30 struct va_format vaf = {
31 .fmt = fmt,
32 };
33 va_list args;
34
35 va_start(args, fmt);
36 vaf.va = &args;
37
38 if (print)
39 pr_debug("%pV", &vaf);
40 trace_mac80211_dbg(&vaf);
41 va_end(args);
42}
43
44void __sdata_err(const char *fmt, ...)
45{
46 struct va_format vaf = {
47 .fmt = fmt,
48 };
49 va_list args;
50
51 va_start(args, fmt);
52 vaf.va = &args;
53
54 pr_err("%pV", &vaf);
55 trace_mac80211_err(&vaf);
56 va_end(args);
57}
58
59void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
60{
61 struct va_format vaf = {
62 .fmt = fmt,
63 };
64 va_list args;
65
66 va_start(args, fmt);
67 vaf.va = &args;
68
69 if (print)
70 wiphy_dbg(wiphy, "%pV", &vaf);
71 trace_mac80211_dbg(&vaf);
72 va_end(args);
73}
74#endif
75#endif
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/trace.h
index 6de00b2c268c..2e60f4acd027 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/trace.h
@@ -1218,6 +1218,32 @@ DEFINE_EVENT(release_evt, drv_allow_buffered_frames,
1218 TP_ARGS(local, sta, tids, num_frames, reason, more_data) 1218 TP_ARGS(local, sta, tids, num_frames, reason, more_data)
1219); 1219);
1220 1220
1221TRACE_EVENT(drv_get_rssi,
1222 TP_PROTO(struct ieee80211_local *local, struct ieee80211_sta *sta,
1223 s8 rssi, int ret),
1224
1225 TP_ARGS(local, sta, rssi, ret),
1226
1227 TP_STRUCT__entry(
1228 LOCAL_ENTRY
1229 STA_ENTRY
1230 __field(s8, rssi)
1231 __field(int, ret)
1232 ),
1233
1234 TP_fast_assign(
1235 LOCAL_ASSIGN;
1236 STA_ASSIGN;
1237 __entry->rssi = rssi;
1238 __entry->ret = ret;
1239 ),
1240
1241 TP_printk(
1242 LOCAL_PR_FMT STA_PR_FMT " rssi:%d ret:%d",
1243 LOCAL_PR_ARG, STA_PR_ARG, __entry->rssi, __entry->ret
1244 )
1245);
1246
1221/* 1247/*
1222 * Tracing for API calls that drivers call. 1248 * Tracing for API calls that drivers call.
1223 */ 1249 */
@@ -1606,10 +1632,49 @@ TRACE_EVENT(stop_queue,
1606 LOCAL_PR_ARG, __entry->queue, __entry->reason 1632 LOCAL_PR_ARG, __entry->queue, __entry->reason
1607 ) 1633 )
1608); 1634);
1635
1636#ifdef CONFIG_MAC80211_MESSAGE_TRACING
1637#undef TRACE_SYSTEM
1638#define TRACE_SYSTEM mac80211_msg
1639
1640#define MAX_MSG_LEN 100
1641
1642DECLARE_EVENT_CLASS(mac80211_msg_event,
1643 TP_PROTO(struct va_format *vaf),
1644
1645 TP_ARGS(vaf),
1646
1647 TP_STRUCT__entry(
1648 __dynamic_array(char, msg, MAX_MSG_LEN)
1649 ),
1650
1651 TP_fast_assign(
1652 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
1653 MAX_MSG_LEN, vaf->fmt,
1654 *vaf->va) >= MAX_MSG_LEN);
1655 ),
1656
1657 TP_printk("%s", __get_str(msg))
1658);
1659
1660DEFINE_EVENT(mac80211_msg_event, mac80211_info,
1661 TP_PROTO(struct va_format *vaf),
1662 TP_ARGS(vaf)
1663);
1664DEFINE_EVENT(mac80211_msg_event, mac80211_dbg,
1665 TP_PROTO(struct va_format *vaf),
1666 TP_ARGS(vaf)
1667);
1668DEFINE_EVENT(mac80211_msg_event, mac80211_err,
1669 TP_PROTO(struct va_format *vaf),
1670 TP_ARGS(vaf)
1671);
1672#endif
1673
1609#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ 1674#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
1610 1675
1611#undef TRACE_INCLUDE_PATH 1676#undef TRACE_INCLUDE_PATH
1612#define TRACE_INCLUDE_PATH . 1677#define TRACE_INCLUDE_PATH .
1613#undef TRACE_INCLUDE_FILE 1678#undef TRACE_INCLUDE_FILE
1614#define TRACE_INCLUDE_FILE driver-trace 1679#define TRACE_INCLUDE_FILE trace
1615#include <trace/define_trace.h> 1680#include <trace/define_trace.h>
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index af25c4e7ec5c..ec8f53467374 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -175,12 +175,6 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
175 return cpu_to_le16(dur); 175 return cpu_to_le16(dur);
176} 176}
177 177
178static inline int is_ieee80211_device(struct ieee80211_local *local,
179 struct net_device *dev)
180{
181 return local == wdev_priv(dev->ieee80211_ptr);
182}
183
184/* tx handlers */ 178/* tx handlers */
185static ieee80211_tx_result debug_noinline 179static ieee80211_tx_result debug_noinline
186ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) 180ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
@@ -297,9 +291,10 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
297 if (unlikely(!assoc && 291 if (unlikely(!assoc &&
298 ieee80211_is_data(hdr->frame_control))) { 292 ieee80211_is_data(hdr->frame_control))) {
299#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 293#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
300 pr_debug("%s: dropped data frame to not associated station %pM\n", 294 sdata_info(tx->sdata,
301 tx->sdata->name, hdr->addr1); 295 "dropped data frame to not associated station %pM\n",
302#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 296 hdr->addr1);
297#endif
303 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); 298 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
304 return TX_DROP; 299 return TX_DROP;
305 } 300 }
@@ -366,10 +361,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
366 rcu_read_unlock(); 361 rcu_read_unlock();
367 362
368 local->total_ps_buffered = total; 363 local->total_ps_buffered = total;
369#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 364 ps_dbg_hw(&local->hw, "PS buffers full - purged %d frames\n", purged);
370 wiphy_debug(local->hw.wiphy, "PS buffers full - purged %d frames\n",
371 purged);
372#endif
373} 365}
374 366
375static ieee80211_tx_result 367static ieee80211_tx_result
@@ -411,10 +403,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
411 purge_old_ps_buffers(tx->local); 403 purge_old_ps_buffers(tx->local);
412 404
413 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { 405 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) {
414#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 406 ps_dbg(tx->sdata,
415 net_dbg_ratelimited("%s: BC TX buffer full - dropping the oldest frame\n", 407 "BC TX buffer full - dropping the oldest frame\n");
416 tx->sdata->name);
417#endif
418 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); 408 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
419 } else 409 } else
420 tx->local->total_ps_buffered++; 410 tx->local->total_ps_buffered++;
@@ -465,18 +455,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
465 return TX_CONTINUE; 455 return TX_CONTINUE;
466 } 456 }
467 457
468#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 458 ps_dbg(sta->sdata, "STA %pM aid %d: PS buffer for AC %d\n",
469 pr_debug("STA %pM aid %d: PS buffer for AC %d\n", 459 sta->sta.addr, sta->sta.aid, ac);
470 sta->sta.addr, sta->sta.aid, ac);
471#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
472 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) 460 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
473 purge_old_ps_buffers(tx->local); 461 purge_old_ps_buffers(tx->local);
474 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { 462 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) {
475 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); 463 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);
476#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 464 ps_dbg(tx->sdata,
477 net_dbg_ratelimited("%s: STA %pM TX buffer for AC %d full - dropping oldest frame\n", 465 "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
478 tx->sdata->name, sta->sta.addr, ac); 466 sta->sta.addr, ac);
479#endif
480 dev_kfree_skb(old); 467 dev_kfree_skb(old);
481 } else 468 } else
482 tx->local->total_ps_buffered++; 469 tx->local->total_ps_buffered++;
@@ -498,13 +485,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
498 sta_info_recalc_tim(sta); 485 sta_info_recalc_tim(sta);
499 486
500 return TX_QUEUED; 487 return TX_QUEUED;
488 } else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
489 ps_dbg(tx->sdata,
490 "STA %pM in PS mode, but polling/in SP -> send frame\n",
491 sta->sta.addr);
501 } 492 }
502#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
503 else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
504 pr_debug("%s: STA %pM in PS mode, but polling/in SP -> send frame\n",
505 tx->sdata->name, sta->sta.addr);
506 }
507#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
508 493
509 return TX_CONTINUE; 494 return TX_CONTINUE;
510} 495}
@@ -1963,7 +1948,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1963 (cpu_to_be16(ethertype) != sdata->control_port_protocol || 1948 (cpu_to_be16(ethertype) != sdata->control_port_protocol ||
1964 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1949 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) {
1965#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1950#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1966 net_dbg_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", 1951 net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n",
1967 dev->name, hdr.addr1); 1952 dev->name, hdr.addr1);
1968#endif 1953#endif
1969 1954
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 888fadc4d63e..234ff3bbd104 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -340,6 +340,7 @@ static const struct nla_policy
340nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = { 340nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = {
341 [NL80211_SCHED_SCAN_MATCH_ATTR_SSID] = { .type = NLA_BINARY, 341 [NL80211_SCHED_SCAN_MATCH_ATTR_SSID] = { .type = NLA_BINARY,
342 .len = IEEE80211_MAX_SSID_LEN }, 342 .len = IEEE80211_MAX_SSID_LEN },
343 [NL80211_SCHED_SCAN_MATCH_ATTR_RSSI] = { .type = NLA_U32 },
343}; 344};
344 345
345/* ifidx get helper */ 346/* ifidx get helper */
@@ -4387,7 +4388,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4387 nla_for_each_nested(attr, 4388 nla_for_each_nested(attr,
4388 info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH], 4389 info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH],
4389 tmp) { 4390 tmp) {
4390 struct nlattr *ssid; 4391 struct nlattr *ssid, *rssi;
4391 4392
4392 nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX, 4393 nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX,
4393 nla_data(attr), nla_len(attr), 4394 nla_data(attr), nla_len(attr),
@@ -4403,6 +4404,12 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4403 request->match_sets[i].ssid.ssid_len = 4404 request->match_sets[i].ssid.ssid_len =
4404 nla_len(ssid); 4405 nla_len(ssid);
4405 } 4406 }
4407 rssi = tb[NL80211_SCHED_SCAN_MATCH_ATTR_RSSI];
4408 if (rssi)
4409 request->rssi_thold = nla_get_u32(rssi);
4410 else
4411 request->rssi_thold =
4412 NL80211_SCAN_RSSI_THOLD_OFF;
4406 i++; 4413 i++;
4407 } 4414 }
4408 } 4415 }