1 /* SPDX-License-Identifier: GPL-2.0 */
4 #include <linux/ieee80211.h>
5 #include "coreconfigurator.h"
11 #define STATION_MODE 0x02
13 #define CLIENT_MODE 0x04
15 #define PROBE_REQ 0x40
16 #define PROBE_RESP 0x50
18 #define ACTION_FRM_IDX 0
19 #define PROBE_REQ_IDX 1
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
32 #define DEFAULTKEY 0x4
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
39 #define TX_MIC_KEY_LEN 8
40 #define RX_MIC_KEY_LEN 8
41 #define PTK_KEY_LEN 16
43 #define TX_MIC_KEY_MSG_LEN 26
44 #define RX_MIC_KEY_MSG_LEN 48
45 #define PTK_KEY_MSG_LEN 39
47 #define PMKSA_KEY_LEN 22
50 #define WILC_MAX_NUM_PMKIDS 16
51 #define WILC_ADD_STA_LENGTH 40
52 #define SCAN_EVENT_DONE_ABORTED
53 #define NUM_CONCURRENT_IFC 2
54 #define DRV_HANDLER_SIZE 5
55 #define DRV_HANDLER_MASK 0x000000FF
68 HOST_IF_CONNECTING = 2,
69 HOST_IF_WAITING_CONN_RESP = 3,
70 HOST_IF_CONNECTED = 4,
71 HOST_IF_P2P_LISTEN = 5,
72 HOST_IF_FORCE_32BIT = 0xFFFFFFFF
75 struct host_if_pmkid {
80 struct host_if_pmkid_attr {
82 struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS];
101 struct cfg_param_attr {
108 u16 short_retry_limit;
109 u16 long_retry_limit;
113 u8 short_slot_allowed;
114 u8 txop_prot_disabled;
117 enum SITESURVEY site_survey_enabled;
118 u16 site_survey_scan_time;
120 u16 active_scan_time;
121 u16 passive_scan_time;
122 enum CURRENT_TXRATE curr_tx_rate;
127 RETRY_SHORT = BIT(0),
129 FRAG_THRESHOLD = BIT(2),
130 RTS_THRESHOLD = BIT(3),
133 AUTHEN_TIMEOUT = BIT(6),
134 POWER_MANAGEMENT = BIT(7),
136 SHORT_SLOT_ALLOWED = BIT(9),
137 TXOP_PROT_DISABLE = BIT(10),
138 BEACON_INTERVAL = BIT(11),
139 DTIM_PERIOD = BIT(12),
140 SITE_SURVEY = BIT(13),
141 SITE_SURVEY_SCAN_TIME = BIT(14),
142 ACTIVE_SCANTIME = BIT(15),
143 PASSIVE_SCANTIME = BIT(16),
144 CURRENT_TX_RATE = BIT(17),
148 struct found_net_info {
154 SCAN_EVENT_NETWORK_FOUND = 0,
156 SCAN_EVENT_ABORTED = 2,
157 SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF
161 CONN_DISCONN_EVENT_CONN_RESP = 0,
162 CONN_DISCONN_EVENT_DISCONN_NOTIF = 1,
163 CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF
173 typedef void (*wilc_scan_result)(enum scan_event, struct network_info *,
176 typedef void (*wilc_connect_result)(enum conn_event,
177 struct connect_info *,
179 struct disconnect_info *,
182 typedef void (*wilc_remain_on_chan_expired)(void *, u32);
183 typedef void (*wilc_remain_on_chan_ready)(void *);
185 struct rcvd_net_info {
190 struct hidden_net_info {
195 struct hidden_network {
196 struct hidden_net_info *net_info;
200 struct user_scan_req {
201 wilc_scan_result scan_result;
204 struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS];
207 struct user_conn_req {
211 enum AUTHTYPE auth_type;
215 wilc_connect_result conn_result;
230 struct get_mac_addr {
234 struct ba_session_info {
244 wilc_remain_on_chan_expired expired;
245 wilc_remain_on_chan_ready ready;
256 enum p2p_listen_state {
264 struct user_scan_req usr_scan_req;
265 struct user_conn_req usr_conn_req;
266 struct remain_ch remain_on_ch;
267 u8 remain_on_ch_pending;
271 enum host_if_state hif_state;
273 u8 assoc_bssid[ETH_ALEN];
274 struct cfg_param_attr cfg_values;
276 struct mutex cfg_values_lock;
277 struct completion comp_test_key_block;
278 struct completion comp_test_disconn_block;
279 struct completion comp_get_rssi;
280 struct completion comp_inactive_time;
282 struct timer_list scan_timer;
283 struct timer_list connect_timer;
284 struct timer_list remain_on_ch_timer;
287 int driver_handler_id;
290 struct add_sta_param {
296 struct ieee80211_ht_cap ht_capa;
302 s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress);
303 int wilc_remove_wep_key(struct wilc_vif *vif, u8 index);
304 int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index);
305 int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
307 int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const u8 *key, u8 len,
308 u8 index, u8 mode, enum AUTHTYPE auth_type);
309 int wilc_add_ptk(struct wilc_vif *vif, const u8 *ptk, u8 ptk_key_len,
310 const u8 *mac_addr, const u8 *rx_mic, const u8 *tx_mic,
311 u8 mode, u8 cipher_mode, u8 index);
312 s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac,
313 u32 *pu32InactiveTime);
314 int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
315 u8 index, u32 key_rsc_len, const u8 *key_rsc,
316 const u8 *rx_mic, const u8 *tx_mic, u8 mode,
318 int wilc_set_pmkid_info(struct wilc_vif *vif,
319 struct host_if_pmkid_attr *pmkid);
320 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
321 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid,
322 size_t ssid_len, const u8 *ies, size_t ies_len,
323 wilc_connect_result connect_result, void *user_arg,
324 u8 security, enum AUTHTYPE auth_type,
325 u8 channel, void *join_params);
326 int wilc_disconnect(struct wilc_vif *vif, u16 reason_code);
327 int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel);
328 int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level);
329 int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type,
330 u8 *ch_freq_list, u8 ch_list_len, const u8 *ies,
331 size_t ies_len, wilc_scan_result scan_result, void *user_arg,
332 struct hidden_network *hidden_network);
333 int wilc_hif_set_cfg(struct wilc_vif *vif,
334 struct cfg_param_attr *cfg_param);
335 int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler);
336 int wilc_deinit(struct wilc_vif *vif);
337 int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period,
338 u32 head_len, u8 *head, u32 tail_len, u8 *tail);
339 int wilc_del_beacon(struct wilc_vif *vif);
340 int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param);
341 int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]);
342 int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr);
343 int wilc_edit_station(struct wilc_vif *vif,
344 struct add_sta_param *sta_param);
345 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout);
346 int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled,
348 int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx);
349 int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id,
350 u32 duration, u16 chan,
351 wilc_remain_on_chan_expired expired,
352 wilc_remain_on_chan_ready ready,
354 int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id);
355 int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg);
356 int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode,
358 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
359 int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats);
360 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
361 int wilc_get_vif_idx(struct wilc_vif *vif);
362 int wilc_set_tx_power(struct wilc_vif *vif, u8 tx_power);
363 int wilc_get_tx_power(struct wilc_vif *vif, u8 *tx_power);
365 extern bool wilc_optaining_ip;
366 extern u8 wilc_connected_ssid[6];
367 extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
369 extern int wilc_connecting;
370 extern struct timer_list wilc_during_ip_timer;