Linux wireless drivers development
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: johannes@sipsolutions.net, linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] iw: add survey busy ratios
Date: Wed, 06 Oct 2010 12:30:39 +0900	[thread overview]
Message-ID: <20101006033039.17342.55809.stgit@tt-desk> (raw)

Print survey busy information, if present.

This does not include the neccessay update to nl80211.h.

Signed-off-by: Bruno Randolf <br1@einfach.org>

--
the iw part of the survey series, in case it gets accepted :)
---
 survey.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/survey.c b/survey.c
index f9f2508..3257e9f 100644
--- a/survey.c
+++ b/survey.c
@@ -23,6 +23,9 @@ static int print_survey_handler(struct nl_msg *msg, void *arg)
 	static struct nla_policy survey_policy[NL80211_SURVEY_INFO_MAX + 1] = {
 		[NL80211_SURVEY_INFO_FREQUENCY] = { .type = NLA_U32 },
 		[NL80211_SURVEY_INFO_NOISE] = { .type = NLA_U8 },
+		[NL80211_SURVEY_INFO_BUSY] = { .type = NLA_U8 },
+		[NL80211_SURVEY_INFO_BUSY_TX] = { .type = NLA_U8 },
+		[NL80211_SURVEY_INFO_BUSY_RX] = { .type = NLA_U8 },
 	};
 
 	nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -49,6 +52,18 @@ static int print_survey_handler(struct nl_msg *msg, void *arg)
 	if (sinfo[NL80211_SURVEY_INFO_NOISE])
 		printf("\tnoise:\t\t%d dBm\n",
 			(int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));
+	if (sinfo[NL80211_SURVEY_INFO_BUSY])
+		printf("\tbusy:\t\t%d%%\n",
+			((int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_BUSY])
+			* 100) / 255);
+	if (sinfo[NL80211_SURVEY_INFO_BUSY_RX])
+		printf("\tbusy rx:\t%d%%\n",
+			((int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_BUSY_RX])
+			* 100) / 255);
+	if (sinfo[NL80211_SURVEY_INFO_BUSY_TX])
+		printf("\tbusy tx:\t%d%%\n",
+			((int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_BUSY_TX])
+			* 100) / 255);
 	return NL_SKIP;
 }
 


                 reply	other threads:[~2010-10-06  3:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20101006033039.17342.55809.stgit@tt-desk \
    --to=br1@einfach.org \
    --cc=johannes@sipsolutions.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox