mac80211: clean up mpath_move_to_queue()
[deliverable/linux.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
7b7eab6f
JB
8static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
9{
d17087e7
BG
10 WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
11 "%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
12 sdata->dev->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
JB
148 (sdata->vif.type == NL80211_IFTYPE_MONITOR &&
149 !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF))))
7b7eab6f
JB
150 return -EINVAL;
151
152 trace_drv_add_interface(local, sdata);
153 ret = local->ops->add_interface(&local->hw, &sdata->vif);
4efc76bd 154 trace_drv_return_int(local, ret);
7b7eab6f
JB
155
156 if (ret == 0)
157 sdata->flags |= IEEE80211_SDATA_IN_DRIVER;
158
0a2b8bb2 159 return ret;
24487981
JB
160}
161
34d4bc4d
JB
162static inline int drv_change_interface(struct ieee80211_local *local,
163 struct ieee80211_sub_if_data *sdata,
2ca27bcf 164 enum nl80211_iftype type, bool p2p)
34d4bc4d
JB
165{
166 int ret;
167
168 might_sleep();
169
7b7eab6f
JB
170 check_sdata_in_driver(sdata);
171
2ca27bcf
JB
172 trace_drv_change_interface(local, sdata, type, p2p);
173 ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
34d4bc4d
JB
174 trace_drv_return_int(local, ret);
175 return ret;
176}
177
24487981 178static inline void drv_remove_interface(struct ieee80211_local *local,
7b7eab6f 179 struct ieee80211_sub_if_data *sdata)
24487981 180{
e1781ed3
KV
181 might_sleep();
182
7b7eab6f
JB
183 check_sdata_in_driver(sdata);
184
185 trace_drv_remove_interface(local, sdata);
186 local->ops->remove_interface(&local->hw, &sdata->vif);
187 sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER;
4efc76bd 188 trace_drv_return_void(local);
24487981
JB
189}
190
191static inline int drv_config(struct ieee80211_local *local, u32 changed)
192{
e1781ed3
KV
193 int ret;
194
195 might_sleep();
196
4efc76bd 197 trace_drv_config(local, changed);
e1781ed3 198 ret = local->ops->config(&local->hw, changed);
4efc76bd 199 trace_drv_return_int(local, ret);
0a2b8bb2 200 return ret;
24487981
JB
201}
202
203static inline void drv_bss_info_changed(struct ieee80211_local *local,
12375ef9 204 struct ieee80211_sub_if_data *sdata,
24487981
JB
205 struct ieee80211_bss_conf *info,
206 u32 changed)
207{
e1781ed3
KV
208 might_sleep();
209
7b7eab6f
JB
210 check_sdata_in_driver(sdata);
211
4efc76bd 212 trace_drv_bss_info_changed(local, sdata, info, changed);
24487981 213 if (local->ops->bss_info_changed)
12375ef9 214 local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed);
4efc76bd 215 trace_drv_return_void(local);
24487981
JB
216}
217
3ac64bee 218static inline u64 drv_prepare_multicast(struct ieee80211_local *local,
22bedad3 219 struct netdev_hw_addr_list *mc_list)
3ac64bee
JB
220{
221 u64 ret = 0;
222
4efc76bd
JB
223 trace_drv_prepare_multicast(local, mc_list->count);
224
3ac64bee 225 if (local->ops->prepare_multicast)
22bedad3 226 ret = local->ops->prepare_multicast(&local->hw, mc_list);
3ac64bee 227
4efc76bd 228 trace_drv_return_u64(local, ret);
3ac64bee
JB
229
230 return ret;
231}
232
24487981
JB
233static inline void drv_configure_filter(struct ieee80211_local *local,
234 unsigned int changed_flags,
235 unsigned int *total_flags,
3ac64bee 236 u64 multicast)
24487981 237{
3ac64bee
JB
238 might_sleep();
239
0a2b8bb2 240 trace_drv_configure_filter(local, changed_flags, total_flags,
3ac64bee 241 multicast);
4efc76bd
JB
242 local->ops->configure_filter(&local->hw, changed_flags, total_flags,
243 multicast);
244 trace_drv_return_void(local);
24487981
JB
245}
246
247static inline int drv_set_tim(struct ieee80211_local *local,
248 struct ieee80211_sta *sta, bool set)
249{
0a2b8bb2 250 int ret = 0;
4efc76bd 251 trace_drv_set_tim(local, sta, set);
24487981 252 if (local->ops->set_tim)
0a2b8bb2 253 ret = local->ops->set_tim(&local->hw, sta, set);
4efc76bd 254 trace_drv_return_int(local, ret);
0a2b8bb2 255 return ret;
24487981
JB
256}
257
258static inline int drv_set_key(struct ieee80211_local *local,
12375ef9
JB
259 enum set_key_cmd cmd,
260 struct ieee80211_sub_if_data *sdata,
24487981
JB
261 struct ieee80211_sta *sta,
262 struct ieee80211_key_conf *key)
263{
e1781ed3
KV
264 int ret;
265
266 might_sleep();
267
077f4939 268 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
269 check_sdata_in_driver(sdata);
270
4efc76bd 271 trace_drv_set_key(local, cmd, sdata, sta, key);
e1781ed3 272 ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key);
4efc76bd 273 trace_drv_return_int(local, ret);
0a2b8bb2 274 return ret;
24487981
JB
275}
276
277static inline void drv_update_tkip_key(struct ieee80211_local *local,
b3fbdcf4 278 struct ieee80211_sub_if_data *sdata,
24487981 279 struct ieee80211_key_conf *conf,
b3fbdcf4 280 struct sta_info *sta, u32 iv32,
24487981
JB
281 u16 *phase1key)
282{
b3fbdcf4
JB
283 struct ieee80211_sta *ista = NULL;
284
b3fbdcf4
JB
285 if (sta)
286 ista = &sta->sta;
287
077f4939 288 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
289 check_sdata_in_driver(sdata);
290
4efc76bd 291 trace_drv_update_tkip_key(local, sdata, conf, ista, iv32);
24487981 292 if (local->ops->update_tkip_key)
b3fbdcf4
JB
293 local->ops->update_tkip_key(&local->hw, &sdata->vif, conf,
294 ista, iv32, phase1key);
4efc76bd 295 trace_drv_return_void(local);
24487981
JB
296}
297
298static inline int drv_hw_scan(struct ieee80211_local *local,
a060bbfe 299 struct ieee80211_sub_if_data *sdata,
24487981
JB
300 struct cfg80211_scan_request *req)
301{
e1781ed3
KV
302 int ret;
303
304 might_sleep();
305
7b7eab6f
JB
306 check_sdata_in_driver(sdata);
307
79f460ca 308 trace_drv_hw_scan(local, sdata);
a060bbfe 309 ret = local->ops->hw_scan(&local->hw, &sdata->vif, req);
4efc76bd 310 trace_drv_return_int(local, ret);
0a2b8bb2 311 return ret;
24487981
JB
312}
313
b856439b
EP
314static inline void drv_cancel_hw_scan(struct ieee80211_local *local,
315 struct ieee80211_sub_if_data *sdata)
316{
317 might_sleep();
318
7b7eab6f
JB
319 check_sdata_in_driver(sdata);
320
b856439b
EP
321 trace_drv_cancel_hw_scan(local, sdata);
322 local->ops->cancel_hw_scan(&local->hw, &sdata->vif);
323 trace_drv_return_void(local);
324}
325
79f460ca
LC
326static inline int
327drv_sched_scan_start(struct ieee80211_local *local,
328 struct ieee80211_sub_if_data *sdata,
329 struct cfg80211_sched_scan_request *req,
330 struct ieee80211_sched_scan_ies *ies)
331{
332 int ret;
333
334 might_sleep();
335
7b7eab6f
JB
336 check_sdata_in_driver(sdata);
337
79f460ca
LC
338 trace_drv_sched_scan_start(local, sdata);
339 ret = local->ops->sched_scan_start(&local->hw, &sdata->vif,
340 req, ies);
341 trace_drv_return_int(local, ret);
342 return ret;
343}
344
345static inline void drv_sched_scan_stop(struct ieee80211_local *local,
346 struct ieee80211_sub_if_data *sdata)
347{
348 might_sleep();
349
7b7eab6f
JB
350 check_sdata_in_driver(sdata);
351
79f460ca
LC
352 trace_drv_sched_scan_stop(local, sdata);
353 local->ops->sched_scan_stop(&local->hw, &sdata->vif);
354 trace_drv_return_void(local);
355}
356
24487981
JB
357static inline void drv_sw_scan_start(struct ieee80211_local *local)
358{
e1781ed3
KV
359 might_sleep();
360
4efc76bd 361 trace_drv_sw_scan_start(local);
24487981
JB
362 if (local->ops->sw_scan_start)
363 local->ops->sw_scan_start(&local->hw);
4efc76bd 364 trace_drv_return_void(local);
24487981
JB
365}
366
367static inline void drv_sw_scan_complete(struct ieee80211_local *local)
368{
e1781ed3
KV
369 might_sleep();
370
4efc76bd 371 trace_drv_sw_scan_complete(local);
24487981
JB
372 if (local->ops->sw_scan_complete)
373 local->ops->sw_scan_complete(&local->hw);
4efc76bd 374 trace_drv_return_void(local);
24487981
JB
375}
376
377static inline int drv_get_stats(struct ieee80211_local *local,
378 struct ieee80211_low_level_stats *stats)
379{
0a2b8bb2
JB
380 int ret = -EOPNOTSUPP;
381
e1781ed3
KV
382 might_sleep();
383
0a2b8bb2
JB
384 if (local->ops->get_stats)
385 ret = local->ops->get_stats(&local->hw, stats);
386 trace_drv_get_stats(local, stats, ret);
387
388 return ret;
24487981
JB
389}
390
391static inline void drv_get_tkip_seq(struct ieee80211_local *local,
392 u8 hw_key_idx, u32 *iv32, u16 *iv16)
393{
394 if (local->ops->get_tkip_seq)
395 local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16);
0a2b8bb2 396 trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16);
24487981
JB
397}
398
f23a4780
AN
399static inline int drv_set_frag_threshold(struct ieee80211_local *local,
400 u32 value)
401{
402 int ret = 0;
403
404 might_sleep();
405
406 trace_drv_set_frag_threshold(local, value);
407 if (local->ops->set_frag_threshold)
408 ret = local->ops->set_frag_threshold(&local->hw, value);
409 trace_drv_return_int(local, ret);
410 return ret;
411}
412
24487981
JB
413static inline int drv_set_rts_threshold(struct ieee80211_local *local,
414 u32 value)
415{
0a2b8bb2 416 int ret = 0;
e1781ed3
KV
417
418 might_sleep();
419
4efc76bd 420 trace_drv_set_rts_threshold(local, value);
24487981 421 if (local->ops->set_rts_threshold)
0a2b8bb2 422 ret = local->ops->set_rts_threshold(&local->hw, value);
4efc76bd 423 trace_drv_return_int(local, ret);
0a2b8bb2 424 return ret;
24487981
JB
425}
426
310bc676
LT
427static inline int drv_set_coverage_class(struct ieee80211_local *local,
428 u8 value)
429{
430 int ret = 0;
431 might_sleep();
432
4efc76bd 433 trace_drv_set_coverage_class(local, value);
310bc676
LT
434 if (local->ops->set_coverage_class)
435 local->ops->set_coverage_class(&local->hw, value);
436 else
437 ret = -EOPNOTSUPP;
438
4efc76bd 439 trace_drv_return_int(local, ret);
310bc676
LT
440 return ret;
441}
442
24487981 443static inline void drv_sta_notify(struct ieee80211_local *local,
12375ef9 444 struct ieee80211_sub_if_data *sdata,
24487981
JB
445 enum sta_notify_cmd cmd,
446 struct ieee80211_sta *sta)
447{
bc192f89 448 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
449 check_sdata_in_driver(sdata);
450
4efc76bd 451 trace_drv_sta_notify(local, sdata, cmd, sta);
24487981 452 if (local->ops->sta_notify)
12375ef9 453 local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta);
4efc76bd 454 trace_drv_return_void(local);
24487981
JB
455}
456
34e89507
JB
457static inline int drv_sta_add(struct ieee80211_local *local,
458 struct ieee80211_sub_if_data *sdata,
459 struct ieee80211_sta *sta)
460{
461 int ret = 0;
462
463 might_sleep();
464
bc192f89 465 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
466 check_sdata_in_driver(sdata);
467
4efc76bd 468 trace_drv_sta_add(local, sdata, sta);
34e89507
JB
469 if (local->ops->sta_add)
470 ret = local->ops->sta_add(&local->hw, &sdata->vif, sta);
34e89507 471
4efc76bd 472 trace_drv_return_int(local, ret);
34e89507
JB
473
474 return ret;
475}
476
477static 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
bc192f89 483 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
484 check_sdata_in_driver(sdata);
485
4efc76bd 486 trace_drv_sta_remove(local, sdata, sta);
34e89507
JB
487 if (local->ops->sta_remove)
488 local->ops->sta_remove(&local->hw, &sdata->vif, sta);
34e89507 489
4efc76bd 490 trace_drv_return_void(local);
34e89507
JB
491}
492
f09603a2
JB
493static inline __must_check
494int drv_sta_state(struct ieee80211_local *local,
495 struct ieee80211_sub_if_data *sdata,
496 struct sta_info *sta,
497 enum ieee80211_sta_state old_state,
498 enum ieee80211_sta_state new_state)
499{
500 int ret = 0;
501
502 might_sleep();
503
504 sdata = get_bss_sdata(sdata);
505 check_sdata_in_driver(sdata);
506
507 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
a4ec45a4 508 if (local->ops->sta_state) {
f09603a2
JB
509 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
510 old_state, new_state);
a4ec45a4
JB
511 } else if (old_state == IEEE80211_STA_AUTH &&
512 new_state == IEEE80211_STA_ASSOC) {
513 ret = drv_sta_add(local, sdata, &sta->sta);
514 if (ret == 0)
515 sta->uploaded = true;
516 } else if (old_state == IEEE80211_STA_ASSOC &&
517 new_state == IEEE80211_STA_AUTH) {
518 drv_sta_remove(local, sdata, &sta->sta);
519 }
f09603a2
JB
520 trace_drv_return_int(local, ret);
521 return ret;
522}
523
8f727ef3
JB
524static inline void drv_sta_rc_update(struct ieee80211_local *local,
525 struct ieee80211_sub_if_data *sdata,
526 struct ieee80211_sta *sta, u32 changed)
527{
528 sdata = get_bss_sdata(sdata);
529 check_sdata_in_driver(sdata);
530
531 trace_drv_sta_rc_update(local, sdata, sta, changed);
532 if (local->ops->sta_rc_update)
533 local->ops->sta_rc_update(&local->hw, &sdata->vif,
534 sta, changed);
535
536 trace_drv_return_void(local);
537}
538
f6f3def3 539static inline int drv_conf_tx(struct ieee80211_local *local,
a3304b0a 540 struct ieee80211_sub_if_data *sdata, u16 ac,
24487981
JB
541 const struct ieee80211_tx_queue_params *params)
542{
0a2b8bb2 543 int ret = -EOPNOTSUPP;
e1781ed3
KV
544
545 might_sleep();
546
7b7eab6f
JB
547 check_sdata_in_driver(sdata);
548
a3304b0a 549 trace_drv_conf_tx(local, sdata, ac, params);
24487981 550 if (local->ops->conf_tx)
8a3a3c85 551 ret = local->ops->conf_tx(&local->hw, &sdata->vif,
a3304b0a 552 ac, params);
4efc76bd 553 trace_drv_return_int(local, ret);
0a2b8bb2 554 return ret;
24487981
JB
555}
556
37a41b4a
EP
557static inline u64 drv_get_tsf(struct ieee80211_local *local,
558 struct ieee80211_sub_if_data *sdata)
24487981 559{
0a2b8bb2 560 u64 ret = -1ULL;
e1781ed3
KV
561
562 might_sleep();
563
7b7eab6f
JB
564 check_sdata_in_driver(sdata);
565
37a41b4a 566 trace_drv_get_tsf(local, sdata);
24487981 567 if (local->ops->get_tsf)
37a41b4a 568 ret = local->ops->get_tsf(&local->hw, &sdata->vif);
4efc76bd 569 trace_drv_return_u64(local, ret);
0a2b8bb2 570 return ret;
24487981
JB
571}
572
37a41b4a
EP
573static inline void drv_set_tsf(struct ieee80211_local *local,
574 struct ieee80211_sub_if_data *sdata,
575 u64 tsf)
24487981 576{
e1781ed3
KV
577 might_sleep();
578
7b7eab6f
JB
579 check_sdata_in_driver(sdata);
580
37a41b4a 581 trace_drv_set_tsf(local, sdata, tsf);
24487981 582 if (local->ops->set_tsf)
37a41b4a 583 local->ops->set_tsf(&local->hw, &sdata->vif, tsf);
4efc76bd 584 trace_drv_return_void(local);
24487981
JB
585}
586
37a41b4a
EP
587static inline void drv_reset_tsf(struct ieee80211_local *local,
588 struct ieee80211_sub_if_data *sdata)
24487981 589{
e1781ed3
KV
590 might_sleep();
591
7b7eab6f
JB
592 check_sdata_in_driver(sdata);
593
37a41b4a 594 trace_drv_reset_tsf(local, sdata);
24487981 595 if (local->ops->reset_tsf)
37a41b4a 596 local->ops->reset_tsf(&local->hw, &sdata->vif);
4efc76bd 597 trace_drv_return_void(local);
24487981
JB
598}
599
600static inline int drv_tx_last_beacon(struct ieee80211_local *local)
601{
91f44b02 602 int ret = 0; /* default unsuported op for less congestion */
e1781ed3
KV
603
604 might_sleep();
605
4efc76bd 606 trace_drv_tx_last_beacon(local);
24487981 607 if (local->ops->tx_last_beacon)
0a2b8bb2 608 ret = local->ops->tx_last_beacon(&local->hw);
4efc76bd 609 trace_drv_return_int(local, ret);
0a2b8bb2 610 return ret;
24487981
JB
611}
612
613static inline int drv_ampdu_action(struct ieee80211_local *local,
12375ef9 614 struct ieee80211_sub_if_data *sdata,
24487981
JB
615 enum ieee80211_ampdu_mlme_action action,
616 struct ieee80211_sta *sta, u16 tid,
0b01f030 617 u16 *ssn, u8 buf_size)
24487981 618{
0a2b8bb2 619 int ret = -EOPNOTSUPP;
cfcdbde3
JB
620
621 might_sleep();
622
bc192f89 623 sdata = get_bss_sdata(sdata);
7b7eab6f
JB
624 check_sdata_in_driver(sdata);
625
0b01f030 626 trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size);
4efc76bd 627
24487981 628 if (local->ops->ampdu_action)
12375ef9 629 ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action,
0b01f030 630 sta, tid, ssn, buf_size);
85ad181e 631
4efc76bd
JB
632 trace_drv_return_int(local, ret);
633
0a2b8bb2 634 return ret;
24487981 635}
1f87f7d3 636
1289723e
HS
637static inline int drv_get_survey(struct ieee80211_local *local, int idx,
638 struct survey_info *survey)
639{
640 int ret = -EOPNOTSUPP;
c466d4ef
JL
641
642 trace_drv_get_survey(local, idx, survey);
643
35dd0509 644 if (local->ops->get_survey)
1289723e 645 ret = local->ops->get_survey(&local->hw, idx, survey);
c466d4ef
JL
646
647 trace_drv_return_int(local, ret);
648
1289723e
HS
649 return ret;
650}
1f87f7d3
JB
651
652static inline void drv_rfkill_poll(struct ieee80211_local *local)
653{
e1781ed3
KV
654 might_sleep();
655
1f87f7d3
JB
656 if (local->ops->rfkill_poll)
657 local->ops->rfkill_poll(&local->hw);
658}
a80f7c0b
JB
659
660static inline void drv_flush(struct ieee80211_local *local, bool drop)
661{
e1781ed3
KV
662 might_sleep();
663
a80f7c0b
JB
664 trace_drv_flush(local, drop);
665 if (local->ops->flush)
666 local->ops->flush(&local->hw, drop);
4efc76bd 667 trace_drv_return_void(local);
a80f7c0b 668}
5ce6e438
JB
669
670static inline void drv_channel_switch(struct ieee80211_local *local,
671 struct ieee80211_channel_switch *ch_switch)
672{
673 might_sleep();
674
5ce6e438 675 trace_drv_channel_switch(local, ch_switch);
4efc76bd
JB
676 local->ops->channel_switch(&local->hw, ch_switch);
677 trace_drv_return_void(local);
5ce6e438
JB
678}
679
15d96753
BR
680
681static inline int drv_set_antenna(struct ieee80211_local *local,
682 u32 tx_ant, u32 rx_ant)
683{
684 int ret = -EOPNOTSUPP;
685 might_sleep();
686 if (local->ops->set_antenna)
687 ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant);
688 trace_drv_set_antenna(local, tx_ant, rx_ant, ret);
689 return ret;
690}
691
692static inline int drv_get_antenna(struct ieee80211_local *local,
693 u32 *tx_ant, u32 *rx_ant)
694{
695 int ret = -EOPNOTSUPP;
696 might_sleep();
697 if (local->ops->get_antenna)
698 ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant);
699 trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret);
700 return ret;
701}
702
21f83589
JB
703static inline int drv_remain_on_channel(struct ieee80211_local *local,
704 struct ieee80211_channel *chan,
705 enum nl80211_channel_type chantype,
706 unsigned int duration)
707{
708 int ret;
709
710 might_sleep();
711
712 trace_drv_remain_on_channel(local, chan, chantype, duration);
713 ret = local->ops->remain_on_channel(&local->hw, chan, chantype,
714 duration);
715 trace_drv_return_int(local, ret);
716
717 return ret;
718}
719
720static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local)
721{
722 int ret;
723
724 might_sleep();
725
726 trace_drv_cancel_remain_on_channel(local);
727 ret = local->ops->cancel_remain_on_channel(&local->hw);
728 trace_drv_return_int(local, ret);
5f16a436
JB
729
730 return ret;
731}
732
38c09159
JL
733static inline int drv_set_ringparam(struct ieee80211_local *local,
734 u32 tx, u32 rx)
735{
736 int ret = -ENOTSUPP;
737
738 might_sleep();
739
740 trace_drv_set_ringparam(local, tx, rx);
741 if (local->ops->set_ringparam)
742 ret = local->ops->set_ringparam(&local->hw, tx, rx);
743 trace_drv_return_int(local, ret);
744
745 return ret;
746}
747
748static inline void drv_get_ringparam(struct ieee80211_local *local,
749 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max)
750{
751 might_sleep();
752
753 trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max);
754 if (local->ops->get_ringparam)
755 local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max);
756 trace_drv_return_void(local);
757}
758
e8306f98
VN
759static inline bool drv_tx_frames_pending(struct ieee80211_local *local)
760{
761 bool ret = false;
762
763 might_sleep();
764
765 trace_drv_tx_frames_pending(local);
766 if (local->ops->tx_frames_pending)
767 ret = local->ops->tx_frames_pending(&local->hw);
768 trace_drv_return_bool(local, ret);
769
770 return ret;
771}
bdbfd6b5
SM
772
773static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
774 struct ieee80211_sub_if_data *sdata,
775 const struct cfg80211_bitrate_mask *mask)
776{
777 int ret = -EOPNOTSUPP;
778
779 might_sleep();
780
7b7eab6f
JB
781 check_sdata_in_driver(sdata);
782
bdbfd6b5
SM
783 trace_drv_set_bitrate_mask(local, sdata, mask);
784 if (local->ops->set_bitrate_mask)
785 ret = local->ops->set_bitrate_mask(&local->hw,
786 &sdata->vif, mask);
787 trace_drv_return_int(local, ret);
788
789 return ret;
790}
791
c68f4b89
JB
792static inline void drv_set_rekey_data(struct ieee80211_local *local,
793 struct ieee80211_sub_if_data *sdata,
794 struct cfg80211_gtk_rekey_data *data)
795{
7b7eab6f
JB
796 check_sdata_in_driver(sdata);
797
c68f4b89
JB
798 trace_drv_set_rekey_data(local, sdata, data);
799 if (local->ops->set_rekey_data)
800 local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
801 trace_drv_return_void(local);
802}
803
615f7b9b
MV
804static inline void drv_rssi_callback(struct ieee80211_local *local,
805 const enum ieee80211_rssi_event event)
806{
807 trace_drv_rssi_callback(local, event);
808 if (local->ops->rssi_callback)
809 local->ops->rssi_callback(&local->hw, event);
810 trace_drv_return_void(local);
811}
4049e09a
JB
812
813static inline void
814drv_release_buffered_frames(struct ieee80211_local *local,
815 struct sta_info *sta, u16 tids, int num_frames,
816 enum ieee80211_frame_release_type reason,
817 bool more_data)
818{
819 trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames,
820 reason, more_data);
821 if (local->ops->release_buffered_frames)
822 local->ops->release_buffered_frames(&local->hw, &sta->sta, tids,
823 num_frames, reason,
824 more_data);
825 trace_drv_return_void(local);
826}
40b96408
JB
827
828static inline void
829drv_allow_buffered_frames(struct ieee80211_local *local,
830 struct sta_info *sta, u16 tids, int num_frames,
831 enum ieee80211_frame_release_type reason,
832 bool more_data)
833{
834 trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames,
835 reason, more_data);
836 if (local->ops->allow_buffered_frames)
837 local->ops->allow_buffered_frames(&local->hw, &sta->sta,
838 tids, num_frames, reason,
839 more_data);
840 trace_drv_return_void(local);
841}
66572cfc
VG
842
843static inline int drv_get_rssi(struct ieee80211_local *local,
844 struct ieee80211_sub_if_data *sdata,
845 struct ieee80211_sta *sta,
846 s8 *rssi_dbm)
847{
848 int ret;
849
850 might_sleep();
851
852 ret = local->ops->get_rssi(&local->hw, &sdata->vif, sta, rssi_dbm);
853 trace_drv_get_rssi(local, sta, *rssi_dbm, ret);
854
855 return ret;
856}
a1845fc7
JB
857
858static inline void drv_mgd_prepare_tx(struct ieee80211_local *local,
859 struct ieee80211_sub_if_data *sdata)
860{
861 might_sleep();
862
863 check_sdata_in_driver(sdata);
864 WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION);
865
866 trace_drv_mgd_prepare_tx(local, sdata);
867 if (local->ops->mgd_prepare_tx)
868 local->ops->mgd_prepare_tx(&local->hw, &sdata->vif);
869 trace_drv_return_void(local);
870}
24487981 871#endif /* __MAC80211_DRIVER_OPS */
This page took 0.315413 seconds and 5 git commands to generate.