diff options
author | Paul Stewart <pstew@chromium.org> | 2011-03-31 12:25:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-07 15:34:12 -0400 |
commit | f4263c9857e6411ef2388868cc6c79a1602a654e (patch) | |
tree | 2eec220076c4d56a2460e185076cda6646ef2f9f /net | |
parent | 8447c163afeaa7e9f6f015088177b1c8511e0877 (diff) |
nl80211: Add BSS parameters to station
This allows user-space monitoring of BSS parameters for the associated
station. This is useful for debugging and verifying that the paramaters
are as expected.
[Exactly the same as before but bundled into a single message]
Signed-off-by: Paul Stewart <pstew@chromium.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 13 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 21 |
2 files changed, 32 insertions, 2 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 334213571ad0..bf5d28da46e6 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -342,7 +342,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
342 | STATION_INFO_TX_FAILED | | 342 | STATION_INFO_TX_FAILED | |
343 | STATION_INFO_TX_BITRATE | | 343 | STATION_INFO_TX_BITRATE | |
344 | STATION_INFO_RX_BITRATE | | 344 | STATION_INFO_RX_BITRATE | |
345 | STATION_INFO_RX_DROP_MISC; | 345 | STATION_INFO_RX_DROP_MISC | |
346 | STATION_INFO_BSS_PARAM; | ||
346 | 347 | ||
347 | sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); | 348 | sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); |
348 | sinfo->rx_bytes = sta->rx_bytes; | 349 | sinfo->rx_bytes = sta->rx_bytes; |
@@ -389,6 +390,16 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
389 | sinfo->plink_state = sta->plink_state; | 390 | sinfo->plink_state = sta->plink_state; |
390 | #endif | 391 | #endif |
391 | } | 392 | } |
393 | |||
394 | sinfo->bss_param.flags = 0; | ||
395 | if (sdata->vif.bss_conf.use_cts_prot) | ||
396 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT; | ||
397 | if (sdata->vif.bss_conf.use_short_preamble) | ||
398 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; | ||
399 | if (sdata->vif.bss_conf.use_short_slot) | ||
400 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; | ||
401 | sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period; | ||
402 | sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; | ||
392 | } | 403 | } |
393 | 404 | ||
394 | 405 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 40c90fb461c4..297d7ce4117b 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2002,7 +2002,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2002 | const u8 *mac_addr, struct station_info *sinfo) | 2002 | const u8 *mac_addr, struct station_info *sinfo) |
2003 | { | 2003 | { |
2004 | void *hdr; | 2004 | void *hdr; |
2005 | struct nlattr *sinfoattr; | 2005 | struct nlattr *sinfoattr, *bss_param; |
2006 | 2006 | ||
2007 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); | 2007 | hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); |
2008 | if (!hdr) | 2008 | if (!hdr) |
@@ -2062,6 +2062,25 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
2062 | if (sinfo->filled & STATION_INFO_TX_FAILED) | 2062 | if (sinfo->filled & STATION_INFO_TX_FAILED) |
2063 | NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, | 2063 | NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, |
2064 | sinfo->tx_failed); | 2064 | sinfo->tx_failed); |
2065 | if (sinfo->filled & STATION_INFO_BSS_PARAM) { | ||
2066 | bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); | ||
2067 | if (!bss_param) | ||
2068 | goto nla_put_failure; | ||
2069 | |||
2070 | if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_CTS_PROT) | ||
2071 | NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_CTS_PROT); | ||
2072 | if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_PREAMBLE) | ||
2073 | NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE); | ||
2074 | if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_SLOT_TIME) | ||
2075 | NLA_PUT_FLAG(msg, | ||
2076 | NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME); | ||
2077 | NLA_PUT_U8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, | ||
2078 | sinfo->bss_param.dtim_period); | ||
2079 | NLA_PUT_U16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, | ||
2080 | sinfo->bss_param.beacon_interval); | ||
2081 | |||
2082 | nla_nest_end(msg, bss_param); | ||
2083 | } | ||
2065 | nla_nest_end(msg, sinfoattr); | 2084 | nla_nest_end(msg, sinfoattr); |
2066 | 2085 | ||
2067 | return genlmsg_end(msg, hdr); | 2086 | return genlmsg_end(msg, hdr); |