aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ibss.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-22 05:29:50 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-24 05:32:29 -0400
commitbdcbd8e0e3ffdad32b14b6373e67bfcf5fd3f002 (patch)
treeb636f2229570dc95edef997272bd0656cf19224d /net/mac80211/ibss.c
parentd3b2fb53c7f82903880769d406c11c7e619b11a4 (diff)
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>
Diffstat (limited to 'net/mac80211/ibss.c')
-rw-r--r--net/mac80211/ibss.c89
1 files changed, 43 insertions, 46 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 8931110b8433..5746d62faba1 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -261,11 +261,7 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
261 261
262 memcpy(addr, sta->sta.addr, ETH_ALEN); 262 memcpy(addr, sta->sta.addr, ETH_ALEN);
263 263
264#ifdef CONFIG_MAC80211_IBSS_DEBUG 264 ibss_dbg(sdata, "Adding new IBSS station %pM\n", addr);
265 wiphy_debug(sdata->local->hw.wiphy,
266 "Adding new IBSS station %pM (dev=%s)\n",
267 addr, sdata->name);
268#endif
269 265
270 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); 266 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
271 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); 267 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
@@ -280,8 +276,9 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
280 if (sta_info_insert_rcu(sta)) 276 if (sta_info_insert_rcu(sta))
281 return sta_info_get(sdata, addr); 277 return sta_info_get(sdata, addr);
282 if (auth && !sdata->u.ibss.auth_frame_registrations) { 278 if (auth && !sdata->u.ibss.auth_frame_registrations) {
283 ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", 279 ibss_dbg(sdata,
284 sdata->vif.addr, sdata->u.ibss.bssid, addr); 280 "TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
281 sdata->vif.addr, sdata->u.ibss.bssid, addr);
285 ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, 282 ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
286 addr, sdata->u.ibss.bssid, NULL, 0, 0); 283 addr, sdata->u.ibss.bssid, NULL, 0, 0);
287 } 284 }
@@ -304,7 +301,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
304 * allow new one to be added. 301 * allow new one to be added.
305 */ 302 */
306 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { 303 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
307 net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", 304 net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
308 sdata->name, addr); 305 sdata->name, addr);
309 rcu_read_lock(); 306 rcu_read_lock();
310 return NULL; 307 return NULL;
@@ -351,9 +348,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
351 348
352 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) 349 if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
353 return; 350 return;
354 ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", 351 ibss_dbg(sdata,
355 sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, 352 "RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
356 auth_transaction); 353 mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
357 sta_info_destroy_addr(sdata, mgmt->sa); 354 sta_info_destroy_addr(sdata, mgmt->sa);
358 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); 355 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false);
359 rcu_read_unlock(); 356 rcu_read_unlock();
@@ -416,10 +413,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
416 ieee80211_mandatory_rates(local, band); 413 ieee80211_mandatory_rates(local, band);
417 414
418 if (sta->sta.supp_rates[band] != prev_rates) { 415 if (sta->sta.supp_rates[band] != prev_rates) {
419 ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", 416 ibss_dbg(sdata,
420 sdata->name, sta->sta.addr, 417 "updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
421 prev_rates, 418 sta->sta.addr, prev_rates,
422 sta->sta.supp_rates[band]); 419 sta->sta.supp_rates[band]);
423 rates_updated = true; 420 rates_updated = true;
424 } 421 }
425 } else { 422 } else {
@@ -534,16 +531,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
534 rx_timestamp = drv_get_tsf(local, sdata); 531 rx_timestamp = drv_get_tsf(local, sdata);
535 } 532 }
536 533
537 ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", 534 ibss_dbg(sdata,
538 mgmt->sa, mgmt->bssid, 535 "RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
539 (unsigned long long)rx_timestamp, 536 mgmt->sa, mgmt->bssid,
540 (unsigned long long)beacon_timestamp, 537 (unsigned long long)rx_timestamp,
541 (unsigned long long)(rx_timestamp - beacon_timestamp), 538 (unsigned long long)beacon_timestamp,
542 jiffies); 539 (unsigned long long)(rx_timestamp - beacon_timestamp),
540 jiffies);
543 541
544 if (beacon_timestamp > rx_timestamp) { 542 if (beacon_timestamp > rx_timestamp) {
545 ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", 543 ibss_dbg(sdata,
546 sdata->name, mgmt->bssid); 544 "beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n",
545 mgmt->bssid);
547 ieee80211_sta_join_ibss(sdata, bss); 546 ieee80211_sta_join_ibss(sdata, bss);
548 supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); 547 supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
549 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 548 ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
@@ -569,7 +568,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
569 * allow new one to be added. 568 * allow new one to be added.
570 */ 569 */
571 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { 570 if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) {
572 net_dbg_ratelimited("%s: No room for a new IBSS STA entry %pM\n", 571 net_info_ratelimited("%s: No room for a new IBSS STA entry %pM\n",
573 sdata->name, addr); 572 sdata->name, addr);
574 return; 573 return;
575 } 574 }
@@ -645,8 +644,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
645 if (ifibss->fixed_channel) 644 if (ifibss->fixed_channel)
646 return; 645 return;
647 646
648 pr_debug("%s: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n", 647 sdata_info(sdata,
649 sdata->name); 648 "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n");
650 649
651 ieee80211_request_internal_scan(sdata, 650 ieee80211_request_internal_scan(sdata,
652 ifibss->ssid, ifibss->ssid_len, NULL); 651 ifibss->ssid, ifibss->ssid_len, NULL);
@@ -674,8 +673,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
674 bssid[0] |= 0x02; 673 bssid[0] |= 0x02;
675 } 674 }
676 675
677 pr_debug("%s: Creating new IBSS network, BSSID %pM\n", 676 sdata_info(sdata, "Creating new IBSS network, BSSID %pM\n", bssid);
678 sdata->name, bssid);
679 677
680 capability = WLAN_CAPABILITY_IBSS; 678 capability = WLAN_CAPABILITY_IBSS;
681 679
@@ -706,8 +704,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
706 lockdep_assert_held(&ifibss->mtx); 704 lockdep_assert_held(&ifibss->mtx);
707 705
708 active_ibss = ieee80211_sta_active_ibss(sdata); 706 active_ibss = ieee80211_sta_active_ibss(sdata);
709 ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n", 707 ibss_dbg(sdata, "sta_find_ibss (active_ibss=%d)\n", active_ibss);
710 sdata->name, active_ibss);
711 708
712 if (active_ibss) 709 if (active_ibss)
713 return; 710 return;
@@ -730,23 +727,24 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
730 struct ieee80211_bss *bss; 727 struct ieee80211_bss *bss;
731 728
732 bss = (void *)cbss->priv; 729 bss = (void *)cbss->priv;
733 ibss_vdbg(" sta_find_ibss: selected %pM current %pM\n", 730 ibss_dbg(sdata,
734 cbss->bssid, ifibss->bssid); 731 "sta_find_ibss: selected %pM current %pM\n",
735 pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", 732 cbss->bssid, ifibss->bssid);
736 sdata->name, cbss->bssid); 733 sdata_info(sdata,
734 "Selected IBSS BSSID %pM based on configured SSID\n",
735 cbss->bssid);
737 736
738 ieee80211_sta_join_ibss(sdata, bss); 737 ieee80211_sta_join_ibss(sdata, bss);
739 ieee80211_rx_bss_put(local, bss); 738 ieee80211_rx_bss_put(local, bss);
740 return; 739 return;
741 } 740 }
742 741
743 ibss_vdbg(" did not try to join ibss\n"); 742 ibss_dbg(sdata, "sta_find_ibss: did not try to join ibss\n");
744 743
745 /* Selected IBSS not found in current scan results - try to scan */ 744 /* Selected IBSS not found in current scan results - try to scan */
746 if (time_after(jiffies, ifibss->last_scan_completed + 745 if (time_after(jiffies, ifibss->last_scan_completed +
747 IEEE80211_SCAN_INTERVAL)) { 746 IEEE80211_SCAN_INTERVAL)) {
748 pr_debug("%s: Trigger new scan to find an IBSS to join\n", 747 sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
749 sdata->name);
750 748
751 ieee80211_request_internal_scan(sdata, 749 ieee80211_request_internal_scan(sdata,
752 ifibss->ssid, ifibss->ssid_len, 750 ifibss->ssid, ifibss->ssid_len,
@@ -760,9 +758,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
760 ieee80211_sta_create_ibss(sdata); 758 ieee80211_sta_create_ibss(sdata);
761 return; 759 return;
762 } 760 }
763 pr_debug("%s: IBSS not allowed on %d MHz\n", 761 sdata_info(sdata, "IBSS not allowed on %d MHz\n",
764 sdata->name, 762 local->hw.conf.channel->center_freq);
765 local->hw.conf.channel->center_freq);
766 763
767 /* No IBSS found - decrease scan interval and continue 764 /* No IBSS found - decrease scan interval and continue
768 * scanning. */ 765 * scanning. */
@@ -797,9 +794,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
797 794
798 tx_last_beacon = drv_tx_last_beacon(local); 795 tx_last_beacon = drv_tx_last_beacon(local);
799 796
800 ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", 797 ibss_dbg(sdata,
801 sdata->name, mgmt->sa, mgmt->da, 798 "RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
802 mgmt->bssid, tx_last_beacon); 799 mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
803 800
804 if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) 801 if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
805 return; 802 return;
@@ -812,8 +809,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
812 pos = mgmt->u.probe_req.variable; 809 pos = mgmt->u.probe_req.variable;
813 if (pos[0] != WLAN_EID_SSID || 810 if (pos[0] != WLAN_EID_SSID ||
814 pos + 2 + pos[1] > end) { 811 pos + 2 + pos[1] > end) {
815 ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n", 812 ibss_dbg(sdata, "Invalid SSID IE in ProbeReq from %pM\n",
816 sdata->name, mgmt->sa); 813 mgmt->sa);
817 return; 814 return;
818 } 815 }
819 if (pos[1] != 0 && 816 if (pos[1] != 0 &&
@@ -830,7 +827,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
830 827
831 resp = (struct ieee80211_mgmt *) skb->data; 828 resp = (struct ieee80211_mgmt *) skb->data;
832 memcpy(resp->da, mgmt->sa, ETH_ALEN); 829 memcpy(resp->da, mgmt->sa, ETH_ALEN);
833 ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da); 830 ibss_dbg(sdata, "Sending ProbeResp to %pM\n", resp->da);
834 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 831 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
835 ieee80211_tx_skb(sdata, skb); 832 ieee80211_tx_skb(sdata, skb);
836} 833}