/drivers/staging/brcm80211/brcmsmac/wl_dbg.h
C++ Header | 92 lines | 59 code | 16 blank | 17 comment | 4 complexity | 6414806c76565418cffdbfc988c78631 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
1/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _wl_dbg_h_
18#define _wl_dbg_h_
19
20#include <linux/device.h> /* dev_err() */
21
22/* wl_msg_level is a bit vector with defs in wlioctl.h */
23extern u32 wl_msg_level;
24
25#define BCMMSG(dev, fmt, args...) \
26do { \
27 if (wl_msg_level & WL_TRACE_VAL) \
28 wiphy_err(dev, "%s: " fmt, __func__, ##args); \
29} while (0)
30
31#ifdef BCMDBG
32
33
34/* Extra message control for AMPDU debugging */
35#define WL_AMPDU_UPDN_VAL 0x00000001 /* Config up/down related */
36#define WL_AMPDU_ERR_VAL 0x00000002 /* Calls to beaocn update */
37#define WL_AMPDU_TX_VAL 0x00000004 /* Transmit data path */
38#define WL_AMPDU_RX_VAL 0x00000008 /* Receive data path */
39#define WL_AMPDU_CTL_VAL 0x00000010 /* TSF-related items */
40#define WL_AMPDU_HW_VAL 0x00000020 /* AMPDU_HW */
41#define WL_AMPDU_HWTXS_VAL 0x00000040 /* AMPDU_HWTXS */
42#define WL_AMPDU_HWDBG_VAL 0x00000080 /* AMPDU_DBG */
43
44extern u32 wl_ampdu_dbg;
45
46#define WL_AMPDU_PRINT(level, fmt, args...) \
47do { \
48 if (wl_ampdu_dbg & level) { \
49 WL_AMPDU(fmt, ##args); \
50 } \
51} while (0)
52
53#define WL_AMPDU_UPDN(fmt, args...) \
54 WL_AMPDU_PRINT(WL_AMPDU_UPDN_VAL, fmt, ##args)
55#define WL_AMPDU_RX(fmt, args...) \
56 WL_AMPDU_PRINT(WL_AMPDU_RX_VAL, fmt, ##args)
57#define WL_AMPDU_ERR(fmt, args...) \
58 WL_AMPDU_PRINT(WL_AMPDU_ERR_VAL, fmt, ##args)
59#define WL_AMPDU_TX(fmt, args...) \
60 WL_AMPDU_PRINT(WL_AMPDU_TX_VAL, fmt, ##args)
61#define WL_AMPDU_CTL(fmt, args...) \
62 WL_AMPDU_PRINT(WL_AMPDU_CTL_VAL, fmt, ##args)
63#define WL_AMPDU_HW(fmt, args...) \
64 WL_AMPDU_PRINT(WL_AMPDU_HW_VAL, fmt, ##args)
65#define WL_AMPDU_HWTXS(fmt, args...) \
66 WL_AMPDU_PRINT(WL_AMPDU_HWTXS_VAL, fmt, ##args)
67#define WL_AMPDU_HWDBG(fmt, args...) \
68 WL_AMPDU_PRINT(WL_AMPDU_HWDBG_VAL, fmt, ##args)
69#define WL_AMPDU_ERR_ON() (wl_ampdu_dbg & WL_AMPDU_ERR_VAL)
70#define WL_AMPDU_HW_ON() (wl_ampdu_dbg & WL_AMPDU_HW_VAL)
71#define WL_AMPDU_HWTXS_ON() (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL)
72
73#else /* BCMDBG */
74
75
76#define WL_AMPDU_UPDN(fmt, args...) no_printk(fmt, ##args)
77#define WL_AMPDU_RX(fmt, args...) no_printk(fmt, ##args)
78#define WL_AMPDU_ERR(fmt, args...) no_printk(fmt, ##args)
79#define WL_AMPDU_TX(fmt, args...) no_printk(fmt, ##args)
80#define WL_AMPDU_CTL(fmt, args...) no_printk(fmt, ##args)
81#define WL_AMPDU_HW(fmt, args...) no_printk(fmt, ##args)
82#define WL_AMPDU_HWTXS(fmt, args...) no_printk(fmt, ##args)
83#define WL_AMPDU_HWDBG(fmt, args...) no_printk(fmt, ##args)
84#define WL_AMPDU_ERR_ON() 0
85#define WL_AMPDU_HW_ON() 0
86#define WL_AMPDU_HWTXS_ON() 0
87
88#endif /* BCMDBG */
89
90#define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL)
91
92#endif /* _wl_dbg_h_ */