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