wifi: cfg80211: allow setting extended MLD capa/ops
authorJohannes Berg <johannes.berg@intel.com>
Sat, 8 Mar 2025 21:03:28 +0000 (23:03 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Mar 2025 09:51:59 +0000 (10:51 +0100)
Some extended MLD capabilities and operations bits (currently
the "BTM MLD Recommendataion For Multiple APs Support" bit)
may depend on userspace capabilities. Allow userspace to pass
the values for this field that it supports to the association
and link reconfiguration operations.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Link: https://patch.msgid.link/20250308225541.bd52078b5f65.I4dd8f53b0030db7ea87a2e0920989e7e2c7b5345@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/trace.h

index c7cfef104896fa22a52d2a7971b250c310036411..29b9cf0fe6c81c9d610ceb45a7662f14876506f8 100644 (file)
@@ -3086,10 +3086,13 @@ struct cfg80211_assoc_link {
  * struct cfg80211_ml_reconf_req - MLO link reconfiguration request
  * @add_links: data for links to add, see &struct cfg80211_assoc_link
  * @rem_links: bitmap of links to remove
+ * @ext_mld_capa_ops: extended MLD capabilities and operations set by
+ *     userspace for the ML reconfiguration action frame
  */
 struct cfg80211_ml_reconf_req {
        struct cfg80211_assoc_link add_links[IEEE80211_MLD_MAX_NUM_LINKS];
        u16 rem_links;
+       u16 ext_mld_capa_ops;
 };
 
 /**
@@ -3164,6 +3167,8 @@ enum cfg80211_assoc_req_flags {
  *     the link on which the association request should be sent
  * @ap_mld_addr: AP MLD address in case of MLO association request,
  *     valid iff @link_id >= 0
+ * @ext_mld_capa_ops: extended MLD capabilities and operations set by
+ *     userspace for the association
  */
 struct cfg80211_assoc_request {
        struct cfg80211_bss *bss;
@@ -3184,6 +3189,7 @@ struct cfg80211_assoc_request {
        struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
        const u8 *ap_mld_addr;
        s8 link_id;
+       u16 ext_mld_capa_ops;
 };
 
 /**
index 9d8ecf20ef0d46d04e221a9b8962cda65f68784c..c59075acdb10431a729fd6282f2d0dac32fb4054 100644 (file)
@@ -11,7 +11,7 @@
  * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
  * Copyright 2008 Colin McCabe <colin@cozybit.com>
  * Copyright 2015-2017 Intel Deutschland GmbH
- * Copyright (C) 2018-2024 Intel Corporation
+ * Copyright (C) 2018-2025 Intel Corporation
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -2893,6 +2893,12 @@ enum nl80211_commands {
  * @NL80211_ATTR_EPCS: Flag attribute indicating that EPCS is enabled for a
  *     station interface.
  *
+ * @NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS: Extended MLD capabilities and
+ *     operations that userspace implements to use during association/ML
+ *     link reconfig, currently only "BTM MLD Recommendation For Multiple
+ *     APs Support". Drivers may set additional flags that they support
+ *     in the kernel or device.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3448,6 +3454,8 @@ enum nl80211_attrs {
        NL80211_ATTR_MLO_RECONF_REM_LINKS,
        NL80211_ATTR_EPCS,
 
+       NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
index fe706f70ac7ecf07121f9160bb657d45302baab6..e2e8c368fbbf9ccd84a46d46419a91ffac32bcc9 100644 (file)
@@ -850,6 +850,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
                                       NL80211_MAX_SUPP_SELECTORS),
        [NL80211_ATTR_MLO_RECONF_REM_LINKS] = { .type = NLA_U16 },
        [NL80211_ATTR_EPCS] = { .type = NLA_FLAG },
+       [NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS] = { .type = NLA_U16 },
 };
 
 /* policy for the key attributes */
@@ -11373,6 +11374,10 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
                        err = -EINVAL;
                        goto free;
                }
+
+               if (info->attrs[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS])
+                       req.ext_mld_capa_ops =
+                               nla_get_u16(info->attrs[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS]);
        } else {
                if (req.link_id >= 0)
                        return -EINVAL;
@@ -11382,6 +11387,9 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
                if (IS_ERR(req.bss))
                        return PTR_ERR(req.bss);
                ap_addr = req.bss->bssid;
+
+               if (info->attrs[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS])
+                       return -EINVAL;
        }
 
        err = nl80211_crypto_settings(rdev, info, &req.crypto, 1);
@@ -16532,6 +16540,10 @@ static int nl80211_assoc_ml_reconf(struct sk_buff *skb, struct genl_info *info)
                goto out;
        }
 
+       if (info->attrs[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS])
+               req.ext_mld_capa_ops =
+                       nla_get_u16(info->attrs[NL80211_ATTR_ASSOC_MLD_EXT_CAPA_OPS]);
+
        err = cfg80211_assoc_ml_reconf(rdev, dev, &req);
 
 out:
index b82dc7282c2092adb54e3ee3f50e02d3d9187c81..4ed9fada4ec0e9c19a23676890d424dc0ec0661b 100644 (file)
@@ -1378,6 +1378,7 @@ TRACE_EVENT(rdev_assoc,
                __dynamic_array(u8, fils_kek, req->fils_kek_len)
                __dynamic_array(u8, fils_nonces,
                                req->fils_nonces ? 2 * FILS_NONCE_LEN : 0)
+               __field(u16, ext_mld_capa_ops)
        ),
        TP_fast_assign(
                WIPHY_ASSIGN;
@@ -1404,6 +1405,7 @@ TRACE_EVENT(rdev_assoc,
                if (req->fils_nonces)
                        memcpy(__get_dynamic_array(fils_nonces),
                               req->fils_nonces, 2 * FILS_NONCE_LEN);
+               __entry->ext_mld_capa_ops = req->ext_mld_capa_ops;
        ),
        TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", bssid: %pM"
                  ", previous bssid: %pM, use mfp: %s, flags: 0x%x",
@@ -4149,6 +4151,7 @@ TRACE_EVENT(rdev_assoc_ml_reconf,
                NETDEV_ENTRY
                __field(u16, add_links)
                __field(u16, rem_links)
+               __field(u16, ext_mld_capa_ops)
        ),
        TP_fast_assign(
                WIPHY_ASSIGN;
@@ -4160,6 +4163,7 @@ TRACE_EVENT(rdev_assoc_ml_reconf,
                for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++)
                        if (req->add_links[i].bss)
                                __entry->add_links |= BIT(i);
+               __entry->ext_mld_capa_ops = req->ext_mld_capa_ops;
        ),
        TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", add_links=0x%x, rem_links=0x%x",
                  WIPHY_PR_ARG, NETDEV_PR_ARG,