diff options
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
| -rw-r--r-- | net/mac80211/debugfs_netdev.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index e3326d046944..475f89a8aee1 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
| @@ -155,8 +155,9 @@ static const struct file_operations name##_ops = { \ | |||
| 155 | __IEEE80211_IF_WFILE(name) | 155 | __IEEE80211_IF_WFILE(name) |
| 156 | 156 | ||
| 157 | /* common attributes */ | 157 | /* common attributes */ |
| 158 | IEEE80211_IF_FILE(channel_use, channel_use, DEC); | ||
| 159 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); | 158 | IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); |
| 159 | IEEE80211_IF_FILE(force_unicast_rateidx, force_unicast_rateidx, DEC); | ||
| 160 | IEEE80211_IF_FILE(max_ratectrl_rateidx, max_ratectrl_rateidx, DEC); | ||
| 160 | 161 | ||
| 161 | /* STA/IBSS attributes */ | 162 | /* STA/IBSS attributes */ |
| 162 | IEEE80211_IF_FILE(state, u.sta.state, DEC); | 163 | IEEE80211_IF_FILE(state, u.sta.state, DEC); |
| @@ -192,8 +193,6 @@ __IEEE80211_IF_FILE(flags); | |||
| 192 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); | 193 | IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); |
| 193 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); | 194 | IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); |
| 194 | IEEE80211_IF_FILE(num_beacons, u.ap.num_beacons, DEC); | 195 | IEEE80211_IF_FILE(num_beacons, u.ap.num_beacons, DEC); |
| 195 | IEEE80211_IF_FILE(force_unicast_rateidx, u.ap.force_unicast_rateidx, DEC); | ||
| 196 | IEEE80211_IF_FILE(max_ratectrl_rateidx, u.ap.max_ratectrl_rateidx, DEC); | ||
| 197 | 196 | ||
| 198 | static ssize_t ieee80211_if_fmt_num_buffered_multicast( | 197 | static ssize_t ieee80211_if_fmt_num_buffered_multicast( |
| 199 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) | 198 | const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) |
| @@ -248,8 +247,10 @@ IEEE80211_IF_WFILE(min_discovery_timeout, | |||
| 248 | 247 | ||
| 249 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) | 248 | static void add_sta_files(struct ieee80211_sub_if_data *sdata) |
| 250 | { | 249 | { |
| 251 | DEBUGFS_ADD(channel_use, sta); | ||
| 252 | DEBUGFS_ADD(drop_unencrypted, sta); | 250 | DEBUGFS_ADD(drop_unencrypted, sta); |
| 251 | DEBUGFS_ADD(force_unicast_rateidx, ap); | ||
| 252 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | ||
| 253 | |||
| 253 | DEBUGFS_ADD(state, sta); | 254 | DEBUGFS_ADD(state, sta); |
| 254 | DEBUGFS_ADD(bssid, sta); | 255 | DEBUGFS_ADD(bssid, sta); |
| 255 | DEBUGFS_ADD(prev_bssid, sta); | 256 | DEBUGFS_ADD(prev_bssid, sta); |
| @@ -269,27 +270,30 @@ static void add_sta_files(struct ieee80211_sub_if_data *sdata) | |||
| 269 | 270 | ||
| 270 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) | 271 | static void add_ap_files(struct ieee80211_sub_if_data *sdata) |
| 271 | { | 272 | { |
| 272 | DEBUGFS_ADD(channel_use, ap); | ||
| 273 | DEBUGFS_ADD(drop_unencrypted, ap); | 273 | DEBUGFS_ADD(drop_unencrypted, ap); |
| 274 | DEBUGFS_ADD(force_unicast_rateidx, ap); | ||
| 275 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | ||
| 276 | |||
| 274 | DEBUGFS_ADD(num_sta_ps, ap); | 277 | DEBUGFS_ADD(num_sta_ps, ap); |
| 275 | DEBUGFS_ADD(dtim_count, ap); | 278 | DEBUGFS_ADD(dtim_count, ap); |
| 276 | DEBUGFS_ADD(num_beacons, ap); | 279 | DEBUGFS_ADD(num_beacons, ap); |
| 277 | DEBUGFS_ADD(force_unicast_rateidx, ap); | ||
| 278 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | ||
| 279 | DEBUGFS_ADD(num_buffered_multicast, ap); | 280 | DEBUGFS_ADD(num_buffered_multicast, ap); |
| 280 | } | 281 | } |
| 281 | 282 | ||
| 282 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) | 283 | static void add_wds_files(struct ieee80211_sub_if_data *sdata) |
| 283 | { | 284 | { |
| 284 | DEBUGFS_ADD(channel_use, wds); | ||
| 285 | DEBUGFS_ADD(drop_unencrypted, wds); | 285 | DEBUGFS_ADD(drop_unencrypted, wds); |
| 286 | DEBUGFS_ADD(force_unicast_rateidx, ap); | ||
| 287 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | ||
| 288 | |||
| 286 | DEBUGFS_ADD(peer, wds); | 289 | DEBUGFS_ADD(peer, wds); |
| 287 | } | 290 | } |
| 288 | 291 | ||
| 289 | static void add_vlan_files(struct ieee80211_sub_if_data *sdata) | 292 | static void add_vlan_files(struct ieee80211_sub_if_data *sdata) |
| 290 | { | 293 | { |
| 291 | DEBUGFS_ADD(channel_use, vlan); | ||
| 292 | DEBUGFS_ADD(drop_unencrypted, vlan); | 294 | DEBUGFS_ADD(drop_unencrypted, vlan); |
| 295 | DEBUGFS_ADD(force_unicast_rateidx, ap); | ||
| 296 | DEBUGFS_ADD(max_ratectrl_rateidx, ap); | ||
| 293 | } | 297 | } |
| 294 | 298 | ||
| 295 | static void add_monitor_files(struct ieee80211_sub_if_data *sdata) | 299 | static void add_monitor_files(struct ieee80211_sub_if_data *sdata) |
| @@ -376,8 +380,10 @@ static void add_files(struct ieee80211_sub_if_data *sdata) | |||
| 376 | 380 | ||
| 377 | static void del_sta_files(struct ieee80211_sub_if_data *sdata) | 381 | static void del_sta_files(struct ieee80211_sub_if_data *sdata) |
| 378 | { | 382 | { |
| 379 | DEBUGFS_DEL(channel_use, sta); | ||
| 380 | DEBUGFS_DEL(drop_unencrypted, sta); | 383 | DEBUGFS_DEL(drop_unencrypted, sta); |
| 384 | DEBUGFS_DEL(force_unicast_rateidx, ap); | ||
| 385 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | ||
| 386 | |||
| 381 | DEBUGFS_DEL(state, sta); | 387 | DEBUGFS_DEL(state, sta); |
| 382 | DEBUGFS_DEL(bssid, sta); | 388 | DEBUGFS_DEL(bssid, sta); |
| 383 | DEBUGFS_DEL(prev_bssid, sta); | 389 | DEBUGFS_DEL(prev_bssid, sta); |
| @@ -397,27 +403,30 @@ static void del_sta_files(struct ieee80211_sub_if_data *sdata) | |||
| 397 | 403 | ||
| 398 | static void del_ap_files(struct ieee80211_sub_if_data *sdata) | 404 | static void del_ap_files(struct ieee80211_sub_if_data *sdata) |
| 399 | { | 405 | { |
| 400 | DEBUGFS_DEL(channel_use, ap); | ||
| 401 | DEBUGFS_DEL(drop_unencrypted, ap); | 406 | DEBUGFS_DEL(drop_unencrypted, ap); |
| 407 | DEBUGFS_DEL(force_unicast_rateidx, ap); | ||
| 408 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | ||
| 409 | |||
| 402 | DEBUGFS_DEL(num_sta_ps, ap); | 410 | DEBUGFS_DEL(num_sta_ps, ap); |
| 403 | DEBUGFS_DEL(dtim_count, ap); | 411 | DEBUGFS_DEL(dtim_count, ap); |
| 404 | DEBUGFS_DEL(num_beacons, ap); | 412 | DEBUGFS_DEL(num_beacons, ap); |
| 405 | DEBUGFS_DEL(force_unicast_rateidx, ap); | ||
| 406 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | ||
| 407 | DEBUGFS_DEL(num_buffered_multicast, ap); | 413 | DEBUGFS_DEL(num_buffered_multicast, ap); |
| 408 | } | 414 | } |
| 409 | 415 | ||
| 410 | static void del_wds_files(struct ieee80211_sub_if_data *sdata) | 416 | static void del_wds_files(struct ieee80211_sub_if_data *sdata) |
| 411 | { | 417 | { |
| 412 | DEBUGFS_DEL(channel_use, wds); | ||
| 413 | DEBUGFS_DEL(drop_unencrypted, wds); | 418 | DEBUGFS_DEL(drop_unencrypted, wds); |
| 419 | DEBUGFS_DEL(force_unicast_rateidx, ap); | ||
| 420 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | ||
| 421 | |||
| 414 | DEBUGFS_DEL(peer, wds); | 422 | DEBUGFS_DEL(peer, wds); |
| 415 | } | 423 | } |
| 416 | 424 | ||
| 417 | static void del_vlan_files(struct ieee80211_sub_if_data *sdata) | 425 | static void del_vlan_files(struct ieee80211_sub_if_data *sdata) |
| 418 | { | 426 | { |
| 419 | DEBUGFS_DEL(channel_use, vlan); | ||
| 420 | DEBUGFS_DEL(drop_unencrypted, vlan); | 427 | DEBUGFS_DEL(drop_unencrypted, vlan); |
| 428 | DEBUGFS_DEL(force_unicast_rateidx, ap); | ||
| 429 | DEBUGFS_DEL(max_ratectrl_rateidx, ap); | ||
| 421 | } | 430 | } |
| 422 | 431 | ||
| 423 | static void del_monitor_files(struct ieee80211_sub_if_data *sdata) | 432 | static void del_monitor_files(struct ieee80211_sub_if_data *sdata) |
| @@ -467,12 +476,12 @@ static void del_mesh_config(struct ieee80211_sub_if_data *sdata) | |||
| 467 | } | 476 | } |
| 468 | #endif | 477 | #endif |
| 469 | 478 | ||
| 470 | static void del_files(struct ieee80211_sub_if_data *sdata, int type) | 479 | static void del_files(struct ieee80211_sub_if_data *sdata) |
| 471 | { | 480 | { |
| 472 | if (!sdata->debugfsdir) | 481 | if (!sdata->debugfsdir) |
| 473 | return; | 482 | return; |
| 474 | 483 | ||
| 475 | switch (type) { | 484 | switch (sdata->vif.type) { |
| 476 | case IEEE80211_IF_TYPE_MESH_POINT: | 485 | case IEEE80211_IF_TYPE_MESH_POINT: |
| 477 | #ifdef CONFIG_MAC80211_MESH | 486 | #ifdef CONFIG_MAC80211_MESH |
| 478 | del_mesh_stats(sdata); | 487 | del_mesh_stats(sdata); |
| @@ -512,29 +521,23 @@ void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) | |||
| 512 | sprintf(buf, "netdev:%s", sdata->dev->name); | 521 | sprintf(buf, "netdev:%s", sdata->dev->name); |
| 513 | sdata->debugfsdir = debugfs_create_dir(buf, | 522 | sdata->debugfsdir = debugfs_create_dir(buf, |
| 514 | sdata->local->hw.wiphy->debugfsdir); | 523 | sdata->local->hw.wiphy->debugfsdir); |
| 524 | add_files(sdata); | ||
| 515 | } | 525 | } |
| 516 | 526 | ||
| 517 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) | 527 | void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) |
| 518 | { | 528 | { |
| 519 | del_files(sdata, sdata->vif.type); | 529 | del_files(sdata); |
| 520 | debugfs_remove(sdata->debugfsdir); | 530 | debugfs_remove(sdata->debugfsdir); |
| 521 | sdata->debugfsdir = NULL; | 531 | sdata->debugfsdir = NULL; |
| 522 | } | 532 | } |
| 523 | 533 | ||
| 524 | void ieee80211_debugfs_change_if_type(struct ieee80211_sub_if_data *sdata, | 534 | static int netdev_notify(struct notifier_block *nb, |
| 525 | int oldtype) | ||
| 526 | { | ||
| 527 | del_files(sdata, oldtype); | ||
| 528 | add_files(sdata); | ||
| 529 | } | ||
| 530 | |||
| 531 | static int netdev_notify(struct notifier_block * nb, | ||
| 532 | unsigned long state, | 535 | unsigned long state, |
| 533 | void *ndev) | 536 | void *ndev) |
| 534 | { | 537 | { |
| 535 | struct net_device *dev = ndev; | 538 | struct net_device *dev = ndev; |
| 536 | struct dentry *dir; | 539 | struct dentry *dir; |
| 537 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 540 | struct ieee80211_sub_if_data *sdata; |
| 538 | char buf[10+IFNAMSIZ]; | 541 | char buf[10+IFNAMSIZ]; |
| 539 | 542 | ||
| 540 | if (state != NETDEV_CHANGENAME) | 543 | if (state != NETDEV_CHANGENAME) |
| @@ -546,6 +549,8 @@ static int netdev_notify(struct notifier_block * nb, | |||
| 546 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) | 549 | if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) |
| 547 | return 0; | 550 | return 0; |
| 548 | 551 | ||
| 552 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 553 | |||
| 549 | sprintf(buf, "netdev:%s", dev->name); | 554 | sprintf(buf, "netdev:%s", dev->name); |
| 550 | dir = sdata->debugfsdir; | 555 | dir = sdata->debugfsdir; |
| 551 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) | 556 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) |
