• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * wpa_supplicant - Internal driver interface wrappers
3  * Copyright (c) 2003-2015, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef DRIVER_I_H
10 #define DRIVER_I_H
11 
12 #include "drivers/driver.h"
13 
14 /* driver_ops */
wpa_drv_init(struct wpa_supplicant * wpa_s,const char * ifname)15 static inline void * wpa_drv_init(struct wpa_supplicant *wpa_s,
16 				  const char *ifname)
17 {
18 	if (wpa_s->driver->init2)
19 		return wpa_s->driver->init2(wpa_s, ifname,
20 					    wpa_s->global_drv_priv);
21 	if (wpa_s->driver->init) {
22 		return wpa_s->driver->init(wpa_s, ifname);
23 	}
24 	return NULL;
25 }
26 
wpa_drv_deinit(struct wpa_supplicant * wpa_s)27 static inline void wpa_drv_deinit(struct wpa_supplicant *wpa_s)
28 {
29 	if (wpa_s->driver->deinit)
30 		wpa_s->driver->deinit(wpa_s->drv_priv);
31 }
32 
wpa_drv_set_param(struct wpa_supplicant * wpa_s,const char * param)33 static inline int wpa_drv_set_param(struct wpa_supplicant *wpa_s,
34 				    const char *param)
35 {
36 	if (wpa_s->driver->set_param)
37 		return wpa_s->driver->set_param(wpa_s->drv_priv, param);
38 	return 0;
39 }
40 
wpa_drv_set_countermeasures(struct wpa_supplicant * wpa_s,int enabled)41 static inline int wpa_drv_set_countermeasures(struct wpa_supplicant *wpa_s,
42 					      int enabled)
43 {
44 	if (wpa_s->driver->set_countermeasures) {
45 		return wpa_s->driver->set_countermeasures(wpa_s->drv_priv,
46 							  enabled);
47 	}
48 	return -1;
49 }
50 
wpa_drv_authenticate(struct wpa_supplicant * wpa_s,struct wpa_driver_auth_params * params)51 static inline int wpa_drv_authenticate(struct wpa_supplicant *wpa_s,
52 				       struct wpa_driver_auth_params *params)
53 {
54 	if (wpa_s->driver->authenticate)
55 		return wpa_s->driver->authenticate(wpa_s->drv_priv, params);
56 	return -1;
57 }
58 
wpa_drv_associate(struct wpa_supplicant * wpa_s,struct wpa_driver_associate_params * params)59 static inline int wpa_drv_associate(struct wpa_supplicant *wpa_s,
60 				    struct wpa_driver_associate_params *params)
61 {
62 	if (wpa_s->driver->associate) {
63 		return wpa_s->driver->associate(wpa_s->drv_priv, params);
64 	}
65 	return -1;
66 }
67 
wpa_drv_init_mesh(struct wpa_supplicant * wpa_s)68 static inline int wpa_drv_init_mesh(struct wpa_supplicant *wpa_s)
69 {
70 	if (wpa_s->driver->init_mesh)
71 		return wpa_s->driver->init_mesh(wpa_s->drv_priv);
72 	return -1;
73 }
74 
wpa_drv_join_mesh(struct wpa_supplicant * wpa_s,struct wpa_driver_mesh_join_params * params)75 static inline int wpa_drv_join_mesh(struct wpa_supplicant *wpa_s,
76 				    struct wpa_driver_mesh_join_params *params)
77 {
78 	if (wpa_s->driver->join_mesh)
79 		return wpa_s->driver->join_mesh(wpa_s->drv_priv, params);
80 	return -1;
81 }
82 
wpa_drv_leave_mesh(struct wpa_supplicant * wpa_s)83 static inline int wpa_drv_leave_mesh(struct wpa_supplicant *wpa_s)
84 {
85 	if (wpa_s->driver->leave_mesh)
86 		return wpa_s->driver->leave_mesh(wpa_s->drv_priv);
87 	return -1;
88 }
89 
wpa_drv_scan(struct wpa_supplicant * wpa_s,struct wpa_driver_scan_params * params)90 static inline int wpa_drv_scan(struct wpa_supplicant *wpa_s,
91 			       struct wpa_driver_scan_params *params)
92 {
93 #ifdef CONFIG_TESTING_OPTIONS
94 	if (wpa_s->test_failure == WPAS_TEST_FAILURE_SCAN_TRIGGER)
95 		return -EBUSY;
96 #endif /* CONFIG_TESTING_OPTIONS */
97 	if (wpa_s->driver->scan2)
98 		return wpa_s->driver->scan2(wpa_s->drv_priv, params);
99 	return -1;
100 }
101 
wpa_drv_sched_scan(struct wpa_supplicant * wpa_s,struct wpa_driver_scan_params * params)102 static inline int wpa_drv_sched_scan(struct wpa_supplicant *wpa_s,
103 				     struct wpa_driver_scan_params *params)
104 {
105 	if (wpa_s->driver->sched_scan)
106 		return wpa_s->driver->sched_scan(wpa_s->drv_priv, params);
107 	return -1;
108 }
109 
wpa_drv_stop_sched_scan(struct wpa_supplicant * wpa_s)110 static inline int wpa_drv_stop_sched_scan(struct wpa_supplicant *wpa_s)
111 {
112 	if (wpa_s->driver->stop_sched_scan)
113 		return wpa_s->driver->stop_sched_scan(wpa_s->drv_priv);
114 	return -1;
115 }
116 
wpa_drv_get_scan_results2(struct wpa_supplicant * wpa_s)117 static inline struct wpa_scan_results * wpa_drv_get_scan_results2(
118 	struct wpa_supplicant *wpa_s)
119 {
120 	if (wpa_s->driver->get_scan_results2)
121 		return wpa_s->driver->get_scan_results2(wpa_s->drv_priv);
122 	return NULL;
123 }
124 
wpa_drv_get_bssid(struct wpa_supplicant * wpa_s,u8 * bssid)125 static inline int wpa_drv_get_bssid(struct wpa_supplicant *wpa_s, u8 *bssid)
126 {
127 	if (wpa_s->driver->get_bssid) {
128 		return wpa_s->driver->get_bssid(wpa_s->drv_priv, bssid);
129 	}
130 	return -1;
131 }
132 
wpa_drv_get_ssid(struct wpa_supplicant * wpa_s,u8 * ssid)133 static inline int wpa_drv_get_ssid(struct wpa_supplicant *wpa_s, u8 *ssid)
134 {
135 	if (wpa_s->driver->get_ssid) {
136 		return wpa_s->driver->get_ssid(wpa_s->drv_priv, ssid);
137 	}
138 	return -1;
139 }
140 
wpa_drv_set_key(struct wpa_supplicant * wpa_s,enum wpa_alg alg,const u8 * addr,int key_idx,int set_tx,const u8 * seq,size_t seq_len,const u8 * key,size_t key_len)141 static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s,
142 				  enum wpa_alg alg, const u8 *addr,
143 				  int key_idx, int set_tx,
144 				  const u8 *seq, size_t seq_len,
145 				  const u8 *key, size_t key_len)
146 {
147 	if (alg != WPA_ALG_NONE) {
148 		if (key_idx >= 0 && key_idx <= 6)
149 			wpa_s->keys_cleared &= ~BIT(key_idx);
150 		else
151 			wpa_s->keys_cleared = 0;
152 	}
153 	if (wpa_s->driver->set_key) {
154 		return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
155 					      alg, addr, key_idx, set_tx,
156 					      seq, seq_len, key, key_len);
157 	}
158 	return -1;
159 }
160 
wpa_drv_get_seqnum(struct wpa_supplicant * wpa_s,const u8 * addr,int idx,u8 * seq)161 static inline int wpa_drv_get_seqnum(struct wpa_supplicant *wpa_s,
162 				     const u8 *addr, int idx, u8 *seq)
163 {
164 	if (wpa_s->driver->get_seqnum)
165 		return wpa_s->driver->get_seqnum(wpa_s->ifname, wpa_s->drv_priv,
166 						 addr, idx, seq);
167 	return -1;
168 }
169 
wpa_drv_sta_deauth(struct wpa_supplicant * wpa_s,const u8 * addr,int reason_code)170 static inline int wpa_drv_sta_deauth(struct wpa_supplicant *wpa_s,
171 				     const u8 *addr, int reason_code)
172 {
173 	if (wpa_s->driver->sta_deauth) {
174 		return wpa_s->driver->sta_deauth(wpa_s->drv_priv,
175 						 wpa_s->own_addr, addr,
176 						 reason_code);
177 	}
178 	return -1;
179 }
180 
wpa_drv_deauthenticate(struct wpa_supplicant * wpa_s,const u8 * addr,int reason_code)181 static inline int wpa_drv_deauthenticate(struct wpa_supplicant *wpa_s,
182 					 const u8 *addr, int reason_code)
183 {
184 	if (wpa_s->driver->deauthenticate) {
185 		return wpa_s->driver->deauthenticate(wpa_s->drv_priv, addr,
186 						     reason_code);
187 	}
188 	return -1;
189 }
190 
wpa_drv_add_pmkid(struct wpa_supplicant * wpa_s,const u8 * bssid,const u8 * pmkid)191 static inline int wpa_drv_add_pmkid(struct wpa_supplicant *wpa_s,
192 				    const u8 *bssid, const u8 *pmkid)
193 {
194 	if (wpa_s->driver->add_pmkid) {
195 		return wpa_s->driver->add_pmkid(wpa_s->drv_priv, bssid, pmkid);
196 	}
197 	return -1;
198 }
199 
wpa_drv_remove_pmkid(struct wpa_supplicant * wpa_s,const u8 * bssid,const u8 * pmkid)200 static inline int wpa_drv_remove_pmkid(struct wpa_supplicant *wpa_s,
201 				       const u8 *bssid, const u8 *pmkid)
202 {
203 	if (wpa_s->driver->remove_pmkid) {
204 		return wpa_s->driver->remove_pmkid(wpa_s->drv_priv, bssid,
205 						   pmkid);
206 	}
207 	return -1;
208 }
209 
wpa_drv_flush_pmkid(struct wpa_supplicant * wpa_s)210 static inline int wpa_drv_flush_pmkid(struct wpa_supplicant *wpa_s)
211 {
212 	if (wpa_s->driver->flush_pmkid) {
213 		return wpa_s->driver->flush_pmkid(wpa_s->drv_priv);
214 	}
215 	return -1;
216 }
217 
wpa_drv_get_capa(struct wpa_supplicant * wpa_s,struct wpa_driver_capa * capa)218 static inline int wpa_drv_get_capa(struct wpa_supplicant *wpa_s,
219 				   struct wpa_driver_capa *capa)
220 {
221 	if (wpa_s->driver->get_capa) {
222 		return wpa_s->driver->get_capa(wpa_s->drv_priv, capa);
223 	}
224 	return -1;
225 }
226 
wpa_drv_poll(struct wpa_supplicant * wpa_s)227 static inline void wpa_drv_poll(struct wpa_supplicant *wpa_s)
228 {
229 	if (wpa_s->driver->poll) {
230 		wpa_s->driver->poll(wpa_s->drv_priv);
231 	}
232 }
233 
wpa_drv_get_ifname(struct wpa_supplicant * wpa_s)234 static inline const char * wpa_drv_get_ifname(struct wpa_supplicant *wpa_s)
235 {
236 	if (wpa_s->driver->get_ifname) {
237 		return wpa_s->driver->get_ifname(wpa_s->drv_priv);
238 	}
239 	return NULL;
240 }
241 
242 static inline const char *
wpa_driver_get_radio_name(struct wpa_supplicant * wpa_s)243 wpa_driver_get_radio_name(struct wpa_supplicant *wpa_s)
244 {
245 	if (wpa_s->driver->get_radio_name)
246 		return wpa_s->driver->get_radio_name(wpa_s->drv_priv);
247 	return NULL;
248 }
249 
wpa_drv_get_mac_addr(struct wpa_supplicant * wpa_s)250 static inline const u8 * wpa_drv_get_mac_addr(struct wpa_supplicant *wpa_s)
251 {
252 	if (wpa_s->driver->get_mac_addr) {
253 		return wpa_s->driver->get_mac_addr(wpa_s->drv_priv);
254 	}
255 	return NULL;
256 }
257 
wpa_drv_set_operstate(struct wpa_supplicant * wpa_s,int state)258 static inline int wpa_drv_set_operstate(struct wpa_supplicant *wpa_s,
259 					int state)
260 {
261 	if (wpa_s->driver->set_operstate)
262 		return wpa_s->driver->set_operstate(wpa_s->drv_priv, state);
263 	return 0;
264 }
265 
wpa_drv_mlme_setprotection(struct wpa_supplicant * wpa_s,const u8 * addr,int protect_type,int key_type)266 static inline int wpa_drv_mlme_setprotection(struct wpa_supplicant *wpa_s,
267 					     const u8 *addr, int protect_type,
268 					     int key_type)
269 {
270 	if (wpa_s->driver->mlme_setprotection)
271 		return wpa_s->driver->mlme_setprotection(wpa_s->drv_priv, addr,
272 							 protect_type,
273 							 key_type);
274 	return 0;
275 }
276 
277 static inline struct hostapd_hw_modes *
wpa_drv_get_hw_feature_data(struct wpa_supplicant * wpa_s,u16 * num_modes,u16 * flags)278 wpa_drv_get_hw_feature_data(struct wpa_supplicant *wpa_s, u16 *num_modes,
279 			    u16 *flags)
280 {
281 	if (wpa_s->driver->get_hw_feature_data)
282 		return wpa_s->driver->get_hw_feature_data(wpa_s->drv_priv,
283 							  num_modes, flags);
284 	return NULL;
285 }
286 
wpa_drv_set_country(struct wpa_supplicant * wpa_s,const char * alpha2)287 static inline int wpa_drv_set_country(struct wpa_supplicant *wpa_s,
288 				      const char *alpha2)
289 {
290 	if (wpa_s->driver->set_country)
291 		return wpa_s->driver->set_country(wpa_s->drv_priv, alpha2);
292 	return 0;
293 }
294 
wpa_drv_send_mlme(struct wpa_supplicant * wpa_s,const u8 * data,size_t data_len,int noack,unsigned int freq)295 static inline int wpa_drv_send_mlme(struct wpa_supplicant *wpa_s,
296 				    const u8 *data, size_t data_len, int noack,
297 				    unsigned int freq)
298 {
299 	if (wpa_s->driver->send_mlme)
300 		return wpa_s->driver->send_mlme(wpa_s->drv_priv,
301 						data, data_len, noack,
302 						freq, NULL, 0);
303 	return -1;
304 }
305 
wpa_drv_update_ft_ies(struct wpa_supplicant * wpa_s,const u8 * md,const u8 * ies,size_t ies_len)306 static inline int wpa_drv_update_ft_ies(struct wpa_supplicant *wpa_s,
307 					const u8 *md,
308 					const u8 *ies, size_t ies_len)
309 {
310 	if (wpa_s->driver->update_ft_ies)
311 		return wpa_s->driver->update_ft_ies(wpa_s->drv_priv, md,
312 						    ies, ies_len);
313 	return -1;
314 }
315 
wpa_drv_set_ap(struct wpa_supplicant * wpa_s,struct wpa_driver_ap_params * params)316 static inline int wpa_drv_set_ap(struct wpa_supplicant *wpa_s,
317 				 struct wpa_driver_ap_params *params)
318 {
319 	if (wpa_s->driver->set_ap)
320 		return wpa_s->driver->set_ap(wpa_s->drv_priv, params);
321 	return -1;
322 }
323 
wpa_drv_sta_add(struct wpa_supplicant * wpa_s,struct hostapd_sta_add_params * params)324 static inline int wpa_drv_sta_add(struct wpa_supplicant *wpa_s,
325 				  struct hostapd_sta_add_params *params)
326 {
327 	if (wpa_s->driver->sta_add)
328 		return wpa_s->driver->sta_add(wpa_s->drv_priv, params);
329 	return -1;
330 }
331 
wpa_drv_sta_remove(struct wpa_supplicant * wpa_s,const u8 * addr)332 static inline int wpa_drv_sta_remove(struct wpa_supplicant *wpa_s,
333 				     const u8 *addr)
334 {
335 	if (wpa_s->driver->sta_remove)
336 		return wpa_s->driver->sta_remove(wpa_s->drv_priv, addr);
337 	return -1;
338 }
339 
wpa_drv_hapd_send_eapol(struct wpa_supplicant * wpa_s,const u8 * addr,const u8 * data,size_t data_len,int encrypt,const u8 * own_addr,u32 flags)340 static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
341 					  const u8 *addr, const u8 *data,
342 					  size_t data_len, int encrypt,
343 					  const u8 *own_addr, u32 flags)
344 {
345 	if (wpa_s->driver->hapd_send_eapol)
346 		return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
347 						      data, data_len, encrypt,
348 						      own_addr, flags);
349 	return -1;
350 }
351 
wpa_drv_sta_set_flags(struct wpa_supplicant * wpa_s,const u8 * addr,int total_flags,int flags_or,int flags_and)352 static inline int wpa_drv_sta_set_flags(struct wpa_supplicant *wpa_s,
353 					const u8 *addr, int total_flags,
354 					int flags_or, int flags_and)
355 {
356 	if (wpa_s->driver->sta_set_flags)
357 		return wpa_s->driver->sta_set_flags(wpa_s->drv_priv, addr,
358 						    total_flags, flags_or,
359 						    flags_and);
360 	return -1;
361 }
362 
wpa_drv_set_supp_port(struct wpa_supplicant * wpa_s,int authorized)363 static inline int wpa_drv_set_supp_port(struct wpa_supplicant *wpa_s,
364 					int authorized)
365 {
366 	if (wpa_s->driver->set_supp_port) {
367 		return wpa_s->driver->set_supp_port(wpa_s->drv_priv,
368 						    authorized);
369 	}
370 	return 0;
371 }
372 
wpa_drv_send_action(struct wpa_supplicant * wpa_s,unsigned int freq,unsigned int wait,const u8 * dst,const u8 * src,const u8 * bssid,const u8 * data,size_t data_len,int no_cck)373 static inline int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
374 				      unsigned int freq,
375 				      unsigned int wait,
376 				      const u8 *dst, const u8 *src,
377 				      const u8 *bssid,
378 				      const u8 *data, size_t data_len,
379 				      int no_cck)
380 {
381 	if (wpa_s->driver->send_action)
382 		return wpa_s->driver->send_action(wpa_s->drv_priv, freq,
383 						  wait, dst, src, bssid,
384 						  data, data_len, no_cck);
385 	return -1;
386 }
387 
wpa_drv_send_action_cancel_wait(struct wpa_supplicant * wpa_s)388 static inline void wpa_drv_send_action_cancel_wait(struct wpa_supplicant *wpa_s)
389 {
390 	if (wpa_s->driver->send_action_cancel_wait)
391 		wpa_s->driver->send_action_cancel_wait(wpa_s->drv_priv);
392 }
393 
wpa_drv_set_freq(struct wpa_supplicant * wpa_s,struct hostapd_freq_params * freq)394 static inline int wpa_drv_set_freq(struct wpa_supplicant *wpa_s,
395 				   struct hostapd_freq_params *freq)
396 {
397 	if (wpa_s->driver->set_freq)
398 		return wpa_s->driver->set_freq(wpa_s->drv_priv, freq);
399 	return -1;
400 }
401 
wpa_drv_if_add(struct wpa_supplicant * wpa_s,enum wpa_driver_if_type type,const char * ifname,const u8 * addr,void * bss_ctx,char * force_ifname,u8 * if_addr,const char * bridge)402 static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s,
403 				 enum wpa_driver_if_type type,
404 				 const char *ifname, const u8 *addr,
405 				 void *bss_ctx, char *force_ifname,
406 				 u8 *if_addr, const char *bridge)
407 {
408 	if (wpa_s->driver->if_add)
409 		return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname,
410 					     addr, bss_ctx, NULL, force_ifname,
411 					     if_addr, bridge, 0, 0);
412 	return -1;
413 }
414 
wpa_drv_if_remove(struct wpa_supplicant * wpa_s,enum wpa_driver_if_type type,const char * ifname)415 static inline int wpa_drv_if_remove(struct wpa_supplicant *wpa_s,
416 				    enum wpa_driver_if_type type,
417 				    const char *ifname)
418 {
419 	if (wpa_s->driver->if_remove)
420 		return wpa_s->driver->if_remove(wpa_s->drv_priv, type, ifname);
421 	return -1;
422 }
423 
wpa_drv_remain_on_channel(struct wpa_supplicant * wpa_s,unsigned int freq,unsigned int duration)424 static inline int wpa_drv_remain_on_channel(struct wpa_supplicant *wpa_s,
425 					    unsigned int freq,
426 					    unsigned int duration)
427 {
428 	if (wpa_s->driver->remain_on_channel)
429 		return wpa_s->driver->remain_on_channel(wpa_s->drv_priv, freq,
430 							duration);
431 	return -1;
432 }
433 
wpa_drv_cancel_remain_on_channel(struct wpa_supplicant * wpa_s)434 static inline int wpa_drv_cancel_remain_on_channel(
435 	struct wpa_supplicant *wpa_s)
436 {
437 	if (wpa_s->driver->cancel_remain_on_channel)
438 		return wpa_s->driver->cancel_remain_on_channel(
439 			wpa_s->drv_priv);
440 	return -1;
441 }
442 
wpa_drv_probe_req_report(struct wpa_supplicant * wpa_s,int report)443 static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s,
444 					   int report)
445 {
446 	if (wpa_s->driver->probe_req_report)
447 		return wpa_s->driver->probe_req_report(wpa_s->drv_priv,
448 						       report);
449 	return -1;
450 }
451 
wpa_drv_deinit_ap(struct wpa_supplicant * wpa_s)452 static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s)
453 {
454 	if (wpa_s->driver->deinit_ap)
455 		return wpa_s->driver->deinit_ap(wpa_s->drv_priv);
456 	return 0;
457 }
458 
wpa_drv_deinit_p2p_cli(struct wpa_supplicant * wpa_s)459 static inline int wpa_drv_deinit_p2p_cli(struct wpa_supplicant *wpa_s)
460 {
461 	if (wpa_s->driver->deinit_p2p_cli)
462 		return wpa_s->driver->deinit_p2p_cli(wpa_s->drv_priv);
463 	return 0;
464 }
465 
wpa_drv_suspend(struct wpa_supplicant * wpa_s)466 static inline void wpa_drv_suspend(struct wpa_supplicant *wpa_s)
467 {
468 	if (wpa_s->driver->suspend)
469 		wpa_s->driver->suspend(wpa_s->drv_priv);
470 }
471 
wpa_drv_resume(struct wpa_supplicant * wpa_s)472 static inline void wpa_drv_resume(struct wpa_supplicant *wpa_s)
473 {
474 	if (wpa_s->driver->resume)
475 		wpa_s->driver->resume(wpa_s->drv_priv);
476 }
477 
wpa_drv_signal_monitor(struct wpa_supplicant * wpa_s,int threshold,int hysteresis)478 static inline int wpa_drv_signal_monitor(struct wpa_supplicant *wpa_s,
479 					 int threshold, int hysteresis)
480 {
481 	if (wpa_s->driver->signal_monitor)
482 		return wpa_s->driver->signal_monitor(wpa_s->drv_priv,
483 						     threshold, hysteresis);
484 	return -1;
485 }
486 
wpa_drv_signal_poll(struct wpa_supplicant * wpa_s,struct wpa_signal_info * si)487 static inline int wpa_drv_signal_poll(struct wpa_supplicant *wpa_s,
488 				      struct wpa_signal_info *si)
489 {
490 	if (wpa_s->driver->signal_poll)
491 		return wpa_s->driver->signal_poll(wpa_s->drv_priv, si);
492 	return -1;
493 }
494 
wpa_drv_pktcnt_poll(struct wpa_supplicant * wpa_s,struct hostap_sta_driver_data * sta)495 static inline int wpa_drv_pktcnt_poll(struct wpa_supplicant *wpa_s,
496 				      struct hostap_sta_driver_data *sta)
497 {
498 	if (wpa_s->driver->read_sta_data)
499 		return wpa_s->driver->read_sta_data(wpa_s->drv_priv, sta,
500 						    wpa_s->bssid);
501 	return -1;
502 }
503 
wpa_drv_set_ap_wps_ie(struct wpa_supplicant * wpa_s,const struct wpabuf * beacon,const struct wpabuf * proberesp,const struct wpabuf * assocresp)504 static inline int wpa_drv_set_ap_wps_ie(struct wpa_supplicant *wpa_s,
505 					const struct wpabuf *beacon,
506 					const struct wpabuf *proberesp,
507 					const struct wpabuf *assocresp)
508 {
509 	if (!wpa_s->driver->set_ap_wps_ie)
510 		return -1;
511 	return wpa_s->driver->set_ap_wps_ie(wpa_s->drv_priv, beacon,
512 					    proberesp, assocresp);
513 }
514 
wpa_drv_get_noa(struct wpa_supplicant * wpa_s,u8 * buf,size_t buf_len)515 static inline int wpa_drv_get_noa(struct wpa_supplicant *wpa_s,
516 				  u8 *buf, size_t buf_len)
517 {
518 	if (!wpa_s->driver->get_noa)
519 		return -1;
520 	return wpa_s->driver->get_noa(wpa_s->drv_priv, buf, buf_len);
521 }
522 
wpa_drv_set_p2p_powersave(struct wpa_supplicant * wpa_s,int legacy_ps,int opp_ps,int ctwindow)523 static inline int wpa_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s,
524 					    int legacy_ps, int opp_ps,
525 					    int ctwindow)
526 {
527 	if (!wpa_s->driver->set_p2p_powersave)
528 		return -1;
529 	return wpa_s->driver->set_p2p_powersave(wpa_s->drv_priv, legacy_ps,
530 						opp_ps, ctwindow);
531 }
532 
wpa_drv_ampdu(struct wpa_supplicant * wpa_s,int ampdu)533 static inline int wpa_drv_ampdu(struct wpa_supplicant *wpa_s, int ampdu)
534 {
535 	if (!wpa_s->driver->ampdu)
536 		return -1;
537 	return wpa_s->driver->ampdu(wpa_s->drv_priv, ampdu);
538 }
539 
wpa_drv_send_tdls_mgmt(struct wpa_supplicant * wpa_s,const u8 * dst,u8 action_code,u8 dialog_token,u16 status_code,u32 peer_capab,int initiator,const u8 * buf,size_t len)540 static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
541 					 const u8 *dst, u8 action_code,
542 					 u8 dialog_token, u16 status_code,
543 					 u32 peer_capab, int initiator,
544 					 const u8 *buf, size_t len)
545 {
546 	if (wpa_s->driver->send_tdls_mgmt) {
547 		return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
548 						     action_code, dialog_token,
549 						     status_code, peer_capab,
550 						     initiator, buf, len);
551 	}
552 	return -1;
553 }
554 
wpa_drv_tdls_oper(struct wpa_supplicant * wpa_s,enum tdls_oper oper,const u8 * peer)555 static inline int wpa_drv_tdls_oper(struct wpa_supplicant *wpa_s,
556 				    enum tdls_oper oper, const u8 *peer)
557 {
558 	if (!wpa_s->driver->tdls_oper)
559 		return -1;
560 	return wpa_s->driver->tdls_oper(wpa_s->drv_priv, oper, peer);
561 }
562 
563 #ifdef ANDROID
wpa_drv_driver_cmd(struct wpa_supplicant * wpa_s,char * cmd,char * buf,size_t buf_len)564 static inline int wpa_drv_driver_cmd(struct wpa_supplicant *wpa_s,
565 				     char *cmd, char *buf, size_t buf_len)
566 {
567 	if (!wpa_s->driver->driver_cmd)
568 		return -1;
569 	return wpa_s->driver->driver_cmd(wpa_s->drv_priv, cmd, buf, buf_len);
570 }
571 #endif /* ANDROID */
572 
wpa_drv_set_rekey_info(struct wpa_supplicant * wpa_s,const u8 * kek,size_t kek_len,const u8 * kck,size_t kck_len,const u8 * replay_ctr)573 static inline void wpa_drv_set_rekey_info(struct wpa_supplicant *wpa_s,
574 					  const u8 *kek, size_t kek_len,
575 					  const u8 *kck, size_t kck_len,
576 					  const u8 *replay_ctr)
577 {
578 	if (!wpa_s->driver->set_rekey_info)
579 		return;
580 	wpa_s->driver->set_rekey_info(wpa_s->drv_priv, kek, kek_len,
581 				      kck, kck_len, replay_ctr);
582 }
583 
wpa_drv_radio_disable(struct wpa_supplicant * wpa_s,int disabled)584 static inline int wpa_drv_radio_disable(struct wpa_supplicant *wpa_s,
585 					int disabled)
586 {
587 	if (!wpa_s->driver->radio_disable)
588 		return -1;
589 	return wpa_s->driver->radio_disable(wpa_s->drv_priv, disabled);
590 }
591 
wpa_drv_switch_channel(struct wpa_supplicant * wpa_s,struct csa_settings * settings)592 static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s,
593 					 struct csa_settings *settings)
594 {
595 	if (!wpa_s->driver->switch_channel)
596 		return -1;
597 	return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings);
598 }
599 
wpa_drv_add_ts(struct wpa_supplicant * wpa_s,u8 tsid,const u8 * address,u8 user_priority,u16 admitted_time)600 static inline int wpa_drv_add_ts(struct wpa_supplicant *wpa_s, u8 tsid,
601 				 const u8 *address, u8 user_priority,
602 				 u16 admitted_time)
603 {
604 	if (!wpa_s->driver->add_tx_ts)
605 		return -1;
606 	return wpa_s->driver->add_tx_ts(wpa_s->drv_priv, tsid, address,
607 					user_priority, admitted_time);
608 }
609 
wpa_drv_del_ts(struct wpa_supplicant * wpa_s,u8 tid,const u8 * address)610 static inline int wpa_drv_del_ts(struct wpa_supplicant *wpa_s, u8 tid,
611 				 const u8 *address)
612 {
613 	if (!wpa_s->driver->del_tx_ts)
614 		return -1;
615 	return wpa_s->driver->del_tx_ts(wpa_s->drv_priv, tid, address);
616 }
617 
wpa_drv_tdls_enable_channel_switch(struct wpa_supplicant * wpa_s,const u8 * addr,u8 oper_class,const struct hostapd_freq_params * freq_params)618 static inline int wpa_drv_tdls_enable_channel_switch(
619 	struct wpa_supplicant *wpa_s, const u8 *addr, u8 oper_class,
620 	const struct hostapd_freq_params *freq_params)
621 {
622 	if (!wpa_s->driver->tdls_enable_channel_switch)
623 		return -1;
624 	return wpa_s->driver->tdls_enable_channel_switch(wpa_s->drv_priv, addr,
625 							 oper_class,
626 							 freq_params);
627 }
628 
629 static inline int
wpa_drv_tdls_disable_channel_switch(struct wpa_supplicant * wpa_s,const u8 * addr)630 wpa_drv_tdls_disable_channel_switch(struct wpa_supplicant *wpa_s,
631 				    const u8 *addr)
632 {
633 	if (!wpa_s->driver->tdls_disable_channel_switch)
634 		return -1;
635 	return wpa_s->driver->tdls_disable_channel_switch(wpa_s->drv_priv,
636 							  addr);
637 }
638 
wpa_drv_wnm_oper(struct wpa_supplicant * wpa_s,enum wnm_oper oper,const u8 * peer,u8 * buf,u16 * buf_len)639 static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
640 				   enum wnm_oper oper, const u8 *peer,
641 				   u8 *buf, u16 *buf_len)
642 {
643 	if (!wpa_s->driver->wnm_oper)
644 		return -1;
645 	return wpa_s->driver->wnm_oper(wpa_s->drv_priv, oper, peer, buf,
646 				       buf_len);
647 }
648 
wpa_drv_status(struct wpa_supplicant * wpa_s,char * buf,size_t buflen)649 static inline int wpa_drv_status(struct wpa_supplicant *wpa_s,
650 				 char *buf, size_t buflen)
651 {
652 	if (!wpa_s->driver->status)
653 		return -1;
654 	return wpa_s->driver->status(wpa_s->drv_priv, buf, buflen);
655 }
656 
wpa_drv_set_qos_map(struct wpa_supplicant * wpa_s,const u8 * qos_map_set,u8 qos_map_set_len)657 static inline int wpa_drv_set_qos_map(struct wpa_supplicant *wpa_s,
658 				      const u8 *qos_map_set, u8 qos_map_set_len)
659 {
660 	if (!wpa_s->driver->set_qos_map)
661 		return -1;
662 	return wpa_s->driver->set_qos_map(wpa_s->drv_priv, qos_map_set,
663 					  qos_map_set_len);
664 }
665 
wpa_drv_wowlan(struct wpa_supplicant * wpa_s,const struct wowlan_triggers * triggers)666 static inline int wpa_drv_wowlan(struct wpa_supplicant *wpa_s,
667 				 const struct wowlan_triggers *triggers)
668 {
669 	if (!wpa_s->driver->set_wowlan)
670 		return -1;
671 	return wpa_s->driver->set_wowlan(wpa_s->drv_priv, triggers);
672 }
673 
wpa_drv_vendor_cmd(struct wpa_supplicant * wpa_s,int vendor_id,int subcmd,const u8 * data,size_t data_len,struct wpabuf * buf)674 static inline int wpa_drv_vendor_cmd(struct wpa_supplicant *wpa_s,
675 				     int vendor_id, int subcmd, const u8 *data,
676 				     size_t data_len, struct wpabuf *buf)
677 {
678 	if (!wpa_s->driver->vendor_cmd)
679 		return -1;
680 	return wpa_s->driver->vendor_cmd(wpa_s->drv_priv, vendor_id, subcmd,
681 					 data, data_len, buf);
682 }
683 
wpa_drv_roaming(struct wpa_supplicant * wpa_s,int allowed,const u8 * bssid)684 static inline int wpa_drv_roaming(struct wpa_supplicant *wpa_s, int allowed,
685 				  const u8 *bssid)
686 {
687 	if (!wpa_s->driver->roaming)
688 		return -1;
689 	return wpa_s->driver->roaming(wpa_s->drv_priv, allowed, bssid);
690 }
691 
wpa_drv_set_mac_addr(struct wpa_supplicant * wpa_s,const u8 * addr)692 static inline int wpa_drv_set_mac_addr(struct wpa_supplicant *wpa_s,
693 				       const u8 *addr)
694 {
695 	if (!wpa_s->driver->set_mac_addr)
696 		return -1;
697 	return wpa_s->driver->set_mac_addr(wpa_s->drv_priv, addr);
698 }
699 
700 
701 #ifdef CONFIG_MACSEC
702 
wpa_drv_macsec_init(struct wpa_supplicant * wpa_s,struct macsec_init_params * params)703 static inline int wpa_drv_macsec_init(struct wpa_supplicant *wpa_s,
704 				      struct macsec_init_params *params)
705 {
706 	if (!wpa_s->driver->macsec_init)
707 		return -1;
708 	return wpa_s->driver->macsec_init(wpa_s->drv_priv, params);
709 }
710 
wpa_drv_macsec_deinit(struct wpa_supplicant * wpa_s)711 static inline int wpa_drv_macsec_deinit(struct wpa_supplicant *wpa_s)
712 {
713 	if (!wpa_s->driver->macsec_deinit)
714 		return -1;
715 	return wpa_s->driver->macsec_deinit(wpa_s->drv_priv);
716 }
717 
wpa_drv_macsec_get_capability(struct wpa_supplicant * wpa_s,enum macsec_cap * cap)718 static inline int wpa_drv_macsec_get_capability(struct wpa_supplicant *wpa_s,
719 						enum macsec_cap *cap)
720 {
721 	if (!wpa_s->driver->macsec_get_capability)
722 		return -1;
723 	return wpa_s->driver->macsec_get_capability(wpa_s->drv_priv, cap);
724 }
725 
wpa_drv_enable_protect_frames(struct wpa_supplicant * wpa_s,Boolean enabled)726 static inline int wpa_drv_enable_protect_frames(struct wpa_supplicant *wpa_s,
727 						Boolean enabled)
728 {
729 	if (!wpa_s->driver->enable_protect_frames)
730 		return -1;
731 	return wpa_s->driver->enable_protect_frames(wpa_s->drv_priv, enabled);
732 }
733 
wpa_drv_enable_encrypt(struct wpa_supplicant * wpa_s,Boolean enabled)734 static inline int wpa_drv_enable_encrypt(struct wpa_supplicant *wpa_s,
735 						Boolean enabled)
736 {
737 	if (!wpa_s->driver->enable_encrypt)
738 		return -1;
739 	return wpa_s->driver->enable_encrypt(wpa_s->drv_priv, enabled);
740 }
741 
wpa_drv_set_replay_protect(struct wpa_supplicant * wpa_s,Boolean enabled,u32 window)742 static inline int wpa_drv_set_replay_protect(struct wpa_supplicant *wpa_s,
743 					     Boolean enabled, u32 window)
744 {
745 	if (!wpa_s->driver->set_replay_protect)
746 		return -1;
747 	return wpa_s->driver->set_replay_protect(wpa_s->drv_priv, enabled,
748 						 window);
749 }
750 
wpa_drv_set_current_cipher_suite(struct wpa_supplicant * wpa_s,u64 cs)751 static inline int wpa_drv_set_current_cipher_suite(struct wpa_supplicant *wpa_s,
752 						   u64 cs)
753 {
754 	if (!wpa_s->driver->set_current_cipher_suite)
755 		return -1;
756 	return wpa_s->driver->set_current_cipher_suite(wpa_s->drv_priv, cs);
757 }
758 
wpa_drv_enable_controlled_port(struct wpa_supplicant * wpa_s,Boolean enabled)759 static inline int wpa_drv_enable_controlled_port(struct wpa_supplicant *wpa_s,
760 						 Boolean enabled)
761 {
762 	if (!wpa_s->driver->enable_controlled_port)
763 		return -1;
764 	return wpa_s->driver->enable_controlled_port(wpa_s->drv_priv, enabled);
765 }
766 
wpa_drv_get_receive_lowest_pn(struct wpa_supplicant * wpa_s,struct receive_sa * sa)767 static inline int wpa_drv_get_receive_lowest_pn(struct wpa_supplicant *wpa_s,
768 						struct receive_sa *sa)
769 {
770 	if (!wpa_s->driver->get_receive_lowest_pn)
771 		return -1;
772 	return wpa_s->driver->get_receive_lowest_pn(wpa_s->drv_priv, sa);
773 }
774 
wpa_drv_get_transmit_next_pn(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)775 static inline int wpa_drv_get_transmit_next_pn(struct wpa_supplicant *wpa_s,
776 						struct transmit_sa *sa)
777 {
778 	if (!wpa_s->driver->get_transmit_next_pn)
779 		return -1;
780 	return wpa_s->driver->get_transmit_next_pn(wpa_s->drv_priv, sa);
781 }
782 
wpa_drv_set_transmit_next_pn(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)783 static inline int wpa_drv_set_transmit_next_pn(struct wpa_supplicant *wpa_s,
784 						struct transmit_sa *sa)
785 {
786 	if (!wpa_s->driver->set_transmit_next_pn)
787 		return -1;
788 	return wpa_s->driver->set_transmit_next_pn(wpa_s->drv_priv, sa);
789 }
790 
791 static inline int
wpa_drv_create_receive_sc(struct wpa_supplicant * wpa_s,struct receive_sc * sc,unsigned int conf_offset,int validation)792 wpa_drv_create_receive_sc(struct wpa_supplicant *wpa_s, struct receive_sc *sc,
793 			  unsigned int conf_offset, int validation)
794 {
795 	if (!wpa_s->driver->create_receive_sc)
796 		return -1;
797 	return wpa_s->driver->create_receive_sc(wpa_s->drv_priv, sc,
798 						conf_offset, validation);
799 }
800 
wpa_drv_delete_receive_sc(struct wpa_supplicant * wpa_s,struct receive_sc * sc)801 static inline int wpa_drv_delete_receive_sc(struct wpa_supplicant *wpa_s,
802 					    struct receive_sc *sc)
803 {
804 	if (!wpa_s->driver->delete_receive_sc)
805 		return -1;
806 	return wpa_s->driver->delete_receive_sc(wpa_s->drv_priv, sc);
807 }
808 
wpa_drv_create_receive_sa(struct wpa_supplicant * wpa_s,struct receive_sa * sa)809 static inline int wpa_drv_create_receive_sa(struct wpa_supplicant *wpa_s,
810 					    struct receive_sa *sa)
811 {
812 	if (!wpa_s->driver->create_receive_sa)
813 		return -1;
814 	return wpa_s->driver->create_receive_sa(wpa_s->drv_priv, sa);
815 }
816 
wpa_drv_delete_receive_sa(struct wpa_supplicant * wpa_s,struct receive_sa * sa)817 static inline int wpa_drv_delete_receive_sa(struct wpa_supplicant *wpa_s,
818 					    struct receive_sa *sa)
819 {
820 	if (!wpa_s->driver->delete_receive_sa)
821 		return -1;
822 	return wpa_s->driver->delete_receive_sa(wpa_s->drv_priv, sa);
823 }
824 
wpa_drv_enable_receive_sa(struct wpa_supplicant * wpa_s,struct receive_sa * sa)825 static inline int wpa_drv_enable_receive_sa(struct wpa_supplicant *wpa_s,
826 					    struct receive_sa *sa)
827 {
828 	if (!wpa_s->driver->enable_receive_sa)
829 		return -1;
830 	return wpa_s->driver->enable_receive_sa(wpa_s->drv_priv, sa);
831 }
832 
wpa_drv_disable_receive_sa(struct wpa_supplicant * wpa_s,struct receive_sa * sa)833 static inline int wpa_drv_disable_receive_sa(struct wpa_supplicant *wpa_s,
834 					     struct receive_sa *sa)
835 {
836 	if (!wpa_s->driver->disable_receive_sa)
837 		return -1;
838 	return wpa_s->driver->disable_receive_sa(wpa_s->drv_priv, sa);
839 }
840 
841 static inline int
wpa_drv_create_transmit_sc(struct wpa_supplicant * wpa_s,struct transmit_sc * sc,unsigned int conf_offset)842 wpa_drv_create_transmit_sc(struct wpa_supplicant *wpa_s, struct transmit_sc *sc,
843 			   unsigned int conf_offset)
844 {
845 	if (!wpa_s->driver->create_transmit_sc)
846 		return -1;
847 	return wpa_s->driver->create_transmit_sc(wpa_s->drv_priv, sc,
848 						 conf_offset);
849 }
850 
wpa_drv_delete_transmit_sc(struct wpa_supplicant * wpa_s,struct transmit_sc * sc)851 static inline int wpa_drv_delete_transmit_sc(struct wpa_supplicant *wpa_s,
852 					     struct transmit_sc *sc)
853 {
854 	if (!wpa_s->driver->delete_transmit_sc)
855 		return -1;
856 	return wpa_s->driver->delete_transmit_sc(wpa_s->drv_priv, sc);
857 }
858 
wpa_drv_create_transmit_sa(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)859 static inline int wpa_drv_create_transmit_sa(struct wpa_supplicant *wpa_s,
860 					     struct transmit_sa *sa)
861 {
862 	if (!wpa_s->driver->create_transmit_sa)
863 		return -1;
864 	return wpa_s->driver->create_transmit_sa(wpa_s->drv_priv, sa);
865 }
866 
wpa_drv_delete_transmit_sa(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)867 static inline int wpa_drv_delete_transmit_sa(struct wpa_supplicant *wpa_s,
868 					     struct transmit_sa *sa)
869 {
870 	if (!wpa_s->driver->delete_transmit_sa)
871 		return -1;
872 	return wpa_s->driver->delete_transmit_sa(wpa_s->drv_priv, sa);
873 }
874 
wpa_drv_enable_transmit_sa(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)875 static inline int wpa_drv_enable_transmit_sa(struct wpa_supplicant *wpa_s,
876 					     struct transmit_sa *sa)
877 {
878 	if (!wpa_s->driver->enable_transmit_sa)
879 		return -1;
880 	return wpa_s->driver->enable_transmit_sa(wpa_s->drv_priv, sa);
881 }
882 
wpa_drv_disable_transmit_sa(struct wpa_supplicant * wpa_s,struct transmit_sa * sa)883 static inline int wpa_drv_disable_transmit_sa(struct wpa_supplicant *wpa_s,
884 					      struct transmit_sa *sa)
885 {
886 	if (!wpa_s->driver->disable_transmit_sa)
887 		return -1;
888 	return wpa_s->driver->disable_transmit_sa(wpa_s->drv_priv, sa);
889 }
890 #endif /* CONFIG_MACSEC */
891 
wpa_drv_setband(struct wpa_supplicant * wpa_s,enum set_band band)892 static inline int wpa_drv_setband(struct wpa_supplicant *wpa_s,
893 				  enum set_band band)
894 {
895 	if (!wpa_s->driver->set_band)
896 		return -1;
897 	return wpa_s->driver->set_band(wpa_s->drv_priv, band);
898 }
899 
wpa_drv_get_pref_freq_list(struct wpa_supplicant * wpa_s,enum wpa_driver_if_type if_type,unsigned int * num,unsigned int * freq_list)900 static inline int wpa_drv_get_pref_freq_list(struct wpa_supplicant *wpa_s,
901 					     enum wpa_driver_if_type if_type,
902 					     unsigned int *num,
903 					     unsigned int *freq_list)
904 {
905 #ifdef CONFIG_TESTING_OPTIONS
906 	if (wpa_s->get_pref_freq_list_override)
907 		return wpas_ctrl_iface_get_pref_freq_list_override(
908 			wpa_s, if_type, num, freq_list);
909 #endif /* CONFIG_TESTING_OPTIONS */
910 	if (!wpa_s->driver->get_pref_freq_list)
911 		return -1;
912 	return wpa_s->driver->get_pref_freq_list(wpa_s->drv_priv, if_type,
913 						 num, freq_list);
914 }
915 
wpa_drv_set_prob_oper_freq(struct wpa_supplicant * wpa_s,unsigned int freq)916 static inline int wpa_drv_set_prob_oper_freq(struct wpa_supplicant *wpa_s,
917 					     unsigned int freq)
918 {
919 	if (!wpa_s->driver->set_prob_oper_freq)
920 		return 0;
921 	return wpa_s->driver->set_prob_oper_freq(wpa_s->drv_priv, freq);
922 }
923 
wpa_drv_abort_scan(struct wpa_supplicant * wpa_s,u64 scan_cookie)924 static inline int wpa_drv_abort_scan(struct wpa_supplicant *wpa_s,
925 				     u64 scan_cookie)
926 {
927 	if (!wpa_s->driver->abort_scan)
928 		return -1;
929 	return wpa_s->driver->abort_scan(wpa_s->drv_priv, scan_cookie);
930 }
931 
wpa_drv_configure_frame_filters(struct wpa_supplicant * wpa_s,u32 filters)932 static inline int wpa_drv_configure_frame_filters(struct wpa_supplicant *wpa_s,
933 						  u32 filters)
934 {
935 	if (!wpa_s->driver->configure_data_frame_filters)
936 		return -1;
937 	return wpa_s->driver->configure_data_frame_filters(wpa_s->drv_priv,
938 							   filters);
939 }
940 
wpa_drv_get_ext_capa(struct wpa_supplicant * wpa_s,enum wpa_driver_if_type type)941 static inline int wpa_drv_get_ext_capa(struct wpa_supplicant *wpa_s,
942 				       enum wpa_driver_if_type type)
943 {
944 	if (!wpa_s->driver->get_ext_capab)
945 		return -1;
946 	return wpa_s->driver->get_ext_capab(wpa_s->drv_priv, type,
947 					    &wpa_s->extended_capa,
948 					    &wpa_s->extended_capa_mask,
949 					    &wpa_s->extended_capa_len);
950 }
951 
wpa_drv_p2p_lo_start(struct wpa_supplicant * wpa_s,unsigned int channel,unsigned int period,unsigned int interval,unsigned int count,const u8 * device_types,size_t dev_types_len,const u8 * ies,size_t ies_len)952 static inline int wpa_drv_p2p_lo_start(struct wpa_supplicant *wpa_s,
953 				       unsigned int channel,
954 				       unsigned int period,
955 				       unsigned int interval,
956 				       unsigned int count,
957 				       const u8 *device_types,
958 				       size_t dev_types_len,
959 				       const u8 *ies, size_t ies_len)
960 {
961 	if (!wpa_s->driver->p2p_lo_start)
962 		return -1;
963 	return wpa_s->driver->p2p_lo_start(wpa_s->drv_priv, channel, period,
964 					   interval, count, device_types,
965 					   dev_types_len, ies, ies_len);
966 }
967 
wpa_drv_p2p_lo_stop(struct wpa_supplicant * wpa_s)968 static inline int wpa_drv_p2p_lo_stop(struct wpa_supplicant *wpa_s)
969 {
970 	if (!wpa_s->driver->p2p_lo_stop)
971 		return -1;
972 	return wpa_s->driver->p2p_lo_stop(wpa_s->drv_priv);
973 }
974 
wpa_drv_set_default_scan_ies(struct wpa_supplicant * wpa_s,const u8 * ies,size_t len)975 static inline int wpa_drv_set_default_scan_ies(struct wpa_supplicant *wpa_s,
976 					       const u8 *ies, size_t len)
977 {
978 	if (!wpa_s->driver->set_default_scan_ies)
979 		return -1;
980 	return wpa_s->driver->set_default_scan_ies(wpa_s->drv_priv, ies, len);
981 }
982 
wpa_drv_set_tdls_mode(struct wpa_supplicant * wpa_s,int tdls_external_control)983 static inline int wpa_drv_set_tdls_mode(struct wpa_supplicant *wpa_s,
984 					int tdls_external_control)
985 {
986 	if (!wpa_s->driver->set_tdls_mode)
987 		return -1;
988 	return wpa_s->driver->set_tdls_mode(wpa_s->drv_priv,
989 					    tdls_external_control);
990 }
991 
992 #endif /* DRIVER_I_H */
993