]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/net/wireless/brcm80211/brcmfmac/dhd_dbg.h
brcmfmac: error messages should not be suppressed
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / brcm80211 / brcmfmac / dhd_dbg.h
CommitLineData
5b435de0
AS
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 _BRCMF_DBG_H_
18#define _BRCMF_DBG_H_
19
8763349b 20/* message levels */
8763349b
FL
21#define BRCMF_TRACE_VAL 0x0002
22#define BRCMF_INFO_VAL 0x0004
23#define BRCMF_DATA_VAL 0x0008
24#define BRCMF_CTL_VAL 0x0010
25#define BRCMF_TIMER_VAL 0x0020
26#define BRCMF_HDRS_VAL 0x0040
27#define BRCMF_BYTES_VAL 0x0080
28#define BRCMF_INTR_VAL 0x0100
f0799895
HM
29#define BRCMF_GLOM_VAL 0x0200
30#define BRCMF_EVENT_VAL 0x0400
31#define BRCMF_BTA_VAL 0x0800
32#define BRCMF_FIL_VAL 0x1000
cb8b73da 33#define BRCMF_USB_VAL 0x2000
8763349b 34
5e8149f5
AS
35/* Macro for error messages. net_ratelimit() is used when driver
36 * debugging is not selected. When debugging the driver error
37 * messages are as important as other tracing or even more so.
38 */
39#ifdef CONFIG_BRCMDBG
40#define brcmf_err(fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__)
41#else
42#define brcmf_err(fmt, ...) \
43 do { \
44 if (net_ratelimit()) \
45 pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \
46 } while (0)
47#endif
48
8ae74654 49#if defined(DEBUG)
5b435de0 50
5e8149f5
AS
51#define brcmf_dbg(level, fmt, ...) \
52do { \
53 if (brcmf_msg_level & BRCMF_##level##_VAL) \
54 pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \
5b435de0
AS
55} while (0)
56
57#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
58#define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL)
59#define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL)
60#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
61#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
30c52bcf 62#define BRCMF_EVENT_ON() (brcmf_msg_level & BRCMF_EVENT_VAL)
81f5dcb8 63#define BRCMF_FIL_ON() (brcmf_msg_level & BRCMF_FIL_VAL)
5b435de0 64
8ae74654 65#else /* (defined DEBUG) || (defined DEBUG) */
5b435de0
AS
66
67#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
68
69#define BRCMF_DATA_ON() 0
70#define BRCMF_CTL_ON() 0
71#define BRCMF_HDRS_ON() 0
72#define BRCMF_BYTES_ON() 0
73#define BRCMF_GLOM_ON() 0
30c52bcf 74#define BRCMF_EVENT_ON() 0
81f5dcb8 75#define BRCMF_FIL_ON() 0
5b435de0 76
8ae74654 77#endif /* defined(DEBUG) */
5b435de0 78
1e023829
JP
79#define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \
80do { \
81 if (test) \
82 brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__); \
83} while (0)
84
5b435de0
AS
85extern int brcmf_msg_level;
86
80969836
AS
87/*
88 * hold counter variables used in brcmfmac sdio driver.
89 */
90struct brcmf_sdio_count {
91 uint intrcount; /* Count of device interrupt callbacks */
92 uint lastintrs; /* Count as of last watchdog timer */
93 uint pollcnt; /* Count of active polls */
94 uint regfails; /* Count of R_REG failures */
95 uint tx_sderrs; /* Count of tx attempts with sd errors */
96 uint fcqueued; /* Tx packets that got queued */
97 uint rxrtx; /* Count of rtx requests (NAK to dongle) */
98 uint rx_toolong; /* Receive frames too long to receive */
99 uint rxc_errors; /* SDIO errors when reading control frames */
100 uint rx_hdrfail; /* SDIO errors on header reads */
101 uint rx_badhdr; /* Bad received headers (roosync?) */
102 uint rx_badseq; /* Mismatched rx sequence number */
103 uint fc_rcvd; /* Number of flow-control events received */
104 uint fc_xoff; /* Number which turned on flow-control */
105 uint fc_xon; /* Number which turned off flow-control */
106 uint rxglomfail; /* Failed deglom attempts */
107 uint rxglomframes; /* Number of glom frames (superframes) */
108 uint rxglompkts; /* Number of packets from glom frames */
109 uint f2rxhdrs; /* Number of header reads */
110 uint f2rxdata; /* Number of frame data reads */
111 uint f2txdata; /* Number of f2 frame writes */
112 uint f1regdata; /* Number of f1 register accesses */
113 uint tickcnt; /* Number of watchdog been schedule */
114 ulong tx_ctlerrs; /* Err of sending ctrl frames */
115 ulong tx_ctlpkts; /* Ctrl frames sent to dongle */
116 ulong rx_ctlerrs; /* Err of processing rx ctrl frames */
117 ulong rx_ctlpkts; /* Ctrl frames processed from dongle */
118 ulong rx_readahead_cnt; /* packets where header read-ahead was used */
119};
120
d319a7cf
AS
121struct brcmf_pub;
122#ifdef DEBUG
123void brcmf_debugfs_init(void);
124void brcmf_debugfs_exit(void);
125int brcmf_debugfs_attach(struct brcmf_pub *drvr);
126void brcmf_debugfs_detach(struct brcmf_pub *drvr);
127struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr);
80969836
AS
128void brcmf_debugfs_create_sdio_count(struct brcmf_pub *drvr,
129 struct brcmf_sdio_count *sdcnt);
d319a7cf
AS
130#else
131static inline void brcmf_debugfs_init(void)
132{
133}
134static inline void brcmf_debugfs_exit(void)
135{
136}
137static inline int brcmf_debugfs_attach(struct brcmf_pub *drvr)
138{
139 return 0;
140}
141static inline void brcmf_debugfs_detach(struct brcmf_pub *drvr)
142{
143}
144#endif
145
5b435de0 146#endif /* _BRCMF_DBG_H_ */