linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] iw: survey: Mark frequency in use
@ 2011-01-11  0:51 Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 2/4] iw: Add channel busy time to survey Bruno Randolf
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bruno Randolf @ 2011-01-11  0:51 UTC (permalink / raw)
  To: johannes, linville; +Cc: nbd, linux-wireless

From: Felix Fietkau <nbd@openwrt.org>

Survey: Mark frequency in use according to NL80211_SURVEY_INFO_IN_USE.

This patch comes from OpenWRT. Original author: Felix Fietkau

Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 survey.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/survey.c b/survey.c
index f9f2508..83c54b3 100644
--- a/survey.c
+++ b/survey.c
@@ -44,8 +44,9 @@ static int print_survey_handler(struct nl_msg *msg, void *arg)
 	}
 
 	if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
-		printf("\tfrequency:\t%u MHz\n",
-			nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]));
+		printf("\tfrequency:\t%u MHz%s\n",
+			nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]),
+			sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : "");
 	if (sinfo[NL80211_SURVEY_INFO_NOISE])
 		printf("\tnoise:\t\t%d dBm\n",
 			(int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11  0:51 [PATCH v2 1/4] iw: survey: Mark frequency in use Bruno Randolf
@ 2011-01-11  0:51 ` Bruno Randolf
  2011-01-11  8:32   ` Johannes Berg
  2011-01-11  0:51 ` [PATCH v2 3/4] iw: add multicast rates to IBSS join Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 4/4] iw: Add signal average to station dump information Bruno Randolf
  2 siblings, 1 reply; 10+ messages in thread
From: Bruno Randolf @ 2011-01-11  0:51 UTC (permalink / raw)
  To: johannes, linville; +Cc: nbd, linux-wireless

From: Felix Fietkau <nbd@openwrt.org>

Print channel busy time in survey dump.

This patch comes from OpenWRT. Original author: Felix Fietkau.
Fixed up for unsigned values.

Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 survey.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/survey.c b/survey.c
index 83c54b3..e71d21b 100644
--- a/survey.c
+++ b/survey.c
@@ -44,12 +44,27 @@ static int print_survey_handler(struct nl_msg *msg, void *arg)
 	}
 
 	if (sinfo[NL80211_SURVEY_INFO_FREQUENCY])
-		printf("\tfrequency:\t%u MHz%s\n",
+		printf("\tfrequency:\t\t\t%u MHz%s\n",
 			nla_get_u32(sinfo[NL80211_SURVEY_INFO_FREQUENCY]),
 			sinfo[NL80211_SURVEY_INFO_IN_USE] ? " [in use]" : "");
 	if (sinfo[NL80211_SURVEY_INFO_NOISE])
-		printf("\tnoise:\t\t%d dBm\n",
+		printf("\tnoise:\t\t\t\t%d dBm\n",
 			(int8_t)nla_get_u8(sinfo[NL80211_SURVEY_INFO_NOISE]));
+	if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME])
+		printf("\tchannel active time:\t\t%llu ms\n",
+			(uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME]));
+	if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY])
+		printf("\tchannel busy time:\t\t%llu ms\n",
+			(uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY]));
+	if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY])
+		printf("\textension channel busy time:\t%llu ms\n",
+			(uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY]));
+	if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX])
+		printf("\tchannel receive time:\t\t%llu ms\n",
+			(uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));
+	if (sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX])
+		printf("\tchannel transmit time:\t\t%llu ms\n",
+			(uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_TX]));
 	return NL_SKIP;
 }
 


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/4] iw: add multicast rates to IBSS join
  2011-01-11  0:51 [PATCH v2 1/4] iw: survey: Mark frequency in use Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 2/4] iw: Add channel busy time to survey Bruno Randolf
@ 2011-01-11  0:51 ` Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 4/4] iw: Add signal average to station dump information Bruno Randolf
  2 siblings, 0 replies; 10+ messages in thread
From: Bruno Randolf @ 2011-01-11  0:51 UTC (permalink / raw)
  To: johannes, linville; +Cc: nbd, linux-wireless

From: Felix Fietkau <nbd@openwrt.org>

Add multicast rates to IBSS join command.

This patch comes from OpenWRT. Original author: Felix Fietkau.

Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 ibss.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/ibss.c b/ibss.c
index 84ea7f2..ca8a4ec 100644
--- a/ibss.c
+++ b/ibss.c
@@ -95,6 +95,20 @@ static int join_ibss(struct nl80211_state *state,
 		argc--;
 	}
 
+	/* multicast rate */
+	if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) {
+		argv++;
+		argc--;
+
+		rate = strtod(argv[0], &end);
+		if (*end != '\0')
+			return 1;
+
+		NLA_PUT_U32(msg, NL80211_ATTR_MCAST_RATE, (int) rate * 10);
+		argv++;
+		argc--;
+	}
+
 	if (!argc)
 		return 0;
 
@@ -120,12 +134,13 @@ COMMAND(ibss, leave, NULL,
 	NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
 	"Leave the current IBSS cell.");
 COMMAND(ibss, join,
-	"<SSID> <freq in MHz> [fixed-freq] [<fixed bssid>] [beacon-interval "
-	"<TU>] [basic-rates <rate in Mbps,rate2,...>] [key d:0:abcde]",
+	"<SSID> <freq in MHz> [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
+	" [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
+	"[key d:0:abcde]",
 	NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
 	"Join the IBSS cell with the given SSID, if it doesn't exist create\n"
 	"it on the given frequency. When fixed frequency is requested, don't\n"
 	"join/create a cell on a different frequency. When a fixed BSSID is\n"
 	"requested use that BSSID and do not adopt another cell's BSSID even\n"
 	"if it has higher TSF and the same SSID. If an IBSS is created, create\n"
-	"it with the specified basic-rates and beacon-interval (in TU).");
+	"it with the specified basic-rates, multicast-rate and beacon-interval.");


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/4] iw: Add signal average to station dump information
  2011-01-11  0:51 [PATCH v2 1/4] iw: survey: Mark frequency in use Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 2/4] iw: Add channel busy time to survey Bruno Randolf
  2011-01-11  0:51 ` [PATCH v2 3/4] iw: add multicast rates to IBSS join Bruno Randolf
@ 2011-01-11  0:51 ` Bruno Randolf
  2 siblings, 0 replies; 10+ messages in thread
From: Bruno Randolf @ 2011-01-11  0:51 UTC (permalink / raw)
  To: johannes, linville; +Cc: nbd, linux-wireless

Print station signal average in station dump.

Signed-off-by: Bruno Randolf <br1@einfach.org>
---
 station.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/station.c b/station.c
index be2301f..6581d50 100644
--- a/station.c
+++ b/station.c
@@ -107,6 +107,9 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 	if (sinfo[NL80211_STA_INFO_SIGNAL])
 		printf("\n\tsignal:  \t%d dBm",
 			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
+	if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
+		printf("\n\tsignal avg:\t%d dBm",
+			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]));
 
 	if (sinfo[NL80211_STA_INFO_TX_BITRATE]) {
 		if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX,


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11  0:51 ` [PATCH v2 2/4] iw: Add channel busy time to survey Bruno Randolf
@ 2011-01-11  8:32   ` Johannes Berg
  2011-01-11  9:20     ` Bruno Randolf
  2011-01-11 12:57     ` jpo234
  0 siblings, 2 replies; 10+ messages in thread
From: Johannes Berg @ 2011-01-11  8:32 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linville, nbd, linux-wireless

On Tue, 2011-01-11 at 09:51 +0900, Bruno Randolf wrote:
> From: Felix Fietkau <nbd@openwrt.org>
> 
> Print channel busy time in survey dump.
> 
> This patch comes from OpenWRT. Original author: Felix Fietkau.
> Fixed up for unsigned values.

I've fixed it up, but two things: You should've lost the "original
author" crap after you fixed up the git author field.

Secondly,

> 
> +               printf("\tchannel receive time:\t\t%llu ms\n",
> +                       (uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));

caused warnings:
survey.c: In function ‘print_survey_handler’:
survey.c:55: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
survey.c:58: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
survey.c:61: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
survey.c:64: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
survey.c:67: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’


because uint64_t isn't guaranteed to be unsigned long long (in fact, it
is unsigned long on many machines). Please look at the commit and check.

johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11  8:32   ` Johannes Berg
@ 2011-01-11  9:20     ` Bruno Randolf
  2011-01-11 12:57     ` jpo234
  1 sibling, 0 replies; 10+ messages in thread
From: Bruno Randolf @ 2011-01-11  9:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, nbd, linux-wireless

On Tue January 11 2011 17:32:24 Johannes Berg wrote:
> I've fixed it up, but two things: You should've lost the "original
> author" crap after you fixed up the git author field.

Sorry for that.
 
> Secondly,
> 
> > +               printf("\tchannel receive time:\t\t%llu ms\n",
> > +                      
> > (uint64_t)nla_get_u64(sinfo[NL80211_SURVEY_INFO_CHANNEL_TIME_RX]));
> 
> caused warnings:
> survey.c: In function ‘print_survey_handler’:
> survey.c:55: warning: format ‘%llu’ expects type ‘long long unsigned int’,
> but argument 2 has type ‘uint64_t’ survey.c:58: warning: format ‘%llu’
> expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
> survey.c:61: warning: format ‘%llu’ expects type ‘long long unsigned int’,
> but argument 2 has type ‘uint64_t’ survey.c:64: warning: format ‘%llu’
> expects type ‘long long unsigned int’, but argument 2 has type ‘uint64_t’
> survey.c:67: warning: format ‘%llu’ expects type ‘long long unsigned int’,
> but argument 2 has type ‘uint64_t’
> 
> 
> because uint64_t isn't guaranteed to be unsigned long long (in fact, it
> is unsigned long on many machines). Please look at the commit and check.

Looks good & compiles on my platforms (x86, mips).

Thanks,
bruno

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11  8:32   ` Johannes Berg
  2011-01-11  9:20     ` Bruno Randolf
@ 2011-01-11 12:57     ` jpo234
  2011-01-11 13:00       ` jpo234
  2011-01-11 13:00       ` Johannes Berg
  1 sibling, 2 replies; 10+ messages in thread
From: jpo234 @ 2011-01-11 12:57 UTC (permalink / raw)
  To: linux-wireless

Johannes Berg <johannes@...> writes:
> because uint64_t isn't guaranteed to be unsigned long long (in fact, it
> is unsigned long on many machines). Please look at the commit and check.

In the commit you did a cast to unsigned long long. While this works, it's
depends on gcc-ism, e.g. long long support. The C99 way would be to use the 
PRIu64 macro (see stdint.h).
see http://www.dinkumware.com/manuals/?manual=compleat&page=inttypes.html#PRIu64


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11 12:57     ` jpo234
@ 2011-01-11 13:00       ` jpo234
  2011-01-11 13:00       ` Johannes Berg
  1 sibling, 0 replies; 10+ messages in thread
From: jpo234 @ 2011-01-11 13:00 UTC (permalink / raw)
  To: linux-wireless

jpo234 <pommnitz@...> writes:
> The C99 way would be to use the PRIu64 macro (see stdint.h).

Sorry, make this <inttypes.h>.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11 12:57     ` jpo234
  2011-01-11 13:00       ` jpo234
@ 2011-01-11 13:00       ` Johannes Berg
  2011-01-11 13:08         ` jpo234
  1 sibling, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2011-01-11 13:00 UTC (permalink / raw)
  To: jpo234; +Cc: linux-wireless

On Tue, 2011-01-11 at 12:57 +0000, jpo234 wrote:
> Johannes Berg <johannes@...> writes:
> > because uint64_t isn't guaranteed to be unsigned long long (in fact, it
> > is unsigned long on many machines). Please look at the commit and check.
> 
> In the commit you did a cast to unsigned long long. While this works, it's
> depends on gcc-ism, e.g. long long support. The C99 way would be to use the 
> PRIu64 macro (see stdint.h).
> see http://www.dinkumware.com/manuals/?manual=compleat&page=inttypes.html#PRIu64

Oi, that's complicated. Patch welcome I guess.

johannes


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/4] iw: Add channel busy time to survey
  2011-01-11 13:00       ` Johannes Berg
@ 2011-01-11 13:08         ` jpo234
  0 siblings, 0 replies; 10+ messages in thread
From: jpo234 @ 2011-01-11 13:08 UTC (permalink / raw)
  To: linux-wireless

Johannes Berg <johannes@...> writes:
> > see http://www.dinkumware.com/manuals/?manual=compleat&page=inttypes.html#PRIu64
> 
> Oi, that's complicated. Patch welcome I guess.

Not really:

#include <inttypes.h>
#include <stdio.h>

int
main()
{
	printf ("unsigned long long: %llu\n", 1llu);
	printf ("uint64_t: %"PRIu64"\n", (uint64_t)1);
	return 0;
}



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-11 13:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11  0:51 [PATCH v2 1/4] iw: survey: Mark frequency in use Bruno Randolf
2011-01-11  0:51 ` [PATCH v2 2/4] iw: Add channel busy time to survey Bruno Randolf
2011-01-11  8:32   ` Johannes Berg
2011-01-11  9:20     ` Bruno Randolf
2011-01-11 12:57     ` jpo234
2011-01-11 13:00       ` jpo234
2011-01-11 13:00       ` Johannes Berg
2011-01-11 13:08         ` jpo234
2011-01-11  0:51 ` [PATCH v2 3/4] iw: add multicast rates to IBSS join Bruno Randolf
2011-01-11  0:51 ` [PATCH v2 4/4] iw: Add signal average to station dump information Bruno Randolf

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).