aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-22 05:29:50 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-24 05:32:29 -0400
commitbdcbd8e0e3ffdad32b14b6373e67bfcf5fd3f002 (patch)
treeb636f2229570dc95edef997272bd0656cf19224d /net
parentd3b2fb53c7f82903880769d406c11c7e619b11a4 (diff)
mac80211: clean up debugging
There are a few things that make the logging and debugging in mac80211 less useful than it should be right now: * a lot of messages should be pr_info, not pr_debug * wholesale use of pr_debug makes it require *both* Kconfig and dynamic configuration * there are still a lot of ifdefs * the style is very inconsistent, sometimes the sdata->name is printed in front Clean up everything, introducing new macros and separating out the station MLME debugging into a new Kconfig symbol. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/Kconfig32
-rw-r--r--net/mac80211/Makefile2
-rw-r--r--net/mac80211/agg-rx.c34
-rw-r--r--net/mac80211/agg-tx.c72
-rw-r--r--net/mac80211/cfg.c9
-rw-r--r--net/mac80211/debug.h152
-rw-r--r--net/mac80211/debugfs_netdev.c5
-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.c13
-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/rx.c40
-rw-r--r--net/mac80211/sta_info.c44
-rw-r--r--net/mac80211/status.c11
-rw-r--r--net/mac80211/tx.c43
22 files changed, 519 insertions, 429 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 323aa19a39d5..7475e266eb4e 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -140,6 +140,26 @@ config MAC80211_VERBOSE_DEBUG
140 140
141 Do not select this option. 141 Do not select this option.
142 142
143config MAC80211_MLME_DEBUG
144 bool "Verbose managed MLME output"
145 depends on MAC80211_DEBUG_MENU
146 ---help---
147 Selecting this option causes mac80211 to print out
148 debugging messages for the managed-mode MLME. It
149 should not be selected on production systems as some
150 of the messages are remotely triggerable.
151
152 Do not select this option.
153
154config MAC80211_STA_DEBUG
155 bool "Verbose station debugging"
156 depends on MAC80211_DEBUG_MENU
157 ---help---
158 Selecting this option causes mac80211 to print out
159 debugging messages for station addition/removal.
160
161 Do not select this option.
162
143config MAC80211_HT_DEBUG 163config MAC80211_HT_DEBUG
144 bool "Verbose HT debugging" 164 bool "Verbose HT debugging"
145 depends on MAC80211_DEBUG_MENU 165 depends on MAC80211_DEBUG_MENU
@@ -163,7 +183,7 @@ config MAC80211_IBSS_DEBUG
163 183
164 Do not select this option. 184 Do not select this option.
165 185
166config MAC80211_VERBOSE_PS_DEBUG 186config MAC80211_PS_DEBUG
167 bool "Verbose powersave mode debugging" 187 bool "Verbose powersave mode debugging"
168 depends on MAC80211_DEBUG_MENU 188 depends on MAC80211_DEBUG_MENU
169 ---help--- 189 ---help---
@@ -175,7 +195,7 @@ config MAC80211_VERBOSE_PS_DEBUG
175 195
176 Do not select this option. 196 Do not select this option.
177 197
178config MAC80211_VERBOSE_MPL_DEBUG 198config MAC80211_MPL_DEBUG
179 bool "Verbose mesh peer link debugging" 199 bool "Verbose mesh peer link debugging"
180 depends on MAC80211_DEBUG_MENU 200 depends on MAC80211_DEBUG_MENU
181 depends on MAC80211_MESH 201 depends on MAC80211_MESH
@@ -188,7 +208,7 @@ config MAC80211_VERBOSE_MPL_DEBUG
188 208
189 Do not select this option. 209 Do not select this option.
190 210
191config MAC80211_VERBOSE_MPATH_DEBUG 211config MAC80211_MPATH_DEBUG
192 bool "Verbose mesh path debugging" 212 bool "Verbose mesh path debugging"
193 depends on MAC80211_DEBUG_MENU 213 depends on MAC80211_DEBUG_MENU
194 depends on MAC80211_MESH 214 depends on MAC80211_MESH
@@ -201,7 +221,7 @@ config MAC80211_VERBOSE_MPATH_DEBUG
201 221
202 Do not select this option. 222 Do not select this option.
203 223
204config MAC80211_VERBOSE_MHWMP_DEBUG 224config MAC80211_MHWMP_DEBUG
205 bool "Verbose mesh HWMP routing debugging" 225 bool "Verbose mesh HWMP routing debugging"
206 depends on MAC80211_DEBUG_MENU 226 depends on MAC80211_DEBUG_MENU
207 depends on MAC80211_MESH 227 depends on MAC80211_MESH
@@ -214,7 +234,7 @@ config MAC80211_VERBOSE_MHWMP_DEBUG
214 234
215 Do not select this option. 235 Do not select this option.
216 236
217config MAC80211_VERBOSE_MESH_SYNC_DEBUG 237config MAC80211_MESH_SYNC_DEBUG
218 bool "Verbose mesh mesh synchronization debugging" 238 bool "Verbose mesh mesh synchronization debugging"
219 depends on MAC80211_DEBUG_MENU 239 depends on MAC80211_DEBUG_MENU
220 depends on MAC80211_MESH 240 depends on MAC80211_MESH
@@ -225,7 +245,7 @@ config MAC80211_VERBOSE_MESH_SYNC_DEBUG
225 245
226 Do not select this option. 246 Do not select this option.
227 247
228config MAC80211_VERBOSE_TDLS_DEBUG 248config MAC80211_TDLS_DEBUG
229 bool "Verbose TDLS debugging" 249 bool "Verbose TDLS debugging"
230 depends on MAC80211_DEBUG_MENU 250 depends on MAC80211_DEBUG_MENU
231 ---help--- 251 ---help---
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index 2b1470bac178..231ffa02e496 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -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 d0c8f78115cb..7722a7336a58 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2771,9 +2771,8 @@ static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2771 !sdata->u.mgd.associated) 2771 !sdata->u.mgd.associated)
2772 return -EINVAL; 2772 return -EINVAL;
2773 2773
2774#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG 2774 tdls_dbg(sdata, "TDLS mgmt action %d peer %pM\n",
2775 pr_debug("TDLS mgmt action %d peer %pM\n", action_code, peer); 2775 action_code, peer);
2776#endif
2777 2776
2778 skb = dev_alloc_skb(local->hw.extra_tx_headroom + 2777 skb = dev_alloc_skb(local->hw.extra_tx_headroom +
2779 max(sizeof(struct ieee80211_mgmt), 2778 max(sizeof(struct ieee80211_mgmt),
@@ -2882,9 +2881,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
2882 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2881 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2883 return -EINVAL; 2882 return -EINVAL;
2884 2883
2885#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG 2884 tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer);
2886 pr_debug("TDLS oper %d peer %pM\n", oper, peer);
2887#endif
2888 2885
2889 switch (oper) { 2886 switch (oper) {
2890 case NL80211_TDLS_ENABLE_LINK: 2887 case NL80211_TDLS_ENABLE_LINK:
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h
new file mode 100644
index 000000000000..6e6bbb9a9d41
--- /dev/null
+++ b/net/mac80211/debug.h
@@ -0,0 +1,152 @@
1#ifndef __MAC80211_DEBUG_H
2#define __MAC80211_DEBUG_H
3
4#ifdef CONFIG_MAC80211_IBSS_DEBUG
5#define MAC80211_IBSS_DEBUG 1
6#else
7#define MAC80211_IBSS_DEBUG 0
8#endif
9
10#ifdef CONFIG_MAC80211_PS_DEBUG
11#define MAC80211_PS_DEBUG 1
12#else
13#define MAC80211_PS_DEBUG 0
14#endif
15
16#ifdef CONFIG_MAC80211_HT_DEBUG
17#define MAC80211_HT_DEBUG 1
18#else
19#define MAC80211_HT_DEBUG 0
20#endif
21
22#ifdef CONFIG_MAC80211_MPL_DEBUG
23#define MAC80211_MPL_DEBUG 1
24#else
25#define MAC80211_MPL_DEBUG 0
26#endif
27
28#ifdef CONFIG_MAC80211_MPATH_DEBUG
29#define MAC80211_MPATH_DEBUG 1
30#else
31#define MAC80211_MPATH_DEBUG 0
32#endif
33
34#ifdef CONFIG_MAC80211_MHWMP_DEBUG
35#define MAC80211_MHWMP_DEBUG 1
36#else
37#define MAC80211_MHWMP_DEBUG 0
38#endif
39
40#ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
41#define MAC80211_MESH_SYNC_DEBUG 1
42#else
43#define MAC80211_MESH_SYNC_DEBUG 0
44#endif
45
46#ifdef CONFIG_MAC80211_TDLS_DEBUG
47#define MAC80211_TDLS_DEBUG 1
48#else
49#define MAC80211_TDLS_DEBUG 0
50#endif
51
52#ifdef CONFIG_MAC80211_STA_DEBUG
53#define MAC80211_STA_DEBUG 1
54#else
55#define MAC80211_STA_DEBUG 0
56#endif
57
58#ifdef CONFIG_MAC80211_MLME_DEBUG
59#define MAC80211_MLME_DEBUG 1
60#else
61#define MAC80211_MLME_DEBUG 0
62#endif
63
64#define _sdata_info(sdata, fmt, ...) \
65do { \
66 pr_info("%s: " fmt, \
67 (sdata)->name, ##__VA_ARGS__); \
68} while (0)
69
70#define _sdata_dbg(print, sdata, fmt, ...) \
71do { \
72 if (print) \
73 pr_debug("%s: " fmt, \
74 (sdata)->name, ##__VA_ARGS__); \
75} while (0)
76
77#define _sdata_err(sdata, fmt, ...) \
78do { \
79 pr_err("%s: " fmt, \
80 (sdata)->name, ##__VA_ARGS__); \
81} while (0)
82
83#define _wiphy_dbg(print, wiphy, fmt, ...) \
84do { \
85 if (print) \
86 wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \
87} while (0)
88
89#define sdata_info(sdata, fmt, ...) \
90 _sdata_info(sdata, fmt, ##__VA_ARGS__)
91#define sdata_err(sdata, fmt, ...) \
92 _sdata_err(sdata, fmt, ##__VA_ARGS__)
93#define sdata_dbg(sdata, fmt, ...) \
94 _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
95
96#define ht_dbg(sdata, fmt, ...) \
97 _sdata_dbg(MAC80211_HT_DEBUG, \
98 sdata, fmt, ##__VA_ARGS__)
99
100#define ht_dbg_ratelimited(sdata, fmt, ...) \
101 _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \
102 sdata, fmt, ##__VA_ARGS__)
103
104#define ibss_dbg(sdata, fmt, ...) \
105 _sdata_dbg(MAC80211_IBSS_DEBUG, \
106 sdata, fmt, ##__VA_ARGS__)
107
108#define ps_dbg(sdata, fmt, ...) \
109 _sdata_dbg(MAC80211_PS_DEBUG, \
110 sdata, fmt, ##__VA_ARGS__)
111
112#define ps_dbg_hw(hw, fmt, ...) \
113 _wiphy_dbg(MAC80211_PS_DEBUG, \
114 (hw)->wiphy, fmt, ##__VA_ARGS__)
115
116#define ps_dbg_ratelimited(sdata, fmt, ...) \
117 _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \
118 sdata, fmt, ##__VA_ARGS__)
119
120#define mpl_dbg(sdata, fmt, ...) \
121 _sdata_dbg(MAC80211_MPL_DEBUG, \
122 sdata, fmt, ##__VA_ARGS__)
123
124#define mpath_dbg(sdata, fmt, ...) \
125 _sdata_dbg(MAC80211_MPATH_DEBUG, \
126 sdata, fmt, ##__VA_ARGS__)
127
128#define mhwmp_dbg(sdata, fmt, ...) \
129 _sdata_dbg(MAC80211_MHWMP_DEBUG, \
130 sdata, fmt, ##__VA_ARGS__)
131
132#define msync_dbg(sdata, fmt, ...) \
133 _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \
134 sdata, fmt, ##__VA_ARGS__)
135
136#define tdls_dbg(sdata, fmt, ...) \
137 _sdata_dbg(MAC80211_TDLS_DEBUG, \
138 sdata, fmt, ##__VA_ARGS__)
139
140#define sta_dbg(sdata, fmt, ...) \
141 _sdata_dbg(MAC80211_STA_DEBUG, \
142 sdata, fmt, ##__VA_ARGS__)
143
144#define mlme_dbg(sdata, fmt, ...) \
145 _sdata_dbg(MAC80211_MLME_DEBUG, \
146 sdata, fmt, ##__VA_ARGS__)
147
148#define mlme_dbg_ratelimited(sdata, fmt, ...) \
149 _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \
150 sdata, fmt, ##__VA_ARGS__)
151
152#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/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 8931110b8433..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_IBSS_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..576880317d0e 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}
@@ -1223,7 +1220,7 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1223 1220
1224 if (__ffs64(mask) + hweight64(mask) != fls64(mask)) { 1221 if (__ffs64(mask) + hweight64(mask) != fls64(mask)) {
1225 /* not a contiguous mask ... not handled now! */ 1222 /* not a contiguous mask ... not handled now! */
1226 pr_debug("not contiguous\n"); 1223 pr_info("not contiguous\n");
1227 break; 1224 break;
1228 } 1225 }
1229 1226
@@ -1414,10 +1411,6 @@ static u32 ieee80211_idle_off(struct ieee80211_local *local,
1414 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) 1411 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE))
1415 return 0; 1412 return 0;
1416 1413
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; 1414 local->hw.conf.flags &= ~IEEE80211_CONF_IDLE;
1422 return IEEE80211_CONF_CHANGE_IDLE; 1415 return IEEE80211_CONF_CHANGE_IDLE;
1423} 1416}
@@ -1427,10 +1420,6 @@ static u32 ieee80211_idle_on(struct ieee80211_local *local)
1427 if (local->hw.conf.flags & IEEE80211_CONF_IDLE) 1420 if (local->hw.conf.flags & IEEE80211_CONF_IDLE)
1428 return 0; 1421 return 0;
1429 1422
1430#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1431 wiphy_debug(local->hw.wiphy, "device now idle\n");
1432#endif
1433
1434 drv_flush(local, false); 1423 drv_flush(local, false);
1435 1424
1436 local->hw.conf.flags |= IEEE80211_CONF_IDLE; 1425 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 2b450f541993..e11cd0e033ef 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 */
@@ -1565,11 +1562,10 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
1565 goto out; 1562 goto out;
1566 } 1563 }
1567 1564
1568#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1569 if (beacon) 1565 if (beacon)
1570 net_dbg_ratelimited("%s: detected beacon loss from AP - sending probe request\n", 1566 mlme_dbg_ratelimited(sdata,
1571 sdata->name); 1567 "detected beacon loss from AP - sending probe request\n");
1572#endif 1568
1573 ieee80211_cqm_rssi_notify(&sdata->vif, 1569 ieee80211_cqm_rssi_notify(&sdata->vif,
1574 NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL); 1570 NL80211_CQM_RSSI_BEACON_LOSS_EVENT, GFP_KERNEL);
1575 1571
@@ -1654,7 +1650,7 @@ static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata)
1654 1650
1655 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); 1651 memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN);
1656 1652
1657 pr_debug("%s: Connection to AP %pM lost\n", sdata->name, bssid); 1653 sdata_info(sdata, "Connection to AP %pM lost\n", bssid);
1658 1654
1659 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, 1655 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
1660 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, 1656 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
@@ -1788,8 +1784,8 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1788 return RX_MGMT_NONE; 1784 return RX_MGMT_NONE;
1789 1785
1790 if (status_code != WLAN_STATUS_SUCCESS) { 1786 if (status_code != WLAN_STATUS_SUCCESS) {
1791 pr_debug("%s: %pM denied authentication (status %d)\n", 1787 sdata_info(sdata, "%pM denied authentication (status %d)\n",
1792 sdata->name, mgmt->sa, status_code); 1788 mgmt->sa, status_code);
1793 ieee80211_destroy_auth_data(sdata, false); 1789 ieee80211_destroy_auth_data(sdata, false);
1794 return RX_MGMT_CFG80211_RX_AUTH; 1790 return RX_MGMT_CFG80211_RX_AUTH;
1795 } 1791 }
@@ -1812,7 +1808,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1812 return RX_MGMT_NONE; 1808 return RX_MGMT_NONE;
1813 } 1809 }
1814 1810
1815 pr_debug("%s: authenticated\n", sdata->name); 1811 sdata_info(sdata, "authenticated\n");
1816 ifmgd->auth_data->done = true; 1812 ifmgd->auth_data->done = true;
1817 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; 1813 ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC;
1818 run_again(ifmgd, ifmgd->auth_data->timeout); 1814 run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -1825,7 +1821,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1825 goto out_err; 1821 goto out_err;
1826 } 1822 }
1827 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) { 1823 if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) {
1828 pr_debug("%s: failed moving %pM to auth\n", sdata->name, bssid); 1824 sdata_info(sdata, "failed moving %pM to auth\n", bssid);
1829 goto out_err; 1825 goto out_err;
1830 } 1826 }
1831 mutex_unlock(&sdata->local->sta_mtx); 1827 mutex_unlock(&sdata->local->sta_mtx);
@@ -1859,8 +1855,8 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1859 1855
1860 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); 1856 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code);
1861 1857
1862 pr_debug("%s: deauthenticated from %pM (Reason: %u)\n", 1858 sdata_info(sdata, "deauthenticated from %pM (Reason: %u)\n",
1863 sdata->name, bssid, reason_code); 1859 bssid, reason_code);
1864 1860
1865 ieee80211_set_disassoc(sdata, 0, 0, false, NULL); 1861 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
1866 1862
@@ -1890,8 +1886,8 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1890 1886
1891 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1887 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
1892 1888
1893 pr_debug("%s: disassociated from %pM (Reason: %u)\n", 1889 sdata_info(sdata, "disassociated from %pM (Reason: %u)\n",
1894 sdata->name, mgmt->sa, reason_code); 1890 mgmt->sa, reason_code);
1895 1891
1896 ieee80211_set_disassoc(sdata, 0, 0, false, NULL); 1892 ieee80211_set_disassoc(sdata, 0, 0, false, NULL);
1897 1893
@@ -1983,15 +1979,15 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
1983 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); 1979 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
1984 1980
1985 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) 1981 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
1986 pr_debug("%s: invalid AID value 0x%x; bits 15:14 not set\n", 1982 sdata_info(sdata, "invalid AID value 0x%x; bits 15:14 not set\n",
1987 sdata->name, aid); 1983 aid);
1988 aid &= ~(BIT(15) | BIT(14)); 1984 aid &= ~(BIT(15) | BIT(14));
1989 1985
1990 ifmgd->broken_ap = false; 1986 ifmgd->broken_ap = false;
1991 1987
1992 if (aid == 0 || aid > IEEE80211_MAX_AID) { 1988 if (aid == 0 || aid > IEEE80211_MAX_AID) {
1993 pr_debug("%s: invalid AID value %d (out of range), turn off PS\n", 1989 sdata_info(sdata, "invalid AID value %d (out of range), turn off PS\n",
1994 sdata->name, aid); 1990 aid);
1995 aid = 0; 1991 aid = 0;
1996 ifmgd->broken_ap = true; 1992 ifmgd->broken_ap = true;
1997 } 1993 }
@@ -2000,8 +1996,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2000 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 1996 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
2001 1997
2002 if (!elems.supp_rates) { 1998 if (!elems.supp_rates) {
2003 pr_debug("%s: no SuppRates element in AssocResp\n", 1999 sdata_info(sdata, "no SuppRates element in AssocResp\n");
2004 sdata->name);
2005 return false; 2000 return false;
2006 } 2001 }
2007 2002
@@ -2041,8 +2036,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2041 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) 2036 if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
2042 err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); 2037 err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
2043 if (err) { 2038 if (err) {
2044 pr_debug("%s: failed to move station %pM to desired state\n", 2039 sdata_info(sdata,
2045 sdata->name, sta->sta.addr); 2040 "failed to move station %pM to desired state\n",
2041 sta->sta.addr);
2046 WARN_ON(__sta_info_destroy(sta)); 2042 WARN_ON(__sta_info_destroy(sta));
2047 mutex_unlock(&sdata->local->sta_mtx); 2043 mutex_unlock(&sdata->local->sta_mtx);
2048 return false; 2044 return false;
@@ -2125,9 +2121,10 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2125 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 2121 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
2126 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); 2122 aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
2127 2123
2128 pr_debug("%s: RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n", 2124 sdata_info(sdata,
2129 sdata->name, reassoc ? "Rea" : "A", mgmt->sa, 2125 "RX %sssocResp from %pM (capab=0x%x status=%d aid=%d)\n",
2130 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); 2126 reassoc ? "Rea" : "A", mgmt->sa,
2127 capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
2131 2128
2132 pos = mgmt->u.assoc_resp.variable; 2129 pos = mgmt->u.assoc_resp.variable;
2133 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); 2130 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
@@ -2138,8 +2135,9 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2138 u32 tu, ms; 2135 u32 tu, ms;
2139 tu = get_unaligned_le32(elems.timeout_int + 1); 2136 tu = get_unaligned_le32(elems.timeout_int + 1);
2140 ms = tu * 1024 / 1000; 2137 ms = tu * 1024 / 1000;
2141 pr_debug("%s: %pM rejected association temporarily; comeback duration %u TU (%u ms)\n", 2138 sdata_info(sdata,
2142 sdata->name, mgmt->sa, tu, ms); 2139 "%pM rejected association temporarily; comeback duration %u TU (%u ms)\n",
2140 mgmt->sa, tu, ms);
2143 assoc_data->timeout = jiffies + msecs_to_jiffies(ms); 2141 assoc_data->timeout = jiffies + msecs_to_jiffies(ms);
2144 if (ms > IEEE80211_ASSOC_TIMEOUT) 2142 if (ms > IEEE80211_ASSOC_TIMEOUT)
2145 run_again(ifmgd, assoc_data->timeout); 2143 run_again(ifmgd, assoc_data->timeout);
@@ -2149,11 +2147,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2149 *bss = assoc_data->bss; 2147 *bss = assoc_data->bss;
2150 2148
2151 if (status_code != WLAN_STATUS_SUCCESS) { 2149 if (status_code != WLAN_STATUS_SUCCESS) {
2152 pr_debug("%s: %pM denied association (code=%d)\n", 2150 sdata_info(sdata, "%pM denied association (code=%d)\n",
2153 sdata->name, mgmt->sa, status_code); 2151 mgmt->sa, status_code);
2154 ieee80211_destroy_assoc_data(sdata, false); 2152 ieee80211_destroy_assoc_data(sdata, false);
2155 } else { 2153 } else {
2156 pr_debug("%s: associated\n", sdata->name); 2154 sdata_info(sdata, "associated\n");
2157 2155
2158 if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) { 2156 if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) {
2159 /* oops -- internal error -- send timeout for now */ 2157 /* oops -- internal error -- send timeout for now */
@@ -2261,7 +2259,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2261 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && 2259 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
2262 ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) { 2260 ether_addr_equal(mgmt->bssid, ifmgd->auth_data->bss->bssid)) {
2263 /* got probe response, continue with auth */ 2261 /* got probe response, continue with auth */
2264 pr_debug("%s: direct probe responded\n", sdata->name); 2262 sdata_info(sdata, "direct probe responded\n");
2265 ifmgd->auth_data->tries = 0; 2263 ifmgd->auth_data->tries = 0;
2266 ifmgd->auth_data->timeout = jiffies; 2264 ifmgd->auth_data->timeout = jiffies;
2267 run_again(ifmgd, ifmgd->auth_data->timeout); 2265 run_again(ifmgd, ifmgd->auth_data->timeout);
@@ -2397,10 +2395,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2397 } 2395 }
2398 2396
2399 if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) { 2397 if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) {
2400#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 2398 mlme_dbg_ratelimited(sdata,
2401 net_dbg_ratelimited("%s: cancelling probereq poll due to a received beacon\n", 2399 "cancelling probereq poll due to a received beacon\n");
2402 sdata->name);
2403#endif
2404 mutex_lock(&local->mtx); 2400 mutex_lock(&local->mtx);
2405 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; 2401 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL;
2406 ieee80211_run_deferred_scan(local); 2402 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/rx.c b/net/mac80211/rx.c
index 9f1bd692589b..ab5185054e6c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -632,11 +632,8 @@ static void ieee80211_sta_reorder_release(struct ieee80211_sub_if_data *sdata,
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(sdata->local->hw.wiphy,
638 "release an RX reorder frame due to timeout on earlier frames\n");
639#endif
640 ieee80211_release_reorder_frame(sdata, tid_agg_rx, j); 637 ieee80211_release_reorder_frame(sdata, tid_agg_rx, j);
641 638
642 /* 639 /*
@@ -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 }
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 51a6d1e6e250..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_PS_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/tx.c b/net/mac80211/tx.c
index af25c4e7ec5c..37eda7e00e03 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -297,9 +297,10 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
297 if (unlikely(!assoc && 297 if (unlikely(!assoc &&
298 ieee80211_is_data(hdr->frame_control))) { 298 ieee80211_is_data(hdr->frame_control))) {
299#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 299#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
300 pr_debug("%s: dropped data frame to not associated station %pM\n", 300 sdata_info(tx->sdata,
301 tx->sdata->name, hdr->addr1); 301 "dropped data frame to not associated station %pM\n",
302#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 302 hdr->addr1);
303#endif
303 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); 304 I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
304 return TX_DROP; 305 return TX_DROP;
305 } 306 }
@@ -366,10 +367,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
366 rcu_read_unlock(); 367 rcu_read_unlock();
367 368
368 local->total_ps_buffered = total; 369 local->total_ps_buffered = total;
369#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 370 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} 371}
374 372
375static ieee80211_tx_result 373static ieee80211_tx_result
@@ -411,10 +409,8 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
411 purge_old_ps_buffers(tx->local); 409 purge_old_ps_buffers(tx->local);
412 410
413 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { 411 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) {
414#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 412 ps_dbg(tx->sdata,
415 net_dbg_ratelimited("%s: BC TX buffer full - dropping the oldest frame\n", 413 "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)); 414 dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf));
419 } else 415 } else
420 tx->local->total_ps_buffered++; 416 tx->local->total_ps_buffered++;
@@ -465,18 +461,15 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
465 return TX_CONTINUE; 461 return TX_CONTINUE;
466 } 462 }
467 463
468#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 464 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", 465 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) 466 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
473 purge_old_ps_buffers(tx->local); 467 purge_old_ps_buffers(tx->local);
474 if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { 468 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]); 469 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]);
476#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG 470 ps_dbg(tx->sdata,
477 net_dbg_ratelimited("%s: STA %pM TX buffer for AC %d full - dropping oldest frame\n", 471 "STA %pM TX buffer for AC %d full - dropping oldest frame\n",
478 tx->sdata->name, sta->sta.addr, ac); 472 sta->sta.addr, ac);
479#endif
480 dev_kfree_skb(old); 473 dev_kfree_skb(old);
481 } else 474 } else
482 tx->local->total_ps_buffered++; 475 tx->local->total_ps_buffered++;
@@ -498,13 +491,11 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
498 sta_info_recalc_tim(sta); 491 sta_info_recalc_tim(sta);
499 492
500 return TX_QUEUED; 493 return TX_QUEUED;
494 } else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) {
495 ps_dbg(tx->sdata,
496 "STA %pM in PS mode, but polling/in SP -> send frame\n",
497 sta->sta.addr);
501 } 498 }
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 499
509 return TX_CONTINUE; 500 return TX_CONTINUE;
510} 501}
@@ -1963,7 +1954,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
1963 (cpu_to_be16(ethertype) != sdata->control_port_protocol || 1954 (cpu_to_be16(ethertype) != sdata->control_port_protocol ||
1964 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1955 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) {
1965#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1956#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1966 net_dbg_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", 1957 net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n",
1967 dev->name, hdr.addr1); 1958 dev->name, hdr.addr1);
1968#endif 1959#endif
1969 1960