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