Skip to content

Commit bdcbd8e

Browse files
committed
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>
1 parent d3b2fb5 commit bdcbd8e

23 files changed

Lines changed: 519 additions & 453 deletions

‎include/net/mac80211.h‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,28 +3842,4 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
38423842
*/
38433843
int ieee80211_ave_rssi(struct ieee80211_vif *vif);
38443844

3845-
/* Extra debugging macros */
3846-
3847-
#ifdef CONFIG_MAC80211_HT_DEBUG
3848-
#define ht_vdbg(fmt, ...) \
3849-
pr_debug(fmt, ##__VA_ARGS__)
3850-
#else
3851-
#define ht_vdbg(fmt, ...) \
3852-
do { \
3853-
if (0) \
3854-
pr_debug(fmt, ##__VA_ARGS__); \
3855-
} while (0)
3856-
#endif
3857-
3858-
#ifdef CONFIG_MAC80211_IBSS_DEBUG
3859-
#define ibss_vdbg(fmt, ...) \
3860-
pr_debug(fmt, ##__VA_ARGS__)
3861-
#else
3862-
#define ibss_vdbg(fmt, ...) \
3863-
do { \
3864-
if (0) \
3865-
pr_debug(fmt, ##__VA_ARGS__); \
3866-
} while (0)
3867-
#endif
3868-
38693845
#endif /* MAC80211_H */

‎net/mac80211/Kconfig‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,26 @@ config MAC80211_VERBOSE_DEBUG
140140

141141
Do not select this option.
142142

143+
config 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+
154+
config 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+
143163
config MAC80211_HT_DEBUG
144164
bool "Verbose HT debugging"
145165
depends on MAC80211_DEBUG_MENU
@@ -163,7 +183,7 @@ config MAC80211_IBSS_DEBUG
163183

164184
Do not select this option.
165185

166-
config MAC80211_VERBOSE_PS_DEBUG
186+
config MAC80211_PS_DEBUG
167187
bool "Verbose powersave mode debugging"
168188
depends on MAC80211_DEBUG_MENU
169189
---help---
@@ -175,7 +195,7 @@ config MAC80211_VERBOSE_PS_DEBUG
175195

176196
Do not select this option.
177197

178-
config MAC80211_VERBOSE_MPL_DEBUG
198+
config MAC80211_MPL_DEBUG
179199
bool "Verbose mesh peer link debugging"
180200
depends on MAC80211_DEBUG_MENU
181201
depends on MAC80211_MESH
@@ -188,7 +208,7 @@ config MAC80211_VERBOSE_MPL_DEBUG
188208

189209
Do not select this option.
190210

191-
config MAC80211_VERBOSE_MPATH_DEBUG
211+
config MAC80211_MPATH_DEBUG
192212
bool "Verbose mesh path debugging"
193213
depends on MAC80211_DEBUG_MENU
194214
depends on MAC80211_MESH
@@ -201,7 +221,7 @@ config MAC80211_VERBOSE_MPATH_DEBUG
201221

202222
Do not select this option.
203223

204-
config MAC80211_VERBOSE_MHWMP_DEBUG
224+
config MAC80211_MHWMP_DEBUG
205225
bool "Verbose mesh HWMP routing debugging"
206226
depends on MAC80211_DEBUG_MENU
207227
depends on MAC80211_MESH
@@ -214,7 +234,7 @@ config MAC80211_VERBOSE_MHWMP_DEBUG
214234

215235
Do not select this option.
216236

217-
config MAC80211_VERBOSE_MESH_SYNC_DEBUG
237+
config MAC80211_MESH_SYNC_DEBUG
218238
bool "Verbose mesh mesh synchronization debugging"
219239
depends on MAC80211_DEBUG_MENU
220240
depends on MAC80211_MESH
@@ -225,7 +245,7 @@ config MAC80211_VERBOSE_MESH_SYNC_DEBUG
225245

226246
Do not select this option.
227247

228-
config MAC80211_VERBOSE_TDLS_DEBUG
248+
config MAC80211_TDLS_DEBUG
229249
bool "Verbose TDLS debugging"
230250
depends on MAC80211_DEBUG_MENU
231251
---help---

‎net/mac80211/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
5858
mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
5959
mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y)
6060

61-
ccflags-y += -D__CHECK_ENDIAN__
61+
ccflags-y += -D__CHECK_ENDIAN__ -DDEBUG

‎net/mac80211/agg-rx.c‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,17 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
7474

7575
RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
7676

77-
ht_vdbg("Rx BA session stop requested for %pM tid %u %s reason: %d\n",
78-
sta->sta.addr, tid,
79-
initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
80-
(int)reason);
77+
ht_dbg(sta->sdata,
78+
"Rx BA session stop requested for %pM tid %u %s reason: %d\n",
79+
sta->sta.addr, tid,
80+
initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
81+
(int)reason);
8182

8283
if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
8384
&sta->sta, tid, NULL, 0))
84-
pr_debug("HW problem - can not stop rx aggregation for tid %d\n",
85-
tid);
85+
sdata_info(sta->sdata,
86+
"HW problem - can not stop rx aggregation for tid %d\n",
87+
tid);
8688

8789
/* check if this is a self generated aggregation halt */
8890
if (initiator == WLAN_BACK_RECIPIENT && tx)
@@ -157,7 +159,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
157159
}
158160
rcu_read_unlock();
159161

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);
161163

162164
set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired);
163165
ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
@@ -245,7 +247,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
245247
status = WLAN_STATUS_REQUEST_DECLINED;
246248

247249
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");
249251
goto end_no_lock;
250252
}
251253

@@ -257,10 +259,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
257259
(!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) ||
258260
(buf_size > IEEE80211_MAX_AMPDU_BUF)) {
259261
status = WLAN_STATUS_INVALID_QOS_PARAM;
260-
#ifdef CONFIG_MAC80211_HT_DEBUG
261-
net_dbg_ratelimited("AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n",
262-
mgmt->sa, tid, ba_policy, buf_size);
263-
#endif /* CONFIG_MAC80211_HT_DEBUG */
262+
ht_dbg_ratelimited(sta->sdata,
263+
"AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n",
264+
mgmt->sa, tid, ba_policy, buf_size);
264265
goto end_no_lock;
265266
}
266267
/* determine default buffer size */
@@ -275,10 +276,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
275276
mutex_lock(&sta->ampdu_mlme.mtx);
276277

277278
if (sta->ampdu_mlme.tid_rx[tid]) {
278-
#ifdef CONFIG_MAC80211_HT_DEBUG
279-
net_dbg_ratelimited("unexpected AddBA Req from %pM on tid %u\n",
280-
mgmt->sa, tid);
281-
#endif /* CONFIG_MAC80211_HT_DEBUG */
279+
ht_dbg_ratelimited(sta->sdata,
280+
"unexpected AddBA Req from %pM on tid %u\n",
281+
mgmt->sa, tid);
282282

283283
/* delete existing Rx BA session on the same tid */
284284
___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT,
@@ -317,7 +317,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
317317

318318
ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START,
319319
&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);
321321
if (ret) {
322322
kfree(tid_agg_rx->reorder_buf);
323323
kfree(tid_agg_rx->reorder_time);

0 commit comments

Comments
 (0)