1 /* 2 * Copyright (c) 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 29 /** 30 * struct wlan_cm_wep_key_params - store wep key info 31 * @key: key info 32 * @seq: seq info 33 * @key_len: key length 34 * @seq_len: seq len 35 * @key_idx: key index 36 */ 37 struct wlan_cm_wep_key_params { 38 uint8_t *key; 39 uint8_t *seq; 40 uint8_t key_len; 41 uint8_t seq_len; 42 uint8_t key_idx; 43 }; 44 45 #define WLAN_CM_MAX_NR_CIPHER_SUITES 5 46 #define WLAN_CM_MAX_NR_AKM_SUITES 2 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 * @group_cipher: group key cipher suite (or 0 if unset) 53 * @n_ciphers_pairwise: number of AP supported unicast ciphers 54 * @ciphers_pairwise: unicast key cipher suites 55 * @n_akm_suites: number of AKM suites 56 * @akm_suites: AKM suites 57 * @wep_keys: static WEP keys, if not NULL points to an array of 58 * MAX_WEP_KEYS WEP keys 59 * @pmf_cap: Pmf capability 60 */ 61 struct wlan_cm_connect_crypto_info { 62 uint32_t wpa_versions; 63 wlan_crypto_auth_mode auth_type; 64 wlan_crypto_cipher_type group_cipher; 65 uint32_t n_ciphers_pairwise; 66 wlan_crypto_cipher_type ciphers_pairwise[WLAN_CM_MAX_NR_CIPHER_SUITES]; 67 uint32_t n_akm_suites; 68 wlan_crypto_key_mgmt akm_suites[WLAN_CM_MAX_NR_AKM_SUITES]; 69 struct wlan_cm_wep_key_params wep_keys; 70 enum wlan_pmf_cap pmf_cap; 71 uint32_t rsn_ie_len; 72 uint8_t *rsn_ie; 73 }; 74 75 #ifdef WLAN_FEATURE_FILS_SK 76 #define WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH 253 77 #define WLAN_CM_FILS_MAX_REALM_LEN 255 78 #define WLAN_CM_FILS_MAX_RRK_LENGTH 64 79 #define WLAN_CM_FILS_MAX_RIK_LENGTH CM_FILS_MAX_RRK_LENGTH 80 81 /** 82 * struct wlan_fils_con_info - fils connect req info 83 * @is_fils_connection: is fils connection 84 * @username_len: username length 85 * @username: username 86 * @realm_len: realm length 87 * @realm: realm 88 * @next_seq_num: next seq number 89 * @rrk_len: rrk length 90 * @rrk: rrk 91 */ 92 struct wlan_fils_con_info { 93 bool is_fils_connection; 94 uint32_t username_len; 95 uint8_t username[WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH]; 96 uint32_t realm_len; 97 uint8_t realm[WLAN_CM_FILS_MAX_REALM_LEN]; 98 uint16_t next_seq_num; 99 uint32_t rrk_len; 100 uint8_t rrk[WLAN_CM_FILS_MAX_RRK_LENGTH]; 101 }; 102 #endif 103 104 /** 105 * enum wlan_cm_source - connection manager req source 106 * @CM_OSIF_CONENCT_REQ: Connect req initiated by OSIF or north bound 107 * @CM_ROAMING: Roaming request 108 * @CM_OSIF_DISCONNECT: Disconnect req initiated by OSIF or north bound 109 * @CM_PEER_DISCONNECT: Disconnect req initiated by peer sending deauth/disassoc 110 * only for this localy generated will be false while indicating to kernel 111 * @CM_SB_DISCONNECT: Disconnect req initiated by South bound/VDEV mgr/Peer mgr 112 * @CM_INTERNAL_DISCONNECT: Internal disconnect initiated by Connection manager 113 * on receiving the back to back commands 114 * @CM_ROAM_DISCONNECT: Disconnect req due to HO failure 115 */ 116 enum wlan_cm_source { 117 CM_OSIF_CONENCT_REQ, 118 CM_ROAMING, 119 CM_OSIF_DISCONNECT, 120 CM_PEER_DISCONNECT, 121 CM_SB_DISCONNECT, 122 CM_INTERNAL_DISCONNECT, 123 CM_ROAM_DISCONNECT, 124 }; 125 126 /** 127 * struct wlan_cm_connect_req - connect req from requester 128 * @vdev_id: vdev id 129 * @source: source of the req 130 * @bssid: bssid given 131 * @prev_bssid: prev AP bssid, given in case supplican want to roam to new BSSID 132 * @ssid: profile SSID 133 * @bssid_hint: bssid hint to connect 134 * @chan_freq: channel of the AP 135 * @crypto: crypto related info 136 * @connect_ie: connect IE additional assoc IE 137 * @ht_caps: ht capability 138 * @ht_caps_mask: mask of valid ht caps 139 * @vht_caps: vht capability 140 * @vht_caps_mask: mask of valid vht caps 141 * @fils_info: Fills related connect info 142 */ 143 struct wlan_cm_connect_req { 144 uint8_t vdev_id; 145 enum wlan_cm_source source; 146 struct qdf_mac_addr bssid; 147 struct qdf_mac_addr prev_bssid; 148 struct wlan_ssid ssid; 149 struct qdf_mac_addr bssid_hint; 150 uint32_t chan_freq; 151 struct wlan_cm_connect_crypto_info crypto; 152 struct element_info connect_ie; 153 uint16_t ht_caps; 154 uint16_t ht_caps_mask; 155 uint32_t vht_caps; 156 uint32_t vht_caps_mask; 157 #ifdef WLAN_FEATURE_FILS_SK 158 struct wlan_fils_con_info fils_info; 159 #endif 160 }; 161 162 /** 163 * struct wlan_cm_vdev_connect_req - connect req from connection manager to 164 * vdev mgr 165 * @vdev_id: vdev id 166 * @cm_id: Connect manager id 167 * @bss: scan entry for the candidate 168 */ 169 struct wlan_cm_vdev_connect_req { 170 uint8_t vdev_id; 171 uint8_t cm_id; 172 struct scan_cache_node *bss; 173 }; 174 175 /** 176 * struct wlan_cm_disconnect_req - disconnect req from requester 177 * @vdev_id: vdev id 178 * @source: source of disconnect 179 * @reason_code: protocol/propitiatory reason code of the disconnect. 180 * propitiatory will be used to send in 181 * QCA_WLAN_VENDOR_ATTR_GET_STATION_INFO_DRIVER_DISCONNECT_REASON 182 * @bssid: bssid of AP 183 */ 184 struct wlan_cm_disconnect_req { 185 uint8_t vdev_id; 186 enum wlan_cm_source source; 187 uint16_t reason_code; 188 struct qdf_mac_addr bssid; 189 }; 190 191 /** 192 * struct wlan_cm_vdev_discon_req - disconnect req from connection manager to 193 * vdev mgr 194 * @cm_id: connection manager ID 195 * @req: disconnect req 196 */ 197 struct wlan_cm_vdev_discon_req { 198 uint8_t cm_id; 199 struct wlan_cm_disconnect_req req; 200 }; 201 202 /* 203 * enum wlan_cm_connect_fail_reason: connection manager connect fail reason 204 * @CM_NO_CANDIDATE_FOUND: No candidate found 205 * @CM_JOIN_FAILED: Failed in joining state 206 * (BSS peer creation or other handling) 207 * @CM_JOIN_TIMEOUT: Did not receive beacon or probe response after unicast 208 * probe request 209 * @CM_AUTH_FAILED: Auth rejected by AP 210 * @CM_AUTH_TIMEOUT: No Auth resp from AP 211 * @CM_ASSOC_FAILED: Assoc rejected by AP 212 * @CM_ASSOC_TIMEOUT: No Assoc resp from AP 213 * @CM_HW_MODE_FAILURE: failed to change HW mode 214 * @CM_SER_FAILURE: Failed to serialize command 215 * @CM_GENERIC_FAILURE: Generic failure apart from above 216 */ 217 enum wlan_cm_connect_fail_reason { 218 CM_NO_CANDIDATE_FOUND, 219 CM_JOIN_FAILED, 220 CM_JOIN_TIMEOUT, 221 CM_AUTH_FAILED, 222 CM_AUTH_TIMEOUT, 223 CM_ASSOC_FAILED, 224 CM_ASSOC_TIMEOUT, 225 CM_HW_MODE_FAILURE, 226 CM_SER_FAILURE, 227 CM_GENERIC_FAILURE, 228 }; 229 230 /** 231 * struct wlan_cm_connect_rsp - connect resp from VDEV mgr and will be sent to 232 * OSIF 233 * @vdev_id: vdev id 234 * @cm_id: Connect manager id 235 * @connect_status: connect status success or failure 236 * @reason: connect fail reason 237 * @reason_code: protocol reason code of the connect failure 238 * @peer_macaddr: bssid of AP 239 */ 240 struct wlan_cm_connect_rsp { 241 uint8_t vdev_id; 242 uint8_t cm_id; 243 uint8_t connect_status; 244 enum wlan_cm_connect_fail_reason reason; 245 uint8_t failure_code; 246 uint8_t aid; 247 }; 248 249 /** 250 * struct wlan_cm_discon_rsp - disconnect resp from VDEV mgr and will be sent to 251 * OSIF 252 * @req: disconnect req sent to vdev mgr 253 */ 254 struct wlan_cm_discon_rsp { 255 struct wlan_cm_vdev_discon_req req; 256 }; 257 258 #endif /* FEATURE_CM_ENABLE */ 259 260 #endif /* __WLAN_CM_PUBLIC_STRUCT_H__ */ 261