linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: linville@tuxdriver.com
Cc: nbd@openwrt.org, ath5k-devel@lists.ath5k.org,
	linux-wireless@vger.kernel.org, adrian@freebsd.org,
	vasanth@atheros.com
Subject: [PATCH 4/5] nl80211/mac80211: Add channel utilization to survey
Date: Tue, 05 Oct 2010 18:55:26 +0900	[thread overview]
Message-ID: <20101005095526.3083.82322.stgit@tt-desk> (raw)
In-Reply-To: <20101005095510.3083.46174.stgit@tt-desk>

This adds three new values to the survey results:

  * BUSY - percentage of time the channel was busy
  * BUSY_TX - percentage of time spent transmitting frames
  * BUSY_RX - percentage of time spent receiving frames

They are defined to be a percentage of time, normalized to 255. That way they
match the Channel Utilization of the BSS Load IE of 802.11-2007, chapter
7.3.2.28, in case we want to use that later.

I admit that these three values are ath[59]k centric - it's what is available
there, and i don't know if other chipsets have similar information.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 include/linux/nl80211.h |   10 ++++++++++
 include/net/cfg80211.h  |    6 ++++++
 net/wireless/nl80211.c  |    9 +++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index f0518b0..2cc74a2 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1400,6 +1400,13 @@ enum nl80211_reg_rule_flags {
  * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved
  * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
  * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
+ * @NL80211_SURVEY_INFO_BUSY: channel busy ratio (u8, percentage of time,
+ *	normalized to 255 so it matches Channel Utilization of the BSS Load IE
+ *	of 802.11-2007 chapter 7.3.2.28)
+ * @NL80211_SURVEY_INFO_BUSY_TX: percentage of time spent transmitting frames
+ *	(u8, percent 0-255, see above)
+ * @NL80211_SURVEY_INFO_BUSY_RX: percentage of time spent receiving frames
+ *	(u8, percent 0-255, see above)
  * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
  *	currently defined
  * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -1408,6 +1415,9 @@ enum nl80211_survey_info {
 	__NL80211_SURVEY_INFO_INVALID,
 	NL80211_SURVEY_INFO_FREQUENCY,
 	NL80211_SURVEY_INFO_NOISE,
+	NL80211_SURVEY_INFO_BUSY,
+	NL80211_SURVEY_INFO_BUSY_TX,
+	NL80211_SURVEY_INFO_BUSY_RX,
 
 	/* keep last */
 	__NL80211_SURVEY_INFO_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a0613ff..e86c890 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -299,6 +299,9 @@ struct key_params {
  */
 enum survey_info_flags {
 	SURVEY_INFO_NOISE_DBM = 1<<0,
+	SURVEY_INFO_BUSY = 1<<1,
+	SURVEY_INFO_BUSY_TX = 1<<2,
+	SURVEY_INFO_BUSY_RX = 1<<3,
 };
 
 /**
@@ -318,6 +321,9 @@ struct survey_info {
 	struct ieee80211_channel *channel;
 	u32 filled;
 	s8 noise;
+	u8 busy;
+	u8 busy_rx;
+	u8 busy_tx;
 };
 
 /**
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9c84825..26062e1 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3489,6 +3489,15 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq,
 	if (survey->filled & SURVEY_INFO_NOISE_DBM)
 		NLA_PUT_U8(msg, NL80211_SURVEY_INFO_NOISE,
 			    survey->noise);
+	if (survey->filled & SURVEY_INFO_BUSY)
+		NLA_PUT_U8(msg, NL80211_SURVEY_INFO_BUSY,
+			    survey->busy);
+	if (survey->filled & SURVEY_INFO_BUSY_TX)
+		NLA_PUT_U8(msg, NL80211_SURVEY_INFO_BUSY_TX,
+			    survey->busy_tx);
+	if (survey->filled & SURVEY_INFO_BUSY_RX)
+		NLA_PUT_U8(msg, NL80211_SURVEY_INFO_BUSY_RX,
+			    survey->busy_rx);
 
 	nla_nest_end(msg, infoattr);
 


  parent reply	other threads:[~2010-10-05  9:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-05  9:55 [PATCH 1/5] ath: Add common function for reading cycle counters Bruno Randolf
2010-10-05  9:55 ` [PATCH 2/5] ath5k: Use common cycle counters for ANI Bruno Randolf
2010-10-05  9:55 ` [PATCH 3/5] ath9k: Use common cycle counters Bruno Randolf
2010-10-05 20:14   ` [ath5k-devel] " Luis R. Rodriguez
2010-10-06  1:10     ` Bruno Randolf
2010-10-06  1:13       ` Luis R. Rodriguez
2010-10-06  1:18   ` Luis R. Rodriguez
2010-10-06  2:00     ` Bruno Randolf
2010-10-06  2:15       ` [ath5k-devel] " Luis R. Rodriguez
2010-10-05  9:55 ` Bruno Randolf [this message]
2010-10-05 22:36   ` [PATCH 4/5] nl80211/mac80211: Add channel utilization to survey Luis R. Rodriguez
2010-10-06  2:35     ` Bruno Randolf
2010-10-06  9:54   ` Helmut Schaa
2010-10-07  1:03     ` Bruno Randolf
2010-10-07  3:02       ` [ath5k-devel] " Luis R. Rodriguez
2010-10-07  6:51       ` Helmut Schaa
2010-10-07  7:06         ` Bruno Randolf
2010-10-07  7:35           ` Jonathan Guerin
2010-10-07  7:44           ` Helmut Schaa
2010-10-07  7:52             ` Johannes Berg
2010-10-08 17:41               ` Helmut Schaa
2010-10-05  9:55 ` [PATCH 5/5] ath5k: Add busy ratios to survey data Bruno Randolf
2010-10-05 22:38   ` Luis R. Rodriguez
2010-10-06  2:25     ` Bruno Randolf
2010-10-06  2:45       ` Felix Fietkau
2010-10-06  2:50         ` Bruno Randolf
2010-10-06 14:13           ` Luis R. Rodriguez

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=20101005095526.3083.82322.stgit@tt-desk \
    --to=br1@einfach.org \
    --cc=adrian@freebsd.org \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=nbd@openwrt.org \
    --cc=vasanth@atheros.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 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).