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