xtensa: support DMA buffers in high memory
[cris-mirror.git] / net / wireless / rdev-ops.h
blob0c06240d25afc9da33ddd23c09c719cd2c06ebce
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __CFG80211_RDEV_OPS
3 #define __CFG80211_RDEV_OPS
5 #include <linux/rtnetlink.h>
6 #include <net/cfg80211.h>
7 #include "core.h"
8 #include "trace.h"
10 static inline int rdev_suspend(struct cfg80211_registered_device *rdev,
11 struct cfg80211_wowlan *wowlan)
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;
20 static inline int rdev_resume(struct cfg80211_registered_device *rdev)
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;
29 static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
30 bool enabled)
32 trace_rdev_set_wakeup(&rdev->wiphy, enabled);
33 rdev->ops->set_wakeup(&rdev->wiphy, enabled);
34 trace_rdev_return_void(&rdev->wiphy);
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)
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;
51 static inline int
52 rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
53 struct wireless_dev *wdev)
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;
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)
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;
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)
79 int ret;
80 trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
81 ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
82 mac_addr, params);
83 trace_rdev_return_int(&rdev->wiphy, ret);
84 return ret;
87 static inline int
88 rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
89 u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
90 void (*callback)(void *cookie, struct key_params*))
92 int ret;
93 trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
94 ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
95 mac_addr, cookie, callback);
96 trace_rdev_return_int(&rdev->wiphy, ret);
97 return ret;
100 static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
101 struct net_device *netdev, u8 key_index,
102 bool pairwise, const u8 *mac_addr)
104 int ret;
105 trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
106 ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
107 mac_addr);
108 trace_rdev_return_int(&rdev->wiphy, ret);
109 return ret;
112 static inline int
113 rdev_set_default_key(struct cfg80211_registered_device *rdev,
114 struct net_device *netdev, u8 key_index, bool unicast,
115 bool multicast)
117 int ret;
118 trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
119 unicast, multicast);
120 ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
121 unicast, multicast);
122 trace_rdev_return_int(&rdev->wiphy, ret);
123 return ret;
126 static inline int
127 rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
128 struct net_device *netdev, u8 key_index)
130 int ret;
131 trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
132 ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
133 key_index);
134 trace_rdev_return_int(&rdev->wiphy, ret);
135 return ret;
138 static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
139 struct net_device *dev,
140 struct cfg80211_ap_settings *settings)
142 int ret;
143 trace_rdev_start_ap(&rdev->wiphy, dev, settings);
144 ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
145 trace_rdev_return_int(&rdev->wiphy, ret);
146 return ret;
149 static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
150 struct net_device *dev,
151 struct cfg80211_beacon_data *info)
153 int ret;
154 trace_rdev_change_beacon(&rdev->wiphy, dev, info);
155 ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
156 trace_rdev_return_int(&rdev->wiphy, ret);
157 return ret;
160 static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
161 struct net_device *dev)
163 int ret;
164 trace_rdev_stop_ap(&rdev->wiphy, dev);
165 ret = rdev->ops->stop_ap(&rdev->wiphy, dev);
166 trace_rdev_return_int(&rdev->wiphy, ret);
167 return ret;
170 static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
171 struct net_device *dev, u8 *mac,
172 struct station_parameters *params)
174 int ret;
175 trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
176 ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
177 trace_rdev_return_int(&rdev->wiphy, ret);
178 return ret;
181 static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
182 struct net_device *dev,
183 struct station_del_parameters *params)
185 int ret;
186 trace_rdev_del_station(&rdev->wiphy, dev, params);
187 ret = rdev->ops->del_station(&rdev->wiphy, dev, params);
188 trace_rdev_return_int(&rdev->wiphy, ret);
189 return ret;
192 static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
193 struct net_device *dev, u8 *mac,
194 struct station_parameters *params)
196 int ret;
197 trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
198 ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
199 trace_rdev_return_int(&rdev->wiphy, ret);
200 return ret;
203 static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
204 struct net_device *dev, const u8 *mac,
205 struct station_info *sinfo)
207 int ret;
208 trace_rdev_get_station(&rdev->wiphy, dev, mac);
209 ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
210 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
211 return ret;
214 static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
215 struct net_device *dev, int idx, u8 *mac,
216 struct station_info *sinfo)
218 int ret;
219 trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
220 ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
221 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
222 return ret;
225 static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
226 struct net_device *dev, u8 *dst, u8 *next_hop)
228 int ret;
229 trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
230 ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
231 trace_rdev_return_int(&rdev->wiphy, ret);
232 return ret;
235 static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
236 struct net_device *dev, u8 *dst)
238 int ret;
239 trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
240 ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
241 trace_rdev_return_int(&rdev->wiphy, ret);
242 return ret;
245 static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
246 struct net_device *dev, u8 *dst,
247 u8 *next_hop)
249 int ret;
250 trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
251 ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
252 trace_rdev_return_int(&rdev->wiphy, ret);
253 return ret;
256 static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
257 struct net_device *dev, u8 *dst, u8 *next_hop,
258 struct mpath_info *pinfo)
260 int ret;
261 trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
262 ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
263 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
264 return ret;
268 static inline int rdev_get_mpp(struct cfg80211_registered_device *rdev,
269 struct net_device *dev, u8 *dst, u8 *mpp,
270 struct mpath_info *pinfo)
272 int ret;
274 trace_rdev_get_mpp(&rdev->wiphy, dev, dst, mpp);
275 ret = rdev->ops->get_mpp(&rdev->wiphy, dev, dst, mpp, pinfo);
276 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
277 return ret;
280 static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
281 struct net_device *dev, int idx, u8 *dst,
282 u8 *next_hop, struct mpath_info *pinfo)
285 int ret;
286 trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
287 ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
288 pinfo);
289 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
290 return ret;
293 static inline int rdev_dump_mpp(struct cfg80211_registered_device *rdev,
294 struct net_device *dev, int idx, u8 *dst,
295 u8 *mpp, struct mpath_info *pinfo)
298 int ret;
300 trace_rdev_dump_mpp(&rdev->wiphy, dev, idx, dst, mpp);
301 ret = rdev->ops->dump_mpp(&rdev->wiphy, dev, idx, dst, mpp, pinfo);
302 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
303 return ret;
306 static inline int
307 rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
308 struct net_device *dev, struct mesh_config *conf)
310 int ret;
311 trace_rdev_get_mesh_config(&rdev->wiphy, dev);
312 ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
313 trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
314 return ret;
317 static inline int
318 rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
319 struct net_device *dev, u32 mask,
320 const struct mesh_config *nconf)
322 int ret;
323 trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
324 ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
325 trace_rdev_return_int(&rdev->wiphy, ret);
326 return ret;
329 static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
330 struct net_device *dev,
331 const struct mesh_config *conf,
332 const struct mesh_setup *setup)
334 int ret;
335 trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
336 ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
337 trace_rdev_return_int(&rdev->wiphy, ret);
338 return ret;
342 static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
343 struct net_device *dev)
345 int ret;
346 trace_rdev_leave_mesh(&rdev->wiphy, dev);
347 ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
348 trace_rdev_return_int(&rdev->wiphy, ret);
349 return ret;
352 static inline int rdev_join_ocb(struct cfg80211_registered_device *rdev,
353 struct net_device *dev,
354 struct ocb_setup *setup)
356 int ret;
357 trace_rdev_join_ocb(&rdev->wiphy, dev, setup);
358 ret = rdev->ops->join_ocb(&rdev->wiphy, dev, setup);
359 trace_rdev_return_int(&rdev->wiphy, ret);
360 return ret;
363 static inline int rdev_leave_ocb(struct cfg80211_registered_device *rdev,
364 struct net_device *dev)
366 int ret;
367 trace_rdev_leave_ocb(&rdev->wiphy, dev);
368 ret = rdev->ops->leave_ocb(&rdev->wiphy, dev);
369 trace_rdev_return_int(&rdev->wiphy, ret);
370 return ret;
373 static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
374 struct net_device *dev,
375 struct bss_parameters *params)
378 int ret;
379 trace_rdev_change_bss(&rdev->wiphy, dev, params);
380 ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
381 trace_rdev_return_int(&rdev->wiphy, ret);
382 return ret;
385 static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
386 struct net_device *dev,
387 struct ieee80211_txq_params *params)
390 int ret;
391 trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
392 ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
393 trace_rdev_return_int(&rdev->wiphy, ret);
394 return ret;
397 static inline int
398 rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
399 struct net_device *dev,
400 struct ieee80211_channel *chan)
402 int ret;
403 trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
404 ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
405 trace_rdev_return_int(&rdev->wiphy, ret);
406 return ret;
409 static inline int
410 rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
411 struct cfg80211_chan_def *chandef)
413 int ret;
414 trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
415 ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
416 trace_rdev_return_int(&rdev->wiphy, ret);
417 return ret;
420 static inline int rdev_scan(struct cfg80211_registered_device *rdev,
421 struct cfg80211_scan_request *request)
423 int ret;
424 trace_rdev_scan(&rdev->wiphy, request);
425 ret = rdev->ops->scan(&rdev->wiphy, request);
426 trace_rdev_return_int(&rdev->wiphy, ret);
427 return ret;
430 static inline void rdev_abort_scan(struct cfg80211_registered_device *rdev,
431 struct wireless_dev *wdev)
433 trace_rdev_abort_scan(&rdev->wiphy, wdev);
434 rdev->ops->abort_scan(&rdev->wiphy, wdev);
435 trace_rdev_return_void(&rdev->wiphy);
438 static inline int rdev_auth(struct cfg80211_registered_device *rdev,
439 struct net_device *dev,
440 struct cfg80211_auth_request *req)
442 int ret;
443 trace_rdev_auth(&rdev->wiphy, dev, req);
444 ret = rdev->ops->auth(&rdev->wiphy, dev, req);
445 trace_rdev_return_int(&rdev->wiphy, ret);
446 return ret;
449 static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
450 struct net_device *dev,
451 struct cfg80211_assoc_request *req)
453 int ret;
454 trace_rdev_assoc(&rdev->wiphy, dev, req);
455 ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
456 trace_rdev_return_int(&rdev->wiphy, ret);
457 return ret;
460 static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
461 struct net_device *dev,
462 struct cfg80211_deauth_request *req)
464 int ret;
465 trace_rdev_deauth(&rdev->wiphy, dev, req);
466 ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
467 trace_rdev_return_int(&rdev->wiphy, ret);
468 return ret;
471 static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
472 struct net_device *dev,
473 struct cfg80211_disassoc_request *req)
475 int ret;
476 trace_rdev_disassoc(&rdev->wiphy, dev, req);
477 ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
478 trace_rdev_return_int(&rdev->wiphy, ret);
479 return ret;
482 static inline int rdev_connect(struct cfg80211_registered_device *rdev,
483 struct net_device *dev,
484 struct cfg80211_connect_params *sme)
486 int ret;
487 trace_rdev_connect(&rdev->wiphy, dev, sme);
488 ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
489 trace_rdev_return_int(&rdev->wiphy, ret);
490 return ret;
493 static inline int
494 rdev_update_connect_params(struct cfg80211_registered_device *rdev,
495 struct net_device *dev,
496 struct cfg80211_connect_params *sme, u32 changed)
498 int ret;
499 trace_rdev_update_connect_params(&rdev->wiphy, dev, sme, changed);
500 ret = rdev->ops->update_connect_params(&rdev->wiphy, dev, sme, changed);
501 trace_rdev_return_int(&rdev->wiphy, ret);
502 return ret;
505 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
506 struct net_device *dev, u16 reason_code)
508 int ret;
509 trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
510 ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
511 trace_rdev_return_int(&rdev->wiphy, ret);
512 return ret;
515 static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
516 struct net_device *dev,
517 struct cfg80211_ibss_params *params)
519 int ret;
520 trace_rdev_join_ibss(&rdev->wiphy, dev, params);
521 ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
522 trace_rdev_return_int(&rdev->wiphy, ret);
523 return ret;
526 static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
527 struct net_device *dev)
529 int ret;
530 trace_rdev_leave_ibss(&rdev->wiphy, dev);
531 ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
532 trace_rdev_return_int(&rdev->wiphy, ret);
533 return ret;
536 static inline int
537 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
539 int ret;
540 trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
541 ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
542 trace_rdev_return_int(&rdev->wiphy, ret);
543 return ret;
546 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
547 struct wireless_dev *wdev,
548 enum nl80211_tx_power_setting type, int mbm)
550 int ret;
551 trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
552 ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
553 trace_rdev_return_int(&rdev->wiphy, ret);
554 return ret;
557 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
558 struct wireless_dev *wdev, int *dbm)
560 int ret;
561 trace_rdev_get_tx_power(&rdev->wiphy, wdev);
562 ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
563 trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
564 return ret;
567 static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
568 struct net_device *dev, const u8 *addr)
570 int ret;
571 trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
572 ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
573 trace_rdev_return_int(&rdev->wiphy, ret);
574 return ret;
577 static inline int
578 rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
579 struct net_device *dev,
580 const bool enabled)
582 int ret;
583 trace_rdev_set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
584 ret = rdev->ops->set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
585 trace_rdev_return_int(&rdev->wiphy, ret);
586 return ret;
589 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
591 trace_rdev_rfkill_poll(&rdev->wiphy);
592 rdev->ops->rfkill_poll(&rdev->wiphy);
593 trace_rdev_return_void(&rdev->wiphy);
597 #ifdef CONFIG_NL80211_TESTMODE
598 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
599 struct wireless_dev *wdev,
600 void *data, int len)
602 int ret;
603 trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
604 ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
605 trace_rdev_return_int(&rdev->wiphy, ret);
606 return ret;
609 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
610 struct sk_buff *skb,
611 struct netlink_callback *cb, void *data,
612 int len)
614 int ret;
615 trace_rdev_testmode_dump(&rdev->wiphy);
616 ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
617 trace_rdev_return_int(&rdev->wiphy, ret);
618 return ret;
620 #endif
622 static inline int
623 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
624 struct net_device *dev, const u8 *peer,
625 const struct cfg80211_bitrate_mask *mask)
627 int ret;
628 trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
629 ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
630 trace_rdev_return_int(&rdev->wiphy, ret);
631 return ret;
634 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
635 struct net_device *netdev, int idx,
636 struct survey_info *info)
638 int ret;
639 trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
640 ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
641 if (ret < 0)
642 trace_rdev_return_int(&rdev->wiphy, ret);
643 else
644 trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
645 return ret;
648 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
649 struct net_device *netdev,
650 struct cfg80211_pmksa *pmksa)
652 int ret;
653 trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
654 ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
655 trace_rdev_return_int(&rdev->wiphy, ret);
656 return ret;
659 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
660 struct net_device *netdev,
661 struct cfg80211_pmksa *pmksa)
663 int ret;
664 trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
665 ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
666 trace_rdev_return_int(&rdev->wiphy, ret);
667 return ret;
670 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
671 struct net_device *netdev)
673 int ret;
674 trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
675 ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
676 trace_rdev_return_int(&rdev->wiphy, ret);
677 return ret;
680 static inline int
681 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
682 struct wireless_dev *wdev,
683 struct ieee80211_channel *chan,
684 unsigned int duration, u64 *cookie)
686 int ret;
687 trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
688 ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
689 duration, cookie);
690 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
691 return ret;
694 static inline int
695 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
696 struct wireless_dev *wdev, u64 cookie)
698 int ret;
699 trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
700 ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
701 trace_rdev_return_int(&rdev->wiphy, ret);
702 return ret;
705 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
706 struct wireless_dev *wdev,
707 struct cfg80211_mgmt_tx_params *params,
708 u64 *cookie)
710 int ret;
711 trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
712 ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
713 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
714 return ret;
717 static inline int
718 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
719 struct wireless_dev *wdev, u64 cookie)
721 int ret;
722 trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
723 ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
724 trace_rdev_return_int(&rdev->wiphy, ret);
725 return ret;
728 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
729 struct net_device *dev, bool enabled,
730 int timeout)
732 int ret;
733 trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
734 ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
735 trace_rdev_return_int(&rdev->wiphy, ret);
736 return ret;
739 static inline int
740 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
741 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
743 int ret;
744 trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
745 rssi_hyst);
746 ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
747 rssi_hyst);
748 trace_rdev_return_int(&rdev->wiphy, ret);
749 return ret;
752 static inline int
753 rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device *rdev,
754 struct net_device *dev, s32 low, s32 high)
756 int ret;
757 trace_rdev_set_cqm_rssi_range_config(&rdev->wiphy, dev, low, high);
758 ret = rdev->ops->set_cqm_rssi_range_config(&rdev->wiphy, dev,
759 low, high);
760 trace_rdev_return_int(&rdev->wiphy, ret);
761 return ret;
764 static inline int
765 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
766 struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
768 int ret;
769 trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
770 ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
771 intvl);
772 trace_rdev_return_int(&rdev->wiphy, ret);
773 return ret;
776 static inline void
777 rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
778 struct wireless_dev *wdev, u16 frame_type, bool reg)
780 might_sleep();
782 trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
783 rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
784 trace_rdev_return_void(&rdev->wiphy);
787 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
788 u32 tx_ant, u32 rx_ant)
790 int ret;
791 trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
792 ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
793 trace_rdev_return_int(&rdev->wiphy, ret);
794 return ret;
797 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
798 u32 *tx_ant, u32 *rx_ant)
800 int ret;
801 trace_rdev_get_antenna(&rdev->wiphy);
802 ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
803 if (ret)
804 trace_rdev_return_int(&rdev->wiphy, ret);
805 else
806 trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
807 *rx_ant);
808 return ret;
811 static inline int
812 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
813 struct net_device *dev,
814 struct cfg80211_sched_scan_request *request)
816 int ret;
817 trace_rdev_sched_scan_start(&rdev->wiphy, dev, request->reqid);
818 ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
819 trace_rdev_return_int(&rdev->wiphy, ret);
820 return ret;
823 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
824 struct net_device *dev, u64 reqid)
826 int ret;
827 trace_rdev_sched_scan_stop(&rdev->wiphy, dev, reqid);
828 ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev, reqid);
829 trace_rdev_return_int(&rdev->wiphy, ret);
830 return ret;
833 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
834 struct net_device *dev,
835 struct cfg80211_gtk_rekey_data *data)
837 int ret;
838 trace_rdev_set_rekey_data(&rdev->wiphy, dev);
839 ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
840 trace_rdev_return_int(&rdev->wiphy, ret);
841 return ret;
844 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
845 struct net_device *dev, u8 *peer,
846 u8 action_code, u8 dialog_token,
847 u16 status_code, u32 peer_capability,
848 bool initiator, const u8 *buf, size_t len)
850 int ret;
851 trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
852 dialog_token, status_code, peer_capability,
853 initiator, buf, len);
854 ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
855 dialog_token, status_code, peer_capability,
856 initiator, buf, len);
857 trace_rdev_return_int(&rdev->wiphy, ret);
858 return ret;
861 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
862 struct net_device *dev, u8 *peer,
863 enum nl80211_tdls_operation oper)
865 int ret;
866 trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
867 ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
868 trace_rdev_return_int(&rdev->wiphy, ret);
869 return ret;
872 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
873 struct net_device *dev, const u8 *peer,
874 u64 *cookie)
876 int ret;
877 trace_rdev_probe_client(&rdev->wiphy, dev, peer);
878 ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
879 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
880 return ret;
883 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
884 struct net_device *dev, u16 noack_map)
886 int ret;
887 trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
888 ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
889 trace_rdev_return_int(&rdev->wiphy, ret);
890 return ret;
893 static inline int
894 rdev_get_channel(struct cfg80211_registered_device *rdev,
895 struct wireless_dev *wdev,
896 struct cfg80211_chan_def *chandef)
898 int ret;
900 trace_rdev_get_channel(&rdev->wiphy, wdev);
901 ret = rdev->ops->get_channel(&rdev->wiphy, wdev, chandef);
902 trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
904 return ret;
907 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
908 struct wireless_dev *wdev)
910 int ret;
912 trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
913 ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
914 trace_rdev_return_int(&rdev->wiphy, ret);
915 return ret;
918 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
919 struct wireless_dev *wdev)
921 trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
922 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
923 trace_rdev_return_void(&rdev->wiphy);
926 static inline int rdev_start_nan(struct cfg80211_registered_device *rdev,
927 struct wireless_dev *wdev,
928 struct cfg80211_nan_conf *conf)
930 int ret;
932 trace_rdev_start_nan(&rdev->wiphy, wdev, conf);
933 ret = rdev->ops->start_nan(&rdev->wiphy, wdev, conf);
934 trace_rdev_return_int(&rdev->wiphy, ret);
935 return ret;
938 static inline void rdev_stop_nan(struct cfg80211_registered_device *rdev,
939 struct wireless_dev *wdev)
941 trace_rdev_stop_nan(&rdev->wiphy, wdev);
942 rdev->ops->stop_nan(&rdev->wiphy, wdev);
943 trace_rdev_return_void(&rdev->wiphy);
946 static inline int
947 rdev_add_nan_func(struct cfg80211_registered_device *rdev,
948 struct wireless_dev *wdev,
949 struct cfg80211_nan_func *nan_func)
951 int ret;
953 trace_rdev_add_nan_func(&rdev->wiphy, wdev, nan_func);
954 ret = rdev->ops->add_nan_func(&rdev->wiphy, wdev, nan_func);
955 trace_rdev_return_int(&rdev->wiphy, ret);
956 return ret;
959 static inline void rdev_del_nan_func(struct cfg80211_registered_device *rdev,
960 struct wireless_dev *wdev, u64 cookie)
962 trace_rdev_del_nan_func(&rdev->wiphy, wdev, cookie);
963 rdev->ops->del_nan_func(&rdev->wiphy, wdev, cookie);
964 trace_rdev_return_void(&rdev->wiphy);
967 static inline int
968 rdev_nan_change_conf(struct cfg80211_registered_device *rdev,
969 struct wireless_dev *wdev,
970 struct cfg80211_nan_conf *conf, u32 changes)
972 int ret;
974 trace_rdev_nan_change_conf(&rdev->wiphy, wdev, conf, changes);
975 if (rdev->ops->nan_change_conf)
976 ret = rdev->ops->nan_change_conf(&rdev->wiphy, wdev, conf,
977 changes);
978 else
979 ret = -ENOTSUPP;
980 trace_rdev_return_int(&rdev->wiphy, ret);
981 return ret;
984 static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
985 struct net_device *dev,
986 struct cfg80211_acl_data *params)
988 int ret;
990 trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
991 ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
992 trace_rdev_return_int(&rdev->wiphy, ret);
993 return ret;
996 static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
997 struct net_device *dev,
998 struct cfg80211_update_ft_ies_params *ftie)
1000 int ret;
1002 trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
1003 ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
1004 trace_rdev_return_int(&rdev->wiphy, ret);
1005 return ret;
1008 static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
1009 struct wireless_dev *wdev,
1010 enum nl80211_crit_proto_id protocol,
1011 u16 duration)
1013 int ret;
1015 trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
1016 ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
1017 protocol, duration);
1018 trace_rdev_return_int(&rdev->wiphy, ret);
1019 return ret;
1022 static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
1023 struct wireless_dev *wdev)
1025 trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
1026 rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
1027 trace_rdev_return_void(&rdev->wiphy);
1030 static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
1031 struct net_device *dev,
1032 struct cfg80211_csa_settings *params)
1034 int ret;
1036 trace_rdev_channel_switch(&rdev->wiphy, dev, params);
1037 ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
1038 trace_rdev_return_int(&rdev->wiphy, ret);
1039 return ret;
1042 static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
1043 struct net_device *dev,
1044 struct cfg80211_qos_map *qos_map)
1046 int ret = -EOPNOTSUPP;
1048 if (rdev->ops->set_qos_map) {
1049 trace_rdev_set_qos_map(&rdev->wiphy, dev, qos_map);
1050 ret = rdev->ops->set_qos_map(&rdev->wiphy, dev, qos_map);
1051 trace_rdev_return_int(&rdev->wiphy, ret);
1054 return ret;
1057 static inline int
1058 rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev,
1059 struct net_device *dev, struct cfg80211_chan_def *chandef)
1061 int ret;
1063 trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, chandef);
1064 ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, chandef);
1065 trace_rdev_return_int(&rdev->wiphy, ret);
1067 return ret;
1070 static inline int
1071 rdev_add_tx_ts(struct cfg80211_registered_device *rdev,
1072 struct net_device *dev, u8 tsid, const u8 *peer,
1073 u8 user_prio, u16 admitted_time)
1075 int ret = -EOPNOTSUPP;
1077 trace_rdev_add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1078 user_prio, admitted_time);
1079 if (rdev->ops->add_tx_ts)
1080 ret = rdev->ops->add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1081 user_prio, admitted_time);
1082 trace_rdev_return_int(&rdev->wiphy, ret);
1084 return ret;
1087 static inline int
1088 rdev_del_tx_ts(struct cfg80211_registered_device *rdev,
1089 struct net_device *dev, u8 tsid, const u8 *peer)
1091 int ret = -EOPNOTSUPP;
1093 trace_rdev_del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1094 if (rdev->ops->del_tx_ts)
1095 ret = rdev->ops->del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1096 trace_rdev_return_int(&rdev->wiphy, ret);
1098 return ret;
1101 static inline int
1102 rdev_tdls_channel_switch(struct cfg80211_registered_device *rdev,
1103 struct net_device *dev, const u8 *addr,
1104 u8 oper_class, struct cfg80211_chan_def *chandef)
1106 int ret;
1108 trace_rdev_tdls_channel_switch(&rdev->wiphy, dev, addr, oper_class,
1109 chandef);
1110 ret = rdev->ops->tdls_channel_switch(&rdev->wiphy, dev, addr,
1111 oper_class, chandef);
1112 trace_rdev_return_int(&rdev->wiphy, ret);
1113 return ret;
1116 static inline void
1117 rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device *rdev,
1118 struct net_device *dev, const u8 *addr)
1120 trace_rdev_tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1121 rdev->ops->tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1122 trace_rdev_return_void(&rdev->wiphy);
1125 static inline int
1126 rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
1127 struct net_device *dev,
1128 struct cfg80211_chan_def *chandef,
1129 u32 cac_time_ms)
1131 int ret = -ENOTSUPP;
1133 trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef,
1134 cac_time_ms);
1135 if (rdev->ops->start_radar_detection)
1136 ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev,
1137 chandef, cac_time_ms);
1138 trace_rdev_return_int(&rdev->wiphy, ret);
1139 return ret;
1142 static inline int
1143 rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
1144 struct net_device *dev,
1145 int mcast_rate[NUM_NL80211_BANDS])
1147 int ret = -ENOTSUPP;
1149 trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1150 if (rdev->ops->set_mcast_rate)
1151 ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1152 trace_rdev_return_int(&rdev->wiphy, ret);
1153 return ret;
1156 static inline int
1157 rdev_set_coalesce(struct cfg80211_registered_device *rdev,
1158 struct cfg80211_coalesce *coalesce)
1160 int ret = -ENOTSUPP;
1162 trace_rdev_set_coalesce(&rdev->wiphy, coalesce);
1163 if (rdev->ops->set_coalesce)
1164 ret = rdev->ops->set_coalesce(&rdev->wiphy, coalesce);
1165 trace_rdev_return_int(&rdev->wiphy, ret);
1166 return ret;
1169 static inline int rdev_set_pmk(struct cfg80211_registered_device *rdev,
1170 struct net_device *dev,
1171 struct cfg80211_pmk_conf *pmk_conf)
1173 int ret = -EOPNOTSUPP;
1175 trace_rdev_set_pmk(&rdev->wiphy, dev, pmk_conf);
1176 if (rdev->ops->set_pmk)
1177 ret = rdev->ops->set_pmk(&rdev->wiphy, dev, pmk_conf);
1178 trace_rdev_return_int(&rdev->wiphy, ret);
1179 return ret;
1182 static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev,
1183 struct net_device *dev, const u8 *aa)
1185 int ret = -EOPNOTSUPP;
1187 trace_rdev_del_pmk(&rdev->wiphy, dev, aa);
1188 if (rdev->ops->del_pmk)
1189 ret = rdev->ops->del_pmk(&rdev->wiphy, dev, aa);
1190 trace_rdev_return_int(&rdev->wiphy, ret);
1191 return ret;
1193 #endif /* __CFG80211_RDEV_OPS */