xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wlan_cm_public_struct.h
19  *
20  * This header file maintain public structures required for connection mgr
21  */
22 
23 #ifndef __WLAN_CM_PUBLIC_STRUCT_H__
24 #define __WLAN_CM_PUBLIC_STRUCT_H__
25 
26 #ifdef FEATURE_CM_ENABLE
27 #include <wlan_scan_public_structs.h>
28 #include "wlan_crypto_global_def.h"
29 #include "qdf_status.h"
30 
31 #define CM_ID_INVALID 0xFFFFFFFF
32 typedef uint32_t wlan_cm_id;
33 
34 /* Diconnect active timeout */
35 #define DISCONNECT_TIMEOUT   STOP_RESPONSE_TIMER + DELETE_RESPONSE_TIMER + 1000
36 
37 /* Diconnect command wait timeout */
38 #define CM_DISCONNECT_CMD_TIMEOUT DISCONNECT_TIMEOUT + 2000
39 
40 /**
41  * struct wlan_cm_wep_key_params - store wep key info
42  * @key: key info
43  * @seq: seq info
44  * @key_len: key length
45  * @seq_len: seq len
46  * @key_idx: key index
47  */
48 struct wlan_cm_wep_key_params {
49 	uint8_t *key;
50 	uint8_t *seq;
51 	uint8_t key_len;
52 	uint8_t seq_len;
53 	uint8_t key_idx;
54 };
55 
56 /**
57  * struct wlan_cm_connect_crypto_info - Crypto settings
58  * @wpa_versions: indicates which, if any, WPA versions are enabled
59  *	(from enum nl80211_wpa_versions)
60  * @auth_type: Auth mode type bitmask
61  * @group_cipher: group key cipher suite bitmask
62  * @ciphers_pairwise: unicast key cipher suites bitmask
63  * @akm_suites: AKM suites bitmask
64  * @wep_keys: static WEP keys, if not NULL points to an array of
65  *	MAX_WEP_KEYS WEP keys
66  * @rsn_caps: rsn caps
67  * @mgmt_ciphers: mgmt cipher bitmask
68  */
69 struct wlan_cm_connect_crypto_info {
70 	uint32_t wpa_versions;
71 	uint32_t auth_type;
72 	uint32_t group_cipher;
73 	uint32_t ciphers_pairwise;
74 	uint32_t akm_suites;
75 	struct wlan_cm_wep_key_params wep_keys;
76 	uint16_t rsn_caps;
77 	uint32_t mgmt_ciphers;
78 };
79 
80 #ifdef WLAN_FEATURE_FILS_SK
81 #define WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH 253
82 #define WLAN_CM_FILS_MAX_REALM_LEN 255
83 #define WLAN_CM_FILS_MAX_RRK_LENGTH 64
84 
85 /**
86  * struct wlan_fils_con_info - fils connect req info
87  * @is_fils_connection: is fils connection
88  * @username_len: username length
89  * @username: username
90  * @realm_len: realm length
91  * @realm: realm
92  * @next_seq_num: next seq number
93  * @rrk_len: rrk length
94  * @rrk: rrk
95  */
96 struct wlan_fils_con_info {
97 	bool is_fils_connection;
98 	uint32_t username_len;
99 	uint8_t username[WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH];
100 	uint32_t realm_len;
101 	uint8_t realm[WLAN_CM_FILS_MAX_REALM_LEN];
102 	uint16_t next_seq_num;
103 	uint32_t rrk_len;
104 	uint8_t rrk[WLAN_CM_FILS_MAX_RRK_LENGTH];
105 };
106 #endif
107 
108 /**
109  * enum wlan_cm_source - connection manager req source
110  * @CM_OSIF_CONNECT: Connect req initiated by OSIF or north bound
111  * @CM_ROAMING: Roaming request
112  * @CM_OSIF_DISCONNECT: Disconnect req initiated by OSIF or north bound
113  * @CM_PEER_DISCONNECT: Disconnect req initiated by peer sending deauth/disassoc
114  * only for this localy generated will be false while indicating to kernel
115  * @CM_SB_DISCONNECT: Disconnect initiated from firmware. eg HB failure,
116  * sta kickout etc
117  * @CM_MLME_DISCONNECT: Disconnect req initiated by mlme. eg VDEV mgr or any
118  * other mlme component.
119  * @CM_INTERNAL_DISCONNECT: Internal disconnect initiated by Connection manager
120  * on receiving the back to back commands
121  * @CM_ROAM_DISCONNECT: Disconnect req due to HO failure
122  * @CM_SOURCE_MAX: max value of connection manager source
123  * @CM_SOURCE_INVALID: Invalid connection manager req source
124  */
125 enum wlan_cm_source {
126 	CM_OSIF_CONNECT,
127 	CM_ROAMING,
128 	CM_OSIF_DISCONNECT,
129 	CM_PEER_DISCONNECT,
130 	CM_SB_DISCONNECT,
131 	CM_MLME_DISCONNECT,
132 	CM_INTERNAL_DISCONNECT,
133 	CM_ROAM_DISCONNECT,
134 	CM_SOURCE_MAX,
135 	CM_SOURCE_INVALID = CM_SOURCE_MAX,
136 };
137 
138 /**
139  * struct wlan_cm_connect_req - connect req from requester
140  * @vdev_id: vdev id
141  * @source: source of the req
142  * @bssid: bssid given
143  * @prev_bssid: prev AP bssid, given in case supplican want to roam to new BSSID
144  * @ssid: profile SSID
145  * @bssid_hint: bssid hint to connect
146  * @chan_freq: channel of the AP
147  * @crypto: crypto related info
148  * @assoc_ie:Additional assoc IE to be appended in assoc req
149  *           (Include RSN/WPA/WAPI/WPS ies)
150  * @scan_ie: Default scan ie to be used in the uncast probe req and connect scan
151  * @force_rsne_override: force the arbitrary rsne received in connect req to be
152  * used with out validation, used for the scenarios where the device is used
153  * as a testbed device with special functionality and not recommended
154  * for production.
155  * @dot11mode_filter: dot11mode filter used to restrict connection to
156  * 11n/11ac/11ax.
157  * @sae_pwe: SAE mechanism for PWE derivation
158  *           0 = hunting-and-pecking loop only
159  *           1 = hash-to-element only
160  *           2 = both hunting-and-pecking loop and hash-to-element enabled
161  * @ht_caps: ht capability information bit mask
162  * @ht_caps_mask: mask of valid ht caps
163  * @vht_caps: vht capability information bit mask
164  * @vht_caps_mask: mask of valid vht caps
165  * @fils_info: Fills related connect info
166  */
167 struct wlan_cm_connect_req {
168 	uint8_t vdev_id;
169 	enum wlan_cm_source source;
170 	struct qdf_mac_addr bssid;
171 	struct qdf_mac_addr prev_bssid;
172 	struct wlan_ssid ssid;
173 	struct qdf_mac_addr bssid_hint;
174 	uint32_t chan_freq;
175 	struct wlan_cm_connect_crypto_info crypto;
176 	struct element_info assoc_ie;
177 	struct element_info scan_ie;
178 	bool force_rsne_override;
179 	enum dot11_mode_filter dot11mode_filter;
180 	uint8_t sae_pwe;
181 	uint16_t ht_caps;
182 	uint16_t ht_caps_mask;
183 	uint32_t vht_caps;
184 	uint32_t vht_caps_mask;
185 #ifdef WLAN_FEATURE_FILS_SK
186 	struct wlan_fils_con_info fils_info;
187 #endif
188 };
189 
190 /**
191  * struct wlan_cm_vdev_connect_req - connect req from connection manager to
192  * vdev mgr
193  * @vdev_id: vdev id
194  * @cm_id: Connect manager id
195  * @force_rsne_override: force the arbitrary rsne received in connect req to be
196  * used with out validation, used for the scenarios where the device is used
197  * as a testbed device with special functionality and not recommended
198  * for production.
199  * @ht_caps: ht capability
200  * @ht_caps_mask: mask of valid ht caps
201  * @vht_caps: vht capability
202  * @vht_caps_mask: mask of valid vht caps
203  * @assoc_ie: assoc ie to be used in assoc req
204  * @scan_ie: Default scan ie to be used in the uncast probe req
205  * @bss: scan entry for the candidate
206  * @fils_info: Fills related connect info
207  */
208 struct wlan_cm_vdev_connect_req {
209 	uint8_t vdev_id;
210 	wlan_cm_id cm_id;
211 	bool force_rsne_override;
212 	uint16_t ht_caps;
213 	uint16_t ht_caps_mask;
214 	uint32_t vht_caps;
215 	uint32_t vht_caps_mask;
216 	struct element_info assoc_ie;
217 	struct element_info scan_ie;
218 	struct scan_cache_node *bss;
219 #ifdef WLAN_FEATURE_FILS_SK
220 	struct wlan_fils_con_info *fils_info;
221 #endif
222 };
223 
224 /**
225  * struct wlan_cm_disconnect_req - disconnect req from requester
226  * @vdev_id: vdev id
227  * @source: source of disconnect
228  * @reason_code: protocol/propitiatory reason code of the disconnect.
229  * propitiatory will be used to send in
230  * QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON
231  * @bssid: bssid of AP
232  */
233 struct wlan_cm_disconnect_req {
234 	uint8_t vdev_id;
235 	enum wlan_cm_source source;
236 	enum wlan_reason_code reason_code;
237 	struct qdf_mac_addr bssid;
238 };
239 
240 /**
241  * struct wlan_cm_vdev_discon_req - disconnect req from connection manager to
242  * vdev mgr
243  * @cm_id: connection manager ID
244  * @req: disconnect req
245  */
246 struct wlan_cm_vdev_discon_req {
247 	wlan_cm_id cm_id;
248 	struct wlan_cm_disconnect_req req;
249 };
250 
251 /*
252  * enum wlan_cm_connect_fail_reason: connection manager connect fail reason
253  * @CM_NO_CANDIDATE_FOUND: No candidate found
254  * @CM_ABORT_DUE_TO_NEW_REQ_RECVD: Aborted as new command is received and
255  * @CM_BSS_SELECT_IND_FAILED: Failed BSS select indication
256  * State machine is not able to handle as state has changed due to new command.
257  * @CM_PEER_CREATE_FAILED: peer create failed
258  * @CM_JOIN_FAILED: Failed in joining state
259  * (BSS peer creation or other handling)
260  * @CM_JOIN_TIMEOUT: Did not receive beacon or probe response after unicast
261  * probe request
262  * @CM_AUTH_FAILED: Auth rejected by AP
263  * @CM_AUTH_TIMEOUT: No Auth resp from AP
264  * @CM_ASSOC_FAILED: Assoc rejected by AP
265  * @CM_ASSOC_TIMEOUT: No Assoc resp from AP
266  * @CM_HW_MODE_FAILURE: failed to change HW mode
267  * @CM_SER_FAILURE: Failed to serialize command
268  * @CM_SER_TIMEOUT: Serialization cmd timeout
269  * @CM_GENERIC_FAILURE: Generic failure apart from above
270  */
271 enum wlan_cm_connect_fail_reason {
272 	CM_NO_CANDIDATE_FOUND,
273 	CM_ABORT_DUE_TO_NEW_REQ_RECVD,
274 	CM_BSS_SELECT_IND_FAILED,
275 	CM_PEER_CREATE_FAILED,
276 	CM_JOIN_FAILED,
277 	CM_JOIN_TIMEOUT,
278 	CM_AUTH_FAILED,
279 	CM_AUTH_TIMEOUT,
280 	CM_ASSOC_FAILED,
281 	CM_ASSOC_TIMEOUT,
282 	CM_HW_MODE_FAILURE,
283 	CM_SER_FAILURE,
284 	CM_SER_TIMEOUT,
285 	CM_GENERIC_FAILURE,
286 };
287 
288 #ifdef WLAN_FEATURE_FILS_SK
289 #define CM_FILS_MAX_HLP_DATA_LEN 2048
290 #define MAX_KEK_LENGTH 64
291 #define MAX_TK_LENGTH 32
292 #define MAX_GTK_LENGTH 255
293 
294 /**
295  * struct fils_connect_rsp_params - fils related connect rsp params
296  * @fils_pmk: fils pmk
297  * @fils_pmk_len: fils pmk length
298  * @fils_pmkid: fils pmkid
299  * @kek: kek
300  * @kek_len: kek length
301  * @tk: tk
302  * @tk_len: tk length
303  * @gtk: gtk
304  * @gtk_len: gtk length
305  * @dst_mac: dst mac
306  * @src_mac: src mac
307  * @hlp_data: hlp data
308  * @hlp_data_len: hlp data length
309  * @fils_seq_num: FILS sequence number
310  */
311 struct fils_connect_rsp_params {
312 	uint8_t *fils_pmk;
313 	uint8_t fils_pmk_len;
314 	uint8_t fils_pmkid[PMKID_LEN];
315 	uint8_t kek[MAX_KEK_LENGTH];
316 	uint8_t kek_len;
317 	uint8_t tk[MAX_TK_LENGTH];
318 	uint8_t tk_len;
319 	uint8_t gtk[MAX_GTK_LENGTH];
320 	uint8_t gtk_len;
321 	struct qdf_mac_addr dst_mac;
322 	struct qdf_mac_addr src_mac;
323 	uint8_t hlp_data[CM_FILS_MAX_HLP_DATA_LEN];
324 	uint16_t hlp_data_len;
325 	uint16_t fils_seq_num;
326 };
327 #endif
328 
329 /**
330  * struct connect_rsp_ies - connect rsp ies stored in vdev filled during connect
331  * @bcn_probe_rsp: Raw beacon or probe rsp of connected AP
332  * @assoc_req: assoc req IE pointer send during conenct
333  * @assoc_rsq: assoc rsp IE received during connection
334  * @ric_resp_ie: ric ie from assoc resp received during connection
335  * @fills_ie: fills connection ie received during connection
336  */
337 struct wlan_connect_rsp_ies {
338 	struct element_info bcn_probe_rsp;
339 	struct element_info assoc_req;
340 	struct element_info assoc_rsp;
341 	struct element_info ric_resp_ie;
342 #ifdef WLAN_FEATURE_FILS_SK
343 	struct fils_connect_rsp_params *fils_ie;
344 #endif
345 };
346 
347 /**
348  * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to
349  * OSIF
350  * @vdev_id: vdev id
351  * @cm_id: Connect manager id
352  * @bssid: BSSID of the ap
353  * @ssid: SSID of the connection
354  * @freq: Channel frequency
355  * @connect_status: connect status success or failure
356  * @reason: connect fail reason, valid only in case of failure
357  * @status_code: protocol status code received in auth/assoc resp
358  * @aid: aid
359  * @connect_ies: connect related IE required by osif to send to kernel
360  * @is_fils_connection: is fils connection
361  */
362 struct wlan_cm_connect_resp {
363 	uint8_t vdev_id;
364 	wlan_cm_id cm_id;
365 	struct qdf_mac_addr bssid;
366 	struct wlan_ssid ssid;
367 	qdf_freq_t freq;
368 	QDF_STATUS connect_status;
369 	enum wlan_cm_connect_fail_reason reason;
370 	enum wlan_status_code status_code;
371 	uint8_t aid;
372 	struct wlan_connect_rsp_ies connect_ies;
373 #ifdef WLAN_FEATURE_FILS_SK
374 	bool is_fils_connection;
375 #endif
376 };
377 
378 
379 /**
380  * struct wlan_cm_discon_rsp - disconnect resp from VDEV mgr and will be sent to
381  * OSIF
382  * @req: disconnect req sent to vdev mgr
383  * @ap_discon_ie: disconnect IE sent by AP
384  */
385 struct wlan_cm_discon_rsp {
386 	struct wlan_cm_vdev_discon_req req;
387 	struct element_info ap_discon_ie;
388 };
389 
390 #endif /* FEATURE_CM_ENABLE */
391 
392 #endif /* __WLAN_CM_PUBLIC_STRUCT_H__ */
393