linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Henning Rogge <rogge@fgan.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Henning Rogge <hrogge@googlemail.com>,
	Marcel Holtmann <holtmann@linux.intel.com>,
	"linux-wireless" <linux-wireless@vger.kernel.org>
Subject: Re: RFC Patch v2: Add signal strength to nl80211station info
Date: Mon, 1 Dec 2008 14:22:23 +0100	[thread overview]
Message-ID: <200812011422.30671.rogge@fgan.de> (raw)
In-Reply-To: <1228130256.3478.5.camel@johannes.berg>


[-- Attachment #1.1: Type: text/plain, Size: 4893 bytes --]

Am Monday 01 December 2008 12:17:36 schrieb Johannes Berg:
> Even if you corrected the spelling to "bandwidth" you'd (a) be missing
> documentation and (b) be using an entirely wrong term for what you're
> doing.

Changes since v1:
- removed noise and quality from station info in NL80211
- added bandwith to station info in NL80211
- changed name of patch file to nl80211ext_v2.patch

Changes since v2:
- added kernel comment lines for new fields/enums
- changed name of "bandwith" field to tx_bitrate

Henning Rogge

*************************************************
Diplom Informatiker Henning Rogge
Forschungsgesellschaft für
Angewandte Naturwissenschaften e. V. (FGAN) 
Neuenahrer Str. 20, 53343 Wachtberg, Germany
Tel.: 0049 (0)228 9435-961
Fax: 0049 (0)228 9435-685
E-Mail: rogge@fgan.de
Web: www.fgan.de
************************************************
Sitz der Gesellschaft: Bonn
Registergericht: Amtsgericht Bonn VR 2530
Vorstand: Dr. rer. nat. Ralf Dornhaus (Vors.), Prof. Dr. Joachim Ender 
(Stellv.)

---------------------------------------------------

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e08c8bc..030feed 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -404,6 +404,8 @@ enum nl80211_sta_flags {
  * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
+ * @NL80211_STA_INFO_SIGNAL: signal strength of last received package (u8, 
dBm)
+ * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate (u16, 100 kbit/s)
  */
 enum nl80211_sta_info {
 	__NL80211_STA_INFO_INVALID,
@@ -413,6 +415,8 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_LLID,
 	NL80211_STA_INFO_PLID,
 	NL80211_STA_INFO_PLINK_STATE,
+	NL80211_STA_INFO_SIGNAL,
+	NL80211_STA_INFO_TX_BITRATE,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1d57835..fd9964c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -167,6 +167,8 @@ struct station_parameters {
  * @STATION_INFO_LLID: @llid filled
  * @STATION_INFO_PLID: @plid filled
  * @STATION_INFO_PLINK_STATE: @plink_state filled
+ * @STATION_INFO_SIGNAL: @signal filled
+ * @STATION_INFO_TX_BITRATE: @tx_bitrate filled
  */
 enum station_info_flags {
 	STATION_INFO_INACTIVE_TIME	= 1<<0,
@@ -175,6 +177,8 @@ enum station_info_flags {
 	STATION_INFO_LLID		= 1<<3,
 	STATION_INFO_PLID		= 1<<4,
 	STATION_INFO_PLINK_STATE	= 1<<5,
+	STATION_INFO_SIGNAL		= 1<<6,
+	STATION_INFO_TX_BITRATE		= 1<<7,
 };
 
 /**
@@ -189,6 +193,8 @@ enum station_info_flags {
  * @llid: mesh local link id
  * @plid: mesh peer link id
  * @plink_state: mesh peer link state
+ * @signal: signal strength of last received package in dBm
+ * @tx_bitrate: current unicast tx rate in 100 kbit/sec
  */
 struct station_info {
 	u32 filled;
@@ -198,6 +204,8 @@ struct station_info {
 	u16 llid;
 	u16 plid;
 	u8 plink_state;
+	u8 signal;
+	u16 tx_bitrate;
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 16423f9..f6ed5b5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -307,14 +307,24 @@ static int ieee80211_config_default_key(struct wiphy 
*wiphy,
 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
+  struct ieee80211_supported_band *sband;
 
 	sinfo->filled = STATION_INFO_INACTIVE_TIME |
 			STATION_INFO_RX_BYTES |
-			STATION_INFO_TX_BYTES;
+			STATION_INFO_TX_BYTES |
+			STATION_INFO_SIGNAL |
+			STATION_INFO_TX_BITRATE;
 
 	sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
 	sinfo->rx_bytes = sta->rx_bytes;
 	sinfo->tx_bytes = sta->tx_bytes;
+	sinfo->signal = sta->last_signal;
+
+	sband = sta->local->hw.wiphy->bands[sta->local->hw.conf.channel->band];
+	if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS))
+	  sinfo->tx_bitrate = sband->bitrates[sta->last_tx_rate.idx].bitrate;
+	else
+	  sinfo->tx_bitrate = 0;
 
 	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 #ifdef CONFIG_MAC80211_MESH
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c9141e3..0afc641 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1057,6 +1057,12 @@ static int nl80211_send_station(struct sk_buff *msg, 
u32 pid, u32 seq,
 	if (sinfo->filled & STATION_INFO_PLINK_STATE)
 		NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE,
 			    sinfo->plink_state);
+	if (sinfo->filled & STATION_INFO_SIGNAL)
+		NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL,
+			    sinfo->signal);
+	if (sinfo->filled & STATION_INFO_TX_BITRATE)
+		NLA_PUT_U16(msg, NL80211_STA_INFO_TX_BITRATE,
+			    sinfo->tx_bitrate);
 
 	nla_nest_end(msg, sinfoattr);
 


[-- Attachment #1.2: nl80211ext_v3.patch --]
[-- Type: text/x-patch, Size: 3785 bytes --]

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e08c8bc..030feed 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -404,6 +404,8 @@ enum nl80211_sta_flags {
  * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
  * @__NL80211_STA_INFO_AFTER_LAST: internal
  * @NL80211_STA_INFO_MAX: highest possible station info attribute
+ * @NL80211_STA_INFO_SIGNAL: signal strength of last received package (u8, dBm)
+ * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate (u16, 100 kbit/s)
  */
 enum nl80211_sta_info {
 	__NL80211_STA_INFO_INVALID,
@@ -413,6 +415,8 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_LLID,
 	NL80211_STA_INFO_PLID,
 	NL80211_STA_INFO_PLINK_STATE,
+	NL80211_STA_INFO_SIGNAL,
+	NL80211_STA_INFO_TX_BITRATE,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1d57835..fd9964c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -167,6 +167,8 @@ struct station_parameters {
  * @STATION_INFO_LLID: @llid filled
  * @STATION_INFO_PLID: @plid filled
  * @STATION_INFO_PLINK_STATE: @plink_state filled
+ * @STATION_INFO_SIGNAL: @signal filled
+ * @STATION_INFO_TX_BITRATE: @tx_bitrate filled
  */
 enum station_info_flags {
 	STATION_INFO_INACTIVE_TIME	= 1<<0,
@@ -175,6 +177,8 @@ enum station_info_flags {
 	STATION_INFO_LLID		= 1<<3,
 	STATION_INFO_PLID		= 1<<4,
 	STATION_INFO_PLINK_STATE	= 1<<5,
+	STATION_INFO_SIGNAL		= 1<<6,
+	STATION_INFO_TX_BITRATE		= 1<<7,
 };
 
 /**
@@ -189,6 +193,8 @@ enum station_info_flags {
  * @llid: mesh local link id
  * @plid: mesh peer link id
  * @plink_state: mesh peer link state
+ * @signal: signal strength of last received package in dBm
+ * @tx_bitrate: current unicast tx rate in 100 kbit/sec
  */
 struct station_info {
 	u32 filled;
@@ -198,6 +204,8 @@ struct station_info {
 	u16 llid;
 	u16 plid;
 	u8 plink_state;
+	u8 signal;
+	u16 tx_bitrate;
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 16423f9..f6ed5b5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -307,14 +307,24 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
+  struct ieee80211_supported_band *sband;
 
 	sinfo->filled = STATION_INFO_INACTIVE_TIME |
 			STATION_INFO_RX_BYTES |
-			STATION_INFO_TX_BYTES;
+			STATION_INFO_TX_BYTES |
+			STATION_INFO_SIGNAL |
+			STATION_INFO_TX_BITRATE;
 
 	sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
 	sinfo->rx_bytes = sta->rx_bytes;
 	sinfo->tx_bytes = sta->tx_bytes;
+	sinfo->signal = sta->last_signal;
+
+	sband = sta->local->hw.wiphy->bands[sta->local->hw.conf.channel->band];
+	if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS))
+	  sinfo->tx_bitrate = sband->bitrates[sta->last_tx_rate.idx].bitrate;
+	else
+	  sinfo->tx_bitrate = 0;
 
 	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 #ifdef CONFIG_MAC80211_MESH
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c9141e3..0afc641 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1057,6 +1057,12 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
 	if (sinfo->filled & STATION_INFO_PLINK_STATE)
 		NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE,
 			    sinfo->plink_state);
+	if (sinfo->filled & STATION_INFO_SIGNAL)
+		NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL,
+			    sinfo->signal);
+	if (sinfo->filled & STATION_INFO_TX_BITRATE)
+		NLA_PUT_U16(msg, NL80211_STA_INFO_TX_BITRATE,
+			    sinfo->tx_bitrate);
 
 	nla_nest_end(msg, sinfoattr);
 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2008-12-01 14:07 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 20:31 RFC Patch: Add signal strength to nl80211station info Henning Rogge
2008-11-25 20:47 ` Johannes Berg
2008-11-25 21:01   ` Henning Rogge
2008-11-26  5:21   ` Marcel Holtmann
2008-11-26  8:32     ` Johannes Berg
2008-11-26 16:17     ` Henning Rogge
2008-11-29 10:50     ` RFC Patch v2: " Henning Rogge
2008-12-01 11:17       ` Johannes Berg
2008-12-01 13:22         ` Henning Rogge [this message]
2008-12-01 17:39           ` Luis R. Rodriguez
2008-12-01 17:45             ` Luis R. Rodriguez
2008-12-01 17:53             ` Henning Rogge
2008-12-02 13:25             ` Henning Rogge
2008-12-02 20:29               ` Luis R. Rodriguez
2008-12-02 20:46                 ` Henning Rogge
2008-12-03  1:44                   ` Luis R. Rodriguez
2008-12-03 10:31                     ` Henning Rogge
2008-12-04  8:47                       ` Johannes Berg
2008-12-04  9:48                         ` Henning Rogge
2008-12-04 13:02                           ` Johannes Berg
2008-12-04 20:26                       ` Johannes Berg
2008-12-04 21:12                         ` Luis R. Rodriguez
2008-12-04 21:20                           ` Johannes Berg
2008-12-05  8:34                             ` Henning Rogge
2008-12-05  9:45                               ` Johannes Berg
2008-12-05  9:51                                 ` Henning Rogge
2008-12-05  9:54                                   ` Johannes Berg
2008-12-05 23:26                                     ` Henning Rogge
2008-12-06  9:15                                       ` Johannes Berg
2008-12-06 11:12                                         ` Henning Rogge
2008-12-06 14:10                                 ` Henning Rogge
2008-12-06 14:43                                   ` Henning Rogge
2008-12-06 14:51                                   ` Johannes Berg
2008-12-06 15:03                                     ` Henning Rogge
2008-12-06 15:46                                       ` Henning Rogge
2008-12-06 15:59                                         ` Johannes Berg
2008-12-06 16:08                                           ` Henning Rogge
2008-12-06 20:46                                           ` Luis R. Rodriguez
2008-12-07 17:32                                             ` Henning Rogge
2008-12-07 17:39                                               ` Johannes Berg
2008-12-07 18:17                                                 ` [PATCH 1/2] Add signal strength and bandwith " Henning Rogge
2008-12-08 19:43                                                   ` Johannes Berg
2008-12-09 19:50                                                     ` Henning Rogge
2008-12-09 21:16                                                       ` Johannes Berg
2008-12-10  6:53                                                         ` Henning Rogge
2008-12-10  9:05                                                           ` Johannes Berg
2008-12-10 17:40                                                             ` Henning Rogge
2008-12-10 20:45                                                               ` Johannes Berg
2008-12-10 20:58                                                                 ` Henning Rogge
2008-12-10 21:01                                                                   ` Johannes Berg
2008-12-11 17:07                                                                     ` [Patch] nl80211: " Henning Rogge
2008-12-11 17:24                                                                       ` Johannes Berg
2008-12-11 18:02                                                                         ` Henning Rogge
2008-12-11 18:14                                                                           ` Johannes Berg
2008-12-11 18:22                                                                             ` Henning Rogge
2008-12-11 18:28                                                                               ` Johannes Berg
2008-12-11 20:10                                                                                 ` Henning Rogge
2008-12-11 20:24                                                                                   ` Johannes Berg
2008-12-11 20:12                                                                                 ` Henning Rogge
2008-12-11 20:23                                                                                   ` Johannes Berg
2008-12-09 19:54                                                     ` [Patch 1/2 v2] " Henning Rogge
2008-12-09 19:58                                                     ` [Patch 2/2 " Henning Rogge
2008-12-09 21:19                                                       ` Johannes Berg
2008-12-07 18:19                                                 ` [PATCH 2/2] " Henning Rogge
2008-12-07 18:20                                                 ` [PATCH 0/2] " Henning Rogge
2008-12-06 15:48                                       ` RFC Patch v2: Add signal strength " Johannes Berg

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=200812011422.30671.rogge@fgan.de \
    --to=rogge@fgan.de \
    --cc=holtmann@linux.intel.com \
    --cc=hrogge@googlemail.com \
    --cc=johannes@sipsolutions.net \
    --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).