aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2007-09-26 23:27:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:26 -0400
commit98d7e09af513da19389128f23d49893b11de81fa (patch)
tree3d9d31a105de2b714c6a27e8a50e4b91411a2dc8 /drivers/net/wireless
parent1b696de23bb21b89f4a4c4fd6b12e26fe2cc4a37 (diff)
[PATCH] iwlwifi: set fixed rate through debugfs
This patch adds fixed rate setting through debugfs $ echo <rate_n_flags> > \ /sys/kernel/debug/ieee80211/phy<X>/stations/<mac>/rate_scale_table Currently there is no way to turn to rate scaling working again. Will be fixed in later. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c72
1 files changed, 70 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index c4b8ca128495..e5f8cce443ba 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -123,7 +123,9 @@ struct iwl_rate_scale_priv {
123 struct iwl_link_quality_cmd lq; 123 struct iwl_link_quality_cmd lq;
124 struct iwl_scale_tbl_info lq_info[LQ_SIZE]; 124 struct iwl_scale_tbl_info lq_info[LQ_SIZE];
125#ifdef CONFIG_MAC80211_DEBUGFS 125#ifdef CONFIG_MAC80211_DEBUGFS
126 struct dentry *rs_sta_dbgfs_scale_table_file; 126 struct dentry *rs_sta_dbgfs_scale_table_file;
127 struct iwl_rate dbg_fixed;
128 struct iwl_priv *drv;
127#endif 129#endif
128}; 130};
129 131
@@ -136,6 +138,14 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
136 struct iwl_link_quality_cmd *tbl); 138 struct iwl_link_quality_cmd *tbl);
137 139
138 140
141#ifdef CONFIG_MAC80211_DEBUGFS
142static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
143 struct iwl_rate *mcs, int index);
144#else
145static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
146 struct iwl_rate *mcs, int index)
147{}
148#endif
139static s32 expected_tpt_A[IWL_RATE_COUNT] = { 149static s32 expected_tpt_A[IWL_RATE_COUNT] = {
140 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186 150 0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186
141}; 151};
@@ -1866,6 +1876,9 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
1866 IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate, 1876 IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate,
1867 crl->active_mimo_rate); 1877 crl->active_mimo_rate);
1868#endif /*CONFIG_IWLWIFI_HT*/ 1878#endif /*CONFIG_IWLWIFI_HT*/
1879#ifdef CONFIG_MAC80211_DEBUGFS
1880 crl->drv = priv;
1881#endif
1869 1882
1870 if (priv->assoc_station_added) 1883 if (priv->assoc_station_added)
1871 priv->lq_mngr.lq_ready = 1; 1884 priv->lq_mngr.lq_ready = 1;
@@ -1885,6 +1898,8 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
1885 struct iwl_rate new_rate; 1898 struct iwl_rate new_rate;
1886 struct iwl_scale_tbl_info tbl_type = { 0 }; 1899 struct iwl_scale_tbl_info tbl_type = { 0 };
1887 1900
1901 rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
1902
1888 rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode, 1903 rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode,
1889 &tbl_type, &rate_idx); 1904 &tbl_type, &rate_idx);
1890 1905
@@ -1919,6 +1934,8 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
1919 ant_toggle_count = 1; 1934 ant_toggle_count = 1;
1920 } 1935 }
1921 } 1936 }
1937
1938 rs_dbgfs_set_mcs(lq_data, &new_rate, index);
1922 lq_cmd->rs_table[index].rate_n_flags = 1939 lq_cmd->rs_table[index].rate_n_flags =
1923 cpu_to_le32(new_rate.rate_n_flags); 1940 cpu_to_le32(new_rate.rate_n_flags);
1924 repeat_rate--; 1941 repeat_rate--;
@@ -1947,6 +1964,7 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
1947 1964
1948 use_ht_possible = 0; 1965 use_ht_possible = 0;
1949 1966
1967 rs_dbgfs_set_mcs(lq_data, &new_rate, index);
1950 lq_cmd->rs_table[index].rate_n_flags = 1968 lq_cmd->rs_table[index].rate_n_flags =
1951 cpu_to_le32(new_rate.rate_n_flags); 1969 cpu_to_le32(new_rate.rate_n_flags);
1952 1970
@@ -2002,7 +2020,54 @@ static int open_file_generic(struct inode *inode, struct file *file)
2002 file->private_data = inode->i_private; 2020 file->private_data = inode->i_private;
2003 return 0; 2021 return 0;
2004} 2022}
2023static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
2024 struct iwl_rate *mcs, int index)
2025{
2026 const u32 cck_rate = 0x820A;
2027 if (rs_priv->dbg_fixed.rate_n_flags) {
2028 if (index < 12)
2029 mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags;
2030 else
2031 mcs->rate_n_flags = cck_rate;
2032 IWL_DEBUG_RATE("Fixed rate ON\n");
2033 return;
2034 }
2035
2036 IWL_DEBUG_RATE("Fixed rate OFF\n");
2037}
2005 2038
2039static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
2040 const char __user *user_buf, size_t count, loff_t *ppos)
2041{
2042 struct iwl_rate_scale_priv *rs_priv = file->private_data;
2043 char buf[64];
2044 int buf_size;
2045 u32 parsed_rate;
2046
2047 memset(buf, 0, sizeof(buf));
2048 buf_size = min(count, sizeof(buf) - 1);
2049 if (copy_from_user(buf, user_buf, buf_size))
2050 return -EFAULT;
2051
2052 if (sscanf(buf, "%x", &parsed_rate) == 1)
2053 rs_priv->dbg_fixed.rate_n_flags = parsed_rate;
2054 else
2055 rs_priv->dbg_fixed.rate_n_flags = 0;
2056
2057 rs_priv->active_rate = 0x0FFF;
2058 rs_priv->active_siso_rate = 0x1FD0;
2059 rs_priv->active_mimo_rate = 0x1FD0;
2060
2061 IWL_DEBUG_RATE("sta_id %d rate 0x%X\n",
2062 rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags);
2063
2064 if (rs_priv->dbg_fixed.rate_n_flags) {
2065 rs_fill_link_cmd(rs_priv, &rs_priv->dbg_fixed, &rs_priv->lq);
2066 rs_send_lq_cmd(rs_priv->drv, &rs_priv->lq, CMD_ASYNC);
2067 }
2068
2069 return count;
2070}
2006static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, 2071static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
2007 char __user *user_buf, size_t count, loff_t *ppos) 2072 char __user *user_buf, size_t count, loff_t *ppos)
2008{ 2073{
@@ -2013,9 +2078,11 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
2013 struct iwl_rate_scale_priv *rs_priv = file->private_data; 2078 struct iwl_rate_scale_priv *rs_priv = file->private_data;
2014 2079
2015 desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id); 2080 desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
2016 desc += sprintf(buff+desc, "failed=%d success=%d rate=%X\n", 2081 desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
2017 rs_priv->total_failed, rs_priv->total_success, 2082 rs_priv->total_failed, rs_priv->total_success,
2018 rs_priv->active_rate); 2083 rs_priv->active_rate);
2084 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
2085 rs_priv->dbg_fixed.rate_n_flags);
2019 desc += sprintf(buff+desc, "general:" 2086 desc += sprintf(buff+desc, "general:"
2020 "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", 2087 "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n",
2021 rs_priv->lq.general_params.flags, 2088 rs_priv->lq.general_params.flags,
@@ -2045,6 +2112,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
2045} 2112}
2046 2113
2047static const struct file_operations rs_sta_dbgfs_scale_table_ops = { 2114static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
2115 .write = rs_sta_dbgfs_scale_table_write,
2048 .read = rs_sta_dbgfs_scale_table_read, 2116 .read = rs_sta_dbgfs_scale_table_read,
2049 .open = open_file_generic, 2117 .open = open_file_generic,
2050}; 2118};