Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bdcbd8e0 authored by Johannes Berg's avatar Johannes Berg
Browse files

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent d3b2fb53
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -3842,28 +3842,4 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
 */
int ieee80211_ave_rssi(struct ieee80211_vif *vif);

/* Extra debugging macros */

#ifdef CONFIG_MAC80211_HT_DEBUG
#define ht_vdbg(fmt, ...)			\
	pr_debug(fmt, ##__VA_ARGS__)
#else
#define ht_vdbg(fmt, ...)			\
do {						\
	if (0)					\
		pr_debug(fmt, ##__VA_ARGS__);	\
} while (0)
#endif

#ifdef CONFIG_MAC80211_IBSS_DEBUG
#define ibss_vdbg(fmt, ...)			\
	pr_debug(fmt, ##__VA_ARGS__)
#else
#define ibss_vdbg(fmt, ...)			\
do {						\
	if (0)					\
		pr_debug(fmt, ##__VA_ARGS__);	\
} while (0)
#endif

#endif /* MAC80211_H */
+26 −6
Original line number Diff line number Diff line
@@ -140,6 +140,26 @@ config MAC80211_VERBOSE_DEBUG

	  Do not select this option.

config MAC80211_MLME_DEBUG
	bool "Verbose managed MLME output"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out
	  debugging messages for the managed-mode MLME. It
	  should not be selected on production systems as some
	  of the messages are remotely triggerable.

	  Do not select this option.

config MAC80211_STA_DEBUG
	bool "Verbose station debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
	  Selecting this option causes mac80211 to print out
	  debugging messages for station addition/removal.

	  Do not select this option.

config MAC80211_HT_DEBUG
	bool "Verbose HT debugging"
	depends on MAC80211_DEBUG_MENU
@@ -163,7 +183,7 @@ config MAC80211_IBSS_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_PS_DEBUG
config MAC80211_PS_DEBUG
	bool "Verbose powersave mode debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
@@ -175,7 +195,7 @@ config MAC80211_VERBOSE_PS_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_MPL_DEBUG
config MAC80211_MPL_DEBUG
	bool "Verbose mesh peer link debugging"
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_MESH
@@ -188,7 +208,7 @@ config MAC80211_VERBOSE_MPL_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_MPATH_DEBUG
config MAC80211_MPATH_DEBUG
	bool "Verbose mesh path debugging"
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_MESH
@@ -201,7 +221,7 @@ config MAC80211_VERBOSE_MPATH_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_MHWMP_DEBUG
config MAC80211_MHWMP_DEBUG
	bool "Verbose mesh HWMP routing debugging"
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_MESH
@@ -214,7 +234,7 @@ config MAC80211_VERBOSE_MHWMP_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_MESH_SYNC_DEBUG
config MAC80211_MESH_SYNC_DEBUG
	bool "Verbose mesh mesh synchronization debugging"
	depends on MAC80211_DEBUG_MENU
	depends on MAC80211_MESH
@@ -225,7 +245,7 @@ config MAC80211_VERBOSE_MESH_SYNC_DEBUG

	  Do not select this option.

config MAC80211_VERBOSE_TDLS_DEBUG
config MAC80211_TDLS_DEBUG
	bool "Verbose TDLS debugging"
	depends on MAC80211_DEBUG_MENU
	---help---
+1 −1
Original line number Diff line number Diff line
@@ -58,4 +58,4 @@ mac80211-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y)
mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y)
mac80211-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y)

ccflags-y += -D__CHECK_ENDIAN__
ccflags-y += -D__CHECK_ENDIAN__ -DDEBUG
+17 −17
Original line number Diff line number Diff line
@@ -74,14 +74,16 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,

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

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

	if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
			     &sta->sta, tid, NULL, 0))
		pr_debug("HW problem - can not stop rx aggregation for tid %d\n",
		sdata_info(sta->sdata,
			   "HW problem - can not stop rx aggregation for tid %d\n",
			   tid);

	/* check if this is a self generated aggregation halt */
@@ -157,7 +159,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
	}
	rcu_read_unlock();

	ht_vdbg("rx session timer expired on tid %d\n", (u16)*ptid);
	ht_dbg(sta->sdata, "rx session timer expired on tid %d\n", (u16)*ptid);

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

	if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
		ht_vdbg("Suspend in progress - Denying ADDBA request\n");
		ht_dbg(sta->sdata, "Suspend in progress - Denying ADDBA request\n");
		goto end_no_lock;
	}

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

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

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

	ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START,
			       &sta->sta, tid, &start_seq_num, 0);
	ht_vdbg("Rx A-MPDU request on tid %d result %d\n", tid, ret);
	ht_dbg(sta->sdata, "Rx A-MPDU request on tid %d result %d\n", tid, ret);
	if (ret) {
		kfree(tid_agg_rx->reorder_buf);
		kfree(tid_agg_rx->reorder_time);
+41 −31
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,

	spin_unlock_bh(&sta->lock);

	ht_vdbg("Tx BA session stop requested for %pM tid %u\n",
	ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n",
	       sta->sta.addr, tid);

	del_timer_sync(&tid_tx->addba_resp_timer);
@@ -251,12 +251,13 @@ static void sta_addba_resp_timer_expired(unsigned long data)
	if (!tid_tx ||
	    test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) {
		rcu_read_unlock();
		ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
		ht_dbg(sta->sdata,
		       "timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
		       tid);
		return;
	}

	ht_vdbg("addBA response timer expired on tid %d\n", tid);
	ht_dbg(sta->sdata, "addBA response timer expired on tid %d\n", tid);

	ieee80211_stop_tx_ba_session(&sta->sta, tid);
	rcu_read_unlock();
@@ -316,8 +317,9 @@ ieee80211_agg_splice_packets(struct ieee80211_sub_if_data *sdata,

	ieee80211_stop_queue_agg(sdata, tid);

	if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates"
			  " from the pending queue\n", tid))
	if (WARN(!tid_tx,
		 "TID %d gone but expected when splicing aggregates from the pending queue\n",
		 tid))
		return;

	if (!skb_queue_empty(&tid_tx->pending)) {
@@ -365,7 +367,8 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
	ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START,
			       &sta->sta, tid, &start_seq_num, 0);
	if (ret) {
		ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid);
		ht_dbg(sdata,
		       "BA request denied - HW unavailable for tid %d\n", tid);
		spin_lock_bh(&sta->lock);
		ieee80211_agg_splice_packets(sdata, tid_tx, tid);
		ieee80211_assign_tid_tx(sta, tid, NULL);
@@ -378,7 +381,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)

	/* activate the timer for the recipient's addBA response */
	mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
	ht_vdbg("activated addBA response timer on tid %d\n", tid);
	ht_dbg(sdata, "activated addBA response timer on tid %d\n", tid);

	spin_lock_bh(&sta->lock);
	sta->ampdu_mlme.last_addba_req_time[tid] = jiffies;
@@ -425,7 +428,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data)

	rcu_read_unlock();

	ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid);
	ht_dbg(sta->sdata, "tx session timer expired on tid %d\n", (u16)*ptid);

	ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
}
@@ -449,7 +452,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
	    (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
		return -EINVAL;

	ht_vdbg("Open BA session requested for %pM tid %u\n",
	ht_dbg(sdata, "Open BA session requested for %pM tid %u\n",
	       pubsta->addr, tid);

	if (sdata->vif.type != NL80211_IFTYPE_STATION &&
@@ -460,7 +463,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
		return -EINVAL;

	if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
		ht_vdbg("BA sessions blocked - Denying BA session request\n");
		ht_dbg(sdata,
		       "BA sessions blocked - Denying BA session request\n");
		return -EINVAL;
	}

@@ -478,7 +482,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
	 */
	if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC &&
	    !sta->sta.ht_cap.ht_supported) {
		ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n",
		ht_dbg(sdata,
		       "BA request denied - IBSS STA %pM does not advertise HT support\n",
		       pubsta->addr);
		return -EINVAL;
	}
@@ -499,7 +504,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
	if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
	    time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
			HT_AGG_RETRIES_PERIOD)) {
		ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n",
		ht_dbg(sdata,
		       "BA request denied - waiting a grace period after %d failed requests on tid %u\n",
		       sta->ampdu_mlme.addba_req_num[tid], tid);
		ret = -EBUSY;
		goto err_unlock_sta;
@@ -508,7 +514,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
	/* check if the TID is not in aggregation flow already */
	if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {
		ht_vdbg("BA request denied - session is not idle on tid %u\n",
		ht_dbg(sdata,
		       "BA request denied - session is not idle on tid %u\n",
		       tid);
		ret = -EAGAIN;
		goto err_unlock_sta;
@@ -564,7 +571,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,

	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);

	ht_vdbg("Aggregation is on for tid %d\n", tid);
	ht_dbg(sta->sdata, "Aggregation is on for tid %d\n", tid);

	drv_ampdu_action(local, sta->sdata,
			 IEEE80211_AMPDU_TX_OPERATIONAL,
@@ -598,7 +605,8 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
	trace_api_start_tx_ba_cb(sdata, ra, tid);

	if (tid >= STA_TID_NUM) {
		ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
		ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
		       tid, STA_TID_NUM);
		return;
	}

@@ -606,7 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
	sta = sta_info_get_bss(sdata, ra);
	if (!sta) {
		mutex_unlock(&local->sta_mtx);
		ht_vdbg("Could not find station: %pM\n", ra);
		ht_dbg(sdata, "Could not find station: %pM\n", ra);
		return;
	}

@@ -614,7 +622,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);

	if (WARN_ON(!tid_tx)) {
		ht_vdbg("addBA was not requested!\n");
		ht_dbg(sdata, "addBA was not requested!\n");
		goto unlock;
	}

@@ -714,17 +722,18 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
	trace_api_stop_tx_ba_cb(sdata, ra, tid);

	if (tid >= STA_TID_NUM) {
		ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
		ht_dbg(sdata, "Bad TID value: tid = %d (>= %d)\n",
		       tid, STA_TID_NUM);
		return;
	}

	ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid);
	ht_dbg(sdata, "Stopping Tx BA session for %pM tid %d\n", ra, tid);

	mutex_lock(&local->sta_mtx);

	sta = sta_info_get_bss(sdata, ra);
	if (!sta) {
		ht_vdbg("Could not find station: %pM\n", ra);
		ht_dbg(sdata, "Could not find station: %pM\n", ra);
		goto unlock;
	}

@@ -733,7 +742,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
	tid_tx = rcu_dereference_protected_tid_tx(sta, tid);

	if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
		ht_vdbg("unexpected callback to A-MPDU stop\n");
		ht_dbg(sdata, "unexpected callback to A-MPDU stop\n");
		goto unlock_sta;
	}

@@ -809,13 +818,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
		goto out;

	if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
		ht_vdbg("wrong addBA response token, tid %d\n", tid);
		ht_dbg(sta->sdata, "wrong addBA response token, tid %d\n", tid);
		goto out;
	}

	del_timer_sync(&tid_tx->addba_resp_timer);

	ht_vdbg("switched off addBA timer for tid %d\n", tid);
	ht_dbg(sta->sdata, "switched off addBA timer for tid %d\n", tid);

	/*
	 * addba_resp_timer may have fired before we got here, and
@@ -824,7 +833,8 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
	 */
	if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
	    test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
		ht_vdbg("got addBA resp for tid %d but we already gave up\n",
		ht_dbg(sta->sdata,
		       "got addBA resp for tid %d but we already gave up\n",
		       tid);
		goto out;
	}
Loading