aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2017-04-26 03:58:47 -0400
committerJohannes Berg <johannes.berg@intel.com>2017-04-28 06:28:45 -0400
commite38a017bf080d47376db340e94b9c2ffc47eb9b4 (patch)
tree7e017a6ec85701cb8e32a16097c981b86c68b6ab
parent29ce6ecbb83c9185d76e3a7c340c9702d2a54961 (diff)
mac80211: Add support for BSS max idle period element
Parse the BSS max idle period element and set the BSS configuration accordingly so the driver can use this information to configure the max idle period and to use protected management frames for keep alive when required. The BSS max idle period element is defined in IEEE802.11-2016, section 9.4.2.79 Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/linux/ieee80211.h28
-rw-r--r--include/net/mac80211.h14
-rw-r--r--net/mac80211/ieee80211_i.h1
-rw-r--r--net/mac80211/mlme.c14
-rw-r--r--net/mac80211/util.c9
5 files changed, 63 insertions, 3 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 639e77abf064..69033353d0d1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -7,7 +7,7 @@
7 * Copyright (c) 2005, Devicescape Software, Inc. 7 * Copyright (c) 2005, Devicescape Software, Inc.
8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> 8 * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH 9 * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright (c) 2016 Intel Deutschland GmbH 10 * Copyright (c) 2016 - 2017 Intel Deutschland GmbH
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
@@ -2316,6 +2316,32 @@ struct ieee80211_timeout_interval_ie {
2316 __le32 value; 2316 __le32 value;
2317} __packed; 2317} __packed;
2318 2318
2319/**
2320 * enum ieee80211_idle_options - BSS idle options
2321 * @WLAN_IDLE_OPTIONS_PROTECTED_KEEP_ALIVE: the station should send an RSN
2322 * protected frame to the AP to reset the idle timer at the AP for
2323 * the station.
2324 */
2325enum ieee80211_idle_options {
2326 WLAN_IDLE_OPTIONS_PROTECTED_KEEP_ALIVE = BIT(0),
2327};
2328
2329/**
2330 * struct ieee80211_bss_max_idle_period_ie
2331 *
2332 * This structure refers to "BSS Max idle period element"
2333 *
2334 * @max_idle_period: indicates the time period during which a station can
2335 * refrain from transmitting frames to its associated AP without being
2336 * disassociated. In units of 1000 TUs.
2337 * @idle_options: indicates the options associated with the BSS idle capability
2338 * as specified in &enum ieee80211_idle_options.
2339 */
2340struct ieee80211_bss_max_idle_period_ie {
2341 __le16 max_idle_period;
2342 u8 idle_options;
2343} __packed;
2344
2319/* BACK action code */ 2345/* BACK action code */
2320enum ieee80211_back_actioncode { 2346enum ieee80211_back_actioncode {
2321 WLAN_ACTION_ADDBA_REQ = 0, 2347 WLAN_ACTION_ADDBA_REQ = 0,
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 807ee6cd903f..4d05a9443344 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -5,7 +5,7 @@
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH 7 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2015 - 2016 Intel Deutschland GmbH 8 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -299,6 +299,8 @@ struct ieee80211_vif_chanctx_switch {
299 * context had been assigned. 299 * context had been assigned.
300 * @BSS_CHANGED_OCB: OCB join status changed 300 * @BSS_CHANGED_OCB: OCB join status changed
301 * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed 301 * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
302 * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
303 * keep alive) changed.
302 */ 304 */
303enum ieee80211_bss_change { 305enum ieee80211_bss_change {
304 BSS_CHANGED_ASSOC = 1<<0, 306 BSS_CHANGED_ASSOC = 1<<0,
@@ -325,6 +327,7 @@ enum ieee80211_bss_change {
325 BSS_CHANGED_BANDWIDTH = 1<<21, 327 BSS_CHANGED_BANDWIDTH = 1<<21,
326 BSS_CHANGED_OCB = 1<<22, 328 BSS_CHANGED_OCB = 1<<22,
327 BSS_CHANGED_MU_GROUPS = 1<<23, 329 BSS_CHANGED_MU_GROUPS = 1<<23,
330 BSS_CHANGED_KEEP_ALIVE = 1<<24,
328 331
329 /* when adding here, make sure to change ieee80211_reconfig */ 332 /* when adding here, make sure to change ieee80211_reconfig */
330}; 333};
@@ -533,6 +536,13 @@ struct ieee80211_mu_group_data {
533 * @allow_p2p_go_ps: indication for AP or P2P GO interface, whether it's allowed 536 * @allow_p2p_go_ps: indication for AP or P2P GO interface, whether it's allowed
534 * to use P2P PS mechanism or not. AP/P2P GO is not allowed to use P2P PS 537 * to use P2P PS mechanism or not. AP/P2P GO is not allowed to use P2P PS
535 * if it has associated clients without P2P PS support. 538 * if it has associated clients without P2P PS support.
539 * @max_idle_period: the time period during which the station can refrain from
540 * transmitting frames to its associated AP without being disassociated.
541 * In units of 1000 TUs. Zero value indicates that the AP did not include
542 * a (valid) BSS Max Idle Period Element.
543 * @protected_keep_alive: if set, indicates that the station should send an RSN
544 * protected frame to the AP to reset the idle timer at the AP for the
545 * station.
536 */ 546 */
537struct ieee80211_bss_conf { 547struct ieee80211_bss_conf {
538 const u8 *bssid; 548 const u8 *bssid;
@@ -573,6 +583,8 @@ struct ieee80211_bss_conf {
573 enum nl80211_tx_power_setting txpower_type; 583 enum nl80211_tx_power_setting txpower_type;
574 struct ieee80211_p2p_noa_attr p2p_noa_attr; 584 struct ieee80211_p2p_noa_attr p2p_noa_attr;
575 bool allow_p2p_go_ps; 585 bool allow_p2p_go_ps;
586 u16 max_idle_period;
587 bool protected_keep_alive;
576}; 588};
577 589
578/** 590/**
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2a5730573aa3..f8f6c148f554 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1483,6 +1483,7 @@ struct ieee802_11_elems {
1483 const u8 *opmode_notif; 1483 const u8 *opmode_notif;
1484 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 1484 const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
1485 const struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie; 1485 const struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
1486 const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie;
1486 1487
1487 /* length of them, respectively */ 1488 /* length of them, respectively */
1488 u8 ext_capab_len; 1489 u8 ext_capab_len;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 45d80fe61c5f..89dff563b1ec 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -6,7 +6,7 @@
6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 6 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2013-2014 Intel Mobile Communications GmbH 8 * Copyright 2013-2014 Intel Mobile Communications GmbH
9 * Copyright (C) 2015 - 2016 Intel Deutschland GmbH 9 * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -3098,6 +3098,18 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
3098 } 3098 }
3099 changed |= BSS_CHANGED_QOS; 3099 changed |= BSS_CHANGED_QOS;
3100 3100
3101 if (elems.max_idle_period_ie) {
3102 bss_conf->max_idle_period =
3103 le16_to_cpu(elems.max_idle_period_ie->max_idle_period);
3104 bss_conf->protected_keep_alive =
3105 !!(elems.max_idle_period_ie->idle_options &
3106 WLAN_IDLE_OPTIONS_PROTECTED_KEEP_ALIVE);
3107 changed |= BSS_CHANGED_KEEP_ALIVE;
3108 } else {
3109 bss_conf->max_idle_period = 0;
3110 bss_conf->protected_keep_alive = false;
3111 }
3112
3101 /* set AID and assoc capability, 3113 /* set AID and assoc capability,
3102 * ieee80211_set_associated() will tell the driver */ 3114 * ieee80211_set_associated() will tell the driver */
3103 bss_conf->aid = aid; 3115 bss_conf->aid = aid;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 4a5414481b78..bfc28053639b 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -828,6 +828,7 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
828 case WLAN_EID_EXT_CAPABILITY: 828 case WLAN_EID_EXT_CAPABILITY:
829 case WLAN_EID_CHAN_SWITCH_TIMING: 829 case WLAN_EID_CHAN_SWITCH_TIMING:
830 case WLAN_EID_LINK_ID: 830 case WLAN_EID_LINK_ID:
831 case WLAN_EID_BSS_MAX_IDLE_PERIOD:
831 /* 832 /*
832 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible 833 * not listing WLAN_EID_CHANNEL_SWITCH_WRAPPER -- it seems possible
833 * that if the content gets bigger it might be needed more than once 834 * that if the content gets bigger it might be needed more than once
@@ -1089,6 +1090,10 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
1089 else 1090 else
1090 elem_parse_failed = true; 1091 elem_parse_failed = true;
1091 break; 1092 break;
1093 case WLAN_EID_BSS_MAX_IDLE_PERIOD:
1094 if (elen >= sizeof(*elems->max_idle_period_ie))
1095 elems->max_idle_period_ie = (void *)pos;
1096 break;
1092 default: 1097 default:
1093 break; 1098 break;
1094 } 1099 }
@@ -1983,6 +1988,10 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1983 if (sdata->u.mgd.have_beacon) 1988 if (sdata->u.mgd.have_beacon)
1984 changed |= BSS_CHANGED_BEACON_INFO; 1989 changed |= BSS_CHANGED_BEACON_INFO;
1985 1990
1991 if (sdata->vif.bss_conf.max_idle_period ||
1992 sdata->vif.bss_conf.protected_keep_alive)
1993 changed |= BSS_CHANGED_KEEP_ALIVE;
1994
1986 sdata_lock(sdata); 1995 sdata_lock(sdata);
1987 ieee80211_bss_info_change_notify(sdata, changed); 1996 ieee80211_bss_info_change_notify(sdata, changed);
1988 sdata_unlock(sdata); 1997 sdata_unlock(sdata);