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