linux/drivers/staging/wilc1000/host_interface.h
<<
>>
Prefs
   1#ifndef HOST_INT_H
   2#define HOST_INT_H
   3
   4#include "coreconfigurator.h"
   5
   6#define IP_ALEN  4
   7
   8#define IDLE_MODE       0x00
   9#define AP_MODE         0x01
  10#define STATION_MODE    0x02
  11#define GO_MODE         0x03
  12#define CLIENT_MODE     0x04
  13#define ACTION          0xD0
  14#define PROBE_REQ       0x40
  15#define PROBE_RESP      0x50
  16
  17#define ACTION_FRM_IDX                          0
  18#define PROBE_REQ_IDX                           1
  19#define MAX_NUM_STA                             9
  20#define ACTIVE_SCAN_TIME                        10
  21#define PASSIVE_SCAN_TIME                       1200
  22#define MIN_SCAN_TIME                           10
  23#define MAX_SCAN_TIME                           1200
  24#define DEFAULT_SCAN                            0
  25#define USER_SCAN                               BIT(0)
  26#define OBSS_PERIODIC_SCAN                      BIT(1)
  27#define OBSS_ONETIME_SCAN                       BIT(2)
  28#define GTK_RX_KEY_BUFF_LEN                     24
  29#define ADDKEY                                  0x1
  30#define REMOVEKEY                               0x2
  31#define DEFAULTKEY                              0x4
  32#define ADDKEY_AP                               0x8
  33#define MAX_NUM_SCANNED_NETWORKS                100
  34#define MAX_NUM_SCANNED_NETWORKS_SHADOW         130
  35#define MAX_NUM_PROBED_SSID                     10
  36#define CHANNEL_SCAN_TIME                       250
  37
  38#define TX_MIC_KEY_LEN                          8
  39#define RX_MIC_KEY_LEN                          8
  40#define PTK_KEY_LEN                             16
  41
  42#define TX_MIC_KEY_MSG_LEN                      26
  43#define RX_MIC_KEY_MSG_LEN                      48
  44#define PTK_KEY_MSG_LEN                         39
  45
  46#define PMKSA_KEY_LEN                           22
  47#define ETH_ALEN                                6
  48#define PMKID_LEN                               16
  49#define WILC_MAX_NUM_PMKIDS                     16
  50#define WILC_SUPP_MCS_SET_SIZE                  16
  51#define WILC_ADD_STA_LENGTH                     40
  52#define SCAN_EVENT_DONE_ABORTED
  53#define NUM_CONCURRENT_IFC                      2
  54
  55struct rf_info {
  56        u8 link_speed;
  57        s8 rssi;
  58        u32 tx_cnt;
  59        u32 rx_cnt;
  60        u32 tx_fail_cnt;
  61};
  62
  63enum host_if_state {
  64        HOST_IF_IDLE                    = 0,
  65        HOST_IF_SCANNING                = 1,
  66        HOST_IF_CONNECTING              = 2,
  67        HOST_IF_WAITING_CONN_RESP       = 3,
  68        HOST_IF_CONNECTED               = 4,
  69        HOST_IF_P2P_LISTEN              = 5,
  70        HOST_IF_FORCE_32BIT             = 0xFFFFFFFF
  71};
  72
  73struct host_if_pmkid {
  74        u8 bssid[ETH_ALEN];
  75        u8 pmkid[PMKID_LEN];
  76};
  77
  78struct host_if_pmkid_attr {
  79        u8 numpmkid;
  80        struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
  81};
  82
  83enum CURRENT_TXRATE {
  84        AUTORATE        = 0,
  85        MBPS_1          = 1,
  86        MBPS_2          = 2,
  87        MBPS_5_5        = 5,
  88        MBPS_11         = 11,
  89        MBPS_6          = 6,
  90        MBPS_9          = 9,
  91        MBPS_12         = 12,
  92        MBPS_18         = 18,
  93        MBPS_24         = 24,
  94        MBPS_36         = 36,
  95        MBPS_48         = 48,
  96        MBPS_54         = 54
  97};
  98
  99struct cfg_param_attr {
 100        u32 flag;
 101        u8 ht_enable;
 102        u8 bss_type;
 103        u8 auth_type;
 104        u16 auth_timeout;
 105        u8 power_mgmt_mode;
 106        u16 short_retry_limit;
 107        u16 long_retry_limit;
 108        u16 frag_threshold;
 109        u16 rts_threshold;
 110        u16 preamble_type;
 111        u8 short_slot_allowed;
 112        u8 txop_prot_disabled;
 113        u16 beacon_interval;
 114        u16 dtim_period;
 115        enum SITESURVEY site_survey_enabled;
 116        u16 site_survey_scan_time;
 117        u8 scan_source;
 118        u16 active_scan_time;
 119        u16 passive_scan_time;
 120        enum CURRENT_TXRATE curr_tx_rate;
 121
 122};
 123
 124enum cfg_param {
 125        RETRY_SHORT             = BIT(0),
 126        RETRY_LONG              = BIT(1),
 127        FRAG_THRESHOLD          = BIT(2),
 128        RTS_THRESHOLD           = BIT(3),
 129        BSS_TYPE                = BIT(4),
 130        AUTH_TYPE               = BIT(5),
 131        AUTHEN_TIMEOUT          = BIT(6),
 132        POWER_MANAGEMENT        = BIT(7),
 133        PREAMBLE                = BIT(8),
 134        SHORT_SLOT_ALLOWED      = BIT(9),
 135        TXOP_PROT_DISABLE       = BIT(10),
 136        BEACON_INTERVAL         = BIT(11),
 137        DTIM_PERIOD             = BIT(12),
 138        SITE_SURVEY             = BIT(13),
 139        SITE_SURVEY_SCAN_TIME   = BIT(14),
 140        ACTIVE_SCANTIME         = BIT(15),
 141        PASSIVE_SCANTIME        = BIT(16),
 142        CURRENT_TX_RATE         = BIT(17),
 143        HT_ENABLE               = BIT(18),
 144};
 145
 146struct found_net_info {
 147        u8 bssid[6];
 148        s8 rssi;
 149};
 150
 151enum scan_event {
 152        SCAN_EVENT_NETWORK_FOUND        = 0,
 153        SCAN_EVENT_DONE                 = 1,
 154        SCAN_EVENT_ABORTED              = 2,
 155        SCAN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
 156};
 157
 158enum conn_event {
 159        CONN_DISCONN_EVENT_CONN_RESP            = 0,
 160        CONN_DISCONN_EVENT_DISCONN_NOTIF        = 1,
 161        CONN_DISCONN_EVENT_FORCE_32BIT          = 0xFFFFFFFF
 162};
 163
 164enum KEY_TYPE {
 165        WEP,
 166        WPA_RX_GTK,
 167        WPA_PTK,
 168        PMKSA,
 169};
 170
 171typedef void (*wilc_scan_result)(enum scan_event, struct network_info *,
 172                                 void *, void *);
 173
 174typedef void (*wilc_connect_result)(enum conn_event,
 175                                     struct connect_info *,
 176                                     u8,
 177                                     struct disconnect_info *,
 178                                     void *);
 179
 180typedef void (*wilc_remain_on_chan_expired)(void *, u32);
 181typedef void (*wilc_remain_on_chan_ready)(void *);
 182
 183struct rcvd_net_info {
 184        u8 *buffer;
 185        u32 len;
 186};
 187
 188struct hidden_net_info {
 189        u8  *ssid;
 190        u8 ssid_len;
 191};
 192
 193struct hidden_network {
 194        struct hidden_net_info *net_info;
 195        u8 n_ssids;
 196};
 197
 198struct user_scan_req {
 199        wilc_scan_result scan_result;
 200        void *arg;
 201        u32 rcvd_ch_cnt;
 202        struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS];
 203};
 204
 205struct user_conn_req {
 206        u8 *bssid;
 207        u8 *ssid;
 208        u8 security;
 209        enum AUTHTYPE auth_type;
 210        size_t ssid_len;
 211        u8 *ies;
 212        size_t ies_len;
 213        wilc_connect_result conn_result;
 214        bool ht_capable;
 215        void *arg;
 216};
 217
 218struct drv_handler {
 219        u32 handler;
 220        u8 mac_idx;
 221};
 222
 223struct op_mode {
 224        u32 mode;
 225};
 226
 227struct set_mac_addr {
 228        u8 mac_addr[ETH_ALEN];
 229};
 230
 231struct get_mac_addr {
 232        u8 *mac_addr;
 233};
 234
 235struct ba_session_info {
 236        u8 bssid[ETH_ALEN];
 237        u8 tid;
 238        u16 buf_size;
 239        u16 time_out;
 240};
 241
 242struct remain_ch {
 243        u16 ch;
 244        u32 duration;
 245        wilc_remain_on_chan_expired expired;
 246        wilc_remain_on_chan_ready ready;
 247        void *arg;
 248        u32 id;
 249};
 250
 251struct reg_frame {
 252        bool reg;
 253        u16 frame_type;
 254        u8 reg_id;
 255};
 256
 257enum p2p_listen_state {
 258        P2P_IDLE,
 259        P2P_LISTEN,
 260        P2P_GRP_FORMATION
 261};
 262
 263struct wilc;
 264struct host_if_drv {
 265        struct user_scan_req usr_scan_req;
 266        struct user_conn_req usr_conn_req;
 267        struct remain_ch remain_on_ch;
 268        u8 remain_on_ch_pending;
 269        u64 p2p_timeout;
 270        u8 p2p_connect;
 271
 272        enum host_if_state hif_state;
 273
 274        u8 assoc_bssid[ETH_ALEN];
 275        struct cfg_param_attr cfg_values;
 276
 277        struct mutex cfg_values_lock;
 278        struct completion comp_test_key_block;
 279        struct completion comp_test_disconn_block;
 280        struct completion comp_get_rssi;
 281        struct completion comp_inactive_time;
 282
 283        struct timer_list scan_timer;
 284        struct timer_list connect_timer;
 285        struct timer_list remain_on_ch_timer;
 286
 287        bool IFC_UP;
 288};
 289
 290struct add_sta_param {
 291        u8 bssid[ETH_ALEN];
 292        u16 aid;
 293        u8 rates_len;
 294        const u8 *rates;
 295        bool ht_supported;
 296        u16 ht_capa_info;
 297        u8 ht_ampdu_params;
 298        u8 ht_supp_mcs_set[16];
 299        u16 ht_ext_params;
 300        u32 ht_tx_bf_cap;
 301        u8 ht_ante_sel;
 302        u16 flags_mask;
 303        u16 flags_set;
 304};
 305
 306struct wilc_vif;
 307s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
 308int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
 309int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
 310int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
 311                             u8 index);
 312int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
 313                            u8 index, u8 mode, enum AUTHTYPE auth_type);
 314int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
 315                 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
 316                 u8 mode, u8 cipher_mode, u8 index);
 317s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
 318                           u32 *pu32InactiveTime);
 319int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
 320                    u8 index, u32 key_rsc_len, const u8 *key_rsc,
 321                    const u8 *rx_mic, const u8 *tx_mic, u8 mode,
 322                    u8 cipher_mode);
 323int wilc_set_pmkid_info(struct wilc_vif *vif,
 324                        struct host_if_pmkid_attr *pmkid);
 325int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
 326int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
 327                      size_t ssid_len, const u8 *ies, size_t ies_len,
 328                      wilc_connect_result connect_result, void *user_arg,
 329                      u8 security, enum AUTHTYPE auth_type,
 330                      u8 channel, void *join_params);
 331int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
 332int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
 333int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
 334int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
 335              u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
 336              size_t ies_len, wilc_scan_result scan_result, void *user_arg,
 337              struct hidden_network *hidden_network);
 338int wilc_hif_set_cfg(struct wilc_vif *vif,
 339                     struct cfg_param_attr *cfg_param);
 340int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
 341int wilc_deinit(struct wilc_vif *vif);
 342int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
 343                    u32 head_len, u8 *head, u32 tail_len, u8 *tail);
 344int wilc_del_beacon(struct wilc_vif *vif);
 345int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
 346int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
 347int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
 348int wilc_edit_station(struct wilc_vif *vif,
 349                      struct add_sta_param *sta_param);
 350int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
 351int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
 352                                u32 count);
 353int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
 354int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
 355                           u32 duration, u16 chan,
 356                           wilc_remain_on_chan_expired expired,
 357                           wilc_remain_on_chan_ready ready,
 358                           void *user_arg);
 359int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
 360int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
 361int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mac_idx);
 362int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 363int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
 364void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
 365int wilc_get_vif_idx(struct wilc_vif *vif);
 366int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
 367int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
 368
 369extern bool wilc_optaining_ip;
 370extern u8 wilc_connected_ssid[6];
 371extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
 372
 373extern int wilc_connecting;
 374extern u8 wilc_initialized;
 375extern struct timer_list wilc_during_ip_timer;
 376
 377#endif
 378