summaryrefslogtreecommitdiff
path: root/drivers/staging/cw1200/debug.h
blob: 72b827f296b5978f76bda4cee02e246ae88e32c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 * DebugFS code for ST-Ericsson CW1200 mac80211 driver
 *
 * Copyright (c) 2011, ST-Ericsson
 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef CW1200_DEBUG_H_INCLUDED
#define CW1200_DEBUG_H_INCLUDED

#include "itp.h"

struct cw200_common;

#ifdef CONFIG_CW1200_DEBUGFS

struct cw1200_debug_priv {
	struct dentry *debugfs_phy;
	int tx;
	int tx_agg;
	int rx;
	int rx_agg;
	int tx_multi;
	int tx_multi_frames;
	int tx_cache_miss;
	int tx_align;
	int tx_ttl;
	int tx_burst;
	int rx_burst;
	int ba_cnt;
	int ba_acc;
#ifdef CONFIG_CW1200_ITP
	struct cw1200_itp itp;
#endif /* CONFIG_CW1200_ITP */
};

int cw1200_debug_init(struct cw1200_common *priv);
void cw1200_debug_release(struct cw1200_common *priv);

static inline void cw1200_debug_txed(struct cw1200_common *priv)
{
	++priv->debug->tx;
}

static inline void cw1200_debug_txed_agg(struct cw1200_common *priv)
{
	++priv->debug->tx_agg;
}

static inline void cw1200_debug_txed_multi(struct cw1200_common *priv,
					   int count)
{
	++priv->debug->tx_multi;
	priv->debug->tx_multi_frames += count;
}

static inline void cw1200_debug_rxed(struct cw1200_common *priv)
{
	++priv->debug->rx;
}

static inline void cw1200_debug_rxed_agg(struct cw1200_common *priv)
{
	++priv->debug->rx_agg;
}

static inline void cw1200_debug_tx_cache_miss(struct cw1200_common *priv)
{
	++priv->debug->tx_cache_miss;
}

static inline void cw1200_debug_tx_align(struct cw1200_common *priv)
{
	++priv->debug->tx_align;
}

static inline void cw1200_debug_tx_ttl(struct cw1200_common *priv)
{
	++priv->debug->tx_ttl;
}

static inline void cw1200_debug_tx_burst(struct cw1200_common *priv)
{
	++priv->debug->tx_burst;
}

static inline void cw1200_debug_rx_burst(struct cw1200_common *priv)
{
	++priv->debug->rx_burst;
}

static inline void cw1200_debug_ba(struct cw1200_common *priv,
				   int ba_cnt, int ba_acc)
{
	priv->debug->ba_cnt = ba_cnt;
	priv->debug->ba_acc = ba_acc;
}

int cw1200_print_fw_version(struct cw1200_common *priv, u8 *buf, size_t len);

#else /* CONFIG_CW1200_DEBUGFS */

static inline int cw1200_debug_init(struct cw1200_common *priv)
{
	return 0;
}

static inline void cw1200_debug_release(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_txed(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_txed_agg(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_txed_multi(struct cw1200_common *priv,
					   int count)
{
}

static inline void cw1200_debug_rxed(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_rxed_agg(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_tx_cache_miss(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_tx_align(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_tx_ttl(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_tx_burst(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_rx_burst(struct cw1200_common *priv)
{
}

static inline void cw1200_debug_ba(struct cw1200_common *priv,
				   int ba_cnt, int ba_acc)
{
}

int cw1200_print_fw_version(struct cw1200_common *priv, u8 *buf, size_t len)
{
}

#endif /* CONFIG_CW1200_DEBUGFS */

#endif /* CW1200_DEBUG_H_INCLUDED */