blob: b3be425c00ff8e5b69e0cfe31f347b1fa3c30a7a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sravan Kumar Kairam091e5b62017-01-23 14:14:20 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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 Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031#if !defined( HDD_CONNECTION_H__ )
Gopichand Nakkala66923aa2013-03-06 23:17:24 +053032#define HDD_CONNECTION_H__
Jeff Johnson295189b2012-06-20 16:38:30 -070033#include <wlan_hdd_mib.h>
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +053034#include <net/cfg80211.h>
35#include <linux/ieee80211.h>
Ravi Joshiaa81ca22013-06-25 17:20:52 -070036#define HDD_MAX_NUM_IBSS_STA ( 32 )
Mohit Khanna698ba2a2012-12-04 15:08:18 -080037#ifdef FEATURE_WLAN_TDLS
Madan Mohan Koyyalamudi7d5eed32013-08-05 13:13:14 +053038#define HDD_MAX_NUM_TDLS_STA ( 8 )
Gopichand Nakkala2f4a2822013-04-17 11:22:01 -070039#define TDLS_STA_INDEX_VALID(staId) \
Masti, Narayanraddi975a9272015-05-19 11:11:43 +053040 (((staId) >= 3) && ((staId) < 0xFF))
Mohit Khanna698ba2a2012-12-04 15:08:18 -080041#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070042#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 Joshife5e1162013-06-17 18:24:34 -070046#define IBSS_BROADCAST_STAID 0
Abhishek Singh00b71972016-01-07 10:51:04 +053047
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 Chouhanbdb1fd62017-07-19 16:32:33 +053052
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 */
59struct 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 Johnson295189b2012-06-20 16:38:30 -0700103typedef enum
104{
105 /** Not associated in Infra or participating in an IBSS / Ad-hoc network.*/
106 eConnectionState_NotConnected,
Madan Mohan Koyyalamudifd4e1da2012-11-09 17:50:19 -0800107
108 /** While connection in progress */
109 eConnectionState_Connecting,
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 /** 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 Johnsone7245742012-09-05 17:12:55 -0700119 eConnectionState_IbssConnected,
Jeff Johnson295189b2012-06-20 16:38:30 -0700120
Jeff Johnsone7245742012-09-05 17:12:55 -0700121 /** Disconnecting in an Infrastructure network.*/
122 eConnectionState_Disconnecting
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124}eConnectionState;
125/**This structure stores the connection information */
126typedef 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 Nakkaladacbcb52013-04-18 16:41:54 +0530163
164 /** Dot11Mode */
165 tANI_U32 dot11Mode;
Deepthi Gowriae6a1662015-10-12 12:59:37 +0530166
167 uint32_t rate_flags;
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +0530168
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 Johnson295189b2012-06-20 16:38:30 -0700204}connection_info_t;
205/*Forward declaration of Adapter*/
206typedef struct hdd_adapter_s hdd_adapter_t;
207typedef struct hdd_context_s hdd_context_t;
208typedef struct hdd_station_ctx hdd_station_ctx_t;
209typedef struct hdd_ap_ctx_s hdd_ap_ctx_t;
Jeff Johnson295189b2012-06-20 16:38:30 -0700210typedef struct hdd_mon_ctx_s hdd_mon_ctx_t;
Jeff Johnson295189b2012-06-20 16:38:30 -0700211
212
213extern v_BOOL_t hdd_connIsConnected( hdd_station_ctx_t *pHddStaCtx );
Agarwal Ashish450ffde2014-04-08 19:53:00 +0530214eCsrBand hdd_connGetConnectedBand( hdd_station_ctx_t *pHddStaCtx );
Jeff Johnson295189b2012-06-20 16:38:30 -0700215extern eHalStatus hdd_smeRoamCallback( void *pContext, tCsrRoamInfo *pRoamInfo, v_U32_t roamId,
216 eRoamCmdStatus roamStatus, eCsrRoamResult roamResult );
217
218extern v_VOID_t hdd_connSaveConnectInfo( hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, eCsrRoamBssType eBssType );
219
Jeff Johnson51019dc2013-02-21 16:44:09 -0800220v_BOOL_t hdd_connGetConnectedBssType( hdd_station_ctx_t *pHddCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 eMib_dot11DesiredBssType *pConnectedBssType );
222
223int hdd_SetGENIEToCsr( hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType );
224
225int hdd_set_csr_auth_type( hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType );
Sravan Kumar Kairam091e5b62017-01-23 14:14:20 +0530226
227void hdd_assoc_registerFwdEapolCB(void *pContext);
228
Hoonki Lee11f7dda2013-02-14 16:55:44 -0800229VOS_STATUS hdd_roamRegisterTDLSSTA( hdd_adapter_t *pAdapter,
Anand N Sunkad9bfc2622015-07-30 15:18:54 +0530230#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 Nakkala3d295922013-05-07 16:19:14 +0530236void hdd_PerformRoamSetKeyComplete(hdd_adapter_t *pAdapter);
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +0530237VOS_STATUS hdd_roamDeregisterTDLSSTA(hdd_adapter_t *pAdapter, tANI_U8 staId);
Srinivas Girigowda0c6d7fe2014-05-28 18:18:10 -0700238
239#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
240void 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 Khandavalli7eeb1592015-10-19 21:36:57 +0530246void iw_full_power_cbfn (void *pContext, eHalStatus status);
247
Hanumanth Reddy Pothula57323632017-12-06 17:55:09 +0530248void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap,
249 tDot11fIEHTCaps *roam_ht_cap);
250void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap,
251 tDot11fIEVHTCaps *roam_vht_cap);
252
Vignesh Viswanathan36575f82018-06-14 16:52:21 +0530253/**
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 */
260hdd_adapter_t *hdd_get_sta_connection_in_progress(hdd_context_t *hdd_ctx);
261
Jeff Johnson295189b2012-06-20 16:38:30 -0700262#endif