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