From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, Zhu Yi <yi.zhu@intel.com>,
Tomas Winkler <tomas.winkler@intel.com>
Subject: [PATCH] iwlwifi: set fixed rate through debugfs
Date: Thu, 27 Sep 2007 11:27:42 +0800 [thread overview]
Message-ID: <11908636823439-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <11908636801368-git-send-email-yi.zhu@intel.com>
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>
---
drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 72 +++++++++++++++++++++++++++-
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 c4b8ca1..e5f8cce 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 {
struct iwl_link_quality_cmd lq;
struct iwl_scale_tbl_info lq_info[LQ_SIZE];
#ifdef CONFIG_MAC80211_DEBUGFS
- struct dentry *rs_sta_dbgfs_scale_table_file;
+ struct dentry *rs_sta_dbgfs_scale_table_file;
+ struct iwl_rate dbg_fixed;
+ struct iwl_priv *drv;
#endif
};
@@ -136,6 +138,14 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
struct iwl_link_quality_cmd *tbl);
+#ifdef CONFIG_MAC80211_DEBUGFS
+static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
+ struct iwl_rate *mcs, int index);
+#else
+static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
+ struct iwl_rate *mcs, int index)
+{}
+#endif
static s32 expected_tpt_A[IWL_RATE_COUNT] = {
0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186, 186
};
@@ -1866,6 +1876,9 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate,
crl->active_mimo_rate);
#endif /*CONFIG_IWLWIFI_HT*/
+#ifdef CONFIG_MAC80211_DEBUGFS
+ crl->drv = priv;
+#endif
if (priv->assoc_station_added)
priv->lq_mngr.lq_ready = 1;
@@ -1885,6 +1898,8 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
struct iwl_rate new_rate;
struct iwl_scale_tbl_info tbl_type = { 0 };
+ rs_dbgfs_set_mcs(lq_data, tx_mcs, index);
+
rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode,
&tbl_type, &rate_idx);
@@ -1919,6 +1934,8 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
ant_toggle_count = 1;
}
}
+
+ rs_dbgfs_set_mcs(lq_data, &new_rate, index);
lq_cmd->rs_table[index].rate_n_flags =
cpu_to_le32(new_rate.rate_n_flags);
repeat_rate--;
@@ -1947,6 +1964,7 @@ static void rs_fill_link_cmd(struct iwl_rate_scale_priv *lq_data,
use_ht_possible = 0;
+ rs_dbgfs_set_mcs(lq_data, &new_rate, index);
lq_cmd->rs_table[index].rate_n_flags =
cpu_to_le32(new_rate.rate_n_flags);
@@ -2002,7 +2020,54 @@ static int open_file_generic(struct inode *inode, struct file *file)
file->private_data = inode->i_private;
return 0;
}
+static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
+ struct iwl_rate *mcs, int index)
+{
+ const u32 cck_rate = 0x820A;
+ if (rs_priv->dbg_fixed.rate_n_flags) {
+ if (index < 12)
+ mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags;
+ else
+ mcs->rate_n_flags = cck_rate;
+ IWL_DEBUG_RATE("Fixed rate ON\n");
+ return;
+ }
+
+ IWL_DEBUG_RATE("Fixed rate OFF\n");
+}
+static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
+ const char __user *user_buf, size_t count, loff_t *ppos)
+{
+ struct iwl_rate_scale_priv *rs_priv = file->private_data;
+ char buf[64];
+ int buf_size;
+ u32 parsed_rate;
+
+ memset(buf, 0, sizeof(buf));
+ buf_size = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, buf_size))
+ return -EFAULT;
+
+ if (sscanf(buf, "%x", &parsed_rate) == 1)
+ rs_priv->dbg_fixed.rate_n_flags = parsed_rate;
+ else
+ rs_priv->dbg_fixed.rate_n_flags = 0;
+
+ rs_priv->active_rate = 0x0FFF;
+ rs_priv->active_siso_rate = 0x1FD0;
+ rs_priv->active_mimo_rate = 0x1FD0;
+
+ IWL_DEBUG_RATE("sta_id %d rate 0x%X\n",
+ rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags);
+
+ if (rs_priv->dbg_fixed.rate_n_flags) {
+ rs_fill_link_cmd(rs_priv, &rs_priv->dbg_fixed, &rs_priv->lq);
+ rs_send_lq_cmd(rs_priv->drv, &rs_priv->lq, CMD_ASYNC);
+ }
+
+ return count;
+}
static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
@@ -2013,9 +2078,11 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
struct iwl_rate_scale_priv *rs_priv = file->private_data;
desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id);
- desc += sprintf(buff+desc, "failed=%d success=%d rate=%X\n",
+ desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
rs_priv->total_failed, rs_priv->total_success,
rs_priv->active_rate);
+ desc += sprintf(buff+desc, "fixed rate 0x%X\n",
+ rs_priv->dbg_fixed.rate_n_flags);
desc += sprintf(buff+desc, "general:"
"flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n",
rs_priv->lq.general_params.flags,
@@ -2045,6 +2112,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
}
static const struct file_operations rs_sta_dbgfs_scale_table_ops = {
+ .write = rs_sta_dbgfs_scale_table_write,
.read = rs_sta_dbgfs_scale_table_read,
.open = open_file_generic,
};
--
1.5.1
next prev parent reply other threads:[~2007-09-27 3:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11908636643693-git-send-email-yi.zhu@intel.com>
2007-09-27 3:27 ` [PATCH] iwlwifi: replacing IPW with IWL in error messages Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: workaournd REPLY_COMPRESSED_BA command in iwl_rx_handle Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: Correction for sending beacon in config_ap Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: clear station table in rxon unconditionally Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: Fix typo in rate sacling algorithm Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: fix add_station to avoid FW error Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: removing unnecessary memset in 4965 rate scale Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: add debugfs framework to " Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: add read rate scale table debugfs function Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: limit printouts on hot path Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: add supp_rates to rate scale sta private data Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: rs_rate_scale_perform clean up Zhu Yi
2007-09-27 3:27 ` Zhu Yi [this message]
2007-09-27 3:27 ` [PATCH] iwlwifi: add debugfs rate scale stats Zhu Yi
2007-09-27 3:27 ` [PATCH] iwlwifi: Update iwlwifi version stamp to 1.1.17 Zhu Yi
2007-09-27 4:35 ` [PATCH] iwlwifi: set fixed rate through debugfs Randy Dunlap
2007-09-27 4:43 ` Zhu Yi
2007-09-27 14:26 ` Randy Dunlap
2007-09-28 7:44 ` Tomas Winkler
2007-09-27 4:32 ` [PATCH] iwlwifi: replacing IPW with IWL in error messages Randy Dunlap
2007-09-27 4:42 ` Zhu Yi
2007-09-27 20:41 ` iwlwifi driver updates John W. Linville
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11908636823439-git-send-email-yi.zhu@intel.com \
--to=yi.zhu@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=tomas.winkler@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.