diff options
-rw-r--r-- | include/linux/nl80211.h | 35 | ||||
-rw-r--r-- | include/net/cfg80211.h | 34 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 13 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 21 |
4 files changed, 100 insertions, 3 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 30022189104d..16eea7229e99 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -1222,6 +1222,36 @@ enum nl80211_rate_info { | |||
1222 | }; | 1222 | }; |
1223 | 1223 | ||
1224 | /** | 1224 | /** |
1225 | * enum nl80211_sta_bss_param - BSS information collected by STA | ||
1226 | * | ||
1227 | * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM | ||
1228 | * when getting information about the bitrate of a station. | ||
1229 | * | ||
1230 | * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved | ||
1231 | * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag) | ||
1232 | * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled | ||
1233 | * (flag) | ||
1234 | * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled | ||
1235 | * (flag) | ||
1236 | * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8) | ||
1237 | * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16) | ||
1238 | * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined | ||
1239 | * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use | ||
1240 | */ | ||
1241 | enum nl80211_sta_bss_param { | ||
1242 | __NL80211_STA_BSS_PARAM_INVALID, | ||
1243 | NL80211_STA_BSS_PARAM_CTS_PROT, | ||
1244 | NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, | ||
1245 | NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, | ||
1246 | NL80211_STA_BSS_PARAM_DTIM_PERIOD, | ||
1247 | NL80211_STA_BSS_PARAM_BEACON_INTERVAL, | ||
1248 | |||
1249 | /* keep last */ | ||
1250 | __NL80211_STA_BSS_PARAM_AFTER_LAST, | ||
1251 | NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 | ||
1252 | }; | ||
1253 | |||
1254 | /** | ||
1225 | * enum nl80211_sta_info - station information | 1255 | * enum nl80211_sta_info - station information |
1226 | * | 1256 | * |
1227 | * These attribute types are used with %NL80211_ATTR_STA_INFO | 1257 | * These attribute types are used with %NL80211_ATTR_STA_INFO |
@@ -1233,7 +1263,7 @@ enum nl80211_rate_info { | |||
1233 | * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) | 1263 | * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) |
1234 | * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) | 1264 | * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) |
1235 | * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute | 1265 | * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute |
1236 | * containing info as possible, see &enum nl80211_sta_info_txrate. | 1266 | * containing info as possible, see &enum nl80211_rate_info |
1237 | * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) | 1267 | * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) |
1238 | * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this | 1268 | * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this |
1239 | * station) | 1269 | * station) |
@@ -1245,6 +1275,8 @@ enum nl80211_rate_info { | |||
1245 | * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station | 1275 | * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station |
1246 | * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested | 1276 | * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested |
1247 | * attribute, like NL80211_STA_INFO_TX_BITRATE. | 1277 | * attribute, like NL80211_STA_INFO_TX_BITRATE. |
1278 | * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute | ||
1279 | * containing info as possible, see &enum nl80211_sta_bss_param | ||
1248 | * @__NL80211_STA_INFO_AFTER_LAST: internal | 1280 | * @__NL80211_STA_INFO_AFTER_LAST: internal |
1249 | * @NL80211_STA_INFO_MAX: highest possible station info attribute | 1281 | * @NL80211_STA_INFO_MAX: highest possible station info attribute |
1250 | */ | 1282 | */ |
@@ -1264,6 +1296,7 @@ enum nl80211_sta_info { | |||
1264 | NL80211_STA_INFO_TX_FAILED, | 1296 | NL80211_STA_INFO_TX_FAILED, |
1265 | NL80211_STA_INFO_SIGNAL_AVG, | 1297 | NL80211_STA_INFO_SIGNAL_AVG, |
1266 | NL80211_STA_INFO_RX_BITRATE, | 1298 | NL80211_STA_INFO_RX_BITRATE, |
1299 | NL80211_STA_INFO_BSS_PARAM, | ||
1267 | 1300 | ||
1268 | /* keep last */ | 1301 | /* keep last */ |
1269 | __NL80211_STA_INFO_AFTER_LAST, | 1302 | __NL80211_STA_INFO_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2c4530451721..ba7384acf4e0 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -422,6 +422,7 @@ struct station_parameters { | |||
422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | 422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled |
423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled | 423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled |
424 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled | 424 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled |
425 | * @STATION_INFO_BSS_PARAM: @bss_param filled | ||
425 | */ | 426 | */ |
426 | enum station_info_flags { | 427 | enum station_info_flags { |
427 | STATION_INFO_INACTIVE_TIME = 1<<0, | 428 | STATION_INFO_INACTIVE_TIME = 1<<0, |
@@ -439,6 +440,7 @@ enum station_info_flags { | |||
439 | STATION_INFO_RX_DROP_MISC = 1<<12, | 440 | STATION_INFO_RX_DROP_MISC = 1<<12, |
440 | STATION_INFO_SIGNAL_AVG = 1<<13, | 441 | STATION_INFO_SIGNAL_AVG = 1<<13, |
441 | STATION_INFO_RX_BITRATE = 1<<14, | 442 | STATION_INFO_RX_BITRATE = 1<<14, |
443 | STATION_INFO_BSS_PARAM = 1<<15, | ||
442 | }; | 444 | }; |
443 | 445 | ||
444 | /** | 446 | /** |
@@ -473,6 +475,37 @@ struct rate_info { | |||
473 | }; | 475 | }; |
474 | 476 | ||
475 | /** | 477 | /** |
478 | * enum station_info_rate_flags - bitrate info flags | ||
479 | * | ||
480 | * Used by the driver to indicate the specific rate transmission | ||
481 | * type for 802.11n transmissions. | ||
482 | * | ||
483 | * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled | ||
484 | * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled | ||
485 | * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled | ||
486 | */ | ||
487 | enum bss_param_flags { | ||
488 | BSS_PARAM_FLAGS_CTS_PROT = 1<<0, | ||
489 | BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, | ||
490 | BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, | ||
491 | }; | ||
492 | |||
493 | /** | ||
494 | * struct sta_bss_parameters - BSS parameters for the attached station | ||
495 | * | ||
496 | * Information about the currently associated BSS | ||
497 | * | ||
498 | * @flags: bitflag of flags from &enum bss_param_flags | ||
499 | * @dtim_period: DTIM period for the BSS | ||
500 | * @beacon_interval: beacon interval | ||
501 | */ | ||
502 | struct sta_bss_parameters { | ||
503 | u8 flags; | ||
504 | u8 dtim_period; | ||
505 | u16 beacon_interval; | ||
506 | }; | ||
507 | |||
508 | /** | ||
476 | * struct station_info - station information | 509 | * struct station_info - station information |
477 | * | 510 | * |
478 | * Station information filled by driver for get_station() and dump_station. | 511 | * Station information filled by driver for get_station() and dump_station. |
@@ -515,6 +548,7 @@ struct station_info { | |||
515 | u32 tx_retries; | 548 | u32 tx_retries; |
516 | u32 tx_failed; | 549 | u32 tx_failed; |
517 | u32 rx_dropped_misc; | 550 | u32 rx_dropped_misc; |
551 | struct sta_bss_parameters bss_param; | ||
518 | 552 | ||
519 | int generation; | 553 | int generation; |
520 | }; | 554 | }; |
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); |