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