@@ -1331,6 +1331,7 @@ struct cfg80211_unsol_bcast_probe_resp {
* @punct_bitmap: Preamble puncturing bitmap. Each bit represents
* a 20 MHz channel, lowest bit corresponding to the lowest channel.
* Bit set to 1 indicates that the channel is punctured.
+ * @ap_ps_enable: enable/disable ap power save.
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
@@ -1366,6 +1367,7 @@ struct cfg80211_ap_settings {
struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
struct cfg80211_mbssid_config mbssid_config;
u16 punct_bitmap;
+ bool ap_ps_enable;
};
/**
@@ -1376,9 +1378,13 @@ validation flags
* to indicate the valid settings in struct cfg80211_ap_settings.
*
* @BEACON_VALID: beacon setting is valid.
+ * @AP_PS_VALID: AP PS setting is valid.
*/
enum cfg80211_ap_settings_valid {
BEACON_VALID,
+ AP_PS_VALID,
+
+ /* keep last */
LAST_VALID,
};
@@ -401,7 +401,8 @@
* attributes. For drivers that generate the beacon and probe responses
* internally, the following attributes must be provided for the
* beacon update: %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP and
- * %NL80211_ATTR_IE_ASSOC_RESP.
+ * %NL80211_ATTR_IE_ASSOC_RESP. This following attribute must be
+ * provided for the ap power save: %NL80211_ATTR_AP_PS.
* @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters
* are like for %NL80211_CMD_UPDATE_AP, and additionally parameters that
* do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL,
@@ -2745,6 +2746,12 @@ enum nl80211_commands {
* enumerated in &enum nl80211_ap_settings_flags. This attribute shall be
* used with %NL80211_CMD_START_AP request.
*
+ * @NL80211_ATTR_AP_PS: enable/disable AP power save.
+ * This attribute type is NLA_FLAG and valid input is 0 or 1.
+ * 0 for disable AP power save mode.
+ * 1 for enable AP power save mode.
+ * This attribute shall be used with %%NL80211_CMD_UPDATE_AP.
+ *
* @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from
* association request when used with NL80211_CMD_NEW_STATION). Can be set
* only if %NL80211_STA_FLAG_WME is set.
@@ -3331,6 +3338,8 @@ enum nl80211_attrs {
NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS,
NL80211_ATTR_HW_TIMESTAMP_ENABLED,
+ NL80211_ATTR_AP_PS,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -809,6 +809,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS] = { .type = NLA_U16 },
[NL80211_ATTR_HW_TIMESTAMP_ENABLED] = { .type = NLA_FLAG },
+ [NL80211_ATTR_AP_PS] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -6150,6 +6151,7 @@ static int nl80211_update_ap(struct sk_buff *skb, struct genl_info *info)
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_ap_update params;
int err;
+ bool haveinfo = false;
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
@@ -6163,9 +6165,16 @@ static int nl80211_update_ap(struct sk_buff *skb, struct genl_info *info)
memset(¶ms, 0, sizeof(params));
+ if (info->attrs[NL80211_ATTR_AP_PS]) {
+ params.settings.ap_ps_enable =
+ !!nla_get_flag(info->attrs[NL80211_ATTR_AP_PS]);
+ set_bit(AP_PS_VALID, params.valid);
+ haveinfo = true;
+ }
+
err = nl80211_parse_beacon(rdev, info->attrs,
¶ms.settings.beacon);
- if (err)
+ if (err && !haveinfo)
goto out;
set_bit(BEACON_VALID, params.valid);