xref: /openbmc/linux/net/wireless/rdev-ops.h (revision 3b12018d)
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 
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 
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 
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
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
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
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 
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
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 
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
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
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
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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
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
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 
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 
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 
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 
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 
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 
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
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
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 
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 
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 
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 
468 static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
469 			     struct net_device *dev,
470 			     struct cfg80211_assoc_request *req)
471 {
472 	int ret;
473 
474 	trace_rdev_assoc(&rdev->wiphy, dev, req);
475 	ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
476 	trace_rdev_return_int(&rdev->wiphy, ret);
477 	return ret;
478 }
479 
480 static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
481 			      struct net_device *dev,
482 			      struct cfg80211_deauth_request *req)
483 {
484 	int ret;
485 	trace_rdev_deauth(&rdev->wiphy, dev, req);
486 	ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
487 	trace_rdev_return_int(&rdev->wiphy, ret);
488 	return ret;
489 }
490 
491 static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
492 				struct net_device *dev,
493 				struct cfg80211_disassoc_request *req)
494 {
495 	int ret;
496 	trace_rdev_disassoc(&rdev->wiphy, dev, req);
497 	ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
498 	trace_rdev_return_int(&rdev->wiphy, ret);
499 	return ret;
500 }
501 
502 static inline int rdev_connect(struct cfg80211_registered_device *rdev,
503 			       struct net_device *dev,
504 			       struct cfg80211_connect_params *sme)
505 {
506 	int ret;
507 	trace_rdev_connect(&rdev->wiphy, dev, sme);
508 	ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
509 	trace_rdev_return_int(&rdev->wiphy, ret);
510 	return ret;
511 }
512 
513 static inline int
514 rdev_update_connect_params(struct cfg80211_registered_device *rdev,
515 			   struct net_device *dev,
516 			   struct cfg80211_connect_params *sme, u32 changed)
517 {
518 	int ret;
519 	trace_rdev_update_connect_params(&rdev->wiphy, dev, sme, changed);
520 	ret = rdev->ops->update_connect_params(&rdev->wiphy, dev, sme, changed);
521 	trace_rdev_return_int(&rdev->wiphy, ret);
522 	return ret;
523 }
524 
525 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
526 				  struct net_device *dev, u16 reason_code)
527 {
528 	int ret;
529 	trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
530 	ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
531 	trace_rdev_return_int(&rdev->wiphy, ret);
532 	return ret;
533 }
534 
535 static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
536 				 struct net_device *dev,
537 				 struct cfg80211_ibss_params *params)
538 {
539 	int ret;
540 	trace_rdev_join_ibss(&rdev->wiphy, dev, params);
541 	ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
542 	trace_rdev_return_int(&rdev->wiphy, ret);
543 	return ret;
544 }
545 
546 static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
547 				  struct net_device *dev)
548 {
549 	int ret;
550 	trace_rdev_leave_ibss(&rdev->wiphy, dev);
551 	ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
552 	trace_rdev_return_int(&rdev->wiphy, ret);
553 	return ret;
554 }
555 
556 static inline int
557 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
558 {
559 	int ret;
560 
561 	if (!rdev->ops->set_wiphy_params)
562 		return -EOPNOTSUPP;
563 
564 	trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
565 	ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
566 	trace_rdev_return_int(&rdev->wiphy, ret);
567 	return ret;
568 }
569 
570 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
571 				    struct wireless_dev *wdev,
572 				    enum nl80211_tx_power_setting type, int mbm)
573 {
574 	int ret;
575 	trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
576 	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
577 	trace_rdev_return_int(&rdev->wiphy, ret);
578 	return ret;
579 }
580 
581 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
582 				    struct wireless_dev *wdev, int *dbm)
583 {
584 	int ret;
585 	trace_rdev_get_tx_power(&rdev->wiphy, wdev);
586 	ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
587 	trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
588 	return ret;
589 }
590 
591 static inline int
592 rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
593 			      struct net_device *dev,
594 			      const bool enabled)
595 {
596 	int ret;
597 	trace_rdev_set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
598 	ret = rdev->ops->set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
599 	trace_rdev_return_int(&rdev->wiphy, ret);
600 	return ret;
601 }
602 
603 static inline int
604 rdev_get_txq_stats(struct cfg80211_registered_device *rdev,
605 		   struct wireless_dev *wdev,
606 		   struct cfg80211_txq_stats *txqstats)
607 {
608 	int ret;
609 	trace_rdev_get_txq_stats(&rdev->wiphy, wdev);
610 	ret = rdev->ops->get_txq_stats(&rdev->wiphy, wdev, txqstats);
611 	trace_rdev_return_int(&rdev->wiphy, ret);
612 	return ret;
613 }
614 
615 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
616 {
617 	trace_rdev_rfkill_poll(&rdev->wiphy);
618 	rdev->ops->rfkill_poll(&rdev->wiphy);
619 	trace_rdev_return_void(&rdev->wiphy);
620 }
621 
622 
623 #ifdef CONFIG_NL80211_TESTMODE
624 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
625 				    struct wireless_dev *wdev,
626 				    void *data, int len)
627 {
628 	int ret;
629 	trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
630 	ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
631 	trace_rdev_return_int(&rdev->wiphy, ret);
632 	return ret;
633 }
634 
635 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
636 				     struct sk_buff *skb,
637 				     struct netlink_callback *cb, void *data,
638 				     int len)
639 {
640 	int ret;
641 	trace_rdev_testmode_dump(&rdev->wiphy);
642 	ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
643 	trace_rdev_return_int(&rdev->wiphy, ret);
644 	return ret;
645 }
646 #endif
647 
648 static inline int
649 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
650 		      struct net_device *dev, unsigned int link_id,
651 		      const u8 *peer,
652 		      const struct cfg80211_bitrate_mask *mask)
653 {
654 	int ret;
655 	trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, link_id, peer, mask);
656 	ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, link_id,
657 					  peer, mask);
658 	trace_rdev_return_int(&rdev->wiphy, ret);
659 	return ret;
660 }
661 
662 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
663 				   struct net_device *netdev, int idx,
664 				   struct survey_info *info)
665 {
666 	int ret;
667 	trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
668 	ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
669 	if (ret < 0)
670 		trace_rdev_return_int(&rdev->wiphy, ret);
671 	else
672 		trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
673 	return ret;
674 }
675 
676 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
677 				 struct net_device *netdev,
678 				 struct cfg80211_pmksa *pmksa)
679 {
680 	int ret;
681 	trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
682 	ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
683 	trace_rdev_return_int(&rdev->wiphy, ret);
684 	return ret;
685 }
686 
687 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
688 				 struct net_device *netdev,
689 				 struct cfg80211_pmksa *pmksa)
690 {
691 	int ret;
692 	trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
693 	ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
694 	trace_rdev_return_int(&rdev->wiphy, ret);
695 	return ret;
696 }
697 
698 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
699 				   struct net_device *netdev)
700 {
701 	int ret;
702 	trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
703 	ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
704 	trace_rdev_return_int(&rdev->wiphy, ret);
705 	return ret;
706 }
707 
708 static inline int
709 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
710 		       struct wireless_dev *wdev,
711 		       struct ieee80211_channel *chan,
712 		       unsigned int duration, u64 *cookie)
713 {
714 	int ret;
715 	trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
716 	ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
717 					   duration, cookie);
718 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
719 	return ret;
720 }
721 
722 static inline int
723 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
724 			      struct wireless_dev *wdev, u64 cookie)
725 {
726 	int ret;
727 	trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
728 	ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
729 	trace_rdev_return_int(&rdev->wiphy, ret);
730 	return ret;
731 }
732 
733 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
734 			       struct wireless_dev *wdev,
735 			       struct cfg80211_mgmt_tx_params *params,
736 			       u64 *cookie)
737 {
738 	int ret;
739 	trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
740 	ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
741 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
742 	return ret;
743 }
744 
745 static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,
746 				       struct net_device *dev,
747 				       const void *buf, size_t len,
748 				       const u8 *dest, __be16 proto,
749 				       const bool noencrypt, int link,
750 				       u64 *cookie)
751 {
752 	int ret;
753 	trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,
754 				   dest, proto, noencrypt, link);
755 	ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,
756 					 dest, proto, noencrypt, link, cookie);
757 	if (cookie)
758 		trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
759 	else
760 		trace_rdev_return_int(&rdev->wiphy, ret);
761 	return ret;
762 }
763 
764 static inline int
765 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
766 			 struct wireless_dev *wdev, u64 cookie)
767 {
768 	int ret;
769 	trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
770 	ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
771 	trace_rdev_return_int(&rdev->wiphy, ret);
772 	return ret;
773 }
774 
775 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
776 				      struct net_device *dev, bool enabled,
777 				      int timeout)
778 {
779 	int ret;
780 	trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
781 	ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
782 	trace_rdev_return_int(&rdev->wiphy, ret);
783 	return ret;
784 }
785 
786 static inline int
787 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
788 			 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
789 {
790 	int ret;
791 	trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
792 				       rssi_hyst);
793 	ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
794 				       rssi_hyst);
795 	trace_rdev_return_int(&rdev->wiphy, ret);
796 	return ret;
797 }
798 
799 static inline int
800 rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device *rdev,
801 			       struct net_device *dev, s32 low, s32 high)
802 {
803 	int ret;
804 	trace_rdev_set_cqm_rssi_range_config(&rdev->wiphy, dev, low, high);
805 	ret = rdev->ops->set_cqm_rssi_range_config(&rdev->wiphy, dev,
806 						   low, high);
807 	trace_rdev_return_int(&rdev->wiphy, ret);
808 	return ret;
809 }
810 
811 static inline int
812 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
813 			struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
814 {
815 	int ret;
816 	trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
817 	ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
818 					     intvl);
819 	trace_rdev_return_int(&rdev->wiphy, ret);
820 	return ret;
821 }
822 
823 static inline void
824 rdev_update_mgmt_frame_registrations(struct cfg80211_registered_device *rdev,
825 				     struct wireless_dev *wdev,
826 				     struct mgmt_frame_regs *upd)
827 {
828 	might_sleep();
829 
830 	trace_rdev_update_mgmt_frame_registrations(&rdev->wiphy, wdev, upd);
831 	if (rdev->ops->update_mgmt_frame_registrations)
832 		rdev->ops->update_mgmt_frame_registrations(&rdev->wiphy, wdev,
833 							   upd);
834 	trace_rdev_return_void(&rdev->wiphy);
835 }
836 
837 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
838 				   u32 tx_ant, u32 rx_ant)
839 {
840 	int ret;
841 	trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
842 	ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
843 	trace_rdev_return_int(&rdev->wiphy, ret);
844 	return ret;
845 }
846 
847 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
848 				   u32 *tx_ant, u32 *rx_ant)
849 {
850 	int ret;
851 	trace_rdev_get_antenna(&rdev->wiphy);
852 	ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
853 	if (ret)
854 		trace_rdev_return_int(&rdev->wiphy, ret);
855 	else
856 		trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
857 					    *rx_ant);
858 	return ret;
859 }
860 
861 static inline int
862 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
863 		      struct net_device *dev,
864 		      struct cfg80211_sched_scan_request *request)
865 {
866 	int ret;
867 	trace_rdev_sched_scan_start(&rdev->wiphy, dev, request->reqid);
868 	ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
869 	trace_rdev_return_int(&rdev->wiphy, ret);
870 	return ret;
871 }
872 
873 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
874 				       struct net_device *dev, u64 reqid)
875 {
876 	int ret;
877 	trace_rdev_sched_scan_stop(&rdev->wiphy, dev, reqid);
878 	ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev, reqid);
879 	trace_rdev_return_int(&rdev->wiphy, ret);
880 	return ret;
881 }
882 
883 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
884 				      struct net_device *dev,
885 				      struct cfg80211_gtk_rekey_data *data)
886 {
887 	int ret;
888 	trace_rdev_set_rekey_data(&rdev->wiphy, dev);
889 	ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
890 	trace_rdev_return_int(&rdev->wiphy, ret);
891 	return ret;
892 }
893 
894 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
895 				 struct net_device *dev, u8 *peer,
896 				 u8 action_code, u8 dialog_token,
897 				 u16 status_code, u32 peer_capability,
898 				 bool initiator, const u8 *buf, size_t len)
899 {
900 	int ret;
901 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
902 			     dialog_token, status_code, peer_capability,
903 			     initiator, buf, len);
904 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
905 				   dialog_token, status_code, peer_capability,
906 				   initiator, buf, len);
907 	trace_rdev_return_int(&rdev->wiphy, ret);
908 	return ret;
909 }
910 
911 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
912 				 struct net_device *dev, u8 *peer,
913 				 enum nl80211_tdls_operation oper)
914 {
915 	int ret;
916 	trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
917 	ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
918 	trace_rdev_return_int(&rdev->wiphy, ret);
919 	return ret;
920 }
921 
922 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
923 				    struct net_device *dev, const u8 *peer,
924 				    u64 *cookie)
925 {
926 	int ret;
927 	trace_rdev_probe_client(&rdev->wiphy, dev, peer);
928 	ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
929 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
930 	return ret;
931 }
932 
933 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
934 				     struct net_device *dev, u16 noack_map)
935 {
936 	int ret;
937 	trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
938 	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
939 	trace_rdev_return_int(&rdev->wiphy, ret);
940 	return ret;
941 }
942 
943 static inline int
944 rdev_get_channel(struct cfg80211_registered_device *rdev,
945 		 struct wireless_dev *wdev,
946 		 unsigned int link_id,
947 		 struct cfg80211_chan_def *chandef)
948 {
949 	int ret;
950 
951 	trace_rdev_get_channel(&rdev->wiphy, wdev, link_id);
952 	ret = rdev->ops->get_channel(&rdev->wiphy, wdev, link_id, chandef);
953 	trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
954 
955 	return ret;
956 }
957 
958 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
959 					struct wireless_dev *wdev)
960 {
961 	int ret;
962 
963 	trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
964 	ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
965 	trace_rdev_return_int(&rdev->wiphy, ret);
966 	return ret;
967 }
968 
969 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
970 					struct wireless_dev *wdev)
971 {
972 	trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
973 	rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
974 	trace_rdev_return_void(&rdev->wiphy);
975 }
976 
977 static inline int rdev_start_nan(struct cfg80211_registered_device *rdev,
978 				 struct wireless_dev *wdev,
979 				 struct cfg80211_nan_conf *conf)
980 {
981 	int ret;
982 
983 	trace_rdev_start_nan(&rdev->wiphy, wdev, conf);
984 	ret = rdev->ops->start_nan(&rdev->wiphy, wdev, conf);
985 	trace_rdev_return_int(&rdev->wiphy, ret);
986 	return ret;
987 }
988 
989 static inline void rdev_stop_nan(struct cfg80211_registered_device *rdev,
990 				 struct wireless_dev *wdev)
991 {
992 	trace_rdev_stop_nan(&rdev->wiphy, wdev);
993 	rdev->ops->stop_nan(&rdev->wiphy, wdev);
994 	trace_rdev_return_void(&rdev->wiphy);
995 }
996 
997 static inline int
998 rdev_add_nan_func(struct cfg80211_registered_device *rdev,
999 		  struct wireless_dev *wdev,
1000 		  struct cfg80211_nan_func *nan_func)
1001 {
1002 	int ret;
1003 
1004 	trace_rdev_add_nan_func(&rdev->wiphy, wdev, nan_func);
1005 	ret = rdev->ops->add_nan_func(&rdev->wiphy, wdev, nan_func);
1006 	trace_rdev_return_int(&rdev->wiphy, ret);
1007 	return ret;
1008 }
1009 
1010 static inline void rdev_del_nan_func(struct cfg80211_registered_device *rdev,
1011 				    struct wireless_dev *wdev, u64 cookie)
1012 {
1013 	trace_rdev_del_nan_func(&rdev->wiphy, wdev, cookie);
1014 	rdev->ops->del_nan_func(&rdev->wiphy, wdev, cookie);
1015 	trace_rdev_return_void(&rdev->wiphy);
1016 }
1017 
1018 static inline int
1019 rdev_nan_change_conf(struct cfg80211_registered_device *rdev,
1020 		     struct wireless_dev *wdev,
1021 		     struct cfg80211_nan_conf *conf, u32 changes)
1022 {
1023 	int ret;
1024 
1025 	trace_rdev_nan_change_conf(&rdev->wiphy, wdev, conf, changes);
1026 	if (rdev->ops->nan_change_conf)
1027 		ret = rdev->ops->nan_change_conf(&rdev->wiphy, wdev, conf,
1028 						 changes);
1029 	else
1030 		ret = -ENOTSUPP;
1031 	trace_rdev_return_int(&rdev->wiphy, ret);
1032 	return ret;
1033 }
1034 
1035 static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
1036 				   struct net_device *dev,
1037 				   struct cfg80211_acl_data *params)
1038 {
1039 	int ret;
1040 
1041 	trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
1042 	ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
1043 	trace_rdev_return_int(&rdev->wiphy, ret);
1044 	return ret;
1045 }
1046 
1047 static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
1048 				     struct net_device *dev,
1049 				     struct cfg80211_update_ft_ies_params *ftie)
1050 {
1051 	int ret;
1052 
1053 	trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
1054 	ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
1055 	trace_rdev_return_int(&rdev->wiphy, ret);
1056 	return ret;
1057 }
1058 
1059 static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
1060 					struct wireless_dev *wdev,
1061 					enum nl80211_crit_proto_id protocol,
1062 					u16 duration)
1063 {
1064 	int ret;
1065 
1066 	trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
1067 	ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
1068 					  protocol, duration);
1069 	trace_rdev_return_int(&rdev->wiphy, ret);
1070 	return ret;
1071 }
1072 
1073 static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
1074 				       struct wireless_dev *wdev)
1075 {
1076 	trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
1077 	rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
1078 	trace_rdev_return_void(&rdev->wiphy);
1079 }
1080 
1081 static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
1082 				      struct net_device *dev,
1083 				      struct cfg80211_csa_settings *params)
1084 {
1085 	int ret;
1086 
1087 	trace_rdev_channel_switch(&rdev->wiphy, dev, params);
1088 	ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
1089 	trace_rdev_return_int(&rdev->wiphy, ret);
1090 	return ret;
1091 }
1092 
1093 static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
1094 				   struct net_device *dev,
1095 				   struct cfg80211_qos_map *qos_map)
1096 {
1097 	int ret = -EOPNOTSUPP;
1098 
1099 	if (rdev->ops->set_qos_map) {
1100 		trace_rdev_set_qos_map(&rdev->wiphy, dev, qos_map);
1101 		ret = rdev->ops->set_qos_map(&rdev->wiphy, dev, qos_map);
1102 		trace_rdev_return_int(&rdev->wiphy, ret);
1103 	}
1104 
1105 	return ret;
1106 }
1107 
1108 static inline int
1109 rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev,
1110 		      struct net_device *dev,
1111 		      unsigned int link_id,
1112 		      struct cfg80211_chan_def *chandef)
1113 {
1114 	int ret;
1115 
1116 	trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1117 	ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1118 	trace_rdev_return_int(&rdev->wiphy, ret);
1119 
1120 	return ret;
1121 }
1122 
1123 static inline int
1124 rdev_add_tx_ts(struct cfg80211_registered_device *rdev,
1125 	       struct net_device *dev, u8 tsid, const u8 *peer,
1126 	       u8 user_prio, u16 admitted_time)
1127 {
1128 	int ret = -EOPNOTSUPP;
1129 
1130 	trace_rdev_add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1131 			     user_prio, admitted_time);
1132 	if (rdev->ops->add_tx_ts)
1133 		ret = rdev->ops->add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1134 					   user_prio, admitted_time);
1135 	trace_rdev_return_int(&rdev->wiphy, ret);
1136 
1137 	return ret;
1138 }
1139 
1140 static inline int
1141 rdev_del_tx_ts(struct cfg80211_registered_device *rdev,
1142 	       struct net_device *dev, u8 tsid, const u8 *peer)
1143 {
1144 	int ret = -EOPNOTSUPP;
1145 
1146 	trace_rdev_del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1147 	if (rdev->ops->del_tx_ts)
1148 		ret = rdev->ops->del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1149 	trace_rdev_return_int(&rdev->wiphy, ret);
1150 
1151 	return ret;
1152 }
1153 
1154 static inline int
1155 rdev_tdls_channel_switch(struct cfg80211_registered_device *rdev,
1156 			 struct net_device *dev, const u8 *addr,
1157 			 u8 oper_class, struct cfg80211_chan_def *chandef)
1158 {
1159 	int ret;
1160 
1161 	trace_rdev_tdls_channel_switch(&rdev->wiphy, dev, addr, oper_class,
1162 				       chandef);
1163 	ret = rdev->ops->tdls_channel_switch(&rdev->wiphy, dev, addr,
1164 					     oper_class, chandef);
1165 	trace_rdev_return_int(&rdev->wiphy, ret);
1166 	return ret;
1167 }
1168 
1169 static inline void
1170 rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device *rdev,
1171 				struct net_device *dev, const u8 *addr)
1172 {
1173 	trace_rdev_tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1174 	rdev->ops->tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1175 	trace_rdev_return_void(&rdev->wiphy);
1176 }
1177 
1178 static inline int
1179 rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
1180 			   struct net_device *dev,
1181 			   struct cfg80211_chan_def *chandef,
1182 			   u32 cac_time_ms)
1183 {
1184 	int ret = -ENOTSUPP;
1185 
1186 	trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef,
1187 					 cac_time_ms);
1188 	if (rdev->ops->start_radar_detection)
1189 		ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev,
1190 						       chandef, cac_time_ms);
1191 	trace_rdev_return_int(&rdev->wiphy, ret);
1192 	return ret;
1193 }
1194 
1195 static inline void
1196 rdev_end_cac(struct cfg80211_registered_device *rdev,
1197 	     struct net_device *dev)
1198 {
1199 	trace_rdev_end_cac(&rdev->wiphy, dev);
1200 	if (rdev->ops->end_cac)
1201 		rdev->ops->end_cac(&rdev->wiphy, dev);
1202 	trace_rdev_return_void(&rdev->wiphy);
1203 }
1204 
1205 static inline int
1206 rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
1207 		    struct net_device *dev,
1208 		    int mcast_rate[NUM_NL80211_BANDS])
1209 {
1210 	int ret = -ENOTSUPP;
1211 
1212 	trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1213 	if (rdev->ops->set_mcast_rate)
1214 		ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1215 	trace_rdev_return_int(&rdev->wiphy, ret);
1216 	return ret;
1217 }
1218 
1219 static inline int
1220 rdev_set_coalesce(struct cfg80211_registered_device *rdev,
1221 		  struct cfg80211_coalesce *coalesce)
1222 {
1223 	int ret = -ENOTSUPP;
1224 
1225 	trace_rdev_set_coalesce(&rdev->wiphy, coalesce);
1226 	if (rdev->ops->set_coalesce)
1227 		ret = rdev->ops->set_coalesce(&rdev->wiphy, coalesce);
1228 	trace_rdev_return_int(&rdev->wiphy, ret);
1229 	return ret;
1230 }
1231 
1232 static inline int rdev_set_pmk(struct cfg80211_registered_device *rdev,
1233 			       struct net_device *dev,
1234 			       struct cfg80211_pmk_conf *pmk_conf)
1235 {
1236 	int ret = -EOPNOTSUPP;
1237 
1238 	trace_rdev_set_pmk(&rdev->wiphy, dev, pmk_conf);
1239 	if (rdev->ops->set_pmk)
1240 		ret = rdev->ops->set_pmk(&rdev->wiphy, dev, pmk_conf);
1241 	trace_rdev_return_int(&rdev->wiphy, ret);
1242 	return ret;
1243 }
1244 
1245 static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev,
1246 			       struct net_device *dev, const u8 *aa)
1247 {
1248 	int ret = -EOPNOTSUPP;
1249 
1250 	trace_rdev_del_pmk(&rdev->wiphy, dev, aa);
1251 	if (rdev->ops->del_pmk)
1252 		ret = rdev->ops->del_pmk(&rdev->wiphy, dev, aa);
1253 	trace_rdev_return_int(&rdev->wiphy, ret);
1254 	return ret;
1255 }
1256 
1257 static inline int
1258 rdev_external_auth(struct cfg80211_registered_device *rdev,
1259 		   struct net_device *dev,
1260 		   struct cfg80211_external_auth_params *params)
1261 {
1262 	int ret = -EOPNOTSUPP;
1263 
1264 	trace_rdev_external_auth(&rdev->wiphy, dev, params);
1265 	if (rdev->ops->external_auth)
1266 		ret = rdev->ops->external_auth(&rdev->wiphy, dev, params);
1267 	trace_rdev_return_int(&rdev->wiphy, ret);
1268 	return ret;
1269 }
1270 
1271 static inline int
1272 rdev_get_ftm_responder_stats(struct cfg80211_registered_device *rdev,
1273 			     struct net_device *dev,
1274 			     struct cfg80211_ftm_responder_stats *ftm_stats)
1275 {
1276 	int ret = -EOPNOTSUPP;
1277 
1278 	trace_rdev_get_ftm_responder_stats(&rdev->wiphy, dev, ftm_stats);
1279 	if (rdev->ops->get_ftm_responder_stats)
1280 		ret = rdev->ops->get_ftm_responder_stats(&rdev->wiphy, dev,
1281 							ftm_stats);
1282 	trace_rdev_return_int(&rdev->wiphy, ret);
1283 	return ret;
1284 }
1285 
1286 static inline int
1287 rdev_start_pmsr(struct cfg80211_registered_device *rdev,
1288 		struct wireless_dev *wdev,
1289 		struct cfg80211_pmsr_request *request)
1290 {
1291 	int ret = -EOPNOTSUPP;
1292 
1293 	trace_rdev_start_pmsr(&rdev->wiphy, wdev, request->cookie);
1294 	if (rdev->ops->start_pmsr)
1295 		ret = rdev->ops->start_pmsr(&rdev->wiphy, wdev, request);
1296 	trace_rdev_return_int(&rdev->wiphy, ret);
1297 	return ret;
1298 }
1299 
1300 static inline void
1301 rdev_abort_pmsr(struct cfg80211_registered_device *rdev,
1302 		struct wireless_dev *wdev,
1303 		struct cfg80211_pmsr_request *request)
1304 {
1305 	trace_rdev_abort_pmsr(&rdev->wiphy, wdev, request->cookie);
1306 	if (rdev->ops->abort_pmsr)
1307 		rdev->ops->abort_pmsr(&rdev->wiphy, wdev, request);
1308 	trace_rdev_return_void(&rdev->wiphy);
1309 }
1310 
1311 static inline int rdev_update_owe_info(struct cfg80211_registered_device *rdev,
1312 				       struct net_device *dev,
1313 				       struct cfg80211_update_owe_info *oweinfo)
1314 {
1315 	int ret = -EOPNOTSUPP;
1316 
1317 	trace_rdev_update_owe_info(&rdev->wiphy, dev, oweinfo);
1318 	if (rdev->ops->update_owe_info)
1319 		ret = rdev->ops->update_owe_info(&rdev->wiphy, dev, oweinfo);
1320 	trace_rdev_return_int(&rdev->wiphy, ret);
1321 	return ret;
1322 }
1323 
1324 static inline int
1325 rdev_probe_mesh_link(struct cfg80211_registered_device *rdev,
1326 		     struct net_device *dev, const u8 *dest,
1327 		     const void *buf, size_t len)
1328 {
1329 	int ret;
1330 
1331 	trace_rdev_probe_mesh_link(&rdev->wiphy, dev, dest, buf, len);
1332 	ret = rdev->ops->probe_mesh_link(&rdev->wiphy, dev, buf, len);
1333 	trace_rdev_return_int(&rdev->wiphy, ret);
1334 	return ret;
1335 }
1336 
1337 static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev,
1338 				      struct net_device *dev,
1339 				      struct cfg80211_tid_config *tid_conf)
1340 {
1341 	int ret;
1342 
1343 	trace_rdev_set_tid_config(&rdev->wiphy, dev, tid_conf);
1344 	ret = rdev->ops->set_tid_config(&rdev->wiphy, dev, tid_conf);
1345 	trace_rdev_return_int(&rdev->wiphy, ret);
1346 	return ret;
1347 }
1348 
1349 static inline int rdev_reset_tid_config(struct cfg80211_registered_device *rdev,
1350 					struct net_device *dev, const u8 *peer,
1351 					u8 tids)
1352 {
1353 	int ret;
1354 
1355 	trace_rdev_reset_tid_config(&rdev->wiphy, dev, peer, tids);
1356 	ret = rdev->ops->reset_tid_config(&rdev->wiphy, dev, peer, tids);
1357 	trace_rdev_return_int(&rdev->wiphy, ret);
1358 	return ret;
1359 }
1360 
1361 static inline int rdev_set_sar_specs(struct cfg80211_registered_device *rdev,
1362 				     struct cfg80211_sar_specs *sar)
1363 {
1364 	int ret;
1365 
1366 	trace_rdev_set_sar_specs(&rdev->wiphy, sar);
1367 	ret = rdev->ops->set_sar_specs(&rdev->wiphy, sar);
1368 	trace_rdev_return_int(&rdev->wiphy, ret);
1369 
1370 	return ret;
1371 }
1372 
1373 static inline int rdev_color_change(struct cfg80211_registered_device *rdev,
1374 				    struct net_device *dev,
1375 				    struct cfg80211_color_change_settings *params)
1376 {
1377 	int ret;
1378 
1379 	trace_rdev_color_change(&rdev->wiphy, dev, params);
1380 	ret = rdev->ops->color_change(&rdev->wiphy, dev, params);
1381 	trace_rdev_return_int(&rdev->wiphy, ret);
1382 
1383 	return ret;
1384 }
1385 
1386 static inline int
1387 rdev_set_fils_aad(struct cfg80211_registered_device *rdev,
1388 		  struct net_device *dev, struct cfg80211_fils_aad *fils_aad)
1389 {
1390 	int ret = -EOPNOTSUPP;
1391 
1392 	trace_rdev_set_fils_aad(&rdev->wiphy, dev, fils_aad);
1393 	if (rdev->ops->set_fils_aad)
1394 		ret = rdev->ops->set_fils_aad(&rdev->wiphy, dev, fils_aad);
1395 	trace_rdev_return_int(&rdev->wiphy, ret);
1396 
1397 	return ret;
1398 }
1399 
1400 static inline int
1401 rdev_set_radar_background(struct cfg80211_registered_device *rdev,
1402 			  struct cfg80211_chan_def *chandef)
1403 {
1404 	struct wiphy *wiphy = &rdev->wiphy;
1405 	int ret;
1406 
1407 	if (!rdev->ops->set_radar_background)
1408 		return -EOPNOTSUPP;
1409 
1410 	trace_rdev_set_radar_background(wiphy, chandef);
1411 	ret = rdev->ops->set_radar_background(wiphy, chandef);
1412 	trace_rdev_return_int(wiphy, ret);
1413 
1414 	return ret;
1415 }
1416 
1417 static inline int
1418 rdev_add_intf_link(struct cfg80211_registered_device *rdev,
1419 		   struct wireless_dev *wdev,
1420 		   unsigned int link_id)
1421 {
1422 	int ret = 0;
1423 
1424 	trace_rdev_add_intf_link(&rdev->wiphy, wdev, link_id);
1425 	if (rdev->ops->add_intf_link)
1426 		ret = rdev->ops->add_intf_link(&rdev->wiphy, wdev, link_id);
1427 	trace_rdev_return_int(&rdev->wiphy, ret);
1428 
1429 	return ret;
1430 }
1431 
1432 static inline void
1433 rdev_del_intf_link(struct cfg80211_registered_device *rdev,
1434 		   struct wireless_dev *wdev,
1435 		   unsigned int link_id)
1436 {
1437 	trace_rdev_del_intf_link(&rdev->wiphy, wdev, link_id);
1438 	if (rdev->ops->add_intf_link)
1439 		rdev->ops->add_intf_link(&rdev->wiphy, wdev, link_id);
1440 	trace_rdev_return_void(&rdev->wiphy);
1441 }
1442 
1443 static inline int
1444 rdev_add_link_station(struct cfg80211_registered_device *rdev,
1445 		      struct net_device *dev,
1446 		      struct link_station_parameters *params)
1447 {
1448 	int ret;
1449 
1450 	if (!rdev->ops->add_link_station)
1451 		return -EOPNOTSUPP;
1452 
1453 	trace_rdev_add_link_station(&rdev->wiphy, dev, params);
1454 	ret = rdev->ops->add_link_station(&rdev->wiphy, dev, params);
1455 	trace_rdev_return_int(&rdev->wiphy, ret);
1456 	return ret;
1457 }
1458 
1459 static inline int
1460 rdev_mod_link_station(struct cfg80211_registered_device *rdev,
1461 		      struct net_device *dev,
1462 		      struct link_station_parameters *params)
1463 {
1464 	int ret;
1465 
1466 	if (!rdev->ops->mod_link_station)
1467 		return -EOPNOTSUPP;
1468 
1469 	trace_rdev_mod_link_station(&rdev->wiphy, dev, params);
1470 	ret = rdev->ops->mod_link_station(&rdev->wiphy, dev, params);
1471 	trace_rdev_return_int(&rdev->wiphy, ret);
1472 	return ret;
1473 }
1474 
1475 static inline int
1476 rdev_del_link_station(struct cfg80211_registered_device *rdev,
1477 		      struct net_device *dev,
1478 		      struct link_station_del_parameters *params)
1479 {
1480 	int ret;
1481 
1482 	if (!rdev->ops->del_link_station)
1483 		return -EOPNOTSUPP;
1484 
1485 	trace_rdev_del_link_station(&rdev->wiphy, dev, params);
1486 	ret = rdev->ops->del_link_station(&rdev->wiphy, dev, params);
1487 	trace_rdev_return_int(&rdev->wiphy, ret);
1488 	return ret;
1489 }
1490 
1491 #endif /* __CFG80211_RDEV_OPS */
1492