]> git.ipfire.org Git - thirdparty/linux.git/blame - net/mac80211/driver-ops.h
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[thirdparty/linux.git] / net / mac80211 / driver-ops.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
f59374eb
SS
2/*
3* Portions of this file
4* Copyright(c) 2016 Intel Deutschland GmbH
fafd2bce 5* Copyright (C) 2018 - 2019 Intel Corporation
f59374eb
SS
6*/
7
24487981
JB
8#ifndef __MAC80211_DRIVER_OPS
9#define __MAC80211_DRIVER_OPS
10
11#include <net/mac80211.h>
12#include "ieee80211_i.h"
011ad0e9 13#include "trace.h"
24487981 14
f6837ba8 15static inline bool check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
7b7eab6f 16{
f6837ba8
JB
17 return !WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
18 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
19 sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);
7b7eab6f
JB
20}
21
bc192f89
FF
22static inline struct ieee80211_sub_if_data *
23get_bss_sdata(struct ieee80211_sub_if_data *sdata)
24{
25 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
26 sdata = container_of(sdata->bss, struct ieee80211_sub_if_data,
27 u.ap);
28
29 return sdata;
30}
31
36323f81
TH
32static inline void drv_tx(struct ieee80211_local *local,
33 struct ieee80211_tx_control *control,
34 struct sk_buff *skb)
24487981 35{
36323f81 36 local->ops->tx(&local->hw, control, skb);
24487981
JB
37}
38
f59374eb
SS
39static inline void drv_sync_rx_queues(struct ieee80211_local *local,
40 struct sta_info *sta)
41{
42 if (local->ops->sync_rx_queues) {
43 trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta);
44 local->ops->sync_rx_queues(&local->hw);
45 trace_drv_return_void(local);
46 }
47}
48
e352114f
BG
49static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata,
50 u32 sset, u8 *data)
51{
52 struct ieee80211_local *local = sdata->local;
53 if (local->ops->get_et_strings) {
54 trace_drv_get_et_strings(local, sset);
55 local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data);
56 trace_drv_return_void(local);
57 }
58}
59
60static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata,
61 struct ethtool_stats *stats,
62 u64 *data)
63{
64 struct ieee80211_local *local = sdata->local;
65 if (local->ops->get_et_stats) {
66 trace_drv_get_et_stats(local);
67 local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data);
68 trace_drv_return_void(local);
69 }
70}
71
72static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata,
73 int sset)
74{
75 struct ieee80211_local *local = sdata->local;
76 int rv = 0;
77 if (local->ops->get_et_sset_count) {
78 trace_drv_get_et_sset_count(local, sset);
79 rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif,
80 sset);
81 trace_drv_return_int(local, rv);
82 }
83 return rv;
84}
85
968a76ce
EP
86int drv_start(struct ieee80211_local *local);
87void drv_stop(struct ieee80211_local *local);
24487981 88
eecc4800
JB
89#ifdef CONFIG_PM
90static inline int drv_suspend(struct ieee80211_local *local,
91 struct cfg80211_wowlan *wowlan)
92{
93 int ret;
94
95 might_sleep();
96
97 trace_drv_suspend(local);
98 ret = local->ops->suspend(&local->hw, wowlan);
99 trace_drv_return_int(local, ret);
100 return ret;
101}
102
103static inline int drv_resume(struct ieee80211_local *local)
104{
105 int ret;
106
107 might_sleep();
108
109 trace_drv_resume(local);
110 ret = local->ops->resume(&local->hw);
111 trace_drv_return_int(local, ret);
112 return ret;
113}
6d52563f
JB
114
115static inline void drv_set_wakeup(struct ieee80211_local *local,
116 bool enabled)
117{
118 might_sleep();
119
120 if (!local->ops->set_wakeup)
121 return;
122
123 trace_drv_set_wakeup(local, enabled);
124 local->ops->set_wakeup(&local->hw, enabled);
125 trace_drv_return_void(local);
126}
eecc4800
JB
127#endif
128
9aae296a
DV
129int drv_add_interface(struct ieee80211_local *local,
130 struct ieee80211_sub_if_data *sdata);
7b7eab6f 131
9aae296a
DV
132int drv_change_interface(struct ieee80211_local *local,
133 struct ieee80211_sub_if_data *sdata,
134 enum nl80211_iftype type, bool p2p);
7b7eab6f 135
9aae296a
DV
136void drv_remove_interface(struct ieee80211_local *local,
137 struct ieee80211_sub_if_data *sdata);
24487981
JB
138
139static inline int drv_config(struct ieee80211_local *local, u32 changed)
140{
e1781ed3
KV
141 int ret;
142
143 might_sleep();
144
4efc76bd 145 trace_drv_config(local, changed);
e1781ed3 146 ret = local->ops->config(&local->hw, changed);
4efc76bd 147 trace_drv_return_int(local, ret);
0a2b8bb2 148 return ret;
24487981
JB
149}
150
151static inline void drv_bss_info_changed(struct ieee80211_local *local,
12375ef9 152 struct ieee80211_sub_if_data *sdata,
24487981
JB
153 struct ieee80211_bss_conf *info,
154 u32 changed)
155{
e1781ed3
KV
156 might_sleep();
157
5bbe754d
JB
158 if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
159 BSS_CHANGED_BEACON_ENABLED) &&
160 sdata->vif.type != NL80211_IFTYPE_AP &&
161 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
239281f8
RL
162 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
163 sdata->vif.type != NL80211_IFTYPE_OCB))
5bbe754d
JB
164 return;
165
166 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE ||
708d50ed 167 sdata->vif.type == NL80211_IFTYPE_NAN ||
42bd20d9 168 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
3a3713ec
PG
169 !sdata->vif.mu_mimo_owner &&
170 !(changed & BSS_CHANGED_TXPOWER))))
5bbe754d 171 return;
b8dc1a35 172
f6837ba8
JB
173 if (!check_sdata_in_driver(sdata))
174 return;
7b7eab6f 175
4efc76bd 176 trace_drv_bss_info_changed(local, sdata, info, changed);
24487981 177 if (local->ops->bss_info_changed)
12375ef9 178 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
4efc76bd 179 trace_drv_return_void(local);
24487981
JB
180}
181
3ac64bee 182static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
22bedad3 183 struct netdev_hw_addr_list *mc_list)
3ac64bee
JB
184{
185 u64 ret = 0;
186
4efc76bd
JB
187 trace_drv_prepare_multicast(local, mc_list->count);
188
3ac64bee 189 if (local->ops->prepare_multicast)
22bedad3 190 ret = local->ops->prepare_multicast(&local->hw, mc_list);
3ac64bee 191
4efc76bd 192 trace_drv_return_u64(local, ret);
3ac64bee
JB
193
194 return ret;
195}
196
24487981
JB
197static inline void drv_configure_filter(struct ieee80211_local *local,
198 unsigned int changed_flags,
199 unsigned int *total_flags,
3ac64bee 200 u64 multicast)
24487981 201{
3ac64bee
JB
202 might_sleep();
203
0a2b8bb2 204 trace_drv_configure_filter(local, changed_flags, total_flags,
3ac64bee 205 multicast);
4efc76bd
JB
206 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
207 multicast);
208 trace_drv_return_void(local);
24487981
JB
209}
210
1b09b556
AO
211static inline void drv_config_iface_filter(struct ieee80211_local *local,
212 struct ieee80211_sub_if_data *sdata,
213 unsigned int filter_flags,
214 unsigned int changed_flags)
215{
216 might_sleep();
217
218 trace_drv_config_iface_filter(local, sdata, filter_flags,
219 changed_flags);
220 if (local->ops->config_iface_filter)
221 local->ops->config_iface_filter(&local->hw, &sdata->vif,
222 filter_flags,
223 changed_flags);
224 trace_drv_return_void(local);
225}
226
24487981
JB
227static inline int drv_set_tim(struct ieee80211_local *local,
228 struct ieee80211_sta *sta, bool set)
229{
0a2b8bb2 230 int ret = 0;
4efc76bd 231 trace_drv_set_tim(local, sta, set);
24487981 232 if (local->ops->set_tim)
0a2b8bb2 233 ret = local->ops->set_tim(&local->hw, sta, set);
4efc76bd 234 trace_drv_return_int(local, ret);
0a2b8bb2 235 return ret;
24487981
JB
236}
237
238static inline int drv_set_key(struct ieee80211_local *local,
12375ef9
JB
239 enum set_key_cmd cmd,
240 struct ieee80211_sub_if_data *sdata,
24487981
JB
241 struct ieee80211_sta *sta,
242 struct ieee80211_key_conf *key)
243{
e1781ed3
KV
244 int ret;
245
246 might_sleep();
247
077f4939 248 sdata = get_bss_sdata(sdata);
f6837ba8
JB
249 if (!check_sdata_in_driver(sdata))
250 return -EIO;
7b7eab6f 251
4efc76bd 252 trace_drv_set_key(local, cmd, sdata, sta, key);
e1781ed3 253 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
4efc76bd 254 trace_drv_return_int(local, ret);
0a2b8bb2 255 return ret;
24487981
JB
256}
257
258static inline void drv_update_tkip_key(struct ieee80211_local *local,
b3fbdcf4 259 struct ieee80211_sub_if_data *sdata,
24487981 260 struct ieee80211_key_conf *conf,
b3fbdcf4 261 struct sta_info *sta, u32 iv32,
24487981
JB
262 u16 *phase1key)
263{
b3fbdcf4
JB
264 struct ieee80211_sta *ista = NULL;
265
b3fbdcf4
JB
266 if (sta)
267 ista = &sta->sta;
268
077f4939 269 sdata = get_bss_sdata(sdata);
f6837ba8
JB
270 if (!check_sdata_in_driver(sdata))
271 return;
7b7eab6f 272
4efc76bd 273 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
24487981 274 if (local->ops->update_tkip_key)
b3fbdcf4
JB
275 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
276 ista, iv32, phase1key);
4efc76bd 277 trace_drv_return_void(local);
24487981
JB
278}
279
280static inline int drv_hw_scan(struct ieee80211_local *local,
a060bbfe 281 struct ieee80211_sub_if_data *sdata,
c56ef672 282 struct ieee80211_scan_request *req)
24487981 283{
e1781ed3
KV
284 int ret;
285
286 might_sleep();
287
f6837ba8
JB
288 if (!check_sdata_in_driver(sdata))
289 return -EIO;
7b7eab6f 290
79f460ca 291 trace_drv_hw_scan(local, sdata);
a060bbfe 292 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
4efc76bd 293 trace_drv_return_int(local, ret);
0a2b8bb2 294 return ret;
24487981
JB
295}
296
b856439b
EP
297static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
298 struct ieee80211_sub_if_data *sdata)
299{
300 might_sleep();
301
f6837ba8
JB
302 if (!check_sdata_in_driver(sdata))
303 return;
7b7eab6f 304
b856439b
EP
305 trace_drv_cancel_hw_scan(local, sdata);
306 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
307 trace_drv_return_void(local);
308}
309
79f460ca
LC
310static inline int
311drv_sched_scan_start(struct ieee80211_local *local,
312 struct ieee80211_sub_if_data *sdata,
313 struct cfg80211_sched_scan_request *req,
633e2713 314 struct ieee80211_scan_ies *ies)
79f460ca
LC
315{
316 int ret;
317
318 might_sleep();
319
f6837ba8
JB
320 if (!check_sdata_in_driver(sdata))
321 return -EIO;
7b7eab6f 322
79f460ca
LC
323 trace_drv_sched_scan_start(local, sdata);
324 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
325 req, ies);
326 trace_drv_return_int(local, ret);
327 return ret;
328}
329
37e3308c
JB
330static inline int drv_sched_scan_stop(struct ieee80211_local *local,
331 struct ieee80211_sub_if_data *sdata)
79f460ca 332{
37e3308c
JB
333 int ret;
334
79f460ca
LC
335 might_sleep();
336
f6837ba8
JB
337 if (!check_sdata_in_driver(sdata))
338 return -EIO;
7b7eab6f 339
79f460ca 340 trace_drv_sched_scan_stop(local, sdata);
37e3308c
JB
341 ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif);
342 trace_drv_return_int(local, ret);
343
344 return ret;
79f460ca
LC
345}
346
a344d677
JB
347static inline void drv_sw_scan_start(struct ieee80211_local *local,
348 struct ieee80211_sub_if_data *sdata,
349 const u8 *mac_addr)
24487981 350{
e1781ed3
KV
351 might_sleep();
352
a344d677 353 trace_drv_sw_scan_start(local, sdata, mac_addr);
24487981 354 if (local->ops->sw_scan_start)
a344d677 355 local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr);
4efc76bd 356 trace_drv_return_void(local);
24487981
JB
357}
358
a344d677
JB
359static inline void drv_sw_scan_complete(struct ieee80211_local *local,
360 struct ieee80211_sub_if_data *sdata)
24487981 361{
e1781ed3
KV
362 might_sleep();
363
a344d677 364 trace_drv_sw_scan_complete(local, sdata);
24487981 365 if (local->ops->sw_scan_complete)
a344d677 366 local->ops->sw_scan_complete(&local->hw, &sdata->vif);
4efc76bd 367 trace_drv_return_void(local);
24487981
JB
368}
369
370static inline int drv_get_stats(struct ieee80211_local *local,
371 struct ieee80211_low_level_stats *stats)
372{
0a2b8bb2
JB
373 int ret = -EOPNOTSUPP;
374
e1781ed3
KV
375 might_sleep();
376
0a2b8bb2
JB
377 if (local->ops->get_stats)
378 ret = local->ops->get_stats(&local->hw, stats);
379 trace_drv_get_stats(local, stats, ret);
380
381 return ret;
24487981
JB
382}
383
9352c19f
JB
384static inline void drv_get_key_seq(struct ieee80211_local *local,
385 struct ieee80211_key *key,
386 struct ieee80211_key_seq *seq)
24487981 387{
9352c19f
JB
388 if (local->ops->get_key_seq)
389 local->ops->get_key_seq(&local->hw, &key->conf, seq);
390 trace_drv_get_key_seq(local, &key->conf);
24487981
JB
391}
392
f23a4780
AN
393static inline int drv_set_frag_threshold(struct ieee80211_local *local,
394 u32 value)
395{
396 int ret = 0;
397
398 might_sleep();
399
400 trace_drv_set_frag_threshold(local, value);
401 if (local->ops->set_frag_threshold)
402 ret = local->ops->set_frag_threshold(&local->hw, value);
403 trace_drv_return_int(local, ret);
404 return ret;
405}
406
24487981
JB
407static inline int drv_set_rts_threshold(struct ieee80211_local *local,
408 u32 value)
409{
0a2b8bb2 410 int ret = 0;
e1781ed3
KV
411
412 might_sleep();
413
4efc76bd 414 trace_drv_set_rts_threshold(local, value);
24487981 415 if (local->ops->set_rts_threshold)
0a2b8bb2 416 ret = local->ops->set_rts_threshold(&local->hw, value);
4efc76bd 417 trace_drv_return_int(local, ret);
0a2b8bb2 418 return ret;
24487981
JB
419}
420
310bc676 421static inline int drv_set_coverage_class(struct ieee80211_local *local,
a4bcaf55 422 s16 value)
310bc676
LT
423{
424 int ret = 0;
425 might_sleep();
426
4efc76bd 427 trace_drv_set_coverage_class(local, value);
310bc676
LT
428 if (local->ops->set_coverage_class)
429 local->ops->set_coverage_class(&local->hw, value);
430 else
431 ret = -EOPNOTSUPP;
432
4efc76bd 433 trace_drv_return_int(local, ret);
310bc676
LT
434 return ret;
435}
436
24487981 437static inline void drv_sta_notify(struct ieee80211_local *local,
12375ef9 438 struct ieee80211_sub_if_data *sdata,
24487981
JB
439 enum sta_notify_cmd cmd,
440 struct ieee80211_sta *sta)
441{
bc192f89 442 sdata = get_bss_sdata(sdata);
f6837ba8
JB
443 if (!check_sdata_in_driver(sdata))
444 return;
7b7eab6f 445
4efc76bd 446 trace_drv_sta_notify(local, sdata, cmd, sta);
24487981 447 if (local->ops->sta_notify)
12375ef9 448 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
4efc76bd 449 trace_drv_return_void(local);
24487981
JB
450}
451
34e89507
JB
452static inline int drv_sta_add(struct ieee80211_local *local,
453 struct ieee80211_sub_if_data *sdata,
454 struct ieee80211_sta *sta)
455{
456 int ret = 0;
457
458 might_sleep();
459
bc192f89 460 sdata = get_bss_sdata(sdata);
f6837ba8
JB
461 if (!check_sdata_in_driver(sdata))
462 return -EIO;
7b7eab6f 463
4efc76bd 464 trace_drv_sta_add(local, sdata, sta);
34e89507
JB
465 if (local->ops->sta_add)
466 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
34e89507 467
4efc76bd 468 trace_drv_return_int(local, ret);
34e89507
JB
469
470 return ret;
471}
472
473static inline void drv_sta_remove(struct ieee80211_local *local,
474 struct ieee80211_sub_if_data *sdata,
475 struct ieee80211_sta *sta)
476{
477 might_sleep();
478
bc192f89 479 sdata = get_bss_sdata(sdata);
f6837ba8
JB
480 if (!check_sdata_in_driver(sdata))
481 return;
7b7eab6f 482
4efc76bd 483 trace_drv_sta_remove(local, sdata, sta);
34e89507
JB
484 if (local->ops->sta_remove)
485 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
34e89507 486
4efc76bd 487 trace_drv_return_void(local);
34e89507
JB
488}
489
77d2ece6
SM
490#ifdef CONFIG_MAC80211_DEBUGFS
491static inline void drv_sta_add_debugfs(struct ieee80211_local *local,
492 struct ieee80211_sub_if_data *sdata,
493 struct ieee80211_sta *sta,
494 struct dentry *dir)
495{
496 might_sleep();
497
498 sdata = get_bss_sdata(sdata);
f6837ba8
JB
499 if (!check_sdata_in_driver(sdata))
500 return;
77d2ece6
SM
501
502 if (local->ops->sta_add_debugfs)
503 local->ops->sta_add_debugfs(&local->hw, &sdata->vif,
504 sta, dir);
505}
77d2ece6
SM
506#endif
507
6a9d1b91
JB
508static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local,
509 struct ieee80211_sub_if_data *sdata,
510 struct sta_info *sta)
511{
512 might_sleep();
513
514 sdata = get_bss_sdata(sdata);
f6837ba8
JB
515 if (!check_sdata_in_driver(sdata))
516 return;
6a9d1b91
JB
517
518 trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta);
519 if (local->ops->sta_pre_rcu_remove)
520 local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif,
521 &sta->sta);
522 trace_drv_return_void(local);
523}
524
727da60b 525__must_check
f09603a2
JB
526int drv_sta_state(struct ieee80211_local *local,
527 struct ieee80211_sub_if_data *sdata,
528 struct sta_info *sta,
529 enum ieee80211_sta_state old_state,
727da60b 530 enum ieee80211_sta_state new_state);
f09603a2 531
4fbd572c
DV
532void drv_sta_rc_update(struct ieee80211_local *local,
533 struct ieee80211_sub_if_data *sdata,
534 struct ieee80211_sta *sta, u32 changed);
8f727ef3 535
f815e2b3
JB
536static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local,
537 struct ieee80211_sub_if_data *sdata,
538 struct ieee80211_sta *sta)
539{
540 sdata = get_bss_sdata(sdata);
541 if (!check_sdata_in_driver(sdata))
542 return;
543
544 trace_drv_sta_rate_tbl_update(local, sdata, sta);
545 if (local->ops->sta_rate_tbl_update)
546 local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta);
547
548 trace_drv_return_void(local);
549}
550
2b9a7e1b
JB
551static inline void drv_sta_statistics(struct ieee80211_local *local,
552 struct ieee80211_sub_if_data *sdata,
553 struct ieee80211_sta *sta,
554 struct station_info *sinfo)
555{
556 sdata = get_bss_sdata(sdata);
557 if (!check_sdata_in_driver(sdata))
558 return;
559
560 trace_drv_sta_statistics(local, sdata, sta);
561 if (local->ops->sta_statistics)
562 local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo);
563 trace_drv_return_void(local);
564}
565
b23dcd4a
DV
566int drv_conf_tx(struct ieee80211_local *local,
567 struct ieee80211_sub_if_data *sdata, u16 ac,
568 const struct ieee80211_tx_queue_params *params);
24487981 569
416eb9fc
DV
570u64 drv_get_tsf(struct ieee80211_local *local,
571 struct ieee80211_sub_if_data *sdata);
572void drv_set_tsf(struct ieee80211_local *local,
573 struct ieee80211_sub_if_data *sdata,
574 u64 tsf);
354d381b
PT
575void drv_offset_tsf(struct ieee80211_local *local,
576 struct ieee80211_sub_if_data *sdata,
577 s64 offset);
416eb9fc
DV
578void drv_reset_tsf(struct ieee80211_local *local,
579 struct ieee80211_sub_if_data *sdata);
24487981
JB
580
581static inline int drv_tx_last_beacon(struct ieee80211_local *local)
582{
02582e9b 583 int ret = 0; /* default unsupported op for less congestion */
e1781ed3
KV
584
585 might_sleep();
586
4efc76bd 587 trace_drv_tx_last_beacon(local);
24487981 588 if (local->ops->tx_last_beacon)
0a2b8bb2 589 ret = local->ops->tx_last_beacon(&local->hw);
4efc76bd 590 trace_drv_return_int(local, ret);
0a2b8bb2 591 return ret;
24487981
JB
592}
593
6db96838
DV
594int drv_ampdu_action(struct ieee80211_local *local,
595 struct ieee80211_sub_if_data *sdata,
50ea05ef 596 struct ieee80211_ampdu_params *params);
1f87f7d3 597
1289723e
HS
598static inline int drv_get_survey(struct ieee80211_local *local, int idx,
599 struct survey_info *survey)
600{
601 int ret = -EOPNOTSUPP;
c466d4ef
JL
602
603 trace_drv_get_survey(local, idx, survey);
604
35dd0509 605 if (local->ops->get_survey)
1289723e 606 ret = local->ops->get_survey(&local->hw, idx, survey);
c466d4ef
JL
607
608 trace_drv_return_int(local, ret);
609
1289723e
HS
610 return ret;
611}
1f87f7d3
JB
612
613static inline void drv_rfkill_poll(struct ieee80211_local *local)
614{
e1781ed3
KV
615 might_sleep();
616
1f87f7d3
JB
617 if (local->ops->rfkill_poll)
618 local->ops->rfkill_poll(&local->hw);
619}
a80f7c0b 620
39ecc01d 621static inline void drv_flush(struct ieee80211_local *local,
77be2c54 622 struct ieee80211_sub_if_data *sdata,
39ecc01d 623 u32 queues, bool drop)
a80f7c0b 624{
77be2c54
EG
625 struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;
626
e1781ed3
KV
627 might_sleep();
628
f6837ba8
JB
629 if (sdata && !check_sdata_in_driver(sdata))
630 return;
77be2c54 631
39ecc01d 632 trace_drv_flush(local, queues, drop);
a80f7c0b 633 if (local->ops->flush)
77be2c54 634 local->ops->flush(&local->hw, vif, queues, drop);
4efc76bd 635 trace_drv_return_void(local);
a80f7c0b 636}
5ce6e438
JB
637
638static inline void drv_channel_switch(struct ieee80211_local *local,
0f791eb4
LC
639 struct ieee80211_sub_if_data *sdata,
640 struct ieee80211_channel_switch *ch_switch)
5ce6e438
JB
641{
642 might_sleep();
643
0f791eb4
LC
644 trace_drv_channel_switch(local, sdata, ch_switch);
645 local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch);
4efc76bd 646 trace_drv_return_void(local);
5ce6e438
JB
647}
648
15d96753
BR
649
650static inline int drv_set_antenna(struct ieee80211_local *local,
651 u32 tx_ant, u32 rx_ant)
652{
653 int ret = -EOPNOTSUPP;
654 might_sleep();
655 if (local->ops->set_antenna)
656 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
657 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
658 return ret;
659}
660
661static inline int drv_get_antenna(struct ieee80211_local *local,
662 u32 *tx_ant, u32 *rx_ant)
663{
664 int ret = -EOPNOTSUPP;
665 might_sleep();
666 if (local->ops->get_antenna)
667 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
668 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
669 return ret;
670}
671
21f83589 672static inline int drv_remain_on_channel(struct ieee80211_local *local,
49884568 673 struct ieee80211_sub_if_data *sdata,
21f83589 674 struct ieee80211_channel *chan,
d339d5ca
IP
675 unsigned int duration,
676 enum ieee80211_roc_type type)
21f83589
JB
677{
678 int ret;
679
680 might_sleep();
681
d339d5ca 682 trace_drv_remain_on_channel(local, sdata, chan, duration, type);
49884568 683 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
d339d5ca 684 chan, duration, type);
21f83589
JB
685 trace_drv_return_int(local, ret);
686
687 return ret;
688}
689
690static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
691{
692 int ret;
693
694 might_sleep();
695
696 trace_drv_cancel_remain_on_channel(local);
697 ret = local->ops->cancel_remain_on_channel(&local->hw);
698 trace_drv_return_int(local, ret);
5f16a436
JB
699
700 return ret;
701}
702
38c09159
JL
703static inline int drv_set_ringparam(struct ieee80211_local *local,
704 u32 tx, u32 rx)
705{
706 int ret = -ENOTSUPP;
707
708 might_sleep();
709
710 trace_drv_set_ringparam(local, tx, rx);
711 if (local->ops->set_ringparam)
712 ret = local->ops->set_ringparam(&local->hw, tx, rx);
713 trace_drv_return_int(local, ret);
714
715 return ret;
716}
717
718static inline void drv_get_ringparam(struct ieee80211_local *local,
719 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
720{
721 might_sleep();
722
723 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
724 if (local->ops->get_ringparam)
725 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
726 trace_drv_return_void(local);
727}
728
e8306f98
VN
729static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
730{
731 bool ret = false;
732
733 might_sleep();
734
735 trace_drv_tx_frames_pending(local);
736 if (local->ops->tx_frames_pending)
737 ret = local->ops->tx_frames_pending(&local->hw);
738 trace_drv_return_bool(local, ret);
739
740 return ret;
741}
bdbfd6b5
SM
742
743static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
744 struct ieee80211_sub_if_data *sdata,
745 const struct cfg80211_bitrate_mask *mask)
746{
747 int ret = -EOPNOTSUPP;
748
749 might_sleep();
750
f6837ba8
JB
751 if (!check_sdata_in_driver(sdata))
752 return -EIO;
7b7eab6f 753
bdbfd6b5
SM
754 trace_drv_set_bitrate_mask(local, sdata, mask);
755 if (local->ops->set_bitrate_mask)
756 ret = local->ops->set_bitrate_mask(&local->hw,
757 &sdata->vif, mask);
758 trace_drv_return_int(local, ret);
759
760 return ret;
761}
762
c68f4b89
JB
763static inline void drv_set_rekey_data(struct ieee80211_local *local,
764 struct ieee80211_sub_if_data *sdata,
765 struct cfg80211_gtk_rekey_data *data)
766{
f6837ba8
JB
767 if (!check_sdata_in_driver(sdata))
768 return;
7b7eab6f 769
c68f4b89
JB
770 trace_drv_set_rekey_data(local, sdata, data);
771 if (local->ops->set_rekey_data)
772 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
773 trace_drv_return_void(local);
774}
775
a8182929
EG
776static inline void drv_event_callback(struct ieee80211_local *local,
777 struct ieee80211_sub_if_data *sdata,
778 const struct ieee80211_event *event)
615f7b9b 779{
a8182929
EG
780 trace_drv_event_callback(local, sdata, event);
781 if (local->ops->event_callback)
782 local->ops->event_callback(&local->hw, &sdata->vif, event);
615f7b9b
MV
783 trace_drv_return_void(local);
784}
4049e09a
JB
785
786static inline void
787drv_release_buffered_frames(struct ieee80211_local *local,
788 struct sta_info *sta, u16 tids, int num_frames,
789 enum ieee80211_frame_release_type reason,
790 bool more_data)
791{
792 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
793 reason, more_data);
794 if (local->ops->release_buffered_frames)
795 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
796 num_frames, reason,
797 more_data);
798 trace_drv_return_void(local);
799}
40b96408
JB
800
801static inline void
802drv_allow_buffered_frames(struct ieee80211_local *local,
803 struct sta_info *sta, u16 tids, int num_frames,
804 enum ieee80211_frame_release_type reason,
805 bool more_data)
806{
807 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
808 reason, more_data);
809 if (local->ops->allow_buffered_frames)
810 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
811 tids, num_frames, reason,
812 more_data);
813 trace_drv_return_void(local);
814}
66572cfc 815
a1845fc7 816static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
d4e36e55
IP
817 struct ieee80211_sub_if_data *sdata,
818 u16 duration)
a1845fc7
JB
819{
820 might_sleep();
821
f6837ba8
JB
822 if (!check_sdata_in_driver(sdata))
823 return;
a1845fc7
JB
824 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
825
d4e36e55 826 trace_drv_mgd_prepare_tx(local, sdata, duration);
a1845fc7 827 if (local->ops->mgd_prepare_tx)
d4e36e55 828 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, duration);
a1845fc7
JB
829 trace_drv_return_void(local);
830}
c3645eac 831
ee10f2c7
AN
832static inline void
833drv_mgd_protect_tdls_discover(struct ieee80211_local *local,
834 struct ieee80211_sub_if_data *sdata)
835{
836 might_sleep();
837
838 if (!check_sdata_in_driver(sdata))
839 return;
840 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
841
842 trace_drv_mgd_protect_tdls_discover(local, sdata);
843 if (local->ops->mgd_protect_tdls_discover)
844 local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif);
845 trace_drv_return_void(local);
846}
847
c3645eac
MK
848static inline int drv_add_chanctx(struct ieee80211_local *local,
849 struct ieee80211_chanctx *ctx)
850{
851 int ret = -EOPNOTSUPP;
852
dcae9e02
C
853 might_sleep();
854
c3645eac
MK
855 trace_drv_add_chanctx(local, ctx);
856 if (local->ops->add_chanctx)
857 ret = local->ops->add_chanctx(&local->hw, &ctx->conf);
858 trace_drv_return_int(local, ret);
8a61af65
JB
859 if (!ret)
860 ctx->driver_present = true;
c3645eac
MK
861
862 return ret;
863}
864
865static inline void drv_remove_chanctx(struct ieee80211_local *local,
866 struct ieee80211_chanctx *ctx)
867{
dcae9e02
C
868 might_sleep();
869
f6837ba8
JB
870 if (WARN_ON(!ctx->driver_present))
871 return;
872
c3645eac
MK
873 trace_drv_remove_chanctx(local, ctx);
874 if (local->ops->remove_chanctx)
875 local->ops->remove_chanctx(&local->hw, &ctx->conf);
876 trace_drv_return_void(local);
8a61af65 877 ctx->driver_present = false;
c3645eac
MK
878}
879
880static inline void drv_change_chanctx(struct ieee80211_local *local,
881 struct ieee80211_chanctx *ctx,
882 u32 changed)
883{
dcae9e02
C
884 might_sleep();
885
c3645eac 886 trace_drv_change_chanctx(local, ctx, changed);
8a61af65
JB
887 if (local->ops->change_chanctx) {
888 WARN_ON_ONCE(!ctx->driver_present);
c3645eac 889 local->ops->change_chanctx(&local->hw, &ctx->conf, changed);
8a61af65 890 }
c3645eac
MK
891 trace_drv_return_void(local);
892}
893
894static inline int drv_assign_vif_chanctx(struct ieee80211_local *local,
895 struct ieee80211_sub_if_data *sdata,
896 struct ieee80211_chanctx *ctx)
897{
898 int ret = 0;
899
f6837ba8
JB
900 if (!check_sdata_in_driver(sdata))
901 return -EIO;
c3645eac
MK
902
903 trace_drv_assign_vif_chanctx(local, sdata, ctx);
8a61af65
JB
904 if (local->ops->assign_vif_chanctx) {
905 WARN_ON_ONCE(!ctx->driver_present);
c3645eac
MK
906 ret = local->ops->assign_vif_chanctx(&local->hw,
907 &sdata->vif,
908 &ctx->conf);
8a61af65 909 }
c3645eac
MK
910 trace_drv_return_int(local, ret);
911
912 return ret;
913}
914
915static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local,
916 struct ieee80211_sub_if_data *sdata,
917 struct ieee80211_chanctx *ctx)
918{
dcae9e02
C
919 might_sleep();
920
f6837ba8
JB
921 if (!check_sdata_in_driver(sdata))
922 return;
c3645eac
MK
923
924 trace_drv_unassign_vif_chanctx(local, sdata, ctx);
8a61af65
JB
925 if (local->ops->unassign_vif_chanctx) {
926 WARN_ON_ONCE(!ctx->driver_present);
c3645eac
MK
927 local->ops->unassign_vif_chanctx(&local->hw,
928 &sdata->vif,
929 &ctx->conf);
8a61af65 930 }
c3645eac
MK
931 trace_drv_return_void(local);
932}
933
42677ed3
DV
934int drv_switch_vif_chanctx(struct ieee80211_local *local,
935 struct ieee80211_vif_chanctx_switch *vifs,
936 int n_vifs, enum ieee80211_chanctx_switch_mode mode);
1a5f0c13 937
1041638f
JB
938static inline int drv_start_ap(struct ieee80211_local *local,
939 struct ieee80211_sub_if_data *sdata)
940{
941 int ret = 0;
942
dcae9e02
C
943 might_sleep();
944
f6837ba8
JB
945 if (!check_sdata_in_driver(sdata))
946 return -EIO;
1041638f
JB
947
948 trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf);
949 if (local->ops->start_ap)
950 ret = local->ops->start_ap(&local->hw, &sdata->vif);
951 trace_drv_return_int(local, ret);
952 return ret;
953}
954
955static inline void drv_stop_ap(struct ieee80211_local *local,
956 struct ieee80211_sub_if_data *sdata)
957{
f6837ba8
JB
958 if (!check_sdata_in_driver(sdata))
959 return;
1041638f
JB
960
961 trace_drv_stop_ap(local, sdata);
962 if (local->ops->stop_ap)
963 local->ops->stop_ap(&local->hw, &sdata->vif);
964 trace_drv_return_void(local);
965}
966
cf2c92d8
EP
967static inline void
968drv_reconfig_complete(struct ieee80211_local *local,
969 enum ieee80211_reconfig_type reconfig_type)
9214ad7f
JB
970{
971 might_sleep();
972
cf2c92d8
EP
973 trace_drv_reconfig_complete(local, reconfig_type);
974 if (local->ops->reconfig_complete)
975 local->ops->reconfig_complete(&local->hw, reconfig_type);
9214ad7f
JB
976 trace_drv_return_void(local);
977}
978
de5fad81
YD
979static inline void
980drv_set_default_unicast_key(struct ieee80211_local *local,
981 struct ieee80211_sub_if_data *sdata,
982 int key_idx)
983{
f6837ba8
JB
984 if (!check_sdata_in_driver(sdata))
985 return;
de5fad81
YD
986
987 WARN_ON_ONCE(key_idx < -1 || key_idx > 3);
988
989 trace_drv_set_default_unicast_key(local, sdata, key_idx);
990 if (local->ops->set_default_unicast_key)
991 local->ops->set_default_unicast_key(&local->hw, &sdata->vif,
992 key_idx);
993 trace_drv_return_void(local);
994}
995
a65240c1
JB
996#if IS_ENABLED(CONFIG_IPV6)
997static inline void drv_ipv6_addr_change(struct ieee80211_local *local,
998 struct ieee80211_sub_if_data *sdata,
999 struct inet6_dev *idev)
1000{
1001 trace_drv_ipv6_addr_change(local, sdata);
1002 if (local->ops->ipv6_addr_change)
1003 local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev);
1004 trace_drv_return_void(local);
1005}
1006#endif
1007
73da7d5b
SW
1008static inline void
1009drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata,
1010 struct cfg80211_chan_def *chandef)
1011{
1012 struct ieee80211_local *local = sdata->local;
1013
1014 if (local->ops->channel_switch_beacon) {
1015 trace_drv_channel_switch_beacon(local, sdata, chandef);
1016 local->ops->channel_switch_beacon(&local->hw, &sdata->vif,
1017 chandef);
1018 }
1019}
1020
6d027bcc
LC
1021static inline int
1022drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata,
1023 struct ieee80211_channel_switch *ch_switch)
1024{
1025 struct ieee80211_local *local = sdata->local;
1026 int ret = 0;
1027
1028 if (!check_sdata_in_driver(sdata))
1029 return -EIO;
1030
1031 trace_drv_pre_channel_switch(local, sdata, ch_switch);
1032 if (local->ops->pre_channel_switch)
1033 ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif,
1034 ch_switch);
1035 trace_drv_return_int(local, ret);
1036 return ret;
1037}
1038
f1d65583
LC
1039static inline int
1040drv_post_channel_switch(struct ieee80211_sub_if_data *sdata)
1041{
1042 struct ieee80211_local *local = sdata->local;
1043 int ret = 0;
1044
1045 if (!check_sdata_in_driver(sdata))
1046 return -EIO;
1047
1048 trace_drv_post_channel_switch(local, sdata);
1049 if (local->ops->post_channel_switch)
1050 ret = local->ops->post_channel_switch(&local->hw, &sdata->vif);
1051 trace_drv_return_int(local, ret);
1052 return ret;
1053}
1054
b9cc81d8
SS
1055static inline void
1056drv_abort_channel_switch(struct ieee80211_sub_if_data *sdata)
1057{
1058 struct ieee80211_local *local = sdata->local;
1059
1060 if (!check_sdata_in_driver(sdata))
1061 return;
1062
1063 trace_drv_abort_channel_switch(local, sdata);
1064
1065 if (local->ops->abort_channel_switch)
1066 local->ops->abort_channel_switch(&local->hw, &sdata->vif);
1067}
1068
fafd2bce
SS
1069static inline void
1070drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata,
1071 struct ieee80211_channel_switch *ch_switch)
1072{
1073 struct ieee80211_local *local = sdata->local;
1074
1075 if (!check_sdata_in_driver(sdata))
1076 return;
1077
1078 trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch);
1079 if (local->ops->channel_switch_rx_beacon)
1080 local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif,
1081 ch_switch);
1082}
1083
55fff501
JB
1084static inline int drv_join_ibss(struct ieee80211_local *local,
1085 struct ieee80211_sub_if_data *sdata)
1086{
1087 int ret = 0;
1088
1089 might_sleep();
f6837ba8
JB
1090 if (!check_sdata_in_driver(sdata))
1091 return -EIO;
55fff501
JB
1092
1093 trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf);
1094 if (local->ops->join_ibss)
1095 ret = local->ops->join_ibss(&local->hw, &sdata->vif);
1096 trace_drv_return_int(local, ret);
1097 return ret;
1098}
1099
1100static inline void drv_leave_ibss(struct ieee80211_local *local,
1101 struct ieee80211_sub_if_data *sdata)
1102{
1103 might_sleep();
f6837ba8
JB
1104 if (!check_sdata_in_driver(sdata))
1105 return;
55fff501
JB
1106
1107 trace_drv_leave_ibss(local, sdata);
1108 if (local->ops->leave_ibss)
1109 local->ops->leave_ibss(&local->hw, &sdata->vif);
1110 trace_drv_return_void(local);
1111}
1112
cca674d4 1113static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
4fdbc67a 1114 struct sta_info *sta)
cca674d4
AQ
1115{
1116 u32 ret = 0;
1117
4fdbc67a
MA
1118 trace_drv_get_expected_throughput(&sta->sta);
1119 if (local->ops->get_expected_throughput && sta->uploaded)
1120 ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
cca674d4
AQ
1121 trace_drv_return_u32(local, ret);
1122
1123 return ret;
1124}
1125
5b3dc42b
FF
1126static inline int drv_get_txpower(struct ieee80211_local *local,
1127 struct ieee80211_sub_if_data *sdata, int *dbm)
1128{
1129 int ret;
1130
1131 if (!local->ops->get_txpower)
1132 return -EOPNOTSUPP;
1133
1134 ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm);
1135 trace_drv_get_txpower(local, sdata, *dbm, ret);
1136
1137 return ret;
1138}
1139
a7a6bdd0
AN
1140static inline int
1141drv_tdls_channel_switch(struct ieee80211_local *local,
1142 struct ieee80211_sub_if_data *sdata,
1143 struct ieee80211_sta *sta, u8 oper_class,
1144 struct cfg80211_chan_def *chandef,
1145 struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie)
1146{
1147 int ret;
1148
1149 might_sleep();
1150 if (!check_sdata_in_driver(sdata))
1151 return -EIO;
1152
1153 if (!local->ops->tdls_channel_switch)
1154 return -EOPNOTSUPP;
1155
1156 trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef);
1157 ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta,
1158 oper_class, chandef, tmpl_skb,
1159 ch_sw_tm_ie);
1160 trace_drv_return_int(local, ret);
1161 return ret;
1162}
1163
1164static inline void
1165drv_tdls_cancel_channel_switch(struct ieee80211_local *local,
1166 struct ieee80211_sub_if_data *sdata,
1167 struct ieee80211_sta *sta)
1168{
1169 might_sleep();
1170 if (!check_sdata_in_driver(sdata))
1171 return;
1172
1173 if (!local->ops->tdls_cancel_channel_switch)
1174 return;
1175
1176 trace_drv_tdls_cancel_channel_switch(local, sdata, sta);
1177 local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta);
1178 trace_drv_return_void(local);
1179}
1180
8a4d32f3
AN
1181static inline void
1182drv_tdls_recv_channel_switch(struct ieee80211_local *local,
1183 struct ieee80211_sub_if_data *sdata,
1184 struct ieee80211_tdls_ch_sw_params *params)
1185{
1186 trace_drv_tdls_recv_channel_switch(local, sdata, params);
1187 if (local->ops->tdls_recv_channel_switch)
1188 local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif,
1189 params);
1190 trace_drv_return_void(local);
1191}
1192
e7881bd5
JB
1193static inline void drv_wake_tx_queue(struct ieee80211_local *local,
1194 struct txq_info *txq)
ba8c3d6f 1195{
e7881bd5
JB
1196 struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif);
1197
4856bfd2
FF
1198 if (local->in_reconfig)
1199 return;
1200
e7881bd5
JB
1201 if (!check_sdata_in_driver(sdata))
1202 return;
1203
1204 trace_drv_wake_tx_queue(local, sdata, txq);
1205 local->ops->wake_tx_queue(&local->hw, &txq->txq);
ba8c3d6f
FF
1206}
1207
18667600
THJ
1208static inline void schedule_and_wake_txq(struct ieee80211_local *local,
1209 struct txq_info *txqi)
1210{
390298e8 1211 ieee80211_schedule_txq(&local->hw, &txqi->txq);
18667600
THJ
1212 drv_wake_tx_queue(local, txqi);
1213}
1214
9739fe29
SS
1215static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
1216 struct sk_buff *head,
1217 struct sk_buff *skb)
1218{
1219 if (!local->ops->can_aggregate_in_amsdu)
1220 return true;
1221
1222 return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
1223}
1224
bc847970
PKC
1225static inline int
1226drv_get_ftm_responder_stats(struct ieee80211_local *local,
1227 struct ieee80211_sub_if_data *sdata,
1228 struct cfg80211_ftm_responder_stats *ftm_stats)
1229{
1230 u32 ret = -EOPNOTSUPP;
1231
1232 if (local->ops->get_ftm_responder_stats)
1233 ret = local->ops->get_ftm_responder_stats(&local->hw,
1234 &sdata->vif,
1235 ftm_stats);
1236 trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats);
1237
1238 return ret;
1239}
1240
cee7013b
JB
1241static inline int drv_start_pmsr(struct ieee80211_local *local,
1242 struct ieee80211_sub_if_data *sdata,
1243 struct cfg80211_pmsr_request *request)
1244{
1245 int ret = -EOPNOTSUPP;
1246
1247 might_sleep();
1248 if (!check_sdata_in_driver(sdata))
1249 return -EIO;
1250
1251 trace_drv_start_pmsr(local, sdata);
1252
1253 if (local->ops->start_pmsr)
1254 ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request);
1255 trace_drv_return_int(local, ret);
1256
1257 return ret;
1258}
1259
1260static inline void drv_abort_pmsr(struct ieee80211_local *local,
1261 struct ieee80211_sub_if_data *sdata,
1262 struct cfg80211_pmsr_request *request)
1263{
1264 trace_drv_abort_pmsr(local, sdata);
1265
1266 might_sleep();
1267 if (!check_sdata_in_driver(sdata))
1268 return;
1269
1270 if (local->ops->abort_pmsr)
1271 local->ops->abort_pmsr(&local->hw, &sdata->vif, request);
1272 trace_drv_return_void(local);
1273}
1274
708d50ed
AB
1275static inline int drv_start_nan(struct ieee80211_local *local,
1276 struct ieee80211_sub_if_data *sdata,
1277 struct cfg80211_nan_conf *conf)
1278{
1279 int ret;
1280
1281 might_sleep();
1282 check_sdata_in_driver(sdata);
1283
1284 trace_drv_start_nan(local, sdata, conf);
1285 ret = local->ops->start_nan(&local->hw, &sdata->vif, conf);
1286 trace_drv_return_int(local, ret);
1287 return ret;
1288}
1289
1290static inline void drv_stop_nan(struct ieee80211_local *local,
1291 struct ieee80211_sub_if_data *sdata)
1292{
1293 might_sleep();
1294 check_sdata_in_driver(sdata);
1295
1296 trace_drv_stop_nan(local, sdata);
1297 local->ops->stop_nan(&local->hw, &sdata->vif);
1298 trace_drv_return_void(local);
1299}
1300
5953ff6d
AB
1301static inline int drv_nan_change_conf(struct ieee80211_local *local,
1302 struct ieee80211_sub_if_data *sdata,
1303 struct cfg80211_nan_conf *conf,
1304 u32 changes)
1305{
1306 int ret;
1307
1308 might_sleep();
1309 check_sdata_in_driver(sdata);
1310
1311 if (!local->ops->nan_change_conf)
1312 return -EOPNOTSUPP;
1313
1314 trace_drv_nan_change_conf(local, sdata, conf, changes);
1315 ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf,
1316 changes);
1317 trace_drv_return_int(local, ret);
1318
1319 return ret;
1320}
1321
167e33f4
AB
1322static inline int drv_add_nan_func(struct ieee80211_local *local,
1323 struct ieee80211_sub_if_data *sdata,
1324 const struct cfg80211_nan_func *nan_func)
1325{
1326 int ret;
1327
1328 might_sleep();
1329 check_sdata_in_driver(sdata);
1330
1331 if (!local->ops->add_nan_func)
1332 return -EOPNOTSUPP;
1333
1334 trace_drv_add_nan_func(local, sdata, nan_func);
1335 ret = local->ops->add_nan_func(&local->hw, &sdata->vif, nan_func);
1336 trace_drv_return_int(local, ret);
1337
1338 return ret;
1339}
1340
1341static inline void drv_del_nan_func(struct ieee80211_local *local,
1342 struct ieee80211_sub_if_data *sdata,
1343 u8 instance_id)
1344{
1345 might_sleep();
1346 check_sdata_in_driver(sdata);
1347
1348 trace_drv_del_nan_func(local, sdata, instance_id);
1349 if (local->ops->del_nan_func)
1350 local->ops->del_nan_func(&local->hw, &sdata->vif, instance_id);
1351 trace_drv_return_void(local);
1352}
1353
24487981 1354#endif /* __MAC80211_DRIVER_OPS */