linux-stable/net/mac80211/debug.h
Johannes Berg bdcbd8e0e3 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>
2012-06-24 11:32:29 +02:00

152 lines
3.6 KiB
C

#ifndef __MAC80211_DEBUG_H
#define __MAC80211_DEBUG_H
#ifdef CONFIG_MAC80211_IBSS_DEBUG
#define MAC80211_IBSS_DEBUG 1
#else
#define MAC80211_IBSS_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_PS_DEBUG
#define MAC80211_PS_DEBUG 1
#else
#define MAC80211_PS_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_HT_DEBUG
#define MAC80211_HT_DEBUG 1
#else
#define MAC80211_HT_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_MPL_DEBUG
#define MAC80211_MPL_DEBUG 1
#else
#define MAC80211_MPL_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_MPATH_DEBUG
#define MAC80211_MPATH_DEBUG 1
#else
#define MAC80211_MPATH_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_MHWMP_DEBUG
#define MAC80211_MHWMP_DEBUG 1
#else
#define MAC80211_MHWMP_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
#define MAC80211_MESH_SYNC_DEBUG 1
#else
#define MAC80211_MESH_SYNC_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_TDLS_DEBUG
#define MAC80211_TDLS_DEBUG 1
#else
#define MAC80211_TDLS_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_STA_DEBUG
#define MAC80211_STA_DEBUG 1
#else
#define MAC80211_STA_DEBUG 0
#endif
#ifdef CONFIG_MAC80211_MLME_DEBUG
#define MAC80211_MLME_DEBUG 1
#else
#define MAC80211_MLME_DEBUG 0
#endif
#define _sdata_info(sdata, fmt, ...) \
do { \
pr_info("%s: " fmt, \
(sdata)->name, ##__VA_ARGS__); \
} while (0)
#define _sdata_dbg(print, sdata, fmt, ...) \
do { \
if (print) \
pr_debug("%s: " fmt, \
(sdata)->name, ##__VA_ARGS__); \
} while (0)
#define _sdata_err(sdata, fmt, ...) \
do { \
pr_err("%s: " fmt, \
(sdata)->name, ##__VA_ARGS__); \
} while (0)
#define _wiphy_dbg(print, wiphy, fmt, ...) \
do { \
if (print) \
wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \
} while (0)
#define sdata_info(sdata, fmt, ...) \
_sdata_info(sdata, fmt, ##__VA_ARGS__)
#define sdata_err(sdata, fmt, ...) \
_sdata_err(sdata, fmt, ##__VA_ARGS__)
#define sdata_dbg(sdata, fmt, ...) \
_sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
#define ht_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_HT_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define ht_dbg_ratelimited(sdata, fmt, ...) \
_sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \
sdata, fmt, ##__VA_ARGS__)
#define ibss_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_IBSS_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define ps_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_PS_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define ps_dbg_hw(hw, fmt, ...) \
_wiphy_dbg(MAC80211_PS_DEBUG, \
(hw)->wiphy, fmt, ##__VA_ARGS__)
#define ps_dbg_ratelimited(sdata, fmt, ...) \
_sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \
sdata, fmt, ##__VA_ARGS__)
#define mpl_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MPL_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define mpath_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MPATH_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define mhwmp_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MHWMP_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define msync_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define tdls_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_TDLS_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define sta_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_STA_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define mlme_dbg(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MLME_DEBUG, \
sdata, fmt, ##__VA_ARGS__)
#define mlme_dbg_ratelimited(sdata, fmt, ...) \
_sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \
sdata, fmt, ##__VA_ARGS__)
#endif /* __MAC80211_DEBUG_H */