Search Linux Wireless

RFC Patch: Add signal strength to nl80211station info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux