1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright 2015 Intel Deutschland GmbH
4 * Copyright (C) 2022-2024 Intel Corporation
5 */
6 #include <net/mac80211.h>
7 #include "ieee80211_i.h"
8 #include "trace.h"
9 #include "driver-ops.h"
10 #include "debugfs_sta.h"
11 #include "debugfs_netdev.h"
12
drv_start(struct ieee80211_local * local)13 int drv_start(struct ieee80211_local *local)
14 {
15 int ret;
16
17 might_sleep();
18 lockdep_assert_wiphy(local->hw.wiphy);
19
20 if (WARN_ON(local->started))
21 return -EALREADY;
22
23 trace_drv_start(local);
24 local->started = true;
25 /* allow rx frames */
26 smp_mb();
27 ret = local->ops->start(&local->hw);
28 trace_drv_return_int(local, ret);
29
30 if (ret)
31 local->started = false;
32
33 return ret;
34 }
35
drv_stop(struct ieee80211_local * local,bool suspend)36 void drv_stop(struct ieee80211_local *local, bool suspend)
37 {
38 might_sleep();
39 lockdep_assert_wiphy(local->hw.wiphy);
40
41 if (WARN_ON(!local->started))
42 return;
43
44 trace_drv_stop(local, suspend);
45 local->ops->stop(&local->hw, suspend);
46 trace_drv_return_void(local);
47
48 /* sync away all work on the tasklet before clearing started */
49 tasklet_disable(&local->tasklet);
50 tasklet_enable(&local->tasklet);
51
52 barrier();
53
54 local->started = false;
55 }
56
drv_add_interface(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)57 int drv_add_interface(struct ieee80211_local *local,
58 struct ieee80211_sub_if_data *sdata)
59 {
60 int ret;
61
62 might_sleep();
63 lockdep_assert_wiphy(local->hw.wiphy);
64
65 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
66 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
67 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF) &&
68 !(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))))
69 return -EINVAL;
70
71 trace_drv_add_interface(local, sdata);
72 ret = local->ops->add_interface(&local->hw, &sdata->vif);
73 trace_drv_return_int(local, ret);
74
75 if (ret)
76 return ret;
77
78 if (!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)) {
79 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
80
81 drv_vif_add_debugfs(local, sdata);
82 /* initially vif is not MLD */
83 ieee80211_link_debugfs_drv_add(&sdata->deflink);
84 }
85
86 return 0;
87 }
88
drv_change_interface(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,enum nl80211_iftype type,bool p2p)89 int drv_change_interface(struct ieee80211_local *local,
90 struct ieee80211_sub_if_data *sdata,
91 enum nl80211_iftype type, bool p2p)
92 {
93 int ret;
94
95 might_sleep();
96 lockdep_assert_wiphy(local->hw.wiphy);
97
98 if (!check_sdata_in_driver(sdata))
99 return -EIO;
100
101 trace_drv_change_interface(local, sdata, type, p2p);
102 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
103 trace_drv_return_int(local, ret);
104 return ret;
105 }
106
drv_remove_interface(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)107 void drv_remove_interface(struct ieee80211_local *local,
108 struct ieee80211_sub_if_data *sdata)
109 {
110 might_sleep();
111 lockdep_assert_wiphy(local->hw.wiphy);
112
113 if (!check_sdata_in_driver(sdata))
114 return;
115
116 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
117
118 /*
119 * Remove driver debugfs entries.
120 * The virtual monitor interface doesn't get a debugfs
121 * entry, so it's exempt here.
122 */
123 if (sdata != rcu_access_pointer(local->monitor_sdata))
124 ieee80211_debugfs_recreate_netdev(sdata,
125 sdata->vif.valid_links);
126
127 trace_drv_remove_interface(local, sdata);
128 local->ops->remove_interface(&local->hw, &sdata->vif);
129 trace_drv_return_void(local);
130 }
131
132 __must_check
drv_sta_state(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct sta_info * sta,enum ieee80211_sta_state old_state,enum ieee80211_sta_state new_state)133 int drv_sta_state(struct ieee80211_local *local,
134 struct ieee80211_sub_if_data *sdata,
135 struct sta_info *sta,
136 enum ieee80211_sta_state old_state,
137 enum ieee80211_sta_state new_state)
138 {
139 int ret = 0;
140
141 might_sleep();
142 lockdep_assert_wiphy(local->hw.wiphy);
143
144 sdata = get_bss_sdata(sdata);
145 if (!check_sdata_in_driver(sdata))
146 return -EIO;
147
148 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
149 if (local->ops->sta_state) {
150 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
151 old_state, new_state);
152 } else if (old_state == IEEE80211_STA_AUTH &&
153 new_state == IEEE80211_STA_ASSOC) {
154 ret = drv_sta_add(local, sdata, &sta->sta);
155 if (ret == 0) {
156 sta->uploaded = true;
157 if (rcu_access_pointer(sta->sta.rates))
158 drv_sta_rate_tbl_update(local, sdata, &sta->sta);
159 }
160 } else if (old_state == IEEE80211_STA_ASSOC &&
161 new_state == IEEE80211_STA_AUTH) {
162 drv_sta_remove(local, sdata, &sta->sta);
163 }
164 trace_drv_return_int(local, ret);
165 return ret;
166 }
167
168 __must_check
drv_sta_set_txpwr(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct sta_info * sta)169 int drv_sta_set_txpwr(struct ieee80211_local *local,
170 struct ieee80211_sub_if_data *sdata,
171 struct sta_info *sta)
172 {
173 int ret = -EOPNOTSUPP;
174
175 might_sleep();
176 lockdep_assert_wiphy(local->hw.wiphy);
177
178 sdata = get_bss_sdata(sdata);
179 if (!check_sdata_in_driver(sdata))
180 return -EIO;
181
182 trace_drv_sta_set_txpwr(local, sdata, &sta->sta);
183 if (local->ops->sta_set_txpwr)
184 ret = local->ops->sta_set_txpwr(&local->hw, &sdata->vif,
185 &sta->sta);
186 trace_drv_return_int(local, ret);
187 return ret;
188 }
189
drv_sta_rc_update(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,u32 changed)190 void drv_sta_rc_update(struct ieee80211_local *local,
191 struct ieee80211_sub_if_data *sdata,
192 struct ieee80211_sta *sta, u32 changed)
193 {
194 sdata = get_bss_sdata(sdata);
195 if (!check_sdata_in_driver(sdata))
196 return;
197
198 WARN_ON(changed & IEEE80211_RC_SUPP_RATES_CHANGED &&
199 (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
200 sdata->vif.type != NL80211_IFTYPE_MESH_POINT));
201
202 trace_drv_sta_rc_update(local, sdata, sta, changed);
203 if (local->ops->sta_rc_update)
204 local->ops->sta_rc_update(&local->hw, &sdata->vif,
205 sta, changed);
206
207 trace_drv_return_void(local);
208 }
209
drv_conf_tx(struct ieee80211_local * local,struct ieee80211_link_data * link,u16 ac,const struct ieee80211_tx_queue_params * params)210 int drv_conf_tx(struct ieee80211_local *local,
211 struct ieee80211_link_data *link, u16 ac,
212 const struct ieee80211_tx_queue_params *params)
213 {
214 struct ieee80211_sub_if_data *sdata = link->sdata;
215 int ret = -EOPNOTSUPP;
216
217 might_sleep();
218 lockdep_assert_wiphy(local->hw.wiphy);
219
220 if (!check_sdata_in_driver(sdata))
221 return -EIO;
222
223 if (!ieee80211_vif_link_active(&sdata->vif, link->link_id))
224 return 0;
225
226 if (params->cw_min == 0 || params->cw_min > params->cw_max) {
227 /*
228 * If we can't configure hardware anyway, don't warn. We may
229 * never have initialized the CW parameters.
230 */
231 WARN_ONCE(local->ops->conf_tx,
232 "%s: invalid CW_min/CW_max: %d/%d\n",
233 sdata->name, params->cw_min, params->cw_max);
234 return -EINVAL;
235 }
236
237 trace_drv_conf_tx(local, sdata, link->link_id, ac, params);
238 if (local->ops->conf_tx)
239 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
240 link->link_id, ac, params);
241 trace_drv_return_int(local, ret);
242 return ret;
243 }
244
drv_get_tsf(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)245 u64 drv_get_tsf(struct ieee80211_local *local,
246 struct ieee80211_sub_if_data *sdata)
247 {
248 u64 ret = -1ULL;
249
250 might_sleep();
251 lockdep_assert_wiphy(local->hw.wiphy);
252
253 if (!check_sdata_in_driver(sdata))
254 return ret;
255
256 trace_drv_get_tsf(local, sdata);
257 if (local->ops->get_tsf)
258 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
259 trace_drv_return_u64(local, ret);
260 return ret;
261 }
262
drv_set_tsf(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u64 tsf)263 void drv_set_tsf(struct ieee80211_local *local,
264 struct ieee80211_sub_if_data *sdata,
265 u64 tsf)
266 {
267 might_sleep();
268 lockdep_assert_wiphy(local->hw.wiphy);
269
270 if (!check_sdata_in_driver(sdata))
271 return;
272
273 trace_drv_set_tsf(local, sdata, tsf);
274 if (local->ops->set_tsf)
275 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
276 trace_drv_return_void(local);
277 }
278
drv_offset_tsf(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,s64 offset)279 void drv_offset_tsf(struct ieee80211_local *local,
280 struct ieee80211_sub_if_data *sdata,
281 s64 offset)
282 {
283 might_sleep();
284 lockdep_assert_wiphy(local->hw.wiphy);
285
286 if (!check_sdata_in_driver(sdata))
287 return;
288
289 trace_drv_offset_tsf(local, sdata, offset);
290 if (local->ops->offset_tsf)
291 local->ops->offset_tsf(&local->hw, &sdata->vif, offset);
292 trace_drv_return_void(local);
293 }
294
drv_reset_tsf(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata)295 void drv_reset_tsf(struct ieee80211_local *local,
296 struct ieee80211_sub_if_data *sdata)
297 {
298 might_sleep();
299 lockdep_assert_wiphy(local->hw.wiphy);
300
301 if (!check_sdata_in_driver(sdata))
302 return;
303
304 trace_drv_reset_tsf(local, sdata);
305 if (local->ops->reset_tsf)
306 local->ops->reset_tsf(&local->hw, &sdata->vif);
307 trace_drv_return_void(local);
308 }
309
drv_assign_vif_chanctx(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * link_conf,struct ieee80211_chanctx * ctx)310 int drv_assign_vif_chanctx(struct ieee80211_local *local,
311 struct ieee80211_sub_if_data *sdata,
312 struct ieee80211_bss_conf *link_conf,
313 struct ieee80211_chanctx *ctx)
314 {
315 int ret = 0;
316
317 might_sleep();
318 lockdep_assert_wiphy(local->hw.wiphy);
319
320 /*
321 * We should perhaps push emulate chanctx down and only
322 * make it call ->config() when the chanctx is actually
323 * assigned here (and unassigned below), but that's yet
324 * another change to all drivers to add assign/unassign
325 * emulation callbacks. Maybe later.
326 */
327 if (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
328 local->emulate_chanctx &&
329 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
330 return 0;
331
332 if (!check_sdata_in_driver(sdata))
333 return -EIO;
334
335 if (!ieee80211_vif_link_active(&sdata->vif, link_conf->link_id))
336 return 0;
337
338 trace_drv_assign_vif_chanctx(local, sdata, link_conf, ctx);
339 if (local->ops->assign_vif_chanctx) {
340 WARN_ON_ONCE(!ctx->driver_present);
341 ret = local->ops->assign_vif_chanctx(&local->hw,
342 &sdata->vif,
343 link_conf,
344 &ctx->conf);
345 }
346 trace_drv_return_int(local, ret);
347
348 return ret;
349 }
350
drv_unassign_vif_chanctx(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * link_conf,struct ieee80211_chanctx * ctx)351 void drv_unassign_vif_chanctx(struct ieee80211_local *local,
352 struct ieee80211_sub_if_data *sdata,
353 struct ieee80211_bss_conf *link_conf,
354 struct ieee80211_chanctx *ctx)
355 {
356 might_sleep();
357 lockdep_assert_wiphy(local->hw.wiphy);
358
359 if (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
360 local->emulate_chanctx &&
361 !ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
362 return;
363
364 if (!check_sdata_in_driver(sdata))
365 return;
366
367 if (!ieee80211_vif_link_active(&sdata->vif, link_conf->link_id))
368 return;
369
370 trace_drv_unassign_vif_chanctx(local, sdata, link_conf, ctx);
371 if (local->ops->unassign_vif_chanctx) {
372 WARN_ON_ONCE(!ctx->driver_present);
373 local->ops->unassign_vif_chanctx(&local->hw,
374 &sdata->vif,
375 link_conf,
376 &ctx->conf);
377 }
378 trace_drv_return_void(local);
379 }
380
drv_switch_vif_chanctx(struct ieee80211_local * local,struct ieee80211_vif_chanctx_switch * vifs,int n_vifs,enum ieee80211_chanctx_switch_mode mode)381 int drv_switch_vif_chanctx(struct ieee80211_local *local,
382 struct ieee80211_vif_chanctx_switch *vifs,
383 int n_vifs, enum ieee80211_chanctx_switch_mode mode)
384 {
385 int ret = 0;
386 int i;
387
388 might_sleep();
389 lockdep_assert_wiphy(local->hw.wiphy);
390
391 if (!local->ops->switch_vif_chanctx)
392 return -EOPNOTSUPP;
393
394 for (i = 0; i < n_vifs; i++) {
395 struct ieee80211_chanctx *new_ctx =
396 container_of(vifs[i].new_ctx,
397 struct ieee80211_chanctx,
398 conf);
399 struct ieee80211_chanctx *old_ctx =
400 container_of(vifs[i].old_ctx,
401 struct ieee80211_chanctx,
402 conf);
403
404 WARN_ON_ONCE(!old_ctx->driver_present);
405 WARN_ON_ONCE((mode == CHANCTX_SWMODE_SWAP_CONTEXTS &&
406 new_ctx->driver_present) ||
407 (mode == CHANCTX_SWMODE_REASSIGN_VIF &&
408 !new_ctx->driver_present));
409 }
410
411 trace_drv_switch_vif_chanctx(local, vifs, n_vifs, mode);
412 ret = local->ops->switch_vif_chanctx(&local->hw,
413 vifs, n_vifs, mode);
414 trace_drv_return_int(local, ret);
415
416 if (!ret && mode == CHANCTX_SWMODE_SWAP_CONTEXTS) {
417 for (i = 0; i < n_vifs; i++) {
418 struct ieee80211_chanctx *new_ctx =
419 container_of(vifs[i].new_ctx,
420 struct ieee80211_chanctx,
421 conf);
422 struct ieee80211_chanctx *old_ctx =
423 container_of(vifs[i].old_ctx,
424 struct ieee80211_chanctx,
425 conf);
426
427 new_ctx->driver_present = true;
428 old_ctx->driver_present = false;
429 }
430 }
431
432 return ret;
433 }
434
drv_ampdu_action(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_ampdu_params * params)435 int drv_ampdu_action(struct ieee80211_local *local,
436 struct ieee80211_sub_if_data *sdata,
437 struct ieee80211_ampdu_params *params)
438 {
439 int ret = -EOPNOTSUPP;
440
441 might_sleep();
442 lockdep_assert_wiphy(local->hw.wiphy);
443
444 sdata = get_bss_sdata(sdata);
445 if (!check_sdata_in_driver(sdata))
446 return -EIO;
447
448 trace_drv_ampdu_action(local, sdata, params);
449
450 if (local->ops->ampdu_action)
451 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, params);
452
453 trace_drv_return_int(local, ret);
454
455 return ret;
456 }
457
drv_link_info_changed(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_bss_conf * info,int link_id,u64 changed)458 void drv_link_info_changed(struct ieee80211_local *local,
459 struct ieee80211_sub_if_data *sdata,
460 struct ieee80211_bss_conf *info,
461 int link_id, u64 changed)
462 {
463 might_sleep();
464 lockdep_assert_wiphy(local->hw.wiphy);
465
466 if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
467 BSS_CHANGED_BEACON_ENABLED) &&
468 sdata->vif.type != NL80211_IFTYPE_AP &&
469 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
470 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
471 sdata->vif.type != NL80211_IFTYPE_OCB))
472 return;
473
474 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
475 sdata->vif.type == NL80211_IFTYPE_NAN ||
476 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
477 !sdata->vif.bss_conf.mu_mimo_owner &&
478 !(changed & BSS_CHANGED_TXPOWER))))
479 return;
480
481 if (!check_sdata_in_driver(sdata))
482 return;
483
484 if (!ieee80211_vif_link_active(&sdata->vif, link_id))
485 return;
486
487 trace_drv_link_info_changed(local, sdata, info, changed);
488 if (local->ops->link_info_changed)
489 local->ops->link_info_changed(&local->hw, &sdata->vif,
490 info, changed);
491 else if (local->ops->bss_info_changed)
492 local->ops->bss_info_changed(&local->hw, &sdata->vif,
493 info, changed);
494 trace_drv_return_void(local);
495 }
496
drv_set_key(struct ieee80211_local * local,enum set_key_cmd cmd,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,struct ieee80211_key_conf * key)497 int drv_set_key(struct ieee80211_local *local,
498 enum set_key_cmd cmd,
499 struct ieee80211_sub_if_data *sdata,
500 struct ieee80211_sta *sta,
501 struct ieee80211_key_conf *key)
502 {
503 int ret;
504
505 might_sleep();
506 lockdep_assert_wiphy(local->hw.wiphy);
507
508 sdata = get_bss_sdata(sdata);
509 if (!check_sdata_in_driver(sdata))
510 return -EIO;
511
512 if (WARN_ON(key->link_id >= 0 && sdata->vif.active_links &&
513 !(sdata->vif.active_links & BIT(key->link_id))))
514 return -ENOLINK;
515
516 trace_drv_set_key(local, cmd, sdata, sta, key);
517 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
518 trace_drv_return_int(local, ret);
519 return ret;
520 }
521
drv_change_vif_links(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,u16 old_links,u16 new_links,struct ieee80211_bss_conf * old[IEEE80211_MLD_MAX_NUM_LINKS])522 int drv_change_vif_links(struct ieee80211_local *local,
523 struct ieee80211_sub_if_data *sdata,
524 u16 old_links, u16 new_links,
525 struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS])
526 {
527 struct ieee80211_link_data *link;
528 unsigned long links_to_add;
529 unsigned long links_to_rem;
530 unsigned int link_id;
531 int ret = -EOPNOTSUPP;
532
533 might_sleep();
534 lockdep_assert_wiphy(local->hw.wiphy);
535
536 if (!check_sdata_in_driver(sdata))
537 return -EIO;
538
539 if (old_links == new_links)
540 return 0;
541
542 links_to_add = ~old_links & new_links;
543 links_to_rem = old_links & ~new_links;
544
545 for_each_set_bit(link_id, &links_to_rem, IEEE80211_MLD_MAX_NUM_LINKS) {
546 link = rcu_access_pointer(sdata->link[link_id]);
547
548 ieee80211_link_debugfs_drv_remove(link);
549 }
550
551 trace_drv_change_vif_links(local, sdata, old_links, new_links);
552 if (local->ops->change_vif_links)
553 ret = local->ops->change_vif_links(&local->hw, &sdata->vif,
554 old_links, new_links, old);
555 trace_drv_return_int(local, ret);
556
557 if (ret)
558 return ret;
559
560 if (!local->in_reconfig && !local->resuming) {
561 for_each_set_bit(link_id, &links_to_add,
562 IEEE80211_MLD_MAX_NUM_LINKS) {
563 link = rcu_access_pointer(sdata->link[link_id]);
564
565 ieee80211_link_debugfs_drv_add(link);
566 }
567 }
568
569 return 0;
570 }
571
drv_change_sta_links(struct ieee80211_local * local,struct ieee80211_sub_if_data * sdata,struct ieee80211_sta * sta,u16 old_links,u16 new_links)572 int drv_change_sta_links(struct ieee80211_local *local,
573 struct ieee80211_sub_if_data *sdata,
574 struct ieee80211_sta *sta,
575 u16 old_links, u16 new_links)
576 {
577 struct sta_info *info = container_of(sta, struct sta_info, sta);
578 struct link_sta_info *link_sta;
579 unsigned long links_to_add;
580 unsigned long links_to_rem;
581 unsigned int link_id;
582 int ret = -EOPNOTSUPP;
583
584 might_sleep();
585 lockdep_assert_wiphy(local->hw.wiphy);
586
587 if (!check_sdata_in_driver(sdata))
588 return -EIO;
589
590 old_links &= sdata->vif.active_links;
591 new_links &= sdata->vif.active_links;
592
593 if (old_links == new_links)
594 return 0;
595
596 links_to_add = ~old_links & new_links;
597 links_to_rem = old_links & ~new_links;
598
599 for_each_set_bit(link_id, &links_to_rem, IEEE80211_MLD_MAX_NUM_LINKS) {
600 link_sta = rcu_dereference_protected(info->link[link_id],
601 lockdep_is_held(&local->hw.wiphy->mtx));
602
603 ieee80211_link_sta_debugfs_drv_remove(link_sta);
604 }
605
606 trace_drv_change_sta_links(local, sdata, sta, old_links, new_links);
607 if (local->ops->change_sta_links)
608 ret = local->ops->change_sta_links(&local->hw, &sdata->vif, sta,
609 old_links, new_links);
610 trace_drv_return_int(local, ret);
611
612 if (ret)
613 return ret;
614
615 /* during reconfig don't add it to debugfs again */
616 if (local->in_reconfig || local->resuming)
617 return 0;
618
619 for_each_set_bit(link_id, &links_to_add, IEEE80211_MLD_MAX_NUM_LINKS) {
620 link_sta = rcu_dereference_protected(info->link[link_id],
621 lockdep_is_held(&local->hw.wiphy->mtx));
622 ieee80211_link_sta_debugfs_drv_add(link_sta);
623 }
624
625 return 0;
626 }
627