1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Portions of this file
4 * Copyright(c) 2016-2017 Intel Deutschland GmbH
5 * Copyright (C) 2018, 2021-2022 Intel Corporation
6 */
7 #ifndef __CFG80211_RDEV_OPS
8 #define __CFG80211_RDEV_OPS
9
10 #include <linux/rtnetlink.h>
11 #include <net/cfg80211.h>
12 #include "core.h"
13 #include "trace.h"
14
rdev_suspend(struct cfg80211_registered_device * rdev,struct cfg80211_wowlan * wowlan)15 static inline int rdev_suspend(struct cfg80211_registered_device *rdev,
16 struct cfg80211_wowlan *wowlan)
17 {
18 int ret;
19 trace_rdev_suspend(&rdev->wiphy, wowlan);
20 ret = rdev->ops->suspend(&rdev->wiphy, wowlan);
21 trace_rdev_return_int(&rdev->wiphy, ret);
22 return ret;
23 }
24
rdev_resume(struct cfg80211_registered_device * rdev)25 static inline int rdev_resume(struct cfg80211_registered_device *rdev)
26 {
27 int ret;
28 trace_rdev_resume(&rdev->wiphy);
29 ret = rdev->ops->resume(&rdev->wiphy);
30 trace_rdev_return_int(&rdev->wiphy, ret);
31 return ret;
32 }
33
rdev_set_wakeup(struct cfg80211_registered_device * rdev,bool enabled)34 static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
35 bool enabled)
36 {
37 trace_rdev_set_wakeup(&rdev->wiphy, enabled);
38 rdev->ops->set_wakeup(&rdev->wiphy, enabled);
39 trace_rdev_return_void(&rdev->wiphy);
40 }
41
42 static inline struct wireless_dev
rdev_add_virtual_intf(struct cfg80211_registered_device * rdev,char * name,unsigned char name_assign_type,enum nl80211_iftype type,struct vif_params * params)43 *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
44 unsigned char name_assign_type,
45 enum nl80211_iftype type,
46 struct vif_params *params)
47 {
48 struct wireless_dev *ret;
49 trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
50 ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, name_assign_type,
51 type, params);
52 trace_rdev_return_wdev(&rdev->wiphy, ret);
53 return ret;
54 }
55
56 static inline int
rdev_del_virtual_intf(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)57 rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
58 struct wireless_dev *wdev)
59 {
60 int ret;
61 trace_rdev_del_virtual_intf(&rdev->wiphy, wdev);
62 ret = rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
63 trace_rdev_return_int(&rdev->wiphy, ret);
64 return ret;
65 }
66
67 static inline int
rdev_change_virtual_intf(struct cfg80211_registered_device * rdev,struct net_device * dev,enum nl80211_iftype type,struct vif_params * params)68 rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
69 struct net_device *dev, enum nl80211_iftype type,
70 struct vif_params *params)
71 {
72 int ret;
73 trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
74 ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, params);
75 trace_rdev_return_int(&rdev->wiphy, ret);
76 return ret;
77 }
78
rdev_add_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index,bool pairwise,const u8 * mac_addr,struct key_params * params)79 static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
80 struct net_device *netdev, u8 key_index,
81 bool pairwise, const u8 *mac_addr,
82 struct key_params *params)
83 {
84 int ret;
85 trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise,
86 mac_addr, params->mode);
87 ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
88 mac_addr, params);
89 trace_rdev_return_int(&rdev->wiphy, ret);
90 return ret;
91 }
92
93 static inline int
rdev_get_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index,bool pairwise,const u8 * mac_addr,void * cookie,void (* callback)(void * cookie,struct key_params *))94 rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
95 u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
96 void (*callback)(void *cookie, struct key_params*))
97 {
98 int ret;
99 trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
100 ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
101 mac_addr, cookie, callback);
102 trace_rdev_return_int(&rdev->wiphy, ret);
103 return ret;
104 }
105
rdev_del_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index,bool pairwise,const u8 * mac_addr)106 static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
107 struct net_device *netdev, u8 key_index,
108 bool pairwise, const u8 *mac_addr)
109 {
110 int ret;
111 trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
112 ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
113 mac_addr);
114 trace_rdev_return_int(&rdev->wiphy, ret);
115 return ret;
116 }
117
118 static inline int
rdev_set_default_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index,bool unicast,bool multicast)119 rdev_set_default_key(struct cfg80211_registered_device *rdev,
120 struct net_device *netdev, u8 key_index, bool unicast,
121 bool multicast)
122 {
123 int ret;
124 trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
125 unicast, multicast);
126 ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
127 unicast, multicast);
128 trace_rdev_return_int(&rdev->wiphy, ret);
129 return ret;
130 }
131
132 static inline int
rdev_set_default_mgmt_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index)133 rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
134 struct net_device *netdev, u8 key_index)
135 {
136 int ret;
137 trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
138 ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
139 key_index);
140 trace_rdev_return_int(&rdev->wiphy, ret);
141 return ret;
142 }
143
144 static inline int
rdev_set_default_beacon_key(struct cfg80211_registered_device * rdev,struct net_device * netdev,u8 key_index)145 rdev_set_default_beacon_key(struct cfg80211_registered_device *rdev,
146 struct net_device *netdev, u8 key_index)
147 {
148 int ret;
149
150 trace_rdev_set_default_beacon_key(&rdev->wiphy, netdev, key_index);
151 ret = rdev->ops->set_default_beacon_key(&rdev->wiphy, netdev,
152 key_index);
153 trace_rdev_return_int(&rdev->wiphy, ret);
154 return ret;
155 }
156
rdev_start_ap(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_ap_settings * settings)157 static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
158 struct net_device *dev,
159 struct cfg80211_ap_settings *settings)
160 {
161 int ret;
162 trace_rdev_start_ap(&rdev->wiphy, dev, settings);
163 ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
164 trace_rdev_return_int(&rdev->wiphy, ret);
165 return ret;
166 }
167
rdev_change_beacon(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_beacon_data * info)168 static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
169 struct net_device *dev,
170 struct cfg80211_beacon_data *info)
171 {
172 int ret;
173 trace_rdev_change_beacon(&rdev->wiphy, dev, info);
174 ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
175 trace_rdev_return_int(&rdev->wiphy, ret);
176 return ret;
177 }
178
rdev_stop_ap(struct cfg80211_registered_device * rdev,struct net_device * dev,unsigned int link_id)179 static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
180 struct net_device *dev, unsigned int link_id)
181 {
182 int ret;
183 trace_rdev_stop_ap(&rdev->wiphy, dev, link_id);
184 ret = rdev->ops->stop_ap(&rdev->wiphy, dev, link_id);
185 trace_rdev_return_int(&rdev->wiphy, ret);
186 return ret;
187 }
188
rdev_add_station(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * mac,struct station_parameters * params)189 static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
190 struct net_device *dev, u8 *mac,
191 struct station_parameters *params)
192 {
193 int ret;
194 trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
195 ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
196 trace_rdev_return_int(&rdev->wiphy, ret);
197 return ret;
198 }
199
rdev_del_station(struct cfg80211_registered_device * rdev,struct net_device * dev,struct station_del_parameters * params)200 static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
201 struct net_device *dev,
202 struct station_del_parameters *params)
203 {
204 int ret;
205 trace_rdev_del_station(&rdev->wiphy, dev, params);
206 ret = rdev->ops->del_station(&rdev->wiphy, dev, params);
207 trace_rdev_return_int(&rdev->wiphy, ret);
208 return ret;
209 }
210
rdev_change_station(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * mac,struct station_parameters * params)211 static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
212 struct net_device *dev, u8 *mac,
213 struct station_parameters *params)
214 {
215 int ret;
216 trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
217 ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
218 trace_rdev_return_int(&rdev->wiphy, ret);
219 return ret;
220 }
221
rdev_get_station(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * mac,struct station_info * sinfo)222 static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
223 struct net_device *dev, const u8 *mac,
224 struct station_info *sinfo)
225 {
226 int ret;
227 trace_rdev_get_station(&rdev->wiphy, dev, mac);
228 ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
229 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
230 return ret;
231 }
232
rdev_dump_station(struct cfg80211_registered_device * rdev,struct net_device * dev,int idx,u8 * mac,struct station_info * sinfo)233 static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
234 struct net_device *dev, int idx, u8 *mac,
235 struct station_info *sinfo)
236 {
237 int ret;
238 trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
239 ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
240 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
241 return ret;
242 }
243
rdev_add_mpath(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * dst,u8 * next_hop)244 static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
245 struct net_device *dev, u8 *dst, u8 *next_hop)
246 {
247 int ret;
248 trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
249 ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
250 trace_rdev_return_int(&rdev->wiphy, ret);
251 return ret;
252 }
253
rdev_del_mpath(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * dst)254 static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
255 struct net_device *dev, u8 *dst)
256 {
257 int ret;
258 trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
259 ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
260 trace_rdev_return_int(&rdev->wiphy, ret);
261 return ret;
262 }
263
rdev_change_mpath(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * dst,u8 * next_hop)264 static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
265 struct net_device *dev, u8 *dst,
266 u8 *next_hop)
267 {
268 int ret;
269 trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
270 ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
271 trace_rdev_return_int(&rdev->wiphy, ret);
272 return ret;
273 }
274
rdev_get_mpath(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * dst,u8 * next_hop,struct mpath_info * pinfo)275 static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
276 struct net_device *dev, u8 *dst, u8 *next_hop,
277 struct mpath_info *pinfo)
278 {
279 int ret;
280 trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
281 ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
282 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
283 return ret;
284
285 }
286
rdev_get_mpp(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * dst,u8 * mpp,struct mpath_info * pinfo)287 static inline int rdev_get_mpp(struct cfg80211_registered_device *rdev,
288 struct net_device *dev, u8 *dst, u8 *mpp,
289 struct mpath_info *pinfo)
290 {
291 int ret;
292
293 trace_rdev_get_mpp(&rdev->wiphy, dev, dst, mpp);
294 ret = rdev->ops->get_mpp(&rdev->wiphy, dev, dst, mpp, pinfo);
295 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
296 return ret;
297 }
298
rdev_dump_mpath(struct cfg80211_registered_device * rdev,struct net_device * dev,int idx,u8 * dst,u8 * next_hop,struct mpath_info * pinfo)299 static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
300 struct net_device *dev, int idx, u8 *dst,
301 u8 *next_hop, struct mpath_info *pinfo)
302
303 {
304 int ret;
305 trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
306 ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
307 pinfo);
308 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
309 return ret;
310 }
311
rdev_dump_mpp(struct cfg80211_registered_device * rdev,struct net_device * dev,int idx,u8 * dst,u8 * mpp,struct mpath_info * pinfo)312 static inline int rdev_dump_mpp(struct cfg80211_registered_device *rdev,
313 struct net_device *dev, int idx, u8 *dst,
314 u8 *mpp, struct mpath_info *pinfo)
315
316 {
317 int ret;
318
319 trace_rdev_dump_mpp(&rdev->wiphy, dev, idx, dst, mpp);
320 ret = rdev->ops->dump_mpp(&rdev->wiphy, dev, idx, dst, mpp, pinfo);
321 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
322 return ret;
323 }
324
325 static inline int
rdev_get_mesh_config(struct cfg80211_registered_device * rdev,struct net_device * dev,struct mesh_config * conf)326 rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
327 struct net_device *dev, struct mesh_config *conf)
328 {
329 int ret;
330 trace_rdev_get_mesh_config(&rdev->wiphy, dev);
331 ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
332 trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
333 return ret;
334 }
335
336 static inline int
rdev_update_mesh_config(struct cfg80211_registered_device * rdev,struct net_device * dev,u32 mask,const struct mesh_config * nconf)337 rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
338 struct net_device *dev, u32 mask,
339 const struct mesh_config *nconf)
340 {
341 int ret;
342 trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
343 ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
344 trace_rdev_return_int(&rdev->wiphy, ret);
345 return ret;
346 }
347
rdev_join_mesh(struct cfg80211_registered_device * rdev,struct net_device * dev,const struct mesh_config * conf,const struct mesh_setup * setup)348 static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
349 struct net_device *dev,
350 const struct mesh_config *conf,
351 const struct mesh_setup *setup)
352 {
353 int ret;
354 trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
355 ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
356 trace_rdev_return_int(&rdev->wiphy, ret);
357 return ret;
358 }
359
360
rdev_leave_mesh(struct cfg80211_registered_device * rdev,struct net_device * dev)361 static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
362 struct net_device *dev)
363 {
364 int ret;
365 trace_rdev_leave_mesh(&rdev->wiphy, dev);
366 ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
367 trace_rdev_return_int(&rdev->wiphy, ret);
368 return ret;
369 }
370
rdev_join_ocb(struct cfg80211_registered_device * rdev,struct net_device * dev,struct ocb_setup * setup)371 static inline int rdev_join_ocb(struct cfg80211_registered_device *rdev,
372 struct net_device *dev,
373 struct ocb_setup *setup)
374 {
375 int ret;
376 trace_rdev_join_ocb(&rdev->wiphy, dev, setup);
377 ret = rdev->ops->join_ocb(&rdev->wiphy, dev, setup);
378 trace_rdev_return_int(&rdev->wiphy, ret);
379 return ret;
380 }
381
rdev_leave_ocb(struct cfg80211_registered_device * rdev,struct net_device * dev)382 static inline int rdev_leave_ocb(struct cfg80211_registered_device *rdev,
383 struct net_device *dev)
384 {
385 int ret;
386 trace_rdev_leave_ocb(&rdev->wiphy, dev);
387 ret = rdev->ops->leave_ocb(&rdev->wiphy, dev);
388 trace_rdev_return_int(&rdev->wiphy, ret);
389 return ret;
390 }
391
rdev_change_bss(struct cfg80211_registered_device * rdev,struct net_device * dev,struct bss_parameters * params)392 static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
393 struct net_device *dev,
394 struct bss_parameters *params)
395
396 {
397 int ret;
398 trace_rdev_change_bss(&rdev->wiphy, dev, params);
399 ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
400 trace_rdev_return_int(&rdev->wiphy, ret);
401 return ret;
402 }
403
rdev_set_txq_params(struct cfg80211_registered_device * rdev,struct net_device * dev,struct ieee80211_txq_params * params)404 static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
405 struct net_device *dev,
406 struct ieee80211_txq_params *params)
407
408 {
409 int ret;
410 trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
411 ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
412 trace_rdev_return_int(&rdev->wiphy, ret);
413 return ret;
414 }
415
416 static inline int
rdev_libertas_set_mesh_channel(struct cfg80211_registered_device * rdev,struct net_device * dev,struct ieee80211_channel * chan)417 rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
418 struct net_device *dev,
419 struct ieee80211_channel *chan)
420 {
421 int ret;
422 trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
423 ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
424 trace_rdev_return_int(&rdev->wiphy, ret);
425 return ret;
426 }
427
428 static inline int
rdev_set_monitor_channel(struct cfg80211_registered_device * rdev,struct cfg80211_chan_def * chandef)429 rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
430 struct cfg80211_chan_def *chandef)
431 {
432 int ret;
433 trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
434 ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
435 trace_rdev_return_int(&rdev->wiphy, ret);
436 return ret;
437 }
438
rdev_scan(struct cfg80211_registered_device * rdev,struct cfg80211_scan_request * request)439 static inline int rdev_scan(struct cfg80211_registered_device *rdev,
440 struct cfg80211_scan_request *request)
441 {
442 int ret;
443 trace_rdev_scan(&rdev->wiphy, request);
444 ret = rdev->ops->scan(&rdev->wiphy, request);
445 trace_rdev_return_int(&rdev->wiphy, ret);
446 return ret;
447 }
448
rdev_abort_scan(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)449 static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
450 struct wireless_dev *wdev)
451 {
452 trace_rdev_abort_scan(&rdev->wiphy, wdev);
453 rdev->ops->abort_scan(&rdev->wiphy, wdev);
454 trace_rdev_return_void(&rdev->wiphy);
455 }
456
rdev_auth(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_auth_request * req)457 static inline int rdev_auth(struct cfg80211_registered_device *rdev,
458 struct net_device *dev,
459 struct cfg80211_auth_request *req)
460 {
461 int ret;
462 trace_rdev_auth(&rdev->wiphy, dev, req);
463 ret = rdev->ops->auth(&rdev->wiphy, dev, req);
464 trace_rdev_return_int(&rdev->wiphy, ret);
465 return ret;
466 }
467
rdev_assoc(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_assoc_request * req)468 static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
469 struct net_device *dev,
470 struct cfg80211_assoc_request *req)
471 {
472 const struct cfg80211_bss_ies *bss_ies;
473 int ret;
474
475 /*
476 * Note: we might trace not exactly the data that's processed,
477 * due to races and the driver/mac80211 getting a newer copy.
478 */
479 rcu_read_lock();
480 bss_ies = rcu_dereference(req->bss->ies);
481 trace_rdev_assoc(&rdev->wiphy, dev, req, bss_ies);
482 rcu_read_unlock();
483
484 ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
485 trace_rdev_return_int(&rdev->wiphy, ret);
486 return ret;
487 }
488
rdev_deauth(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_deauth_request * req)489 static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
490 struct net_device *dev,
491 struct cfg80211_deauth_request *req)
492 {
493 int ret;
494 trace_rdev_deauth(&rdev->wiphy, dev, req);
495 ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
496 trace_rdev_return_int(&rdev->wiphy, ret);
497 return ret;
498 }
499
rdev_disassoc(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_disassoc_request * req)500 static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
501 struct net_device *dev,
502 struct cfg80211_disassoc_request *req)
503 {
504 int ret;
505 trace_rdev_disassoc(&rdev->wiphy, dev, req);
506 ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
507 trace_rdev_return_int(&rdev->wiphy, ret);
508 return ret;
509 }
510
rdev_connect(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_connect_params * sme)511 static inline int rdev_connect(struct cfg80211_registered_device *rdev,
512 struct net_device *dev,
513 struct cfg80211_connect_params *sme)
514 {
515 int ret;
516 trace_rdev_connect(&rdev->wiphy, dev, sme);
517 ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
518 trace_rdev_return_int(&rdev->wiphy, ret);
519 return ret;
520 }
521
522 static inline int
rdev_update_connect_params(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_connect_params * sme,u32 changed)523 rdev_update_connect_params(struct cfg80211_registered_device *rdev,
524 struct net_device *dev,
525 struct cfg80211_connect_params *sme, u32 changed)
526 {
527 int ret;
528 trace_rdev_update_connect_params(&rdev->wiphy, dev, sme, changed);
529 ret = rdev->ops->update_connect_params(&rdev->wiphy, dev, sme, changed);
530 trace_rdev_return_int(&rdev->wiphy, ret);
531 return ret;
532 }
533
rdev_disconnect(struct cfg80211_registered_device * rdev,struct net_device * dev,u16 reason_code)534 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
535 struct net_device *dev, u16 reason_code)
536 {
537 int ret;
538 trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
539 ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
540 trace_rdev_return_int(&rdev->wiphy, ret);
541 return ret;
542 }
543
rdev_join_ibss(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_ibss_params * params)544 static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
545 struct net_device *dev,
546 struct cfg80211_ibss_params *params)
547 {
548 int ret;
549 trace_rdev_join_ibss(&rdev->wiphy, dev, params);
550 ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
551 trace_rdev_return_int(&rdev->wiphy, ret);
552 return ret;
553 }
554
rdev_leave_ibss(struct cfg80211_registered_device * rdev,struct net_device * dev)555 static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
556 struct net_device *dev)
557 {
558 int ret;
559 trace_rdev_leave_ibss(&rdev->wiphy, dev);
560 ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
561 trace_rdev_return_int(&rdev->wiphy, ret);
562 return ret;
563 }
564
565 static inline int
rdev_set_wiphy_params(struct cfg80211_registered_device * rdev,u32 changed)566 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
567 {
568 int ret;
569
570 if (!rdev->ops->set_wiphy_params)
571 return -EOPNOTSUPP;
572
573 trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
574 ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
575 trace_rdev_return_int(&rdev->wiphy, ret);
576 return ret;
577 }
578
rdev_set_tx_power(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,enum nl80211_tx_power_setting type,int mbm)579 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
580 struct wireless_dev *wdev,
581 enum nl80211_tx_power_setting type, int mbm)
582 {
583 int ret;
584 trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
585 ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
586 trace_rdev_return_int(&rdev->wiphy, ret);
587 return ret;
588 }
589
rdev_get_tx_power(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,int * dbm)590 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
591 struct wireless_dev *wdev, int *dbm)
592 {
593 int ret;
594 trace_rdev_get_tx_power(&rdev->wiphy, wdev);
595 ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
596 trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
597 return ret;
598 }
599
600 static inline int
rdev_set_multicast_to_unicast(struct cfg80211_registered_device * rdev,struct net_device * dev,const bool enabled)601 rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
602 struct net_device *dev,
603 const bool enabled)
604 {
605 int ret;
606 trace_rdev_set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
607 ret = rdev->ops->set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
608 trace_rdev_return_int(&rdev->wiphy, ret);
609 return ret;
610 }
611
612 static inline int
rdev_get_txq_stats(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_txq_stats * txqstats)613 rdev_get_txq_stats(struct cfg80211_registered_device *rdev,
614 struct wireless_dev *wdev,
615 struct cfg80211_txq_stats *txqstats)
616 {
617 int ret;
618 trace_rdev_get_txq_stats(&rdev->wiphy, wdev);
619 ret = rdev->ops->get_txq_stats(&rdev->wiphy, wdev, txqstats);
620 trace_rdev_return_int(&rdev->wiphy, ret);
621 return ret;
622 }
623
rdev_rfkill_poll(struct cfg80211_registered_device * rdev)624 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
625 {
626 trace_rdev_rfkill_poll(&rdev->wiphy);
627 rdev->ops->rfkill_poll(&rdev->wiphy);
628 trace_rdev_return_void(&rdev->wiphy);
629 }
630
631
632 #ifdef CONFIG_NL80211_TESTMODE
rdev_testmode_cmd(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,void * data,int len)633 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
634 struct wireless_dev *wdev,
635 void *data, int len)
636 {
637 int ret;
638 trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
639 ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
640 trace_rdev_return_int(&rdev->wiphy, ret);
641 return ret;
642 }
643
rdev_testmode_dump(struct cfg80211_registered_device * rdev,struct sk_buff * skb,struct netlink_callback * cb,void * data,int len)644 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
645 struct sk_buff *skb,
646 struct netlink_callback *cb, void *data,
647 int len)
648 {
649 int ret;
650 trace_rdev_testmode_dump(&rdev->wiphy);
651 ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
652 trace_rdev_return_int(&rdev->wiphy, ret);
653 return ret;
654 }
655 #endif
656
657 static inline int
rdev_set_bitrate_mask(struct cfg80211_registered_device * rdev,struct net_device * dev,unsigned int link_id,const u8 * peer,const struct cfg80211_bitrate_mask * mask)658 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
659 struct net_device *dev, unsigned int link_id,
660 const u8 *peer,
661 const struct cfg80211_bitrate_mask *mask)
662 {
663 int ret;
664 trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, link_id, peer, mask);
665 ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, link_id,
666 peer, mask);
667 trace_rdev_return_int(&rdev->wiphy, ret);
668 return ret;
669 }
670
rdev_dump_survey(struct cfg80211_registered_device * rdev,struct net_device * netdev,int idx,struct survey_info * info)671 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
672 struct net_device *netdev, int idx,
673 struct survey_info *info)
674 {
675 int ret;
676 trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
677 ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
678 if (ret < 0)
679 trace_rdev_return_int(&rdev->wiphy, ret);
680 else
681 trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
682 return ret;
683 }
684
rdev_set_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev,struct cfg80211_pmksa * pmksa)685 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
686 struct net_device *netdev,
687 struct cfg80211_pmksa *pmksa)
688 {
689 int ret;
690 trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
691 ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
692 trace_rdev_return_int(&rdev->wiphy, ret);
693 return ret;
694 }
695
rdev_del_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev,struct cfg80211_pmksa * pmksa)696 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
697 struct net_device *netdev,
698 struct cfg80211_pmksa *pmksa)
699 {
700 int ret;
701 trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
702 ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
703 trace_rdev_return_int(&rdev->wiphy, ret);
704 return ret;
705 }
706
rdev_flush_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev)707 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
708 struct net_device *netdev)
709 {
710 int ret;
711 trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
712 ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
713 trace_rdev_return_int(&rdev->wiphy, ret);
714 return ret;
715 }
716
717 static inline int
rdev_remain_on_channel(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct ieee80211_channel * chan,unsigned int duration,u64 * cookie)718 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
719 struct wireless_dev *wdev,
720 struct ieee80211_channel *chan,
721 unsigned int duration, u64 *cookie)
722 {
723 int ret;
724 trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
725 ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
726 duration, cookie);
727 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
728 return ret;
729 }
730
731 static inline int
rdev_cancel_remain_on_channel(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)732 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
733 struct wireless_dev *wdev, u64 cookie)
734 {
735 int ret;
736 trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
737 ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
738 trace_rdev_return_int(&rdev->wiphy, ret);
739 return ret;
740 }
741
rdev_mgmt_tx(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_mgmt_tx_params * params,u64 * cookie)742 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
743 struct wireless_dev *wdev,
744 struct cfg80211_mgmt_tx_params *params,
745 u64 *cookie)
746 {
747 int ret;
748 trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
749 ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
750 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
751 return ret;
752 }
753
rdev_tx_control_port(struct cfg80211_registered_device * rdev,struct net_device * dev,const void * buf,size_t len,const u8 * dest,__be16 proto,const bool noencrypt,u64 * cookie)754 static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,
755 struct net_device *dev,
756 const void *buf, size_t len,
757 const u8 *dest, __be16 proto,
758 const bool noencrypt, u64 *cookie)
759 {
760 int ret;
761 trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,
762 dest, proto, noencrypt);
763 ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,
764 dest, proto, noencrypt, cookie);
765 if (cookie)
766 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
767 else
768 trace_rdev_return_int(&rdev->wiphy, ret);
769 return ret;
770 }
771
772 static inline int
rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)773 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
774 struct wireless_dev *wdev, u64 cookie)
775 {
776 int ret;
777 trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
778 ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
779 trace_rdev_return_int(&rdev->wiphy, ret);
780 return ret;
781 }
782
rdev_set_power_mgmt(struct cfg80211_registered_device * rdev,struct net_device * dev,bool enabled,int timeout)783 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
784 struct net_device *dev, bool enabled,
785 int timeout)
786 {
787 int ret;
788 trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
789 ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
790 trace_rdev_return_int(&rdev->wiphy, ret);
791 return ret;
792 }
793
794 static inline int
rdev_set_cqm_rssi_config(struct cfg80211_registered_device * rdev,struct net_device * dev,s32 rssi_thold,u32 rssi_hyst)795 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
796 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
797 {
798 int ret;
799 trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
800 rssi_hyst);
801 ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
802 rssi_hyst);
803 trace_rdev_return_int(&rdev->wiphy, ret);
804 return ret;
805 }
806
807 static inline int
rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device * rdev,struct net_device * dev,s32 low,s32 high)808 rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device *rdev,
809 struct net_device *dev, s32 low, s32 high)
810 {
811 int ret;
812 trace_rdev_set_cqm_rssi_range_config(&rdev->wiphy, dev, low, high);
813 ret = rdev->ops->set_cqm_rssi_range_config(&rdev->wiphy, dev,
814 low, high);
815 trace_rdev_return_int(&rdev->wiphy, ret);
816 return ret;
817 }
818
819 static inline int
rdev_set_cqm_txe_config(struct cfg80211_registered_device * rdev,struct net_device * dev,u32 rate,u32 pkts,u32 intvl)820 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
821 struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
822 {
823 int ret;
824 trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
825 ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
826 intvl);
827 trace_rdev_return_int(&rdev->wiphy, ret);
828 return ret;
829 }
830
831 static inline void
rdev_update_mgmt_frame_registrations(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct mgmt_frame_regs * upd)832 rdev_update_mgmt_frame_registrations(struct cfg80211_registered_device *rdev,
833 struct wireless_dev *wdev,
834 struct mgmt_frame_regs *upd)
835 {
836 might_sleep();
837
838 trace_rdev_update_mgmt_frame_registrations(&rdev->wiphy, wdev, upd);
839 if (rdev->ops->update_mgmt_frame_registrations)
840 rdev->ops->update_mgmt_frame_registrations(&rdev->wiphy, wdev,
841 upd);
842 trace_rdev_return_void(&rdev->wiphy);
843 }
844
rdev_set_antenna(struct cfg80211_registered_device * rdev,u32 tx_ant,u32 rx_ant)845 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
846 u32 tx_ant, u32 rx_ant)
847 {
848 int ret;
849 trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
850 ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
851 trace_rdev_return_int(&rdev->wiphy, ret);
852 return ret;
853 }
854
rdev_get_antenna(struct cfg80211_registered_device * rdev,u32 * tx_ant,u32 * rx_ant)855 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
856 u32 *tx_ant, u32 *rx_ant)
857 {
858 int ret;
859 trace_rdev_get_antenna(&rdev->wiphy);
860 ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
861 if (ret)
862 trace_rdev_return_int(&rdev->wiphy, ret);
863 else
864 trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
865 *rx_ant);
866 return ret;
867 }
868
869 static inline int
rdev_sched_scan_start(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_sched_scan_request * request)870 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
871 struct net_device *dev,
872 struct cfg80211_sched_scan_request *request)
873 {
874 int ret;
875 trace_rdev_sched_scan_start(&rdev->wiphy, dev, request->reqid);
876 ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
877 trace_rdev_return_int(&rdev->wiphy, ret);
878 return ret;
879 }
880
rdev_sched_scan_stop(struct cfg80211_registered_device * rdev,struct net_device * dev,u64 reqid)881 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
882 struct net_device *dev, u64 reqid)
883 {
884 int ret;
885 trace_rdev_sched_scan_stop(&rdev->wiphy, dev, reqid);
886 ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev, reqid);
887 trace_rdev_return_int(&rdev->wiphy, ret);
888 return ret;
889 }
890
rdev_set_rekey_data(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_gtk_rekey_data * data)891 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
892 struct net_device *dev,
893 struct cfg80211_gtk_rekey_data *data)
894 {
895 int ret;
896 trace_rdev_set_rekey_data(&rdev->wiphy, dev);
897 ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
898 trace_rdev_return_int(&rdev->wiphy, ret);
899 return ret;
900 }
901
rdev_tdls_mgmt(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * peer,u8 action_code,u8 dialog_token,u16 status_code,u32 peer_capability,bool initiator,const u8 * buf,size_t len)902 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
903 struct net_device *dev, u8 *peer,
904 u8 action_code, u8 dialog_token,
905 u16 status_code, u32 peer_capability,
906 bool initiator, const u8 *buf, size_t len)
907 {
908 int ret;
909 trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
910 dialog_token, status_code, peer_capability,
911 initiator, buf, len);
912 ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
913 dialog_token, status_code, peer_capability,
914 initiator, buf, len);
915 trace_rdev_return_int(&rdev->wiphy, ret);
916 return ret;
917 }
918
rdev_tdls_oper(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * peer,enum nl80211_tdls_operation oper)919 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
920 struct net_device *dev, u8 *peer,
921 enum nl80211_tdls_operation oper)
922 {
923 int ret;
924 trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
925 ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
926 trace_rdev_return_int(&rdev->wiphy, ret);
927 return ret;
928 }
929
rdev_probe_client(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * peer,u64 * cookie)930 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
931 struct net_device *dev, const u8 *peer,
932 u64 *cookie)
933 {
934 int ret;
935 trace_rdev_probe_client(&rdev->wiphy, dev, peer);
936 ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
937 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
938 return ret;
939 }
940
rdev_set_noack_map(struct cfg80211_registered_device * rdev,struct net_device * dev,u16 noack_map)941 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
942 struct net_device *dev, u16 noack_map)
943 {
944 int ret;
945 trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
946 ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
947 trace_rdev_return_int(&rdev->wiphy, ret);
948 return ret;
949 }
950
951 static inline int
rdev_get_channel(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,unsigned int link_id,struct cfg80211_chan_def * chandef)952 rdev_get_channel(struct cfg80211_registered_device *rdev,
953 struct wireless_dev *wdev,
954 unsigned int link_id,
955 struct cfg80211_chan_def *chandef)
956 {
957 int ret;
958
959 trace_rdev_get_channel(&rdev->wiphy, wdev, link_id);
960 ret = rdev->ops->get_channel(&rdev->wiphy, wdev, link_id, chandef);
961 trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
962
963 return ret;
964 }
965
rdev_start_p2p_device(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)966 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
967 struct wireless_dev *wdev)
968 {
969 int ret;
970
971 trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
972 ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
973 trace_rdev_return_int(&rdev->wiphy, ret);
974 return ret;
975 }
976
rdev_stop_p2p_device(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)977 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
978 struct wireless_dev *wdev)
979 {
980 trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
981 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
982 trace_rdev_return_void(&rdev->wiphy);
983 }
984
rdev_start_nan(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_conf * conf)985 static inline int rdev_start_nan(struct cfg80211_registered_device *rdev,
986 struct wireless_dev *wdev,
987 struct cfg80211_nan_conf *conf)
988 {
989 int ret;
990
991 trace_rdev_start_nan(&rdev->wiphy, wdev, conf);
992 ret = rdev->ops->start_nan(&rdev->wiphy, wdev, conf);
993 trace_rdev_return_int(&rdev->wiphy, ret);
994 return ret;
995 }
996
rdev_stop_nan(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)997 static inline void rdev_stop_nan(struct cfg80211_registered_device *rdev,
998 struct wireless_dev *wdev)
999 {
1000 trace_rdev_stop_nan(&rdev->wiphy, wdev);
1001 rdev->ops->stop_nan(&rdev->wiphy, wdev);
1002 trace_rdev_return_void(&rdev->wiphy);
1003 }
1004
1005 static inline int
rdev_add_nan_func(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_func * nan_func)1006 rdev_add_nan_func(struct cfg80211_registered_device *rdev,
1007 struct wireless_dev *wdev,
1008 struct cfg80211_nan_func *nan_func)
1009 {
1010 int ret;
1011
1012 trace_rdev_add_nan_func(&rdev->wiphy, wdev, nan_func);
1013 ret = rdev->ops->add_nan_func(&rdev->wiphy, wdev, nan_func);
1014 trace_rdev_return_int(&rdev->wiphy, ret);
1015 return ret;
1016 }
1017
rdev_del_nan_func(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)1018 static inline void rdev_del_nan_func(struct cfg80211_registered_device *rdev,
1019 struct wireless_dev *wdev, u64 cookie)
1020 {
1021 trace_rdev_del_nan_func(&rdev->wiphy, wdev, cookie);
1022 rdev->ops->del_nan_func(&rdev->wiphy, wdev, cookie);
1023 trace_rdev_return_void(&rdev->wiphy);
1024 }
1025
1026 static inline int
rdev_nan_change_conf(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_conf * conf,u32 changes)1027 rdev_nan_change_conf(struct cfg80211_registered_device *rdev,
1028 struct wireless_dev *wdev,
1029 struct cfg80211_nan_conf *conf, u32 changes)
1030 {
1031 int ret;
1032
1033 trace_rdev_nan_change_conf(&rdev->wiphy, wdev, conf, changes);
1034 if (rdev->ops->nan_change_conf)
1035 ret = rdev->ops->nan_change_conf(&rdev->wiphy, wdev, conf,
1036 changes);
1037 else
1038 ret = -ENOTSUPP;
1039 trace_rdev_return_int(&rdev->wiphy, ret);
1040 return ret;
1041 }
1042
rdev_set_mac_acl(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_acl_data * params)1043 static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
1044 struct net_device *dev,
1045 struct cfg80211_acl_data *params)
1046 {
1047 int ret;
1048
1049 trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
1050 ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
1051 trace_rdev_return_int(&rdev->wiphy, ret);
1052 return ret;
1053 }
1054
rdev_update_ft_ies(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_update_ft_ies_params * ftie)1055 static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
1056 struct net_device *dev,
1057 struct cfg80211_update_ft_ies_params *ftie)
1058 {
1059 int ret;
1060
1061 trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
1062 ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
1063 trace_rdev_return_int(&rdev->wiphy, ret);
1064 return ret;
1065 }
1066
rdev_crit_proto_start(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,enum nl80211_crit_proto_id protocol,u16 duration)1067 static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
1068 struct wireless_dev *wdev,
1069 enum nl80211_crit_proto_id protocol,
1070 u16 duration)
1071 {
1072 int ret;
1073
1074 trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
1075 ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
1076 protocol, duration);
1077 trace_rdev_return_int(&rdev->wiphy, ret);
1078 return ret;
1079 }
1080
rdev_crit_proto_stop(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)1081 static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
1082 struct wireless_dev *wdev)
1083 {
1084 trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
1085 rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
1086 trace_rdev_return_void(&rdev->wiphy);
1087 }
1088
rdev_channel_switch(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_csa_settings * params)1089 static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
1090 struct net_device *dev,
1091 struct cfg80211_csa_settings *params)
1092 {
1093 int ret;
1094
1095 trace_rdev_channel_switch(&rdev->wiphy, dev, params);
1096 ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
1097 trace_rdev_return_int(&rdev->wiphy, ret);
1098 return ret;
1099 }
1100
rdev_set_qos_map(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_qos_map * qos_map)1101 static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
1102 struct net_device *dev,
1103 struct cfg80211_qos_map *qos_map)
1104 {
1105 int ret = -EOPNOTSUPP;
1106
1107 if (rdev->ops->set_qos_map) {
1108 trace_rdev_set_qos_map(&rdev->wiphy, dev, qos_map);
1109 ret = rdev->ops->set_qos_map(&rdev->wiphy, dev, qos_map);
1110 trace_rdev_return_int(&rdev->wiphy, ret);
1111 }
1112
1113 return ret;
1114 }
1115
1116 static inline int
rdev_set_ap_chanwidth(struct cfg80211_registered_device * rdev,struct net_device * dev,unsigned int link_id,struct cfg80211_chan_def * chandef)1117 rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev,
1118 struct net_device *dev,
1119 unsigned int link_id,
1120 struct cfg80211_chan_def *chandef)
1121 {
1122 int ret;
1123
1124 trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1125 ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1126 trace_rdev_return_int(&rdev->wiphy, ret);
1127
1128 return ret;
1129 }
1130
1131 static inline int
rdev_add_tx_ts(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 tsid,const u8 * peer,u8 user_prio,u16 admitted_time)1132 rdev_add_tx_ts(struct cfg80211_registered_device *rdev,
1133 struct net_device *dev, u8 tsid, const u8 *peer,
1134 u8 user_prio, u16 admitted_time)
1135 {
1136 int ret = -EOPNOTSUPP;
1137
1138 trace_rdev_add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1139 user_prio, admitted_time);
1140 if (rdev->ops->add_tx_ts)
1141 ret = rdev->ops->add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1142 user_prio, admitted_time);
1143 trace_rdev_return_int(&rdev->wiphy, ret);
1144
1145 return ret;
1146 }
1147
1148 static inline int
rdev_del_tx_ts(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 tsid,const u8 * peer)1149 rdev_del_tx_ts(struct cfg80211_registered_device *rdev,
1150 struct net_device *dev, u8 tsid, const u8 *peer)
1151 {
1152 int ret = -EOPNOTSUPP;
1153
1154 trace_rdev_del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1155 if (rdev->ops->del_tx_ts)
1156 ret = rdev->ops->del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1157 trace_rdev_return_int(&rdev->wiphy, ret);
1158
1159 return ret;
1160 }
1161
1162 static inline int
rdev_tdls_channel_switch(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * addr,u8 oper_class,struct cfg80211_chan_def * chandef)1163 rdev_tdls_channel_switch(struct cfg80211_registered_device *rdev,
1164 struct net_device *dev, const u8 *addr,
1165 u8 oper_class, struct cfg80211_chan_def *chandef)
1166 {
1167 int ret;
1168
1169 trace_rdev_tdls_channel_switch(&rdev->wiphy, dev, addr, oper_class,
1170 chandef);
1171 ret = rdev->ops->tdls_channel_switch(&rdev->wiphy, dev, addr,
1172 oper_class, chandef);
1173 trace_rdev_return_int(&rdev->wiphy, ret);
1174 return ret;
1175 }
1176
1177 static inline void
rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * addr)1178 rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device *rdev,
1179 struct net_device *dev, const u8 *addr)
1180 {
1181 trace_rdev_tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1182 rdev->ops->tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1183 trace_rdev_return_void(&rdev->wiphy);
1184 }
1185
1186 static inline int
rdev_start_radar_detection(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_chan_def * chandef,u32 cac_time_ms)1187 rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
1188 struct net_device *dev,
1189 struct cfg80211_chan_def *chandef,
1190 u32 cac_time_ms)
1191 {
1192 int ret = -ENOTSUPP;
1193
1194 trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef,
1195 cac_time_ms);
1196 if (rdev->ops->start_radar_detection)
1197 ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev,
1198 chandef, cac_time_ms);
1199 trace_rdev_return_int(&rdev->wiphy, ret);
1200 return ret;
1201 }
1202
1203 static inline void
rdev_end_cac(struct cfg80211_registered_device * rdev,struct net_device * dev)1204 rdev_end_cac(struct cfg80211_registered_device *rdev,
1205 struct net_device *dev)
1206 {
1207 trace_rdev_end_cac(&rdev->wiphy, dev);
1208 if (rdev->ops->end_cac)
1209 rdev->ops->end_cac(&rdev->wiphy, dev);
1210 trace_rdev_return_void(&rdev->wiphy);
1211 }
1212
1213 static inline int
rdev_set_mcast_rate(struct cfg80211_registered_device * rdev,struct net_device * dev,int mcast_rate[NUM_NL80211_BANDS])1214 rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
1215 struct net_device *dev,
1216 int mcast_rate[NUM_NL80211_BANDS])
1217 {
1218 int ret = -ENOTSUPP;
1219
1220 trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1221 if (rdev->ops->set_mcast_rate)
1222 ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1223 trace_rdev_return_int(&rdev->wiphy, ret);
1224 return ret;
1225 }
1226
1227 static inline int
rdev_set_coalesce(struct cfg80211_registered_device * rdev,struct cfg80211_coalesce * coalesce)1228 rdev_set_coalesce(struct cfg80211_registered_device *rdev,
1229 struct cfg80211_coalesce *coalesce)
1230 {
1231 int ret = -ENOTSUPP;
1232
1233 trace_rdev_set_coalesce(&rdev->wiphy, coalesce);
1234 if (rdev->ops->set_coalesce)
1235 ret = rdev->ops->set_coalesce(&rdev->wiphy, coalesce);
1236 trace_rdev_return_int(&rdev->wiphy, ret);
1237 return ret;
1238 }
1239
rdev_set_pmk(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_pmk_conf * pmk_conf)1240 static inline int rdev_set_pmk(struct cfg80211_registered_device *rdev,
1241 struct net_device *dev,
1242 struct cfg80211_pmk_conf *pmk_conf)
1243 {
1244 int ret = -EOPNOTSUPP;
1245
1246 trace_rdev_set_pmk(&rdev->wiphy, dev, pmk_conf);
1247 if (rdev->ops->set_pmk)
1248 ret = rdev->ops->set_pmk(&rdev->wiphy, dev, pmk_conf);
1249 trace_rdev_return_int(&rdev->wiphy, ret);
1250 return ret;
1251 }
1252
rdev_del_pmk(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * aa)1253 static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev,
1254 struct net_device *dev, const u8 *aa)
1255 {
1256 int ret = -EOPNOTSUPP;
1257
1258 trace_rdev_del_pmk(&rdev->wiphy, dev, aa);
1259 if (rdev->ops->del_pmk)
1260 ret = rdev->ops->del_pmk(&rdev->wiphy, dev, aa);
1261 trace_rdev_return_int(&rdev->wiphy, ret);
1262 return ret;
1263 }
1264
1265 static inline int
rdev_external_auth(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_external_auth_params * params)1266 rdev_external_auth(struct cfg80211_registered_device *rdev,
1267 struct net_device *dev,
1268 struct cfg80211_external_auth_params *params)
1269 {
1270 int ret = -EOPNOTSUPP;
1271
1272 trace_rdev_external_auth(&rdev->wiphy, dev, params);
1273 if (rdev->ops->external_auth)
1274 ret = rdev->ops->external_auth(&rdev->wiphy, dev, params);
1275 trace_rdev_return_int(&rdev->wiphy, ret);
1276 return ret;
1277 }
1278
1279 static inline int
rdev_get_ftm_responder_stats(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_ftm_responder_stats * ftm_stats)1280 rdev_get_ftm_responder_stats(struct cfg80211_registered_device *rdev,
1281 struct net_device *dev,
1282 struct cfg80211_ftm_responder_stats *ftm_stats)
1283 {
1284 int ret = -EOPNOTSUPP;
1285
1286 trace_rdev_get_ftm_responder_stats(&rdev->wiphy, dev, ftm_stats);
1287 if (rdev->ops->get_ftm_responder_stats)
1288 ret = rdev->ops->get_ftm_responder_stats(&rdev->wiphy, dev,
1289 ftm_stats);
1290 trace_rdev_return_int(&rdev->wiphy, ret);
1291 return ret;
1292 }
1293
1294 static inline int
rdev_start_pmsr(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_pmsr_request * request)1295 rdev_start_pmsr(struct cfg80211_registered_device *rdev,
1296 struct wireless_dev *wdev,
1297 struct cfg80211_pmsr_request *request)
1298 {
1299 int ret = -EOPNOTSUPP;
1300
1301 trace_rdev_start_pmsr(&rdev->wiphy, wdev, request->cookie);
1302 if (rdev->ops->start_pmsr)
1303 ret = rdev->ops->start_pmsr(&rdev->wiphy, wdev, request);
1304 trace_rdev_return_int(&rdev->wiphy, ret);
1305 return ret;
1306 }
1307
1308 static inline void
rdev_abort_pmsr(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_pmsr_request * request)1309 rdev_abort_pmsr(struct cfg80211_registered_device *rdev,
1310 struct wireless_dev *wdev,
1311 struct cfg80211_pmsr_request *request)
1312 {
1313 trace_rdev_abort_pmsr(&rdev->wiphy, wdev, request->cookie);
1314 if (rdev->ops->abort_pmsr)
1315 rdev->ops->abort_pmsr(&rdev->wiphy, wdev, request);
1316 trace_rdev_return_void(&rdev->wiphy);
1317 }
1318
rdev_update_owe_info(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_update_owe_info * oweinfo)1319 static inline int rdev_update_owe_info(struct cfg80211_registered_device *rdev,
1320 struct net_device *dev,
1321 struct cfg80211_update_owe_info *oweinfo)
1322 {
1323 int ret = -EOPNOTSUPP;
1324
1325 trace_rdev_update_owe_info(&rdev->wiphy, dev, oweinfo);
1326 if (rdev->ops->update_owe_info)
1327 ret = rdev->ops->update_owe_info(&rdev->wiphy, dev, oweinfo);
1328 trace_rdev_return_int(&rdev->wiphy, ret);
1329 return ret;
1330 }
1331
1332 static inline int
rdev_probe_mesh_link(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * dest,const void * buf,size_t len)1333 rdev_probe_mesh_link(struct cfg80211_registered_device *rdev,
1334 struct net_device *dev, const u8 *dest,
1335 const void *buf, size_t len)
1336 {
1337 int ret;
1338
1339 trace_rdev_probe_mesh_link(&rdev->wiphy, dev, dest, buf, len);
1340 ret = rdev->ops->probe_mesh_link(&rdev->wiphy, dev, buf, len);
1341 trace_rdev_return_int(&rdev->wiphy, ret);
1342 return ret;
1343 }
1344
rdev_set_tid_config(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_tid_config * tid_conf)1345 static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev,
1346 struct net_device *dev,
1347 struct cfg80211_tid_config *tid_conf)
1348 {
1349 int ret;
1350
1351 trace_rdev_set_tid_config(&rdev->wiphy, dev, tid_conf);
1352 ret = rdev->ops->set_tid_config(&rdev->wiphy, dev, tid_conf);
1353 trace_rdev_return_int(&rdev->wiphy, ret);
1354 return ret;
1355 }
1356
rdev_reset_tid_config(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * peer,u8 tids)1357 static inline int rdev_reset_tid_config(struct cfg80211_registered_device *rdev,
1358 struct net_device *dev, const u8 *peer,
1359 u8 tids)
1360 {
1361 int ret;
1362
1363 trace_rdev_reset_tid_config(&rdev->wiphy, dev, peer, tids);
1364 ret = rdev->ops->reset_tid_config(&rdev->wiphy, dev, peer, tids);
1365 trace_rdev_return_int(&rdev->wiphy, ret);
1366 return ret;
1367 }
1368
rdev_set_sar_specs(struct cfg80211_registered_device * rdev,struct cfg80211_sar_specs * sar)1369 static inline int rdev_set_sar_specs(struct cfg80211_registered_device *rdev,
1370 struct cfg80211_sar_specs *sar)
1371 {
1372 int ret;
1373
1374 trace_rdev_set_sar_specs(&rdev->wiphy, sar);
1375 ret = rdev->ops->set_sar_specs(&rdev->wiphy, sar);
1376 trace_rdev_return_int(&rdev->wiphy, ret);
1377
1378 return ret;
1379 }
1380
rdev_color_change(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_color_change_settings * params)1381 static inline int rdev_color_change(struct cfg80211_registered_device *rdev,
1382 struct net_device *dev,
1383 struct cfg80211_color_change_settings *params)
1384 {
1385 int ret;
1386
1387 trace_rdev_color_change(&rdev->wiphy, dev, params);
1388 ret = rdev->ops->color_change(&rdev->wiphy, dev, params);
1389 trace_rdev_return_int(&rdev->wiphy, ret);
1390
1391 return ret;
1392 }
1393
1394 static inline int
rdev_set_fils_aad(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_fils_aad * fils_aad)1395 rdev_set_fils_aad(struct cfg80211_registered_device *rdev,
1396 struct net_device *dev, struct cfg80211_fils_aad *fils_aad)
1397 {
1398 int ret = -EOPNOTSUPP;
1399
1400 trace_rdev_set_fils_aad(&rdev->wiphy, dev, fils_aad);
1401 if (rdev->ops->set_fils_aad)
1402 ret = rdev->ops->set_fils_aad(&rdev->wiphy, dev, fils_aad);
1403 trace_rdev_return_int(&rdev->wiphy, ret);
1404
1405 return ret;
1406 }
1407
1408 static inline int
rdev_set_radar_background(struct cfg80211_registered_device * rdev,struct cfg80211_chan_def * chandef)1409 rdev_set_radar_background(struct cfg80211_registered_device *rdev,
1410 struct cfg80211_chan_def *chandef)
1411 {
1412 struct wiphy *wiphy = &rdev->wiphy;
1413 int ret;
1414
1415 if (!rdev->ops->set_radar_background)
1416 return -EOPNOTSUPP;
1417
1418 trace_rdev_set_radar_background(wiphy, chandef);
1419 ret = rdev->ops->set_radar_background(wiphy, chandef);
1420 trace_rdev_return_int(wiphy, ret);
1421
1422 return ret;
1423 }
1424
1425 #endif /* __CFG80211_RDEV_OPS */
1426