Commit d63e9ae3 authored by Joe Perches's avatar Joe Perches Committed by John W. Linville

net: mac80211: Add and use ht_vdbg debugging macro

Simplify the use of #ifdef CONFIG_MAC80211_HT_DEBUG/#endif
by adding a logging macro to encapsulate the test.

Convert the appropriate uses too.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f0d23208
...@@ -3844,4 +3844,17 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, ...@@ -3844,4 +3844,17 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
*/ */
int ieee80211_ave_rssi(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
#endif /* MAC80211_H */ #endif /* MAC80211_H */
...@@ -74,12 +74,10 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, ...@@ -74,12 +74,10 @@ void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Rx BA session stop requested for %pM tid %u %s reason: %d\n",
pr_debug("Rx BA session stop requested for %pM tid %u %s reason: %d\n", sta->sta.addr, tid,
sta->sta.addr, tid, initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator",
initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator", (int)reason);
(int)reason);
#endif /* CONFIG_MAC80211_HT_DEBUG */
if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP,
&sta->sta, tid, NULL, 0)) &sta->sta, tid, NULL, 0))
...@@ -154,9 +152,8 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) ...@@ -154,9 +152,8 @@ static void sta_rx_agg_session_timer_expired(unsigned long data)
return; return;
} }
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("rx session timer expired on tid %d\n", (u16)*ptid);
pr_debug("rx session timer expired on tid %d\n", (u16)*ptid);
#endif
set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired);
ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work);
} }
...@@ -243,9 +240,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, ...@@ -243,9 +240,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
status = WLAN_STATUS_REQUEST_DECLINED; status = WLAN_STATUS_REQUEST_DECLINED;
if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Suspend in progress - Denying ADDBA request\n");
pr_debug("Suspend in progress - Denying ADDBA request\n");
#endif
goto end_no_lock; goto end_no_lock;
} }
...@@ -317,10 +312,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, ...@@ -317,10 +312,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START,
&sta->sta, tid, &start_seq_num, 0); &sta->sta, tid, &start_seq_num, 0);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Rx A-MPDU request on tid %d result %d\n", tid, ret);
pr_debug("Rx A-MPDU request on tid %d result %d\n", tid, ret);
#endif /* CONFIG_MAC80211_HT_DEBUG */
if (ret) { if (ret) {
kfree(tid_agg_rx->reorder_buf); kfree(tid_agg_rx->reorder_buf);
kfree(tid_agg_rx->reorder_time); kfree(tid_agg_rx->reorder_time);
......
...@@ -184,10 +184,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, ...@@ -184,10 +184,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
spin_unlock_bh(&sta->lock); spin_unlock_bh(&sta->lock);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Tx BA session stop requested for %pM tid %u\n",
pr_debug("Tx BA session stop requested for %pM tid %u\n", sta->sta.addr, tid);
sta->sta.addr, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */
del_timer_sync(&tid_tx->addba_resp_timer); del_timer_sync(&tid_tx->addba_resp_timer);
del_timer_sync(&tid_tx->session_timer); del_timer_sync(&tid_tx->session_timer);
...@@ -253,16 +251,12 @@ static void sta_addba_resp_timer_expired(unsigned long data) ...@@ -253,16 +251,12 @@ static void sta_addba_resp_timer_expired(unsigned long data)
if (!tid_tx || if (!tid_tx ||
test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) {
rcu_read_unlock(); rcu_read_unlock();
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
pr_debug("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n", tid);
tid);
#endif
return; return;
} }
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("addBA response timer expired on tid %d\n", tid);
pr_debug("addBA response timer expired on tid %d\n", tid);
#endif
ieee80211_stop_tx_ba_session(&sta->sta, tid); ieee80211_stop_tx_ba_session(&sta->sta, tid);
rcu_read_unlock(); rcu_read_unlock();
...@@ -371,10 +365,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) ...@@ -371,10 +365,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START,
&sta->sta, tid, &start_seq_num, 0); &sta->sta, tid, &start_seq_num, 0);
if (ret) { if (ret) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid);
pr_debug("BA request denied - HW unavailable for tid %d\n",
tid);
#endif
spin_lock_bh(&sta->lock); spin_lock_bh(&sta->lock);
ieee80211_agg_splice_packets(sdata, tid_tx, tid); ieee80211_agg_splice_packets(sdata, tid_tx, tid);
ieee80211_assign_tid_tx(sta, tid, NULL); ieee80211_assign_tid_tx(sta, tid, NULL);
...@@ -387,9 +378,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) ...@@ -387,9 +378,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
/* activate the timer for the recipient's addBA response */ /* activate the timer for the recipient's addBA response */
mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("activated addBA response timer on tid %d\n", tid);
pr_debug("activated addBA response timer on tid %d\n", tid);
#endif
spin_lock_bh(&sta->lock); spin_lock_bh(&sta->lock);
sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; sta->ampdu_mlme.last_addba_req_time[tid] = jiffies;
...@@ -436,9 +425,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data) ...@@ -436,9 +425,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data)
rcu_read_unlock(); rcu_read_unlock();
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid);
pr_debug("tx session timer expired on tid %d\n", (u16)*ptid);
#endif
ieee80211_stop_tx_ba_session(&sta->sta, *ptid); ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
} }
...@@ -462,10 +449,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -462,10 +449,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
(local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
return -EINVAL; return -EINVAL;
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Open BA session requested for %pM tid %u\n",
pr_debug("Open BA session requested for %pM tid %u\n", pubsta->addr, tid);
pubsta->addr, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */
if (sdata->vif.type != NL80211_IFTYPE_STATION && if (sdata->vif.type != NL80211_IFTYPE_STATION &&
sdata->vif.type != NL80211_IFTYPE_MESH_POINT && sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
...@@ -475,9 +460,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -475,9 +460,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
return -EINVAL; return -EINVAL;
if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("BA sessions blocked - Denying BA session request\n");
pr_debug("BA sessions blocked - Denying BA session request\n");
#endif
return -EINVAL; return -EINVAL;
} }
...@@ -495,10 +478,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -495,10 +478,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
*/ */
if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC &&
!sta->sta.ht_cap.ht_supported) { !sta->sta.ht_cap.ht_supported) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n",
pr_debug("BA request denied - IBSS STA %pM does not advertise HT support\n", pubsta->addr);
pubsta->addr);
#endif /* CONFIG_MAC80211_HT_DEBUG */
return -EINVAL; return -EINVAL;
} }
...@@ -518,10 +499,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -518,10 +499,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 && if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
HT_AGG_RETRIES_PERIOD)) { HT_AGG_RETRIES_PERIOD)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n",
pr_debug("BA request denied - waiting a grace period after %d failed requests on tid %u\n", sta->ampdu_mlme.addba_req_num[tid], tid);
sta->ampdu_mlme.addba_req_num[tid], tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */
ret = -EBUSY; ret = -EBUSY;
goto err_unlock_sta; goto err_unlock_sta;
} }
...@@ -529,10 +508,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -529,10 +508,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
tid_tx = rcu_dereference_protected_tid_tx(sta, tid); tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
/* check if the TID is not in aggregation flow already */ /* check if the TID is not in aggregation flow already */
if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("BA request denied - session is not idle on tid %u\n",
pr_debug("BA request denied - session is not idle on tid %u\n", tid);
tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */
ret = -EAGAIN; ret = -EAGAIN;
goto err_unlock_sta; goto err_unlock_sta;
} }
...@@ -587,9 +564,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local, ...@@ -587,9 +564,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
tid_tx = rcu_dereference_protected_tid_tx(sta, tid); tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Aggregation is on for tid %d\n", tid);
pr_debug("Aggregation is on for tid %d\n", tid);
#endif
drv_ampdu_action(local, sta->sdata, drv_ampdu_action(local, sta->sdata,
IEEE80211_AMPDU_TX_OPERATIONAL, IEEE80211_AMPDU_TX_OPERATIONAL,
...@@ -623,9 +598,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) ...@@ -623,9 +598,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
trace_api_start_tx_ba_cb(sdata, ra, tid); trace_api_start_tx_ba_cb(sdata, ra, tid);
if (tid >= STA_TID_NUM) { if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
pr_debug("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
#endif
return; return;
} }
...@@ -633,9 +606,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) ...@@ -633,9 +606,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
sta = sta_info_get_bss(sdata, ra); sta = sta_info_get_bss(sdata, ra);
if (!sta) { if (!sta) {
mutex_unlock(&local->sta_mtx); mutex_unlock(&local->sta_mtx);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Could not find station: %pM\n", ra);
pr_debug("Could not find station: %pM\n", ra);
#endif
return; return;
} }
...@@ -643,9 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) ...@@ -643,9 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
tid_tx = rcu_dereference_protected_tid_tx(sta, tid); tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
if (WARN_ON(!tid_tx)) { if (WARN_ON(!tid_tx)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("addBA was not requested!\n");
pr_debug("addBA was not requested!\n");
#endif
goto unlock; goto unlock;
} }
...@@ -745,23 +714,17 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) ...@@ -745,23 +714,17 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
trace_api_stop_tx_ba_cb(sdata, ra, tid); trace_api_stop_tx_ba_cb(sdata, ra, tid);
if (tid >= STA_TID_NUM) { if (tid >= STA_TID_NUM) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
pr_debug("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
#endif
return; return;
} }
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid);
pr_debug("Stopping Tx BA session for %pM tid %d\n", ra, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */
mutex_lock(&local->sta_mtx); mutex_lock(&local->sta_mtx);
sta = sta_info_get_bss(sdata, ra); sta = sta_info_get_bss(sdata, ra);
if (!sta) { if (!sta) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("Could not find station: %pM\n", ra);
pr_debug("Could not find station: %pM\n", ra);
#endif
goto unlock; goto unlock;
} }
...@@ -770,9 +733,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) ...@@ -770,9 +733,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
tid_tx = rcu_dereference_protected_tid_tx(sta, tid); tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("unexpected callback to A-MPDU stop\n");
pr_debug("unexpected callback to A-MPDU stop\n");
#endif
goto unlock_sta; goto unlock_sta;
} }
...@@ -848,17 +809,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, ...@@ -848,17 +809,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
goto out; goto out;
if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("wrong addBA response token, tid %d\n", tid);
pr_debug("wrong addBA response token, tid %d\n", tid);
#endif
goto out; goto out;
} }
del_timer_sync(&tid_tx->addba_resp_timer); del_timer_sync(&tid_tx->addba_resp_timer);
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("switched off addBA timer for tid %d\n", tid);
pr_debug("switched off addBA timer for tid %d\n", tid);
#endif
/* /*
* addba_resp_timer may have fired before we got here, and * addba_resp_timer may have fired before we got here, and
...@@ -867,10 +824,8 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, ...@@ -867,10 +824,8 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
*/ */
if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
#ifdef CONFIG_MAC80211_HT_DEBUG ht_vdbg("got addBA resp for tid %d but we already gave up\n",
pr_debug("got addBA resp for tid %d but we already gave up\n", tid);
tid);
#endif
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment