linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC Patch: Add signal strength to nl80211station info
@ 2008-11-25 20:31 Henning Rogge
  2008-11-25 20:47 ` Johannes Berg
  0 siblings, 1 reply; 66+ messages in thread
From: Henning Rogge @ 2008-11-25 20:31 UTC (permalink / raw)
  To: linux-wireless


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

Hello,

I have just written a prototype of a patch that adds signal strength information to the nl80211 station info. This allows user space programs to keep track of the signal 
strength of each other station in communication range (in adhoc mode) without using radiotap headers (which consume lots of cpu power on embedded systems).

I have tested the patch with a modified iw command on ath5k. I'm still looking for a way to add the datarate of unicast for each of the stations in range, but would like 
to hear comments about the patch.

-------------------------------------------
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e08c8bc..1e20e47 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -413,7 +413,10 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_LLID,
 	NL80211_STA_INFO_PLID,
 	NL80211_STA_INFO_PLINK_STATE,
-
+	NL80211_STA_INFO_SIGNAL,
+	NL80211_STA_INFO_NOISE,
+	NL80211_STA_INFO_QUAL,
+	
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
 	NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1d57835..7fc1aaf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -175,6 +175,9 @@ 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_NOISE		= 1<<7,
+	STATION_INFO_QUAL		= 1<<8,
 };
 
 /**
@@ -195,6 +198,7 @@ struct station_info {
 	u32 inactive_time;
 	u32 rx_bytes;
 	u32 tx_bytes;
+	u32 signal,noise,qual;
 	u16 llid;
 	u16 plid;
 	u8 plink_state;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 16423f9..8006555 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -310,12 +310,18 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 
 	sinfo->filled = STATION_INFO_INACTIVE_TIME |
 			STATION_INFO_RX_BYTES |
-			STATION_INFO_TX_BYTES;
+			STATION_INFO_TX_BYTES |
+			STATION_INFO_SIGNAL |
+			STATION_INFO_NOISE |
+			STATION_INFO_QUAL;
 
 	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;
+	sinfo->qual = sta->last_qual;
+	sinfo->noise = sta->last_noise;
+	
 	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 #ifdef CONFIG_MAC80211_MESH
 		sinfo->filled |= STATION_INFO_LLID |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c9141e3..de30b1a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1057,6 +1057,15 @@ 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_U32(msg, NL80211_STA_INFO_SIGNAL,
+			    sinfo->signal);
+	if (sinfo->filled & STATION_INFO_NOISE)
+		NLA_PUT_U32(msg, NL80211_STA_INFO_NOISE,
+			    sinfo->noise);
+	if (sinfo->filled & STATION_INFO_QUAL)
+		NLA_PUT_U32(msg, NL80211_STA_INFO_QUAL,
+			    sinfo->qual);
 
 	nla_nest_end(msg, sinfoattr);
 


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

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e08c8bc..1e20e47 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -413,7 +413,10 @@ enum nl80211_sta_info {
 	NL80211_STA_INFO_LLID,
 	NL80211_STA_INFO_PLID,
 	NL80211_STA_INFO_PLINK_STATE,
-
+	NL80211_STA_INFO_SIGNAL,
+	NL80211_STA_INFO_NOISE,
+	NL80211_STA_INFO_QUAL,
+	
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
 	NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1d57835..7fc1aaf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -175,6 +175,9 @@ 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_NOISE		= 1<<7,
+	STATION_INFO_QUAL		= 1<<8,
 };
 
 /**
@@ -195,6 +198,7 @@ struct station_info {
 	u32 inactive_time;
 	u32 rx_bytes;
 	u32 tx_bytes;
+	u32 signal,noise,qual;
 	u16 llid;
 	u16 plid;
 	u8 plink_state;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 16423f9..8006555 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -310,12 +310,18 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 
 	sinfo->filled = STATION_INFO_INACTIVE_TIME |
 			STATION_INFO_RX_BYTES |
-			STATION_INFO_TX_BYTES;
+			STATION_INFO_TX_BYTES |
+			STATION_INFO_SIGNAL |
+			STATION_INFO_NOISE |
+			STATION_INFO_QUAL;
 
 	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;
+	sinfo->qual = sta->last_qual;
+	sinfo->noise = sta->last_noise;
+	
 	if (ieee80211_vif_is_mesh(&sdata->vif)) {
 #ifdef CONFIG_MAC80211_MESH
 		sinfo->filled |= STATION_INFO_LLID |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c9141e3..de30b1a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1057,6 +1057,15 @@ 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_U32(msg, NL80211_STA_INFO_SIGNAL,
+			    sinfo->signal);
+	if (sinfo->filled & STATION_INFO_NOISE)
+		NLA_PUT_U32(msg, NL80211_STA_INFO_NOISE,
+			    sinfo->noise);
+	if (sinfo->filled & STATION_INFO_QUAL)
+		NLA_PUT_U32(msg, NL80211_STA_INFO_QUAL,
+			    sinfo->qual);
 
 	nla_nest_end(msg, sinfoattr);
 

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

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

end of thread, other threads:[~2008-12-11 20:24 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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