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