Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/net/mac80211/driver-ops.h
26295 views
1
/* SPDX-License-Identifier: GPL-2.0 */
2
/*
3
* Portions of this file
4
* Copyright(c) 2016 Intel Deutschland GmbH
5
* Copyright (C) 2018-2019, 2021-2025 Intel Corporation
6
*/
7
8
#ifndef __MAC80211_DRIVER_OPS
9
#define __MAC80211_DRIVER_OPS
10
11
#include <linux/fips.h>
12
#include <net/mac80211.h>
13
#include "ieee80211_i.h"
14
#include "trace.h"
15
16
#define check_sdata_in_driver(sdata) ({ \
17
WARN_ONCE(!sdata->local->reconfig_failure && \
18
!(sdata->flags & IEEE80211_SDATA_IN_DRIVER), \
19
"%s: Failed check-sdata-in-driver check, flags: 0x%x\n", \
20
sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); \
21
!!(sdata->flags & IEEE80211_SDATA_IN_DRIVER); \
22
})
23
24
static inline struct ieee80211_sub_if_data *
25
get_bss_sdata(struct ieee80211_sub_if_data *sdata)
26
{
27
if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
28
sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
29
u.ap);
30
31
return sdata;
32
}
33
34
static inline void drv_tx(struct ieee80211_local *local,
35
struct ieee80211_tx_control *control,
36
struct sk_buff *skb)
37
{
38
local->ops->tx(&local->hw, control, skb);
39
}
40
41
static inline void drv_sync_rx_queues(struct ieee80211_local *local,
42
struct sta_info *sta)
43
{
44
might_sleep();
45
lockdep_assert_wiphy(local->hw.wiphy);
46
47
if (local->ops->sync_rx_queues) {
48
trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
49
local->ops->sync_rx_queues(&local->hw);
50
trace_drv_return_void(local);
51
}
52
}
53
54
static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
55
u32 sset, u8 *data)
56
{
57
struct ieee80211_local *local = sdata->local;
58
if (local->ops->get_et_strings) {
59
trace_drv_get_et_strings(local, sset);
60
local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
61
trace_drv_return_void(local);
62
}
63
}
64
65
static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
66
struct ethtool_stats *stats,
67
u64 *data)
68
{
69
struct ieee80211_local *local = sdata->local;
70
if (local->ops->get_et_stats) {
71
trace_drv_get_et_stats(local);
72
local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
73
trace_drv_return_void(local);
74
}
75
}
76
77
static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
78
int sset)
79
{
80
struct ieee80211_local *local = sdata->local;
81
int rv = 0;
82
if (local->ops->get_et_sset_count) {
83
trace_drv_get_et_sset_count(local, sset);
84
rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
85
sset);
86
trace_drv_return_int(local, rv);
87
}
88
return rv;
89
}
90
91
int drv_start(struct ieee80211_local *local);
92
void drv_stop(struct ieee80211_local *local, bool suspend);
93
94
#ifdef CONFIG_PM
95
static inline int drv_suspend(struct ieee80211_local *local,
96
struct cfg80211_wowlan *wowlan)
97
{
98
int ret;
99
100
might_sleep();
101
lockdep_assert_wiphy(local->hw.wiphy);
102
103
trace_drv_suspend(local);
104
ret = local->ops->suspend(&local->hw, wowlan);
105
trace_drv_return_int(local, ret);
106
return ret;
107
}
108
109
static inline int drv_resume(struct ieee80211_local *local)
110
{
111
int ret;
112
113
might_sleep();
114
lockdep_assert_wiphy(local->hw.wiphy);
115
116
trace_drv_resume(local);
117
ret = local->ops->resume(&local->hw);
118
trace_drv_return_int(local, ret);
119
return ret;
120
}
121
122
static inline void drv_set_wakeup(struct ieee80211_local *local,
123
bool enabled)
124
{
125
might_sleep();
126
lockdep_assert_wiphy(local->hw.wiphy);
127
128
if (!local->ops->set_wakeup)
129
return;
130
131
trace_drv_set_wakeup(local, enabled);
132
local->ops->set_wakeup(&local->hw, enabled);
133
trace_drv_return_void(local);
134
}
135
#endif
136
137
int drv_add_interface(struct ieee80211_local *local,
138
struct ieee80211_sub_if_data *sdata);
139
140
int drv_change_interface(struct ieee80211_local *local,
141
struct ieee80211_sub_if_data *sdata,
142
enum nl80211_iftype type, bool p2p);
143
144
void drv_remove_interface(struct ieee80211_local *local,
145
struct ieee80211_sub_if_data *sdata);
146
147
static inline int drv_config(struct ieee80211_local *local, int radio_idx,
148
u32 changed)
149
{
150
int ret;
151
152
might_sleep();
153
lockdep_assert_wiphy(local->hw.wiphy);
154
155
trace_drv_config(local, radio_idx, changed);
156
ret = local->ops->config(&local->hw, radio_idx, changed);
157
trace_drv_return_int(local, ret);
158
return ret;
159
}
160
161
static inline void drv_vif_cfg_changed(struct ieee80211_local *local,
162
struct ieee80211_sub_if_data *sdata,
163
u64 changed)
164
{
165
might_sleep();
166
lockdep_assert_wiphy(local->hw.wiphy);
167
168
if (!check_sdata_in_driver(sdata))
169
return;
170
171
trace_drv_vif_cfg_changed(local, sdata, changed);
172
if (local->ops->vif_cfg_changed)
173
local->ops->vif_cfg_changed(&local->hw, &sdata->vif, changed);
174
else if (local->ops->bss_info_changed)
175
local->ops->bss_info_changed(&local->hw, &sdata->vif,
176
&sdata->vif.bss_conf, changed);
177
trace_drv_return_void(local);
178
}
179
180
void drv_link_info_changed(struct ieee80211_local *local,
181
struct ieee80211_sub_if_data *sdata,
182
struct ieee80211_bss_conf *info,
183
int link_id, u64 changed);
184
185
static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
186
struct netdev_hw_addr_list *mc_list)
187
{
188
u64 ret = 0;
189
190
trace_drv_prepare_multicast(local, mc_list->count);
191
192
if (local->ops->prepare_multicast)
193
ret = local->ops->prepare_multicast(&local->hw, mc_list);
194
195
trace_drv_return_u64(local, ret);
196
197
return ret;
198
}
199
200
static inline void drv_configure_filter(struct ieee80211_local *local,
201
unsigned int changed_flags,
202
unsigned int *total_flags,
203
u64 multicast)
204
{
205
might_sleep();
206
lockdep_assert_wiphy(local->hw.wiphy);
207
208
trace_drv_configure_filter(local, changed_flags, total_flags,
209
multicast);
210
local->ops->configure_filter(&local->hw, changed_flags, total_flags,
211
multicast);
212
trace_drv_return_void(local);
213
}
214
215
static inline void drv_config_iface_filter(struct ieee80211_local *local,
216
struct ieee80211_sub_if_data *sdata,
217
unsigned int filter_flags,
218
unsigned int changed_flags)
219
{
220
might_sleep();
221
lockdep_assert_wiphy(local->hw.wiphy);
222
223
trace_drv_config_iface_filter(local, sdata, filter_flags,
224
changed_flags);
225
if (local->ops->config_iface_filter)
226
local->ops->config_iface_filter(&local->hw, &sdata->vif,
227
filter_flags,
228
changed_flags);
229
trace_drv_return_void(local);
230
}
231
232
static inline int drv_set_tim(struct ieee80211_local *local,
233
struct ieee80211_sta *sta, bool set)
234
{
235
int ret = 0;
236
trace_drv_set_tim(local, sta, set);
237
if (local->ops->set_tim)
238
ret = local->ops->set_tim(&local->hw, sta, set);
239
trace_drv_return_int(local, ret);
240
return ret;
241
}
242
243
int drv_set_key(struct ieee80211_local *local,
244
enum set_key_cmd cmd,
245
struct ieee80211_sub_if_data *sdata,
246
struct ieee80211_sta *sta,
247
struct ieee80211_key_conf *key);
248
249
static inline void drv_update_tkip_key(struct ieee80211_local *local,
250
struct ieee80211_sub_if_data *sdata,
251
struct ieee80211_key_conf *conf,
252
struct sta_info *sta, u32 iv32,
253
u16 *phase1key)
254
{
255
struct ieee80211_sta *ista = NULL;
256
257
if (sta)
258
ista = &sta->sta;
259
260
sdata = get_bss_sdata(sdata);
261
if (!check_sdata_in_driver(sdata))
262
return;
263
264
trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
265
if (local->ops->update_tkip_key)
266
local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
267
ista, iv32, phase1key);
268
trace_drv_return_void(local);
269
}
270
271
static inline int drv_hw_scan(struct ieee80211_local *local,
272
struct ieee80211_sub_if_data *sdata,
273
struct ieee80211_scan_request *req)
274
{
275
int ret;
276
277
might_sleep();
278
lockdep_assert_wiphy(local->hw.wiphy);
279
280
if (!check_sdata_in_driver(sdata))
281
return -EIO;
282
283
trace_drv_hw_scan(local, sdata);
284
ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
285
trace_drv_return_int(local, ret);
286
return ret;
287
}
288
289
static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
290
struct ieee80211_sub_if_data *sdata)
291
{
292
might_sleep();
293
lockdep_assert_wiphy(local->hw.wiphy);
294
295
if (!check_sdata_in_driver(sdata))
296
return;
297
298
trace_drv_cancel_hw_scan(local, sdata);
299
local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
300
trace_drv_return_void(local);
301
}
302
303
static inline int
304
drv_sched_scan_start(struct ieee80211_local *local,
305
struct ieee80211_sub_if_data *sdata,
306
struct cfg80211_sched_scan_request *req,
307
struct ieee80211_scan_ies *ies)
308
{
309
int ret;
310
311
might_sleep();
312
lockdep_assert_wiphy(local->hw.wiphy);
313
314
if (!check_sdata_in_driver(sdata))
315
return -EIO;
316
317
trace_drv_sched_scan_start(local, sdata);
318
ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
319
req, ies);
320
trace_drv_return_int(local, ret);
321
return ret;
322
}
323
324
static inline int drv_sched_scan_stop(struct ieee80211_local *local,
325
struct ieee80211_sub_if_data *sdata)
326
{
327
int ret;
328
329
might_sleep();
330
lockdep_assert_wiphy(local->hw.wiphy);
331
332
if (!check_sdata_in_driver(sdata))
333
return -EIO;
334
335
trace_drv_sched_scan_stop(local, sdata);
336
ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
337
trace_drv_return_int(local, ret);
338
339
return ret;
340
}
341
342
static inline void drv_sw_scan_start(struct ieee80211_local *local,
343
struct ieee80211_sub_if_data *sdata,
344
const u8 *mac_addr)
345
{
346
might_sleep();
347
lockdep_assert_wiphy(local->hw.wiphy);
348
349
trace_drv_sw_scan_start(local, sdata, mac_addr);
350
if (local->ops->sw_scan_start)
351
local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
352
trace_drv_return_void(local);
353
}
354
355
static inline void drv_sw_scan_complete(struct ieee80211_local *local,
356
struct ieee80211_sub_if_data *sdata)
357
{
358
might_sleep();
359
lockdep_assert_wiphy(local->hw.wiphy);
360
361
trace_drv_sw_scan_complete(local, sdata);
362
if (local->ops->sw_scan_complete)
363
local->ops->sw_scan_complete(&local->hw, &sdata->vif);
364
trace_drv_return_void(local);
365
}
366
367
static inline int drv_get_stats(struct ieee80211_local *local,
368
struct ieee80211_low_level_stats *stats)
369
{
370
int ret = -EOPNOTSUPP;
371
372
might_sleep();
373
lockdep_assert_wiphy(local->hw.wiphy);
374
375
if (local->ops->get_stats)
376
ret = local->ops->get_stats(&local->hw, stats);
377
trace_drv_get_stats(local, stats, ret);
378
379
return ret;
380
}
381
382
static inline void drv_get_key_seq(struct ieee80211_local *local,
383
struct ieee80211_key *key,
384
struct ieee80211_key_seq *seq)
385
{
386
if (local->ops->get_key_seq)
387
local->ops->get_key_seq(&local->hw, &key->conf, seq);
388
trace_drv_get_key_seq(local, &key->conf);
389
}
390
391
static inline int drv_set_frag_threshold(struct ieee80211_local *local,
392
int radio_idx, u32 value)
393
{
394
int ret = 0;
395
396
might_sleep();
397
lockdep_assert_wiphy(local->hw.wiphy);
398
399
trace_drv_set_frag_threshold(local, radio_idx, value);
400
if (local->ops->set_frag_threshold)
401
ret = local->ops->set_frag_threshold(&local->hw, radio_idx,
402
value);
403
trace_drv_return_int(local, ret);
404
return ret;
405
}
406
407
static inline int drv_set_rts_threshold(struct ieee80211_local *local,
408
int radio_idx, u32 value)
409
{
410
int ret = 0;
411
412
might_sleep();
413
lockdep_assert_wiphy(local->hw.wiphy);
414
415
trace_drv_set_rts_threshold(local, radio_idx, value);
416
if (local->ops->set_rts_threshold)
417
ret = local->ops->set_rts_threshold(&local->hw, radio_idx,
418
value);
419
trace_drv_return_int(local, ret);
420
return ret;
421
}
422
423
static inline int drv_set_coverage_class(struct ieee80211_local *local,
424
int radio_idx, s16 value)
425
{
426
int ret = 0;
427
might_sleep();
428
lockdep_assert_wiphy(local->hw.wiphy);
429
430
trace_drv_set_coverage_class(local, radio_idx, value);
431
if (local->ops->set_coverage_class)
432
local->ops->set_coverage_class(&local->hw, radio_idx, value);
433
else
434
ret = -EOPNOTSUPP;
435
436
trace_drv_return_int(local, ret);
437
return ret;
438
}
439
440
static inline void drv_sta_notify(struct ieee80211_local *local,
441
struct ieee80211_sub_if_data *sdata,
442
enum sta_notify_cmd cmd,
443
struct ieee80211_sta *sta)
444
{
445
sdata = get_bss_sdata(sdata);
446
if (!check_sdata_in_driver(sdata))
447
return;
448
449
trace_drv_sta_notify(local, sdata, cmd, sta);
450
if (local->ops->sta_notify)
451
local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
452
trace_drv_return_void(local);
453
}
454
455
static inline int drv_sta_add(struct ieee80211_local *local,
456
struct ieee80211_sub_if_data *sdata,
457
struct ieee80211_sta *sta)
458
{
459
int ret = 0;
460
461
might_sleep();
462
lockdep_assert_wiphy(local->hw.wiphy);
463
464
sdata = get_bss_sdata(sdata);
465
if (!check_sdata_in_driver(sdata))
466
return -EIO;
467
468
trace_drv_sta_add(local, sdata, sta);
469
if (local->ops->sta_add)
470
ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
471
472
trace_drv_return_int(local, ret);
473
474
return ret;
475
}
476
477
static inline void drv_sta_remove(struct ieee80211_local *local,
478
struct ieee80211_sub_if_data *sdata,
479
struct ieee80211_sta *sta)
480
{
481
might_sleep();
482
lockdep_assert_wiphy(local->hw.wiphy);
483
484
sdata = get_bss_sdata(sdata);
485
if (!check_sdata_in_driver(sdata))
486
return;
487
488
trace_drv_sta_remove(local, sdata, sta);
489
if (local->ops->sta_remove)
490
local->ops->sta_remove(&local->hw, &sdata->vif, sta);
491
492
trace_drv_return_void(local);
493
}
494
495
#ifdef CONFIG_MAC80211_DEBUGFS
496
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
497
struct ieee80211_sub_if_data *sdata)
498
{
499
might_sleep();
500
501
if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
502
WARN_ON(!sdata->vif.debugfs_dir))
503
return;
504
505
sdata = get_bss_sdata(sdata);
506
if (!check_sdata_in_driver(sdata))
507
return;
508
509
if (local->ops->vif_add_debugfs)
510
local->ops->vif_add_debugfs(&local->hw, &sdata->vif);
511
}
512
513
static inline void drv_link_add_debugfs(struct ieee80211_local *local,
514
struct ieee80211_sub_if_data *sdata,
515
struct ieee80211_bss_conf *link_conf,
516
struct dentry *dir)
517
{
518
might_sleep();
519
lockdep_assert_wiphy(local->hw.wiphy);
520
521
sdata = get_bss_sdata(sdata);
522
if (!check_sdata_in_driver(sdata))
523
return;
524
525
if (local->ops->link_add_debugfs)
526
local->ops->link_add_debugfs(&local->hw, &sdata->vif,
527
link_conf, dir);
528
}
529
530
static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
531
struct ieee80211_sub_if_data *sdata,
532
struct ieee80211_sta *sta,
533
struct dentry *dir)
534
{
535
might_sleep();
536
lockdep_assert_wiphy(local->hw.wiphy);
537
538
sdata = get_bss_sdata(sdata);
539
if (!check_sdata_in_driver(sdata))
540
return;
541
542
if (local->ops->sta_add_debugfs)
543
local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
544
sta, dir);
545
}
546
547
static inline void drv_link_sta_add_debugfs(struct ieee80211_local *local,
548
struct ieee80211_sub_if_data *sdata,
549
struct ieee80211_link_sta *link_sta,
550
struct dentry *dir)
551
{
552
might_sleep();
553
lockdep_assert_wiphy(local->hw.wiphy);
554
555
sdata = get_bss_sdata(sdata);
556
if (!check_sdata_in_driver(sdata))
557
return;
558
559
if (local->ops->link_sta_add_debugfs)
560
local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif,
561
link_sta, dir);
562
}
563
#else
564
static inline void drv_vif_add_debugfs(struct ieee80211_local *local,
565
struct ieee80211_sub_if_data *sdata)
566
{
567
might_sleep();
568
}
569
#endif
570
571
static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
572
struct ieee80211_sub_if_data *sdata,
573
struct sta_info *sta)
574
{
575
might_sleep();
576
lockdep_assert_wiphy(local->hw.wiphy);
577
578
sdata = get_bss_sdata(sdata);
579
if (!check_sdata_in_driver(sdata))
580
return;
581
582
trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
583
if (local->ops->sta_pre_rcu_remove)
584
local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
585
&sta->sta);
586
trace_drv_return_void(local);
587
}
588
589
__must_check
590
int drv_sta_state(struct ieee80211_local *local,
591
struct ieee80211_sub_if_data *sdata,
592
struct sta_info *sta,
593
enum ieee80211_sta_state old_state,
594
enum ieee80211_sta_state new_state);
595
596
__must_check
597
int drv_sta_set_txpwr(struct ieee80211_local *local,
598
struct ieee80211_sub_if_data *sdata,
599
struct sta_info *sta);
600
601
void drv_link_sta_rc_update(struct ieee80211_local *local,
602
struct ieee80211_sub_if_data *sdata,
603
struct ieee80211_link_sta *link_sta, u32 changed);
604
605
static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
606
struct ieee80211_sub_if_data *sdata,
607
struct ieee80211_sta *sta)
608
{
609
sdata = get_bss_sdata(sdata);
610
if (!check_sdata_in_driver(sdata))
611
return;
612
613
trace_drv_sta_rate_tbl_update(local, sdata, sta);
614
if (local->ops->sta_rate_tbl_update)
615
local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
616
617
trace_drv_return_void(local);
618
}
619
620
static inline void drv_sta_statistics(struct ieee80211_local *local,
621
struct ieee80211_sub_if_data *sdata,
622
struct ieee80211_sta *sta,
623
struct station_info *sinfo)
624
{
625
might_sleep();
626
lockdep_assert_wiphy(local->hw.wiphy);
627
628
sdata = get_bss_sdata(sdata);
629
if (!check_sdata_in_driver(sdata))
630
return;
631
632
trace_drv_sta_statistics(local, sdata, sta);
633
if (local->ops->sta_statistics)
634
local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
635
trace_drv_return_void(local);
636
}
637
638
static inline void drv_link_sta_statistics(struct ieee80211_local *local,
639
struct ieee80211_sub_if_data *sdata,
640
struct ieee80211_link_sta *link_sta,
641
struct link_station_info *link_sinfo)
642
{
643
might_sleep();
644
lockdep_assert_wiphy(local->hw.wiphy);
645
646
sdata = get_bss_sdata(sdata);
647
if (!check_sdata_in_driver(sdata))
648
return;
649
650
trace_drv_link_sta_statistics(local, sdata, link_sta);
651
if (local->ops->link_sta_statistics)
652
local->ops->link_sta_statistics(&local->hw, &sdata->vif,
653
link_sta, link_sinfo);
654
trace_drv_return_void(local);
655
}
656
657
int drv_conf_tx(struct ieee80211_local *local,
658
struct ieee80211_link_data *link, u16 ac,
659
const struct ieee80211_tx_queue_params *params);
660
661
u64 drv_get_tsf(struct ieee80211_local *local,
662
struct ieee80211_sub_if_data *sdata);
663
void drv_set_tsf(struct ieee80211_local *local,
664
struct ieee80211_sub_if_data *sdata,
665
u64 tsf);
666
void drv_offset_tsf(struct ieee80211_local *local,
667
struct ieee80211_sub_if_data *sdata,
668
s64 offset);
669
void drv_reset_tsf(struct ieee80211_local *local,
670
struct ieee80211_sub_if_data *sdata);
671
672
static inline int drv_tx_last_beacon(struct ieee80211_local *local)
673
{
674
int ret = 0; /* default unsupported op for less congestion */
675
676
might_sleep();
677
lockdep_assert_wiphy(local->hw.wiphy);
678
679
trace_drv_tx_last_beacon(local);
680
if (local->ops->tx_last_beacon)
681
ret = local->ops->tx_last_beacon(&local->hw);
682
trace_drv_return_int(local, ret);
683
return ret;
684
}
685
686
int drv_ampdu_action(struct ieee80211_local *local,
687
struct ieee80211_sub_if_data *sdata,
688
struct ieee80211_ampdu_params *params);
689
690
static inline int drv_get_survey(struct ieee80211_local *local, int idx,
691
struct survey_info *survey)
692
{
693
int ret = -EOPNOTSUPP;
694
695
might_sleep();
696
lockdep_assert_wiphy(local->hw.wiphy);
697
698
trace_drv_get_survey(local, idx, survey);
699
700
if (local->ops->get_survey)
701
ret = local->ops->get_survey(&local->hw, idx, survey);
702
703
trace_drv_return_int(local, ret);
704
705
return ret;
706
}
707
708
static inline void drv_rfkill_poll(struct ieee80211_local *local)
709
{
710
might_sleep();
711
lockdep_assert_wiphy(local->hw.wiphy);
712
713
if (local->ops->rfkill_poll)
714
local->ops->rfkill_poll(&local->hw);
715
}
716
717
static inline void drv_flush(struct ieee80211_local *local,
718
struct ieee80211_sub_if_data *sdata,
719
u32 queues, bool drop)
720
{
721
struct ieee80211_vif *vif;
722
723
might_sleep();
724
lockdep_assert_wiphy(local->hw.wiphy);
725
726
sdata = get_bss_sdata(sdata);
727
vif = sdata ? &sdata->vif : NULL;
728
729
if (sdata && !check_sdata_in_driver(sdata))
730
return;
731
732
trace_drv_flush(local, queues, drop);
733
if (local->ops->flush)
734
local->ops->flush(&local->hw, vif, queues, drop);
735
trace_drv_return_void(local);
736
}
737
738
static inline void drv_flush_sta(struct ieee80211_local *local,
739
struct ieee80211_sub_if_data *sdata,
740
struct sta_info *sta)
741
{
742
might_sleep();
743
lockdep_assert_wiphy(local->hw.wiphy);
744
745
sdata = get_bss_sdata(sdata);
746
747
if (sdata && !check_sdata_in_driver(sdata))
748
return;
749
750
if (!sta->uploaded)
751
return;
752
753
trace_drv_flush_sta(local, sdata, &sta->sta);
754
if (local->ops->flush_sta)
755
local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta);
756
trace_drv_return_void(local);
757
}
758
759
static inline void drv_channel_switch(struct ieee80211_local *local,
760
struct ieee80211_sub_if_data *sdata,
761
struct ieee80211_channel_switch *ch_switch)
762
{
763
might_sleep();
764
lockdep_assert_wiphy(local->hw.wiphy);
765
766
trace_drv_channel_switch(local, sdata, ch_switch);
767
local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
768
trace_drv_return_void(local);
769
}
770
771
772
static inline int drv_set_antenna(struct ieee80211_local *local,
773
u32 tx_ant, u32 rx_ant)
774
{
775
int ret = -EOPNOTSUPP;
776
might_sleep();
777
lockdep_assert_wiphy(local->hw.wiphy);
778
if (local->ops->set_antenna)
779
ret = local->ops->set_antenna(&local->hw, -1, tx_ant, rx_ant);
780
trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
781
return ret;
782
}
783
784
static inline int drv_get_antenna(struct ieee80211_local *local, int radio_idx,
785
u32 *tx_ant, u32 *rx_ant)
786
{
787
int ret = -EOPNOTSUPP;
788
might_sleep();
789
lockdep_assert_wiphy(local->hw.wiphy);
790
if (local->ops->get_antenna)
791
ret = local->ops->get_antenna(&local->hw, radio_idx,
792
tx_ant, rx_ant);
793
trace_drv_get_antenna(local, radio_idx, *tx_ant, *rx_ant, ret);
794
return ret;
795
}
796
797
static inline int drv_remain_on_channel(struct ieee80211_local *local,
798
struct ieee80211_sub_if_data *sdata,
799
struct ieee80211_channel *chan,
800
unsigned int duration,
801
enum ieee80211_roc_type type)
802
{
803
int ret;
804
805
might_sleep();
806
lockdep_assert_wiphy(local->hw.wiphy);
807
808
trace_drv_remain_on_channel(local, sdata, chan, duration, type);
809
ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
810
chan, duration, type);
811
trace_drv_return_int(local, ret);
812
813
return ret;
814
}
815
816
static inline int
817
drv_cancel_remain_on_channel(struct ieee80211_local *local,
818
struct ieee80211_sub_if_data *sdata)
819
{
820
int ret;
821
822
might_sleep();
823
lockdep_assert_wiphy(local->hw.wiphy);
824
825
trace_drv_cancel_remain_on_channel(local, sdata);
826
ret = local->ops->cancel_remain_on_channel(&local->hw, &sdata->vif);
827
trace_drv_return_int(local, ret);
828
829
return ret;
830
}
831
832
static inline int drv_set_ringparam(struct ieee80211_local *local,
833
u32 tx, u32 rx)
834
{
835
int ret = -EOPNOTSUPP;
836
837
might_sleep();
838
lockdep_assert_wiphy(local->hw.wiphy);
839
840
trace_drv_set_ringparam(local, tx, rx);
841
if (local->ops->set_ringparam)
842
ret = local->ops->set_ringparam(&local->hw, tx, rx);
843
trace_drv_return_int(local, ret);
844
845
return ret;
846
}
847
848
static inline void drv_get_ringparam(struct ieee80211_local *local,
849
u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
850
{
851
might_sleep();
852
lockdep_assert_wiphy(local->hw.wiphy);
853
854
trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
855
if (local->ops->get_ringparam)
856
local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
857
trace_drv_return_void(local);
858
}
859
860
static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
861
{
862
bool ret = false;
863
864
might_sleep();
865
lockdep_assert_wiphy(local->hw.wiphy);
866
867
trace_drv_tx_frames_pending(local);
868
if (local->ops->tx_frames_pending)
869
ret = local->ops->tx_frames_pending(&local->hw);
870
trace_drv_return_bool(local, ret);
871
872
return ret;
873
}
874
875
static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
876
struct ieee80211_sub_if_data *sdata,
877
const struct cfg80211_bitrate_mask *mask)
878
{
879
int ret = -EOPNOTSUPP;
880
881
might_sleep();
882
lockdep_assert_wiphy(local->hw.wiphy);
883
884
if (!check_sdata_in_driver(sdata))
885
return -EIO;
886
887
trace_drv_set_bitrate_mask(local, sdata, mask);
888
if (local->ops->set_bitrate_mask)
889
ret = local->ops->set_bitrate_mask(&local->hw,
890
&sdata->vif, mask);
891
trace_drv_return_int(local, ret);
892
893
return ret;
894
}
895
896
static inline void drv_set_rekey_data(struct ieee80211_local *local,
897
struct ieee80211_sub_if_data *sdata,
898
struct cfg80211_gtk_rekey_data *data)
899
{
900
might_sleep();
901
lockdep_assert_wiphy(local->hw.wiphy);
902
903
if (!check_sdata_in_driver(sdata))
904
return;
905
906
if (fips_enabled)
907
return;
908
909
trace_drv_set_rekey_data(local, sdata, data);
910
if (local->ops->set_rekey_data)
911
local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
912
trace_drv_return_void(local);
913
}
914
915
static inline void drv_event_callback(struct ieee80211_local *local,
916
struct ieee80211_sub_if_data *sdata,
917
const struct ieee80211_event *event)
918
{
919
trace_drv_event_callback(local, sdata, event);
920
if (local->ops->event_callback)
921
local->ops->event_callback(&local->hw, &sdata->vif, event);
922
trace_drv_return_void(local);
923
}
924
925
static inline void
926
drv_release_buffered_frames(struct ieee80211_local *local,
927
struct sta_info *sta, u16 tids, int num_frames,
928
enum ieee80211_frame_release_type reason,
929
bool more_data)
930
{
931
trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
932
reason, more_data);
933
if (local->ops->release_buffered_frames)
934
local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
935
num_frames, reason,
936
more_data);
937
trace_drv_return_void(local);
938
}
939
940
static inline void
941
drv_allow_buffered_frames(struct ieee80211_local *local,
942
struct sta_info *sta, u16 tids, int num_frames,
943
enum ieee80211_frame_release_type reason,
944
bool more_data)
945
{
946
trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
947
reason, more_data);
948
if (local->ops->allow_buffered_frames)
949
local->ops->allow_buffered_frames(&local->hw, &sta->sta,
950
tids, num_frames, reason,
951
more_data);
952
trace_drv_return_void(local);
953
}
954
955
static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
956
struct ieee80211_sub_if_data *sdata,
957
struct ieee80211_prep_tx_info *info)
958
{
959
might_sleep();
960
lockdep_assert_wiphy(local->hw.wiphy);
961
962
if (!check_sdata_in_driver(sdata))
963
return;
964
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
965
966
info->link_id = info->link_id < 0 ? 0 : info->link_id;
967
trace_drv_mgd_prepare_tx(local, sdata, info->duration,
968
info->subtype, info->success);
969
if (local->ops->mgd_prepare_tx)
970
local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, info);
971
trace_drv_return_void(local);
972
}
973
974
static inline void drv_mgd_complete_tx(struct ieee80211_local *local,
975
struct ieee80211_sub_if_data *sdata,
976
struct ieee80211_prep_tx_info *info)
977
{
978
might_sleep();
979
lockdep_assert_wiphy(local->hw.wiphy);
980
981
if (!check_sdata_in_driver(sdata))
982
return;
983
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
984
985
info->link_id = info->link_id < 0 ? 0 : info->link_id;
986
trace_drv_mgd_complete_tx(local, sdata, info->duration,
987
info->subtype, info->success);
988
if (local->ops->mgd_complete_tx)
989
local->ops->mgd_complete_tx(&local->hw, &sdata->vif, info);
990
trace_drv_return_void(local);
991
}
992
993
static inline void
994
drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
995
struct ieee80211_sub_if_data *sdata,
996
int link_id)
997
{
998
might_sleep();
999
lockdep_assert_wiphy(local->hw.wiphy);
1000
1001
if (!check_sdata_in_driver(sdata))
1002
return;
1003
WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
1004
1005
link_id = link_id > 0 ? link_id : 0;
1006
1007
trace_drv_mgd_protect_tdls_discover(local, sdata);
1008
if (local->ops->mgd_protect_tdls_discover)
1009
local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif,
1010
link_id);
1011
trace_drv_return_void(local);
1012
}
1013
1014
static inline int drv_add_chanctx(struct ieee80211_local *local,
1015
struct ieee80211_chanctx *ctx)
1016
{
1017
int ret = -EOPNOTSUPP;
1018
1019
might_sleep();
1020
lockdep_assert_wiphy(local->hw.wiphy);
1021
1022
trace_drv_add_chanctx(local, ctx);
1023
if (local->ops->add_chanctx)
1024
ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
1025
trace_drv_return_int(local, ret);
1026
if (!ret)
1027
ctx->driver_present = true;
1028
1029
return ret;
1030
}
1031
1032
static inline void drv_remove_chanctx(struct ieee80211_local *local,
1033
struct ieee80211_chanctx *ctx)
1034
{
1035
might_sleep();
1036
lockdep_assert_wiphy(local->hw.wiphy);
1037
1038
if (WARN_ON(!ctx->driver_present))
1039
return;
1040
1041
trace_drv_remove_chanctx(local, ctx);
1042
if (local->ops->remove_chanctx)
1043
local->ops->remove_chanctx(&local->hw, &ctx->conf);
1044
trace_drv_return_void(local);
1045
ctx->driver_present = false;
1046
}
1047
1048
static inline void drv_change_chanctx(struct ieee80211_local *local,
1049
struct ieee80211_chanctx *ctx,
1050
u32 changed)
1051
{
1052
might_sleep();
1053
lockdep_assert_wiphy(local->hw.wiphy);
1054
1055
trace_drv_change_chanctx(local, ctx, changed);
1056
if (local->ops->change_chanctx) {
1057
WARN_ON_ONCE(!ctx->driver_present);
1058
local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
1059
}
1060
trace_drv_return_void(local);
1061
}
1062
1063
int drv_assign_vif_chanctx(struct ieee80211_local *local,
1064
struct ieee80211_sub_if_data *sdata,
1065
struct ieee80211_bss_conf *link_conf,
1066
struct ieee80211_chanctx *ctx);
1067
void drv_unassign_vif_chanctx(struct ieee80211_local *local,
1068
struct ieee80211_sub_if_data *sdata,
1069
struct ieee80211_bss_conf *link_conf,
1070
struct ieee80211_chanctx *ctx);
1071
int drv_switch_vif_chanctx(struct ieee80211_local *local,
1072
struct ieee80211_vif_chanctx_switch *vifs,
1073
int n_vifs, enum ieee80211_chanctx_switch_mode mode);
1074
1075
static inline int drv_start_ap(struct ieee80211_local *local,
1076
struct ieee80211_sub_if_data *sdata,
1077
struct ieee80211_bss_conf *link_conf)
1078
{
1079
int ret = 0;
1080
1081
might_sleep();
1082
lockdep_assert_wiphy(local->hw.wiphy);
1083
1084
if (!check_sdata_in_driver(sdata))
1085
return -EIO;
1086
1087
trace_drv_start_ap(local, sdata, link_conf);
1088
if (local->ops->start_ap)
1089
ret = local->ops->start_ap(&local->hw, &sdata->vif, link_conf);
1090
trace_drv_return_int(local, ret);
1091
return ret;
1092
}
1093
1094
static inline void drv_stop_ap(struct ieee80211_local *local,
1095
struct ieee80211_sub_if_data *sdata,
1096
struct ieee80211_bss_conf *link_conf)
1097
{
1098
might_sleep();
1099
lockdep_assert_wiphy(local->hw.wiphy);
1100
1101
if (!check_sdata_in_driver(sdata))
1102
return;
1103
1104
trace_drv_stop_ap(local, sdata, link_conf);
1105
if (local->ops->stop_ap)
1106
local->ops->stop_ap(&local->hw, &sdata->vif, link_conf);
1107
trace_drv_return_void(local);
1108
}
1109
1110
static inline void
1111
drv_reconfig_complete(struct ieee80211_local *local,
1112
enum ieee80211_reconfig_type reconfig_type)
1113
{
1114
might_sleep();
1115
lockdep_assert_wiphy(local->hw.wiphy);
1116
1117
trace_drv_reconfig_complete(local, reconfig_type);
1118
if (local->ops->reconfig_complete)
1119
local->ops->reconfig_complete(&local->hw, reconfig_type);
1120
trace_drv_return_void(local);
1121
}
1122
1123
static inline void
1124
drv_set_default_unicast_key(struct ieee80211_local *local,
1125
struct ieee80211_sub_if_data *sdata,
1126
int key_idx)
1127
{
1128
might_sleep();
1129
lockdep_assert_wiphy(local->hw.wiphy);
1130
1131
if (!check_sdata_in_driver(sdata))
1132
return;
1133
1134
WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
1135
1136
trace_drv_set_default_unicast_key(local, sdata, key_idx);
1137
if (local->ops->set_default_unicast_key)
1138
local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
1139
key_idx);
1140
trace_drv_return_void(local);
1141
}
1142
1143
#if IS_ENABLED(CONFIG_IPV6)
1144
static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
1145
struct ieee80211_sub_if_data *sdata,
1146
struct inet6_dev *idev)
1147
{
1148
trace_drv_ipv6_addr_change(local, sdata);
1149
if (local->ops->ipv6_addr_change)
1150
local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1151
trace_drv_return_void(local);
1152
}
1153
#endif
1154
1155
static inline void
1156
drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
1157
struct cfg80211_chan_def *chandef)
1158
{
1159
struct ieee80211_local *local = sdata->local;
1160
1161
might_sleep();
1162
lockdep_assert_wiphy(local->hw.wiphy);
1163
1164
if (local->ops->channel_switch_beacon) {
1165
trace_drv_channel_switch_beacon(local, sdata, chandef);
1166
local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
1167
chandef);
1168
}
1169
}
1170
1171
static inline int
1172
drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
1173
struct ieee80211_channel_switch *ch_switch)
1174
{
1175
struct ieee80211_local *local = sdata->local;
1176
int ret = 0;
1177
1178
might_sleep();
1179
lockdep_assert_wiphy(local->hw.wiphy);
1180
1181
if (!check_sdata_in_driver(sdata))
1182
return -EIO;
1183
1184
if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id))
1185
return 0;
1186
1187
trace_drv_pre_channel_switch(local, sdata, ch_switch);
1188
if (local->ops->pre_channel_switch)
1189
ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
1190
ch_switch);
1191
trace_drv_return_int(local, ret);
1192
return ret;
1193
}
1194
1195
static inline int
1196
drv_post_channel_switch(struct ieee80211_link_data *link)
1197
{
1198
struct ieee80211_sub_if_data *sdata = link->sdata;
1199
struct ieee80211_local *local = sdata->local;
1200
int ret = 0;
1201
1202
might_sleep();
1203
lockdep_assert_wiphy(local->hw.wiphy);
1204
1205
if (!check_sdata_in_driver(sdata))
1206
return -EIO;
1207
1208
if (!ieee80211_vif_link_active(&sdata->vif, link->link_id))
1209
return 0;
1210
1211
trace_drv_post_channel_switch(local, sdata);
1212
if (local->ops->post_channel_switch)
1213
ret = local->ops->post_channel_switch(&local->hw, &sdata->vif,
1214
link->conf);
1215
trace_drv_return_int(local, ret);
1216
return ret;
1217
}
1218
1219
static inline void
1220
drv_abort_channel_switch(struct ieee80211_link_data *link)
1221
{
1222
struct ieee80211_sub_if_data *sdata = link->sdata;
1223
struct ieee80211_local *local = sdata->local;
1224
1225
might_sleep();
1226
lockdep_assert_wiphy(local->hw.wiphy);
1227
1228
if (!check_sdata_in_driver(sdata))
1229
return;
1230
1231
if (!ieee80211_vif_link_active(&sdata->vif, link->link_id))
1232
return;
1233
1234
trace_drv_abort_channel_switch(local, sdata);
1235
1236
if (local->ops->abort_channel_switch)
1237
local->ops->abort_channel_switch(&local->hw, &sdata->vif,
1238
link->conf);
1239
}
1240
1241
static inline void
1242
drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
1243
struct ieee80211_channel_switch *ch_switch)
1244
{
1245
struct ieee80211_local *local = sdata->local;
1246
1247
might_sleep();
1248
lockdep_assert_wiphy(local->hw.wiphy);
1249
1250
if (!check_sdata_in_driver(sdata))
1251
return;
1252
1253
if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id))
1254
return;
1255
1256
trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch);
1257
if (local->ops->channel_switch_rx_beacon)
1258
local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif,
1259
ch_switch);
1260
}
1261
1262
static inline int drv_join_ibss(struct ieee80211_local *local,
1263
struct ieee80211_sub_if_data *sdata)
1264
{
1265
int ret = 0;
1266
1267
might_sleep();
1268
lockdep_assert_wiphy(local->hw.wiphy);
1269
if (!check_sdata_in_driver(sdata))
1270
return -EIO;
1271
1272
trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
1273
if (local->ops->join_ibss)
1274
ret = local->ops->join_ibss(&local->hw, &sdata->vif);
1275
trace_drv_return_int(local, ret);
1276
return ret;
1277
}
1278
1279
static inline void drv_leave_ibss(struct ieee80211_local *local,
1280
struct ieee80211_sub_if_data *sdata)
1281
{
1282
might_sleep();
1283
lockdep_assert_wiphy(local->hw.wiphy);
1284
if (!check_sdata_in_driver(sdata))
1285
return;
1286
1287
trace_drv_leave_ibss(local, sdata);
1288
if (local->ops->leave_ibss)
1289
local->ops->leave_ibss(&local->hw, &sdata->vif);
1290
trace_drv_return_void(local);
1291
}
1292
1293
static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
1294
struct sta_info *sta)
1295
{
1296
u32 ret = 0;
1297
1298
trace_drv_get_expected_throughput(&sta->sta);
1299
if (local->ops->get_expected_throughput && sta->uploaded)
1300
ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
1301
trace_drv_return_u32(local, ret);
1302
1303
return ret;
1304
}
1305
1306
static inline int drv_get_txpower(struct ieee80211_local *local,
1307
struct ieee80211_sub_if_data *sdata,
1308
unsigned int link_id, int *dbm)
1309
{
1310
int ret;
1311
1312
might_sleep();
1313
lockdep_assert_wiphy(local->hw.wiphy);
1314
1315
if (!local->ops->get_txpower)
1316
return -EOPNOTSUPP;
1317
1318
ret = local->ops->get_txpower(&local->hw, &sdata->vif, link_id, dbm);
1319
trace_drv_get_txpower(local, sdata, link_id, *dbm, ret);
1320
1321
return ret;
1322
}
1323
1324
static inline int
1325
drv_tdls_channel_switch(struct ieee80211_local *local,
1326
struct ieee80211_sub_if_data *sdata,
1327
struct ieee80211_sta *sta, u8 oper_class,
1328
struct cfg80211_chan_def *chandef,
1329
struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
1330
{
1331
int ret;
1332
1333
might_sleep();
1334
lockdep_assert_wiphy(local->hw.wiphy);
1335
if (!check_sdata_in_driver(sdata))
1336
return -EIO;
1337
1338
if (!local->ops->tdls_channel_switch)
1339
return -EOPNOTSUPP;
1340
1341
trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
1342
ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
1343
oper_class, chandef, tmpl_skb,
1344
ch_sw_tm_ie);
1345
trace_drv_return_int(local, ret);
1346
return ret;
1347
}
1348
1349
static inline void
1350
drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
1351
struct ieee80211_sub_if_data *sdata,
1352
struct ieee80211_sta *sta)
1353
{
1354
might_sleep();
1355
lockdep_assert_wiphy(local->hw.wiphy);
1356
if (!check_sdata_in_driver(sdata))
1357
return;
1358
1359
if (!local->ops->tdls_cancel_channel_switch)
1360
return;
1361
1362
trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
1363
local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
1364
trace_drv_return_void(local);
1365
}
1366
1367
static inline void
1368
drv_tdls_recv_channel_switch(struct ieee80211_local *local,
1369
struct ieee80211_sub_if_data *sdata,
1370
struct ieee80211_tdls_ch_sw_params *params)
1371
{
1372
trace_drv_tdls_recv_channel_switch(local, sdata, params);
1373
if (local->ops->tdls_recv_channel_switch)
1374
local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
1375
params);
1376
trace_drv_return_void(local);
1377
}
1378
1379
static inline void drv_wake_tx_queue(struct ieee80211_local *local,
1380
struct txq_info *txq)
1381
{
1382
struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
1383
1384
/* In reconfig don't transmit now, but mark for waking later */
1385
if (local->in_reconfig) {
1386
set_bit(IEEE80211_TXQ_DIRTY, &txq->flags);
1387
return;
1388
}
1389
1390
if (!check_sdata_in_driver(sdata))
1391
return;
1392
1393
trace_drv_wake_tx_queue(local, sdata, txq);
1394
local->ops->wake_tx_queue(&local->hw, &txq->txq);
1395
}
1396
1397
static inline void schedule_and_wake_txq(struct ieee80211_local *local,
1398
struct txq_info *txqi)
1399
{
1400
ieee80211_schedule_txq(&local->hw, &txqi->txq);
1401
drv_wake_tx_queue(local, txqi);
1402
}
1403
1404
static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
1405
struct sk_buff *head,
1406
struct sk_buff *skb)
1407
{
1408
if (!local->ops->can_aggregate_in_amsdu)
1409
return true;
1410
1411
return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
1412
}
1413
1414
static inline int
1415
drv_get_ftm_responder_stats(struct ieee80211_local *local,
1416
struct ieee80211_sub_if_data *sdata,
1417
struct cfg80211_ftm_responder_stats *ftm_stats)
1418
{
1419
int ret = -EOPNOTSUPP;
1420
1421
might_sleep();
1422
lockdep_assert_wiphy(local->hw.wiphy);
1423
if (!check_sdata_in_driver(sdata))
1424
return -EIO;
1425
1426
if (local->ops->get_ftm_responder_stats)
1427
ret = local->ops->get_ftm_responder_stats(&local->hw,
1428
&sdata->vif,
1429
ftm_stats);
1430
trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats);
1431
1432
return ret;
1433
}
1434
1435
static inline int drv_start_pmsr(struct ieee80211_local *local,
1436
struct ieee80211_sub_if_data *sdata,
1437
struct cfg80211_pmsr_request *request)
1438
{
1439
int ret = -EOPNOTSUPP;
1440
1441
might_sleep();
1442
lockdep_assert_wiphy(local->hw.wiphy);
1443
if (!check_sdata_in_driver(sdata))
1444
return -EIO;
1445
1446
trace_drv_start_pmsr(local, sdata);
1447
1448
if (local->ops->start_pmsr)
1449
ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request);
1450
trace_drv_return_int(local, ret);
1451
1452
return ret;
1453
}
1454
1455
static inline void drv_abort_pmsr(struct ieee80211_local *local,
1456
struct ieee80211_sub_if_data *sdata,
1457
struct cfg80211_pmsr_request *request)
1458
{
1459
trace_drv_abort_pmsr(local, sdata);
1460
1461
might_sleep();
1462
lockdep_assert_wiphy(local->hw.wiphy);
1463
if (!check_sdata_in_driver(sdata))
1464
return;
1465
1466
if (local->ops->abort_pmsr)
1467
local->ops->abort_pmsr(&local->hw, &sdata->vif, request);
1468
trace_drv_return_void(local);
1469
}
1470
1471
static inline int drv_start_nan(struct ieee80211_local *local,
1472
struct ieee80211_sub_if_data *sdata,
1473
struct cfg80211_nan_conf *conf)
1474
{
1475
int ret;
1476
1477
might_sleep();
1478
lockdep_assert_wiphy(local->hw.wiphy);
1479
check_sdata_in_driver(sdata);
1480
1481
trace_drv_start_nan(local, sdata, conf);
1482
ret = local->ops->start_nan(&local->hw, &sdata->vif, conf);
1483
trace_drv_return_int(local, ret);
1484
return ret;
1485
}
1486
1487
static inline void drv_stop_nan(struct ieee80211_local *local,
1488
struct ieee80211_sub_if_data *sdata)
1489
{
1490
might_sleep();
1491
lockdep_assert_wiphy(local->hw.wiphy);
1492
check_sdata_in_driver(sdata);
1493
1494
trace_drv_stop_nan(local, sdata);
1495
local->ops->stop_nan(&local->hw, &sdata->vif);
1496
trace_drv_return_void(local);
1497
}
1498
1499
static inline int drv_nan_change_conf(struct ieee80211_local *local,
1500
struct ieee80211_sub_if_data *sdata,
1501
struct cfg80211_nan_conf *conf,
1502
u32 changes)
1503
{
1504
int ret;
1505
1506
might_sleep();
1507
lockdep_assert_wiphy(local->hw.wiphy);
1508
check_sdata_in_driver(sdata);
1509
1510
if (!local->ops->nan_change_conf)
1511
return -EOPNOTSUPP;
1512
1513
trace_drv_nan_change_conf(local, sdata, conf, changes);
1514
ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf,
1515
changes);
1516
trace_drv_return_int(local, ret);
1517
1518
return ret;
1519
}
1520
1521
static inline int drv_add_nan_func(struct ieee80211_local *local,
1522
struct ieee80211_sub_if_data *sdata,
1523
const struct cfg80211_nan_func *nan_func)
1524
{
1525
int ret;
1526
1527
might_sleep();
1528
lockdep_assert_wiphy(local->hw.wiphy);
1529
check_sdata_in_driver(sdata);
1530
1531
if (!local->ops->add_nan_func)
1532
return -EOPNOTSUPP;
1533
1534
trace_drv_add_nan_func(local, sdata, nan_func);
1535
ret = local->ops->add_nan_func(&local->hw, &sdata->vif, nan_func);
1536
trace_drv_return_int(local, ret);
1537
1538
return ret;
1539
}
1540
1541
static inline void drv_del_nan_func(struct ieee80211_local *local,
1542
struct ieee80211_sub_if_data *sdata,
1543
u8 instance_id)
1544
{
1545
might_sleep();
1546
lockdep_assert_wiphy(local->hw.wiphy);
1547
check_sdata_in_driver(sdata);
1548
1549
trace_drv_del_nan_func(local, sdata, instance_id);
1550
if (local->ops->del_nan_func)
1551
local->ops->del_nan_func(&local->hw, &sdata->vif, instance_id);
1552
trace_drv_return_void(local);
1553
}
1554
1555
static inline int drv_set_tid_config(struct ieee80211_local *local,
1556
struct ieee80211_sub_if_data *sdata,
1557
struct ieee80211_sta *sta,
1558
struct cfg80211_tid_config *tid_conf)
1559
{
1560
int ret;
1561
1562
might_sleep();
1563
lockdep_assert_wiphy(local->hw.wiphy);
1564
ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta,
1565
tid_conf);
1566
trace_drv_return_int(local, ret);
1567
1568
return ret;
1569
}
1570
1571
static inline int drv_reset_tid_config(struct ieee80211_local *local,
1572
struct ieee80211_sub_if_data *sdata,
1573
struct ieee80211_sta *sta, u8 tids)
1574
{
1575
int ret;
1576
1577
might_sleep();
1578
lockdep_assert_wiphy(local->hw.wiphy);
1579
ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tids);
1580
trace_drv_return_int(local, ret);
1581
1582
return ret;
1583
}
1584
1585
static inline void drv_update_vif_offload(struct ieee80211_local *local,
1586
struct ieee80211_sub_if_data *sdata)
1587
{
1588
might_sleep();
1589
lockdep_assert_wiphy(local->hw.wiphy);
1590
check_sdata_in_driver(sdata);
1591
1592
if (!local->ops->update_vif_offload)
1593
return;
1594
1595
trace_drv_update_vif_offload(local, sdata);
1596
local->ops->update_vif_offload(&local->hw, &sdata->vif);
1597
trace_drv_return_void(local);
1598
}
1599
1600
static inline void drv_sta_set_4addr(struct ieee80211_local *local,
1601
struct ieee80211_sub_if_data *sdata,
1602
struct ieee80211_sta *sta, bool enabled)
1603
{
1604
sdata = get_bss_sdata(sdata);
1605
1606
might_sleep();
1607
lockdep_assert_wiphy(local->hw.wiphy);
1608
if (!check_sdata_in_driver(sdata))
1609
return;
1610
1611
trace_drv_sta_set_4addr(local, sdata, sta, enabled);
1612
if (local->ops->sta_set_4addr)
1613
local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
1614
trace_drv_return_void(local);
1615
}
1616
1617
static inline void drv_sta_set_decap_offload(struct ieee80211_local *local,
1618
struct ieee80211_sub_if_data *sdata,
1619
struct ieee80211_sta *sta,
1620
bool enabled)
1621
{
1622
sdata = get_bss_sdata(sdata);
1623
1624
might_sleep();
1625
lockdep_assert_wiphy(local->hw.wiphy);
1626
if (!check_sdata_in_driver(sdata))
1627
return;
1628
1629
trace_drv_sta_set_decap_offload(local, sdata, sta, enabled);
1630
if (local->ops->sta_set_decap_offload)
1631
local->ops->sta_set_decap_offload(&local->hw, &sdata->vif, sta,
1632
enabled);
1633
trace_drv_return_void(local);
1634
}
1635
1636
static inline void drv_add_twt_setup(struct ieee80211_local *local,
1637
struct ieee80211_sub_if_data *sdata,
1638
struct ieee80211_sta *sta,
1639
struct ieee80211_twt_setup *twt)
1640
{
1641
struct ieee80211_twt_params *twt_agrt;
1642
1643
might_sleep();
1644
lockdep_assert_wiphy(local->hw.wiphy);
1645
1646
if (!check_sdata_in_driver(sdata))
1647
return;
1648
1649
twt_agrt = (void *)twt->params;
1650
1651
trace_drv_add_twt_setup(local, sta, twt, twt_agrt);
1652
local->ops->add_twt_setup(&local->hw, sta, twt);
1653
trace_drv_return_void(local);
1654
}
1655
1656
static inline void drv_twt_teardown_request(struct ieee80211_local *local,
1657
struct ieee80211_sub_if_data *sdata,
1658
struct ieee80211_sta *sta,
1659
u8 flowid)
1660
{
1661
might_sleep();
1662
lockdep_assert_wiphy(local->hw.wiphy);
1663
if (!check_sdata_in_driver(sdata))
1664
return;
1665
1666
if (!local->ops->twt_teardown_request)
1667
return;
1668
1669
trace_drv_twt_teardown_request(local, sta, flowid);
1670
local->ops->twt_teardown_request(&local->hw, sta, flowid);
1671
trace_drv_return_void(local);
1672
}
1673
1674
static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
1675
struct ieee80211_sub_if_data *sdata,
1676
struct ieee80211_sta *sta,
1677
struct net_device_path_ctx *ctx,
1678
struct net_device_path *path)
1679
{
1680
int ret = -EOPNOTSUPP;
1681
1682
sdata = get_bss_sdata(sdata);
1683
if (!check_sdata_in_driver(sdata))
1684
return -EIO;
1685
1686
trace_drv_net_fill_forward_path(local, sdata, sta);
1687
if (local->ops->net_fill_forward_path)
1688
ret = local->ops->net_fill_forward_path(&local->hw,
1689
&sdata->vif, sta,
1690
ctx, path);
1691
trace_drv_return_int(local, ret);
1692
1693
return ret;
1694
}
1695
1696
static inline int drv_net_setup_tc(struct ieee80211_local *local,
1697
struct ieee80211_sub_if_data *sdata,
1698
struct net_device *dev,
1699
enum tc_setup_type type, void *type_data)
1700
{
1701
int ret = -EOPNOTSUPP;
1702
1703
might_sleep();
1704
1705
sdata = get_bss_sdata(sdata);
1706
trace_drv_net_setup_tc(local, sdata, type);
1707
if (local->ops->net_setup_tc)
1708
ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev,
1709
type, type_data);
1710
trace_drv_return_int(local, ret);
1711
1712
return ret;
1713
}
1714
1715
static inline bool drv_can_activate_links(struct ieee80211_local *local,
1716
struct ieee80211_sub_if_data *sdata,
1717
u16 active_links)
1718
{
1719
bool ret = true;
1720
1721
lockdep_assert_wiphy(local->hw.wiphy);
1722
1723
if (!check_sdata_in_driver(sdata))
1724
return false;
1725
1726
trace_drv_can_activate_links(local, sdata, active_links);
1727
if (local->ops->can_activate_links)
1728
ret = local->ops->can_activate_links(&local->hw, &sdata->vif,
1729
active_links);
1730
trace_drv_return_bool(local, ret);
1731
1732
return ret;
1733
}
1734
1735
int drv_change_vif_links(struct ieee80211_local *local,
1736
struct ieee80211_sub_if_data *sdata,
1737
u16 old_links, u16 new_links,
1738
struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]);
1739
int drv_change_sta_links(struct ieee80211_local *local,
1740
struct ieee80211_sub_if_data *sdata,
1741
struct ieee80211_sta *sta,
1742
u16 old_links, u16 new_links);
1743
1744
static inline enum ieee80211_neg_ttlm_res
1745
drv_can_neg_ttlm(struct ieee80211_local *local,
1746
struct ieee80211_sub_if_data *sdata,
1747
struct ieee80211_neg_ttlm *neg_ttlm)
1748
{
1749
enum ieee80211_neg_ttlm_res res = NEG_TTLM_RES_REJECT;
1750
1751
might_sleep();
1752
if (!check_sdata_in_driver(sdata))
1753
return -EIO;
1754
1755
trace_drv_can_neg_ttlm(local, sdata, neg_ttlm);
1756
if (local->ops->can_neg_ttlm)
1757
res = local->ops->can_neg_ttlm(&local->hw, &sdata->vif,
1758
neg_ttlm);
1759
trace_drv_neg_ttlm_res(local, sdata, res, neg_ttlm);
1760
1761
return res;
1762
}
1763
1764
static inline void
1765
drv_prep_add_interface(struct ieee80211_local *local,
1766
enum nl80211_iftype type)
1767
{
1768
trace_drv_prep_add_interface(local, type);
1769
if (local->ops->prep_add_interface)
1770
local->ops->prep_add_interface(&local->hw, type);
1771
1772
trace_drv_return_void(local);
1773
}
1774
1775
#endif /* __MAC80211_DRIVER_OPS */
1776
1777