debugfs_netdev.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /*
  2. * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
  3. * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/device.h>
  11. #include <linux/if.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/netdevice.h>
  14. #include <linux/rtnetlink.h>
  15. #include <linux/notifier.h>
  16. #include <net/mac80211.h>
  17. #include <net/cfg80211.h>
  18. #include "ieee80211_i.h"
  19. #include "rate.h"
  20. #include "debugfs.h"
  21. #include "debugfs_netdev.h"
  22. static ssize_t ieee80211_if_read(
  23. struct ieee80211_sub_if_data *sdata,
  24. char __user *userbuf,
  25. size_t count, loff_t *ppos,
  26. ssize_t (*format)(const struct ieee80211_sub_if_data *, char *, int))
  27. {
  28. char buf[70];
  29. ssize_t ret = -EINVAL;
  30. read_lock(&dev_base_lock);
  31. if (sdata->dev->reg_state == NETREG_REGISTERED)
  32. ret = (*format)(sdata, buf, sizeof(buf));
  33. read_unlock(&dev_base_lock);
  34. if (ret != -EINVAL)
  35. ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
  36. return ret;
  37. }
  38. #define IEEE80211_IF_FMT(name, field, format_string) \
  39. static ssize_t ieee80211_if_fmt_##name( \
  40. const struct ieee80211_sub_if_data *sdata, char *buf, \
  41. int buflen) \
  42. { \
  43. return scnprintf(buf, buflen, format_string, sdata->field); \
  44. }
  45. #define IEEE80211_IF_FMT_DEC(name, field) \
  46. IEEE80211_IF_FMT(name, field, "%d\n")
  47. #define IEEE80211_IF_FMT_HEX(name, field) \
  48. IEEE80211_IF_FMT(name, field, "%#x\n")
  49. #define IEEE80211_IF_FMT_SIZE(name, field) \
  50. IEEE80211_IF_FMT(name, field, "%zd\n")
  51. #define IEEE80211_IF_FMT_ATOMIC(name, field) \
  52. static ssize_t ieee80211_if_fmt_##name( \
  53. const struct ieee80211_sub_if_data *sdata, \
  54. char *buf, int buflen) \
  55. { \
  56. return scnprintf(buf, buflen, "%d\n", atomic_read(&sdata->field));\
  57. }
  58. #define IEEE80211_IF_FMT_MAC(name, field) \
  59. static ssize_t ieee80211_if_fmt_##name( \
  60. const struct ieee80211_sub_if_data *sdata, char *buf, \
  61. int buflen) \
  62. { \
  63. return scnprintf(buf, buflen, "%pM\n", sdata->field); \
  64. }
  65. #define __IEEE80211_IF_FILE(name) \
  66. static ssize_t ieee80211_if_read_##name(struct file *file, \
  67. char __user *userbuf, \
  68. size_t count, loff_t *ppos) \
  69. { \
  70. return ieee80211_if_read(file->private_data, \
  71. userbuf, count, ppos, \
  72. ieee80211_if_fmt_##name); \
  73. } \
  74. static const struct file_operations name##_ops = { \
  75. .read = ieee80211_if_read_##name, \
  76. .open = mac80211_open_file_generic, \
  77. }
  78. #define IEEE80211_IF_FILE(name, field, format) \
  79. IEEE80211_IF_FMT_##format(name, field) \
  80. __IEEE80211_IF_FILE(name)
  81. /* common attributes */
  82. IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC);
  83. IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC);
  84. IEEE80211_IF_FILE(max_ratectrl_rateidx, max_ratectrl_rateidx, DEC);
  85. /* STA attributes */
  86. IEEE80211_IF_FILE(state, u.mgd.state, DEC);
  87. IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
  88. IEEE80211_IF_FILE(prev_bssid, u.mgd.prev_bssid, MAC);
  89. IEEE80211_IF_FILE(ssid_len, u.mgd.ssid_len, SIZE);
  90. IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
  91. IEEE80211_IF_FILE(ap_capab, u.mgd.ap_capab, HEX);
  92. IEEE80211_IF_FILE(capab, u.mgd.capab, HEX);
  93. IEEE80211_IF_FILE(extra_ie_len, u.mgd.extra_ie_len, SIZE);
  94. IEEE80211_IF_FILE(auth_tries, u.mgd.auth_tries, DEC);
  95. IEEE80211_IF_FILE(assoc_tries, u.mgd.assoc_tries, DEC);
  96. IEEE80211_IF_FILE(auth_algs, u.mgd.auth_algs, HEX);
  97. IEEE80211_IF_FILE(auth_alg, u.mgd.auth_alg, DEC);
  98. IEEE80211_IF_FILE(auth_transaction, u.mgd.auth_transaction, DEC);
  99. static ssize_t ieee80211_if_fmt_flags(
  100. const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
  101. {
  102. return scnprintf(buf, buflen, "%s%s%s%s%s%s%s\n",
  103. sdata->u.mgd.flags & IEEE80211_STA_SSID_SET ? "SSID\n" : "",
  104. sdata->u.mgd.flags & IEEE80211_STA_BSSID_SET ? "BSSID\n" : "",
  105. sdata->u.mgd.flags & IEEE80211_STA_PREV_BSSID_SET ? "prev BSSID\n" : "",
  106. sdata->u.mgd.flags & IEEE80211_STA_AUTHENTICATED ? "AUTH\n" : "",
  107. sdata->u.mgd.flags & IEEE80211_STA_ASSOCIATED ? "ASSOC\n" : "",
  108. sdata->u.mgd.flags & IEEE80211_STA_PROBEREQ_POLL ? "PROBEREQ POLL\n" : "",
  109. sdata->vif.bss_conf.use_cts_prot ? "CTS prot\n" : "");
  110. }
  111. __IEEE80211_IF_FILE(flags);
  112. /* AP attributes */
  113. IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC);
  114. IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC);
  115. static ssize_t ieee80211_if_fmt_num_buffered_multicast(
  116. const struct ieee80211_sub_if_data *sdata, char *buf, int buflen)
  117. {
  118. return scnprintf(buf, buflen, "%u\n",
  119. skb_queue_len(&sdata->u.ap.ps_bc_buf));
  120. }
  121. __IEEE80211_IF_FILE(num_buffered_multicast);
  122. /* WDS attributes */
  123. IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC);
  124. #ifdef CONFIG_MAC80211_MESH
  125. /* Mesh stats attributes */
  126. IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC);
  127. IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC);
  128. IEEE80211_IF_FILE(dropped_frames_no_route,
  129. u.mesh.mshstats.dropped_frames_no_route, DEC);
  130. IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC);
  131. /* Mesh parameters */
  132. IEEE80211_IF_FILE(dot11MeshMaxRetries,
  133. u.mesh.mshcfg.dot11MeshMaxRetries, DEC);
  134. IEEE80211_IF_FILE(dot11MeshRetryTimeout,
  135. u.mesh.mshcfg.dot11MeshRetryTimeout, DEC);
  136. IEEE80211_IF_FILE(dot11MeshConfirmTimeout,
  137. u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC);
  138. IEEE80211_IF_FILE(dot11MeshHoldingTimeout,
  139. u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC);
  140. IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC);
  141. IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC);
  142. IEEE80211_IF_FILE(dot11MeshMaxPeerLinks,
  143. u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC);
  144. IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout,
  145. u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC);
  146. IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval,
  147. u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC);
  148. IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime,
  149. u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC);
  150. IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries,
  151. u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC);
  152. IEEE80211_IF_FILE(path_refresh_time,
  153. u.mesh.mshcfg.path_refresh_time, DEC);
  154. IEEE80211_IF_FILE(min_discovery_timeout,
  155. u.mesh.mshcfg.min_discovery_timeout, DEC);
  156. #endif
  157. #define DEBUGFS_ADD(name, type)\
  158. sdata->debugfs.type.name = debugfs_create_file(#name, 0400,\
  159. sdata->debugfsdir, sdata, &name##_ops);
  160. static void add_sta_files(struct ieee80211_sub_if_data *sdata)
  161. {
  162. DEBUGFS_ADD(drop_unencrypted, sta);
  163. DEBUGFS_ADD(force_unicast_rateidx, sta);
  164. DEBUGFS_ADD(max_ratectrl_rateidx, sta);
  165. DEBUGFS_ADD(state, sta);
  166. DEBUGFS_ADD(bssid, sta);
  167. DEBUGFS_ADD(prev_bssid, sta);
  168. DEBUGFS_ADD(ssid_len, sta);
  169. DEBUGFS_ADD(aid, sta);
  170. DEBUGFS_ADD(ap_capab, sta);
  171. DEBUGFS_ADD(capab, sta);
  172. DEBUGFS_ADD(extra_ie_len, sta);
  173. DEBUGFS_ADD(auth_tries, sta);
  174. DEBUGFS_ADD(assoc_tries, sta);
  175. DEBUGFS_ADD(auth_algs, sta);
  176. DEBUGFS_ADD(auth_alg, sta);
  177. DEBUGFS_ADD(auth_transaction, sta);
  178. DEBUGFS_ADD(flags, sta);
  179. }
  180. static void add_ap_files(struct ieee80211_sub_if_data *sdata)
  181. {
  182. DEBUGFS_ADD(drop_unencrypted, ap);
  183. DEBUGFS_ADD(force_unicast_rateidx, ap);
  184. DEBUGFS_ADD(max_ratectrl_rateidx, ap);
  185. DEBUGFS_ADD(num_sta_ps, ap);
  186. DEBUGFS_ADD(dtim_count, ap);
  187. DEBUGFS_ADD(num_buffered_multicast, ap);
  188. }
  189. static void add_wds_files(struct ieee80211_sub_if_data *sdata)
  190. {
  191. DEBUGFS_ADD(drop_unencrypted, wds);
  192. DEBUGFS_ADD(force_unicast_rateidx, wds);
  193. DEBUGFS_ADD(max_ratectrl_rateidx, wds);
  194. DEBUGFS_ADD(peer, wds);
  195. }
  196. static void add_vlan_files(struct ieee80211_sub_if_data *sdata)
  197. {
  198. DEBUGFS_ADD(drop_unencrypted, vlan);
  199. DEBUGFS_ADD(force_unicast_rateidx, vlan);
  200. DEBUGFS_ADD(max_ratectrl_rateidx, vlan);
  201. }
  202. static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
  203. {
  204. }
  205. #ifdef CONFIG_MAC80211_MESH
  206. #define MESHSTATS_ADD(name)\
  207. sdata->mesh_stats.name = debugfs_create_file(#name, 0400,\
  208. sdata->mesh_stats_dir, sdata, &name##_ops);
  209. static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
  210. {
  211. sdata->mesh_stats_dir = debugfs_create_dir("mesh_stats",
  212. sdata->debugfsdir);
  213. MESHSTATS_ADD(fwded_frames);
  214. MESHSTATS_ADD(dropped_frames_ttl);
  215. MESHSTATS_ADD(dropped_frames_no_route);
  216. MESHSTATS_ADD(estab_plinks);
  217. }
  218. #define MESHPARAMS_ADD(name)\
  219. sdata->mesh_config.name = debugfs_create_file(#name, 0600,\
  220. sdata->mesh_config_dir, sdata, &name##_ops);
  221. static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
  222. {
  223. sdata->mesh_config_dir = debugfs_create_dir("mesh_config",
  224. sdata->debugfsdir);
  225. MESHPARAMS_ADD(dot11MeshMaxRetries);
  226. MESHPARAMS_ADD(dot11MeshRetryTimeout);
  227. MESHPARAMS_ADD(dot11MeshConfirmTimeout);
  228. MESHPARAMS_ADD(dot11MeshHoldingTimeout);
  229. MESHPARAMS_ADD(dot11MeshTTL);
  230. MESHPARAMS_ADD(auto_open_plinks);
  231. MESHPARAMS_ADD(dot11MeshMaxPeerLinks);
  232. MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout);
  233. MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval);
  234. MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime);
  235. MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries);
  236. MESHPARAMS_ADD(path_refresh_time);
  237. MESHPARAMS_ADD(min_discovery_timeout);
  238. }
  239. #endif
  240. static void add_files(struct ieee80211_sub_if_data *sdata)
  241. {
  242. if (!sdata->debugfsdir)
  243. return;
  244. switch (sdata->vif.type) {
  245. case NL80211_IFTYPE_MESH_POINT:
  246. #ifdef CONFIG_MAC80211_MESH
  247. add_mesh_stats(sdata);
  248. add_mesh_config(sdata);
  249. #endif
  250. break;
  251. case NL80211_IFTYPE_STATION:
  252. add_sta_files(sdata);
  253. break;
  254. case NL80211_IFTYPE_ADHOC:
  255. /* XXX */
  256. break;
  257. case NL80211_IFTYPE_AP:
  258. add_ap_files(sdata);
  259. break;
  260. case NL80211_IFTYPE_WDS:
  261. add_wds_files(sdata);
  262. break;
  263. case NL80211_IFTYPE_MONITOR:
  264. add_monitor_files(sdata);
  265. break;
  266. case NL80211_IFTYPE_AP_VLAN:
  267. add_vlan_files(sdata);
  268. break;
  269. default:
  270. break;
  271. }
  272. }
  273. #define DEBUGFS_DEL(name, type) \
  274. do { \
  275. debugfs_remove(sdata->debugfs.type.name); \
  276. sdata->debugfs.type.name = NULL; \
  277. } while (0)
  278. static void del_sta_files(struct ieee80211_sub_if_data *sdata)
  279. {
  280. DEBUGFS_DEL(drop_unencrypted, sta);
  281. DEBUGFS_DEL(force_unicast_rateidx, sta);
  282. DEBUGFS_DEL(max_ratectrl_rateidx, sta);
  283. DEBUGFS_DEL(state, sta);
  284. DEBUGFS_DEL(bssid, sta);
  285. DEBUGFS_DEL(prev_bssid, sta);
  286. DEBUGFS_DEL(ssid_len, sta);
  287. DEBUGFS_DEL(aid, sta);
  288. DEBUGFS_DEL(ap_capab, sta);
  289. DEBUGFS_DEL(capab, sta);
  290. DEBUGFS_DEL(extra_ie_len, sta);
  291. DEBUGFS_DEL(auth_tries, sta);
  292. DEBUGFS_DEL(assoc_tries, sta);
  293. DEBUGFS_DEL(auth_algs, sta);
  294. DEBUGFS_DEL(auth_alg, sta);
  295. DEBUGFS_DEL(auth_transaction, sta);
  296. DEBUGFS_DEL(flags, sta);
  297. }
  298. static void del_ap_files(struct ieee80211_sub_if_data *sdata)
  299. {
  300. DEBUGFS_DEL(drop_unencrypted, ap);
  301. DEBUGFS_DEL(force_unicast_rateidx, ap);
  302. DEBUGFS_DEL(max_ratectrl_rateidx, ap);
  303. DEBUGFS_DEL(num_sta_ps, ap);
  304. DEBUGFS_DEL(dtim_count, ap);
  305. DEBUGFS_DEL(num_buffered_multicast, ap);
  306. }
  307. static void del_wds_files(struct ieee80211_sub_if_data *sdata)
  308. {
  309. DEBUGFS_DEL(drop_unencrypted, wds);
  310. DEBUGFS_DEL(force_unicast_rateidx, wds);
  311. DEBUGFS_DEL(max_ratectrl_rateidx, wds);
  312. DEBUGFS_DEL(peer, wds);
  313. }
  314. static 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. static void del_monitor_files(struct ieee80211_sub_if_data *sdata)
  321. {
  322. }
  323. #ifdef CONFIG_MAC80211_MESH
  324. #define MESHSTATS_DEL(name) \
  325. do { \
  326. debugfs_remove(sdata->mesh_stats.name); \
  327. sdata->mesh_stats.name = NULL; \
  328. } while (0)
  329. static void del_mesh_stats(struct ieee80211_sub_if_data *sdata)
  330. {
  331. MESHSTATS_DEL(fwded_frames);
  332. MESHSTATS_DEL(dropped_frames_ttl);
  333. MESHSTATS_DEL(dropped_frames_no_route);
  334. MESHSTATS_DEL(estab_plinks);
  335. debugfs_remove(sdata->mesh_stats_dir);
  336. sdata->mesh_stats_dir = NULL;
  337. }
  338. #define MESHPARAMS_DEL(name) \
  339. do { \
  340. debugfs_remove(sdata->mesh_config.name); \
  341. sdata->mesh_config.name = NULL; \
  342. } while (0)
  343. static void del_mesh_config(struct ieee80211_sub_if_data *sdata)
  344. {
  345. MESHPARAMS_DEL(dot11MeshMaxRetries);
  346. MESHPARAMS_DEL(dot11MeshRetryTimeout);
  347. MESHPARAMS_DEL(dot11MeshConfirmTimeout);
  348. MESHPARAMS_DEL(dot11MeshHoldingTimeout);
  349. MESHPARAMS_DEL(dot11MeshTTL);
  350. MESHPARAMS_DEL(auto_open_plinks);
  351. MESHPARAMS_DEL(dot11MeshMaxPeerLinks);
  352. MESHPARAMS_DEL(dot11MeshHWMPactivePathTimeout);
  353. MESHPARAMS_DEL(dot11MeshHWMPpreqMinInterval);
  354. MESHPARAMS_DEL(dot11MeshHWMPnetDiameterTraversalTime);
  355. MESHPARAMS_DEL(dot11MeshHWMPmaxPREQretries);
  356. MESHPARAMS_DEL(path_refresh_time);
  357. MESHPARAMS_DEL(min_discovery_timeout);
  358. debugfs_remove(sdata->mesh_config_dir);
  359. sdata->mesh_config_dir = NULL;
  360. }
  361. #endif
  362. static void del_files(struct ieee80211_sub_if_data *sdata)
  363. {
  364. if (!sdata->debugfsdir)
  365. return;
  366. switch (sdata->vif.type) {
  367. case NL80211_IFTYPE_MESH_POINT:
  368. #ifdef CONFIG_MAC80211_MESH
  369. del_mesh_stats(sdata);
  370. del_mesh_config(sdata);
  371. #endif
  372. break;
  373. case NL80211_IFTYPE_STATION:
  374. del_sta_files(sdata);
  375. break;
  376. case NL80211_IFTYPE_ADHOC:
  377. /* XXX */
  378. break;
  379. case NL80211_IFTYPE_AP:
  380. del_ap_files(sdata);
  381. break;
  382. case NL80211_IFTYPE_WDS:
  383. del_wds_files(sdata);
  384. break;
  385. case NL80211_IFTYPE_MONITOR:
  386. del_monitor_files(sdata);
  387. break;
  388. case NL80211_IFTYPE_AP_VLAN:
  389. del_vlan_files(sdata);
  390. break;
  391. default:
  392. break;
  393. }
  394. }
  395. static int notif_registered;
  396. void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata)
  397. {
  398. char buf[10+IFNAMSIZ];
  399. if (!notif_registered)
  400. return;
  401. sprintf(buf, "netdev:%s", sdata->dev->name);
  402. sdata->debugfsdir = debugfs_create_dir(buf,
  403. sdata->local->hw.wiphy->debugfsdir);
  404. add_files(sdata);
  405. }
  406. void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata)
  407. {
  408. del_files(sdata);
  409. debugfs_remove(sdata->debugfsdir);
  410. sdata->debugfsdir = NULL;
  411. }
  412. static int netdev_notify(struct notifier_block *nb,
  413. unsigned long state,
  414. void *ndev)
  415. {
  416. struct net_device *dev = ndev;
  417. struct dentry *dir;
  418. struct ieee80211_sub_if_data *sdata;
  419. char buf[10+IFNAMSIZ];
  420. if (state != NETDEV_CHANGENAME)
  421. return 0;
  422. if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy)
  423. return 0;
  424. if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
  425. return 0;
  426. sdata = IEEE80211_DEV_TO_SUB_IF(dev);
  427. dir = sdata->debugfsdir;
  428. if (!dir)
  429. return 0;
  430. sprintf(buf, "netdev:%s", dev->name);
  431. if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
  432. printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
  433. "dir to %s\n", buf);
  434. return 0;
  435. }
  436. static struct notifier_block mac80211_debugfs_netdev_notifier = {
  437. .notifier_call = netdev_notify,
  438. };
  439. void ieee80211_debugfs_netdev_init(void)
  440. {
  441. int err;
  442. err = register_netdevice_notifier(&mac80211_debugfs_netdev_notifier);
  443. if (err) {
  444. printk(KERN_ERR
  445. "mac80211: failed to install netdev notifier,"
  446. " disabling per-netdev debugfs!\n");
  447. } else
  448. notif_registered = 1;
  449. }
  450. void ieee80211_debugfs_netdev_exit(void)
  451. {
  452. unregister_netdevice_notifier(&mac80211_debugfs_netdev_notifier);
  453. notif_registered = 0;
  454. }