diff options
author | Joe Perches <joe@perches.com> | 2012-05-15 17:20:32 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-05 15:32:10 -0400 |
commit | 499f42bb03a9bd8a23f73e7c3886f70f52e7edc5 (patch) | |
tree | f0a1ee12e47d46f58094fded70bd7ebf3b49b4c8 /net/mac80211 | |
parent | d63e9ae3b12fd0c6a3795c9b08de6b476f80b8c3 (diff) |
net: mac80211: Add and use ibss_vdbg debugging macro
Simplify the use of #ifdef CONFIG_MAC80211_IBSS_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')
-rw-r--r-- | net/mac80211/ibss.c | 79 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 6 |
2 files changed, 30 insertions, 55 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 148c27553024..0bc47a825692 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -281,10 +281,8 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, | |||
281 | if (sta_info_insert_rcu(sta)) | 281 | if (sta_info_insert_rcu(sta)) |
282 | return sta_info_get(sdata, addr); | 282 | return sta_info_get(sdata, addr); |
283 | if (auth) { | 283 | if (auth) { |
284 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 284 | ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", |
285 | pr_debug("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", | 285 | sdata->vif.addr, sdata->u.ibss.bssid, addr); |
286 | sdata->vif.addr, sdata->u.ibss.bssid, addr); | ||
287 | #endif | ||
288 | ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, | 286 | ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, |
289 | addr, sdata->u.ibss.bssid, NULL, 0, 0); | 287 | addr, sdata->u.ibss.bssid, NULL, 0, 0); |
290 | } | 288 | } |
@@ -354,11 +352,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, | |||
354 | 352 | ||
355 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) | 353 | if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) |
356 | return; | 354 | return; |
357 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 355 | ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", |
358 | pr_debug("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", | 356 | sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, |
359 | sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, | 357 | auth_transaction); |
360 | auth_transaction); | ||
361 | #endif | ||
362 | sta_info_destroy_addr(sdata, mgmt->sa); | 358 | sta_info_destroy_addr(sdata, mgmt->sa); |
363 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); | 359 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); |
364 | rcu_read_unlock(); | 360 | rcu_read_unlock(); |
@@ -421,12 +417,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
421 | ieee80211_mandatory_rates(local, band); | 417 | ieee80211_mandatory_rates(local, band); |
422 | 418 | ||
423 | if (sta->sta.supp_rates[band] != prev_rates) { | 419 | if (sta->sta.supp_rates[band] != prev_rates) { |
424 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 420 | ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", |
425 | pr_debug("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", | 421 | sdata->name, sta->sta.addr, |
426 | sdata->name, sta->sta.addr, | 422 | prev_rates, |
427 | prev_rates, | 423 | sta->sta.supp_rates[band]); |
428 | sta->sta.supp_rates[band]); | ||
429 | #endif | ||
430 | rates_updated = true; | 424 | rates_updated = true; |
431 | } | 425 | } |
432 | } else { | 426 | } else { |
@@ -541,20 +535,16 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
541 | rx_timestamp = drv_get_tsf(local, sdata); | 535 | rx_timestamp = drv_get_tsf(local, sdata); |
542 | } | 536 | } |
543 | 537 | ||
544 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 538 | ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", |
545 | pr_debug("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", | 539 | mgmt->sa, mgmt->bssid, |
546 | mgmt->sa, mgmt->bssid, | 540 | (unsigned long long)rx_timestamp, |
547 | (unsigned long long)rx_timestamp, | 541 | (unsigned long long)beacon_timestamp, |
548 | (unsigned long long)beacon_timestamp, | 542 | (unsigned long long)(rx_timestamp - beacon_timestamp), |
549 | (unsigned long long)(rx_timestamp - beacon_timestamp), | 543 | jiffies); |
550 | jiffies); | ||
551 | #endif | ||
552 | 544 | ||
553 | if (beacon_timestamp > rx_timestamp) { | 545 | if (beacon_timestamp > rx_timestamp) { |
554 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 546 | ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", |
555 | pr_debug("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", | 547 | sdata->name, mgmt->bssid); |
556 | sdata->name, mgmt->bssid); | ||
557 | #endif | ||
558 | ieee80211_sta_join_ibss(sdata, bss); | 548 | ieee80211_sta_join_ibss(sdata, bss); |
559 | supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); | 549 | supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); |
560 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, | 550 | ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, |
@@ -717,10 +707,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
717 | lockdep_assert_held(&ifibss->mtx); | 707 | lockdep_assert_held(&ifibss->mtx); |
718 | 708 | ||
719 | active_ibss = ieee80211_sta_active_ibss(sdata); | 709 | active_ibss = ieee80211_sta_active_ibss(sdata); |
720 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 710 | ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n", |
721 | pr_debug("%s: sta_find_ibss (active_ibss=%d)\n", | 711 | sdata->name, active_ibss); |
722 | sdata->name, active_ibss); | ||
723 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | ||
724 | 712 | ||
725 | if (active_ibss) | 713 | if (active_ibss) |
726 | return; | 714 | return; |
@@ -743,11 +731,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
743 | struct ieee80211_bss *bss; | 731 | struct ieee80211_bss *bss; |
744 | 732 | ||
745 | bss = (void *)cbss->priv; | 733 | bss = (void *)cbss->priv; |
746 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 734 | ibss_vdbg(" sta_find_ibss: selected %pM current %pM\n", |
747 | pr_debug(" sta_find_ibss: selected %pM current %pM\n", | 735 | cbss->bssid, ifibss->bssid); |
748 | cbss->bssid, ifibss->bssid); | ||
749 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | ||
750 | |||
751 | pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", | 736 | pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", |
752 | sdata->name, cbss->bssid); | 737 | sdata->name, cbss->bssid); |
753 | 738 | ||
@@ -756,9 +741,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | |||
756 | return; | 741 | return; |
757 | } | 742 | } |
758 | 743 | ||
759 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 744 | ibss_vdbg(" did not try to join ibss\n"); |
760 | pr_debug(" did not try to join ibss\n"); | ||
761 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | ||
762 | 745 | ||
763 | /* Selected IBSS not found in current scan results - try to scan */ | 746 | /* Selected IBSS not found in current scan results - try to scan */ |
764 | if (time_after(jiffies, ifibss->last_scan_completed + | 747 | if (time_after(jiffies, ifibss->last_scan_completed + |
@@ -815,11 +798,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
815 | 798 | ||
816 | tx_last_beacon = drv_tx_last_beacon(local); | 799 | tx_last_beacon = drv_tx_last_beacon(local); |
817 | 800 | ||
818 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 801 | ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", |
819 | pr_debug("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", | 802 | sdata->name, mgmt->sa, mgmt->da, |
820 | sdata->name, mgmt->sa, mgmt->da, | 803 | mgmt->bssid, tx_last_beacon); |
821 | mgmt->bssid, tx_last_beacon); | ||
822 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | ||
823 | 804 | ||
824 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) | 805 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) |
825 | return; | 806 | return; |
@@ -832,10 +813,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
832 | pos = mgmt->u.probe_req.variable; | 813 | pos = mgmt->u.probe_req.variable; |
833 | if (pos[0] != WLAN_EID_SSID || | 814 | if (pos[0] != WLAN_EID_SSID || |
834 | pos + 2 + pos[1] > end) { | 815 | pos + 2 + pos[1] > end) { |
835 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 816 | ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n", |
836 | pr_debug("%s: Invalid SSID IE in ProbeReq from %pM\n", | 817 | sdata->name, mgmt->sa); |
837 | sdata->name, mgmt->sa); | ||
838 | #endif | ||
839 | return; | 818 | return; |
840 | } | 819 | } |
841 | if (pos[1] != 0 && | 820 | if (pos[1] != 0 && |
@@ -852,9 +831,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
852 | 831 | ||
853 | resp = (struct ieee80211_mgmt *) skb->data; | 832 | resp = (struct ieee80211_mgmt *) skb->data; |
854 | memcpy(resp->da, mgmt->sa, ETH_ALEN); | 833 | memcpy(resp->da, mgmt->sa, ETH_ALEN); |
855 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 834 | ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da); |
856 | pr_debug("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da); | ||
857 | #endif /* CONFIG_MAC80211_IBSS_DEBUG */ | ||
858 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | 835 | IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; |
859 | ieee80211_tx_skb(sdata, skb); | 836 | ieee80211_tx_skb(sdata, skb); |
860 | } | 837 | } |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 4be509807607..0a70f797dcf1 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -887,10 +887,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, | |||
887 | continue; | 887 | continue; |
888 | 888 | ||
889 | if (time_after(jiffies, sta->last_rx + exp_time)) { | 889 | if (time_after(jiffies, sta->last_rx + exp_time)) { |
890 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | 890 | ibss_vdbg("%s: expiring inactive STA %pM\n", |
891 | pr_debug("%s: expiring inactive STA %pM\n", | 891 | sdata->name, sta->sta.addr); |
892 | sdata->name, sta->sta.addr); | ||
893 | #endif | ||
894 | WARN_ON(__sta_info_destroy(sta)); | 892 | WARN_ON(__sta_info_destroy(sta)); |
895 | } | 893 | } |
896 | } | 894 | } |