aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-10-27 07:59:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-30 16:49:18 -0400
commit7bcfaf2f431c09c51fe776fc06638b25d3b421c5 (patch)
tree27f767335566826f11f0134b97ee76b58d9bcf90 /net/mac80211
parent2c0d6100da3ee9b0f0cc46add9bb8a8161299a92 (diff)
cfg80211/mac80211: use debugfs_remove_recursive
We can save a lot of code and pointers in the structs by using debugfs_remove_recursive(). First, change cfg80211 to use debugfs_remove_recursive() so that drivers do not need to clean up any files they added to the per-wiphy debugfs (if and only if they are ok to be accessed until after wiphy_unregister!). Then also make mac80211 use debugfs_remove_recursive() where necessary -- it need not remove per-wiphy files as cfg80211 now removes those, but netdev etc. files still need to be handled but can now be removed without needing struct dentry pointers to all of them. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs.c73
-rw-r--r--net/mac80211/debugfs.h2
-rw-r--r--net/mac80211/debugfs_key.c44
-rw-r--r--net/mac80211/debugfs_netdev.c174
-rw-r--r--net/mac80211/debugfs_sta.c31
-rw-r--r--net/mac80211/ieee80211_i.h114
-rw-r--r--net/mac80211/key.h12
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/rate.c7
-rw-r--r--net/mac80211/sta_info.h22
10 files changed, 49 insertions, 432 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 96991b68f048..82c807723b6f 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -1,3 +1,4 @@
1
1/* 2/*
2 * mac80211 debugfs for wireless PHYs 3 * mac80211 debugfs for wireless PHYs
3 * 4 *
@@ -38,16 +39,10 @@ static const struct file_operations name## _ops = { \
38}; 39};
39 40
40#define DEBUGFS_ADD(name) \ 41#define DEBUGFS_ADD(name) \
41 local->debugfs.name = debugfs_create_file(#name, 0400, phyd, \ 42 debugfs_create_file(#name, 0400, phyd, local, &name## _ops);
42 local, &name## _ops);
43 43
44#define DEBUGFS_ADD_MODE(name, mode) \ 44#define DEBUGFS_ADD_MODE(name, mode) \
45 local->debugfs.name = debugfs_create_file(#name, mode, phyd, \ 45 debugfs_create_file(#name, mode, phyd, local, &name## _ops);
46 local, &name## _ops);
47
48#define DEBUGFS_DEL(name) \
49 debugfs_remove(local->debugfs.name); \
50 local->debugfs.name = NULL;
51 46
52 47
53DEBUGFS_READONLY_FILE(frequency, 20, "%d", 48DEBUGFS_READONLY_FILE(frequency, 20, "%d",
@@ -233,12 +228,7 @@ static const struct file_operations stats_ ##name## _ops = { \
233}; 228};
234 229
235#define DEBUGFS_STATS_ADD(name) \ 230#define DEBUGFS_STATS_ADD(name) \
236 local->debugfs.stats.name = debugfs_create_file(#name, 0400, statsd,\ 231 debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops);
237 local, &stats_ ##name## _ops);
238
239#define DEBUGFS_STATS_DEL(name) \
240 debugfs_remove(local->debugfs.stats.name); \
241 local->debugfs.stats.name = NULL;
242 232
243DEBUGFS_STATS_FILE(transmitted_fragment_count, 20, "%u", 233DEBUGFS_STATS_FILE(transmitted_fragment_count, 20, "%u",
244 local->dot11TransmittedFragmentCount); 234 local->dot11TransmittedFragmentCount);
@@ -326,7 +316,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
326 DEBUGFS_ADD(noack); 316 DEBUGFS_ADD(noack);
327 317
328 statsd = debugfs_create_dir("statistics", phyd); 318 statsd = debugfs_create_dir("statistics", phyd);
329 local->debugfs.statistics = statsd;
330 319
331 /* if the dir failed, don't put all the other things into the root! */ 320 /* if the dir failed, don't put all the other things into the root! */
332 if (!statsd) 321 if (!statsd)
@@ -367,57 +356,3 @@ void debugfs_hw_add(struct ieee80211_local *local)
367 DEBUGFS_STATS_ADD(dot11FCSErrorCount); 356 DEBUGFS_STATS_ADD(dot11FCSErrorCount);
368 DEBUGFS_STATS_ADD(dot11RTSSuccessCount); 357 DEBUGFS_STATS_ADD(dot11RTSSuccessCount);
369} 358}
370
371void debugfs_hw_del(struct ieee80211_local *local)
372{
373 DEBUGFS_DEL(frequency);
374 DEBUGFS_DEL(total_ps_buffered);
375 DEBUGFS_DEL(wep_iv);
376 DEBUGFS_DEL(tsf);
377 DEBUGFS_DEL(queues);
378 DEBUGFS_DEL(reset);
379 DEBUGFS_DEL(noack);
380
381 DEBUGFS_STATS_DEL(transmitted_fragment_count);
382 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count);
383 DEBUGFS_STATS_DEL(failed_count);
384 DEBUGFS_STATS_DEL(retry_count);
385 DEBUGFS_STATS_DEL(multiple_retry_count);
386 DEBUGFS_STATS_DEL(frame_duplicate_count);
387 DEBUGFS_STATS_DEL(received_fragment_count);
388 DEBUGFS_STATS_DEL(multicast_received_frame_count);
389 DEBUGFS_STATS_DEL(transmitted_frame_count);
390 DEBUGFS_STATS_DEL(num_scans);
391#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
392 DEBUGFS_STATS_DEL(tx_handlers_drop);
393 DEBUGFS_STATS_DEL(tx_handlers_queued);
394 DEBUGFS_STATS_DEL(tx_handlers_drop_unencrypted);
395 DEBUGFS_STATS_DEL(tx_handlers_drop_fragment);
396 DEBUGFS_STATS_DEL(tx_handlers_drop_wep);
397 DEBUGFS_STATS_DEL(tx_handlers_drop_not_assoc);
398 DEBUGFS_STATS_DEL(tx_handlers_drop_unauth_port);
399 DEBUGFS_STATS_DEL(rx_handlers_drop);
400 DEBUGFS_STATS_DEL(rx_handlers_queued);
401 DEBUGFS_STATS_DEL(rx_handlers_drop_nullfunc);
402 DEBUGFS_STATS_DEL(rx_handlers_drop_defrag);
403 DEBUGFS_STATS_DEL(rx_handlers_drop_short);
404 DEBUGFS_STATS_DEL(rx_handlers_drop_passive_scan);
405 DEBUGFS_STATS_DEL(tx_expand_skb_head);
406 DEBUGFS_STATS_DEL(tx_expand_skb_head_cloned);
407 DEBUGFS_STATS_DEL(rx_expand_skb_head);
408 DEBUGFS_STATS_DEL(rx_expand_skb_head2);
409 DEBUGFS_STATS_DEL(rx_handlers_fragments);
410 DEBUGFS_STATS_DEL(tx_status_drop);
411#endif
412 DEBUGFS_STATS_DEL(dot11ACKFailureCount);
413 DEBUGFS_STATS_DEL(dot11RTSFailureCount);
414 DEBUGFS_STATS_DEL(dot11FCSErrorCount);
415 DEBUGFS_STATS_DEL(dot11RTSSuccessCount);
416
417 debugfs_remove(local->debugfs.statistics);
418 local->debugfs.statistics = NULL;
419 debugfs_remove(local->debugfs.stations);
420 local->debugfs.stations = NULL;
421 debugfs_remove(local->debugfs.keys);
422 local->debugfs.keys = NULL;
423}
diff --git a/net/mac80211/debugfs.h b/net/mac80211/debugfs.h
index dd2541935c27..68e6a2050f9a 100644
--- a/net/mac80211/debugfs.h
+++ b/net/mac80211/debugfs.h
@@ -3,14 +3,12 @@
3 3
4#ifdef CONFIG_MAC80211_DEBUGFS 4#ifdef CONFIG_MAC80211_DEBUGFS
5extern void debugfs_hw_add(struct ieee80211_local *local); 5extern void debugfs_hw_add(struct ieee80211_local *local);
6extern void debugfs_hw_del(struct ieee80211_local *local);
7extern int mac80211_open_file_generic(struct inode *inode, struct file *file); 6extern int mac80211_open_file_generic(struct inode *inode, struct file *file);
8#else 7#else
9static inline void debugfs_hw_add(struct ieee80211_local *local) 8static inline void debugfs_hw_add(struct ieee80211_local *local)
10{ 9{
11 return; 10 return;
12} 11}
13static inline void debugfs_hw_del(struct ieee80211_local *local) {}
14#endif 12#endif
15 13
16#endif /* __MAC80211_DEBUGFS_H */ 14#endif /* __MAC80211_DEBUGFS_H */
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c
index 99c752588b30..e0f5224630da 100644
--- a/net/mac80211/debugfs_key.c
+++ b/net/mac80211/debugfs_key.c
@@ -225,8 +225,8 @@ static ssize_t key_key_read(struct file *file, char __user *userbuf,
225KEY_OPS(key); 225KEY_OPS(key);
226 226
227#define DEBUGFS_ADD(name) \ 227#define DEBUGFS_ADD(name) \
228 key->debugfs.name = debugfs_create_file(#name, 0400,\ 228 debugfs_create_file(#name, 0400, key->debugfs.dir, \
229 key->debugfs.dir, key, &key_##name##_ops); 229 key, &key_##name##_ops);
230 230
231void ieee80211_debugfs_key_add(struct ieee80211_key *key) 231void ieee80211_debugfs_key_add(struct ieee80211_key *key)
232 { 232 {
@@ -271,30 +271,12 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
271 DEBUGFS_ADD(ifindex); 271 DEBUGFS_ADD(ifindex);
272}; 272};
273 273
274#define DEBUGFS_DEL(name) \
275 debugfs_remove(key->debugfs.name); key->debugfs.name = NULL;
276
277void ieee80211_debugfs_key_remove(struct ieee80211_key *key) 274void ieee80211_debugfs_key_remove(struct ieee80211_key *key)
278{ 275{
279 if (!key) 276 if (!key)
280 return; 277 return;
281 278
282 DEBUGFS_DEL(keylen); 279 debugfs_remove_recursive(key->debugfs.dir);
283 DEBUGFS_DEL(flags);
284 DEBUGFS_DEL(keyidx);
285 DEBUGFS_DEL(hw_key_idx);
286 DEBUGFS_DEL(tx_rx_count);
287 DEBUGFS_DEL(algorithm);
288 DEBUGFS_DEL(tx_spec);
289 DEBUGFS_DEL(rx_spec);
290 DEBUGFS_DEL(replays);
291 DEBUGFS_DEL(icverrors);
292 DEBUGFS_DEL(key);
293 DEBUGFS_DEL(ifindex);
294
295 debugfs_remove(key->debugfs.stalink);
296 key->debugfs.stalink = NULL;
297 debugfs_remove(key->debugfs.dir);
298 key->debugfs.dir = NULL; 280 key->debugfs.dir = NULL;
299} 281}
300void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) 282void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
@@ -302,7 +284,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
302 char buf[50]; 284 char buf[50];
303 struct ieee80211_key *key; 285 struct ieee80211_key *key;
304 286
305 if (!sdata->debugfsdir) 287 if (!sdata->debugfs.dir)
306 return; 288 return;
307 289
308 /* this is running under the key lock */ 290 /* this is running under the key lock */
@@ -310,9 +292,9 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata)
310 key = sdata->default_key; 292 key = sdata->default_key;
311 if (key) { 293 if (key) {
312 sprintf(buf, "../keys/%d", key->debugfs.cnt); 294 sprintf(buf, "../keys/%d", key->debugfs.cnt);
313 sdata->common_debugfs.default_key = 295 sdata->debugfs.default_key =
314 debugfs_create_symlink("default_key", 296 debugfs_create_symlink("default_key",
315 sdata->debugfsdir, buf); 297 sdata->debugfs.dir, buf);
316 } else 298 } else
317 ieee80211_debugfs_key_remove_default(sdata); 299 ieee80211_debugfs_key_remove_default(sdata);
318} 300}
@@ -322,8 +304,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
322 if (!sdata) 304 if (!sdata)
323 return; 305 return;
324 306
325 debugfs_remove(sdata->common_debugfs.default_key); 307 debugfs_remove(sdata->debugfs.default_key);
326 sdata->common_debugfs.default_key = NULL; 308 sdata->debugfs.default_key = NULL;
327} 309}
328 310
329void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) 311void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
@@ -331,7 +313,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
331 char buf[50]; 313 char buf[50];
332 struct ieee80211_key *key; 314 struct ieee80211_key *key;
333 315
334 if (!sdata->debugfsdir) 316 if (!sdata->debugfs.dir)
335 return; 317 return;
336 318
337 /* this is running under the key lock */ 319 /* this is running under the key lock */
@@ -339,9 +321,9 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
339 key = sdata->default_mgmt_key; 321 key = sdata->default_mgmt_key;
340 if (key) { 322 if (key) {
341 sprintf(buf, "../keys/%d", key->debugfs.cnt); 323 sprintf(buf, "../keys/%d", key->debugfs.cnt);
342 sdata->common_debugfs.default_mgmt_key = 324 sdata->debugfs.default_mgmt_key =
343 debugfs_create_symlink("default_mgmt_key", 325 debugfs_create_symlink("default_mgmt_key",
344 sdata->debugfsdir, buf); 326 sdata->debugfs.dir, buf);
345 } else 327 } else
346 ieee80211_debugfs_key_remove_mgmt_default(sdata); 328 ieee80211_debugfs_key_remove_mgmt_default(sdata);
347} 329}
@@ -351,8 +333,8 @@ void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sda
351 if (!sdata) 333 if (!sdata)
352 return; 334 return;
353 335
354 debugfs_remove(sdata->common_debugfs.default_mgmt_key); 336 debugfs_remove(sdata->debugfs.default_mgmt_key);
355 sdata->common_debugfs.default_mgmt_key = NULL; 337 sdata->debugfs.default_mgmt_key = NULL;
356} 338}
357 339
358void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, 340void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 61234e79022b..8782264f49e7 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -152,9 +152,9 @@ IEEE80211_IF_FILE(min_discovery_timeout,
152#endif 152#endif
153 153
154 154
155#define DEBUGFS_ADD(name, type)\ 155#define DEBUGFS_ADD(name, type) \
156 sdata->debugfs.type.name = debugfs_create_file(#name, 0400,\ 156 debugfs_create_file(#name, 0400, sdata->debugfs.dir, \
157 sdata->debugfsdir, sdata, &name##_ops); 157 sdata, &name##_ops);
158 158
159static void add_sta_files(struct ieee80211_sub_if_data *sdata) 159static void add_sta_files(struct ieee80211_sub_if_data *sdata)
160{ 160{
@@ -199,30 +199,32 @@ static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
199} 199}
200 200
201#ifdef CONFIG_MAC80211_MESH 201#ifdef CONFIG_MAC80211_MESH
202#define MESHSTATS_ADD(name)\
203 sdata->mesh_stats.name = debugfs_create_file(#name, 0400,\
204 sdata->mesh_stats_dir, sdata, &name##_ops);
205 202
206static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) 203static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
207{ 204{
208 sdata->mesh_stats_dir = debugfs_create_dir("mesh_stats", 205 struct dentry *dir = debugfs_create_dir("mesh_stats",
209 sdata->debugfsdir); 206 sdata->debugfs.dir);
207
208#define MESHSTATS_ADD(name)\
209 debugfs_create_file(#name, 0400, dir, sdata, &name##_ops);
210
210 MESHSTATS_ADD(fwded_mcast); 211 MESHSTATS_ADD(fwded_mcast);
211 MESHSTATS_ADD(fwded_unicast); 212 MESHSTATS_ADD(fwded_unicast);
212 MESHSTATS_ADD(fwded_frames); 213 MESHSTATS_ADD(fwded_frames);
213 MESHSTATS_ADD(dropped_frames_ttl); 214 MESHSTATS_ADD(dropped_frames_ttl);
214 MESHSTATS_ADD(dropped_frames_no_route); 215 MESHSTATS_ADD(dropped_frames_no_route);
215 MESHSTATS_ADD(estab_plinks); 216 MESHSTATS_ADD(estab_plinks);
217#undef MESHSTATS_ADD
216} 218}
217 219
218#define MESHPARAMS_ADD(name)\
219 sdata->mesh_config.name = debugfs_create_file(#name, 0600,\
220 sdata->mesh_config_dir, sdata, &name##_ops);
221
222static void add_mesh_config(struct ieee80211_sub_if_data *sdata) 220static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
223{ 221{
224 sdata->mesh_config_dir = debugfs_create_dir("mesh_config", 222 struct dentry *dir = debugfs_create_dir("mesh_config",
225 sdata->debugfsdir); 223 sdata->debugfs.dir);
224
225#define MESHPARAMS_ADD(name) \
226 debugfs_create_file(#name, 0600, dir, sdata, &name##_ops);
227
226 MESHPARAMS_ADD(dot11MeshMaxRetries); 228 MESHPARAMS_ADD(dot11MeshMaxRetries);
227 MESHPARAMS_ADD(dot11MeshRetryTimeout); 229 MESHPARAMS_ADD(dot11MeshRetryTimeout);
228 MESHPARAMS_ADD(dot11MeshConfirmTimeout); 230 MESHPARAMS_ADD(dot11MeshConfirmTimeout);
@@ -236,12 +238,14 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
236 MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries); 238 MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
237 MESHPARAMS_ADD(path_refresh_time); 239 MESHPARAMS_ADD(path_refresh_time);
238 MESHPARAMS_ADD(min_discovery_timeout); 240 MESHPARAMS_ADD(min_discovery_timeout);
241
242#undef MESHPARAMS_ADD
239} 243}
240#endif 244#endif
241 245
242static void add_files(struct ieee80211_sub_if_data *sdata) 246static void add_files(struct ieee80211_sub_if_data *sdata)
243{ 247{
244 if (!sdata->debugfsdir) 248 if (!sdata->debugfs.dir)
245 return; 249 return;
246 250
247 switch (sdata->vif.type) { 251 switch (sdata->vif.type) {
@@ -274,134 +278,6 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
274 } 278 }
275} 279}
276 280
277#define DEBUGFS_DEL(name, type) \
278 do { \
279 debugfs_remove(sdata->debugfs.type.name); \
280 sdata->debugfs.type.name = NULL; \
281 } while (0)
282
283static void del_sta_files(struct ieee80211_sub_if_data *sdata)
284{
285 DEBUGFS_DEL(drop_unencrypted, sta);
286 DEBUGFS_DEL(force_unicast_rateidx, sta);
287 DEBUGFS_DEL(max_ratectrl_rateidx, sta);
288
289 DEBUGFS_DEL(bssid, sta);
290 DEBUGFS_DEL(aid, sta);
291 DEBUGFS_DEL(capab, sta);
292}
293
294static void del_ap_files(struct ieee80211_sub_if_data *sdata)
295{
296 DEBUGFS_DEL(drop_unencrypted, ap);
297 DEBUGFS_DEL(force_unicast_rateidx, ap);
298 DEBUGFS_DEL(max_ratectrl_rateidx, ap);
299
300 DEBUGFS_DEL(num_sta_ps, ap);
301 DEBUGFS_DEL(dtim_count, ap);
302 DEBUGFS_DEL(num_buffered_multicast, ap);
303}
304
305static void del_wds_files(struct ieee80211_sub_if_data *sdata)
306{
307 DEBUGFS_DEL(drop_unencrypted, wds);
308 DEBUGFS_DEL(force_unicast_rateidx, wds);
309 DEBUGFS_DEL(max_ratectrl_rateidx, wds);
310
311 DEBUGFS_DEL(peer, wds);
312}
313
314static void del_vlan_files(struct ieee80211_sub_if_data *sdata)
315{
316 DEBUGFS_DEL(drop_unencrypted, vlan);
317 DEBUGFS_DEL(force_unicast_rateidx, vlan);
318 DEBUGFS_DEL(max_ratectrl_rateidx, vlan);
319}
320
321static void del_monitor_files(struct ieee80211_sub_if_data *sdata)
322{
323}
324
325#ifdef CONFIG_MAC80211_MESH
326#define MESHSTATS_DEL(name) \
327 do { \
328 debugfs_remove(sdata->mesh_stats.name); \
329 sdata->mesh_stats.name = NULL; \
330 } while (0)
331
332static void del_mesh_stats(struct ieee80211_sub_if_data *sdata)
333{
334 MESHSTATS_DEL(fwded_mcast);
335 MESHSTATS_DEL(fwded_unicast);
336 MESHSTATS_DEL(fwded_frames);
337 MESHSTATS_DEL(dropped_frames_ttl);
338 MESHSTATS_DEL(dropped_frames_no_route);
339 MESHSTATS_DEL(estab_plinks);
340 debugfs_remove(sdata->mesh_stats_dir);
341 sdata->mesh_stats_dir = NULL;
342}
343
344#define MESHPARAMS_DEL(name) \
345 do { \
346 debugfs_remove(sdata->mesh_config.name); \
347 sdata->mesh_config.name = NULL; \
348 } while (0)
349
350static void del_mesh_config(struct ieee80211_sub_if_data *sdata)
351{
352 MESHPARAMS_DEL(dot11MeshMaxRetries);
353 MESHPARAMS_DEL(dot11MeshRetryTimeout);
354 MESHPARAMS_DEL(dot11MeshConfirmTimeout);
355 MESHPARAMS_DEL(dot11MeshHoldingTimeout);
356 MESHPARAMS_DEL(dot11MeshTTL);
357 MESHPARAMS_DEL(auto_open_plinks);
358 MESHPARAMS_DEL(dot11MeshMaxPeerLinks);
359 MESHPARAMS_DEL(dot11MeshHWMPactivePathTimeout);
360 MESHPARAMS_DEL(dot11MeshHWMPpreqMinInterval);
361 MESHPARAMS_DEL(dot11MeshHWMPnetDiameterTraversalTime);
362 MESHPARAMS_DEL(dot11MeshHWMPmaxPREQretries);
363 MESHPARAMS_DEL(path_refresh_time);
364 MESHPARAMS_DEL(min_discovery_timeout);
365 debugfs_remove(sdata->mesh_config_dir);
366 sdata->mesh_config_dir = NULL;
367}
368#endif
369
370static void del_files(struct ieee80211_sub_if_data *sdata)
371{
372 if (!sdata->debugfsdir)
373 return;
374
375 switch (sdata->vif.type) {
376 case NL80211_IFTYPE_MESH_POINT:
377#ifdef CONFIG_MAC80211_MESH
378 del_mesh_stats(sdata);
379 del_mesh_config(sdata);
380#endif
381 break;
382 case NL80211_IFTYPE_STATION:
383 del_sta_files(sdata);
384 break;
385 case NL80211_IFTYPE_ADHOC:
386 /* XXX */
387 break;
388 case NL80211_IFTYPE_AP:
389 del_ap_files(sdata);
390 break;
391 case NL80211_IFTYPE_WDS:
392 del_wds_files(sdata);
393 break;
394 case NL80211_IFTYPE_MONITOR:
395 del_monitor_files(sdata);
396 break;
397 case NL80211_IFTYPE_AP_VLAN:
398 del_vlan_files(sdata);
399 break;
400 default:
401 break;
402 }
403}
404
405static int notif_registered; 281static int notif_registered;
406 282
407void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) 283void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
@@ -412,16 +288,18 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
412 return; 288 return;
413 289
414 sprintf(buf, "netdev:%s", sdata->dev->name); 290 sprintf(buf, "netdev:%s", sdata->dev->name);
415 sdata->debugfsdir = debugfs_create_dir(buf, 291 sdata->debugfs.dir = debugfs_create_dir(buf,
416 sdata->local->hw.wiphy->debugfsdir); 292 sdata->local->hw.wiphy->debugfsdir);
417 add_files(sdata); 293 add_files(sdata);
418} 294}
419 295
420void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) 296void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
421{ 297{
422 del_files(sdata); 298 if (!sdata->debugfs.dir)
423 debugfs_remove(sdata->debugfsdir); 299 return;
424 sdata->debugfsdir = NULL; 300
301 debugfs_remove_recursive(sdata->debugfs.dir);
302 sdata->debugfs.dir = NULL;
425} 303}
426 304
427static int netdev_notify(struct notifier_block *nb, 305static int netdev_notify(struct notifier_block *nb,
@@ -444,7 +322,7 @@ static int netdev_notify(struct notifier_block *nb,
444 322
445 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 323 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
446 324
447 dir = sdata->debugfsdir; 325 dir = sdata->debugfs.dir;
448 326
449 if (!dir) 327 if (!dir)
450 return 0; 328 return 0;
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 33a2e892115b..8721679773da 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -158,13 +158,9 @@ static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf,
158STA_OPS(agg_status); 158STA_OPS(agg_status);
159 159
160#define DEBUGFS_ADD(name) \ 160#define DEBUGFS_ADD(name) \
161 sta->debugfs.name = debugfs_create_file(#name, 0400, \ 161 debugfs_create_file(#name, 0400, \
162 sta->debugfs.dir, sta, &sta_ ##name## _ops); 162 sta->debugfs.dir, sta, &sta_ ##name## _ops);
163 163
164#define DEBUGFS_DEL(name) \
165 debugfs_remove(sta->debugfs.name);\
166 sta->debugfs.name = NULL;
167
168 164
169void ieee80211_sta_debugfs_add(struct sta_info *sta) 165void ieee80211_sta_debugfs_add(struct sta_info *sta)
170{ 166{
@@ -216,29 +212,6 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta)
216 212
217void ieee80211_sta_debugfs_remove(struct sta_info *sta) 213void ieee80211_sta_debugfs_remove(struct sta_info *sta)
218{ 214{
219 DEBUGFS_DEL(flags); 215 debugfs_remove_recursive(sta->debugfs.dir);
220 DEBUGFS_DEL(num_ps_buf_frames);
221 DEBUGFS_DEL(inactive_ms);
222 DEBUGFS_DEL(last_seq_ctrl);
223 DEBUGFS_DEL(agg_status);
224 DEBUGFS_DEL(aid);
225 DEBUGFS_DEL(dev);
226 DEBUGFS_DEL(rx_packets);
227 DEBUGFS_DEL(tx_packets);
228 DEBUGFS_DEL(rx_bytes);
229 DEBUGFS_DEL(tx_bytes);
230 DEBUGFS_DEL(rx_duplicates);
231 DEBUGFS_DEL(rx_fragments);
232 DEBUGFS_DEL(rx_dropped);
233 DEBUGFS_DEL(tx_fragments);
234 DEBUGFS_DEL(tx_filtered);
235 DEBUGFS_DEL(tx_retry_failed);
236 DEBUGFS_DEL(tx_retry_count);
237 DEBUGFS_DEL(last_signal);
238 DEBUGFS_DEL(last_qual);
239 DEBUGFS_DEL(last_noise);
240 DEBUGFS_DEL(wep_weak_iv_count);
241
242 debugfs_remove(sta->debugfs.dir);
243 sta->debugfs.dir = NULL; 216 sta->debugfs.dir = NULL;
244} 217}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 588005c84a6d..60c2822802f0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -471,74 +471,11 @@ struct ieee80211_sub_if_data {
471 } u; 471 } u;
472 472
473#ifdef CONFIG_MAC80211_DEBUGFS 473#ifdef CONFIG_MAC80211_DEBUGFS
474 struct dentry *debugfsdir;
475 union {
476 struct {
477 struct dentry *drop_unencrypted;
478 struct dentry *bssid;
479 struct dentry *aid;
480 struct dentry *capab;
481 struct dentry *force_unicast_rateidx;
482 struct dentry *max_ratectrl_rateidx;
483 } sta;
484 struct {
485 struct dentry *drop_unencrypted;
486 struct dentry *num_sta_ps;
487 struct dentry *dtim_count;
488 struct dentry *force_unicast_rateidx;
489 struct dentry *max_ratectrl_rateidx;
490 struct dentry *num_buffered_multicast;
491 } ap;
492 struct {
493 struct dentry *drop_unencrypted;
494 struct dentry *peer;
495 struct dentry *force_unicast_rateidx;
496 struct dentry *max_ratectrl_rateidx;
497 } wds;
498 struct {
499 struct dentry *drop_unencrypted;
500 struct dentry *force_unicast_rateidx;
501 struct dentry *max_ratectrl_rateidx;
502 } vlan;
503 struct {
504 struct dentry *mode;
505 } monitor;
506 } debugfs;
507 struct { 474 struct {
475 struct dentry *dir;
508 struct dentry *default_key; 476 struct dentry *default_key;
509 struct dentry *default_mgmt_key; 477 struct dentry *default_mgmt_key;
510 } common_debugfs; 478 } debugfs;
511
512#ifdef CONFIG_MAC80211_MESH
513 struct dentry *mesh_stats_dir;
514 struct {
515 struct dentry *fwded_mcast;
516 struct dentry *fwded_unicast;
517 struct dentry *fwded_frames;
518 struct dentry *dropped_frames_ttl;
519 struct dentry *dropped_frames_no_route;
520 struct dentry *estab_plinks;
521 struct timer_list mesh_path_timer;
522 } mesh_stats;
523
524 struct dentry *mesh_config_dir;
525 struct {
526 struct dentry *dot11MeshRetryTimeout;
527 struct dentry *dot11MeshConfirmTimeout;
528 struct dentry *dot11MeshHoldingTimeout;
529 struct dentry *dot11MeshMaxRetries;
530 struct dentry *dot11MeshTTL;
531 struct dentry *auto_open_plinks;
532 struct dentry *dot11MeshMaxPeerLinks;
533 struct dentry *dot11MeshHWMPactivePathTimeout;
534 struct dentry *dot11MeshHWMPpreqMinInterval;
535 struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
536 struct dentry *dot11MeshHWMPmaxPREQretries;
537 struct dentry *path_refresh_time;
538 struct dentry *min_discovery_timeout;
539 } mesh_config;
540#endif
541
542#endif 479#endif
543 /* must be last, dynamically sized area in this! */ 480 /* must be last, dynamically sized area in this! */
544 struct ieee80211_vif vif; 481 struct ieee80211_vif vif;
@@ -818,53 +755,6 @@ struct ieee80211_local {
818#ifdef CONFIG_MAC80211_DEBUGFS 755#ifdef CONFIG_MAC80211_DEBUGFS
819 struct local_debugfsdentries { 756 struct local_debugfsdentries {
820 struct dentry *rcdir; 757 struct dentry *rcdir;
821 struct dentry *rcname;
822 struct dentry *frequency;
823 struct dentry *total_ps_buffered;
824 struct dentry *wep_iv;
825 struct dentry *tsf;
826 struct dentry *queues;
827 struct dentry *reset;
828 struct dentry *noack;
829 struct dentry *statistics;
830 struct local_debugfsdentries_statsdentries {
831 struct dentry *transmitted_fragment_count;
832 struct dentry *multicast_transmitted_frame_count;
833 struct dentry *failed_count;
834 struct dentry *retry_count;
835 struct dentry *multiple_retry_count;
836 struct dentry *frame_duplicate_count;
837 struct dentry *received_fragment_count;
838 struct dentry *multicast_received_frame_count;
839 struct dentry *transmitted_frame_count;
840 struct dentry *wep_undecryptable_count;
841 struct dentry *num_scans;
842#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
843 struct dentry *tx_handlers_drop;
844 struct dentry *tx_handlers_queued;
845 struct dentry *tx_handlers_drop_unencrypted;
846 struct dentry *tx_handlers_drop_fragment;
847 struct dentry *tx_handlers_drop_wep;
848 struct dentry *tx_handlers_drop_not_assoc;
849 struct dentry *tx_handlers_drop_unauth_port;
850 struct dentry *rx_handlers_drop;
851 struct dentry *rx_handlers_queued;
852 struct dentry *rx_handlers_drop_nullfunc;
853 struct dentry *rx_handlers_drop_defrag;
854 struct dentry *rx_handlers_drop_short;
855 struct dentry *rx_handlers_drop_passive_scan;
856 struct dentry *tx_expand_skb_head;
857 struct dentry *tx_expand_skb_head_cloned;
858 struct dentry *rx_expand_skb_head;
859 struct dentry *rx_expand_skb_head2;
860 struct dentry *rx_handlers_fragments;
861 struct dentry *tx_status_drop;
862#endif
863 struct dentry *dot11ACKFailureCount;
864 struct dentry *dot11RTSFailureCount;
865 struct dentry *dot11FCSErrorCount;
866 struct dentry *dot11RTSSuccessCount;
867 } stats;
868 struct dentry *stations; 758 struct dentry *stations;
869 struct dentry *keys; 759 struct dentry *keys;
870 } debugfs; 760 } debugfs;
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 9572e00f532c..a49f93b79e92 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -118,18 +118,6 @@ struct ieee80211_key {
118 struct { 118 struct {
119 struct dentry *stalink; 119 struct dentry *stalink;
120 struct dentry *dir; 120 struct dentry *dir;
121 struct dentry *keylen;
122 struct dentry *flags;
123 struct dentry *keyidx;
124 struct dentry *hw_key_idx;
125 struct dentry *tx_rx_count;
126 struct dentry *algorithm;
127 struct dentry *tx_spec;
128 struct dentry *rx_spec;
129 struct dentry *replays;
130 struct dentry *icverrors;
131 struct dentry *key;
132 struct dentry *ifindex;
133 int cnt; 121 int cnt;
134 } debugfs; 122 } debugfs;
135#endif 123#endif
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 797f53942e5f..4e80213d6c77 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -923,7 +923,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
923 fail_wep: 923 fail_wep:
924 sta_info_stop(local); 924 sta_info_stop(local);
925 fail_sta_info: 925 fail_sta_info:
926 debugfs_hw_del(local);
927 destroy_workqueue(local->workqueue); 926 destroy_workqueue(local->workqueue);
928 fail_workqueue: 927 fail_workqueue:
929 wiphy_unregister(local->hw.wiphy); 928 wiphy_unregister(local->hw.wiphy);
@@ -959,7 +958,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
959 ieee80211_clear_tx_pending(local); 958 ieee80211_clear_tx_pending(local);
960 sta_info_stop(local); 959 sta_info_stop(local);
961 rate_control_deinitialize(local); 960 rate_control_deinitialize(local);
962 debugfs_hw_del(local);
963 961
964 if (skb_queue_len(&local->skb_queue) 962 if (skb_queue_len(&local->skb_queue)
965 || skb_queue_len(&local->skb_queue_unreliable)) 963 || skb_queue_len(&local->skb_queue_unreliable))
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index b33efc4fc267..ccda7454fb17 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -163,8 +163,7 @@ struct rate_control_ref *rate_control_alloc(const char *name,
163#ifdef CONFIG_MAC80211_DEBUGFS 163#ifdef CONFIG_MAC80211_DEBUGFS
164 debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); 164 debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
165 local->debugfs.rcdir = debugfsdir; 165 local->debugfs.rcdir = debugfsdir;
166 local->debugfs.rcname = debugfs_create_file("name", 0400, debugfsdir, 166 debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops);
167 ref, &rcname_ops);
168#endif 167#endif
169 168
170 ref->priv = ref->ops->alloc(&local->hw, debugfsdir); 169 ref->priv = ref->ops->alloc(&local->hw, debugfsdir);
@@ -188,9 +187,7 @@ static void rate_control_release(struct kref *kref)
188 ctrl_ref->ops->free(ctrl_ref->priv); 187 ctrl_ref->ops->free(ctrl_ref->priv);
189 188
190#ifdef CONFIG_MAC80211_DEBUGFS 189#ifdef CONFIG_MAC80211_DEBUGFS
191 debugfs_remove(ctrl_ref->local->debugfs.rcname); 190 debugfs_remove_recursive(ctrl_ref->local->debugfs.rcdir);
192 ctrl_ref->local->debugfs.rcname = NULL;
193 debugfs_remove(ctrl_ref->local->debugfs.rcdir);
194 ctrl_ref->local->debugfs.rcdir = NULL; 191 ctrl_ref->local->debugfs.rcdir = NULL;
195#endif 192#endif
196 193
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index ccc3adf962c7..b3686c870b5e 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -301,28 +301,6 @@ struct sta_info {
301#ifdef CONFIG_MAC80211_DEBUGFS 301#ifdef CONFIG_MAC80211_DEBUGFS
302 struct sta_info_debugfsdentries { 302 struct sta_info_debugfsdentries {
303 struct dentry *dir; 303 struct dentry *dir;
304 struct dentry *flags;
305 struct dentry *num_ps_buf_frames;
306 struct dentry *inactive_ms;
307 struct dentry *last_seq_ctrl;
308 struct dentry *agg_status;
309 struct dentry *aid;
310 struct dentry *dev;
311 struct dentry *rx_packets;
312 struct dentry *tx_packets;
313 struct dentry *rx_bytes;
314 struct dentry *tx_bytes;
315 struct dentry *rx_duplicates;
316 struct dentry *rx_fragments;
317 struct dentry *rx_dropped;
318 struct dentry *tx_fragments;
319 struct dentry *tx_filtered;
320 struct dentry *tx_retry_failed;
321 struct dentry *tx_retry_count;
322 struct dentry *last_signal;
323 struct dentry *last_qual;
324 struct dentry *last_noise;
325 struct dentry *wep_weak_iv_count;
326 bool add_has_run; 304 bool add_has_run;
327 } debugfs; 305 } debugfs;
328#endif 306#endif