From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Eyal Shapira <eyal@wizery.com>,
Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 04/29] iwlwifi: mvm: fix and improve printing of rate scale table
Date: Sun, 24 Nov 2013 22:06:21 +0200 [thread overview]
Message-ID: <1385323606-3603-4-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <52925BE7.4050406@gmail.com>
From: Eyal Shapira <eyal@wizery.com>
Info about VHT/HT rates wasn't printed properly when dumping
the rate scale table. Fix that and print more info. While at it
fix some other minor issues in the printing and prevent
overflowing the print buffer.
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
drivers/net/wireless/iwlwifi/mvm/rs.c | 91 ++++++++++++++++++++++++++-------
1 file changed, 73 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index a0b4cc8..f7ac485 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -2566,13 +2566,75 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
return count;
}
+static int rs_pretty_print_rate(char *buf, const u32 rate)
+{
+ static const char * const ant_name[] = {
+ [ANT_NONE] = "None",
+ [ANT_A] = "A",
+ [ANT_B] = "B",
+ [ANT_AB] = "AB",
+ [ANT_C] = "C",
+ [ANT_AC] = "AC",
+ [ANT_BC] = "BC",
+ [ANT_ABC] = "ABC",
+ };
+
+ char *type, *bw;
+ u8 mcs = 0, nss = 0;
+ u8 ant = (rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS;
+
+ if (!(rate & RATE_MCS_HT_MSK) &&
+ !(rate & RATE_MCS_VHT_MSK)) {
+ int index = iwl_hwrate_to_plcp_idx(rate);
+
+ return sprintf(buf, "Legacy | ANT: %s Rate: %s Mbps\n",
+ ant_name[ant], iwl_rate_mcs[index].mbps);
+ }
+
+ if (rate & RATE_MCS_VHT_MSK) {
+ type = "VHT";
+ mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
+ nss = ((rate & RATE_VHT_MCS_NSS_MSK)
+ >> RATE_VHT_MCS_NSS_POS) + 1;
+ } else if (rate & RATE_MCS_HT_MSK) {
+ type = "HT";
+ mcs = rate & RATE_HT_MCS_INDEX_MSK;
+ } else {
+ type = "Unknown"; /* shouldn't happen */
+ }
+
+ switch (rate & RATE_MCS_CHAN_WIDTH_MSK) {
+ case RATE_MCS_CHAN_WIDTH_20:
+ bw = "20Mhz";
+ break;
+ case RATE_MCS_CHAN_WIDTH_40:
+ bw = "40Mhz";
+ break;
+ case RATE_MCS_CHAN_WIDTH_80:
+ bw = "80Mhz";
+ break;
+ case RATE_MCS_CHAN_WIDTH_160:
+ bw = "160Mhz";
+ break;
+ default:
+ bw = "BAD BW";
+ }
+
+ return sprintf(buf, "%s | ANT: %s BW: %s MCS: %d NSS: %d %s%s%s%s%s\n",
+ type, ant_name[ant], bw, mcs, nss,
+ (rate & RATE_MCS_SGI_MSK) ? "SGI " : "NGI ",
+ (rate & RATE_MCS_STBC_MSK) ? "STBC " : "",
+ (rate & RATE_MCS_LDPC_MSK) ? "LDPC " : "",
+ (rate & RATE_MCS_BF_MSK) ? "BF " : "",
+ (rate & RATE_MCS_ZLF_MSK) ? "ZLF " : "");
+}
+
static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
char *buff;
int desc = 0;
int i = 0;
- int index = 0;
ssize_t ret;
struct iwl_lq_sta *lq_sta = file->private_data;
@@ -2580,7 +2642,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
struct iwl_scale_tbl_info *tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
mvm = lq_sta->drv;
- buff = kmalloc(1024, GFP_KERNEL);
+ buff = kmalloc(2048, GFP_KERNEL);
if (!buff)
return -ENOMEM;
@@ -2597,7 +2659,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
desc += sprintf(buff+desc, "lq type %s\n",
(is_legacy(tbl->lq_type)) ? "legacy" :
is_vht(tbl->lq_type) ? "VHT" : "HT");
- if (is_ht(tbl->lq_type)) {
+ if (!is_legacy(tbl->lq_type)) {
desc += sprintf(buff+desc, " %s",
(is_siso(tbl->lq_type)) ? "SISO" : "MIMO2");
desc += sprintf(buff+desc, " %s",
@@ -2605,13 +2667,13 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
(is_ht40(tbl)) ? "40MHz" :
(is_ht80(tbl)) ? "80Mhz" : "BAD BW");
desc += sprintf(buff+desc, " %s %s\n",
- (tbl->is_SGI) ? "SGI" : "",
+ (tbl->is_SGI) ? "SGI" : "NGI",
(lq_sta->is_agg) ? "AGG on" : "");
}
desc += sprintf(buff+desc, "last tx rate=0x%X\n",
lq_sta->last_rate_n_flags);
desc += sprintf(buff+desc,
- "general: flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n",
+ "general: flags=0x%X mimo-d=%d s-ant=0x%x d-ant=0x%x\n",
lq_sta->lq.flags,
lq_sta->lq.mimo_delim,
lq_sta->lq.single_stream_ant_msk,
@@ -2631,19 +2693,12 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
lq_sta->lq.initial_rate_index[3]);
for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) {
- index = iwl_hwrate_to_plcp_idx(
- le32_to_cpu(lq_sta->lq.rs_table[i]));
- if (is_legacy(tbl->lq_type)) {
- desc += sprintf(buff+desc, " rate[%d] 0x%X %smbps\n",
- i, le32_to_cpu(lq_sta->lq.rs_table[i]),
- iwl_rate_mcs[index].mbps);
- } else {
- desc += sprintf(buff+desc,
- " rate[%d] 0x%X %smbps (%s)\n",
- i, le32_to_cpu(lq_sta->lq.rs_table[i]),
- iwl_rate_mcs[index].mbps,
- iwl_rate_mcs[index].mcs);
- }
+ u32 rate = le32_to_cpu(lq_sta->lq.rs_table[i]);
+ desc += sprintf(buff+desc,
+ " rate[%d] 0x%X ",
+ i, rate);
+
+ desc += rs_pretty_print_rate(buff+desc, rate);
}
ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc);
--
1.7.9.5
next prev parent reply other threads:[~2013-11-24 20:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-24 20:04 pull request: iwlwifi-next 2013_11_24 Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 01/29] iwlwifi: remove TX_CMD id from transport layer Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 02/29] iwlwifi: mvm: Add debugfs entry to generate NMI to NIC Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 03/29] iwlwifi: pcie: remove useless condition test Emmanuel Grumbach
2013-11-24 20:06 ` Emmanuel Grumbach [this message]
2013-11-24 20:06 ` [PATCH 05/29] iwlwifi: mvm: simplify iwl_mvm_send_lq_cmd Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 06/29] iwlwifi: mvm: refactor iwl_mvm_rs_rate_init Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 07/29] iwlwifi: mvm: enable d3_test even if d3_test_pme_ptr is not available Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 08/29] iwlwifi: mvm: disconnect on disconnection wakeup event Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 09/29] iwlwifi: mvm: implement rate_update hook in rs Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 10/29] iwlwifi: mvm: allow keeping connections in d3_test Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 11/29] iwlwifi: mvm: fix ht protection flags Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 12/29] iwlwifi: mvm: small debugfs cleanups Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 13/29] iwlwifi: mvm: move interface-specific debugfs to a new file Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 14/29] iwlwifi: mvm: don't use void pointers in debugfs Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 15/29] iwlwifi: mvm: refactor debugfs copy_from_user() Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 16/29] iwlwifi: mvm: add LQ flags definitions Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 17/29] iwlwifi: mvm: BT Coex - fine tune the aggregation size Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 18/29] iwlwifi: mvm: a few more SKUs for 7260 and 3160 Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 19/29] iwlwifi: pcie: remove minor dead code Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 20/29] iwlwifi: fix check for a single rx antenna Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 21/29] iwlwifi: mvm: add iwl_mvm_sta_from_mac80211 Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 22/29] iwlwifi: mvm: don't restart HW if suspending fails before D3 image is loaded Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 23/29] iwlwifi: mvm: dump NVM from debugfs Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 24/29] iwlwifi: mvm: fix scan offloading flag definition Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 25/29] iwlwifi: mvm: Implement low-priority scan Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 26/29] iwlwifi: mvm: quota command max_duration should be zero Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 27/29] iwlwifi: mvm: stop using MIMO in case BT doesn't allow it Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 28/29] iwlwifi: mvm: don't enable VHT MCS9 in 20Mhz Emmanuel Grumbach
2013-11-24 20:06 ` [PATCH 29/29] iwlwifi: mvm: don't configure mimo rates if nss is limited to 1 Emmanuel Grumbach
2013-12-02 18:40 ` pull request: iwlwifi-next 2013_11_24 John W. Linville
2013-12-02 19:23 ` 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=1385323606-3603-4-git-send-email-egrumbach@gmail.com \
--to=egrumbach@gmail.com \
--cc=emmanuel.grumbach@intel.com \
--cc=eyal@wizery.com \
--cc=linux-wireless@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).