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