All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sujith Manoharan <sujith@msujith.org>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 1/3] ath9k: Print the negotiated HT capabilities
Date: Mon,  4 Feb 2013 15:38:22 +0530	[thread overview]
Message-ID: <1359972504-8900-1-git-send-email-sujith@msujith.org> (raw)

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

Also, reduce the memory allocated for each row.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/rc.c | 12 +++++++++++-
 drivers/net/wireless/ath/ath9k/rc.h |  6 ++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 714558d..62abd70 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1364,7 +1364,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
 	if (rc->rate_table == NULL)
 		return 0;
 
-	max = 80 + rc->rate_table_size * 1024 + 1;
+	max = 80 + rc->rate_table_size * 256 + 1;
 	buf = kmalloc(max, GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
@@ -1410,6 +1410,16 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
 			stats->per);
 	}
 
+	if (rc->ht_cap & WLAN_RC_HT_FLAG) {
+		len += snprintf(buf + len, max - len, "\nNegotiated HT caps: ");
+		PR_HT_CAP((rc->ht_cap & WLAN_RC_HT_FLAG), "[HT20]");
+		PR_HT_CAP((rc->ht_cap & WLAN_RC_40_FLAG), "[HT40]");
+		PR_HT_CAP((rc->ht_cap & WLAN_RC_DS_FLAG), "[2-Stream]");
+		PR_HT_CAP((rc->ht_cap & WLAN_RC_TS_FLAG), "[3-Stream]");
+		PR_HT_CAP((rc->ht_cap & WLAN_RC_SGI_FLAG), "[SGI]");
+		len += snprintf(buf + len, max - len, "\n");
+	}
+
 	if (len > max)
 		len = max;
 
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index 267dbfc..d9089b9 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -131,6 +131,12 @@ enum {
 #define WLAN_RC_SGI_FLAG        (0x08)
 #define WLAN_RC_HT_FLAG         (0x10)
 
+#define PR_HT_CAP(_cond, _str)						\
+	do {								\
+		if (_cond)						\
+			len += snprintf(buf + len, max - len, _str);	\
+	} while (0)
+
 /**
  * struct ath_rate_table - Rate Control table
  * @rate_cnt: total number of rates for the given wireless mode
-- 
1.8.1.2


             reply	other threads:[~2013-02-04 10:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 10:08 Sujith Manoharan [this message]
2013-02-04 10:08 ` [PATCH 2/3] ath9k: Fix ATH9K_HW_CAP_HT usage Sujith Manoharan
2013-02-04 10:08 ` [PATCH 3/3] ath9k: Fix IBSS joiner mode Sujith Manoharan
2013-02-12  9:24   ` Nicolas Cavallari
2013-02-12  9:55     ` Sujith Manoharan
2013-02-08 14:08 ` [PATCH 1/3] ath9k: Print the negotiated HT capabilities Sujith Manoharan
2013-02-08 19:45   ` John W. Linville
2013-02-09  2:27     ` Sujith Manoharan

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=1359972504-8900-1-git-send-email-sujith@msujith.org \
    --to=sujith@msujith.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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.