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 30 typedef uint32_t wlan_cm_id; 31 32 /** 33 * struct wlan_cm_wep_key_params - store wep key info 34 * @key: key info 35 * @seq: seq info 36 * @key_len: key length 37 * @seq_len: seq len 38 * @key_idx: key index 39 */ 40 struct wlan_cm_wep_key_params { 41 uint8_t *key; 42 uint8_t *seq; 43 uint8_t key_len; 44 uint8_t seq_len; 45 uint8_t key_idx; 46 }; 47 48 /** 49 * struct wlan_cm_connect_crypto_info - Crypto settings 50 * @wpa_versions: indicates which, if any, WPA versions are enabled 51 * (from enum nl80211_wpa_versions) 52 * @auth_type: Auth mode type bitmask 53 * @group_cipher: group key cipher suite bitmask 54 * @ciphers_pairwise: unicast key cipher suites bitmask 55 * @akm_suites: AKM suites bitmask 56 * @wep_keys: static WEP keys, if not NULL points to an array of 57 * MAX_WEP_KEYS WEP keys 58 * @pmf_cap: Pmf capability 59 * @mgmt_ciphers: mgmt cipher bitmask 60 */ 61 struct wlan_cm_connect_crypto_info { 62 uint32_t wpa_versions; 63 uint32_t auth_type; 64 uint32_t group_cipher; 65 uint32_t ciphers_pairwise; 66 uint32_t akm_suites; 67 struct wlan_cm_wep_key_params wep_keys; 68 enum wlan_pmf_cap pmf_cap; 69 uint32_t mgmt_ciphers; 70 }; 71 72 #ifdef WLAN_FEATURE_FILS_SK 73 #define WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH 253 74 #define WLAN_CM_FILS_MAX_REALM_LEN 255 75 #define WLAN_CM_FILS_MAX_RRK_LENGTH 64 76 #define WLAN_CM_FILS_MAX_RIK_LENGTH CM_FILS_MAX_RRK_LENGTH 77 78 /** 79 * struct wlan_fils_con_info - fils connect req info 80 * @is_fils_connection: is fils connection 81 * @username_len: username length 82 * @username: username 83 * @realm_len: realm length 84 * @realm: realm 85 * @next_seq_num: next seq number 86 * @rrk_len: rrk length 87 * @rrk: rrk 88 */ 89 struct wlan_fils_con_info { 90 bool is_fils_connection; 91 uint32_t username_len; 92 uint8_t username[WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH]; 93 uint32_t realm_len; 94 uint8_t realm[WLAN_CM_FILS_MAX_REALM_LEN]; 95 uint16_t next_seq_num; 96 uint32_t rrk_len; 97 uint8_t rrk[WLAN_CM_FILS_MAX_RRK_LENGTH]; 98 }; 99 #endif 100 101 /** 102 * enum wlan_cm_source - connection manager req source 103 * @CM_OSIF_CONENCT_REQ: Connect req initiated by OSIF or north bound 104 * @CM_ROAMING: Roaming request 105 * @CM_OSIF_DISCONNECT: Disconnect req initiated by OSIF or north bound 106 * @CM_PEER_DISCONNECT: Disconnect req initiated by peer sending deauth/disassoc 107 * only for this localy generated will be false while indicating to kernel 108 * @CM_SB_DISCONNECT: Disconnect req initiated by South bound/VDEV mgr/Peer mgr 109 * @CM_INTERNAL_DISCONNECT: Internal disconnect initiated by Connection manager 110 * on receiving the back to back commands 111 * @CM_ROAM_DISCONNECT: Disconnect req due to HO failure 112 */ 113 enum wlan_cm_source { 114 CM_OSIF_CONENCT_REQ, 115 CM_ROAMING, 116 CM_OSIF_DISCONNECT, 117 CM_PEER_DISCONNECT, 118 CM_SB_DISCONNECT, 119 CM_INTERNAL_DISCONNECT, 120 CM_ROAM_DISCONNECT, 121 }; 122 123 /** 124 * struct wlan_cm_connect_req - connect req from requester 125 * @vdev_id: vdev id 126 * @source: source of the req 127 * @bssid: bssid given 128 * @prev_bssid: prev AP bssid, given in case supplican want to roam to new BSSID 129 * @ssid: profile SSID 130 * @bssid_hint: bssid hint to connect 131 * @chan_freq: channel of the AP 132 * @crypto: crypto related info 133 * @assoc_ie:Additional assoc IE to be appended in assoc req 134 * (Include RSN/WPA/WAPI/WPS ies) 135 * @ht_caps: ht capability 136 * @ht_caps_mask: mask of valid ht caps 137 * @vht_caps: vht capability 138 * @vht_caps_mask: mask of valid vht caps 139 * @fils_info: Fills related connect info 140 */ 141 struct wlan_cm_connect_req { 142 uint8_t vdev_id; 143 enum wlan_cm_source source; 144 struct qdf_mac_addr bssid; 145 struct qdf_mac_addr prev_bssid; 146 struct wlan_ssid ssid; 147 struct qdf_mac_addr bssid_hint; 148 uint32_t chan_freq; 149 struct wlan_cm_connect_crypto_info crypto; 150 struct element_info assoc_ie; 151 uint16_t ht_caps; 152 uint16_t ht_caps_mask; 153 uint32_t vht_caps; 154 uint32_t vht_caps_mask; 155 #ifdef WLAN_FEATURE_FILS_SK 156 struct wlan_fils_con_info fils_info; 157 #endif 158 }; 159 160 /** 161 * struct wlan_cm_vdev_connect_req - connect req from connection manager to 162 * vdev mgr 163 * @vdev_id: vdev id 164 * @cm_id: Connect manager id 165 * @bss: scan entry for the candidate 166 */ 167 struct wlan_cm_vdev_connect_req { 168 uint8_t vdev_id; 169 wlan_cm_id cm_id; 170 struct scan_cache_node *bss; 171 }; 172 173 /** 174 * struct wlan_cm_disconnect_req - disconnect req from requester 175 * @vdev_id: vdev id 176 * @source: source of disconnect 177 * @reason_code: protocol/propitiatory reason code of the disconnect. 178 * propitiatory will be used to send in 179 * QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON 180 * @bssid: bssid of AP 181 */ 182 struct wlan_cm_disconnect_req { 183 uint8_t vdev_id; 184 enum wlan_cm_source source; 185 uint16_t reason_code; 186 struct qdf_mac_addr bssid; 187 }; 188 189 /** 190 * struct wlan_cm_vdev_discon_req - disconnect req from connection manager to 191 * vdev mgr 192 * @cm_id: connection manager ID 193 * @req: disconnect req 194 */ 195 struct wlan_cm_vdev_discon_req { 196 wlan_cm_id cm_id; 197 struct wlan_cm_disconnect_req req; 198 }; 199 200 /* 201 * enum wlan_cm_connect_fail_reason: connection manager connect fail reason 202 * @CM_NO_CANDIDATE_FOUND: No candidate found 203 * @CM_JOIN_FAILED: Failed in joining state 204 * (BSS peer creation or other handling) 205 * @CM_JOIN_TIMEOUT: Did not receive beacon or probe response after unicast 206 * probe request 207 * @CM_AUTH_FAILED: Auth rejected by AP 208 * @CM_AUTH_TIMEOUT: No Auth resp from AP 209 * @CM_ASSOC_FAILED: Assoc rejected by AP 210 * @CM_ASSOC_TIMEOUT: No Assoc resp from AP 211 * @CM_HW_MODE_FAILURE: failed to change HW mode 212 * @CM_SER_FAILURE: Failed to serialize command 213 * @CM_GENERIC_FAILURE: Generic failure apart from above 214 */ 215 enum wlan_cm_connect_fail_reason { 216 CM_NO_CANDIDATE_FOUND, 217 CM_JOIN_FAILED, 218 CM_JOIN_TIMEOUT, 219 CM_AUTH_FAILED, 220 CM_AUTH_TIMEOUT, 221 CM_ASSOC_FAILED, 222 CM_ASSOC_TIMEOUT, 223 CM_HW_MODE_FAILURE, 224 CM_SER_FAILURE, 225 CM_GENERIC_FAILURE, 226 }; 227 228 #ifdef WLAN_FEATURE_FILS_SK 229 #define CM_FILS_MAX_HLP_DATA_LEN 2048 230 #define MAX_KEK_LENGTH 64 231 #define MAX_TK_LENGTH 32 232 #define MAX_GTK_LENGTH 255 233 234 /** 235 * struct fils_connect_rsp_params - fils related connect rsp params 236 * @fils_pmk: fils pmk 237 * @fils_pmk_len: fils pmk length 238 * @fils_pmkid: fils pmkid 239 * @kek: kek 240 * @kek_len: kek length 241 * @tk: tk 242 * @tk_len: tk length 243 * @gtk: gtk 244 * @gtk_len: gtk length 245 * @dst_mac: dst mac 246 * @src_mac: src mac 247 * @hlp_data: hlp data 248 * @hlp_data_len: hlp data length 249 */ 250 struct fils_connect_rsp_params { 251 uint8_t *fils_pmk; 252 uint8_t fils_pmk_len; 253 uint8_t fils_pmkid[PMKID_LEN]; 254 uint8_t kek[MAX_KEK_LENGTH]; 255 uint8_t kek_len; 256 uint8_t tk[MAX_TK_LENGTH]; 257 uint8_t tk_len; 258 uint8_t gtk[MAX_GTK_LENGTH]; 259 uint8_t gtk_len; 260 struct qdf_mac_addr dst_mac; 261 struct qdf_mac_addr src_mac; 262 uint8_t hlp_data[CM_FILS_MAX_HLP_DATA_LEN]; 263 uint16_t hlp_data_len; 264 }; 265 #endif 266 267 /** 268 * struct connect_rsp_ies - connect rsp ies stored in vdev filled during connect 269 * @bcn_probe_rsp: beacon or probe rsp of connected AP 270 * @assoc_req: assoc req send during conenct 271 * @assoc_rsq: assoc rsp received during connection 272 * @ric_resp_ie: ric ie from assoc resp received during connection 273 * @fills_ie: fills connection ie received during connection 274 */ 275 struct wlan_connect_rsp_ies { 276 struct element_info bcn_probe_rsp; 277 struct element_info assoc_req; 278 struct element_info assoc_rsp; 279 struct element_info ric_resp_ie; 280 #ifdef WLAN_FEATURE_FILS_SK 281 struct fils_connect_rsp_params fils_ie; 282 #endif 283 }; 284 285 /** 286 * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to 287 * OSIF 288 * @vdev_id: vdev id 289 * @cm_id: Connect manager id 290 * @connect_status: connect status success or failure 291 * @reason: connect fail reason, valid only in case of failure 292 * @reason_code: protocol reason code of the connect failure 293 * @aid: aid 294 * @connect_ies: connect related IE required by osif to send to kernel 295 */ 296 struct wlan_cm_connect_rsp { 297 uint8_t vdev_id; 298 wlan_cm_id cm_id; 299 uint8_t connect_status; 300 enum wlan_cm_connect_fail_reason reason; 301 uint8_t reason_code; 302 uint8_t aid; 303 struct wlan_connect_rsp_ies connect_ies; 304 }; 305 306 307 /** 308 * struct wlan_cm_discon_rsp - disconnect resp from VDEV mgr and will be sent to 309 * OSIF 310 * @req: disconnect req sent to vdev mgr 311 * @ap_discon_ie: disconnect IE sent by AP 312 */ 313 struct wlan_cm_discon_rsp { 314 struct wlan_cm_vdev_discon_req req; 315 struct element_info ap_discon_ie; 316 }; 317 318 #endif /* FEATURE_CM_ENABLE */ 319 320 #endif /* __WLAN_CM_PUBLIC_STRUCT_H__ */ 321