xref: /linux/net/wireless/rdev-ops.h (revision 0d456bad36d42d16022be045c8a53ddbb59ee478)
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 cfg80211_chan_def *chandef)
363 {
364 	int ret;
365 	trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
366 	ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
367 	trace_rdev_return_int(&rdev->wiphy, ret);
368 	return ret;
369 }
370 
371 static inline int rdev_scan(struct cfg80211_registered_device *rdev,
372 			    struct cfg80211_scan_request *request)
373 {
374 	int ret;
375 	trace_rdev_scan(&rdev->wiphy, request);
376 	ret = rdev->ops->scan(&rdev->wiphy, request);
377 	trace_rdev_return_int(&rdev->wiphy, ret);
378 	return ret;
379 }
380 
381 static inline int rdev_auth(struct cfg80211_registered_device *rdev,
382 			    struct net_device *dev,
383 			    struct cfg80211_auth_request *req)
384 {
385 	int ret;
386 	trace_rdev_auth(&rdev->wiphy, dev, req);
387 	ret = rdev->ops->auth(&rdev->wiphy, dev, req);
388 	trace_rdev_return_int(&rdev->wiphy, ret);
389 	return ret;
390 }
391 
392 static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
393 			     struct net_device *dev,
394 			     struct cfg80211_assoc_request *req)
395 {
396 	int ret;
397 	trace_rdev_assoc(&rdev->wiphy, dev, req);
398 	ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
399 	trace_rdev_return_int(&rdev->wiphy, ret);
400 	return ret;
401 }
402 
403 static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
404 			      struct net_device *dev,
405 			      struct cfg80211_deauth_request *req)
406 {
407 	int ret;
408 	trace_rdev_deauth(&rdev->wiphy, dev, req);
409 	ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
410 	trace_rdev_return_int(&rdev->wiphy, ret);
411 	return ret;
412 }
413 
414 static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
415 				struct net_device *dev,
416 				struct cfg80211_disassoc_request *req)
417 {
418 	int ret;
419 	trace_rdev_disassoc(&rdev->wiphy, dev, req);
420 	ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
421 	trace_rdev_return_int(&rdev->wiphy, ret);
422 	return ret;
423 }
424 
425 static inline int rdev_connect(struct cfg80211_registered_device *rdev,
426 			       struct net_device *dev,
427 			       struct cfg80211_connect_params *sme)
428 {
429 	int ret;
430 	trace_rdev_connect(&rdev->wiphy, dev, sme);
431 	ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
432 	trace_rdev_return_int(&rdev->wiphy, ret);
433 	return ret;
434 }
435 
436 static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
437 				  struct net_device *dev, u16 reason_code)
438 {
439 	int ret;
440 	trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
441 	ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
442 	trace_rdev_return_int(&rdev->wiphy, ret);
443 	return ret;
444 }
445 
446 static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
447 				 struct net_device *dev,
448 				 struct cfg80211_ibss_params *params)
449 {
450 	int ret;
451 	trace_rdev_join_ibss(&rdev->wiphy, dev, params);
452 	ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
453 	trace_rdev_return_int(&rdev->wiphy, ret);
454 	return ret;
455 }
456 
457 static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
458 				  struct net_device *dev)
459 {
460 	int ret;
461 	trace_rdev_leave_ibss(&rdev->wiphy, dev);
462 	ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
463 	trace_rdev_return_int(&rdev->wiphy, ret);
464 	return ret;
465 }
466 
467 static inline int
468 rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
469 {
470 	int ret;
471 	trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
472 	ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
473 	trace_rdev_return_int(&rdev->wiphy, ret);
474 	return ret;
475 }
476 
477 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
478 				    struct wireless_dev *wdev,
479 				    enum nl80211_tx_power_setting type, int mbm)
480 {
481 	int ret;
482 	trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
483 	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, 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 				    struct wireless_dev *wdev, int *dbm)
490 {
491 	int ret;
492 	trace_rdev_get_tx_power(&rdev->wiphy, wdev);
493 	ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, 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 		       unsigned int duration, u64 *cookie)
603 {
604 	int ret;
605 	trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
606 	ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
607 					   duration, cookie);
608 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
609 	return ret;
610 }
611 
612 static inline int
613 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
614 			      struct wireless_dev *wdev, u64 cookie)
615 {
616 	int ret;
617 	trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
618 	ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
619 	trace_rdev_return_int(&rdev->wiphy, ret);
620 	return ret;
621 }
622 
623 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
624 			       struct wireless_dev *wdev,
625 			       struct ieee80211_channel *chan, bool offchan,
626 			       unsigned int wait, const u8 *buf, size_t len,
627 			       bool no_cck, bool dont_wait_for_ack, u64 *cookie)
628 {
629 	int ret;
630 	trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
631 			   wait, no_cck, dont_wait_for_ack);
632 	ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
633 				  wait, buf, len, no_cck,
634 				  dont_wait_for_ack, cookie);
635 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
636 	return ret;
637 }
638 
639 static inline int
640 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
641 			 struct wireless_dev *wdev, u64 cookie)
642 {
643 	int ret;
644 	trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
645 	ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
646 	trace_rdev_return_int(&rdev->wiphy, ret);
647 	return ret;
648 }
649 
650 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
651 				      struct net_device *dev, bool enabled,
652 				      int timeout)
653 {
654 	int ret;
655 	trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
656 	ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
657 	trace_rdev_return_int(&rdev->wiphy, ret);
658 	return ret;
659 }
660 
661 static inline int
662 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
663 			 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
664 {
665 	int ret;
666 	trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
667 				       rssi_hyst);
668 	ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
669 				       rssi_hyst);
670 	trace_rdev_return_int(&rdev->wiphy, ret);
671 	return ret;
672 }
673 
674 static inline int
675 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
676 			struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
677 {
678 	int ret;
679 	trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
680 	ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
681 					     intvl);
682 	trace_rdev_return_int(&rdev->wiphy, ret);
683 	return ret;
684 }
685 
686 static inline void
687 rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
688 			 struct wireless_dev *wdev, u16 frame_type, bool reg)
689 {
690 	trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
691 	rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
692 	trace_rdev_return_void(&rdev->wiphy);
693 }
694 
695 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
696 				   u32 tx_ant, u32 rx_ant)
697 {
698 	int ret;
699 	trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
700 	ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
701 	trace_rdev_return_int(&rdev->wiphy, ret);
702 	return ret;
703 }
704 
705 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
706 				   u32 *tx_ant, u32 *rx_ant)
707 {
708 	int ret;
709 	trace_rdev_get_antenna(&rdev->wiphy);
710 	ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
711 	if (ret)
712 		trace_rdev_return_int(&rdev->wiphy, ret);
713 	else
714 		trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
715 					    *rx_ant);
716 	return ret;
717 }
718 
719 static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
720 				     u32 tx, u32 rx)
721 {
722 	int ret;
723 	trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
724 	ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
725 	trace_rdev_return_int(&rdev->wiphy, ret);
726 	return ret;
727 }
728 
729 static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
730 				      u32 *tx, u32 *tx_max, u32 *rx,
731 				      u32 *rx_max)
732 {
733 	trace_rdev_get_ringparam(&rdev->wiphy);
734 	rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
735 	trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
736 }
737 
738 static inline int
739 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
740 		      struct net_device *dev,
741 		      struct cfg80211_sched_scan_request *request)
742 {
743 	int ret;
744 	trace_rdev_sched_scan_start(&rdev->wiphy, dev, request);
745 	ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
746 	trace_rdev_return_int(&rdev->wiphy, ret);
747 	return ret;
748 }
749 
750 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
751 				       struct net_device *dev)
752 {
753 	int ret;
754 	trace_rdev_sched_scan_stop(&rdev->wiphy, dev);
755 	ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
756 	trace_rdev_return_int(&rdev->wiphy, ret);
757 	return ret;
758 }
759 
760 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
761 				      struct net_device *dev,
762 				      struct cfg80211_gtk_rekey_data *data)
763 {
764 	int ret;
765 	trace_rdev_set_rekey_data(&rdev->wiphy, dev);
766 	ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
767 	trace_rdev_return_int(&rdev->wiphy, ret);
768 	return ret;
769 }
770 
771 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
772 				 struct net_device *dev, u8 *peer,
773 				 u8 action_code, u8 dialog_token,
774 				 u16 status_code, const u8 *buf, size_t len)
775 {
776 	int ret;
777 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
778 			     dialog_token, status_code, buf, len);
779 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
780 				   dialog_token, status_code, buf, len);
781 	trace_rdev_return_int(&rdev->wiphy, ret);
782 	return ret;
783 }
784 
785 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
786 				 struct net_device *dev, u8 *peer,
787 				 enum nl80211_tdls_operation oper)
788 {
789 	int ret;
790 	trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
791 	ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
792 	trace_rdev_return_int(&rdev->wiphy, ret);
793 	return ret;
794 }
795 
796 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
797 				    struct net_device *dev, const u8 *peer,
798 				    u64 *cookie)
799 {
800 	int ret;
801 	trace_rdev_probe_client(&rdev->wiphy, dev, peer);
802 	ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
803 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
804 	return ret;
805 }
806 
807 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
808 				     struct net_device *dev, u16 noack_map)
809 {
810 	int ret;
811 	trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
812 	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
813 	trace_rdev_return_int(&rdev->wiphy, ret);
814 	return ret;
815 }
816 
817 static inline int
818 rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
819 		       struct net_device *dev, int sset)
820 {
821 	int ret;
822 	trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
823 	ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
824 	trace_rdev_return_int(&rdev->wiphy, ret);
825 	return ret;
826 }
827 
828 static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
829 				     struct net_device *dev,
830 				     struct ethtool_stats *stats, u64 *data)
831 {
832 	trace_rdev_get_et_stats(&rdev->wiphy, dev);
833 	rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
834 	trace_rdev_return_void(&rdev->wiphy);
835 }
836 
837 static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
838 				       struct net_device *dev, u32 sset,
839 				       u8 *data)
840 {
841 	trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
842 	rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
843 	trace_rdev_return_void(&rdev->wiphy);
844 }
845 
846 static inline int
847 rdev_get_channel(struct cfg80211_registered_device *rdev,
848 		 struct wireless_dev *wdev,
849 		 struct cfg80211_chan_def *chandef)
850 {
851 	int ret;
852 
853 	trace_rdev_get_channel(&rdev->wiphy, wdev);
854 	ret = rdev->ops->get_channel(&rdev->wiphy, wdev, chandef);
855 	trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
856 
857 	return ret;
858 }
859 
860 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
861 					struct wireless_dev *wdev)
862 {
863 	int ret;
864 
865 	trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
866 	ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
867 	trace_rdev_return_int(&rdev->wiphy, ret);
868 	return ret;
869 }
870 
871 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
872 					struct wireless_dev *wdev)
873 {
874 	trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
875 	rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
876 	trace_rdev_return_void(&rdev->wiphy);
877 }
878 #endif /* __CFG80211_RDEV_OPS */
879