Skip to content

Commit 18998c3

Browse files
elpjmberg-intel
authored andcommitted
cfg80211: allow requesting SMPS mode on ap start
Add feature bits to indicate device support for static-smps and dynamic-smps modes. Add a new NL80211_ATTR_SMPS_MODE attribue to allow configuring the smps mode to be used by the ap (e.g. configuring to ap to dynamic smps mode will reduce power consumption while having minor effect on throughput) Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 59cd85c commit 18998c3

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

include/net/cfg80211.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ struct cfg80211_acl_data {
664664
* @crypto: crypto settings
665665
* @privacy: the BSS uses privacy
666666
* @auth_type: Authentication type (algorithm)
667+
* @smps_mode: SMPS mode
667668
* @inactivity_timeout: time in seconds to determine station's inactivity.
668669
* @p2p_ctwindow: P2P CT Window
669670
* @p2p_opp_ps: P2P opportunistic PS
@@ -682,6 +683,7 @@ struct cfg80211_ap_settings {
682683
struct cfg80211_crypto_settings crypto;
683684
bool privacy;
684685
enum nl80211_auth_type auth_type;
686+
enum nl80211_smps_mode smps_mode;
685687
int inactivity_timeout;
686688
u8 p2p_ctwindow;
687689
bool p2p_opp_ps;

include/uapi/linux/nl80211.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,9 @@ enum nl80211_commands {
16351635
* @NL80211_ATTR_ADMITTED_TIME: admitted time in units of 32 microseconds
16361636
* (per second) (u16 attribute)
16371637
*
1638+
* @NL80211_ATTR_SMPS_MODE: SMPS mode to use (ap mode). see
1639+
* &enum nl80211_smps_mode.
1640+
*
16381641
* @NL80211_ATTR_MAX: highest attribute number currently defined
16391642
* @__NL80211_ATTR_AFTER_LAST: internal use
16401643
*/
@@ -1985,6 +1988,8 @@ enum nl80211_attrs {
19851988
NL80211_ATTR_USER_PRIO,
19861989
NL80211_ATTR_ADMITTED_TIME,
19871990

1991+
NL80211_ATTR_SMPS_MODE,
1992+
19881993
/* add attributes here, update the policy in nl80211.c */
19891994

19901995
__NL80211_ATTR_AFTER_LAST,
@@ -4030,6 +4035,13 @@ enum nl80211_ap_sme_features {
40304035
* @NL80211_FEATURE_ACKTO_ESTIMATION: This driver supports dynamic ACK timeout
40314036
* estimation (dynack). %NL80211_ATTR_WIPHY_DYN_ACK flag attribute is used
40324037
* to enable dynack.
4038+
* @NL80211_FEATURE_STATIC_SMPS: Device supports static spatial
4039+
* multiplexing powersave, ie. can turn off all but one chain
4040+
* even on HT connections that should be using more chains.
4041+
* @NL80211_FEATURE_DYNAMIC_SMPS: Device supports dynamic spatial
4042+
* multiplexing powersave, ie. can turn off all but one chain
4043+
* and then wake the rest up as required after, for example,
4044+
* rts/cts handshake.
40334045
*/
40344046
enum nl80211_feature_flags {
40354047
NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -4056,6 +4068,8 @@ enum nl80211_feature_flags {
40564068
NL80211_FEATURE_QUIET = 1 << 21,
40574069
NL80211_FEATURE_TX_POWER_INSERTION = 1 << 22,
40584070
NL80211_FEATURE_ACKTO_ESTIMATION = 1 << 23,
4071+
NL80211_FEATURE_STATIC_SMPS = 1 << 24,
4072+
NL80211_FEATURE_DYNAMIC_SMPS = 1 << 25,
40594073
};
40604074

40614075
/**
@@ -4129,6 +4143,25 @@ enum nl80211_acl_policy {
41294143
NL80211_ACL_POLICY_DENY_UNLESS_LISTED,
41304144
};
41314145

4146+
/**
4147+
* enum nl80211_smps_mode - SMPS mode
4148+
*
4149+
* Requested SMPS mode (for AP mode)
4150+
*
4151+
* @NL80211_SMPS_OFF: SMPS off (use all antennas).
4152+
* @NL80211_SMPS_STATIC: static SMPS (use a single antenna)
4153+
* @NL80211_SMPS_DYNAMIC: dynamic smps (start with a single antenna and
4154+
* turn on other antennas after CTS/RTS).
4155+
*/
4156+
enum nl80211_smps_mode {
4157+
NL80211_SMPS_OFF,
4158+
NL80211_SMPS_STATIC,
4159+
NL80211_SMPS_DYNAMIC,
4160+
4161+
__NL80211_SMPS_AFTER_LAST,
4162+
NL80211_SMPS_MAX = __NL80211_SMPS_AFTER_LAST - 1
4163+
};
4164+
41324165
/**
41334166
* enum nl80211_radar_event - type of radar event for DFS operation
41344167
*

net/wireless/nl80211.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
394394
[NL80211_ATTR_TSID] = { .type = NLA_U8 },
395395
[NL80211_ATTR_USER_PRIO] = { .type = NLA_U8 },
396396
[NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
397+
[NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
397398
};
398399

399400
/* policy for the key attributes */
@@ -3345,6 +3346,29 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
33453346
return PTR_ERR(params.acl);
33463347
}
33473348

3349+
if (info->attrs[NL80211_ATTR_SMPS_MODE]) {
3350+
params.smps_mode =
3351+
nla_get_u8(info->attrs[NL80211_ATTR_SMPS_MODE]);
3352+
switch (params.smps_mode) {
3353+
case NL80211_SMPS_OFF:
3354+
break;
3355+
case NL80211_SMPS_STATIC:
3356+
if (!(rdev->wiphy.features &
3357+
NL80211_FEATURE_STATIC_SMPS))
3358+
return -EINVAL;
3359+
break;
3360+
case NL80211_SMPS_DYNAMIC:
3361+
if (!(rdev->wiphy.features &
3362+
NL80211_FEATURE_DYNAMIC_SMPS))
3363+
return -EINVAL;
3364+
break;
3365+
default:
3366+
return -EINVAL;
3367+
}
3368+
} else {
3369+
params.smps_mode = NL80211_SMPS_OFF;
3370+
}
3371+
33483372
wdev_lock(wdev);
33493373
err = rdev_start_ap(rdev, dev, &params);
33503374
if (!err) {

0 commit comments

Comments
 (0)