diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/debugfs.c')
| -rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/debugfs.c | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index b080b4ba5458..2053dccefcd6 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
| @@ -300,6 +300,67 @@ static ssize_t iwl_dbgfs_power_down_d3_allow_write(struct file *file, | |||
| 300 | return count; | 300 | return count; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | static ssize_t iwl_dbgfs_mac_params_read(struct file *file, | ||
| 304 | char __user *user_buf, | ||
| 305 | size_t count, loff_t *ppos) | ||
| 306 | { | ||
| 307 | struct ieee80211_vif *vif = file->private_data; | ||
| 308 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 309 | struct iwl_mvm *mvm = mvmvif->dbgfs_data; | ||
| 310 | u8 ap_sta_id; | ||
| 311 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
| 312 | char buf[512]; | ||
| 313 | int bufsz = sizeof(buf); | ||
| 314 | int pos = 0; | ||
| 315 | int i; | ||
| 316 | |||
| 317 | mutex_lock(&mvm->mutex); | ||
| 318 | |||
| 319 | ap_sta_id = mvmvif->ap_sta_id; | ||
| 320 | |||
| 321 | pos += scnprintf(buf+pos, bufsz-pos, "mac id/color: %d / %d\n", | ||
| 322 | mvmvif->id, mvmvif->color); | ||
| 323 | pos += scnprintf(buf+pos, bufsz-pos, "bssid: %pM\n", | ||
| 324 | vif->bss_conf.bssid); | ||
| 325 | pos += scnprintf(buf+pos, bufsz-pos, "QoS:\n"); | ||
| 326 | for (i = 0; i < ARRAY_SIZE(mvmvif->queue_params); i++) { | ||
| 327 | pos += scnprintf(buf+pos, bufsz-pos, | ||
| 328 | "\t%d: txop:%d - cw_min:%d - cw_max = %d - aifs = %d upasd = %d\n", | ||
| 329 | i, mvmvif->queue_params[i].txop, | ||
| 330 | mvmvif->queue_params[i].cw_min, | ||
| 331 | mvmvif->queue_params[i].cw_max, | ||
| 332 | mvmvif->queue_params[i].aifs, | ||
| 333 | mvmvif->queue_params[i].uapsd); | ||
| 334 | } | ||
| 335 | |||
| 336 | if (vif->type == NL80211_IFTYPE_STATION && | ||
| 337 | ap_sta_id != IWL_MVM_STATION_COUNT) { | ||
| 338 | struct ieee80211_sta *sta; | ||
| 339 | struct iwl_mvm_sta *mvm_sta; | ||
| 340 | |||
| 341 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[ap_sta_id], | ||
| 342 | lockdep_is_held(&mvm->mutex)); | ||
| 343 | mvm_sta = (void *)sta->drv_priv; | ||
| 344 | pos += scnprintf(buf+pos, bufsz-pos, | ||
| 345 | "ap_sta_id %d - reduced Tx power %d\n", | ||
| 346 | ap_sta_id, mvm_sta->bt_reduced_txpower); | ||
| 347 | } | ||
| 348 | |||
| 349 | rcu_read_lock(); | ||
| 350 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
| 351 | if (chanctx_conf) { | ||
| 352 | pos += scnprintf(buf+pos, bufsz-pos, | ||
| 353 | "idle rx chains %d, active rx chains: %d\n", | ||
| 354 | chanctx_conf->rx_chains_static, | ||
| 355 | chanctx_conf->rx_chains_dynamic); | ||
| 356 | } | ||
| 357 | rcu_read_unlock(); | ||
| 358 | |||
| 359 | mutex_unlock(&mvm->mutex); | ||
| 360 | |||
| 361 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
| 362 | } | ||
| 363 | |||
| 303 | #define BT_MBOX_MSG(_notif, _num, _field) \ | 364 | #define BT_MBOX_MSG(_notif, _num, _field) \ |
| 304 | ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ | 365 | ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ |
| 305 | >> BT_MBOX##_num##_##_field##_POS) | 366 | >> BT_MBOX##_num##_##_field##_POS) |
| @@ -464,6 +525,9 @@ MVM_DEBUGFS_WRITE_FILE_OPS(power_down_allow); | |||
| 464 | MVM_DEBUGFS_WRITE_FILE_OPS(power_down_d3_allow); | 525 | MVM_DEBUGFS_WRITE_FILE_OPS(power_down_d3_allow); |
| 465 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart); | 526 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart); |
| 466 | 527 | ||
| 528 | /* Interface specific debugfs entries */ | ||
| 529 | MVM_DEBUGFS_READ_FILE_OPS(mac_params); | ||
| 530 | |||
| 467 | int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) | 531 | int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) |
| 468 | { | 532 | { |
| 469 | char buf[100]; | 533 | char buf[100]; |
| @@ -494,3 +558,58 @@ err: | |||
| 494 | IWL_ERR(mvm, "Can't create the mvm debugfs directory\n"); | 558 | IWL_ERR(mvm, "Can't create the mvm debugfs directory\n"); |
| 495 | return -ENOMEM; | 559 | return -ENOMEM; |
| 496 | } | 560 | } |
| 561 | |||
| 562 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | ||
| 563 | { | ||
| 564 | struct dentry *dbgfs_dir = vif->debugfs_dir; | ||
| 565 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 566 | char buf[100]; | ||
| 567 | |||
| 568 | if (!dbgfs_dir) | ||
| 569 | return; | ||
| 570 | |||
| 571 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); | ||
| 572 | mvmvif->dbgfs_data = mvm; | ||
| 573 | |||
| 574 | if (!mvmvif->dbgfs_dir) { | ||
| 575 | IWL_ERR(mvm, "Failed to create debugfs directory under %s\n", | ||
| 576 | dbgfs_dir->d_name.name); | ||
| 577 | return; | ||
| 578 | } | ||
| 579 | |||
| 580 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, | ||
| 581 | S_IRUSR); | ||
| 582 | |||
| 583 | /* | ||
| 584 | * Create symlink for convenience pointing to interface specific | ||
| 585 | * debugfs entries for the driver. For example, under | ||
| 586 | * /sys/kernel/debug/iwlwifi/0000\:02\:00.0/iwlmvm/ | ||
| 587 | * find | ||
| 588 | * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/ | ||
| 589 | */ | ||
| 590 | snprintf(buf, 100, "../../../%s/%s/%s/%s", | ||
| 591 | dbgfs_dir->d_parent->d_parent->d_name.name, | ||
| 592 | dbgfs_dir->d_parent->d_name.name, | ||
| 593 | dbgfs_dir->d_name.name, | ||
| 594 | mvmvif->dbgfs_dir->d_name.name); | ||
| 595 | |||
| 596 | mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, | ||
| 597 | mvm->debugfs_dir, buf); | ||
| 598 | if (!mvmvif->dbgfs_slink) | ||
| 599 | IWL_ERR(mvm, "Can't create debugfs symbolic link under %s\n", | ||
| 600 | dbgfs_dir->d_name.name); | ||
| 601 | return; | ||
| 602 | err: | ||
| 603 | IWL_ERR(mvm, "Can't create debugfs entity\n"); | ||
| 604 | } | ||
| 605 | |||
| 606 | void iwl_mvm_vif_dbgfs_clean(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | ||
| 607 | { | ||
| 608 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
| 609 | |||
| 610 | debugfs_remove(mvmvif->dbgfs_slink); | ||
| 611 | mvmvif->dbgfs_slink = NULL; | ||
| 612 | |||
| 613 | debugfs_remove_recursive(mvmvif->dbgfs_dir); | ||
| 614 | mvmvif->dbgfs_dir = NULL; | ||
| 615 | } | ||
