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

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d63e9ae3
...@@ -3857,4 +3857,15 @@ do { \ ...@@ -3857,4 +3857,15 @@ do { \
} while (0) } while (0)
#endif #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 */ #endif /* MAC80211_H */
...@@ -281,10 +281,8 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, ...@@ -281,10 +281,8 @@ static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta,
if (sta_info_insert_rcu(sta)) if (sta_info_insert_rcu(sta))
return sta_info_get(sdata, addr); return sta_info_get(sdata, addr);
if (auth) { if (auth) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n",
pr_debug("TX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=1)\n", sdata->vif.addr, sdata->u.ibss.bssid, addr);
sdata->vif.addr, sdata->u.ibss.bssid, addr);
#endif
ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0,
addr, sdata->u.ibss.bssid, NULL, 0, 0); addr, sdata->u.ibss.bssid, NULL, 0, 0);
} }
...@@ -354,11 +352,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -354,11 +352,9 @@ static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
return; return;
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n",
pr_debug("%s: RX Auth SA=%pM DA=%pM BSSID=%pM (auth_transaction=%d)\n", sdata->name, mgmt->sa, mgmt->da, mgmt->bssid,
sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction);
auth_transaction);
#endif
sta_info_destroy_addr(sdata, mgmt->sa); sta_info_destroy_addr(sdata, mgmt->sa);
ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false);
rcu_read_unlock(); rcu_read_unlock();
...@@ -421,12 +417,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -421,12 +417,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
ieee80211_mandatory_rates(local, band); ieee80211_mandatory_rates(local, band);
if (sta->sta.supp_rates[band] != prev_rates) { if (sta->sta.supp_rates[band] != prev_rates) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n",
pr_debug("%s: updated supp_rates set for %pM based on beacon/probe_resp (0x%x -> 0x%x)\n", sdata->name, sta->sta.addr,
sdata->name, sta->sta.addr, prev_rates,
prev_rates, sta->sta.supp_rates[band]);
sta->sta.supp_rates[band]);
#endif
rates_updated = true; rates_updated = true;
} }
} else { } else {
...@@ -541,20 +535,16 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -541,20 +535,16 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
rx_timestamp = drv_get_tsf(local, sdata); rx_timestamp = drv_get_tsf(local, sdata);
} }
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
pr_debug("RX beacon SA=%pM BSSID=%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", mgmt->sa, mgmt->bssid,
mgmt->sa, mgmt->bssid, (unsigned long long)rx_timestamp,
(unsigned long long)rx_timestamp, (unsigned long long)beacon_timestamp,
(unsigned long long)beacon_timestamp, (unsigned long long)(rx_timestamp - beacon_timestamp),
(unsigned long long)(rx_timestamp - beacon_timestamp), jiffies);
jiffies);
#endif
if (beacon_timestamp > rx_timestamp) { if (beacon_timestamp > rx_timestamp) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n",
pr_debug("%s: beacon TSF higher than local TSF - IBSS merge with BSSID %pM\n", sdata->name, mgmt->bssid);
sdata->name, mgmt->bssid);
#endif
ieee80211_sta_join_ibss(sdata, bss); ieee80211_sta_join_ibss(sdata, bss);
supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL); supp_rates = ieee80211_sta_get_rates(local, elems, band, NULL);
ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 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,10 +707,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
lockdep_assert_held(&ifibss->mtx); lockdep_assert_held(&ifibss->mtx);
active_ibss = ieee80211_sta_active_ibss(sdata); active_ibss = ieee80211_sta_active_ibss(sdata);
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: sta_find_ibss (active_ibss=%d)\n",
pr_debug("%s: sta_find_ibss (active_ibss=%d)\n", sdata->name, active_ibss);
sdata->name, active_ibss);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
if (active_ibss) if (active_ibss)
return; return;
...@@ -743,11 +731,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) ...@@ -743,11 +731,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
struct ieee80211_bss *bss; struct ieee80211_bss *bss;
bss = (void *)cbss->priv; bss = (void *)cbss->priv;
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg(" sta_find_ibss: selected %pM current %pM\n",
pr_debug(" sta_find_ibss: selected %pM current %pM\n", cbss->bssid, ifibss->bssid);
cbss->bssid, ifibss->bssid);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n", pr_debug("%s: Selected IBSS BSSID %pM based on configured SSID\n",
sdata->name, cbss->bssid); sdata->name, cbss->bssid);
...@@ -756,9 +741,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) ...@@ -756,9 +741,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
return; return;
} }
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg(" did not try to join ibss\n");
pr_debug(" did not try to join ibss\n");
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
/* Selected IBSS not found in current scan results - try to scan */ /* Selected IBSS not found in current scan results - try to scan */
if (time_after(jiffies, ifibss->last_scan_completed + 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,11 +798,9 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
tx_last_beacon = drv_tx_last_beacon(local); tx_last_beacon = drv_tx_last_beacon(local);
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n",
pr_debug("%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM (tx_last_beacon=%d)\n", sdata->name, mgmt->sa, mgmt->da,
sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, tx_last_beacon);
mgmt->bssid, tx_last_beacon);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da))
return; return;
...@@ -832,10 +813,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, ...@@ -832,10 +813,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
pos = mgmt->u.probe_req.variable; pos = mgmt->u.probe_req.variable;
if (pos[0] != WLAN_EID_SSID || if (pos[0] != WLAN_EID_SSID ||
pos + 2 + pos[1] > end) { pos + 2 + pos[1] > end) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: Invalid SSID IE in ProbeReq from %pM\n",
pr_debug("%s: Invalid SSID IE in ProbeReq from %pM\n", sdata->name, mgmt->sa);
sdata->name, mgmt->sa);
#endif
return; return;
} }
if (pos[1] != 0 && if (pos[1] != 0 &&
...@@ -852,9 +831,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, ...@@ -852,9 +831,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
resp = (struct ieee80211_mgmt *) skb->data; resp = (struct ieee80211_mgmt *) skb->data;
memcpy(resp->da, mgmt->sa, ETH_ALEN); memcpy(resp->da, mgmt->sa, ETH_ALEN);
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da);
pr_debug("%s: Sending ProbeResp to %pM\n", sdata->name, resp->da);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
ieee80211_tx_skb(sdata, skb); ieee80211_tx_skb(sdata, skb);
} }
......
...@@ -887,10 +887,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, ...@@ -887,10 +887,8 @@ void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata,
continue; continue;
if (time_after(jiffies, sta->last_rx + exp_time)) { if (time_after(jiffies, sta->last_rx + exp_time)) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG ibss_vdbg("%s: expiring inactive STA %pM\n",
pr_debug("%s: expiring inactive STA %pM\n", sdata->name, sta->sta.addr);
sdata->name, sta->sta.addr);
#endif
WARN_ON(__sta_info_destroy(sta)); WARN_ON(__sta_info_destroy(sta));
} }
} }
......
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