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