blob: 0d179ce60fa0035b276a8b6e26ef5472a7a4e9a7 [file] [log] [blame]
Jeff Johnson153f0262018-02-28 12:51:58 -08001/*
Jeff Johnson30e9bb62018-12-27 20:57:09 -08002 * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#if !defined(WLAN_HDD_MAIN_H)
20#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080021/**
22 * DOC: wlan_hdd_main.h
23 *
24 * Linux HDD Adapter Type
25 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080026
Jeff Johnsonef926352017-01-12 10:41:02 -080027/*
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070028 * The following terms were in use in prior versions of the driver but
29 * have now been replaced with terms that are aligned with the Linux
30 * Coding style. Macros are defined to hopefully prevent new instances
31 * from being introduced, primarily by code propagation.
32 */
33#define pHddCtx
Jeff Johnson7b92c0f2017-10-02 13:31:35 -070034#define pAdapter
Jeff Johnson9c4f93d2017-10-04 08:56:22 -070035#define pHostapdAdapter
Jeff Johnson9bf24972017-10-04 09:26:58 -070036#define pHddApCtx
Jeff Johnsond377dce2017-10-04 10:32:42 -070037#define pHddStaCtx
Jeff Johnson5c19ade2017-10-04 09:52:12 -070038#define pHostapdState
Jeff Johnsonfd060852017-10-04 10:50:51 -070039#define pRoamInfo
Jeff Johnson5287de52017-10-28 12:23:06 -070040#define pScanInfo
Jeff Johnson04e00082017-10-04 12:15:58 -070041#define pBeaconIes
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070042
43/*
Jeff Johnsonef926352017-01-12 10:41:02 -080044 * Include files
45 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046
47#include <linux/netdevice.h>
48#include <linux/skbuff.h>
49#include <net/cfg80211.h>
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +053050#include <linux/ieee80211.h>
Dustin Brown8d8ab302019-03-05 16:19:36 -080051#include <qdf_delayed_work.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053052#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053053#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054#include "sir_mac_prot_def.h"
55#include "csr_api.h"
Dustin Brown21a1d462018-07-31 15:13:06 -070056#include "wlan_dsc.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080057#include <wlan_hdd_assoc.h>
58#include <wlan_hdd_wmm.h>
59#include <wlan_hdd_cfg.h>
60#include <linux/spinlock.h>
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +053061#include <ani_system_defs.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080062#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
63#include <linux/wakelock.h>
64#endif
Subrat Dash5f36fbe2019-02-12 16:28:14 +053065#ifdef WLAN_FEATURE_TSF_PTP
66#include <linux/ptp_classify.h>
67#include <linux/ptp_clock_kernel.h>
68#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070071#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072#include "wlan_hdd_cfg80211.h"
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +053073#include "wlan_hdd_debugfs.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053074#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080077#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070078#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070079#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080080#if defined(CONFIG_HL_SUPPORT)
81#include "wlan_tgt_def_config_hl.h"
82#else
Dustin Brown61269462016-09-19 13:25:45 -070083#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080084#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053085#include <wlan_objmgr_cmn.h>
86#include <wlan_objmgr_global_obj.h>
87#include <wlan_objmgr_psoc_obj.h>
88#include <wlan_objmgr_pdev_obj.h>
89#include <wlan_objmgr_vdev_obj.h>
90#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053091#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080092#ifdef WIFI_POS_CONVERGED
93#include "os_if_wifi_pos.h"
94#include "wifi_pos_api.h"
95#else
96#include "wlan_hdd_oemdata.h"
97#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080098#include "wlan_hdd_he.h"
99
Alok Kumarb64650c2018-03-23 17:05:11 +0530100#include <net/neighbour.h>
101#include <net/netevent.h>
102#include "wlan_hdd_nud_tracking.h"
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -0700103#include "wlan_hdd_twt.h"
Jeff Johnsonf9176382018-07-17 19:15:58 -0700104#include "wma_sar_public_structs.h"
Wu Gaoca416ff2018-09-17 11:05:07 +0800105#include "wlan_mlme_ucfg_api.h"
Jinwei Chenb681a482019-08-14 15:24:06 +0800106#include "pld_common.h"
Alok Kumarb64650c2018-03-23 17:05:11 +0530107
Tiger Yu8b119e92019-04-09 13:55:07 +0800108#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Browna20bad52019-03-05 12:03:30 -0800109#include "qdf_periodic_work.h"
110#endif
111
Jeff Johnsonef926352017-01-12 10:41:02 -0800112/*
113 * Preprocessor definitions and constants
114 */
115
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +0530116#ifdef FEATURE_WLAN_APF
117/**
118 * struct hdd_apf_context - hdd Context for apf
119 * @magic: magic number
120 * @qdf_apf_event: Completion variable for APF get operations
121 * @capability_response: capabilities response received from fw
122 * @apf_enabled: True: APF Interpreter enabled, False: Disabled
123 * @cmd_in_progress: Flag that indicates an APF command is in progress
124 * @buf: Buffer to accumulate read memory chunks
125 * @buf_len: Length of the read memory requested
126 * @offset: APF work memory offset to fetch from
127 * @lock: APF Context lock
128 */
129struct hdd_apf_context {
130 unsigned int magic;
131 qdf_event_t qdf_apf_event;
132 bool apf_enabled;
133 bool cmd_in_progress;
134 uint8_t *buf;
135 uint32_t buf_len;
136 uint32_t offset;
137 qdf_spinlock_t lock;
138};
139#endif /* FEATURE_WLAN_APF */
140
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800141/** Number of Tx Queues */
hangtianb9c91362019-06-07 10:39:38 +0800142#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || \
143 defined(QCA_HL_NETDEV_FLOW_CONTROL) || \
144 defined(QCA_LL_PDEV_TX_FLOW_CONTROL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800145#define NUM_TX_QUEUES 5
146#else
147#define NUM_TX_QUEUES 4
148#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800149
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -0700150/*
151 * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're
152 * in a compat syscall or not. It is a new way to query the syscall type, which
153 * works properly on all architectures.
154 *
155 */
156#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
157static inline bool in_compat_syscall(void) { return is_compat_task(); }
158#endif
159
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700160#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
161 defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700162#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ
163#define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700164#define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700165#else
166#define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
167#define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700168#define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700169#endif
170
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530171#define TSF_GPIO_PIN_INVALID 255
172
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800173/** Length of the TX queue for the netdev */
174#define HDD_NETDEV_TX_QUEUE_LEN (3000)
175
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176/** Hdd Tx Time out value */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530178
179#define HDD_TX_STALL_THRESHOLD 4
180
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181/** Hdd Default MTU */
182#define HDD_DEFAULT_MTU (1500)
183
184#ifdef QCA_CONFIG_SMP
185#define NUM_CPUS NR_CPUS
186#else
187#define NUM_CPUS 1
188#endif
189
Alan Chen5b19c212019-07-19 10:44:42 -0700190#define HDD_PSOC_IDLE_SHUTDOWN_SUSPEND_DELAY (1000)
Dustin Brown20f9fc42018-08-30 15:19:12 -0700191/**
192 * enum hdd_adapter_flags - event bitmap flags registered net device
193 * @NET_DEVICE_REGISTERED: Adapter is registered with the kernel
194 * @SME_SESSION_OPENED: Firmware vdev has been created
195 * @INIT_TX_RX_SUCCESS: Adapter datapath is initialized
196 * @WMM_INIT_DONE: Adapter is initialized
197 * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running
198 * @DEVICE_IFACE_OPENED: Adapter has been "opened" via the kernel
199 * @ACS_PENDING: Auto Channel Selection (ACS) is pending
200 * @SOFTAP_INIT_DONE: Software Access Point (SAP) is initialized
201 * @VENDOR_ACS_RESPONSE_PENDING: Waiting for event for vendor acs
Arunk Khandavalli987c8d52018-06-21 17:40:31 +0530202 * @DOWN_DURING_SSR: Mark interface is down during SSR
Dustin Brown20f9fc42018-08-30 15:19:12 -0700203 */
204enum hdd_adapter_flags {
205 NET_DEVICE_REGISTERED,
206 SME_SESSION_OPENED,
207 INIT_TX_RX_SUCCESS,
208 WMM_INIT_DONE,
209 SOFTAP_BSS_STARTED,
210 DEVICE_IFACE_OPENED,
211 ACS_PENDING,
212 SOFTAP_INIT_DONE,
213 VENDOR_ACS_RESPONSE_PENDING,
Arunk Khandavalli987c8d52018-06-21 17:40:31 +0530214 DOWN_DURING_SSR,
Dustin Brown20f9fc42018-08-30 15:19:12 -0700215};
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800216
Dustin Brown20f9fc42018-08-30 15:19:12 -0700217/**
218 * enum hdd_driver_flags - HDD global event bitmap flags
219 * @ACS_IN_PROGRESS: Auto Channel Selection (ACS) in progress
220 */
221enum hdd_driver_flags {
222 ACS_IN_PROGRESS,
223};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800224
Abhishek Singhe9706cc2017-10-12 17:25:06 +0530225#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
Abhishek Singh533c9da2017-05-04 10:23:34 +0530226#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800227#define WLAN_WAIT_TIME_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800228#define WLAN_WAIT_TIME_LINK_STATUS 800
Abhishek Singh13bf0ce2018-10-24 14:26:14 +0530229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230/** Maximum time(ms) to wait for mc thread suspend **/
231#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
232
233/** Maximum time(ms) to wait for target to be ready for suspend **/
234#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
235
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800236/* Scan Req Timeout */
237#define WLAN_WAIT_TIME_SCAN_REQ 100
238
Nachiket Kukadee547a482018-05-22 16:43:30 +0530239#define WLAN_WAIT_TIME_APF 1000
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530240
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +0530241#define WLAN_WAIT_TIME_FW_ROAM_STATS 1000
242
guangde4853c402019-05-06 15:54:04 +0800243#define WLAN_WAIT_TIME_ANTENNA_ISOLATION 8000
244
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530245/* Maximum time(ms) to wait for RSO CMD status event */
246#define WAIT_TIME_RSO_CMD_STATUS 2000
247
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530248/* rcpi request timeout in milli seconds */
249#define WLAN_WAIT_TIME_RCPI 500
250
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251#define MAX_CFG_STRING_LEN 255
252
Kapil Gupta8878ad92017-02-13 11:56:04 +0530253/* Maximum time(ms) to wait for external acs response */
254#define WLAN_VENDOR_ACS_WAIT_TIME 1000
255
Srinivas Girigowdacb7b8b82019-04-10 14:27:47 -0700256/* Mac Address string length */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800257#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700258/* Max and min IEs length in bytes */
259#define MAX_GENIE_LEN (512)
260#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800261
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700262#define WPS_OUI_TYPE "\x00\x50\xf2\x04"
263#define WPS_OUI_TYPE_SIZE 4
264
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700265#define P2P_OUI_TYPE "\x50\x6f\x9a\x09"
266#define P2P_OUI_TYPE_SIZE 4
267
268#define HS20_OUI_TYPE "\x50\x6f\x9a\x10"
269#define HS20_OUI_TYPE_SIZE 4
270
271#define OSEN_OUI_TYPE "\x50\x6f\x9a\x12"
272#define OSEN_OUI_TYPE_SIZE 4
273
274#ifdef WLAN_FEATURE_WFD
275#define WFD_OUI_TYPE "\x50\x6f\x9a\x0a"
276#define WFD_OUI_TYPE_SIZE 4
277#endif
278
279#define MBO_OUI_TYPE "\x50\x6f\x9a\x16"
280#define MBO_OUI_TYPE_SIZE 4
281
282#define QCN_OUI_TYPE "\x8c\xfd\xf0\x01"
283#define QCN_OUI_TYPE_SIZE 4
284
285#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
286 wlan_get_vendor_ie_ptr_from_oui(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, \
287 ie, ie_len)
288
Dustin Brown632af712018-03-14 15:03:55 -0700289#define hdd_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_HDD, params)
290#define hdd_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_HDD, params)
291#define hdd_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_HDD, params)
292#define hdd_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_HDD, params)
293#define hdd_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_HDD, params)
294
Nirav Shah790d9432018-07-12 19:42:48 +0530295#define hdd_nofl_alert(params...) \
296 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_HDD, params)
297#define hdd_nofl_err(params...) \
298 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_HDD, params)
299#define hdd_nofl_warn(params...) \
300 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_HDD, params)
301#define hdd_nofl_info(params...) \
302 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_HDD, params)
303#define hdd_nofl_debug(params...) \
304 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_HDD, params)
305
Dustin Brown500ae3d2018-03-19 12:47:33 -0700306#define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params)
307#define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params)
308#define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params)
309#define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params)
310#define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params)
Rajeev Kumar5cb007f2017-07-27 16:19:31 -0700311
Nirav Shahd6fa0f82018-07-06 15:52:25 +0530312#define hdd_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter")
313#define hdd_enter_dev(dev) \
314 QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter(%s)", (dev)->name)
315#define hdd_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_HDD, "exit")
Dustin Brown32a61182018-03-14 12:14:00 -0700316
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700317#define WLAN_HDD_GET_PRIV_PTR(__dev__) \
318 (struct hdd_adapter *)(netdev_priv((__dev__)))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800319
320#define MAX_NO_OF_2_4_CHANNELS 14
321
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800322#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323
324#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700325 (((center_freq) == 2412) || ((center_freq) == 2437) || \
326 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800327
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800328#define WLAN_HDD_QOS_ACTION_FRAME 1
329#define WLAN_HDD_QOS_MAP_CONFIGURE 4
Dustin Brownd0a76562017-10-13 14:48:37 -0700330#define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800331
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700332/* SAP client disconnect wake lock duration in milli seconds */
Dustin Brownd0a76562017-10-13 14:48:37 -0700333#define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \
334 WAKELOCK_DURATION_RECOMMENDED
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700335
Paul Zhang8bbbcdf2018-06-01 11:14:57 +0800336#define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3)
337#define HDD_CFG_REQUEST_FIRMWARE_DELAY (20)
338
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800339#define MAX_USER_COMMAND_SIZE 4096
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530340#define DNS_DOMAIN_NAME_MAX_LEN 255
341#define ICMPv6_ADDR_LEN 16
342
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800343
344#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
345#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
346
347/* If IPA UC data path is enabled, target should reserve extra tx descriptors
348 * for IPA data path.
349 * Then host data path should allow less TX packet pumping in case
350 * IPA data path enabled
351 */
352#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
353
Ryan Hsu07495ea2016-01-21 15:25:39 -0800354/*
355 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
356 * here if the Kernel version is less than 3.17 to avoid the interleave
357 * conditional compilation.
358 */
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700359#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\
360 defined(WITH_BACKPORTS))
Ryan Hsu07495ea2016-01-21 15:25:39 -0800361#define NET_NAME_UNKNOWN 0
362#endif
363
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530364#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530365
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530366#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
Abhishek Singh00130682017-07-14 10:46:17 +0530367#define SCAN_REJECT_THRESHOLD 15
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530368
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530369/* Default Psoc id */
370#define DEFAULT_PSOC_ID 1
371
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530372/* wait time for nud stats in milliseconds */
373#define WLAN_WAIT_TIME_NUD_STATS 800
374/* nud stats skb max length */
375#define WLAN_NUD_STATS_LEN 800
376/* ARP packet type for NUD debug stats */
377#define WLAN_NUD_STATS_ARP_PKT_TYPE 1
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +0530378/* Assigned size of driver memory dump is 4096 bytes */
379#define DRIVER_MEM_DUMP_SIZE 4096
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530380
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800381/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800382 * Prevent from permanent stall, resume OS Q if timer expired
383 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800384#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
385#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
386#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
387
Nirav Shah997e0832018-06-06 17:49:12 +0530388#ifndef NUM_TX_RX_HISTOGRAM
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700389#define NUM_TX_RX_HISTOGRAM 128
Nirav Shah997e0832018-06-06 17:49:12 +0530390#endif
391
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800392#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
393
Mohit Khannae71e2262015-11-10 09:37:24 -0800394/**
Jeff Johnson37ecea42018-03-18 17:54:40 -0700395 * enum hdd_auth_key_mgmt - auth key mgmt protocols
396 * @HDD_AUTH_KEY_MGMT_802_1X: 802.1x
397 * @HDD_AUTH_KEY_MGMT_PSK: PSK
398 * @HDD_AUTH_KEY_MGMT_CCKM: CCKM
399 */
400enum hdd_auth_key_mgmt {
401 HDD_AUTH_KEY_MGMT_802_1X = BIT(0),
402 HDD_AUTH_KEY_MGMT_PSK = BIT(1),
403 HDD_AUTH_KEY_MGMT_CCKM = BIT(2)
404};
405
406/**
Mohit Khannae71e2262015-11-10 09:37:24 -0800407 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
408 * received over 100ms intervals
409 * @interval_rx: # of rx packets received in the last 100ms interval
410 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700411 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800412 * determined on the basis of total tx and rx packets
413 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700414 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800415 * determined on the basis of rx packets received in the
416 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700417 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800418 * determined on the basis of tx packets received in the
419 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800420 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800421 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800422 * The structure keeps track of throughput requirements of wlan driver.
423 * An entry is added if either of next_vote_level, next_rx_level or
424 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800425 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800426struct hdd_tx_rx_histogram {
427 uint64_t interval_rx;
428 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800429 uint32_t next_vote_level;
430 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800431 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800432 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800433};
434
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700435struct hdd_tx_rx_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800436 /* start_xmit stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700437 __u32 tx_called;
438 __u32 tx_dropped;
439 __u32 tx_orphaned;
440 __u32 tx_classified_ac[NUM_TX_QUEUES];
441 __u32 tx_dropped_ac[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800442
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800443 /* rx stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700444 __u32 rx_packets[NUM_CPUS];
445 __u32 rx_dropped[NUM_CPUS];
446 __u32 rx_delivered[NUM_CPUS];
447 __u32 rx_refused[NUM_CPUS];
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -0800448 qdf_atomic_t rx_usolict_arp_n_mcast_drp;
Mohit Khannaf0620ce2019-07-28 21:31:05 -0700449
Mohit Khanna81418772018-10-30 14:14:46 -0700450 /* rx gro */
451 __u32 rx_aggregated;
Manjunathappa Prakash78b6a882019-03-28 19:59:23 -0700452 __u32 rx_gro_dropped;
Mohit Khanna81418772018-10-30 14:14:46 -0700453 __u32 rx_non_aggregated;
Jinwei Chenb681a482019-08-14 15:24:06 +0800454 __u32 rx_gro_flush_skip;
Jinwei Chen0dc383e2019-08-23 00:43:04 +0800455 __u32 rx_gro_low_tput_flush;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800456
457 /* txflow stats */
458 bool is_txflow_paused;
459 __u32 txflow_pause_cnt;
460 __u32 txflow_unpause_cnt;
461 __u32 txflow_timer_cnt;
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530462
463 /*tx timeout stats*/
464 __u32 tx_timeout_cnt;
465 __u32 cont_txtimeout_cnt;
466 u64 jiffies_last_txtimeout;
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700467};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800468
469#ifdef WLAN_FEATURE_11W
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700470/**
471 * struct hdd_pmf_stats - Protected Management Frame statistics
Jeff Johnsondc179f42017-10-21 11:27:26 -0700472 * @num_unprot_deauth_rx: Number of unprotected deauth frames received
473 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700474 */
475struct hdd_pmf_stats {
Jeff Johnsondc179f42017-10-21 11:27:26 -0700476 uint8_t num_unprot_deauth_rx;
477 uint8_t num_unprot_disassoc_rx;
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700478};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800479#endif
480
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530481/**
482 * struct hdd_arp_stats_s - arp debug stats count
483 * @tx_arp_req_count: no. of arp req received from network stack
484 * @rx_arp_rsp_count: no. of arp res received from FW
485 * @tx_dropped: no. of arp req dropped at hdd layer
486 * @rx_dropped: no. of arp res dropped
487 * @rx_delivered: no. of arp res delivered to network stack
488 * @rx_refused: no of arp rsp refused (not delivered) to network stack
489 * @tx_host_fw_sent: no of arp req sent by FW OTA
490 * @rx_host_drop_reorder: no of arp res dropped by host
491 * @rx_fw_cnt: no of arp res received by FW
492 * @tx_ack_cnt: no of arp req acked by FW
493 */
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530494struct hdd_arp_stats_s {
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +0530495 uint16_t tx_arp_req_count;
496 uint16_t rx_arp_rsp_count;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530497 uint16_t tx_dropped;
498 uint16_t rx_dropped;
499 uint16_t rx_delivered;
500 uint16_t rx_refused;
501 uint16_t tx_host_fw_sent;
502 uint16_t rx_host_drop_reorder;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530503 uint16_t rx_fw_cnt;
504 uint16_t tx_ack_cnt;
505};
506
Jeff Johnson07f94742017-08-14 15:55:40 -0700507/**
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530508 * struct hdd_dns_stats_s - dns debug stats count
509 * @tx_dns_req_count: no. of dns query received from network stack
510 * @rx_dns_rsp_count: no. of dns res received from FW
511 * @tx_dropped: no. of dns query dropped at hdd layer
512 * @rx_delivered: no. of dns res delivered to network stack
513 * @rx_refused: no of dns res refused (not delivered) to network stack
514 * @tx_host_fw_sent: no of dns query sent by FW OTA
515 * @rx_host_drop: no of dns res dropped by host
516 * @tx_ack_cnt: no of dns req acked by FW
Jeff Johnson07f94742017-08-14 15:55:40 -0700517 */
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530518struct hdd_dns_stats_s {
519 uint16_t tx_dns_req_count;
520 uint16_t rx_dns_rsp_count;
521 uint16_t tx_dropped;
522 uint16_t rx_delivered;
523 uint16_t rx_refused;
524 uint16_t tx_host_fw_sent;
525 uint16_t rx_host_drop;
526 uint16_t tx_ack_cnt;
527};
528
529/**
530 * struct hdd_tcp_stats_s - tcp debug stats count
531 * @tx_tcp_syn_count: no. of tcp syn received from network stack
532 * @@tx_tcp_ack_count: no. of tcp ack received from network stack
533 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW
534 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer
535 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer
536 * @rx_delivered: no. of tcp syn ack delivered to network stack
537 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack
538 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA
539 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA
540 * @rx_host_drop: no of tcp syn ack dropped by host
541 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW
542 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW
543 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not
544 * @is_tcp_ack_sent: flag to check tcp ack sent or not
545 */
546struct hdd_tcp_stats_s {
547 uint16_t tx_tcp_syn_count;
548 uint16_t tx_tcp_ack_count;
549 uint16_t rx_tcp_syn_ack_count;
550 uint16_t tx_tcp_syn_dropped;
551 uint16_t tx_tcp_ack_dropped;
552 uint16_t rx_delivered;
553 uint16_t rx_refused;
554 uint16_t tx_tcp_syn_host_fw_sent;
555 uint16_t tx_tcp_ack_host_fw_sent;
556 uint16_t rx_host_drop;
557 uint16_t rx_fw_cnt;
558 uint16_t tx_tcp_syn_ack_cnt;
559 uint16_t tx_tcp_ack_ack_cnt;
560 bool is_tcp_syn_ack_rcv;
561 bool is_tcp_ack_sent;
562
563};
564
565/**
566 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count
567 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack
568 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW
569 * @tx_dropped: no. of icmpv4 req dropped at hdd layer
570 * @rx_delivered: no. of icmpv4 res delivered to network stack
571 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack
572 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA
573 * @rx_host_drop: no of icmpv4 res dropped by host
574 * @rx_fw_cnt: no of icmpv4 res received by FW
575 * @tx_ack_cnt: no of icmpv4 req acked by FW
576 */
577struct hdd_icmpv4_stats_s {
578 uint16_t tx_icmpv4_req_count;
579 uint16_t rx_icmpv4_rsp_count;
580 uint16_t tx_dropped;
581 uint16_t rx_delivered;
582 uint16_t rx_refused;
583 uint16_t tx_host_fw_sent;
584 uint16_t rx_host_drop;
585 uint16_t rx_fw_cnt;
586 uint16_t tx_ack_cnt;
587};
588
Sourav Mohapatra9c398f02018-09-03 11:10:37 +0530589/**
590 * struct hdd_peer_stats - Peer stats at HDD level
591 * @rx_count: RX count
592 * @rx_bytes: RX bytes
593 * @fcs_count: FCS err count
594 */
595struct hdd_peer_stats {
596 uint32_t rx_count;
597 uint64_t rx_bytes;
598 uint32_t fcs_count;
599};
600
Jeff Johnson07f94742017-08-14 15:55:40 -0700601struct hdd_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800602 tCsrSummaryStatsInfo summary_stat;
Jeff Johnson861dd4f2017-10-24 10:10:40 -0700603 tCsrGlobalClassAStatsInfo class_a_stat;
Jeff Johnsonf8cadec2017-10-24 10:21:25 -0700604 tCsrGlobalClassDStatsInfo class_d_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530605 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700606 struct hdd_tx_rx_stats tx_rx_stats;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530607 struct hdd_arp_stats_s hdd_arp_stats;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530608 struct hdd_dns_stats_s hdd_dns_stats;
609 struct hdd_tcp_stats_s hdd_tcp_stats;
610 struct hdd_icmpv4_stats_s hdd_icmpv4_stats;
Sourav Mohapatra9c398f02018-09-03 11:10:37 +0530611 struct hdd_peer_stats peer_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800612#ifdef WLAN_FEATURE_11W
Jeff Johnsondc179f42017-10-21 11:27:26 -0700613 struct hdd_pmf_stats hdd_pmf_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800614#endif
Jeff Johnson07f94742017-08-14 15:55:40 -0700615};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800616
Jeff Johnson41a64962017-08-14 15:29:42 -0700617/**
618 * struct hdd_roaming_info - HDD Internal Roaming Information
Jeff Johnson41a64962017-08-14 15:29:42 -0700619 * @bssid: BSSID to which we are connected
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700620 * @peer_mac: Peer MAC address for IBSS connection
621 * @roam_id: Unique identifier for a roaming instance
622 * @roam_status: Current roam command status
623 * @defer_key_complete: Should key complete be deferred?
Jeff Johnson41a64962017-08-14 15:29:42 -0700624 *
625 */
626struct hdd_roaming_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800627 tSirMacAddr bssid;
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700628 tSirMacAddr peer_mac;
629 uint32_t roam_id;
630 eRoamCmdStatus roam_status;
631 bool defer_key_complete;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800632
Jeff Johnson41a64962017-08-14 15:29:42 -0700633};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800634
635#ifdef FEATURE_WLAN_WAPI
636/* Define WAPI macros for Length, BKID count etc*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637#define MAX_NUM_AKM_SUITES 16
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800638
639/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700640enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800641 WAPI_AUTH_MODE_OPEN = 0,
642 WAPI_AUTH_MODE_PSK = 1,
643 WAPI_AUTH_MODE_CERT
644} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
647#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648#define WAPI_PSK_AKM_SUITE 0x02721400
649#define WAPI_CERT_AKM_SUITE 0x01721400
650
Jeff Johnson89798aa2017-08-16 11:00:56 -0700651/**
652 * struct hdd_wapi_info - WAPI Information structure definition
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700653 * @wapi_mode: Is WAPI enabled on this adapter?
654 * @is_wapi_sta: Is the STA associated with WAPI?
655 * @wapi_auth_mode: WAPI authentication mode used by this adapter
Jeff Johnson89798aa2017-08-16 11:00:56 -0700656 */
657struct hdd_wapi_info {
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700658 bool wapi_mode;
659 bool is_wapi_sta;
660 enum wapi_auth_mode wapi_auth_mode;
Jeff Johnson89798aa2017-08-16 11:00:56 -0700661};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800662#endif /* FEATURE_WLAN_WAPI */
663
Jeff Johnson44e52172017-09-30 16:39:16 -0700664struct hdd_beacon_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800665 u8 *head;
666 u8 *tail;
667 u8 *proberesp_ies;
668 u8 *assocresp_ies;
669 int head_len;
670 int tail_len;
671 int proberesp_ies_len;
672 int assocresp_ies_len;
673 int dtim_period;
Jeff Johnson44e52172017-09-30 16:39:16 -0700674};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800675
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800676/**
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700677 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
wadesong59e727c2019-07-25 13:52:06 +0800678 * @freq: Channel frequency.
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700679 * @cb_mode: Channel bonding
680 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
681 * @phy_mode: PHY mode
682 */
683struct hdd_mon_set_ch_info {
wadesong59e727c2019-07-25 13:52:06 +0800684 uint32_t freq;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700685 uint8_t cb_mode;
686 uint32_t channel_width;
687 eCsrPhyMode phy_mode;
688};
689
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700690/**
691 * struct hdd_station_ctx -- STA-specific information
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700692 * @roam_profile: current roaming profile
693 * @security_ie: WPA or RSN IE used by the @roam_profile
694 * @assoc_additional_ie: association additional IE used by the @roam_profile
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700695 * @wpa_versions: bitmap of supported WPA versions
Jeff Johnson37ecea42018-03-18 17:54:40 -0700696 * @auth_key_mgmt: bitmap of supported auth key mgmt protocols
Jeff Johnson731bc322017-10-14 19:53:44 -0700697 * @requested_bssid: Specific BSSID to which to connect
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700698 * @conn_info: current connection information
699 * @roam_info: current roaming information
700 * @ft_carrier_on: is carrier on
701 * @ibss_sta_generation: current ibss generation. Incremented whenever
702 * ibss New peer joins and departs the network
703 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key
704 * installed?
705 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if
706 * @ibss_enc_key_installed is %true)
707 * @ibss_peer_info: information about the ibss peer
Jeff Johnson690fe952017-10-25 11:48:39 -0700708 * @hdd_reassoc_scenario: is station in the middle of reassociation?
Jeff Johnson8380f232017-10-25 12:39:44 -0700709 * @sta_debug_state: STA context debug variable
Jeff Johnson0a082d92019-03-04 12:25:49 -0800710 * @broadcast_sta_id: STA ID assigned for broadcast frames
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700711 * @ch_info: monitor mode channel information
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700712 * @ap_supports_immediate_power_save: Does the current AP allow our STA
713 * to immediately go into power save?
714 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800715struct hdd_station_ctx {
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700716 struct csr_roam_profile roam_profile;
Srinivas Girigowdacf161402019-03-14 11:37:33 -0700717 uint8_t security_ie[WLAN_MAX_IE_LEN];
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700718 tSirAddie assoc_additional_ie;
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700719 enum nl80211_wpa_versions wpa_versions;
Jeff Johnson37ecea42018-03-18 17:54:40 -0700720 enum hdd_auth_key_mgmt auth_key_mgmt;
Jeff Johnson731bc322017-10-14 19:53:44 -0700721 struct qdf_mac_addr requested_bssid;
Jeff Johnsone4bad252017-08-14 14:09:28 -0700722 struct hdd_connection_info conn_info;
Ashish Kumar Dhanotiya36d19b02018-02-22 00:59:49 +0530723 struct hdd_connection_info cache_conn_info;
Jeff Johnson41a64962017-08-14 15:29:42 -0700724 struct hdd_roaming_info roam_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800726 int ibss_sta_generation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727 bool ibss_enc_key_installed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800728 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700729 tSirPeerInfoRspParams ibss_peer_info;
Jeff Johnson690fe952017-10-25 11:48:39 -0700730 bool hdd_reassoc_scenario;
Jeff Johnson8380f232017-10-25 12:39:44 -0700731 int sta_debug_state;
Jeff Johnson0a082d92019-03-04 12:25:49 -0800732 uint8_t broadcast_sta_id;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700733 struct hdd_mon_set_ch_info ch_info;
Krunal Soni364e0872017-05-10 21:24:34 -0700734 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800735};
736
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700737/**
738 * enum bss_state - current state of the BSS
739 * @BSS_STOP: BSS is stopped
740 * @BSS_START: BSS is started
741 */
742enum bss_state {
743 BSS_STOP,
744 BSS_START,
745};
746
747/**
748 * struct hdd_hostapd_state - hostapd-related state information
749 * @bss_state: Current state of the BSS
750 * @qdf_event: Event to synchronize actions between hostapd thread and
751 * internal callback threads
752 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS
753 * is issued userspace thread can wait on this event. The event will
754 * be set when the Stop BSS processing in UMAC has completed.
Jeff Johnsonb9424862017-10-30 08:49:35 -0700755 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation.
756 * When a STA is disassociated userspace thread can wait on this
757 * event. The event will be set when the STA Disassociation
758 * processing in UMAC has completed.
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700759 * @qdf_status: Used to communicate state from other threads to the
760 * userspace thread.
761 */
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700762struct hdd_hostapd_state {
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700763 enum bss_state bss_state;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530764 qdf_event_t qdf_event;
765 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800766 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530767 QDF_STATUS qdf_status;
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700768};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800769
wadesong9b819072017-02-07 16:42:09 +0800770/**
771 * enum bss_stop_reason - reasons why a BSS is stopped.
772 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
773 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
774 * driver is trying to switch AP role to a different channel
775 * to maintain SCC mode with the STA role on the same card.
776 * this usually happens when STA is connected to an external
777 * AP that runs on a different channel
hqu73bccf22017-10-28 15:34:17 +0800778 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to
779 * vendor subcmd set sap config channel
wadesong9b819072017-02-07 16:42:09 +0800780 */
781enum bss_stop_reason {
782 BSS_STOP_REASON_INVALID = 0,
783 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
hqu73bccf22017-10-28 15:34:17 +0800784 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2,
wadesong9b819072017-02-07 16:42:09 +0800785};
786
Will Huang496b36c2017-07-11 16:38:50 +0800787/**
788 * struct hdd_rate_info - rate_info in HDD
789 * @rate: tx/rx rate (kbps)
790 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode)
791 * @nss: number of streams
792 * @mcs: mcs index for HT/VHT mode
793 * @rate_flags: rate flags for last tx/rx
794 *
795 * rate info in HDD
796 */
797struct hdd_rate_info {
798 uint32_t rate;
799 uint8_t mode;
800 uint8_t nss;
801 uint8_t mcs;
802 uint8_t rate_flags;
803};
804
805/**
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +0530806 * struct hdd_mic_info - mic error info in HDD
807 * @ta_mac_addr: transmitter mac address
808 * @multicast: Flag for multicast
809 * @key_id: Key ID
810 * @tsc: Sequence number
811 * @vdev_id: vdev id
812 *
813 */
814struct hdd_mic_error_info {
815 struct qdf_mac_addr ta_mac_addr;
816 bool multicast;
817 uint8_t key_id;
818 uint8_t tsc[SIR_CIPHER_SEQ_CTR_SIZE];
819 uint16_t vdev_id;
820};
821
822enum hdd_mic_work_status {
823 MIC_UNINITIALIZED,
824 MIC_INITIALIZED,
825 MIC_SCHEDULED,
826 MIC_DISABLED
827};
828
829/**
830 * struct hdd_mic_work - mic work info in HDD
831 * @mic_error_work: mic error work
832 * @status: sattus of mic error work
833 * @info: Pointer to mic error information
834 * @lock: lock to synchronixe mic error work
835 *
836 */
837struct hdd_mic_work {
838 qdf_work_t work;
839 enum hdd_mic_work_status status;
840 struct hdd_mic_error_info *info;
841 qdf_spinlock_t lock;
842};
843
844/**
Will Huang496b36c2017-07-11 16:38:50 +0800845 * struct hdd_fw_txrx_stats - fw txrx status in HDD
846 * (refer to station_info struct in Kernel)
847 * @tx_packets: packets transmitted to this station
848 * @tx_bytes: bytes transmitted to this station
849 * @rx_packets: packets received from this station
850 * @rx_bytes: bytes received from this station
851 * @rx_retries: cumulative retry counts
852 * @tx_failed: number of failed transmissions
853 * @rssi: The signal strength (dbm)
854 * @tx_rate: last used tx rate info
855 * @rx_rate: last used rx rate info
856 *
857 * fw txrx status in HDD
858 */
859struct hdd_fw_txrx_stats {
860 uint32_t tx_packets;
861 uint64_t tx_bytes;
862 uint32_t rx_packets;
863 uint64_t rx_bytes;
864 uint32_t tx_retries;
865 uint32_t tx_failed;
866 int8_t rssi;
867 struct hdd_rate_info tx_rate;
868 struct hdd_rate_info rx_rate;
869};
870
871/**
Yun Parkc3e35562018-03-08 12:05:52 -0800872 * struct dhcp_phase - Per Peer DHCP Phases
873 * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or
874 * DHCP_DELINE message in OFFER phase
875 * @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
876 * @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
877 * @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or
878 * ACK phase (Renewal process)
879 */
880enum dhcp_phase {
881 DHCP_PHASE_ACK,
882 DHCP_PHASE_DISCOVER,
883 DHCP_PHASE_OFFER,
884 DHCP_PHASE_REQUEST
885};
886
887/**
888 * struct dhcp_nego_status - Per Peer DHCP Negotiation Status
889 * @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated
890 * @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST
891 * (Renewal process) phase
892 */
893enum dhcp_nego_status {
894 DHCP_NEGO_STOP,
895 DHCP_NEGO_IN_PROGRESS
896};
897
898/**
Jeff Johnson82155922017-09-30 16:54:14 -0700899 * struct hdd_station_info - Per station structure kept in HDD for
Will Huang496b36c2017-07-11 16:38:50 +0800900 * multiple station support for SoftAP
Jeff Johnsonb105d052017-10-21 12:07:29 -0700901 * @in_use: Is the station entry in use?
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700902 * @sta_id: Station ID reported back from HAL (through SAP).
Will Huang496b36c2017-07-11 16:38:50 +0800903 * Broadcast uses station ID zero by default.
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700904 * @sta_type: Type of station i.e. p2p client or infrastructure station
Jeff Johnsonf2356512017-10-21 16:04:12 -0700905 * @sta_mac: MAC address of the station
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700906 * @peer_state: Current Station state so HDD knows how to deal with packet
Will Huang496b36c2017-07-11 16:38:50 +0800907 * queue. Most recent states used to change TLSHIM STA state.
Jeff Johnson65fda112017-10-21 13:46:10 -0700908 * @is_qos_enabled: Track QoS status of station
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700909 * @is_deauth_in_progress: The station entry for which Deauth is in progress
Will Huang496b36c2017-07-11 16:38:50 +0800910 * @nss: Number of spatial streams supported
911 * @rate_flags: Rate Flags for this connection
912 * @ecsa_capable: Extended CSA capabilities
913 * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc.
914 * @tx_packets: Packets send to current station
915 * @tx_bytes: Bytes send to current station
916 * @rx_packets: Packets received from current station
917 * @rx_bytes: Bytes received from current station
918 * @last_tx_rx_ts: Last tx/rx timestamp with current station
919 * @assoc_ts: Current station association timestamp
920 * @tx_rate: Tx rate with current station reported from F/W
921 * @rx_rate: Rx rate with current station reported from F/W
922 * @ampdu: Ampdu enable or not of the station
923 * @sgi_enable: Short GI enable or not of the station
924 * @tx_stbc: Tx Space-time block coding enable/disable
925 * @rx_stbc: Rx Space-time block coding enable/disable
926 * @ch_width: Channel Width of the connection
927 * @mode: Mode of the connection
928 * @max_supp_idx: Max supported rate index of the station
929 * @max_ext_idx: Max extended supported rate index of the station
930 * @max_mcs_idx: Max supported mcs index of the station
931 * @rx_mcs_map: VHT Rx mcs map
932 * @tx_mcs_map: VHT Tx mcs map
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530933 * @freq : Frequency of the current station
934 * @dot11_mode: 802.11 Mode of the connection
935 * @ht_present: HT caps present or not in the current station
936 * @vht_present: VHT caps present or not in the current station
937 * @ht_caps: HT capabilities of current station
938 * @vht_caps: VHT capabilities of current station
939 * @reason_code: Disconnection reason code for current station
940 * @rssi: RSSI of the current station reported from F/W
Ashish Kumar Dhanotiyac6171062019-01-22 21:55:01 +0530941 * @capability: Capability information of current station
Ashish Kumar Dhanotiya6025c702019-03-20 18:48:49 +0530942 * @support_mode: Max supported mode of a station currently
943 * connected to sap
Ashish Kumar Dhanotiya9d981692019-02-05 20:57:12 +0530944 * @rx_retry_cnt: Number of rx retries received from current station
945 * Currently this feature is not supported from FW
946 * @rx_mc_bc_cnt: Multicast broadcast packet count received from
947 * current station
948 * MSB of rx_mc_bc_cnt indicates whether FW supports rx_mc_bc_cnt
949 * feature or not, if first bit is 1 it indicates that FW supports this
950 * feature, if it is 0 it indicates FW doesn't support this feature
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800951 */
Jeff Johnson82155922017-09-30 16:54:14 -0700952struct hdd_station_info {
Jeff Johnsonb105d052017-10-21 12:07:29 -0700953 bool in_use;
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700954 uint8_t sta_id;
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700955 eStationType sta_type;
Jeff Johnsonf2356512017-10-21 16:04:12 -0700956 struct qdf_mac_addr sta_mac;
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700957 enum ol_txrx_peer_state peer_state;
Jeff Johnson65fda112017-10-21 13:46:10 -0700958 bool is_qos_enabled;
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700959 bool is_deauth_in_progress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530960 uint8_t nss;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530961 uint32_t rate_flags;
gaolez7bb1e742017-03-21 16:37:38 +0800962 uint8_t ecsa_capable;
Will Huang496b36c2017-07-11 16:38:50 +0800963 uint32_t max_phy_rate;
964 uint32_t tx_packets;
965 uint64_t tx_bytes;
966 uint32_t rx_packets;
967 uint64_t rx_bytes;
968 qdf_time_t last_tx_rx_ts;
969 qdf_time_t assoc_ts;
Ashish Kumar Dhanotiya2ef47902018-10-12 21:13:57 +0530970 qdf_time_t disassoc_ts;
Will Huang496b36c2017-07-11 16:38:50 +0800971 uint32_t tx_rate;
972 uint32_t rx_rate;
973 bool ampdu;
974 bool sgi_enable;
975 bool tx_stbc;
976 bool rx_stbc;
Hanumanth Reddy Pothulaf79fbdf2017-10-23 20:10:46 +0530977 tSirMacHTChannelWidth ch_width;
Will Huang496b36c2017-07-11 16:38:50 +0800978 uint8_t mode;
979 uint8_t max_supp_idx;
980 uint8_t max_ext_idx;
981 uint8_t max_mcs_idx;
982 uint8_t rx_mcs_map;
983 uint8_t tx_mcs_map;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +0530984 uint32_t freq;
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +0530985 uint8_t dot11_mode;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +0530986 bool ht_present;
987 bool vht_present;
988 struct ieee80211_ht_cap ht_caps;
989 struct ieee80211_vht_cap vht_caps;
990 uint32_t reason_code;
991 int8_t rssi;
Yun Parkc3e35562018-03-08 12:05:52 -0800992 enum dhcp_phase dhcp_phase;
993 enum dhcp_nego_status dhcp_nego_status;
Ashish Kumar Dhanotiyac6171062019-01-22 21:55:01 +0530994 uint16_t capability;
Ashish Kumar Dhanotiya6025c702019-03-20 18:48:49 +0530995 uint8_t support_mode;
Ashish Kumar Dhanotiya9d981692019-02-05 20:57:12 +0530996 uint32_t rx_retry_cnt;
997 uint32_t rx_mc_bc_cnt;
Jeff Johnson82155922017-09-30 16:54:14 -0700998};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800999
Jeff Johnsonf283c972017-10-26 12:30:49 -07001000/**
1001 * struct hdd_ap_ctx - SAP/P2PGO specific information
1002 * @hostapd_state: state control information
Jeff Johnson01206862017-10-27 20:55:59 -07001003 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC?
Jeff Johnson136c51b2017-10-27 20:02:41 -07001004 * @ap_active: Are any stations active?
Jeff Johnson82ceb082017-10-27 14:52:42 -07001005 * @disable_intrabss_fwd: Prevent forwarding between stations
Jeff Johnson42518cf2017-10-26 13:33:29 -07001006 * @broadcast_sta_id: Station ID assigned after BSS starts
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001007 * @privacy: The privacy bits of configuration
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001008 * @encryption_type: The encryption being used
Jeff Johnson413c15f2017-10-27 18:56:35 -07001009 * @group_key: Group Encryption Key
Jeff Johnson3d731362017-10-27 19:06:41 -07001010 * @wep_key: WEP key array
1011 * @wep_def_key_idx: WEP default key index
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001012 * @sap_context: Pointer to context maintained by SAP (opaque to HDD)
Jeff Johnson91df29d2017-10-27 19:29:50 -07001013 * @sap_config: SAP configuration
Jeff Johnson01206862017-10-27 20:55:59 -07001014 * @operating_channel: channel upon which the SAP is operating
1015 * @beacon: Beacon information
1016 * @vendor_acs_timer: Timer for ACS
1017 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
1018 * @bss_stop_reason: Reason why the BSS was stopped
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301019 * @acs_in_progress: In progress acs flag for an adapter
Jeff Johnsonf283c972017-10-26 12:30:49 -07001020 */
Jeff Johnsone962b192017-08-11 15:37:08 -07001021struct hdd_ap_ctx {
Jeff Johnsonf283c972017-10-26 12:30:49 -07001022 struct hdd_hostapd_state hostapd_state;
Jeff Johnson01206862017-10-27 20:55:59 -07001023 bool dfs_cac_block_tx;
Jeff Johnson136c51b2017-10-27 20:02:41 -07001024 bool ap_active;
Jeff Johnson82ceb082017-10-27 14:52:42 -07001025 bool disable_intrabss_fwd;
Jeff Johnson42518cf2017-10-26 13:33:29 -07001026 uint8_t broadcast_sta_id;
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001027 uint8_t privacy;
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001028 eCsrEncryptionType encryption_type;
Jeff Johnson413c15f2017-10-27 18:56:35 -07001029 tCsrRoamSetKey group_key;
Jeff Johnson3d731362017-10-27 19:06:41 -07001030 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY];
1031 uint8_t wep_def_key_idx;
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001032 struct sap_context *sap_context;
Jeff Johnson8f8ceb92019-03-24 08:16:55 -07001033 struct sap_config sap_config;
Jeff Johnson01206862017-10-27 20:55:59 -07001034 uint8_t operating_channel;
1035 struct hdd_beacon_data *beacon;
1036 qdf_mc_timer_t vendor_acs_timer;
1037 bool vendor_acs_timer_initialized;
1038 enum bss_stop_reason bss_stop_reason;
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301039 qdf_atomic_t acs_in_progress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001040};
1041
Jeff Johnson37588942017-08-15 16:11:41 -07001042/**
1043 * struct hdd_scan_info - Per-adapter scan information
Jeff Johnson37fa0402017-10-28 12:42:29 -07001044 * @scan_add_ie: Additional IE for scan
Jeff Johnson37588942017-08-15 16:11:41 -07001045 * @default_scan_ies: Default scan IEs
1046 * @default_scan_ies_len: Length of @default_scan_ies
1047 * @scan_mode: Scan mode
Jeff Johnson37588942017-08-15 16:11:41 -07001048 */
1049struct hdd_scan_info {
Jeff Johnson37fa0402017-10-28 12:42:29 -07001050 tSirAddie scan_add_ie;
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +05301051 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +05301052 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001053 tSirScanType scan_mode;
Jeff Johnson37588942017-08-15 16:11:41 -07001054};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001055
Dustin Brown61269462016-09-19 13:25:45 -07001056#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001057
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001058struct hdd_multicast_addr_list {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001059 uint8_t mc_cnt;
1060 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001061};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001062
Mohit Khannaf7e7b342019-04-08 11:54:21 -07001063#define WLAN_HDD_MAX_HISTORY_ENTRY 25
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001064
1065/**
1066 * struct hdd_netif_queue_stats - netif queue operation statistics
1067 * @pause_count - pause counter
1068 * @unpause_count - unpause counter
1069 */
1070struct hdd_netif_queue_stats {
Mohit Khannaca4173b2017-09-12 21:52:19 -07001071 u32 pause_count;
1072 u32 unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +05301073 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001074};
1075
1076/**
1077 * struct hdd_netif_queue_history - netif queue operation history
1078 * @time: timestamp
1079 * @netif_action: action type
1080 * @netif_reason: reason type
1081 * @pause_map: pause map
Mohit Khannaf7e7b342019-04-08 11:54:21 -07001082 * @tx_q_state: state of the netdev TX queues
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001083 */
1084struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +05301085 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001086 uint16_t netif_action;
1087 uint16_t netif_reason;
1088 uint32_t pause_map;
Mohit Khannaf7e7b342019-04-08 11:54:21 -07001089 unsigned long tx_q_state[NUM_TX_QUEUES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001090};
1091
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301092/**
1093 * struct hdd_chan_change_params - channel related information
Paul Zhang427962d2019-07-25 15:22:55 +08001094 * @chan_freq: operating channel frequency
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301095 * @chan_params: channel parameters
1096 */
1097struct hdd_chan_change_params {
Paul Zhang427962d2019-07-25 15:22:55 +08001098 uint32_t chan_freq;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001099 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301100};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001101
Komal Seelama89be8d2016-09-29 11:09:26 +05301102/**
Komal Seelam8634b772016-09-29 12:12:24 +05301103 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
Jeff Johnsonb9424862017-10-30 08:49:35 -07001104 * @dfs: dfs context to prevent/allow runtime pm
Jingxiang Geb49aa302018-01-17 20:54:15 +08001105 * @connect: connect context to prevent/allow runtime pm
Komal Seelam8634b772016-09-29 12:12:24 +05301106 *
Jeff Johnsonb9424862017-10-30 08:49:35 -07001107 * Runtime PM control for underlying activities
Komal Seelam8634b772016-09-29 12:12:24 +05301108 */
1109struct hdd_runtime_pm_context {
Komal Seelam81cb1662016-09-29 12:39:08 +05301110 qdf_runtime_lock_t dfs;
Jingxiang Geb49aa302018-01-17 20:54:15 +08001111 qdf_runtime_lock_t connect;
Komal Seelam8634b772016-09-29 12:12:24 +05301112};
1113
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301114/*
1115 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
1116 * belonging to this driver from net devices belonging to other devices.
1117 * Therefore, the magic number must be unique relative to the numbers for
1118 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
1119 * (e.g. by compiler argument), then use that. If it's not already defined,
1120 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
1121 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
1122 */
1123#ifndef WLAN_HDD_ADAPTER_MAGIC
1124#ifdef MULTI_IF_NAME
1125#define WLAN_HDD_ADAPTER_MAGIC \
1126 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
1127 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
1128 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
1129 (MULTI_IF_NAME[1] << 16) : \
1130 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
1131 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
1132#else
Komal Seelama89be8d2016-09-29 11:09:26 +05301133#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301134#endif
1135#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001136
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301137/**
1138 * struct rcpi_info - rcpi info
1139 * @rcpi: computed value in dB
1140 * @mac_addr: peer mac addr for which rcpi is computed
1141 */
1142struct rcpi_info {
1143 int32_t rcpi;
1144 struct qdf_mac_addr mac_addr;
1145};
1146
Jeff Johnsondba0db62017-08-30 11:12:39 -07001147struct hdd_context;
1148
Dustin Brown20f9fc42018-08-30 15:19:12 -07001149/**
1150 * struct hdd_adapter - hdd vdev/net_device context
Dustin Brown89fa06e2018-09-07 10:47:27 -07001151 * @vdev: object manager vdev context
Min Liu8c5d99e2018-09-10 17:18:44 +08001152 * @vdev_lock: lock to protect vdev context access
Jeff Johnson19f4af52019-02-01 12:51:01 -08001153 * @vdev_id: Unique identifier assigned to the vdev
Dustin Brown20f9fc42018-08-30 15:19:12 -07001154 * @event_flags: a bitmap of hdd_adapter_flags
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301155 * @mic_work: mic work information
Subrat Dashb1e61b22019-07-22 14:09:34 +05301156 * @gpio_tsf_sync_work: work to sync send TSF CAP WMI command
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301157 *
Dustin Brown20f9fc42018-08-30 15:19:12 -07001158 */
Jeff Johnson85b5c112017-08-11 15:15:23 -07001159struct hdd_adapter {
Jeff Johnsond399e902015-12-17 15:17:02 -08001160 /* Magic cookie for adapter sanity verification. Note that this
1161 * needs to be at the beginning of the private data structure so
Jeff Johnsonb9424862017-10-30 08:49:35 -07001162 * that it will exist at the beginning of dev->priv and hence
Jeff Johnsond399e902015-12-17 15:17:02 -08001163 * will always be in mapped memory
1164 */
1165 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001166
Dustin Brown920397d2017-12-13 16:27:50 -08001167 /* list node for membership in the adapter list */
1168 qdf_list_node_t node;
1169
Jeff Johnsondba0db62017-08-30 11:12:39 -07001170 struct hdd_context *hdd_ctx;
Dustin Brown89fa06e2018-09-07 10:47:27 -07001171 struct wlan_objmgr_vdev *vdev;
Min Liu8c5d99e2018-09-10 17:18:44 +08001172 qdf_spinlock_t vdev_lock;
Jeff Johnson19f4af52019-02-01 12:51:01 -08001173 uint8_t vdev_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001174
hqu28f68df2019-07-02 23:10:08 +08001175 struct cdp_vdev *txrx_vdev;
Leo Changfdb45c32016-10-28 11:09:23 -07001176
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001177 /** Handle to the network device */
1178 struct net_device *dev;
1179
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001180 enum QDF_OPMODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -08001181
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001182 /** IPv4 notifier callback for handling ARP offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001183 struct work_struct ipv4_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001184#ifdef WLAN_NS_OFFLOAD
1185 /** IPv6 notifier callback for handling NS offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001186 struct work_struct ipv6_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001187#endif
1188
1189 /* TODO Move this to sta Ctx */
1190 struct wireless_dev wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001191
1192 /** ops checks if Opportunistic Power Save is Enable or Not
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07001193 * ctw stores CT Window value once we receive Opps command from
1194 * wpa_supplicant then using CT Window value we need to Enable
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001195 * Opportunistic Power Save
1196 */
1197 uint8_t ops;
1198 uint32_t ctw;
1199
1200 /** Current MAC Address for the adapter */
Jeff Johnson1e851a12017-10-28 14:36:12 -07001201 struct qdf_mac_addr mac_addr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001202
Alok Kumarb64650c2018-03-23 17:05:11 +05301203#ifdef WLAN_NUD_TRACKING
1204 struct hdd_nud_tracking_info nud_tracking;
1205#endif
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301206
1207 struct hdd_mic_work mic_work;
Alok Kumarb64650c2018-03-23 17:05:11 +05301208 bool disconnection_in_progress;
1209 qdf_mutex_t disconnection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001210 unsigned long event_flags;
1211
1212 /**Device TX/RX statistics*/
1213 struct net_device_stats stats;
1214 /** HDD statistics*/
Jeff Johnson07f94742017-08-14 15:55:40 -07001215 struct hdd_stats hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -08001216
1217 /* estimated link speed */
1218 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001219
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301220 /* QDF event for session close */
1221 qdf_event_t qdf_session_close_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001222
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301223 /* QDF event for session open */
1224 qdf_event_t qdf_session_open_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001225
1226 /* TODO: move these to sta ctx. These may not be used in AP */
1227 /** completion variable for disconnect callback */
1228 struct completion disconnect_comp_var;
1229
Abhishek Singh533c9da2017-05-04 10:23:34 +05301230 struct completion roaming_comp_var;
1231
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001232 /* completion variable for Linkup Event */
1233 struct completion linkup_event_var;
1234
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001235 /* completion variable for off channel remain on channel Event */
1236 struct completion offchannel_tx_event;
1237 /* Completion variable for action frame */
1238 struct completion tx_action_cnf_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001239
1240 struct completion sta_authorized_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001241
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001242 struct completion ibss_peer_info_comp;
1243
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001244 /* Track whether the linkup handling is needed */
Jeff Johnsonc72c5732017-10-28 12:49:37 -07001245 bool is_link_up_service_needed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001246
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001247 /* WMM Status */
Jeff Johnson02d14ce2017-10-31 09:08:30 -07001248 struct hdd_wmm_status hdd_wmm_status;
Jeff Johnson18e86622017-10-28 12:55:36 -07001249
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001250 /** Multiple station supports */
1251 /** Per-station structure */
Jeff Johnsonbb8b56a2017-10-23 07:02:36 -07001252 spinlock_t sta_info_lock; /* To protect access to station Info */
1253 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT];
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301254 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001255
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001256
1257#ifdef FEATURE_WLAN_WAPI
Jeff Johnson89798aa2017-08-16 11:00:56 -07001258 struct hdd_wapi_info wapi_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001259#endif
1260
1261 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301262 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001263#ifdef WLAN_FEATURE_LPSS
1264 bool rssi_send;
1265#endif
1266
1267 uint8_t snr;
1268
Krunal Soni22208392017-09-29 18:10:34 -07001269 struct work_struct sap_stop_bss_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001270
1271 union {
Jeff Johnson40dae4e2017-08-29 14:00:25 -07001272 struct hdd_station_ctx station;
Jeff Johnson87251032017-08-29 13:31:11 -07001273 struct hdd_ap_ctx ap;
Jeff Johnsonb9424862017-10-30 08:49:35 -07001274 } session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001275
Abhinav Kumar338e57d2019-02-04 17:30:10 +05301276 qdf_atomic_t ch_switch_in_progress;
Min Liu2fef5792018-01-19 17:59:42 +08001277
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001278#ifdef WLAN_FEATURE_TSF
1279 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001280 uint64_t cur_target_time;
yuanl69575bb2019-01-24 19:16:28 +08001281 uint64_t cur_tsf_sync_soc_time;
1282 uint64_t last_tsf_sync_soc_time;
Jiani Liua8fd1702019-05-01 10:07:10 +08001283 uint64_t cur_target_global_tsf_time;
1284 uint64_t last_target_global_tsf_time;
yuanl2746f072018-09-21 19:19:16 +08001285 qdf_mc_timer_t host_capture_req_timer;
Yu Wang000dc2f2017-05-26 17:38:48 +08001286#ifdef WLAN_FEATURE_TSF_PLUS
1287 /* spin lock for read/write timestamps */
1288 qdf_spinlock_t host_target_sync_lock;
1289 qdf_mc_timer_t host_target_sync_timer;
1290 uint64_t cur_host_time;
1291 uint64_t last_host_time;
1292 uint64_t last_target_time;
1293 /* to store the count of continuous invalid tstamp-pair */
1294 int continuous_error_count;
1295 /* to indicate whether tsf_sync has been initialized */
1296 qdf_atomic_t tsf_sync_ready_flag;
Subrat Dashb1e61b22019-07-22 14:09:34 +05301297#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
1298 qdf_work_t gpio_tsf_sync_work;
1299#endif
Yu Wang000dc2f2017-05-26 17:38:48 +08001300#endif /* WLAN_FEATURE_TSF_PLUS */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001301#endif
1302
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001303 struct hdd_multicast_addr_list mc_addr_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001304 uint8_t addr_filter_pattern;
1305
Jeff Johnson37588942017-08-15 16:11:41 -07001306 struct hdd_scan_info scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001307
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001308 /* Flag to ensure PSB is configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001309 uint8_t psb_changed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001310 /* UAPSD psb value configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001311 uint8_t configured_psb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001312 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1313 * since CSR (PMAC Struct) Config is same for both AP
1314 */
1315 struct delayed_work acs_pending_work;
1316
1317 struct work_struct scan_block_work;
Min Liu9be5d4a2018-05-17 11:51:53 +08001318 qdf_list_t blocked_scan_request_q;
1319 qdf_mutex_t blocked_scan_request_q_lock;
Tiger Yu8b119e92019-04-09 13:55:07 +08001320
1321#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001322 unsigned long prev_rx_packets;
1323 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301324 uint64_t prev_fwd_tx_packets;
1325 uint64_t prev_fwd_rx_packets;
Tiger Yu8b119e92019-04-09 13:55:07 +08001326#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
1327
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301328#if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
1329 defined(QCA_HL_NETDEV_FLOW_CONTROL)
Anurag Chouhan210db072016-02-22 18:42:15 +05301330 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001331 bool tx_flow_timer_initialized;
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301332#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL || QCA_HL_NETDEV_FLOW_CONTROL */
1333#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001334 unsigned int tx_flow_low_watermark;
jitiphil869b9f72018-09-25 17:14:01 +05301335 unsigned int tx_flow_hi_watermark_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001336#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301337
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001338 bool offloads_configured;
1339
1340 /* DSCP to UP QoS Mapping */
Jeff Johnson6b51b6a2017-11-02 20:31:25 -07001341 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342
1343#ifdef WLAN_FEATURE_LINK_LAYER_STATS
Jeff Johnsond30ee4b2017-10-28 15:38:32 -07001344 bool is_link_layer_stats_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001345#endif
Jeff Johnsonbd4c4f02017-10-30 20:33:01 -07001346 uint8_t link_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001347
1348 /* variable for temperature in Celsius */
1349 int temperature;
1350
Agrawal Ashishb141b092016-09-02 19:59:26 +05301351#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001352 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301353 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001354 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301355#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001356
1357 /* BITMAP indicating pause reason */
1358 uint32_t pause_map;
1359 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301360 qdf_time_t start_time;
1361 qdf_time_t last_time;
1362 qdf_time_t total_pause_time;
1363 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001364 uint8_t history_index;
1365 struct hdd_netif_queue_history
1366 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1367 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001368 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001369 /* debugfs entry */
1370 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301371 /*
Paul Zhang9d117c82019-07-25 15:55:11 +08001372 * The pre cac channel frequency is saved here and will be used when
1373 * the SAP's channel needs to be moved from the existing 2.4GHz channel.
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301374 */
Paul Zhang9d117c82019-07-25 15:55:11 +08001375 uint32_t pre_cac_freq;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001376
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001377 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301378 * Indicate if HO fails during disconnect so that
1379 * disconnect is not initiated by HDD as its already
1380 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001381 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301382 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301383 struct lfr_firmware_status lfr_fw_status;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301384 bool con_status;
1385 bool dad;
Ganesh Kondabattini1a2aed82017-09-28 12:21:58 +05301386 uint8_t active_ac;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +05301387 uint32_t pkt_type_bitmap;
1388 uint32_t track_arp_ip;
1389 uint8_t dns_payload[256];
1390 uint32_t track_dns_domain_len;
1391 uint32_t track_src_port;
1392 uint32_t track_dest_port;
1393 uint32_t track_dest_ipv4;
Paul Zhang9d117c82019-07-25 15:55:11 +08001394 uint32_t mon_chan_freq;
Arunk Khandavalli062fb032017-10-04 12:18:15 +05301395 uint32_t mon_bandwidth;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301396
1397 /* rcpi information */
1398 struct rcpi_info rcpi;
Yeshwanth Sriram Guntuka4fe30bd2018-06-13 11:41:42 +05301399 bool send_mode_change;
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301400#ifdef FEATURE_WLAN_APF
1401 struct hdd_apf_context apf_context;
1402#endif /* FEATURE_WLAN_APF */
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +05301403
1404#ifdef WLAN_DEBUGFS
1405 struct hdd_debugfs_file_info csr_file[HDD_DEBUGFS_FILE_ID_MAX];
1406#endif /* WLAN_DEBUGFS */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301407
1408#ifdef WLAN_FEATURE_MOTION_DETECTION
1409 bool motion_detection_mode;
1410#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001411};
1412
Jeff Johnsonb9424862017-10-30 08:49:35 -07001413#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
1414#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
Jeff Johnsondba0db62017-08-30 11:12:39 -07001415#define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001416#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001417 (&(adapter)->session.ap.hostapd_state)
1418#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001419
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +05301420#ifdef WLAN_FEATURE_NAN
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001421#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001422#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001423/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1424 * intentionally so that all references to these must be within NDP code.
1425 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1426 * invoke NDP code to do all work.
1427 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001428#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001429#endif
1430
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001431/* Set mac address locally administered bit */
1432#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1433
1434#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1435#define HDD_RESET_MCC_P2P_QUOTA 50
1436
Jeff Johnson353cd292017-08-17 06:47:26 -07001437/*
1438 * struct hdd_priv_data - driver ioctl private data payload
1439 * @buf: pointer to command buffer (may be in userspace)
1440 * @used_len: length of the command/data currently in @buf
1441 * @total_len: total length of the @buf memory allocation
1442 */
1443struct hdd_priv_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001444 uint8_t *buf;
1445 int used_len;
1446 int total_len;
Jeff Johnson353cd292017-08-17 06:47:26 -07001447};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001448
1449#define MAX_MOD_LOGLEVEL 10
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001450struct fw_log_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451 uint8_t enable;
1452 uint8_t dl_type;
1453 uint8_t dl_report;
1454 uint8_t dl_loglevel;
1455 uint8_t index;
1456 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1457
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001458};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001459
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001460/**
1461 * enum antenna_mode - number of TX/RX chains
1462 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1463 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1464 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1465 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1466 */
1467enum antenna_mode {
1468 HDD_ANTENNA_MODE_INVALID,
1469 HDD_ANTENNA_MODE_1X1,
1470 HDD_ANTENNA_MODE_2X2,
1471 HDD_ANTENNA_MODE_MAX
1472};
1473
1474/**
1475 * enum smps_mode - SM power save mode
1476 * @HDD_SMPS_MODE_STATIC: Static power save
1477 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1478 * @HDD_SMPS_MODE_RESERVED: Reserved
1479 * @HDD_SMPS_MODE_DISABLED: Disable power save
1480 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1481 */
1482enum smps_mode {
1483 HDD_SMPS_MODE_STATIC,
1484 HDD_SMPS_MODE_DYNAMIC,
1485 HDD_SMPS_MODE_RESERVED,
1486 HDD_SMPS_MODE_DISABLED,
1487 HDD_SMPS_MODE_MAX
1488};
1489
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001490#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1491/**
1492 * struct hdd_offloaded_packets - request id to pattern id mapping
1493 * @request_id: request id
1494 * @pattern_id: pattern id
1495 *
1496 */
1497struct hdd_offloaded_packets {
1498 uint32_t request_id;
1499 uint8_t pattern_id;
1500};
1501
1502/**
1503 * struct hdd_offloaded_packets_ctx - offloaded packets context
1504 * @op_table: request id to pattern id table
1505 * @op_lock: mutex lock
1506 */
1507struct hdd_offloaded_packets_ctx {
1508 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1509 struct mutex op_lock;
1510};
1511#endif
1512
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301513/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301514 * enum driver_status: Driver Modules status
1515 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
Arun Khandavallifae92942016-08-01 13:31:08 +05301516 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1517 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1518 */
1519enum driver_modules_status {
1520 DRIVER_MODULES_UNINITIALIZED,
Arun Khandavallifae92942016-08-01 13:31:08 +05301521 DRIVER_MODULES_ENABLED,
1522 DRIVER_MODULES_CLOSED
1523};
1524
Agrawal Ashish65634612016-08-18 13:24:32 +05301525/**
1526 * struct acs_dfs_policy - Define ACS policies
1527 * @acs_dfs_mode: Dfs mode enabled/disabled.
1528 * @acs_channel: pre defined channel to avoid ACS.
1529 */
1530struct acs_dfs_policy {
1531 enum dfs_mode acs_dfs_mode;
1532 uint8_t acs_channel;
1533};
1534
Dustin Brown105d7902016-10-03 16:27:59 -07001535/**
1536 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1537 * SUSPEND_FAIL_IPA: IPA in progress
1538 * SUSPEND_FAIL_RADAR: radar scan in progress
1539 * SUSPEND_FAIL_ROAM: roaming in progress
1540 * SUSPEND_FAIL_SCAN: scan in progress
1541 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1542 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1543 */
1544enum suspend_fail_reason {
1545 SUSPEND_FAIL_IPA,
1546 SUSPEND_FAIL_RADAR,
1547 SUSPEND_FAIL_ROAM,
1548 SUSPEND_FAIL_SCAN,
1549 SUSPEND_FAIL_INITIAL_WAKEUP,
1550 SUSPEND_FAIL_MAX_COUNT
1551};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001552
Dustin Brownd9322482017-01-09 12:46:03 -08001553/**
1554 * suspend_resume_stats - Collection of counters for suspend/resume events
1555 * @suspends: number of suspends completed
1556 * @resumes: number of resumes completed
1557 * @suspend_fail: counters for failed suspend reasons
1558 */
1559struct suspend_resume_stats {
1560 uint32_t suspends;
1561 uint32_t resumes;
1562 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1563};
1564
Ashish Kumar Dhanotiyab28338c2017-07-21 20:12:34 +05301565/**
1566 * hdd_sta_smps_param - SMPS parameters to configure from hdd
1567 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS
1568 * mode from inactive mode
1569 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter
1570 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from
1571 * Stalled-D-SMPS mode
1572 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes
1573 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI.
1574 * Used to reduce RX chainmask.
1575 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI.
1576 * Used to increase RX chainmask.
1577 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature
1578 */
1579enum hdd_sta_smps_param {
1580 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0,
1581 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1,
1582 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2,
1583 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3,
1584 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4,
1585 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
1586};
1587
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301588/**
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001589 * enum RX_OFFLOAD - Receive offload modes
1590 * @CFG_LRO_ENABLED: Large Rx offload
1591 * @CFG_GRO_ENABLED: Generic Rx Offload
1592 */
1593enum RX_OFFLOAD {
1594 CFG_LRO_ENABLED = 1,
1595 CFG_GRO_ENABLED,
1596};
1597
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001598/* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1599 * 1 for WDS_STAID
1600 */
1601#define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2)
1602
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301603#ifdef DISABLE_CHANNEL_LIST
1604
1605/**
1606 * struct hdd_cache_channel_info - Structure of the channel info
1607 * which needs to be cached
1608 * @channel_num: channel number
1609 * @reg_status: Current regulatory status of the channel
1610 * Enable
1611 * Disable
1612 * DFS
1613 * Invalid
1614 * @wiphy_status: Current wiphy status
1615 */
1616struct hdd_cache_channel_info {
1617 uint32_t channel_num;
1618 enum channel_state reg_status;
1619 uint32_t wiphy_status;
1620};
1621
1622/**
1623 * struct hdd_cache_channels - Structure of the channels to be cached
1624 * @num_channels: Number of channels to be cached
1625 * @channel_info: Structure of the channel info
1626 */
1627struct hdd_cache_channels {
1628 uint32_t num_channels;
1629 struct hdd_cache_channel_info *channel_info;
1630};
1631#endif
1632
Dustin Brown20f9fc42018-08-30 15:19:12 -07001633/**
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301634 * struct hdd_dynamic_mac - hdd structure to handle dynamic mac address changes
1635 * @dynamic_mac: Dynamicaly configured mac, this contains the mac on which
1636 * current interface is up
1637 * @is_provisioned_mac: is this mac from provisioned list
1638 * @bit_position: holds the bit mask position from where this mac is assigned,
1639 * if mac is assigned from provisioned this field contains the position from
1640 * provisioned_intf_addr_mask else contains the position from
1641 * derived_intf_addr_mask
1642 */
1643struct hdd_dynamic_mac {
1644 struct qdf_mac_addr dynamic_mac;
1645 bool is_provisioned_mac;
1646 uint8_t bit_position;
1647};
1648
1649/**
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05301650 * hdd_fw_ver_info - FW version info structure
1651 * @major_spid: FW version - major spid.
1652 * @minor_spid: FW version - minor spid
1653 * @siid: FW version - siid
1654 * @sub_id: FW version - sub id
1655 * @rel_id: FW version - release id
1656 * @crmid: FW version - crmid
1657 */
1658
1659struct hdd_fw_ver_info {
1660 uint32_t major_spid;
1661 uint32_t minor_spid;
1662 uint32_t siid;
1663 uint32_t sub_id;
1664 uint32_t rel_id;
1665 uint32_t crmid;
1666};
1667
1668/**
Dustin Brown20f9fc42018-08-30 15:19:12 -07001669 * struct hdd_context - hdd shared driver and psoc/device context
Dustin Brown76cd2932018-09-11 16:03:05 -07001670 * @psoc: object manager psoc context
Dustin Brown07901ec2018-09-07 11:02:41 -07001671 * @pdev: object manager pdev context
gaurank kathpaliaccfca4a2019-08-13 11:51:27 +05301672 * @iftype_data_2g: Interface data for 2g band
1673 * @iftype_data_5g: Interface data for 5g band
Dustin Browna20bad52019-03-05 12:03:30 -08001674 * @bus_bw_work: work for periodically computing DDR bus bandwidth requirements
Dustin Brown20f9fc42018-08-30 15:19:12 -07001675 * @g_event_flags: a bitmap of hdd_driver_flags
Dustin Brown4c663222018-10-23 14:19:36 -07001676 * @psoc_idle_timeout_work: delayed work for psoc idle shutdown
gaurank kathpalia5fcefa92018-10-24 15:03:15 +05301677 * @dynamic_nss_chains_support: Per vdev dynamic nss chains update capability
Sourav Mohapatra9036f652019-04-02 15:02:59 +05301678 * @sar_cmd_params: SAR command params to be configured to the FW
Dustin Brown20f9fc42018-08-30 15:19:12 -07001679 */
Jeff Johnson82797b62017-08-11 15:31:27 -07001680struct hdd_context {
Dustin Brown05d81302018-09-11 16:49:22 -07001681 struct wlan_objmgr_psoc *psoc;
Dustin Brown07901ec2018-09-07 11:02:41 -07001682 struct wlan_objmgr_pdev *pdev;
Jeff Johnson16528362018-06-14 12:34:16 -07001683 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001684 struct wiphy *wiphy;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301685 qdf_spinlock_t hdd_adapter_lock;
Jeff Johnson19fc8e42017-10-30 19:53:49 -07001686 qdf_list_t hdd_adapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001687
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001688 /** Pointer for firmware image data */
1689 const struct firmware *fw;
1690
1691 /** Pointer for configuration data */
1692 const struct firmware *cfg;
1693
1694 /** Pointer to the parent device */
1695 struct device *parent_dev;
1696
1697 /** Config values read from qcom_cfg.ini file */
1698 struct hdd_config *config;
1699
Qun Zhang043635a2019-02-27 15:19:29 +08001700 /* Pointer for wiphy 2G/5G band channels */
1701 struct ieee80211_channel *channels_2ghz;
1702 struct ieee80211_channel *channels_5ghz;
1703
gaurank kathpaliaccfca4a2019-08-13 11:51:27 +05301704#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
1705 struct ieee80211_sband_iftype_data *iftype_data_2g;
1706 struct ieee80211_sband_iftype_data *iftype_data_5g;
1707#endif
1708
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001709 /* Completion variable to indicate Mc Thread Suspended */
1710 struct completion mc_sus_event_var;
1711
Rajeev Kumareada0d02016-12-08 17:44:17 -08001712 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713
1714#ifdef QCA_CONFIG_SMP
1715 bool is_ol_rx_thread_suspended;
1716#endif
1717
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001718 bool hdd_wlan_suspended;
1719 bool suspended;
Poddar, Siddarth61fbc932017-12-19 14:27:55 +05301720 /* flag to start pktlog after SSR/PDR if previously enabled */
1721 bool is_pktlog_enabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722
1723 /* Lock to avoid race condition during start/stop bss */
1724 struct mutex sap_lock;
1725
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001726#ifdef FEATURE_OEM_DATA_SUPPORT
1727 /* OEM App registered or not */
1728 bool oem_app_registered;
1729
1730 /* OEM App Process ID */
1731 int32_t oem_pid;
1732#endif
1733
1734 /** Concurrency Parameters*/
1735 uint32_t concurrency_mode;
1736
Anurag Chouhan6d760662016-02-20 16:05:43 +05301737 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1738 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001739
1740 /** P2P Device MAC Address for the adapter */
Jeff Johnsonacbdb1c2017-11-02 20:42:02 -07001741 struct qdf_mac_addr p2p_device_address;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001742
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301743 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301744 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001745
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001746 /* Flag keeps track of wiphy suspend/resume */
Jeff Johnson214671b2017-10-30 19:45:23 -07001747 bool is_wiphy_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001748
Tiger Yu8b119e92019-04-09 13:55:07 +08001749#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Browna20bad52019-03-05 12:03:30 -08001750 struct qdf_periodic_work bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001751 int cur_vote_level;
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05301752 qdf_spinlock_t bus_bw_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001753 int cur_rx_level;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001754 uint64_t prev_no_rx_offload_pkts;
1755 uint64_t prev_rx_offload_pkts;
Mohit Khannae71e2262015-11-10 09:37:24 -08001756 int cur_tx_level;
1757 uint64_t prev_tx;
Jinwei Chen0dc383e2019-08-23 00:43:04 +08001758 qdf_atomic_t low_tput_gro_enable;
1759 uint32_t bus_low_vote_cnt;
Tiger Yu8b119e92019-04-09 13:55:07 +08001760#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001761
1762 struct completion ready_to_suspend;
1763 /* defining the solution type */
1764 uint32_t target_type;
1765
1766 /* defining the firmware version */
1767 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001768 uint32_t target_fw_vers_ext;
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05301769 struct hdd_fw_ver_info fw_version_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001770
1771 /* defining the chip/rom version */
1772 uint32_t target_hw_version;
1773 /* defining the chip/rom revision */
1774 uint32_t target_hw_revision;
1775 /* chip/rom name */
Dustin Brown6f17a022017-07-19 13:40:55 -07001776 char *target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001777 struct regulatory reg;
1778#ifdef FEATURE_WLAN_CH_AVOID
1779 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001780 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001781#endif /* FEATURE_WLAN_CH_AVOID */
1782
1783 uint8_t max_intf_count;
1784 uint8_t current_intf_count;
1785#ifdef WLAN_FEATURE_LPSS
1786 uint8_t lpss_support;
1787#endif
1788 uint8_t ap_arpns_support;
1789 tSirScanType ioctl_scan_mode;
1790
1791#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301792 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001793#endif
1794
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001795 uint8_t dev_dfs_cac_status;
1796
Jeff Johnson59b19312017-11-02 21:14:33 -07001797 bool bt_coex_mode_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001798#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301799 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001800 uint8_t skip_acs_scan_status;
Min Liu00956e82019-07-26 14:49:30 +08001801 uint32_t *last_acs_freq_list;
Liangwei Dongaef84342016-10-21 05:28:00 -04001802 uint8_t num_of_channels;
1803 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001804#endif
1805
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301806 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001807 atomic_t sap_dfs_ref_cnt;
1808
1809#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1810 bool is_extwow_app_type1_param_set;
1811 bool is_extwow_app_type2_param_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001812#endif
1813
1814 /* Time since boot up to extscan start (in micro seconds) */
1815 uint64_t ext_scan_start_since_boot;
1816 unsigned long g_event_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001817 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301818
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001819#ifdef WLAN_NS_OFFLOAD
1820 /* IPv6 notifier callback for handling NS offload on change in IP */
1821 struct notifier_block ipv6_notifier;
1822#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301823 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001824 /* IPv4 notifier callback for handling ARP offload on change in IP */
1825 struct notifier_block ipv4_notifier;
1826
1827 /* number of rf chains supported by target */
1828 uint32_t num_rf_chains;
1829 /* Is htTxSTBC supported by target */
1830 uint8_t ht_tx_stbc_supported;
1831#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1832 struct hdd_offloaded_packets_ctx op_ctx;
1833#endif
1834 bool mcc_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001835 struct mutex memdump_lock;
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301836 uint16_t driver_dump_size;
1837 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001838
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001839 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301840 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001841
1842 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301843 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001844
Krunal Sonie3531942016-04-12 17:43:53 -07001845 /*
1846 * place to store FTM capab of target. This allows changing of FTM capab
1847 * at runtime and intersecting it with target capab before updating.
1848 */
1849 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001850 uint32_t rx_high_ind_cnt;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001851 /* For Rx thread non GRO/LRO packet accounting */
1852 uint64_t no_rx_offload_pkt_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001853 /* Current number of TX X RX chains being used */
1854 enum antenna_mode current_antenna_mode;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001855
1856 /* the radio index assigned by cnss_logger */
1857 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301858 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301859 bool hbw_requested;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001860 enum RX_OFFLOAD ol_enable;
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +05301861#ifdef WLAN_FEATURE_NAN
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001862 bool nan_datapath_enabled;
1863#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301864 /* Present state of driver cds modules */
1865 enum driver_modules_status driver_status;
Dustin Brown8d8ab302019-03-05 16:19:36 -08001866 struct qdf_delayed_work psoc_idle_timeout_work;
Nirav Shahbd36b062016-07-18 11:12:59 +05301867 bool rps;
Tang Yingying5a4ccf22018-03-30 15:58:27 +08001868 bool dynamic_rps;
Jeff Johnsone2ba3cd2017-10-30 20:02:09 -07001869 bool enable_rxthread;
Mohit Khanna70322002018-05-15 19:21:32 -07001870 /* support for DP RX threads */
1871 bool enable_dp_rx_threads;
Nirav Shahbd36b062016-07-18 11:12:59 +05301872 bool napi_enable;
Agrawal Ashish65634612016-08-18 13:24:32 +05301873 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301874 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001875 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301876 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301877 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301878 struct scan_chan_info *chan_info;
1879 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301880 /* bit map to set/reset TDLS by different sources */
1881 unsigned long tdls_source_bitmap;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001882 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001883 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301884 uint8_t beacon_probe_rsp_cnt_per_scan;
Jeff Johnson995fd512019-03-06 08:45:10 -08001885 uint8_t last_scan_reject_vdev_id;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301886 enum scan_reject_states last_scan_reject_reason;
1887 unsigned long last_scan_reject_timestamp;
Abhishek Singh00130682017-07-14 10:46:17 +05301888 uint8_t scan_reject_cnt;
Arif Hussain759a0232017-03-20 13:17:18 -07001889 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001890 bool reg_offload;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301891 bool rcpi_enabled;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301892#ifdef FEATURE_WLAN_CH_AVOID
Kiran Kumar Lokere48795792017-07-07 15:34:29 -07001893 struct ch_avoid_ind_type coex_avoid_freq_list;
1894 struct ch_avoid_ind_type dnbs_avoid_freq_list;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301895 /* Lock to control access to dnbs and coex avoid freq list */
1896 struct mutex avoid_freq_lock;
1897#endif
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001898#ifdef WLAN_FEATURE_TSF
1899 /* indicate whether tsf has been initialized */
1900 qdf_atomic_t tsf_ready_flag;
1901 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1902 qdf_atomic_t cap_tsf_flag;
1903 /* the context that is capturing tsf */
Jeff Johnson9d295242017-08-29 14:39:48 -07001904 struct hdd_adapter *cap_tsf_context;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001905#endif
Subrat Dash5f36fbe2019-02-12 16:28:14 +05301906#ifdef WLAN_FEATURE_TSF_PTP
1907 struct ptp_clock_info ptp_cinfo;
1908 struct ptp_clock *ptp_clock;
1909#endif
Vidyullatha Kanchanapallybe0ebb32017-03-23 14:36:21 +05301910 uint8_t bt_a2dp_active:1;
1911 uint8_t bt_vo_active:1;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08001912 enum band_info curr_band;
Arunk Khandavalli847969d2017-09-25 15:15:36 +05301913 bool imps_enabled;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001914#ifdef WLAN_FEATURE_PACKET_FILTERING
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05301915 int user_configured_pkt_filter_rules;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001916#endif
Vignesh Viswanathan731186f2017-09-18 13:47:37 +05301917 bool is_fils_roaming_supported;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001918 QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *,
1919 struct sk_buff *);
Poddar, Siddarth4b3f7312017-11-02 17:00:20 +05301920 qdf_atomic_t vendor_disable_lro_flag;
Mohit Khanna81418772018-10-30 14:14:46 -07001921
1922 /* disable RX offload (GRO/LRO) in concurrency scenarios */
1923 qdf_atomic_t disable_rx_ol_in_concurrency;
1924 /* disable RX offload (GRO/LRO) in low throughput scenarios */
1925 qdf_atomic_t disable_rx_ol_in_low_tput;
Manjunathappa Prakash81ca3a52017-10-09 01:41:58 -07001926 bool en_tcp_delack_no_lro;
Abhishek Singh6454ad32017-12-20 10:42:21 +05301927 bool force_rsne_override;
Arunk Khandavalliebd1e372017-11-06 15:00:24 +05301928 qdf_wake_lock_t monitor_mode_wakelock;
Naveen Rawat269b4ed2017-12-07 06:47:32 -08001929 bool lte_coex_ant_share;
Liangwei Dong0da14262018-07-03 03:30:23 -04001930 bool obss_scan_offload;
Sandeep Puligilla019a1bd2018-02-04 22:57:44 -08001931 int sscan_pid;
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +05301932 uint32_t track_arp_ip;
Ryan Hsuc6918552018-05-16 13:29:59 -07001933
1934 /* defining the board related information */
1935 uint32_t hw_bd_id;
1936 struct board_info hw_bd_info;
Varun Reddy Yeturud33033f2018-06-11 10:58:30 -07001937#ifdef WLAN_SUPPORT_TWT
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -07001938 enum twt_status twt_state;
1939#endif
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301940#ifdef FEATURE_WLAN_APF
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301941 uint32_t apf_version;
Rajeev Kumar Sirasanagandla85f8b022018-03-12 12:52:59 +05301942 bool apf_enabled_v2;
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301943#endif
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301944
1945#ifdef DISABLE_CHANNEL_LIST
1946 struct hdd_cache_channels *original_channels;
1947 qdf_mutex_t cache_channel_lock;
1948#endif
Jeff Johnsonf9176382018-07-17 19:15:58 -07001949 enum sar_version sar_version;
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301950 struct hdd_dynamic_mac dynamic_mac_list[QDF_MAX_CONCURRENCY_PERSONA];
gaurank kathpalia5fcefa92018-10-24 15:03:15 +05301951 bool dynamic_nss_chains_support;
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301952 struct qdf_mac_addr hw_macaddr;
1953 struct qdf_mac_addr provisioned_mac_addr[QDF_MAX_CONCURRENCY_PERSONA];
1954 struct qdf_mac_addr derived_mac_addr[QDF_MAX_CONCURRENCY_PERSONA];
1955 uint32_t num_provisioned_addr;
1956 uint32_t num_derived_addr;
1957 unsigned long provisioned_intf_addr_mask;
1958 unsigned long derived_intf_addr_mask;
Sourav Mohapatra9036f652019-04-02 15:02:59 +05301959
1960 struct sar_limit_cmd_params *sar_cmd_params;
Alan Chenabd19472019-08-30 12:07:03 -07001961
1962 qdf_time_t runtime_resume_start_time_stamp;
1963 qdf_time_t runtime_suspend_done_time_stamp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001964};
1965
Kapil Gupta086c6202016-12-11 18:17:06 +05301966/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301967 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1968 * @channel_count: channel count
1969 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301970 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301971 * @vendor_pcl_list: pointer to pcl list
1972 * @vendor_weight_list: pointer to pcl weight list
1973 */
1974struct hdd_vendor_acs_chan_params {
1975 uint32_t channel_count;
1976 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301977 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301978 uint8_t *vendor_pcl_list;
1979 uint8_t *vendor_weight_list;
1980};
1981
1982/**
1983 * struct hdd_external_acs_timer_context - acs timer context
1984 * @reason: reason for acs trigger
1985 * @adapter: hdd adapter for acs
1986 */
1987struct hdd_external_acs_timer_context {
1988 int8_t reason;
Jeff Johnson9d295242017-08-29 14:39:48 -07001989 struct hdd_adapter *adapter;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301990};
1991
1992/**
1993 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301994 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301995 * @pri_ch: primary channel
1996 * @ht_sec_ch: secondary channel
1997 * @vht_seg0_center_ch: segment0 for vht
1998 * @vht_seg1_center_ch: vht segment 1
1999 * @chan_width: channel width
2000 */
2001struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05302002 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05302003 uint8_t pri_ch;
2004 uint8_t ht_sec_ch;
2005 uint8_t vht_seg0_center_ch;
2006 uint8_t vht_seg1_center_ch;
2007 uint8_t chan_width;
2008};
2009
2010/**
Kapil Gupta086c6202016-12-11 18:17:06 +05302011 * struct hdd_channel_info - standard channel info
2012 * @freq: Freq in Mhz
2013 * @flags: channel info flags
2014 * @flagext: extended channel info flags
2015 * @ieee_chan_number: channel number
2016 * @max_reg_power: max tx power according to regulatory
2017 * @max_radio_power: max radio power
2018 * @min_radio_power: min radio power
2019 * @reg_class_id: regulatory class
2020 * @max_antenna_gain: max antenna gain allowed on channel
2021 * @vht_center_freq_seg0: vht center freq segment 0
2022 * @vht_center_freq_seg1: vht center freq segment 1
2023 */
2024struct hdd_channel_info {
2025 u_int16_t freq;
2026 u_int32_t flags;
2027 u_int16_t flagext;
2028 u_int8_t ieee_chan_number;
2029 int8_t max_reg_power;
2030 int8_t max_radio_power;
2031 int8_t min_radio_power;
2032 u_int8_t reg_class_id;
2033 u_int8_t max_antenna_gain;
2034 u_int8_t vht_center_freq_seg0;
2035 u_int8_t vht_center_freq_seg1;
2036};
2037
Jeff Johnsonef926352017-01-12 10:41:02 -08002038/*
2039 * Function declarations and documentation
2040 */
Himanshu Agarwal813b2bf2018-01-22 16:32:15 +05302041
Jeff Johnson9d295242017-08-29 14:39:48 -07002042int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05302043 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002044 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002045
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002046QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002047 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002048
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002049QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002050 struct hdd_adapter *current_adapter,
2051 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002052
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002053QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002054 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002055
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002056QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002057 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002058
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002059QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002060 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002061
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002062QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002063 struct hdd_adapter *adapter);
2064
2065/**
2066 * hdd_for_each_adapter - adapter iterator macro
2067 * @hdd_ctx: the global HDD context
2068 * @adapter: an hdd_adapter pointer to use as a cursor
2069 */
2070#define hdd_for_each_adapter(hdd_ctx, adapter) \
2071 for (hdd_get_front_adapter(hdd_ctx, &adapter); \
2072 adapter; \
2073 hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002074
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002075struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
2076 uint8_t session_type,
Jeff Johnsonaa6cbb82019-03-10 19:31:35 -07002077 const char *name, tSirMacAddr mac_addr,
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002078 unsigned char name_assign_type,
2079 bool rtnl_held);
Dustin Brown728d65a2018-10-02 16:27:52 -07002080
2081/**
2082 * hdd_close_adapter() - remove and free @adapter from the adapter list
2083 * @hdd_ctx: The Hdd context containing the adapter list
2084 * @adapter: the adapter to remove and free
2085 * @rtnl_held: if the caller is already holding the RTNL lock
2086 *
2087 * Return: None
2088 */
2089void hdd_close_adapter(struct hdd_context *hdd_ctx,
2090 struct hdd_adapter *adapter,
2091 bool rtnl_held);
2092
2093/**
2094 * hdd_close_all_adapters() - remove and free all adapters from the adapter list
2095 * @hdd_ctx: The Hdd context containing the adapter list
2096 * @rtnl_held: if the caller is already holding the RTNL lock
2097 *
2098 * Return: None
2099 */
2100void hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
2101
Dustin Browndb2a8be2017-12-20 11:49:56 -08002102QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002103void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002104QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx);
2105QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002106
2107/**
2108 * hdd_get_adapter_by_vdev() - Return adapter with the given vdev id
2109 * @hdd_ctx: hdd context.
2110 * @vdev_id: vdev id for the adapter to get.
2111 *
2112 * This function is used to get the adapter with provided vdev id
2113 *
2114 * Return: adapter pointer if found
2115 *
2116 */
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002117struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx,
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002118 uint32_t vdev_id);
2119
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002120struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx,
Jeff Johnsonaa6cbb82019-03-10 19:31:35 -07002121 tSirMacAddr mac_addr);
Dustin Brownd28772b2017-03-17 14:16:07 -07002122
Will Huang79af29f2019-04-11 15:46:26 +08002123/**
2124 * hdd_get_adapter_home_channel() - return home channel of adapter
2125 * @adapter: hdd adapter of vdev
2126 *
2127 * This function returns operation channel of station/p2p-cli if
2128 * connected, returns opration channel of sap/p2p-go if started.
2129 *
2130 * Return: home channel if connected/started or invalid channel 0
2131 */
2132uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter);
2133
Liangwei Dong3abfe8f2018-09-20 02:25:44 -04002134/*
2135 * hdd_get_adapter_by_rand_macaddr() - find Random mac adapter
2136 * @hdd_ctx: hdd context
2137 * @mac_addr: random mac addr
2138 *
2139 * Find the Adapter based on random mac addr. Adapter's vdev
2140 * have active random mac list.
2141 *
2142 * Return: adapter ptr or null
2143 */
2144struct hdd_adapter *
2145hdd_get_adapter_by_rand_macaddr(struct hdd_context *hdd_ctx,
2146 tSirMacAddr mac_addr);
2147
gaurank kathpalia6982d472018-10-31 21:54:15 +05302148/**
2149 * hdd_is_vdev_in_conn_state() - Check whether the vdev is in
2150 * connected/started state.
2151 * @adapter: hdd adapter of the vdev
2152 *
2153 * This function will give whether the vdev in the adapter is in
2154 * connected/started state.
2155 *
2156 * Return: True/false
2157 */
2158bool hdd_is_vdev_in_conn_state(struct hdd_adapter *adapter);
2159
Krunal Sonib51eec72017-11-20 21:53:01 -08002160int hdd_vdev_create(struct hdd_adapter *adapter,
Jeff Johnson6a18c962018-07-01 09:09:37 -07002161 csr_roam_complete_cb callback, void *ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002162int hdd_vdev_destroy(struct hdd_adapter *adapter);
2163int hdd_vdev_ready(struct hdd_adapter *adapter);
Dustin Brownd28772b2017-03-17 14:16:07 -07002164
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002165QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002166struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002167 enum QDF_OPMODE mode);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002168
2169/**
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302170 * hdd_get_device_mode() - Get device mode
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002171 * @vdev_id: vdev id
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302172 *
2173 * Return: Device mode
2174 */
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002175enum QDF_OPMODE hdd_get_device_mode(uint32_t vdev_id);
2176
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002177void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
2178 struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002179 bool rtnl_held);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002180QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
Dustin Browndb2a8be2017-12-20 11:49:56 -08002181 struct hdd_adapter *adapter);
Liangwei Dongad89c762018-06-01 01:56:23 -04002182
Jeff Johnson5505db82017-11-02 21:19:23 -07002183void hdd_set_station_ops(struct net_device *dev);
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05302184
2185/**
2186 * wlan_hdd_get_intf_addr() - Get address for the interface
2187 * @hdd_ctx: Pointer to hdd context
2188 * @interface_type: type of the interface for which address is queried
2189 *
2190 * This function is used to get mac address for every new interface
2191 *
2192 * Return: If addr is present then return pointer to MAC address
2193 * else NULL
2194 */
2195
2196uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx,
2197 enum QDF_OPMODE interface_type);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002198void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx,
2199 uint8_t *releaseAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002200uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002201 enum QDF_OPMODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002202
Dustin Brownf0f70562018-09-14 10:29:38 -07002203void hdd_set_conparam(int32_t con_param);
Jeff Johnson876c1a62017-12-12 10:43:07 -08002204enum QDF_GLOBAL_MODE hdd_get_conparam(void);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002205void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002206void hdd_prevent_suspend(uint32_t reason);
Sourav Mohapatra92ea8d62018-02-05 10:03:10 +05302207
2208/*
2209 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list
2210 *
2211 * This function is used to fetch the first valid adapter from the adapter
2212 * list. If there is no valid adapter then it returns NULL
2213 *
2214 * @hdd_ctx: HDD context handler
2215 *
2216 * Return: NULL if no valid adapter found in the adapter list
2217 *
2218 */
2219struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx);
2220
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002221void hdd_allow_suspend(uint32_t reason);
2222void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002223
Abhishek Ambure68677462019-09-13 12:44:26 +05302224#ifdef QCA_IBSS_SUPPORT
2225/**
2226 * hdd_set_ibss_power_save_params() - update IBSS Power Save params to WMA.
2227 * @struct hdd_adapter Hdd adapter.
2228 *
2229 * This function sets the IBSS power save config parameters to WMA
2230 * which will send it to firmware if FW supports IBSS power save
2231 * before vdev start.
2232 *
2233 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE
2234 * on failure.
2235 */
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002236QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter);
Abhishek Ambure68677462019-09-13 12:44:26 +05302237#else
2238static inline QDF_STATUS
2239hdd_set_ibss_power_save_params(struct hdd_adapter *adapter)
2240{
2241 return QDF_STATUS_SUCCESS;
2242}
2243#endif
Dustin Brownda351e32018-07-23 15:48:22 -07002244
2245/**
2246 * wlan_hdd_validate_context() - check the HDD context
2247 * @hdd_ctx: Global HDD context pointer
2248 *
2249 * Return: 0 if the context is valid. Error code otherwise
2250 */
2251#define wlan_hdd_validate_context(hdd_ctx) \
2252 __wlan_hdd_validate_context(hdd_ctx, __func__)
2253
2254int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002255
2256/**
2257 * hdd_validate_adapter() - Validate the given adapter
2258 * @adapter: the adapter to validate
2259 *
2260 * This function validates the given adapter, and ensures that it is open.
2261 *
2262 * Return: Errno
2263 */
Dustin Browna8700cc2018-08-07 12:04:47 -07002264#define hdd_validate_adapter(adapter) \
2265 __hdd_validate_adapter(adapter, __func__)
2266
2267int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002268
Dustin Brown63500612018-08-07 11:36:09 -07002269/**
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002270 * wlan_hdd_validate_vdev_id() - ensure the given vdev Id is valid
2271 * @vdev_id: the vdev Id to validate
Dustin Brown63500612018-08-07 11:36:09 -07002272 *
2273 * Return: Errno
2274 */
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002275#define wlan_hdd_validate_vdev_id(vdev_id) \
2276 __wlan_hdd_validate_vdev_id(vdev_id, __func__)
Dustin Brown63500612018-08-07 11:36:09 -07002277
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002278int __wlan_hdd_validate_vdev_id(uint8_t vdev_id, const char *func);
2279
Jeff Johnson030cd902018-11-11 10:19:40 -08002280/**
2281 * hdd_is_valid_mac_address() - validate MAC address
2282 * @mac_addr: Pointer to the input MAC address
2283 *
2284 * This function validates whether the given MAC address is valid or not
2285 * Expected MAC address is of the format XX:XX:XX:XX:XX:XX
2286 * where X is the hexa decimal digit character and separated by ':'
2287 * This algorithm works even if MAC address is not separated by ':'
2288 *
2289 * This code checks given input string mac contains exactly 12 hexadecimal
2290 * digits and a separator colon : appears in the input string only after
2291 * an even number of hex digits.
2292 *
2293 * Return: true for valid and false for invalid
2294 */
2295bool hdd_is_valid_mac_address(const uint8_t *mac_addr);
2296
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002297bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002298
Pragaspathi Thilagaraj84b72842018-09-19 22:06:57 +05302299/**
2300 * wlan_hdd_validate_mac_address() - Function to validate mac address
2301 * @mac_addr: input mac address
2302 *
2303 * Return QDF_STATUS
2304 */
2305#define wlan_hdd_validate_mac_address(mac_addr) \
2306 __wlan_hdd_validate_mac_address(mac_addr, __func__)
2307
2308QDF_STATUS __wlan_hdd_validate_mac_address(struct qdf_mac_addr *mac_addr,
2309 const char *func);
Tiger Yu8b119e92019-04-09 13:55:07 +08002310
2311#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Brown5ec6b552017-03-31 12:11:40 -07002312/**
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05302313 * hdd_bus_bw_compute_prev_txrx_stats() - get tx and rx stats
2314 * @adapter: hdd adapter reference
2315 *
2316 * This function get the collected tx and rx stats before starting
2317 * the bus bandwidth timer.
2318 *
2319 * Return: None
2320 */
2321void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter);
2322
2323/**
2324 * hdd_bus_bw_compute_reset_prev_txrx_stats() - reset previous tx and rx stats
2325 * @adapter: hdd adapter reference
2326 *
2327 * This function resets the adapter previous tx rx stats.
2328 *
2329 * Return: None
2330 */
2331void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter);
2332
2333/**
Dustin Brown5ec6b552017-03-31 12:11:40 -07002334 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
2335 * @hdd_ctx: the global hdd context
2336 *
2337 * Return: None
2338 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002339void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002340
2341/**
2342 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
2343 * @hdd_ctx: the global hdd context
2344 *
2345 * This function ensures there is at least one adapter in the associated state
2346 * before starting the bandwidth timer.
2347 *
2348 * Return: None
2349 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002350void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002351
2352/**
2353 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
2354 * @hdd_ctx: the global hdd context
2355 *
2356 * Return: None
2357 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002358void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002359
2360/**
2361 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
2362 * @hdd_ctx: the global hdd context
2363 *
2364 * This function ensures there are no adapters in the associated state before
2365 * stopping the bandwidth timer.
2366 *
2367 * Return: None
2368 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002369void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002370
2371/**
2372 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002373 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002374 *
2375 * Initialize bus bandwidth related data structures like spinlock and timer.
2376 *
2377 * Return: None.
2378 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002379int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002380
2381/**
Dustin Brown86d196b2018-08-02 11:51:49 -07002382 * hdd_bus_bandwidth_deinit() - De-initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002383 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002384 *
Dustin Brown86d196b2018-08-02 11:51:49 -07002385 * De-initialize bus bandwidth related data structures like timer.
Prashanth Bhattaab004382016-10-11 16:08:11 -07002386 *
2387 * Return: None.
2388 */
Dustin Brown86d196b2018-08-02 11:51:49 -07002389void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx);
Lin Baic5c06882017-09-21 13:58:43 +08002390
Jinwei Chenb681a482019-08-14 15:24:06 +08002391static inline enum pld_bus_width_type
2392hdd_get_current_throughput_level(struct hdd_context *hdd_ctx)
2393{
2394 return hdd_ctx->cur_vote_level;
2395}
2396
Jinwei Chen0dc383e2019-08-23 00:43:04 +08002397static inline bool
2398hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx)
2399{
2400 return (qdf_atomic_read(&hdd_ctx->low_tput_gro_enable)) ? true : false;
2401}
2402
Lin Bai556a1922017-11-10 20:32:04 +08002403#define GET_CUR_RX_LVL(config) ((config)->cur_rx_level)
jitiphil869b9f72018-09-25 17:14:01 +05302404#define GET_BW_COMPUTE_INTV(config) ((config)->bus_bw_compute_interval)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002405#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07002406
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002407static inline
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05302408void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter)
2409{
2410}
2411
2412static inline
2413void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter)
2414{
2415}
2416
2417static inline
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002418void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002419{
Dustin Brown5ec6b552017-03-31 12:11:40 -07002420}
2421
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002422static inline
2423void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002424{
2425}
2426
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002427static inline
2428void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002429{
2430}
2431
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002432static inline
2433void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002434{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002435}
2436
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002437static inline
2438int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002439{
2440 return 0;
2441}
2442
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002443static inline
Dustin Brown86d196b2018-08-02 11:51:49 -07002444void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002445{
Prashanth Bhattaab004382016-10-11 16:08:11 -07002446}
Lin Baic5c06882017-09-21 13:58:43 +08002447
Jinwei Chenb681a482019-08-14 15:24:06 +08002448static inline enum pld_bus_width_type
2449hdd_get_current_throughput_level(struct hdd_context *hdd_ctx)
2450{
2451 return PLD_BUS_WIDTH_NONE;
2452}
2453
Jinwei Chen0dc383e2019-08-23 00:43:04 +08002454static inline bool
2455hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx)
2456{
2457 return false;
2458}
2459
Lin Bai556a1922017-11-10 20:32:04 +08002460#define GET_CUR_RX_LVL(config) 0
Lin Baiaa7f8d72017-10-18 17:23:45 +08002461#define GET_BW_COMPUTE_INTV(config) 0
2462
Tiger Yu8b119e92019-04-09 13:55:07 +08002463#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002464
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05302465int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
2466
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08002467int hdd_init(void);
2468void hdd_deinit(void);
2469
Dustin Brown92bd8382018-10-31 15:49:46 -07002470/**
2471 * hdd_wlan_startup() - HDD init function
Dustin Brown623e7e32018-09-05 14:27:50 -07002472 * hdd_ctx: the HDD context corresponding to the psoc to startup
Dustin Brown92bd8382018-10-31 15:49:46 -07002473 *
2474 * Return: Errno
2475 */
Dustin Brown623e7e32018-09-05 14:27:50 -07002476int hdd_wlan_startup(struct hdd_context *hdd_ctx);
Dustin Brown92bd8382018-10-31 15:49:46 -07002477
2478/**
2479 * hdd_wlan_exit() - HDD WLAN exit function
2480 * @hdd_ctx: pointer to the HDD Context
2481 *
2482 * Return: None
2483 */
2484void hdd_wlan_exit(struct hdd_context *hdd_ctx);
2485
2486/**
2487 * hdd_psoc_create_vdevs() - create the default vdevs for a psoc
2488 * @hdd_ctx: the HDD context for the psoc to operate against
2489 *
2490 * Return: QDF_STATUS
2491 */
2492QDF_STATUS hdd_psoc_create_vdevs(struct hdd_context *hdd_ctx);
2493
Dustin Brown623e7e32018-09-05 14:27:50 -07002494/*
2495 * hdd_context_create() - Allocate and inialize HDD context.
2496 * @dev: Device Pointer to the underlying device
2497 *
2498 * Allocate and initialize HDD context. HDD context is allocated as part of
2499 * wiphy allocation and then context is initialized.
2500 *
2501 * Return: HDD context on success and ERR_PTR on failure
2502 */
2503struct hdd_context *hdd_context_create(struct device *dev);
2504
2505/**
2506 * hdd_context_destroy() - Destroy HDD context
2507 * @hdd_ctx: HDD context to be destroyed.
2508 *
2509 * Free config and HDD context as well as destroy all the resources.
2510 *
2511 * Return: None
2512 */
2513void hdd_context_destroy(struct hdd_context *hdd_ctx);
2514
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002515int hdd_wlan_notify_modem_power_state(int state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002516
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05302517void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002518#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002519void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002520#endif
2521
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002522struct hdd_adapter *
2523hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
2524 bool check_start_bss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002525
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002526bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002527
Ashish Kumar Dhanotiya34507e02019-06-12 12:53:59 +05302528/**
2529 * hdd_is_2g_supported() - check if 2GHz channels are supported
2530 * @hdd_ctx: Pointer to the hdd context
2531 *
2532 * HDD function to know if 2GHz channels are supported
2533 *
2534 * Return: true if 2GHz channels are supported
2535 */
2536
2537bool hdd_is_2g_supported(struct hdd_context *hdd_ctx);
2538
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002539int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002540
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002541#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002542static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002543{
Wu Gaoca416ff2018-09-17 11:05:07 +08002544 bool is_roam_offload;
2545
Dustin Brown05d81302018-09-11 16:49:22 -07002546 ucfg_mlme_get_roaming_offload(hdd_ctx->psoc, &is_roam_offload);
Wu Gaoca416ff2018-09-17 11:05:07 +08002547
2548 return is_roam_offload;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002549}
2550#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002551static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002552{
2553 return false;
2554}
2555#endif
2556
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002557#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002558static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002559{
Wu Gao1ab05582018-11-08 16:22:49 +08002560 bool lfr_enabled;
2561
2562 ucfg_mlme_is_lfr_enabled(hdd_ctx->psoc, &lfr_enabled);
2563
2564 return lfr_enabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002565}
2566#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002567static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002568{
2569 return false;
2570}
2571#endif
2572
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002573static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002574{
2575 bool val;
2576
2577 val = hdd_driver_roaming_supported(hdd_ctx) ||
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002578 roaming_offload_enabled(hdd_ctx);
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002579
2580 return val;
2581}
2582
2583#ifdef CFG80211_SCAN_RANDOM_MAC_ADDR
2584static inline bool hdd_scan_random_mac_addr_supported(void)
2585{
2586 return true;
2587}
2588#else
2589static inline bool hdd_scan_random_mac_addr_supported(void)
2590{
2591 return false;
2592}
2593#endif
2594
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302595/**
2596 * hdd_start_vendor_acs(): Start vendor ACS procedure
2597 * @adapter: pointer to SAP adapter struct
2598 *
2599 * This function sends the ACS config to the ACS daemon and
2600 * starts the vendor ACS timer to wait for the next command.
2601 *
2602 * Return: Status of vendor ACS procedure
2603 */
2604int hdd_start_vendor_acs(struct hdd_adapter *adapter);
2605
Kapil Gupta8878ad92017-02-13 11:56:04 +05302606/**
2607 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05302608 * @context: timeout handler context
Kapil Gupta8878ad92017-02-13 11:56:04 +05302609 *
2610 * Return: None
2611 */
2612void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002613
Kapil Gupta8878ad92017-02-13 11:56:04 +05302614/**
2615 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
2616 * @adapter: pointer to SAP adapter struct
2617 *
2618 * This function starts the ACS procedure if there are no
2619 * constraints like MBSSID DFS restrictions.
2620 *
2621 * Return: Status of ACS Start procedure
2622 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002623int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302624
2625/**
2626 * hdd_cfg80211_update_acs_config() - update acs config to application
2627 * @adapter: hdd adapter
2628 * @reason: channel change reason
2629 *
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302630 * Return: 0 for success else error code
Kapil Gupta8878ad92017-02-13 11:56:04 +05302631 */
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302632int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
2633 uint8_t reason);
Nirav Shaheb017be2018-02-15 11:20:58 +05302634
Kapil Gupta8878ad92017-02-13 11:56:04 +05302635/**
2636 * hdd_update_acs_timer_reason() - update acs timer start reason
2637 * @adapter: hdd adapter
2638 * @reason: channel change reason
2639 *
2640 * Return: 0 for success
2641 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002642int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302643
2644/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002645 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05302646 * @adapter: AP adapter
2647 * @channel: Channel
Min Liu2fef5792018-01-19 17:59:42 +08002648 * @forced: Force to switch channel, ignore SCC/MCC check
Kapil Gupta8878ad92017-02-13 11:56:04 +05302649 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002650 * Moves the SAP interface by invoking the function which
2651 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05302652 *
2653 * Return: None
2654 */
Min Liu2fef5792018-01-19 17:59:42 +08002655void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
2656 bool forced);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002657
Nirav Shaheb017be2018-02-15 11:20:58 +05302658#if defined(FEATURE_WLAN_CH_AVOID)
2659void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
2660
2661void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2662 struct unsafe_ch_list *unsafe_chan_list,
2663 struct ch_avoid_ind_type *avoid_freq_list);
2664#else
2665static inline
2666void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
2667{
2668}
2669
2670static inline
2671void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2672 struct unsafe_ch_list *unsafe_chan_list,
2673 struct ch_avoid_ind_type *avoid_freq_list)
2674{
2675}
2676#endif
2677
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05302678/**
2679 * hdd_free_mac_address_lists() - Free both the MAC address lists
2680 * @hdd_ctx: HDD context
2681 *
2682 * This API clears/memset provisioned address list and
2683 * derived address list
2684 *
2685 */
2686void hdd_free_mac_address_lists(struct hdd_context *hdd_ctx);
2687
2688/**
2689 * hdd_update_macaddr() - update mac address
2690 * @hdd_ctx: hdd contxt
2691 * @hw_macaddr: mac address
2692 * @generate_mac_auto: Indicates whether the first address is
2693 * provisioned address or derived address.
2694 *
2695 * Mac address for multiple virtual interface is found as following
2696 * i) The mac address of the first interface is just the actual hw mac address.
2697 * ii) MSM 3 or 4 bits of byte5 of the actual mac address are used to
2698 * define the mac address for the remaining interfaces and locally
2699 * admistered bit is set. INTF_MACADDR_MASK is based on the number of
2700 * supported virtual interfaces, right now this is 0x07 (meaning 8
2701 * interface).
2702 * Byte[3] of second interface will be hw_macaddr[3](bit5..7) + 1,
2703 * for third interface it will be hw_macaddr[3](bit5..7) + 2, etc.
2704 *
2705 * Return: None
2706 */
2707void hdd_update_macaddr(struct hdd_context *hdd_ctx,
2708 struct qdf_mac_addr hw_macaddr, bool generate_mac_auto);
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302709
2710/**
gaurank kathpalia6c4b50c2019-02-28 14:07:48 +05302711 * hdd_store_nss_chains_cfg_in_vdev() - Store the per vdev ini cfg in vdev_obj
2712 * @adapter: Current HDD adapter passed from caller
2713 *
2714 * This function will store the per vdev nss params to the particular mlme
2715 * vdev obj.
2716 *
2717 * Return: None
2718 */
2719void
2720hdd_store_nss_chains_cfg_in_vdev(struct hdd_adapter *adapter);
2721
2722/**
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302723 * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
2724 * @cur_adapter: Current HDD adapter passed from caller
2725 *
2726 * This function loops through all adapters and disables roaming on each STA
2727 * mode adapter except the current adapter passed from the caller
2728 *
2729 * Return: None
2730 */
2731void wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter);
2732
2733/**
2734 * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one
2735 * @cur_adapter: Current HDD adapter passed from caller
2736 *
2737 * This function loops through all adapters and enables roaming on each STA
2738 * mode adapter except the current adapter passed from the caller
2739 *
2740 * Return: None
2741 */
2742void wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002743
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002744QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002745
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002746QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002747
Jeff Johnson9d295242017-08-29 14:39:48 -07002748void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
2749void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002750
2751#ifdef QCA_CONFIG_SMP
2752int wlan_hdd_get_cpu(void);
2753#else
2754static inline int wlan_hdd_get_cpu(void)
2755{
2756 return 0;
2757}
2758#endif
2759
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302760void wlan_hdd_sap_pre_cac_failure(void *data);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002761void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302762
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002763void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2764 enum netif_action_type action, enum netif_reason_type reason);
2765
Ajit Pal Singh106c1412018-04-18 18:08:49 +05302766#ifdef QCA_HL_NETDEV_FLOW_CONTROL
2767void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2768 enum netif_action_type action);
2769#else
2770static inline void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2771 enum netif_action_type action)
2772{
2773}
2774#endif /* QCA_HL_NETDEV_FLOW_CONTROL */
2775
Jeff Johnson9d295242017-08-29 14:39:48 -07002776int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002777void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002778void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
2779void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
Mohit Khanna70322002018-05-15 19:21:32 -07002780
Mohit Khannaca4173b2017-09-12 21:52:19 -07002781void
2782wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
2783 enum qdf_stats_verbosity_level verb_lvl);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002784void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002785const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302786void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002787
Naveen Rawat4edb6822017-04-12 10:09:17 -07002788/**
2789 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2790 * @hdd_ctx: hdd context.
2791 * @iface_name: interface name
2792 *
2793 * This function is used to get the adapter with given interface name
2794 *
2795 * Return: adapter pointer if found, NULL otherwise
2796 *
2797 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002798struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx,
Naveen Rawat4edb6822017-04-12 10:09:17 -07002799 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002800enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Jeff Johnson16528362018-06-14 12:34:16 -07002801
2802/**
Dustin Brown56377e12018-10-10 17:04:04 -07002803 * hdd_nl_to_qdf_iface_type() - map nl80211_iftype to QDF_OPMODE
2804 * @nl_type: the input NL80211 interface type to map
2805 * @out_qdf_type: the output, equivalent QDF operating mode
2806 *
2807 * Return: QDF_STATUS
2808 */
2809QDF_STATUS hdd_nl_to_qdf_iface_type(enum nl80211_iftype nl_type,
2810 enum QDF_OPMODE *out_qdf_type);
2811
2812/**
Jeff Johnson16528362018-06-14 12:34:16 -07002813 * wlan_hdd_find_opclass() - Find operating class for a channel
2814 * @mac_handle: global MAC handle
2815 * @channel: channel id
2816 * @bw_offset: bandwidth offset
2817 *
2818 * Function invokes sme api to find the operating class
2819 *
2820 * Return: operating class
2821 */
2822uint8_t wlan_hdd_find_opclass(mac_handle_t mac_handle, uint8_t channel,
2823 uint8_t bw_offset);
2824
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002825int hdd_update_config(struct hdd_context *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002826
Mukul Sharma9d797a02017-01-05 20:26:03 +05302827/**
2828 * hdd_update_components_config() - Initialize driver per module ini parameters
2829 * @hdd_ctx: HDD Context
2830 *
2831 * API is used to initialize components configuration parameters
2832 * Return: 0 for success, errno for failure
2833 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002834int hdd_update_components_config(struct hdd_context *hdd_ctx);
Mukul Sharma9d797a02017-01-05 20:26:03 +05302835
Jeff Johnson9d295242017-08-29 14:39:48 -07002836QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302837 struct net_device *dev,
bings58ce8622017-07-10 15:55:36 +08002838 struct hdd_chan_change_params chan_change,
2839 bool legacy_phymode);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302840int wlan_hdd_set_channel(struct wiphy *wiphy,
2841 struct net_device *dev,
2842 struct cfg80211_chan_def *chandef,
2843 enum nl80211_channel_type channel_type);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002844int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302845 struct cfg80211_beacon_data *params,
2846 const u8 *ssid, size_t ssid_len,
2847 enum nl80211_hidden_ssid hidden_ssid,
Mahesh Kumar Kalikot Veetilc637fc92017-09-27 16:06:21 -07002848 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302849
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002850#if !defined(REMOVE_PKT_LOG)
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002851int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302852 int set_value2);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002853int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302854 uint8_t user_triggered, int size);
2855
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002856#else
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002857static inline
2858int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
2859 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002860{
2861 return 0;
2862}
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002863
2864static inline
2865int hdd_process_pktlog_command(struct hdd_context *hdd_ctx,
2866 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002867{
2868 return 0;
2869}
2870#endif /* REMOVE_PKT_LOG */
2871
Tiger Yu83795752019-01-16 19:48:01 +08002872#if defined(FEATURE_SG) && !defined(CONFIG_HL_SUPPORT)
Tiger Yu24ca3362018-11-05 16:49:11 +08002873/**
2874 * hdd_set_sg_flags() - enable SG flag in the network device
2875 * @hdd_ctx: HDD context
2876 * @wlan_dev: network device structure
2877 *
2878 * This function enables the SG feature flag in the
2879 * given network device.
2880 *
2881 * Return: none
2882 */
2883static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx,
2884 struct net_device *wlan_dev)
2885{
2886 hdd_debug("SG Enabled");
2887 wlan_dev->features |= NETIF_F_SG;
2888}
2889#else
2890static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx,
2891 struct net_device *wlan_dev){}
2892#endif
2893
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002894#ifdef FEATURE_TSO
2895/**
2896 * hdd_set_tso_flags() - enable TSO flags in the network device
2897 * @hdd_ctx: HDD context
2898 * @wlan_dev: network device structure
2899 *
2900 * This function enables the TSO related feature flags in the
2901 * given network device.
2902 *
2903 * Return: none
2904 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002905static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002906 struct net_device *wlan_dev)
2907{
jitiphil377bcc12018-10-05 19:46:08 +05302908 if (cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC),
2909 cfg_dp_tso_enable) &&
2910 cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC),
2911 cfg_dp_enable_ip_tcp_udp_checksum_offload)){
Mohit Khanna816e6532016-12-09 15:28:21 -08002912 /*
2913 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2914 * enabled.
2915 */
Dustin Brown7e761c72018-07-31 13:50:17 -07002916 hdd_debug("TSO Enabled");
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002917 wlan_dev->features |=
2918 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2919 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2920 }
2921}
2922#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002923static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Tiger Yu24ca3362018-11-05 16:49:11 +08002924 struct net_device *wlan_dev)
2925{
2926 hdd_set_sg_flags(hdd_ctx, wlan_dev);
2927}
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002928#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002929
Ryan Hsuceddceb2016-04-28 10:20:14 -07002930#ifdef CONFIG_CNSS_LOGGER
2931/**
2932 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2933 * @hdd_ctx: the hdd context pointer
2934 *
2935 * The nl_srv_init() will call to cnss_logger_device_register() and
2936 * expect to get a radio_index from cnss_logger module and assign to
2937 * hdd_ctx->radio_index, then to maintain the consistency to original
2938 * design, adding the radio_index check here, then return the error
2939 * code if radio_index is not assigned correctly, which means the nl_init
2940 * from cnss_logger is failed.
2941 *
2942 * Return: 0 if successfully, otherwise error code
2943 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002944static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002945{
Hangtian Zhuc7642602019-09-11 17:47:43 +08002946 int proto;
2947
2948 proto = hdd_ctx->config->host_log_custom_nl_proto;
2949 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy, proto);
Ryan Hsuceddceb2016-04-28 10:20:14 -07002950
2951 /* radio_index is assigned from 0, so only >=0 will be valid index */
2952 if (hdd_ctx->radio_index >= 0)
2953 return 0;
2954 else
2955 return -EINVAL;
2956}
2957#else
2958/**
2959 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2960 * @hdd_ctx: the hdd context pointer
2961 *
2962 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2963 * the netlink socket and return the success or not.
2964 *
2965 * Return: the return value from nl_srv_init()
2966 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002967static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002968{
Hangtian Zhuc7642602019-09-11 17:47:43 +08002969 int proto;
2970
2971 proto = hdd_ctx->config->host_log_custom_nl_proto;
2972 return nl_srv_init(hdd_ctx->wiphy, proto);
Ryan Hsuceddceb2016-04-28 10:20:14 -07002973}
2974#endif
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002975QDF_STATUS hdd_sme_open_session_callback(uint8_t vdev_id,
Pragaspathi Thilagaraj3551caa2018-09-26 15:52:56 +05302976 QDF_STATUS qdf_status);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002977QDF_STATUS hdd_sme_close_session_callback(uint8_t vdev_id);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002978
Jeff Johnson9d295242017-08-29 14:39:48 -07002979int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002980 uint8_t channel, const handoff_src src);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002981int hdd_register_cb(struct hdd_context *hdd_ctx);
2982void hdd_deregister_cb(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002983int hdd_start_station_adapter(struct hdd_adapter *adapter);
2984int hdd_start_ap_adapter(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002985int hdd_configure_cds(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002986int hdd_set_fw_params(struct hdd_adapter *adapter);
Dustin Brown3ecc8782018-09-19 16:37:13 -07002987
2988/**
2989 * hdd_wlan_start_modules() - Single driver state machine for starting modules
2990 * @hdd_ctx: HDD context
2991 * @reinit: flag to indicate from SSR or normal path
2992 *
2993 * This function maintains the driver state machine it will be invoked from
2994 * startup, reinit and change interface. Depending on the driver state shall
2995 * perform the opening of the modules.
2996 *
2997 * Return: Errno
2998 */
Dustin Browne7e71d32018-05-11 16:00:08 -07002999int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit);
Dustin Brown3ecc8782018-09-19 16:37:13 -07003000
3001/**
3002 * hdd_wlan_stop_modules - Single driver state machine for stoping modules
3003 * @hdd_ctx: HDD context
3004 * @ftm_mode: ftm mode
3005 *
3006 * This function maintains the driver state machine it will be invoked from
3007 * exit, shutdown and con_mode change handler. Depending on the driver state
3008 * shall perform the stopping/closing of the modules.
3009 *
3010 * Return: Errno
3011 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003012int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
Dustin Brown4c663222018-10-23 14:19:36 -07003013
3014/**
3015 * hdd_psoc_idle_timer_start() - start the idle psoc detection timer
3016 * @hdd_ctx: the hdd context for which the timer should be started
3017 *
3018 * Return: None
3019 */
3020void hdd_psoc_idle_timer_start(struct hdd_context *hdd_ctx);
3021
3022/**
3023 * hdd_psoc_idle_timer_stop() - stop the idle psoc detection timer
3024 * @hdd_ctx: the hdd context for which the timer should be stopped
3025 *
3026 * Return: None
3027 */
3028void hdd_psoc_idle_timer_stop(struct hdd_context *hdd_ctx);
3029
Dustin Brown3ecc8782018-09-19 16:37:13 -07003030/**
Rajeev Kumar473f9af2019-04-05 14:25:56 -07003031 * hdd_trigger_psoc_idle_restart() - trigger restart of a previously shutdown
3032 * idle psoc, if needed
Dustin Brown3ecc8782018-09-19 16:37:13 -07003033 * @hdd_ctx: the hdd context which should be restarted
3034 *
3035 * This API does nothing if the given psoc is already active.
3036 *
3037 * Return: Errno
3038 */
Rajeev Kumar473f9af2019-04-05 14:25:56 -07003039int hdd_trigger_psoc_idle_restart(struct hdd_context *hdd_ctx);
Dustin Brown3ecc8782018-09-19 16:37:13 -07003040
Jeff Johnson9d295242017-08-29 14:39:48 -07003041int hdd_start_adapter(struct hdd_adapter *adapter);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003042void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);
yeshwanth sriram guntukaea63f632017-08-30 19:31:56 +05303043/**
3044 * hdd_is_interface_up()- Checkfor interface up before ssr
3045 * @hdd_ctx: HDD context
3046 *
3047 * check if there are any wlan interfaces before SSR accordingly start
3048 * the interface.
3049 *
3050 * Return: 0 if interface was opened else false
3051 */
3052bool hdd_is_interface_up(struct hdd_adapter *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05303053
Anurag Chouhanc4092922016-09-08 15:56:11 +05303054void hdd_connect_result(struct net_device *dev, const u8 *bssid,
Jeff Johnson172237b2017-11-07 15:32:59 -08003055 struct csr_roam_info *roam_info, const u8 *req_ie,
Anurag Chouhanc4092922016-09-08 15:56:11 +05303056 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05303057 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05303058 bool connect_timeout,
3059 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05303060
Arun Khandavallifae92942016-08-01 13:31:08 +05303061#ifdef WLAN_FEATURE_FASTPATH
jitiphil377bcc12018-10-05 19:46:08 +05303062void hdd_enable_fastpath(struct hdd_context *hdd_ctx,
Arun Khandavallifae92942016-08-01 13:31:08 +05303063 void *context);
3064#else
jitiphil377bcc12018-10-05 19:46:08 +05303065static inline void hdd_enable_fastpath(struct hdd_context *hdd_ctx,
Arun Khandavallifae92942016-08-01 13:31:08 +05303066 void *context)
3067{
3068}
3069#endif
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003070void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context);
Nirav Shaheb017be2018-02-15 11:20:58 +05303071
Agrawal Ashish65634612016-08-18 13:24:32 +05303072enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003073void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
Liangwei Dong6e1a2092017-08-30 16:29:06 +08003074/**
3075 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list
3076 * @hdd_ctx: hdd context pointer
3077 * @local_unsafe_list: copied unsafe chan list array
3078 * @local_unsafe_list_count: channel number in returned local_unsafe_list
3079 *
3080 * The function will allocate memory and make a copy the current unsafe
3081 * channels from hdd ctx. The caller need to free the local_unsafe_list
3082 * memory after use.
3083 *
3084 * Return: 0 if successfully clone unsafe chan list.
3085 */
3086int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
3087 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count);
3088
3089/**
3090 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not
3091 * @hdd_ctx: hdd context pointer
3092 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list
3093 * @local_unsafe_list_count: channel number in local_unsafe_list
3094 *
3095 * The function checked the input channel is same as current unsafe chan
3096 * list in hdd_ctx.
3097 *
3098 * Return: true if input channel list is same as the list in hdd_ctx
3099 */
3100bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx,
3101 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count);
3102
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003103int hdd_enable_disable_ca_event(struct hdd_context *hddctx,
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05303104 uint8_t set_value);
Jeff Johnson9d295242017-08-29 14:39:48 -07003105void wlan_hdd_undo_acs(struct hdd_adapter *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07003106
3107#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
3108static inline int
3109hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
3110{
3111 return nla_put_u64(skb, attrtype, value);
3112}
3113#else
3114static inline int
3115hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
3116{
3117 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
3118}
3119#endif
3120
Jeff Johnson57e07512018-03-13 09:16:33 -07003121/**
3122 * hdd_roam_profile() - Get adapter's roam profile
3123 * @adapter: The adapter being queried
3124 *
3125 * Given an adapter this function returns a pointer to its roam profile.
3126 *
3127 * NOTE WELL: Caller is responsible for ensuring this interface is only
3128 * invoked for STA-type interfaces
3129 *
3130 * Return: pointer to the adapter's roam profile
3131 */
3132static inline
3133struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter)
3134{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003135 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003136
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003137 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003138
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003139 return &sta_ctx->roam_profile;
Jeff Johnson57e07512018-03-13 09:16:33 -07003140}
3141
3142/**
3143 * hdd_security_ie() - Get adapter's security IE
3144 * @adapter: The adapter being queried
3145 *
3146 * Given an adapter this function returns a pointer to its security IE
3147 * buffer. Note that this buffer is maintained outside the roam
3148 * profile but, when in use, is referenced by a pointer within the
3149 * roam profile.
3150 *
3151 * NOTE WELL: Caller is responsible for ensuring this interface is only
3152 * invoked for STA-type interfaces
3153 *
3154 * Return: pointer to the adapter's roam profile security IE buffer
3155 */
3156static inline
3157uint8_t *hdd_security_ie(struct hdd_adapter *adapter)
3158{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003159 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003160
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003161 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003162
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003163 return sta_ctx->security_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07003164}
3165
3166/**
3167 * hdd_assoc_additional_ie() - Get adapter's assoc additional IE
3168 * @adapter: The adapter being queried
3169 *
3170 * Given an adapter this function returns a pointer to its assoc
3171 * additional IE buffer. Note that this buffer is maintained outside
3172 * the roam profile but, when in use, is referenced by a pointer
3173 * within the roam profile.
3174 *
3175 * NOTE WELL: Caller is responsible for ensuring this interface is only
3176 * invoked for STA-type interfaces
3177 *
3178 * Return: pointer to the adapter's assoc additional IE buffer
3179 */
3180static inline
3181tSirAddie *hdd_assoc_additional_ie(struct hdd_adapter *adapter)
3182{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003183 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003184
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003185 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003186
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003187 return &sta_ctx->assoc_additional_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07003188}
3189
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05303190/**
3191 * hdd_is_roaming_in_progress() - check if roaming is in progress
3192 * @hdd_ctx - Global HDD context
3193 *
3194 * Checks if roaming is in progress on any of the adapters
3195 *
3196 * Return: true if roaming is in progress else false
3197 */
3198bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08003199void hdd_set_roaming_in_progress(bool value);
Jeff Johnsona2ac4e72019-03-06 08:35:29 -08003200
3201/**
3202 * hdd_is_connection_in_progress() - check if connection is in progress
3203 * @out_vdev_id: id of vdev where connection is occurring
3204 * @out_reason: scan reject reason
3205 *
3206 * Go through each adapter and check if connection is in progress.
3207 * Output parameters @out_vdev_id and @out_reason will only be written
3208 * when a connection is in progress.
3209 *
3210 * Return: true if connection is in progress else false
3211 */
3212bool hdd_is_connection_in_progress(uint8_t *out_vdev_id,
3213 enum scan_reject_states *out_reason);
3214
Jeff Johnson9d295242017-08-29 14:39:48 -07003215void hdd_restart_sap(struct hdd_adapter *ap_adapter);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08003216void hdd_check_and_restart_sap_with_non_dfs_acs(void);
3217bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08003218
Kapil Gupta94ca6f62016-12-11 18:43:12 +05303219/**
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05303220 * wlan_hdd_init_chan_info() - initialize channel info variables
3221 * @hdd_ctx: hdd ctx
3222 *
3223 * This API initialize channel info variables
3224 *
3225 * Return: None
3226 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003227void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07003228
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05303229/**
3230 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
3231 * @hdd_ctx: hdd ctx
3232 *
3233 * This API deinitialize channel info variables
3234 *
3235 * Return: None
3236 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003237void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07003238void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08003239
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303240/**
Dustin Brown4c663222018-10-23 14:19:36 -07003241 * hdd_is_any_interface_open() - Check for interface up
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303242 * @hdd_ctx: HDD context
3243 *
Dustin Brown4c663222018-10-23 14:19:36 -07003244 * Return: true if any interface is open
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303245 */
Dustin Brown4c663222018-10-23 14:19:36 -07003246bool hdd_is_any_interface_open(struct hdd_context *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08003247
3248#ifdef WIFI_POS_CONVERGED
3249/**
3250 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
3251 * function to send peer status to a registered application
3252 * @peer_mac: MAC address of peer
3253 * @peer_status: ePeerConnected or ePeerDisconnected
3254 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
Jeff Johnson8c76d602019-02-23 11:38:59 -08003255 * @vdev_id: ID of the underlying vdev
Naveen Rawat910726a2017-03-06 11:42:51 -08003256 * @chan_info: operating channel information
3257 * @dev_mode: dev mode for which indication is sent
3258 *
3259 * Return: none
3260 */
3261static inline void hdd_send_peer_status_ind_to_app(
3262 struct qdf_mac_addr *peer_mac,
3263 uint8_t peer_status,
3264 uint8_t peer_timing_meas_cap,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003265 uint8_t vdev_id,
Jeff Johnsona7d5b542019-02-03 10:15:46 -08003266 struct oem_channel_info *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08003267 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08003268{
3269 struct wifi_pos_ch_info ch_info;
3270
Naveen Rawat6877a242017-03-23 17:15:38 -07003271 if (!chan_info) {
3272 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003273 peer_timing_meas_cap, vdev_id,
3274 NULL, dev_mode);
Naveen Rawat6877a242017-03-23 17:15:38 -07003275 return;
3276 }
3277
Naveen Rawat910726a2017-03-06 11:42:51 -08003278 ch_info.chan_id = chan_info->chan_id;
3279 ch_info.mhz = chan_info->mhz;
3280 ch_info.band_center_freq1 = chan_info->band_center_freq1;
3281 ch_info.band_center_freq2 = chan_info->band_center_freq2;
3282 ch_info.info = chan_info->info;
3283 ch_info.reg_info_1 = chan_info->reg_info_1;
3284 ch_info.reg_info_2 = chan_info->reg_info_2;
3285 ch_info.nss = chan_info->nss;
3286 ch_info.rate_flags = chan_info->rate_flags;
3287 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
3288 ch_info.ch_width = chan_info->ch_width;
3289 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003290 peer_timing_meas_cap, vdev_id,
Naveen Rawat910726a2017-03-06 11:42:51 -08003291 &ch_info, dev_mode);
3292}
3293#else
3294static inline void hdd_send_peer_status_ind_to_app(
3295 struct qdf_mac_addr *peer_mac,
3296 uint8_t peer_status,
3297 uint8_t peer_timing_meas_cap,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003298 uint8_t vdev_id,
Jeff Johnsona7d5b542019-02-03 10:15:46 -08003299 struct oem_channel_info *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08003300 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08003301{
3302 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003303 peer_timing_meas_cap, vdev_id, chan_info, dev_mode);
Naveen Rawat910726a2017-03-06 11:42:51 -08003304}
3305#endif /* WIFI_POS_CONVERGENCE */
3306
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003307/**
3308 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
3309 * @adapter: Adapter data
3310 * @sval: P2P quota value
3311 *
3312 * Send P2P quota value to FW
3313 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003314 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003315 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003316int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003317
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003318/**
3319 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
3320 * @adapter: Adapter data
3321 * @sval: MCC latency value
3322 *
3323 * Send MCC latency value to FW
3324 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003325 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003326 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003327int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003328
3329/**
3330 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
3331 * and PSOC object data
3332 * @psoc: Psoc object data
3333 * @vdev_id: vdev id
3334 *
3335 * Get adapter from vdev id and PSOC object data
3336 *
3337 * Return: adapter pointer
3338 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003339struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003340 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05303341/**
3342 * hdd_unregister_notifiers()- unregister kernel notifiers
3343 * @hdd_ctx: Hdd Context
3344 *
3345 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
3346 *
3347 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003348void hdd_unregister_notifiers(struct hdd_context *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05303349
3350/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303351 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
3352 * @hdd_ctx: HDD context
3353 *
3354 * This function sends the DBS scan selection config configuration to the
3355 * firmware via WMA
3356 *
3357 * Return: 0 - success, < 0 - failure
3358 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003359int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303360
3361/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05303362 * hdd_start_complete()- complete the start event
3363 * @ret: return value for complete event.
3364 *
3365 * complete the startup event and set the return in
3366 * global variable
3367 *
3368 * Return: void
3369 */
3370
3371void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303372
3373/**
3374 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
3375 * callback
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003376 * @hdd_handle: HDD handle
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303377 * @data: chip power save failure detected data
3378 *
3379 * This function reads the chip power save failure detected data and fill in
3380 * the skb with NL attributes and send up the NL event.
3381 * This callback execute in atomic context and must not invoke any
3382 * blocking calls.
3383 *
3384 * Return: none
3385 */
3386
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003387void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle,
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303388 struct chip_pwr_save_fail_detected_params
3389 *data);
3390
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303391/**
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303392 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg
3393 * @ie_whitelist: output parameter
Dundi Raviteja85a240a2018-09-10 15:03:07 +05303394 * @hdd_ctx: pointer to hdd context
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303395 *
3396 * Return: None
3397 */
3398void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
Dundi Raviteja85a240a2018-09-10 15:03:07 +05303399 struct hdd_context *hdd_ctx);
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303400
3401/**
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303402 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache
3403 * @adapter: adapter handle
3404 * @bssid: bssid to look for in scan cache
3405 * @rssi: rssi value found
3406 * @snr: snr value found
3407 *
3408 * Return: QDF_STATUS
3409 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003410int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303411 int8_t *rssi, int8_t *snr);
3412
Ganesh Kondabattini479a8ae2017-10-03 16:49:24 +05303413/**
3414 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters
3415 * @adapter - HDD adapter
3416 *
3417 * Return: 0 on success and non zero value on failure
3418 */
3419int hdd_reset_limit_off_chan(struct hdd_adapter *adapter);
3420
Vignesh Viswanathan3fa1d382017-08-02 19:36:43 +05303421#if defined(WLAN_FEATURE_FILS_SK) && \
3422 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
3423 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303424/**
3425 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and
3426 * free allocated memory
3427 * @adapter: pointer to hdd adapter
3428 *
3429 * Return: None
3430 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003431void hdd_clear_fils_connection_info(struct hdd_adapter *adapter);
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303432
3433/**
3434 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp
3435 * @dev: net device
3436 * @roam_fils_params: Fils join rsp params
3437 *
3438 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM)
3439 * to the network layer.
3440 *
3441 * Return: None
3442 */
Jeff Johnson172237b2017-11-07 15:32:59 -08003443void hdd_update_hlp_info(struct net_device *dev,
3444 struct csr_roam_info *roam_info);
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303445#else
Jeff Johnson9d295242017-08-29 14:39:48 -07003446static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303447{ }
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303448static inline void hdd_update_hlp_info(struct net_device *dev,
Jeff Johnson172237b2017-11-07 15:32:59 -08003449 struct csr_roam_info *roam_info)
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303450{}
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303451#endif
Dustin Brown3fb15042017-08-15 15:54:49 -07003452
3453#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownc81dd412017-08-15 16:26:28 -07003454static inline void hdd_dev_setup_destructor(struct net_device *dev)
3455{
3456 dev->destructor = free_netdev;
3457}
Dustin Brown3fb15042017-08-15 15:54:49 -07003458#else
Dustin Brownc81dd412017-08-15 16:26:28 -07003459static inline void hdd_dev_setup_destructor(struct net_device *dev)
3460{
3461 dev->needs_free_netdev = true;
3462}
Dustin Brownc81dd412017-08-15 16:26:28 -07003463#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brown3fb15042017-08-15 15:54:49 -07003464
Mohit Khannaf8f96822017-05-17 17:11:59 -07003465/**
3466 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API
3467 * @config: hdd config
3468 *
3469 * Return: NONE
3470 */
Nirav Shahd21a2e32018-04-20 16:34:43 +05303471#ifdef CONFIG_DP_TRACE
Mohit Khannaf8f96822017-05-17 17:11:59 -07003472void hdd_dp_trace_init(struct hdd_config *config);
Nirav Shahd21a2e32018-04-20 16:34:43 +05303473#else
3474static inline
3475void hdd_dp_trace_init(struct hdd_config *config) {}
3476#endif
3477
Jeff Johnsona1382382019-03-31 11:08:27 -07003478/**
3479 * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode
3480 * @enable: Set true to enable RPS in SAP mode
3481 *
3482 * Callback function registered with datapath
3483 *
3484 * Return: none
3485 */
Yun Parkff6a16a2017-09-26 16:38:18 -07003486void hdd_set_rx_mode_rps(bool enable);
Mohit Khannaf8f96822017-05-17 17:11:59 -07003487
Ganesh Kondabattini35739572017-06-21 16:26:39 +05303488/**
Jeff Johnson33142e62018-05-06 17:58:36 -07003489 * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100%
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303490 * (0x64). If it exceed make it 100%
3491 *
3492 * @per_index_score: per_index_score as input
3493 *
3494 * Return: per_index_score within the max limit
3495 */
3496uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303497
3498/**
3499 * hdd_update_score_config - API to update candidate scoring related params
3500 * configuration parameters
3501 * @score_config: score config to update
3502 * @cfg: config params
3503 *
3504 * Return: QDF_STATUS
3505 */
3506QDF_STATUS hdd_update_score_config(
3507 struct scoring_config *score_config, struct hdd_context *hdd_ctx);
3508
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05303509/**
3510 * hdd_get_stainfo() - get stainfo for the specified peer
3511 * @astainfo: array of the station info in which the sta info
3512 * corresponding to mac_addr needs to be searched
3513 * @mac_addr: mac address of requested peer
3514 *
3515 * This function find the stainfo for the peer with mac_addr
3516 *
3517 * Return: stainfo if found, NULL if not found
3518 */
3519struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo,
3520 struct qdf_mac_addr mac_addr);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303521
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303522/**
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303523 * hdd_component_psoc_open() - Open the legacy components
3524 * @psoc: Pointer to psoc object
3525 *
3526 * This function opens the legacy components and initializes the
3527 * component's private objects.
3528 *
3529 * Return: QDF_STATUS
3530 */
3531QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc);
3532
3533/**
3534 * hdd_component_psoc_close() - Close the legacy components
3535 * @psoc: Pointer to psoc object
3536 *
3537 * This function closes the legacy components and resets the
3538 * component's private objects.
3539 *
3540 * Return: None
3541 */
3542void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc);
3543
3544/**
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303545 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components
3546 *
3547 * Return: None
3548 */
3549void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc);
3550
3551/**
3552 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components
3553 *
3554 * Return: None
3555 */
3556void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc);
3557
Sandeep Puligillab7beb472018-08-13 22:54:20 -07003558/**
3559 * hdd_component_pdev_open() - Trigger pdev open for CLD Components
3560 *
3561 * Return: QDF_STATUS
3562 */
3563QDF_STATUS hdd_component_pdev_open(struct wlan_objmgr_pdev *pdev);
3564
3565/**
3566 * hdd_component_pdev_close() - Trigger pdev close for CLD Components
3567 *
3568 * Return: None
3569 */
3570void hdd_component_pdev_close(struct wlan_objmgr_pdev *pdev);
3571
Wen Gong3f003382018-05-14 14:26:37 +08003572#ifdef WLAN_FEATURE_MEMDUMP_ENABLE
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +05303573int hdd_driver_memdump_init(void);
3574void hdd_driver_memdump_deinit(void);
Ashish Kumar Dhanotiya64b3fa92019-07-23 15:50:10 +05303575
3576/**
3577 * hdd_driver_mem_cleanup() - Frees memory allocated for
3578 * driver dump
3579 *
3580 * This function frees driver dump memory.
3581 *
3582 * Return: None
3583 */
3584void hdd_driver_mem_cleanup(void);
3585
Wen Gong3f003382018-05-14 14:26:37 +08003586#else /* WLAN_FEATURE_MEMDUMP_ENABLE */
Wen Gongaa6d55d2018-04-26 16:33:21 +08003587static inline int hdd_driver_memdump_init(void)
3588{
3589 return 0;
3590}
3591static inline void hdd_driver_memdump_deinit(void)
3592{
3593}
Ashish Kumar Dhanotiya64b3fa92019-07-23 15:50:10 +05303594
3595static inline void hdd_driver_mem_cleanup(void)
3596{
3597}
Wen Gong3f003382018-05-14 14:26:37 +08003598#endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
Himanshu Agarwalb229a142017-12-21 10:16:45 +05303599/**
Alok Kumarb64650c2018-03-23 17:05:11 +05303600 * hdd_set_disconnect_status() - set adapter disconnection status
3601 * @hdd_adapter: Pointer to hdd adapter
3602 * @disconnecting: Disconnect status to set
3603 *
3604 * Return: None
3605 */
3606void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting);
3607
Nirav Shah73713f72018-05-17 14:50:41 +05303608#ifdef FEATURE_MONITOR_MODE_SUPPORT
Jeff Johnsond9952752018-04-18 12:15:35 -07003609/**
3610 * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface.
3611 * @adapter: Handle to adapter
3612 * @chan: Monitor mode channel
3613 * @bandwidth: Capture channel bandwidth
3614 *
3615 * Return: 0 on success else error code.
3616 */
3617int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3618 uint32_t bandwidth);
Nirav Shah73713f72018-05-17 14:50:41 +05303619#else
3620static inline
3621int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3622 uint32_t bandwidth)
3623{
3624 return 0;
3625}
3626#endif
Jeff Johnsond9952752018-04-18 12:15:35 -07003627
Ryan Hsuaadba072018-04-20 13:01:53 -07003628/**
3629 * hdd_wlan_get_version() - Get version information
3630 * @hdd_ctx: Global HDD context
3631 * @version_len: length of the version buffer size
3632 * @version: the buffer to the version string
3633 *
3634 * This function is used to get Wlan Driver, Firmware, Hardware Version
3635 * & the Board related information.
3636 *
3637 * Return: the length of the version string
3638 */
3639uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
3640 const size_t version_len, uint8_t *version);
Rachit Kankane0dc3e852018-05-07 17:33:42 +05303641/**
3642 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
3643 * @preamble: rate preamble
3644 * @nss: number of streams
3645 * @rate: rate index
3646 *
3647 * Rate code assembling is different for targets which are 11ax capable.
3648 * Check for the target support and assemble the rate code accordingly.
3649 *
3650 * Return: assembled rate code
3651 */
3652int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
3653
3654/**
3655 * hdd_set_11ax_rate() - set 11ax rate
3656 * @adapter: adapter being modified
3657 * @value: new 11ax rate code
3658 * @sap_config: pointer to SAP config to check HW mode
3659 * this will be NULL for call from STA persona
3660 *
3661 * Return: 0 on success, negative errno on failure
3662 */
3663int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
3664 struct sap_config *sap_config);
Ryan Hsuaadba072018-04-20 13:01:53 -07003665
3666/**
3667 * hdd_update_hw_sw_info() - API to update the HW/SW information
3668 * @hdd_ctx: Global HDD context
3669 *
3670 * API to update the HW and SW information in the driver
3671 *
3672 * Note:
3673 * All the version/revision information would only be retrieved after
3674 * firmware download
3675 *
3676 * Return: None
3677 */
3678void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx);
3679
Dundi Raviteja3bcf3a82018-05-22 13:24:18 +05303680/**
3681 * hdd_get_nud_stats_cb() - callback api to update the stats received from FW
3682 * @data: pointer to hdd context.
3683 * @rsp: pointer to data received from FW.
3684 * @context: callback context
3685 *
3686 * This is called when wlan driver received response event for
3687 * get arp stats to firmware.
3688 *
3689 * Return: None
3690 */
3691void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context);
3692
Jeff Johnsonb81b2e02018-06-11 19:13:11 -07003693/**
3694 * hdd_context_get_mac_handle() - get mac handle from hdd context
3695 * @hdd_ctx: Global HDD context pointer
3696 *
3697 * Retrieves the global MAC handle from the HDD context
3698 *
3699 * Return: The global MAC handle (which may be NULL)
3700 */
3701static inline
3702mac_handle_t hdd_context_get_mac_handle(struct hdd_context *hdd_ctx)
3703{
3704 return hdd_ctx ? hdd_ctx->mac_handle : NULL;
3705}
3706
3707/**
3708 * hdd_adapter_get_mac_handle() - get mac handle from hdd adapter
3709 * @adapter: HDD adapter pointer
3710 *
3711 * Retrieves the global MAC handle given an HDD adapter
3712 *
3713 * Return: The global MAC handle (which may be NULL)
3714 */
3715static inline
3716mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter)
3717{
3718 return adapter ?
3719 hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL;
3720}
3721
Jeff Johnsonea70b942018-07-02 09:42:31 -07003722/**
3723 * hdd_handle_to_context() - turn an HDD handle into an HDD context
3724 * @hdd_handle: HDD handle to be converted
3725 *
3726 * Return: HDD context referenced by @hdd_handle
3727 */
3728static inline
3729struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle)
3730{
3731 return (struct hdd_context *)hdd_handle;
3732}
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05303733
3734/**
3735 * wlan_hdd_free_cache_channels() - Free the cache channels list
3736 * @hdd_ctx: Pointer to HDD context
3737 *
3738 * Return: None
3739 */
3740void wlan_hdd_free_cache_channels(struct hdd_context *hdd_ctx);
3741
Ashish Kumar Dhanotiya6784b502018-10-17 12:51:10 +05303742/**
3743 * hdd_update_dynamic_mac() - Updates the dynamic MAC list
3744 * @hdd_ctx: Pointer to HDD context
3745 * @curr_mac_addr: Current interface mac address
3746 * @new_mac_addr: New mac address which needs to be updated
3747 *
3748 * This function updates newly configured MAC address to the
3749 * dynamic MAC address list corresponding to the current
3750 * adapter MAC address
3751 *
3752 * Return: None
3753 */
3754void hdd_update_dynamic_mac(struct hdd_context *hdd_ctx,
3755 struct qdf_mac_addr *curr_mac_addr,
3756 struct qdf_mac_addr *new_mac_addr);
3757
Tiger Yu8b119e92019-04-09 13:55:07 +08003758#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Alok Kumar2fad6442018-11-08 19:19:28 +05303759/**
3760 * wlan_hdd_send_tcp_param_update_event() - Send vendor event to update
3761 * TCP parameter through Wi-Fi HAL
3762 * @hdd_ctx: Pointer to HDD context
3763 * @data: Parameters to update
3764 * @dir: Direction(tx/rx) to update
3765 *
3766 * Return: None
3767 */
3768void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx,
3769 void *data,
3770 uint8_t dir);
3771
3772/**
3773 * wlan_hdd_update_tcp_rx_param() - update TCP param in RX dir
3774 * @hdd_ctx: Pointer to HDD context
3775 * @data: Parameters to update
3776 *
3777 * Return: None
3778 */
3779void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data);
3780
3781/**
3782 * wlan_hdd_update_tcp_tx_param() - update TCP param in TX dir
3783 * @hdd_ctx: Pointer to HDD context
3784 * @data: Parameters to update
3785 *
3786 * Return: None
3787 */
3788void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data);
3789#else
3790static inline
3791void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data)
3792{
3793}
3794
3795static inline
3796void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data)
3797{
3798}
3799
3800static inline
3801void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx,
3802 void *data,
3803 uint8_t dir)
3804{
3805}
Tiger Yu8b119e92019-04-09 13:55:07 +08003806#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Visweswara Tanuku633976b2019-01-07 16:13:12 +05303807
3808#ifdef WLAN_FEATURE_MOTION_DETECTION
3809/**
3810 * hdd_md_host_evt_cb - Callback for Motion Detection Event
3811 * @ctx: HDD context
3812 * @sir_md_evt: motion detect event
3813 *
3814 * Callback for Motion Detection Event. Re-enables Motion
3815 * Detection again upon event
3816 *
3817 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and
3818 * QDF_STATUS_E_FAILURE on failure
3819 */
3820QDF_STATUS hdd_md_host_evt_cb(void *ctx, struct sir_md_evt *event);
3821#endif /* WLAN_FEATURE_MOTION_DETECTION */
3822
Abhinav Kumar338e57d2019-02-04 17:30:10 +05303823/**
3824 * hdd_hidden_ssid_enable_roaming() - enable roaming after hidden ssid rsp
3825 * @hdd_handle: Hdd handler
3826 * @vdev_id: Vdev Id
3827 *
3828 * This is a wrapper function to enable roaming after getting hidden
3829 * ssid rsp
3830 */
3831void hdd_hidden_ssid_enable_roaming(hdd_handle_t hdd_handle, uint8_t vdev_id);
3832
Min Liue34708a2019-02-01 15:00:34 +08003833/**
3834 * hdd_send_update_owe_info_event - Send update OWE info event
3835 * @adapter: Pointer to adapter
3836 * @sta_addr: MAC address of peer STA
3837 * @owe_ie: OWE IE
3838 * @owe_ie_len: Length of OWE IE
3839 *
3840 * Send update OWE info event to hostapd
3841 *
3842 * Return: none
3843 */
3844#ifdef CFG80211_EXTERNAL_DH_UPDATE_SUPPORT
3845void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
3846 uint8_t sta_addr[],
3847 uint8_t *owe_ie,
3848 uint32_t owe_ie_len);
3849#else
3850static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
3851 uint8_t sta_addr[],
3852 uint8_t *owe_ie,
3853 uint32_t owe_ie_len)
3854{
3855}
3856#endif
3857
Rajeev Kumar473f9af2019-04-05 14:25:56 -07003858/**
3859 * hdd_psoc_idle_shutdown - perform idle shutdown after interface inactivity
3860 * timeout
3861 * @device: pointer to struct device
3862 *
3863 * Return: 0 for success non-zero error code for failure
3864 */
3865int hdd_psoc_idle_shutdown(struct device *dev);
3866
3867/**
3868 * hdd_psoc_idle_restart - perform idle restart after idle shutdown
3869 * @device: pointer to struct device
3870 *
3871 * Return: 0 for success non-zero error code for failure
3872 */
3873int hdd_psoc_idle_restart(struct device *dev);
3874
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003875#endif /* end #if !defined(WLAN_HDD_MAIN_H) */