xref: /openbmc/linux/net/wireless/rdev-ops.h (revision 12eb4683)
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 			       struct cfg80211_wowlan *wowlan)
11 {
12 	int ret;
13 	trace_rdev_suspend(&rdev->wiphy, wowlan);
14 	ret = rdev->ops->suspend(&rdev->wiphy, wowlan);
15 	trace_rdev_return_int(&rdev->wiphy, ret);
16 	return ret;
17 }
18 
19 static inline int rdev_resume(struct cfg80211_registered_device *rdev)
20 {
21 	int ret;
22 	trace_rdev_resume(&rdev->wiphy);
23 	ret = rdev->ops->resume(&rdev->wiphy);
24 	trace_rdev_return_int(&rdev->wiphy, ret);
25 	return ret;
26 }
27 
28 static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
29 				   bool enabled)
30 {
31 	trace_rdev_set_wakeup(&rdev->wiphy, enabled);
32 	rdev->ops->set_wakeup(&rdev->wiphy, enabled);
33 	trace_rdev_return_void(&rdev->wiphy);
34 }
35 
36 static inline struct wireless_dev
37 *rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
38 		       enum nl80211_iftype type, u32 *flags,
39 		       struct vif_params *params)
40 {
41 	struct wireless_dev *ret;
42 	trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
43 	ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, type, flags,
44 					  params);
45 	trace_rdev_return_wdev(&rdev->wiphy, ret);
46 	return ret;
47 }
48 
49 static inline int
50 rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
51 		      struct wireless_dev *wdev)
52 {
53 	int ret;
54 	trace_rdev_del_virtual_intf(&rdev->wiphy, wdev);
55 	ret = rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
56 	trace_rdev_return_int(&rdev->wiphy, ret);
57 	return ret;
58 }
59 
60 static inline int
61 rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
62 			 struct net_device *dev, enum nl80211_iftype type,
63 			 u32 *flags, struct vif_params *params)
64 {
65 	int ret;
66 	trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
67 	ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
68 					     params);
69 	trace_rdev_return_int(&rdev->wiphy, ret);
70 	return ret;
71 }
72 
73 static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
74 			       struct net_device *netdev, u8 key_index,
75 			       bool pairwise, const u8 *mac_addr,
76 			       struct key_params *params)
77 {
78 	int ret;
79 	trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
80 	ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
81 				  mac_addr, params);
82 	trace_rdev_return_int(&rdev->wiphy, ret);
83 	return ret;
84 }
85 
86 static inline int
87 rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
88 	     u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
89 	     void (*callback)(void *cookie, struct key_params*))
90 {
91 	int ret;
92 	trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
93 	ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
94 				  mac_addr, cookie, callback);
95 	trace_rdev_return_int(&rdev->wiphy, ret);
96 	return ret;
97 }
98 
99 static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
100 			       struct net_device *netdev, u8 key_index,
101 			       bool pairwise, const u8 *mac_addr)
102 {
103 	int ret;
104 	trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
105 	ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
106 				  mac_addr);
107 	trace_rdev_return_int(&rdev->wiphy, ret);
108 	return ret;
109 }
110 
111 static inline int
112 rdev_set_default_key(struct cfg80211_registered_device *rdev,
113 		     struct net_device *netdev, u8 key_index, bool unicast,
114 		     bool multicast)
115 {
116 	int ret;
117 	trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
118 				   unicast, multicast);
119 	ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
120 					  unicast, multicast);
121 	trace_rdev_return_int(&rdev->wiphy, ret);
122 	return ret;
123 }
124 
125 static inline int
126 rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
127 			  struct net_device *netdev, u8 key_index)
128 {
129 	int ret;
130 	trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
131 	ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
132 					       key_index);
133 	trace_rdev_return_int(&rdev->wiphy, ret);
134 	return ret;
135 }
136 
137 static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
138 				struct net_device *dev,
139 				struct cfg80211_ap_settings *settings)
140 {
141 	int ret;
142 	trace_rdev_start_ap(&rdev->wiphy, dev, settings);
143 	ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
144 	trace_rdev_return_int(&rdev->wiphy, ret);
145 	return ret;
146 }
147 
148 static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
149 				     struct net_device *dev,
150 				     struct cfg80211_beacon_data *info)
151 {
152 	int ret;
153 	trace_rdev_change_beacon(&rdev->wiphy, dev, info);
154 	ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
155 	trace_rdev_return_int(&rdev->wiphy, ret);
156 	return ret;
157 }
158 
159 static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
160 			       struct net_device *dev)
161 {
162 	int ret;
163 	trace_rdev_stop_ap(&rdev->wiphy, dev);
164 	ret = rdev->ops->stop_ap(&rdev->wiphy, dev);
165 	trace_rdev_return_int(&rdev->wiphy, ret);
166 	return ret;
167 }
168 
169 static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
170 				   struct net_device *dev, u8 *mac,
171 				   struct station_parameters *params)
172 {
173 	int ret;
174 	trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
175 	ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
176 	trace_rdev_return_int(&rdev->wiphy, ret);
177 	return ret;
178 }
179 
180 static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
181 				   struct net_device *dev, u8 *mac)
182 {
183 	int ret;
184 	trace_rdev_del_station(&rdev->wiphy, dev, mac);
185 	ret = rdev->ops->del_station(&rdev->wiphy, dev, mac);
186 	trace_rdev_return_int(&rdev->wiphy, ret);
187 	return ret;
188 }
189 
190 static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
191 				      struct net_device *dev, u8 *mac,
192 				      struct station_parameters *params)
193 {
194 	int ret;
195 	trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
196 	ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
197 	trace_rdev_return_int(&rdev->wiphy, ret);
198 	return ret;
199 }
200 
201 static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
202 				   struct net_device *dev, u8 *mac,
203 				   struct station_info *sinfo)
204 {
205 	int ret;
206 	trace_rdev_get_station(&rdev->wiphy, dev, mac);
207 	ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
208 	trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
209 	return ret;
210 }
211 
212 static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
213 				    struct net_device *dev, int idx, u8 *mac,
214 				    struct station_info *sinfo)
215 {
216 	int ret;
217 	trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
218 	ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
219 	trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
220 	return ret;
221 }
222 
223 static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
224 				 struct net_device *dev, u8 *dst, u8 *next_hop)
225 {
226 	int ret;
227 	trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
228 	ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
229 	trace_rdev_return_int(&rdev->wiphy, ret);
230 	return ret;
231 }
232 
233 static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
234 				 struct net_device *dev, u8 *dst)
235 {
236 	int ret;
237 	trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
238 	ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
239 	trace_rdev_return_int(&rdev->wiphy, ret);
240 	return ret;
241 }
242 
243 static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
244 				    struct net_device *dev, u8 *dst,
245 				    u8 *next_hop)
246 {
247 	int ret;
248 	trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
249 	ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
250 	trace_rdev_return_int(&rdev->wiphy, ret);
251 	return ret;
252 }
253 
254 static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
255 				 struct net_device *dev, u8 *dst, u8 *next_hop,
256 				 struct mpath_info *pinfo)
257 {
258 	int ret;
259 	trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
260 	ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
261 	trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
262 	return ret;
263 
264 }
265 
266 static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
267 				  struct net_device *dev, int idx, u8 *dst,
268 				  u8 *next_hop, struct mpath_info *pinfo)
269 
270 {
271 	int ret;
272 	trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
273 	ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
274 				     pinfo);
275 	trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
276 	return ret;
277 }
278 
279 static inline int
280 rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
281 		     struct net_device *dev, struct mesh_config *conf)
282 {
283 	int ret;
284 	trace_rdev_get_mesh_config(&rdev->wiphy, dev);
285 	ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
286 	trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
287 	return ret;
288 }
289 
290 static inline int
291 rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
292 			struct net_device *dev, u32 mask,
293 			const struct mesh_config *nconf)
294 {
295 	int ret;
296 	trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
297 	ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
298 	trace_rdev_return_int(&rdev->wiphy, ret);
299 	return ret;
300 }
301 
302 static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
303 				 struct net_device *dev,
304 				 const struct mesh_config *conf,
305 				 const struct mesh_setup *setup)
306 {
307 	int ret;
308 	trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
309 	ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
310 	trace_rdev_return_int(&rdev->wiphy, ret);
311 	return ret;
312 }
313 
314 
315 static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
316 				  struct net_device *dev)
317 {
318 	int ret;
319 	trace_rdev_leave_mesh(&rdev->wiphy, dev);
320 	ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
321 	trace_rdev_return_int(&rdev->wiphy, ret);
322 	return ret;
323 }
324 
325 static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
326 				  struct net_device *dev,
327 				  struct bss_parameters *params)
328 
329 {
330 	int ret;
331 	trace_rdev_change_bss(&rdev->wiphy, dev, params);
332 	ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
333 	trace_rdev_return_int(&rdev->wiphy, ret);
334 	return ret;
335 }
336 
337 static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
338 				      struct net_device *dev,
339 				      struct ieee80211_txq_params *params)
340 
341 {
342 	int ret;
343 	trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
344 	ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
345 	trace_rdev_return_int(&rdev->wiphy, ret);
346 	return ret;
347 }
348 
349 static inline int
350 rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
351 			       struct net_device *dev,
352 			       struct ieee80211_channel *chan)
353 {
354 	int ret;
355 	trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
356 	ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
357 	trace_rdev_return_int(&rdev->wiphy, ret);
358 	return ret;
359 }
360 
361 static inline int
362 rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
363 			 struct cfg80211_chan_def *chandef)
364 {
365 	int ret;
366 	trace_rdev_set_monitor_channel(&rdev->wiphy, chandef);
367 	ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chandef);
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 				    struct wireless_dev *wdev,
480 				    enum nl80211_tx_power_setting type, int mbm)
481 {
482 	int ret;
483 	trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
484 	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
485 	trace_rdev_return_int(&rdev->wiphy, ret);
486 	return ret;
487 }
488 
489 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
490 				    struct wireless_dev *wdev, int *dbm)
491 {
492 	int ret;
493 	trace_rdev_get_tx_power(&rdev->wiphy, wdev);
494 	ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
495 	trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
496 	return ret;
497 }
498 
499 static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
500 				    struct net_device *dev, const u8 *addr)
501 {
502 	int ret;
503 	trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
504 	ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
505 	trace_rdev_return_int(&rdev->wiphy, ret);
506 	return ret;
507 }
508 
509 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
510 {
511 	trace_rdev_rfkill_poll(&rdev->wiphy);
512 	rdev->ops->rfkill_poll(&rdev->wiphy);
513 	trace_rdev_return_void(&rdev->wiphy);
514 }
515 
516 
517 #ifdef CONFIG_NL80211_TESTMODE
518 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
519 				    struct wireless_dev *wdev,
520 				    void *data, int len)
521 {
522 	int ret;
523 	trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
524 	ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
525 	trace_rdev_return_int(&rdev->wiphy, ret);
526 	return ret;
527 }
528 
529 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
530 				     struct sk_buff *skb,
531 				     struct netlink_callback *cb, void *data,
532 				     int len)
533 {
534 	int ret;
535 	trace_rdev_testmode_dump(&rdev->wiphy);
536 	ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
537 	trace_rdev_return_int(&rdev->wiphy, ret);
538 	return ret;
539 }
540 #endif
541 
542 static inline int
543 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
544 		      struct net_device *dev, const u8 *peer,
545 		      const struct cfg80211_bitrate_mask *mask)
546 {
547 	int ret;
548 	trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
549 	ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
550 	trace_rdev_return_int(&rdev->wiphy, ret);
551 	return ret;
552 }
553 
554 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
555 				   struct net_device *netdev, int idx,
556 				   struct survey_info *info)
557 {
558 	int ret;
559 	trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
560 	ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
561 	if (ret < 0)
562 		trace_rdev_return_int(&rdev->wiphy, ret);
563 	else
564 		trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
565 	return ret;
566 }
567 
568 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
569 				 struct net_device *netdev,
570 				 struct cfg80211_pmksa *pmksa)
571 {
572 	int ret;
573 	trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
574 	ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
575 	trace_rdev_return_int(&rdev->wiphy, ret);
576 	return ret;
577 }
578 
579 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
580 				 struct net_device *netdev,
581 				 struct cfg80211_pmksa *pmksa)
582 {
583 	int ret;
584 	trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
585 	ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
586 	trace_rdev_return_int(&rdev->wiphy, ret);
587 	return ret;
588 }
589 
590 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
591 				   struct net_device *netdev)
592 {
593 	int ret;
594 	trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
595 	ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
596 	trace_rdev_return_int(&rdev->wiphy, ret);
597 	return ret;
598 }
599 
600 static inline int
601 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
602 		       struct wireless_dev *wdev,
603 		       struct ieee80211_channel *chan,
604 		       unsigned int duration, u64 *cookie)
605 {
606 	int ret;
607 	trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
608 	ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
609 					   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 			       unsigned int wait, const u8 *buf, size_t len,
629 			       bool no_cck, bool dont_wait_for_ack, u64 *cookie)
630 {
631 	int ret;
632 	trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
633 			   wait, no_cck, dont_wait_for_ack);
634 	ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
635 				  wait, buf, len, no_cck,
636 				  dont_wait_for_ack, cookie);
637 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
638 	return ret;
639 }
640 
641 static inline int
642 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
643 			 struct wireless_dev *wdev, u64 cookie)
644 {
645 	int ret;
646 	trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
647 	ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
648 	trace_rdev_return_int(&rdev->wiphy, ret);
649 	return ret;
650 }
651 
652 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
653 				      struct net_device *dev, bool enabled,
654 				      int timeout)
655 {
656 	int ret;
657 	trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
658 	ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
659 	trace_rdev_return_int(&rdev->wiphy, ret);
660 	return ret;
661 }
662 
663 static inline int
664 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
665 			 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
666 {
667 	int ret;
668 	trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
669 				       rssi_hyst);
670 	ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
671 				       rssi_hyst);
672 	trace_rdev_return_int(&rdev->wiphy, ret);
673 	return ret;
674 }
675 
676 static inline int
677 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
678 			struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
679 {
680 	int ret;
681 	trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
682 	ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
683 					     intvl);
684 	trace_rdev_return_int(&rdev->wiphy, ret);
685 	return ret;
686 }
687 
688 static inline void
689 rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
690 			 struct wireless_dev *wdev, u16 frame_type, bool reg)
691 {
692 	trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
693 	rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
694 	trace_rdev_return_void(&rdev->wiphy);
695 }
696 
697 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
698 				   u32 tx_ant, u32 rx_ant)
699 {
700 	int ret;
701 	trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
702 	ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
703 	trace_rdev_return_int(&rdev->wiphy, ret);
704 	return ret;
705 }
706 
707 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
708 				   u32 *tx_ant, u32 *rx_ant)
709 {
710 	int ret;
711 	trace_rdev_get_antenna(&rdev->wiphy);
712 	ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
713 	if (ret)
714 		trace_rdev_return_int(&rdev->wiphy, ret);
715 	else
716 		trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
717 					    *rx_ant);
718 	return ret;
719 }
720 
721 static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
722 				     u32 tx, u32 rx)
723 {
724 	int ret;
725 	trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
726 	ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
727 	trace_rdev_return_int(&rdev->wiphy, ret);
728 	return ret;
729 }
730 
731 static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
732 				      u32 *tx, u32 *tx_max, u32 *rx,
733 				      u32 *rx_max)
734 {
735 	trace_rdev_get_ringparam(&rdev->wiphy);
736 	rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
737 	trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
738 }
739 
740 static inline int
741 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
742 		      struct net_device *dev,
743 		      struct cfg80211_sched_scan_request *request)
744 {
745 	int ret;
746 	trace_rdev_sched_scan_start(&rdev->wiphy, dev, request);
747 	ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
748 	trace_rdev_return_int(&rdev->wiphy, ret);
749 	return ret;
750 }
751 
752 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
753 				       struct net_device *dev)
754 {
755 	int ret;
756 	trace_rdev_sched_scan_stop(&rdev->wiphy, dev);
757 	ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
758 	trace_rdev_return_int(&rdev->wiphy, ret);
759 	return ret;
760 }
761 
762 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
763 				      struct net_device *dev,
764 				      struct cfg80211_gtk_rekey_data *data)
765 {
766 	int ret;
767 	trace_rdev_set_rekey_data(&rdev->wiphy, dev);
768 	ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
769 	trace_rdev_return_int(&rdev->wiphy, ret);
770 	return ret;
771 }
772 
773 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
774 				 struct net_device *dev, u8 *peer,
775 				 u8 action_code, u8 dialog_token,
776 				 u16 status_code, const u8 *buf, size_t len)
777 {
778 	int ret;
779 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
780 			     dialog_token, status_code, buf, len);
781 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
782 				   dialog_token, status_code, buf, len);
783 	trace_rdev_return_int(&rdev->wiphy, ret);
784 	return ret;
785 }
786 
787 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
788 				 struct net_device *dev, u8 *peer,
789 				 enum nl80211_tdls_operation oper)
790 {
791 	int ret;
792 	trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
793 	ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
794 	trace_rdev_return_int(&rdev->wiphy, ret);
795 	return ret;
796 }
797 
798 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
799 				    struct net_device *dev, const u8 *peer,
800 				    u64 *cookie)
801 {
802 	int ret;
803 	trace_rdev_probe_client(&rdev->wiphy, dev, peer);
804 	ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
805 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
806 	return ret;
807 }
808 
809 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
810 				     struct net_device *dev, u16 noack_map)
811 {
812 	int ret;
813 	trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
814 	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
815 	trace_rdev_return_int(&rdev->wiphy, ret);
816 	return ret;
817 }
818 
819 static inline int
820 rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
821 		       struct net_device *dev, int sset)
822 {
823 	int ret;
824 	trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
825 	ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
826 	trace_rdev_return_int(&rdev->wiphy, ret);
827 	return ret;
828 }
829 
830 static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
831 				     struct net_device *dev,
832 				     struct ethtool_stats *stats, u64 *data)
833 {
834 	trace_rdev_get_et_stats(&rdev->wiphy, dev);
835 	rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
836 	trace_rdev_return_void(&rdev->wiphy);
837 }
838 
839 static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
840 				       struct net_device *dev, u32 sset,
841 				       u8 *data)
842 {
843 	trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
844 	rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
845 	trace_rdev_return_void(&rdev->wiphy);
846 }
847 
848 static inline int
849 rdev_get_channel(struct cfg80211_registered_device *rdev,
850 		 struct wireless_dev *wdev,
851 		 struct cfg80211_chan_def *chandef)
852 {
853 	int ret;
854 
855 	trace_rdev_get_channel(&rdev->wiphy, wdev);
856 	ret = rdev->ops->get_channel(&rdev->wiphy, wdev, chandef);
857 	trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
858 
859 	return ret;
860 }
861 
862 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
863 					struct wireless_dev *wdev)
864 {
865 	int ret;
866 
867 	trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
868 	ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
869 	trace_rdev_return_int(&rdev->wiphy, ret);
870 	return ret;
871 }
872 
873 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
874 					struct wireless_dev *wdev)
875 {
876 	trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
877 	rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
878 	trace_rdev_return_void(&rdev->wiphy);
879 }
880 
881 static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
882 				   struct net_device *dev,
883 				   struct cfg80211_acl_data *params)
884 {
885 	int ret;
886 
887 	trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
888 	ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
889 	trace_rdev_return_int(&rdev->wiphy, ret);
890 	return ret;
891 }
892 
893 static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
894 				     struct net_device *dev,
895 				     struct cfg80211_update_ft_ies_params *ftie)
896 {
897 	int ret;
898 
899 	trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
900 	ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
901 	trace_rdev_return_int(&rdev->wiphy, ret);
902 	return ret;
903 }
904 
905 static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
906 					struct wireless_dev *wdev,
907 					enum nl80211_crit_proto_id protocol,
908 					u16 duration)
909 {
910 	int ret;
911 
912 	trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
913 	ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
914 					  protocol, duration);
915 	trace_rdev_return_int(&rdev->wiphy, ret);
916 	return ret;
917 }
918 
919 static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
920 				       struct wireless_dev *wdev)
921 {
922 	trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
923 	rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
924 	trace_rdev_return_void(&rdev->wiphy);
925 }
926 
927 static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
928 				      struct net_device *dev,
929 				      struct cfg80211_csa_settings *params)
930 {
931 	int ret;
932 
933 	trace_rdev_channel_switch(&rdev->wiphy, dev, params);
934 	ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
935 	trace_rdev_return_int(&rdev->wiphy, ret);
936 	return ret;
937 }
938 
939 #endif /* __CFG80211_RDEV_OPS */
940