diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-02-08 03:56:43 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2015-03-02 01:20:27 -0500 |
commit | ddf89ab10a93e8bb0ecf91a563a71d1cfb604c9f (patch) | |
tree | 7b927a0101b92dc09f0c9c8874c2f81ba38fee22 | |
parent | 0522588d2fdc7813338d2f02aec6e46dbc20431f (diff) |
iwlwifi: mvm: allow to force the Rx chains from debugfs
This is useful to debug weird antenna problems.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | 54 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | 2 |
3 files changed, 57 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index 5fe14591e1c4..7faad90386b8 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -545,6 +545,57 @@ static ssize_t iwl_dbgfs_uapsd_misbehaving_write(struct ieee80211_vif *vif, | |||
545 | return ret ? count : -EINVAL; | 545 | return ret ? count : -EINVAL; |
546 | } | 546 | } |
547 | 547 | ||
548 | static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf, | ||
549 | size_t count, loff_t *ppos) | ||
550 | { | ||
551 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
552 | struct iwl_mvm *mvm = mvmvif->mvm; | ||
553 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
554 | struct iwl_mvm_phy_ctxt *phy_ctxt; | ||
555 | u16 value; | ||
556 | int ret; | ||
557 | |||
558 | ret = kstrtou16(buf, 0, &value); | ||
559 | if (ret) | ||
560 | return ret; | ||
561 | |||
562 | mutex_lock(&mvm->mutex); | ||
563 | rcu_read_lock(); | ||
564 | |||
565 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
566 | /* make sure the channel context is assigned */ | ||
567 | if (!chanctx_conf) { | ||
568 | rcu_read_unlock(); | ||
569 | mutex_unlock(&mvm->mutex); | ||
570 | return -EINVAL; | ||
571 | } | ||
572 | |||
573 | phy_ctxt = &mvm->phy_ctxts[*(u16 *)chanctx_conf->drv_priv]; | ||
574 | rcu_read_unlock(); | ||
575 | |||
576 | mvm->dbgfs_rx_phyinfo = value; | ||
577 | |||
578 | ret = iwl_mvm_phy_ctxt_changed(mvm, phy_ctxt, &chanctx_conf->min_def, | ||
579 | chanctx_conf->rx_chains_static, | ||
580 | chanctx_conf->rx_chains_dynamic); | ||
581 | mutex_unlock(&mvm->mutex); | ||
582 | |||
583 | return ret ?: count; | ||
584 | } | ||
585 | |||
586 | static ssize_t iwl_dbgfs_rx_phyinfo_read(struct file *file, | ||
587 | char __user *user_buf, | ||
588 | size_t count, loff_t *ppos) | ||
589 | { | ||
590 | struct ieee80211_vif *vif = file->private_data; | ||
591 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
592 | char buf[8]; | ||
593 | |||
594 | snprintf(buf, sizeof(buf), "0x%04x\n", mvmvif->mvm->dbgfs_rx_phyinfo); | ||
595 | |||
596 | return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf)); | ||
597 | } | ||
598 | |||
548 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ | 599 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
549 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) | 600 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
550 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ | 601 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
@@ -560,6 +611,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); | |||
560 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); | 611 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); |
561 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); | 612 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); |
562 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(uapsd_misbehaving, 20); | 613 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(uapsd_misbehaving, 20); |
614 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(rx_phyinfo, 10); | ||
563 | 615 | ||
564 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 616 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
565 | { | 617 | { |
@@ -595,6 +647,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
595 | S_IRUSR | S_IWUSR); | 647 | S_IRUSR | S_IWUSR); |
596 | MVM_DEBUGFS_ADD_FILE_VIF(uapsd_misbehaving, mvmvif->dbgfs_dir, | 648 | MVM_DEBUGFS_ADD_FILE_VIF(uapsd_misbehaving, mvmvif->dbgfs_dir, |
597 | S_IRUSR | S_IWUSR); | 649 | S_IRUSR | S_IWUSR); |
650 | MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, | ||
651 | S_IRUSR | S_IWUSR); | ||
598 | 652 | ||
599 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | 653 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
600 | mvmvif == mvm->bf_allowed_vif) | 654 | mvmvif == mvm->bf_allowed_vif) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index f78a006df0e9..885d09692fb6 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -681,6 +681,7 @@ struct iwl_mvm { | |||
681 | 681 | ||
682 | struct iwl_mvm_frame_stats drv_rx_stats; | 682 | struct iwl_mvm_frame_stats drv_rx_stats; |
683 | spinlock_t drv_stats_lock; | 683 | spinlock_t drv_stats_lock; |
684 | u16 dbgfs_rx_phyinfo; | ||
684 | #endif | 685 | #endif |
685 | 686 | ||
686 | struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX]; | 687 | struct iwl_mvm_phy_ctxt phy_ctxts[NUM_PHY_CTX]; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c index 5b43616eeb06..1bd10eda01f9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/phy-ctxt.c | |||
@@ -175,6 +175,8 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm, | |||
175 | cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); | 175 | cmd->rxchain_info |= cpu_to_le32(idle_cnt << PHY_RX_CHAIN_CNT_POS); |
176 | cmd->rxchain_info |= cpu_to_le32(active_cnt << | 176 | cmd->rxchain_info |= cpu_to_le32(active_cnt << |
177 | PHY_RX_CHAIN_MIMO_CNT_POS); | 177 | PHY_RX_CHAIN_MIMO_CNT_POS); |
178 | if (unlikely(mvm->dbgfs_rx_phyinfo)) | ||
179 | cmd->rxchain_info = cpu_to_le32(mvm->dbgfs_rx_phyinfo); | ||
178 | 180 | ||
179 | cmd->txchain_info = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); | 181 | cmd->txchain_info = cpu_to_le32(iwl_mvm_get_valid_tx_ant(mvm)); |
180 | } | 182 | } |