]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: mlme: support extended MLD capa/ops in assoc
authorJohannes Berg <johannes.berg@intel.com>
Sat, 8 Mar 2025 21:03:29 +0000 (23:03 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 11 Mar 2025 09:51:59 +0000 (10:51 +0100)
Support passing the value from userspace on to the AP in the
association and ML link reconfiguration requests. We may need
to also add a driver value to or in with the field, but for
now have no feature that is controlled by the driver.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250308225541.2e555beb0a76.I623f59023b47ec202fc0c7520f2b5f575b439927@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ieee80211_i.h
net/mac80211/mlme.c

index 5f92619f8584a09b7b3b5597574e14430d39de2f..a36563a07b3b04c249e2352624c1fecc7b6fbd93 100644 (file)
@@ -462,6 +462,8 @@ struct ieee80211_mgd_assoc_data {
 
        unsigned int assoc_link_id;
 
+       __le16 ext_mld_capa_ops;
+
        u8 fils_nonces[2 * FILS_NONCE_LEN];
        u8 fils_kek[FILS_MAX_KEK_LEN];
        size_t fils_kek_len;
index 613959f19713e7c6c6c4856725aec5aca0152b0a..87ebeec2877dfaff91cfabf1f9376310141da333 100644 (file)
@@ -1943,6 +1943,21 @@ ieee80211_assoc_add_ml_elem(struct ieee80211_sub_if_data *sdata,
        }
        skb_put_data(skb, &mld_capa_ops, sizeof(mld_capa_ops));
 
+       /* Many APs have broken parsing of the extended MLD capa/ops field,
+        * dropping (re-)association request frames or replying with association
+        * response with a failure status if it's present. Without a clear
+        * indication as to whether the AP supports parsing this field or not do
+        * not include it in the common information unless strict mode is set.
+        */
+       if (ieee80211_hw_check(&local->hw, STRICT) &&
+           assoc_data->ext_mld_capa_ops) {
+               ml_elem->control |=
+                       cpu_to_le16(IEEE80211_MLC_BASIC_PRES_EXT_MLD_CAPA_OP);
+               common->len += 2;
+               skb_put_data(skb, &assoc_data->ext_mld_capa_ops,
+                            sizeof(assoc_data->ext_mld_capa_ops));
+       }
+
        for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
                u16 link_present_elems[PRESENT_ELEMS_MAX] = {};
                const u8 *extra_elems;
@@ -2112,6 +2127,7 @@ static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
                /* max common info field in basic multi-link element */
                size += sizeof(struct ieee80211_mle_basic_common_info) +
                        2 + /* capa & op */
+                       2 + /* ext capa & op */
                        2; /* EML capa */
 
                /*
@@ -9366,6 +9382,8 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        else
                memcpy(assoc_data->ap_addr, cbss->bssid, ETH_ALEN);
 
+       assoc_data->ext_mld_capa_ops = cpu_to_le16(req->ext_mld_capa_ops);
+
        if (ifmgd->associated) {
                u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
 
@@ -10136,7 +10154,7 @@ disconnect:
 static struct sk_buff *
 ieee80211_build_ml_reconf_req(struct ieee80211_sub_if_data *sdata,
                              struct ieee80211_mgd_assoc_data *add_links_data,
-                             u16 removed_links)
+                             u16 removed_links, __le16 ext_mld_capa_ops)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_mgmt *mgmt;
@@ -10185,6 +10203,9 @@ ieee80211_build_ml_reconf_req(struct ieee80211_sub_if_data *sdata,
                        var_common_size += 2;
        }
 
+       if (ext_mld_capa_ops)
+               var_common_size += 2;
+
        /* Add the common information length */
        size += common_size + var_common_size;
 
@@ -10269,6 +10290,12 @@ ieee80211_build_ml_reconf_req(struct ieee80211_sub_if_data *sdata,
                skb_put_data(skb, &mld_capa_ops, sizeof(mld_capa_ops));
        }
 
+       if (ext_mld_capa_ops) {
+               ml_elem->control |=
+                       cpu_to_le16(IEEE80211_MLC_RECONF_PRES_EXT_MLD_CAPA_OP);
+               skb_put_data(skb, &ext_mld_capa_ops, sizeof(ext_mld_capa_ops));
+       }
+
        if (sdata->u.mgd.flags & IEEE80211_STA_ENABLE_RRM)
                capab |= WLAN_CAPABILITY_RADIO_MEASURE;
 
@@ -10535,7 +10562,8 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,
         * is expected to send the ML reconfiguration response frame on the link
         * on which the request was received.
         */
-       skb = ieee80211_build_ml_reconf_req(sdata, data, req->rem_links);
+       skb = ieee80211_build_ml_reconf_req(sdata, data, req->rem_links,
+                                           cpu_to_le16(req->ext_mld_capa_ops));
        if (!skb) {
                err = -ENOMEM;
                goto err_free;