aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/agg-tx.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-15 17:20:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-05 15:32:10 -0400
commitd63e9ae3b12fd0c6a3795c9b08de6b476f80b8c3 (patch)
tree7d7e89004303daafb4d03e607d6863cd1fdce442 /net/mac80211/agg-tx.c
parentf0d232080fa5d040aaf73a39d127b003cdd2d0ae (diff)
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: Joe Perches <joe@perches.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/agg-tx.c')
-rw-r--r--net/mac80211/agg-tx.c103
1 files changed, 29 insertions, 74 deletions
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 90b2c0ffd5b0..da07f01cfe4d 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -184,10 +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#ifdef CONFIG_MAC80211_HT_DEBUG 187 ht_vdbg("Tx BA session stop requested for %pM tid %u\n",
188 pr_debug("Tx BA session stop requested for %pM tid %u\n", 188 sta->sta.addr, tid);
189 sta->sta.addr, tid);
190#endif /* CONFIG_MAC80211_HT_DEBUG */
191 189
192 del_timer_sync(&tid_tx->addba_resp_timer); 190 del_timer_sync(&tid_tx->addba_resp_timer);
193 del_timer_sync(&tid_tx->session_timer); 191 del_timer_sync(&tid_tx->session_timer);
@@ -253,16 +251,12 @@ static void sta_addba_resp_timer_expired(unsigned long data)
253 if (!tid_tx || 251 if (!tid_tx ||
254 test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { 252 test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) {
255 rcu_read_unlock(); 253 rcu_read_unlock();
256#ifdef CONFIG_MAC80211_HT_DEBUG 254 ht_vdbg("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n",
257 pr_debug("timer expired on tid %d but we are not (or no longer) expecting addBA response there\n", 255 tid);
258 tid);
259#endif
260 return; 256 return;
261 } 257 }
262 258
263#ifdef CONFIG_MAC80211_HT_DEBUG 259 ht_vdbg("addBA response timer expired on tid %d\n", tid);
264 pr_debug("addBA response timer expired on tid %d\n", tid);
265#endif
266 260
267 ieee80211_stop_tx_ba_session(&sta->sta, tid); 261 ieee80211_stop_tx_ba_session(&sta->sta, tid);
268 rcu_read_unlock(); 262 rcu_read_unlock();
@@ -371,10 +365,7 @@ void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid)
371 ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, 365 ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START,
372 &sta->sta, tid, &start_seq_num, 0); 366 &sta->sta, tid, &start_seq_num, 0);
373 if (ret) { 367 if (ret) {
374#ifdef CONFIG_MAC80211_HT_DEBUG 368 ht_vdbg("BA request denied - HW unavailable for tid %d\n", tid);
375 pr_debug("BA request denied - HW unavailable for tid %d\n",
376 tid);
377#endif
378 spin_lock_bh(&sta->lock); 369 spin_lock_bh(&sta->lock);
379 ieee80211_agg_splice_packets(sdata, tid_tx, tid); 370 ieee80211_agg_splice_packets(sdata, tid_tx, tid);
380 ieee80211_assign_tid_tx(sta, tid, NULL); 371 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 378
388 /* activate the timer for the recipient's addBA response */ 379 /* activate the timer for the recipient's addBA response */
389 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); 380 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL);
390#ifdef CONFIG_MAC80211_HT_DEBUG 381 ht_vdbg("activated addBA response timer on tid %d\n", tid);
391 pr_debug("activated addBA response timer on tid %d\n", tid);
392#endif
393 382
394 spin_lock_bh(&sta->lock); 383 spin_lock_bh(&sta->lock);
395 sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; 384 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 425
437 rcu_read_unlock(); 426 rcu_read_unlock();
438 427
439#ifdef CONFIG_MAC80211_HT_DEBUG 428 ht_vdbg("tx session timer expired on tid %d\n", (u16)*ptid);
440 pr_debug("tx session timer expired on tid %d\n", (u16)*ptid);
441#endif
442 429
443 ieee80211_stop_tx_ba_session(&sta->sta, *ptid); 430 ieee80211_stop_tx_ba_session(&sta->sta, *ptid);
444} 431}
@@ -462,10 +449,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
462 (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) 449 (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW))
463 return -EINVAL; 450 return -EINVAL;
464 451
465#ifdef CONFIG_MAC80211_HT_DEBUG 452 ht_vdbg("Open BA session requested for %pM tid %u\n",
466 pr_debug("Open BA session requested for %pM tid %u\n", 453 pubsta->addr, tid);
467 pubsta->addr, tid);
468#endif /* CONFIG_MAC80211_HT_DEBUG */
469 454
470 if (sdata->vif.type != NL80211_IFTYPE_STATION && 455 if (sdata->vif.type != NL80211_IFTYPE_STATION &&
471 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && 456 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
@@ -475,9 +460,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
475 return -EINVAL; 460 return -EINVAL;
476 461
477 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { 462 if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
478#ifdef CONFIG_MAC80211_HT_DEBUG 463 ht_vdbg("BA sessions blocked - Denying BA session request\n");
479 pr_debug("BA sessions blocked - Denying BA session request\n");
480#endif
481 return -EINVAL; 464 return -EINVAL;
482 } 465 }
483 466
@@ -495,10 +478,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
495 */ 478 */
496 if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && 479 if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC &&
497 !sta->sta.ht_cap.ht_supported) { 480 !sta->sta.ht_cap.ht_supported) {
498#ifdef CONFIG_MAC80211_HT_DEBUG 481 ht_vdbg("BA request denied - IBSS STA %pM does not advertise HT support\n",
499 pr_debug("BA request denied - IBSS STA %pM does not advertise HT support\n", 482 pubsta->addr);
500 pubsta->addr);
501#endif /* CONFIG_MAC80211_HT_DEBUG */
502 return -EINVAL; 483 return -EINVAL;
503 } 484 }
504 485
@@ -518,10 +499,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
518 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && 499 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES &&
519 time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + 500 time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] +
520 HT_AGG_RETRIES_PERIOD)) { 501 HT_AGG_RETRIES_PERIOD)) {
521#ifdef CONFIG_MAC80211_HT_DEBUG 502 ht_vdbg("BA request denied - waiting a grace period after %d failed requests on tid %u\n",
522 pr_debug("BA request denied - waiting a grace period after %d failed requests on tid %u\n", 503 sta->ampdu_mlme.addba_req_num[tid], tid);
523 sta->ampdu_mlme.addba_req_num[tid], tid);
524#endif /* CONFIG_MAC80211_HT_DEBUG */
525 ret = -EBUSY; 504 ret = -EBUSY;
526 goto err_unlock_sta; 505 goto err_unlock_sta;
527 } 506 }
@@ -529,10 +508,8 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
529 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 508 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
530 /* check if the TID is not in aggregation flow already */ 509 /* check if the TID is not in aggregation flow already */
531 if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { 510 if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) {
532#ifdef CONFIG_MAC80211_HT_DEBUG 511 ht_vdbg("BA request denied - session is not idle on tid %u\n",
533 pr_debug("BA request denied - session is not idle on tid %u\n", 512 tid);
534 tid);
535#endif /* CONFIG_MAC80211_HT_DEBUG */
536 ret = -EAGAIN; 513 ret = -EAGAIN;
537 goto err_unlock_sta; 514 goto err_unlock_sta;
538 } 515 }
@@ -587,9 +564,7 @@ static void ieee80211_agg_tx_operational(struct ieee80211_local *local,
587 564
588 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 565 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
589 566
590#ifdef CONFIG_MAC80211_HT_DEBUG 567 ht_vdbg("Aggregation is on for tid %d\n", tid);
591 pr_debug("Aggregation is on for tid %d\n", tid);
592#endif
593 568
594 drv_ampdu_action(local, sta->sdata, 569 drv_ampdu_action(local, sta->sdata,
595 IEEE80211_AMPDU_TX_OPERATIONAL, 570 IEEE80211_AMPDU_TX_OPERATIONAL,
@@ -623,9 +598,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
623 trace_api_start_tx_ba_cb(sdata, ra, tid); 598 trace_api_start_tx_ba_cb(sdata, ra, tid);
624 599
625 if (tid >= STA_TID_NUM) { 600 if (tid >= STA_TID_NUM) {
626#ifdef CONFIG_MAC80211_HT_DEBUG 601 ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
627 pr_debug("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
628#endif
629 return; 602 return;
630 } 603 }
631 604
@@ -633,9 +606,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
633 sta = sta_info_get_bss(sdata, ra); 606 sta = sta_info_get_bss(sdata, ra);
634 if (!sta) { 607 if (!sta) {
635 mutex_unlock(&local->sta_mtx); 608 mutex_unlock(&local->sta_mtx);
636#ifdef CONFIG_MAC80211_HT_DEBUG 609 ht_vdbg("Could not find station: %pM\n", ra);
637 pr_debug("Could not find station: %pM\n", ra);
638#endif
639 return; 610 return;
640 } 611 }
641 612
@@ -643,9 +614,7 @@ void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid)
643 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 614 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
644 615
645 if (WARN_ON(!tid_tx)) { 616 if (WARN_ON(!tid_tx)) {
646#ifdef CONFIG_MAC80211_HT_DEBUG 617 ht_vdbg("addBA was not requested!\n");
647 pr_debug("addBA was not requested!\n");
648#endif
649 goto unlock; 618 goto unlock;
650 } 619 }
651 620
@@ -745,23 +714,17 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
745 trace_api_stop_tx_ba_cb(sdata, ra, tid); 714 trace_api_stop_tx_ba_cb(sdata, ra, tid);
746 715
747 if (tid >= STA_TID_NUM) { 716 if (tid >= STA_TID_NUM) {
748#ifdef CONFIG_MAC80211_HT_DEBUG 717 ht_vdbg("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
749 pr_debug("Bad TID value: tid = %d (>= %d)\n", tid, STA_TID_NUM);
750#endif
751 return; 718 return;
752 } 719 }
753 720
754#ifdef CONFIG_MAC80211_HT_DEBUG 721 ht_vdbg("Stopping Tx BA session for %pM tid %d\n", ra, tid);
755 pr_debug("Stopping Tx BA session for %pM tid %d\n", ra, tid);
756#endif /* CONFIG_MAC80211_HT_DEBUG */
757 722
758 mutex_lock(&local->sta_mtx); 723 mutex_lock(&local->sta_mtx);
759 724
760 sta = sta_info_get_bss(sdata, ra); 725 sta = sta_info_get_bss(sdata, ra);
761 if (!sta) { 726 if (!sta) {
762#ifdef CONFIG_MAC80211_HT_DEBUG 727 ht_vdbg("Could not find station: %pM\n", ra);
763 pr_debug("Could not find station: %pM\n", ra);
764#endif
765 goto unlock; 728 goto unlock;
766 } 729 }
767 730
@@ -770,9 +733,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid)
770 tid_tx = rcu_dereference_protected_tid_tx(sta, tid); 733 tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
771 734
772 if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 735 if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
773#ifdef CONFIG_MAC80211_HT_DEBUG 736 ht_vdbg("unexpected callback to A-MPDU stop\n");
774 pr_debug("unexpected callback to A-MPDU stop\n");
775#endif
776 goto unlock_sta; 737 goto unlock_sta;
777 } 738 }
778 739
@@ -848,17 +809,13 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
848 goto out; 809 goto out;
849 810
850 if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { 811 if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) {
851#ifdef CONFIG_MAC80211_HT_DEBUG 812 ht_vdbg("wrong addBA response token, tid %d\n", tid);
852 pr_debug("wrong addBA response token, tid %d\n", tid);
853#endif
854 goto out; 813 goto out;
855 } 814 }
856 815
857 del_timer_sync(&tid_tx->addba_resp_timer); 816 del_timer_sync(&tid_tx->addba_resp_timer);
858 817
859#ifdef CONFIG_MAC80211_HT_DEBUG 818 ht_vdbg("switched off addBA timer for tid %d\n", tid);
860 pr_debug("switched off addBA timer for tid %d\n", tid);
861#endif
862 819
863 /* 820 /*
864 * addba_resp_timer may have fired before we got here, and 821 * 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 */ 824 */
868 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || 825 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) ||
869 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { 826 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) {
870#ifdef CONFIG_MAC80211_HT_DEBUG 827 ht_vdbg("got addBA resp for tid %d but we already gave up\n",
871 pr_debug("got addBA resp for tid %d but we already gave up\n", 828 tid);
872 tid);
873#endif
874 goto out; 829 goto out;
875 } 830 }
876 831