Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Portions
0004  * Copyright (C) 2022 Intel Corporation
0005  */
0006 #ifndef __MAC80211_DEBUG_H
0007 #define __MAC80211_DEBUG_H
0008 #include <net/cfg80211.h>
0009 
0010 #ifdef CONFIG_MAC80211_OCB_DEBUG
0011 #define MAC80211_OCB_DEBUG 1
0012 #else
0013 #define MAC80211_OCB_DEBUG 0
0014 #endif
0015 
0016 #ifdef CONFIG_MAC80211_IBSS_DEBUG
0017 #define MAC80211_IBSS_DEBUG 1
0018 #else
0019 #define MAC80211_IBSS_DEBUG 0
0020 #endif
0021 
0022 #ifdef CONFIG_MAC80211_PS_DEBUG
0023 #define MAC80211_PS_DEBUG 1
0024 #else
0025 #define MAC80211_PS_DEBUG 0
0026 #endif
0027 
0028 #ifdef CONFIG_MAC80211_HT_DEBUG
0029 #define MAC80211_HT_DEBUG 1
0030 #else
0031 #define MAC80211_HT_DEBUG 0
0032 #endif
0033 
0034 #ifdef CONFIG_MAC80211_MPL_DEBUG
0035 #define MAC80211_MPL_DEBUG 1
0036 #else
0037 #define MAC80211_MPL_DEBUG 0
0038 #endif
0039 
0040 #ifdef CONFIG_MAC80211_MPATH_DEBUG
0041 #define MAC80211_MPATH_DEBUG 1
0042 #else
0043 #define MAC80211_MPATH_DEBUG 0
0044 #endif
0045 
0046 #ifdef CONFIG_MAC80211_MHWMP_DEBUG
0047 #define MAC80211_MHWMP_DEBUG 1
0048 #else
0049 #define MAC80211_MHWMP_DEBUG 0
0050 #endif
0051 
0052 #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
0053 #define MAC80211_MESH_SYNC_DEBUG 1
0054 #else
0055 #define MAC80211_MESH_SYNC_DEBUG 0
0056 #endif
0057 
0058 #ifdef CONFIG_MAC80211_MESH_CSA_DEBUG
0059 #define MAC80211_MESH_CSA_DEBUG 1
0060 #else
0061 #define MAC80211_MESH_CSA_DEBUG 0
0062 #endif
0063 
0064 #ifdef CONFIG_MAC80211_MESH_PS_DEBUG
0065 #define MAC80211_MESH_PS_DEBUG 1
0066 #else
0067 #define MAC80211_MESH_PS_DEBUG 0
0068 #endif
0069 
0070 #ifdef CONFIG_MAC80211_TDLS_DEBUG
0071 #define MAC80211_TDLS_DEBUG 1
0072 #else
0073 #define MAC80211_TDLS_DEBUG 0
0074 #endif
0075 
0076 #ifdef CONFIG_MAC80211_STA_DEBUG
0077 #define MAC80211_STA_DEBUG 1
0078 #else
0079 #define MAC80211_STA_DEBUG 0
0080 #endif
0081 
0082 #ifdef CONFIG_MAC80211_MLME_DEBUG
0083 #define MAC80211_MLME_DEBUG 1
0084 #else
0085 #define MAC80211_MLME_DEBUG 0
0086 #endif
0087 
0088 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
0089 void __sdata_info(const char *fmt, ...) __printf(1, 2);
0090 void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3);
0091 void __sdata_err(const char *fmt, ...) __printf(1, 2);
0092 void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
0093     __printf(3, 4);
0094 
0095 #define _sdata_info(sdata, fmt, ...)                    \
0096     __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
0097 #define _sdata_dbg(print, sdata, fmt, ...)              \
0098     __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__)
0099 #define _sdata_err(sdata, fmt, ...)                 \
0100     __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
0101 #define _wiphy_dbg(print, wiphy, fmt, ...)              \
0102     __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__)
0103 #else
0104 #define _sdata_info(sdata, fmt, ...)                    \
0105 do {                                    \
0106     pr_info("%s: " fmt,                     \
0107         (sdata)->name, ##__VA_ARGS__);              \
0108 } while (0)
0109 
0110 #define _sdata_dbg(print, sdata, fmt, ...)              \
0111 do {                                    \
0112     if (print)                          \
0113         pr_debug("%s: " fmt,                    \
0114              (sdata)->name, ##__VA_ARGS__);         \
0115 } while (0)
0116 
0117 #define _sdata_err(sdata, fmt, ...)                 \
0118 do {                                    \
0119     pr_err("%s: " fmt,                      \
0120            (sdata)->name, ##__VA_ARGS__);               \
0121 } while (0)
0122 
0123 #define _wiphy_dbg(print, wiphy, fmt, ...)              \
0124 do {                                    \
0125     if (print)                          \
0126         wiphy_dbg((wiphy), fmt, ##__VA_ARGS__);         \
0127 } while (0)
0128 #endif
0129 
0130 #define sdata_info(sdata, fmt, ...)                 \
0131     _sdata_info(sdata, fmt, ##__VA_ARGS__)
0132 #define sdata_err(sdata, fmt, ...)                  \
0133     _sdata_err(sdata, fmt, ##__VA_ARGS__)
0134 #define sdata_dbg(sdata, fmt, ...)                  \
0135     _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
0136 
0137 #define link_info(link, fmt, ...)                   \
0138     do {                                \
0139         if ((link)->sdata->vif.valid_links)         \
0140             _sdata_info((link)->sdata, "[link %d] " fmt,    \
0141                     (link)->link_id,            \
0142                     ##__VA_ARGS__);         \
0143         else                            \
0144             _sdata_info((link)->sdata, fmt, ##__VA_ARGS__); \
0145     } while (0)
0146 #define link_err(link, fmt, ...)                    \
0147     do {                                \
0148         if ((link)->sdata->vif.valid_links)         \
0149             _sdata_err((link)->sdata, "[link %d] " fmt, \
0150                    (link)->link_id,         \
0151                    ##__VA_ARGS__);          \
0152         else                            \
0153             _sdata_err((link)->sdata, fmt, ##__VA_ARGS__);  \
0154     } while (0)
0155 #define link_dbg(link, fmt, ...)                    \
0156     do {                                \
0157         if ((link)->sdata->vif.valid_links)         \
0158             _sdata_dbg(1, (link)->sdata, "[link %d] " fmt,  \
0159                    (link)->link_id,         \
0160                    ##__VA_ARGS__);          \
0161         else                            \
0162             _sdata_dbg(1, (link)->sdata, fmt,       \
0163                    ##__VA_ARGS__);          \
0164     } while (0)
0165 
0166 #define ht_dbg(sdata, fmt, ...)                     \
0167     _sdata_dbg(MAC80211_HT_DEBUG,                   \
0168            sdata, fmt, ##__VA_ARGS__)
0169 
0170 #define ht_dbg_ratelimited(sdata, fmt, ...)             \
0171     _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(),        \
0172            sdata, fmt, ##__VA_ARGS__)
0173 
0174 #define ocb_dbg(sdata, fmt, ...)                    \
0175     _sdata_dbg(MAC80211_OCB_DEBUG,                  \
0176            sdata, fmt, ##__VA_ARGS__)
0177 
0178 #define ibss_dbg(sdata, fmt, ...)                   \
0179     _sdata_dbg(MAC80211_IBSS_DEBUG,                 \
0180            sdata, fmt, ##__VA_ARGS__)
0181 
0182 #define ps_dbg(sdata, fmt, ...)                     \
0183     _sdata_dbg(MAC80211_PS_DEBUG,                   \
0184            sdata, fmt, ##__VA_ARGS__)
0185 
0186 #define ps_dbg_hw(hw, fmt, ...)                     \
0187     _wiphy_dbg(MAC80211_PS_DEBUG,                   \
0188            (hw)->wiphy, fmt, ##__VA_ARGS__)
0189 
0190 #define ps_dbg_ratelimited(sdata, fmt, ...)             \
0191     _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(),        \
0192            sdata, fmt, ##__VA_ARGS__)
0193 
0194 #define mpl_dbg(sdata, fmt, ...)                    \
0195     _sdata_dbg(MAC80211_MPL_DEBUG,                  \
0196            sdata, fmt, ##__VA_ARGS__)
0197 
0198 #define mpath_dbg(sdata, fmt, ...)                  \
0199     _sdata_dbg(MAC80211_MPATH_DEBUG,                \
0200            sdata, fmt, ##__VA_ARGS__)
0201 
0202 #define mhwmp_dbg(sdata, fmt, ...)                  \
0203     _sdata_dbg(MAC80211_MHWMP_DEBUG,                \
0204            sdata, fmt, ##__VA_ARGS__)
0205 
0206 #define msync_dbg(sdata, fmt, ...)                  \
0207     _sdata_dbg(MAC80211_MESH_SYNC_DEBUG,                \
0208            sdata, fmt, ##__VA_ARGS__)
0209 
0210 #define mcsa_dbg(sdata, fmt, ...)                   \
0211     _sdata_dbg(MAC80211_MESH_CSA_DEBUG,             \
0212            sdata, fmt, ##__VA_ARGS__)
0213 
0214 #define mps_dbg(sdata, fmt, ...)                    \
0215     _sdata_dbg(MAC80211_MESH_PS_DEBUG,              \
0216            sdata, fmt, ##__VA_ARGS__)
0217 
0218 #define tdls_dbg(sdata, fmt, ...)                   \
0219     _sdata_dbg(MAC80211_TDLS_DEBUG,                 \
0220            sdata, fmt, ##__VA_ARGS__)
0221 
0222 #define sta_dbg(sdata, fmt, ...)                    \
0223     _sdata_dbg(MAC80211_STA_DEBUG,                  \
0224            sdata, fmt, ##__VA_ARGS__)
0225 
0226 #define mlme_dbg(sdata, fmt, ...)                   \
0227     _sdata_dbg(MAC80211_MLME_DEBUG,                 \
0228            sdata, fmt, ##__VA_ARGS__)
0229 
0230 #define mlme_dbg_ratelimited(sdata, fmt, ...)               \
0231     _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(),      \
0232            sdata, fmt, ##__VA_ARGS__)
0233 
0234 #endif /* __MAC80211_DEBUG_H */