0001
0002
0003
0004
0005
0006
0007
0008 #ifndef _GELIC_WIRELESS_H
0009 #define _GELIC_WIRELESS_H
0010
0011 #include <linux/wireless.h>
0012 #include <net/iw_handler.h>
0013
0014
0015
0016 enum gelic_lv1_wl_event {
0017 GELIC_LV1_WL_EVENT_DEVICE_READY = 0x01,
0018 GELIC_LV1_WL_EVENT_SCAN_COMPLETED = 0x02,
0019 GELIC_LV1_WL_EVENT_DEAUTH = 0x04,
0020 GELIC_LV1_WL_EVENT_BEACON_LOST = 0x08,
0021 GELIC_LV1_WL_EVENT_CONNECTED = 0x10,
0022 GELIC_LV1_WL_EVENT_WPA_CONNECTED = 0x20,
0023 GELIC_LV1_WL_EVENT_WPA_ERROR = 0x40,
0024 };
0025
0026
0027 enum gelic_eurus_command {
0028 GELIC_EURUS_CMD_ASSOC = 1,
0029 GELIC_EURUS_CMD_DISASSOC = 2,
0030 GELIC_EURUS_CMD_START_SCAN = 3,
0031 GELIC_EURUS_CMD_GET_SCAN = 4,
0032 GELIC_EURUS_CMD_SET_COMMON_CFG = 5,
0033 GELIC_EURUS_CMD_GET_COMMON_CFG = 6,
0034 GELIC_EURUS_CMD_SET_WEP_CFG = 7,
0035 GELIC_EURUS_CMD_GET_WEP_CFG = 8,
0036 GELIC_EURUS_CMD_SET_WPA_CFG = 9,
0037 GELIC_EURUS_CMD_GET_WPA_CFG = 10,
0038 GELIC_EURUS_CMD_GET_RSSI_CFG = 11,
0039 GELIC_EURUS_CMD_MAX_INDEX
0040 };
0041
0042
0043 enum gelic_eurus_bss_type {
0044 GELIC_EURUS_BSS_INFRA = 0,
0045 GELIC_EURUS_BSS_ADHOC = 1,
0046 };
0047
0048 enum gelic_eurus_auth_method {
0049 GELIC_EURUS_AUTH_OPEN = 0,
0050 GELIC_EURUS_AUTH_SHARED = 1,
0051 };
0052
0053 enum gelic_eurus_opmode {
0054 GELIC_EURUS_OPMODE_11BG = 0,
0055 GELIC_EURUS_OPMODE_11B = 1,
0056 GELIC_EURUS_OPMODE_11G = 2,
0057 };
0058
0059 struct gelic_eurus_common_cfg {
0060
0061 u16 scan_index;
0062 u16 bss_type;
0063 u16 auth_method;
0064 u16 op_mode;
0065 } __packed;
0066
0067
0068
0069 enum gelic_eurus_wep_security {
0070 GELIC_EURUS_WEP_SEC_NONE = 0,
0071 GELIC_EURUS_WEP_SEC_40BIT = 1,
0072 GELIC_EURUS_WEP_SEC_104BIT = 2,
0073 };
0074
0075 struct gelic_eurus_wep_cfg {
0076
0077 u16 security;
0078 u8 key[4][16];
0079 } __packed;
0080
0081
0082 enum gelic_eurus_wpa_security {
0083 GELIC_EURUS_WPA_SEC_NONE = 0x0000,
0084
0085 GELIC_EURUS_WPA_SEC_WPA_TKIP_TKIP = 0x0001,
0086
0087 GELIC_EURUS_WPA_SEC_WPA_AES_AES = 0x0002,
0088
0089 GELIC_EURUS_WPA_SEC_WPA2_TKIP_TKIP = 0x0004,
0090
0091 GELIC_EURUS_WPA_SEC_WPA2_AES_AES = 0x0008,
0092
0093 GELIC_EURUS_WPA_SEC_WPA_TKIP_AES = 0x0010,
0094
0095 GELIC_EURUS_WPA_SEC_WPA2_TKIP_AES = 0x0020,
0096 };
0097
0098 enum gelic_eurus_wpa_psk_type {
0099 GELIC_EURUS_WPA_PSK_PASSPHRASE = 0,
0100 GELIC_EURUS_WPA_PSK_BIN = 1,
0101 };
0102
0103 #define GELIC_WL_EURUS_PSK_MAX_LEN 64
0104 #define WPA_PSK_LEN 32
0105
0106 struct gelic_eurus_wpa_cfg {
0107
0108 u16 security;
0109 u16 psk_type;
0110 u8 psk[GELIC_WL_EURUS_PSK_MAX_LEN];
0111 } __packed;
0112
0113
0114 enum gelic_eurus_scan_capability {
0115 GELIC_EURUS_SCAN_CAP_ADHOC = 0x0000,
0116 GELIC_EURUS_SCAN_CAP_INFRA = 0x0001,
0117 GELIC_EURUS_SCAN_CAP_MASK = 0x0001,
0118 };
0119
0120 enum gelic_eurus_scan_sec_type {
0121 GELIC_EURUS_SCAN_SEC_NONE = 0x0000,
0122 GELIC_EURUS_SCAN_SEC_WEP = 0x0100,
0123 GELIC_EURUS_SCAN_SEC_WPA = 0x0200,
0124 GELIC_EURUS_SCAN_SEC_WPA2 = 0x0400,
0125 GELIC_EURUS_SCAN_SEC_MASK = 0x0f00,
0126 };
0127
0128 enum gelic_eurus_scan_sec_wep_type {
0129 GELIC_EURUS_SCAN_SEC_WEP_UNKNOWN = 0x0000,
0130 GELIC_EURUS_SCAN_SEC_WEP_40 = 0x0001,
0131 GELIC_EURUS_SCAN_SEC_WEP_104 = 0x0002,
0132 GELIC_EURUS_SCAN_SEC_WEP_MASK = 0x0003,
0133 };
0134
0135 enum gelic_eurus_scan_sec_wpa_type {
0136 GELIC_EURUS_SCAN_SEC_WPA_UNKNOWN = 0x0000,
0137 GELIC_EURUS_SCAN_SEC_WPA_TKIP = 0x0001,
0138 GELIC_EURUS_SCAN_SEC_WPA_AES = 0x0002,
0139 GELIC_EURUS_SCAN_SEC_WPA_MASK = 0x0003,
0140 };
0141
0142
0143
0144
0145 struct gelic_eurus_scan_info {
0146
0147 __be16 size;
0148 __be16 rssi;
0149 __be16 channel;
0150 __be16 beacon_period;
0151 __be16 capability;
0152 __be16 security;
0153 u8 bssid[8];
0154 u8 essid[32];
0155 u8 rate[16];
0156 u8 ext_rate[16];
0157 __be32 reserved1;
0158 __be32 reserved2;
0159 __be32 reserved3;
0160 __be32 reserved4;
0161 u8 elements[];
0162 } __packed;
0163
0164
0165 #define GELIC_EURUS_MAX_SCAN (16)
0166 struct gelic_wl_scan_info {
0167 struct list_head list;
0168 struct gelic_eurus_scan_info *hwinfo;
0169
0170 int valid;
0171
0172 unsigned int eurus_index;
0173 unsigned long last_scanned;
0174
0175 unsigned int rate_len;
0176 unsigned int rate_ext_len;
0177 unsigned int essid_len;
0178 };
0179
0180
0181 struct gelic_eurus_rssi_info {
0182
0183 __be16 rssi;
0184 } __packed;
0185
0186
0187
0188 enum gelic_wl_info_status_bit {
0189 GELIC_WL_STAT_CONFIGURED,
0190 GELIC_WL_STAT_CH_INFO,
0191 GELIC_WL_STAT_ESSID_SET,
0192 GELIC_WL_STAT_BSSID_SET,
0193 GELIC_WL_STAT_WPA_PSK_SET,
0194 GELIC_WL_STAT_WPA_LEVEL_SET,
0195 };
0196
0197
0198 enum gelic_wl_scan_state {
0199
0200 GELIC_WL_SCAN_STAT_INIT,
0201
0202 GELIC_WL_SCAN_STAT_SCANNING,
0203
0204 GELIC_WL_SCAN_STAT_GOT_LIST,
0205 };
0206
0207
0208 enum gelic_wl_cipher_method {
0209 GELIC_WL_CIPHER_NONE,
0210 GELIC_WL_CIPHER_WEP,
0211 GELIC_WL_CIPHER_TKIP,
0212 GELIC_WL_CIPHER_AES,
0213 };
0214
0215
0216 enum gelic_wl_wpa_level {
0217 GELIC_WL_WPA_LEVEL_NONE,
0218 GELIC_WL_WPA_LEVEL_WPA,
0219 GELIC_WL_WPA_LEVEL_WPA2,
0220 };
0221
0222
0223 enum gelic_wl_assoc_state {
0224 GELIC_WL_ASSOC_STAT_DISCONN,
0225 GELIC_WL_ASSOC_STAT_ASSOCIATING,
0226 GELIC_WL_ASSOC_STAT_ASSOCIATED,
0227 };
0228
0229 #define GELIC_WEP_KEYS 4
0230 struct gelic_wl_info {
0231
0232 struct mutex scan_lock;
0233 struct list_head network_list;
0234 struct list_head network_free_list;
0235 struct gelic_wl_scan_info *networks;
0236
0237 unsigned long scan_age;
0238 enum gelic_wl_scan_state scan_stat;
0239 struct completion scan_done;
0240
0241
0242 struct workqueue_struct *eurus_cmd_queue;
0243 struct completion cmd_done_intr;
0244
0245
0246 struct workqueue_struct *event_queue;
0247 struct delayed_work event_work;
0248
0249
0250 unsigned long stat;
0251 enum gelic_eurus_auth_method auth_method;
0252 enum gelic_wl_cipher_method group_cipher_method;
0253 enum gelic_wl_cipher_method pairwise_cipher_method;
0254 enum gelic_wl_wpa_level wpa_level;
0255
0256
0257 struct mutex assoc_stat_lock;
0258 struct delayed_work assoc_work;
0259 enum gelic_wl_assoc_state assoc_stat;
0260 struct completion assoc_done;
0261
0262 spinlock_t lock;
0263 u16 ch_info;
0264
0265 u8 key[GELIC_WEP_KEYS][IW_ENCODING_TOKEN_MAX];
0266 unsigned long key_enabled;
0267 unsigned int key_len[GELIC_WEP_KEYS];
0268 unsigned int current_key;
0269
0270 u8 psk[GELIC_WL_EURUS_PSK_MAX_LEN];
0271 enum gelic_eurus_wpa_psk_type psk_type;
0272 unsigned int psk_len;
0273
0274 u8 essid[IW_ESSID_MAX_SIZE];
0275 u8 bssid[ETH_ALEN];
0276 u8 active_bssid[ETH_ALEN];
0277 unsigned int essid_len;
0278
0279 struct iw_public_data wireless_data;
0280 struct iw_statistics iwstat;
0281 };
0282
0283 #define GELIC_WL_BSS_MAX_ENT 32
0284 #define GELIC_WL_ASSOC_RETRY 50
0285 static inline struct gelic_port *wl_port(struct gelic_wl_info *wl)
0286 {
0287 return container_of((void *)wl, struct gelic_port, priv);
0288 }
0289 static inline struct gelic_wl_info *port_wl(struct gelic_port *port)
0290 {
0291 return port_priv(port);
0292 }
0293
0294 struct gelic_eurus_cmd {
0295 struct work_struct work;
0296 struct gelic_wl_info *wl;
0297 unsigned int cmd;
0298 u64 tag;
0299 u64 size;
0300 void *buffer;
0301 unsigned int buf_size;
0302 struct completion done;
0303 int status;
0304 u64 cmd_status;
0305 };
0306
0307
0308 #define GELIC_WL_PRIV_SET_PSK (SIOCIWFIRSTPRIV + 0)
0309 #define GELIC_WL_PRIV_GET_PSK (SIOCIWFIRSTPRIV + 1)
0310
0311 int gelic_wl_driver_probe(struct gelic_card *card);
0312 int gelic_wl_driver_remove(struct gelic_card *card);
0313 void gelic_wl_interrupt(struct net_device *netdev, u64 status);
0314 #endif