diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-09-17 10:43:45 -0700 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:33 -0400 |
commit | 01abfbb282482d01e2ac2e6b00e75b248bf517c8 (patch) | |
tree | 43a0363adf63eda3d06313ab82a0d27fbee171ad | |
parent | 47eef9bd1079edbc3e6606309c733a2316ca5a72 (diff) | |
download | op-kernel-dev-01abfbb282482d01e2ac2e6b00e75b248bf517c8.zip op-kernel-dev-01abfbb282482d01e2ac2e6b00e75b248bf517c8.tar.gz |
iwlwifi: allow user change protection mechanism for HT
Allow user to change protection mechanism for HT between RTS/CTS and
CTS-to-self through sysfs:
Show current protection mechanism for HT
cat /sys/class/net/wlan0/device/rts_ht_protection
Change protection mechanism for HT (only allowed while not-associated)
CTS-to-self:
echo 0 > /sys/class/net/wlan0/device/rts_ht_protection
RTS/CTS:
echo 1 > /sys/class/net/wlan0/device/rts_ht_protection
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-agn.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index a373962..2a7cc4b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -2798,6 +2798,40 @@ static ssize_t show_statistics(struct device *d, static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL); +static ssize_t show_rts_ht_protection(struct device *d, + struct device_attribute *attr, char *buf) +{ + struct iwl_priv *priv = dev_get_drvdata(d); + + return sprintf(buf, "%s\n", + priv->cfg->use_rts_for_ht ? "RTS/CTS" : "CTS-to-self"); +} + +static ssize_t store_rts_ht_protection(struct device *d, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct iwl_priv *priv = dev_get_drvdata(d); + unsigned long val; + int ret; + + ret = strict_strtoul(buf, 10, &val); + if (ret) + IWL_INFO(priv, "Input is not in decimal form.\n"); + else { + if (!iwl_is_associated(priv)) + priv->cfg->use_rts_for_ht = val ? true : false; + else + IWL_ERR(priv, "Sta associated with AP - " + "Change protection mechanism is not allowed\n"); + ret = count; + } + return ret; +} + +static DEVICE_ATTR(rts_ht_protection, S_IWUSR | S_IRUGO, + show_rts_ht_protection, store_rts_ht_protection); + /***************************************************************************** * @@ -2854,6 +2888,7 @@ static struct attribute *iwl_sysfs_entries[] = { &dev_attr_statistics.attr, &dev_attr_temperature.attr, &dev_attr_tx_power.attr, + &dev_attr_rts_ht_protection.attr, #ifdef CONFIG_IWLWIFI_DEBUG &dev_attr_debug_level.attr, #endif |