root/drivers/staging/wilc1000/wilc_hif.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 /*
   3  * Copyright (c) 2012 - 2018 Microchip Technology Inc., and its subsidiaries
   4  * All rights reserved.
   5  */
   6 
   7 #ifndef HOST_INT_H
   8 #define HOST_INT_H
   9 #include <linux/ieee80211.h>
  10 #include "wilc_wlan_if.h"
  11 
  12 enum {
  13         WILC_IDLE_MODE = 0x0,
  14         WILC_AP_MODE = 0x1,
  15         WILC_STATION_MODE = 0x2,
  16         WILC_GO_MODE = 0x3,
  17         WILC_CLIENT_MODE = 0x4
  18 };
  19 
  20 #define WILC_MAX_NUM_STA                        9
  21 #define WILC_MAX_NUM_SCANNED_CH                 14
  22 #define WILC_MAX_NUM_PROBED_SSID                10
  23 
  24 #define WILC_TX_MIC_KEY_LEN                     8
  25 #define WILC_RX_MIC_KEY_LEN                     8
  26 
  27 #define WILC_MAX_NUM_PMKIDS                     16
  28 #define WILC_ADD_STA_LENGTH                     40
  29 #define WILC_NUM_CONCURRENT_IFC                 2
  30 
  31 enum {
  32         WILC_SET_CFG = 0,
  33         WILC_GET_CFG
  34 };
  35 
  36 #define WILC_MAX_ASSOC_RESP_FRAME_SIZE   256
  37 
  38 struct assoc_resp {
  39         __le16 capab_info;
  40         __le16 status_code;
  41         __le16 aid;
  42 } __packed;
  43 
  44 struct rf_info {
  45         u8 link_speed;
  46         s8 rssi;
  47         u32 tx_cnt;
  48         u32 rx_cnt;
  49         u32 tx_fail_cnt;
  50 };
  51 
  52 enum host_if_state {
  53         HOST_IF_IDLE                    = 0,
  54         HOST_IF_SCANNING                = 1,
  55         HOST_IF_CONNECTING              = 2,
  56         HOST_IF_WAITING_CONN_RESP       = 3,
  57         HOST_IF_CONNECTED               = 4,
  58         HOST_IF_P2P_LISTEN              = 5,
  59         HOST_IF_FORCE_32BIT             = 0xFFFFFFFF
  60 };
  61 
  62 struct wilc_pmkid {
  63         u8 bssid[ETH_ALEN];
  64         u8 pmkid[WLAN_PMKID_LEN];
  65 } __packed;
  66 
  67 struct wilc_pmkid_attr {
  68         u8 numpmkid;
  69         struct wilc_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
  70 } __packed;
  71 
  72 struct cfg_param_attr {
  73         u32 flag;
  74         u16 short_retry_limit;
  75         u16 long_retry_limit;
  76         u16 frag_threshold;
  77         u16 rts_threshold;
  78 };
  79 
  80 enum cfg_param {
  81         WILC_CFG_PARAM_RETRY_SHORT = BIT(0),
  82         WILC_CFG_PARAM_RETRY_LONG = BIT(1),
  83         WILC_CFG_PARAM_FRAG_THRESHOLD = BIT(2),
  84         WILC_CFG_PARAM_RTS_THRESHOLD = BIT(3)
  85 };
  86 
  87 enum scan_event {
  88         SCAN_EVENT_NETWORK_FOUND        = 0,
  89         SCAN_EVENT_DONE                 = 1,
  90         SCAN_EVENT_ABORTED              = 2,
  91         SCAN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
  92 };
  93 
  94 enum conn_event {
  95         CONN_DISCONN_EVENT_CONN_RESP            = 0,
  96         CONN_DISCONN_EVENT_DISCONN_NOTIF        = 1,
  97         CONN_DISCONN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
  98 };
  99 
 100 enum {
 101         WILC_HIF_SDIO = 0,
 102         WILC_HIF_SPI = BIT(0)
 103 };
 104 
 105 enum {
 106         WILC_MAC_STATUS_INIT = -1,
 107         WILC_MAC_STATUS_DISCONNECTED = 0,
 108         WILC_MAC_STATUS_CONNECTED = 1
 109 };
 110 
 111 struct wilc_rcvd_net_info {
 112         s8 rssi;
 113         u8 ch;
 114         u16 frame_len;
 115         struct ieee80211_mgmt *mgmt;
 116 };
 117 
 118 struct wilc_user_scan_req {
 119         void (*scan_result)(enum scan_event evt,
 120                             struct wilc_rcvd_net_info *info, void *priv);
 121         void *arg;
 122         u32 ch_cnt;
 123 };
 124 
 125 struct wilc_conn_info {
 126         u8 bssid[ETH_ALEN];
 127         u8 security;
 128         enum authtype auth_type;
 129         u8 ch;
 130         u8 *req_ies;
 131         size_t req_ies_len;
 132         u8 *resp_ies;
 133         u16 resp_ies_len;
 134         u16 status;
 135         void (*conn_result)(enum conn_event evt, u8 status, void *priv_data);
 136         void *arg;
 137         void *param;
 138 };
 139 
 140 struct wilc_remain_ch {
 141         u16 ch;
 142         u32 duration;
 143         void (*expired)(void *priv, u64 cookie);
 144         void *arg;
 145         u32 cookie;
 146 };
 147 
 148 struct wilc;
 149 struct host_if_drv {
 150         struct wilc_user_scan_req usr_scan_req;
 151         struct wilc_conn_info conn_info;
 152         struct wilc_remain_ch remain_on_ch;
 153         u64 p2p_timeout;
 154 
 155         enum host_if_state hif_state;
 156 
 157         u8 assoc_bssid[ETH_ALEN];
 158 
 159         struct timer_list scan_timer;
 160         struct wilc_vif *scan_timer_vif;
 161 
 162         struct timer_list connect_timer;
 163         struct wilc_vif *connect_timer_vif;
 164 
 165         struct timer_list remain_on_ch_timer;
 166         struct wilc_vif *remain_on_ch_timer_vif;
 167 
 168         bool ifc_up;
 169         u8 assoc_resp[WILC_MAX_ASSOC_RESP_FRAME_SIZE];
 170 };
 171 
 172 struct wilc_vif;
 173 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
 174 int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
 175 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 176                              u8 index);
 177 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
 178                             u8 index, u8 mode, enum authtype auth_type);
 179 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
 180                  const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
 181                  u8 mode, u8 cipher_mode, u8 index);
 182 s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
 183                            u32 *out_val);
 184 int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 185                     u8 index, u32 key_rsc_len, const u8 *key_rsc,
 186                     const u8 *rx_mic, const u8 *tx_mic, u8 mode,
 187                     u8 cipher_mode);
 188 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid);
 189 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
 190 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
 191                       size_t ies_len);
 192 int wilc_disconnect(struct wilc_vif *vif);
 193 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
 194 int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
 195 int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 196               u8 *ch_freq_list, u8 ch_list_len,
 197               void (*scan_result_fn)(enum scan_event,
 198                                      struct wilc_rcvd_net_info *, void *),
 199               void *user_arg, struct cfg80211_scan_request *request);
 200 int wilc_hif_set_cfg(struct wilc_vif *vif,
 201                      struct cfg_param_attr *cfg_param);
 202 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
 203 int wilc_deinit(struct wilc_vif *vif);
 204 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
 205                     struct cfg80211_beacon_data *params);
 206 int wilc_del_beacon(struct wilc_vif *vif);
 207 int wilc_add_station(struct wilc_vif *vif, const u8 *mac,
 208                      struct station_parameters *params);
 209 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
 210 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
 211 int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
 212                       struct station_parameters *params);
 213 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 214 int wilc_setup_multicast_filter(struct wilc_vif *vif, u32 enabled, u32 count,
 215                                 u8 *mc_list);
 216 int wilc_remain_on_channel(struct wilc_vif *vif, u64 cookie,
 217                            u32 duration, u16 chan,
 218                            void (*expired)(void *, u64),
 219                            void *user_arg);
 220 int wilc_listen_state_expired(struct wilc_vif *vif, u64 cookie);
 221 void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 222 int wilc_set_operation_mode(struct wilc_vif *vif, int index, u8 mode,
 223                             u8 ifc_id);
 224 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
 225 int wilc_get_vif_idx(struct wilc_vif *vif);
 226 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 227 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 228 void wilc_scan_complete_received(struct wilc *wilc, u8 *buffer, u32 length);
 229 void wilc_network_info_received(struct wilc *wilc, u8 *buffer, u32 length);
 230 void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *buffer, u32 length);
 231 void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,
 232                                 struct cfg80211_crypto_settings *crypto);
 233 #endif

/* [<][>][^][v][top][bottom][index][help] */