Commit | Line | Data |
---|---|---|
24487981 JB |
1 | #ifndef __MAC80211_DRIVER_OPS |
2 | #define __MAC80211_DRIVER_OPS | |
3 | ||
4 | #include <net/mac80211.h> | |
5 | #include "ieee80211_i.h" | |
0a2b8bb2 | 6 | #include "driver-trace.h" |
24487981 | 7 | |
7b7eab6f JB |
8 | static 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 |
15 | static inline struct ieee80211_sub_if_data * |
16 | get_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 | ||
7bb45683 | 25 | static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) |
24487981 | 26 | { |
7bb45683 | 27 | local->ops->tx(&local->hw, skb); |
24487981 JB |
28 | } |
29 | ||
11127e91 JB |
30 | static inline void drv_tx_frags(struct ieee80211_local *local, |
31 | struct ieee80211_vif *vif, | |
32 | struct ieee80211_sta *sta, | |
33 | struct sk_buff_head *skbs) | |
34 | { | |
35 | local->ops->tx_frags(&local->hw, vif, sta, skbs); | |
36 | } | |
37 | ||
24487981 JB |
38 | static inline int drv_start(struct ieee80211_local *local) |
39 | { | |
ea77f12f JB |
40 | int ret; |
41 | ||
e1781ed3 KV |
42 | might_sleep(); |
43 | ||
4efc76bd | 44 | trace_drv_start(local); |
ea77f12f JB |
45 | local->started = true; |
46 | smp_mb(); | |
47 | ret = local->ops->start(&local->hw); | |
4efc76bd | 48 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 49 | return ret; |
24487981 JB |
50 | } |
51 | ||
52 | static inline void drv_stop(struct ieee80211_local *local) | |
53 | { | |
e1781ed3 KV |
54 | might_sleep(); |
55 | ||
0a2b8bb2 | 56 | trace_drv_stop(local); |
4efc76bd JB |
57 | local->ops->stop(&local->hw); |
58 | trace_drv_return_void(local); | |
ea77f12f JB |
59 | |
60 | /* sync away all work on the tasklet before clearing started */ | |
61 | tasklet_disable(&local->tasklet); | |
62 | tasklet_enable(&local->tasklet); | |
63 | ||
64 | barrier(); | |
65 | ||
66 | local->started = false; | |
24487981 JB |
67 | } |
68 | ||
eecc4800 JB |
69 | #ifdef CONFIG_PM |
70 | static inline int drv_suspend(struct ieee80211_local *local, | |
71 | struct cfg80211_wowlan *wowlan) | |
72 | { | |
73 | int ret; | |
74 | ||
75 | might_sleep(); | |
76 | ||
77 | trace_drv_suspend(local); | |
78 | ret = local->ops->suspend(&local->hw, wowlan); | |
79 | trace_drv_return_int(local, ret); | |
80 | return ret; | |
81 | } | |
82 | ||
83 | static inline int drv_resume(struct ieee80211_local *local) | |
84 | { | |
85 | int ret; | |
86 | ||
87 | might_sleep(); | |
88 | ||
89 | trace_drv_resume(local); | |
90 | ret = local->ops->resume(&local->hw); | |
91 | trace_drv_return_int(local, ret); | |
92 | return ret; | |
93 | } | |
6d52563f JB |
94 | |
95 | static inline void drv_set_wakeup(struct ieee80211_local *local, | |
96 | bool enabled) | |
97 | { | |
98 | might_sleep(); | |
99 | ||
100 | if (!local->ops->set_wakeup) | |
101 | return; | |
102 | ||
103 | trace_drv_set_wakeup(local, enabled); | |
104 | local->ops->set_wakeup(&local->hw, enabled); | |
105 | trace_drv_return_void(local); | |
106 | } | |
eecc4800 JB |
107 | #endif |
108 | ||
24487981 | 109 | static inline int drv_add_interface(struct ieee80211_local *local, |
7b7eab6f | 110 | struct ieee80211_sub_if_data *sdata) |
24487981 | 111 | { |
e1781ed3 KV |
112 | int ret; |
113 | ||
114 | might_sleep(); | |
115 | ||
7b7eab6f | 116 | if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
4b6f1dd6 JB |
117 | (sdata->vif.type == NL80211_IFTYPE_MONITOR && |
118 | !(local->hw.flags & IEEE80211_HW_WANT_MONITOR_VIF)))) | |
7b7eab6f JB |
119 | return -EINVAL; |
120 | ||
121 | trace_drv_add_interface(local, sdata); | |
122 | ret = local->ops->add_interface(&local->hw, &sdata->vif); | |
4efc76bd | 123 | trace_drv_return_int(local, ret); |
7b7eab6f JB |
124 | |
125 | if (ret == 0) | |
126 | sdata->flags |= IEEE80211_SDATA_IN_DRIVER; | |
127 | ||
0a2b8bb2 | 128 | return ret; |
24487981 JB |
129 | } |
130 | ||
34d4bc4d JB |
131 | static inline int drv_change_interface(struct ieee80211_local *local, |
132 | struct ieee80211_sub_if_data *sdata, | |
2ca27bcf | 133 | enum nl80211_iftype type, bool p2p) |
34d4bc4d JB |
134 | { |
135 | int ret; | |
136 | ||
137 | might_sleep(); | |
138 | ||
7b7eab6f JB |
139 | check_sdata_in_driver(sdata); |
140 | ||
2ca27bcf JB |
141 | trace_drv_change_interface(local, sdata, type, p2p); |
142 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); | |
34d4bc4d JB |
143 | trace_drv_return_int(local, ret); |
144 | return ret; | |
145 | } | |
146 | ||
24487981 | 147 | static inline void drv_remove_interface(struct ieee80211_local *local, |
7b7eab6f | 148 | struct ieee80211_sub_if_data *sdata) |
24487981 | 149 | { |
e1781ed3 KV |
150 | might_sleep(); |
151 | ||
7b7eab6f JB |
152 | check_sdata_in_driver(sdata); |
153 | ||
154 | trace_drv_remove_interface(local, sdata); | |
155 | local->ops->remove_interface(&local->hw, &sdata->vif); | |
156 | sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; | |
4efc76bd | 157 | trace_drv_return_void(local); |
24487981 JB |
158 | } |
159 | ||
160 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | |
161 | { | |
e1781ed3 KV |
162 | int ret; |
163 | ||
164 | might_sleep(); | |
165 | ||
4efc76bd | 166 | trace_drv_config(local, changed); |
e1781ed3 | 167 | ret = local->ops->config(&local->hw, changed); |
4efc76bd | 168 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 169 | return ret; |
24487981 JB |
170 | } |
171 | ||
172 | static inline void drv_bss_info_changed(struct ieee80211_local *local, | |
12375ef9 | 173 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
174 | struct ieee80211_bss_conf *info, |
175 | u32 changed) | |
176 | { | |
e1781ed3 KV |
177 | might_sleep(); |
178 | ||
7b7eab6f JB |
179 | check_sdata_in_driver(sdata); |
180 | ||
4efc76bd | 181 | trace_drv_bss_info_changed(local, sdata, info, changed); |
24487981 | 182 | if (local->ops->bss_info_changed) |
12375ef9 | 183 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
4efc76bd | 184 | trace_drv_return_void(local); |
24487981 JB |
185 | } |
186 | ||
3ac64bee | 187 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
22bedad3 | 188 | struct netdev_hw_addr_list *mc_list) |
3ac64bee JB |
189 | { |
190 | u64 ret = 0; | |
191 | ||
4efc76bd JB |
192 | trace_drv_prepare_multicast(local, mc_list->count); |
193 | ||
3ac64bee | 194 | if (local->ops->prepare_multicast) |
22bedad3 | 195 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
3ac64bee | 196 | |
4efc76bd | 197 | trace_drv_return_u64(local, ret); |
3ac64bee JB |
198 | |
199 | return ret; | |
200 | } | |
201 | ||
24487981 JB |
202 | static inline void drv_configure_filter(struct ieee80211_local *local, |
203 | unsigned int changed_flags, | |
204 | unsigned int *total_flags, | |
3ac64bee | 205 | u64 multicast) |
24487981 | 206 | { |
3ac64bee JB |
207 | might_sleep(); |
208 | ||
0a2b8bb2 | 209 | trace_drv_configure_filter(local, changed_flags, total_flags, |
3ac64bee | 210 | multicast); |
4efc76bd JB |
211 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
212 | multicast); | |
213 | trace_drv_return_void(local); | |
24487981 JB |
214 | } |
215 | ||
216 | static inline int drv_set_tim(struct ieee80211_local *local, | |
217 | struct ieee80211_sta *sta, bool set) | |
218 | { | |
0a2b8bb2 | 219 | int ret = 0; |
4efc76bd | 220 | trace_drv_set_tim(local, sta, set); |
24487981 | 221 | if (local->ops->set_tim) |
0a2b8bb2 | 222 | ret = local->ops->set_tim(&local->hw, sta, set); |
4efc76bd | 223 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 224 | return ret; |
24487981 JB |
225 | } |
226 | ||
227 | static inline int drv_set_key(struct ieee80211_local *local, | |
12375ef9 JB |
228 | enum set_key_cmd cmd, |
229 | struct ieee80211_sub_if_data *sdata, | |
24487981 JB |
230 | struct ieee80211_sta *sta, |
231 | struct ieee80211_key_conf *key) | |
232 | { | |
e1781ed3 KV |
233 | int ret; |
234 | ||
235 | might_sleep(); | |
236 | ||
077f4939 | 237 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
238 | check_sdata_in_driver(sdata); |
239 | ||
4efc76bd | 240 | trace_drv_set_key(local, cmd, sdata, sta, key); |
e1781ed3 | 241 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
4efc76bd | 242 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 243 | return ret; |
24487981 JB |
244 | } |
245 | ||
246 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | |
b3fbdcf4 | 247 | struct ieee80211_sub_if_data *sdata, |
24487981 | 248 | struct ieee80211_key_conf *conf, |
b3fbdcf4 | 249 | struct sta_info *sta, u32 iv32, |
24487981 JB |
250 | u16 *phase1key) |
251 | { | |
b3fbdcf4 JB |
252 | struct ieee80211_sta *ista = NULL; |
253 | ||
b3fbdcf4 JB |
254 | if (sta) |
255 | ista = &sta->sta; | |
256 | ||
077f4939 | 257 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
258 | check_sdata_in_driver(sdata); |
259 | ||
4efc76bd | 260 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
24487981 | 261 | if (local->ops->update_tkip_key) |
b3fbdcf4 JB |
262 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
263 | ista, iv32, phase1key); | |
4efc76bd | 264 | trace_drv_return_void(local); |
24487981 JB |
265 | } |
266 | ||
267 | static inline int drv_hw_scan(struct ieee80211_local *local, | |
a060bbfe | 268 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
269 | struct cfg80211_scan_request *req) |
270 | { | |
e1781ed3 KV |
271 | int ret; |
272 | ||
273 | might_sleep(); | |
274 | ||
7b7eab6f JB |
275 | check_sdata_in_driver(sdata); |
276 | ||
79f460ca | 277 | trace_drv_hw_scan(local, sdata); |
a060bbfe | 278 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
4efc76bd | 279 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 280 | return ret; |
24487981 JB |
281 | } |
282 | ||
b856439b EP |
283 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
284 | struct ieee80211_sub_if_data *sdata) | |
285 | { | |
286 | might_sleep(); | |
287 | ||
7b7eab6f JB |
288 | check_sdata_in_driver(sdata); |
289 | ||
b856439b EP |
290 | trace_drv_cancel_hw_scan(local, sdata); |
291 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); | |
292 | trace_drv_return_void(local); | |
293 | } | |
294 | ||
79f460ca LC |
295 | static inline int |
296 | drv_sched_scan_start(struct ieee80211_local *local, | |
297 | struct ieee80211_sub_if_data *sdata, | |
298 | struct cfg80211_sched_scan_request *req, | |
299 | struct ieee80211_sched_scan_ies *ies) | |
300 | { | |
301 | int ret; | |
302 | ||
303 | might_sleep(); | |
304 | ||
7b7eab6f JB |
305 | check_sdata_in_driver(sdata); |
306 | ||
79f460ca LC |
307 | trace_drv_sched_scan_start(local, sdata); |
308 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, | |
309 | req, ies); | |
310 | trace_drv_return_int(local, ret); | |
311 | return ret; | |
312 | } | |
313 | ||
314 | static inline void drv_sched_scan_stop(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 | ||
79f460ca LC |
321 | trace_drv_sched_scan_stop(local, sdata); |
322 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); | |
323 | trace_drv_return_void(local); | |
324 | } | |
325 | ||
24487981 JB |
326 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
327 | { | |
e1781ed3 KV |
328 | might_sleep(); |
329 | ||
4efc76bd | 330 | trace_drv_sw_scan_start(local); |
24487981 JB |
331 | if (local->ops->sw_scan_start) |
332 | local->ops->sw_scan_start(&local->hw); | |
4efc76bd | 333 | trace_drv_return_void(local); |
24487981 JB |
334 | } |
335 | ||
336 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) | |
337 | { | |
e1781ed3 KV |
338 | might_sleep(); |
339 | ||
4efc76bd | 340 | trace_drv_sw_scan_complete(local); |
24487981 JB |
341 | if (local->ops->sw_scan_complete) |
342 | local->ops->sw_scan_complete(&local->hw); | |
4efc76bd | 343 | trace_drv_return_void(local); |
24487981 JB |
344 | } |
345 | ||
346 | static inline int drv_get_stats(struct ieee80211_local *local, | |
347 | struct ieee80211_low_level_stats *stats) | |
348 | { | |
0a2b8bb2 JB |
349 | int ret = -EOPNOTSUPP; |
350 | ||
e1781ed3 KV |
351 | might_sleep(); |
352 | ||
0a2b8bb2 JB |
353 | if (local->ops->get_stats) |
354 | ret = local->ops->get_stats(&local->hw, stats); | |
355 | trace_drv_get_stats(local, stats, ret); | |
356 | ||
357 | return ret; | |
24487981 JB |
358 | } |
359 | ||
360 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, | |
361 | u8 hw_key_idx, u32 *iv32, u16 *iv16) | |
362 | { | |
363 | if (local->ops->get_tkip_seq) | |
364 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); | |
0a2b8bb2 | 365 | trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); |
24487981 JB |
366 | } |
367 | ||
f23a4780 AN |
368 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
369 | u32 value) | |
370 | { | |
371 | int ret = 0; | |
372 | ||
373 | might_sleep(); | |
374 | ||
375 | trace_drv_set_frag_threshold(local, value); | |
376 | if (local->ops->set_frag_threshold) | |
377 | ret = local->ops->set_frag_threshold(&local->hw, value); | |
378 | trace_drv_return_int(local, ret); | |
379 | return ret; | |
380 | } | |
381 | ||
24487981 JB |
382 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
383 | u32 value) | |
384 | { | |
0a2b8bb2 | 385 | int ret = 0; |
e1781ed3 KV |
386 | |
387 | might_sleep(); | |
388 | ||
4efc76bd | 389 | trace_drv_set_rts_threshold(local, value); |
24487981 | 390 | if (local->ops->set_rts_threshold) |
0a2b8bb2 | 391 | ret = local->ops->set_rts_threshold(&local->hw, value); |
4efc76bd | 392 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 393 | return ret; |
24487981 JB |
394 | } |
395 | ||
310bc676 LT |
396 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
397 | u8 value) | |
398 | { | |
399 | int ret = 0; | |
400 | might_sleep(); | |
401 | ||
4efc76bd | 402 | trace_drv_set_coverage_class(local, value); |
310bc676 LT |
403 | if (local->ops->set_coverage_class) |
404 | local->ops->set_coverage_class(&local->hw, value); | |
405 | else | |
406 | ret = -EOPNOTSUPP; | |
407 | ||
4efc76bd | 408 | trace_drv_return_int(local, ret); |
310bc676 LT |
409 | return ret; |
410 | } | |
411 | ||
24487981 | 412 | static inline void drv_sta_notify(struct ieee80211_local *local, |
12375ef9 | 413 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
414 | enum sta_notify_cmd cmd, |
415 | struct ieee80211_sta *sta) | |
416 | { | |
bc192f89 | 417 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
418 | check_sdata_in_driver(sdata); |
419 | ||
4efc76bd | 420 | trace_drv_sta_notify(local, sdata, cmd, sta); |
24487981 | 421 | if (local->ops->sta_notify) |
12375ef9 | 422 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
4efc76bd | 423 | trace_drv_return_void(local); |
24487981 JB |
424 | } |
425 | ||
34e89507 JB |
426 | static inline int drv_sta_add(struct ieee80211_local *local, |
427 | struct ieee80211_sub_if_data *sdata, | |
428 | struct ieee80211_sta *sta) | |
429 | { | |
430 | int ret = 0; | |
431 | ||
432 | might_sleep(); | |
433 | ||
bc192f89 | 434 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
435 | check_sdata_in_driver(sdata); |
436 | ||
4efc76bd | 437 | trace_drv_sta_add(local, sdata, sta); |
34e89507 JB |
438 | if (local->ops->sta_add) |
439 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); | |
34e89507 | 440 | |
4efc76bd | 441 | trace_drv_return_int(local, ret); |
34e89507 JB |
442 | |
443 | return ret; | |
444 | } | |
445 | ||
446 | static inline void drv_sta_remove(struct ieee80211_local *local, | |
447 | struct ieee80211_sub_if_data *sdata, | |
448 | struct ieee80211_sta *sta) | |
449 | { | |
450 | might_sleep(); | |
451 | ||
bc192f89 | 452 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
453 | check_sdata_in_driver(sdata); |
454 | ||
4efc76bd | 455 | trace_drv_sta_remove(local, sdata, sta); |
34e89507 JB |
456 | if (local->ops->sta_remove) |
457 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); | |
34e89507 | 458 | |
4efc76bd | 459 | trace_drv_return_void(local); |
34e89507 JB |
460 | } |
461 | ||
f09603a2 JB |
462 | static inline __must_check |
463 | int drv_sta_state(struct ieee80211_local *local, | |
464 | struct ieee80211_sub_if_data *sdata, | |
465 | struct sta_info *sta, | |
466 | enum ieee80211_sta_state old_state, | |
467 | enum ieee80211_sta_state new_state) | |
468 | { | |
469 | int ret = 0; | |
470 | ||
471 | might_sleep(); | |
472 | ||
473 | sdata = get_bss_sdata(sdata); | |
474 | check_sdata_in_driver(sdata); | |
475 | ||
476 | trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); | |
a4ec45a4 | 477 | if (local->ops->sta_state) { |
f09603a2 JB |
478 | ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, |
479 | old_state, new_state); | |
a4ec45a4 JB |
480 | } else if (old_state == IEEE80211_STA_AUTH && |
481 | new_state == IEEE80211_STA_ASSOC) { | |
482 | ret = drv_sta_add(local, sdata, &sta->sta); | |
483 | if (ret == 0) | |
484 | sta->uploaded = true; | |
485 | } else if (old_state == IEEE80211_STA_ASSOC && | |
486 | new_state == IEEE80211_STA_AUTH) { | |
487 | drv_sta_remove(local, sdata, &sta->sta); | |
488 | } | |
f09603a2 JB |
489 | trace_drv_return_int(local, ret); |
490 | return ret; | |
491 | } | |
492 | ||
8f727ef3 JB |
493 | static inline void drv_sta_rc_update(struct ieee80211_local *local, |
494 | struct ieee80211_sub_if_data *sdata, | |
495 | struct ieee80211_sta *sta, u32 changed) | |
496 | { | |
497 | sdata = get_bss_sdata(sdata); | |
498 | check_sdata_in_driver(sdata); | |
499 | ||
500 | trace_drv_sta_rc_update(local, sdata, sta, changed); | |
501 | if (local->ops->sta_rc_update) | |
502 | local->ops->sta_rc_update(&local->hw, &sdata->vif, | |
503 | sta, changed); | |
504 | ||
505 | trace_drv_return_void(local); | |
506 | } | |
507 | ||
f6f3def3 | 508 | static inline int drv_conf_tx(struct ieee80211_local *local, |
a3304b0a | 509 | struct ieee80211_sub_if_data *sdata, u16 ac, |
24487981 JB |
510 | const struct ieee80211_tx_queue_params *params) |
511 | { | |
0a2b8bb2 | 512 | int ret = -EOPNOTSUPP; |
e1781ed3 KV |
513 | |
514 | might_sleep(); | |
515 | ||
7b7eab6f JB |
516 | check_sdata_in_driver(sdata); |
517 | ||
a3304b0a | 518 | trace_drv_conf_tx(local, sdata, ac, params); |
24487981 | 519 | if (local->ops->conf_tx) |
8a3a3c85 | 520 | ret = local->ops->conf_tx(&local->hw, &sdata->vif, |
a3304b0a | 521 | ac, params); |
4efc76bd | 522 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 523 | return ret; |
24487981 JB |
524 | } |
525 | ||
37a41b4a EP |
526 | static inline u64 drv_get_tsf(struct ieee80211_local *local, |
527 | struct ieee80211_sub_if_data *sdata) | |
24487981 | 528 | { |
0a2b8bb2 | 529 | u64 ret = -1ULL; |
e1781ed3 KV |
530 | |
531 | might_sleep(); | |
532 | ||
7b7eab6f JB |
533 | check_sdata_in_driver(sdata); |
534 | ||
37a41b4a | 535 | trace_drv_get_tsf(local, sdata); |
24487981 | 536 | if (local->ops->get_tsf) |
37a41b4a | 537 | ret = local->ops->get_tsf(&local->hw, &sdata->vif); |
4efc76bd | 538 | trace_drv_return_u64(local, ret); |
0a2b8bb2 | 539 | return ret; |
24487981 JB |
540 | } |
541 | ||
37a41b4a EP |
542 | static inline void drv_set_tsf(struct ieee80211_local *local, |
543 | struct ieee80211_sub_if_data *sdata, | |
544 | u64 tsf) | |
24487981 | 545 | { |
e1781ed3 KV |
546 | might_sleep(); |
547 | ||
7b7eab6f JB |
548 | check_sdata_in_driver(sdata); |
549 | ||
37a41b4a | 550 | trace_drv_set_tsf(local, sdata, tsf); |
24487981 | 551 | if (local->ops->set_tsf) |
37a41b4a | 552 | local->ops->set_tsf(&local->hw, &sdata->vif, tsf); |
4efc76bd | 553 | trace_drv_return_void(local); |
24487981 JB |
554 | } |
555 | ||
37a41b4a EP |
556 | static inline void drv_reset_tsf(struct ieee80211_local *local, |
557 | struct ieee80211_sub_if_data *sdata) | |
24487981 | 558 | { |
e1781ed3 KV |
559 | might_sleep(); |
560 | ||
7b7eab6f JB |
561 | check_sdata_in_driver(sdata); |
562 | ||
37a41b4a | 563 | trace_drv_reset_tsf(local, sdata); |
24487981 | 564 | if (local->ops->reset_tsf) |
37a41b4a | 565 | local->ops->reset_tsf(&local->hw, &sdata->vif); |
4efc76bd | 566 | trace_drv_return_void(local); |
24487981 JB |
567 | } |
568 | ||
569 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |
570 | { | |
91f44b02 | 571 | int ret = 0; /* default unsuported op for less congestion */ |
e1781ed3 KV |
572 | |
573 | might_sleep(); | |
574 | ||
4efc76bd | 575 | trace_drv_tx_last_beacon(local); |
24487981 | 576 | if (local->ops->tx_last_beacon) |
0a2b8bb2 | 577 | ret = local->ops->tx_last_beacon(&local->hw); |
4efc76bd | 578 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 579 | return ret; |
24487981 JB |
580 | } |
581 | ||
582 | static inline int drv_ampdu_action(struct ieee80211_local *local, | |
12375ef9 | 583 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
584 | enum ieee80211_ampdu_mlme_action action, |
585 | struct ieee80211_sta *sta, u16 tid, | |
0b01f030 | 586 | u16 *ssn, u8 buf_size) |
24487981 | 587 | { |
0a2b8bb2 | 588 | int ret = -EOPNOTSUPP; |
cfcdbde3 JB |
589 | |
590 | might_sleep(); | |
591 | ||
bc192f89 | 592 | sdata = get_bss_sdata(sdata); |
7b7eab6f JB |
593 | check_sdata_in_driver(sdata); |
594 | ||
0b01f030 | 595 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); |
4efc76bd | 596 | |
24487981 | 597 | if (local->ops->ampdu_action) |
12375ef9 | 598 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
0b01f030 | 599 | sta, tid, ssn, buf_size); |
85ad181e | 600 | |
4efc76bd JB |
601 | trace_drv_return_int(local, ret); |
602 | ||
0a2b8bb2 | 603 | return ret; |
24487981 | 604 | } |
1f87f7d3 | 605 | |
1289723e HS |
606 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
607 | struct survey_info *survey) | |
608 | { | |
609 | int ret = -EOPNOTSUPP; | |
c466d4ef JL |
610 | |
611 | trace_drv_get_survey(local, idx, survey); | |
612 | ||
35dd0509 | 613 | if (local->ops->get_survey) |
1289723e | 614 | ret = local->ops->get_survey(&local->hw, idx, survey); |
c466d4ef JL |
615 | |
616 | trace_drv_return_int(local, ret); | |
617 | ||
1289723e HS |
618 | return ret; |
619 | } | |
1f87f7d3 JB |
620 | |
621 | static inline void drv_rfkill_poll(struct ieee80211_local *local) | |
622 | { | |
e1781ed3 KV |
623 | might_sleep(); |
624 | ||
1f87f7d3 JB |
625 | if (local->ops->rfkill_poll) |
626 | local->ops->rfkill_poll(&local->hw); | |
627 | } | |
a80f7c0b JB |
628 | |
629 | static inline void drv_flush(struct ieee80211_local *local, bool drop) | |
630 | { | |
e1781ed3 KV |
631 | might_sleep(); |
632 | ||
a80f7c0b JB |
633 | trace_drv_flush(local, drop); |
634 | if (local->ops->flush) | |
635 | local->ops->flush(&local->hw, drop); | |
4efc76bd | 636 | trace_drv_return_void(local); |
a80f7c0b | 637 | } |
5ce6e438 JB |
638 | |
639 | static inline void drv_channel_switch(struct ieee80211_local *local, | |
640 | struct ieee80211_channel_switch *ch_switch) | |
641 | { | |
642 | might_sleep(); | |
643 | ||
5ce6e438 | 644 | trace_drv_channel_switch(local, ch_switch); |
4efc76bd JB |
645 | local->ops->channel_switch(&local->hw, ch_switch); |
646 | trace_drv_return_void(local); | |
5ce6e438 JB |
647 | } |
648 | ||
15d96753 BR |
649 | |
650 | static 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 | ||
661 | static 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 JB |
672 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
673 | struct ieee80211_channel *chan, | |
674 | enum nl80211_channel_type chantype, | |
675 | unsigned int duration) | |
676 | { | |
677 | int ret; | |
678 | ||
679 | might_sleep(); | |
680 | ||
681 | trace_drv_remain_on_channel(local, chan, chantype, duration); | |
682 | ret = local->ops->remain_on_channel(&local->hw, chan, chantype, | |
683 | duration); | |
684 | trace_drv_return_int(local, ret); | |
685 | ||
686 | return ret; | |
687 | } | |
688 | ||
689 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) | |
690 | { | |
691 | int ret; | |
692 | ||
693 | might_sleep(); | |
694 | ||
695 | trace_drv_cancel_remain_on_channel(local); | |
696 | ret = local->ops->cancel_remain_on_channel(&local->hw); | |
697 | trace_drv_return_int(local, ret); | |
5f16a436 JB |
698 | |
699 | return ret; | |
700 | } | |
701 | ||
38c09159 JL |
702 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
703 | u32 tx, u32 rx) | |
704 | { | |
705 | int ret = -ENOTSUPP; | |
706 | ||
707 | might_sleep(); | |
708 | ||
709 | trace_drv_set_ringparam(local, tx, rx); | |
710 | if (local->ops->set_ringparam) | |
711 | ret = local->ops->set_ringparam(&local->hw, tx, rx); | |
712 | trace_drv_return_int(local, ret); | |
713 | ||
714 | return ret; | |
715 | } | |
716 | ||
717 | static inline void drv_get_ringparam(struct ieee80211_local *local, | |
718 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | |
719 | { | |
720 | might_sleep(); | |
721 | ||
722 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); | |
723 | if (local->ops->get_ringparam) | |
724 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); | |
725 | trace_drv_return_void(local); | |
726 | } | |
727 | ||
e8306f98 VN |
728 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
729 | { | |
730 | bool ret = false; | |
731 | ||
732 | might_sleep(); | |
733 | ||
734 | trace_drv_tx_frames_pending(local); | |
735 | if (local->ops->tx_frames_pending) | |
736 | ret = local->ops->tx_frames_pending(&local->hw); | |
737 | trace_drv_return_bool(local, ret); | |
738 | ||
739 | return ret; | |
740 | } | |
bdbfd6b5 SM |
741 | |
742 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, | |
743 | struct ieee80211_sub_if_data *sdata, | |
744 | const struct cfg80211_bitrate_mask *mask) | |
745 | { | |
746 | int ret = -EOPNOTSUPP; | |
747 | ||
748 | might_sleep(); | |
749 | ||
7b7eab6f JB |
750 | check_sdata_in_driver(sdata); |
751 | ||
bdbfd6b5 SM |
752 | trace_drv_set_bitrate_mask(local, sdata, mask); |
753 | if (local->ops->set_bitrate_mask) | |
754 | ret = local->ops->set_bitrate_mask(&local->hw, | |
755 | &sdata->vif, mask); | |
756 | trace_drv_return_int(local, ret); | |
757 | ||
758 | return ret; | |
759 | } | |
760 | ||
c68f4b89 JB |
761 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
762 | struct ieee80211_sub_if_data *sdata, | |
763 | struct cfg80211_gtk_rekey_data *data) | |
764 | { | |
7b7eab6f JB |
765 | check_sdata_in_driver(sdata); |
766 | ||
c68f4b89 JB |
767 | trace_drv_set_rekey_data(local, sdata, data); |
768 | if (local->ops->set_rekey_data) | |
769 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); | |
770 | trace_drv_return_void(local); | |
771 | } | |
772 | ||
615f7b9b MV |
773 | static inline void drv_rssi_callback(struct ieee80211_local *local, |
774 | const enum ieee80211_rssi_event event) | |
775 | { | |
776 | trace_drv_rssi_callback(local, event); | |
777 | if (local->ops->rssi_callback) | |
778 | local->ops->rssi_callback(&local->hw, event); | |
779 | trace_drv_return_void(local); | |
780 | } | |
4049e09a JB |
781 | |
782 | static inline void | |
783 | drv_release_buffered_frames(struct ieee80211_local *local, | |
784 | struct sta_info *sta, u16 tids, int num_frames, | |
785 | enum ieee80211_frame_release_type reason, | |
786 | bool more_data) | |
787 | { | |
788 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, | |
789 | reason, more_data); | |
790 | if (local->ops->release_buffered_frames) | |
791 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, | |
792 | num_frames, reason, | |
793 | more_data); | |
794 | trace_drv_return_void(local); | |
795 | } | |
40b96408 JB |
796 | |
797 | static inline void | |
798 | drv_allow_buffered_frames(struct ieee80211_local *local, | |
799 | struct sta_info *sta, u16 tids, int num_frames, | |
800 | enum ieee80211_frame_release_type reason, | |
801 | bool more_data) | |
802 | { | |
803 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, | |
804 | reason, more_data); | |
805 | if (local->ops->allow_buffered_frames) | |
806 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, | |
807 | tids, num_frames, reason, | |
808 | more_data); | |
809 | trace_drv_return_void(local); | |
810 | } | |
24487981 | 811 | #endif /* __MAC80211_DRIVER_OPS */ |