]>
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 | |
7bb45683 | 8 | static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) |
24487981 | 9 | { |
7bb45683 | 10 | local->ops->tx(&local->hw, skb); |
24487981 JB |
11 | } |
12 | ||
13 | static inline int drv_start(struct ieee80211_local *local) | |
14 | { | |
ea77f12f JB |
15 | int ret; |
16 | ||
e1781ed3 KV |
17 | might_sleep(); |
18 | ||
4efc76bd | 19 | trace_drv_start(local); |
ea77f12f JB |
20 | local->started = true; |
21 | smp_mb(); | |
22 | ret = local->ops->start(&local->hw); | |
4efc76bd | 23 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 24 | return ret; |
24487981 JB |
25 | } |
26 | ||
27 | static inline void drv_stop(struct ieee80211_local *local) | |
28 | { | |
e1781ed3 KV |
29 | might_sleep(); |
30 | ||
0a2b8bb2 | 31 | trace_drv_stop(local); |
4efc76bd JB |
32 | local->ops->stop(&local->hw); |
33 | trace_drv_return_void(local); | |
ea77f12f JB |
34 | |
35 | /* sync away all work on the tasklet before clearing started */ | |
36 | tasklet_disable(&local->tasklet); | |
37 | tasklet_enable(&local->tasklet); | |
38 | ||
39 | barrier(); | |
40 | ||
41 | local->started = false; | |
24487981 JB |
42 | } |
43 | ||
eecc4800 JB |
44 | #ifdef CONFIG_PM |
45 | static inline int drv_suspend(struct ieee80211_local *local, | |
46 | struct cfg80211_wowlan *wowlan) | |
47 | { | |
48 | int ret; | |
49 | ||
50 | might_sleep(); | |
51 | ||
52 | trace_drv_suspend(local); | |
53 | ret = local->ops->suspend(&local->hw, wowlan); | |
54 | trace_drv_return_int(local, ret); | |
55 | return ret; | |
56 | } | |
57 | ||
58 | static inline int drv_resume(struct ieee80211_local *local) | |
59 | { | |
60 | int ret; | |
61 | ||
62 | might_sleep(); | |
63 | ||
64 | trace_drv_resume(local); | |
65 | ret = local->ops->resume(&local->hw); | |
66 | trace_drv_return_int(local, ret); | |
67 | return ret; | |
68 | } | |
69 | #endif | |
70 | ||
24487981 | 71 | static inline int drv_add_interface(struct ieee80211_local *local, |
1ed32e4f | 72 | struct ieee80211_vif *vif) |
24487981 | 73 | { |
e1781ed3 KV |
74 | int ret; |
75 | ||
76 | might_sleep(); | |
77 | ||
4efc76bd | 78 | trace_drv_add_interface(local, vif_to_sdata(vif)); |
e1781ed3 | 79 | ret = local->ops->add_interface(&local->hw, vif); |
4efc76bd | 80 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 81 | return ret; |
24487981 JB |
82 | } |
83 | ||
34d4bc4d JB |
84 | static inline int drv_change_interface(struct ieee80211_local *local, |
85 | struct ieee80211_sub_if_data *sdata, | |
2ca27bcf | 86 | enum nl80211_iftype type, bool p2p) |
34d4bc4d JB |
87 | { |
88 | int ret; | |
89 | ||
90 | might_sleep(); | |
91 | ||
2ca27bcf JB |
92 | trace_drv_change_interface(local, sdata, type, p2p); |
93 | ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); | |
34d4bc4d JB |
94 | trace_drv_return_int(local, ret); |
95 | return ret; | |
96 | } | |
97 | ||
24487981 | 98 | static inline void drv_remove_interface(struct ieee80211_local *local, |
1ed32e4f | 99 | struct ieee80211_vif *vif) |
24487981 | 100 | { |
e1781ed3 KV |
101 | might_sleep(); |
102 | ||
1ed32e4f | 103 | trace_drv_remove_interface(local, vif_to_sdata(vif)); |
4efc76bd JB |
104 | local->ops->remove_interface(&local->hw, vif); |
105 | trace_drv_return_void(local); | |
24487981 JB |
106 | } |
107 | ||
108 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | |
109 | { | |
e1781ed3 KV |
110 | int ret; |
111 | ||
112 | might_sleep(); | |
113 | ||
4efc76bd | 114 | trace_drv_config(local, changed); |
e1781ed3 | 115 | ret = local->ops->config(&local->hw, changed); |
4efc76bd | 116 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 117 | return ret; |
24487981 JB |
118 | } |
119 | ||
120 | static inline void drv_bss_info_changed(struct ieee80211_local *local, | |
12375ef9 | 121 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
122 | struct ieee80211_bss_conf *info, |
123 | u32 changed) | |
124 | { | |
e1781ed3 KV |
125 | might_sleep(); |
126 | ||
4efc76bd | 127 | trace_drv_bss_info_changed(local, sdata, info, changed); |
24487981 | 128 | if (local->ops->bss_info_changed) |
12375ef9 | 129 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
4efc76bd | 130 | trace_drv_return_void(local); |
24487981 JB |
131 | } |
132 | ||
3ac64bee | 133 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
22bedad3 | 134 | struct netdev_hw_addr_list *mc_list) |
3ac64bee JB |
135 | { |
136 | u64 ret = 0; | |
137 | ||
4efc76bd JB |
138 | trace_drv_prepare_multicast(local, mc_list->count); |
139 | ||
3ac64bee | 140 | if (local->ops->prepare_multicast) |
22bedad3 | 141 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
3ac64bee | 142 | |
4efc76bd | 143 | trace_drv_return_u64(local, ret); |
3ac64bee JB |
144 | |
145 | return ret; | |
146 | } | |
147 | ||
24487981 JB |
148 | static inline void drv_configure_filter(struct ieee80211_local *local, |
149 | unsigned int changed_flags, | |
150 | unsigned int *total_flags, | |
3ac64bee | 151 | u64 multicast) |
24487981 | 152 | { |
3ac64bee JB |
153 | might_sleep(); |
154 | ||
0a2b8bb2 | 155 | trace_drv_configure_filter(local, changed_flags, total_flags, |
3ac64bee | 156 | multicast); |
4efc76bd JB |
157 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
158 | multicast); | |
159 | trace_drv_return_void(local); | |
24487981 JB |
160 | } |
161 | ||
162 | static inline int drv_set_tim(struct ieee80211_local *local, | |
163 | struct ieee80211_sta *sta, bool set) | |
164 | { | |
0a2b8bb2 | 165 | int ret = 0; |
4efc76bd | 166 | trace_drv_set_tim(local, sta, set); |
24487981 | 167 | if (local->ops->set_tim) |
0a2b8bb2 | 168 | ret = local->ops->set_tim(&local->hw, sta, set); |
4efc76bd | 169 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 170 | return ret; |
24487981 JB |
171 | } |
172 | ||
173 | static inline int drv_set_key(struct ieee80211_local *local, | |
12375ef9 JB |
174 | enum set_key_cmd cmd, |
175 | struct ieee80211_sub_if_data *sdata, | |
24487981 JB |
176 | struct ieee80211_sta *sta, |
177 | struct ieee80211_key_conf *key) | |
178 | { | |
e1781ed3 KV |
179 | int ret; |
180 | ||
181 | might_sleep(); | |
182 | ||
4efc76bd | 183 | trace_drv_set_key(local, cmd, sdata, sta, key); |
e1781ed3 | 184 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
4efc76bd | 185 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 186 | return ret; |
24487981 JB |
187 | } |
188 | ||
189 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | |
b3fbdcf4 | 190 | struct ieee80211_sub_if_data *sdata, |
24487981 | 191 | struct ieee80211_key_conf *conf, |
b3fbdcf4 | 192 | struct sta_info *sta, u32 iv32, |
24487981 JB |
193 | u16 *phase1key) |
194 | { | |
b3fbdcf4 JB |
195 | struct ieee80211_sta *ista = NULL; |
196 | ||
b3fbdcf4 JB |
197 | if (sta) |
198 | ista = &sta->sta; | |
199 | ||
4efc76bd | 200 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
24487981 | 201 | if (local->ops->update_tkip_key) |
b3fbdcf4 JB |
202 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
203 | ista, iv32, phase1key); | |
4efc76bd | 204 | trace_drv_return_void(local); |
24487981 JB |
205 | } |
206 | ||
207 | static inline int drv_hw_scan(struct ieee80211_local *local, | |
a060bbfe | 208 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
209 | struct cfg80211_scan_request *req) |
210 | { | |
e1781ed3 KV |
211 | int ret; |
212 | ||
213 | might_sleep(); | |
214 | ||
79f460ca | 215 | trace_drv_hw_scan(local, sdata); |
a060bbfe | 216 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
4efc76bd | 217 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 218 | return ret; |
24487981 JB |
219 | } |
220 | ||
b856439b EP |
221 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
222 | struct ieee80211_sub_if_data *sdata) | |
223 | { | |
224 | might_sleep(); | |
225 | ||
226 | trace_drv_cancel_hw_scan(local, sdata); | |
227 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); | |
228 | trace_drv_return_void(local); | |
229 | } | |
230 | ||
79f460ca LC |
231 | static inline int |
232 | drv_sched_scan_start(struct ieee80211_local *local, | |
233 | struct ieee80211_sub_if_data *sdata, | |
234 | struct cfg80211_sched_scan_request *req, | |
235 | struct ieee80211_sched_scan_ies *ies) | |
236 | { | |
237 | int ret; | |
238 | ||
239 | might_sleep(); | |
240 | ||
241 | trace_drv_sched_scan_start(local, sdata); | |
242 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, | |
243 | req, ies); | |
244 | trace_drv_return_int(local, ret); | |
245 | return ret; | |
246 | } | |
247 | ||
248 | static inline void drv_sched_scan_stop(struct ieee80211_local *local, | |
249 | struct ieee80211_sub_if_data *sdata) | |
250 | { | |
251 | might_sleep(); | |
252 | ||
253 | trace_drv_sched_scan_stop(local, sdata); | |
254 | local->ops->sched_scan_stop(&local->hw, &sdata->vif); | |
255 | trace_drv_return_void(local); | |
256 | } | |
257 | ||
24487981 JB |
258 | static inline void drv_sw_scan_start(struct ieee80211_local *local) |
259 | { | |
e1781ed3 KV |
260 | might_sleep(); |
261 | ||
4efc76bd | 262 | trace_drv_sw_scan_start(local); |
24487981 JB |
263 | if (local->ops->sw_scan_start) |
264 | local->ops->sw_scan_start(&local->hw); | |
4efc76bd | 265 | trace_drv_return_void(local); |
24487981 JB |
266 | } |
267 | ||
268 | static inline void drv_sw_scan_complete(struct ieee80211_local *local) | |
269 | { | |
e1781ed3 KV |
270 | might_sleep(); |
271 | ||
4efc76bd | 272 | trace_drv_sw_scan_complete(local); |
24487981 JB |
273 | if (local->ops->sw_scan_complete) |
274 | local->ops->sw_scan_complete(&local->hw); | |
4efc76bd | 275 | trace_drv_return_void(local); |
24487981 JB |
276 | } |
277 | ||
278 | static inline int drv_get_stats(struct ieee80211_local *local, | |
279 | struct ieee80211_low_level_stats *stats) | |
280 | { | |
0a2b8bb2 JB |
281 | int ret = -EOPNOTSUPP; |
282 | ||
e1781ed3 KV |
283 | might_sleep(); |
284 | ||
0a2b8bb2 JB |
285 | if (local->ops->get_stats) |
286 | ret = local->ops->get_stats(&local->hw, stats); | |
287 | trace_drv_get_stats(local, stats, ret); | |
288 | ||
289 | return ret; | |
24487981 JB |
290 | } |
291 | ||
292 | static inline void drv_get_tkip_seq(struct ieee80211_local *local, | |
293 | u8 hw_key_idx, u32 *iv32, u16 *iv16) | |
294 | { | |
295 | if (local->ops->get_tkip_seq) | |
296 | local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); | |
0a2b8bb2 | 297 | trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); |
24487981 JB |
298 | } |
299 | ||
f23a4780 AN |
300 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
301 | u32 value) | |
302 | { | |
303 | int ret = 0; | |
304 | ||
305 | might_sleep(); | |
306 | ||
307 | trace_drv_set_frag_threshold(local, value); | |
308 | if (local->ops->set_frag_threshold) | |
309 | ret = local->ops->set_frag_threshold(&local->hw, value); | |
310 | trace_drv_return_int(local, ret); | |
311 | return ret; | |
312 | } | |
313 | ||
24487981 JB |
314 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
315 | u32 value) | |
316 | { | |
0a2b8bb2 | 317 | int ret = 0; |
e1781ed3 KV |
318 | |
319 | might_sleep(); | |
320 | ||
4efc76bd | 321 | trace_drv_set_rts_threshold(local, value); |
24487981 | 322 | if (local->ops->set_rts_threshold) |
0a2b8bb2 | 323 | ret = local->ops->set_rts_threshold(&local->hw, value); |
4efc76bd | 324 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 325 | return ret; |
24487981 JB |
326 | } |
327 | ||
310bc676 LT |
328 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
329 | u8 value) | |
330 | { | |
331 | int ret = 0; | |
332 | might_sleep(); | |
333 | ||
4efc76bd | 334 | trace_drv_set_coverage_class(local, value); |
310bc676 LT |
335 | if (local->ops->set_coverage_class) |
336 | local->ops->set_coverage_class(&local->hw, value); | |
337 | else | |
338 | ret = -EOPNOTSUPP; | |
339 | ||
4efc76bd | 340 | trace_drv_return_int(local, ret); |
310bc676 LT |
341 | return ret; |
342 | } | |
343 | ||
24487981 | 344 | static inline void drv_sta_notify(struct ieee80211_local *local, |
12375ef9 | 345 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
346 | enum sta_notify_cmd cmd, |
347 | struct ieee80211_sta *sta) | |
348 | { | |
4efc76bd | 349 | trace_drv_sta_notify(local, sdata, cmd, sta); |
24487981 | 350 | if (local->ops->sta_notify) |
12375ef9 | 351 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
4efc76bd | 352 | trace_drv_return_void(local); |
24487981 JB |
353 | } |
354 | ||
34e89507 JB |
355 | static inline int drv_sta_add(struct ieee80211_local *local, |
356 | struct ieee80211_sub_if_data *sdata, | |
357 | struct ieee80211_sta *sta) | |
358 | { | |
359 | int ret = 0; | |
360 | ||
361 | might_sleep(); | |
362 | ||
4efc76bd | 363 | trace_drv_sta_add(local, sdata, sta); |
34e89507 JB |
364 | if (local->ops->sta_add) |
365 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); | |
34e89507 | 366 | |
4efc76bd | 367 | trace_drv_return_int(local, ret); |
34e89507 JB |
368 | |
369 | return ret; | |
370 | } | |
371 | ||
372 | static inline void drv_sta_remove(struct ieee80211_local *local, | |
373 | struct ieee80211_sub_if_data *sdata, | |
374 | struct ieee80211_sta *sta) | |
375 | { | |
376 | might_sleep(); | |
377 | ||
4efc76bd | 378 | trace_drv_sta_remove(local, sdata, sta); |
34e89507 JB |
379 | if (local->ops->sta_remove) |
380 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); | |
34e89507 | 381 | |
4efc76bd | 382 | trace_drv_return_void(local); |
34e89507 JB |
383 | } |
384 | ||
24487981 JB |
385 | static inline int drv_conf_tx(struct ieee80211_local *local, u16 queue, |
386 | const struct ieee80211_tx_queue_params *params) | |
387 | { | |
0a2b8bb2 | 388 | int ret = -EOPNOTSUPP; |
e1781ed3 KV |
389 | |
390 | might_sleep(); | |
391 | ||
4efc76bd | 392 | trace_drv_conf_tx(local, queue, params); |
24487981 | 393 | if (local->ops->conf_tx) |
0a2b8bb2 | 394 | ret = local->ops->conf_tx(&local->hw, queue, params); |
4efc76bd | 395 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 396 | return ret; |
24487981 JB |
397 | } |
398 | ||
24487981 JB |
399 | static inline u64 drv_get_tsf(struct ieee80211_local *local) |
400 | { | |
0a2b8bb2 | 401 | u64 ret = -1ULL; |
e1781ed3 KV |
402 | |
403 | might_sleep(); | |
404 | ||
4efc76bd | 405 | trace_drv_get_tsf(local); |
24487981 | 406 | if (local->ops->get_tsf) |
0a2b8bb2 | 407 | ret = local->ops->get_tsf(&local->hw); |
4efc76bd | 408 | trace_drv_return_u64(local, ret); |
0a2b8bb2 | 409 | return ret; |
24487981 JB |
410 | } |
411 | ||
412 | static inline void drv_set_tsf(struct ieee80211_local *local, u64 tsf) | |
413 | { | |
e1781ed3 KV |
414 | might_sleep(); |
415 | ||
4efc76bd | 416 | trace_drv_set_tsf(local, tsf); |
24487981 JB |
417 | if (local->ops->set_tsf) |
418 | local->ops->set_tsf(&local->hw, tsf); | |
4efc76bd | 419 | trace_drv_return_void(local); |
24487981 JB |
420 | } |
421 | ||
422 | static inline void drv_reset_tsf(struct ieee80211_local *local) | |
423 | { | |
e1781ed3 KV |
424 | might_sleep(); |
425 | ||
4efc76bd | 426 | trace_drv_reset_tsf(local); |
24487981 JB |
427 | if (local->ops->reset_tsf) |
428 | local->ops->reset_tsf(&local->hw); | |
4efc76bd | 429 | trace_drv_return_void(local); |
24487981 JB |
430 | } |
431 | ||
432 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |
433 | { | |
91f44b02 | 434 | int ret = 0; /* default unsuported op for less congestion */ |
e1781ed3 KV |
435 | |
436 | might_sleep(); | |
437 | ||
4efc76bd | 438 | trace_drv_tx_last_beacon(local); |
24487981 | 439 | if (local->ops->tx_last_beacon) |
0a2b8bb2 | 440 | ret = local->ops->tx_last_beacon(&local->hw); |
4efc76bd | 441 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 442 | return ret; |
24487981 JB |
443 | } |
444 | ||
445 | static inline int drv_ampdu_action(struct ieee80211_local *local, | |
12375ef9 | 446 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
447 | enum ieee80211_ampdu_mlme_action action, |
448 | struct ieee80211_sta *sta, u16 tid, | |
0b01f030 | 449 | u16 *ssn, u8 buf_size) |
24487981 | 450 | { |
0a2b8bb2 | 451 | int ret = -EOPNOTSUPP; |
cfcdbde3 JB |
452 | |
453 | might_sleep(); | |
454 | ||
0b01f030 | 455 | trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); |
4efc76bd | 456 | |
24487981 | 457 | if (local->ops->ampdu_action) |
12375ef9 | 458 | ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, |
0b01f030 | 459 | sta, tid, ssn, buf_size); |
85ad181e | 460 | |
4efc76bd JB |
461 | trace_drv_return_int(local, ret); |
462 | ||
0a2b8bb2 | 463 | return ret; |
24487981 | 464 | } |
1f87f7d3 | 465 | |
1289723e HS |
466 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
467 | struct survey_info *survey) | |
468 | { | |
469 | int ret = -EOPNOTSUPP; | |
c466d4ef JL |
470 | |
471 | trace_drv_get_survey(local, idx, survey); | |
472 | ||
35dd0509 | 473 | if (local->ops->get_survey) |
1289723e | 474 | ret = local->ops->get_survey(&local->hw, idx, survey); |
c466d4ef JL |
475 | |
476 | trace_drv_return_int(local, ret); | |
477 | ||
1289723e HS |
478 | return ret; |
479 | } | |
1f87f7d3 JB |
480 | |
481 | static inline void drv_rfkill_poll(struct ieee80211_local *local) | |
482 | { | |
e1781ed3 KV |
483 | might_sleep(); |
484 | ||
1f87f7d3 JB |
485 | if (local->ops->rfkill_poll) |
486 | local->ops->rfkill_poll(&local->hw); | |
487 | } | |
a80f7c0b JB |
488 | |
489 | static inline void drv_flush(struct ieee80211_local *local, bool drop) | |
490 | { | |
e1781ed3 KV |
491 | might_sleep(); |
492 | ||
a80f7c0b JB |
493 | trace_drv_flush(local, drop); |
494 | if (local->ops->flush) | |
495 | local->ops->flush(&local->hw, drop); | |
4efc76bd | 496 | trace_drv_return_void(local); |
a80f7c0b | 497 | } |
5ce6e438 JB |
498 | |
499 | static inline void drv_channel_switch(struct ieee80211_local *local, | |
500 | struct ieee80211_channel_switch *ch_switch) | |
501 | { | |
502 | might_sleep(); | |
503 | ||
5ce6e438 | 504 | trace_drv_channel_switch(local, ch_switch); |
4efc76bd JB |
505 | local->ops->channel_switch(&local->hw, ch_switch); |
506 | trace_drv_return_void(local); | |
5ce6e438 JB |
507 | } |
508 | ||
15d96753 BR |
509 | |
510 | static inline int drv_set_antenna(struct ieee80211_local *local, | |
511 | u32 tx_ant, u32 rx_ant) | |
512 | { | |
513 | int ret = -EOPNOTSUPP; | |
514 | might_sleep(); | |
515 | if (local->ops->set_antenna) | |
516 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); | |
517 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); | |
518 | return ret; | |
519 | } | |
520 | ||
521 | static inline int drv_get_antenna(struct ieee80211_local *local, | |
522 | u32 *tx_ant, u32 *rx_ant) | |
523 | { | |
524 | int ret = -EOPNOTSUPP; | |
525 | might_sleep(); | |
526 | if (local->ops->get_antenna) | |
527 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); | |
528 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); | |
529 | return ret; | |
530 | } | |
531 | ||
21f83589 JB |
532 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
533 | struct ieee80211_channel *chan, | |
534 | enum nl80211_channel_type chantype, | |
535 | unsigned int duration) | |
536 | { | |
537 | int ret; | |
538 | ||
539 | might_sleep(); | |
540 | ||
541 | trace_drv_remain_on_channel(local, chan, chantype, duration); | |
542 | ret = local->ops->remain_on_channel(&local->hw, chan, chantype, | |
543 | duration); | |
544 | trace_drv_return_int(local, ret); | |
545 | ||
546 | return ret; | |
547 | } | |
548 | ||
549 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) | |
550 | { | |
551 | int ret; | |
552 | ||
553 | might_sleep(); | |
554 | ||
555 | trace_drv_cancel_remain_on_channel(local); | |
556 | ret = local->ops->cancel_remain_on_channel(&local->hw); | |
557 | trace_drv_return_int(local, ret); | |
558 | ||
559 | return ret; | |
560 | } | |
561 | ||
5f16a436 JB |
562 | static inline int drv_offchannel_tx(struct ieee80211_local *local, |
563 | struct sk_buff *skb, | |
564 | struct ieee80211_channel *chan, | |
565 | enum nl80211_channel_type channel_type, | |
566 | unsigned int wait) | |
567 | { | |
568 | int ret; | |
569 | ||
570 | might_sleep(); | |
571 | ||
572 | trace_drv_offchannel_tx(local, skb, chan, channel_type, wait); | |
573 | ret = local->ops->offchannel_tx(&local->hw, skb, chan, | |
574 | channel_type, wait); | |
575 | trace_drv_return_int(local, ret); | |
576 | ||
577 | return ret; | |
578 | } | |
579 | ||
580 | static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local) | |
581 | { | |
582 | int ret; | |
583 | ||
584 | might_sleep(); | |
585 | ||
586 | trace_drv_offchannel_tx_cancel_wait(local); | |
587 | ret = local->ops->offchannel_tx_cancel_wait(&local->hw); | |
588 | trace_drv_return_int(local, ret); | |
589 | ||
590 | return ret; | |
591 | } | |
592 | ||
38c09159 JL |
593 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
594 | u32 tx, u32 rx) | |
595 | { | |
596 | int ret = -ENOTSUPP; | |
597 | ||
598 | might_sleep(); | |
599 | ||
600 | trace_drv_set_ringparam(local, tx, rx); | |
601 | if (local->ops->set_ringparam) | |
602 | ret = local->ops->set_ringparam(&local->hw, tx, rx); | |
603 | trace_drv_return_int(local, ret); | |
604 | ||
605 | return ret; | |
606 | } | |
607 | ||
608 | static inline void drv_get_ringparam(struct ieee80211_local *local, | |
609 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | |
610 | { | |
611 | might_sleep(); | |
612 | ||
613 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); | |
614 | if (local->ops->get_ringparam) | |
615 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); | |
616 | trace_drv_return_void(local); | |
617 | } | |
618 | ||
e8306f98 VN |
619 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
620 | { | |
621 | bool ret = false; | |
622 | ||
623 | might_sleep(); | |
624 | ||
625 | trace_drv_tx_frames_pending(local); | |
626 | if (local->ops->tx_frames_pending) | |
627 | ret = local->ops->tx_frames_pending(&local->hw); | |
628 | trace_drv_return_bool(local, ret); | |
629 | ||
630 | return ret; | |
631 | } | |
bdbfd6b5 SM |
632 | |
633 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, | |
634 | struct ieee80211_sub_if_data *sdata, | |
635 | const struct cfg80211_bitrate_mask *mask) | |
636 | { | |
637 | int ret = -EOPNOTSUPP; | |
638 | ||
639 | might_sleep(); | |
640 | ||
641 | trace_drv_set_bitrate_mask(local, sdata, mask); | |
642 | if (local->ops->set_bitrate_mask) | |
643 | ret = local->ops->set_bitrate_mask(&local->hw, | |
644 | &sdata->vif, mask); | |
645 | trace_drv_return_int(local, ret); | |
646 | ||
647 | return ret; | |
648 | } | |
649 | ||
c68f4b89 JB |
650 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
651 | struct ieee80211_sub_if_data *sdata, | |
652 | struct cfg80211_gtk_rekey_data *data) | |
653 | { | |
654 | trace_drv_set_rekey_data(local, sdata, data); | |
655 | if (local->ops->set_rekey_data) | |
656 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); | |
657 | trace_drv_return_void(local); | |
658 | } | |
659 | ||
24487981 | 660 | #endif /* __MAC80211_DRIVER_OPS */ |