Skip to content

Commit d2b7588

Browse files
twpedersenjmberg-intel
authored andcommitted
nl80211: support S1G capability overrides in assoc
NL80211_ATTR_S1G_CAPABILITY can be passed along with NL80211_ATTR_S1G_CAPABILITY_MASK to NL80211_CMD_ASSOCIATE to indicate S1G capabilities which should override the hardware capabilities in eg. the association request. Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com> Link: https://lore.kernel.org/r/20200922022818.15855-4-thomas@adapt-ip.com [johannes: always require both attributes together, commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 75b1593 commit d2b7588

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

include/linux/ieee80211.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,8 @@ ieee80211_he_spr_size(const u8 *he_spr_ie)
23302330
}
23312331

23322332
/* S1G Capabilities Information field */
2333+
#define IEEE80211_S1G_CAPABILITY_LEN 15
2334+
23332335
#define S1G_CAP0_S1G_LONG BIT(0)
23342336
#define S1G_CAP0_SGI_1MHZ BIT(1)
23352337
#define S1G_CAP0_SGI_2MHZ BIT(2)

include/net/cfg80211.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,6 +2556,8 @@ enum cfg80211_assoc_req_flags {
25562556
* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
25572557
* Request/Response frame or %NULL if FILS is not used. This field starts
25582558
* with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2559+
* @s1g_capa: S1G capability override
2560+
* @s1g_capa_mask: S1G capability override mask
25592561
*/
25602562
struct cfg80211_assoc_request {
25612563
struct cfg80211_bss *bss;
@@ -2570,6 +2572,7 @@ struct cfg80211_assoc_request {
25702572
const u8 *fils_kek;
25712573
size_t fils_kek_len;
25722574
const u8 *fils_nonces;
2575+
struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
25732576
};
25742577

25752578
/**

include/uapi/linux/nl80211.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,6 +2521,12 @@ enum nl80211_commands {
25212521
* unsolicited broadcast probe response. It is a nested attribute, see
25222522
* &enum nl80211_unsol_bcast_probe_resp_attributes.
25232523
*
2524+
* @NL80211_ATTR_S1G_CAPABILITY: S1G Capability information element (from
2525+
* association request when used with NL80211_CMD_NEW_STATION)
2526+
* @NL80211_ATTR_S1G_CAPABILITY_MASK: S1G Capability Information element
2527+
* override mask. Used with NL80211_ATTR_S1G_CAPABILITY in
2528+
* NL80211_CMD_ASSOCIATE or NL80211_CMD_CONNECT.
2529+
*
25242530
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
25252531
* @NL80211_ATTR_MAX: highest attribute number currently defined
25262532
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3007,6 +3013,9 @@ enum nl80211_attrs {
30073013

30083014
NL80211_ATTR_UNSOL_BCAST_PROBE_RESP,
30093015

3016+
NL80211_ATTR_S1G_CAPABILITY,
3017+
NL80211_ATTR_S1G_CAPABILITY_MASK,
3018+
30103019
/* add attributes here, update the policy in nl80211.c */
30113020

30123021
__NL80211_ATTR_AFTER_LAST,

net/wireless/nl80211.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,10 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
704704
NLA_POLICY_NESTED(nl80211_fils_discovery_policy),
705705
[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP] =
706706
NLA_POLICY_NESTED(nl80211_unsol_bcast_probe_resp_policy),
707+
[NL80211_ATTR_S1G_CAPABILITY] =
708+
NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
709+
[NL80211_ATTR_S1G_CAPABILITY_MASK] =
710+
NLA_POLICY_EXACT_LEN(IEEE80211_S1G_CAPABILITY_LEN),
707711
};
708712

709713
/* policy for the key attributes */
@@ -9792,6 +9796,22 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
97929796
nla_data(info->attrs[NL80211_ATTR_FILS_NONCES]);
97939797
}
97949798

9799+
if (info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK]) {
9800+
if (!info->attrs[NL80211_ATTR_S1G_CAPABILITY])
9801+
return -EINVAL;
9802+
memcpy(&req.s1g_capa_mask,
9803+
nla_data(info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK]),
9804+
sizeof(req.s1g_capa_mask));
9805+
}
9806+
9807+
if (info->attrs[NL80211_ATTR_S1G_CAPABILITY]) {
9808+
if (!info->attrs[NL80211_ATTR_S1G_CAPABILITY_MASK])
9809+
return -EINVAL;
9810+
memcpy(&req.s1g_capa,
9811+
nla_data(info->attrs[NL80211_ATTR_S1G_CAPABILITY]),
9812+
sizeof(req.s1g_capa));
9813+
}
9814+
97959815
err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
97969816
if (!err) {
97979817
wdev_lock(dev->ieee80211_ptr);

0 commit comments

Comments
 (0)