blob: 4ce49bddbbf4cda028fd90eb15d0dd0ccc818a3d [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 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined(WLAN_HDD_MAIN_H)
29#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080030/**
31 * DOC: wlan_hdd_main.h
32 *
33 * Linux HDD Adapter Type
34 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035
Jeff Johnsonef926352017-01-12 10:41:02 -080036/*
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070037 * The following terms were in use in prior versions of the driver but
38 * have now been replaced with terms that are aligned with the Linux
39 * Coding style. Macros are defined to hopefully prevent new instances
40 * from being introduced, primarily by code propagation.
41 */
42#define pHddCtx
Jeff Johnson7b92c0f2017-10-02 13:31:35 -070043#define pAdapter
Jeff Johnson9c4f93d2017-10-04 08:56:22 -070044#define pHostapdAdapter
Jeff Johnson9bf24972017-10-04 09:26:58 -070045#define pHddApCtx
Jeff Johnsond377dce2017-10-04 10:32:42 -070046#define pHddStaCtx
Jeff Johnson5c19ade2017-10-04 09:52:12 -070047#define pHostapdState
Jeff Johnsonfd060852017-10-04 10:50:51 -070048#define pRoamInfo
Jeff Johnson5287de52017-10-28 12:23:06 -070049#define pScanInfo
Jeff Johnson04e00082017-10-04 12:15:58 -070050#define pBeaconIes
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070051
52/*
Jeff Johnsonef926352017-01-12 10:41:02 -080053 * Include files
54 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055
56#include <linux/netdevice.h>
57#include <linux/skbuff.h>
58#include <net/cfg80211.h>
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +053059#include <linux/ieee80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053060#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053061#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080062#include "sir_mac_prot_def.h"
63#include "csr_api.h"
64#include <wlan_hdd_assoc.h>
65#include <wlan_hdd_wmm.h>
66#include <wlan_hdd_cfg.h>
67#include <linux/spinlock.h>
68#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
69#include <linux/wakelock.h>
70#endif
71#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070073#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053075#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080078#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070079#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070080#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080081#if defined(CONFIG_HL_SUPPORT)
82#include "wlan_tgt_def_config_hl.h"
83#else
Dustin Brown61269462016-09-19 13:25:45 -070084#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080085#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053086#include <wlan_objmgr_cmn.h>
87#include <wlan_objmgr_global_obj.h>
88#include <wlan_objmgr_psoc_obj.h>
89#include <wlan_objmgr_pdev_obj.h>
90#include <wlan_objmgr_vdev_obj.h>
91#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053092#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080093#ifdef WIFI_POS_CONVERGED
94#include "os_if_wifi_pos.h"
95#include "wifi_pos_api.h"
96#else
97#include "wlan_hdd_oemdata.h"
98#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080099#include "wlan_hdd_he.h"
100
Jeff Johnsonef926352017-01-12 10:41:02 -0800101/*
102 * Preprocessor definitions and constants
103 */
104
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105/** Number of Tx Queues */
106#ifdef QCA_LL_TX_FLOW_CONTROL_V2
107#define NUM_TX_QUEUES 5
108#else
109#define NUM_TX_QUEUES 4
110#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800111
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700112#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
113 defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700114#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ
115#define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700116#define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700117#else
118#define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
119#define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700120#define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700121#endif
122
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800123/** Length of the TX queue for the netdev */
124#define HDD_NETDEV_TX_QUEUE_LEN (3000)
125
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126/** Hdd Tx Time out value */
127#ifdef LIBRA_LINUX_PC
128#define HDD_TX_TIMEOUT (8000)
129#else
130#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
131#endif
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530132
133#define HDD_TX_STALL_THRESHOLD 4
134
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135/** Hdd Default MTU */
136#define HDD_DEFAULT_MTU (1500)
137
138#ifdef QCA_CONFIG_SMP
139#define NUM_CPUS NR_CPUS
140#else
141#define NUM_CPUS 1
142#endif
143
144/**event flags registered net device*/
145#define NET_DEVICE_REGISTERED (0)
146#define SME_SESSION_OPENED (1)
147#define INIT_TX_RX_SUCCESS (2)
148#define WMM_INIT_DONE (3)
149#define SOFTAP_BSS_STARTED (4)
150#define DEVICE_IFACE_OPENED (5)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800151#define ACS_PENDING (7)
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800152#define SOFTAP_INIT_DONE (8)
153
Kapil Gupta8878ad92017-02-13 11:56:04 +0530154/* Waiting for event for vendor acs */
155#define VENDOR_ACS_RESPONSE_PENDING (8)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800156
157/* HDD global event flags */
158#define ACS_IN_PROGRESS (0)
159
160/** Maximum time(ms)to wait for disconnect to complete **/
161#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530162#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800163#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530164#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800165#endif
Abhishek Singhe9706cc2017-10-12 17:25:06 +0530166#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
Abhishek Singh533c9da2017-05-04 10:23:34 +0530167#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800168#define WLAN_WAIT_TIME_STATS 800
169#define WLAN_WAIT_TIME_POWER 800
170#define WLAN_WAIT_TIME_COUNTRY 1000
171#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530172#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173/* Amount of time to wait for sme close session callback.
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700174 * This value should be larger than the timeout used by WDI to wait for
Jeff Johnsonef926352017-01-12 10:41:02 -0800175 * a response from WCNSS
176 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
178#define WLAN_WAIT_TIME_ABORTSCAN 2000
179
180/** Maximum time(ms) to wait for mc thread suspend **/
181#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
182
183/** Maximum time(ms) to wait for target to be ready for suspend **/
184#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
185
186/** Maximum time(ms) to wait for tdls add sta to complete **/
187#define WAIT_TIME_TDLS_ADD_STA 1500
188
189/** Maximum time(ms) to wait for tdls del sta to complete **/
190#define WAIT_TIME_TDLS_DEL_STA 1500
191
192/** Maximum time(ms) to wait for Link Establish Req to complete **/
193#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
194
195/** Maximum time(ms) to wait for tdls mgmt to complete **/
196#define WAIT_TIME_TDLS_MGMT 11000
197
198/* Scan Req Timeout */
199#define WLAN_WAIT_TIME_SCAN_REQ 100
200
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800201#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
202#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
203
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530204#define WLAN_WAIT_TIME_BPF 1000
205
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530206/* Maximum time(ms) to wait for RSO CMD status event */
207#define WAIT_TIME_RSO_CMD_STATUS 2000
208
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530209/* rcpi request timeout in milli seconds */
210#define WLAN_WAIT_TIME_RCPI 500
211
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800212#define MAX_NUMBER_OF_ADAPTERS 4
213
214#define MAX_CFG_STRING_LEN 255
215
Kapil Gupta8878ad92017-02-13 11:56:04 +0530216/* Maximum time(ms) to wait for external acs response */
217#define WLAN_VENDOR_ACS_WAIT_TIME 1000
218
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800219#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
220/** Mac Address string **/
221#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
222#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700223/* Max and min IEs length in bytes */
224#define MAX_GENIE_LEN (512)
225#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800226
227#define WLAN_CHIP_VERSION "WCNSS"
228
Dustin Brown500ae3d2018-03-19 12:47:33 -0700229#define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params)
230#define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params)
231#define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params)
232#define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params)
233#define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params)
Rajeev Kumar5cb007f2017-07-27 16:19:31 -0700234
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530235#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800236#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
237
238#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530239 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800240#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530241 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800242#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530243 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800244#define hdd_info(format, args...) \
Srinivas Girigowda67044ad2017-03-30 21:23:51 -0700245 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530247 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800248
Dustin Brown32a61182018-03-14 12:14:00 -0700249#define hdd_enter() hdd_debug("enter")
250#define hdd_enter_dev(dev) hdd_debug("enter(%s)", (dev)->name)
251#define hdd_exit() hdd_debug("exit")
252
253#define ENTER() hdd_enter()
254#define ENTER_DEV(dev) hdd_enter_dev(dev)
255#define EXIT() hdd_exit()
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800256
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700257#define WLAN_HDD_GET_PRIV_PTR(__dev__) \
258 (struct hdd_adapter *)(netdev_priv((__dev__)))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800259
260#define MAX_NO_OF_2_4_CHANNELS 14
261
262#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
263#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
264#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
265#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
266#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
267#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
268#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
269#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
270#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
271#define WLAN_HDD_WFA_OUI 0x506F9A
272#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
273#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
274#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
275#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
276
277#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700278 (((center_freq) == 2412) || ((center_freq) == 2437) || \
279 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800280
281#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
282 (((center_freq) == 5180) || ((center_freq) == 5200) \
283 || ((center_freq) == 5220) || ((center_freq) == 5240))
284
285#ifdef WLAN_FEATURE_11W
286#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
287#endif
288
289#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
290#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291
292#define WLAN_HDD_QOS_ACTION_FRAME 1
293#define WLAN_HDD_QOS_MAP_CONFIGURE 4
Dustin Brownd0a76562017-10-13 14:48:37 -0700294#define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800295
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700296/* SAP client disconnect wake lock duration in milli seconds */
Dustin Brownd0a76562017-10-13 14:48:37 -0700297#define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \
298 WAKELOCK_DURATION_RECOMMENDED
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700299
Mukul Sharma974ca652016-09-03 16:24:48 +0530300#if defined(CONFIG_HL_SUPPORT)
301#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
302#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800303#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530304#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800305
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800306#define MAX_USER_COMMAND_SIZE 4096
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530307#define DNS_DOMAIN_NAME_MAX_LEN 255
308#define ICMPv6_ADDR_LEN 16
309
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800310
311#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
312#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
313
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530314/* FW expects burst duration in 1020*ms */
315#define SIFS_BURST_DUR_MULTIPLIER 1020
316#define SIFS_BURST_DUR_MAX 12240
317
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800318/* If IPA UC data path is enabled, target should reserve extra tx descriptors
319 * for IPA data path.
320 * Then host data path should allow less TX packet pumping in case
321 * IPA data path enabled
322 */
323#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
324
Ryan Hsu07495ea2016-01-21 15:25:39 -0800325/*
326 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
327 * here if the Kernel version is less than 3.17 to avoid the interleave
328 * conditional compilation.
329 */
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700330#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\
331 defined(WITH_BACKPORTS))
Ryan Hsu07495ea2016-01-21 15:25:39 -0800332#define NET_NAME_UNKNOWN 0
333#endif
334
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530335#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530336
337/* session ID invalid */
338#define HDD_SESSION_ID_INVALID 0xFF
339
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530340#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
Abhishek Singh00130682017-07-14 10:46:17 +0530341#define SCAN_REJECT_THRESHOLD 15
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530342
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530343/* Default Psoc id */
344#define DEFAULT_PSOC_ID 1
345
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530346/* wait time for nud stats in milliseconds */
347#define WLAN_WAIT_TIME_NUD_STATS 800
348/* nud stats skb max length */
349#define WLAN_NUD_STATS_LEN 800
350/* ARP packet type for NUD debug stats */
351#define WLAN_NUD_STATS_ARP_PKT_TYPE 1
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +0530352/* Assigned size of driver memory dump is 4096 bytes */
353#define DRIVER_MEM_DUMP_SIZE 4096
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530354
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800355/*
356 * Generic asynchronous request/response support
357 *
358 * Many of the APIs supported by HDD require a call to SME to
359 * perform an action or to retrieve some data. In most cases SME
360 * performs the operation asynchronously, and will execute a provided
361 * callback function when the request has completed. In order to
362 * synchronize this the HDD API allocates a context which is then
363 * passed to SME, and which is then, in turn, passed back to the
364 * callback function when the operation completes. The callback
365 * function then sets a completion variable inside the context which
366 * the HDD API is waiting on. In an ideal world the HDD API would
367 * wait forever (or at least for a long time) for the response to be
368 * received and for the completion variable to be set. However in
369 * most cases these HDD APIs are being invoked in the context of a
370 * user space thread which has invoked either a cfg80211 API or a
371 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
372 * Since this lock is used to synchronize many of the kernel tasks, we
373 * do not want to hold it for a long time. In addition we do not want
374 * to block user space threads (such as the wpa supplicant's main
375 * thread) for an extended time. Therefore we only block for a short
376 * time waiting for the response before we timeout. This means that
377 * it is possible for the HDD API to timeout, and for the callback to
378 * be invoked afterwards. In order for the callback function to
379 * determine if the HDD API is still waiting, a magic value is also
380 * stored in the shared context. Only if the context has a valid
381 * magic will the callback routine do any work. In order to further
382 * synchronize these activities a spinlock is used so that if any HDD
383 * API timeout coincides with its callback, the operations of the two
384 * threads will be serialized.
385 */
386
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800387extern spinlock_t hdd_context_lock;
Arunk Khandavalli16d84252017-06-21 15:26:29 +0530388extern struct mutex hdd_init_deinit_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800389
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800390/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800391 * Prevent from permanent stall, resume OS Q if timer expired
392 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800393#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
394#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
395#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
396
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700397#define NUM_TX_RX_HISTOGRAM 128
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800398#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
399
Mohit Khannae71e2262015-11-10 09:37:24 -0800400/**
401 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
402 * received over 100ms intervals
403 * @interval_rx: # of rx packets received in the last 100ms interval
404 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700405 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800406 * determined on the basis of total tx and rx packets
407 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700408 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800409 * determined on the basis of rx packets received in the
410 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700411 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800412 * determined on the basis of tx packets received in the
413 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800414 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800415 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800416 * The structure keeps track of throughput requirements of wlan driver.
417 * An entry is added if either of next_vote_level, next_rx_level or
418 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800419 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800420struct hdd_tx_rx_histogram {
421 uint64_t interval_rx;
422 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423 uint32_t next_vote_level;
424 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800425 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800426 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800427};
428
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700429struct hdd_tx_rx_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800430 /* start_xmit stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700431 __u32 tx_called;
432 __u32 tx_dropped;
433 __u32 tx_orphaned;
434 __u32 tx_classified_ac[NUM_TX_QUEUES];
435 __u32 tx_dropped_ac[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800436
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800437 /* rx stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700438 __u32 rx_packets[NUM_CPUS];
439 __u32 rx_dropped[NUM_CPUS];
440 __u32 rx_delivered[NUM_CPUS];
441 __u32 rx_refused[NUM_CPUS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800442
443 /* txflow stats */
444 bool is_txflow_paused;
445 __u32 txflow_pause_cnt;
446 __u32 txflow_unpause_cnt;
447 __u32 txflow_timer_cnt;
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530448
449 /*tx timeout stats*/
450 __u32 tx_timeout_cnt;
451 __u32 cont_txtimeout_cnt;
452 u64 jiffies_last_txtimeout;
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700453};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800454
455#ifdef WLAN_FEATURE_11W
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700456/**
457 * struct hdd_pmf_stats - Protected Management Frame statistics
Jeff Johnsondc179f42017-10-21 11:27:26 -0700458 * @num_unprot_deauth_rx: Number of unprotected deauth frames received
459 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700460 */
461struct hdd_pmf_stats {
Jeff Johnsondc179f42017-10-21 11:27:26 -0700462 uint8_t num_unprot_deauth_rx;
463 uint8_t num_unprot_disassoc_rx;
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700464};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800465#endif
466
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530467/**
468 * struct hdd_arp_stats_s - arp debug stats count
469 * @tx_arp_req_count: no. of arp req received from network stack
470 * @rx_arp_rsp_count: no. of arp res received from FW
471 * @tx_dropped: no. of arp req dropped at hdd layer
472 * @rx_dropped: no. of arp res dropped
473 * @rx_delivered: no. of arp res delivered to network stack
474 * @rx_refused: no of arp rsp refused (not delivered) to network stack
475 * @tx_host_fw_sent: no of arp req sent by FW OTA
476 * @rx_host_drop_reorder: no of arp res dropped by host
477 * @rx_fw_cnt: no of arp res received by FW
478 * @tx_ack_cnt: no of arp req acked by FW
479 */
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530480struct hdd_arp_stats_s {
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +0530481 uint16_t tx_arp_req_count;
482 uint16_t rx_arp_rsp_count;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530483 uint16_t tx_dropped;
484 uint16_t rx_dropped;
485 uint16_t rx_delivered;
486 uint16_t rx_refused;
487 uint16_t tx_host_fw_sent;
488 uint16_t rx_host_drop_reorder;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530489 uint16_t rx_fw_cnt;
490 uint16_t tx_ack_cnt;
491};
492
Jeff Johnson07f94742017-08-14 15:55:40 -0700493/**
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530494 * struct hdd_dns_stats_s - dns debug stats count
495 * @tx_dns_req_count: no. of dns query received from network stack
496 * @rx_dns_rsp_count: no. of dns res received from FW
497 * @tx_dropped: no. of dns query dropped at hdd layer
498 * @rx_delivered: no. of dns res delivered to network stack
499 * @rx_refused: no of dns res refused (not delivered) to network stack
500 * @tx_host_fw_sent: no of dns query sent by FW OTA
501 * @rx_host_drop: no of dns res dropped by host
502 * @tx_ack_cnt: no of dns req acked by FW
Jeff Johnson07f94742017-08-14 15:55:40 -0700503 */
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530504struct hdd_dns_stats_s {
505 uint16_t tx_dns_req_count;
506 uint16_t rx_dns_rsp_count;
507 uint16_t tx_dropped;
508 uint16_t rx_delivered;
509 uint16_t rx_refused;
510 uint16_t tx_host_fw_sent;
511 uint16_t rx_host_drop;
512 uint16_t tx_ack_cnt;
513};
514
515/**
516 * struct hdd_tcp_stats_s - tcp debug stats count
517 * @tx_tcp_syn_count: no. of tcp syn received from network stack
518 * @@tx_tcp_ack_count: no. of tcp ack received from network stack
519 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW
520 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer
521 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer
522 * @rx_delivered: no. of tcp syn ack delivered to network stack
523 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack
524 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA
525 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA
526 * @rx_host_drop: no of tcp syn ack dropped by host
527 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW
528 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW
529 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not
530 * @is_tcp_ack_sent: flag to check tcp ack sent or not
531 */
532struct hdd_tcp_stats_s {
533 uint16_t tx_tcp_syn_count;
534 uint16_t tx_tcp_ack_count;
535 uint16_t rx_tcp_syn_ack_count;
536 uint16_t tx_tcp_syn_dropped;
537 uint16_t tx_tcp_ack_dropped;
538 uint16_t rx_delivered;
539 uint16_t rx_refused;
540 uint16_t tx_tcp_syn_host_fw_sent;
541 uint16_t tx_tcp_ack_host_fw_sent;
542 uint16_t rx_host_drop;
543 uint16_t rx_fw_cnt;
544 uint16_t tx_tcp_syn_ack_cnt;
545 uint16_t tx_tcp_ack_ack_cnt;
546 bool is_tcp_syn_ack_rcv;
547 bool is_tcp_ack_sent;
548
549};
550
551/**
552 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count
553 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack
554 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW
555 * @tx_dropped: no. of icmpv4 req dropped at hdd layer
556 * @rx_delivered: no. of icmpv4 res delivered to network stack
557 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack
558 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA
559 * @rx_host_drop: no of icmpv4 res dropped by host
560 * @rx_fw_cnt: no of icmpv4 res received by FW
561 * @tx_ack_cnt: no of icmpv4 req acked by FW
562 */
563struct hdd_icmpv4_stats_s {
564 uint16_t tx_icmpv4_req_count;
565 uint16_t rx_icmpv4_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 rx_fw_cnt;
572 uint16_t tx_ack_cnt;
573};
574
Jeff Johnson07f94742017-08-14 15:55:40 -0700575struct hdd_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800576 tCsrSummaryStatsInfo summary_stat;
Jeff Johnson861dd4f2017-10-24 10:10:40 -0700577 tCsrGlobalClassAStatsInfo class_a_stat;
Jeff Johnsonf8cadec2017-10-24 10:21:25 -0700578 tCsrGlobalClassDStatsInfo class_d_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530579 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700580 struct hdd_tx_rx_stats tx_rx_stats;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530581 struct hdd_arp_stats_s hdd_arp_stats;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530582 struct hdd_dns_stats_s hdd_dns_stats;
583 struct hdd_tcp_stats_s hdd_tcp_stats;
584 struct hdd_icmpv4_stats_s hdd_icmpv4_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800585#ifdef WLAN_FEATURE_11W
Jeff Johnsondc179f42017-10-21 11:27:26 -0700586 struct hdd_pmf_stats hdd_pmf_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800587#endif
Jeff Johnson07f94742017-08-14 15:55:40 -0700588};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589
Jeff Johnson41a64962017-08-14 15:29:42 -0700590/**
591 * struct hdd_roaming_info - HDD Internal Roaming Information
Jeff Johnson41a64962017-08-14 15:29:42 -0700592 * @bssid: BSSID to which we are connected
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700593 * @peer_mac: Peer MAC address for IBSS connection
594 * @roam_id: Unique identifier for a roaming instance
595 * @roam_status: Current roam command status
596 * @defer_key_complete: Should key complete be deferred?
Jeff Johnson41a64962017-08-14 15:29:42 -0700597 *
598 */
599struct hdd_roaming_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800600 tSirMacAddr bssid;
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700601 tSirMacAddr peer_mac;
602 uint32_t roam_id;
603 eRoamCmdStatus roam_status;
604 bool defer_key_complete;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800605
Jeff Johnson41a64962017-08-14 15:29:42 -0700606};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800607
608#ifdef FEATURE_WLAN_WAPI
609/* Define WAPI macros for Length, BKID count etc*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800610#define MAC_ADDR_LEN 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800611#define MAX_NUM_AKM_SUITES 16
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800612
613/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700614enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800615 WAPI_AUTH_MODE_OPEN = 0,
616 WAPI_AUTH_MODE_PSK = 1,
617 WAPI_AUTH_MODE_CERT
618} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800619
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800620#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
621#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
622#define WLAN_EID_WAPI 68
623#define WAPI_PSK_AKM_SUITE 0x02721400
624#define WAPI_CERT_AKM_SUITE 0x01721400
625
Jeff Johnson89798aa2017-08-16 11:00:56 -0700626/**
627 * struct hdd_wapi_info - WAPI Information structure definition
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700628 * @wapi_mode: Is WAPI enabled on this adapter?
629 * @is_wapi_sta: Is the STA associated with WAPI?
630 * @wapi_auth_mode: WAPI authentication mode used by this adapter
Jeff Johnson89798aa2017-08-16 11:00:56 -0700631 */
632struct hdd_wapi_info {
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700633 bool wapi_mode;
634 bool is_wapi_sta;
635 enum wapi_auth_mode wapi_auth_mode;
Jeff Johnson89798aa2017-08-16 11:00:56 -0700636};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637#endif /* FEATURE_WLAN_WAPI */
638
Jeff Johnson44e52172017-09-30 16:39:16 -0700639struct hdd_beacon_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640 u8 *head;
641 u8 *tail;
642 u8 *proberesp_ies;
643 u8 *assocresp_ies;
644 int head_len;
645 int tail_len;
646 int proberesp_ies_len;
647 int assocresp_ies_len;
648 int dtim_period;
Jeff Johnson44e52172017-09-30 16:39:16 -0700649};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800650
Jeff Johnsonc945f562017-09-29 16:15:58 -0700651struct action_pkt_buffer {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800652 uint8_t *frame_ptr;
653 uint32_t frame_length;
654 uint16_t freq;
Jeff Johnsonc945f562017-09-29 16:15:58 -0700655};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800657/**
658 * struct hdd_scan_req - Scan Request entry
659 * @node : List entry element
660 * @adapter: Adapter address
661 * @scan_request: scan request holder
662 * @scan_id: scan identifier used across host layers which is generated at WMI
663 * @cookie: scan request identifier sent to userspace
664 * @source: scan request originator (NL/Vendor scan)
665 * @timestamp: scan request timestamp
666 *
667 * Scan request linked list element
668 */
669struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530670 qdf_list_node_t node;
Jeff Johnson9d295242017-08-29 14:39:48 -0700671 struct hdd_adapter *adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800672 struct cfg80211_scan_request *scan_request;
673 uint32_t scan_id;
674 uint8_t source;
675 uint32_t timestamp;
Nachiket Kukadec34d4a32017-07-12 16:20:27 +0530676 qdf_timer_t hdd_scan_inactivity_timer;
677 uint32_t scan_req_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800678};
679
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700680/**
681 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
682 * @channel: Channel number.
683 * @cb_mode: Channel bonding
684 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
685 * @phy_mode: PHY mode
686 */
687struct hdd_mon_set_ch_info {
688 uint8_t channel;
689 uint8_t cb_mode;
690 uint32_t channel_width;
691 eCsrPhyMode phy_mode;
692};
693
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700694/**
695 * struct hdd_station_ctx -- STA-specific information
Jeff Johnson7c0d3b22017-10-25 12:44:14 -0700696 * @wext_state: wireless extensions state
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700697 * @wpa_versions: bitmap of supported WPA versions
Jeff Johnson731bc322017-10-14 19:53:44 -0700698 * @requested_bssid: Specific BSSID to which to connect
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700699 * @conn_info: current connection information
700 * @roam_info: current roaming information
701 * @ft_carrier_on: is carrier on
702 * @ibss_sta_generation: current ibss generation. Incremented whenever
703 * ibss New peer joins and departs the network
704 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key
705 * installed?
706 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if
707 * @ibss_enc_key_installed is %true)
708 * @ibss_peer_info: information about the ibss peer
Jeff Johnson690fe952017-10-25 11:48:39 -0700709 * @hdd_reassoc_scenario: is station in the middle of reassociation?
Jeff Johnson8380f232017-10-25 12:39:44 -0700710 * @sta_debug_state: STA context debug variable
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700711 * @broadcast_staid: STA ID assigned for broadcast frames
712 * @ch_info: monitor mode channel information
713 * @ndp_ctx: NAN data path context
714 * @ap_supports_immediate_power_save: Does the current AP allow our STA
715 * to immediately go into power save?
716 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800717struct hdd_station_ctx {
Jeff Johnson7c0d3b22017-10-25 12:44:14 -0700718 struct hdd_wext_state wext_state;
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700719 enum nl80211_wpa_versions wpa_versions;
Jeff Johnson731bc322017-10-14 19:53:44 -0700720 struct qdf_mac_addr requested_bssid;
Jeff Johnsone4bad252017-08-14 14:09:28 -0700721 struct hdd_connection_info conn_info;
Ashish Kumar Dhanotiya36d19b02018-02-22 00:59:49 +0530722 struct hdd_connection_info cache_conn_info;
Jeff Johnson41a64962017-08-14 15:29:42 -0700723 struct hdd_roaming_info roam_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800724 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725 int ibss_sta_generation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800726 bool ibss_enc_key_installed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700728 tSirPeerInfoRspParams ibss_peer_info;
Jeff Johnson690fe952017-10-25 11:48:39 -0700729 bool hdd_reassoc_scenario;
Jeff Johnson8380f232017-10-25 12:39:44 -0700730 int sta_debug_state;
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700731 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700732 struct hdd_mon_set_ch_info ch_info;
Krunal Soni364e0872017-05-10 21:24:34 -0700733 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800734};
735
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700736/**
737 * enum bss_state - current state of the BSS
738 * @BSS_STOP: BSS is stopped
739 * @BSS_START: BSS is started
740 */
741enum bss_state {
742 BSS_STOP,
743 BSS_START,
744};
745
746/**
747 * struct hdd_hostapd_state - hostapd-related state information
748 * @bss_state: Current state of the BSS
749 * @qdf_event: Event to synchronize actions between hostapd thread and
750 * internal callback threads
751 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS
752 * is issued userspace thread can wait on this event. The event will
753 * be set when the Stop BSS processing in UMAC has completed.
Jeff Johnsonb9424862017-10-30 08:49:35 -0700754 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation.
755 * When a STA is disassociated userspace thread can wait on this
756 * event. The event will be set when the STA Disassociation
757 * processing in UMAC has completed.
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700758 * @qdf_status: Used to communicate state from other threads to the
759 * userspace thread.
760 */
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700761struct hdd_hostapd_state {
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700762 enum bss_state bss_state;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530763 qdf_event_t qdf_event;
764 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800765 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530766 QDF_STATUS qdf_status;
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700767};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800768
wadesong9b819072017-02-07 16:42:09 +0800769/**
770 * enum bss_stop_reason - reasons why a BSS is stopped.
771 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
772 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
773 * driver is trying to switch AP role to a different channel
774 * to maintain SCC mode with the STA role on the same card.
775 * this usually happens when STA is connected to an external
776 * AP that runs on a different channel
hqu73bccf22017-10-28 15:34:17 +0800777 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to
778 * vendor subcmd set sap config channel
wadesong9b819072017-02-07 16:42:09 +0800779 */
780enum bss_stop_reason {
781 BSS_STOP_REASON_INVALID = 0,
782 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
hqu73bccf22017-10-28 15:34:17 +0800783 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2,
wadesong9b819072017-02-07 16:42:09 +0800784};
785
Will Huang496b36c2017-07-11 16:38:50 +0800786/**
787 * struct hdd_rate_info - rate_info in HDD
788 * @rate: tx/rx rate (kbps)
789 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode)
790 * @nss: number of streams
791 * @mcs: mcs index for HT/VHT mode
792 * @rate_flags: rate flags for last tx/rx
793 *
794 * rate info in HDD
795 */
796struct hdd_rate_info {
797 uint32_t rate;
798 uint8_t mode;
799 uint8_t nss;
800 uint8_t mcs;
801 uint8_t rate_flags;
802};
803
804/**
805 * struct hdd_fw_txrx_stats - fw txrx status in HDD
806 * (refer to station_info struct in Kernel)
807 * @tx_packets: packets transmitted to this station
808 * @tx_bytes: bytes transmitted to this station
809 * @rx_packets: packets received from this station
810 * @rx_bytes: bytes received from this station
811 * @rx_retries: cumulative retry counts
812 * @tx_failed: number of failed transmissions
813 * @rssi: The signal strength (dbm)
814 * @tx_rate: last used tx rate info
815 * @rx_rate: last used rx rate info
816 *
817 * fw txrx status in HDD
818 */
819struct hdd_fw_txrx_stats {
820 uint32_t tx_packets;
821 uint64_t tx_bytes;
822 uint32_t rx_packets;
823 uint64_t rx_bytes;
824 uint32_t tx_retries;
825 uint32_t tx_failed;
826 int8_t rssi;
827 struct hdd_rate_info tx_rate;
828 struct hdd_rate_info rx_rate;
829};
830
831/**
Jeff Johnson82155922017-09-30 16:54:14 -0700832 * struct hdd_station_info - Per station structure kept in HDD for
Will Huang496b36c2017-07-11 16:38:50 +0800833 * multiple station support for SoftAP
Jeff Johnsonb105d052017-10-21 12:07:29 -0700834 * @in_use: Is the station entry in use?
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700835 * @sta_id: Station ID reported back from HAL (through SAP).
Will Huang496b36c2017-07-11 16:38:50 +0800836 * Broadcast uses station ID zero by default.
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700837 * @sta_type: Type of station i.e. p2p client or infrastructure station
Jeff Johnsonf2356512017-10-21 16:04:12 -0700838 * @sta_mac: MAC address of the station
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700839 * @peer_state: Current Station state so HDD knows how to deal with packet
Will Huang496b36c2017-07-11 16:38:50 +0800840 * queue. Most recent states used to change TLSHIM STA state.
Jeff Johnson65fda112017-10-21 13:46:10 -0700841 * @is_qos_enabled: Track QoS status of station
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700842 * @is_deauth_in_progress: The station entry for which Deauth is in progress
Will Huang496b36c2017-07-11 16:38:50 +0800843 * @nss: Number of spatial streams supported
844 * @rate_flags: Rate Flags for this connection
845 * @ecsa_capable: Extended CSA capabilities
846 * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc.
847 * @tx_packets: Packets send to current station
848 * @tx_bytes: Bytes send to current station
849 * @rx_packets: Packets received from current station
850 * @rx_bytes: Bytes received from current station
851 * @last_tx_rx_ts: Last tx/rx timestamp with current station
852 * @assoc_ts: Current station association timestamp
853 * @tx_rate: Tx rate with current station reported from F/W
854 * @rx_rate: Rx rate with current station reported from F/W
855 * @ampdu: Ampdu enable or not of the station
856 * @sgi_enable: Short GI enable or not of the station
857 * @tx_stbc: Tx Space-time block coding enable/disable
858 * @rx_stbc: Rx Space-time block coding enable/disable
859 * @ch_width: Channel Width of the connection
860 * @mode: Mode of the connection
861 * @max_supp_idx: Max supported rate index of the station
862 * @max_ext_idx: Max extended supported rate index of the station
863 * @max_mcs_idx: Max supported mcs index of the station
864 * @rx_mcs_map: VHT Rx mcs map
865 * @tx_mcs_map: VHT Tx mcs map
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530866 * @freq : Frequency of the current station
867 * @dot11_mode: 802.11 Mode of the connection
868 * @ht_present: HT caps present or not in the current station
869 * @vht_present: VHT caps present or not in the current station
870 * @ht_caps: HT capabilities of current station
871 * @vht_caps: VHT capabilities of current station
872 * @reason_code: Disconnection reason code for current station
873 * @rssi: RSSI of the current station reported from F/W
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800874 */
Jeff Johnson82155922017-09-30 16:54:14 -0700875struct hdd_station_info {
Jeff Johnsonb105d052017-10-21 12:07:29 -0700876 bool in_use;
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700877 uint8_t sta_id;
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700878 eStationType sta_type;
Jeff Johnsonf2356512017-10-21 16:04:12 -0700879 struct qdf_mac_addr sta_mac;
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700880 enum ol_txrx_peer_state peer_state;
Jeff Johnson65fda112017-10-21 13:46:10 -0700881 bool is_qos_enabled;
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700882 bool is_deauth_in_progress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530883 uint8_t nss;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530884 uint32_t rate_flags;
gaolez7bb1e742017-03-21 16:37:38 +0800885 uint8_t ecsa_capable;
Will Huang496b36c2017-07-11 16:38:50 +0800886 uint32_t max_phy_rate;
887 uint32_t tx_packets;
888 uint64_t tx_bytes;
889 uint32_t rx_packets;
890 uint64_t rx_bytes;
891 qdf_time_t last_tx_rx_ts;
892 qdf_time_t assoc_ts;
893 uint32_t tx_rate;
894 uint32_t rx_rate;
895 bool ampdu;
896 bool sgi_enable;
897 bool tx_stbc;
898 bool rx_stbc;
Hanumanth Reddy Pothulaf79fbdf2017-10-23 20:10:46 +0530899 tSirMacHTChannelWidth ch_width;
Will Huang496b36c2017-07-11 16:38:50 +0800900 uint8_t mode;
901 uint8_t max_supp_idx;
902 uint8_t max_ext_idx;
903 uint8_t max_mcs_idx;
904 uint8_t rx_mcs_map;
905 uint8_t tx_mcs_map;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +0530906 uint32_t freq;
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530907 uint8_t dot11_mode;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +0530908 bool ht_present;
909 bool vht_present;
910 struct ieee80211_ht_cap ht_caps;
911 struct ieee80211_vht_cap vht_caps;
912 uint32_t reason_code;
913 int8_t rssi;
Jeff Johnson82155922017-09-30 16:54:14 -0700914};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800915
Jeff Johnsonf283c972017-10-26 12:30:49 -0700916/**
917 * struct hdd_ap_ctx - SAP/P2PGO specific information
918 * @hostapd_state: state control information
Jeff Johnson01206862017-10-27 20:55:59 -0700919 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC?
Jeff Johnson136c51b2017-10-27 20:02:41 -0700920 * @ap_active: Are any stations active?
921 * @hdd_ap_inactivity_timer: Timer used to shutdown the AP if it is
922 * inactive for an extended amount of time.
Jeff Johnson82ceb082017-10-27 14:52:42 -0700923 * @disable_intrabss_fwd: Prevent forwarding between stations
Jeff Johnson42518cf2017-10-26 13:33:29 -0700924 * @broadcast_sta_id: Station ID assigned after BSS starts
Jeff Johnsonc8d94a12017-10-27 14:02:53 -0700925 * @privacy: The privacy bits of configuration
Jeff Johnsona8e686b2017-10-27 15:05:18 -0700926 * @encryption_type: The encryption being used
Jeff Johnson413c15f2017-10-27 18:56:35 -0700927 * @group_key: Group Encryption Key
Jeff Johnson3d731362017-10-27 19:06:41 -0700928 * @wep_key: WEP key array
929 * @wep_def_key_idx: WEP default key index
Jeff Johnson0bbe66f2017-10-27 19:23:49 -0700930 * @sap_context: Pointer to context maintained by SAP (opaque to HDD)
Jeff Johnson91df29d2017-10-27 19:29:50 -0700931 * @sap_config: SAP configuration
Jeff Johnson01206862017-10-27 20:55:59 -0700932 * @operating_channel: channel upon which the SAP is operating
933 * @beacon: Beacon information
934 * @vendor_acs_timer: Timer for ACS
935 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
936 * @bss_stop_reason: Reason why the BSS was stopped
937 * @txrx_stats: TX RX statistics from firmware
Jeff Johnsonf283c972017-10-26 12:30:49 -0700938 */
Jeff Johnsone962b192017-08-11 15:37:08 -0700939struct hdd_ap_ctx {
Jeff Johnsonf283c972017-10-26 12:30:49 -0700940 struct hdd_hostapd_state hostapd_state;
Jeff Johnson01206862017-10-27 20:55:59 -0700941 bool dfs_cac_block_tx;
Jeff Johnson136c51b2017-10-27 20:02:41 -0700942 bool ap_active;
943 qdf_mc_timer_t hdd_ap_inactivity_timer;
Jeff Johnson82ceb082017-10-27 14:52:42 -0700944 bool disable_intrabss_fwd;
Jeff Johnson42518cf2017-10-26 13:33:29 -0700945 uint8_t broadcast_sta_id;
Jeff Johnsonc8d94a12017-10-27 14:02:53 -0700946 uint8_t privacy;
Jeff Johnsona8e686b2017-10-27 15:05:18 -0700947 eCsrEncryptionType encryption_type;
Jeff Johnson413c15f2017-10-27 18:56:35 -0700948 tCsrRoamSetKey group_key;
Jeff Johnson3d731362017-10-27 19:06:41 -0700949 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY];
950 uint8_t wep_def_key_idx;
Jeff Johnson0bbe66f2017-10-27 19:23:49 -0700951 struct sap_context *sap_context;
Jeff Johnson91df29d2017-10-27 19:29:50 -0700952 tsap_Config_t sap_config;
Jeff Johnson01206862017-10-27 20:55:59 -0700953 uint8_t operating_channel;
954 struct hdd_beacon_data *beacon;
955 qdf_mc_timer_t vendor_acs_timer;
956 bool vendor_acs_timer_initialized;
957 enum bss_stop_reason bss_stop_reason;
958 struct hdd_fw_txrx_stats txrx_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800959};
960
Jeff Johnson37588942017-08-15 16:11:41 -0700961/**
962 * struct hdd_scan_info - Per-adapter scan information
Jeff Johnson37fa0402017-10-28 12:42:29 -0700963 * @scan_add_ie: Additional IE for scan
Jeff Johnson37588942017-08-15 16:11:41 -0700964 * @default_scan_ies: Default scan IEs
965 * @default_scan_ies_len: Length of @default_scan_ies
966 * @scan_mode: Scan mode
Jeff Johnson37588942017-08-15 16:11:41 -0700967 */
968struct hdd_scan_info {
Jeff Johnson37fa0402017-10-28 12:42:29 -0700969 tSirAddie scan_add_ie;
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530970 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +0530971 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800972 tSirScanType scan_mode;
Jeff Johnson37588942017-08-15 16:11:41 -0700973};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800974
Dustin Brown61269462016-09-19 13:25:45 -0700975#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800976
977#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -0700978struct hdd_multicast_addr_list {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800979 uint8_t mc_cnt;
980 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
Jeff Johnson673fd5b2017-09-30 16:44:56 -0700981};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800982#endif
983
984#define WLAN_HDD_MAX_HISTORY_ENTRY 10
985
986/**
987 * struct hdd_netif_queue_stats - netif queue operation statistics
988 * @pause_count - pause counter
989 * @unpause_count - unpause counter
990 */
991struct hdd_netif_queue_stats {
Mohit Khannaca4173b2017-09-12 21:52:19 -0700992 u32 pause_count;
993 u32 unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530994 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800995};
996
997/**
998 * struct hdd_netif_queue_history - netif queue operation history
999 * @time: timestamp
1000 * @netif_action: action type
1001 * @netif_reason: reason type
1002 * @pause_map: pause map
1003 */
1004struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +05301005 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001006 uint16_t netif_action;
1007 uint16_t netif_reason;
1008 uint32_t pause_map;
1009};
1010
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301011/**
1012 * struct hdd_chan_change_params - channel related information
1013 * @chan: operating channel
1014 * @chan_params: channel parameters
1015 */
1016struct hdd_chan_change_params {
1017 uint8_t chan;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001018 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301019};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001020
Komal Seelama89be8d2016-09-29 11:09:26 +05301021/**
Komal Seelam8634b772016-09-29 12:12:24 +05301022 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
Jeff Johnsonb9424862017-10-30 08:49:35 -07001023 * @dfs: dfs context to prevent/allow runtime pm
Jingxiang Geb49aa302018-01-17 20:54:15 +08001024 * @connect: connect context to prevent/allow runtime pm
Komal Seelam8634b772016-09-29 12:12:24 +05301025 *
Jeff Johnsonb9424862017-10-30 08:49:35 -07001026 * Runtime PM control for underlying activities
Komal Seelam8634b772016-09-29 12:12:24 +05301027 */
1028struct hdd_runtime_pm_context {
Komal Seelam81cb1662016-09-29 12:39:08 +05301029 qdf_runtime_lock_t dfs;
Jingxiang Geb49aa302018-01-17 20:54:15 +08001030 qdf_runtime_lock_t connect;
Komal Seelam8634b772016-09-29 12:12:24 +05301031};
1032
1033/**
Komal Seelama89be8d2016-09-29 11:09:26 +05301034 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
1035 * @connect: Runtime Connect Context
1036 *
1037 * Structure to hold runtime pm connect context for each adapter.
1038 */
1039struct hdd_connect_pm_context {
1040 qdf_runtime_lock_t connect;
1041};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001042
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301043/*
1044 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
1045 * belonging to this driver from net devices belonging to other devices.
1046 * Therefore, the magic number must be unique relative to the numbers for
1047 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
1048 * (e.g. by compiler argument), then use that. If it's not already defined,
1049 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
1050 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
1051 */
1052#ifndef WLAN_HDD_ADAPTER_MAGIC
1053#ifdef MULTI_IF_NAME
1054#define WLAN_HDD_ADAPTER_MAGIC \
1055 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
1056 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
1057 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
1058 (MULTI_IF_NAME[1] << 16) : \
1059 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
1060 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
1061#else
Komal Seelama89be8d2016-09-29 11:09:26 +05301062#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301063#endif
1064#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301066/**
1067 * struct rcpi_info - rcpi info
1068 * @rcpi: computed value in dB
1069 * @mac_addr: peer mac addr for which rcpi is computed
1070 */
1071struct rcpi_info {
1072 int32_t rcpi;
1073 struct qdf_mac_addr mac_addr;
1074};
1075
Jeff Johnsondba0db62017-08-30 11:12:39 -07001076struct hdd_context;
1077
Jeff Johnson85b5c112017-08-11 15:15:23 -07001078struct hdd_adapter {
Jeff Johnsond399e902015-12-17 15:17:02 -08001079 /* Magic cookie for adapter sanity verification. Note that this
1080 * needs to be at the beginning of the private data structure so
Jeff Johnsonb9424862017-10-30 08:49:35 -07001081 * that it will exist at the beginning of dev->priv and hence
Jeff Johnsond399e902015-12-17 15:17:02 -08001082 * will always be in mapped memory
1083 */
1084 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001085
Dustin Brown920397d2017-12-13 16:27:50 -08001086 /* list node for membership in the adapter list */
1087 qdf_list_node_t node;
1088
Jeff Johnsondba0db62017-08-30 11:12:39 -07001089 struct hdd_context *hdd_ctx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301090 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001091
Leo Changfdb45c32016-10-28 11:09:23 -07001092 void *txrx_vdev;
1093
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 /** Handle to the network device */
1095 struct net_device *dev;
1096
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001097 enum QDF_OPMODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -08001098
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001099 /** IPv4 notifier callback for handling ARP offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001100 struct work_struct ipv4_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001101#ifdef WLAN_NS_OFFLOAD
1102 /** IPv6 notifier callback for handling NS offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001103 struct work_struct ipv6_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001104#endif
1105
1106 /* TODO Move this to sta Ctx */
1107 struct wireless_dev wdev;
1108 struct cfg80211_scan_request *request;
bings86657fe2017-10-31 08:54:12 +08001109 struct cfg80211_scan_request *vendor_request;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001110
1111 /** ops checks if Opportunistic Power Save is Enable or Not
1112 * ctw stores ctWindow value once we receive Opps command from
1113 * wpa_supplicant then using ctWindow value we need to Enable
1114 * Opportunistic Power Save
1115 */
1116 uint8_t ops;
1117 uint32_t ctw;
1118
1119 /** Current MAC Address for the adapter */
Jeff Johnson1e851a12017-10-28 14:36:12 -07001120 struct qdf_mac_addr mac_addr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001121
1122 /**Event Flags*/
1123 unsigned long event_flags;
1124
1125 /**Device TX/RX statistics*/
1126 struct net_device_stats stats;
1127 /** HDD statistics*/
Jeff Johnson07f94742017-08-14 15:55:40 -07001128 struct hdd_stats hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -08001129
1130 /* estimated link speed */
1131 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001132
Jeff Johnson1b780e42017-10-31 14:11:45 -07001133 uint8_t session_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001134
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301135 /* QDF event for session close */
1136 qdf_event_t qdf_session_close_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001137
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301138 /* QDF event for session open */
1139 qdf_event_t qdf_session_open_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001140
1141 /* TODO: move these to sta ctx. These may not be used in AP */
1142 /** completion variable for disconnect callback */
1143 struct completion disconnect_comp_var;
1144
Abhishek Singh533c9da2017-05-04 10:23:34 +05301145 struct completion roaming_comp_var;
1146
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001147 /** Completion of change country code */
1148 struct completion change_country_code;
1149
1150 /* completion variable for Linkup Event */
1151 struct completion linkup_event_var;
1152
1153 /* completion variable for cancel remain on channel Event */
1154 struct completion cancel_rem_on_chan_var;
1155
1156 /* completion variable for off channel remain on channel Event */
1157 struct completion offchannel_tx_event;
1158 /* Completion variable for action frame */
1159 struct completion tx_action_cnf_event;
1160 /* Completion variable for remain on channel ready */
1161 struct completion rem_on_chan_ready_event;
1162
1163 struct completion sta_authorized_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001164
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001165 struct completion ibss_peer_info_comp;
1166
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167 /* Track whether the linkup handling is needed */
Jeff Johnsonc72c5732017-10-28 12:49:37 -07001168 bool is_link_up_service_needed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001169
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001170 /* WMM Status */
Jeff Johnson02d14ce2017-10-31 09:08:30 -07001171 struct hdd_wmm_status hdd_wmm_status;
Jeff Johnson18e86622017-10-28 12:55:36 -07001172
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001173 /** Multiple station supports */
1174 /** Per-station structure */
Jeff Johnsonbb8b56a2017-10-23 07:02:36 -07001175 spinlock_t sta_info_lock; /* To protect access to station Info */
1176 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT];
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301177 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001178
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001179
1180#ifdef FEATURE_WLAN_WAPI
Jeff Johnson89798aa2017-08-16 11:00:56 -07001181 struct hdd_wapi_info wapi_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001182#endif
1183
1184 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301185 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001186#ifdef WLAN_FEATURE_LPSS
1187 bool rssi_send;
1188#endif
1189
1190 uint8_t snr;
1191
Krunal Soni22208392017-09-29 18:10:34 -07001192 struct work_struct sap_stop_bss_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001193
1194 union {
Jeff Johnson40dae4e2017-08-29 14:00:25 -07001195 struct hdd_station_ctx station;
Jeff Johnson87251032017-08-29 13:31:11 -07001196 struct hdd_ap_ctx ap;
Jeff Johnsonb9424862017-10-30 08:49:35 -07001197 } session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001198
Min Liu2fef5792018-01-19 17:59:42 +08001199 qdf_atomic_t dfs_radar_found;
1200
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001201#ifdef WLAN_FEATURE_TSF
1202 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001203 uint64_t cur_target_time;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001204 uint64_t tsf_sync_soc_timer;
Yu Wang000dc2f2017-05-26 17:38:48 +08001205#ifdef WLAN_FEATURE_TSF_PLUS
1206 /* spin lock for read/write timestamps */
1207 qdf_spinlock_t host_target_sync_lock;
1208 qdf_mc_timer_t host_target_sync_timer;
1209 uint64_t cur_host_time;
1210 uint64_t last_host_time;
1211 uint64_t last_target_time;
1212 /* to store the count of continuous invalid tstamp-pair */
1213 int continuous_error_count;
1214 /* to indicate whether tsf_sync has been initialized */
1215 qdf_atomic_t tsf_sync_ready_flag;
1216#endif /* WLAN_FEATURE_TSF_PLUS */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001217#endif
1218
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001219#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001220 struct hdd_multicast_addr_list mc_addr_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001221#endif
1222 uint8_t addr_filter_pattern;
1223
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001224 bool survey_idx;
1225
Jeff Johnson37588942017-08-15 16:11:41 -07001226 struct hdd_scan_info scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001227
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001228 /* Flag to ensure PSB is configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001229 uint8_t psb_changed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001230 /* UAPSD psb value configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001231 uint8_t configured_psb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001232#ifdef IPA_OFFLOAD
1233 void *ipa_context;
1234#endif
1235 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1236 * since CSR (PMAC Struct) Config is same for both AP
1237 */
1238 struct delayed_work acs_pending_work;
1239
1240 struct work_struct scan_block_work;
1241#ifdef MSM_PLATFORM
1242 unsigned long prev_rx_packets;
1243 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301244 uint64_t prev_fwd_tx_packets;
1245 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001246 int connection;
1247#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001248#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301249 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001250 bool tx_flow_timer_initialized;
1251 unsigned int tx_flow_low_watermark;
1252 unsigned int tx_flow_high_watermark_offset;
1253#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1254 bool offloads_configured;
1255
1256 /* DSCP to UP QoS Mapping */
Jeff Johnson6b51b6a2017-11-02 20:31:25 -07001257 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001258
1259#ifdef WLAN_FEATURE_LINK_LAYER_STATS
Jeff Johnsond30ee4b2017-10-28 15:38:32 -07001260 bool is_link_layer_stats_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001261#endif
Jeff Johnsonbd4c4f02017-10-30 20:33:01 -07001262 uint8_t link_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001263
1264 /* variable for temperature in Celsius */
1265 int temperature;
1266
Agrawal Ashishb141b092016-09-02 19:59:26 +05301267#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001268 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301269 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001270 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301271#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001272
1273 /* BITMAP indicating pause reason */
1274 uint32_t pause_map;
1275 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301276 qdf_time_t start_time;
1277 qdf_time_t last_time;
1278 qdf_time_t total_pause_time;
1279 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001280 uint8_t history_index;
1281 struct hdd_netif_queue_history
1282 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1283 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001284 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001285 /* debugfs entry */
1286 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301287 /*
1288 * The pre cac channel is saved here and will be used when the SAP's
1289 * channel needs to be moved from the existing 2.4GHz channel.
1290 */
1291 uint8_t pre_cac_chan;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001292
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001293 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301294 * Indicate if HO fails during disconnect so that
1295 * disconnect is not initiated by HDD as its already
1296 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001297 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301298 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301299 struct lfr_firmware_status lfr_fw_status;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301300 bool con_status;
1301 bool dad;
Ganesh Kondabattini1a2aed82017-09-28 12:21:58 +05301302 uint8_t active_ac;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +05301303 uint32_t pkt_type_bitmap;
1304 uint32_t track_arp_ip;
1305 uint8_t dns_payload[256];
1306 uint32_t track_dns_domain_len;
1307 uint32_t track_src_port;
1308 uint32_t track_dest_port;
1309 uint32_t track_dest_ipv4;
Arunk Khandavalli062fb032017-10-04 12:18:15 +05301310 uint32_t mon_chan;
1311 uint32_t mon_bandwidth;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301312
1313 /* rcpi information */
1314 struct rcpi_info rcpi;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001315};
1316
Jeff Johnsonb9424862017-10-30 08:49:35 -07001317#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
1318#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001319#define WLAN_HDD_GET_WEXT_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001320 (&(adapter)->session.station.wext_state)
Jeff Johnsondba0db62017-08-30 11:12:39 -07001321#define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
1322#define WLAN_HDD_GET_HAL_CTX(adapter) ((adapter)->hdd_ctx->hHal)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001323#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001324 (&(adapter)->session.ap.hostapd_state)
1325#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001327#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001328#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001329#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001330/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1331 * intentionally so that all references to these must be within NDP code.
1332 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1333 * invoke NDP code to do all work.
1334 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001335#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001336#endif
1337
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001338/* Set mac address locally administered bit */
1339#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1340
1341#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1342#define HDD_RESET_MCC_P2P_QUOTA 50
1343
Jeff Johnson353cd292017-08-17 06:47:26 -07001344/*
1345 * struct hdd_priv_data - driver ioctl private data payload
1346 * @buf: pointer to command buffer (may be in userspace)
1347 * @used_len: length of the command/data currently in @buf
1348 * @total_len: total length of the @buf memory allocation
1349 */
1350struct hdd_priv_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001351 uint8_t *buf;
1352 int used_len;
1353 int total_len;
Jeff Johnson353cd292017-08-17 06:47:26 -07001354};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001355
1356#define MAX_MOD_LOGLEVEL 10
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001357struct fw_log_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001358 uint8_t enable;
1359 uint8_t dl_type;
1360 uint8_t dl_report;
1361 uint8_t dl_loglevel;
1362 uint8_t index;
1363 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1364
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001365};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001366
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001367/**
1368 * enum antenna_mode - number of TX/RX chains
1369 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1370 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1371 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1372 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1373 */
1374enum antenna_mode {
1375 HDD_ANTENNA_MODE_INVALID,
1376 HDD_ANTENNA_MODE_1X1,
1377 HDD_ANTENNA_MODE_2X2,
1378 HDD_ANTENNA_MODE_MAX
1379};
1380
1381/**
1382 * enum smps_mode - SM power save mode
1383 * @HDD_SMPS_MODE_STATIC: Static power save
1384 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1385 * @HDD_SMPS_MODE_RESERVED: Reserved
1386 * @HDD_SMPS_MODE_DISABLED: Disable power save
1387 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1388 */
1389enum smps_mode {
1390 HDD_SMPS_MODE_STATIC,
1391 HDD_SMPS_MODE_DYNAMIC,
1392 HDD_SMPS_MODE_RESERVED,
1393 HDD_SMPS_MODE_DISABLED,
1394 HDD_SMPS_MODE_MAX
1395};
1396
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001397#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1398/**
1399 * struct hdd_offloaded_packets - request id to pattern id mapping
1400 * @request_id: request id
1401 * @pattern_id: pattern id
1402 *
1403 */
1404struct hdd_offloaded_packets {
1405 uint32_t request_id;
1406 uint8_t pattern_id;
1407};
1408
1409/**
1410 * struct hdd_offloaded_packets_ctx - offloaded packets context
1411 * @op_table: request id to pattern id table
1412 * @op_lock: mutex lock
1413 */
1414struct hdd_offloaded_packets_ctx {
1415 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1416 struct mutex op_lock;
1417};
1418#endif
1419
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301420/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301421 * enum driver_status: Driver Modules status
1422 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1423 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1424 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1425 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1426 */
1427enum driver_modules_status {
1428 DRIVER_MODULES_UNINITIALIZED,
1429 DRIVER_MODULES_OPENED,
1430 DRIVER_MODULES_ENABLED,
1431 DRIVER_MODULES_CLOSED
1432};
1433
Agrawal Ashish65634612016-08-18 13:24:32 +05301434/**
1435 * struct acs_dfs_policy - Define ACS policies
1436 * @acs_dfs_mode: Dfs mode enabled/disabled.
1437 * @acs_channel: pre defined channel to avoid ACS.
1438 */
1439struct acs_dfs_policy {
1440 enum dfs_mode acs_dfs_mode;
1441 uint8_t acs_channel;
1442};
1443
Dustin Brown105d7902016-10-03 16:27:59 -07001444/**
1445 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1446 * SUSPEND_FAIL_IPA: IPA in progress
1447 * SUSPEND_FAIL_RADAR: radar scan in progress
1448 * SUSPEND_FAIL_ROAM: roaming in progress
1449 * SUSPEND_FAIL_SCAN: scan in progress
1450 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1451 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1452 */
1453enum suspend_fail_reason {
1454 SUSPEND_FAIL_IPA,
1455 SUSPEND_FAIL_RADAR,
1456 SUSPEND_FAIL_ROAM,
1457 SUSPEND_FAIL_SCAN,
1458 SUSPEND_FAIL_INITIAL_WAKEUP,
1459 SUSPEND_FAIL_MAX_COUNT
1460};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001461
Dustin Brownd9322482017-01-09 12:46:03 -08001462/**
1463 * suspend_resume_stats - Collection of counters for suspend/resume events
1464 * @suspends: number of suspends completed
1465 * @resumes: number of resumes completed
1466 * @suspend_fail: counters for failed suspend reasons
1467 */
1468struct suspend_resume_stats {
1469 uint32_t suspends;
1470 uint32_t resumes;
1471 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1472};
1473
Ashish Kumar Dhanotiyab28338c2017-07-21 20:12:34 +05301474/**
1475 * hdd_sta_smps_param - SMPS parameters to configure from hdd
1476 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS
1477 * mode from inactive mode
1478 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter
1479 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from
1480 * Stalled-D-SMPS mode
1481 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes
1482 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI.
1483 * Used to reduce RX chainmask.
1484 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI.
1485 * Used to increase RX chainmask.
1486 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature
1487 */
1488enum hdd_sta_smps_param {
1489 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0,
1490 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1,
1491 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2,
1492 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3,
1493 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4,
1494 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
1495};
1496
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301497/**
1498 * struct hdd_nud_stats_context - hdd NUD stats context
1499 * @response_event: NUD stats request wait event
1500 */
1501struct hdd_nud_stats_context {
1502 struct completion response_event;
1503};
1504
Ganesh Kondabattini35739572017-06-21 16:26:39 +05301505/**
1506 * tos - Type of service requested by the application
1507 * TOS_BK: Back ground traffic
1508 * TOS_BE: Best effort traffic
1509 * TOS_VI: Video traffic
1510 * TOS_VO: Voice traffic
1511 */
1512enum tos {
1513 TOS_BK = 0,
1514 TOS_BE = 1,
1515 TOS_VI = 2,
1516 TOS_VO = 3,
1517};
1518
1519#define HDD_AC_BK_BIT 1
1520#define HDD_AC_BE_BIT 2
1521#define HDD_AC_VI_BIT 4
1522#define HDD_AC_VO_BIT 8
1523
1524#define HDD_MAX_OFF_CHAN_TIME_FOR_VO 20
1525#define HDD_MAX_OFF_CHAN_TIME_FOR_VI 20
1526#define HDD_MAX_OFF_CHAN_TIME_FOR_BE 40
1527#define HDD_MAX_OFF_CHAN_TIME_FOR_BK 40
1528
1529#define HDD_MAX_AC 4
1530#define HDD_MAX_OFF_CHAN_ENTRIES 2
1531
1532#define HDD_AC_BIT_INDX 0
1533#define HDD_DWELL_TIME_INDX 1
1534
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001535/* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1536 * 1 for WDS_STAID
1537 */
1538#define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2)
1539
Dustin Brown105d7902016-10-03 16:27:59 -07001540/** Adapter structure definition */
Jeff Johnson82797b62017-08-11 15:31:27 -07001541struct hdd_context {
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301542 struct wlan_objmgr_psoc *hdd_psoc;
1543 struct wlan_objmgr_pdev *hdd_pdev;
1544
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001545 /** HAL handle...*/
1546 tHalHandle hHal;
1547
1548 struct wiphy *wiphy;
1549 /* TODO Remove this from here. */
1550
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301551 qdf_spinlock_t hdd_adapter_lock;
Jeff Johnson19fc8e42017-10-30 19:53:49 -07001552 qdf_list_t hdd_adapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001553
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001554 struct hdd_adapter *sta_to_adapter[HDD_MAX_ADAPTERS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001555
1556 /** Pointer for firmware image data */
1557 const struct firmware *fw;
1558
1559 /** Pointer for configuration data */
1560 const struct firmware *cfg;
1561
1562 /** Pointer to the parent device */
1563 struct device *parent_dev;
1564
1565 /** Config values read from qcom_cfg.ini file */
1566 struct hdd_config *config;
1567
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001568 /* Completion variable to indicate Mc Thread Suspended */
1569 struct completion mc_sus_event_var;
1570
Rajeev Kumareada0d02016-12-08 17:44:17 -08001571 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001572
1573#ifdef QCA_CONFIG_SMP
1574 bool is_ol_rx_thread_suspended;
1575#endif
1576
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001577 bool hdd_wlan_suspended;
1578 bool suspended;
Poddar, Siddarth61fbc932017-12-19 14:27:55 +05301579 /* flag to start pktlog after SSR/PDR if previously enabled */
1580 bool is_pktlog_enabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001581
1582 /* Lock to avoid race condition during start/stop bss */
1583 struct mutex sap_lock;
1584
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001585#ifdef FEATURE_OEM_DATA_SUPPORT
1586 /* OEM App registered or not */
1587 bool oem_app_registered;
1588
1589 /* OEM App Process ID */
1590 int32_t oem_pid;
1591#endif
1592
1593 /** Concurrency Parameters*/
1594 uint32_t concurrency_mode;
1595
Anurag Chouhan6d760662016-02-20 16:05:43 +05301596 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1597 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001598
1599 /** P2P Device MAC Address for the adapter */
Jeff Johnsonacbdb1c2017-11-02 20:42:02 -07001600 struct qdf_mac_addr p2p_device_address;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001601
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301602 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301603 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001604
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001606
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001607 /* Flag keeps track of wiphy suspend/resume */
Jeff Johnson214671b2017-10-30 19:45:23 -07001608 bool is_wiphy_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001609
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610#ifdef MSM_PLATFORM
1611 /* DDR bus bandwidth compute timer
1612 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301613 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001614 bool bus_bw_timer_running;
1615 qdf_spinlock_t bus_bw_timer_lock;
1616 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001617 int cur_vote_level;
1618 spinlock_t bus_bw_lock;
1619 int cur_rx_level;
1620 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001621 int cur_tx_level;
1622 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001623#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001624
1625 struct completion ready_to_suspend;
1626 /* defining the solution type */
1627 uint32_t target_type;
1628
Sourav Mohapatra421d42b2017-12-29 16:33:23 +05301629 qdf_atomic_t con_mode_flag;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001630 /* defining the firmware version */
1631 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001632 uint32_t target_fw_vers_ext;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001633
1634 /* defining the chip/rom version */
1635 uint32_t target_hw_version;
1636 /* defining the chip/rom revision */
1637 uint32_t target_hw_revision;
1638 /* chip/rom name */
Dustin Brown6f17a022017-07-19 13:40:55 -07001639 char *target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001640 struct regulatory reg;
1641#ifdef FEATURE_WLAN_CH_AVOID
1642 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001643 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001644#endif /* FEATURE_WLAN_CH_AVOID */
1645
1646 uint8_t max_intf_count;
1647 uint8_t current_intf_count;
1648#ifdef WLAN_FEATURE_LPSS
1649 uint8_t lpss_support;
1650#endif
1651 uint8_t ap_arpns_support;
1652 tSirScanType ioctl_scan_mode;
1653
1654#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301655 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001656#endif
1657
1658 struct work_struct sap_start_work;
1659 bool is_sap_restart_required;
1660 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301661 qdf_spinlock_t sap_update_info_lock;
1662 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001663
1664 uint8_t dev_dfs_cac_status;
1665
Jeff Johnson59b19312017-11-02 21:14:33 -07001666 bool bt_coex_mode_set;
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001667 struct fw_log_info fw_log_settings;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001668#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301669 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001670 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001671 uint8_t *last_acs_channel_list;
1672 uint8_t num_of_channels;
1673 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001674#endif
1675
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301676 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001677 atomic_t sap_dfs_ref_cnt;
1678
1679#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1680 bool is_extwow_app_type1_param_set;
1681 bool is_extwow_app_type2_param_set;
1682 bool ext_wow_should_suspend;
1683 struct completion ready_to_extwow;
1684#endif
1685
1686 /* Time since boot up to extscan start (in micro seconds) */
1687 uint64_t ext_scan_start_since_boot;
1688 unsigned long g_event_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001689 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301690
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001691#ifdef WLAN_NS_OFFLOAD
1692 /* IPv6 notifier callback for handling NS offload on change in IP */
1693 struct notifier_block ipv6_notifier;
1694#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301695 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001696 /* IPv4 notifier callback for handling ARP offload on change in IP */
1697 struct notifier_block ipv4_notifier;
1698
1699 /* number of rf chains supported by target */
1700 uint32_t num_rf_chains;
1701 /* Is htTxSTBC supported by target */
1702 uint8_t ht_tx_stbc_supported;
1703#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1704 struct hdd_offloaded_packets_ctx op_ctx;
1705#endif
1706 bool mcc_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001707 struct mutex memdump_lock;
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301708 uint16_t driver_dump_size;
1709 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001710
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001711 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301712 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713
1714 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301715 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001716
Krunal Sonie3531942016-04-12 17:43:53 -07001717 /*
1718 * place to store FTM capab of target. This allows changing of FTM capab
1719 * at runtime and intersecting it with target capab before updating.
1720 */
1721 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001722 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001723 /* completion variable to indicate set antenna mode complete*/
1724 struct completion set_antenna_mode_cmpl;
1725 /* Current number of TX X RX chains being used */
1726 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301727 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001728
1729 /* the radio index assigned by cnss_logger */
1730 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301731 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301732 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301733 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001734#ifdef WLAN_FEATURE_NAN_DATAPATH
1735 bool nan_datapath_enabled;
1736#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301737 /* Present state of driver cds modules */
1738 enum driver_modules_status driver_status;
Dustin Brown6f427922017-09-19 12:19:00 -07001739 /* interface idle work */
1740 qdf_delayed_work_t iface_idle_work;
Arun Khandavallifae92942016-08-01 13:31:08 +05301741 /* Interface change lock */
1742 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301743 bool rps;
Jeff Johnsone2ba3cd2017-10-30 20:02:09 -07001744 bool enable_rxthread;
Nirav Shahbd36b062016-07-18 11:12:59 +05301745 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301746 bool stop_modules_in_progress;
1747 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001748 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301749 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301750 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001751 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301752 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301753 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301754 struct scan_chan_info *chan_info;
1755 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301756 /* bit map to set/reset TDLS by different sources */
1757 unsigned long tdls_source_bitmap;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001758 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001759 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301760 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301761 uint8_t last_scan_reject_session_id;
1762 enum scan_reject_states last_scan_reject_reason;
1763 unsigned long last_scan_reject_timestamp;
Abhishek Singh00130682017-07-14 10:46:17 +05301764 uint8_t scan_reject_cnt;
Arif Hussain759a0232017-03-20 13:17:18 -07001765 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001766 bool reg_offload;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301767 bool rcpi_enabled;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301768#ifdef FEATURE_WLAN_CH_AVOID
Kiran Kumar Lokere48795792017-07-07 15:34:29 -07001769 struct ch_avoid_ind_type coex_avoid_freq_list;
1770 struct ch_avoid_ind_type dnbs_avoid_freq_list;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301771 /* Lock to control access to dnbs and coex avoid freq list */
1772 struct mutex avoid_freq_lock;
1773#endif
Abhinav Kumar5eda62d2018-02-13 13:00:39 +05301774 qdf_atomic_t is_acs_allowed;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001775#ifdef WLAN_FEATURE_TSF
1776 /* indicate whether tsf has been initialized */
1777 qdf_atomic_t tsf_ready_flag;
1778 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1779 qdf_atomic_t cap_tsf_flag;
1780 /* the context that is capturing tsf */
Jeff Johnson9d295242017-08-29 14:39:48 -07001781 struct hdd_adapter *cap_tsf_context;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001782#endif
Vidyullatha Kanchanapallybe0ebb32017-03-23 14:36:21 +05301783 uint8_t bt_a2dp_active:1;
1784 uint8_t bt_vo_active:1;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301785 struct hdd_nud_stats_context nud_stats_context;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08001786 enum band_info curr_band;
Arunk Khandavalli847969d2017-09-25 15:15:36 +05301787 bool imps_enabled;
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05301788 int user_configured_pkt_filter_rules;
Vignesh Viswanathan731186f2017-09-18 13:47:37 +05301789 bool is_fils_roaming_supported;
Poddar, Siddarth4b3f7312017-11-02 17:00:20 +05301790 qdf_atomic_t vendor_disable_lro_flag;
Manjunathappa Prakash7b6cb002017-10-09 00:40:24 -07001791 qdf_atomic_t disable_lro_in_concurrency;
Poddar, Siddarth47c23402017-10-25 12:17:39 +05301792 qdf_atomic_t disable_lro_in_low_tput;
Manjunathappa Prakash81ca3a52017-10-09 01:41:58 -07001793 bool en_tcp_delack_no_lro;
Abhishek Singh6454ad32017-12-20 10:42:21 +05301794 bool force_rsne_override;
Arunk Khandavalliebd1e372017-11-06 15:00:24 +05301795 qdf_wake_lock_t monitor_mode_wakelock;
Naveen Rawat269b4ed2017-12-07 06:47:32 -08001796 bool lte_coex_ant_share;
Sandeep Puligilla019a1bd2018-02-04 22:57:44 -08001797 int sscan_pid;
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +05301798 uint32_t track_arp_ip;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001799};
1800
Kapil Gupta086c6202016-12-11 18:17:06 +05301801/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301802 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1803 * @channel_count: channel count
1804 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301805 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301806 * @vendor_pcl_list: pointer to pcl list
1807 * @vendor_weight_list: pointer to pcl weight list
1808 */
1809struct hdd_vendor_acs_chan_params {
1810 uint32_t channel_count;
1811 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301812 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301813 uint8_t *vendor_pcl_list;
1814 uint8_t *vendor_weight_list;
1815};
1816
1817/**
1818 * struct hdd_external_acs_timer_context - acs timer context
1819 * @reason: reason for acs trigger
1820 * @adapter: hdd adapter for acs
1821 */
1822struct hdd_external_acs_timer_context {
1823 int8_t reason;
Jeff Johnson9d295242017-08-29 14:39:48 -07001824 struct hdd_adapter *adapter;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301825};
1826
1827/**
1828 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301829 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301830 * @pri_ch: primary channel
1831 * @ht_sec_ch: secondary channel
1832 * @vht_seg0_center_ch: segment0 for vht
1833 * @vht_seg1_center_ch: vht segment 1
1834 * @chan_width: channel width
1835 */
1836struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05301837 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301838 uint8_t pri_ch;
1839 uint8_t ht_sec_ch;
1840 uint8_t vht_seg0_center_ch;
1841 uint8_t vht_seg1_center_ch;
1842 uint8_t chan_width;
1843};
1844
1845/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301846 * struct hdd_channel_info - standard channel info
1847 * @freq: Freq in Mhz
1848 * @flags: channel info flags
1849 * @flagext: extended channel info flags
1850 * @ieee_chan_number: channel number
1851 * @max_reg_power: max tx power according to regulatory
1852 * @max_radio_power: max radio power
1853 * @min_radio_power: min radio power
1854 * @reg_class_id: regulatory class
1855 * @max_antenna_gain: max antenna gain allowed on channel
1856 * @vht_center_freq_seg0: vht center freq segment 0
1857 * @vht_center_freq_seg1: vht center freq segment 1
1858 */
1859struct hdd_channel_info {
1860 u_int16_t freq;
1861 u_int32_t flags;
1862 u_int16_t flagext;
1863 u_int8_t ieee_chan_number;
1864 int8_t max_reg_power;
1865 int8_t max_radio_power;
1866 int8_t min_radio_power;
1867 u_int8_t reg_class_id;
1868 u_int8_t max_antenna_gain;
1869 u_int8_t vht_center_freq_seg0;
1870 u_int8_t vht_center_freq_seg1;
1871};
1872
Jeff Johnsonef926352017-01-12 10:41:02 -08001873/*
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301874 * @eHDD_DRV_OP_PROBE: Refers to .probe operation
1875 * @eHDD_DRV_OP_REMOVE: Refers to .remove operation
1876 * @eHDD_DRV_OP_SHUTDOWN: Refers to .shutdown operation
1877 * @eHDD_DRV_OP_REINIT: Refers to .reinit operation
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05301878 * @eHDD_DRV_OP_IFF_UP: Refers to IFF_UP operation
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301879 */
1880enum {
1881 eHDD_DRV_OP_PROBE = 0,
1882 eHDD_DRV_OP_REMOVE,
1883 eHDD_DRV_OP_SHUTDOWN,
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05301884 eHDD_DRV_OP_REINIT,
1885 eHDD_DRV_OP_IFF_UP
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05301886};
1887
1888/*
Jeff Johnsonef926352017-01-12 10:41:02 -08001889 * Function declarations and documentation
1890 */
Himanshu Agarwal813b2bf2018-01-22 16:32:15 +05301891
1892/**
1893 * hdd_start_green_ap_state_mc() - to start green AP state mc based on
1894 * present concurrency and state of green AP state machine.
1895 * @hdd_ctx: hdd context
1896 * @mode: device mode
1897 * @is_session_start: BSS start/stop
1898 *
1899 * Return: 0 - success, < 0 - failure
1900 */
1901int hdd_start_green_ap_state_mc(struct hdd_context *hdd_ctx,
1902 enum QDF_OPMODE mode, bool is_session_start);
1903
Jeff Johnson9d295242017-08-29 14:39:48 -07001904int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301905 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001906 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001907
1908const char *hdd_device_mode_to_string(uint8_t device_mode);
1909
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001910QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001911 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001912
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001913QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001914 struct hdd_adapter *current_adapter,
1915 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001916
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001917QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001918 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001919
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001920QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001921 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001922
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001923QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001924 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001925
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001926QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001927 struct hdd_adapter *adapter);
1928
1929/**
1930 * hdd_for_each_adapter - adapter iterator macro
1931 * @hdd_ctx: the global HDD context
1932 * @adapter: an hdd_adapter pointer to use as a cursor
1933 */
1934#define hdd_for_each_adapter(hdd_ctx, adapter) \
1935 for (hdd_get_front_adapter(hdd_ctx, &adapter); \
1936 adapter; \
1937 hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001938
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001939struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
1940 uint8_t session_type,
1941 const char *name, tSirMacAddr macAddr,
1942 unsigned char name_assign_type,
1943 bool rtnl_held);
1944QDF_STATUS hdd_close_adapter(struct hdd_context *hdd_ctx,
1945 struct hdd_adapter *adapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001946 bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001947QDF_STATUS hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Dustin Browndb2a8be2017-12-20 11:49:56 -08001948QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07001949void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001950QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx);
1951QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx);
1952struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001953 uint32_t vdev_id);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001954struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001955 tSirMacAddr macAddr);
Dustin Brownd28772b2017-03-17 14:16:07 -07001956
Krunal Sonib51eec72017-11-20 21:53:01 -08001957int hdd_vdev_create(struct hdd_adapter *adapter,
1958 csr_roam_completeCallback callback, void *ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07001959int hdd_vdev_destroy(struct hdd_adapter *adapter);
1960int hdd_vdev_ready(struct hdd_adapter *adapter);
Dustin Brownd28772b2017-03-17 14:16:07 -07001961
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001962QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001963struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001964 enum QDF_OPMODE mode);
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05301965/*
1966 * hdd_get_device_mode() - Get device mode
1967 * @session_id: Session id
1968 *
1969 * Return: Device mode
1970 */
1971enum tQDF_ADAPTER_MODE hdd_get_device_mode(uint32_t session_id);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001972void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
1973 struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001974 bool rtnl_held);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001975QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
Dustin Browndb2a8be2017-12-20 11:49:56 -08001976 struct hdd_adapter *adapter);
Jeff Johnson5505db82017-11-02 21:19:23 -07001977void hdd_set_station_ops(struct net_device *dev);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001978uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001979void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx,
1980 uint8_t *releaseAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001981uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001982 enum QDF_OPMODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001983
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001984void hdd_set_conparam(uint32_t con_param);
Jeff Johnson876c1a62017-12-12 10:43:07 -08001985enum QDF_GLOBAL_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001986void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07001987void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001988void hdd_prevent_suspend(uint32_t reason);
Sourav Mohapatra92ea8d62018-02-05 10:03:10 +05301989
1990/*
1991 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list
1992 *
1993 * This function is used to fetch the first valid adapter from the adapter
1994 * list. If there is no valid adapter then it returns NULL
1995 *
1996 * @hdd_ctx: HDD context handler
1997 *
1998 * Return: NULL if no valid adapter found in the adapter list
1999 *
2000 */
2001struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx);
2002
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002003void hdd_allow_suspend(uint32_t reason);
2004void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002005
2006void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002007QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002008int wlan_hdd_validate_context(struct hdd_context *hdd_ctx);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002009
2010/**
2011 * hdd_validate_adapter() - Validate the given adapter
2012 * @adapter: the adapter to validate
2013 *
2014 * This function validates the given adapter, and ensures that it is open.
2015 *
2016 * Return: Errno
2017 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002018int hdd_validate_adapter(struct hdd_adapter *adapter);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002019
Chris Guo1751acf2017-07-03 14:09:01 +08002020/**
2021 * wlan_hdd_validate_context_in_loading() - check the HDD context in loading
2022 * @hdd_ctx: HDD context pointer
2023 *
2024 * Return: 0 if the context is valid. Error code otherwise
2025 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002026int wlan_hdd_validate_context_in_loading(struct hdd_context *hdd_ctx);
Chris Guo1751acf2017-07-03 14:09:01 +08002027
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002028bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002029QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002030bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002031
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002032struct qdf_mac_addr *
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002033hdd_wlan_get_ibss_mac_addr_from_staid(struct hdd_adapter *adapter,
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08002034 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002035#ifdef MSM_PLATFORM
Dustin Brown5ec6b552017-03-31 12:11:40 -07002036/**
2037 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
2038 * @hdd_ctx: the global hdd context
2039 *
2040 * Return: None
2041 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002042void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002043
2044/**
2045 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
2046 * @hdd_ctx: the global hdd context
2047 *
2048 * This function ensures there is at least one adapter in the associated state
2049 * before starting the bandwidth timer.
2050 *
2051 * Return: None
2052 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002053void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002054
2055/**
2056 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
2057 * @hdd_ctx: the global hdd context
2058 *
2059 * Return: None
2060 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002061void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002062
2063/**
2064 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
2065 * @hdd_ctx: the global hdd context
2066 *
2067 * This function ensures there are no adapters in the associated state before
2068 * stopping the bandwidth timer.
2069 *
2070 * Return: None
2071 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002072void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002073
2074/**
2075 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002076 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002077 *
2078 * Initialize bus bandwidth related data structures like spinlock and timer.
2079 *
2080 * Return: None.
2081 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002082int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002083
2084/**
2085 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002086 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002087 *
2088 * Destroy bus bandwidth related data structures like timer.
2089 *
2090 * Return: None.
2091 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002092void hdd_bus_bandwidth_destroy(struct hdd_context *hdd_ctx);
Lin Baic5c06882017-09-21 13:58:43 +08002093
2094/**
2095 * hdd_bus_bw_cancel_work() - Cancel the bus_bw_work worker
2096 * @hdd_ctx: HDD context
2097 *
2098 * Cancel the bus_bw_work to stop monitor link state.
2099 *
2100 * Return: None.
2101 */
2102void hdd_bus_bw_cancel_work(struct hdd_context *hdd_ctx);
jiadcdaf9bd2017-10-26 12:20:21 +08002103
Lin Bai556a1922017-11-10 20:32:04 +08002104#define GET_CUR_RX_LVL(config) ((config)->cur_rx_level)
Lin Baiaa7f8d72017-10-18 17:23:45 +08002105#define GET_BW_COMPUTE_INTV(config) ((config)->busBandwidthComputeInterval)
2106
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002107#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07002108
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002109static inline
2110void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002111{
Dustin Brown5ec6b552017-03-31 12:11:40 -07002112}
2113
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002114static inline
2115void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002116{
2117}
2118
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002119static inline
2120void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002121{
2122}
2123
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002124static inline
2125void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002126{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002127}
2128
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002129static inline
2130int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002131{
2132 return 0;
2133}
2134
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002135static inline
2136void hdd_bus_bandwidth_destroy(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002137{
Prashanth Bhattaab004382016-10-11 16:08:11 -07002138}
Lin Baic5c06882017-09-21 13:58:43 +08002139
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002140static inline
2141void hdd_bus_bw_cancel_work(struct hdd_context *hdd_ctx)
Lin Baic5c06882017-09-21 13:58:43 +08002142{
2143}
jiadcdaf9bd2017-10-26 12:20:21 +08002144
Lin Bai556a1922017-11-10 20:32:04 +08002145#define GET_CUR_RX_LVL(config) 0
Lin Baiaa7f8d72017-10-18 17:23:45 +08002146#define GET_BW_COMPUTE_INTV(config) 0
2147
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002148#endif
2149
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05302150int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
2151
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08002152int hdd_init(void);
2153void hdd_deinit(void);
2154
Arun Khandavallifae92942016-08-01 13:31:08 +05302155int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002156void __hdd_wlan_exit(void);
2157int hdd_wlan_notify_modem_power_state(int state);
2158#ifdef QCA_HT_2040_COEX
Jeff Johnsone7672e72017-10-21 15:10:04 -07002159/**
2160 * hdd_wlan_set_ht2040_mode() - notify FW with HT20/HT40 mode
2161 * @adapter: pointer to adapter
2162 * @sta_id: station id
2163 * @sta_mac: station MAC address
2164 * @channel_type: channel type
2165 *
2166 * This function notifies FW with HT20/HT40 mode
2167 *
2168 * Return: 0 if successful, error number otherwise
2169 */
2170int hdd_wlan_set_ht2040_mode(struct hdd_adapter *adapter, uint16_t sta_id,
2171 struct qdf_mac_addr sta_mac, int channel_type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002172#endif
2173
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05302174void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002175#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002176void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002177#endif
2178
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002179struct hdd_adapter *
2180hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
2181 bool check_start_bss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002182
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002183bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002184
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002185int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002186
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002187#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002188static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002189{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002190 return hdd_ctx->config->isRoamOffloadEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002191}
2192#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002193static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002194{
2195 return false;
2196}
2197#endif
2198
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002199#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002200static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002201{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002202 return hdd_ctx->config->isFastRoamIniFeatureEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002203}
2204#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002205static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002206{
2207 return false;
2208}
2209#endif
2210
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002211static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002212{
2213 bool val;
2214
2215 val = hdd_driver_roaming_supported(hdd_ctx) ||
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002216 roaming_offload_enabled(hdd_ctx);
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002217
2218 return val;
2219}
2220
2221#ifdef CFG80211_SCAN_RANDOM_MAC_ADDR
2222static inline bool hdd_scan_random_mac_addr_supported(void)
2223{
2224 return true;
2225}
2226#else
2227static inline bool hdd_scan_random_mac_addr_supported(void)
2228{
2229 return false;
2230}
2231#endif
2232
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302233/**
2234 * hdd_start_vendor_acs(): Start vendor ACS procedure
2235 * @adapter: pointer to SAP adapter struct
2236 *
2237 * This function sends the ACS config to the ACS daemon and
2238 * starts the vendor ACS timer to wait for the next command.
2239 *
2240 * Return: Status of vendor ACS procedure
2241 */
2242int hdd_start_vendor_acs(struct hdd_adapter *adapter);
2243
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002244void hdd_get_fw_version(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002245 uint32_t *major_spid, uint32_t *minor_spid,
2246 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302247/**
2248 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
2249 * @context : timeout handler context
2250 *
2251 * Return: None
2252 */
2253void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002254
Kapil Gupta8878ad92017-02-13 11:56:04 +05302255/**
2256 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
2257 * @adapter: pointer to SAP adapter struct
2258 *
2259 * This function starts the ACS procedure if there are no
2260 * constraints like MBSSID DFS restrictions.
2261 *
2262 * Return: Status of ACS Start procedure
2263 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002264int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302265
2266/**
2267 * hdd_cfg80211_update_acs_config() - update acs config to application
2268 * @adapter: hdd adapter
2269 * @reason: channel change reason
2270 *
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302271 * Return: 0 for success else error code
Kapil Gupta8878ad92017-02-13 11:56:04 +05302272 */
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302273int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
2274 uint8_t reason);
Nirav Shaheb017be2018-02-15 11:20:58 +05302275
Kapil Gupta8878ad92017-02-13 11:56:04 +05302276/**
2277 * hdd_update_acs_timer_reason() - update acs timer start reason
2278 * @adapter: hdd adapter
2279 * @reason: channel change reason
2280 *
2281 * Return: 0 for success
2282 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002283int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302284
2285/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002286 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05302287 * @adapter: AP adapter
2288 * @channel: Channel
Min Liu2fef5792018-01-19 17:59:42 +08002289 * @forced: Force to switch channel, ignore SCC/MCC check
Kapil Gupta8878ad92017-02-13 11:56:04 +05302290 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002291 * Moves the SAP interface by invoking the function which
2292 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05302293 *
2294 * Return: None
2295 */
Min Liu2fef5792018-01-19 17:59:42 +08002296void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
2297 bool forced);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002298
Nirav Shaheb017be2018-02-15 11:20:58 +05302299#if defined(FEATURE_WLAN_CH_AVOID)
2300void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
2301
2302void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2303 struct unsafe_ch_list *unsafe_chan_list,
2304 struct ch_avoid_ind_type *avoid_freq_list);
2305#else
2306static inline
2307void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
2308{
2309}
2310
2311static inline
2312void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2313 struct unsafe_ch_list *unsafe_chan_list,
2314 struct ch_avoid_ind_type *avoid_freq_list)
2315{
2316}
2317#endif
2318
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002319void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05302320 struct qdf_mac_addr hw_macaddr);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002321void wlan_hdd_disable_roaming(struct hdd_adapter *adapter);
2322void wlan_hdd_enable_roaming(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002323
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002324QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002325
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002326QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002327
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002328QDF_STATUS
2329wlan_hdd_check_custom_con_channel_rules(struct hdd_adapter *sta_adapter,
2330 struct hdd_adapter *ap_adapter,
Jeff Johnson61b5e982018-03-15 11:33:31 -07002331 struct csr_roam_profile *roam_profile,
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002332 tScanResultHandle *scan_cache,
2333 bool *concurrent_chnl_same);
2334
Jeff Johnson9d295242017-08-29 14:39:48 -07002335void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
2336void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002337
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05302338/**
2339 * hdd_init_nud_stats_ctx() - initialize NUD stats context
2340 * @hdd_ctx: Pointer to hdd context
2341 *
2342 * Return: none
2343 */
2344static inline void hdd_init_nud_stats_ctx(struct hdd_context *hdd_ctx)
2345{
2346 init_completion(&hdd_ctx->nud_stats_context.response_event);
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05302347}
2348
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08002349void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
2350
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002351#ifdef QCA_CONFIG_SMP
2352int wlan_hdd_get_cpu(void);
2353#else
2354static inline int wlan_hdd_get_cpu(void)
2355{
2356 return 0;
2357}
2358#endif
2359
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302360void wlan_hdd_sap_pre_cac_failure(void *data);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002361void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302362
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002363void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2364 enum netif_action_type action, enum netif_reason_type reason);
2365
Jeff Johnson9d295242017-08-29 14:39:48 -07002366int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002367void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002368void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
2369void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
Mohit Khannaca4173b2017-09-12 21:52:19 -07002370void
2371wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
2372 enum qdf_stats_verbosity_level verb_lvl);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002373void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002374const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302375void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002376
2377struct hdd_adapter *
2378hdd_get_adapter_by_sme_session_id(struct hdd_context *hdd_ctx,
2379 uint32_t sme_session_id);
2380
Naveen Rawat4edb6822017-04-12 10:09:17 -07002381/**
2382 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2383 * @hdd_ctx: hdd context.
2384 * @iface_name: interface name
2385 *
2386 * This function is used to get the adapter with given interface name
2387 *
2388 * Return: adapter pointer if found, NULL otherwise
2389 *
2390 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002391struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx,
Naveen Rawat4edb6822017-04-12 10:09:17 -07002392 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002393enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05302394uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
2395 uint8_t bw_offset);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002396int hdd_update_config(struct hdd_context *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002397
Mukul Sharma9d797a02017-01-05 20:26:03 +05302398/**
2399 * hdd_update_components_config() - Initialize driver per module ini parameters
2400 * @hdd_ctx: HDD Context
2401 *
2402 * API is used to initialize components configuration parameters
2403 * Return: 0 for success, errno for failure
2404 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002405int hdd_update_components_config(struct hdd_context *hdd_ctx);
Mukul Sharma9d797a02017-01-05 20:26:03 +05302406
Jeff Johnson9d295242017-08-29 14:39:48 -07002407QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302408 struct net_device *dev,
bings58ce8622017-07-10 15:55:36 +08002409 struct hdd_chan_change_params chan_change,
2410 bool legacy_phymode);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302411int wlan_hdd_set_channel(struct wiphy *wiphy,
2412 struct net_device *dev,
2413 struct cfg80211_chan_def *chandef,
2414 enum nl80211_channel_type channel_type);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002415int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302416 struct cfg80211_beacon_data *params,
2417 const u8 *ssid, size_t ssid_len,
2418 enum nl80211_hidden_ssid hidden_ssid,
Mahesh Kumar Kalikot Veetilc637fc92017-09-27 16:06:21 -07002419 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302420
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002421#if !defined(REMOVE_PKT_LOG)
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002422int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302423 int set_value2);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002424int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302425 uint8_t user_triggered, int size);
2426
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002427#else
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002428static inline
2429int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
2430 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002431{
2432 return 0;
2433}
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002434
2435static inline
2436int hdd_process_pktlog_command(struct hdd_context *hdd_ctx,
2437 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002438{
2439 return 0;
2440}
2441#endif /* REMOVE_PKT_LOG */
2442
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002443#ifdef FEATURE_TSO
2444/**
2445 * hdd_set_tso_flags() - enable TSO flags in the network device
2446 * @hdd_ctx: HDD context
2447 * @wlan_dev: network device structure
2448 *
2449 * This function enables the TSO related feature flags in the
2450 * given network device.
2451 *
2452 * Return: none
2453 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002454static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002455 struct net_device *wlan_dev)
2456{
Mohit Khanna816e6532016-12-09 15:28:21 -08002457 if (hdd_ctx->config->tso_enable &&
2458 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2459 /*
2460 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2461 * enabled.
2462 */
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002463 hdd_info("TSO Enabled");
2464 wlan_dev->features |=
2465 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2466 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2467 }
2468}
2469#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002470static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002471 struct net_device *wlan_dev){}
2472#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002473
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002474void hdd_get_ibss_peer_info_cb(void *pUserData,
2475 tSirPeerInfoRspParams *pPeerInfo);
2476
Ryan Hsuceddceb2016-04-28 10:20:14 -07002477#ifdef CONFIG_CNSS_LOGGER
2478/**
2479 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2480 * @hdd_ctx: the hdd context pointer
2481 *
2482 * The nl_srv_init() will call to cnss_logger_device_register() and
2483 * expect to get a radio_index from cnss_logger module and assign to
2484 * hdd_ctx->radio_index, then to maintain the consistency to original
2485 * design, adding the radio_index check here, then return the error
2486 * code if radio_index is not assigned correctly, which means the nl_init
2487 * from cnss_logger is failed.
2488 *
2489 * Return: 0 if successfully, otherwise error code
2490 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002491static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002492{
2493 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2494
2495 /* radio_index is assigned from 0, so only >=0 will be valid index */
2496 if (hdd_ctx->radio_index >= 0)
2497 return 0;
2498 else
2499 return -EINVAL;
2500}
2501#else
2502/**
2503 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2504 * @hdd_ctx: the hdd context pointer
2505 *
2506 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2507 * the netlink socket and return the success or not.
2508 *
2509 * Return: the return value from nl_srv_init()
2510 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002511static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002512{
2513 return nl_srv_init(hdd_ctx->wiphy);
2514}
2515#endif
Krunal Sonib51eec72017-11-20 21:53:01 -08002516QDF_STATUS hdd_sme_open_session_callback(uint8_t session_id);
2517QDF_STATUS hdd_sme_close_session_callback(uint8_t session_id);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002518
Jeff Johnson9d295242017-08-29 14:39:48 -07002519int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002520 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05302521void hdd_svc_fw_shutdown_ind(struct device *dev);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002522int hdd_register_cb(struct hdd_context *hdd_ctx);
2523void hdd_deregister_cb(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002524int hdd_start_station_adapter(struct hdd_adapter *adapter);
2525int hdd_start_ap_adapter(struct hdd_adapter *adapter);
2526int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter);
Jeff Johnson9d295242017-08-29 14:39:48 -07002527int hdd_set_fw_params(struct hdd_adapter *adapter);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002528int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
2529 struct hdd_adapter *adapter,
Arun Khandavallifae92942016-08-01 13:31:08 +05302530 bool reinit);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002531int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
Jeff Johnson9d295242017-08-29 14:39:48 -07002532int hdd_start_adapter(struct hdd_adapter *adapter);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002533void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);
yeshwanth sriram guntukaea63f632017-08-30 19:31:56 +05302534/**
2535 * hdd_is_interface_up()- Checkfor interface up before ssr
2536 * @hdd_ctx: HDD context
2537 *
2538 * check if there are any wlan interfaces before SSR accordingly start
2539 * the interface.
2540 *
2541 * Return: 0 if interface was opened else false
2542 */
2543bool hdd_is_interface_up(struct hdd_adapter *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302544/**
2545 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2546 * @wiphy: wiphy
2547 * @channel: channel of the BSS to find
2548 * @bssid: bssid of the BSS to find
2549 * @ssid: ssid of the BSS to find
2550 * @ssid_len: ssid len of of the BSS to find
2551 *
2552 * The API is a wrapper to get bss from kernel matching the chan,
2553 * bssid and ssid
2554 *
2555 * Return: bss structure if found else NULL
2556 */
2557struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2558 struct ieee80211_channel *channel,
2559 const u8 *bssid,
2560 const u8 *ssid, size_t ssid_len);
2561
Anurag Chouhanc4092922016-09-08 15:56:11 +05302562void hdd_connect_result(struct net_device *dev, const u8 *bssid,
Jeff Johnson172237b2017-11-07 15:32:59 -08002563 struct csr_roam_info *roam_info, const u8 *req_ie,
Anurag Chouhanc4092922016-09-08 15:56:11 +05302564 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302565 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302566 bool connect_timeout,
2567 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302568
Arun Khandavallifae92942016-08-01 13:31:08 +05302569#ifdef WLAN_FEATURE_FASTPATH
2570void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2571 void *context);
2572#else
2573static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2574 void *context)
2575{
2576}
2577#endif
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002578void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context);
Nirav Shaheb017be2018-02-15 11:20:58 +05302579
Agrawal Ashish65634612016-08-18 13:24:32 +05302580enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002581void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
Liangwei Dong6e1a2092017-08-30 16:29:06 +08002582/**
2583 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list
2584 * @hdd_ctx: hdd context pointer
2585 * @local_unsafe_list: copied unsafe chan list array
2586 * @local_unsafe_list_count: channel number in returned local_unsafe_list
2587 *
2588 * The function will allocate memory and make a copy the current unsafe
2589 * channels from hdd ctx. The caller need to free the local_unsafe_list
2590 * memory after use.
2591 *
2592 * Return: 0 if successfully clone unsafe chan list.
2593 */
2594int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
2595 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count);
2596
2597/**
2598 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not
2599 * @hdd_ctx: hdd context pointer
2600 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list
2601 * @local_unsafe_list_count: channel number in local_unsafe_list
2602 *
2603 * The function checked the input channel is same as current unsafe chan
2604 * list in hdd_ctx.
2605 *
2606 * Return: true if input channel list is same as the list in hdd_ctx
2607 */
2608bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx,
2609 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count);
2610
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002611int hdd_enable_disable_ca_event(struct hdd_context *hddctx,
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302612 uint8_t set_value);
Jeff Johnson9d295242017-08-29 14:39:48 -07002613void wlan_hdd_undo_acs(struct hdd_adapter *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002614
2615#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2616static inline int
2617hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2618{
2619 return nla_put_u64(skb, attrtype, value);
2620}
2621#else
2622static inline int
2623hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2624{
2625 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2626}
2627#endif
2628
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302629static inline int wlan_hdd_validate_session_id(u8 session_id)
2630{
2631 if (session_id != HDD_SESSION_ID_INVALID)
2632 return 0;
2633
2634 return -EINVAL;
2635}
2636
Jeff Johnson9d295242017-08-29 14:39:48 -07002637bool hdd_is_roaming_in_progress(struct hdd_adapter *adapter);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002638void hdd_set_roaming_in_progress(bool value);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002639bool hdd_is_connection_in_progress(uint8_t *session_id,
2640 enum scan_reject_states *reason);
Jeff Johnson9d295242017-08-29 14:39:48 -07002641void hdd_restart_sap(struct hdd_adapter *ap_adapter);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002642void hdd_check_and_restart_sap_with_non_dfs_acs(void);
2643bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002644
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302645/**
2646 * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
2647 * @ap_adapter: adapter
2648 * @channel_count: valid channel count
2649 * @channel_list: valid channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302650 * @band: frequency band
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302651 *
2652 * This API returns valid channel list for SAP after removing nol and
2653 * channel which lies outside of configuration.
2654 *
2655 * Return: Zero on success, non-zero on failure
2656 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002657int wlan_hdd_sap_get_valid_channellist(struct hdd_adapter *adapter,
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302658 uint32_t *channel_count,
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302659 uint8_t *channel_list,
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08002660 enum band_info band);
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302661/**
2662 * wlan_hdd_init_chan_info() - initialize channel info variables
2663 * @hdd_ctx: hdd ctx
2664 *
2665 * This API initialize channel info variables
2666 *
2667 * Return: None
2668 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002669void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07002670
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302671/**
2672 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2673 * @hdd_ctx: hdd ctx
2674 *
2675 * This API deinitialize channel info variables
2676 *
2677 * Return: None
2678 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002679void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002680void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08002681
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05302682/**
2683 * hdd_check_for_opened_interfaces()- Check for interface up
2684 * @hdd_ctx: HDD context
2685 *
2686 * check if there are any wlan interfaces before starting the timer
2687 * to close the modules
2688 *
2689 * Return: 0 if interface was opened else false
2690 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002691bool hdd_check_for_opened_interfaces(struct hdd_context *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08002692
2693#ifdef WIFI_POS_CONVERGED
2694/**
2695 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
2696 * function to send peer status to a registered application
2697 * @peer_mac: MAC address of peer
2698 * @peer_status: ePeerConnected or ePeerDisconnected
2699 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
2700 * @sessionId: SME session id, i.e. vdev_id
2701 * @chan_info: operating channel information
2702 * @dev_mode: dev mode for which indication is sent
2703 *
2704 * Return: none
2705 */
2706static inline void hdd_send_peer_status_ind_to_app(
2707 struct qdf_mac_addr *peer_mac,
2708 uint8_t peer_status,
2709 uint8_t peer_timing_meas_cap,
2710 uint8_t sessionId,
2711 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002712 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08002713{
2714 struct wifi_pos_ch_info ch_info;
2715
Naveen Rawat6877a242017-03-23 17:15:38 -07002716 if (!chan_info) {
2717 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2718 peer_timing_meas_cap, sessionId,
2719 NULL, dev_mode);
2720 return;
2721 }
2722
Naveen Rawat910726a2017-03-06 11:42:51 -08002723 ch_info.chan_id = chan_info->chan_id;
2724 ch_info.mhz = chan_info->mhz;
2725 ch_info.band_center_freq1 = chan_info->band_center_freq1;
2726 ch_info.band_center_freq2 = chan_info->band_center_freq2;
2727 ch_info.info = chan_info->info;
2728 ch_info.reg_info_1 = chan_info->reg_info_1;
2729 ch_info.reg_info_2 = chan_info->reg_info_2;
2730 ch_info.nss = chan_info->nss;
2731 ch_info.rate_flags = chan_info->rate_flags;
2732 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
2733 ch_info.ch_width = chan_info->ch_width;
2734 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2735 peer_timing_meas_cap, sessionId,
2736 &ch_info, dev_mode);
2737}
2738#else
2739static inline void hdd_send_peer_status_ind_to_app(
2740 struct qdf_mac_addr *peer_mac,
2741 uint8_t peer_status,
2742 uint8_t peer_timing_meas_cap,
2743 uint8_t sessionId,
2744 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002745 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08002746{
2747 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
2748 peer_timing_meas_cap, sessionId, chan_info, dev_mode);
2749}
2750#endif /* WIFI_POS_CONVERGENCE */
2751
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002752/**
2753 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
2754 * @adapter: Adapter data
2755 * @sval: P2P quota value
2756 *
2757 * Send P2P quota value to FW
2758 *
2759 * Return: 0 sucess else failure
2760 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002761int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002762
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002763/**
2764 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
2765 * @adapter: Adapter data
2766 * @sval: MCC latency value
2767 *
2768 * Send MCC latency value to FW
2769 *
2770 * Return: 0 sucess else failure
2771 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002772int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002773
2774/**
2775 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
2776 * and PSOC object data
2777 * @psoc: Psoc object data
2778 * @vdev_id: vdev id
2779 *
2780 * Get adapter from vdev id and PSOC object data
2781 *
2782 * Return: adapter pointer
2783 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002784struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002785 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05302786/**
2787 * hdd_unregister_notifiers()- unregister kernel notifiers
2788 * @hdd_ctx: Hdd Context
2789 *
2790 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
2791 *
2792 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002793void hdd_unregister_notifiers(struct hdd_context *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05302794
2795/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05302796 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
2797 * @hdd_ctx: HDD context
2798 *
2799 * This function sends the DBS scan selection config configuration to the
2800 * firmware via WMA
2801 *
2802 * Return: 0 - success, < 0 - failure
2803 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002804int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05302805
2806/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05302807 * hdd_start_complete()- complete the start event
2808 * @ret: return value for complete event.
2809 *
2810 * complete the startup event and set the return in
2811 * global variable
2812 *
2813 * Return: void
2814 */
2815
2816void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05302817
2818/**
2819 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
2820 * callback
2821 * @hddctx: HDD context
2822 * @data: chip power save failure detected data
2823 *
2824 * This function reads the chip power save failure detected data and fill in
2825 * the skb with NL attributes and send up the NL event.
2826 * This callback execute in atomic context and must not invoke any
2827 * blocking calls.
2828 *
2829 * Return: none
2830 */
2831
2832void hdd_chip_pwr_save_fail_detected_cb(void *hddctx,
2833 struct chip_pwr_save_fail_detected_params
2834 *data);
2835
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05302836/**
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05302837 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg
2838 * @ie_whitelist: output parameter
2839 * @cfg: pointer to hdd config
2840 *
2841 * Return: None
2842 */
2843void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
2844 struct hdd_config *cfg);
2845
2846/**
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05302847 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache
2848 * @adapter: adapter handle
2849 * @bssid: bssid to look for in scan cache
2850 * @rssi: rssi value found
2851 * @snr: snr value found
2852 *
2853 * Return: QDF_STATUS
2854 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002855int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05302856 int8_t *rssi, int8_t *snr);
2857
Ganesh Kondabattini479a8ae2017-10-03 16:49:24 +05302858/**
2859 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters
2860 * @adapter - HDD adapter
2861 *
2862 * Return: 0 on success and non zero value on failure
2863 */
2864int hdd_reset_limit_off_chan(struct hdd_adapter *adapter);
2865
Vignesh Viswanathan3fa1d382017-08-02 19:36:43 +05302866#if defined(WLAN_FEATURE_FILS_SK) && \
2867 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
2868 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05302869/**
2870 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and
2871 * free allocated memory
2872 * @adapter: pointer to hdd adapter
2873 *
2874 * Return: None
2875 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002876void hdd_clear_fils_connection_info(struct hdd_adapter *adapter);
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05302877
2878/**
2879 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp
2880 * @dev: net device
2881 * @roam_fils_params: Fils join rsp params
2882 *
2883 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM)
2884 * to the network layer.
2885 *
2886 * Return: None
2887 */
Jeff Johnson172237b2017-11-07 15:32:59 -08002888void hdd_update_hlp_info(struct net_device *dev,
2889 struct csr_roam_info *roam_info);
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05302890#else
Jeff Johnson9d295242017-08-29 14:39:48 -07002891static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05302892{ }
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05302893static inline void hdd_update_hlp_info(struct net_device *dev,
Jeff Johnson172237b2017-11-07 15:32:59 -08002894 struct csr_roam_info *roam_info)
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05302895{}
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05302896#endif
Dustin Brown3fb15042017-08-15 15:54:49 -07002897
2898#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownc81dd412017-08-15 16:26:28 -07002899static inline void hdd_dev_setup_destructor(struct net_device *dev)
2900{
2901 dev->destructor = free_netdev;
2902}
Dustin Brown3fb15042017-08-15 15:54:49 -07002903#else
Dustin Brownc81dd412017-08-15 16:26:28 -07002904static inline void hdd_dev_setup_destructor(struct net_device *dev)
2905{
2906 dev->needs_free_netdev = true;
2907}
Dustin Brownc81dd412017-08-15 16:26:28 -07002908#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brown3fb15042017-08-15 15:54:49 -07002909
Mohit Khannaf8f96822017-05-17 17:11:59 -07002910/**
2911 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API
2912 * @config: hdd config
2913 *
2914 * Return: NONE
2915 */
2916void hdd_dp_trace_init(struct hdd_config *config);
Yun Parkff6a16a2017-09-26 16:38:18 -07002917void hdd_set_rx_mode_rps(bool enable);
Mohit Khannaf8f96822017-05-17 17:11:59 -07002918
Ganesh Kondabattini35739572017-06-21 16:26:39 +05302919/**
2920 * hdd_set_limit_off_chan_for_tos() - set limit off-chan command parameters
2921 * @adapter: pointer adapter context
2922 * @tos: type of service
2923 * @status: status of the traffic (active/inactive)
2924 *
2925 * This function updates the limit off-channel command parameters to WMA
2926 *
2927 * Return: 0 on success or non zero value on failure
2928 */
2929int hdd_set_limit_off_chan_for_tos(struct hdd_adapter *adapter, enum tos tos,
2930 bool is_tos_active);
2931
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05302932/**
2933 * hdd_drv_ops_inactivity_handler() - Timeout handler for driver ops
2934 * inactivity timer
2935 *
2936 * Return: None
2937 */
2938void hdd_drv_ops_inactivity_handler(void);
2939
2940/**
2941 * hdd_start_driver_ops_timer() - Starts driver ops inactivity timer
2942 * @drv_op: Enum indicating driver op
2943 *
2944 * Return: none
2945 */
2946void hdd_start_driver_ops_timer(int drv_op);
2947
2948/**
2949 * hdd_stop_driver_ops_timer() - Stops driver ops inactivity timer
2950 *
2951 * Return: none
2952 */
2953void hdd_stop_driver_ops_timer(void);
2954
Sravan Kumar Kairamd80c7662017-10-03 16:11:05 +05302955/**
2956 * hdd_pld_ipa_uc_shutdown_pipes() - Disconnect IPA WDI pipes during PDR
2957 *
2958 * Return: None
2959 */
2960void hdd_pld_ipa_uc_shutdown_pipes(void);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05302961
2962/**
2963 * hdd_limit_max_per_index_score() -check if per index score doesnt exceed 100%
2964 * (0x64). If it exceed make it 100%
2965 *
2966 * @per_index_score: per_index_score as input
2967 *
2968 * Return: per_index_score within the max limit
2969 */
2970uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score);
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05302971/**
2972 * hdd_get_stainfo() - get stainfo for the specified peer
2973 * @astainfo: array of the station info in which the sta info
2974 * corresponding to mac_addr needs to be searched
2975 * @mac_addr: mac address of requested peer
2976 *
2977 * This function find the stainfo for the peer with mac_addr
2978 *
2979 * Return: stainfo if found, NULL if not found
2980 */
2981struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo,
2982 struct qdf_mac_addr mac_addr);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05302983
Nachiket Kukade98f562a2017-12-15 12:18:07 +05302984/**
2985 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components
2986 *
2987 * Return: None
2988 */
2989void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc);
2990
2991/**
2992 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components
2993 *
2994 * Return: None
2995 */
2996void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc);
2997
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +05302998int hdd_driver_memdump_init(void);
2999void hdd_driver_memdump_deinit(void);
3000
Himanshu Agarwalb229a142017-12-21 10:16:45 +05303001/**
Hanumanth Reddy Pothula3862ca92018-01-12 16:44:10 +05303002 * hdd_is_cli_iface_up() - check if there is any cli iface up
3003 * @hdd_ctx: HDD context
3004 *
3005 * Return: return true if there is any cli iface(STA/P2P_CLI) is up
3006 * else return false
3007 */
3008bool hdd_is_cli_iface_up(struct hdd_context *hdd_ctx);
3009
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003010#endif /* end #if !defined(WLAN_HDD_MAIN_H) */