cfg80211: add tracing for P2P Device start/stop
[linux-3.10.git] / net / wireless / rdev-ops.h
1 #ifndef __CFG80211_RDEV_OPS
2 #define __CFG80211_RDEV_OPS
3
4 #include <linux/rtnetlink.h>
5 #include <net/cfg80211.h>
6 #include "core.h"
7 #include "trace.h"
8
9 static inline int rdev_suspend(struct cfg80211_registered_device *rdev)
10 {
11         int ret;
12         trace_rdev_suspend(&rdev->wiphy, rdev->wowlan);
13         ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
14         trace_rdev_return_int(&rdev->wiphy, ret);
15         return ret;
16 }
17
18 static inline int rdev_resume(struct cfg80211_registered_device *rdev)
19 {
20         int ret;
21         trace_rdev_resume(&rdev->wiphy);
22         ret = rdev->ops->resume(&rdev->wiphy);
23         trace_rdev_return_int(&rdev->wiphy, ret);
24         return ret;
25 }
26
27 static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
28                                    bool enabled)
29 {
30         trace_rdev_set_wakeup(&rdev->wiphy, enabled);
31         rdev->ops->set_wakeup(&rdev->wiphy, enabled);
32         trace_rdev_return_void(&rdev->wiphy);
33 }
34
35 static inline struct wireless_dev
36 *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
37                        enum nl80211_iftype type, u32 *flags,
38                        struct vif_params *params)
39 {
40         struct wireless_dev *ret;
41         trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
42         ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, type, flags,
43                                           params);
44         trace_rdev_return_wdev(&rdev->wiphy, ret);
45         return ret;
46 }
47
48 static inline int
49 rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
50                       struct wireless_dev *wdev)
51 {
52         int ret;
53         trace_rdev_del_virtual_intf(&rdev->wiphy, wdev);
54         ret = rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
55         trace_rdev_return_int(&rdev->wiphy, ret);
56         return ret;
57 }
58
59 static inline int
60 rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
61                          struct net_device *dev, enum nl80211_iftype type,
62                          u32 *flags, struct vif_params *params)
63 {
64         int ret;
65         trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
66         ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
67                                              params);
68         trace_rdev_return_int(&rdev->wiphy, ret);
69         return ret;
70 }
71
72 static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
73                                struct net_device *netdev, u8 key_index,
74                                bool pairwise, const u8 *mac_addr,
75                                struct key_params *params)
76 {
77         int ret;
78         trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
79         ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
80                                   mac_addr, params);
81         trace_rdev_return_int(&rdev->wiphy, ret);
82         return ret;
83 }
84
85 static inline int
86 rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
87              u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
88              void (*callback)(void *cookie, struct key_params*))
89 {
90         int ret;
91         trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
92         ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
93                                   mac_addr, cookie, callback);
94         trace_rdev_return_int(&rdev->wiphy, ret);
95         return ret;
96 }
97
98 static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
99                                struct net_device *netdev, u8 key_index,
100                                bool pairwise, const u8 *mac_addr)
101 {
102         int ret;
103         trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
104         ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
105                                   mac_addr);
106         trace_rdev_return_int(&rdev->wiphy, ret);
107         return ret;
108 }
109
110 static inline int
111 rdev_set_default_key(struct cfg80211_registered_device *rdev,
112                      struct net_device *netdev, u8 key_index, bool unicast,
113                      bool multicast)
114 {
115         int ret;
116         trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
117                                    unicast, multicast);
118         ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
119                                           unicast, multicast);
120         trace_rdev_return_int(&rdev->wiphy, ret);
121         return ret;
122 }
123
124 static inline int
125 rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
126                           struct net_device *netdev, u8 key_index)
127 {
128         int ret;
129         trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
130         ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
131                                                key_index);
132         trace_rdev_return_int(&rdev->wiphy, ret);
133         return ret;
134 }
135
136 static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
137                                 struct net_device *dev,
138                                 struct cfg80211_ap_settings *settings)
139 {
140         int ret;
141         trace_rdev_start_ap(&rdev->wiphy, dev, settings);
142         ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
143         trace_rdev_return_int(&rdev->wiphy, ret);
144         return ret;
145 }
146
147 static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
148                                      struct net_device *dev,
149                                      struct cfg80211_beacon_data *info)
150 {
151         int ret;
152         trace_rdev_change_beacon(&rdev->wiphy, dev, info);
153         ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
154         trace_rdev_return_int(&rdev->wiphy, ret);
155         return ret;
156 }
157
158 static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
159                                struct net_device *dev)
160 {
161         int ret;
162         trace_rdev_stop_ap(&rdev->wiphy, dev);
163         ret = rdev->ops->stop_ap(&rdev->wiphy, dev);
164         trace_rdev_return_int(&rdev->wiphy, ret);
165         return ret;
166 }
167
168 static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
169                                    struct net_device *dev, u8 *mac,
170                                    struct station_parameters *params)
171 {
172         int ret;
173         trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
174         ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
175         trace_rdev_return_int(&rdev->wiphy, ret);
176         return ret;
177 }
178
179 static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
180                                    struct net_device *dev, u8 *mac)
181 {
182         int ret;
183         trace_rdev_del_station(&rdev->wiphy, dev, mac);
184         ret = rdev->ops->del_station(&rdev->wiphy, dev, mac);
185         trace_rdev_return_int(&rdev->wiphy, ret);
186         return ret;
187 }
188
189 static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
190                                       struct net_device *dev, u8 *mac,
191                                       struct station_parameters *params)
192 {
193         int ret;
194         trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
195         ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
196         trace_rdev_return_int(&rdev->wiphy, ret);
197         return ret;
198 }
199
200 static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
201                                    struct net_device *dev, u8 *mac,
202                                    struct station_info *sinfo)
203 {
204         int ret;
205         trace_rdev_get_station(&rdev->wiphy, dev, mac);
206         ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
207         trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
208         return ret;
209 }
210
211 static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
212                                     struct net_device *dev, int idx, u8 *mac,
213                                     struct station_info *sinfo)
214 {
215         int ret;
216         trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
217         ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
218         trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
219         return ret;
220 }
221
222 static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
223                                  struct net_device *dev, u8 *dst, u8 *next_hop)
224 {
225         int ret;
226         trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
227         ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
228         trace_rdev_return_int(&rdev->wiphy, ret);
229         return ret;
230 }
231
232 static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
233                                  struct net_device *dev, u8 *dst)
234 {
235         int ret;
236         trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
237         ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
238         trace_rdev_return_int(&rdev->wiphy, ret);
239         return ret;
240 }
241
242 static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
243                                     struct net_device *dev, u8 *dst,
244                                     u8 *next_hop)
245 {
246         int ret;
247         trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
248         ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
249         trace_rdev_return_int(&rdev->wiphy, ret);
250         return ret;
251 }
252
253 static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
254                                  struct net_device *dev, u8 *dst, u8 *next_hop,
255                                  struct mpath_info *pinfo)
256 {
257         int ret;
258         trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
259         ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
260         trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
261         return ret;
262
263 }
264
265 static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
266                                   struct net_device *dev, int idx, u8 *dst,
267                                   u8 *next_hop, struct mpath_info *pinfo)
268
269 {
270         int ret;
271         trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
272         ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
273                                      pinfo);
274         trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
275         return ret;
276 }
277
278 static inline int
279 rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
280                      struct net_device *dev, struct mesh_config *conf)
281 {
282         int ret;
283         trace_rdev_get_mesh_config(&rdev->wiphy, dev);
284         ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
285         trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
286         return ret;
287 }
288
289 static inline int
290 rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
291                         struct net_device *dev, u32 mask,
292                         const struct mesh_config *nconf)
293 {
294         int ret;
295         trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
296         ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
297         trace_rdev_return_int(&rdev->wiphy, ret);
298         return ret;
299 }
300
301 static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
302                                  struct net_device *dev,
303                                  const struct mesh_config *conf,
304                                  const struct mesh_setup *setup)
305 {
306         int ret;
307         trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
308         ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
309         trace_rdev_return_int(&rdev->wiphy, ret);
310         return ret;
311 }
312
313
314 static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
315                                   struct net_device *dev)
316 {
317         int ret;
318         trace_rdev_leave_mesh(&rdev->wiphy, dev);
319         ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
320         trace_rdev_return_int(&rdev->wiphy, ret);
321         return ret;
322 }
323
324 static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
325                                   struct net_device *dev,
326                                   struct bss_parameters *params)
327
328 {
329         int ret;
330         trace_rdev_change_bss(&rdev->wiphy, dev, params);
331         ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
332         trace_rdev_return_int(&rdev->wiphy, ret);
333         return ret;
334 }
335
336 static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
337                                       struct net_device *dev,
338                                       struct ieee80211_txq_params *params)
339
340 {
341         int ret;
342         trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
343         ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
344         trace_rdev_return_int(&rdev->wiphy, ret);
345         return ret;
346 }
347
348 static inline int
349 rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
350                                struct net_device *dev,
351                                struct ieee80211_channel *chan)
352 {
353         int ret;
354         trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
355         ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
356         trace_rdev_return_int(&rdev->wiphy, ret);
357         return ret;
358 }
359
360 static inline int
361 rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
362                          struct ieee80211_channel *chan,
363                          enum nl80211_channel_type channel_type)
364 {
365         int ret;
366         trace_rdev_set_monitor_channel(&rdev->wiphy, chan, channel_type);
367         ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chan, channel_type);
368         trace_rdev_return_int(&rdev->wiphy, ret);
369         return ret;
370 }
371
372 static inline int rdev_scan(struct cfg80211_registered_device *rdev,
373                             struct cfg80211_scan_request *request)
374 {
375         int ret;
376         trace_rdev_scan(&rdev->wiphy, request);
377         ret = rdev->ops->scan(&rdev->wiphy, request);
378         trace_rdev_return_int(&rdev->wiphy, ret);
379         return ret;
380 }
381
382 static inline int rdev_auth(struct cfg80211_registered_device *rdev,
383                             struct net_device *dev,
384                             struct cfg80211_auth_request *req)
385 {
386         int ret;
387         trace_rdev_auth(&rdev->wiphy, dev, req);
388         ret = rdev->ops->auth(&rdev->wiphy, dev, req);
389         trace_rdev_return_int(&rdev->wiphy, ret);
390         return ret;
391 }
392
393 static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
394                              struct net_device *dev,
395                              struct cfg80211_assoc_request *req)
396 {
397         int ret;
398         trace_rdev_assoc(&rdev->wiphy, dev, req);
399         ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
400         trace_rdev_return_int(&rdev->wiphy, ret);
401         return ret;
402 }
403
404 static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
405                               struct net_device *dev,
406                               struct cfg80211_deauth_request *req)
407 {
408         int ret;
409         trace_rdev_deauth(&rdev->wiphy, dev, req);
410         ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
411         trace_rdev_return_int(&rdev->wiphy, ret);
412         return ret;
413 }
414
415 static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
416                                 struct net_device *dev,
417                                 struct cfg80211_disassoc_request *req)
418 {
419         int ret;
420         trace_rdev_disassoc(&rdev->wiphy, dev, req);
421         ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
422         trace_rdev_return_int(&rdev->wiphy, ret);
423         return ret;
424 }
425
426 static inline int rdev_connect(struct cfg80211_registered_device *rdev,
427                                struct net_device *dev,
428                                struct cfg80211_connect_params *sme)
429 {
430         int ret;
431         trace_rdev_connect(&rdev->wiphy, dev, sme);
432         ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
433         trace_rdev_return_int(&rdev->wiphy, ret);
434         return ret;
435 }
436
437 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
438                                   struct net_device *dev, u16 reason_code)
439 {
440         int ret;
441         trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
442         ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
443         trace_rdev_return_int(&rdev->wiphy, ret);
444         return ret;
445 }
446
447 static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
448                                  struct net_device *dev,
449                                  struct cfg80211_ibss_params *params)
450 {
451         int ret;
452         trace_rdev_join_ibss(&rdev->wiphy, dev, params);
453         ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
454         trace_rdev_return_int(&rdev->wiphy, ret);
455         return ret;
456 }
457
458 static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
459                                   struct net_device *dev)
460 {
461         int ret;
462         trace_rdev_leave_ibss(&rdev->wiphy, dev);
463         ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
464         trace_rdev_return_int(&rdev->wiphy, ret);
465         return ret;
466 }
467
468 static inline int
469 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
470 {
471         int ret;
472         trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
473         ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
474         trace_rdev_return_int(&rdev->wiphy, ret);
475         return ret;
476 }
477
478 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
479                                     enum nl80211_tx_power_setting type, int mbm)
480 {
481         int ret;
482         trace_rdev_set_tx_power(&rdev->wiphy, type, mbm);
483         ret = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
484         trace_rdev_return_int(&rdev->wiphy, ret);
485         return ret;
486 }
487
488 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
489                                     int *dbm)
490 {
491         int ret;
492         trace_rdev_get_tx_power(&rdev->wiphy);
493         ret = rdev->ops->get_tx_power(&rdev->wiphy, dbm);
494         trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
495         return ret;
496 }
497
498 static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
499                                     struct net_device *dev, const u8 *addr)
500 {
501         int ret;
502         trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
503         ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
504         trace_rdev_return_int(&rdev->wiphy, ret);
505         return ret;
506 }
507
508 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
509 {
510         trace_rdev_rfkill_poll(&rdev->wiphy);
511         rdev->ops->rfkill_poll(&rdev->wiphy);
512         trace_rdev_return_void(&rdev->wiphy);
513 }
514
515
516 #ifdef CONFIG_NL80211_TESTMODE
517 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
518                                     void *data, int len)
519 {
520         int ret;
521         trace_rdev_testmode_cmd(&rdev->wiphy);
522         ret = rdev->ops->testmode_cmd(&rdev->wiphy, data, len);
523         trace_rdev_return_int(&rdev->wiphy, ret);
524         return ret;
525 }
526
527 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
528                                      struct sk_buff *skb,
529                                      struct netlink_callback *cb, void *data,
530                                      int len)
531 {
532         int ret;
533         trace_rdev_testmode_dump(&rdev->wiphy);
534         ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
535         trace_rdev_return_int(&rdev->wiphy, ret);
536         return ret;
537 }
538 #endif
539
540 static inline int
541 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
542                       struct net_device *dev, const u8 *peer,
543                       const struct cfg80211_bitrate_mask *mask)
544 {
545         int ret;
546         trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
547         ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
548         trace_rdev_return_int(&rdev->wiphy, ret);
549         return ret;
550 }
551
552 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
553                                    struct net_device *netdev, int idx,
554                                    struct survey_info *info)
555 {
556         int ret;
557         trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
558         ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
559         if (ret < 0)
560                 trace_rdev_return_int(&rdev->wiphy, ret);
561         else
562                 trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
563         return ret;
564 }
565
566 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
567                                  struct net_device *netdev,
568                                  struct cfg80211_pmksa *pmksa)
569 {
570         int ret;
571         trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
572         ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
573         trace_rdev_return_int(&rdev->wiphy, ret);
574         return ret;
575 }
576
577 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
578                                  struct net_device *netdev,
579                                  struct cfg80211_pmksa *pmksa)
580 {
581         int ret;
582         trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
583         ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
584         trace_rdev_return_int(&rdev->wiphy, ret);
585         return ret;
586 }
587
588 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
589                                    struct net_device *netdev)
590 {
591         int ret;
592         trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
593         ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
594         trace_rdev_return_int(&rdev->wiphy, ret);
595         return ret;
596 }
597
598 static inline int
599 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
600                        struct wireless_dev *wdev,
601                        struct ieee80211_channel *chan,
602                        enum nl80211_channel_type channel_type,
603                        unsigned int duration, u64 *cookie)
604 {
605         int ret;
606         trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, channel_type,
607                                      duration);
608         ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
609                                             channel_type, duration, cookie);
610         trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
611         return ret;
612 }
613
614 static inline int
615 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
616                               struct wireless_dev *wdev, u64 cookie)
617 {
618         int ret;
619         trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
620         ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
621         trace_rdev_return_int(&rdev->wiphy, ret);
622         return ret;
623 }
624
625 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
626                                struct wireless_dev *wdev,
627                                struct ieee80211_channel *chan, bool offchan,
628                                enum nl80211_channel_type channel_type,
629                                bool channel_type_valid, unsigned int wait,
630                                const u8 *buf, size_t len, bool no_cck,
631                                bool dont_wait_for_ack, u64 *cookie)
632 {
633         int ret;
634         trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, channel_type,
635                            channel_type_valid, wait, no_cck, dont_wait_for_ack);
636         ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
637                                   channel_type, channel_type_valid, wait, buf,
638                                   len, no_cck, dont_wait_for_ack, cookie);
639         trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
640         return ret;
641 }
642
643 static inline int
644 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
645                          struct wireless_dev *wdev, u64 cookie)
646 {
647         int ret;
648         trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
649         ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
650         trace_rdev_return_int(&rdev->wiphy, ret);
651         return ret;
652 }
653
654 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
655                                       struct net_device *dev, bool enabled,
656                                       int timeout)
657 {
658         int ret;
659         trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
660         ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
661         trace_rdev_return_int(&rdev->wiphy, ret);
662         return ret;
663 }
664
665 static inline int
666 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
667                          struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
668 {
669         int ret;
670         trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
671                                        rssi_hyst);
672         ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
673                                        rssi_hyst);
674         trace_rdev_return_int(&rdev->wiphy, ret);
675         return ret;
676 }
677
678 static inline int
679 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
680                         struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
681 {
682         int ret;
683         trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
684         ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
685                                              intvl);
686         trace_rdev_return_int(&rdev->wiphy, ret);
687         return ret;
688 }
689
690 static inline void
691 rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
692                          struct wireless_dev *wdev, u16 frame_type, bool reg)
693 {
694         trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
695         rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
696         trace_rdev_return_void(&rdev->wiphy);
697 }
698
699 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
700                                    u32 tx_ant, u32 rx_ant)
701 {
702         int ret;
703         trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
704         ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
705         trace_rdev_return_int(&rdev->wiphy, ret);
706         return ret;
707 }
708
709 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
710                                    u32 *tx_ant, u32 *rx_ant)
711 {
712         int ret;
713         trace_rdev_get_antenna(&rdev->wiphy);
714         ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
715         if (ret)
716                 trace_rdev_return_int(&rdev->wiphy, ret);
717         else
718                 trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
719                                             *rx_ant);
720         return ret;
721 }
722
723 static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
724                                      u32 tx, u32 rx)
725 {
726         int ret;
727         trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
728         ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
729         trace_rdev_return_int(&rdev->wiphy, ret);
730         return ret;
731 }
732
733 static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
734                                       u32 *tx, u32 *tx_max, u32 *rx,
735                                       u32 *rx_max)
736 {
737         trace_rdev_get_ringparam(&rdev->wiphy);
738         rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
739         trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
740 }
741
742 static inline int
743 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
744                       struct net_device *dev,
745                       struct cfg80211_sched_scan_request *request)
746 {
747         int ret;
748         trace_rdev_sched_scan_start(&rdev->wiphy, dev, request);
749         ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
750         trace_rdev_return_int(&rdev->wiphy, ret);
751         return ret;
752 }
753
754 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
755                                        struct net_device *dev)
756 {
757         int ret;
758         trace_rdev_sched_scan_stop(&rdev->wiphy, dev);
759         ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
760         trace_rdev_return_int(&rdev->wiphy, ret);
761         return ret;
762 }
763
764 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
765                                       struct net_device *dev,
766                                       struct cfg80211_gtk_rekey_data *data)
767 {
768         int ret;
769         trace_rdev_set_rekey_data(&rdev->wiphy, dev);
770         ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
771         trace_rdev_return_int(&rdev->wiphy, ret);
772         return ret;
773 }
774
775 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
776                                  struct net_device *dev, u8 *peer,
777                                  u8 action_code, u8 dialog_token,
778                                  u16 status_code, const u8 *buf, size_t len)
779 {
780         int ret;
781         trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
782                              dialog_token, status_code, buf, len);
783         ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
784                                    dialog_token, status_code, buf, len);
785         trace_rdev_return_int(&rdev->wiphy, ret);
786         return ret;
787 }
788
789 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
790                                  struct net_device *dev, u8 *peer,
791                                  enum nl80211_tdls_operation oper)
792 {
793         int ret;
794         trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
795         ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
796         trace_rdev_return_int(&rdev->wiphy, ret);
797         return ret;
798 }
799
800 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
801                                     struct net_device *dev, const u8 *peer,
802                                     u64 *cookie)
803 {
804         int ret;
805         trace_rdev_probe_client(&rdev->wiphy, dev, peer);
806         ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
807         trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
808         return ret;
809 }
810
811 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
812                                      struct net_device *dev, u16 noack_map)
813 {
814         int ret;
815         trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
816         ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
817         trace_rdev_return_int(&rdev->wiphy, ret);
818         return ret;
819 }
820
821 static inline int
822 rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
823                        struct net_device *dev, int sset)
824 {
825         int ret;
826         trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
827         ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
828         trace_rdev_return_int(&rdev->wiphy, ret);
829         return ret;
830 }
831
832 static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
833                                      struct net_device *dev,
834                                      struct ethtool_stats *stats, u64 *data)
835 {
836         trace_rdev_get_et_stats(&rdev->wiphy, dev);
837         rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
838         trace_rdev_return_void(&rdev->wiphy);
839 }
840
841 static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
842                                        struct net_device *dev, u32 sset,
843                                        u8 *data)
844 {
845         trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
846         rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
847         trace_rdev_return_void(&rdev->wiphy);
848 }
849
850 static inline struct ieee80211_channel
851 *rdev_get_channel(struct cfg80211_registered_device *rdev,
852                   struct wireless_dev *wdev, enum nl80211_channel_type *type)
853 {
854         struct ieee80211_channel *ret;
855         trace_rdev_get_channel(&rdev->wiphy, wdev);
856         ret = rdev->ops->get_channel(&rdev->wiphy, wdev, type);
857         trace_rdev_return_channel(&rdev->wiphy, ret, *type);
858         return ret;
859 }
860
861 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
862                                         struct wireless_dev *wdev)
863 {
864         int ret;
865
866         trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
867         ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
868         trace_rdev_return_int(&rdev->wiphy, ret);
869         return ret;
870 }
871
872 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
873                                         struct wireless_dev *wdev)
874 {
875         trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
876         rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
877         trace_rdev_return_void(&rdev->wiphy);
878 }                                       
879 #endif /* __CFG80211_RDEV_OPS */