xref: /linux/net/wireless/rdev-ops.h (revision 9410645520e9b820069761f3450ef6661418e279)
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_ap_update * info)174 static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
175 				     struct net_device *dev,
176 				     struct cfg80211_ap_update *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 = -EOPNOTSUPP;
582 
583 	trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
584 	if (rdev->ops->set_wiphy_params)
585 		ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
586 	trace_rdev_return_int(&rdev->wiphy, ret);
587 	return ret;
588 }
589 
rdev_set_tx_power(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,enum nl80211_tx_power_setting type,int mbm)590 static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
591 				    struct wireless_dev *wdev,
592 				    enum nl80211_tx_power_setting type, int mbm)
593 {
594 	int ret;
595 	trace_rdev_set_tx_power(&rdev->wiphy, wdev, type, mbm);
596 	ret = rdev->ops->set_tx_power(&rdev->wiphy, wdev, type, mbm);
597 	trace_rdev_return_int(&rdev->wiphy, ret);
598 	return ret;
599 }
600 
rdev_get_tx_power(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,int * dbm)601 static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
602 				    struct wireless_dev *wdev, int *dbm)
603 {
604 	int ret;
605 	trace_rdev_get_tx_power(&rdev->wiphy, wdev);
606 	ret = rdev->ops->get_tx_power(&rdev->wiphy, wdev, dbm);
607 	trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
608 	return ret;
609 }
610 
611 static inline int
rdev_set_multicast_to_unicast(struct cfg80211_registered_device * rdev,struct net_device * dev,const bool enabled)612 rdev_set_multicast_to_unicast(struct cfg80211_registered_device *rdev,
613 			      struct net_device *dev,
614 			      const bool enabled)
615 {
616 	int ret;
617 	trace_rdev_set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
618 	ret = rdev->ops->set_multicast_to_unicast(&rdev->wiphy, dev, enabled);
619 	trace_rdev_return_int(&rdev->wiphy, ret);
620 	return ret;
621 }
622 
623 static inline int
rdev_get_txq_stats(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_txq_stats * txqstats)624 rdev_get_txq_stats(struct cfg80211_registered_device *rdev,
625 		   struct wireless_dev *wdev,
626 		   struct cfg80211_txq_stats *txqstats)
627 {
628 	int ret;
629 	trace_rdev_get_txq_stats(&rdev->wiphy, wdev);
630 	ret = rdev->ops->get_txq_stats(&rdev->wiphy, wdev, txqstats);
631 	trace_rdev_return_int(&rdev->wiphy, ret);
632 	return ret;
633 }
634 
rdev_rfkill_poll(struct cfg80211_registered_device * rdev)635 static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
636 {
637 	trace_rdev_rfkill_poll(&rdev->wiphy);
638 	rdev->ops->rfkill_poll(&rdev->wiphy);
639 	trace_rdev_return_void(&rdev->wiphy);
640 }
641 
642 
643 #ifdef CONFIG_NL80211_TESTMODE
rdev_testmode_cmd(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,void * data,int len)644 static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
645 				    struct wireless_dev *wdev,
646 				    void *data, int len)
647 {
648 	int ret;
649 	trace_rdev_testmode_cmd(&rdev->wiphy, wdev);
650 	ret = rdev->ops->testmode_cmd(&rdev->wiphy, wdev, data, len);
651 	trace_rdev_return_int(&rdev->wiphy, ret);
652 	return ret;
653 }
654 
rdev_testmode_dump(struct cfg80211_registered_device * rdev,struct sk_buff * skb,struct netlink_callback * cb,void * data,int len)655 static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
656 				     struct sk_buff *skb,
657 				     struct netlink_callback *cb, void *data,
658 				     int len)
659 {
660 	int ret;
661 	trace_rdev_testmode_dump(&rdev->wiphy);
662 	ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
663 	trace_rdev_return_int(&rdev->wiphy, ret);
664 	return ret;
665 }
666 #endif
667 
668 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)669 rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
670 		      struct net_device *dev, unsigned int link_id,
671 		      const u8 *peer,
672 		      const struct cfg80211_bitrate_mask *mask)
673 {
674 	int ret;
675 	trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, link_id, peer, mask);
676 	ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, link_id,
677 					  peer, mask);
678 	trace_rdev_return_int(&rdev->wiphy, ret);
679 	return ret;
680 }
681 
rdev_dump_survey(struct cfg80211_registered_device * rdev,struct net_device * netdev,int idx,struct survey_info * info)682 static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
683 				   struct net_device *netdev, int idx,
684 				   struct survey_info *info)
685 {
686 	int ret;
687 	trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
688 	ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
689 	if (ret < 0)
690 		trace_rdev_return_int(&rdev->wiphy, ret);
691 	else
692 		trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
693 	return ret;
694 }
695 
rdev_set_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev,struct cfg80211_pmksa * pmksa)696 static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
697 				 struct net_device *netdev,
698 				 struct cfg80211_pmksa *pmksa)
699 {
700 	int ret;
701 	trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
702 	ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
703 	trace_rdev_return_int(&rdev->wiphy, ret);
704 	return ret;
705 }
706 
rdev_del_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev,struct cfg80211_pmksa * pmksa)707 static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
708 				 struct net_device *netdev,
709 				 struct cfg80211_pmksa *pmksa)
710 {
711 	int ret;
712 	trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
713 	ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
714 	trace_rdev_return_int(&rdev->wiphy, ret);
715 	return ret;
716 }
717 
rdev_flush_pmksa(struct cfg80211_registered_device * rdev,struct net_device * netdev)718 static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
719 				   struct net_device *netdev)
720 {
721 	int ret;
722 	trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
723 	ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
724 	trace_rdev_return_int(&rdev->wiphy, ret);
725 	return ret;
726 }
727 
728 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)729 rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
730 		       struct wireless_dev *wdev,
731 		       struct ieee80211_channel *chan,
732 		       unsigned int duration, u64 *cookie)
733 {
734 	int ret;
735 	trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
736 	ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
737 					   duration, cookie);
738 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
739 	return ret;
740 }
741 
742 static inline int
rdev_cancel_remain_on_channel(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)743 rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
744 			      struct wireless_dev *wdev, u64 cookie)
745 {
746 	int ret;
747 	trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
748 	ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
749 	trace_rdev_return_int(&rdev->wiphy, ret);
750 	return ret;
751 }
752 
rdev_mgmt_tx(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_mgmt_tx_params * params,u64 * cookie)753 static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
754 			       struct wireless_dev *wdev,
755 			       struct cfg80211_mgmt_tx_params *params,
756 			       u64 *cookie)
757 {
758 	int ret;
759 	trace_rdev_mgmt_tx(&rdev->wiphy, wdev, params);
760 	ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, params, cookie);
761 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
762 	return ret;
763 }
764 
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)765 static inline int rdev_tx_control_port(struct cfg80211_registered_device *rdev,
766 				       struct net_device *dev,
767 				       const void *buf, size_t len,
768 				       const u8 *dest, __be16 proto,
769 				       const bool noencrypt, int link,
770 				       u64 *cookie)
771 {
772 	int ret;
773 	trace_rdev_tx_control_port(&rdev->wiphy, dev, buf, len,
774 				   dest, proto, noencrypt, link);
775 	ret = rdev->ops->tx_control_port(&rdev->wiphy, dev, buf, len,
776 					 dest, proto, noencrypt, link, cookie);
777 	if (cookie)
778 		trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
779 	else
780 		trace_rdev_return_int(&rdev->wiphy, ret);
781 	return ret;
782 }
783 
784 static inline int
rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)785 rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
786 			 struct wireless_dev *wdev, u64 cookie)
787 {
788 	int ret;
789 	trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
790 	ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
791 	trace_rdev_return_int(&rdev->wiphy, ret);
792 	return ret;
793 }
794 
rdev_set_power_mgmt(struct cfg80211_registered_device * rdev,struct net_device * dev,bool enabled,int timeout)795 static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
796 				      struct net_device *dev, bool enabled,
797 				      int timeout)
798 {
799 	int ret;
800 	trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
801 	ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
802 	trace_rdev_return_int(&rdev->wiphy, ret);
803 	return ret;
804 }
805 
806 static inline int
rdev_set_cqm_rssi_config(struct cfg80211_registered_device * rdev,struct net_device * dev,s32 rssi_thold,u32 rssi_hyst)807 rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
808 			 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
809 {
810 	int ret;
811 	trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
812 				       rssi_hyst);
813 	ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
814 				       rssi_hyst);
815 	trace_rdev_return_int(&rdev->wiphy, ret);
816 	return ret;
817 }
818 
819 static inline int
rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device * rdev,struct net_device * dev,s32 low,s32 high)820 rdev_set_cqm_rssi_range_config(struct cfg80211_registered_device *rdev,
821 			       struct net_device *dev, s32 low, s32 high)
822 {
823 	int ret;
824 	trace_rdev_set_cqm_rssi_range_config(&rdev->wiphy, dev, low, high);
825 	ret = rdev->ops->set_cqm_rssi_range_config(&rdev->wiphy, dev,
826 						   low, high);
827 	trace_rdev_return_int(&rdev->wiphy, ret);
828 	return ret;
829 }
830 
831 static inline int
rdev_set_cqm_txe_config(struct cfg80211_registered_device * rdev,struct net_device * dev,u32 rate,u32 pkts,u32 intvl)832 rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
833 			struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
834 {
835 	int ret;
836 	trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
837 	ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
838 					     intvl);
839 	trace_rdev_return_int(&rdev->wiphy, ret);
840 	return ret;
841 }
842 
843 static inline void
rdev_update_mgmt_frame_registrations(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct mgmt_frame_regs * upd)844 rdev_update_mgmt_frame_registrations(struct cfg80211_registered_device *rdev,
845 				     struct wireless_dev *wdev,
846 				     struct mgmt_frame_regs *upd)
847 {
848 	might_sleep();
849 
850 	trace_rdev_update_mgmt_frame_registrations(&rdev->wiphy, wdev, upd);
851 	if (rdev->ops->update_mgmt_frame_registrations)
852 		rdev->ops->update_mgmt_frame_registrations(&rdev->wiphy, wdev,
853 							   upd);
854 	trace_rdev_return_void(&rdev->wiphy);
855 }
856 
rdev_set_antenna(struct cfg80211_registered_device * rdev,u32 tx_ant,u32 rx_ant)857 static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
858 				   u32 tx_ant, u32 rx_ant)
859 {
860 	int ret;
861 	trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
862 	ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
863 	trace_rdev_return_int(&rdev->wiphy, ret);
864 	return ret;
865 }
866 
rdev_get_antenna(struct cfg80211_registered_device * rdev,u32 * tx_ant,u32 * rx_ant)867 static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
868 				   u32 *tx_ant, u32 *rx_ant)
869 {
870 	int ret;
871 	trace_rdev_get_antenna(&rdev->wiphy);
872 	ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
873 	if (ret)
874 		trace_rdev_return_int(&rdev->wiphy, ret);
875 	else
876 		trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
877 					    *rx_ant);
878 	return ret;
879 }
880 
881 static inline int
rdev_sched_scan_start(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_sched_scan_request * request)882 rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
883 		      struct net_device *dev,
884 		      struct cfg80211_sched_scan_request *request)
885 {
886 	int ret;
887 	trace_rdev_sched_scan_start(&rdev->wiphy, dev, request->reqid);
888 	ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
889 	trace_rdev_return_int(&rdev->wiphy, ret);
890 	return ret;
891 }
892 
rdev_sched_scan_stop(struct cfg80211_registered_device * rdev,struct net_device * dev,u64 reqid)893 static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
894 				       struct net_device *dev, u64 reqid)
895 {
896 	int ret;
897 	trace_rdev_sched_scan_stop(&rdev->wiphy, dev, reqid);
898 	ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev, reqid);
899 	trace_rdev_return_int(&rdev->wiphy, ret);
900 	return ret;
901 }
902 
rdev_set_rekey_data(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_gtk_rekey_data * data)903 static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
904 				      struct net_device *dev,
905 				      struct cfg80211_gtk_rekey_data *data)
906 {
907 	int ret;
908 	trace_rdev_set_rekey_data(&rdev->wiphy, dev);
909 	ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
910 	trace_rdev_return_int(&rdev->wiphy, ret);
911 	return ret;
912 }
913 
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)914 static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
915 				 struct net_device *dev, u8 *peer,
916 				 int link_id, u8 action_code,
917 				 u8 dialog_token, u16 status_code,
918 				 u32 peer_capability, bool initiator,
919 				 const u8 *buf, size_t len)
920 {
921 	int ret;
922 	trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, link_id, action_code,
923 			     dialog_token, status_code, peer_capability,
924 			     initiator, buf, len);
925 	ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, link_id,
926 				   action_code, dialog_token, status_code,
927 				   peer_capability, initiator, buf, len);
928 	trace_rdev_return_int(&rdev->wiphy, ret);
929 	return ret;
930 }
931 
rdev_tdls_oper(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 * peer,enum nl80211_tdls_operation oper)932 static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
933 				 struct net_device *dev, u8 *peer,
934 				 enum nl80211_tdls_operation oper)
935 {
936 	int ret;
937 	trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
938 	ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
939 	trace_rdev_return_int(&rdev->wiphy, ret);
940 	return ret;
941 }
942 
rdev_probe_client(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * peer,u64 * cookie)943 static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
944 				    struct net_device *dev, const u8 *peer,
945 				    u64 *cookie)
946 {
947 	int ret;
948 	trace_rdev_probe_client(&rdev->wiphy, dev, peer);
949 	ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
950 	trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
951 	return ret;
952 }
953 
rdev_set_noack_map(struct cfg80211_registered_device * rdev,struct net_device * dev,u16 noack_map)954 static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
955 				     struct net_device *dev, u16 noack_map)
956 {
957 	int ret;
958 	trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
959 	ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
960 	trace_rdev_return_int(&rdev->wiphy, ret);
961 	return ret;
962 }
963 
964 static inline int
rdev_get_channel(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,unsigned int link_id,struct cfg80211_chan_def * chandef)965 rdev_get_channel(struct cfg80211_registered_device *rdev,
966 		 struct wireless_dev *wdev,
967 		 unsigned int link_id,
968 		 struct cfg80211_chan_def *chandef)
969 {
970 	int ret;
971 
972 	trace_rdev_get_channel(&rdev->wiphy, wdev, link_id);
973 	ret = rdev->ops->get_channel(&rdev->wiphy, wdev, link_id, chandef);
974 	trace_rdev_return_chandef(&rdev->wiphy, ret, chandef);
975 
976 	return ret;
977 }
978 
rdev_start_p2p_device(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)979 static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
980 					struct wireless_dev *wdev)
981 {
982 	int ret;
983 
984 	trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
985 	ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
986 	trace_rdev_return_int(&rdev->wiphy, ret);
987 	return ret;
988 }
989 
rdev_stop_p2p_device(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)990 static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
991 					struct wireless_dev *wdev)
992 {
993 	trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
994 	rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
995 	trace_rdev_return_void(&rdev->wiphy);
996 }
997 
rdev_start_nan(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_conf * conf)998 static inline int rdev_start_nan(struct cfg80211_registered_device *rdev,
999 				 struct wireless_dev *wdev,
1000 				 struct cfg80211_nan_conf *conf)
1001 {
1002 	int ret;
1003 
1004 	trace_rdev_start_nan(&rdev->wiphy, wdev, conf);
1005 	ret = rdev->ops->start_nan(&rdev->wiphy, wdev, conf);
1006 	trace_rdev_return_int(&rdev->wiphy, ret);
1007 	return ret;
1008 }
1009 
rdev_stop_nan(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)1010 static inline void rdev_stop_nan(struct cfg80211_registered_device *rdev,
1011 				 struct wireless_dev *wdev)
1012 {
1013 	trace_rdev_stop_nan(&rdev->wiphy, wdev);
1014 	rdev->ops->stop_nan(&rdev->wiphy, wdev);
1015 	trace_rdev_return_void(&rdev->wiphy);
1016 }
1017 
1018 static inline int
rdev_add_nan_func(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_func * nan_func)1019 rdev_add_nan_func(struct cfg80211_registered_device *rdev,
1020 		  struct wireless_dev *wdev,
1021 		  struct cfg80211_nan_func *nan_func)
1022 {
1023 	int ret;
1024 
1025 	trace_rdev_add_nan_func(&rdev->wiphy, wdev, nan_func);
1026 	ret = rdev->ops->add_nan_func(&rdev->wiphy, wdev, nan_func);
1027 	trace_rdev_return_int(&rdev->wiphy, ret);
1028 	return ret;
1029 }
1030 
rdev_del_nan_func(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,u64 cookie)1031 static inline void rdev_del_nan_func(struct cfg80211_registered_device *rdev,
1032 				    struct wireless_dev *wdev, u64 cookie)
1033 {
1034 	trace_rdev_del_nan_func(&rdev->wiphy, wdev, cookie);
1035 	rdev->ops->del_nan_func(&rdev->wiphy, wdev, cookie);
1036 	trace_rdev_return_void(&rdev->wiphy);
1037 }
1038 
1039 static inline int
rdev_nan_change_conf(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_nan_conf * conf,u32 changes)1040 rdev_nan_change_conf(struct cfg80211_registered_device *rdev,
1041 		     struct wireless_dev *wdev,
1042 		     struct cfg80211_nan_conf *conf, u32 changes)
1043 {
1044 	int ret;
1045 
1046 	trace_rdev_nan_change_conf(&rdev->wiphy, wdev, conf, changes);
1047 	if (rdev->ops->nan_change_conf)
1048 		ret = rdev->ops->nan_change_conf(&rdev->wiphy, wdev, conf,
1049 						 changes);
1050 	else
1051 		ret = -EOPNOTSUPP;
1052 	trace_rdev_return_int(&rdev->wiphy, ret);
1053 	return ret;
1054 }
1055 
rdev_set_mac_acl(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_acl_data * params)1056 static inline int rdev_set_mac_acl(struct cfg80211_registered_device *rdev,
1057 				   struct net_device *dev,
1058 				   struct cfg80211_acl_data *params)
1059 {
1060 	int ret;
1061 
1062 	trace_rdev_set_mac_acl(&rdev->wiphy, dev, params);
1063 	ret = rdev->ops->set_mac_acl(&rdev->wiphy, dev, params);
1064 	trace_rdev_return_int(&rdev->wiphy, ret);
1065 	return ret;
1066 }
1067 
rdev_update_ft_ies(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_update_ft_ies_params * ftie)1068 static inline int rdev_update_ft_ies(struct cfg80211_registered_device *rdev,
1069 				     struct net_device *dev,
1070 				     struct cfg80211_update_ft_ies_params *ftie)
1071 {
1072 	int ret;
1073 
1074 	trace_rdev_update_ft_ies(&rdev->wiphy, dev, ftie);
1075 	ret = rdev->ops->update_ft_ies(&rdev->wiphy, dev, ftie);
1076 	trace_rdev_return_int(&rdev->wiphy, ret);
1077 	return ret;
1078 }
1079 
rdev_crit_proto_start(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,enum nl80211_crit_proto_id protocol,u16 duration)1080 static inline int rdev_crit_proto_start(struct cfg80211_registered_device *rdev,
1081 					struct wireless_dev *wdev,
1082 					enum nl80211_crit_proto_id protocol,
1083 					u16 duration)
1084 {
1085 	int ret;
1086 
1087 	trace_rdev_crit_proto_start(&rdev->wiphy, wdev, protocol, duration);
1088 	ret = rdev->ops->crit_proto_start(&rdev->wiphy, wdev,
1089 					  protocol, duration);
1090 	trace_rdev_return_int(&rdev->wiphy, ret);
1091 	return ret;
1092 }
1093 
rdev_crit_proto_stop(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev)1094 static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev,
1095 				       struct wireless_dev *wdev)
1096 {
1097 	trace_rdev_crit_proto_stop(&rdev->wiphy, wdev);
1098 	rdev->ops->crit_proto_stop(&rdev->wiphy, wdev);
1099 	trace_rdev_return_void(&rdev->wiphy);
1100 }
1101 
rdev_channel_switch(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_csa_settings * params)1102 static inline int rdev_channel_switch(struct cfg80211_registered_device *rdev,
1103 				      struct net_device *dev,
1104 				      struct cfg80211_csa_settings *params)
1105 {
1106 	int ret;
1107 
1108 	trace_rdev_channel_switch(&rdev->wiphy, dev, params);
1109 	ret = rdev->ops->channel_switch(&rdev->wiphy, dev, params);
1110 	trace_rdev_return_int(&rdev->wiphy, ret);
1111 	return ret;
1112 }
1113 
rdev_set_qos_map(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_qos_map * qos_map)1114 static inline int rdev_set_qos_map(struct cfg80211_registered_device *rdev,
1115 				   struct net_device *dev,
1116 				   struct cfg80211_qos_map *qos_map)
1117 {
1118 	int ret = -EOPNOTSUPP;
1119 
1120 	if (rdev->ops->set_qos_map) {
1121 		trace_rdev_set_qos_map(&rdev->wiphy, dev, qos_map);
1122 		ret = rdev->ops->set_qos_map(&rdev->wiphy, dev, qos_map);
1123 		trace_rdev_return_int(&rdev->wiphy, ret);
1124 	}
1125 
1126 	return ret;
1127 }
1128 
1129 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)1130 rdev_set_ap_chanwidth(struct cfg80211_registered_device *rdev,
1131 		      struct net_device *dev,
1132 		      unsigned int link_id,
1133 		      struct cfg80211_chan_def *chandef)
1134 {
1135 	int ret;
1136 
1137 	trace_rdev_set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1138 	ret = rdev->ops->set_ap_chanwidth(&rdev->wiphy, dev, link_id, chandef);
1139 	trace_rdev_return_int(&rdev->wiphy, ret);
1140 
1141 	return ret;
1142 }
1143 
1144 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)1145 rdev_add_tx_ts(struct cfg80211_registered_device *rdev,
1146 	       struct net_device *dev, u8 tsid, const u8 *peer,
1147 	       u8 user_prio, u16 admitted_time)
1148 {
1149 	int ret = -EOPNOTSUPP;
1150 
1151 	trace_rdev_add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1152 			     user_prio, admitted_time);
1153 	if (rdev->ops->add_tx_ts)
1154 		ret = rdev->ops->add_tx_ts(&rdev->wiphy, dev, tsid, peer,
1155 					   user_prio, admitted_time);
1156 	trace_rdev_return_int(&rdev->wiphy, ret);
1157 
1158 	return ret;
1159 }
1160 
1161 static inline int
rdev_del_tx_ts(struct cfg80211_registered_device * rdev,struct net_device * dev,u8 tsid,const u8 * peer)1162 rdev_del_tx_ts(struct cfg80211_registered_device *rdev,
1163 	       struct net_device *dev, u8 tsid, const u8 *peer)
1164 {
1165 	int ret = -EOPNOTSUPP;
1166 
1167 	trace_rdev_del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1168 	if (rdev->ops->del_tx_ts)
1169 		ret = rdev->ops->del_tx_ts(&rdev->wiphy, dev, tsid, peer);
1170 	trace_rdev_return_int(&rdev->wiphy, ret);
1171 
1172 	return ret;
1173 }
1174 
1175 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)1176 rdev_tdls_channel_switch(struct cfg80211_registered_device *rdev,
1177 			 struct net_device *dev, const u8 *addr,
1178 			 u8 oper_class, struct cfg80211_chan_def *chandef)
1179 {
1180 	int ret;
1181 
1182 	trace_rdev_tdls_channel_switch(&rdev->wiphy, dev, addr, oper_class,
1183 				       chandef);
1184 	ret = rdev->ops->tdls_channel_switch(&rdev->wiphy, dev, addr,
1185 					     oper_class, chandef);
1186 	trace_rdev_return_int(&rdev->wiphy, ret);
1187 	return ret;
1188 }
1189 
1190 static inline void
rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * addr)1191 rdev_tdls_cancel_channel_switch(struct cfg80211_registered_device *rdev,
1192 				struct net_device *dev, const u8 *addr)
1193 {
1194 	trace_rdev_tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1195 	rdev->ops->tdls_cancel_channel_switch(&rdev->wiphy, dev, addr);
1196 	trace_rdev_return_void(&rdev->wiphy);
1197 }
1198 
1199 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,int link_id)1200 rdev_start_radar_detection(struct cfg80211_registered_device *rdev,
1201 			   struct net_device *dev,
1202 			   struct cfg80211_chan_def *chandef,
1203 			   u32 cac_time_ms, int link_id)
1204 {
1205 	int ret = -EOPNOTSUPP;
1206 
1207 	trace_rdev_start_radar_detection(&rdev->wiphy, dev, chandef,
1208 					 cac_time_ms, link_id);
1209 	if (rdev->ops->start_radar_detection)
1210 		ret = rdev->ops->start_radar_detection(&rdev->wiphy, dev,
1211 						       chandef, cac_time_ms,
1212 						       link_id);
1213 	trace_rdev_return_int(&rdev->wiphy, ret);
1214 	return ret;
1215 }
1216 
1217 static inline void
rdev_end_cac(struct cfg80211_registered_device * rdev,struct net_device * dev,unsigned int link_id)1218 rdev_end_cac(struct cfg80211_registered_device *rdev,
1219 	     struct net_device *dev, unsigned int link_id)
1220 {
1221 	trace_rdev_end_cac(&rdev->wiphy, dev, link_id);
1222 	if (rdev->ops->end_cac)
1223 		rdev->ops->end_cac(&rdev->wiphy, dev, link_id);
1224 	trace_rdev_return_void(&rdev->wiphy);
1225 }
1226 
1227 static inline int
rdev_set_mcast_rate(struct cfg80211_registered_device * rdev,struct net_device * dev,int mcast_rate[NUM_NL80211_BANDS])1228 rdev_set_mcast_rate(struct cfg80211_registered_device *rdev,
1229 		    struct net_device *dev,
1230 		    int mcast_rate[NUM_NL80211_BANDS])
1231 {
1232 	int ret = -EOPNOTSUPP;
1233 
1234 	trace_rdev_set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1235 	if (rdev->ops->set_mcast_rate)
1236 		ret = rdev->ops->set_mcast_rate(&rdev->wiphy, dev, mcast_rate);
1237 	trace_rdev_return_int(&rdev->wiphy, ret);
1238 	return ret;
1239 }
1240 
1241 static inline int
rdev_set_coalesce(struct cfg80211_registered_device * rdev,struct cfg80211_coalesce * coalesce)1242 rdev_set_coalesce(struct cfg80211_registered_device *rdev,
1243 		  struct cfg80211_coalesce *coalesce)
1244 {
1245 	int ret = -EOPNOTSUPP;
1246 
1247 	trace_rdev_set_coalesce(&rdev->wiphy, coalesce);
1248 	if (rdev->ops->set_coalesce)
1249 		ret = rdev->ops->set_coalesce(&rdev->wiphy, coalesce);
1250 	trace_rdev_return_int(&rdev->wiphy, ret);
1251 	return ret;
1252 }
1253 
rdev_set_pmk(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_pmk_conf * pmk_conf)1254 static inline int rdev_set_pmk(struct cfg80211_registered_device *rdev,
1255 			       struct net_device *dev,
1256 			       struct cfg80211_pmk_conf *pmk_conf)
1257 {
1258 	int ret = -EOPNOTSUPP;
1259 
1260 	trace_rdev_set_pmk(&rdev->wiphy, dev, pmk_conf);
1261 	if (rdev->ops->set_pmk)
1262 		ret = rdev->ops->set_pmk(&rdev->wiphy, dev, pmk_conf);
1263 	trace_rdev_return_int(&rdev->wiphy, ret);
1264 	return ret;
1265 }
1266 
rdev_del_pmk(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * aa)1267 static inline int rdev_del_pmk(struct cfg80211_registered_device *rdev,
1268 			       struct net_device *dev, const u8 *aa)
1269 {
1270 	int ret = -EOPNOTSUPP;
1271 
1272 	trace_rdev_del_pmk(&rdev->wiphy, dev, aa);
1273 	if (rdev->ops->del_pmk)
1274 		ret = rdev->ops->del_pmk(&rdev->wiphy, dev, aa);
1275 	trace_rdev_return_int(&rdev->wiphy, ret);
1276 	return ret;
1277 }
1278 
1279 static inline int
rdev_external_auth(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_external_auth_params * params)1280 rdev_external_auth(struct cfg80211_registered_device *rdev,
1281 		   struct net_device *dev,
1282 		   struct cfg80211_external_auth_params *params)
1283 {
1284 	int ret = -EOPNOTSUPP;
1285 
1286 	trace_rdev_external_auth(&rdev->wiphy, dev, params);
1287 	if (rdev->ops->external_auth)
1288 		ret = rdev->ops->external_auth(&rdev->wiphy, dev, params);
1289 	trace_rdev_return_int(&rdev->wiphy, ret);
1290 	return ret;
1291 }
1292 
1293 static inline int
rdev_get_ftm_responder_stats(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_ftm_responder_stats * ftm_stats)1294 rdev_get_ftm_responder_stats(struct cfg80211_registered_device *rdev,
1295 			     struct net_device *dev,
1296 			     struct cfg80211_ftm_responder_stats *ftm_stats)
1297 {
1298 	int ret = -EOPNOTSUPP;
1299 
1300 	trace_rdev_get_ftm_responder_stats(&rdev->wiphy, dev, ftm_stats);
1301 	if (rdev->ops->get_ftm_responder_stats)
1302 		ret = rdev->ops->get_ftm_responder_stats(&rdev->wiphy, dev,
1303 							ftm_stats);
1304 	trace_rdev_return_int(&rdev->wiphy, ret);
1305 	return ret;
1306 }
1307 
1308 static inline int
rdev_start_pmsr(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_pmsr_request * request)1309 rdev_start_pmsr(struct cfg80211_registered_device *rdev,
1310 		struct wireless_dev *wdev,
1311 		struct cfg80211_pmsr_request *request)
1312 {
1313 	int ret = -EOPNOTSUPP;
1314 
1315 	trace_rdev_start_pmsr(&rdev->wiphy, wdev, request->cookie);
1316 	if (rdev->ops->start_pmsr)
1317 		ret = rdev->ops->start_pmsr(&rdev->wiphy, wdev, request);
1318 	trace_rdev_return_int(&rdev->wiphy, ret);
1319 	return ret;
1320 }
1321 
1322 static inline void
rdev_abort_pmsr(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,struct cfg80211_pmsr_request * request)1323 rdev_abort_pmsr(struct cfg80211_registered_device *rdev,
1324 		struct wireless_dev *wdev,
1325 		struct cfg80211_pmsr_request *request)
1326 {
1327 	trace_rdev_abort_pmsr(&rdev->wiphy, wdev, request->cookie);
1328 	if (rdev->ops->abort_pmsr)
1329 		rdev->ops->abort_pmsr(&rdev->wiphy, wdev, request);
1330 	trace_rdev_return_void(&rdev->wiphy);
1331 }
1332 
rdev_update_owe_info(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_update_owe_info * oweinfo)1333 static inline int rdev_update_owe_info(struct cfg80211_registered_device *rdev,
1334 				       struct net_device *dev,
1335 				       struct cfg80211_update_owe_info *oweinfo)
1336 {
1337 	int ret = -EOPNOTSUPP;
1338 
1339 	trace_rdev_update_owe_info(&rdev->wiphy, dev, oweinfo);
1340 	if (rdev->ops->update_owe_info)
1341 		ret = rdev->ops->update_owe_info(&rdev->wiphy, dev, oweinfo);
1342 	trace_rdev_return_int(&rdev->wiphy, ret);
1343 	return ret;
1344 }
1345 
1346 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)1347 rdev_probe_mesh_link(struct cfg80211_registered_device *rdev,
1348 		     struct net_device *dev, const u8 *dest,
1349 		     const void *buf, size_t len)
1350 {
1351 	int ret;
1352 
1353 	trace_rdev_probe_mesh_link(&rdev->wiphy, dev, dest, buf, len);
1354 	ret = rdev->ops->probe_mesh_link(&rdev->wiphy, dev, buf, len);
1355 	trace_rdev_return_int(&rdev->wiphy, ret);
1356 	return ret;
1357 }
1358 
rdev_set_tid_config(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_tid_config * tid_conf)1359 static inline int rdev_set_tid_config(struct cfg80211_registered_device *rdev,
1360 				      struct net_device *dev,
1361 				      struct cfg80211_tid_config *tid_conf)
1362 {
1363 	int ret;
1364 
1365 	trace_rdev_set_tid_config(&rdev->wiphy, dev, tid_conf);
1366 	ret = rdev->ops->set_tid_config(&rdev->wiphy, dev, tid_conf);
1367 	trace_rdev_return_int(&rdev->wiphy, ret);
1368 	return ret;
1369 }
1370 
rdev_reset_tid_config(struct cfg80211_registered_device * rdev,struct net_device * dev,const u8 * peer,u8 tids)1371 static inline int rdev_reset_tid_config(struct cfg80211_registered_device *rdev,
1372 					struct net_device *dev, const u8 *peer,
1373 					u8 tids)
1374 {
1375 	int ret;
1376 
1377 	trace_rdev_reset_tid_config(&rdev->wiphy, dev, peer, tids);
1378 	ret = rdev->ops->reset_tid_config(&rdev->wiphy, dev, peer, tids);
1379 	trace_rdev_return_int(&rdev->wiphy, ret);
1380 	return ret;
1381 }
1382 
rdev_set_sar_specs(struct cfg80211_registered_device * rdev,struct cfg80211_sar_specs * sar)1383 static inline int rdev_set_sar_specs(struct cfg80211_registered_device *rdev,
1384 				     struct cfg80211_sar_specs *sar)
1385 {
1386 	int ret;
1387 
1388 	trace_rdev_set_sar_specs(&rdev->wiphy, sar);
1389 	ret = rdev->ops->set_sar_specs(&rdev->wiphy, sar);
1390 	trace_rdev_return_int(&rdev->wiphy, ret);
1391 
1392 	return ret;
1393 }
1394 
rdev_color_change(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_color_change_settings * params)1395 static inline int rdev_color_change(struct cfg80211_registered_device *rdev,
1396 				    struct net_device *dev,
1397 				    struct cfg80211_color_change_settings *params)
1398 {
1399 	int ret;
1400 
1401 	trace_rdev_color_change(&rdev->wiphy, dev, params);
1402 	ret = rdev->ops->color_change(&rdev->wiphy, dev, params);
1403 	trace_rdev_return_int(&rdev->wiphy, ret);
1404 
1405 	return ret;
1406 }
1407 
1408 static inline int
rdev_set_fils_aad(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_fils_aad * fils_aad)1409 rdev_set_fils_aad(struct cfg80211_registered_device *rdev,
1410 		  struct net_device *dev, struct cfg80211_fils_aad *fils_aad)
1411 {
1412 	int ret = -EOPNOTSUPP;
1413 
1414 	trace_rdev_set_fils_aad(&rdev->wiphy, dev, fils_aad);
1415 	if (rdev->ops->set_fils_aad)
1416 		ret = rdev->ops->set_fils_aad(&rdev->wiphy, dev, fils_aad);
1417 	trace_rdev_return_int(&rdev->wiphy, ret);
1418 
1419 	return ret;
1420 }
1421 
1422 static inline int
rdev_set_radar_background(struct cfg80211_registered_device * rdev,struct cfg80211_chan_def * chandef)1423 rdev_set_radar_background(struct cfg80211_registered_device *rdev,
1424 			  struct cfg80211_chan_def *chandef)
1425 {
1426 	struct wiphy *wiphy = &rdev->wiphy;
1427 	int ret = -EOPNOTSUPP;
1428 
1429 	trace_rdev_set_radar_background(wiphy, chandef);
1430 	if (rdev->ops->set_radar_background)
1431 		ret = rdev->ops->set_radar_background(wiphy, chandef);
1432 	trace_rdev_return_int(wiphy, ret);
1433 
1434 	return ret;
1435 }
1436 
1437 static inline int
rdev_add_intf_link(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,unsigned int link_id)1438 rdev_add_intf_link(struct cfg80211_registered_device *rdev,
1439 		   struct wireless_dev *wdev,
1440 		   unsigned int link_id)
1441 {
1442 	int ret = 0;
1443 
1444 	trace_rdev_add_intf_link(&rdev->wiphy, wdev, link_id);
1445 	if (rdev->ops->add_intf_link)
1446 		ret = rdev->ops->add_intf_link(&rdev->wiphy, wdev, link_id);
1447 	trace_rdev_return_int(&rdev->wiphy, ret);
1448 
1449 	return ret;
1450 }
1451 
1452 static inline void
rdev_del_intf_link(struct cfg80211_registered_device * rdev,struct wireless_dev * wdev,unsigned int link_id)1453 rdev_del_intf_link(struct cfg80211_registered_device *rdev,
1454 		   struct wireless_dev *wdev,
1455 		   unsigned int link_id)
1456 {
1457 	trace_rdev_del_intf_link(&rdev->wiphy, wdev, link_id);
1458 	if (rdev->ops->del_intf_link)
1459 		rdev->ops->del_intf_link(&rdev->wiphy, wdev, link_id);
1460 	trace_rdev_return_void(&rdev->wiphy);
1461 }
1462 
1463 static inline int
rdev_add_link_station(struct cfg80211_registered_device * rdev,struct net_device * dev,struct link_station_parameters * params)1464 rdev_add_link_station(struct cfg80211_registered_device *rdev,
1465 		      struct net_device *dev,
1466 		      struct link_station_parameters *params)
1467 {
1468 	int ret = -EOPNOTSUPP;
1469 
1470 	trace_rdev_add_link_station(&rdev->wiphy, dev, params);
1471 	if (rdev->ops->add_link_station)
1472 		ret = rdev->ops->add_link_station(&rdev->wiphy, dev, params);
1473 	trace_rdev_return_int(&rdev->wiphy, ret);
1474 	return ret;
1475 }
1476 
1477 static inline int
rdev_mod_link_station(struct cfg80211_registered_device * rdev,struct net_device * dev,struct link_station_parameters * params)1478 rdev_mod_link_station(struct cfg80211_registered_device *rdev,
1479 		      struct net_device *dev,
1480 		      struct link_station_parameters *params)
1481 {
1482 	int ret = -EOPNOTSUPP;
1483 
1484 	trace_rdev_mod_link_station(&rdev->wiphy, dev, params);
1485 	if (rdev->ops->mod_link_station)
1486 		ret = rdev->ops->mod_link_station(&rdev->wiphy, dev, params);
1487 	trace_rdev_return_int(&rdev->wiphy, ret);
1488 	return ret;
1489 }
1490 
1491 static inline int
rdev_del_link_station(struct cfg80211_registered_device * rdev,struct net_device * dev,struct link_station_del_parameters * params)1492 rdev_del_link_station(struct cfg80211_registered_device *rdev,
1493 		      struct net_device *dev,
1494 		      struct link_station_del_parameters *params)
1495 {
1496 	int ret = -EOPNOTSUPP;
1497 
1498 	trace_rdev_del_link_station(&rdev->wiphy, dev, params);
1499 	if (rdev->ops->del_link_station)
1500 		ret = rdev->ops->del_link_station(&rdev->wiphy, dev, params);
1501 	trace_rdev_return_int(&rdev->wiphy, ret);
1502 	return ret;
1503 }
1504 
1505 static inline int
rdev_set_hw_timestamp(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_set_hw_timestamp * hwts)1506 rdev_set_hw_timestamp(struct cfg80211_registered_device *rdev,
1507 		      struct net_device *dev,
1508 		      struct cfg80211_set_hw_timestamp *hwts)
1509 {
1510 	struct wiphy *wiphy = &rdev->wiphy;
1511 	int ret = -EOPNOTSUPP;
1512 
1513 	trace_rdev_set_hw_timestamp(wiphy, dev, hwts);
1514 	if (rdev->ops->set_hw_timestamp)
1515 		ret = rdev->ops->set_hw_timestamp(wiphy, dev, hwts);
1516 	trace_rdev_return_int(wiphy, ret);
1517 
1518 	return ret;
1519 }
1520 
1521 static inline int
rdev_set_ttlm(struct cfg80211_registered_device * rdev,struct net_device * dev,struct cfg80211_ttlm_params * params)1522 rdev_set_ttlm(struct cfg80211_registered_device *rdev,
1523 	      struct net_device *dev,
1524 	      struct cfg80211_ttlm_params *params)
1525 {
1526 	struct wiphy *wiphy = &rdev->wiphy;
1527 	int ret = -EOPNOTSUPP;
1528 
1529 	trace_rdev_set_ttlm(wiphy, dev, params);
1530 	if (rdev->ops->set_ttlm)
1531 		ret = rdev->ops->set_ttlm(wiphy, dev, params);
1532 	trace_rdev_return_int(wiphy, ret);
1533 
1534 	return ret;
1535 }
1536 
1537 static inline u32
rdev_get_radio_mask(struct cfg80211_registered_device * rdev,struct net_device * dev)1538 rdev_get_radio_mask(struct cfg80211_registered_device *rdev,
1539 		    struct net_device *dev)
1540 {
1541 	struct wiphy *wiphy = &rdev->wiphy;
1542 
1543 	if (!rdev->ops->get_radio_mask)
1544 		return 0;
1545 
1546 	return rdev->ops->get_radio_mask(wiphy, dev);
1547 }
1548 #endif /* __CFG80211_RDEV_OPS */
1549