Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
c5c77ba1 JK |
2 | #ifndef HOST_INT_H |
3 | #define HOST_INT_H | |
e9837cd9 | 4 | #include <linux/ieee80211.h> |
c5c77ba1 | 5 | #include "coreconfigurator.h" |
c5c77ba1 JK |
6 | |
7 | #define IP_ALEN 4 | |
8 | ||
c590b9a4 | 9 | #define IDLE_MODE 0x00 |
c5c77ba1 JK |
10 | #define AP_MODE 0x01 |
11 | #define STATION_MODE 0x02 | |
568ab197 | 12 | #define GO_MODE 0x03 |
c5c77ba1 | 13 | #define CLIENT_MODE 0x04 |
c81f7de8 LK |
14 | #define ACTION 0xD0 |
15 | #define PROBE_REQ 0x40 | |
16 | #define PROBE_RESP 0x50 | |
c5c77ba1 | 17 | |
c81f7de8 LK |
18 | #define ACTION_FRM_IDX 0 |
19 | #define PROBE_REQ_IDX 1 | |
568ab197 | 20 | #define MAX_NUM_STA 9 |
c5c77ba1 JK |
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 | |
af080e04 CL |
26 | #define USER_SCAN BIT(0) |
27 | #define OBSS_PERIODIC_SCAN BIT(1) | |
28 | #define OBSS_ONETIME_SCAN BIT(2) | |
c5c77ba1 | 29 | #define GTK_RX_KEY_BUFF_LEN 24 |
568ab197 CL |
30 | #define ADDKEY 0x1 |
31 | #define REMOVEKEY 0x2 | |
32 | #define DEFAULTKEY 0x4 | |
33 | #define ADDKEY_AP 0x8 | |
30b2ba09 | 34 | #define MAX_NUM_SCANNED_NETWORKS 100 |
568ab197 | 35 | #define MAX_NUM_SCANNED_NETWORKS_SHADOW 130 |
30b2ba09 CL |
36 | #define MAX_NUM_PROBED_SSID 10 |
37 | #define CHANNEL_SCAN_TIME 250 | |
c5c77ba1 JK |
38 | |
39 | #define TX_MIC_KEY_LEN 8 | |
40 | #define RX_MIC_KEY_LEN 8 | |
568ab197 | 41 | #define PTK_KEY_LEN 16 |
c5c77ba1 JK |
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 | |
568ab197 CL |
48 | #define ETH_ALEN 6 |
49 | #define PMKID_LEN 16 | |
50 | #define WILC_MAX_NUM_PMKIDS 16 | |
30b2ba09 | 51 | #define WILC_ADD_STA_LENGTH 40 |
c5c77ba1 | 52 | #define SCAN_EVENT_DONE_ABORTED |
568ab197 | 53 | #define NUM_CONCURRENT_IFC 2 |
46949b48 AS |
54 | #define DRV_HANDLER_SIZE 5 |
55 | #define DRV_HANDLER_MASK 0x000000FF | |
c5c77ba1 | 56 | |
03e7b9c4 | 57 | struct rf_info { |
5babeecb | 58 | u8 link_speed; |
00c8dfcf | 59 | s8 rssi; |
7e84ff4e | 60 | u32 tx_cnt; |
9b99274a | 61 | u32 rx_cnt; |
54160376 | 62 | u32 tx_fail_cnt; |
03e7b9c4 | 63 | }; |
c5c77ba1 | 64 | |
db9f1b12 | 65 | enum host_if_state { |
df94ed25 CL |
66 | HOST_IF_IDLE = 0, |
67 | HOST_IF_SCANNING = 1, | |
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 | |
db9f1b12 | 73 | }; |
c5c77ba1 | 74 | |
cd1e6cb4 | 75 | struct host_if_pmkid { |
63d03e47 GKH |
76 | u8 bssid[ETH_ALEN]; |
77 | u8 pmkid[PMKID_LEN]; | |
cd1e6cb4 | 78 | }; |
c5c77ba1 | 79 | |
a949f909 | 80 | struct host_if_pmkid_attr { |
63d03e47 | 81 | u8 numpmkid; |
cd1e6cb4 | 82 | struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; |
a949f909 | 83 | }; |
61500fbd | 84 | |
430a78cf | 85 | enum CURRENT_TXRATE { |
df94ed25 CL |
86 | AUTORATE = 0, |
87 | MBPS_1 = 1, | |
88 | MBPS_2 = 2, | |
89 | MBPS_5_5 = 5, | |
90 | MBPS_11 = 11, | |
91 | MBPS_6 = 6, | |
92 | MBPS_9 = 9, | |
93 | MBPS_12 = 12, | |
94 | MBPS_18 = 18, | |
95 | MBPS_24 = 24, | |
96 | MBPS_36 = 36, | |
97 | MBPS_48 = 48, | |
98 | MBPS_54 = 54 | |
430a78cf | 99 | }; |
c5c77ba1 | 100 | |
a5f0fb5c | 101 | struct cfg_param_attr { |
87c05b28 | 102 | u32 flag; |
63d03e47 GKH |
103 | u8 ht_enable; |
104 | u8 bss_type; | |
105 | u8 auth_type; | |
d85f5326 | 106 | u16 auth_timeout; |
63d03e47 | 107 | u8 power_mgmt_mode; |
d85f5326 CL |
108 | u16 short_retry_limit; |
109 | u16 long_retry_limit; | |
110 | u16 frag_threshold; | |
111 | u16 rts_threshold; | |
112 | u16 preamble_type; | |
63d03e47 GKH |
113 | u8 short_slot_allowed; |
114 | u8 txop_prot_disabled; | |
d85f5326 CL |
115 | u16 beacon_interval; |
116 | u16 dtim_period; | |
073b8d0c | 117 | enum SITESURVEY site_survey_enabled; |
d85f5326 | 118 | u16 site_survey_scan_time; |
63d03e47 | 119 | u8 scan_source; |
d85f5326 CL |
120 | u16 active_scan_time; |
121 | u16 passive_scan_time; | |
430a78cf | 122 | enum CURRENT_TXRATE curr_tx_rate; |
c5c77ba1 | 123 | |
9529650a | 124 | }; |
c5c77ba1 | 125 | |
200ac21b | 126 | enum cfg_param { |
ffda203c AB |
127 | RETRY_SHORT = BIT(0), |
128 | RETRY_LONG = BIT(1), | |
129 | FRAG_THRESHOLD = BIT(2), | |
130 | RTS_THRESHOLD = BIT(3), | |
131 | BSS_TYPE = BIT(4), | |
132 | AUTH_TYPE = BIT(5), | |
133 | AUTHEN_TIMEOUT = BIT(6), | |
134 | POWER_MANAGEMENT = BIT(7), | |
135 | PREAMBLE = BIT(8), | |
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), | |
145 | HT_ENABLE = BIT(18), | |
200ac21b | 146 | }; |
c5c77ba1 | 147 | |
73735e49 | 148 | struct found_net_info { |
69dc533e | 149 | u8 bssid[6]; |
5cfbbf14 | 150 | s8 rssi; |
73735e49 | 151 | }; |
c5c77ba1 | 152 | |
1ec3815f LK |
153 | enum scan_event { |
154 | SCAN_EVENT_NETWORK_FOUND = 0, | |
155 | SCAN_EVENT_DONE = 1, | |
156 | SCAN_EVENT_ABORTED = 2, | |
157 | SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF | |
158 | }; | |
c5c77ba1 | 159 | |
ed3f0379 | 160 | enum conn_event { |
c5c77ba1 JK |
161 | CONN_DISCONN_EVENT_CONN_RESP = 0, |
162 | CONN_DISCONN_EVENT_DISCONN_NOTIF = 1, | |
df94ed25 | 163 | CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF |
ed3f0379 | 164 | }; |
c5c77ba1 | 165 | |
b9d96333 | 166 | enum KEY_TYPE { |
c5c77ba1 | 167 | WEP, |
5cd8f7ae | 168 | WPA_RX_GTK, |
2141fe39 | 169 | WPA_PTK, |
c5c77ba1 | 170 | PMKSA, |
b9d96333 | 171 | }; |
c5c77ba1 | 172 | |
6b5180a0 LK |
173 | typedef void (*wilc_scan_result)(enum scan_event, struct network_info *, |
174 | void *, void *); | |
c5c77ba1 | 175 | |
ed3f0379 | 176 | typedef void (*wilc_connect_result)(enum conn_event, |
3b0437e1 | 177 | struct connect_info *, |
63d03e47 | 178 | u8, |
bb76df5a | 179 | struct disconnect_info *, |
c5c77ba1 JK |
180 | void *); |
181 | ||
e3e7e8ac LK |
182 | typedef void (*wilc_remain_on_chan_expired)(void *, u32); |
183 | typedef void (*wilc_remain_on_chan_ready)(void *); | |
c5c77ba1 | 184 | |
3bbd59f5 | 185 | struct rcvd_net_info { |
b021b80b | 186 | u8 *buffer; |
3bffac68 | 187 | u32 len; |
3bbd59f5 | 188 | }; |
c5c77ba1 | 189 | |
ad61fcea | 190 | struct hidden_net_info { |
8c6492aa | 191 | u8 *ssid; |
a2d4969b | 192 | u8 ssid_len; |
ad61fcea | 193 | }; |
c5c77ba1 | 194 | |
607db447 | 195 | struct hidden_network { |
245a1865 | 196 | struct hidden_net_info *net_info; |
40e05e86 | 197 | u8 n_ssids; |
607db447 | 198 | }; |
c5c77ba1 | 199 | |
b4fe59d8 | 200 | struct user_scan_req { |
bc801855 | 201 | wilc_scan_result scan_result; |
66eaea30 | 202 | void *arg; |
f79756ee | 203 | u32 rcvd_ch_cnt; |
af973f30 | 204 | struct found_net_info net_info[MAX_NUM_SCANNED_NETWORKS]; |
b4fe59d8 | 205 | }; |
c5c77ba1 | 206 | |
c944a4e8 | 207 | struct user_conn_req { |
788f6fc0 | 208 | u8 *bssid; |
72216411 | 209 | u8 *ssid; |
a0942c57 | 210 | u8 security; |
7d069728 | 211 | enum AUTHTYPE auth_type; |
74ab5e45 | 212 | size_t ssid_len; |
a3b2f4b9 | 213 | u8 *ies; |
331ed080 | 214 | size_t ies_len; |
33bfb198 | 215 | wilc_connect_result conn_result; |
ff06982c | 216 | bool ht_capable; |
73abaa49 | 217 | void *arg; |
c944a4e8 | 218 | }; |
c5c77ba1 | 219 | |
127f9d94 | 220 | struct drv_handler { |
a7f3b12f | 221 | u32 handler; |
46949b48 AS |
222 | u8 mode; |
223 | u8 name; | |
127f9d94 | 224 | }; |
c5c77ba1 | 225 | |
801bee52 | 226 | struct op_mode { |
c96debf1 | 227 | u32 mode; |
801bee52 | 228 | }; |
c5c77ba1 | 229 | |
fcd27c5f | 230 | struct get_mac_addr { |
6ceba0af | 231 | u8 *mac_addr; |
fcd27c5f | 232 | }; |
c5c77ba1 | 233 | |
54265472 | 234 | struct ba_session_info { |
3fc4999e | 235 | u8 bssid[ETH_ALEN]; |
16c9b391 | 236 | u8 tid; |
277c2130 | 237 | u16 buf_size; |
23d0bfaa | 238 | u16 time_out; |
54265472 | 239 | }; |
c5c77ba1 | 240 | |
2f9c03f5 | 241 | struct remain_ch { |
839ab709 | 242 | u16 ch; |
fb6e0680 | 243 | u32 duration; |
bfb62abc | 244 | wilc_remain_on_chan_expired expired; |
5e5f7916 | 245 | wilc_remain_on_chan_ready ready; |
c5cc4b12 | 246 | void *arg; |
9d764e38 | 247 | u32 id; |
2f9c03f5 | 248 | }; |
c5c77ba1 | 249 | |
bc37c5df | 250 | struct reg_frame { |
6abf8681 | 251 | bool reg; |
d5f654ca | 252 | u16 frame_type; |
bcb410bb | 253 | u8 reg_id; |
bc37c5df | 254 | }; |
c5c77ba1 | 255 | |
c5c77ba1 JK |
256 | enum p2p_listen_state { |
257 | P2P_IDLE, | |
258 | P2P_LISTEN, | |
259 | P2P_GRP_FORMATION | |
260 | }; | |
261 | ||
b82d940d | 262 | struct wilc; |
441dc609 | 263 | struct host_if_drv { |
70793b2a | 264 | struct user_scan_req usr_scan_req; |
f8b17132 | 265 | struct user_conn_req usr_conn_req; |
d61f8e1e | 266 | struct remain_ch remain_on_ch; |
5beef2ca | 267 | u8 remain_on_ch_pending; |
1229b1ab | 268 | u64 p2p_timeout; |
ab16ec0b | 269 | u8 p2p_connect; |
c5c77ba1 | 270 | |
b60005a8 | 271 | enum host_if_state hif_state; |
c5c77ba1 | 272 | |
2a4eded9 | 273 | u8 assoc_bssid[ETH_ALEN]; |
a5f0fb5c | 274 | struct cfg_param_attr cfg_values; |
33110ad7 | 275 | |
1f12f148 | 276 | struct mutex cfg_values_lock; |
702962f3 | 277 | struct completion comp_test_key_block; |
96adbd27 | 278 | struct completion comp_test_disconn_block; |
7c8a3dca | 279 | struct completion comp_get_rssi; |
e0c1496f | 280 | struct completion comp_inactive_time; |
13b313e4 LK |
281 | |
282 | struct timer_list scan_timer; | |
81a59506 | 283 | struct timer_list connect_timer; |
cc2d7e9e | 284 | struct timer_list remain_on_ch_timer; |
c5c77ba1 | 285 | |
72ed4dc7 | 286 | bool IFC_UP; |
46949b48 | 287 | int driver_handler_id; |
441dc609 | 288 | }; |
c5c77ba1 | 289 | |
6a89ba9c | 290 | struct add_sta_param { |
2353c388 | 291 | u8 bssid[ETH_ALEN]; |
4101eb8a | 292 | u16 aid; |
e734223c | 293 | u8 rates_len; |
a622e016 | 294 | const u8 *rates; |
22520120 | 295 | bool ht_supported; |
e9837cd9 | 296 | struct ieee80211_ht_cap ht_capa; |
f676e17a | 297 | u16 flags_mask; |
67ab64e4 | 298 | u16 flags_set; |
6a89ba9c | 299 | }; |
c5c77ba1 | 300 | |
cf60106b | 301 | struct wilc_vif; |
0e1af73d | 302 | s32 wilc_remove_key(struct host_if_drv *hWFIDrv, const u8 *pu8StaAddress); |
fbf5379b GL |
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, | |
306 | u8 index); | |
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); | |
961875ed CL |
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); | |
fbf5379b GL |
312 | s32 wilc_get_inactive_time(struct wilc_vif *vif, const u8 *mac, |
313 | u32 *pu32InactiveTime); | |
9676108e CL |
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, | |
317 | u8 cipher_mode); | |
1ab58705 | 318 | int wilc_set_pmkid_info(struct wilc_vif *vif, |
16c0cba7 | 319 | struct host_if_pmkid_attr *pmkid); |
1eabfe3f | 320 | int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr); |
f2cb5f3f | 321 | int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ssid, |
8c38d960 | 322 | size_t ssid_len, const u8 *ies, size_t ies_len, |
2ef29833 | 323 | wilc_connect_result connect_result, void *user_arg, |
12a3b8bc | 324 | u8 security, enum AUTHTYPE auth_type, |
f382b376 | 325 | u8 channel, void *join_params); |
9f723fde | 326 | int wilc_disconnect(struct wilc_vif *vif, u16 reason_code); |
fbf5379b | 327 | int wilc_set_mac_chnl_num(struct wilc_vif *vif, u8 channel); |
652bb5e8 | 328 | int wilc_get_rssi(struct wilc_vif *vif, s8 *rssi_level); |
c0734df9 | 329 | int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 scan_type, |
ce2d023f | 330 | u8 *ch_freq_list, u8 ch_list_len, const u8 *ies, |
2c97f2d4 | 331 | size_t ies_len, wilc_scan_result scan_result, void *user_arg, |
d317818b | 332 | struct hidden_network *hidden_network); |
4168da71 | 333 | int wilc_hif_set_cfg(struct wilc_vif *vif, |
a5f0fb5c | 334 | struct cfg_param_attr *cfg_param); |
1e995c10 | 335 | int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler); |
127a27c3 | 336 | int wilc_deinit(struct wilc_vif *vif); |
916935f5 | 337 | int wilc_add_beacon(struct wilc_vif *vif, u32 interval, u32 dtim_period, |
733d1031 | 338 | u32 head_len, u8 *head, u32 tail_len, u8 *tail); |
fbf5379b GL |
339 | int wilc_del_beacon(struct wilc_vif *vif); |
340 | int wilc_add_station(struct wilc_vif *vif, struct add_sta_param *sta_param); | |
2092374d | 341 | int wilc_del_allstation(struct wilc_vif *vif, u8 mac_addr[][ETH_ALEN]); |
fbf5379b | 342 | int wilc_del_station(struct wilc_vif *vif, const u8 *mac_addr); |
4208e663 | 343 | int wilc_edit_station(struct wilc_vif *vif, |
4c7abe19 | 344 | struct add_sta_param *sta_param); |
ecd27500 | 345 | int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout); |
b80c0943 | 346 | int wilc_setup_multicast_filter(struct wilc_vif *vif, bool enabled, |
2dff2d42 | 347 | u32 count); |
6964f086 | 348 | int wilc_setup_ipaddress(struct wilc_vif *vif, u8 *ip_addr, u8 idx); |
6f7584be | 349 | int wilc_remain_on_channel(struct wilc_vif *vif, u32 session_id, |
d44cd45e | 350 | u32 duration, u16 chan, |
95bfdd58 | 351 | wilc_remain_on_chan_expired expired, |
1aae9398 | 352 | wilc_remain_on_chan_ready ready, |
482c4330 | 353 | void *user_arg); |
6b0f7cdd | 354 | int wilc_listen_state_expired(struct wilc_vif *vif, u32 session_id); |
8859fc28 | 355 | int wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg); |
46949b48 AS |
356 | int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index, u8 mode, |
357 | u8 ifc_id); | |
fbf5379b | 358 | int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode); |
f70b25ff | 359 | int wilc_get_statistics(struct wilc_vif *vif, struct rf_info *stats); |
fbf5379b | 360 | void wilc_resolve_disconnect_aberration(struct wilc_vif *vif); |
31f0f697 | 361 | int wilc_get_vif_idx(struct wilc_vif *vif); |
70418790 GL |
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); | |
491880eb AB |
364 | |
365 | extern bool wilc_optaining_ip; | |
e554a305 | 366 | extern u8 wilc_connected_ssid[6]; |
491880eb AB |
367 | extern u8 wilc_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
368 | ||
369 | extern int wilc_connecting; | |
491880eb AB |
370 | extern struct timer_list wilc_during_ip_timer; |
371 | ||
c5c77ba1 | 372 | #endif |