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 1422976643 Lines: 211 282 74.8 %
Date: 2015-02-03 Functions: 62 68 91.2 %

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

Generated by: LCOV version 1.10