if_ath_debug.h revision 296373
160786Sps/*-
260786Sps * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting
360786Sps * All rights reserved.
460786Sps *
560786Sps * Redistribution and use in source and binary forms, with or without
660786Sps * modification, are permitted provided that the following conditions
760786Sps * are met:
860786Sps * 1. Redistributions of source code must retain the above copyright
960786Sps *    notice, this list of conditions and the following disclaimer,
1060786Sps *    without modification.
1160786Sps * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1260786Sps *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
1360786Sps *    redistribution must be conditioned upon including a substantially
1460786Sps *    similar Disclaimer requirement for further binary redistribution.
1560786Sps *
1660786Sps * NO WARRANTY
1760786Sps * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1860786Sps * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1960786Sps * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
2060786Sps * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2160786Sps * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
2260786Sps * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2360786Sps * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2460786Sps * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2560786Sps * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2660786Sps * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
2760786Sps * THE POSSIBILITY OF SUCH DAMAGES.
2860786Sps *
2960786Sps * $FreeBSD: releng/10.3/sys/dev/ath/if_ath_debug.h 251655 2013-06-12 14:52:57Z adrian $
3060786Sps */
3160786Sps#ifndef	__IF_ATH_DEBUG_H__
3260786Sps#define	__IF_ATH_DEBUG_H__
3360786Sps
3460786Sps#ifdef	ATH_DEBUG
3560786Sps
3660786Spsenum {
3760786Sps	ATH_DEBUG_XMIT		= 0x000000001ULL,	/* basic xmit operation */
3860786Sps	ATH_DEBUG_XMIT_DESC	= 0x000000002ULL,	/* xmit descriptors */
3960786Sps	ATH_DEBUG_RECV		= 0x000000004ULL,	/* basic recv operation */
4060786Sps	ATH_DEBUG_RECV_DESC	= 0x000000008ULL,	/* recv descriptors */
4160786Sps	ATH_DEBUG_RATE		= 0x000000010ULL,	/* rate control */
4260786Sps	ATH_DEBUG_RESET		= 0x000000020ULL,	/* reset processing */
4360786Sps	ATH_DEBUG_MODE		= 0x000000040ULL,	/* mode init/setup */
4460786Sps	ATH_DEBUG_BEACON	= 0x000000080ULL,	/* beacon handling */
4560786Sps	ATH_DEBUG_WATCHDOG	= 0x000000100ULL,	/* watchdog timeout */
4660786Sps	ATH_DEBUG_INTR		= 0x000001000ULL,	/* ISR */
4760786Sps	ATH_DEBUG_TX_PROC	= 0x000002000ULL,	/* tx ISR proc */
4860786Sps	ATH_DEBUG_RX_PROC	= 0x000004000ULL,	/* rx ISR proc */
4960786Sps	ATH_DEBUG_BEACON_PROC	= 0x000008000ULL,	/* beacon ISR proc */
5060786Sps	ATH_DEBUG_CALIBRATE	= 0x000010000ULL,	/* periodic calibration */
5160786Sps	ATH_DEBUG_KEYCACHE	= 0x000020000ULL,	/* key cache management */
5260786Sps	ATH_DEBUG_STATE		= 0x000040000ULL,	/* 802.11 state transitions */
5360786Sps	ATH_DEBUG_NODE		= 0x000080000ULL,	/* node management */
5460786Sps	ATH_DEBUG_LED		= 0x000100000ULL,	/* led management */
5560786Sps	ATH_DEBUG_FF		= 0x000200000ULL,	/* fast frames */
5660786Sps	ATH_DEBUG_DFS		= 0x000400000ULL,	/* DFS processing */
5760786Sps	ATH_DEBUG_TDMA		= 0x000800000ULL,	/* TDMA processing */
5860786Sps	ATH_DEBUG_TDMA_TIMER	= 0x001000000ULL,	/* TDMA timer processing */
5960786Sps	ATH_DEBUG_REGDOMAIN	= 0x002000000ULL,	/* regulatory processing */
6060786Sps	ATH_DEBUG_SW_TX		= 0x004000000ULL,	/* per-packet software TX */
6160786Sps	ATH_DEBUG_SW_TX_BAW	= 0x008000000ULL,	/* BAW handling */
6260786Sps	ATH_DEBUG_SW_TX_CTRL	= 0x010000000ULL,	/* queue control */
6360786Sps	ATH_DEBUG_SW_TX_AGGR	= 0x020000000ULL,	/* aggregate TX */
6460786Sps	ATH_DEBUG_SW_TX_RETRIES	= 0x040000000ULL,	/* software TX retries */
6560786Sps	ATH_DEBUG_FATAL		= 0x080000000ULL,	/* fatal errors */
6689019Sps	ATH_DEBUG_SW_TX_BAR	= 0x100000000ULL,	/* BAR TX */
6789019Sps	ATH_DEBUG_EDMA_RX	= 0x200000000ULL,	/* RX EDMA state */
6860786Sps	ATH_DEBUG_SW_TX_FILT	= 0x400000000ULL,	/* SW TX FF */
6960786Sps	ATH_DEBUG_NODE_PWRSAVE	= 0x800000000ULL,	/* node powersave */
7060786Sps	ATH_DEBUG_DIVERSITY	= 0x1000000000ULL,	/* Diversity logic */
7160786Sps
7260786Sps	ATH_DEBUG_ANY		= 0xffffffffffffffffULL
7360786Sps};
7460786Sps
7560786Spsenum {
7660786Sps	ATH_KTR_RXPROC		= 0x00000001,
7760786Sps	ATH_KTR_TXPROC		= 0x00000002,
7860786Sps	ATH_KTR_TXCOMP		= 0x00000004,
7960786Sps	ATH_KTR_SWQ		= 0x00000008,
8060786Sps	ATH_KTR_INTERRUPTS	= 0x00000010,
8160786Sps	ATH_KTR_ERROR		= 0x00000020,
8260786Sps	ATH_KTR_NODE		= 0x00000040,
8360786Sps	ATH_KTR_TX		= 0x00000080,
8460786Sps};
8560786Sps
8660786Sps#define	ATH_KTR(_sc, _km, _kf, ...)	do {	\
8760786Sps	if (sc->sc_ktrdebug & (_km))		\
8860786Sps		CTR##_kf(KTR_DEV, __VA_ARGS__);	\
8960786Sps	} while (0)
9060786Sps
9160786Spsextern uint64_t ath_debug;
9260786Sps
9360786Sps#define	IFF_DUMPPKTS(sc, m) \
9460786Sps	((sc->sc_debug & (m)) || \
9560786Sps	    (sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2))
9660786Sps#define	DPRINTF(sc, m, fmt, ...) do {				\
9760786Sps	if (sc->sc_debug & (m))					\
9860786Sps		device_printf(sc->sc_dev, fmt, __VA_ARGS__);		\
9960786Sps} while (0)
10060786Sps#define	KEYPRINTF(sc, ix, hk, mac) do {				\
10160786Sps	if (sc->sc_debug & ATH_DEBUG_KEYCACHE)			\
10260786Sps		ath_keyprint(sc, __func__, ix, hk, mac);	\
10360786Sps} while (0)
10460786Sps
10560786Spsextern	void ath_printrxbuf(struct ath_softc *, const struct ath_buf *bf,
10660786Sps	u_int ix, int);
10760786Spsextern	void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf,
10889019Sps	u_int qnum, u_int ix, int done);
10960786Spsextern	void ath_printtxstatbuf(struct ath_softc *sc, const struct ath_buf *bf,
11060786Sps	const uint32_t *ds, u_int qnum, u_int ix, int done);
11160786Sps#else	/* ATH_DEBUG */
11260786Sps#define	ATH_KTR(_sc, _km, _kf, ...)	do { } while (0)
11360786Sps
11460786Sps#define	IFF_DUMPPKTS(sc, m) \
11560786Sps	((sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2))
11660786Sps#define	DPRINTF(sc, m, fmt, ...) do {				\
11760786Sps	(void) sc;						\
11860786Sps} while (0)
11960786Sps#define	KEYPRINTF(sc, k, ix, mac) do {				\
12060786Sps	(void) sc;						\
12160786Sps} while (0)
12260786Sps#endif	/* ATH_DEBUG */
12360786Sps
12460786Sps#endif
12560786Sps