if_ath_debug.h revision 238364
1109320Ssam/*-
2109320Ssam * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
3116953Ssam * All rights reserved.
4109320Ssam *
5109320Ssam * Redistribution and use in source and binary forms, with or without
6195383Ssam * modification, are permitted provided that the following conditions
7195383Ssam * are met:
8138573Ssam * 1. Redistributions of source code must retain the above copyright
9178354Ssam *    notice, this list of conditions and the following disclaimer,
10178354Ssam *    without modification.
11192571Ssam * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12178354Ssam *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13183055Ssam *    redistribution must be conditioned upon including a substantially
14194330Sweongyo *    similar Disclaimer requirement for further binary redistribution.
15194330Sweongyo *
16109320Ssam * NO WARRANTY
17151350Syar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18178354Ssam * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19182668Simp * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20182668Simp * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21109320Ssam * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22182668Simp * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23128091Skan * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24182668Simp * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25183055Ssam * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26183055Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27183055Ssam * THE POSSIBILITY OF SUCH DAMAGES.
28151350Syar *
29128091Skan * $FreeBSD: head/sys/dev/ath/if_ath_debug.h 238364 2012-07-11 12:10:13Z jhb $
30109320Ssam */
31#ifndef	__IF_ATH_DEBUG_H__
32#define	__IF_ATH_DEBUG_H__
33
34#ifdef	ATH_DEBUG
35
36enum {
37	ATH_DEBUG_XMIT		= 0x000000001ULL,	/* basic xmit operation */
38	ATH_DEBUG_XMIT_DESC	= 0x000000002ULL,	/* xmit descriptors */
39	ATH_DEBUG_RECV		= 0x000000004ULL,	/* basic recv operation */
40	ATH_DEBUG_RECV_DESC	= 0x000000008ULL,	/* recv descriptors */
41	ATH_DEBUG_RATE		= 0x000000010ULL,	/* rate control */
42	ATH_DEBUG_RESET		= 0x000000020ULL,	/* reset processing */
43	ATH_DEBUG_MODE		= 0x000000040ULL,	/* mode init/setup */
44	ATH_DEBUG_BEACON	= 0x000000080ULL,	/* beacon handling */
45	ATH_DEBUG_WATCHDOG	= 0x000000100ULL,	/* watchdog timeout */
46	ATH_DEBUG_INTR		= 0x000001000ULL,	/* ISR */
47	ATH_DEBUG_TX_PROC	= 0x000002000ULL,	/* tx ISR proc */
48	ATH_DEBUG_RX_PROC	= 0x000004000ULL,	/* rx ISR proc */
49	ATH_DEBUG_BEACON_PROC	= 0x000008000ULL,	/* beacon ISR proc */
50	ATH_DEBUG_CALIBRATE	= 0x000010000ULL,	/* periodic calibration */
51	ATH_DEBUG_KEYCACHE	= 0x000020000ULL,	/* key cache management */
52	ATH_DEBUG_STATE		= 0x000040000ULL,	/* 802.11 state transitions */
53	ATH_DEBUG_NODE		= 0x000080000ULL,	/* node management */
54	ATH_DEBUG_LED		= 0x000100000ULL,	/* led management */
55	ATH_DEBUG_FF		= 0x000200000ULL,	/* fast frames */
56	ATH_DEBUG_DFS		= 0x000400000ULL,	/* DFS processing */
57	ATH_DEBUG_TDMA		= 0x000800000ULL,	/* TDMA processing */
58	ATH_DEBUG_TDMA_TIMER	= 0x001000000ULL,	/* TDMA timer processing */
59	ATH_DEBUG_REGDOMAIN	= 0x002000000ULL,	/* regulatory processing */
60	ATH_DEBUG_SW_TX		= 0x004000000ULL,	/* per-packet software TX */
61	ATH_DEBUG_SW_TX_BAW	= 0x008000000ULL,	/* BAW handling */
62	ATH_DEBUG_SW_TX_CTRL	= 0x010000000ULL,	/* queue control */
63	ATH_DEBUG_SW_TX_AGGR	= 0x020000000ULL,	/* aggregate TX */
64	ATH_DEBUG_SW_TX_RETRIES	= 0x040000000ULL,	/* software TX retries */
65	ATH_DEBUG_FATAL		= 0x080000000ULL,	/* fatal errors */
66	ATH_DEBUG_SW_TX_BAR	= 0x100000000ULL,	/* BAR TX */
67	ATH_DEBUG_EDMA_RX	= 0x200000000ULL,	/* RX EDMA state */
68
69	ATH_DEBUG_ANY		= 0xffffffffffffffffULL
70};
71
72#define	ATH_KTR_INTR	KTR_SPARE4
73#define	ATH_KTR_ERR	KTR_SPARE3
74
75extern uint64_t ath_debug;
76
77#define	IFF_DUMPPKTS(sc, m) \
78	((sc->sc_debug & (m)) || \
79	    (sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2))
80#define	DPRINTF(sc, m, fmt, ...) do {				\
81	if (sc->sc_debug & (m))					\
82		device_printf(sc->sc_dev, fmt, __VA_ARGS__);		\
83} while (0)
84#define	KEYPRINTF(sc, ix, hk, mac) do {				\
85	if (sc->sc_debug & ATH_DEBUG_KEYCACHE)			\
86		ath_keyprint(sc, __func__, ix, hk, mac);	\
87} while (0)
88
89extern	void ath_printrxbuf(struct ath_softc *, const struct ath_buf *bf,
90	u_int ix, int);
91extern	void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf,
92	u_int qnum, u_int ix, int done);
93#else	/* ATH_DEBUG */
94#define	ATH_KTR_INTR	0
95#define	ATH_KTR_ERR	0
96
97#define	IFF_DUMPPKTS(sc, m) \
98	((sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2))
99#define	DPRINTF(sc, m, fmt, ...) do {				\
100	(void) sc;						\
101} while (0)
102#define	KEYPRINTF(sc, k, ix, mac) do {				\
103	(void) sc;						\
104} while (0)
105#endif	/* ATH_DEBUG */
106
107#endif
108