aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-07-27 16:50:15 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-29 15:46:23 -0400
commit1e4247d457c6a42e4a05cb7dfa4e6ea1fa65c112 (patch)
tree87e9a6298904525faf4200e9dfa47d3d24d8efbe
parent35a1e70dfe74aafa350325f79687153b9852c3f1 (diff)
iwlwifi: debugFs to enable/disable HT40 support
Add debugfs file to enable/disable HT40(40MHz) channel support. By default, 40MHz is supported if AP can support the function. By echo "1" to "disable_ht40" file, iwlwifi driver will disable the 40MHz support and only allow 20MHz channel. Because the information exchange happen during association time, so enable/disable ht40 channel only can be performed when it is not associated with AP. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c46
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
4 files changed, 52 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index aafa9fdd6476..8570d56b3124 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -632,6 +632,10 @@ u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
632 if (!sta_ht_inf->ht_supported) 632 if (!sta_ht_inf->ht_supported)
633 return 0; 633 return 0;
634 } 634 }
635#ifdef CONFIG_IWLWIFI_DEBUG
636 if (priv->disable_ht40)
637 return 0;
638#endif
635 return iwl_is_channel_extension(priv, priv->band, 639 return iwl_is_channel_extension(priv, priv->band,
636 le16_to_cpu(priv->staging_rxon.channel), 640 le16_to_cpu(priv->staging_rxon.channel),
637 iwl_ht_conf->extension_chan_offset); 641 iwl_ht_conf->extension_chan_offset);
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 609a68184dba..fbe177608bc7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -88,6 +88,7 @@ struct iwl_debugfs {
88#ifdef CONFIG_IWLWIFI_LEDS 88#ifdef CONFIG_IWLWIFI_LEDS
89 struct dentry *file_led; 89 struct dentry *file_led;
90#endif 90#endif
91 struct dentry *file_disable_ht40;
91 } dbgfs_data_files; 92 } dbgfs_data_files;
92 struct dir_rf_files { 93 struct dir_rf_files {
93 struct dentry *file_disable_sensitivity; 94 struct dentry *file_disable_sensitivity;
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 748dc31877bc..7707a2655994 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -653,6 +653,49 @@ static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file,
653 return ret; 653 return ret;
654} 654}
655 655
656static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
657 const char __user *user_buf,
658 size_t count, loff_t *ppos)
659{
660 struct iwl_priv *priv = file->private_data;
661 char buf[8];
662 int buf_size;
663 int ht40;
664
665 memset(buf, 0, sizeof(buf));
666 buf_size = min(count, sizeof(buf) - 1);
667 if (copy_from_user(buf, user_buf, buf_size))
668 return -EFAULT;
669 if (sscanf(buf, "%d", &ht40) != 1)
670 return -EFAULT;
671 if (!iwl_is_associated(priv))
672 priv->disable_ht40 = ht40 ? true : false;
673 else {
674 IWL_ERR(priv, "Sta associated with AP - "
675 "Change to 40MHz channel support is not allowed\n");
676 return -EINVAL;
677 }
678
679 return count;
680}
681
682static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file,
683 char __user *user_buf,
684 size_t count, loff_t *ppos)
685{
686 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
687 char buf[100];
688 int pos = 0;
689 const size_t bufsz = sizeof(buf);
690 ssize_t ret;
691
692 pos += scnprintf(buf + pos, bufsz - pos,
693 "11n 40MHz Mode: %s\n",
694 priv->disable_ht40 ? "Disabled" : "Enabled");
695 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
696 return ret;
697}
698
656DEBUGFS_READ_WRITE_FILE_OPS(sram); 699DEBUGFS_READ_WRITE_FILE_OPS(sram);
657DEBUGFS_WRITE_FILE_OPS(log_event); 700DEBUGFS_WRITE_FILE_OPS(log_event);
658DEBUGFS_READ_FILE_OPS(nvm); 701DEBUGFS_READ_FILE_OPS(nvm);
@@ -667,6 +710,7 @@ DEBUGFS_READ_FILE_OPS(qos);
667DEBUGFS_READ_FILE_OPS(led); 710DEBUGFS_READ_FILE_OPS(led);
668#endif 711#endif
669DEBUGFS_READ_FILE_OPS(thermal_throttling); 712DEBUGFS_READ_FILE_OPS(thermal_throttling);
713DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40);
670 714
671/* 715/*
672 * Create the debugfs files and directories 716 * Create the debugfs files and directories
@@ -708,6 +752,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
708 DEBUGFS_ADD_FILE(led, data); 752 DEBUGFS_ADD_FILE(led, data);
709#endif 753#endif
710 DEBUGFS_ADD_FILE(thermal_throttling, data); 754 DEBUGFS_ADD_FILE(thermal_throttling, data);
755 DEBUGFS_ADD_FILE(disable_ht40, data);
711 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); 756 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
712 DEBUGFS_ADD_BOOL(disable_chain_noise, rf, 757 DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
713 &priv->disable_chain_noise_cal); 758 &priv->disable_chain_noise_cal);
@@ -747,6 +792,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
747 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_led); 792 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_led);
748#endif 793#endif
749 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_thermal_throttling); 794 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_thermal_throttling);
795 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_disable_ht40);
750 DEBUGFS_REMOVE(priv->dbgfs->dir_data); 796 DEBUGFS_REMOVE(priv->dbgfs->dir_data);
751 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); 797 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
752 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); 798 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index facbc3daf551..0ee3ad245697 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1164,6 +1164,7 @@ struct iwl_priv {
1164 /* debugging info */ 1164 /* debugging info */
1165 u32 framecnt_to_us; 1165 u32 framecnt_to_us;
1166 atomic_t restrict_refcnt; 1166 atomic_t restrict_refcnt;
1167 bool disable_ht40;
1167#ifdef CONFIG_IWLWIFI_DEBUGFS 1168#ifdef CONFIG_IWLWIFI_DEBUGFS
1168 /* debugfs */ 1169 /* debugfs */
1169 struct iwl_debugfs *dbgfs; 1170 struct iwl_debugfs *dbgfs;