From: Henning Rogge <hrogge@googlemail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Henning Rogge <rogge@fgan.de>,
"Luis R. Rodriguez" <lrodriguez@atheros.com>,
Luis Rodriguez <Luis.Rodriguez@atheros.com>,
Marcel Holtmann <holtmann@linux.intel.com>,
"linux-wireless" <linux-wireless@vger.kernel.org>,
"nbd@openwrt.org" <nbd@openwrt.org>
Subject: Re: RFC Patch v2: Add signal strength to nl80211station info
Date: Sat, 6 Dec 2008 15:43:56 +0100 [thread overview]
Message-ID: <200812061544.02312.hrogge@googlemail.com> (raw)
In-Reply-To: <200812061511.05473.hrogge@googlemail.com>
[-- Attachment #1.1: Type: text/plain, Size: 10132 bytes --]
Okay, here is v6 of my patch... feel free to rip it apart. ;)
(forgot to put the patch inline too... sorry)
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
Changes since v3:
- added rx_bitrate to station info and sta_info
- remember bitrate of last received unicast packet to this station
- decode 802.11n MCS index for nl80211
(maybe this should be ported to WEXT too ?)
Changes since v4:
- added tx_bitrate_flags adn tx_bitrate_mcs field to station info
- added flags for 40Mhz and small guard interval to NL80211 station info
- added mcs field to NL80211 station info
Changes since v5:
- remove rx_bitrate from patch until we get a sane way to learn the details of
received 802.11n packages
-replace 802.11n bitrate arrays with calculation based on basic rates
- pushed txrate nl80211 stationinfo into nested attribute
- created station_info_rate_flags enum to save bitrate flags in
station_info - cleanup of kerneldoc
TODO:
- push magic numbers of sta_get_80211n_bitrate (65/135) into constants
- coding style cleanup
Henning
-----------------------
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 04d4516..e14caa9 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -425,6 +425,30 @@ enum nl80211_sta_flags {
};
/**
+ * enum nl80211_sta_info_rate - station information about bitrate
+ *
+ * These attribute types are used with %NL80211_STA_INFO_TXRATE
+ * when getting information about the bitrate of a station.
+ *
+ * @__NL80211_STA_INFO_RATE_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_INFO_RATE_TOTAL: total bitrate (u16, 100kbit/s)
+ * @NL80211_STA_INFO_RATE_MCS: mcs index for 802.11n (u8)
+ * @NL80211_STA_INFO_RATE_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
+ * @NL80211_STA_INFO_RATE_SHORT_GI: 400ns guard interval
+ */
+enum nl80211_sta_info_rate {
+ __NL80211_STA_INFO_RATE_INVALID,
+ NL80211_STA_INFO_RATE_TOTAL,
+ NL80211_STA_INFO_RATE_MCS,
+ NL80211_STA_INFO_RATE_40_MHZ_WIDTH,
+ NL80211_STA_INFO_RATE_SHORT_GI,
+
+ /* keep last */
+ __NL80211_STA_INFO_RATE_AFTER_LAST,
+ NL80211_STA_INFO_RATE_MAX = __NL80211_STA_INFO_RATE_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_sta_info - station information
*
* These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -436,6 +460,9 @@ 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, nested attribute
+ * containing info as possible, see &enum nl80211_sta_info_txrate.
*/
enum nl80211_sta_info {
__NL80211_STA_INFO_INVALID,
@@ -445,6 +472,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 a0c0bf1..9ebcb11 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -169,6 +169,10 @@ 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_RX_BITRATE: @rx_bitrate filled
+ * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
+ * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -177,6 +181,25 @@ 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_RX_BITRATE = 1<<7,
+ STATION_INFO_TX_BITRATE = 1<<8,
+};
+
+/**
+ * enum station_info_rate_flags - station transmission rate flags
+ *
+ * Used by the driver to indicate the specific rate transmission
+ * type for 802.11n transmissions.
+ *
+ * @STATION_INFO_BITRATE_MCS: @tx_bitrate_mcs filled
+ * @STATION_INFO_BITRATE_40_MHZ_WIDTH: 40 Mhz width transmission
+ * @STATION_INFO_BITRATE_SHORT_GI: 400ns guard interval
+ */
+enum station_info_rate_flags {
+ STATION_INFO_BITRATE_MCS = 1<<0,
+ STATION_INFO_BITRATE_40_MHZ_WIDTH = 1<<1,
+ STATION_INFO_BITRATE_SHORT_GI = 1<<2,
};
/**
@@ -191,6 +214,11 @@ 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
+ * @txrate_total: current unicast bitrate to this station in 100 kbit/sec
+ * @txrate_flags: bitflag of flags from &enum station_info_bitrate_flags
+ * @txrate_mcs: MCS index of a 802.11n transmission, see
+ * &enum station_info_bitrate_flags
*/
struct station_info {
u32 filled;
@@ -200,6 +228,10 @@ struct station_info {
u16 llid;
u16 plid;
u8 plink_state;
+ u8 signal;
+ u16 txrate_total;
+ u8 txrate_flags;
+ u8 txrate_mcs;
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7a7a6c1..3567cd9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -304,18 +304,65 @@ static int ieee80211_config_default_key(struct wiphy
*wiphy,
return 0;
}
+static u16 sta_get_80211n_bitrate(struct ieee80211_tx_rate *rate)
+{
+ int modulation = rate->idx & 7;
+ int streams = rate->idx >> 3;
+
+ int bitrate = (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 13500000 :
6500000;
+
+ if (modulation < 4)
+ bitrate *= (modulation + 1);
+ else if (modulation == 4)
+ bitrate *= (modulation + 2);
+ else
+ bitrate *= (modulation + 3);
+
+ bitrate *= streams;
+
+ if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
+ bitrate = (bitrate * 10) / 9;
+
+ return (bitrate + 50000) / 100000; // do NOT just round down
+}
+
static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
sinfo->filled = STATION_INFO_INACTIVE_TIME |
STATION_INFO_RX_BYTES |
- STATION_INFO_TX_BYTES;
+ STATION_INFO_TX_BYTES |
+ STATION_INFO_RX_BITRATE |
+ 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;
+ if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
+ sinfo->filled |= STATION_INFO_SIGNAL;
+ sinfo->signal = sta->last_signal;
+ }
+
+ sinfo->txrate_flags = 0;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_MCS;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_40_MHZ_WIDTH;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_SHORT_GI;
+
+ if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) {
+ struct ieee80211_supported_band *sband;
+ sband = sta->local->hw.wiphy->bands[sta->local->hw.conf.channel->band];
+ sinfo->txrate_total = sband->bitrates[sta->last_tx_rate.idx].bitrate;
+ }
+ else {
+ sinfo->txrate_total = sta_get_80211n_bitrate(&sta->last_tx_rate);
+ sinfo->txrate_mcs = sta->last_tx_rate.idx;
+ }
+
if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
sinfo->filled |= STATION_INFO_LLID |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 59f356a..84922b0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -727,8 +727,9 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
NL80211_IFTYPE_ADHOC);
- if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0)
+ if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0) {
sta->last_rx = jiffies;
+ }
} else
if (!is_multicast_ether_addr(hdr->addr1) ||
rx->sdata->vif.type == NL80211_IFTYPE_STATION) {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9caee60..197dc4d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -16,6 +16,7 @@
#include <linux/netlink.h>
#include <net/genetlink.h>
#include <net/cfg80211.h>
+#include <net/mac80211.h>
#include "core.h"
#include "nl80211.h"
#include "reg.h"
@@ -1084,7 +1085,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32
pid, u32 seq,
u8 *mac_addr, struct station_info *sinfo)
{
void *hdr;
- struct nlattr *sinfoattr;
+ struct nlattr *sinfoattr, *txrate;
hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION);
if (!hdr)
@@ -1114,7 +1115,27 @@ 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) {
+ txrate = nla_nest_start(msg, NL80211_STA_INFO_TX_BITRATE);
+ if (!txrate)
+ goto nla_put_failure;
+
+ NLA_PUT_U16(msg, NL80211_STA_INFO_RATE_TOTAL,
+ sinfo->txrate_total);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_MCS)
+ NLA_PUT_U16(msg, NL80211_STA_INFO_RATE_MCS,
+ sinfo->txrate_mcs);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_40_MHZ_WIDTH)
+ NLA_PUT_FLAG(msg, NL80211_STA_INFO_RATE_40_MHZ_WIDTH);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_SHORT_GI)
+ NLA_PUT_FLAG(msg, NL80211_STA_INFO_RATE_SHORT_GI);
+
+ nla_nest_end(msg, txrate);
+ }
nla_nest_end(msg, sinfoattr);
return genlmsg_end(msg, hdr);
[-- Attachment #1.2: nl80211ext_v6.patch --]
[-- Type: text/x-patch, Size: 8777 bytes --]
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 04d4516..e14caa9 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -425,6 +425,30 @@ enum nl80211_sta_flags {
};
/**
+ * enum nl80211_sta_info_rate - station information about bitrate
+ *
+ * These attribute types are used with %NL80211_STA_INFO_TXRATE
+ * when getting information about the bitrate of a station.
+ *
+ * @__NL80211_STA_INFO_RATE_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_INFO_RATE_TOTAL: total bitrate (u16, 100kbit/s)
+ * @NL80211_STA_INFO_RATE_MCS: mcs index for 802.11n (u8)
+ * @NL80211_STA_INFO_RATE_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
+ * @NL80211_STA_INFO_RATE_SHORT_GI: 400ns guard interval
+ */
+enum nl80211_sta_info_rate {
+ __NL80211_STA_INFO_RATE_INVALID,
+ NL80211_STA_INFO_RATE_TOTAL,
+ NL80211_STA_INFO_RATE_MCS,
+ NL80211_STA_INFO_RATE_40_MHZ_WIDTH,
+ NL80211_STA_INFO_RATE_SHORT_GI,
+
+ /* keep last */
+ __NL80211_STA_INFO_RATE_AFTER_LAST,
+ NL80211_STA_INFO_RATE_MAX = __NL80211_STA_INFO_RATE_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_sta_info - station information
*
* These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -436,6 +460,9 @@ 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, nested attribute
+ * containing info as possible, see &enum nl80211_sta_info_txrate.
*/
enum nl80211_sta_info {
__NL80211_STA_INFO_INVALID,
@@ -445,6 +472,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 a0c0bf1..9ebcb11 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -169,6 +169,10 @@ 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_RX_BITRATE: @rx_bitrate filled
+ * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
+ * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
*/
enum station_info_flags {
STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -177,6 +181,25 @@ 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_RX_BITRATE = 1<<7,
+ STATION_INFO_TX_BITRATE = 1<<8,
+};
+
+/**
+ * enum station_info_rate_flags - station transmission rate flags
+ *
+ * Used by the driver to indicate the specific rate transmission
+ * type for 802.11n transmissions.
+ *
+ * @STATION_INFO_BITRATE_MCS: @tx_bitrate_mcs filled
+ * @STATION_INFO_BITRATE_40_MHZ_WIDTH: 40 Mhz width transmission
+ * @STATION_INFO_BITRATE_SHORT_GI: 400ns guard interval
+ */
+enum station_info_rate_flags {
+ STATION_INFO_BITRATE_MCS = 1<<0,
+ STATION_INFO_BITRATE_40_MHZ_WIDTH = 1<<1,
+ STATION_INFO_BITRATE_SHORT_GI = 1<<2,
};
/**
@@ -191,6 +214,11 @@ 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
+ * @txrate_total: current unicast bitrate to this station in 100 kbit/sec
+ * @txrate_flags: bitflag of flags from &enum station_info_bitrate_flags
+ * @txrate_mcs: MCS index of a 802.11n transmission, see
+ * &enum station_info_bitrate_flags
*/
struct station_info {
u32 filled;
@@ -200,6 +228,10 @@ struct station_info {
u16 llid;
u16 plid;
u8 plink_state;
+ u8 signal;
+ u16 txrate_total;
+ u8 txrate_flags;
+ u8 txrate_mcs;
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 7a7a6c1..3567cd9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -304,18 +304,65 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
return 0;
}
+static u16 sta_get_80211n_bitrate(struct ieee80211_tx_rate *rate)
+{
+ int modulation = rate->idx & 7;
+ int streams = rate->idx >> 3;
+
+ int bitrate = (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ? 13500000 : 6500000;
+
+ if (modulation < 4)
+ bitrate *= (modulation + 1);
+ else if (modulation == 4)
+ bitrate *= (modulation + 2);
+ else
+ bitrate *= (modulation + 3);
+
+ bitrate *= streams;
+
+ if (rate->flags & IEEE80211_TX_RC_SHORT_GI)
+ bitrate = (bitrate * 10) / 9;
+
+ return (bitrate + 50000) / 100000; // do NOT just round down
+}
+
static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
{
struct ieee80211_sub_if_data *sdata = sta->sdata;
sinfo->filled = STATION_INFO_INACTIVE_TIME |
STATION_INFO_RX_BYTES |
- STATION_INFO_TX_BYTES;
+ STATION_INFO_TX_BYTES |
+ STATION_INFO_RX_BITRATE |
+ 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;
+ if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
+ sinfo->filled |= STATION_INFO_SIGNAL;
+ sinfo->signal = sta->last_signal;
+ }
+
+ sinfo->txrate_flags = 0;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_MCS;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_40_MHZ_WIDTH;
+ if (sta->last_tx_rate.flags & IEEE80211_TX_RC_SHORT_GI)
+ sinfo->txrate_flags |= STATION_INFO_BITRATE_SHORT_GI;
+
+ if (!(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) {
+ struct ieee80211_supported_band *sband;
+ sband = sta->local->hw.wiphy->bands[sta->local->hw.conf.channel->band];
+ sinfo->txrate_total = sband->bitrates[sta->last_tx_rate.idx].bitrate;
+ }
+ else {
+ sinfo->txrate_total = sta_get_80211n_bitrate(&sta->last_tx_rate);
+ sinfo->txrate_mcs = sta->last_tx_rate.idx;
+ }
+
if (ieee80211_vif_is_mesh(&sdata->vif)) {
#ifdef CONFIG_MAC80211_MESH
sinfo->filled |= STATION_INFO_LLID |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 59f356a..84922b0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -727,8 +727,9 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) {
u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len,
NL80211_IFTYPE_ADHOC);
- if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0)
+ if (compare_ether_addr(bssid, rx->sdata->u.sta.bssid) == 0) {
sta->last_rx = jiffies;
+ }
} else
if (!is_multicast_ether_addr(hdr->addr1) ||
rx->sdata->vif.type == NL80211_IFTYPE_STATION) {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9caee60..197dc4d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -16,6 +16,7 @@
#include <linux/netlink.h>
#include <net/genetlink.h>
#include <net/cfg80211.h>
+#include <net/mac80211.h>
#include "core.h"
#include "nl80211.h"
#include "reg.h"
@@ -1084,7 +1085,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
u8 *mac_addr, struct station_info *sinfo)
{
void *hdr;
- struct nlattr *sinfoattr;
+ struct nlattr *sinfoattr, *txrate;
hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION);
if (!hdr)
@@ -1114,7 +1115,27 @@ 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) {
+ txrate = nla_nest_start(msg, NL80211_STA_INFO_TX_BITRATE);
+ if (!txrate)
+ goto nla_put_failure;
+
+ NLA_PUT_U16(msg, NL80211_STA_INFO_RATE_TOTAL,
+ sinfo->txrate_total);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_MCS)
+ NLA_PUT_U16(msg, NL80211_STA_INFO_RATE_MCS,
+ sinfo->txrate_mcs);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_40_MHZ_WIDTH)
+ NLA_PUT_FLAG(msg, NL80211_STA_INFO_RATE_40_MHZ_WIDTH);
+ if (sinfo->txrate_flags & STATION_INFO_BITRATE_SHORT_GI)
+ NLA_PUT_FLAG(msg, NL80211_STA_INFO_RATE_SHORT_GI);
+
+ nla_nest_end(msg, txrate);
+ }
nla_nest_end(msg, sinfoattr);
return genlmsg_end(msg, hdr);
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-12-06 14:44 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
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 [this message]
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=200812061544.02312.hrogge@googlemail.com \
--to=hrogge@googlemail.com \
--cc=Luis.Rodriguez@atheros.com \
--cc=holtmann@linux.intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=lrodriguez@atheros.com \
--cc=nbd@openwrt.org \
--cc=rogge@fgan.de \
/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).