3b9ab1624cb9afbf9feaf5a74af911e2a743a7dd
[librecmc/librecmc.git] /
1 From f1871abd27641c020298b5c7654e1d8341f22e5f Mon Sep 17 00:00:00 2001
2 From: Ilan Peer <ilan.peer@intel.com>
3 Date: Thu, 8 Jun 2023 16:36:08 +0300
4 Subject: [PATCH] wifi: mac80211: Add getter functions for vif MLD state
5
6 As a preparation to support disabled/dormant links, add the
7 following function:
8
9 - ieee80211_vif_usable_links(): returns the bitmap of the links
10   that can be activated. Use this function in all the places that
11   the bitmap of the usable links is needed.
12
13 - ieee80211_vif_is_mld(): returns true iff the vif is an MLD.
14   Use this function in all the places where an indication that the
15   connection is a MLD is needed.
16
17 Signed-off-by: Ilan Peer <ilan.peer@intel.com>
18 Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
19 Link: https://lore.kernel.org/r/20230608163202.86e3351da1fc.If6fe3a339fda2019f13f57ff768ecffb711b710a@changeid
20 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
21 ---
22  include/net/mac80211.h     | 21 +++++++++++++++++++
23  net/mac80211/cfg.c         |  4 ++--
24  net/mac80211/debug.h       |  8 +++----
25  net/mac80211/ieee80211_i.h |  2 +-
26  net/mac80211/iface.c       |  4 ++--
27  net/mac80211/link.c        |  4 ++--
28  net/mac80211/mlme.c        | 43 +++++++++++++++++++-------------------
29  net/mac80211/rx.c          |  2 +-
30  net/mac80211/tx.c          | 22 +++++++++----------
31  net/mac80211/util.c        | 14 ++++++-------
32  10 files changed, 73 insertions(+), 51 deletions(-)
33
34 --- a/include/net/mac80211.h
35 +++ b/include/net/mac80211.h
36 @@ -1936,6 +1936,27 @@ struct ieee80211_vif {
37         u8 drv_priv[] __aligned(sizeof(void *));
38  };
39  
40 +/**
41 + * ieee80211_vif_usable_links - Return the usable links for the vif
42 + * @vif: the vif for which the usable links are requested
43 + * Return: the usable link bitmap
44 + */
45 +static inline u16 ieee80211_vif_usable_links(const struct ieee80211_vif *vif)
46 +{
47 +       return vif->valid_links;
48 +}
49 +
50 +/**
51 + * ieee80211_vif_is_mld - Returns true iff the vif is an MLD one
52 + * @vif: the vif
53 + * Return: %true if the vif is an MLD, %false otherwise.
54 + */
55 +static inline bool ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
56 +{
57 +       /* valid_links != 0 indicates this vif is an MLD */
58 +       return vif->valid_links != 0;
59 +}
60 +
61  #define for_each_vif_active_link(vif, link, link_id)                           \
62         for (link_id = 0; link_id < ARRAY_SIZE((vif)->link_conf); link_id++)    \
63                 if ((!(vif)->active_links ||                                    \
64 --- a/net/mac80211/cfg.c
65 +++ b/net/mac80211/cfg.c
66 @@ -35,7 +35,7 @@ ieee80211_link_or_deflink(struct ieee802
67                  * the return value at all (if it's not a pairwise key),
68                  * so in that case (require_valid==false) don't error.
69                  */
70 -               if (require_valid && sdata->vif.valid_links)
71 +               if (require_valid && ieee80211_vif_is_mld(&sdata->vif))
72                         return ERR_PTR(-EINVAL);
73  
74                 return &sdata->deflink;
75 @@ -228,7 +228,7 @@ static int ieee80211_change_iface(struct
76                         return 0;
77  
78                 /* FIXME: no support for 4-addr MLO yet */
79 -               if (sdata->vif.valid_links)
80 +               if (ieee80211_vif_is_mld(&sdata->vif))
81                         return -EOPNOTSUPP;
82  
83                 sdata->u.mgd.use_4addr = params->use_4addr;
84 --- a/net/mac80211/debug.h
85 +++ b/net/mac80211/debug.h
86 @@ -1,7 +1,7 @@
87  /* SPDX-License-Identifier: GPL-2.0 */
88  /*
89   * Portions
90 - * Copyright (C) 2022 Intel Corporation
91 + * Copyright (C) 2022 - 2023 Intel Corporation
92   */
93  #ifndef __MAC80211_DEBUG_H
94  #define __MAC80211_DEBUG_H
95 @@ -136,7 +136,7 @@ do {                                                                        \
96  
97  #define link_info(link, fmt, ...)                                      \
98         do {                                                            \
99 -               if ((link)->sdata->vif.valid_links)                     \
100 +               if (ieee80211_vif_is_mld(&(link)->sdata->vif))          \
101                         _sdata_info((link)->sdata, "[link %d] " fmt,    \
102                                     (link)->link_id,                    \
103                                     ##__VA_ARGS__);                     \
104 @@ -145,7 +145,7 @@ do {                                                                        \
105         } while (0)
106  #define link_err(link, fmt, ...)                                       \
107         do {                                                            \
108 -               if ((link)->sdata->vif.valid_links)                     \
109 +               if (ieee80211_vif_is_mld(&(link)->sdata->vif))          \
110                         _sdata_err((link)->sdata, "[link %d] " fmt,     \
111                                    (link)->link_id,                     \
112                                    ##__VA_ARGS__);                      \
113 @@ -154,7 +154,7 @@ do {                                                                        \
114         } while (0)
115  #define link_dbg(link, fmt, ...)                                       \
116         do {                                                            \
117 -               if ((link)->sdata->vif.valid_links)                     \
118 +               if (ieee80211_vif_is_mld(&(link)->sdata->vif))          \
119                         _sdata_dbg(1, (link)->sdata, "[link %d] " fmt,  \
120                                    (link)->link_id,                     \
121                                    ##__VA_ARGS__);                      \
122 --- a/net/mac80211/ieee80211_i.h
123 +++ b/net/mac80211/ieee80211_i.h
124 @@ -1600,7 +1600,7 @@ ieee80211_get_sband(struct ieee80211_sub
125         struct ieee80211_chanctx_conf *chanctx_conf;
126         enum nl80211_band band;
127  
128 -       WARN_ON(sdata->vif.valid_links);
129 +       WARN_ON(ieee80211_vif_is_mld(&sdata->vif));
130  
131         rcu_read_lock();
132         chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
133 --- a/net/mac80211/iface.c
134 +++ b/net/mac80211/iface.c
135 @@ -521,7 +521,7 @@ static void ieee80211_do_stop(struct iee
136         cancel_work_sync(&sdata->recalc_smps);
137  
138         sdata_lock(sdata);
139 -       WARN(sdata->vif.valid_links,
140 +       WARN(ieee80211_vif_is_mld(&sdata->vif),
141              "destroying interface with valid links 0x%04x\n",
142              sdata->vif.valid_links);
143  
144 @@ -1834,7 +1834,7 @@ static int ieee80211_runtime_change_ifty
145                 return -EBUSY;
146  
147         /* for now, don't support changing while links exist */
148 -       if (sdata->vif.valid_links)
149 +       if (ieee80211_vif_is_mld(&sdata->vif))
150                 return -EBUSY;
151  
152         switch (sdata->vif.type) {
153 --- a/net/mac80211/link.c
154 +++ b/net/mac80211/link.c
155 @@ -324,7 +324,7 @@ static int _ieee80211_set_active_links(s
156                 return -EINVAL;
157  
158         /* cannot activate links that don't exist */
159 -       if (active_links & ~sdata->vif.valid_links)
160 +       if (active_links & ~ieee80211_vif_usable_links(&sdata->vif))
161                 return -EINVAL;
162  
163         /* nothing to do */
164 @@ -463,7 +463,7 @@ void ieee80211_set_active_links_async(st
165                 return;
166  
167         /* cannot activate links that don't exist */
168 -       if (active_links & ~sdata->vif.valid_links)
169 +       if (active_links & ~ieee80211_vif_usable_links(&sdata->vif))
170                 return;
171  
172         /* nothing to do */
173 --- a/net/mac80211/mlme.c
174 +++ b/net/mac80211/mlme.c
175 @@ -1287,7 +1287,7 @@ static void ieee80211_assoc_add_ml_elem(
176         u8 *ml_elem_len;
177         void *capab_pos;
178  
179 -       if (!sdata->vif.valid_links)
180 +       if (!ieee80211_vif_is_mld(&sdata->vif))
181                 return;
182  
183         ift_ext_capa = cfg80211_get_iftype_ext_capa(local->hw.wiphy,
184 @@ -1461,7 +1461,7 @@ static int ieee80211_send_assoc(struct i
185                         capab |= WLAN_CAPABILITY_PRIVACY;
186         }
187  
188 -       if (sdata->vif.valid_links) {
189 +       if (ieee80211_vif_is_mld(&sdata->vif)) {
190                 /* consider the multi-link element with STA profile */
191                 size += sizeof(struct ieee80211_multi_link_elem);
192                 /* max common info field in basic multi-link element */
193 @@ -1792,7 +1792,7 @@ void ieee80211_chswitch_done(struct ieee
194         struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
195         struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
196  
197 -       if (WARN_ON(sdata->vif.valid_links))
198 +       if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif)))
199                 success = false;
200  
201         trace_api_chswitch_done(sdata, success);
202 @@ -2855,7 +2855,7 @@ static void ieee80211_set_associated(str
203         if (vif_cfg->arp_addr_cnt)
204                 vif_changed |= BSS_CHANGED_ARP_FILTER;
205  
206 -       if (sdata->vif.valid_links) {
207 +       if (ieee80211_vif_is_mld(&sdata->vif)) {
208                 for (link_id = 0;
209                      link_id < IEEE80211_MLD_MAX_NUM_LINKS;
210                      link_id++) {
211 @@ -2886,7 +2886,7 @@ static void ieee80211_set_associated(str
212         mutex_unlock(&local->iflist_mtx);
213  
214         /* leave this here to not change ordering in non-MLO cases */
215 -       if (!sdata->vif.valid_links)
216 +       if (!ieee80211_vif_is_mld(&sdata->vif))
217                 ieee80211_recalc_smps(sdata, &sdata->deflink);
218         ieee80211_recalc_ps_vif(sdata);
219  
220 @@ -2982,7 +2982,7 @@ static void ieee80211_set_disassoc(struc
221         sta_info_flush(sdata);
222  
223         /* finally reset all BSS / config parameters */
224 -       if (!sdata->vif.valid_links)
225 +       if (!ieee80211_vif_is_mld(&sdata->vif))
226                 changed |= ieee80211_reset_erp_info(sdata);
227  
228         ieee80211_led_assoc(local, 0);
229 @@ -3007,7 +3007,7 @@ static void ieee80211_set_disassoc(struc
230                sizeof(sdata->vif.bss_conf.mu_group.membership));
231         memset(sdata->vif.bss_conf.mu_group.position, 0,
232                sizeof(sdata->vif.bss_conf.mu_group.position));
233 -       if (!sdata->vif.valid_links)
234 +       if (!ieee80211_vif_is_mld(&sdata->vif))
235                 changed |= BSS_CHANGED_MU_GROUPS;
236         sdata->vif.bss_conf.mu_mimo_owner = false;
237  
238 @@ -3021,7 +3021,7 @@ static void ieee80211_set_disassoc(struc
239                 changed |= BSS_CHANGED_ARP_FILTER;
240  
241         sdata->vif.bss_conf.qos = false;
242 -       if (!sdata->vif.valid_links) {
243 +       if (!ieee80211_vif_is_mld(&sdata->vif)) {
244                 changed |= BSS_CHANGED_QOS;
245                 /* The BSSID (not really interesting) and HT changed */
246                 changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT;
247 @@ -3191,7 +3191,7 @@ static void ieee80211_mgd_probe_ap_send(
248         u8 unicast_limit = max(1, max_probe_tries - 3);
249         struct sta_info *sta;
250  
251 -       if (WARN_ON(sdata->vif.valid_links))
252 +       if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif)))
253                 return;
254  
255         /*
256 @@ -3239,7 +3239,7 @@ static void ieee80211_mgd_probe_ap(struc
257         struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
258         bool already = false;
259  
260 -       if (WARN_ON_ONCE(sdata->vif.valid_links))
261 +       if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif)))
262                 return;
263  
264         if (!ieee80211_sdata_running(sdata))
265 @@ -3314,7 +3314,7 @@ struct sk_buff *ieee80211_ap_probereq_ge
266         int ssid_len;
267  
268         if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION ||
269 -                   sdata->vif.valid_links))
270 +                   ieee80211_vif_is_mld(&sdata->vif)))
271                 return NULL;
272  
273         sdata_assert_lock(sdata);
274 @@ -3379,7 +3379,8 @@ static void __ieee80211_disconnect(struc
275         }
276  
277         /* in MLO assume we have a link where we can TX the frame */
278 -       tx = sdata->vif.valid_links || !sdata->deflink.csa_block_tx;
279 +       tx = ieee80211_vif_is_mld(&sdata->vif) ||
280 +               !sdata->deflink.csa_block_tx;
281  
282         if (!ifmgd->driver_disconnect) {
283                 unsigned int link_id;
284 @@ -3578,7 +3579,7 @@ static void ieee80211_destroy_assoc_data
285                         for (i = 0; i < ARRAY_SIZE(data.bss); i++)
286                                 data.bss[i] = assoc_data->link[i].bss;
287  
288 -                       if (sdata->vif.valid_links)
289 +                       if (ieee80211_vif_is_mld(&sdata->vif))
290                                 data.ap_mld_addr = assoc_data->ap_addr;
291  
292                         cfg80211_assoc_failure(sdata->dev, &data);
293 @@ -4979,7 +4980,7 @@ static bool ieee80211_assoc_success(stru
294         if (WARN_ON(!sta))
295                 goto out_err;
296  
297 -       if (sdata->vif.valid_links) {
298 +       if (ieee80211_vif_is_mld(&sdata->vif)) {
299                 u16 valid_links = 0;
300  
301                 for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
302 @@ -5008,7 +5009,7 @@ static bool ieee80211_assoc_success(stru
303                 if (WARN_ON(!link))
304                         goto out_err;
305  
306 -               if (sdata->vif.valid_links)
307 +               if (ieee80211_vif_is_mld(&sdata->vif))
308                         link_info(link,
309                                   "local address %pM, AP link address %pM\n",
310                                   link->conf->addr,
311 @@ -5240,7 +5241,7 @@ static void ieee80211_rx_mgmt_assoc_resp
312                         ifmgd->broken_ap = true;
313                 }
314  
315 -               if (sdata->vif.valid_links) {
316 +               if (ieee80211_vif_is_mld(&sdata->vif)) {
317                         if (!elems->multi_link) {
318                                 sdata_info(sdata,
319                                            "MLO association with %pM but no multi-link element in response!\n",
320 @@ -5304,7 +5305,7 @@ static void ieee80211_rx_mgmt_assoc_resp
321                                 resp.uapsd_queues |= ieee80211_ac_to_qos_mask[ac];
322         }
323  
324 -       if (sdata->vif.valid_links) {
325 +       if (ieee80211_vif_is_mld(&sdata->vif)) {
326                 ether_addr_copy(ap_mld_addr, sdata->vif.cfg.ap_addr);
327                 resp.ap_mld_addr = ap_mld_addr;
328         }
329 @@ -5629,7 +5630,7 @@ static void ieee80211_rx_mgmt_beacon(str
330         rcu_read_unlock();
331  
332         if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon &&
333 -           !WARN_ON(sdata->vif.valid_links) &&
334 +           !WARN_ON(ieee80211_vif_is_mld(&sdata->vif)) &&
335             ieee80211_rx_our_beacon(bssid, ifmgd->assoc_data->link[0].bss)) {
336                 parse_params.bss = ifmgd->assoc_data->link[0].bss;
337                 elems = ieee802_11_parse_elems_full(&parse_params);
338 @@ -6319,7 +6320,7 @@ static void ieee80211_sta_bcn_mon_timer(
339         struct ieee80211_sub_if_data *sdata =
340                 from_timer(sdata, t, u.mgd.bcn_mon_timer);
341  
342 -       if (WARN_ON(sdata->vif.valid_links))
343 +       if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif)))
344                 return;
345  
346         if (sdata->vif.bss_conf.csa_active &&
347 @@ -6343,7 +6344,7 @@ static void ieee80211_sta_conn_mon_timer
348         struct sta_info *sta;
349         unsigned long timeout;
350  
351 -       if (WARN_ON(sdata->vif.valid_links))
352 +       if (WARN_ON(ieee80211_vif_is_mld(&sdata->vif)))
353                 return;
354  
355         if (sdata->vif.bss_conf.csa_active &&
356 @@ -6898,7 +6899,7 @@ int ieee80211_mgd_auth(struct ieee80211_
357         return 0;
358  
359   err_clear:
360 -       if (!sdata->vif.valid_links) {
361 +       if (!ieee80211_vif_is_mld(&sdata->vif)) {
362                 eth_zero_addr(sdata->deflink.u.mgd.bssid);
363                 ieee80211_link_info_change_notify(sdata, &sdata->deflink,
364                                                   BSS_CHANGED_BSSID);
365 --- a/net/mac80211/rx.c
366 +++ b/net/mac80211/rx.c
367 @@ -2526,7 +2526,7 @@ bool ieee80211_is_our_addr(struct ieee80
368         if (ether_addr_equal(sdata->vif.addr, addr))
369                 return true;
370  
371 -       if (!sdata->vif.valid_links)
372 +       if (!ieee80211_vif_is_mld(&sdata->vif))
373                 return false;
374  
375         for (link_id = 0; link_id < ARRAY_SIZE(sdata->vif.link_conf); link_id++) {
376 --- a/net/mac80211/tx.c
377 +++ b/net/mac80211/tx.c
378 @@ -866,7 +866,7 @@ ieee80211_tx_h_sequence(struct ieee80211
379  
380         /* SNS11 from 802.11be 10.3.2.14 */
381         if (unlikely(is_multicast_ether_addr(hdr->addr1) &&
382 -                    info->control.vif->valid_links &&
383 +                    ieee80211_vif_is_mld(info->control.vif) &&
384                      info->control.vif->type == NL80211_IFTYPE_AP)) {
385                 if (info->control.flags & IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX)
386                         tx->sdata->mld_mcast_seq += 0x10;
387 @@ -2635,7 +2635,7 @@ static struct sk_buff *ieee80211_build_h
388         ethertype = (skb->data[12] << 8) | skb->data[13];
389         fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA);
390  
391 -       if (!sdata->vif.valid_links)
392 +       if (!ieee80211_vif_is_mld(&sdata->vif))
393                 chanctx_conf =
394                         rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
395  
396 @@ -2652,7 +2652,7 @@ static struct sk_buff *ieee80211_build_h
397                         authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
398                         wme_sta = sta->sta.wme;
399                 }
400 -               if (!sdata->vif.valid_links) {
401 +               if (!ieee80211_vif_is_mld(&sdata->vif)) {
402                         struct ieee80211_sub_if_data *ap_sdata;
403  
404                         /* override chanctx_conf from AP (we don't have one) */
405 @@ -2670,7 +2670,7 @@ static struct sk_buff *ieee80211_build_h
406                 /* DA BSSID SA */
407                 memcpy(hdr.addr1, skb->data, ETH_ALEN);
408  
409 -               if (sdata->vif.valid_links && sta && !sta->sta.mlo) {
410 +               if (ieee80211_vif_is_mld(&sdata->vif) && sta && !sta->sta.mlo) {
411                         struct ieee80211_link_data *link;
412  
413                         link_id = sta->deflink.link_id;
414 @@ -2822,7 +2822,7 @@ static struct sk_buff *ieee80211_build_h
415         }
416  
417         if (!chanctx_conf) {
418 -               if (!sdata->vif.valid_links) {
419 +               if (!ieee80211_vif_is_mld(&sdata->vif)) {
420                         ret = -ENOTCONN;
421                         goto free;
422                 }
423 @@ -3064,7 +3064,7 @@ void ieee80211_check_fast_xmit(struct st
424             !ieee80211_hw_check(&local->hw, SUPPORTS_TX_FRAG))
425                 goto out;
426  
427 -       if (!sdata->vif.valid_links) {
428 +       if (!ieee80211_vif_is_mld(&sdata->vif)) {
429                 rcu_read_lock();
430                 chanctx_conf =
431                         rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
432 @@ -3135,7 +3135,7 @@ void ieee80211_check_fast_xmit(struct st
433                 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
434                 /* DA BSSID SA */
435                 build.da_offs = offsetof(struct ieee80211_hdr, addr1);
436 -               if (sta->sta.mlo || !sdata->vif.valid_links) {
437 +               if (sta->sta.mlo || !ieee80211_vif_is_mld(&sdata->vif)) {
438                         memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN);
439                 } else {
440                         unsigned int link_id = sta->deflink.link_id;
441 @@ -4507,7 +4507,7 @@ netdev_tx_t ieee80211_subif_start_xmit(s
442                         __ieee80211_subif_start_xmit(skb, dev, 0,
443                                                      IEEE80211_TX_CTRL_MLO_LINK_UNSPEC,
444                                                      NULL);
445 -       } else if (sdata->vif.valid_links &&
446 +       } else if (ieee80211_vif_is_mld(&sdata->vif) &&
447                    sdata->vif.type == NL80211_IFTYPE_AP &&
448                    !ieee80211_hw_check(&sdata->local->hw, MLO_MCAST_MULTI_LINK_TX)) {
449                 ieee80211_mlo_multicast_tx(dev, skb);
450 @@ -4785,7 +4785,7 @@ static bool ieee80211_tx_pending_skb(str
451  
452         if (info->control.flags & IEEE80211_TX_INTCFL_NEED_TXPROCESSING) {
453                 /* update band only for non-MLD */
454 -               if (!sdata->vif.valid_links) {
455 +               if (!ieee80211_vif_is_mld(&sdata->vif)) {
456                         chanctx_conf =
457                                 rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
458                         if (unlikely(!chanctx_conf)) {
459 @@ -6008,7 +6008,7 @@ void __ieee80211_tx_skb_tid_band(struct
460         BUILD_BUG_ON(!FIELD_FIT(IEEE80211_TX_CTRL_MLO_LINK,
461                                 IEEE80211_LINK_UNSPECIFIED));
462  
463 -       if (!sdata->vif.valid_links) {
464 +       if (!ieee80211_vif_is_mld(&sdata->vif)) {
465                 link = 0;
466         } else if (link_id >= 0) {
467                 link = link_id;
468 @@ -6054,7 +6054,7 @@ void ieee80211_tx_skb_tid(struct ieee802
469         enum nl80211_band band;
470  
471         rcu_read_lock();
472 -       if (!sdata->vif.valid_links) {
473 +       if (!ieee80211_vif_is_mld(&sdata->vif)) {
474                 WARN_ON(link_id >= 0);
475                 chanctx_conf =
476                         rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
477 --- a/net/mac80211/util.c
478 +++ b/net/mac80211/util.c
479 @@ -1701,7 +1701,7 @@ void ieee80211_send_auth(struct ieee8021
480         struct ieee80211_local *local = sdata->local;
481         struct sk_buff *skb;
482         struct ieee80211_mgmt *mgmt;
483 -       bool multi_link = sdata->vif.valid_links;
484 +       bool multi_link = ieee80211_vif_is_mld(&sdata->vif);
485         struct {
486                 u8 id;
487                 u8 len;
488 @@ -2542,7 +2542,7 @@ int ieee80211_reconfig(struct ieee80211_
489                         continue;
490  
491                 sdata_lock(sdata);
492 -               if (sdata->vif.valid_links) {
493 +               if (ieee80211_vif_is_mld(&sdata->vif)) {
494                         struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS] = {
495                                 [0] = &sdata->vif.bss_conf,
496                         };
497 @@ -2562,7 +2562,7 @@ int ieee80211_reconfig(struct ieee80211_
498                 for (link_id = 0;
499                      link_id < ARRAY_SIZE(sdata->vif.link_conf);
500                      link_id++) {
501 -                       if (sdata->vif.valid_links &&
502 +                       if (ieee80211_vif_is_mld(&sdata->vif) &&
503                             !(sdata->vif.active_links & BIT(link_id)))
504                                 continue;
505  
506 @@ -2594,12 +2594,12 @@ int ieee80211_reconfig(struct ieee80211_
507                 if (sdata->vif.bss_conf.mu_mimo_owner)
508                         changed |= BSS_CHANGED_MU_GROUPS;
509  
510 -               if (!sdata->vif.valid_links)
511 +               if (!ieee80211_vif_is_mld(&sdata->vif))
512                         changed |= BSS_CHANGED_IDLE;
513  
514                 switch (sdata->vif.type) {
515                 case NL80211_IFTYPE_STATION:
516 -                       if (!sdata->vif.valid_links) {
517 +                       if (!ieee80211_vif_is_mld(&sdata->vif)) {
518                                 changed |= BSS_CHANGED_ASSOC |
519                                            BSS_CHANGED_ARP_FILTER |
520                                            BSS_CHANGED_PS;
521 @@ -2637,7 +2637,7 @@ int ieee80211_reconfig(struct ieee80211_
522                 case NL80211_IFTYPE_AP:
523                         changed |= BSS_CHANGED_P2P_PS;
524  
525 -                       if (sdata->vif.valid_links)
526 +                       if (ieee80211_vif_is_mld(&sdata->vif))
527                                 ieee80211_vif_cfg_change_notify(sdata,
528                                                                 BSS_CHANGED_SSID);
529                         else
530 @@ -2651,7 +2651,7 @@ int ieee80211_reconfig(struct ieee80211_
531                         if (sdata->vif.type == NL80211_IFTYPE_AP) {
532                                 changed |= BSS_CHANGED_AP_PROBE_RESP;
533  
534 -                               if (sdata->vif.valid_links) {
535 +                               if (ieee80211_vif_is_mld(&sdata->vif)) {
536                                         ieee80211_reconfig_ap_links(local,
537                                                                     sdata,
538                                                                     changed);