]>
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" | |
011ad0e9 | 6 | #include "trace.h" |
24487981 | 7 | |
f6837ba8 | 8 | static 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 |
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 | ||
36323f81 TH |
25 | static 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 |
32 | static 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 | ||
43 | static 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 | ||
55 | static 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 |
69 | static 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 | ||
83 | static 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 |
101 | static 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 | ||
114 | static 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 | |
126 | static 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 | ||
9aae296a DV |
140 | int drv_add_interface(struct ieee80211_local *local, |
141 | struct ieee80211_sub_if_data *sdata); | |
7b7eab6f | 142 | |
9aae296a DV |
143 | int drv_change_interface(struct ieee80211_local *local, |
144 | struct ieee80211_sub_if_data *sdata, | |
145 | enum nl80211_iftype type, bool p2p); | |
7b7eab6f | 146 | |
9aae296a DV |
147 | void drv_remove_interface(struct ieee80211_local *local, |
148 | struct ieee80211_sub_if_data *sdata); | |
24487981 JB |
149 | |
150 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | |
151 | { | |
e1781ed3 KV |
152 | int ret; |
153 | ||
154 | might_sleep(); | |
155 | ||
4efc76bd | 156 | trace_drv_config(local, changed); |
e1781ed3 | 157 | ret = local->ops->config(&local->hw, changed); |
4efc76bd | 158 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 159 | return ret; |
24487981 JB |
160 | } |
161 | ||
162 | static inline void drv_bss_info_changed(struct ieee80211_local *local, | |
12375ef9 | 163 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
164 | struct ieee80211_bss_conf *info, |
165 | u32 changed) | |
166 | { | |
e1781ed3 KV |
167 | might_sleep(); |
168 | ||
5bbe754d JB |
169 | if (WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON | |
170 | BSS_CHANGED_BEACON_ENABLED) && | |
171 | sdata->vif.type != NL80211_IFTYPE_AP && | |
172 | sdata->vif.type != NL80211_IFTYPE_ADHOC && | |
239281f8 RL |
173 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
174 | sdata->vif.type != NL80211_IFTYPE_OCB)) | |
5bbe754d JB |
175 | return; |
176 | ||
177 | if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE || | |
178 | sdata->vif.type == NL80211_IFTYPE_MONITOR)) | |
179 | return; | |
b8dc1a35 | 180 | |
f6837ba8 JB |
181 | if (!check_sdata_in_driver(sdata)) |
182 | return; | |
7b7eab6f | 183 | |
4efc76bd | 184 | trace_drv_bss_info_changed(local, sdata, info, changed); |
24487981 | 185 | if (local->ops->bss_info_changed) |
12375ef9 | 186 | local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); |
4efc76bd | 187 | trace_drv_return_void(local); |
24487981 JB |
188 | } |
189 | ||
3ac64bee | 190 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
22bedad3 | 191 | struct netdev_hw_addr_list *mc_list) |
3ac64bee JB |
192 | { |
193 | u64 ret = 0; | |
194 | ||
4efc76bd JB |
195 | trace_drv_prepare_multicast(local, mc_list->count); |
196 | ||
3ac64bee | 197 | if (local->ops->prepare_multicast) |
22bedad3 | 198 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
3ac64bee | 199 | |
4efc76bd | 200 | trace_drv_return_u64(local, ret); |
3ac64bee JB |
201 | |
202 | return ret; | |
203 | } | |
204 | ||
24487981 JB |
205 | static inline void drv_configure_filter(struct ieee80211_local *local, |
206 | unsigned int changed_flags, | |
207 | unsigned int *total_flags, | |
3ac64bee | 208 | u64 multicast) |
24487981 | 209 | { |
3ac64bee JB |
210 | might_sleep(); |
211 | ||
0a2b8bb2 | 212 | trace_drv_configure_filter(local, changed_flags, total_flags, |
3ac64bee | 213 | multicast); |
4efc76bd JB |
214 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
215 | multicast); | |
216 | trace_drv_return_void(local); | |
24487981 JB |
217 | } |
218 | ||
1b09b556 AO |
219 | static inline void drv_config_iface_filter(struct ieee80211_local *local, |
220 | struct ieee80211_sub_if_data *sdata, | |
221 | unsigned int filter_flags, | |
222 | unsigned int changed_flags) | |
223 | { | |
224 | might_sleep(); | |
225 | ||
226 | trace_drv_config_iface_filter(local, sdata, filter_flags, | |
227 | changed_flags); | |
228 | if (local->ops->config_iface_filter) | |
229 | local->ops->config_iface_filter(&local->hw, &sdata->vif, | |
230 | filter_flags, | |
231 | changed_flags); | |
232 | trace_drv_return_void(local); | |
233 | } | |
234 | ||
24487981 JB |
235 | static inline int drv_set_tim(struct ieee80211_local *local, |
236 | struct ieee80211_sta *sta, bool set) | |
237 | { | |
0a2b8bb2 | 238 | int ret = 0; |
4efc76bd | 239 | trace_drv_set_tim(local, sta, set); |
24487981 | 240 | if (local->ops->set_tim) |
0a2b8bb2 | 241 | ret = local->ops->set_tim(&local->hw, sta, set); |
4efc76bd | 242 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 243 | return ret; |
24487981 JB |
244 | } |
245 | ||
246 | static inline int drv_set_key(struct ieee80211_local *local, | |
12375ef9 JB |
247 | enum set_key_cmd cmd, |
248 | struct ieee80211_sub_if_data *sdata, | |
24487981 JB |
249 | struct ieee80211_sta *sta, |
250 | struct ieee80211_key_conf *key) | |
251 | { | |
e1781ed3 KV |
252 | int ret; |
253 | ||
254 | might_sleep(); | |
255 | ||
077f4939 | 256 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
257 | if (!check_sdata_in_driver(sdata)) |
258 | return -EIO; | |
7b7eab6f | 259 | |
4efc76bd | 260 | trace_drv_set_key(local, cmd, sdata, sta, key); |
e1781ed3 | 261 | ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); |
4efc76bd | 262 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 263 | return ret; |
24487981 JB |
264 | } |
265 | ||
266 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | |
b3fbdcf4 | 267 | struct ieee80211_sub_if_data *sdata, |
24487981 | 268 | struct ieee80211_key_conf *conf, |
b3fbdcf4 | 269 | struct sta_info *sta, u32 iv32, |
24487981 JB |
270 | u16 *phase1key) |
271 | { | |
b3fbdcf4 JB |
272 | struct ieee80211_sta *ista = NULL; |
273 | ||
b3fbdcf4 JB |
274 | if (sta) |
275 | ista = &sta->sta; | |
276 | ||
077f4939 | 277 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
278 | if (!check_sdata_in_driver(sdata)) |
279 | return; | |
7b7eab6f | 280 | |
4efc76bd | 281 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
24487981 | 282 | if (local->ops->update_tkip_key) |
b3fbdcf4 JB |
283 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
284 | ista, iv32, phase1key); | |
4efc76bd | 285 | trace_drv_return_void(local); |
24487981 JB |
286 | } |
287 | ||
288 | static inline int drv_hw_scan(struct ieee80211_local *local, | |
a060bbfe | 289 | struct ieee80211_sub_if_data *sdata, |
c56ef672 | 290 | struct ieee80211_scan_request *req) |
24487981 | 291 | { |
e1781ed3 KV |
292 | int ret; |
293 | ||
294 | might_sleep(); | |
295 | ||
f6837ba8 JB |
296 | if (!check_sdata_in_driver(sdata)) |
297 | return -EIO; | |
7b7eab6f | 298 | |
79f460ca | 299 | trace_drv_hw_scan(local, sdata); |
a060bbfe | 300 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
4efc76bd | 301 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 302 | return ret; |
24487981 JB |
303 | } |
304 | ||
b856439b EP |
305 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
306 | struct ieee80211_sub_if_data *sdata) | |
307 | { | |
308 | might_sleep(); | |
309 | ||
f6837ba8 JB |
310 | if (!check_sdata_in_driver(sdata)) |
311 | return; | |
7b7eab6f | 312 | |
b856439b EP |
313 | trace_drv_cancel_hw_scan(local, sdata); |
314 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); | |
315 | trace_drv_return_void(local); | |
316 | } | |
317 | ||
79f460ca LC |
318 | static inline int |
319 | drv_sched_scan_start(struct ieee80211_local *local, | |
320 | struct ieee80211_sub_if_data *sdata, | |
321 | struct cfg80211_sched_scan_request *req, | |
633e2713 | 322 | struct ieee80211_scan_ies *ies) |
79f460ca LC |
323 | { |
324 | int ret; | |
325 | ||
326 | might_sleep(); | |
327 | ||
f6837ba8 JB |
328 | if (!check_sdata_in_driver(sdata)) |
329 | return -EIO; | |
7b7eab6f | 330 | |
79f460ca LC |
331 | trace_drv_sched_scan_start(local, sdata); |
332 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, | |
333 | req, ies); | |
334 | trace_drv_return_int(local, ret); | |
335 | return ret; | |
336 | } | |
337 | ||
37e3308c JB |
338 | static inline int drv_sched_scan_stop(struct ieee80211_local *local, |
339 | struct ieee80211_sub_if_data *sdata) | |
79f460ca | 340 | { |
37e3308c JB |
341 | int ret; |
342 | ||
79f460ca LC |
343 | might_sleep(); |
344 | ||
f6837ba8 JB |
345 | if (!check_sdata_in_driver(sdata)) |
346 | return -EIO; | |
7b7eab6f | 347 | |
79f460ca | 348 | trace_drv_sched_scan_stop(local, sdata); |
37e3308c JB |
349 | ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
350 | trace_drv_return_int(local, ret); | |
351 | ||
352 | return ret; | |
79f460ca LC |
353 | } |
354 | ||
a344d677 JB |
355 | static inline void drv_sw_scan_start(struct ieee80211_local *local, |
356 | struct ieee80211_sub_if_data *sdata, | |
357 | const u8 *mac_addr) | |
24487981 | 358 | { |
e1781ed3 KV |
359 | might_sleep(); |
360 | ||
a344d677 | 361 | trace_drv_sw_scan_start(local, sdata, mac_addr); |
24487981 | 362 | if (local->ops->sw_scan_start) |
a344d677 | 363 | local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr); |
4efc76bd | 364 | trace_drv_return_void(local); |
24487981 JB |
365 | } |
366 | ||
a344d677 JB |
367 | static inline void drv_sw_scan_complete(struct ieee80211_local *local, |
368 | struct ieee80211_sub_if_data *sdata) | |
24487981 | 369 | { |
e1781ed3 KV |
370 | might_sleep(); |
371 | ||
a344d677 | 372 | trace_drv_sw_scan_complete(local, sdata); |
24487981 | 373 | if (local->ops->sw_scan_complete) |
a344d677 | 374 | local->ops->sw_scan_complete(&local->hw, &sdata->vif); |
4efc76bd | 375 | trace_drv_return_void(local); |
24487981 JB |
376 | } |
377 | ||
378 | static inline int drv_get_stats(struct ieee80211_local *local, | |
379 | struct ieee80211_low_level_stats *stats) | |
380 | { | |
0a2b8bb2 JB |
381 | int ret = -EOPNOTSUPP; |
382 | ||
e1781ed3 KV |
383 | might_sleep(); |
384 | ||
0a2b8bb2 JB |
385 | if (local->ops->get_stats) |
386 | ret = local->ops->get_stats(&local->hw, stats); | |
387 | trace_drv_get_stats(local, stats, ret); | |
388 | ||
389 | return ret; | |
24487981 JB |
390 | } |
391 | ||
9352c19f JB |
392 | static inline void drv_get_key_seq(struct ieee80211_local *local, |
393 | struct ieee80211_key *key, | |
394 | struct ieee80211_key_seq *seq) | |
24487981 | 395 | { |
9352c19f JB |
396 | if (local->ops->get_key_seq) |
397 | local->ops->get_key_seq(&local->hw, &key->conf, seq); | |
398 | trace_drv_get_key_seq(local, &key->conf); | |
24487981 JB |
399 | } |
400 | ||
f23a4780 AN |
401 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
402 | u32 value) | |
403 | { | |
404 | int ret = 0; | |
405 | ||
406 | might_sleep(); | |
407 | ||
408 | trace_drv_set_frag_threshold(local, value); | |
409 | if (local->ops->set_frag_threshold) | |
410 | ret = local->ops->set_frag_threshold(&local->hw, value); | |
411 | trace_drv_return_int(local, ret); | |
412 | return ret; | |
413 | } | |
414 | ||
24487981 JB |
415 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
416 | u32 value) | |
417 | { | |
0a2b8bb2 | 418 | int ret = 0; |
e1781ed3 KV |
419 | |
420 | might_sleep(); | |
421 | ||
4efc76bd | 422 | trace_drv_set_rts_threshold(local, value); |
24487981 | 423 | if (local->ops->set_rts_threshold) |
0a2b8bb2 | 424 | ret = local->ops->set_rts_threshold(&local->hw, value); |
4efc76bd | 425 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 426 | return ret; |
24487981 JB |
427 | } |
428 | ||
310bc676 | 429 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
a4bcaf55 | 430 | s16 value) |
310bc676 LT |
431 | { |
432 | int ret = 0; | |
433 | might_sleep(); | |
434 | ||
4efc76bd | 435 | trace_drv_set_coverage_class(local, value); |
310bc676 LT |
436 | if (local->ops->set_coverage_class) |
437 | local->ops->set_coverage_class(&local->hw, value); | |
438 | else | |
439 | ret = -EOPNOTSUPP; | |
440 | ||
4efc76bd | 441 | trace_drv_return_int(local, ret); |
310bc676 LT |
442 | return ret; |
443 | } | |
444 | ||
24487981 | 445 | static inline void drv_sta_notify(struct ieee80211_local *local, |
12375ef9 | 446 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
447 | enum sta_notify_cmd cmd, |
448 | struct ieee80211_sta *sta) | |
449 | { | |
bc192f89 | 450 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
451 | if (!check_sdata_in_driver(sdata)) |
452 | return; | |
7b7eab6f | 453 | |
4efc76bd | 454 | trace_drv_sta_notify(local, sdata, cmd, sta); |
24487981 | 455 | if (local->ops->sta_notify) |
12375ef9 | 456 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
4efc76bd | 457 | trace_drv_return_void(local); |
24487981 JB |
458 | } |
459 | ||
34e89507 JB |
460 | static inline int drv_sta_add(struct ieee80211_local *local, |
461 | struct ieee80211_sub_if_data *sdata, | |
462 | struct ieee80211_sta *sta) | |
463 | { | |
464 | int ret = 0; | |
465 | ||
466 | might_sleep(); | |
467 | ||
bc192f89 | 468 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
469 | if (!check_sdata_in_driver(sdata)) |
470 | return -EIO; | |
7b7eab6f | 471 | |
4efc76bd | 472 | trace_drv_sta_add(local, sdata, sta); |
34e89507 JB |
473 | if (local->ops->sta_add) |
474 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); | |
34e89507 | 475 | |
4efc76bd | 476 | trace_drv_return_int(local, ret); |
34e89507 JB |
477 | |
478 | return ret; | |
479 | } | |
480 | ||
481 | static inline void drv_sta_remove(struct ieee80211_local *local, | |
482 | struct ieee80211_sub_if_data *sdata, | |
483 | struct ieee80211_sta *sta) | |
484 | { | |
485 | might_sleep(); | |
486 | ||
bc192f89 | 487 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
488 | if (!check_sdata_in_driver(sdata)) |
489 | return; | |
7b7eab6f | 490 | |
4efc76bd | 491 | trace_drv_sta_remove(local, sdata, sta); |
34e89507 JB |
492 | if (local->ops->sta_remove) |
493 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); | |
34e89507 | 494 | |
4efc76bd | 495 | trace_drv_return_void(local); |
34e89507 JB |
496 | } |
497 | ||
77d2ece6 SM |
498 | #ifdef CONFIG_MAC80211_DEBUGFS |
499 | static inline void drv_sta_add_debugfs(struct ieee80211_local *local, | |
500 | struct ieee80211_sub_if_data *sdata, | |
501 | struct ieee80211_sta *sta, | |
502 | struct dentry *dir) | |
503 | { | |
504 | might_sleep(); | |
505 | ||
506 | sdata = get_bss_sdata(sdata); | |
f6837ba8 JB |
507 | if (!check_sdata_in_driver(sdata)) |
508 | return; | |
77d2ece6 SM |
509 | |
510 | if (local->ops->sta_add_debugfs) | |
511 | local->ops->sta_add_debugfs(&local->hw, &sdata->vif, | |
512 | sta, dir); | |
513 | } | |
514 | ||
515 | static inline void drv_sta_remove_debugfs(struct ieee80211_local *local, | |
516 | struct ieee80211_sub_if_data *sdata, | |
517 | struct ieee80211_sta *sta, | |
518 | struct dentry *dir) | |
519 | { | |
520 | might_sleep(); | |
521 | ||
522 | sdata = get_bss_sdata(sdata); | |
523 | check_sdata_in_driver(sdata); | |
524 | ||
525 | if (local->ops->sta_remove_debugfs) | |
526 | local->ops->sta_remove_debugfs(&local->hw, &sdata->vif, | |
527 | sta, dir); | |
528 | } | |
529 | #endif | |
530 | ||
6a9d1b91 JB |
531 | static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local, |
532 | struct ieee80211_sub_if_data *sdata, | |
533 | struct sta_info *sta) | |
534 | { | |
535 | might_sleep(); | |
536 | ||
537 | sdata = get_bss_sdata(sdata); | |
f6837ba8 JB |
538 | if (!check_sdata_in_driver(sdata)) |
539 | return; | |
6a9d1b91 JB |
540 | |
541 | trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta); | |
542 | if (local->ops->sta_pre_rcu_remove) | |
543 | local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif, | |
544 | &sta->sta); | |
545 | trace_drv_return_void(local); | |
546 | } | |
547 | ||
727da60b | 548 | __must_check |
f09603a2 JB |
549 | int drv_sta_state(struct ieee80211_local *local, |
550 | struct ieee80211_sub_if_data *sdata, | |
551 | struct sta_info *sta, | |
552 | enum ieee80211_sta_state old_state, | |
727da60b | 553 | enum ieee80211_sta_state new_state); |
f09603a2 | 554 | |
4fbd572c DV |
555 | void drv_sta_rc_update(struct ieee80211_local *local, |
556 | struct ieee80211_sub_if_data *sdata, | |
557 | struct ieee80211_sta *sta, u32 changed); | |
8f727ef3 | 558 | |
f815e2b3 JB |
559 | static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local, |
560 | struct ieee80211_sub_if_data *sdata, | |
561 | struct ieee80211_sta *sta) | |
562 | { | |
563 | sdata = get_bss_sdata(sdata); | |
564 | if (!check_sdata_in_driver(sdata)) | |
565 | return; | |
566 | ||
567 | trace_drv_sta_rate_tbl_update(local, sdata, sta); | |
568 | if (local->ops->sta_rate_tbl_update) | |
569 | local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta); | |
570 | ||
571 | trace_drv_return_void(local); | |
572 | } | |
573 | ||
2b9a7e1b JB |
574 | static inline void drv_sta_statistics(struct ieee80211_local *local, |
575 | struct ieee80211_sub_if_data *sdata, | |
576 | struct ieee80211_sta *sta, | |
577 | struct station_info *sinfo) | |
578 | { | |
579 | sdata = get_bss_sdata(sdata); | |
580 | if (!check_sdata_in_driver(sdata)) | |
581 | return; | |
582 | ||
583 | trace_drv_sta_statistics(local, sdata, sta); | |
584 | if (local->ops->sta_statistics) | |
585 | local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo); | |
586 | trace_drv_return_void(local); | |
587 | } | |
588 | ||
b23dcd4a DV |
589 | int drv_conf_tx(struct ieee80211_local *local, |
590 | struct ieee80211_sub_if_data *sdata, u16 ac, | |
591 | const struct ieee80211_tx_queue_params *params); | |
24487981 | 592 | |
416eb9fc DV |
593 | u64 drv_get_tsf(struct ieee80211_local *local, |
594 | struct ieee80211_sub_if_data *sdata); | |
595 | void drv_set_tsf(struct ieee80211_local *local, | |
596 | struct ieee80211_sub_if_data *sdata, | |
597 | u64 tsf); | |
598 | void drv_reset_tsf(struct ieee80211_local *local, | |
599 | struct ieee80211_sub_if_data *sdata); | |
24487981 JB |
600 | |
601 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |
602 | { | |
02582e9b | 603 | int ret = 0; /* default unsupported op for less congestion */ |
e1781ed3 KV |
604 | |
605 | might_sleep(); | |
606 | ||
4efc76bd | 607 | trace_drv_tx_last_beacon(local); |
24487981 | 608 | if (local->ops->tx_last_beacon) |
0a2b8bb2 | 609 | ret = local->ops->tx_last_beacon(&local->hw); |
4efc76bd | 610 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 611 | return ret; |
24487981 JB |
612 | } |
613 | ||
6db96838 DV |
614 | int drv_ampdu_action(struct ieee80211_local *local, |
615 | struct ieee80211_sub_if_data *sdata, | |
616 | enum ieee80211_ampdu_mlme_action action, | |
617 | struct ieee80211_sta *sta, u16 tid, | |
618 | u16 *ssn, u8 buf_size, bool amsdu); | |
1f87f7d3 | 619 | |
1289723e HS |
620 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
621 | struct survey_info *survey) | |
622 | { | |
623 | int ret = -EOPNOTSUPP; | |
c466d4ef JL |
624 | |
625 | trace_drv_get_survey(local, idx, survey); | |
626 | ||
35dd0509 | 627 | if (local->ops->get_survey) |
1289723e | 628 | ret = local->ops->get_survey(&local->hw, idx, survey); |
c466d4ef JL |
629 | |
630 | trace_drv_return_int(local, ret); | |
631 | ||
1289723e HS |
632 | return ret; |
633 | } | |
1f87f7d3 JB |
634 | |
635 | static inline void drv_rfkill_poll(struct ieee80211_local *local) | |
636 | { | |
e1781ed3 KV |
637 | might_sleep(); |
638 | ||
1f87f7d3 JB |
639 | if (local->ops->rfkill_poll) |
640 | local->ops->rfkill_poll(&local->hw); | |
641 | } | |
a80f7c0b | 642 | |
39ecc01d | 643 | static inline void drv_flush(struct ieee80211_local *local, |
77be2c54 | 644 | struct ieee80211_sub_if_data *sdata, |
39ecc01d | 645 | u32 queues, bool drop) |
a80f7c0b | 646 | { |
77be2c54 EG |
647 | struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL; |
648 | ||
e1781ed3 KV |
649 | might_sleep(); |
650 | ||
f6837ba8 JB |
651 | if (sdata && !check_sdata_in_driver(sdata)) |
652 | return; | |
77be2c54 | 653 | |
39ecc01d | 654 | trace_drv_flush(local, queues, drop); |
a80f7c0b | 655 | if (local->ops->flush) |
77be2c54 | 656 | local->ops->flush(&local->hw, vif, queues, drop); |
4efc76bd | 657 | trace_drv_return_void(local); |
a80f7c0b | 658 | } |
5ce6e438 JB |
659 | |
660 | static inline void drv_channel_switch(struct ieee80211_local *local, | |
0f791eb4 LC |
661 | struct ieee80211_sub_if_data *sdata, |
662 | struct ieee80211_channel_switch *ch_switch) | |
5ce6e438 JB |
663 | { |
664 | might_sleep(); | |
665 | ||
0f791eb4 LC |
666 | trace_drv_channel_switch(local, sdata, ch_switch); |
667 | local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch); | |
4efc76bd | 668 | trace_drv_return_void(local); |
5ce6e438 JB |
669 | } |
670 | ||
15d96753 BR |
671 | |
672 | static inline int drv_set_antenna(struct ieee80211_local *local, | |
673 | u32 tx_ant, u32 rx_ant) | |
674 | { | |
675 | int ret = -EOPNOTSUPP; | |
676 | might_sleep(); | |
677 | if (local->ops->set_antenna) | |
678 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); | |
679 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); | |
680 | return ret; | |
681 | } | |
682 | ||
683 | static inline int drv_get_antenna(struct ieee80211_local *local, | |
684 | u32 *tx_ant, u32 *rx_ant) | |
685 | { | |
686 | int ret = -EOPNOTSUPP; | |
687 | might_sleep(); | |
688 | if (local->ops->get_antenna) | |
689 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); | |
690 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); | |
691 | return ret; | |
692 | } | |
693 | ||
21f83589 | 694 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
49884568 | 695 | struct ieee80211_sub_if_data *sdata, |
21f83589 | 696 | struct ieee80211_channel *chan, |
d339d5ca IP |
697 | unsigned int duration, |
698 | enum ieee80211_roc_type type) | |
21f83589 JB |
699 | { |
700 | int ret; | |
701 | ||
702 | might_sleep(); | |
703 | ||
d339d5ca | 704 | trace_drv_remain_on_channel(local, sdata, chan, duration, type); |
49884568 | 705 | ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, |
d339d5ca | 706 | chan, duration, type); |
21f83589 JB |
707 | trace_drv_return_int(local, ret); |
708 | ||
709 | return ret; | |
710 | } | |
711 | ||
712 | static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) | |
713 | { | |
714 | int ret; | |
715 | ||
716 | might_sleep(); | |
717 | ||
718 | trace_drv_cancel_remain_on_channel(local); | |
719 | ret = local->ops->cancel_remain_on_channel(&local->hw); | |
720 | trace_drv_return_int(local, ret); | |
5f16a436 JB |
721 | |
722 | return ret; | |
723 | } | |
724 | ||
38c09159 JL |
725 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
726 | u32 tx, u32 rx) | |
727 | { | |
728 | int ret = -ENOTSUPP; | |
729 | ||
730 | might_sleep(); | |
731 | ||
732 | trace_drv_set_ringparam(local, tx, rx); | |
733 | if (local->ops->set_ringparam) | |
734 | ret = local->ops->set_ringparam(&local->hw, tx, rx); | |
735 | trace_drv_return_int(local, ret); | |
736 | ||
737 | return ret; | |
738 | } | |
739 | ||
740 | static inline void drv_get_ringparam(struct ieee80211_local *local, | |
741 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | |
742 | { | |
743 | might_sleep(); | |
744 | ||
745 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); | |
746 | if (local->ops->get_ringparam) | |
747 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); | |
748 | trace_drv_return_void(local); | |
749 | } | |
750 | ||
e8306f98 VN |
751 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
752 | { | |
753 | bool ret = false; | |
754 | ||
755 | might_sleep(); | |
756 | ||
757 | trace_drv_tx_frames_pending(local); | |
758 | if (local->ops->tx_frames_pending) | |
759 | ret = local->ops->tx_frames_pending(&local->hw); | |
760 | trace_drv_return_bool(local, ret); | |
761 | ||
762 | return ret; | |
763 | } | |
bdbfd6b5 SM |
764 | |
765 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, | |
766 | struct ieee80211_sub_if_data *sdata, | |
767 | const struct cfg80211_bitrate_mask *mask) | |
768 | { | |
769 | int ret = -EOPNOTSUPP; | |
770 | ||
771 | might_sleep(); | |
772 | ||
f6837ba8 JB |
773 | if (!check_sdata_in_driver(sdata)) |
774 | return -EIO; | |
7b7eab6f | 775 | |
bdbfd6b5 SM |
776 | trace_drv_set_bitrate_mask(local, sdata, mask); |
777 | if (local->ops->set_bitrate_mask) | |
778 | ret = local->ops->set_bitrate_mask(&local->hw, | |
779 | &sdata->vif, mask); | |
780 | trace_drv_return_int(local, ret); | |
781 | ||
782 | return ret; | |
783 | } | |
784 | ||
c68f4b89 JB |
785 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
786 | struct ieee80211_sub_if_data *sdata, | |
787 | struct cfg80211_gtk_rekey_data *data) | |
788 | { | |
f6837ba8 JB |
789 | if (!check_sdata_in_driver(sdata)) |
790 | return; | |
7b7eab6f | 791 | |
c68f4b89 JB |
792 | trace_drv_set_rekey_data(local, sdata, data); |
793 | if (local->ops->set_rekey_data) | |
794 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); | |
795 | trace_drv_return_void(local); | |
796 | } | |
797 | ||
a8182929 EG |
798 | static inline void drv_event_callback(struct ieee80211_local *local, |
799 | struct ieee80211_sub_if_data *sdata, | |
800 | const struct ieee80211_event *event) | |
615f7b9b | 801 | { |
a8182929 EG |
802 | trace_drv_event_callback(local, sdata, event); |
803 | if (local->ops->event_callback) | |
804 | local->ops->event_callback(&local->hw, &sdata->vif, event); | |
615f7b9b MV |
805 | trace_drv_return_void(local); |
806 | } | |
4049e09a JB |
807 | |
808 | static inline void | |
809 | drv_release_buffered_frames(struct ieee80211_local *local, | |
810 | struct sta_info *sta, u16 tids, int num_frames, | |
811 | enum ieee80211_frame_release_type reason, | |
812 | bool more_data) | |
813 | { | |
814 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, | |
815 | reason, more_data); | |
816 | if (local->ops->release_buffered_frames) | |
817 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, | |
818 | num_frames, reason, | |
819 | more_data); | |
820 | trace_drv_return_void(local); | |
821 | } | |
40b96408 JB |
822 | |
823 | static inline void | |
824 | drv_allow_buffered_frames(struct ieee80211_local *local, | |
825 | struct sta_info *sta, u16 tids, int num_frames, | |
826 | enum ieee80211_frame_release_type reason, | |
827 | bool more_data) | |
828 | { | |
829 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, | |
830 | reason, more_data); | |
831 | if (local->ops->allow_buffered_frames) | |
832 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, | |
833 | tids, num_frames, reason, | |
834 | more_data); | |
835 | trace_drv_return_void(local); | |
836 | } | |
66572cfc | 837 | |
a1845fc7 JB |
838 | static inline void drv_mgd_prepare_tx(struct ieee80211_local *local, |
839 | struct ieee80211_sub_if_data *sdata) | |
840 | { | |
841 | might_sleep(); | |
842 | ||
f6837ba8 JB |
843 | if (!check_sdata_in_driver(sdata)) |
844 | return; | |
a1845fc7 JB |
845 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
846 | ||
847 | trace_drv_mgd_prepare_tx(local, sdata); | |
848 | if (local->ops->mgd_prepare_tx) | |
849 | local->ops->mgd_prepare_tx(&local->hw, &sdata->vif); | |
850 | trace_drv_return_void(local); | |
851 | } | |
c3645eac | 852 | |
ee10f2c7 AN |
853 | static inline void |
854 | drv_mgd_protect_tdls_discover(struct ieee80211_local *local, | |
855 | struct ieee80211_sub_if_data *sdata) | |
856 | { | |
857 | might_sleep(); | |
858 | ||
859 | if (!check_sdata_in_driver(sdata)) | |
860 | return; | |
861 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); | |
862 | ||
863 | trace_drv_mgd_protect_tdls_discover(local, sdata); | |
864 | if (local->ops->mgd_protect_tdls_discover) | |
865 | local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif); | |
866 | trace_drv_return_void(local); | |
867 | } | |
868 | ||
c3645eac MK |
869 | static inline int drv_add_chanctx(struct ieee80211_local *local, |
870 | struct ieee80211_chanctx *ctx) | |
871 | { | |
872 | int ret = -EOPNOTSUPP; | |
873 | ||
874 | trace_drv_add_chanctx(local, ctx); | |
875 | if (local->ops->add_chanctx) | |
876 | ret = local->ops->add_chanctx(&local->hw, &ctx->conf); | |
877 | trace_drv_return_int(local, ret); | |
8a61af65 JB |
878 | if (!ret) |
879 | ctx->driver_present = true; | |
c3645eac MK |
880 | |
881 | return ret; | |
882 | } | |
883 | ||
884 | static inline void drv_remove_chanctx(struct ieee80211_local *local, | |
885 | struct ieee80211_chanctx *ctx) | |
886 | { | |
f6837ba8 JB |
887 | if (WARN_ON(!ctx->driver_present)) |
888 | return; | |
889 | ||
c3645eac MK |
890 | trace_drv_remove_chanctx(local, ctx); |
891 | if (local->ops->remove_chanctx) | |
892 | local->ops->remove_chanctx(&local->hw, &ctx->conf); | |
893 | trace_drv_return_void(local); | |
8a61af65 | 894 | ctx->driver_present = false; |
c3645eac MK |
895 | } |
896 | ||
897 | static inline void drv_change_chanctx(struct ieee80211_local *local, | |
898 | struct ieee80211_chanctx *ctx, | |
899 | u32 changed) | |
900 | { | |
901 | trace_drv_change_chanctx(local, ctx, changed); | |
8a61af65 JB |
902 | if (local->ops->change_chanctx) { |
903 | WARN_ON_ONCE(!ctx->driver_present); | |
c3645eac | 904 | local->ops->change_chanctx(&local->hw, &ctx->conf, changed); |
8a61af65 | 905 | } |
c3645eac MK |
906 | trace_drv_return_void(local); |
907 | } | |
908 | ||
909 | static inline int drv_assign_vif_chanctx(struct ieee80211_local *local, | |
910 | struct ieee80211_sub_if_data *sdata, | |
911 | struct ieee80211_chanctx *ctx) | |
912 | { | |
913 | int ret = 0; | |
914 | ||
f6837ba8 JB |
915 | if (!check_sdata_in_driver(sdata)) |
916 | return -EIO; | |
c3645eac MK |
917 | |
918 | trace_drv_assign_vif_chanctx(local, sdata, ctx); | |
8a61af65 JB |
919 | if (local->ops->assign_vif_chanctx) { |
920 | WARN_ON_ONCE(!ctx->driver_present); | |
c3645eac MK |
921 | ret = local->ops->assign_vif_chanctx(&local->hw, |
922 | &sdata->vif, | |
923 | &ctx->conf); | |
8a61af65 | 924 | } |
c3645eac MK |
925 | trace_drv_return_int(local, ret); |
926 | ||
927 | return ret; | |
928 | } | |
929 | ||
930 | static inline void drv_unassign_vif_chanctx(struct ieee80211_local *local, | |
931 | struct ieee80211_sub_if_data *sdata, | |
932 | struct ieee80211_chanctx *ctx) | |
933 | { | |
f6837ba8 JB |
934 | if (!check_sdata_in_driver(sdata)) |
935 | return; | |
c3645eac MK |
936 | |
937 | trace_drv_unassign_vif_chanctx(local, sdata, ctx); | |
8a61af65 JB |
938 | if (local->ops->unassign_vif_chanctx) { |
939 | WARN_ON_ONCE(!ctx->driver_present); | |
c3645eac MK |
940 | local->ops->unassign_vif_chanctx(&local->hw, |
941 | &sdata->vif, | |
942 | &ctx->conf); | |
8a61af65 | 943 | } |
c3645eac MK |
944 | trace_drv_return_void(local); |
945 | } | |
946 | ||
42677ed3 DV |
947 | int drv_switch_vif_chanctx(struct ieee80211_local *local, |
948 | struct ieee80211_vif_chanctx_switch *vifs, | |
949 | int n_vifs, enum ieee80211_chanctx_switch_mode mode); | |
1a5f0c13 | 950 | |
1041638f JB |
951 | static inline int drv_start_ap(struct ieee80211_local *local, |
952 | struct ieee80211_sub_if_data *sdata) | |
953 | { | |
954 | int ret = 0; | |
955 | ||
f6837ba8 JB |
956 | if (!check_sdata_in_driver(sdata)) |
957 | return -EIO; | |
1041638f JB |
958 | |
959 | trace_drv_start_ap(local, sdata, &sdata->vif.bss_conf); | |
960 | if (local->ops->start_ap) | |
961 | ret = local->ops->start_ap(&local->hw, &sdata->vif); | |
962 | trace_drv_return_int(local, ret); | |
963 | return ret; | |
964 | } | |
965 | ||
966 | static inline void drv_stop_ap(struct ieee80211_local *local, | |
967 | struct ieee80211_sub_if_data *sdata) | |
968 | { | |
f6837ba8 JB |
969 | if (!check_sdata_in_driver(sdata)) |
970 | return; | |
1041638f JB |
971 | |
972 | trace_drv_stop_ap(local, sdata); | |
973 | if (local->ops->stop_ap) | |
974 | local->ops->stop_ap(&local->hw, &sdata->vif); | |
975 | trace_drv_return_void(local); | |
976 | } | |
977 | ||
cf2c92d8 EP |
978 | static inline void |
979 | drv_reconfig_complete(struct ieee80211_local *local, | |
980 | enum ieee80211_reconfig_type reconfig_type) | |
9214ad7f JB |
981 | { |
982 | might_sleep(); | |
983 | ||
cf2c92d8 EP |
984 | trace_drv_reconfig_complete(local, reconfig_type); |
985 | if (local->ops->reconfig_complete) | |
986 | local->ops->reconfig_complete(&local->hw, reconfig_type); | |
9214ad7f JB |
987 | trace_drv_return_void(local); |
988 | } | |
989 | ||
de5fad81 YD |
990 | static inline void |
991 | drv_set_default_unicast_key(struct ieee80211_local *local, | |
992 | struct ieee80211_sub_if_data *sdata, | |
993 | int key_idx) | |
994 | { | |
f6837ba8 JB |
995 | if (!check_sdata_in_driver(sdata)) |
996 | return; | |
de5fad81 YD |
997 | |
998 | WARN_ON_ONCE(key_idx < -1 || key_idx > 3); | |
999 | ||
1000 | trace_drv_set_default_unicast_key(local, sdata, key_idx); | |
1001 | if (local->ops->set_default_unicast_key) | |
1002 | local->ops->set_default_unicast_key(&local->hw, &sdata->vif, | |
1003 | key_idx); | |
1004 | trace_drv_return_void(local); | |
1005 | } | |
1006 | ||
a65240c1 JB |
1007 | #if IS_ENABLED(CONFIG_IPV6) |
1008 | static inline void drv_ipv6_addr_change(struct ieee80211_local *local, | |
1009 | struct ieee80211_sub_if_data *sdata, | |
1010 | struct inet6_dev *idev) | |
1011 | { | |
1012 | trace_drv_ipv6_addr_change(local, sdata); | |
1013 | if (local->ops->ipv6_addr_change) | |
1014 | local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev); | |
1015 | trace_drv_return_void(local); | |
1016 | } | |
1017 | #endif | |
1018 | ||
73da7d5b SW |
1019 | static inline void |
1020 | drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata, | |
1021 | struct cfg80211_chan_def *chandef) | |
1022 | { | |
1023 | struct ieee80211_local *local = sdata->local; | |
1024 | ||
1025 | if (local->ops->channel_switch_beacon) { | |
1026 | trace_drv_channel_switch_beacon(local, sdata, chandef); | |
1027 | local->ops->channel_switch_beacon(&local->hw, &sdata->vif, | |
1028 | chandef); | |
1029 | } | |
1030 | } | |
1031 | ||
6d027bcc LC |
1032 | static inline int |
1033 | drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata, | |
1034 | struct ieee80211_channel_switch *ch_switch) | |
1035 | { | |
1036 | struct ieee80211_local *local = sdata->local; | |
1037 | int ret = 0; | |
1038 | ||
1039 | if (!check_sdata_in_driver(sdata)) | |
1040 | return -EIO; | |
1041 | ||
1042 | trace_drv_pre_channel_switch(local, sdata, ch_switch); | |
1043 | if (local->ops->pre_channel_switch) | |
1044 | ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif, | |
1045 | ch_switch); | |
1046 | trace_drv_return_int(local, ret); | |
1047 | return ret; | |
1048 | } | |
1049 | ||
f1d65583 LC |
1050 | static inline int |
1051 | drv_post_channel_switch(struct ieee80211_sub_if_data *sdata) | |
1052 | { | |
1053 | struct ieee80211_local *local = sdata->local; | |
1054 | int ret = 0; | |
1055 | ||
1056 | if (!check_sdata_in_driver(sdata)) | |
1057 | return -EIO; | |
1058 | ||
1059 | trace_drv_post_channel_switch(local, sdata); | |
1060 | if (local->ops->post_channel_switch) | |
1061 | ret = local->ops->post_channel_switch(&local->hw, &sdata->vif); | |
1062 | trace_drv_return_int(local, ret); | |
1063 | return ret; | |
1064 | } | |
1065 | ||
55fff501 JB |
1066 | static inline int drv_join_ibss(struct ieee80211_local *local, |
1067 | struct ieee80211_sub_if_data *sdata) | |
1068 | { | |
1069 | int ret = 0; | |
1070 | ||
1071 | might_sleep(); | |
f6837ba8 JB |
1072 | if (!check_sdata_in_driver(sdata)) |
1073 | return -EIO; | |
55fff501 JB |
1074 | |
1075 | trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf); | |
1076 | if (local->ops->join_ibss) | |
1077 | ret = local->ops->join_ibss(&local->hw, &sdata->vif); | |
1078 | trace_drv_return_int(local, ret); | |
1079 | return ret; | |
1080 | } | |
1081 | ||
1082 | static inline void drv_leave_ibss(struct ieee80211_local *local, | |
1083 | struct ieee80211_sub_if_data *sdata) | |
1084 | { | |
1085 | might_sleep(); | |
f6837ba8 JB |
1086 | if (!check_sdata_in_driver(sdata)) |
1087 | return; | |
55fff501 JB |
1088 | |
1089 | trace_drv_leave_ibss(local, sdata); | |
1090 | if (local->ops->leave_ibss) | |
1091 | local->ops->leave_ibss(&local->hw, &sdata->vif); | |
1092 | trace_drv_return_void(local); | |
1093 | } | |
1094 | ||
cca674d4 AQ |
1095 | static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, |
1096 | struct ieee80211_sta *sta) | |
1097 | { | |
1098 | u32 ret = 0; | |
1099 | ||
1100 | trace_drv_get_expected_throughput(sta); | |
1101 | if (local->ops->get_expected_throughput) | |
1102 | ret = local->ops->get_expected_throughput(sta); | |
1103 | trace_drv_return_u32(local, ret); | |
1104 | ||
1105 | return ret; | |
1106 | } | |
1107 | ||
5b3dc42b FF |
1108 | static inline int drv_get_txpower(struct ieee80211_local *local, |
1109 | struct ieee80211_sub_if_data *sdata, int *dbm) | |
1110 | { | |
1111 | int ret; | |
1112 | ||
1113 | if (!local->ops->get_txpower) | |
1114 | return -EOPNOTSUPP; | |
1115 | ||
1116 | ret = local->ops->get_txpower(&local->hw, &sdata->vif, dbm); | |
1117 | trace_drv_get_txpower(local, sdata, *dbm, ret); | |
1118 | ||
1119 | return ret; | |
1120 | } | |
1121 | ||
a7a6bdd0 AN |
1122 | static inline int |
1123 | drv_tdls_channel_switch(struct ieee80211_local *local, | |
1124 | struct ieee80211_sub_if_data *sdata, | |
1125 | struct ieee80211_sta *sta, u8 oper_class, | |
1126 | struct cfg80211_chan_def *chandef, | |
1127 | struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie) | |
1128 | { | |
1129 | int ret; | |
1130 | ||
1131 | might_sleep(); | |
1132 | if (!check_sdata_in_driver(sdata)) | |
1133 | return -EIO; | |
1134 | ||
1135 | if (!local->ops->tdls_channel_switch) | |
1136 | return -EOPNOTSUPP; | |
1137 | ||
1138 | trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef); | |
1139 | ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta, | |
1140 | oper_class, chandef, tmpl_skb, | |
1141 | ch_sw_tm_ie); | |
1142 | trace_drv_return_int(local, ret); | |
1143 | return ret; | |
1144 | } | |
1145 | ||
1146 | static inline void | |
1147 | drv_tdls_cancel_channel_switch(struct ieee80211_local *local, | |
1148 | struct ieee80211_sub_if_data *sdata, | |
1149 | struct ieee80211_sta *sta) | |
1150 | { | |
1151 | might_sleep(); | |
1152 | if (!check_sdata_in_driver(sdata)) | |
1153 | return; | |
1154 | ||
1155 | if (!local->ops->tdls_cancel_channel_switch) | |
1156 | return; | |
1157 | ||
1158 | trace_drv_tdls_cancel_channel_switch(local, sdata, sta); | |
1159 | local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta); | |
1160 | trace_drv_return_void(local); | |
1161 | } | |
1162 | ||
8a4d32f3 AN |
1163 | static inline void |
1164 | drv_tdls_recv_channel_switch(struct ieee80211_local *local, | |
1165 | struct ieee80211_sub_if_data *sdata, | |
1166 | struct ieee80211_tdls_ch_sw_params *params) | |
1167 | { | |
1168 | trace_drv_tdls_recv_channel_switch(local, sdata, params); | |
1169 | if (local->ops->tdls_recv_channel_switch) | |
1170 | local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif, | |
1171 | params); | |
1172 | trace_drv_return_void(local); | |
1173 | } | |
1174 | ||
ba8c3d6f FF |
1175 | static inline void drv_wake_tx_queue(struct ieee80211_local *local, |
1176 | struct txq_info *txq) | |
1177 | { | |
1178 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); | |
1179 | ||
1180 | if (!check_sdata_in_driver(sdata)) | |
1181 | return; | |
1182 | ||
1183 | trace_drv_wake_tx_queue(local, sdata, txq); | |
1184 | local->ops->wake_tx_queue(&local->hw, &txq->txq); | |
1185 | } | |
1186 | ||
24487981 | 1187 | #endif /* __MAC80211_DRIVER_OPS */ |