LCOV - code coverage report
Current view: top level - wpa_supplicant - driver_i.h (source / functions) Hit Total Coverage
Test: wpa_supplicant/hostapd combined for hwsim test run 1443382998 Lines: 220 294 74.8 %
Date: 2015-09-27 Functions: 65 71 91.5 %

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

Generated by: LCOV version 1.10