1 --- a/net/mac80211/debugfs.c
2 +++ b/net/mac80211/debugfs.c
3 @@ -307,9 +307,6 @@ static const struct file_operations queu
7 -#define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \
8 - DEBUGFS_READONLY_FILE(stats_ ##name, buflen, fmt, ##value)
10 static ssize_t format_devstat_counter(struct ieee80211_local *local,
12 size_t count, loff_t *ppos,
13 @@ -351,75 +348,16 @@ static const struct file_operations stat
14 .open = mac80211_open_file_generic, \
17 -#define DEBUGFS_STATS_ADD(name) \
18 +#define DEBUGFS_STATS_ADD(name, field) \
19 + debugfs_create_u32(#name, 0400, statsd, (u32 *) &field);
20 +#define DEBUGFS_DEVSTATS_ADD(name) \
21 debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops);
23 -DEBUGFS_STATS_FILE(transmitted_fragment_count, 20, "%u",
24 - local->dot11TransmittedFragmentCount);
25 -DEBUGFS_STATS_FILE(multicast_transmitted_frame_count, 20, "%u",
26 - local->dot11MulticastTransmittedFrameCount);
27 -DEBUGFS_STATS_FILE(failed_count, 20, "%u",
28 - local->dot11FailedCount);
29 -DEBUGFS_STATS_FILE(retry_count, 20, "%u",
30 - local->dot11RetryCount);
31 -DEBUGFS_STATS_FILE(multiple_retry_count, 20, "%u",
32 - local->dot11MultipleRetryCount);
33 -DEBUGFS_STATS_FILE(frame_duplicate_count, 20, "%u",
34 - local->dot11FrameDuplicateCount);
35 -DEBUGFS_STATS_FILE(received_fragment_count, 20, "%u",
36 - local->dot11ReceivedFragmentCount);
37 -DEBUGFS_STATS_FILE(multicast_received_frame_count, 20, "%u",
38 - local->dot11MulticastReceivedFrameCount);
39 -DEBUGFS_STATS_FILE(transmitted_frame_count, 20, "%u",
40 - local->dot11TransmittedFrameCount);
41 -#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
42 -DEBUGFS_STATS_FILE(tx_handlers_drop, 20, "%u",
43 - local->tx_handlers_drop);
44 -DEBUGFS_STATS_FILE(tx_handlers_queued, 20, "%u",
45 - local->tx_handlers_queued);
46 -DEBUGFS_STATS_FILE(tx_handlers_drop_unencrypted, 20, "%u",
47 - local->tx_handlers_drop_unencrypted);
48 -DEBUGFS_STATS_FILE(tx_handlers_drop_fragment, 20, "%u",
49 - local->tx_handlers_drop_fragment);
50 -DEBUGFS_STATS_FILE(tx_handlers_drop_wep, 20, "%u",
51 - local->tx_handlers_drop_wep);
52 -DEBUGFS_STATS_FILE(tx_handlers_drop_not_assoc, 20, "%u",
53 - local->tx_handlers_drop_not_assoc);
54 -DEBUGFS_STATS_FILE(tx_handlers_drop_unauth_port, 20, "%u",
55 - local->tx_handlers_drop_unauth_port);
56 -DEBUGFS_STATS_FILE(rx_handlers_drop, 20, "%u",
57 - local->rx_handlers_drop);
58 -DEBUGFS_STATS_FILE(rx_handlers_queued, 20, "%u",
59 - local->rx_handlers_queued);
60 -DEBUGFS_STATS_FILE(rx_handlers_drop_nullfunc, 20, "%u",
61 - local->rx_handlers_drop_nullfunc);
62 -DEBUGFS_STATS_FILE(rx_handlers_drop_defrag, 20, "%u",
63 - local->rx_handlers_drop_defrag);
64 -DEBUGFS_STATS_FILE(rx_handlers_drop_short, 20, "%u",
65 - local->rx_handlers_drop_short);
66 -DEBUGFS_STATS_FILE(rx_handlers_drop_passive_scan, 20, "%u",
67 - local->rx_handlers_drop_passive_scan);
68 -DEBUGFS_STATS_FILE(tx_expand_skb_head, 20, "%u",
69 - local->tx_expand_skb_head);
70 -DEBUGFS_STATS_FILE(tx_expand_skb_head_cloned, 20, "%u",
71 - local->tx_expand_skb_head_cloned);
72 -DEBUGFS_STATS_FILE(rx_expand_skb_head, 20, "%u",
73 - local->rx_expand_skb_head);
74 -DEBUGFS_STATS_FILE(rx_expand_skb_head2, 20, "%u",
75 - local->rx_expand_skb_head2);
76 -DEBUGFS_STATS_FILE(rx_handlers_fragments, 20, "%u",
77 - local->rx_handlers_fragments);
78 -DEBUGFS_STATS_FILE(tx_status_drop, 20, "%u",
79 - local->tx_status_drop);
83 DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount);
84 DEBUGFS_DEVSTATS_FILE(dot11RTSFailureCount);
85 DEBUGFS_DEVSTATS_FILE(dot11FCSErrorCount);
86 DEBUGFS_DEVSTATS_FILE(dot11RTSSuccessCount);
89 void debugfs_hw_add(struct ieee80211_local *local)
91 struct dentry *phyd = local->hw.wiphy->debugfsdir;
92 @@ -448,38 +386,60 @@ void debugfs_hw_add(struct ieee80211_loc
96 - DEBUGFS_STATS_ADD(transmitted_fragment_count);
97 - DEBUGFS_STATS_ADD(multicast_transmitted_frame_count);
98 - DEBUGFS_STATS_ADD(failed_count);
99 - DEBUGFS_STATS_ADD(retry_count);
100 - DEBUGFS_STATS_ADD(multiple_retry_count);
101 - DEBUGFS_STATS_ADD(frame_duplicate_count);
102 - DEBUGFS_STATS_ADD(received_fragment_count);
103 - DEBUGFS_STATS_ADD(multicast_received_frame_count);
104 - DEBUGFS_STATS_ADD(transmitted_frame_count);
105 + DEBUGFS_STATS_ADD(transmitted_fragment_count,
106 + local->dot11TransmittedFragmentCount);
107 + DEBUGFS_STATS_ADD(multicast_transmitted_frame_count,
108 + local->dot11MulticastTransmittedFrameCount);
109 + DEBUGFS_STATS_ADD(failed_count, local->dot11FailedCount);
110 + DEBUGFS_STATS_ADD(retry_count, local->dot11RetryCount);
111 + DEBUGFS_STATS_ADD(multiple_retry_count,
112 + local->dot11MultipleRetryCount);
113 + DEBUGFS_STATS_ADD(frame_duplicate_count,
114 + local->dot11FrameDuplicateCount);
115 + DEBUGFS_STATS_ADD(received_fragment_count,
116 + local->dot11ReceivedFragmentCount);
117 + DEBUGFS_STATS_ADD(multicast_received_frame_count,
118 + local->dot11MulticastReceivedFrameCount);
119 + DEBUGFS_STATS_ADD(transmitted_frame_count,
120 + local->dot11TransmittedFrameCount);
121 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
122 - DEBUGFS_STATS_ADD(tx_handlers_drop);
123 - DEBUGFS_STATS_ADD(tx_handlers_queued);
124 - DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted);
125 - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment);
126 - DEBUGFS_STATS_ADD(tx_handlers_drop_wep);
127 - DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc);
128 - DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port);
129 - DEBUGFS_STATS_ADD(rx_handlers_drop);
130 - DEBUGFS_STATS_ADD(rx_handlers_queued);
131 - DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc);
132 - DEBUGFS_STATS_ADD(rx_handlers_drop_defrag);
133 - DEBUGFS_STATS_ADD(rx_handlers_drop_short);
134 - DEBUGFS_STATS_ADD(rx_handlers_drop_passive_scan);
135 - DEBUGFS_STATS_ADD(tx_expand_skb_head);
136 - DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned);
137 - DEBUGFS_STATS_ADD(rx_expand_skb_head);
138 - DEBUGFS_STATS_ADD(rx_expand_skb_head2);
139 - DEBUGFS_STATS_ADD(rx_handlers_fragments);
140 - DEBUGFS_STATS_ADD(tx_status_drop);
141 + DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop);
142 + DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued);
143 + DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted,
144 + local->tx_handlers_drop_unencrypted);
145 + DEBUGFS_STATS_ADD(tx_handlers_drop_fragment,
146 + local->tx_handlers_drop_fragment);
147 + DEBUGFS_STATS_ADD(tx_handlers_drop_wep,
148 + local->tx_handlers_drop_wep);
149 + DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc,
150 + local->tx_handlers_drop_not_assoc);
151 + DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port,
152 + local->tx_handlers_drop_unauth_port);
153 + DEBUGFS_STATS_ADD(rx_handlers_drop, local->rx_handlers_drop);
154 + DEBUGFS_STATS_ADD(rx_handlers_queued, local->rx_handlers_queued);
155 + DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc,
156 + local->rx_handlers_drop_nullfunc);
157 + DEBUGFS_STATS_ADD(rx_handlers_drop_defrag,
158 + local->rx_handlers_drop_defrag);
159 + DEBUGFS_STATS_ADD(rx_handlers_drop_short,
160 + local->rx_handlers_drop_short);
161 + DEBUGFS_STATS_ADD(rx_handlers_drop_passive_scan,
162 + local->rx_handlers_drop_passive_scan);
163 + DEBUGFS_STATS_ADD(tx_expand_skb_head,
164 + local->tx_expand_skb_head);
165 + DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned,
166 + local->tx_expand_skb_head_cloned);
167 + DEBUGFS_STATS_ADD(rx_expand_skb_head,
168 + local->rx_expand_skb_head);
169 + DEBUGFS_STATS_ADD(rx_expand_skb_head2,
170 + local->rx_expand_skb_head2);
171 + DEBUGFS_STATS_ADD(rx_handlers_fragments,
172 + local->rx_handlers_fragments);
173 + DEBUGFS_STATS_ADD(tx_status_drop,
174 + local->tx_status_drop);
176 - DEBUGFS_STATS_ADD(dot11ACKFailureCount);
177 - DEBUGFS_STATS_ADD(dot11RTSFailureCount);
178 - DEBUGFS_STATS_ADD(dot11FCSErrorCount);
179 - DEBUGFS_STATS_ADD(dot11RTSSuccessCount);
180 + DEBUGFS_DEVSTATS_ADD(dot11ACKFailureCount);
181 + DEBUGFS_DEVSTATS_ADD(dot11RTSFailureCount);
182 + DEBUGFS_DEVSTATS_ADD(dot11FCSErrorCount);
183 + DEBUGFS_DEVSTATS_ADD(dot11RTSSuccessCount);
185 --- a/net/mac80211/debugfs_sta.c
186 +++ b/net/mac80211/debugfs_sta.c
187 @@ -30,7 +30,6 @@ static ssize_t sta_ ##name## _read(struc
189 #define STA_READ_D(name, field) STA_READ(name, 20, field, "%d\n")
190 #define STA_READ_U(name, field) STA_READ(name, 20, field, "%u\n")
191 -#define STA_READ_LU(name, field) STA_READ(name, 20, field, "%lu\n")
192 #define STA_READ_S(name, field) STA_READ(name, 20, field, "%s\n")
194 #define STA_OPS(name) \
195 @@ -52,19 +51,7 @@ static const struct file_operations sta_
197 STA_FILE(aid, sta.aid, D);
198 STA_FILE(dev, sdata->name, S);
199 -STA_FILE(rx_packets, rx_packets, LU);
200 -STA_FILE(tx_packets, tx_packets, LU);
201 -STA_FILE(rx_bytes, rx_bytes, LU);
202 -STA_FILE(tx_bytes, tx_bytes, LU);
203 -STA_FILE(rx_duplicates, num_duplicates, LU);
204 -STA_FILE(rx_fragments, rx_fragments, LU);
205 -STA_FILE(rx_dropped, rx_dropped, LU);
206 -STA_FILE(tx_fragments, tx_fragments, LU);
207 -STA_FILE(tx_filtered, tx_filtered_count, LU);
208 -STA_FILE(tx_retry_failed, tx_retry_failed, LU);
209 -STA_FILE(tx_retry_count, tx_retry_count, LU);
210 STA_FILE(last_signal, last_signal, D);
211 -STA_FILE(wep_weak_iv_count, wep_weak_iv_count, LU);
213 static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
214 size_t count, loff_t *ppos)
215 @@ -307,6 +294,13 @@ STA_OPS(ht_capa);
216 debugfs_create_file(#name, 0400, \
217 sta->debugfs.dir, sta, &sta_ ##name## _ops);
219 +#define DEBUGFS_ADD_COUNTER(name, field) \
220 + if (sizeof(sta->field) == sizeof(u32)) \
221 + debugfs_create_u32(#name, 0400, sta->debugfs.dir, \
222 + (u32 *) &sta->field); \
224 + debugfs_create_u64(#name, 0400, sta->debugfs.dir, \
225 + (u64 *) &sta->field);
227 void ieee80211_sta_debugfs_add(struct sta_info *sta)
229 @@ -339,20 +333,21 @@ void ieee80211_sta_debugfs_add(struct st
230 DEBUGFS_ADD(last_seq_ctrl);
231 DEBUGFS_ADD(agg_status);
233 - DEBUGFS_ADD(rx_packets);
234 - DEBUGFS_ADD(tx_packets);
235 - DEBUGFS_ADD(rx_bytes);
236 - DEBUGFS_ADD(tx_bytes);
237 - DEBUGFS_ADD(rx_duplicates);
238 - DEBUGFS_ADD(rx_fragments);
239 - DEBUGFS_ADD(rx_dropped);
240 - DEBUGFS_ADD(tx_fragments);
241 - DEBUGFS_ADD(tx_filtered);
242 - DEBUGFS_ADD(tx_retry_failed);
243 - DEBUGFS_ADD(tx_retry_count);
244 DEBUGFS_ADD(last_signal);
245 - DEBUGFS_ADD(wep_weak_iv_count);
246 DEBUGFS_ADD(ht_capa);
248 + DEBUGFS_ADD_COUNTER(rx_packets, rx_packets);
249 + DEBUGFS_ADD_COUNTER(tx_packets, tx_packets);
250 + DEBUGFS_ADD_COUNTER(rx_bytes, rx_bytes);
251 + DEBUGFS_ADD_COUNTER(tx_bytes, tx_bytes);
252 + DEBUGFS_ADD_COUNTER(rx_duplicates, num_duplicates);
253 + DEBUGFS_ADD_COUNTER(rx_fragments, rx_fragments);
254 + DEBUGFS_ADD_COUNTER(rx_dropped, rx_dropped);
255 + DEBUGFS_ADD_COUNTER(tx_fragments, tx_fragments);
256 + DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count);
257 + DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed);
258 + DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count);
259 + DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count);
262 void ieee80211_sta_debugfs_remove(struct sta_info *sta)