Support for setting default VAP debug flags at module load time, so you can

catch messages that occur during VAP startup (before you can possibly invoke 
80211debug).

Support for shared debug flags where they take effect across all devices
(i.e. shared flags in athdebug), and when they take effect across all VAPs
(i.e. shared flags in 80211debug).

Some additional debugging flags, including some in preparation for more leak 
detection code to be merged shortly as well as some from madwifi-dfs.



git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@2888 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
mtaylor 2007-11-21 10:45:58 +00:00
parent 3511ea0ea9
commit 76ef1fd56b
8 changed files with 95 additions and 27 deletions

View File

@ -66,8 +66,10 @@
#include "if_media.h"
#include "if_llc.h"
#include <net80211/ieee80211_radiotap.h>
#define AR_DEBUG
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_radiotap.h>
#include <net80211/ieee80211_monitor.h>
#include <net80211/ieee80211_rate.h>
@ -75,8 +77,6 @@
#include <net80211/if_llc.h>
#endif
#define AR_DEBUG
#include "net80211/if_athproto.h"
#include "if_athvar.h"
@ -341,12 +341,24 @@ MODULE_PARM(ath_debug, "i");
#else
module_param(ath_debug, int, 0600);
#endif
MODULE_PARM_DESC(ath_debug, "Load-time debug output enable");
MODULE_PARM_DESC(ath_debug, "Load-time driver debug output enable");
static int ieee80211_debug = 0;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,52))
MODULE_PARM(ieee80211_debug, "i");
#else
module_param(ieee80211_debug, int, 0600);
#endif
MODULE_PARM_DESC(ieee80211_debug, "Load-time 802.11 debug output enable");
#define IFF_DUMPPKTS(sc, _m) \
((sc->sc_debug & _m))
static void ath_printrxbuf(const struct ath_buf *, int);
static void ath_printtxbuf(const struct ath_buf *, int);
#define DFLAG_ISSET(sc, _m) \
(((sc->sc_debug | ath_debug_global) & _m))
#define IFF_DUMPPKTS(sc, _m) \
DFLAG_ISSET(sc, (_m))
enum {
ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */
ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */
@ -370,15 +382,23 @@ enum {
ATH_DEBUG_TURBO = 0x00400000, /* turbo/dynamic turbo */
ATH_DEBUG_UAPSD = 0x00800000, /* uapsd */
ATH_DEBUG_DOTH = 0x01000000, /* 11.h */
ATH_DEBUG_DOTHFILT = 0x02000000, /* 11.h radar pulse filter algorithm */
ATH_DEBUG_DOTHFILTVBSE = 0x04000000, /* 11.h radar pulse filter algorithm - pulse level debug */
ATH_DEBUG_DOTHFILTNOSC = 0x08000000, /* 11.h radar pulse filter algorithm - disable short circuit of processing after detection */
ATH_DEBUG_DOTHPULSES = 0x10000000, /* 11.h radar pulse events */
ATH_DEBUG_TXBUF = 0x20000000, /* TX buffer usage/leak debugging */
ATH_DEBUG_SKB = 0x40000000, /* SKB usage/leak debugging [applies to all vaps] */
ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */
ATH_DEBUG_ANY = 0xffffffff
ATH_DEBUG_ANY = 0xffffffff,
ATH_DEBUG_GLOBAL = (ATH_DEBUG_SKB)
};
#define DPRINTF(sc, _m, _fmt, ...) do { \
if (sc->sc_debug & (_m)) \
printk(_fmt, __VA_ARGS__); \
#define DPRINTF(sc, _m, _fmt, ...) do { \
if (DFLAG_ISSET(sc, (_m))) { \
printk("%s: " _fmt, DEV_NAME(sc->sc_dev), __VA_ARGS__); \
} \
} while (0)
#define KEYPRINTF(sc, ix, hk, mac) do { \
if (sc->sc_debug & ATH_DEBUG_KEYCACHE) \
if (DFLAG_ISSET(sc, ATH_DEBUG_KEYCACHE)) \
ath_keyprint(sc, __func__, ix, hk, mac); \
} while (0)
#else /* defined(AR_DEBUG) */
@ -404,7 +424,7 @@ enum {
* Define the scheme that we select MAC address for multiple BSS on the same radio.
* The very first VAP will just use the MAC address from the EEPROM.
* For the next 3 VAPs, we set the U/L bit (bit 1) in MAC address,
* and use the next two bits as the index of the VAP.
* and use the higher bits as the index of the VAP.
*/
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
#define ATH_GET_VAP_ID(bssid) ((bssid)[0] >> 2)
@ -428,7 +448,8 @@ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
u_int8_t csz;
sc->devid = devid;
sc->sc_debug = ath_debug;
ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
sc->sc_debug = (ath_debug & ~ATH_DEBUG_GLOBAL);
DPRINTF(sc, ATH_DEBUG_ANY, "%s: devid 0x%x\n", __func__, devid);
/*
@ -713,6 +734,7 @@ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
ic->ic_reset = ath_reset;
ic->ic_newassoc = ath_newassoc;
ic->ic_updateslot = ath_updateslot;
ic->ic_debug = 0;
ic->ic_wme.wme_update = ath_wme_update;
ic->ic_uapsd_flush = ath_uapsd_flush;
@ -1120,6 +1142,24 @@ ath_vap_create(struct ieee80211com *ic, const char *name,
vap->iv_key_set = ath_key_set;
vap->iv_key_update_begin = ath_key_update_begin;
vap->iv_key_update_end = ath_key_update_end;
if(sc->sc_default_ieee80211_debug) {
/* User specified defaults for new VAPs were provided, so
* use those (only). */
vap->iv_debug = (sc->sc_default_ieee80211_debug & ~IEEE80211_MSG_IC);
}
else {
/* MT: If no default VAP debug flags are passed, allow a few to
* transfer down from the driver to new VAPs so we can have load
* time debugging for VAPs too. */
vap->iv_debug = 0 |
((sc->sc_debug & ATH_DEBUG_RATE) ? IEEE80211_MSG_XRATE : 0) |
((sc->sc_debug & ATH_DEBUG_XMIT) ? IEEE80211_MSG_OUTPUT : 0) |
((sc->sc_debug & ATH_DEBUG_RECV) ? IEEE80211_MSG_INPUT : 0) |
0
;
}
ic->ic_debug = (sc->sc_default_ieee80211_debug & IEEE80211_MSG_IC);
#ifdef ATH_SUPERG_COMP
vap->iv_comp_set = ath_comp_set;
#endif
@ -9559,7 +9599,8 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
sc->sc_ledpin = val;
break;
case ATH_DEBUG:
sc->sc_debug = val;
sc->sc_debug = (val & ~ATH_DEBUG_GLOBAL);
ath_debug_global = (val & ATH_DEBUG_GLOBAL);
break;
case ATH_TXANTENNA:
/*
@ -9660,7 +9701,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
ath_hal_getregdomain(ah, &val);
break;
case ATH_DEBUG:
val = sc->sc_debug;
val = sc->sc_debug | ath_debug_global;
break;
case ATH_TXANTENNA:
val = sc->sc_txantenna;
@ -9865,7 +9906,9 @@ ath_dynamic_sysctl_register(struct ath_softc *sc)
}
/* initialize values */
sc->sc_debug = ath_debug;
ath_debug_global = (ath_debug & ATH_DEBUG_GLOBAL);
sc->sc_debug = (ath_debug & ~ATH_DEBUG_GLOBAL);
sc->sc_default_ieee80211_debug = ieee80211_debug;
sc->sc_txantenna = 0; /* default to auto-selection */
sc->sc_txintrperiod = ATH_TXQ_INTR_PERIOD;
}

View File

@ -547,6 +547,7 @@ struct ath_softc {
struct ath_stats sc_stats; /* private statistics */
int devid;
int sc_debug;
int sc_default_ieee80211_debug; /* default debug flags for new VAPs */
void (*sc_recv_mgmt)(struct ieee80211_node *, struct sk_buff *, int, int, u_int64_t);
void (*sc_node_cleanup)(struct ieee80211_node *);
void (*sc_node_free)(struct ieee80211_node *);

View File

@ -37,13 +37,21 @@
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211.h>
/* Set to true if ANY sc has skb debugging on */
extern int ath_debug_global;
enum {
GLOBAL_DEBUG_SKB = 0x40000000, /* SKB usage/leak debugging,
must match ATH_DEBUG_SKB */
};
#define IEEE80211_MSG_NODE_REF 0x80000000 /* node ref counting */
#define IEEE80211_MSG_DEBUG 0x40000000 /* IFF_DEBUG equivalent */
#define IEEE80211_MSG_DUMPPKTS 0x20000000 /* IFF_LINK2 equivalent */
#define IEEE80211_MSG_CRYPTO 0x10000000 /* crypto work */
#define IEEE80211_MSG_INPUT 0x08000000 /* input handling */
#define IEEE80211_MSG_XRATE 0x04000000 /* rate set handling */
#define IEEE80211_MSG_ELEMID 0x02000000 /* element id parsing */
#define IEEE80211_MSG_NODE 0x01000000 /* node handling */
#define IEEE80211_MSG_NODE 0x01000000 /* node management */
#define IEEE80211_MSG_ASSOC 0x00800000 /* association handling */
#define IEEE80211_MSG_AUTH 0x00400000 /* authentication handling */
#define IEEE80211_MSG_SCAN 0x00200000 /* scanning */
@ -65,8 +73,11 @@
#define IEEE80211_MSG_ANY 0xffffffff /* anything */
#define IEEE80211_MSG_IC (IEEE80211_MSG_NODE_REF) /* shared for all VAP */
#ifdef IEEE80211_DEBUG
#define ieee80211_msg_is_reported(_vap, m) (!!((_vap)->iv_debug & (m)))
#define ieee80211_msg_is_reported(_vap, m) \
(!!(((_vap)->iv_debug) & (m)))
#define IEEE80211_DPRINTF(_vap, _m, _fmt, ...) do { \
if (ieee80211_msg_is_reported(_vap, _m)) \
ieee80211_note(_vap, _fmt, __VA_ARGS__); \

View File

@ -538,10 +538,13 @@ IEEE80211_SYSCTL_DECL(ieee80211_sysctl_debug, ctl, write, filp, buffer,
if (write) {
ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer,
lenp, ppos);
if (ret == 0)
vap->iv_debug = val;
if (ret == 0) {
vap->iv_debug = (val & ~IEEE80211_MSG_IC);
vap->iv_ic->ic_debug = (val & IEEE80211_MSG_IC);
}
} else {
val = vap->iv_debug;
/* VAP specific and 'global' debug flags */
val = vap->iv_debug | vap->iv_ic->ic_debug;
ret = IEEE80211_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer,
lenp, ppos);
}

View File

@ -363,6 +363,8 @@ struct ieee80211com {
u_int8_t ic_chanchange_tbtt;
u_int8_t ic_chanchange_chan;
/* Global debug flags applicable to all VAPs */
int ic_debug;
/* Virtual AP create/delete */
struct ieee80211vap *(*ic_vap_create)(struct ieee80211com *,
const char *, int, int, struct net_device *);
@ -417,6 +419,7 @@ struct ieee80211com {
#endif /* #ifdef ATH_REVERSE_ENGINEERING */
};
#define MAX_PROC_IEEE80211_SIZE 16383
#define PROC_IEEE80211_PERM 0644

View File

@ -68,15 +68,15 @@ struct athl2p_tunnel_hdr {
* Offset of 8B into cb[] is used to preserve vlan tag info.
*/
#define ATH_FF_MAGIC_PUT(_skb) \
(((struct ieee80211_cb *) (_skb)->cb)->flags |= M_FF)
(SKB_CB(_skb)->flags |= M_FF)
#define ATH_FF_MAGIC_CLR(_skb) \
(((struct ieee80211_cb *) (_skb)->cb)->flags &= ~M_FF)
(SKB_CB(_skb)->flags &= ~M_FF)
#define ATH_FF_MAGIC_PRESENT(_skb) \
((((struct ieee80211_cb *) (_skb)->cb)->flags & M_FF) != 0)
((SKB_CB(_skb)->flags & M_FF) != 0)
#define ATH_FF_NEXTSKB_PUT(_skb, _next) \
(((struct ieee80211_cb *) (_skb)->cb)->next = _next)
(SKB_CB(_skb)->next = _next)
#define ATH_FF_NEXTSKB_GET(_skb) \
(((struct ieee80211_cb *) (_skb)->cb)->next)
(SKB_CB(_skb)->next)
/*
* default value for the minimum txq depth required for an ath_buf to be

View File

@ -54,6 +54,7 @@
static const char *progname;
enum {
IEEE80211_MSG_NODE_REF = 0x80000000, /* node reference counting */
IEEE80211_MSG_DEBUG = 0x40000000, /* IFF_DEBUG equivalent */
IEEE80211_MSG_DUMPPKTS = 0x20000000, /* IFF_LINK2 equivalent, dump packets */
IEEE80211_MSG_CRYPTO = 0x10000000, /* crypto modules */
@ -79,7 +80,8 @@ enum {
IEEE80211_MSG_DOTH = 0x00000100, /* 11.h */
IEEE80211_MSG_INACT = 0x00000080, /* inactivity handling */
IEEE80211_MSG_ROAM = 0x00000040, /* sta-mode roaming */
IEEE80211_MSG_ANY = 0xffffffff
IEEE80211_MSG_ANY = 0xffffffff,
IEEE80211_MSG_IC = (IEEE80211_MSG_NODE_REF)
};
static struct {
@ -87,6 +89,7 @@ static struct {
u_int bit;
const char *desc;
} flags[] = {
{ "node_ref", IEEE80211_MSG_NODE_REF, "node ref counting (affects all devs)" },
{ "debug", IEEE80211_MSG_DEBUG, "IFF_DEBUG equivalent" },
{ "dumppkts", IEEE80211_MSG_DUMPPKTS, "dump packets" },
{ "crypto", IEEE80211_MSG_CRYPTO, "crypto modules" },

View File

@ -83,6 +83,8 @@ enum {
ATH_DEBUG_DOTHFILTVBSE = 0x04000000, /* 11.h radar pulse analysis - verbose */
ATH_DEBUG_DOTHFILTNOSC = 0x08000000, /* 11.h radar pulse analysis - don't short circuit analysis when detected */
ATH_DEBUG_DOTHPULSES = 0x10000000, /* 11.h radar pulse events */
ATH_DEBUG_TXBUF = 0x20000000, /* TX buffer usage/leak debugging */
ATH_DEBUG_SKB = 0x40000000, /* SKB usage/leak debugging [applies to all vaps] */
ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */
ATH_DEBUG_ANY = 0xffffffff
};
@ -109,6 +111,8 @@ static struct {
{ "keycache", ATH_DEBUG_KEYCACHE, "key cache management" },
{ "state", ATH_DEBUG_STATE, "802.11 state transitions" },
{ "node", ATH_DEBUG_NODE, "node management" },
{ "txbuf", ATH_DEBUG_TXBUF, "ath_buf management" },
{ "skb", ATH_DEBUG_SKB, "skb management (affects all devs)" },
{ "led", ATH_DEBUG_LED, "led management" },
{ "ff", ATH_DEBUG_FF, "fast frame handling" },
{ "turbo", ATH_DEBUG_TURBO, "dynamic turbo handling" },