Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 26 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | #if !defined( HDD_CONNECTION_H__ ) |
Gopichand Nakkala | 66923aa | 2013-03-06 23:17:24 +0530 | [diff] [blame] | 32 | #define HDD_CONNECTION_H__ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | #include <wlan_hdd_mib.h> |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 34 | #include <net/cfg80211.h> |
| 35 | #include <linux/ieee80211.h> |
Ravi Joshi | aa81ca2 | 2013-06-25 17:20:52 -0700 | [diff] [blame] | 36 | #define HDD_MAX_NUM_IBSS_STA ( 32 ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 37 | #ifdef FEATURE_WLAN_TDLS |
Madan Mohan Koyyalamudi | 7d5eed3 | 2013-08-05 13:13:14 +0530 | [diff] [blame] | 38 | #define HDD_MAX_NUM_TDLS_STA ( 8 ) |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 39 | #define TDLS_STA_INDEX_VALID(staId) \ |
Masti, Narayanraddi | 975a927 | 2015-05-19 11:11:43 +0530 | [diff] [blame] | 40 | (((staId) >= 3) && ((staId) < 0xFF)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 41 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #define TKIP_COUNTER_MEASURE_STARTED 1 |
| 43 | #define TKIP_COUNTER_MEASURE_STOPED 0 |
| 44 | /* Timeout (in ms) for Link to Up before Registering Station */ |
| 45 | #define ASSOC_LINKUP_TIMEOUT 60 |
Ravi Joshi | fe5e116 | 2013-06-17 18:24:34 -0700 | [diff] [blame] | 46 | #define IBSS_BROADCAST_STAID 0 |
Abhishek Singh | 00b7197 | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 47 | |
| 48 | #ifdef WLAN_FEATURE_RMC |
| 49 | /* Timeout in ms for peer info request commpletion */ |
| 50 | #define IBSS_PEER_INFO_REQ_TIMOEUT 1000 |
| 51 | #endif |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * struct hdd_conn_flag - connection flags |
| 55 | * @ht_present: ht element present or not |
| 56 | * @vht_present: vht element present or not |
| 57 | * @hs20_present: hs20 element present or not |
| 58 | */ |
| 59 | struct hdd_conn_flag { |
| 60 | uint8_t ht_present:1; |
| 61 | uint8_t vht_present:1; |
| 62 | uint8_t hs20_present:1; |
| 63 | uint8_t ht_op_present:1; |
| 64 | uint8_t vht_op_present:1; |
| 65 | uint8_t reserved:3; |
| 66 | }; |
| 67 | |
| 68 | /*defines for tx_BF_cap_info */ |
| 69 | #define TX_BF_CAP_INFO_TX_BF 0x00000001 |
| 70 | #define TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING 0x00000002 |
| 71 | #define TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING 0x00000004 |
| 72 | #define TX_BF_CAP_INFO_RX_ZFL 0x00000008 |
| 73 | #define TX_BF_CAP_INFO_TX_ZFL 0x00000010 |
| 74 | #define TX_BF_CAP_INFO_IMP_TX_BF 0x00000020 |
| 75 | #define TX_BF_CAP_INFO_CALIBRATION 0x000000c0 |
| 76 | #define TX_BF_CAP_INFO_CALIBRATION_SHIFT 6 |
| 77 | #define TX_BF_CAP_INFO_EXP_CSIT_BF 0x00000100 |
| 78 | #define TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT 0x00000200 |
| 79 | #define TX_BF_CAP_INFO_EXP_BF_CSI_FB 0x00001c00 |
| 80 | #define TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT 10 |
| 81 | #define TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT 0x0000e000 |
| 82 | #define TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT 13 |
| 83 | #define TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB 0x00070000 |
| 84 | #define TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT 16 |
| 85 | #define TX_BF_CAP_INFO_CSI_NUM_BF_ANT 0x00180000 |
| 86 | #define TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT 18 |
| 87 | #define TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT 0x00600000 |
| 88 | #define TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT 20 |
| 89 | #define TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT 0x01800000 |
| 90 | #define TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT 22 |
| 91 | #define TX_BF_CAP_INFO_RSVD 0xfe000000 |
| 92 | |
| 93 | /* defines for antenna selection info */ |
| 94 | #define ANTENNA_SEL_INFO 0x01 |
| 95 | #define ANTENNA_SEL_INFO_EXP_CSI_FB_TX 0x02 |
| 96 | #define ANTENNA_SEL_INFO_ANT_ID_FB_TX 0x04 |
| 97 | #define ANTENNA_SEL_INFO_EXP_CSI_FB 0x08 |
| 98 | #define ANTENNA_SEL_INFO_ANT_ID_FB 0x10 |
| 99 | #define ANTENNA_SEL_INFO_RX_AS 0x20 |
| 100 | #define ANTENNA_SEL_INFO_TX_SOUNDING_PPDU 0x40 |
| 101 | #define ANTENNA_SEL_INFO_RSVD 0x80 |
| 102 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 103 | typedef enum |
| 104 | { |
| 105 | /** Not associated in Infra or participating in an IBSS / Ad-hoc network.*/ |
| 106 | eConnectionState_NotConnected, |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 107 | |
| 108 | /** While connection in progress */ |
| 109 | eConnectionState_Connecting, |
| 110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 111 | /** Associated in an Infrastructure network.*/ |
| 112 | eConnectionState_Associated, |
| 113 | |
| 114 | /** Participating in an IBSS network though disconnected (no partner stations |
| 115 | in the IBSS).*/ |
| 116 | eConnectionState_IbssDisconnected, |
| 117 | |
| 118 | /** Participating in an IBSS network with partner stations also present*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 119 | eConnectionState_IbssConnected, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 121 | /** Disconnecting in an Infrastructure network.*/ |
| 122 | eConnectionState_Disconnecting |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | }eConnectionState; |
| 125 | /**This structure stores the connection information */ |
| 126 | typedef struct connection_info_s |
| 127 | { |
| 128 | /** connection state of the NIC.*/ |
| 129 | eConnectionState connState; |
| 130 | |
| 131 | /** BSS type of the current connection. Comes from the MIB at the |
| 132 | time the connect request is issued in combination with the BssDescription |
| 133 | from the associated entity.*/ |
| 134 | |
| 135 | eMib_dot11DesiredBssType connDot11DesiredBssType; |
| 136 | /** BSSID */ |
| 137 | tCsrBssid bssId; |
| 138 | |
| 139 | /** SSID Info*/ |
| 140 | tCsrSSIDInfo SSID; |
| 141 | |
| 142 | /** Station ID */ |
| 143 | v_U8_t staId[ HDD_MAX_NUM_IBSS_STA ]; |
| 144 | /** Peer Mac Address of the IBSS Stations */ |
| 145 | v_MACADDR_t peerMacAddress[ HDD_MAX_NUM_IBSS_STA ]; |
| 146 | /** Auth Type */ |
| 147 | eCsrAuthType authType; |
| 148 | |
| 149 | /** Unicast Encryption Type */ |
| 150 | eCsrEncryptionType ucEncryptionType; |
| 151 | |
| 152 | /** Multicast Encryption Type */ |
| 153 | eCsrEncryptionType mcEncryptionType; |
| 154 | |
| 155 | /** Keys */ |
| 156 | tCsrKeys Keys; |
| 157 | |
| 158 | /** Operation Channel */ |
| 159 | v_U8_t operationChannel; |
| 160 | |
| 161 | /** Remembers authenticated state */ |
| 162 | v_U8_t uIsAuthenticated; |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 163 | |
| 164 | /** Dot11Mode */ |
| 165 | tANI_U32 dot11Mode; |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 166 | |
| 167 | uint32_t rate_flags; |
Anurag Chouhan | bdb1fd6 | 2017-07-19 16:32:33 +0530 | [diff] [blame] | 168 | |
| 169 | /** channel frequency */ |
| 170 | uint32_t freq; |
| 171 | |
| 172 | /** txrate structure holds nss & datarate info */ |
| 173 | struct rate_info txrate; |
| 174 | |
| 175 | /** noise information */ |
| 176 | int8_t noise; |
| 177 | |
| 178 | /** ht capabilities info */ |
| 179 | struct ieee80211_ht_cap ht_caps; |
| 180 | |
| 181 | /** vht capabilities info */ |
| 182 | struct ieee80211_vht_cap vht_caps; |
| 183 | |
| 184 | /** passpoint/hs20 info */ |
| 185 | tDot11fIEhs20vendor_ie hs20vendor_ie; |
| 186 | |
| 187 | /** conn info params is present or not */ |
| 188 | struct hdd_conn_flag conn_flag; |
| 189 | |
| 190 | /** ht operation info */ |
| 191 | struct ieee80211_ht_operation ht_operation; |
| 192 | |
| 193 | /** ht operation info */ |
| 194 | struct ieee80211_vht_operation vht_operation; |
| 195 | |
| 196 | /** roaming counter */ |
| 197 | uint32_t roam_count; |
| 198 | |
| 199 | /** rssi info */ |
| 200 | int8_t signal; |
| 201 | |
| 202 | /** assoc fail reason */ |
| 203 | int32_t assoc_status_code; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 204 | }connection_info_t; |
| 205 | /*Forward declaration of Adapter*/ |
| 206 | typedef struct hdd_adapter_s hdd_adapter_t; |
| 207 | typedef struct hdd_context_s hdd_context_t; |
| 208 | typedef struct hdd_station_ctx hdd_station_ctx_t; |
| 209 | typedef struct hdd_ap_ctx_s hdd_ap_ctx_t; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | typedef struct hdd_mon_ctx_s hdd_mon_ctx_t; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | |
| 212 | |
| 213 | extern v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx ); |
Agarwal Ashish | 450ffde | 2014-04-08 19:53:00 +0530 | [diff] [blame] | 214 | eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 215 | extern eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, v_U32_t roamId, |
| 216 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult ); |
| 217 | |
| 218 | extern v_VOID_t hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType ); |
| 219 | |
Jeff Johnson | 51019dc | 2013-02-21 16:44:09 -0800 | [diff] [blame] | 220 | v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddCtx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | eMib_dot11DesiredBssType *pConnectedBssType ); |
| 222 | |
| 223 | int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType ); |
| 224 | |
| 225 | int hdd_set_csr_auth_type( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType ); |
Sravan Kumar Kairam | 091e5b6 | 2017-01-23 14:14:20 +0530 | [diff] [blame] | 226 | |
| 227 | void hdd_assoc_registerFwdEapolCB(void *pContext); |
| 228 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 229 | VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 230 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 231 | const tANI_U8 *peerMac, |
| 232 | #else |
| 233 | tANI_U8 *peerMac, |
| 234 | #endif |
| 235 | tANI_U16 staId, tANI_U8 ucastSig); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 236 | void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter); |
Masti, Narayanraddi | 1fb32a9 | 2015-06-29 13:14:06 +0530 | [diff] [blame] | 237 | VOS_STATUS hdd_roamDeregisterTDLSSTA(hdd_adapter_t *pAdapter, tANI_U8 staId); |
Srinivas Girigowda | 0c6d7fe | 2014-05-28 18:18:10 -0700 | [diff] [blame] | 238 | |
| 239 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 240 | void hdd_indicateEseBcnReportNoResults(const hdd_adapter_t *pAdapter, |
| 241 | const tANI_U16 measurementToken, |
| 242 | const tANI_BOOLEAN flag, |
| 243 | const tANI_U8 numBss); |
| 244 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
| 245 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 246 | void iw_full_power_cbfn (void *pContext, eHalStatus status); |
| 247 | |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 248 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 249 | tDot11fIEHTCaps *roam_ht_cap); |
| 250 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 251 | tDot11fIEVHTCaps *roam_vht_cap); |
| 252 | |
Vignesh Viswanathan | 36575f8 | 2018-06-14 16:52:21 +0530 | [diff] [blame] | 253 | /** |
| 254 | * hdd_get_sta_connection_in_progress() - get STA for which connection |
| 255 | * is in progress |
| 256 | * @hdd_ctx: hdd context |
| 257 | * |
| 258 | * Return: hdd adpater for which connection is in progress |
| 259 | */ |
| 260 | hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx); |
| 261 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 262 | #endif |