Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
f59374eb SS |
2 | /* |
3 | * Portions of this file | |
4 | * Copyright(c) 2016 Intel Deutschland GmbH | |
8c60179b | 5 | * Copyright (C) 2018-2019, 2021-2025 Intel Corporation |
f59374eb SS |
6 | */ |
7 | ||
24487981 JB |
8 | #ifndef __MAC80211_DRIVER_OPS |
9 | #define __MAC80211_DRIVER_OPS | |
10 | ||
11 | #include <net/mac80211.h> | |
12 | #include "ieee80211_i.h" | |
011ad0e9 | 13 | #include "trace.h" |
24487981 | 14 | |
c8ad0106 | 15 | #define check_sdata_in_driver(sdata) ({ \ |
c4fdb081 JB |
16 | WARN_ONCE(!sdata->local->reconfig_failure && \ |
17 | !(sdata->flags & IEEE80211_SDATA_IN_DRIVER), \ | |
18 | "%s: Failed check-sdata-in-driver check, flags: 0x%x\n", \ | |
19 | sdata->dev ? sdata->dev->name : sdata->name, sdata->flags); \ | |
20 | !!(sdata->flags & IEEE80211_SDATA_IN_DRIVER); \ | |
c8ad0106 | 21 | }) |
7b7eab6f | 22 | |
bc192f89 FF |
23 | static inline struct ieee80211_sub_if_data * |
24 | get_bss_sdata(struct ieee80211_sub_if_data *sdata) | |
25 | { | |
3e3a2b64 | 26 | if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
bc192f89 FF |
27 | sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, |
28 | u.ap); | |
29 | ||
30 | return sdata; | |
31 | } | |
32 | ||
36323f81 TH |
33 | static inline void drv_tx(struct ieee80211_local *local, |
34 | struct ieee80211_tx_control *control, | |
35 | struct sk_buff *skb) | |
24487981 | 36 | { |
36323f81 | 37 | local->ops->tx(&local->hw, control, skb); |
24487981 JB |
38 | } |
39 | ||
f59374eb SS |
40 | static inline void drv_sync_rx_queues(struct ieee80211_local *local, |
41 | struct sta_info *sta) | |
42 | { | |
5549b088 | 43 | might_sleep(); |
0e8185ce | 44 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 45 | |
f59374eb SS |
46 | if (local->ops->sync_rx_queues) { |
47 | trace_drv_sync_rx_queues(local, sta->sdata, &sta->sta); | |
48 | local->ops->sync_rx_queues(&local->hw); | |
49 | trace_drv_return_void(local); | |
50 | } | |
51 | } | |
52 | ||
e352114f BG |
53 | static inline void drv_get_et_strings(struct ieee80211_sub_if_data *sdata, |
54 | u32 sset, u8 *data) | |
55 | { | |
56 | struct ieee80211_local *local = sdata->local; | |
57 | if (local->ops->get_et_strings) { | |
58 | trace_drv_get_et_strings(local, sset); | |
59 | local->ops->get_et_strings(&local->hw, &sdata->vif, sset, data); | |
60 | trace_drv_return_void(local); | |
61 | } | |
62 | } | |
63 | ||
64 | static inline void drv_get_et_stats(struct ieee80211_sub_if_data *sdata, | |
65 | struct ethtool_stats *stats, | |
66 | u64 *data) | |
67 | { | |
68 | struct ieee80211_local *local = sdata->local; | |
69 | if (local->ops->get_et_stats) { | |
70 | trace_drv_get_et_stats(local); | |
71 | local->ops->get_et_stats(&local->hw, &sdata->vif, stats, data); | |
72 | trace_drv_return_void(local); | |
73 | } | |
74 | } | |
75 | ||
76 | static inline int drv_get_et_sset_count(struct ieee80211_sub_if_data *sdata, | |
77 | int sset) | |
78 | { | |
79 | struct ieee80211_local *local = sdata->local; | |
80 | int rv = 0; | |
81 | if (local->ops->get_et_sset_count) { | |
82 | trace_drv_get_et_sset_count(local, sset); | |
83 | rv = local->ops->get_et_sset_count(&local->hw, &sdata->vif, | |
84 | sset); | |
85 | trace_drv_return_int(local, rv); | |
86 | } | |
87 | return rv; | |
88 | } | |
89 | ||
968a76ce | 90 | int drv_start(struct ieee80211_local *local); |
1decf05d | 91 | void drv_stop(struct ieee80211_local *local, bool suspend); |
24487981 | 92 | |
eecc4800 JB |
93 | #ifdef CONFIG_PM |
94 | static inline int drv_suspend(struct ieee80211_local *local, | |
95 | struct cfg80211_wowlan *wowlan) | |
96 | { | |
97 | int ret; | |
98 | ||
99 | might_sleep(); | |
0e8185ce | 100 | lockdep_assert_wiphy(local->hw.wiphy); |
eecc4800 JB |
101 | |
102 | trace_drv_suspend(local); | |
103 | ret = local->ops->suspend(&local->hw, wowlan); | |
104 | trace_drv_return_int(local, ret); | |
105 | return ret; | |
106 | } | |
107 | ||
108 | static inline int drv_resume(struct ieee80211_local *local) | |
109 | { | |
110 | int ret; | |
111 | ||
112 | might_sleep(); | |
0e8185ce | 113 | lockdep_assert_wiphy(local->hw.wiphy); |
eecc4800 JB |
114 | |
115 | trace_drv_resume(local); | |
116 | ret = local->ops->resume(&local->hw); | |
117 | trace_drv_return_int(local, ret); | |
118 | return ret; | |
119 | } | |
6d52563f JB |
120 | |
121 | static inline void drv_set_wakeup(struct ieee80211_local *local, | |
122 | bool enabled) | |
123 | { | |
124 | might_sleep(); | |
0e8185ce | 125 | lockdep_assert_wiphy(local->hw.wiphy); |
6d52563f JB |
126 | |
127 | if (!local->ops->set_wakeup) | |
128 | return; | |
129 | ||
130 | trace_drv_set_wakeup(local, enabled); | |
131 | local->ops->set_wakeup(&local->hw, enabled); | |
132 | trace_drv_return_void(local); | |
133 | } | |
eecc4800 JB |
134 | #endif |
135 | ||
9aae296a DV |
136 | int drv_add_interface(struct ieee80211_local *local, |
137 | struct ieee80211_sub_if_data *sdata); | |
7b7eab6f | 138 | |
9aae296a DV |
139 | int drv_change_interface(struct ieee80211_local *local, |
140 | struct ieee80211_sub_if_data *sdata, | |
141 | enum nl80211_iftype type, bool p2p); | |
7b7eab6f | 142 | |
9aae296a DV |
143 | void drv_remove_interface(struct ieee80211_local *local, |
144 | struct ieee80211_sub_if_data *sdata); | |
24487981 JB |
145 | |
146 | static inline int drv_config(struct ieee80211_local *local, u32 changed) | |
147 | { | |
e1781ed3 KV |
148 | int ret; |
149 | ||
150 | might_sleep(); | |
0e8185ce | 151 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 152 | |
4efc76bd | 153 | trace_drv_config(local, changed); |
e1781ed3 | 154 | ret = local->ops->config(&local->hw, changed); |
4efc76bd | 155 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 156 | return ret; |
24487981 JB |
157 | } |
158 | ||
7b7090b4 JB |
159 | static inline void drv_vif_cfg_changed(struct ieee80211_local *local, |
160 | struct ieee80211_sub_if_data *sdata, | |
161 | u64 changed) | |
162 | { | |
163 | might_sleep(); | |
0e8185ce | 164 | lockdep_assert_wiphy(local->hw.wiphy); |
7b7090b4 JB |
165 | |
166 | if (!check_sdata_in_driver(sdata)) | |
167 | return; | |
168 | ||
169 | trace_drv_vif_cfg_changed(local, sdata, changed); | |
170 | if (local->ops->vif_cfg_changed) | |
171 | local->ops->vif_cfg_changed(&local->hw, &sdata->vif, changed); | |
172 | else if (local->ops->bss_info_changed) | |
173 | local->ops->bss_info_changed(&local->hw, &sdata->vif, | |
174 | &sdata->vif.bss_conf, changed); | |
175 | trace_drv_return_void(local); | |
176 | } | |
177 | ||
efe9c2bf JB |
178 | void drv_link_info_changed(struct ieee80211_local *local, |
179 | struct ieee80211_sub_if_data *sdata, | |
180 | struct ieee80211_bss_conf *info, | |
181 | int link_id, u64 changed); | |
24487981 | 182 | |
3ac64bee | 183 | static inline u64 drv_prepare_multicast(struct ieee80211_local *local, |
22bedad3 | 184 | struct netdev_hw_addr_list *mc_list) |
3ac64bee JB |
185 | { |
186 | u64 ret = 0; | |
187 | ||
4efc76bd JB |
188 | trace_drv_prepare_multicast(local, mc_list->count); |
189 | ||
3ac64bee | 190 | if (local->ops->prepare_multicast) |
22bedad3 | 191 | ret = local->ops->prepare_multicast(&local->hw, mc_list); |
3ac64bee | 192 | |
4efc76bd | 193 | trace_drv_return_u64(local, ret); |
3ac64bee JB |
194 | |
195 | return ret; | |
196 | } | |
197 | ||
24487981 JB |
198 | static inline void drv_configure_filter(struct ieee80211_local *local, |
199 | unsigned int changed_flags, | |
200 | unsigned int *total_flags, | |
3ac64bee | 201 | u64 multicast) |
24487981 | 202 | { |
3ac64bee | 203 | might_sleep(); |
0e8185ce | 204 | lockdep_assert_wiphy(local->hw.wiphy); |
3ac64bee | 205 | |
0a2b8bb2 | 206 | trace_drv_configure_filter(local, changed_flags, total_flags, |
3ac64bee | 207 | multicast); |
4efc76bd JB |
208 | local->ops->configure_filter(&local->hw, changed_flags, total_flags, |
209 | multicast); | |
210 | trace_drv_return_void(local); | |
24487981 JB |
211 | } |
212 | ||
1b09b556 AO |
213 | static inline void drv_config_iface_filter(struct ieee80211_local *local, |
214 | struct ieee80211_sub_if_data *sdata, | |
215 | unsigned int filter_flags, | |
216 | unsigned int changed_flags) | |
217 | { | |
218 | might_sleep(); | |
0e8185ce | 219 | lockdep_assert_wiphy(local->hw.wiphy); |
1b09b556 AO |
220 | |
221 | trace_drv_config_iface_filter(local, sdata, filter_flags, | |
222 | changed_flags); | |
223 | if (local->ops->config_iface_filter) | |
224 | local->ops->config_iface_filter(&local->hw, &sdata->vif, | |
225 | filter_flags, | |
226 | changed_flags); | |
227 | trace_drv_return_void(local); | |
228 | } | |
229 | ||
24487981 JB |
230 | static inline int drv_set_tim(struct ieee80211_local *local, |
231 | struct ieee80211_sta *sta, bool set) | |
232 | { | |
0a2b8bb2 | 233 | int ret = 0; |
4efc76bd | 234 | trace_drv_set_tim(local, sta, set); |
24487981 | 235 | if (local->ops->set_tim) |
0a2b8bb2 | 236 | ret = local->ops->set_tim(&local->hw, sta, set); |
4efc76bd | 237 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 238 | return ret; |
24487981 JB |
239 | } |
240 | ||
efe9c2bf JB |
241 | int drv_set_key(struct ieee80211_local *local, |
242 | enum set_key_cmd cmd, | |
243 | struct ieee80211_sub_if_data *sdata, | |
244 | struct ieee80211_sta *sta, | |
245 | struct ieee80211_key_conf *key); | |
24487981 JB |
246 | |
247 | static inline void drv_update_tkip_key(struct ieee80211_local *local, | |
b3fbdcf4 | 248 | struct ieee80211_sub_if_data *sdata, |
24487981 | 249 | struct ieee80211_key_conf *conf, |
b3fbdcf4 | 250 | struct sta_info *sta, u32 iv32, |
24487981 JB |
251 | u16 *phase1key) |
252 | { | |
b3fbdcf4 JB |
253 | struct ieee80211_sta *ista = NULL; |
254 | ||
b3fbdcf4 JB |
255 | if (sta) |
256 | ista = &sta->sta; | |
257 | ||
077f4939 | 258 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
259 | if (!check_sdata_in_driver(sdata)) |
260 | return; | |
7b7eab6f | 261 | |
4efc76bd | 262 | trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); |
24487981 | 263 | if (local->ops->update_tkip_key) |
b3fbdcf4 JB |
264 | local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, |
265 | ista, iv32, phase1key); | |
4efc76bd | 266 | trace_drv_return_void(local); |
24487981 JB |
267 | } |
268 | ||
269 | static inline int drv_hw_scan(struct ieee80211_local *local, | |
a060bbfe | 270 | struct ieee80211_sub_if_data *sdata, |
c56ef672 | 271 | struct ieee80211_scan_request *req) |
24487981 | 272 | { |
e1781ed3 KV |
273 | int ret; |
274 | ||
275 | might_sleep(); | |
0e8185ce | 276 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 277 | |
f6837ba8 JB |
278 | if (!check_sdata_in_driver(sdata)) |
279 | return -EIO; | |
7b7eab6f | 280 | |
79f460ca | 281 | trace_drv_hw_scan(local, sdata); |
a060bbfe | 282 | ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); |
4efc76bd | 283 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 284 | return ret; |
24487981 JB |
285 | } |
286 | ||
b856439b EP |
287 | static inline void drv_cancel_hw_scan(struct ieee80211_local *local, |
288 | struct ieee80211_sub_if_data *sdata) | |
289 | { | |
290 | might_sleep(); | |
0e8185ce | 291 | lockdep_assert_wiphy(local->hw.wiphy); |
b856439b | 292 | |
f6837ba8 JB |
293 | if (!check_sdata_in_driver(sdata)) |
294 | return; | |
7b7eab6f | 295 | |
b856439b EP |
296 | trace_drv_cancel_hw_scan(local, sdata); |
297 | local->ops->cancel_hw_scan(&local->hw, &sdata->vif); | |
298 | trace_drv_return_void(local); | |
299 | } | |
300 | ||
79f460ca LC |
301 | static inline int |
302 | drv_sched_scan_start(struct ieee80211_local *local, | |
303 | struct ieee80211_sub_if_data *sdata, | |
304 | struct cfg80211_sched_scan_request *req, | |
633e2713 | 305 | struct ieee80211_scan_ies *ies) |
79f460ca LC |
306 | { |
307 | int ret; | |
308 | ||
309 | might_sleep(); | |
0e8185ce | 310 | lockdep_assert_wiphy(local->hw.wiphy); |
79f460ca | 311 | |
f6837ba8 JB |
312 | if (!check_sdata_in_driver(sdata)) |
313 | return -EIO; | |
7b7eab6f | 314 | |
79f460ca LC |
315 | trace_drv_sched_scan_start(local, sdata); |
316 | ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, | |
317 | req, ies); | |
318 | trace_drv_return_int(local, ret); | |
319 | return ret; | |
320 | } | |
321 | ||
37e3308c JB |
322 | static inline int drv_sched_scan_stop(struct ieee80211_local *local, |
323 | struct ieee80211_sub_if_data *sdata) | |
79f460ca | 324 | { |
37e3308c JB |
325 | int ret; |
326 | ||
79f460ca | 327 | might_sleep(); |
0e8185ce | 328 | lockdep_assert_wiphy(local->hw.wiphy); |
79f460ca | 329 | |
f6837ba8 JB |
330 | if (!check_sdata_in_driver(sdata)) |
331 | return -EIO; | |
7b7eab6f | 332 | |
79f460ca | 333 | trace_drv_sched_scan_stop(local, sdata); |
37e3308c JB |
334 | ret = local->ops->sched_scan_stop(&local->hw, &sdata->vif); |
335 | trace_drv_return_int(local, ret); | |
336 | ||
337 | return ret; | |
79f460ca LC |
338 | } |
339 | ||
a344d677 JB |
340 | static inline void drv_sw_scan_start(struct ieee80211_local *local, |
341 | struct ieee80211_sub_if_data *sdata, | |
342 | const u8 *mac_addr) | |
24487981 | 343 | { |
e1781ed3 | 344 | might_sleep(); |
0e8185ce | 345 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 346 | |
a344d677 | 347 | trace_drv_sw_scan_start(local, sdata, mac_addr); |
24487981 | 348 | if (local->ops->sw_scan_start) |
a344d677 | 349 | local->ops->sw_scan_start(&local->hw, &sdata->vif, mac_addr); |
4efc76bd | 350 | trace_drv_return_void(local); |
24487981 JB |
351 | } |
352 | ||
a344d677 JB |
353 | static inline void drv_sw_scan_complete(struct ieee80211_local *local, |
354 | struct ieee80211_sub_if_data *sdata) | |
24487981 | 355 | { |
e1781ed3 | 356 | might_sleep(); |
0e8185ce | 357 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 358 | |
a344d677 | 359 | trace_drv_sw_scan_complete(local, sdata); |
24487981 | 360 | if (local->ops->sw_scan_complete) |
a344d677 | 361 | local->ops->sw_scan_complete(&local->hw, &sdata->vif); |
4efc76bd | 362 | trace_drv_return_void(local); |
24487981 JB |
363 | } |
364 | ||
365 | static inline int drv_get_stats(struct ieee80211_local *local, | |
366 | struct ieee80211_low_level_stats *stats) | |
367 | { | |
0a2b8bb2 JB |
368 | int ret = -EOPNOTSUPP; |
369 | ||
e1781ed3 | 370 | might_sleep(); |
0e8185ce | 371 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 372 | |
0a2b8bb2 JB |
373 | if (local->ops->get_stats) |
374 | ret = local->ops->get_stats(&local->hw, stats); | |
375 | trace_drv_get_stats(local, stats, ret); | |
376 | ||
377 | return ret; | |
24487981 JB |
378 | } |
379 | ||
9352c19f JB |
380 | static inline void drv_get_key_seq(struct ieee80211_local *local, |
381 | struct ieee80211_key *key, | |
382 | struct ieee80211_key_seq *seq) | |
24487981 | 383 | { |
9352c19f JB |
384 | if (local->ops->get_key_seq) |
385 | local->ops->get_key_seq(&local->hw, &key->conf, seq); | |
386 | trace_drv_get_key_seq(local, &key->conf); | |
24487981 JB |
387 | } |
388 | ||
f23a4780 AN |
389 | static inline int drv_set_frag_threshold(struct ieee80211_local *local, |
390 | u32 value) | |
391 | { | |
392 | int ret = 0; | |
393 | ||
394 | might_sleep(); | |
0e8185ce | 395 | lockdep_assert_wiphy(local->hw.wiphy); |
f23a4780 AN |
396 | |
397 | trace_drv_set_frag_threshold(local, value); | |
398 | if (local->ops->set_frag_threshold) | |
399 | ret = local->ops->set_frag_threshold(&local->hw, value); | |
400 | trace_drv_return_int(local, ret); | |
401 | return ret; | |
402 | } | |
403 | ||
24487981 JB |
404 | static inline int drv_set_rts_threshold(struct ieee80211_local *local, |
405 | u32 value) | |
406 | { | |
0a2b8bb2 | 407 | int ret = 0; |
e1781ed3 KV |
408 | |
409 | might_sleep(); | |
0e8185ce | 410 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 411 | |
4efc76bd | 412 | trace_drv_set_rts_threshold(local, value); |
24487981 | 413 | if (local->ops->set_rts_threshold) |
0a2b8bb2 | 414 | ret = local->ops->set_rts_threshold(&local->hw, value); |
4efc76bd | 415 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 416 | return ret; |
24487981 JB |
417 | } |
418 | ||
310bc676 | 419 | static inline int drv_set_coverage_class(struct ieee80211_local *local, |
a4bcaf55 | 420 | s16 value) |
310bc676 LT |
421 | { |
422 | int ret = 0; | |
423 | might_sleep(); | |
0e8185ce | 424 | lockdep_assert_wiphy(local->hw.wiphy); |
310bc676 | 425 | |
4efc76bd | 426 | trace_drv_set_coverage_class(local, value); |
310bc676 LT |
427 | if (local->ops->set_coverage_class) |
428 | local->ops->set_coverage_class(&local->hw, value); | |
429 | else | |
430 | ret = -EOPNOTSUPP; | |
431 | ||
4efc76bd | 432 | trace_drv_return_int(local, ret); |
310bc676 LT |
433 | return ret; |
434 | } | |
435 | ||
24487981 | 436 | static inline void drv_sta_notify(struct ieee80211_local *local, |
12375ef9 | 437 | struct ieee80211_sub_if_data *sdata, |
24487981 JB |
438 | enum sta_notify_cmd cmd, |
439 | struct ieee80211_sta *sta) | |
440 | { | |
bc192f89 | 441 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
442 | if (!check_sdata_in_driver(sdata)) |
443 | return; | |
7b7eab6f | 444 | |
4efc76bd | 445 | trace_drv_sta_notify(local, sdata, cmd, sta); |
24487981 | 446 | if (local->ops->sta_notify) |
12375ef9 | 447 | local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); |
4efc76bd | 448 | trace_drv_return_void(local); |
24487981 JB |
449 | } |
450 | ||
34e89507 JB |
451 | static inline int drv_sta_add(struct ieee80211_local *local, |
452 | struct ieee80211_sub_if_data *sdata, | |
453 | struct ieee80211_sta *sta) | |
454 | { | |
455 | int ret = 0; | |
456 | ||
457 | might_sleep(); | |
0e8185ce | 458 | lockdep_assert_wiphy(local->hw.wiphy); |
34e89507 | 459 | |
bc192f89 | 460 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
461 | if (!check_sdata_in_driver(sdata)) |
462 | return -EIO; | |
7b7eab6f | 463 | |
4efc76bd | 464 | trace_drv_sta_add(local, sdata, sta); |
34e89507 JB |
465 | if (local->ops->sta_add) |
466 | ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); | |
34e89507 | 467 | |
4efc76bd | 468 | trace_drv_return_int(local, ret); |
34e89507 JB |
469 | |
470 | return ret; | |
471 | } | |
472 | ||
473 | static inline void drv_sta_remove(struct ieee80211_local *local, | |
474 | struct ieee80211_sub_if_data *sdata, | |
475 | struct ieee80211_sta *sta) | |
476 | { | |
477 | might_sleep(); | |
0e8185ce | 478 | lockdep_assert_wiphy(local->hw.wiphy); |
34e89507 | 479 | |
bc192f89 | 480 | sdata = get_bss_sdata(sdata); |
f6837ba8 JB |
481 | if (!check_sdata_in_driver(sdata)) |
482 | return; | |
7b7eab6f | 483 | |
4efc76bd | 484 | trace_drv_sta_remove(local, sdata, sta); |
34e89507 JB |
485 | if (local->ops->sta_remove) |
486 | local->ops->sta_remove(&local->hw, &sdata->vif, sta); | |
34e89507 | 487 | |
4efc76bd | 488 | trace_drv_return_void(local); |
34e89507 JB |
489 | } |
490 | ||
77d2ece6 | 491 | #ifdef CONFIG_MAC80211_DEBUGFS |
a1f5dcb1 MK |
492 | static inline void drv_vif_add_debugfs(struct ieee80211_local *local, |
493 | struct ieee80211_sub_if_data *sdata) | |
494 | { | |
495 | might_sleep(); | |
496 | ||
497 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR || | |
498 | WARN_ON(!sdata->vif.debugfs_dir)) | |
499 | return; | |
500 | ||
501 | sdata = get_bss_sdata(sdata); | |
502 | if (!check_sdata_in_driver(sdata)) | |
503 | return; | |
504 | ||
505 | if (local->ops->vif_add_debugfs) | |
506 | local->ops->vif_add_debugfs(&local->hw, &sdata->vif); | |
507 | } | |
508 | ||
170cd6a6 BB |
509 | static inline void drv_link_add_debugfs(struct ieee80211_local *local, |
510 | struct ieee80211_sub_if_data *sdata, | |
511 | struct ieee80211_bss_conf *link_conf, | |
512 | struct dentry *dir) | |
513 | { | |
514 | might_sleep(); | |
0e8185ce | 515 | lockdep_assert_wiphy(local->hw.wiphy); |
170cd6a6 BB |
516 | |
517 | sdata = get_bss_sdata(sdata); | |
518 | if (!check_sdata_in_driver(sdata)) | |
519 | return; | |
520 | ||
521 | if (local->ops->link_add_debugfs) | |
522 | local->ops->link_add_debugfs(&local->hw, &sdata->vif, | |
523 | link_conf, dir); | |
524 | } | |
525 | ||
77d2ece6 SM |
526 | static inline void drv_sta_add_debugfs(struct ieee80211_local *local, |
527 | struct ieee80211_sub_if_data *sdata, | |
528 | struct ieee80211_sta *sta, | |
529 | struct dentry *dir) | |
530 | { | |
531 | might_sleep(); | |
0e8185ce | 532 | lockdep_assert_wiphy(local->hw.wiphy); |
77d2ece6 SM |
533 | |
534 | sdata = get_bss_sdata(sdata); | |
f6837ba8 JB |
535 | if (!check_sdata_in_driver(sdata)) |
536 | return; | |
77d2ece6 SM |
537 | |
538 | if (local->ops->sta_add_debugfs) | |
539 | local->ops->sta_add_debugfs(&local->hw, &sdata->vif, | |
540 | sta, dir); | |
541 | } | |
d2caad52 BB |
542 | |
543 | static inline void drv_link_sta_add_debugfs(struct ieee80211_local *local, | |
544 | struct ieee80211_sub_if_data *sdata, | |
545 | struct ieee80211_link_sta *link_sta, | |
546 | struct dentry *dir) | |
547 | { | |
548 | might_sleep(); | |
0e8185ce | 549 | lockdep_assert_wiphy(local->hw.wiphy); |
d2caad52 BB |
550 | |
551 | sdata = get_bss_sdata(sdata); | |
552 | if (!check_sdata_in_driver(sdata)) | |
553 | return; | |
554 | ||
555 | if (local->ops->link_sta_add_debugfs) | |
556 | local->ops->link_sta_add_debugfs(&local->hw, &sdata->vif, | |
557 | link_sta, dir); | |
558 | } | |
a1f5dcb1 MK |
559 | #else |
560 | static inline void drv_vif_add_debugfs(struct ieee80211_local *local, | |
561 | struct ieee80211_sub_if_data *sdata) | |
562 | { | |
563 | might_sleep(); | |
564 | } | |
77d2ece6 SM |
565 | #endif |
566 | ||
6a9d1b91 JB |
567 | static inline void drv_sta_pre_rcu_remove(struct ieee80211_local *local, |
568 | struct ieee80211_sub_if_data *sdata, | |
569 | struct sta_info *sta) | |
570 | { | |
571 | might_sleep(); | |
0e8185ce | 572 | lockdep_assert_wiphy(local->hw.wiphy); |
6a9d1b91 JB |
573 | |
574 | sdata = get_bss_sdata(sdata); | |
f6837ba8 JB |
575 | if (!check_sdata_in_driver(sdata)) |
576 | return; | |
6a9d1b91 JB |
577 | |
578 | trace_drv_sta_pre_rcu_remove(local, sdata, &sta->sta); | |
579 | if (local->ops->sta_pre_rcu_remove) | |
580 | local->ops->sta_pre_rcu_remove(&local->hw, &sdata->vif, | |
581 | &sta->sta); | |
582 | trace_drv_return_void(local); | |
583 | } | |
584 | ||
727da60b | 585 | __must_check |
f09603a2 JB |
586 | int drv_sta_state(struct ieee80211_local *local, |
587 | struct ieee80211_sub_if_data *sdata, | |
588 | struct sta_info *sta, | |
589 | enum ieee80211_sta_state old_state, | |
727da60b | 590 | enum ieee80211_sta_state new_state); |
f09603a2 | 591 | |
ba905bf4 ARN |
592 | __must_check |
593 | int drv_sta_set_txpwr(struct ieee80211_local *local, | |
594 | struct ieee80211_sub_if_data *sdata, | |
595 | struct sta_info *sta); | |
596 | ||
88b67e91 JB |
597 | void drv_link_sta_rc_update(struct ieee80211_local *local, |
598 | struct ieee80211_sub_if_data *sdata, | |
599 | struct ieee80211_link_sta *link_sta, u32 changed); | |
8f727ef3 | 600 | |
f815e2b3 JB |
601 | static inline void drv_sta_rate_tbl_update(struct ieee80211_local *local, |
602 | struct ieee80211_sub_if_data *sdata, | |
603 | struct ieee80211_sta *sta) | |
604 | { | |
605 | sdata = get_bss_sdata(sdata); | |
606 | if (!check_sdata_in_driver(sdata)) | |
607 | return; | |
608 | ||
609 | trace_drv_sta_rate_tbl_update(local, sdata, sta); | |
610 | if (local->ops->sta_rate_tbl_update) | |
611 | local->ops->sta_rate_tbl_update(&local->hw, &sdata->vif, sta); | |
612 | ||
613 | trace_drv_return_void(local); | |
614 | } | |
615 | ||
2b9a7e1b JB |
616 | static inline void drv_sta_statistics(struct ieee80211_local *local, |
617 | struct ieee80211_sub_if_data *sdata, | |
618 | struct ieee80211_sta *sta, | |
619 | struct station_info *sinfo) | |
620 | { | |
5549b088 | 621 | might_sleep(); |
0e8185ce | 622 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 623 | |
2b9a7e1b JB |
624 | sdata = get_bss_sdata(sdata); |
625 | if (!check_sdata_in_driver(sdata)) | |
626 | return; | |
627 | ||
628 | trace_drv_sta_statistics(local, sdata, sta); | |
629 | if (local->ops->sta_statistics) | |
630 | local->ops->sta_statistics(&local->hw, &sdata->vif, sta, sinfo); | |
631 | trace_drv_return_void(local); | |
632 | } | |
633 | ||
b23dcd4a | 634 | int drv_conf_tx(struct ieee80211_local *local, |
b3e2130b | 635 | struct ieee80211_link_data *link, u16 ac, |
b23dcd4a | 636 | const struct ieee80211_tx_queue_params *params); |
24487981 | 637 | |
416eb9fc DV |
638 | u64 drv_get_tsf(struct ieee80211_local *local, |
639 | struct ieee80211_sub_if_data *sdata); | |
640 | void drv_set_tsf(struct ieee80211_local *local, | |
641 | struct ieee80211_sub_if_data *sdata, | |
642 | u64 tsf); | |
354d381b PT |
643 | void drv_offset_tsf(struct ieee80211_local *local, |
644 | struct ieee80211_sub_if_data *sdata, | |
645 | s64 offset); | |
416eb9fc DV |
646 | void drv_reset_tsf(struct ieee80211_local *local, |
647 | struct ieee80211_sub_if_data *sdata); | |
24487981 JB |
648 | |
649 | static inline int drv_tx_last_beacon(struct ieee80211_local *local) | |
650 | { | |
02582e9b | 651 | int ret = 0; /* default unsupported op for less congestion */ |
e1781ed3 KV |
652 | |
653 | might_sleep(); | |
0e8185ce | 654 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 655 | |
4efc76bd | 656 | trace_drv_tx_last_beacon(local); |
24487981 | 657 | if (local->ops->tx_last_beacon) |
0a2b8bb2 | 658 | ret = local->ops->tx_last_beacon(&local->hw); |
4efc76bd | 659 | trace_drv_return_int(local, ret); |
0a2b8bb2 | 660 | return ret; |
24487981 JB |
661 | } |
662 | ||
6db96838 DV |
663 | int drv_ampdu_action(struct ieee80211_local *local, |
664 | struct ieee80211_sub_if_data *sdata, | |
50ea05ef | 665 | struct ieee80211_ampdu_params *params); |
1f87f7d3 | 666 | |
1289723e HS |
667 | static inline int drv_get_survey(struct ieee80211_local *local, int idx, |
668 | struct survey_info *survey) | |
669 | { | |
670 | int ret = -EOPNOTSUPP; | |
c466d4ef | 671 | |
5549b088 | 672 | might_sleep(); |
0e8185ce | 673 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 674 | |
c466d4ef JL |
675 | trace_drv_get_survey(local, idx, survey); |
676 | ||
35dd0509 | 677 | if (local->ops->get_survey) |
1289723e | 678 | ret = local->ops->get_survey(&local->hw, idx, survey); |
c466d4ef JL |
679 | |
680 | trace_drv_return_int(local, ret); | |
681 | ||
1289723e HS |
682 | return ret; |
683 | } | |
1f87f7d3 JB |
684 | |
685 | static inline void drv_rfkill_poll(struct ieee80211_local *local) | |
686 | { | |
e1781ed3 | 687 | might_sleep(); |
0e8185ce | 688 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 689 | |
1f87f7d3 JB |
690 | if (local->ops->rfkill_poll) |
691 | local->ops->rfkill_poll(&local->hw); | |
692 | } | |
a80f7c0b | 693 | |
39ecc01d | 694 | static inline void drv_flush(struct ieee80211_local *local, |
77be2c54 | 695 | struct ieee80211_sub_if_data *sdata, |
39ecc01d | 696 | u32 queues, bool drop) |
a80f7c0b | 697 | { |
3e3a2b64 | 698 | struct ieee80211_vif *vif; |
77be2c54 | 699 | |
e1781ed3 | 700 | might_sleep(); |
0e8185ce | 701 | lockdep_assert_wiphy(local->hw.wiphy); |
e1781ed3 | 702 | |
3e3a2b64 OJ |
703 | sdata = get_bss_sdata(sdata); |
704 | vif = sdata ? &sdata->vif : NULL; | |
705 | ||
f6837ba8 JB |
706 | if (sdata && !check_sdata_in_driver(sdata)) |
707 | return; | |
77be2c54 | 708 | |
39ecc01d | 709 | trace_drv_flush(local, queues, drop); |
a80f7c0b | 710 | if (local->ops->flush) |
77be2c54 | 711 | local->ops->flush(&local->hw, vif, queues, drop); |
4efc76bd | 712 | trace_drv_return_void(local); |
a80f7c0b | 713 | } |
5ce6e438 | 714 | |
d00800a2 JB |
715 | static inline void drv_flush_sta(struct ieee80211_local *local, |
716 | struct ieee80211_sub_if_data *sdata, | |
717 | struct sta_info *sta) | |
718 | { | |
719 | might_sleep(); | |
0e8185ce | 720 | lockdep_assert_wiphy(local->hw.wiphy); |
d00800a2 | 721 | |
3e3a2b64 OJ |
722 | sdata = get_bss_sdata(sdata); |
723 | ||
d00800a2 JB |
724 | if (sdata && !check_sdata_in_driver(sdata)) |
725 | return; | |
726 | ||
aa3ce3f8 JB |
727 | if (!sta->uploaded) |
728 | return; | |
729 | ||
d00800a2 JB |
730 | trace_drv_flush_sta(local, sdata, &sta->sta); |
731 | if (local->ops->flush_sta) | |
732 | local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); | |
733 | trace_drv_return_void(local); | |
734 | } | |
735 | ||
5ce6e438 | 736 | static inline void drv_channel_switch(struct ieee80211_local *local, |
0f791eb4 LC |
737 | struct ieee80211_sub_if_data *sdata, |
738 | struct ieee80211_channel_switch *ch_switch) | |
5ce6e438 JB |
739 | { |
740 | might_sleep(); | |
0e8185ce | 741 | lockdep_assert_wiphy(local->hw.wiphy); |
5ce6e438 | 742 | |
0f791eb4 LC |
743 | trace_drv_channel_switch(local, sdata, ch_switch); |
744 | local->ops->channel_switch(&local->hw, &sdata->vif, ch_switch); | |
4efc76bd | 745 | trace_drv_return_void(local); |
5ce6e438 JB |
746 | } |
747 | ||
15d96753 BR |
748 | |
749 | static inline int drv_set_antenna(struct ieee80211_local *local, | |
750 | u32 tx_ant, u32 rx_ant) | |
751 | { | |
752 | int ret = -EOPNOTSUPP; | |
753 | might_sleep(); | |
0e8185ce | 754 | lockdep_assert_wiphy(local->hw.wiphy); |
15d96753 BR |
755 | if (local->ops->set_antenna) |
756 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); | |
757 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); | |
758 | return ret; | |
759 | } | |
760 | ||
761 | static inline int drv_get_antenna(struct ieee80211_local *local, | |
762 | u32 *tx_ant, u32 *rx_ant) | |
763 | { | |
764 | int ret = -EOPNOTSUPP; | |
765 | might_sleep(); | |
0e8185ce | 766 | lockdep_assert_wiphy(local->hw.wiphy); |
15d96753 BR |
767 | if (local->ops->get_antenna) |
768 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); | |
769 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); | |
770 | return ret; | |
771 | } | |
772 | ||
21f83589 | 773 | static inline int drv_remain_on_channel(struct ieee80211_local *local, |
49884568 | 774 | struct ieee80211_sub_if_data *sdata, |
21f83589 | 775 | struct ieee80211_channel *chan, |
d339d5ca IP |
776 | unsigned int duration, |
777 | enum ieee80211_roc_type type) | |
21f83589 JB |
778 | { |
779 | int ret; | |
780 | ||
781 | might_sleep(); | |
0e8185ce | 782 | lockdep_assert_wiphy(local->hw.wiphy); |
21f83589 | 783 | |
d339d5ca | 784 | trace_drv_remain_on_channel(local, sdata, chan, duration, type); |
49884568 | 785 | ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, |
d339d5ca | 786 | chan, duration, type); |
21f83589 JB |
787 | trace_drv_return_int(local, ret); |
788 | ||
789 | return ret; | |
790 | } | |
791 | ||
5db4c4b9 EG |
792 | static inline int |
793 | drv_cancel_remain_on_channel(struct ieee80211_local *local, | |
794 | struct ieee80211_sub_if_data *sdata) | |
21f83589 JB |
795 | { |
796 | int ret; | |
797 | ||
798 | might_sleep(); | |
0e8185ce | 799 | lockdep_assert_wiphy(local->hw.wiphy); |
21f83589 | 800 | |
5db4c4b9 EG |
801 | trace_drv_cancel_remain_on_channel(local, sdata); |
802 | ret = local->ops->cancel_remain_on_channel(&local->hw, &sdata->vif); | |
21f83589 | 803 | trace_drv_return_int(local, ret); |
5f16a436 JB |
804 | |
805 | return ret; | |
806 | } | |
807 | ||
38c09159 JL |
808 | static inline int drv_set_ringparam(struct ieee80211_local *local, |
809 | u32 tx, u32 rx) | |
810 | { | |
0528e0fd | 811 | int ret = -EOPNOTSUPP; |
38c09159 JL |
812 | |
813 | might_sleep(); | |
0e8185ce | 814 | lockdep_assert_wiphy(local->hw.wiphy); |
38c09159 JL |
815 | |
816 | trace_drv_set_ringparam(local, tx, rx); | |
817 | if (local->ops->set_ringparam) | |
818 | ret = local->ops->set_ringparam(&local->hw, tx, rx); | |
819 | trace_drv_return_int(local, ret); | |
820 | ||
821 | return ret; | |
822 | } | |
823 | ||
824 | static inline void drv_get_ringparam(struct ieee80211_local *local, | |
825 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) | |
826 | { | |
827 | might_sleep(); | |
0e8185ce | 828 | lockdep_assert_wiphy(local->hw.wiphy); |
38c09159 JL |
829 | |
830 | trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); | |
831 | if (local->ops->get_ringparam) | |
832 | local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); | |
833 | trace_drv_return_void(local); | |
834 | } | |
835 | ||
e8306f98 VN |
836 | static inline bool drv_tx_frames_pending(struct ieee80211_local *local) |
837 | { | |
838 | bool ret = false; | |
839 | ||
840 | might_sleep(); | |
0e8185ce | 841 | lockdep_assert_wiphy(local->hw.wiphy); |
e8306f98 VN |
842 | |
843 | trace_drv_tx_frames_pending(local); | |
844 | if (local->ops->tx_frames_pending) | |
845 | ret = local->ops->tx_frames_pending(&local->hw); | |
846 | trace_drv_return_bool(local, ret); | |
847 | ||
848 | return ret; | |
849 | } | |
bdbfd6b5 SM |
850 | |
851 | static inline int drv_set_bitrate_mask(struct ieee80211_local *local, | |
852 | struct ieee80211_sub_if_data *sdata, | |
853 | const struct cfg80211_bitrate_mask *mask) | |
854 | { | |
855 | int ret = -EOPNOTSUPP; | |
856 | ||
857 | might_sleep(); | |
0e8185ce | 858 | lockdep_assert_wiphy(local->hw.wiphy); |
bdbfd6b5 | 859 | |
f6837ba8 JB |
860 | if (!check_sdata_in_driver(sdata)) |
861 | return -EIO; | |
7b7eab6f | 862 | |
bdbfd6b5 SM |
863 | trace_drv_set_bitrate_mask(local, sdata, mask); |
864 | if (local->ops->set_bitrate_mask) | |
865 | ret = local->ops->set_bitrate_mask(&local->hw, | |
866 | &sdata->vif, mask); | |
867 | trace_drv_return_int(local, ret); | |
868 | ||
869 | return ret; | |
870 | } | |
871 | ||
c68f4b89 JB |
872 | static inline void drv_set_rekey_data(struct ieee80211_local *local, |
873 | struct ieee80211_sub_if_data *sdata, | |
874 | struct cfg80211_gtk_rekey_data *data) | |
875 | { | |
5549b088 | 876 | might_sleep(); |
0e8185ce | 877 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 878 | |
f6837ba8 JB |
879 | if (!check_sdata_in_driver(sdata)) |
880 | return; | |
7b7eab6f | 881 | |
c68f4b89 JB |
882 | trace_drv_set_rekey_data(local, sdata, data); |
883 | if (local->ops->set_rekey_data) | |
884 | local->ops->set_rekey_data(&local->hw, &sdata->vif, data); | |
885 | trace_drv_return_void(local); | |
886 | } | |
887 | ||
a8182929 EG |
888 | static inline void drv_event_callback(struct ieee80211_local *local, |
889 | struct ieee80211_sub_if_data *sdata, | |
890 | const struct ieee80211_event *event) | |
615f7b9b | 891 | { |
a8182929 EG |
892 | trace_drv_event_callback(local, sdata, event); |
893 | if (local->ops->event_callback) | |
894 | local->ops->event_callback(&local->hw, &sdata->vif, event); | |
615f7b9b MV |
895 | trace_drv_return_void(local); |
896 | } | |
4049e09a JB |
897 | |
898 | static inline void | |
899 | drv_release_buffered_frames(struct ieee80211_local *local, | |
900 | struct sta_info *sta, u16 tids, int num_frames, | |
901 | enum ieee80211_frame_release_type reason, | |
902 | bool more_data) | |
903 | { | |
904 | trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, | |
905 | reason, more_data); | |
906 | if (local->ops->release_buffered_frames) | |
907 | local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, | |
908 | num_frames, reason, | |
909 | more_data); | |
910 | trace_drv_return_void(local); | |
911 | } | |
40b96408 JB |
912 | |
913 | static inline void | |
914 | drv_allow_buffered_frames(struct ieee80211_local *local, | |
915 | struct sta_info *sta, u16 tids, int num_frames, | |
916 | enum ieee80211_frame_release_type reason, | |
917 | bool more_data) | |
918 | { | |
919 | trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, | |
920 | reason, more_data); | |
921 | if (local->ops->allow_buffered_frames) | |
922 | local->ops->allow_buffered_frames(&local->hw, &sta->sta, | |
923 | tids, num_frames, reason, | |
924 | more_data); | |
925 | trace_drv_return_void(local); | |
926 | } | |
66572cfc | 927 | |
a1845fc7 | 928 | static inline void drv_mgd_prepare_tx(struct ieee80211_local *local, |
d4e36e55 | 929 | struct ieee80211_sub_if_data *sdata, |
15fae341 | 930 | struct ieee80211_prep_tx_info *info) |
a1845fc7 JB |
931 | { |
932 | might_sleep(); | |
0e8185ce | 933 | lockdep_assert_wiphy(local->hw.wiphy); |
a1845fc7 | 934 | |
f6837ba8 JB |
935 | if (!check_sdata_in_driver(sdata)) |
936 | return; | |
a1845fc7 JB |
937 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); |
938 | ||
e76f3b4a | 939 | info->link_id = info->link_id < 0 ? 0 : info->link_id; |
15fae341 JB |
940 | trace_drv_mgd_prepare_tx(local, sdata, info->duration, |
941 | info->subtype, info->success); | |
a1845fc7 | 942 | if (local->ops->mgd_prepare_tx) |
15fae341 JB |
943 | local->ops->mgd_prepare_tx(&local->hw, &sdata->vif, info); |
944 | trace_drv_return_void(local); | |
945 | } | |
946 | ||
947 | static inline void drv_mgd_complete_tx(struct ieee80211_local *local, | |
948 | struct ieee80211_sub_if_data *sdata, | |
949 | struct ieee80211_prep_tx_info *info) | |
950 | { | |
951 | might_sleep(); | |
0e8185ce | 952 | lockdep_assert_wiphy(local->hw.wiphy); |
15fae341 JB |
953 | |
954 | if (!check_sdata_in_driver(sdata)) | |
955 | return; | |
956 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); | |
957 | ||
8c60179b | 958 | info->link_id = info->link_id < 0 ? 0 : info->link_id; |
15fae341 JB |
959 | trace_drv_mgd_complete_tx(local, sdata, info->duration, |
960 | info->subtype, info->success); | |
961 | if (local->ops->mgd_complete_tx) | |
962 | local->ops->mgd_complete_tx(&local->hw, &sdata->vif, info); | |
a1845fc7 JB |
963 | trace_drv_return_void(local); |
964 | } | |
c3645eac | 965 | |
ee10f2c7 AN |
966 | static inline void |
967 | drv_mgd_protect_tdls_discover(struct ieee80211_local *local, | |
271d14b3 MK |
968 | struct ieee80211_sub_if_data *sdata, |
969 | int link_id) | |
ee10f2c7 AN |
970 | { |
971 | might_sleep(); | |
0e8185ce | 972 | lockdep_assert_wiphy(local->hw.wiphy); |
ee10f2c7 AN |
973 | |
974 | if (!check_sdata_in_driver(sdata)) | |
975 | return; | |
976 | WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_STATION); | |
977 | ||
271d14b3 MK |
978 | link_id = link_id > 0 ? link_id : 0; |
979 | ||
ee10f2c7 AN |
980 | trace_drv_mgd_protect_tdls_discover(local, sdata); |
981 | if (local->ops->mgd_protect_tdls_discover) | |
271d14b3 MK |
982 | local->ops->mgd_protect_tdls_discover(&local->hw, &sdata->vif, |
983 | link_id); | |
ee10f2c7 AN |
984 | trace_drv_return_void(local); |
985 | } | |
986 | ||
c3645eac MK |
987 | static inline int drv_add_chanctx(struct ieee80211_local *local, |
988 | struct ieee80211_chanctx *ctx) | |
989 | { | |
990 | int ret = -EOPNOTSUPP; | |
991 | ||
dcae9e02 | 992 | might_sleep(); |
0e8185ce | 993 | lockdep_assert_wiphy(local->hw.wiphy); |
dcae9e02 | 994 | |
c3645eac MK |
995 | trace_drv_add_chanctx(local, ctx); |
996 | if (local->ops->add_chanctx) | |
997 | ret = local->ops->add_chanctx(&local->hw, &ctx->conf); | |
998 | trace_drv_return_int(local, ret); | |
8a61af65 JB |
999 | if (!ret) |
1000 | ctx->driver_present = true; | |
c3645eac MK |
1001 | |
1002 | return ret; | |
1003 | } | |
1004 | ||
1005 | static inline void drv_remove_chanctx(struct ieee80211_local *local, | |
1006 | struct ieee80211_chanctx *ctx) | |
1007 | { | |
dcae9e02 | 1008 | might_sleep(); |
0e8185ce | 1009 | lockdep_assert_wiphy(local->hw.wiphy); |
dcae9e02 | 1010 | |
f6837ba8 JB |
1011 | if (WARN_ON(!ctx->driver_present)) |
1012 | return; | |
1013 | ||
c3645eac MK |
1014 | trace_drv_remove_chanctx(local, ctx); |
1015 | if (local->ops->remove_chanctx) | |
1016 | local->ops->remove_chanctx(&local->hw, &ctx->conf); | |
1017 | trace_drv_return_void(local); | |
8a61af65 | 1018 | ctx->driver_present = false; |
c3645eac MK |
1019 | } |
1020 | ||
1021 | static inline void drv_change_chanctx(struct ieee80211_local *local, | |
1022 | struct ieee80211_chanctx *ctx, | |
1023 | u32 changed) | |
1024 | { | |
dcae9e02 | 1025 | might_sleep(); |
0e8185ce | 1026 | lockdep_assert_wiphy(local->hw.wiphy); |
dcae9e02 | 1027 | |
c3645eac | 1028 | trace_drv_change_chanctx(local, ctx, changed); |
8a61af65 JB |
1029 | if (local->ops->change_chanctx) { |
1030 | WARN_ON_ONCE(!ctx->driver_present); | |
c3645eac | 1031 | local->ops->change_chanctx(&local->hw, &ctx->conf, changed); |
8a61af65 | 1032 | } |
c3645eac MK |
1033 | trace_drv_return_void(local); |
1034 | } | |
1035 | ||
efe9c2bf JB |
1036 | int drv_assign_vif_chanctx(struct ieee80211_local *local, |
1037 | struct ieee80211_sub_if_data *sdata, | |
1038 | struct ieee80211_bss_conf *link_conf, | |
1039 | struct ieee80211_chanctx *ctx); | |
1040 | void drv_unassign_vif_chanctx(struct ieee80211_local *local, | |
1041 | struct ieee80211_sub_if_data *sdata, | |
1042 | struct ieee80211_bss_conf *link_conf, | |
1043 | struct ieee80211_chanctx *ctx); | |
42677ed3 DV |
1044 | int drv_switch_vif_chanctx(struct ieee80211_local *local, |
1045 | struct ieee80211_vif_chanctx_switch *vifs, | |
1046 | int n_vifs, enum ieee80211_chanctx_switch_mode mode); | |
1a5f0c13 | 1047 | |
1041638f | 1048 | static inline int drv_start_ap(struct ieee80211_local *local, |
ae7ba17b | 1049 | struct ieee80211_sub_if_data *sdata, |
b327c84c | 1050 | struct ieee80211_bss_conf *link_conf) |
1041638f JB |
1051 | { |
1052 | int ret = 0; | |
1053 | ||
dcae9e02 | 1054 | might_sleep(); |
0e8185ce | 1055 | lockdep_assert_wiphy(local->hw.wiphy); |
dcae9e02 | 1056 | |
f6837ba8 JB |
1057 | if (!check_sdata_in_driver(sdata)) |
1058 | return -EIO; | |
1041638f | 1059 | |
b327c84c | 1060 | trace_drv_start_ap(local, sdata, link_conf); |
1041638f | 1061 | if (local->ops->start_ap) |
b327c84c | 1062 | ret = local->ops->start_ap(&local->hw, &sdata->vif, link_conf); |
1041638f JB |
1063 | trace_drv_return_int(local, ret); |
1064 | return ret; | |
1065 | } | |
1066 | ||
1067 | static inline void drv_stop_ap(struct ieee80211_local *local, | |
ae7ba17b | 1068 | struct ieee80211_sub_if_data *sdata, |
b327c84c | 1069 | struct ieee80211_bss_conf *link_conf) |
1041638f | 1070 | { |
5549b088 | 1071 | might_sleep(); |
0e8185ce | 1072 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1073 | |
f6837ba8 JB |
1074 | if (!check_sdata_in_driver(sdata)) |
1075 | return; | |
1041638f | 1076 | |
b327c84c | 1077 | trace_drv_stop_ap(local, sdata, link_conf); |
1041638f | 1078 | if (local->ops->stop_ap) |
b327c84c | 1079 | local->ops->stop_ap(&local->hw, &sdata->vif, link_conf); |
1041638f JB |
1080 | trace_drv_return_void(local); |
1081 | } | |
1082 | ||
cf2c92d8 EP |
1083 | static inline void |
1084 | drv_reconfig_complete(struct ieee80211_local *local, | |
1085 | enum ieee80211_reconfig_type reconfig_type) | |
9214ad7f JB |
1086 | { |
1087 | might_sleep(); | |
0e8185ce | 1088 | lockdep_assert_wiphy(local->hw.wiphy); |
9214ad7f | 1089 | |
cf2c92d8 EP |
1090 | trace_drv_reconfig_complete(local, reconfig_type); |
1091 | if (local->ops->reconfig_complete) | |
1092 | local->ops->reconfig_complete(&local->hw, reconfig_type); | |
9214ad7f JB |
1093 | trace_drv_return_void(local); |
1094 | } | |
1095 | ||
de5fad81 YD |
1096 | static inline void |
1097 | drv_set_default_unicast_key(struct ieee80211_local *local, | |
1098 | struct ieee80211_sub_if_data *sdata, | |
1099 | int key_idx) | |
1100 | { | |
5549b088 | 1101 | might_sleep(); |
0e8185ce | 1102 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1103 | |
f6837ba8 JB |
1104 | if (!check_sdata_in_driver(sdata)) |
1105 | return; | |
de5fad81 YD |
1106 | |
1107 | WARN_ON_ONCE(key_idx < -1 || key_idx > 3); | |
1108 | ||
1109 | trace_drv_set_default_unicast_key(local, sdata, key_idx); | |
1110 | if (local->ops->set_default_unicast_key) | |
1111 | local->ops->set_default_unicast_key(&local->hw, &sdata->vif, | |
1112 | key_idx); | |
1113 | trace_drv_return_void(local); | |
1114 | } | |
1115 | ||
a65240c1 JB |
1116 | #if IS_ENABLED(CONFIG_IPV6) |
1117 | static inline void drv_ipv6_addr_change(struct ieee80211_local *local, | |
1118 | struct ieee80211_sub_if_data *sdata, | |
1119 | struct inet6_dev *idev) | |
1120 | { | |
1121 | trace_drv_ipv6_addr_change(local, sdata); | |
1122 | if (local->ops->ipv6_addr_change) | |
1123 | local->ops->ipv6_addr_change(&local->hw, &sdata->vif, idev); | |
1124 | trace_drv_return_void(local); | |
1125 | } | |
1126 | #endif | |
1127 | ||
73da7d5b SW |
1128 | static inline void |
1129 | drv_channel_switch_beacon(struct ieee80211_sub_if_data *sdata, | |
1130 | struct cfg80211_chan_def *chandef) | |
1131 | { | |
1132 | struct ieee80211_local *local = sdata->local; | |
1133 | ||
5549b088 | 1134 | might_sleep(); |
0e8185ce | 1135 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1136 | |
73da7d5b SW |
1137 | if (local->ops->channel_switch_beacon) { |
1138 | trace_drv_channel_switch_beacon(local, sdata, chandef); | |
1139 | local->ops->channel_switch_beacon(&local->hw, &sdata->vif, | |
1140 | chandef); | |
1141 | } | |
1142 | } | |
1143 | ||
6d027bcc LC |
1144 | static inline int |
1145 | drv_pre_channel_switch(struct ieee80211_sub_if_data *sdata, | |
1146 | struct ieee80211_channel_switch *ch_switch) | |
1147 | { | |
1148 | struct ieee80211_local *local = sdata->local; | |
1149 | int ret = 0; | |
1150 | ||
5549b088 | 1151 | might_sleep(); |
0e8185ce | 1152 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1153 | |
6d027bcc LC |
1154 | if (!check_sdata_in_driver(sdata)) |
1155 | return -EIO; | |
1156 | ||
7ef8f682 JB |
1157 | if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id)) |
1158 | return 0; | |
1159 | ||
6d027bcc LC |
1160 | trace_drv_pre_channel_switch(local, sdata, ch_switch); |
1161 | if (local->ops->pre_channel_switch) | |
1162 | ret = local->ops->pre_channel_switch(&local->hw, &sdata->vif, | |
1163 | ch_switch); | |
1164 | trace_drv_return_int(local, ret); | |
1165 | return ret; | |
1166 | } | |
1167 | ||
f1d65583 | 1168 | static inline int |
a469a593 | 1169 | drv_post_channel_switch(struct ieee80211_link_data *link) |
f1d65583 | 1170 | { |
a469a593 | 1171 | struct ieee80211_sub_if_data *sdata = link->sdata; |
f1d65583 LC |
1172 | struct ieee80211_local *local = sdata->local; |
1173 | int ret = 0; | |
1174 | ||
5549b088 | 1175 | might_sleep(); |
0e8185ce | 1176 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1177 | |
f1d65583 LC |
1178 | if (!check_sdata_in_driver(sdata)) |
1179 | return -EIO; | |
1180 | ||
7ef8f682 JB |
1181 | if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) |
1182 | return 0; | |
1183 | ||
f1d65583 LC |
1184 | trace_drv_post_channel_switch(local, sdata); |
1185 | if (local->ops->post_channel_switch) | |
a469a593 EG |
1186 | ret = local->ops->post_channel_switch(&local->hw, &sdata->vif, |
1187 | link->conf); | |
f1d65583 LC |
1188 | trace_drv_return_int(local, ret); |
1189 | return ret; | |
1190 | } | |
1191 | ||
b9cc81d8 | 1192 | static inline void |
5ecd5d82 | 1193 | drv_abort_channel_switch(struct ieee80211_link_data *link) |
b9cc81d8 | 1194 | { |
5ecd5d82 | 1195 | struct ieee80211_sub_if_data *sdata = link->sdata; |
b9cc81d8 SS |
1196 | struct ieee80211_local *local = sdata->local; |
1197 | ||
5549b088 | 1198 | might_sleep(); |
0e8185ce | 1199 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1200 | |
b9cc81d8 SS |
1201 | if (!check_sdata_in_driver(sdata)) |
1202 | return; | |
1203 | ||
7ef8f682 JB |
1204 | if (!ieee80211_vif_link_active(&sdata->vif, link->link_id)) |
1205 | return; | |
1206 | ||
b9cc81d8 SS |
1207 | trace_drv_abort_channel_switch(local, sdata); |
1208 | ||
1209 | if (local->ops->abort_channel_switch) | |
5ecd5d82 JB |
1210 | local->ops->abort_channel_switch(&local->hw, &sdata->vif, |
1211 | link->conf); | |
b9cc81d8 SS |
1212 | } |
1213 | ||
fafd2bce SS |
1214 | static inline void |
1215 | drv_channel_switch_rx_beacon(struct ieee80211_sub_if_data *sdata, | |
1216 | struct ieee80211_channel_switch *ch_switch) | |
1217 | { | |
1218 | struct ieee80211_local *local = sdata->local; | |
1219 | ||
5549b088 | 1220 | might_sleep(); |
0e8185ce | 1221 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1222 | |
fafd2bce SS |
1223 | if (!check_sdata_in_driver(sdata)) |
1224 | return; | |
1225 | ||
7ef8f682 JB |
1226 | if (!ieee80211_vif_link_active(&sdata->vif, ch_switch->link_id)) |
1227 | return; | |
1228 | ||
fafd2bce SS |
1229 | trace_drv_channel_switch_rx_beacon(local, sdata, ch_switch); |
1230 | if (local->ops->channel_switch_rx_beacon) | |
1231 | local->ops->channel_switch_rx_beacon(&local->hw, &sdata->vif, | |
1232 | ch_switch); | |
1233 | } | |
1234 | ||
55fff501 JB |
1235 | static inline int drv_join_ibss(struct ieee80211_local *local, |
1236 | struct ieee80211_sub_if_data *sdata) | |
1237 | { | |
1238 | int ret = 0; | |
1239 | ||
1240 | might_sleep(); | |
0e8185ce | 1241 | lockdep_assert_wiphy(local->hw.wiphy); |
f6837ba8 JB |
1242 | if (!check_sdata_in_driver(sdata)) |
1243 | return -EIO; | |
55fff501 JB |
1244 | |
1245 | trace_drv_join_ibss(local, sdata, &sdata->vif.bss_conf); | |
1246 | if (local->ops->join_ibss) | |
1247 | ret = local->ops->join_ibss(&local->hw, &sdata->vif); | |
1248 | trace_drv_return_int(local, ret); | |
1249 | return ret; | |
1250 | } | |
1251 | ||
1252 | static inline void drv_leave_ibss(struct ieee80211_local *local, | |
1253 | struct ieee80211_sub_if_data *sdata) | |
1254 | { | |
1255 | might_sleep(); | |
0e8185ce | 1256 | lockdep_assert_wiphy(local->hw.wiphy); |
f6837ba8 JB |
1257 | if (!check_sdata_in_driver(sdata)) |
1258 | return; | |
55fff501 JB |
1259 | |
1260 | trace_drv_leave_ibss(local, sdata); | |
1261 | if (local->ops->leave_ibss) | |
1262 | local->ops->leave_ibss(&local->hw, &sdata->vif); | |
1263 | trace_drv_return_void(local); | |
1264 | } | |
1265 | ||
cca674d4 | 1266 | static inline u32 drv_get_expected_throughput(struct ieee80211_local *local, |
4fdbc67a | 1267 | struct sta_info *sta) |
cca674d4 AQ |
1268 | { |
1269 | u32 ret = 0; | |
1270 | ||
4fdbc67a MA |
1271 | trace_drv_get_expected_throughput(&sta->sta); |
1272 | if (local->ops->get_expected_throughput && sta->uploaded) | |
1273 | ret = local->ops->get_expected_throughput(&local->hw, &sta->sta); | |
cca674d4 AQ |
1274 | trace_drv_return_u32(local, ret); |
1275 | ||
1276 | return ret; | |
1277 | } | |
1278 | ||
5b3dc42b | 1279 | static inline int drv_get_txpower(struct ieee80211_local *local, |
24dab555 RS |
1280 | struct ieee80211_sub_if_data *sdata, |
1281 | unsigned int link_id, int *dbm) | |
5b3dc42b FF |
1282 | { |
1283 | int ret; | |
1284 | ||
5549b088 | 1285 | might_sleep(); |
0e8185ce | 1286 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 | 1287 | |
5b3dc42b FF |
1288 | if (!local->ops->get_txpower) |
1289 | return -EOPNOTSUPP; | |
1290 | ||
24dab555 RS |
1291 | ret = local->ops->get_txpower(&local->hw, &sdata->vif, link_id, dbm); |
1292 | trace_drv_get_txpower(local, sdata, link_id, *dbm, ret); | |
5b3dc42b FF |
1293 | |
1294 | return ret; | |
1295 | } | |
1296 | ||
a7a6bdd0 AN |
1297 | static inline int |
1298 | drv_tdls_channel_switch(struct ieee80211_local *local, | |
1299 | struct ieee80211_sub_if_data *sdata, | |
1300 | struct ieee80211_sta *sta, u8 oper_class, | |
1301 | struct cfg80211_chan_def *chandef, | |
1302 | struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie) | |
1303 | { | |
1304 | int ret; | |
1305 | ||
1306 | might_sleep(); | |
0e8185ce | 1307 | lockdep_assert_wiphy(local->hw.wiphy); |
a7a6bdd0 AN |
1308 | if (!check_sdata_in_driver(sdata)) |
1309 | return -EIO; | |
1310 | ||
1311 | if (!local->ops->tdls_channel_switch) | |
1312 | return -EOPNOTSUPP; | |
1313 | ||
1314 | trace_drv_tdls_channel_switch(local, sdata, sta, oper_class, chandef); | |
1315 | ret = local->ops->tdls_channel_switch(&local->hw, &sdata->vif, sta, | |
1316 | oper_class, chandef, tmpl_skb, | |
1317 | ch_sw_tm_ie); | |
1318 | trace_drv_return_int(local, ret); | |
1319 | return ret; | |
1320 | } | |
1321 | ||
1322 | static inline void | |
1323 | drv_tdls_cancel_channel_switch(struct ieee80211_local *local, | |
1324 | struct ieee80211_sub_if_data *sdata, | |
1325 | struct ieee80211_sta *sta) | |
1326 | { | |
1327 | might_sleep(); | |
0e8185ce | 1328 | lockdep_assert_wiphy(local->hw.wiphy); |
a7a6bdd0 AN |
1329 | if (!check_sdata_in_driver(sdata)) |
1330 | return; | |
1331 | ||
1332 | if (!local->ops->tdls_cancel_channel_switch) | |
1333 | return; | |
1334 | ||
1335 | trace_drv_tdls_cancel_channel_switch(local, sdata, sta); | |
1336 | local->ops->tdls_cancel_channel_switch(&local->hw, &sdata->vif, sta); | |
1337 | trace_drv_return_void(local); | |
1338 | } | |
1339 | ||
8a4d32f3 AN |
1340 | static inline void |
1341 | drv_tdls_recv_channel_switch(struct ieee80211_local *local, | |
1342 | struct ieee80211_sub_if_data *sdata, | |
1343 | struct ieee80211_tdls_ch_sw_params *params) | |
1344 | { | |
1345 | trace_drv_tdls_recv_channel_switch(local, sdata, params); | |
1346 | if (local->ops->tdls_recv_channel_switch) | |
1347 | local->ops->tdls_recv_channel_switch(&local->hw, &sdata->vif, | |
1348 | params); | |
1349 | trace_drv_return_void(local); | |
1350 | } | |
1351 | ||
e7881bd5 JB |
1352 | static inline void drv_wake_tx_queue(struct ieee80211_local *local, |
1353 | struct txq_info *txq) | |
ba8c3d6f | 1354 | { |
e7881bd5 JB |
1355 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(txq->txq.vif); |
1356 | ||
db7205af JB |
1357 | /* In reconfig don't transmit now, but mark for waking later */ |
1358 | if (local->in_reconfig) { | |
4444bc21 | 1359 | set_bit(IEEE80211_TXQ_DIRTY, &txq->flags); |
4856bfd2 | 1360 | return; |
db7205af | 1361 | } |
4856bfd2 | 1362 | |
e7881bd5 JB |
1363 | if (!check_sdata_in_driver(sdata)) |
1364 | return; | |
1365 | ||
1366 | trace_drv_wake_tx_queue(local, sdata, txq); | |
1367 | local->ops->wake_tx_queue(&local->hw, &txq->txq); | |
ba8c3d6f FF |
1368 | } |
1369 | ||
18667600 THJ |
1370 | static inline void schedule_and_wake_txq(struct ieee80211_local *local, |
1371 | struct txq_info *txqi) | |
1372 | { | |
390298e8 | 1373 | ieee80211_schedule_txq(&local->hw, &txqi->txq); |
18667600 THJ |
1374 | drv_wake_tx_queue(local, txqi); |
1375 | } | |
1376 | ||
9739fe29 SS |
1377 | static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local, |
1378 | struct sk_buff *head, | |
1379 | struct sk_buff *skb) | |
1380 | { | |
1381 | if (!local->ops->can_aggregate_in_amsdu) | |
1382 | return true; | |
1383 | ||
1384 | return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb); | |
1385 | } | |
1386 | ||
bc847970 PKC |
1387 | static inline int |
1388 | drv_get_ftm_responder_stats(struct ieee80211_local *local, | |
1389 | struct ieee80211_sub_if_data *sdata, | |
1390 | struct cfg80211_ftm_responder_stats *ftm_stats) | |
1391 | { | |
1392 | u32 ret = -EOPNOTSUPP; | |
1393 | ||
5549b088 | 1394 | might_sleep(); |
0e8185ce | 1395 | lockdep_assert_wiphy(local->hw.wiphy); |
5549b088 JB |
1396 | if (!check_sdata_in_driver(sdata)) |
1397 | return -EIO; | |
1398 | ||
bc847970 PKC |
1399 | if (local->ops->get_ftm_responder_stats) |
1400 | ret = local->ops->get_ftm_responder_stats(&local->hw, | |
1401 | &sdata->vif, | |
1402 | ftm_stats); | |
1403 | trace_drv_get_ftm_responder_stats(local, sdata, ftm_stats); | |
1404 | ||
1405 | return ret; | |
1406 | } | |
1407 | ||
cee7013b JB |
1408 | static inline int drv_start_pmsr(struct ieee80211_local *local, |
1409 | struct ieee80211_sub_if_data *sdata, | |
1410 | struct cfg80211_pmsr_request *request) | |
1411 | { | |
1412 | int ret = -EOPNOTSUPP; | |
1413 | ||
1414 | might_sleep(); | |
0e8185ce | 1415 | lockdep_assert_wiphy(local->hw.wiphy); |
cee7013b JB |
1416 | if (!check_sdata_in_driver(sdata)) |
1417 | return -EIO; | |
1418 | ||
1419 | trace_drv_start_pmsr(local, sdata); | |
1420 | ||
1421 | if (local->ops->start_pmsr) | |
1422 | ret = local->ops->start_pmsr(&local->hw, &sdata->vif, request); | |
1423 | trace_drv_return_int(local, ret); | |
1424 | ||
1425 | return ret; | |
1426 | } | |
1427 | ||
1428 | static inline void drv_abort_pmsr(struct ieee80211_local *local, | |
1429 | struct ieee80211_sub_if_data *sdata, | |
1430 | struct cfg80211_pmsr_request *request) | |
1431 | { | |
1432 | trace_drv_abort_pmsr(local, sdata); | |
1433 | ||
1434 | might_sleep(); | |
0e8185ce | 1435 | lockdep_assert_wiphy(local->hw.wiphy); |
cee7013b JB |
1436 | if (!check_sdata_in_driver(sdata)) |
1437 | return; | |
1438 | ||
1439 | if (local->ops->abort_pmsr) | |
1440 | local->ops->abort_pmsr(&local->hw, &sdata->vif, request); | |
1441 | trace_drv_return_void(local); | |
1442 | } | |
1443 | ||
708d50ed AB |
1444 | static inline int drv_start_nan(struct ieee80211_local *local, |
1445 | struct ieee80211_sub_if_data *sdata, | |
1446 | struct cfg80211_nan_conf *conf) | |
1447 | { | |
1448 | int ret; | |
1449 | ||
1450 | might_sleep(); | |
0e8185ce | 1451 | lockdep_assert_wiphy(local->hw.wiphy); |
708d50ed AB |
1452 | check_sdata_in_driver(sdata); |
1453 | ||
1454 | trace_drv_start_nan(local, sdata, conf); | |
1455 | ret = local->ops->start_nan(&local->hw, &sdata->vif, conf); | |
1456 | trace_drv_return_int(local, ret); | |
1457 | return ret; | |
1458 | } | |
1459 | ||
1460 | static inline void drv_stop_nan(struct ieee80211_local *local, | |
1461 | struct ieee80211_sub_if_data *sdata) | |
1462 | { | |
1463 | might_sleep(); | |
0e8185ce | 1464 | lockdep_assert_wiphy(local->hw.wiphy); |
708d50ed AB |
1465 | check_sdata_in_driver(sdata); |
1466 | ||
1467 | trace_drv_stop_nan(local, sdata); | |
1468 | local->ops->stop_nan(&local->hw, &sdata->vif); | |
1469 | trace_drv_return_void(local); | |
1470 | } | |
1471 | ||
5953ff6d AB |
1472 | static inline int drv_nan_change_conf(struct ieee80211_local *local, |
1473 | struct ieee80211_sub_if_data *sdata, | |
1474 | struct cfg80211_nan_conf *conf, | |
1475 | u32 changes) | |
1476 | { | |
1477 | int ret; | |
1478 | ||
1479 | might_sleep(); | |
0e8185ce | 1480 | lockdep_assert_wiphy(local->hw.wiphy); |
5953ff6d AB |
1481 | check_sdata_in_driver(sdata); |
1482 | ||
1483 | if (!local->ops->nan_change_conf) | |
1484 | return -EOPNOTSUPP; | |
1485 | ||
1486 | trace_drv_nan_change_conf(local, sdata, conf, changes); | |
1487 | ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf, | |
1488 | changes); | |
1489 | trace_drv_return_int(local, ret); | |
1490 | ||
1491 | return ret; | |
1492 | } | |
1493 | ||
167e33f4 AB |
1494 | static inline int drv_add_nan_func(struct ieee80211_local *local, |
1495 | struct ieee80211_sub_if_data *sdata, | |
1496 | const struct cfg80211_nan_func *nan_func) | |
1497 | { | |
1498 | int ret; | |
1499 | ||
1500 | might_sleep(); | |
0e8185ce | 1501 | lockdep_assert_wiphy(local->hw.wiphy); |
167e33f4 AB |
1502 | check_sdata_in_driver(sdata); |
1503 | ||
1504 | if (!local->ops->add_nan_func) | |
1505 | return -EOPNOTSUPP; | |
1506 | ||
1507 | trace_drv_add_nan_func(local, sdata, nan_func); | |
1508 | ret = local->ops->add_nan_func(&local->hw, &sdata->vif, nan_func); | |
1509 | trace_drv_return_int(local, ret); | |
1510 | ||
1511 | return ret; | |
1512 | } | |
1513 | ||
1514 | static inline void drv_del_nan_func(struct ieee80211_local *local, | |
1515 | struct ieee80211_sub_if_data *sdata, | |
1516 | u8 instance_id) | |
1517 | { | |
1518 | might_sleep(); | |
0e8185ce | 1519 | lockdep_assert_wiphy(local->hw.wiphy); |
167e33f4 AB |
1520 | check_sdata_in_driver(sdata); |
1521 | ||
1522 | trace_drv_del_nan_func(local, sdata, instance_id); | |
1523 | if (local->ops->del_nan_func) | |
1524 | local->ops->del_nan_func(&local->hw, &sdata->vif, instance_id); | |
1525 | trace_drv_return_void(local); | |
1526 | } | |
1527 | ||
370f51d5 T |
1528 | static inline int drv_set_tid_config(struct ieee80211_local *local, |
1529 | struct ieee80211_sub_if_data *sdata, | |
1530 | struct ieee80211_sta *sta, | |
1531 | struct cfg80211_tid_config *tid_conf) | |
1532 | { | |
1533 | int ret; | |
1534 | ||
1535 | might_sleep(); | |
0e8185ce | 1536 | lockdep_assert_wiphy(local->hw.wiphy); |
370f51d5 T |
1537 | ret = local->ops->set_tid_config(&local->hw, &sdata->vif, sta, |
1538 | tid_conf); | |
1539 | trace_drv_return_int(local, ret); | |
1540 | ||
1541 | return ret; | |
1542 | } | |
1543 | ||
1544 | static inline int drv_reset_tid_config(struct ieee80211_local *local, | |
1545 | struct ieee80211_sub_if_data *sdata, | |
60c2ef0e | 1546 | struct ieee80211_sta *sta, u8 tids) |
370f51d5 T |
1547 | { |
1548 | int ret; | |
1549 | ||
1550 | might_sleep(); | |
0e8185ce | 1551 | lockdep_assert_wiphy(local->hw.wiphy); |
60c2ef0e | 1552 | ret = local->ops->reset_tid_config(&local->hw, &sdata->vif, sta, tids); |
370f51d5 T |
1553 | trace_drv_return_int(local, ret); |
1554 | ||
1555 | return ret; | |
1556 | } | |
6aea26ce FF |
1557 | |
1558 | static inline void drv_update_vif_offload(struct ieee80211_local *local, | |
1559 | struct ieee80211_sub_if_data *sdata) | |
1560 | { | |
1561 | might_sleep(); | |
0e8185ce | 1562 | lockdep_assert_wiphy(local->hw.wiphy); |
6aea26ce FF |
1563 | check_sdata_in_driver(sdata); |
1564 | ||
1565 | if (!local->ops->update_vif_offload) | |
1566 | return; | |
1567 | ||
1568 | trace_drv_update_vif_offload(local, sdata); | |
1569 | local->ops->update_vif_offload(&local->hw, &sdata->vif); | |
1570 | trace_drv_return_void(local); | |
1571 | } | |
1572 | ||
1ff4e8f2 FF |
1573 | static inline void drv_sta_set_4addr(struct ieee80211_local *local, |
1574 | struct ieee80211_sub_if_data *sdata, | |
1575 | struct ieee80211_sta *sta, bool enabled) | |
1576 | { | |
1577 | sdata = get_bss_sdata(sdata); | |
5549b088 JB |
1578 | |
1579 | might_sleep(); | |
0e8185ce | 1580 | lockdep_assert_wiphy(local->hw.wiphy); |
1ff4e8f2 FF |
1581 | if (!check_sdata_in_driver(sdata)) |
1582 | return; | |
1583 | ||
1584 | trace_drv_sta_set_4addr(local, sdata, sta, enabled); | |
1585 | if (local->ops->sta_set_4addr) | |
1586 | local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled); | |
1587 | trace_drv_return_void(local); | |
1588 | } | |
1589 | ||
80a915ec FF |
1590 | static inline void drv_sta_set_decap_offload(struct ieee80211_local *local, |
1591 | struct ieee80211_sub_if_data *sdata, | |
1592 | struct ieee80211_sta *sta, | |
1593 | bool enabled) | |
1594 | { | |
1595 | sdata = get_bss_sdata(sdata); | |
5549b088 JB |
1596 | |
1597 | might_sleep(); | |
0e8185ce | 1598 | lockdep_assert_wiphy(local->hw.wiphy); |
80a915ec FF |
1599 | if (!check_sdata_in_driver(sdata)) |
1600 | return; | |
1601 | ||
1602 | trace_drv_sta_set_decap_offload(local, sdata, sta, enabled); | |
1603 | if (local->ops->sta_set_decap_offload) | |
1604 | local->ops->sta_set_decap_offload(&local->hw, &sdata->vif, sta, | |
1605 | enabled); | |
1606 | trace_drv_return_void(local); | |
1607 | } | |
1608 | ||
f5a4c24e LB |
1609 | static inline void drv_add_twt_setup(struct ieee80211_local *local, |
1610 | struct ieee80211_sub_if_data *sdata, | |
1611 | struct ieee80211_sta *sta, | |
1612 | struct ieee80211_twt_setup *twt) | |
1613 | { | |
1614 | struct ieee80211_twt_params *twt_agrt; | |
1615 | ||
1616 | might_sleep(); | |
0e8185ce | 1617 | lockdep_assert_wiphy(local->hw.wiphy); |
f5a4c24e LB |
1618 | |
1619 | if (!check_sdata_in_driver(sdata)) | |
1620 | return; | |
1621 | ||
1622 | twt_agrt = (void *)twt->params; | |
1623 | ||
1624 | trace_drv_add_twt_setup(local, sta, twt, twt_agrt); | |
1625 | local->ops->add_twt_setup(&local->hw, sta, twt); | |
1626 | trace_drv_return_void(local); | |
1627 | } | |
1628 | ||
1629 | static inline void drv_twt_teardown_request(struct ieee80211_local *local, | |
1630 | struct ieee80211_sub_if_data *sdata, | |
1631 | struct ieee80211_sta *sta, | |
1632 | u8 flowid) | |
1633 | { | |
1634 | might_sleep(); | |
0e8185ce | 1635 | lockdep_assert_wiphy(local->hw.wiphy); |
f5a4c24e LB |
1636 | if (!check_sdata_in_driver(sdata)) |
1637 | return; | |
1638 | ||
1639 | if (!local->ops->twt_teardown_request) | |
1640 | return; | |
1641 | ||
1642 | trace_drv_twt_teardown_request(local, sta, flowid); | |
1643 | local->ops->twt_teardown_request(&local->hw, sta, flowid); | |
1644 | trace_drv_return_void(local); | |
1645 | } | |
1646 | ||
d787a3e3 FF |
1647 | static inline int drv_net_fill_forward_path(struct ieee80211_local *local, |
1648 | struct ieee80211_sub_if_data *sdata, | |
1649 | struct ieee80211_sta *sta, | |
1650 | struct net_device_path_ctx *ctx, | |
1651 | struct net_device_path *path) | |
1652 | { | |
1653 | int ret = -EOPNOTSUPP; | |
1654 | ||
1655 | sdata = get_bss_sdata(sdata); | |
1656 | if (!check_sdata_in_driver(sdata)) | |
1657 | return -EIO; | |
1658 | ||
1659 | trace_drv_net_fill_forward_path(local, sdata, sta); | |
1660 | if (local->ops->net_fill_forward_path) | |
1661 | ret = local->ops->net_fill_forward_path(&local->hw, | |
1662 | &sdata->vif, sta, | |
1663 | ctx, path); | |
1664 | trace_drv_return_int(local, ret); | |
1665 | ||
1666 | return ret; | |
1667 | } | |
1668 | ||
61587f15 FF |
1669 | static inline int drv_net_setup_tc(struct ieee80211_local *local, |
1670 | struct ieee80211_sub_if_data *sdata, | |
1671 | struct net_device *dev, | |
1672 | enum tc_setup_type type, void *type_data) | |
1673 | { | |
1674 | int ret = -EOPNOTSUPP; | |
1675 | ||
5549b088 JB |
1676 | might_sleep(); |
1677 | ||
61587f15 FF |
1678 | sdata = get_bss_sdata(sdata); |
1679 | trace_drv_net_setup_tc(local, sdata, type); | |
1680 | if (local->ops->net_setup_tc) | |
1681 | ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev, | |
1682 | type, type_data); | |
1683 | trace_drv_return_int(local, ret); | |
1684 | ||
1685 | return ret; | |
1686 | } | |
1687 | ||
e993af2e MK |
1688 | static inline bool drv_can_activate_links(struct ieee80211_local *local, |
1689 | struct ieee80211_sub_if_data *sdata, | |
1690 | u16 active_links) | |
1691 | { | |
1692 | bool ret = true; | |
1693 | ||
1694 | lockdep_assert_wiphy(local->hw.wiphy); | |
1695 | ||
1696 | if (!check_sdata_in_driver(sdata)) | |
1697 | return false; | |
1698 | ||
1699 | trace_drv_can_activate_links(local, sdata, active_links); | |
1700 | if (local->ops->can_activate_links) | |
1701 | ret = local->ops->can_activate_links(&local->hw, &sdata->vif, | |
1702 | active_links); | |
1703 | trace_drv_return_bool(local, ret); | |
1704 | ||
1705 | return ret; | |
1706 | } | |
1707 | ||
efe9c2bf JB |
1708 | int drv_change_vif_links(struct ieee80211_local *local, |
1709 | struct ieee80211_sub_if_data *sdata, | |
1710 | u16 old_links, u16 new_links, | |
1711 | struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]); | |
1712 | int drv_change_sta_links(struct ieee80211_local *local, | |
1713 | struct ieee80211_sub_if_data *sdata, | |
1714 | struct ieee80211_sta *sta, | |
1715 | u16 old_links, u16 new_links); | |
cb71f1d1 | 1716 | |
8f500fbc AB |
1717 | static inline enum ieee80211_neg_ttlm_res |
1718 | drv_can_neg_ttlm(struct ieee80211_local *local, | |
1719 | struct ieee80211_sub_if_data *sdata, | |
1720 | struct ieee80211_neg_ttlm *neg_ttlm) | |
1721 | { | |
1722 | enum ieee80211_neg_ttlm_res res = NEG_TTLM_RES_REJECT; | |
1723 | ||
1724 | might_sleep(); | |
1725 | if (!check_sdata_in_driver(sdata)) | |
1726 | return -EIO; | |
1727 | ||
1728 | trace_drv_can_neg_ttlm(local, sdata, neg_ttlm); | |
1729 | if (local->ops->can_neg_ttlm) | |
1730 | res = local->ops->can_neg_ttlm(&local->hw, &sdata->vif, | |
1731 | neg_ttlm); | |
1732 | trace_drv_neg_ttlm_res(local, sdata, res, neg_ttlm); | |
1733 | ||
1734 | return res; | |
1735 | } | |
074a8b54 IP |
1736 | |
1737 | static inline void | |
1738 | drv_prep_add_interface(struct ieee80211_local *local, | |
1739 | enum nl80211_iftype type) | |
1740 | { | |
1741 | trace_drv_prep_add_interface(local, type); | |
1742 | if (local->ops->prep_add_interface) | |
1743 | local->ops->prep_add_interface(&local->hw, type); | |
1744 | ||
1745 | trace_drv_return_void(local); | |
1746 | } | |
1747 | ||
24487981 | 1748 | #endif /* __MAC80211_DRIVER_OPS */ |