@@ -4336,6 +4336,8 @@ enum nl80211_reg_type {
* If not present or 0 default CAC time will be used.
* @NL80211_ATTR_POWER_RULE_PSD: power spectral density (in dBm).
* This could be negative.
+ * @NL80211_ATTR_REG_POWER_MODE: the regulatory power mode for 6 GHz rules.
+ * Referenced from &enum nl80211_regulatory_power_modes
* @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
* currently defined
* @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
@@ -4355,6 +4357,8 @@ enum nl80211_reg_rule_attr {
NL80211_ATTR_POWER_RULE_PSD,
+ NL80211_ATTR_REG_POWER_MODE,
+
/* keep last */
__NL80211_REG_RULE_ATTR_AFTER_LAST,
NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
@@ -8473,6 +8473,13 @@ static int nl80211_put_regdom(const struct ieee80211_regdomain *regdom,
reg_rule->dfs_cac_ms))
goto nla_put_failure;
+ /* Put power mode as well if its a 6 GHz reg rule */
+ if (freq_range->start_freq_khz >= MHZ_TO_KHZ(5925) &&
+ freq_range->end_freq_khz <= MHZ_TO_KHZ(7125) &&
+ nla_put_u8(msg, NL80211_ATTR_REG_POWER_MODE,
+ reg_rule->power_mode))
+ goto nla_put_failure;
+
if ((reg_rule->flags & NL80211_RRF_PSD) &&
nla_put_s8(msg, NL80211_ATTR_POWER_RULE_PSD,
reg_rule->psd))
@@ -8652,6 +8659,10 @@ static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] =
[NL80211_ATTR_POWER_RULE_MAX_EIRP] = { .type = NLA_U32 },
[NL80211_ATTR_DFS_CAC_TIME] = { .type = NLA_U32 },
[NL80211_ATTR_POWER_RULE_PSD] = { .type = NLA_S8 },
+ [NL80211_ATTR_REG_POWER_MODE] =
+ NLA_POLICY_RANGE(NLA_U8,
+ NL80211_REG_PWR_MODE_AP_LPI,
+ NL80211_REG_PWR_MODE_MAX - 1),
};
static int parse_reg_rule(struct nlattr *tb[],
@@ -8699,6 +8710,15 @@ static int parse_reg_rule(struct nlattr *tb[],
reg_rule->dfs_cac_ms =
nla_get_u32(tb[NL80211_ATTR_DFS_CAC_TIME]);
+ if (freq_range->start_freq_khz >= MHZ_TO_KHZ(5925) &&
+ freq_range->end_freq_khz <= MHZ_TO_KHZ(7125)) {
+ if (!tb[NL80211_ATTR_REG_POWER_MODE])
+ return -EINVAL;
+
+ reg_rule->power_mode =
+ nla_get_u8(tb[NL80211_ATTR_REG_POWER_MODE]);
+ }
+
return 0;
}
Currently when user space demands the reg rules via NL80211_CMD_GET_REG command, along with Power Spectral Denity (PSD) values, power mode needs to be advertised since in 6 GHz AP beacon, Tx power envelope should have PSD info as well which can be opted based on the power mode. Similarly, via NL80211_CMD_SET_REG command, user space can try to set regulatory rules and cfg80211 needs to store the incoming power mode for the rule. Add support for 6 GHz power mode advertisement in NL80211_CMD_GET_REG command and saving 6 GHz power mode for reg rules via NL80211_CMD_SET_REG command. Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> --- include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+)