blob: a3b6c510596ae5c1089ccde93a0706e72fb2f77c [file] [log] [blame]
Jeff Johnson153f0262018-02-28 12:51:58 -08001/*
Dustin Browndb2a8be2017-12-20 11:49:56 -08002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#if !defined(WLAN_HDD_MAIN_H)
20#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080021/**
22 * DOC: wlan_hdd_main.h
23 *
24 * Linux HDD Adapter Type
25 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080026
Jeff Johnsonef926352017-01-12 10:41:02 -080027/*
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070028 * The following terms were in use in prior versions of the driver but
29 * have now been replaced with terms that are aligned with the Linux
30 * Coding style. Macros are defined to hopefully prevent new instances
31 * from being introduced, primarily by code propagation.
32 */
33#define pHddCtx
Jeff Johnson7b92c0f2017-10-02 13:31:35 -070034#define pAdapter
Jeff Johnson9c4f93d2017-10-04 08:56:22 -070035#define pHostapdAdapter
Jeff Johnson9bf24972017-10-04 09:26:58 -070036#define pHddApCtx
Jeff Johnsond377dce2017-10-04 10:32:42 -070037#define pHddStaCtx
Jeff Johnson5c19ade2017-10-04 09:52:12 -070038#define pHostapdState
Jeff Johnsonfd060852017-10-04 10:50:51 -070039#define pRoamInfo
Jeff Johnson5287de52017-10-28 12:23:06 -070040#define pScanInfo
Jeff Johnson04e00082017-10-04 12:15:58 -070041#define pBeaconIes
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070042
43/*
Jeff Johnsonef926352017-01-12 10:41:02 -080044 * Include files
45 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046
47#include <linux/netdevice.h>
48#include <linux/skbuff.h>
49#include <net/cfg80211.h>
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +053050#include <linux/ieee80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053051#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053052#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080053#include "sir_mac_prot_def.h"
54#include "csr_api.h"
55#include <wlan_hdd_assoc.h>
56#include <wlan_hdd_wmm.h>
57#include <wlan_hdd_cfg.h>
58#include <linux/spinlock.h>
59#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
60#include <linux/wakelock.h>
61#endif
62#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070064#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053066#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080067#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080069#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070070#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070071#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080072#if defined(CONFIG_HL_SUPPORT)
73#include "wlan_tgt_def_config_hl.h"
74#else
Dustin Brown61269462016-09-19 13:25:45 -070075#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080076#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053077#include <wlan_objmgr_cmn.h>
78#include <wlan_objmgr_global_obj.h>
79#include <wlan_objmgr_psoc_obj.h>
80#include <wlan_objmgr_pdev_obj.h>
81#include <wlan_objmgr_vdev_obj.h>
82#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053083#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080084#ifdef WIFI_POS_CONVERGED
85#include "os_if_wifi_pos.h"
86#include "wifi_pos_api.h"
87#else
88#include "wlan_hdd_oemdata.h"
89#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080090#include "wlan_hdd_he.h"
91
Alok Kumarb64650c2018-03-23 17:05:11 +053092#include <net/neighbour.h>
93#include <net/netevent.h>
94#include "wlan_hdd_nud_tracking.h"
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -070095#include "wlan_hdd_twt.h"
Alok Kumarb64650c2018-03-23 17:05:11 +053096
Jeff Johnsonef926352017-01-12 10:41:02 -080097/*
98 * Preprocessor definitions and constants
99 */
100
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800101/** Number of Tx Queues */
Ajit Pal Singh5d269612018-04-19 16:29:12 +0530102#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(QCA_HL_NETDEV_FLOW_CONTROL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103#define NUM_TX_QUEUES 5
104#else
105#define NUM_TX_QUEUES 4
106#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800107
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -0700108/*
109 * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're
110 * in a compat syscall or not. It is a new way to query the syscall type, which
111 * works properly on all architectures.
112 *
113 */
114#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
115static inline bool in_compat_syscall(void) { return is_compat_task(); }
116#endif
117
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700118#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
119 defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700120#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ
121#define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700122#define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700123#else
124#define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
125#define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700126#define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700127#endif
128
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800129/** Length of the TX queue for the netdev */
130#define HDD_NETDEV_TX_QUEUE_LEN (3000)
131
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800132/** Hdd Tx Time out value */
133#ifdef LIBRA_LINUX_PC
134#define HDD_TX_TIMEOUT (8000)
135#else
136#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
137#endif
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530138
139#define HDD_TX_STALL_THRESHOLD 4
140
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800141/** Hdd Default MTU */
142#define HDD_DEFAULT_MTU (1500)
143
144#ifdef QCA_CONFIG_SMP
145#define NUM_CPUS NR_CPUS
146#else
147#define NUM_CPUS 1
148#endif
149
150/**event flags registered net device*/
151#define NET_DEVICE_REGISTERED (0)
152#define SME_SESSION_OPENED (1)
153#define INIT_TX_RX_SUCCESS (2)
154#define WMM_INIT_DONE (3)
155#define SOFTAP_BSS_STARTED (4)
156#define DEVICE_IFACE_OPENED (5)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800157#define ACS_PENDING (7)
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800158#define SOFTAP_INIT_DONE (8)
159
Kapil Gupta8878ad92017-02-13 11:56:04 +0530160/* Waiting for event for vendor acs */
161#define VENDOR_ACS_RESPONSE_PENDING (8)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800162
163/* HDD global event flags */
164#define ACS_IN_PROGRESS (0)
165
166/** Maximum time(ms)to wait for disconnect to complete **/
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800167/* This value should be larger than the timeout used by WMA to wait for
168 * stop vdev response from FW
169 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170#ifdef QCA_WIFI_3_0_EMU
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800171#define WLAN_WAIT_TIME_DISCONNECT 7000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800172#else
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800173#define WLAN_WAIT_TIME_DISCONNECT 7000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174#endif
Abhishek Singhe9706cc2017-10-12 17:25:06 +0530175#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
Abhishek Singh533c9da2017-05-04 10:23:34 +0530176#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177#define WLAN_WAIT_TIME_STATS 800
178#define WLAN_WAIT_TIME_POWER 800
179#define WLAN_WAIT_TIME_COUNTRY 1000
180#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530181#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800182/* Amount of time to wait for sme close session callback.
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700183 * This value should be larger than the timeout used by WDI to wait for
Jeff Johnsonef926352017-01-12 10:41:02 -0800184 * a response from WCNSS
185 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
187#define WLAN_WAIT_TIME_ABORTSCAN 2000
188
189/** Maximum time(ms) to wait for mc thread suspend **/
190#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
191
192/** Maximum time(ms) to wait for target to be ready for suspend **/
193#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
194
195/** Maximum time(ms) to wait for tdls add sta to complete **/
196#define WAIT_TIME_TDLS_ADD_STA 1500
197
198/** Maximum time(ms) to wait for tdls del sta to complete **/
199#define WAIT_TIME_TDLS_DEL_STA 1500
200
201/** Maximum time(ms) to wait for Link Establish Req to complete **/
202#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
203
204/** Maximum time(ms) to wait for tdls mgmt to complete **/
205#define WAIT_TIME_TDLS_MGMT 11000
206
207/* Scan Req Timeout */
208#define WLAN_WAIT_TIME_SCAN_REQ 100
209
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800210#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
211#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
212
Nachiket Kukadee547a482018-05-22 16:43:30 +0530213#define WLAN_WAIT_TIME_APF 1000
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530214
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530215/* Maximum time(ms) to wait for RSO CMD status event */
216#define WAIT_TIME_RSO_CMD_STATUS 2000
217
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530218/* rcpi request timeout in milli seconds */
219#define WLAN_WAIT_TIME_RCPI 500
220
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800221#define MAX_NUMBER_OF_ADAPTERS 4
222
223#define MAX_CFG_STRING_LEN 255
224
Kapil Gupta8878ad92017-02-13 11:56:04 +0530225/* Maximum time(ms) to wait for external acs response */
226#define WLAN_VENDOR_ACS_WAIT_TIME 1000
227
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800228#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
229/** Mac Address string **/
230#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
231#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700232/* Max and min IEs length in bytes */
233#define MAX_GENIE_LEN (512)
234#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800235
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700236/** Maximum Length of WPA/RSN IE */
237#define MAX_WPA_RSN_IE_LEN 255
238
239#define WPS_OUI_TYPE "\x00\x50\xf2\x04"
240#define WPS_OUI_TYPE_SIZE 4
241
242#define SS_OUI_TYPE "\x00\x16\x32"
243#define SS_OUI_TYPE_SIZE 3
244
245#define P2P_OUI_TYPE "\x50\x6f\x9a\x09"
246#define P2P_OUI_TYPE_SIZE 4
247
248#define HS20_OUI_TYPE "\x50\x6f\x9a\x10"
249#define HS20_OUI_TYPE_SIZE 4
250
251#define OSEN_OUI_TYPE "\x50\x6f\x9a\x12"
252#define OSEN_OUI_TYPE_SIZE 4
253
254#ifdef WLAN_FEATURE_WFD
255#define WFD_OUI_TYPE "\x50\x6f\x9a\x0a"
256#define WFD_OUI_TYPE_SIZE 4
257#endif
258
259#define MBO_OUI_TYPE "\x50\x6f\x9a\x16"
260#define MBO_OUI_TYPE_SIZE 4
261
262#define QCN_OUI_TYPE "\x8c\xfd\xf0\x01"
263#define QCN_OUI_TYPE_SIZE 4
264
265#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
266 wlan_get_vendor_ie_ptr_from_oui(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, \
267 ie, ie_len)
268
269#define wlan_hdd_get_p2p_ie_ptr(ie, ie_len) \
270 wlan_get_vendor_ie_ptr_from_oui(P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE, \
271 ie, ie_len)
272
273#ifdef WLAN_FEATURE_WFD
274#define wlan_hdd_get_wfd_ie_ptr(ie, ie_len) \
275 wlan_get_vendor_ie_ptr_from_oui(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, \
276 ie, ie_len)
277#endif
278
279#define wlan_hdd_get_mbo_ie_ptr(ie, ie_len) \
280 wlan_get_vendor_ie_ptr_from_oui(MBO_OUI_TYPE, MBO_OUI_TYPE_SIZE, \
281 ie, ie_len)
282
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800283#define WLAN_CHIP_VERSION "WCNSS"
284
Dustin Brown632af712018-03-14 15:03:55 -0700285#define hdd_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_HDD, params)
286#define hdd_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_HDD, params)
287#define hdd_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_HDD, params)
288#define hdd_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_HDD, params)
289#define hdd_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_HDD, params)
290
Dustin Brown500ae3d2018-03-19 12:47:33 -0700291#define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params)
292#define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params)
293#define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params)
294#define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params)
295#define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params)
Rajeev Kumar5cb007f2017-07-27 16:19:31 -0700296
Dustin Brown32a61182018-03-14 12:14:00 -0700297#define hdd_enter() hdd_debug("enter")
298#define hdd_enter_dev(dev) hdd_debug("enter(%s)", (dev)->name)
299#define hdd_exit() hdd_debug("exit")
300
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700301#define WLAN_HDD_GET_PRIV_PTR(__dev__) \
302 (struct hdd_adapter *)(netdev_priv((__dev__)))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800303
304#define MAX_NO_OF_2_4_CHANNELS 14
305
306#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
307#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
308#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
309#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
310#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
311#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
312#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
313#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
314#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
315#define WLAN_HDD_WFA_OUI 0x506F9A
316#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
317#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
318#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
319#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
320
321#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700322 (((center_freq) == 2412) || ((center_freq) == 2437) || \
323 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800324
325#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
326 (((center_freq) == 5180) || ((center_freq) == 5200) \
327 || ((center_freq) == 5220) || ((center_freq) == 5240))
328
329#ifdef WLAN_FEATURE_11W
330#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
331#endif
332
333#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
334#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800335
336#define WLAN_HDD_QOS_ACTION_FRAME 1
337#define WLAN_HDD_QOS_MAP_CONFIGURE 4
Dustin Brownd0a76562017-10-13 14:48:37 -0700338#define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800339
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700340/* SAP client disconnect wake lock duration in milli seconds */
Dustin Brownd0a76562017-10-13 14:48:37 -0700341#define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \
342 WAKELOCK_DURATION_RECOMMENDED
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700343
Mukul Sharma974ca652016-09-03 16:24:48 +0530344#if defined(CONFIG_HL_SUPPORT)
345#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
346#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800347#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530348#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800349
Paul Zhang8bbbcdf2018-06-01 11:14:57 +0800350#define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3)
351#define HDD_CFG_REQUEST_FIRMWARE_DELAY (20)
352
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800353#define MAX_USER_COMMAND_SIZE 4096
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530354#define DNS_DOMAIN_NAME_MAX_LEN 255
355#define ICMPv6_ADDR_LEN 16
356
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800357
358#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
359#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
360
Dundi Ravitejabb06d022018-05-31 15:54:15 +0530361#define HDD_ENABLE_SIFS_BURST_DEFAULT (1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362/* If IPA UC data path is enabled, target should reserve extra tx descriptors
363 * for IPA data path.
364 * Then host data path should allow less TX packet pumping in case
365 * IPA data path enabled
366 */
367#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
368
Ryan Hsu07495ea2016-01-21 15:25:39 -0800369/*
370 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
371 * here if the Kernel version is less than 3.17 to avoid the interleave
372 * conditional compilation.
373 */
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700374#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\
375 defined(WITH_BACKPORTS))
Ryan Hsu07495ea2016-01-21 15:25:39 -0800376#define NET_NAME_UNKNOWN 0
377#endif
378
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530379#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530380
381/* session ID invalid */
382#define HDD_SESSION_ID_INVALID 0xFF
383
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530384#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
Abhishek Singh00130682017-07-14 10:46:17 +0530385#define SCAN_REJECT_THRESHOLD 15
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530386
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530387/* Default Psoc id */
388#define DEFAULT_PSOC_ID 1
389
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530390/* wait time for nud stats in milliseconds */
391#define WLAN_WAIT_TIME_NUD_STATS 800
392/* nud stats skb max length */
393#define WLAN_NUD_STATS_LEN 800
394/* ARP packet type for NUD debug stats */
395#define WLAN_NUD_STATS_ARP_PKT_TYPE 1
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +0530396/* Assigned size of driver memory dump is 4096 bytes */
397#define DRIVER_MEM_DUMP_SIZE 4096
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530398
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800399/*
400 * Generic asynchronous request/response support
401 *
402 * Many of the APIs supported by HDD require a call to SME to
403 * perform an action or to retrieve some data. In most cases SME
404 * performs the operation asynchronously, and will execute a provided
405 * callback function when the request has completed. In order to
406 * synchronize this the HDD API allocates a context which is then
407 * passed to SME, and which is then, in turn, passed back to the
408 * callback function when the operation completes. The callback
409 * function then sets a completion variable inside the context which
410 * the HDD API is waiting on. In an ideal world the HDD API would
411 * wait forever (or at least for a long time) for the response to be
412 * received and for the completion variable to be set. However in
413 * most cases these HDD APIs are being invoked in the context of a
414 * user space thread which has invoked either a cfg80211 API or a
415 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
416 * Since this lock is used to synchronize many of the kernel tasks, we
417 * do not want to hold it for a long time. In addition we do not want
418 * to block user space threads (such as the wpa supplicant's main
419 * thread) for an extended time. Therefore we only block for a short
420 * time waiting for the response before we timeout. This means that
421 * it is possible for the HDD API to timeout, and for the callback to
422 * be invoked afterwards. In order for the callback function to
423 * determine if the HDD API is still waiting, a magic value is also
424 * stored in the shared context. Only if the context has a valid
425 * magic will the callback routine do any work. In order to further
426 * synchronize these activities a spinlock is used so that if any HDD
427 * API timeout coincides with its callback, the operations of the two
428 * threads will be serialized.
429 */
430
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800431extern spinlock_t hdd_context_lock;
Arunk Khandavalli16d84252017-06-21 15:26:29 +0530432extern struct mutex hdd_init_deinit_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800433
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800434/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800435 * Prevent from permanent stall, resume OS Q if timer expired
436 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800437#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
438#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
439#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
440
Nirav Shah997e0832018-06-06 17:49:12 +0530441#ifndef NUM_TX_RX_HISTOGRAM
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700442#define NUM_TX_RX_HISTOGRAM 128
Nirav Shah997e0832018-06-06 17:49:12 +0530443#endif
444
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800445#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
446
Mohit Khannae71e2262015-11-10 09:37:24 -0800447/**
Jeff Johnson37ecea42018-03-18 17:54:40 -0700448 * enum hdd_auth_key_mgmt - auth key mgmt protocols
449 * @HDD_AUTH_KEY_MGMT_802_1X: 802.1x
450 * @HDD_AUTH_KEY_MGMT_PSK: PSK
451 * @HDD_AUTH_KEY_MGMT_CCKM: CCKM
452 */
453enum hdd_auth_key_mgmt {
454 HDD_AUTH_KEY_MGMT_802_1X = BIT(0),
455 HDD_AUTH_KEY_MGMT_PSK = BIT(1),
456 HDD_AUTH_KEY_MGMT_CCKM = BIT(2)
457};
458
459/**
Mohit Khannae71e2262015-11-10 09:37:24 -0800460 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
461 * received over 100ms intervals
462 * @interval_rx: # of rx packets received in the last 100ms interval
463 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700464 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800465 * determined on the basis of total tx and rx packets
466 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700467 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800468 * determined on the basis of rx packets received in the
469 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700470 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800471 * determined on the basis of tx packets received in the
472 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800473 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800474 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800475 * The structure keeps track of throughput requirements of wlan driver.
476 * An entry is added if either of next_vote_level, next_rx_level or
477 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800478 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800479struct hdd_tx_rx_histogram {
480 uint64_t interval_rx;
481 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482 uint32_t next_vote_level;
483 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800484 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800485 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800486};
487
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700488struct hdd_tx_rx_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489 /* start_xmit stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700490 __u32 tx_called;
491 __u32 tx_dropped;
492 __u32 tx_orphaned;
493 __u32 tx_classified_ac[NUM_TX_QUEUES];
494 __u32 tx_dropped_ac[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800495
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800496 /* rx stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700497 __u32 rx_packets[NUM_CPUS];
498 __u32 rx_dropped[NUM_CPUS];
499 __u32 rx_delivered[NUM_CPUS];
500 __u32 rx_refused[NUM_CPUS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800501
502 /* txflow stats */
503 bool is_txflow_paused;
504 __u32 txflow_pause_cnt;
505 __u32 txflow_unpause_cnt;
506 __u32 txflow_timer_cnt;
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530507
508 /*tx timeout stats*/
509 __u32 tx_timeout_cnt;
510 __u32 cont_txtimeout_cnt;
511 u64 jiffies_last_txtimeout;
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700512};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800513
514#ifdef WLAN_FEATURE_11W
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700515/**
516 * struct hdd_pmf_stats - Protected Management Frame statistics
Jeff Johnsondc179f42017-10-21 11:27:26 -0700517 * @num_unprot_deauth_rx: Number of unprotected deauth frames received
518 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700519 */
520struct hdd_pmf_stats {
Jeff Johnsondc179f42017-10-21 11:27:26 -0700521 uint8_t num_unprot_deauth_rx;
522 uint8_t num_unprot_disassoc_rx;
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700523};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800524#endif
525
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530526/**
527 * struct hdd_arp_stats_s - arp debug stats count
528 * @tx_arp_req_count: no. of arp req received from network stack
529 * @rx_arp_rsp_count: no. of arp res received from FW
530 * @tx_dropped: no. of arp req dropped at hdd layer
531 * @rx_dropped: no. of arp res dropped
532 * @rx_delivered: no. of arp res delivered to network stack
533 * @rx_refused: no of arp rsp refused (not delivered) to network stack
534 * @tx_host_fw_sent: no of arp req sent by FW OTA
535 * @rx_host_drop_reorder: no of arp res dropped by host
536 * @rx_fw_cnt: no of arp res received by FW
537 * @tx_ack_cnt: no of arp req acked by FW
538 */
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530539struct hdd_arp_stats_s {
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +0530540 uint16_t tx_arp_req_count;
541 uint16_t rx_arp_rsp_count;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530542 uint16_t tx_dropped;
543 uint16_t rx_dropped;
544 uint16_t rx_delivered;
545 uint16_t rx_refused;
546 uint16_t tx_host_fw_sent;
547 uint16_t rx_host_drop_reorder;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530548 uint16_t rx_fw_cnt;
549 uint16_t tx_ack_cnt;
550};
551
Jeff Johnson07f94742017-08-14 15:55:40 -0700552/**
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530553 * struct hdd_dns_stats_s - dns debug stats count
554 * @tx_dns_req_count: no. of dns query received from network stack
555 * @rx_dns_rsp_count: no. of dns res received from FW
556 * @tx_dropped: no. of dns query dropped at hdd layer
557 * @rx_delivered: no. of dns res delivered to network stack
558 * @rx_refused: no of dns res refused (not delivered) to network stack
559 * @tx_host_fw_sent: no of dns query sent by FW OTA
560 * @rx_host_drop: no of dns res dropped by host
561 * @tx_ack_cnt: no of dns req acked by FW
Jeff Johnson07f94742017-08-14 15:55:40 -0700562 */
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530563struct hdd_dns_stats_s {
564 uint16_t tx_dns_req_count;
565 uint16_t rx_dns_rsp_count;
566 uint16_t tx_dropped;
567 uint16_t rx_delivered;
568 uint16_t rx_refused;
569 uint16_t tx_host_fw_sent;
570 uint16_t rx_host_drop;
571 uint16_t tx_ack_cnt;
572};
573
574/**
575 * struct hdd_tcp_stats_s - tcp debug stats count
576 * @tx_tcp_syn_count: no. of tcp syn received from network stack
577 * @@tx_tcp_ack_count: no. of tcp ack received from network stack
578 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW
579 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer
580 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer
581 * @rx_delivered: no. of tcp syn ack delivered to network stack
582 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack
583 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA
584 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA
585 * @rx_host_drop: no of tcp syn ack dropped by host
586 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW
587 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW
588 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not
589 * @is_tcp_ack_sent: flag to check tcp ack sent or not
590 */
591struct hdd_tcp_stats_s {
592 uint16_t tx_tcp_syn_count;
593 uint16_t tx_tcp_ack_count;
594 uint16_t rx_tcp_syn_ack_count;
595 uint16_t tx_tcp_syn_dropped;
596 uint16_t tx_tcp_ack_dropped;
597 uint16_t rx_delivered;
598 uint16_t rx_refused;
599 uint16_t tx_tcp_syn_host_fw_sent;
600 uint16_t tx_tcp_ack_host_fw_sent;
601 uint16_t rx_host_drop;
602 uint16_t rx_fw_cnt;
603 uint16_t tx_tcp_syn_ack_cnt;
604 uint16_t tx_tcp_ack_ack_cnt;
605 bool is_tcp_syn_ack_rcv;
606 bool is_tcp_ack_sent;
607
608};
609
610/**
611 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count
612 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack
613 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW
614 * @tx_dropped: no. of icmpv4 req dropped at hdd layer
615 * @rx_delivered: no. of icmpv4 res delivered to network stack
616 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack
617 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA
618 * @rx_host_drop: no of icmpv4 res dropped by host
619 * @rx_fw_cnt: no of icmpv4 res received by FW
620 * @tx_ack_cnt: no of icmpv4 req acked by FW
621 */
622struct hdd_icmpv4_stats_s {
623 uint16_t tx_icmpv4_req_count;
624 uint16_t rx_icmpv4_rsp_count;
625 uint16_t tx_dropped;
626 uint16_t rx_delivered;
627 uint16_t rx_refused;
628 uint16_t tx_host_fw_sent;
629 uint16_t rx_host_drop;
630 uint16_t rx_fw_cnt;
631 uint16_t tx_ack_cnt;
632};
633
Jeff Johnson07f94742017-08-14 15:55:40 -0700634struct hdd_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800635 tCsrSummaryStatsInfo summary_stat;
Jeff Johnson861dd4f2017-10-24 10:10:40 -0700636 tCsrGlobalClassAStatsInfo class_a_stat;
Jeff Johnsonf8cadec2017-10-24 10:21:25 -0700637 tCsrGlobalClassDStatsInfo class_d_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530638 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700639 struct hdd_tx_rx_stats tx_rx_stats;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530640 struct hdd_arp_stats_s hdd_arp_stats;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530641 struct hdd_dns_stats_s hdd_dns_stats;
642 struct hdd_tcp_stats_s hdd_tcp_stats;
643 struct hdd_icmpv4_stats_s hdd_icmpv4_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800644#ifdef WLAN_FEATURE_11W
Jeff Johnsondc179f42017-10-21 11:27:26 -0700645 struct hdd_pmf_stats hdd_pmf_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646#endif
Jeff Johnson07f94742017-08-14 15:55:40 -0700647};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648
Jeff Johnson41a64962017-08-14 15:29:42 -0700649/**
650 * struct hdd_roaming_info - HDD Internal Roaming Information
Jeff Johnson41a64962017-08-14 15:29:42 -0700651 * @bssid: BSSID to which we are connected
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700652 * @peer_mac: Peer MAC address for IBSS connection
653 * @roam_id: Unique identifier for a roaming instance
654 * @roam_status: Current roam command status
655 * @defer_key_complete: Should key complete be deferred?
Jeff Johnson41a64962017-08-14 15:29:42 -0700656 *
657 */
658struct hdd_roaming_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800659 tSirMacAddr bssid;
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700660 tSirMacAddr peer_mac;
661 uint32_t roam_id;
662 eRoamCmdStatus roam_status;
663 bool defer_key_complete;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800664
Jeff Johnson41a64962017-08-14 15:29:42 -0700665};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666
667#ifdef FEATURE_WLAN_WAPI
668/* Define WAPI macros for Length, BKID count etc*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800669#define MAC_ADDR_LEN 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800670#define MAX_NUM_AKM_SUITES 16
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671
672/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700673enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800674 WAPI_AUTH_MODE_OPEN = 0,
675 WAPI_AUTH_MODE_PSK = 1,
676 WAPI_AUTH_MODE_CERT
677} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800678
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800679#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
680#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
681#define WLAN_EID_WAPI 68
682#define WAPI_PSK_AKM_SUITE 0x02721400
683#define WAPI_CERT_AKM_SUITE 0x01721400
684
Jeff Johnson89798aa2017-08-16 11:00:56 -0700685/**
686 * struct hdd_wapi_info - WAPI Information structure definition
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700687 * @wapi_mode: Is WAPI enabled on this adapter?
688 * @is_wapi_sta: Is the STA associated with WAPI?
689 * @wapi_auth_mode: WAPI authentication mode used by this adapter
Jeff Johnson89798aa2017-08-16 11:00:56 -0700690 */
691struct hdd_wapi_info {
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700692 bool wapi_mode;
693 bool is_wapi_sta;
694 enum wapi_auth_mode wapi_auth_mode;
Jeff Johnson89798aa2017-08-16 11:00:56 -0700695};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800696#endif /* FEATURE_WLAN_WAPI */
697
Jeff Johnson44e52172017-09-30 16:39:16 -0700698struct hdd_beacon_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699 u8 *head;
700 u8 *tail;
701 u8 *proberesp_ies;
702 u8 *assocresp_ies;
703 int head_len;
704 int tail_len;
705 int proberesp_ies_len;
706 int assocresp_ies_len;
707 int dtim_period;
Jeff Johnson44e52172017-09-30 16:39:16 -0700708};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800709
Jeff Johnsonc945f562017-09-29 16:15:58 -0700710struct action_pkt_buffer {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800711 uint8_t *frame_ptr;
712 uint32_t frame_length;
713 uint16_t freq;
Jeff Johnsonc945f562017-09-29 16:15:58 -0700714};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800715
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800716/**
717 * struct hdd_scan_req - Scan Request entry
718 * @node : List entry element
719 * @adapter: Adapter address
720 * @scan_request: scan request holder
721 * @scan_id: scan identifier used across host layers which is generated at WMI
722 * @cookie: scan request identifier sent to userspace
723 * @source: scan request originator (NL/Vendor scan)
724 * @timestamp: scan request timestamp
725 *
726 * Scan request linked list element
727 */
728struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530729 qdf_list_node_t node;
Jeff Johnson9d295242017-08-29 14:39:48 -0700730 struct hdd_adapter *adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800731 struct cfg80211_scan_request *scan_request;
732 uint32_t scan_id;
733 uint8_t source;
734 uint32_t timestamp;
Nachiket Kukadec34d4a32017-07-12 16:20:27 +0530735 qdf_timer_t hdd_scan_inactivity_timer;
736 uint32_t scan_req_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800737};
738
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700739/**
740 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
741 * @channel: Channel number.
742 * @cb_mode: Channel bonding
743 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
744 * @phy_mode: PHY mode
745 */
746struct hdd_mon_set_ch_info {
747 uint8_t channel;
748 uint8_t cb_mode;
749 uint32_t channel_width;
750 eCsrPhyMode phy_mode;
751};
752
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700753/**
754 * struct hdd_station_ctx -- STA-specific information
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700755 * @roam_profile: current roaming profile
756 * @security_ie: WPA or RSN IE used by the @roam_profile
757 * @assoc_additional_ie: association additional IE used by the @roam_profile
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700758 * @wpa_versions: bitmap of supported WPA versions
Jeff Johnson37ecea42018-03-18 17:54:40 -0700759 * @auth_key_mgmt: bitmap of supported auth key mgmt protocols
Jeff Johnson731bc322017-10-14 19:53:44 -0700760 * @requested_bssid: Specific BSSID to which to connect
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700761 * @conn_info: current connection information
762 * @roam_info: current roaming information
763 * @ft_carrier_on: is carrier on
764 * @ibss_sta_generation: current ibss generation. Incremented whenever
765 * ibss New peer joins and departs the network
766 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key
767 * installed?
768 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if
769 * @ibss_enc_key_installed is %true)
770 * @ibss_peer_info: information about the ibss peer
Jeff Johnson690fe952017-10-25 11:48:39 -0700771 * @hdd_reassoc_scenario: is station in the middle of reassociation?
Jeff Johnson8380f232017-10-25 12:39:44 -0700772 * @sta_debug_state: STA context debug variable
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700773 * @broadcast_staid: STA ID assigned for broadcast frames
774 * @ch_info: monitor mode channel information
775 * @ndp_ctx: NAN data path context
776 * @ap_supports_immediate_power_save: Does the current AP allow our STA
777 * to immediately go into power save?
778 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800779struct hdd_station_ctx {
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700780 struct csr_roam_profile roam_profile;
781 uint8_t security_ie[MAX_WPA_RSN_IE_LEN];
782 tSirAddie assoc_additional_ie;
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700783 enum nl80211_wpa_versions wpa_versions;
Jeff Johnson37ecea42018-03-18 17:54:40 -0700784 enum hdd_auth_key_mgmt auth_key_mgmt;
Jeff Johnson731bc322017-10-14 19:53:44 -0700785 struct qdf_mac_addr requested_bssid;
Jeff Johnsone4bad252017-08-14 14:09:28 -0700786 struct hdd_connection_info conn_info;
Ashish Kumar Dhanotiya36d19b02018-02-22 00:59:49 +0530787 struct hdd_connection_info cache_conn_info;
Jeff Johnson41a64962017-08-14 15:29:42 -0700788 struct hdd_roaming_info roam_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800789 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800790 int ibss_sta_generation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800791 bool ibss_enc_key_installed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800792 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700793 tSirPeerInfoRspParams ibss_peer_info;
Jeff Johnson690fe952017-10-25 11:48:39 -0700794 bool hdd_reassoc_scenario;
Jeff Johnson8380f232017-10-25 12:39:44 -0700795 int sta_debug_state;
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700796 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700797 struct hdd_mon_set_ch_info ch_info;
Krunal Soni364e0872017-05-10 21:24:34 -0700798 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800799};
800
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700801/**
802 * enum bss_state - current state of the BSS
803 * @BSS_STOP: BSS is stopped
804 * @BSS_START: BSS is started
805 */
806enum bss_state {
807 BSS_STOP,
808 BSS_START,
809};
810
811/**
812 * struct hdd_hostapd_state - hostapd-related state information
813 * @bss_state: Current state of the BSS
814 * @qdf_event: Event to synchronize actions between hostapd thread and
815 * internal callback threads
816 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS
817 * is issued userspace thread can wait on this event. The event will
818 * be set when the Stop BSS processing in UMAC has completed.
Jeff Johnsonb9424862017-10-30 08:49:35 -0700819 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation.
820 * When a STA is disassociated userspace thread can wait on this
821 * event. The event will be set when the STA Disassociation
822 * processing in UMAC has completed.
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700823 * @qdf_status: Used to communicate state from other threads to the
824 * userspace thread.
825 */
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700826struct hdd_hostapd_state {
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700827 enum bss_state bss_state;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530828 qdf_event_t qdf_event;
829 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800830 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530831 QDF_STATUS qdf_status;
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700832};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800833
wadesong9b819072017-02-07 16:42:09 +0800834/**
835 * enum bss_stop_reason - reasons why a BSS is stopped.
836 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
837 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
838 * driver is trying to switch AP role to a different channel
839 * to maintain SCC mode with the STA role on the same card.
840 * this usually happens when STA is connected to an external
841 * AP that runs on a different channel
hqu73bccf22017-10-28 15:34:17 +0800842 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to
843 * vendor subcmd set sap config channel
wadesong9b819072017-02-07 16:42:09 +0800844 */
845enum bss_stop_reason {
846 BSS_STOP_REASON_INVALID = 0,
847 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
hqu73bccf22017-10-28 15:34:17 +0800848 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2,
wadesong9b819072017-02-07 16:42:09 +0800849};
850
Will Huang496b36c2017-07-11 16:38:50 +0800851/**
852 * struct hdd_rate_info - rate_info in HDD
853 * @rate: tx/rx rate (kbps)
854 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode)
855 * @nss: number of streams
856 * @mcs: mcs index for HT/VHT mode
857 * @rate_flags: rate flags for last tx/rx
858 *
859 * rate info in HDD
860 */
861struct hdd_rate_info {
862 uint32_t rate;
863 uint8_t mode;
864 uint8_t nss;
865 uint8_t mcs;
866 uint8_t rate_flags;
867};
868
869/**
870 * struct hdd_fw_txrx_stats - fw txrx status in HDD
871 * (refer to station_info struct in Kernel)
872 * @tx_packets: packets transmitted to this station
873 * @tx_bytes: bytes transmitted to this station
874 * @rx_packets: packets received from this station
875 * @rx_bytes: bytes received from this station
876 * @rx_retries: cumulative retry counts
877 * @tx_failed: number of failed transmissions
878 * @rssi: The signal strength (dbm)
879 * @tx_rate: last used tx rate info
880 * @rx_rate: last used rx rate info
881 *
882 * fw txrx status in HDD
883 */
884struct hdd_fw_txrx_stats {
885 uint32_t tx_packets;
886 uint64_t tx_bytes;
887 uint32_t rx_packets;
888 uint64_t rx_bytes;
889 uint32_t tx_retries;
890 uint32_t tx_failed;
891 int8_t rssi;
892 struct hdd_rate_info tx_rate;
893 struct hdd_rate_info rx_rate;
894};
895
896/**
Yun Parkc3e35562018-03-08 12:05:52 -0800897 * struct dhcp_phase - Per Peer DHCP Phases
898 * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or
899 * DHCP_DELINE message in OFFER phase
900 * @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
901 * @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
902 * @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or
903 * ACK phase (Renewal process)
904 */
905enum dhcp_phase {
906 DHCP_PHASE_ACK,
907 DHCP_PHASE_DISCOVER,
908 DHCP_PHASE_OFFER,
909 DHCP_PHASE_REQUEST
910};
911
912/**
913 * struct dhcp_nego_status - Per Peer DHCP Negotiation Status
914 * @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated
915 * @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST
916 * (Renewal process) phase
917 */
918enum dhcp_nego_status {
919 DHCP_NEGO_STOP,
920 DHCP_NEGO_IN_PROGRESS
921};
922
923/**
Jeff Johnson82155922017-09-30 16:54:14 -0700924 * struct hdd_station_info - Per station structure kept in HDD for
Will Huang496b36c2017-07-11 16:38:50 +0800925 * multiple station support for SoftAP
Jeff Johnsonb105d052017-10-21 12:07:29 -0700926 * @in_use: Is the station entry in use?
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700927 * @sta_id: Station ID reported back from HAL (through SAP).
Will Huang496b36c2017-07-11 16:38:50 +0800928 * Broadcast uses station ID zero by default.
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700929 * @sta_type: Type of station i.e. p2p client or infrastructure station
Jeff Johnsonf2356512017-10-21 16:04:12 -0700930 * @sta_mac: MAC address of the station
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700931 * @peer_state: Current Station state so HDD knows how to deal with packet
Will Huang496b36c2017-07-11 16:38:50 +0800932 * queue. Most recent states used to change TLSHIM STA state.
Jeff Johnson65fda112017-10-21 13:46:10 -0700933 * @is_qos_enabled: Track QoS status of station
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700934 * @is_deauth_in_progress: The station entry for which Deauth is in progress
Will Huang496b36c2017-07-11 16:38:50 +0800935 * @nss: Number of spatial streams supported
936 * @rate_flags: Rate Flags for this connection
937 * @ecsa_capable: Extended CSA capabilities
938 * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc.
939 * @tx_packets: Packets send to current station
940 * @tx_bytes: Bytes send to current station
941 * @rx_packets: Packets received from current station
942 * @rx_bytes: Bytes received from current station
943 * @last_tx_rx_ts: Last tx/rx timestamp with current station
944 * @assoc_ts: Current station association timestamp
945 * @tx_rate: Tx rate with current station reported from F/W
946 * @rx_rate: Rx rate with current station reported from F/W
947 * @ampdu: Ampdu enable or not of the station
948 * @sgi_enable: Short GI enable or not of the station
949 * @tx_stbc: Tx Space-time block coding enable/disable
950 * @rx_stbc: Rx Space-time block coding enable/disable
951 * @ch_width: Channel Width of the connection
952 * @mode: Mode of the connection
953 * @max_supp_idx: Max supported rate index of the station
954 * @max_ext_idx: Max extended supported rate index of the station
955 * @max_mcs_idx: Max supported mcs index of the station
956 * @rx_mcs_map: VHT Rx mcs map
957 * @tx_mcs_map: VHT Tx mcs map
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530958 * @freq : Frequency of the current station
959 * @dot11_mode: 802.11 Mode of the connection
960 * @ht_present: HT caps present or not in the current station
961 * @vht_present: VHT caps present or not in the current station
962 * @ht_caps: HT capabilities of current station
963 * @vht_caps: VHT capabilities of current station
964 * @reason_code: Disconnection reason code for current station
965 * @rssi: RSSI of the current station reported from F/W
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800966 */
Jeff Johnson82155922017-09-30 16:54:14 -0700967struct hdd_station_info {
Jeff Johnsonb105d052017-10-21 12:07:29 -0700968 bool in_use;
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700969 uint8_t sta_id;
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700970 eStationType sta_type;
Jeff Johnsonf2356512017-10-21 16:04:12 -0700971 struct qdf_mac_addr sta_mac;
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700972 enum ol_txrx_peer_state peer_state;
Jeff Johnson65fda112017-10-21 13:46:10 -0700973 bool is_qos_enabled;
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700974 bool is_deauth_in_progress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530975 uint8_t nss;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530976 uint32_t rate_flags;
gaolez7bb1e742017-03-21 16:37:38 +0800977 uint8_t ecsa_capable;
Will Huang496b36c2017-07-11 16:38:50 +0800978 uint32_t max_phy_rate;
979 uint32_t tx_packets;
980 uint64_t tx_bytes;
981 uint32_t rx_packets;
982 uint64_t rx_bytes;
983 qdf_time_t last_tx_rx_ts;
984 qdf_time_t assoc_ts;
985 uint32_t tx_rate;
986 uint32_t rx_rate;
987 bool ampdu;
988 bool sgi_enable;
989 bool tx_stbc;
990 bool rx_stbc;
Hanumanth Reddy Pothulaf79fbdf2017-10-23 20:10:46 +0530991 tSirMacHTChannelWidth ch_width;
Will Huang496b36c2017-07-11 16:38:50 +0800992 uint8_t mode;
993 uint8_t max_supp_idx;
994 uint8_t max_ext_idx;
995 uint8_t max_mcs_idx;
996 uint8_t rx_mcs_map;
997 uint8_t tx_mcs_map;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +0530998 uint32_t freq;
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530999 uint8_t dot11_mode;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301000 bool ht_present;
1001 bool vht_present;
1002 struct ieee80211_ht_cap ht_caps;
1003 struct ieee80211_vht_cap vht_caps;
1004 uint32_t reason_code;
1005 int8_t rssi;
Yun Parkc3e35562018-03-08 12:05:52 -08001006 enum dhcp_phase dhcp_phase;
1007 enum dhcp_nego_status dhcp_nego_status;
Jeff Johnson82155922017-09-30 16:54:14 -07001008};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001009
Jeff Johnsonf283c972017-10-26 12:30:49 -07001010/**
1011 * struct hdd_ap_ctx - SAP/P2PGO specific information
1012 * @hostapd_state: state control information
Jeff Johnson01206862017-10-27 20:55:59 -07001013 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC?
Jeff Johnson136c51b2017-10-27 20:02:41 -07001014 * @ap_active: Are any stations active?
Jeff Johnson82ceb082017-10-27 14:52:42 -07001015 * @disable_intrabss_fwd: Prevent forwarding between stations
Jeff Johnson42518cf2017-10-26 13:33:29 -07001016 * @broadcast_sta_id: Station ID assigned after BSS starts
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001017 * @privacy: The privacy bits of configuration
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001018 * @encryption_type: The encryption being used
Jeff Johnson413c15f2017-10-27 18:56:35 -07001019 * @group_key: Group Encryption Key
Jeff Johnson3d731362017-10-27 19:06:41 -07001020 * @wep_key: WEP key array
1021 * @wep_def_key_idx: WEP default key index
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001022 * @sap_context: Pointer to context maintained by SAP (opaque to HDD)
Jeff Johnson91df29d2017-10-27 19:29:50 -07001023 * @sap_config: SAP configuration
Jeff Johnson01206862017-10-27 20:55:59 -07001024 * @operating_channel: channel upon which the SAP is operating
1025 * @beacon: Beacon information
1026 * @vendor_acs_timer: Timer for ACS
1027 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
1028 * @bss_stop_reason: Reason why the BSS was stopped
1029 * @txrx_stats: TX RX statistics from firmware
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301030 * @acs_in_progress: In progress acs flag for an adapter
Jeff Johnsonf283c972017-10-26 12:30:49 -07001031 */
Jeff Johnsone962b192017-08-11 15:37:08 -07001032struct hdd_ap_ctx {
Jeff Johnsonf283c972017-10-26 12:30:49 -07001033 struct hdd_hostapd_state hostapd_state;
Jeff Johnson01206862017-10-27 20:55:59 -07001034 bool dfs_cac_block_tx;
Jeff Johnson136c51b2017-10-27 20:02:41 -07001035 bool ap_active;
Jeff Johnson82ceb082017-10-27 14:52:42 -07001036 bool disable_intrabss_fwd;
Jeff Johnson42518cf2017-10-26 13:33:29 -07001037 uint8_t broadcast_sta_id;
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001038 uint8_t privacy;
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001039 eCsrEncryptionType encryption_type;
Jeff Johnson413c15f2017-10-27 18:56:35 -07001040 tCsrRoamSetKey group_key;
Jeff Johnson3d731362017-10-27 19:06:41 -07001041 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY];
1042 uint8_t wep_def_key_idx;
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001043 struct sap_context *sap_context;
Jeff Johnsone4c11db2018-05-05 23:22:32 -07001044 tsap_config_t sap_config;
Jeff Johnson01206862017-10-27 20:55:59 -07001045 uint8_t operating_channel;
1046 struct hdd_beacon_data *beacon;
1047 qdf_mc_timer_t vendor_acs_timer;
1048 bool vendor_acs_timer_initialized;
1049 enum bss_stop_reason bss_stop_reason;
1050 struct hdd_fw_txrx_stats txrx_stats;
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301051 qdf_atomic_t acs_in_progress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001052};
1053
Jeff Johnson37588942017-08-15 16:11:41 -07001054/**
1055 * struct hdd_scan_info - Per-adapter scan information
Jeff Johnson37fa0402017-10-28 12:42:29 -07001056 * @scan_add_ie: Additional IE for scan
Jeff Johnson37588942017-08-15 16:11:41 -07001057 * @default_scan_ies: Default scan IEs
1058 * @default_scan_ies_len: Length of @default_scan_ies
1059 * @scan_mode: Scan mode
Jeff Johnson37588942017-08-15 16:11:41 -07001060 */
1061struct hdd_scan_info {
Jeff Johnson37fa0402017-10-28 12:42:29 -07001062 tSirAddie scan_add_ie;
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +05301063 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +05301064 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 tSirScanType scan_mode;
Jeff Johnson37588942017-08-15 16:11:41 -07001066};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001067
Dustin Brown61269462016-09-19 13:25:45 -07001068#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001069
1070#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001071struct hdd_multicast_addr_list {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001072 uint8_t mc_cnt;
1073 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001074};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001075#endif
1076
1077#define WLAN_HDD_MAX_HISTORY_ENTRY 10
1078
1079/**
1080 * struct hdd_netif_queue_stats - netif queue operation statistics
1081 * @pause_count - pause counter
1082 * @unpause_count - unpause counter
1083 */
1084struct hdd_netif_queue_stats {
Mohit Khannaca4173b2017-09-12 21:52:19 -07001085 u32 pause_count;
1086 u32 unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +05301087 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001088};
1089
1090/**
1091 * struct hdd_netif_queue_history - netif queue operation history
1092 * @time: timestamp
1093 * @netif_action: action type
1094 * @netif_reason: reason type
1095 * @pause_map: pause map
1096 */
1097struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +05301098 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001099 uint16_t netif_action;
1100 uint16_t netif_reason;
1101 uint32_t pause_map;
1102};
1103
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301104/**
1105 * struct hdd_chan_change_params - channel related information
1106 * @chan: operating channel
1107 * @chan_params: channel parameters
1108 */
1109struct hdd_chan_change_params {
1110 uint8_t chan;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001111 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301112};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001113
Komal Seelama89be8d2016-09-29 11:09:26 +05301114/**
Komal Seelam8634b772016-09-29 12:12:24 +05301115 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
Jeff Johnsonb9424862017-10-30 08:49:35 -07001116 * @dfs: dfs context to prevent/allow runtime pm
Jingxiang Geb49aa302018-01-17 20:54:15 +08001117 * @connect: connect context to prevent/allow runtime pm
Komal Seelam8634b772016-09-29 12:12:24 +05301118 *
Jeff Johnsonb9424862017-10-30 08:49:35 -07001119 * Runtime PM control for underlying activities
Komal Seelam8634b772016-09-29 12:12:24 +05301120 */
1121struct hdd_runtime_pm_context {
Komal Seelam81cb1662016-09-29 12:39:08 +05301122 qdf_runtime_lock_t dfs;
Jingxiang Geb49aa302018-01-17 20:54:15 +08001123 qdf_runtime_lock_t connect;
Komal Seelam8634b772016-09-29 12:12:24 +05301124};
1125
1126/**
Komal Seelama89be8d2016-09-29 11:09:26 +05301127 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
1128 * @connect: Runtime Connect Context
1129 *
1130 * Structure to hold runtime pm connect context for each adapter.
1131 */
1132struct hdd_connect_pm_context {
1133 qdf_runtime_lock_t connect;
1134};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001135
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301136/*
1137 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
1138 * belonging to this driver from net devices belonging to other devices.
1139 * Therefore, the magic number must be unique relative to the numbers for
1140 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
1141 * (e.g. by compiler argument), then use that. If it's not already defined,
1142 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
1143 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
1144 */
1145#ifndef WLAN_HDD_ADAPTER_MAGIC
1146#ifdef MULTI_IF_NAME
1147#define WLAN_HDD_ADAPTER_MAGIC \
1148 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
1149 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
1150 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
1151 (MULTI_IF_NAME[1] << 16) : \
1152 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
1153 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
1154#else
Komal Seelama89be8d2016-09-29 11:09:26 +05301155#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301156#endif
1157#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001158
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301159/**
1160 * struct rcpi_info - rcpi info
1161 * @rcpi: computed value in dB
1162 * @mac_addr: peer mac addr for which rcpi is computed
1163 */
1164struct rcpi_info {
1165 int32_t rcpi;
1166 struct qdf_mac_addr mac_addr;
1167};
1168
Jeff Johnsondba0db62017-08-30 11:12:39 -07001169struct hdd_context;
1170
Jeff Johnson85b5c112017-08-11 15:15:23 -07001171struct hdd_adapter {
Jeff Johnsond399e902015-12-17 15:17:02 -08001172 /* Magic cookie for adapter sanity verification. Note that this
1173 * needs to be at the beginning of the private data structure so
Jeff Johnsonb9424862017-10-30 08:49:35 -07001174 * that it will exist at the beginning of dev->priv and hence
Jeff Johnsond399e902015-12-17 15:17:02 -08001175 * will always be in mapped memory
1176 */
1177 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001178
Dustin Brown920397d2017-12-13 16:27:50 -08001179 /* list node for membership in the adapter list */
1180 qdf_list_node_t node;
1181
Jeff Johnsondba0db62017-08-30 11:12:39 -07001182 struct hdd_context *hdd_ctx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301183 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001184
Leo Changfdb45c32016-10-28 11:09:23 -07001185 void *txrx_vdev;
1186
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001187 /** Handle to the network device */
1188 struct net_device *dev;
1189
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001190 enum QDF_OPMODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -08001191
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001192 /** IPv4 notifier callback for handling ARP offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001193 struct work_struct ipv4_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001194#ifdef WLAN_NS_OFFLOAD
1195 /** IPv6 notifier callback for handling NS offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001196 struct work_struct ipv6_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001197#endif
1198
1199 /* TODO Move this to sta Ctx */
1200 struct wireless_dev wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001201
1202 /** ops checks if Opportunistic Power Save is Enable or Not
1203 * ctw stores ctWindow value once we receive Opps command from
1204 * wpa_supplicant then using ctWindow value we need to Enable
1205 * Opportunistic Power Save
1206 */
1207 uint8_t ops;
1208 uint32_t ctw;
1209
1210 /** Current MAC Address for the adapter */
Jeff Johnson1e851a12017-10-28 14:36:12 -07001211 struct qdf_mac_addr mac_addr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001212
Alok Kumarb64650c2018-03-23 17:05:11 +05301213#ifdef WLAN_NUD_TRACKING
1214 struct hdd_nud_tracking_info nud_tracking;
1215#endif
1216 bool disconnection_in_progress;
1217 qdf_mutex_t disconnection_status_lock;
1218
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001219 /**Event Flags*/
1220 unsigned long event_flags;
1221
1222 /**Device TX/RX statistics*/
1223 struct net_device_stats stats;
1224 /** HDD statistics*/
Jeff Johnson07f94742017-08-14 15:55:40 -07001225 struct hdd_stats hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -08001226
1227 /* estimated link speed */
1228 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001229
Jeff Johnson1b780e42017-10-31 14:11:45 -07001230 uint8_t session_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001231
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301232 /* QDF event for session close */
1233 qdf_event_t qdf_session_close_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301235 /* QDF event for session open */
1236 qdf_event_t qdf_session_open_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001237
1238 /* TODO: move these to sta ctx. These may not be used in AP */
1239 /** completion variable for disconnect callback */
1240 struct completion disconnect_comp_var;
1241
Abhishek Singh533c9da2017-05-04 10:23:34 +05301242 struct completion roaming_comp_var;
1243
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001244 /* completion variable for Linkup Event */
1245 struct completion linkup_event_var;
1246
1247 /* completion variable for cancel remain on channel Event */
1248 struct completion cancel_rem_on_chan_var;
1249
1250 /* completion variable for off channel remain on channel Event */
1251 struct completion offchannel_tx_event;
1252 /* Completion variable for action frame */
1253 struct completion tx_action_cnf_event;
1254 /* Completion variable for remain on channel ready */
1255 struct completion rem_on_chan_ready_event;
1256
1257 struct completion sta_authorized_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001258
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001259 struct completion ibss_peer_info_comp;
1260
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001261 /* Track whether the linkup handling is needed */
Jeff Johnsonc72c5732017-10-28 12:49:37 -07001262 bool is_link_up_service_needed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001263
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001264 /* WMM Status */
Jeff Johnson02d14ce2017-10-31 09:08:30 -07001265 struct hdd_wmm_status hdd_wmm_status;
Jeff Johnson18e86622017-10-28 12:55:36 -07001266
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001267 /** Multiple station supports */
1268 /** Per-station structure */
Jeff Johnsonbb8b56a2017-10-23 07:02:36 -07001269 spinlock_t sta_info_lock; /* To protect access to station Info */
1270 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT];
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301271 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001272
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001273
1274#ifdef FEATURE_WLAN_WAPI
Jeff Johnson89798aa2017-08-16 11:00:56 -07001275 struct hdd_wapi_info wapi_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001276#endif
1277
1278 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301279 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001280#ifdef WLAN_FEATURE_LPSS
1281 bool rssi_send;
1282#endif
1283
1284 uint8_t snr;
1285
Krunal Soni22208392017-09-29 18:10:34 -07001286 struct work_struct sap_stop_bss_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001287
1288 union {
Jeff Johnson40dae4e2017-08-29 14:00:25 -07001289 struct hdd_station_ctx station;
Jeff Johnson87251032017-08-29 13:31:11 -07001290 struct hdd_ap_ctx ap;
Jeff Johnsonb9424862017-10-30 08:49:35 -07001291 } session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001292
Min Liu2fef5792018-01-19 17:59:42 +08001293 qdf_atomic_t dfs_radar_found;
1294
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001295#ifdef WLAN_FEATURE_TSF
1296 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001297 uint64_t cur_target_time;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001298 uint64_t tsf_sync_soc_timer;
Yu Wang000dc2f2017-05-26 17:38:48 +08001299#ifdef WLAN_FEATURE_TSF_PLUS
1300 /* spin lock for read/write timestamps */
1301 qdf_spinlock_t host_target_sync_lock;
1302 qdf_mc_timer_t host_target_sync_timer;
1303 uint64_t cur_host_time;
1304 uint64_t last_host_time;
1305 uint64_t last_target_time;
1306 /* to store the count of continuous invalid tstamp-pair */
1307 int continuous_error_count;
1308 /* to indicate whether tsf_sync has been initialized */
1309 qdf_atomic_t tsf_sync_ready_flag;
1310#endif /* WLAN_FEATURE_TSF_PLUS */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001311#endif
1312
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001313#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001314 struct hdd_multicast_addr_list mc_addr_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001315#endif
1316 uint8_t addr_filter_pattern;
1317
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001318 bool survey_idx;
1319
Jeff Johnson37588942017-08-15 16:11:41 -07001320 struct hdd_scan_info scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001321
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001322 /* Flag to ensure PSB is configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001323 uint8_t psb_changed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001324 /* UAPSD psb value configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001325 uint8_t configured_psb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326#ifdef IPA_OFFLOAD
1327 void *ipa_context;
1328#endif
1329 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1330 * since CSR (PMAC Struct) Config is same for both AP
1331 */
1332 struct delayed_work acs_pending_work;
1333
1334 struct work_struct scan_block_work;
Min Liu9be5d4a2018-05-17 11:51:53 +08001335 qdf_list_t blocked_scan_request_q;
1336 qdf_mutex_t blocked_scan_request_q_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001337#ifdef MSM_PLATFORM
1338 unsigned long prev_rx_packets;
1339 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301340 uint64_t prev_fwd_tx_packets;
1341 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342 int connection;
1343#endif
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301344#if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
1345 defined(QCA_HL_NETDEV_FLOW_CONTROL)
Anurag Chouhan210db072016-02-22 18:42:15 +05301346 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001347 bool tx_flow_timer_initialized;
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301348#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL || QCA_HL_NETDEV_FLOW_CONTROL */
1349#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001350 unsigned int tx_flow_low_watermark;
1351 unsigned int tx_flow_high_watermark_offset;
1352#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301353
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001354 bool offloads_configured;
1355
1356 /* DSCP to UP QoS Mapping */
Jeff Johnson6b51b6a2017-11-02 20:31:25 -07001357 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001358
1359#ifdef WLAN_FEATURE_LINK_LAYER_STATS
Jeff Johnsond30ee4b2017-10-28 15:38:32 -07001360 bool is_link_layer_stats_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001361#endif
Jeff Johnsonbd4c4f02017-10-30 20:33:01 -07001362 uint8_t link_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001363
1364 /* variable for temperature in Celsius */
1365 int temperature;
1366
Agrawal Ashishb141b092016-09-02 19:59:26 +05301367#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001368 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301369 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301371#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001372
1373 /* BITMAP indicating pause reason */
1374 uint32_t pause_map;
1375 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301376 qdf_time_t start_time;
1377 qdf_time_t last_time;
1378 qdf_time_t total_pause_time;
1379 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001380 uint8_t history_index;
1381 struct hdd_netif_queue_history
1382 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1383 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001384 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001385 /* debugfs entry */
1386 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301387 /*
1388 * The pre cac channel is saved here and will be used when the SAP's
1389 * channel needs to be moved from the existing 2.4GHz channel.
1390 */
1391 uint8_t pre_cac_chan;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001392
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001393 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301394 * Indicate if HO fails during disconnect so that
1395 * disconnect is not initiated by HDD as its already
1396 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001397 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301398 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301399 struct lfr_firmware_status lfr_fw_status;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301400 bool con_status;
1401 bool dad;
Ganesh Kondabattini1a2aed82017-09-28 12:21:58 +05301402 uint8_t active_ac;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +05301403 uint32_t pkt_type_bitmap;
1404 uint32_t track_arp_ip;
1405 uint8_t dns_payload[256];
1406 uint32_t track_dns_domain_len;
1407 uint32_t track_src_port;
1408 uint32_t track_dest_port;
1409 uint32_t track_dest_ipv4;
Arunk Khandavalli062fb032017-10-04 12:18:15 +05301410 uint32_t mon_chan;
1411 uint32_t mon_bandwidth;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301412
1413 /* rcpi information */
1414 struct rcpi_info rcpi;
Yeshwanth Sriram Guntuka4fe30bd2018-06-13 11:41:42 +05301415 bool send_mode_change;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001416};
1417
Jeff Johnsonb9424862017-10-30 08:49:35 -07001418#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
1419#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
Jeff Johnsondba0db62017-08-30 11:12:39 -07001420#define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001421#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001422 (&(adapter)->session.ap.hostapd_state)
1423#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001424
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001425#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001426#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001427#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001428/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1429 * intentionally so that all references to these must be within NDP code.
1430 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1431 * invoke NDP code to do all work.
1432 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001433#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001434#endif
1435
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001436/* Set mac address locally administered bit */
1437#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1438
1439#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1440#define HDD_RESET_MCC_P2P_QUOTA 50
1441
Jeff Johnson353cd292017-08-17 06:47:26 -07001442/*
1443 * struct hdd_priv_data - driver ioctl private data payload
1444 * @buf: pointer to command buffer (may be in userspace)
1445 * @used_len: length of the command/data currently in @buf
1446 * @total_len: total length of the @buf memory allocation
1447 */
1448struct hdd_priv_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001449 uint8_t *buf;
1450 int used_len;
1451 int total_len;
Jeff Johnson353cd292017-08-17 06:47:26 -07001452};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001453
1454#define MAX_MOD_LOGLEVEL 10
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001455struct fw_log_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001456 uint8_t enable;
1457 uint8_t dl_type;
1458 uint8_t dl_report;
1459 uint8_t dl_loglevel;
1460 uint8_t index;
1461 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1462
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001463};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001464
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001465/**
1466 * enum antenna_mode - number of TX/RX chains
1467 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1468 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1469 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1470 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1471 */
1472enum antenna_mode {
1473 HDD_ANTENNA_MODE_INVALID,
1474 HDD_ANTENNA_MODE_1X1,
1475 HDD_ANTENNA_MODE_2X2,
1476 HDD_ANTENNA_MODE_MAX
1477};
1478
1479/**
1480 * enum smps_mode - SM power save mode
1481 * @HDD_SMPS_MODE_STATIC: Static power save
1482 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1483 * @HDD_SMPS_MODE_RESERVED: Reserved
1484 * @HDD_SMPS_MODE_DISABLED: Disable power save
1485 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1486 */
1487enum smps_mode {
1488 HDD_SMPS_MODE_STATIC,
1489 HDD_SMPS_MODE_DYNAMIC,
1490 HDD_SMPS_MODE_RESERVED,
1491 HDD_SMPS_MODE_DISABLED,
1492 HDD_SMPS_MODE_MAX
1493};
1494
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001495#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1496/**
1497 * struct hdd_offloaded_packets - request id to pattern id mapping
1498 * @request_id: request id
1499 * @pattern_id: pattern id
1500 *
1501 */
1502struct hdd_offloaded_packets {
1503 uint32_t request_id;
1504 uint8_t pattern_id;
1505};
1506
1507/**
1508 * struct hdd_offloaded_packets_ctx - offloaded packets context
1509 * @op_table: request id to pattern id table
1510 * @op_lock: mutex lock
1511 */
1512struct hdd_offloaded_packets_ctx {
1513 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1514 struct mutex op_lock;
1515};
1516#endif
1517
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301518/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301519 * enum driver_status: Driver Modules status
1520 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1521 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1522 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1523 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1524 */
1525enum driver_modules_status {
1526 DRIVER_MODULES_UNINITIALIZED,
1527 DRIVER_MODULES_OPENED,
1528 DRIVER_MODULES_ENABLED,
1529 DRIVER_MODULES_CLOSED
1530};
1531
Agrawal Ashish65634612016-08-18 13:24:32 +05301532/**
1533 * struct acs_dfs_policy - Define ACS policies
1534 * @acs_dfs_mode: Dfs mode enabled/disabled.
1535 * @acs_channel: pre defined channel to avoid ACS.
1536 */
1537struct acs_dfs_policy {
1538 enum dfs_mode acs_dfs_mode;
1539 uint8_t acs_channel;
1540};
1541
Dustin Brown105d7902016-10-03 16:27:59 -07001542/**
1543 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1544 * SUSPEND_FAIL_IPA: IPA in progress
1545 * SUSPEND_FAIL_RADAR: radar scan in progress
1546 * SUSPEND_FAIL_ROAM: roaming in progress
1547 * SUSPEND_FAIL_SCAN: scan in progress
1548 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1549 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1550 */
1551enum suspend_fail_reason {
1552 SUSPEND_FAIL_IPA,
1553 SUSPEND_FAIL_RADAR,
1554 SUSPEND_FAIL_ROAM,
1555 SUSPEND_FAIL_SCAN,
1556 SUSPEND_FAIL_INITIAL_WAKEUP,
1557 SUSPEND_FAIL_MAX_COUNT
1558};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001559
Dustin Brownd9322482017-01-09 12:46:03 -08001560/**
1561 * suspend_resume_stats - Collection of counters for suspend/resume events
1562 * @suspends: number of suspends completed
1563 * @resumes: number of resumes completed
1564 * @suspend_fail: counters for failed suspend reasons
1565 */
1566struct suspend_resume_stats {
1567 uint32_t suspends;
1568 uint32_t resumes;
1569 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1570};
1571
Ashish Kumar Dhanotiyab28338c2017-07-21 20:12:34 +05301572/**
1573 * hdd_sta_smps_param - SMPS parameters to configure from hdd
1574 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS
1575 * mode from inactive mode
1576 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter
1577 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from
1578 * Stalled-D-SMPS mode
1579 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes
1580 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI.
1581 * Used to reduce RX chainmask.
1582 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI.
1583 * Used to increase RX chainmask.
1584 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature
1585 */
1586enum hdd_sta_smps_param {
1587 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0,
1588 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1,
1589 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2,
1590 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3,
1591 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4,
1592 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
1593};
1594
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301595/**
Ganesh Kondabattini35739572017-06-21 16:26:39 +05301596 * tos - Type of service requested by the application
1597 * TOS_BK: Back ground traffic
1598 * TOS_BE: Best effort traffic
1599 * TOS_VI: Video traffic
1600 * TOS_VO: Voice traffic
1601 */
1602enum tos {
1603 TOS_BK = 0,
1604 TOS_BE = 1,
1605 TOS_VI = 2,
1606 TOS_VO = 3,
1607};
1608
1609#define HDD_AC_BK_BIT 1
1610#define HDD_AC_BE_BIT 2
1611#define HDD_AC_VI_BIT 4
1612#define HDD_AC_VO_BIT 8
1613
1614#define HDD_MAX_OFF_CHAN_TIME_FOR_VO 20
1615#define HDD_MAX_OFF_CHAN_TIME_FOR_VI 20
1616#define HDD_MAX_OFF_CHAN_TIME_FOR_BE 40
1617#define HDD_MAX_OFF_CHAN_TIME_FOR_BK 40
1618
1619#define HDD_MAX_AC 4
1620#define HDD_MAX_OFF_CHAN_ENTRIES 2
1621
1622#define HDD_AC_BIT_INDX 0
1623#define HDD_DWELL_TIME_INDX 1
1624
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001625/**
1626 * enum RX_OFFLOAD - Receive offload modes
1627 * @CFG_LRO_ENABLED: Large Rx offload
1628 * @CFG_GRO_ENABLED: Generic Rx Offload
1629 */
1630enum RX_OFFLOAD {
1631 CFG_LRO_ENABLED = 1,
1632 CFG_GRO_ENABLED,
1633};
1634
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001635/* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1636 * 1 for WDS_STAID
1637 */
1638#define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2)
1639
Dustin Brown105d7902016-10-03 16:27:59 -07001640/** Adapter structure definition */
Jeff Johnson82797b62017-08-11 15:31:27 -07001641struct hdd_context {
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301642 struct wlan_objmgr_psoc *hdd_psoc;
1643 struct wlan_objmgr_pdev *hdd_pdev;
Jeff Johnson16528362018-06-14 12:34:16 -07001644 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001645 struct wiphy *wiphy;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301646 qdf_spinlock_t hdd_adapter_lock;
Jeff Johnson19fc8e42017-10-30 19:53:49 -07001647 qdf_list_t hdd_adapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001648
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001649 struct hdd_adapter *sta_to_adapter[HDD_MAX_ADAPTERS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001650
1651 /** Pointer for firmware image data */
1652 const struct firmware *fw;
1653
1654 /** Pointer for configuration data */
1655 const struct firmware *cfg;
1656
1657 /** Pointer to the parent device */
1658 struct device *parent_dev;
1659
1660 /** Config values read from qcom_cfg.ini file */
1661 struct hdd_config *config;
1662
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001663 /* Completion variable to indicate Mc Thread Suspended */
1664 struct completion mc_sus_event_var;
1665
Rajeev Kumareada0d02016-12-08 17:44:17 -08001666 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001667
1668#ifdef QCA_CONFIG_SMP
1669 bool is_ol_rx_thread_suspended;
1670#endif
1671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001672 bool hdd_wlan_suspended;
1673 bool suspended;
Poddar, Siddarth61fbc932017-12-19 14:27:55 +05301674 /* flag to start pktlog after SSR/PDR if previously enabled */
1675 bool is_pktlog_enabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001676
1677 /* Lock to avoid race condition during start/stop bss */
1678 struct mutex sap_lock;
1679
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001680#ifdef FEATURE_OEM_DATA_SUPPORT
1681 /* OEM App registered or not */
1682 bool oem_app_registered;
1683
1684 /* OEM App Process ID */
1685 int32_t oem_pid;
1686#endif
1687
1688 /** Concurrency Parameters*/
1689 uint32_t concurrency_mode;
1690
Anurag Chouhan6d760662016-02-20 16:05:43 +05301691 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1692 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001693
1694 /** P2P Device MAC Address for the adapter */
Jeff Johnsonacbdb1c2017-11-02 20:42:02 -07001695 struct qdf_mac_addr p2p_device_address;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001696
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301697 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301698 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001699
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001700 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001701
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001702 /* Flag keeps track of wiphy suspend/resume */
Jeff Johnson214671b2017-10-30 19:45:23 -07001703 bool is_wiphy_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001704
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001705#ifdef MSM_PLATFORM
1706 /* DDR bus bandwidth compute timer
1707 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301708 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001709 bool bus_bw_timer_running;
1710 qdf_spinlock_t bus_bw_timer_lock;
1711 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001712 int cur_vote_level;
1713 spinlock_t bus_bw_lock;
1714 int cur_rx_level;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001715 uint64_t prev_no_rx_offload_pkts;
1716 uint64_t prev_rx_offload_pkts;
Mohit Khannae71e2262015-11-10 09:37:24 -08001717 int cur_tx_level;
1718 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001719#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001720
1721 struct completion ready_to_suspend;
1722 /* defining the solution type */
1723 uint32_t target_type;
1724
Sourav Mohapatra421d42b2017-12-29 16:33:23 +05301725 qdf_atomic_t con_mode_flag;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001726 /* defining the firmware version */
1727 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001728 uint32_t target_fw_vers_ext;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001729
1730 /* defining the chip/rom version */
1731 uint32_t target_hw_version;
1732 /* defining the chip/rom revision */
1733 uint32_t target_hw_revision;
1734 /* chip/rom name */
Dustin Brown6f17a022017-07-19 13:40:55 -07001735 char *target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001736 struct regulatory reg;
1737#ifdef FEATURE_WLAN_CH_AVOID
1738 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001739 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001740#endif /* FEATURE_WLAN_CH_AVOID */
1741
1742 uint8_t max_intf_count;
1743 uint8_t current_intf_count;
1744#ifdef WLAN_FEATURE_LPSS
1745 uint8_t lpss_support;
1746#endif
1747 uint8_t ap_arpns_support;
1748 tSirScanType ioctl_scan_mode;
1749
1750#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301751 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001752#endif
1753
1754 struct work_struct sap_start_work;
1755 bool is_sap_restart_required;
1756 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301757 qdf_spinlock_t sap_update_info_lock;
1758 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001759
1760 uint8_t dev_dfs_cac_status;
1761
Jeff Johnson59b19312017-11-02 21:14:33 -07001762 bool bt_coex_mode_set;
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001763 struct fw_log_info fw_log_settings;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001764#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301765 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001766 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001767 uint8_t *last_acs_channel_list;
1768 uint8_t num_of_channels;
1769 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001770#endif
1771
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301772 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001773 atomic_t sap_dfs_ref_cnt;
1774
1775#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1776 bool is_extwow_app_type1_param_set;
1777 bool is_extwow_app_type2_param_set;
1778 bool ext_wow_should_suspend;
1779 struct completion ready_to_extwow;
1780#endif
1781
1782 /* Time since boot up to extscan start (in micro seconds) */
1783 uint64_t ext_scan_start_since_boot;
1784 unsigned long g_event_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001785 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301786
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001787#ifdef WLAN_NS_OFFLOAD
1788 /* IPv6 notifier callback for handling NS offload on change in IP */
1789 struct notifier_block ipv6_notifier;
1790#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301791 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001792 /* IPv4 notifier callback for handling ARP offload on change in IP */
1793 struct notifier_block ipv4_notifier;
1794
1795 /* number of rf chains supported by target */
1796 uint32_t num_rf_chains;
1797 /* Is htTxSTBC supported by target */
1798 uint8_t ht_tx_stbc_supported;
1799#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1800 struct hdd_offloaded_packets_ctx op_ctx;
1801#endif
1802 bool mcc_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001803 struct mutex memdump_lock;
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301804 uint16_t driver_dump_size;
1805 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001806
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001807 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301808 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001809
1810 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301811 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001812
Krunal Sonie3531942016-04-12 17:43:53 -07001813 /*
1814 * place to store FTM capab of target. This allows changing of FTM capab
1815 * at runtime and intersecting it with target capab before updating.
1816 */
1817 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001818 uint32_t rx_high_ind_cnt;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001819 /* For Rx thread non GRO/LRO packet accounting */
1820 uint64_t no_rx_offload_pkt_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001821 /* completion variable to indicate set antenna mode complete*/
1822 struct completion set_antenna_mode_cmpl;
1823 /* Current number of TX X RX chains being used */
1824 enum antenna_mode current_antenna_mode;
Nachiket Kukadee547a482018-05-22 16:43:30 +05301825 bool apf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001826
1827 /* the radio index assigned by cnss_logger */
1828 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301829 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301830 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301831 uint32_t last_nil_scan_bug_report_timestamp;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001832 enum RX_OFFLOAD ol_enable;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001833#ifdef WLAN_FEATURE_NAN_DATAPATH
1834 bool nan_datapath_enabled;
1835#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301836 /* Present state of driver cds modules */
1837 enum driver_modules_status driver_status;
Dustin Brown6f427922017-09-19 12:19:00 -07001838 /* interface idle work */
1839 qdf_delayed_work_t iface_idle_work;
Arun Khandavallifae92942016-08-01 13:31:08 +05301840 /* Interface change lock */
1841 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301842 bool rps;
Tang Yingying5a4ccf22018-03-30 15:58:27 +08001843 bool dynamic_rps;
Jeff Johnsone2ba3cd2017-10-30 20:02:09 -07001844 bool enable_rxthread;
Nirav Shahbd36b062016-07-18 11:12:59 +05301845 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301846 bool stop_modules_in_progress;
1847 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001848 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301849 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301850 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001851 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301852 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301853 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301854 struct scan_chan_info *chan_info;
1855 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301856 /* bit map to set/reset TDLS by different sources */
1857 unsigned long tdls_source_bitmap;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001858 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001859 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301860 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301861 uint8_t last_scan_reject_session_id;
1862 enum scan_reject_states last_scan_reject_reason;
1863 unsigned long last_scan_reject_timestamp;
Abhishek Singh00130682017-07-14 10:46:17 +05301864 uint8_t scan_reject_cnt;
Arif Hussain759a0232017-03-20 13:17:18 -07001865 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001866 bool reg_offload;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301867 bool rcpi_enabled;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301868#ifdef FEATURE_WLAN_CH_AVOID
Kiran Kumar Lokere48795792017-07-07 15:34:29 -07001869 struct ch_avoid_ind_type coex_avoid_freq_list;
1870 struct ch_avoid_ind_type dnbs_avoid_freq_list;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301871 /* Lock to control access to dnbs and coex avoid freq list */
1872 struct mutex avoid_freq_lock;
1873#endif
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001874#ifdef WLAN_FEATURE_TSF
1875 /* indicate whether tsf has been initialized */
1876 qdf_atomic_t tsf_ready_flag;
1877 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1878 qdf_atomic_t cap_tsf_flag;
1879 /* the context that is capturing tsf */
Jeff Johnson9d295242017-08-29 14:39:48 -07001880 struct hdd_adapter *cap_tsf_context;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001881#endif
Vidyullatha Kanchanapallybe0ebb32017-03-23 14:36:21 +05301882 uint8_t bt_a2dp_active:1;
1883 uint8_t bt_vo_active:1;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08001884 enum band_info curr_band;
Arunk Khandavalli847969d2017-09-25 15:15:36 +05301885 bool imps_enabled;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001886#ifdef WLAN_FEATURE_PACKET_FILTERING
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05301887 int user_configured_pkt_filter_rules;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001888#endif
Vignesh Viswanathan731186f2017-09-18 13:47:37 +05301889 bool is_fils_roaming_supported;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001890 QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *,
1891 struct sk_buff *);
Poddar, Siddarth4b3f7312017-11-02 17:00:20 +05301892 qdf_atomic_t vendor_disable_lro_flag;
Manjunathappa Prakash7b6cb002017-10-09 00:40:24 -07001893 qdf_atomic_t disable_lro_in_concurrency;
Poddar, Siddarth47c23402017-10-25 12:17:39 +05301894 qdf_atomic_t disable_lro_in_low_tput;
Manjunathappa Prakash81ca3a52017-10-09 01:41:58 -07001895 bool en_tcp_delack_no_lro;
Abhishek Singh6454ad32017-12-20 10:42:21 +05301896 bool force_rsne_override;
Arunk Khandavalliebd1e372017-11-06 15:00:24 +05301897 qdf_wake_lock_t monitor_mode_wakelock;
Naveen Rawat269b4ed2017-12-07 06:47:32 -08001898 bool lte_coex_ant_share;
Sandeep Puligilla019a1bd2018-02-04 22:57:44 -08001899 int sscan_pid;
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +05301900 uint32_t track_arp_ip;
Ryan Hsuc6918552018-05-16 13:29:59 -07001901
1902 /* defining the board related information */
1903 uint32_t hw_bd_id;
1904 struct board_info hw_bd_info;
Varun Reddy Yeturud33033f2018-06-11 10:58:30 -07001905#ifdef WLAN_SUPPORT_TWT
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -07001906 enum twt_status twt_state;
1907#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001908};
1909
Kapil Gupta086c6202016-12-11 18:17:06 +05301910/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301911 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1912 * @channel_count: channel count
1913 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301914 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301915 * @vendor_pcl_list: pointer to pcl list
1916 * @vendor_weight_list: pointer to pcl weight list
1917 */
1918struct hdd_vendor_acs_chan_params {
1919 uint32_t channel_count;
1920 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301921 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301922 uint8_t *vendor_pcl_list;
1923 uint8_t *vendor_weight_list;
1924};
1925
1926/**
1927 * struct hdd_external_acs_timer_context - acs timer context
1928 * @reason: reason for acs trigger
1929 * @adapter: hdd adapter for acs
1930 */
1931struct hdd_external_acs_timer_context {
1932 int8_t reason;
Jeff Johnson9d295242017-08-29 14:39:48 -07001933 struct hdd_adapter *adapter;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301934};
1935
1936/**
1937 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301938 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301939 * @pri_ch: primary channel
1940 * @ht_sec_ch: secondary channel
1941 * @vht_seg0_center_ch: segment0 for vht
1942 * @vht_seg1_center_ch: vht segment 1
1943 * @chan_width: channel width
1944 */
1945struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05301946 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301947 uint8_t pri_ch;
1948 uint8_t ht_sec_ch;
1949 uint8_t vht_seg0_center_ch;
1950 uint8_t vht_seg1_center_ch;
1951 uint8_t chan_width;
1952};
1953
1954/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301955 * struct hdd_channel_info - standard channel info
1956 * @freq: Freq in Mhz
1957 * @flags: channel info flags
1958 * @flagext: extended channel info flags
1959 * @ieee_chan_number: channel number
1960 * @max_reg_power: max tx power according to regulatory
1961 * @max_radio_power: max radio power
1962 * @min_radio_power: min radio power
1963 * @reg_class_id: regulatory class
1964 * @max_antenna_gain: max antenna gain allowed on channel
1965 * @vht_center_freq_seg0: vht center freq segment 0
1966 * @vht_center_freq_seg1: vht center freq segment 1
1967 */
1968struct hdd_channel_info {
1969 u_int16_t freq;
1970 u_int32_t flags;
1971 u_int16_t flagext;
1972 u_int8_t ieee_chan_number;
1973 int8_t max_reg_power;
1974 int8_t max_radio_power;
1975 int8_t min_radio_power;
1976 u_int8_t reg_class_id;
1977 u_int8_t max_antenna_gain;
1978 u_int8_t vht_center_freq_seg0;
1979 u_int8_t vht_center_freq_seg1;
1980};
1981
Jeff Johnsonef926352017-01-12 10:41:02 -08001982/*
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301983 * @eHDD_DRV_OP_PROBE: Refers to .probe operation
1984 * @eHDD_DRV_OP_REMOVE: Refers to .remove operation
1985 * @eHDD_DRV_OP_SHUTDOWN: Refers to .shutdown operation
1986 * @eHDD_DRV_OP_REINIT: Refers to .reinit operation
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05301987 * @eHDD_DRV_OP_IFF_UP: Refers to IFF_UP operation
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301988 */
1989enum {
1990 eHDD_DRV_OP_PROBE = 0,
1991 eHDD_DRV_OP_REMOVE,
1992 eHDD_DRV_OP_SHUTDOWN,
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05301993 eHDD_DRV_OP_REINIT,
1994 eHDD_DRV_OP_IFF_UP
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301995};
1996
1997/*
Jeff Johnsonef926352017-01-12 10:41:02 -08001998 * Function declarations and documentation
1999 */
Himanshu Agarwal813b2bf2018-01-22 16:32:15 +05302000
Jeff Johnson9d295242017-08-29 14:39:48 -07002001int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05302002 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002003 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002004
2005const char *hdd_device_mode_to_string(uint8_t device_mode);
2006
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002007QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002008 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002009
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002010QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002011 struct hdd_adapter *current_adapter,
2012 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002013
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002014QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002015 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002016
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002017QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002018 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002019
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002020QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002021 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002022
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002023QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002024 struct hdd_adapter *adapter);
2025
2026/**
2027 * hdd_for_each_adapter - adapter iterator macro
2028 * @hdd_ctx: the global HDD context
2029 * @adapter: an hdd_adapter pointer to use as a cursor
2030 */
2031#define hdd_for_each_adapter(hdd_ctx, adapter) \
2032 for (hdd_get_front_adapter(hdd_ctx, &adapter); \
2033 adapter; \
2034 hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002035
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002036struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
2037 uint8_t session_type,
2038 const char *name, tSirMacAddr macAddr,
2039 unsigned char name_assign_type,
2040 bool rtnl_held);
2041QDF_STATUS hdd_close_adapter(struct hdd_context *hdd_ctx,
2042 struct hdd_adapter *adapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08002043 bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002044QDF_STATUS hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Dustin Browndb2a8be2017-12-20 11:49:56 -08002045QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002046void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002047QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx);
2048QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx);
2049struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002050 uint32_t vdev_id);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002051struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002052 tSirMacAddr macAddr);
Dustin Brownd28772b2017-03-17 14:16:07 -07002053
Krunal Sonib51eec72017-11-20 21:53:01 -08002054int hdd_vdev_create(struct hdd_adapter *adapter,
2055 csr_roam_completeCallback callback, void *ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002056int hdd_vdev_destroy(struct hdd_adapter *adapter);
2057int hdd_vdev_ready(struct hdd_adapter *adapter);
Dustin Brownd28772b2017-03-17 14:16:07 -07002058
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002059QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002060struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002061 enum QDF_OPMODE mode);
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302062/*
2063 * hdd_get_device_mode() - Get device mode
2064 * @session_id: Session id
2065 *
2066 * Return: Device mode
2067 */
Jeff Johnson36a0abf2018-05-20 11:24:25 -07002068enum QDF_OPMODE hdd_get_device_mode(uint32_t session_id);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002069void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
2070 struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002071 bool rtnl_held);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002072QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
Dustin Browndb2a8be2017-12-20 11:49:56 -08002073 struct hdd_adapter *adapter);
Liangwei Dongad89c762018-06-01 01:56:23 -04002074
2075enum hdd_adapter_stop_flag_t {
2076 HDD_IN_CAC_WORK_TH_CONTEXT = 0x00000001,
2077};
2078
2079QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
2080 struct hdd_adapter *adapter,
2081 enum hdd_adapter_stop_flag_t flag);
2082
Jeff Johnson5505db82017-11-02 21:19:23 -07002083void hdd_set_station_ops(struct net_device *dev);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002084uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002085void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx,
2086 uint8_t *releaseAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002087uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002088 enum QDF_OPMODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002089
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08002090void hdd_set_conparam(uint32_t con_param);
Jeff Johnson876c1a62017-12-12 10:43:07 -08002091enum QDF_GLOBAL_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002092void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002093void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002094void hdd_prevent_suspend(uint32_t reason);
Sourav Mohapatra92ea8d62018-02-05 10:03:10 +05302095
2096/*
2097 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list
2098 *
2099 * This function is used to fetch the first valid adapter from the adapter
2100 * list. If there is no valid adapter then it returns NULL
2101 *
2102 * @hdd_ctx: HDD context handler
2103 *
2104 * Return: NULL if no valid adapter found in the adapter list
2105 *
2106 */
2107struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx);
2108
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002109void hdd_allow_suspend(uint32_t reason);
2110void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002111
2112void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002113QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002114int wlan_hdd_validate_context(struct hdd_context *hdd_ctx);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002115
2116/**
2117 * hdd_validate_adapter() - Validate the given adapter
2118 * @adapter: the adapter to validate
2119 *
2120 * This function validates the given adapter, and ensures that it is open.
2121 *
2122 * Return: Errno
2123 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002124int hdd_validate_adapter(struct hdd_adapter *adapter);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002125
Chris Guo1751acf2017-07-03 14:09:01 +08002126/**
2127 * wlan_hdd_validate_context_in_loading() - check the HDD context in loading
2128 * @hdd_ctx: HDD context pointer
2129 *
2130 * Return: 0 if the context is valid. Error code otherwise
2131 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002132int wlan_hdd_validate_context_in_loading(struct hdd_context *hdd_ctx);
Chris Guo1751acf2017-07-03 14:09:01 +08002133
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002134bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002135QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002136bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002137
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002138#ifdef MSM_PLATFORM
Dustin Brown5ec6b552017-03-31 12:11:40 -07002139/**
2140 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
2141 * @hdd_ctx: the global hdd context
2142 *
2143 * Return: None
2144 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002145void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002146
2147/**
2148 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
2149 * @hdd_ctx: the global hdd context
2150 *
2151 * This function ensures there is at least one adapter in the associated state
2152 * before starting the bandwidth timer.
2153 *
2154 * Return: None
2155 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002156void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002157
2158/**
2159 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
2160 * @hdd_ctx: the global hdd context
2161 *
2162 * Return: None
2163 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002164void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002165
2166/**
2167 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
2168 * @hdd_ctx: the global hdd context
2169 *
2170 * This function ensures there are no adapters in the associated state before
2171 * stopping the bandwidth timer.
2172 *
2173 * Return: None
2174 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002175void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002176
2177/**
2178 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002179 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002180 *
2181 * Initialize bus bandwidth related data structures like spinlock and timer.
2182 *
2183 * Return: None.
2184 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002185int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002186
2187/**
2188 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002189 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002190 *
2191 * Destroy bus bandwidth related data structures like timer.
2192 *
2193 * Return: None.
2194 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002195void hdd_bus_bandwidth_destroy(struct hdd_context *hdd_ctx);
Lin Baic5c06882017-09-21 13:58:43 +08002196
2197/**
2198 * hdd_bus_bw_cancel_work() - Cancel the bus_bw_work worker
2199 * @hdd_ctx: HDD context
2200 *
2201 * Cancel the bus_bw_work to stop monitor link state.
2202 *
2203 * Return: None.
2204 */
2205void hdd_bus_bw_cancel_work(struct hdd_context *hdd_ctx);
jiadcdaf9bd2017-10-26 12:20:21 +08002206
Lin Bai556a1922017-11-10 20:32:04 +08002207#define GET_CUR_RX_LVL(config) ((config)->cur_rx_level)
Lin Baiaa7f8d72017-10-18 17:23:45 +08002208#define GET_BW_COMPUTE_INTV(config) ((config)->busBandwidthComputeInterval)
2209
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002210#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07002211
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002212static inline
2213void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002214{
Dustin Brown5ec6b552017-03-31 12:11:40 -07002215}
2216
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002217static inline
2218void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002219{
2220}
2221
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002222static inline
2223void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002224{
2225}
2226
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002227static inline
2228void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002229{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002230}
2231
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002232static inline
2233int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002234{
2235 return 0;
2236}
2237
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002238static inline
2239void hdd_bus_bandwidth_destroy(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002240{
Prashanth Bhattaab004382016-10-11 16:08:11 -07002241}
Lin Baic5c06882017-09-21 13:58:43 +08002242
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002243static inline
2244void hdd_bus_bw_cancel_work(struct hdd_context *hdd_ctx)
Lin Baic5c06882017-09-21 13:58:43 +08002245{
2246}
jiadcdaf9bd2017-10-26 12:20:21 +08002247
Lin Bai556a1922017-11-10 20:32:04 +08002248#define GET_CUR_RX_LVL(config) 0
Lin Baiaa7f8d72017-10-18 17:23:45 +08002249#define GET_BW_COMPUTE_INTV(config) 0
2250
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002251#endif
2252
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05302253int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
2254
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08002255int hdd_init(void);
2256void hdd_deinit(void);
2257
Arun Khandavallifae92942016-08-01 13:31:08 +05302258int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002259void __hdd_wlan_exit(void);
2260int hdd_wlan_notify_modem_power_state(int state);
2261#ifdef QCA_HT_2040_COEX
Jeff Johnsone7672e72017-10-21 15:10:04 -07002262/**
2263 * hdd_wlan_set_ht2040_mode() - notify FW with HT20/HT40 mode
2264 * @adapter: pointer to adapter
2265 * @sta_id: station id
2266 * @sta_mac: station MAC address
2267 * @channel_type: channel type
2268 *
2269 * This function notifies FW with HT20/HT40 mode
2270 *
2271 * Return: 0 if successful, error number otherwise
2272 */
2273int hdd_wlan_set_ht2040_mode(struct hdd_adapter *adapter, uint16_t sta_id,
2274 struct qdf_mac_addr sta_mac, int channel_type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002275#endif
2276
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05302277void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002278#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002279void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002280#endif
2281
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002282struct hdd_adapter *
2283hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
2284 bool check_start_bss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002285
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002286bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002287
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002288int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002289
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002290#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002291static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002292{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002293 return hdd_ctx->config->isRoamOffloadEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002294}
2295#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002296static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002297{
2298 return false;
2299}
2300#endif
2301
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002302#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002303static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002304{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002305 return hdd_ctx->config->isFastRoamIniFeatureEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002306}
2307#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002308static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002309{
2310 return false;
2311}
2312#endif
2313
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002314static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002315{
2316 bool val;
2317
2318 val = hdd_driver_roaming_supported(hdd_ctx) ||
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002319 roaming_offload_enabled(hdd_ctx);
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002320
2321 return val;
2322}
2323
2324#ifdef CFG80211_SCAN_RANDOM_MAC_ADDR
2325static inline bool hdd_scan_random_mac_addr_supported(void)
2326{
2327 return true;
2328}
2329#else
2330static inline bool hdd_scan_random_mac_addr_supported(void)
2331{
2332 return false;
2333}
2334#endif
2335
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302336/**
2337 * hdd_start_vendor_acs(): Start vendor ACS procedure
2338 * @adapter: pointer to SAP adapter struct
2339 *
2340 * This function sends the ACS config to the ACS daemon and
2341 * starts the vendor ACS timer to wait for the next command.
2342 *
2343 * Return: Status of vendor ACS procedure
2344 */
2345int hdd_start_vendor_acs(struct hdd_adapter *adapter);
2346
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002347void hdd_get_fw_version(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002348 uint32_t *major_spid, uint32_t *minor_spid,
2349 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302350/**
2351 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
2352 * @context : timeout handler context
2353 *
2354 * Return: None
2355 */
2356void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002357
Kapil Gupta8878ad92017-02-13 11:56:04 +05302358/**
2359 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
2360 * @adapter: pointer to SAP adapter struct
2361 *
2362 * This function starts the ACS procedure if there are no
2363 * constraints like MBSSID DFS restrictions.
2364 *
2365 * Return: Status of ACS Start procedure
2366 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002367int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302368
2369/**
2370 * hdd_cfg80211_update_acs_config() - update acs config to application
2371 * @adapter: hdd adapter
2372 * @reason: channel change reason
2373 *
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302374 * Return: 0 for success else error code
Kapil Gupta8878ad92017-02-13 11:56:04 +05302375 */
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302376int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
2377 uint8_t reason);
Nirav Shaheb017be2018-02-15 11:20:58 +05302378
Kapil Gupta8878ad92017-02-13 11:56:04 +05302379/**
2380 * hdd_update_acs_timer_reason() - update acs timer start reason
2381 * @adapter: hdd adapter
2382 * @reason: channel change reason
2383 *
2384 * Return: 0 for success
2385 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002386int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302387
2388/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002389 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05302390 * @adapter: AP adapter
2391 * @channel: Channel
Min Liu2fef5792018-01-19 17:59:42 +08002392 * @forced: Force to switch channel, ignore SCC/MCC check
Kapil Gupta8878ad92017-02-13 11:56:04 +05302393 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002394 * Moves the SAP interface by invoking the function which
2395 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05302396 *
2397 * Return: None
2398 */
Min Liu2fef5792018-01-19 17:59:42 +08002399void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
2400 bool forced);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002401
Nirav Shaheb017be2018-02-15 11:20:58 +05302402#if defined(FEATURE_WLAN_CH_AVOID)
2403void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
2404
2405void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2406 struct unsafe_ch_list *unsafe_chan_list,
2407 struct ch_avoid_ind_type *avoid_freq_list);
2408#else
2409static inline
2410void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
2411{
2412}
2413
2414static inline
2415void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2416 struct unsafe_ch_list *unsafe_chan_list,
2417 struct ch_avoid_ind_type *avoid_freq_list)
2418{
2419}
2420#endif
2421
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002422void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05302423 struct qdf_mac_addr hw_macaddr);
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302424
2425/**
2426 * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
2427 * @cur_adapter: Current HDD adapter passed from caller
2428 *
2429 * This function loops through all adapters and disables roaming on each STA
2430 * mode adapter except the current adapter passed from the caller
2431 *
2432 * Return: None
2433 */
2434void wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter);
2435
2436/**
2437 * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one
2438 * @cur_adapter: Current HDD adapter passed from caller
2439 *
2440 * This function loops through all adapters and enables roaming on each STA
2441 * mode adapter except the current adapter passed from the caller
2442 *
2443 * Return: None
2444 */
2445void wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002446
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002447QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002448
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002449QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002450
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002451QDF_STATUS
2452wlan_hdd_check_custom_con_channel_rules(struct hdd_adapter *sta_adapter,
2453 struct hdd_adapter *ap_adapter,
Jeff Johnson61b5e982018-03-15 11:33:31 -07002454 struct csr_roam_profile *roam_profile,
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002455 tScanResultHandle *scan_cache,
2456 bool *concurrent_chnl_same);
2457
Jeff Johnson9d295242017-08-29 14:39:48 -07002458void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
2459void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002460
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08002461void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
2462
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002463#ifdef QCA_CONFIG_SMP
2464int wlan_hdd_get_cpu(void);
2465#else
2466static inline int wlan_hdd_get_cpu(void)
2467{
2468 return 0;
2469}
2470#endif
2471
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302472void wlan_hdd_sap_pre_cac_failure(void *data);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002473void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302474
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002475void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2476 enum netif_action_type action, enum netif_reason_type reason);
2477
Ajit Pal Singh106c1412018-04-18 18:08:49 +05302478#ifdef QCA_HL_NETDEV_FLOW_CONTROL
2479void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2480 enum netif_action_type action);
2481#else
2482static inline void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2483 enum netif_action_type action)
2484{
2485}
2486#endif /* QCA_HL_NETDEV_FLOW_CONTROL */
2487
Jeff Johnson9d295242017-08-29 14:39:48 -07002488int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002489void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002490void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
2491void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
Mohit Khannaca4173b2017-09-12 21:52:19 -07002492void
2493wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
2494 enum qdf_stats_verbosity_level verb_lvl);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002495void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002496const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302497void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002498
2499struct hdd_adapter *
2500hdd_get_adapter_by_sme_session_id(struct hdd_context *hdd_ctx,
2501 uint32_t sme_session_id);
2502
Naveen Rawat4edb6822017-04-12 10:09:17 -07002503/**
2504 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2505 * @hdd_ctx: hdd context.
2506 * @iface_name: interface name
2507 *
2508 * This function is used to get the adapter with given interface name
2509 *
2510 * Return: adapter pointer if found, NULL otherwise
2511 *
2512 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002513struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx,
Naveen Rawat4edb6822017-04-12 10:09:17 -07002514 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002515enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Jeff Johnson16528362018-06-14 12:34:16 -07002516
2517/**
2518 * wlan_hdd_find_opclass() - Find operating class for a channel
2519 * @mac_handle: global MAC handle
2520 * @channel: channel id
2521 * @bw_offset: bandwidth offset
2522 *
2523 * Function invokes sme api to find the operating class
2524 *
2525 * Return: operating class
2526 */
2527uint8_t wlan_hdd_find_opclass(mac_handle_t mac_handle, uint8_t channel,
2528 uint8_t bw_offset);
2529
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002530int hdd_update_config(struct hdd_context *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002531
Mukul Sharma9d797a02017-01-05 20:26:03 +05302532/**
2533 * hdd_update_components_config() - Initialize driver per module ini parameters
2534 * @hdd_ctx: HDD Context
2535 *
2536 * API is used to initialize components configuration parameters
2537 * Return: 0 for success, errno for failure
2538 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002539int hdd_update_components_config(struct hdd_context *hdd_ctx);
Mukul Sharma9d797a02017-01-05 20:26:03 +05302540
Jeff Johnson9d295242017-08-29 14:39:48 -07002541QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302542 struct net_device *dev,
bings58ce8622017-07-10 15:55:36 +08002543 struct hdd_chan_change_params chan_change,
2544 bool legacy_phymode);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302545int wlan_hdd_set_channel(struct wiphy *wiphy,
2546 struct net_device *dev,
2547 struct cfg80211_chan_def *chandef,
2548 enum nl80211_channel_type channel_type);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002549int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302550 struct cfg80211_beacon_data *params,
2551 const u8 *ssid, size_t ssid_len,
2552 enum nl80211_hidden_ssid hidden_ssid,
Mahesh Kumar Kalikot Veetilc637fc92017-09-27 16:06:21 -07002553 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302554
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002555#if !defined(REMOVE_PKT_LOG)
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002556int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302557 int set_value2);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002558int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302559 uint8_t user_triggered, int size);
2560
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002561#else
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002562static inline
2563int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
2564 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002565{
2566 return 0;
2567}
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002568
2569static inline
2570int hdd_process_pktlog_command(struct hdd_context *hdd_ctx,
2571 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002572{
2573 return 0;
2574}
2575#endif /* REMOVE_PKT_LOG */
2576
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002577#ifdef FEATURE_TSO
2578/**
2579 * hdd_set_tso_flags() - enable TSO flags in the network device
2580 * @hdd_ctx: HDD context
2581 * @wlan_dev: network device structure
2582 *
2583 * This function enables the TSO related feature flags in the
2584 * given network device.
2585 *
2586 * Return: none
2587 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002588static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002589 struct net_device *wlan_dev)
2590{
Mohit Khanna816e6532016-12-09 15:28:21 -08002591 if (hdd_ctx->config->tso_enable &&
2592 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2593 /*
2594 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2595 * enabled.
2596 */
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002597 hdd_info("TSO Enabled");
2598 wlan_dev->features |=
2599 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2600 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2601 }
2602}
2603#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002604static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002605 struct net_device *wlan_dev){}
2606#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002607
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002608void hdd_get_ibss_peer_info_cb(void *pUserData,
2609 tSirPeerInfoRspParams *pPeerInfo);
2610
Ryan Hsuceddceb2016-04-28 10:20:14 -07002611#ifdef CONFIG_CNSS_LOGGER
2612/**
2613 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2614 * @hdd_ctx: the hdd context pointer
2615 *
2616 * The nl_srv_init() will call to cnss_logger_device_register() and
2617 * expect to get a radio_index from cnss_logger module and assign to
2618 * hdd_ctx->radio_index, then to maintain the consistency to original
2619 * design, adding the radio_index check here, then return the error
2620 * code if radio_index is not assigned correctly, which means the nl_init
2621 * from cnss_logger is failed.
2622 *
2623 * Return: 0 if successfully, otherwise error code
2624 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002625static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002626{
2627 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2628
2629 /* radio_index is assigned from 0, so only >=0 will be valid index */
2630 if (hdd_ctx->radio_index >= 0)
2631 return 0;
2632 else
2633 return -EINVAL;
2634}
2635#else
2636/**
2637 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2638 * @hdd_ctx: the hdd context pointer
2639 *
2640 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2641 * the netlink socket and return the success or not.
2642 *
2643 * Return: the return value from nl_srv_init()
2644 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002645static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002646{
2647 return nl_srv_init(hdd_ctx->wiphy);
2648}
2649#endif
Krunal Sonib51eec72017-11-20 21:53:01 -08002650QDF_STATUS hdd_sme_open_session_callback(uint8_t session_id);
2651QDF_STATUS hdd_sme_close_session_callback(uint8_t session_id);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002652
Jeff Johnson9d295242017-08-29 14:39:48 -07002653int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002654 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05302655void hdd_svc_fw_shutdown_ind(struct device *dev);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002656int hdd_register_cb(struct hdd_context *hdd_ctx);
2657void hdd_deregister_cb(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002658int hdd_start_station_adapter(struct hdd_adapter *adapter);
2659int hdd_start_ap_adapter(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002660int hdd_configure_cds(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002661int hdd_set_fw_params(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002662int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002663int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
Jeff Johnson9d295242017-08-29 14:39:48 -07002664int hdd_start_adapter(struct hdd_adapter *adapter);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002665void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);
yeshwanth sriram guntukaea63f632017-08-30 19:31:56 +05302666/**
2667 * hdd_is_interface_up()- Checkfor interface up before ssr
2668 * @hdd_ctx: HDD context
2669 *
2670 * check if there are any wlan interfaces before SSR accordingly start
2671 * the interface.
2672 *
2673 * Return: 0 if interface was opened else false
2674 */
2675bool hdd_is_interface_up(struct hdd_adapter *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302676/**
2677 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2678 * @wiphy: wiphy
2679 * @channel: channel of the BSS to find
2680 * @bssid: bssid of the BSS to find
2681 * @ssid: ssid of the BSS to find
2682 * @ssid_len: ssid len of of the BSS to find
2683 *
2684 * The API is a wrapper to get bss from kernel matching the chan,
2685 * bssid and ssid
2686 *
2687 * Return: bss structure if found else NULL
2688 */
2689struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2690 struct ieee80211_channel *channel,
2691 const u8 *bssid,
2692 const u8 *ssid, size_t ssid_len);
2693
Anurag Chouhanc4092922016-09-08 15:56:11 +05302694void hdd_connect_result(struct net_device *dev, const u8 *bssid,
Jeff Johnson172237b2017-11-07 15:32:59 -08002695 struct csr_roam_info *roam_info, const u8 *req_ie,
Anurag Chouhanc4092922016-09-08 15:56:11 +05302696 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302697 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302698 bool connect_timeout,
2699 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302700
Arun Khandavallifae92942016-08-01 13:31:08 +05302701#ifdef WLAN_FEATURE_FASTPATH
2702void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2703 void *context);
2704#else
2705static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2706 void *context)
2707{
2708}
2709#endif
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002710void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context);
Nirav Shaheb017be2018-02-15 11:20:58 +05302711
Agrawal Ashish65634612016-08-18 13:24:32 +05302712enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002713void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
Liangwei Dong6e1a2092017-08-30 16:29:06 +08002714/**
2715 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list
2716 * @hdd_ctx: hdd context pointer
2717 * @local_unsafe_list: copied unsafe chan list array
2718 * @local_unsafe_list_count: channel number in returned local_unsafe_list
2719 *
2720 * The function will allocate memory and make a copy the current unsafe
2721 * channels from hdd ctx. The caller need to free the local_unsafe_list
2722 * memory after use.
2723 *
2724 * Return: 0 if successfully clone unsafe chan list.
2725 */
2726int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
2727 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count);
2728
2729/**
2730 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not
2731 * @hdd_ctx: hdd context pointer
2732 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list
2733 * @local_unsafe_list_count: channel number in local_unsafe_list
2734 *
2735 * The function checked the input channel is same as current unsafe chan
2736 * list in hdd_ctx.
2737 *
2738 * Return: true if input channel list is same as the list in hdd_ctx
2739 */
2740bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx,
2741 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count);
2742
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002743int hdd_enable_disable_ca_event(struct hdd_context *hddctx,
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302744 uint8_t set_value);
Jeff Johnson9d295242017-08-29 14:39:48 -07002745void wlan_hdd_undo_acs(struct hdd_adapter *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002746
2747#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2748static inline int
2749hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2750{
2751 return nla_put_u64(skb, attrtype, value);
2752}
2753#else
2754static inline int
2755hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2756{
2757 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2758}
2759#endif
2760
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302761static inline int wlan_hdd_validate_session_id(u8 session_id)
2762{
2763 if (session_id != HDD_SESSION_ID_INVALID)
2764 return 0;
2765
2766 return -EINVAL;
2767}
2768
Jeff Johnson57e07512018-03-13 09:16:33 -07002769/**
2770 * hdd_roam_profile() - Get adapter's roam profile
2771 * @adapter: The adapter being queried
2772 *
2773 * Given an adapter this function returns a pointer to its roam profile.
2774 *
2775 * NOTE WELL: Caller is responsible for ensuring this interface is only
2776 * invoked for STA-type interfaces
2777 *
2778 * Return: pointer to the adapter's roam profile
2779 */
2780static inline
2781struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter)
2782{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002783 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002784
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002785 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002786
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002787 return &sta_ctx->roam_profile;
Jeff Johnson57e07512018-03-13 09:16:33 -07002788}
2789
2790/**
2791 * hdd_security_ie() - Get adapter's security IE
2792 * @adapter: The adapter being queried
2793 *
2794 * Given an adapter this function returns a pointer to its security IE
2795 * buffer. Note that this buffer is maintained outside the roam
2796 * profile but, when in use, is referenced by a pointer within the
2797 * roam profile.
2798 *
2799 * NOTE WELL: Caller is responsible for ensuring this interface is only
2800 * invoked for STA-type interfaces
2801 *
2802 * Return: pointer to the adapter's roam profile security IE buffer
2803 */
2804static inline
2805uint8_t *hdd_security_ie(struct hdd_adapter *adapter)
2806{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002807 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002808
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002809 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002810
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002811 return sta_ctx->security_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07002812}
2813
2814/**
2815 * hdd_assoc_additional_ie() - Get adapter's assoc additional IE
2816 * @adapter: The adapter being queried
2817 *
2818 * Given an adapter this function returns a pointer to its assoc
2819 * additional IE buffer. Note that this buffer is maintained outside
2820 * the roam profile but, when in use, is referenced by a pointer
2821 * within the roam profile.
2822 *
2823 * NOTE WELL: Caller is responsible for ensuring this interface is only
2824 * invoked for STA-type interfaces
2825 *
2826 * Return: pointer to the adapter's assoc additional IE buffer
2827 */
2828static inline
2829tSirAddie *hdd_assoc_additional_ie(struct hdd_adapter *adapter)
2830{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002831 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002832
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002833 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002834
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002835 return &sta_ctx->assoc_additional_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07002836}
2837
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302838/**
2839 * hdd_is_roaming_in_progress() - check if roaming is in progress
2840 * @hdd_ctx - Global HDD context
2841 *
2842 * Checks if roaming is in progress on any of the adapters
2843 *
2844 * Return: true if roaming is in progress else false
2845 */
2846bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002847void hdd_set_roaming_in_progress(bool value);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002848bool hdd_is_connection_in_progress(uint8_t *session_id,
2849 enum scan_reject_states *reason);
Jeff Johnson9d295242017-08-29 14:39:48 -07002850void hdd_restart_sap(struct hdd_adapter *ap_adapter);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002851void hdd_check_and_restart_sap_with_non_dfs_acs(void);
2852bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002853
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302854/**
2855 * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
2856 * @ap_adapter: adapter
2857 * @channel_count: valid channel count
2858 * @channel_list: valid channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302859 * @band: frequency band
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302860 *
2861 * This API returns valid channel list for SAP after removing nol and
2862 * channel which lies outside of configuration.
2863 *
2864 * Return: Zero on success, non-zero on failure
2865 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002866int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter,
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302867 uint32_t *channel_count,
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302868 uint8_t *channel_list,
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08002869 enum band_info band);
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302870/**
2871 * wlan_hdd_init_chan_info() - initialize channel info variables
2872 * @hdd_ctx: hdd ctx
2873 *
2874 * This API initialize channel info variables
2875 *
2876 * Return: None
2877 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002878void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07002879
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302880/**
2881 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2882 * @hdd_ctx: hdd ctx
2883 *
2884 * This API deinitialize channel info variables
2885 *
2886 * Return: None
2887 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002888void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002889void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08002890
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05302891/**
2892 * hdd_check_for_opened_interfaces()- Check for interface up
2893 * @hdd_ctx: HDD context
2894 *
2895 * check if there are any wlan interfaces before starting the timer
2896 * to close the modules
2897 *
2898 * Return: 0 if interface was opened else false
2899 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002900bool hdd_check_for_opened_interfaces(struct hdd_context *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08002901
2902#ifdef WIFI_POS_CONVERGED
2903/**
2904 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
2905 * function to send peer status to a registered application
2906 * @peer_mac: MAC address of peer
2907 * @peer_status: ePeerConnected or ePeerDisconnected
2908 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
2909 * @sessionId: SME session id, i.e. vdev_id
2910 * @chan_info: operating channel information
2911 * @dev_mode: dev mode for which indication is sent
2912 *
2913 * Return: none
2914 */
2915static inline void hdd_send_peer_status_ind_to_app(
2916 struct qdf_mac_addr *peer_mac,
2917 uint8_t peer_status,
2918 uint8_t peer_timing_meas_cap,
2919 uint8_t sessionId,
2920 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002921 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08002922{
2923 struct wifi_pos_ch_info ch_info;
2924
Naveen Rawat6877a242017-03-23 17:15:38 -07002925 if (!chan_info) {
2926 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2927 peer_timing_meas_cap, sessionId,
2928 NULL, dev_mode);
2929 return;
2930 }
2931
Naveen Rawat910726a2017-03-06 11:42:51 -08002932 ch_info.chan_id = chan_info->chan_id;
2933 ch_info.mhz = chan_info->mhz;
2934 ch_info.band_center_freq1 = chan_info->band_center_freq1;
2935 ch_info.band_center_freq2 = chan_info->band_center_freq2;
2936 ch_info.info = chan_info->info;
2937 ch_info.reg_info_1 = chan_info->reg_info_1;
2938 ch_info.reg_info_2 = chan_info->reg_info_2;
2939 ch_info.nss = chan_info->nss;
2940 ch_info.rate_flags = chan_info->rate_flags;
2941 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
2942 ch_info.ch_width = chan_info->ch_width;
2943 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2944 peer_timing_meas_cap, sessionId,
2945 &ch_info, dev_mode);
2946}
2947#else
2948static inline void hdd_send_peer_status_ind_to_app(
2949 struct qdf_mac_addr *peer_mac,
2950 uint8_t peer_status,
2951 uint8_t peer_timing_meas_cap,
2952 uint8_t sessionId,
2953 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002954 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08002955{
2956 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
2957 peer_timing_meas_cap, sessionId, chan_info, dev_mode);
2958}
2959#endif /* WIFI_POS_CONVERGENCE */
2960
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002961/**
2962 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
2963 * @adapter: Adapter data
2964 * @sval: P2P quota value
2965 *
2966 * Send P2P quota value to FW
2967 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07002968 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002969 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002970int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002971
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002972/**
2973 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
2974 * @adapter: Adapter data
2975 * @sval: MCC latency value
2976 *
2977 * Send MCC latency value to FW
2978 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07002979 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002980 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002981int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002982
2983/**
2984 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
2985 * and PSOC object data
2986 * @psoc: Psoc object data
2987 * @vdev_id: vdev id
2988 *
2989 * Get adapter from vdev id and PSOC object data
2990 *
2991 * Return: adapter pointer
2992 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002993struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002994 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05302995/**
2996 * hdd_unregister_notifiers()- unregister kernel notifiers
2997 * @hdd_ctx: Hdd Context
2998 *
2999 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
3000 *
3001 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003002void hdd_unregister_notifiers(struct hdd_context *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05303003
3004/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303005 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
3006 * @hdd_ctx: HDD context
3007 *
3008 * This function sends the DBS scan selection config configuration to the
3009 * firmware via WMA
3010 *
3011 * Return: 0 - success, < 0 - failure
3012 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003013int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303014
3015/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05303016 * hdd_start_complete()- complete the start event
3017 * @ret: return value for complete event.
3018 *
3019 * complete the startup event and set the return in
3020 * global variable
3021 *
3022 * Return: void
3023 */
3024
3025void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303026
3027/**
3028 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
3029 * callback
3030 * @hddctx: HDD context
3031 * @data: chip power save failure detected data
3032 *
3033 * This function reads the chip power save failure detected data and fill in
3034 * the skb with NL attributes and send up the NL event.
3035 * This callback execute in atomic context and must not invoke any
3036 * blocking calls.
3037 *
3038 * Return: none
3039 */
3040
3041void hdd_chip_pwr_save_fail_detected_cb(void *hddctx,
3042 struct chip_pwr_save_fail_detected_params
3043 *data);
3044
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303045/**
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303046 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg
3047 * @ie_whitelist: output parameter
3048 * @cfg: pointer to hdd config
3049 *
3050 * Return: None
3051 */
3052void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
3053 struct hdd_config *cfg);
3054
3055/**
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303056 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache
3057 * @adapter: adapter handle
3058 * @bssid: bssid to look for in scan cache
3059 * @rssi: rssi value found
3060 * @snr: snr value found
3061 *
3062 * Return: QDF_STATUS
3063 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003064int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303065 int8_t *rssi, int8_t *snr);
3066
Ganesh Kondabattini479a8ae2017-10-03 16:49:24 +05303067/**
3068 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters
3069 * @adapter - HDD adapter
3070 *
3071 * Return: 0 on success and non zero value on failure
3072 */
3073int hdd_reset_limit_off_chan(struct hdd_adapter *adapter);
3074
Vignesh Viswanathan3fa1d382017-08-02 19:36:43 +05303075#if defined(WLAN_FEATURE_FILS_SK) && \
3076 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
3077 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303078/**
3079 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and
3080 * free allocated memory
3081 * @adapter: pointer to hdd adapter
3082 *
3083 * Return: None
3084 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003085void hdd_clear_fils_connection_info(struct hdd_adapter *adapter);
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303086
3087/**
3088 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp
3089 * @dev: net device
3090 * @roam_fils_params: Fils join rsp params
3091 *
3092 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM)
3093 * to the network layer.
3094 *
3095 * Return: None
3096 */
Jeff Johnson172237b2017-11-07 15:32:59 -08003097void hdd_update_hlp_info(struct net_device *dev,
3098 struct csr_roam_info *roam_info);
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303099#else
Jeff Johnson9d295242017-08-29 14:39:48 -07003100static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303101{ }
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303102static inline void hdd_update_hlp_info(struct net_device *dev,
Jeff Johnson172237b2017-11-07 15:32:59 -08003103 struct csr_roam_info *roam_info)
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303104{}
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303105#endif
Dustin Brown3fb15042017-08-15 15:54:49 -07003106
3107#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownc81dd412017-08-15 16:26:28 -07003108static inline void hdd_dev_setup_destructor(struct net_device *dev)
3109{
3110 dev->destructor = free_netdev;
3111}
Dustin Brown3fb15042017-08-15 15:54:49 -07003112#else
Dustin Brownc81dd412017-08-15 16:26:28 -07003113static inline void hdd_dev_setup_destructor(struct net_device *dev)
3114{
3115 dev->needs_free_netdev = true;
3116}
Dustin Brownc81dd412017-08-15 16:26:28 -07003117#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brown3fb15042017-08-15 15:54:49 -07003118
Mohit Khannaf8f96822017-05-17 17:11:59 -07003119/**
3120 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API
3121 * @config: hdd config
3122 *
3123 * Return: NONE
3124 */
Nirav Shahd21a2e32018-04-20 16:34:43 +05303125#ifdef CONFIG_DP_TRACE
Mohit Khannaf8f96822017-05-17 17:11:59 -07003126void hdd_dp_trace_init(struct hdd_config *config);
Nirav Shahd21a2e32018-04-20 16:34:43 +05303127#else
3128static inline
3129void hdd_dp_trace_init(struct hdd_config *config) {}
3130#endif
3131
Yun Parkff6a16a2017-09-26 16:38:18 -07003132void hdd_set_rx_mode_rps(bool enable);
Mohit Khannaf8f96822017-05-17 17:11:59 -07003133
Ganesh Kondabattini35739572017-06-21 16:26:39 +05303134/**
3135 * hdd_set_limit_off_chan_for_tos() - set limit off-chan command parameters
3136 * @adapter: pointer adapter context
3137 * @tos: type of service
3138 * @status: status of the traffic (active/inactive)
3139 *
3140 * This function updates the limit off-channel command parameters to WMA
3141 *
3142 * Return: 0 on success or non zero value on failure
3143 */
3144int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos,
3145 bool is_tos_active);
3146
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05303147/**
3148 * hdd_drv_ops_inactivity_handler() - Timeout handler for driver ops
3149 * inactivity timer
3150 *
3151 * Return: None
3152 */
3153void hdd_drv_ops_inactivity_handler(void);
3154
3155/**
3156 * hdd_start_driver_ops_timer() - Starts driver ops inactivity timer
3157 * @drv_op: Enum indicating driver op
3158 *
3159 * Return: none
3160 */
3161void hdd_start_driver_ops_timer(int drv_op);
3162
3163/**
3164 * hdd_stop_driver_ops_timer() - Stops driver ops inactivity timer
3165 *
3166 * Return: none
3167 */
3168void hdd_stop_driver_ops_timer(void);
3169
Sravan Kumar Kairamd80c7662017-10-03 16:11:05 +05303170/**
3171 * hdd_pld_ipa_uc_shutdown_pipes() - Disconnect IPA WDI pipes during PDR
3172 *
3173 * Return: None
3174 */
3175void hdd_pld_ipa_uc_shutdown_pipes(void);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303176
3177/**
Jeff Johnson33142e62018-05-06 17:58:36 -07003178 * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100%
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303179 * (0x64). If it exceed make it 100%
3180 *
3181 * @per_index_score: per_index_score as input
3182 *
3183 * Return: per_index_score within the max limit
3184 */
3185uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score);
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05303186/**
3187 * hdd_get_stainfo() - get stainfo for the specified peer
3188 * @astainfo: array of the station info in which the sta info
3189 * corresponding to mac_addr needs to be searched
3190 * @mac_addr: mac address of requested peer
3191 *
3192 * This function find the stainfo for the peer with mac_addr
3193 *
3194 * Return: stainfo if found, NULL if not found
3195 */
3196struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo,
3197 struct qdf_mac_addr mac_addr);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303198
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303199/**
3200 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components
3201 *
3202 * Return: None
3203 */
3204void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc);
3205
3206/**
3207 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components
3208 *
3209 * Return: None
3210 */
3211void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc);
3212
Wen Gong3f003382018-05-14 14:26:37 +08003213#ifdef WLAN_FEATURE_MEMDUMP_ENABLE
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +05303214int hdd_driver_memdump_init(void);
3215void hdd_driver_memdump_deinit(void);
Wen Gong3f003382018-05-14 14:26:37 +08003216#else /* WLAN_FEATURE_MEMDUMP_ENABLE */
Wen Gongaa6d55d2018-04-26 16:33:21 +08003217static inline int hdd_driver_memdump_init(void)
3218{
3219 return 0;
3220}
3221static inline void hdd_driver_memdump_deinit(void)
3222{
3223}
Wen Gong3f003382018-05-14 14:26:37 +08003224#endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
Himanshu Agarwalb229a142017-12-21 10:16:45 +05303225/**
Hanumanth Reddy Pothula3862ca92018-01-12 16:44:10 +05303226 * hdd_is_cli_iface_up() - check if there is any cli iface up
3227 * @hdd_ctx: HDD context
3228 *
3229 * Return: return true if there is any cli iface(STA/P2P_CLI) is up
3230 * else return false
3231 */
3232bool hdd_is_cli_iface_up(struct hdd_context *hdd_ctx);
3233
Alok Kumarb64650c2018-03-23 17:05:11 +05303234/**
3235 * hdd_set_disconnect_status() - set adapter disconnection status
3236 * @hdd_adapter: Pointer to hdd adapter
3237 * @disconnecting: Disconnect status to set
3238 *
3239 * Return: None
3240 */
3241void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting);
3242
Nirav Shah73713f72018-05-17 14:50:41 +05303243#ifdef FEATURE_MONITOR_MODE_SUPPORT
Jeff Johnsond9952752018-04-18 12:15:35 -07003244/**
3245 * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface.
3246 * @adapter: Handle to adapter
3247 * @chan: Monitor mode channel
3248 * @bandwidth: Capture channel bandwidth
3249 *
3250 * Return: 0 on success else error code.
3251 */
3252int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3253 uint32_t bandwidth);
Nirav Shah73713f72018-05-17 14:50:41 +05303254#else
3255static inline
3256int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3257 uint32_t bandwidth)
3258{
3259 return 0;
3260}
3261#endif
Jeff Johnsond9952752018-04-18 12:15:35 -07003262
Ryan Hsuaadba072018-04-20 13:01:53 -07003263/**
3264 * hdd_wlan_get_version() - Get version information
3265 * @hdd_ctx: Global HDD context
3266 * @version_len: length of the version buffer size
3267 * @version: the buffer to the version string
3268 *
3269 * This function is used to get Wlan Driver, Firmware, Hardware Version
3270 * & the Board related information.
3271 *
3272 * Return: the length of the version string
3273 */
3274uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
3275 const size_t version_len, uint8_t *version);
Rachit Kankane0dc3e852018-05-07 17:33:42 +05303276/**
3277 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
3278 * @preamble: rate preamble
3279 * @nss: number of streams
3280 * @rate: rate index
3281 *
3282 * Rate code assembling is different for targets which are 11ax capable.
3283 * Check for the target support and assemble the rate code accordingly.
3284 *
3285 * Return: assembled rate code
3286 */
3287int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
3288
3289/**
3290 * hdd_set_11ax_rate() - set 11ax rate
3291 * @adapter: adapter being modified
3292 * @value: new 11ax rate code
3293 * @sap_config: pointer to SAP config to check HW mode
3294 * this will be NULL for call from STA persona
3295 *
3296 * Return: 0 on success, negative errno on failure
3297 */
3298int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
3299 struct sap_config *sap_config);
Ryan Hsuaadba072018-04-20 13:01:53 -07003300
3301/**
3302 * hdd_update_hw_sw_info() - API to update the HW/SW information
3303 * @hdd_ctx: Global HDD context
3304 *
3305 * API to update the HW and SW information in the driver
3306 *
3307 * Note:
3308 * All the version/revision information would only be retrieved after
3309 * firmware download
3310 *
3311 * Return: None
3312 */
3313void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx);
3314
Dundi Raviteja3bcf3a82018-05-22 13:24:18 +05303315/**
3316 * hdd_get_nud_stats_cb() - callback api to update the stats received from FW
3317 * @data: pointer to hdd context.
3318 * @rsp: pointer to data received from FW.
3319 * @context: callback context
3320 *
3321 * This is called when wlan driver received response event for
3322 * get arp stats to firmware.
3323 *
3324 * Return: None
3325 */
3326void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context);
3327
Jeff Johnsonb81b2e02018-06-11 19:13:11 -07003328/**
3329 * hdd_context_get_mac_handle() - get mac handle from hdd context
3330 * @hdd_ctx: Global HDD context pointer
3331 *
3332 * Retrieves the global MAC handle from the HDD context
3333 *
3334 * Return: The global MAC handle (which may be NULL)
3335 */
3336static inline
3337mac_handle_t hdd_context_get_mac_handle(struct hdd_context *hdd_ctx)
3338{
3339 return hdd_ctx ? hdd_ctx->mac_handle : NULL;
3340}
3341
3342/**
3343 * hdd_adapter_get_mac_handle() - get mac handle from hdd adapter
3344 * @adapter: HDD adapter pointer
3345 *
3346 * Retrieves the global MAC handle given an HDD adapter
3347 *
3348 * Return: The global MAC handle (which may be NULL)
3349 */
3350static inline
3351mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter)
3352{
3353 return adapter ?
3354 hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL;
3355}
3356
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003357#endif /* end #if !defined(WLAN_HDD_MAIN_H) */