History

{cfg,nl}80211: mesh power mode primitives and userspace access

Add the nl80211_mesh_power_mode enumeration which holds possible values for the mesh power mode. These modes are unknown, active, light sleep and deep sleep. Add power_mode entry to the mesh config structure to hold the user-configured default mesh power mode. This value will be used for new peer links. Add the dot11MeshAwakeWindowDuration value to the mesh config. The awake window is a duration in TU describing how long the STA will stay awake after transmitting its beacon in PS mode. Add access routines to: - get/set local link-specific power mode (STA) - get remote STA's link-specific power mode (STA) - get remote STA's non-peer power mode (STA) - get/set default mesh power mode (mesh config) - get/set mesh awake window duration (mesh config) All config changes may be done at mesh runtime and take effect immediately.

Marco Porsch committed 13 years ago

Commit 3b1c5a51 parent 9bdbf044 files · +113 −1Browse files

Unified · Split

4 files
  1. include/net/cfg80211.h +21 −0
  2. include/uapi/linux/nl80211.h +47 −0
  3. net/wireless/mesh.c +3 −0
  4. net/wireless/nl80211.c +42 −1
include/net/cfg80211.h+21−0
@@ -610,6 +610,8 @@ enum station_parameters_apply_mask { · 609 unmodified lines
610610 * @sta_modify_mask: bitmap indicating which parameters changed
611611 * (for those that don't have a natural "no change" value),
612612 * see &enum station_parameters_apply_mask
613+ * @local_pm: local link-specific mesh power save mode (no change when set
614+ * to unknown)
613615 */
614616 struct station_parameters {
615617 u8 *supported_rates;
@@ -625,6 +627,7 @@ struct station_parameters { · 9 unmodified lines
625627 struct ieee80211_vht_cap *vht_capa;
626628 u8 uapsd_queues;
627629 u8 max_sp;
630+ enum nl80211_mesh_power_mode local_pm;
628631 };
629632
630633 /**
@@ -655,6 +658,9 @@ struct station_parameters { · 24 unmodified lines
655658 * @STATION_INFO_STA_FLAGS: @sta_flags filled
656659 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
657660 * @STATION_INFO_T_OFFSET: @t_offset filled
661+ * @STATION_INFO_LOCAL_PM: @local_pm filled
662+ * @STATION_INFO_PEER_PM: @peer_pm filled
663+ * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
658664 */
659665 enum station_info_flags {
660666 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -678,6 +684,9 @@ enum station_info_flags { · 17 unmodified lines
678684 STATION_INFO_STA_FLAGS = 1<<18,
679685 STATION_INFO_BEACON_LOSS_COUNT = 1<<19,
680686 STATION_INFO_T_OFFSET = 1<<20,
687+ STATION_INFO_LOCAL_PM = 1<<21,
688+ STATION_INFO_PEER_PM = 1<<22,
689+ STATION_INFO_NONPEER_PM = 1<<23,
681690 };
682691
683692 /**
@@ -791,6 +800,9 @@ struct sta_bss_parameters { · 107 unmodified lines
791800 * @sta_flags: station flags mask & values
792801 * @beacon_loss_count: Number of times beacon loss event has triggered.
793802 * @t_offset: Time offset of the station relative to this host.
803+ * @local_pm: local mesh STA power save mode
804+ * @peer_pm: peer mesh STA power save mode
805+ * @nonpeer_pm: non-peer mesh STA power save mode
794806 */
795807 struct station_info {
796808 u32 filled;
@@ -820,6 +832,9 @@ struct station_info { · 23 unmodified lines
820832
821833 u32 beacon_loss_count;
822834 s64 t_offset;
835+ enum nl80211_mesh_power_mode local_pm;
836+ enum nl80211_mesh_power_mode peer_pm;
837+ enum nl80211_mesh_power_mode nonpeer_pm;
823838
824839 /*
825840 * Note: Add a new enum station_info_flags value for each new field and
@@ -995,6 +1010,10 @@ struct bss_parameters { · 169 unmodified lines
9951010 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
9961011 * during which a mesh STA can send only one Action frame containing
9971012 * a PREQ element for root path confirmation.
1013+ * @power_mode: The default mesh power save mode which will be the initial
1014+ * setting for new peer links.
1015+ * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1016+ * after transmitting its beacon.
9981017 */
9991018 struct mesh_config {
10001019 u16 dot11MeshRetryTimeout;
@@ -1022,6 +1041,8 @@ struct mesh_config { · 21 unmodified lines
10221041 u32 dot11MeshHWMPactivePathToRootTimeout;
10231042 u16 dot11MeshHWMProotInterval;
10241043 u16 dot11MeshHWMPconfirmationInterval;
1044+ enum nl80211_mesh_power_mode power_mode;
1045+ u16 dot11MeshAwakeWindowDuration;
10251046 };
10261047
10271048 /**
include/uapi/linux/nl80211.h+47−0
@@ -1310,6 +1310,9 @@ enum nl80211_commands { · 1309 unmodified lines
13101310 * if not given in START_AP 0 is assumed, if not given in SET_BSS
13111311 * no change is made.
13121312 *
1313+ * @NL80211_ATTR_LOCAL_MESH_POWER_MODE: local mesh STA link-specific power mode
1314+ * defined in &enum nl80211_mesh_power_mode.
1315+ *
13131316 * @NL80211_ATTR_MAX: highest attribute number currently defined
13141317 * @__NL80211_ATTR_AFTER_LAST: internal use
13151318 */
@@ -1580,6 +1583,8 @@ enum nl80211_attrs { · 264 unmodified lines
15801583 NL80211_ATTR_P2P_CTWINDOW,
15811584 NL80211_ATTR_P2P_OPPPS,
15821585
1586+ NL80211_ATTR_LOCAL_MESH_POWER_MODE,
1587+
15831588 /* add attributes here, update the policy in nl80211.c */
15841589
15851590 __NL80211_ATTR_AFTER_LAST,
@@ -1838,6 +1843,10 @@ enum nl80211_sta_bss_param { · 252 unmodified lines
18381843 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
18391844 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
18401845 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
1846+ * @NL80211_STA_INFO_LOCAL_PM: local mesh STA link-specific power mode
1847+ * @NL80211_STA_INFO_PEER_PM: peer mesh STA link-specific power mode
1848+ * @NL80211_STA_INFO_NONPEER_PM: neighbor mesh STA power save mode towards
1849+ * non-peer STA
18411850 * @__NL80211_STA_INFO_AFTER_LAST: internal
18421851 * @NL80211_STA_INFO_MAX: highest possible station info attribute
18431852 */
@@ -1862,6 +1871,9 @@ enum nl80211_sta_info { · 18 unmodified lines
18621871 NL80211_STA_INFO_STA_FLAGS,
18631872 NL80211_STA_INFO_BEACON_LOSS,
18641873 NL80211_STA_INFO_T_OFFSET,
1874+ NL80211_STA_INFO_LOCAL_PM,
1875+ NL80211_STA_INFO_PEER_PM,
1876+ NL80211_STA_INFO_NONPEER_PM,
18651877
18661878 /* keep last */
18671879 __NL80211_STA_INFO_AFTER_LAST,
@@ -2252,6 +2264,34 @@ enum nl80211_mntr_flags { · 384 unmodified lines
22522264 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
22532265 };
22542266
2267+/**
2268+ * enum nl80211_mesh_power_mode - mesh power save modes
2269+ *
2270+ * @NL80211_MESH_POWER_UNKNOWN: The mesh power mode of the mesh STA is
2271+ * not known or has not been set yet.
2272+ * @NL80211_MESH_POWER_ACTIVE: Active mesh power mode. The mesh STA is
2273+ * in Awake state all the time.
2274+ * @NL80211_MESH_POWER_LIGHT_SLEEP: Light sleep mode. The mesh STA will
2275+ * alternate between Active and Doze states, but will wake up for
2276+ * neighbor's beacons.
2277+ * @NL80211_MESH_POWER_DEEP_SLEEP: Deep sleep mode. The mesh STA will
2278+ * alternate between Active and Doze states, but may not wake up
2279+ * for neighbor's beacons.
2280+ *
2281+ * @__NL80211_MESH_POWER_AFTER_LAST - internal use
2282+ * @NL80211_MESH_POWER_MAX - highest possible power save level
2283+ */
2284+
2285+enum nl80211_mesh_power_mode {
2286+ NL80211_MESH_POWER_UNKNOWN,
2287+ NL80211_MESH_POWER_ACTIVE,
2288+ NL80211_MESH_POWER_LIGHT_SLEEP,
2289+ NL80211_MESH_POWER_DEEP_SLEEP,
2290+
2291+ __NL80211_MESH_POWER_AFTER_LAST,
2292+ NL80211_MESH_POWER_MAX = __NL80211_MESH_POWER_AFTER_LAST - 1
2293+};
2294+
22552295 /**
22562296 * enum nl80211_meshconf_params - mesh configuration parameters
22572297 *
@@ -2346,6 +2386,11 @@ enum nl80211_mntr_flags { · 88 unmodified lines
23462386 * (in TUs) during which a mesh STA can send only one Action frame
23472387 * containing a PREQ element for root path confirmation.
23482388 *
2389+ * @NL80211_MESHCONF_POWER_MODE: Default mesh power mode for new peer links.
2390+ * type &enum nl80211_mesh_power_mode (u32)
2391+ *
2392+ * @NL80211_MESHCONF_AWAKE_WINDOW: awake window duration (in TUs)
2393+ *
23492394 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
23502395 */
23512396 enum nl80211_meshconf_params {
@@ -2375,6 +2420,8 @@ enum nl80211_meshconf_params { · 23 unmodified lines
23752420 NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT,
23762421 NL80211_MESHCONF_HWMP_ROOT_INTERVAL,
23772422 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
2423+ NL80211_MESHCONF_POWER_MODE,
2424+ NL80211_MESHCONF_AWAKE_WINDOW,
23782425
23792426 /* keep last */
23802427 __NL80211_MESHCONF_ATTR_AFTER_LAST,
net/wireless/mesh.c+3−0
@@ -46,6 +46,7 @@ · 45 unmodified lines
4646
4747 #define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units (=TUs) */
4848 #define MESH_DEFAULT_DTIM_PERIOD 2
49+#define MESH_DEFAULT_AWAKE_WINDOW 10 /* in 1024 us units (=TUs) */
4950
5051 const struct mesh_config default_mesh_config = {
5152 .dot11MeshRetryTimeout = MESH_RET_T,
@@ -72,6 +73,8 @@ const struct mesh_config default_mesh_config = { · 20 unmodified lines
7273 .dot11MeshHWMPactivePathToRootTimeout = MESH_PATH_TO_ROOT_TIMEOUT,
7374 .dot11MeshHWMProotInterval = MESH_ROOT_INTERVAL,
7475 .dot11MeshHWMPconfirmationInterval = MESH_ROOT_CONFIRMATION_INTERVAL,
76+ .power_mode = NL80211_MESH_POWER_ACTIVE,
77+ .dot11MeshAwakeWindowDuration = MESH_DEFAULT_AWAKE_WINDOW,
7578 };
7679
7780 const struct mesh_setup default_mesh_setup = {
net/wireless/nl80211.c+42−1
@@ -3001,6 +3001,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, · 3000 unmodified lines
30013001 nla_put_u32(msg, NL80211_STA_INFO_BEACON_LOSS,
30023002 sinfo->beacon_loss_count))
30033003 goto nla_put_failure;
3004+ if ((sinfo->filled & STATION_INFO_LOCAL_PM) &&
3005+ nla_put_u32(msg, NL80211_STA_INFO_LOCAL_PM,
3006+ sinfo->local_pm))
3007+ goto nla_put_failure;
3008+ if ((sinfo->filled & STATION_INFO_PEER_PM) &&
3009+ nla_put_u32(msg, NL80211_STA_INFO_PEER_PM,
3010+ sinfo->peer_pm))
3011+ goto nla_put_failure;
3012+ if ((sinfo->filled & STATION_INFO_NONPEER_PM) &&
3013+ nla_put_u32(msg, NL80211_STA_INFO_NONPEER_PM,
3014+ sinfo->nonpeer_pm))
3015+ goto nla_put_failure;
30043016 if (sinfo->filled & STATION_INFO_BSS_PARAM) {
30053017 bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM);
30063018 if (!bss_param)
@@ -3206,6 +3218,17 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 199 unmodified lines
32063218 params.plink_state =
32073219 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]);
32083220
3221+ if (info->attrs[NL80211_ATTR_LOCAL_MESH_POWER_MODE]) {
3222+ enum nl80211_mesh_power_mode pm = nla_get_u32(
3223+ info->attrs[NL80211_ATTR_LOCAL_MESH_POWER_MODE]);
3224+
3225+ if (pm <= NL80211_MESH_POWER_UNKNOWN ||
3226+ pm > NL80211_MESH_POWER_MAX)
3227+ return -EINVAL;
3228+
3229+ params.local_pm = pm;
3230+ }
3231+
32093232 switch (dev->ieee80211_ptr->iftype) {
32103233 case NL80211_IFTYPE_AP:
32113234 case NL80211_IFTYPE_AP_VLAN:
@@ -3213,6 +3236,8 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 1 unmodified line
32133236 /* disallow mesh-specific things */
32143237 if (params.plink_action)
32153238 return -EINVAL;
3239+ if (params.local_pm)
3240+ return -EINVAL;
32163241
32173242 /* TDLS can't be set, ... */
32183243 if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
@@ -3265,6 +3290,8 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) · 46 unmodified lines
32653290 /* disallow things sta doesn't support */
32663291 if (params.plink_action)
32673292 return -EINVAL;
3293+ if (params.local_pm)
3294+ return -EINVAL;
32683295 /* reject any changes other than AUTHORIZED */
32693296 if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED))
32703297 return -EINVAL;
@@ -3922,7 +3949,11 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, · 651 unmodified lines
39223949 nla_put_u16(msg, NL80211_MESHCONF_HWMP_ROOT_INTERVAL,
39233950 cur_params.dot11MeshHWMProotInterval) ||
39243951 nla_put_u16(msg, NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
3925− cur_params.dot11MeshHWMPconfirmationInterval))
3952+ cur_params.dot11MeshHWMPconfirmationInterval) ||
3953+ nla_put_u32(msg, NL80211_MESHCONF_POWER_MODE,
3954+ cur_params.power_mode) ||
3955+ nla_put_u16(msg, NL80211_MESHCONF_AWAKE_WINDOW,
3956+ cur_params.dot11MeshAwakeWindowDuration))
39263957 goto nla_put_failure;
39273958 nla_nest_end(msg, pinfoattr);
39283959 genlmsg_end(msg, hdr);
@@ -3961,6 +3992,8 @@ static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_A · 32 unmodified lines
39613992 [NL80211_MESHCONF_HWMP_PATH_TO_ROOT_TIMEOUT] = { .type = NLA_U32 },
39623993 [NL80211_MESHCONF_HWMP_ROOT_INTERVAL] = { .type = NLA_U16 },
39633994 [NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL] = { .type = NLA_U16 },
3995+ [NL80211_MESHCONF_POWER_MODE] = { .type = NLA_U32 },
3996+ [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 },
39643997 };
39653998
39663999 static const struct nla_policy
@@ -4088,6 +4121,14 @@ do { \ · 121 unmodified lines
40884121 1, 65535, mask,
40894122 NL80211_MESHCONF_HWMP_CONFIRMATION_INTERVAL,
40904123 nla_get_u16);
4124+ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, power_mode,
4125+ NL80211_MESH_POWER_ACTIVE,
4126+ NL80211_MESH_POWER_MAX,
4127+ mask, NL80211_MESHCONF_POWER_MODE,
4128+ nla_get_u32);
4129+ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshAwakeWindowDuration,
4130+ 0, 65535, mask,
4131+ NL80211_MESHCONF_AWAKE_WINDOW, nla_get_u16);
40914132 if (mask_out)
40924133 *mask_out = mask;
40934134

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t