1 /*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer, 10 * without modification. 11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 * redistribution must be conditioned upon including a substantially 14 * similar Disclaimer requirement for further binary redistribution. 15 * 16 * NO WARRANTY 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 * 29 * $FreeBSD$ 30 */ 31 #ifndef __IF_ATH_DEBUG_H__ 32 #define __IF_ATH_DEBUG_H__ 33 34 #ifdef ATH_DEBUG 35 36 enum { 37 ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ 38 ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */ 39 ATH_DEBUG_RECV = 0x00000004, /* basic recv operation */ 40 ATH_DEBUG_RECV_DESC = 0x00000008, /* recv descriptors */ 41 ATH_DEBUG_RATE = 0x00000010, /* rate control */ 42 ATH_DEBUG_RESET = 0x00000020, /* reset processing */ 43 ATH_DEBUG_MODE = 0x00000040, /* mode init/setup */ 44 ATH_DEBUG_BEACON = 0x00000080, /* beacon handling */ 45 ATH_DEBUG_WATCHDOG = 0x00000100, /* watchdog timeout */ 46 ATH_DEBUG_INTR = 0x00001000, /* ISR */ 47 ATH_DEBUG_TX_PROC = 0x00002000, /* tx ISR proc */ 48 ATH_DEBUG_RX_PROC = 0x00004000, /* rx ISR proc */ 49 ATH_DEBUG_BEACON_PROC = 0x00008000, /* beacon ISR proc */ 50 ATH_DEBUG_CALIBRATE = 0x00010000, /* periodic calibration */ 51 ATH_DEBUG_KEYCACHE = 0x00020000, /* key cache management */ 52 ATH_DEBUG_STATE = 0x00040000, /* 802.11 state transitions */ 53 ATH_DEBUG_NODE = 0x00080000, /* node management */ 54 ATH_DEBUG_LED = 0x00100000, /* led management */ 55 ATH_DEBUG_FF = 0x00200000, /* fast frames */ 56 ATH_DEBUG_DFS = 0x00400000, /* DFS processing */ 57 ATH_DEBUG_TDMA = 0x00800000, /* TDMA processing */ 58 ATH_DEBUG_TDMA_TIMER = 0x01000000, /* TDMA timer processing */ 59 ATH_DEBUG_REGDOMAIN = 0x02000000, /* regulatory processing */ 60 ATH_DEBUG_SW_TX = 0x04000000, /* per-packet software TX */ 61 ATH_DEBUG_SW_TX_BAW = 0x08000000, /* BAW handling */ 62 ATH_DEBUG_SW_TX_CTRL = 0x10000000, /* queue control */ 63 ATH_DEBUG_SW_TX_AGGR = 0x20000000, /* aggregate TX */ 64 ATH_DEBUG_SW_TX_RETRIES = 0x40000000, /* software TX retries */ 65 ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */ 66 ATH_DEBUG_ANY = 0xffffffff 67 }; 68 69 extern int ath_debug; 70 71 #define IFF_DUMPPKTS(sc, m) \ 72 ((sc->sc_debug & (m)) || \ 73 (sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) 74 #define DPRINTF(sc, m, fmt, ...) do { \ 75 if (sc->sc_debug & (m)) \ 76 device_printf(sc->sc_dev, fmt, __VA_ARGS__); \ 77 } while (0) 78 #define KEYPRINTF(sc, ix, hk, mac) do { \ 79 if (sc->sc_debug & ATH_DEBUG_KEYCACHE) \ 80 ath_keyprint(sc, __func__, ix, hk, mac); \ 81 } while (0) 82 83 extern void ath_printrxbuf(struct ath_softc *, const struct ath_buf *bf, 84 u_int ix, int); 85 extern void ath_printtxbuf(struct ath_softc *, const struct ath_buf *bf, 86 u_int qnum, u_int ix, int done); 87 #else /* ATH_DEBUG */ 88 #define IFF_DUMPPKTS(sc, m) \ 89 ((sc->sc_ifp->if_flags & (IFF_DEBUG|IFF_LINK2)) == (IFF_DEBUG|IFF_LINK2)) 90 #define DPRINTF(sc, m, fmt, ...) do { \ 91 (void) sc; \ 92 } while (0) 93 #define KEYPRINTF(sc, k, ix, mac) do { \ 94 (void) sc; \ 95 } while (0) 96 #endif /* ATH_DEBUG */ 97 98 #endif 99