blob: 8895830ea519ed0a48543bd7f4e5ddc4486bbbd6 [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>
Manjunathappa Prakasheb1ec862019-07-28 00:01:18 -070050#ifdef CLD_PM_QOS
51#include <linux/pm_qos.h>
52#endif
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +053053#include <linux/ieee80211.h>
Dustin Brown8d8ab302019-03-05 16:19:36 -080054#include <qdf_delayed_work.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053055#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053056#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080057#include "sir_mac_prot_def.h"
58#include "csr_api.h"
Dustin Brown21a1d462018-07-31 15:13:06 -070059#include "wlan_dsc.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060#include <wlan_hdd_assoc.h>
61#include <wlan_hdd_wmm.h>
62#include <wlan_hdd_cfg.h>
63#include <linux/spinlock.h>
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +053064#include <ani_system_defs.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
66#include <linux/wakelock.h>
67#endif
Subrat Dash5f36fbe2019-02-12 16:28:14 +053068#ifdef WLAN_FEATURE_TSF_PTP
69#include <linux/ptp_classify.h>
70#include <linux/ptp_clock_kernel.h>
71#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080073#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070074#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075#include "wlan_hdd_cfg80211.h"
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +053076#include "wlan_hdd_debugfs.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053077#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080080#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070081#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070082#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080083#if defined(CONFIG_HL_SUPPORT)
84#include "wlan_tgt_def_config_hl.h"
85#else
Dustin Brown61269462016-09-19 13:25:45 -070086#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080087#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053088#include <wlan_objmgr_cmn.h>
89#include <wlan_objmgr_global_obj.h>
90#include <wlan_objmgr_psoc_obj.h>
91#include <wlan_objmgr_pdev_obj.h>
92#include <wlan_objmgr_vdev_obj.h>
93#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053094#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080095#ifdef WIFI_POS_CONVERGED
96#include "os_if_wifi_pos.h"
97#include "wifi_pos_api.h"
98#else
99#include "wlan_hdd_oemdata.h"
100#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -0800101#include "wlan_hdd_he.h"
102
Alok Kumarb64650c2018-03-23 17:05:11 +0530103#include <net/neighbour.h>
104#include <net/netevent.h>
105#include "wlan_hdd_nud_tracking.h"
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -0700106#include "wlan_hdd_twt.h"
Jeff Johnsonf9176382018-07-17 19:15:58 -0700107#include "wma_sar_public_structs.h"
Wu Gaoca416ff2018-09-17 11:05:07 +0800108#include "wlan_mlme_ucfg_api.h"
Jinwei Chenb681a482019-08-14 15:24:06 +0800109#include "pld_common.h"
Alok Kumarb64650c2018-03-23 17:05:11 +0530110
Tiger Yu8b119e92019-04-09 13:55:07 +0800111#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Browna20bad52019-03-05 12:03:30 -0800112#include "qdf_periodic_work.h"
113#endif
114
Sourav Mohapatra43e6dea2019-08-18 11:39:23 +0530115#include "wlan_hdd_sta_info.h"
116
Jeff Johnsonef926352017-01-12 10:41:02 -0800117/*
118 * Preprocessor definitions and constants
119 */
120
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +0530121#ifdef FEATURE_WLAN_APF
122/**
123 * struct hdd_apf_context - hdd Context for apf
124 * @magic: magic number
125 * @qdf_apf_event: Completion variable for APF get operations
126 * @capability_response: capabilities response received from fw
127 * @apf_enabled: True: APF Interpreter enabled, False: Disabled
128 * @cmd_in_progress: Flag that indicates an APF command is in progress
129 * @buf: Buffer to accumulate read memory chunks
130 * @buf_len: Length of the read memory requested
131 * @offset: APF work memory offset to fetch from
132 * @lock: APF Context lock
133 */
134struct hdd_apf_context {
135 unsigned int magic;
136 qdf_event_t qdf_apf_event;
137 bool apf_enabled;
138 bool cmd_in_progress;
139 uint8_t *buf;
140 uint32_t buf_len;
141 uint32_t offset;
142 qdf_spinlock_t lock;
143};
144#endif /* FEATURE_WLAN_APF */
145
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146/** Number of Tx Queues */
hangtianb9c91362019-06-07 10:39:38 +0800147#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || \
148 defined(QCA_HL_NETDEV_FLOW_CONTROL) || \
149 defined(QCA_LL_PDEV_TX_FLOW_CONTROL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800150#define NUM_TX_QUEUES 5
151#else
152#define NUM_TX_QUEUES 4
153#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800154
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -0700155/*
156 * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're
157 * in a compat syscall or not. It is a new way to query the syscall type, which
158 * works properly on all architectures.
159 *
160 */
161#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
162static inline bool in_compat_syscall(void) { return is_compat_task(); }
163#endif
164
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700165#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
166 defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700167#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ
168#define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700169#define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700170#else
171#define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
172#define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700173#define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700174#endif
175
Liangwei Dong692455f2019-08-09 17:59:46 +0800176#if defined(CONFIG_BAND_6GHZ) && (defined(CFG80211_6GHZ_BAND_SUPPORTED) || \
177 (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE))
178#define HDD_NL80211_BAND_6GHZ NL80211_BAND_6GHZ
179#endif
180
Sourav Mohapatra0f3b8572018-09-12 10:03:51 +0530181#define TSF_GPIO_PIN_INVALID 255
182
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800183/** Length of the TX queue for the netdev */
184#define HDD_NETDEV_TX_QUEUE_LEN (3000)
185
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186/** Hdd Tx Time out value */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530188
189#define HDD_TX_STALL_THRESHOLD 4
190
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191/** Hdd Default MTU */
192#define HDD_DEFAULT_MTU (1500)
193
194#ifdef QCA_CONFIG_SMP
195#define NUM_CPUS NR_CPUS
196#else
197#define NUM_CPUS 1
198#endif
199
Alan Chen5b19c212019-07-19 10:44:42 -0700200#define HDD_PSOC_IDLE_SHUTDOWN_SUSPEND_DELAY (1000)
Dustin Brown20f9fc42018-08-30 15:19:12 -0700201/**
202 * enum hdd_adapter_flags - event bitmap flags registered net device
203 * @NET_DEVICE_REGISTERED: Adapter is registered with the kernel
204 * @SME_SESSION_OPENED: Firmware vdev has been created
205 * @INIT_TX_RX_SUCCESS: Adapter datapath is initialized
206 * @WMM_INIT_DONE: Adapter is initialized
207 * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running
208 * @DEVICE_IFACE_OPENED: Adapter has been "opened" via the kernel
209 * @ACS_PENDING: Auto Channel Selection (ACS) is pending
210 * @SOFTAP_INIT_DONE: Software Access Point (SAP) is initialized
211 * @VENDOR_ACS_RESPONSE_PENDING: Waiting for event for vendor acs
Arunk Khandavalli987c8d52018-06-21 17:40:31 +0530212 * @DOWN_DURING_SSR: Mark interface is down during SSR
Dustin Brown20f9fc42018-08-30 15:19:12 -0700213 */
214enum hdd_adapter_flags {
215 NET_DEVICE_REGISTERED,
216 SME_SESSION_OPENED,
217 INIT_TX_RX_SUCCESS,
218 WMM_INIT_DONE,
219 SOFTAP_BSS_STARTED,
220 DEVICE_IFACE_OPENED,
221 ACS_PENDING,
222 SOFTAP_INIT_DONE,
223 VENDOR_ACS_RESPONSE_PENDING,
Arunk Khandavalli987c8d52018-06-21 17:40:31 +0530224 DOWN_DURING_SSR,
Dustin Brown20f9fc42018-08-30 15:19:12 -0700225};
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800226
Dustin Brown20f9fc42018-08-30 15:19:12 -0700227/**
228 * enum hdd_driver_flags - HDD global event bitmap flags
229 * @ACS_IN_PROGRESS: Auto Channel Selection (ACS) in progress
230 */
231enum hdd_driver_flags {
232 ACS_IN_PROGRESS,
233};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234
Abhishek Singhe9706cc2017-10-12 17:25:06 +0530235#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
Abhishek Singh533c9da2017-05-04 10:23:34 +0530236#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237#define WLAN_WAIT_TIME_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800238#define WLAN_WAIT_TIME_LINK_STATUS 800
Abhishek Singh13bf0ce2018-10-24 14:26:14 +0530239
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800240/** Maximum time(ms) to wait for mc thread suspend **/
241#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
242
243/** Maximum time(ms) to wait for target to be ready for suspend **/
244#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246/* Scan Req Timeout */
247#define WLAN_WAIT_TIME_SCAN_REQ 100
248
Nachiket Kukadee547a482018-05-22 16:43:30 +0530249#define WLAN_WAIT_TIME_APF 1000
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530250
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +0530251#define WLAN_WAIT_TIME_FW_ROAM_STATS 1000
252
guangde4853c402019-05-06 15:54:04 +0800253#define WLAN_WAIT_TIME_ANTENNA_ISOLATION 8000
254
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530255/* Maximum time(ms) to wait for RSO CMD status event */
256#define WAIT_TIME_RSO_CMD_STATUS 2000
257
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530258/* rcpi request timeout in milli seconds */
259#define WLAN_WAIT_TIME_RCPI 500
260
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800261#define MAX_CFG_STRING_LEN 255
262
Kapil Gupta8878ad92017-02-13 11:56:04 +0530263/* Maximum time(ms) to wait for external acs response */
264#define WLAN_VENDOR_ACS_WAIT_TIME 1000
265
Srinivas Girigowdacb7b8b82019-04-10 14:27:47 -0700266/* Mac Address string length */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800267#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700268/* Max and min IEs length in bytes */
269#define MAX_GENIE_LEN (512)
270#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800271
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700272#define WPS_OUI_TYPE "\x00\x50\xf2\x04"
273#define WPS_OUI_TYPE_SIZE 4
274
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700275#define P2P_OUI_TYPE "\x50\x6f\x9a\x09"
276#define P2P_OUI_TYPE_SIZE 4
277
278#define HS20_OUI_TYPE "\x50\x6f\x9a\x10"
279#define HS20_OUI_TYPE_SIZE 4
280
281#define OSEN_OUI_TYPE "\x50\x6f\x9a\x12"
282#define OSEN_OUI_TYPE_SIZE 4
283
284#ifdef WLAN_FEATURE_WFD
285#define WFD_OUI_TYPE "\x50\x6f\x9a\x0a"
286#define WFD_OUI_TYPE_SIZE 4
287#endif
288
289#define MBO_OUI_TYPE "\x50\x6f\x9a\x16"
290#define MBO_OUI_TYPE_SIZE 4
291
292#define QCN_OUI_TYPE "\x8c\xfd\xf0\x01"
293#define QCN_OUI_TYPE_SIZE 4
294
295#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
296 wlan_get_vendor_ie_ptr_from_oui(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, \
297 ie, ie_len)
298
Dustin Brown632af712018-03-14 15:03:55 -0700299#define hdd_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_HDD, params)
300#define hdd_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_HDD, params)
301#define hdd_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_HDD, params)
302#define hdd_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_HDD, params)
303#define hdd_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_HDD, params)
304
Nirav Shah790d9432018-07-12 19:42:48 +0530305#define hdd_nofl_alert(params...) \
306 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_HDD, params)
307#define hdd_nofl_err(params...) \
308 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_HDD, params)
309#define hdd_nofl_warn(params...) \
310 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_HDD, params)
311#define hdd_nofl_info(params...) \
312 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_HDD, params)
313#define hdd_nofl_debug(params...) \
314 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_HDD, params)
315
Dustin Brown500ae3d2018-03-19 12:47:33 -0700316#define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params)
317#define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params)
318#define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params)
319#define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params)
320#define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params)
Rajeev Kumar5cb007f2017-07-27 16:19:31 -0700321
Nirav Shahd6fa0f82018-07-06 15:52:25 +0530322#define hdd_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter")
323#define hdd_enter_dev(dev) \
324 QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter(%s)", (dev)->name)
325#define hdd_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_HDD, "exit")
Dustin Brown32a61182018-03-14 12:14:00 -0700326
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700327#define WLAN_HDD_GET_PRIV_PTR(__dev__) \
328 (struct hdd_adapter *)(netdev_priv((__dev__)))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800329
330#define MAX_NO_OF_2_4_CHANNELS 14
331
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800332#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800333
334#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700335 (((center_freq) == 2412) || ((center_freq) == 2437) || \
336 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800337
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800338#define WLAN_HDD_QOS_ACTION_FRAME 1
339#define WLAN_HDD_QOS_MAP_CONFIGURE 4
Dustin Brownd0a76562017-10-13 14:48:37 -0700340#define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800341
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700342/* SAP client disconnect wake lock duration in milli seconds */
Dustin Brownd0a76562017-10-13 14:48:37 -0700343#define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \
344 WAKELOCK_DURATION_RECOMMENDED
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700345
Paul Zhang8bbbcdf2018-06-01 11:14:57 +0800346#define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3)
347#define HDD_CFG_REQUEST_FIRMWARE_DELAY (20)
348
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800349#define MAX_USER_COMMAND_SIZE 4096
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530350#define DNS_DOMAIN_NAME_MAX_LEN 255
351#define ICMPv6_ADDR_LEN 16
352
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800353
354#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
355#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
356
357/* If IPA UC data path is enabled, target should reserve extra tx descriptors
358 * for IPA data path.
359 * Then host data path should allow less TX packet pumping in case
360 * IPA data path enabled
361 */
362#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
363
Ryan Hsu07495ea2016-01-21 15:25:39 -0800364/*
365 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
366 * here if the Kernel version is less than 3.17 to avoid the interleave
367 * conditional compilation.
368 */
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700369#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\
370 defined(WITH_BACKPORTS))
Ryan Hsu07495ea2016-01-21 15:25:39 -0800371#define NET_NAME_UNKNOWN 0
372#endif
373
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530374#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530375
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530376#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
Abhishek Singh00130682017-07-14 10:46:17 +0530377#define SCAN_REJECT_THRESHOLD 15
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530378
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530379/* Default Psoc id */
380#define DEFAULT_PSOC_ID 1
381
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530382/* wait time for nud stats in milliseconds */
383#define WLAN_WAIT_TIME_NUD_STATS 800
384/* nud stats skb max length */
385#define WLAN_NUD_STATS_LEN 800
386/* ARP packet type for NUD debug stats */
387#define WLAN_NUD_STATS_ARP_PKT_TYPE 1
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +0530388/* Assigned size of driver memory dump is 4096 bytes */
389#define DRIVER_MEM_DUMP_SIZE 4096
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530390
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800391/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800392 * Prevent from permanent stall, resume OS Q if timer expired
393 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800394#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
395#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
396#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
397
Nirav Shah997e0832018-06-06 17:49:12 +0530398#ifndef NUM_TX_RX_HISTOGRAM
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700399#define NUM_TX_RX_HISTOGRAM 128
Nirav Shah997e0832018-06-06 17:49:12 +0530400#endif
401
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800402#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
403
Mohit Khannae71e2262015-11-10 09:37:24 -0800404/**
Jeff Johnson37ecea42018-03-18 17:54:40 -0700405 * enum hdd_auth_key_mgmt - auth key mgmt protocols
406 * @HDD_AUTH_KEY_MGMT_802_1X: 802.1x
407 * @HDD_AUTH_KEY_MGMT_PSK: PSK
408 * @HDD_AUTH_KEY_MGMT_CCKM: CCKM
409 */
410enum hdd_auth_key_mgmt {
411 HDD_AUTH_KEY_MGMT_802_1X = BIT(0),
412 HDD_AUTH_KEY_MGMT_PSK = BIT(1),
413 HDD_AUTH_KEY_MGMT_CCKM = BIT(2)
414};
415
416/**
Mohit Khannae71e2262015-11-10 09:37:24 -0800417 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
418 * received over 100ms intervals
419 * @interval_rx: # of rx packets received in the last 100ms interval
420 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700421 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800422 * determined on the basis of total tx and rx packets
423 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700424 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800425 * determined on the basis of rx packets received in the
426 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700427 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800428 * determined on the basis of tx packets received in the
429 * last 100ms interval
Manjunathappa Prakash35af2e22019-07-30 20:23:34 -0700430 * @is_rx_pm_qos_high Capture rx_pm_qos voting
431 * @is_tx_pm_qos_high Capture tx_pm_qos voting
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800432 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800433 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800434 * The structure keeps track of throughput requirements of wlan driver.
435 * An entry is added if either of next_vote_level, next_rx_level or
436 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800437 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800438struct hdd_tx_rx_histogram {
439 uint64_t interval_rx;
440 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800441 uint32_t next_vote_level;
442 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800443 uint32_t next_tx_level;
Manjunathappa Prakash35af2e22019-07-30 20:23:34 -0700444 bool is_rx_pm_qos_high;
445 bool is_tx_pm_qos_high;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800446 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447};
448
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700449struct hdd_tx_rx_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450 /* start_xmit stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700451 __u32 tx_called;
452 __u32 tx_dropped;
453 __u32 tx_orphaned;
454 __u32 tx_classified_ac[NUM_TX_QUEUES];
455 __u32 tx_dropped_ac[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800456
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800457 /* rx stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700458 __u32 rx_packets[NUM_CPUS];
459 __u32 rx_dropped[NUM_CPUS];
460 __u32 rx_delivered[NUM_CPUS];
461 __u32 rx_refused[NUM_CPUS];
Manjunathappa Prakashf39d2372019-02-25 18:18:57 -0800462 qdf_atomic_t rx_usolict_arp_n_mcast_drp;
Mohit Khannaf0620ce2019-07-28 21:31:05 -0700463
Mohit Khanna81418772018-10-30 14:14:46 -0700464 /* rx gro */
465 __u32 rx_aggregated;
Manjunathappa Prakash78b6a882019-03-28 19:59:23 -0700466 __u32 rx_gro_dropped;
Mohit Khanna81418772018-10-30 14:14:46 -0700467 __u32 rx_non_aggregated;
Jinwei Chenb681a482019-08-14 15:24:06 +0800468 __u32 rx_gro_flush_skip;
Jinwei Chen0dc383e2019-08-23 00:43:04 +0800469 __u32 rx_gro_low_tput_flush;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800470
471 /* txflow stats */
472 bool is_txflow_paused;
473 __u32 txflow_pause_cnt;
474 __u32 txflow_unpause_cnt;
475 __u32 txflow_timer_cnt;
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530476
477 /*tx timeout stats*/
478 __u32 tx_timeout_cnt;
479 __u32 cont_txtimeout_cnt;
480 u64 jiffies_last_txtimeout;
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700481};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800482
483#ifdef WLAN_FEATURE_11W
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700484/**
485 * struct hdd_pmf_stats - Protected Management Frame statistics
Jeff Johnsondc179f42017-10-21 11:27:26 -0700486 * @num_unprot_deauth_rx: Number of unprotected deauth frames received
487 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700488 */
489struct hdd_pmf_stats {
Jeff Johnsondc179f42017-10-21 11:27:26 -0700490 uint8_t num_unprot_deauth_rx;
491 uint8_t num_unprot_disassoc_rx;
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700492};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493#endif
494
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530495/**
496 * struct hdd_arp_stats_s - arp debug stats count
497 * @tx_arp_req_count: no. of arp req received from network stack
498 * @rx_arp_rsp_count: no. of arp res received from FW
499 * @tx_dropped: no. of arp req dropped at hdd layer
500 * @rx_dropped: no. of arp res dropped
501 * @rx_delivered: no. of arp res delivered to network stack
502 * @rx_refused: no of arp rsp refused (not delivered) to network stack
503 * @tx_host_fw_sent: no of arp req sent by FW OTA
504 * @rx_host_drop_reorder: no of arp res dropped by host
505 * @rx_fw_cnt: no of arp res received by FW
506 * @tx_ack_cnt: no of arp req acked by FW
507 */
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530508struct hdd_arp_stats_s {
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +0530509 uint16_t tx_arp_req_count;
510 uint16_t rx_arp_rsp_count;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530511 uint16_t tx_dropped;
512 uint16_t rx_dropped;
513 uint16_t rx_delivered;
514 uint16_t rx_refused;
515 uint16_t tx_host_fw_sent;
516 uint16_t rx_host_drop_reorder;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530517 uint16_t rx_fw_cnt;
518 uint16_t tx_ack_cnt;
519};
520
Jeff Johnson07f94742017-08-14 15:55:40 -0700521/**
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530522 * struct hdd_dns_stats_s - dns debug stats count
523 * @tx_dns_req_count: no. of dns query received from network stack
524 * @rx_dns_rsp_count: no. of dns res received from FW
525 * @tx_dropped: no. of dns query dropped at hdd layer
526 * @rx_delivered: no. of dns res delivered to network stack
527 * @rx_refused: no of dns res refused (not delivered) to network stack
528 * @tx_host_fw_sent: no of dns query sent by FW OTA
529 * @rx_host_drop: no of dns res dropped by host
530 * @tx_ack_cnt: no of dns req acked by FW
Jeff Johnson07f94742017-08-14 15:55:40 -0700531 */
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530532struct hdd_dns_stats_s {
533 uint16_t tx_dns_req_count;
534 uint16_t rx_dns_rsp_count;
535 uint16_t tx_dropped;
536 uint16_t rx_delivered;
537 uint16_t rx_refused;
538 uint16_t tx_host_fw_sent;
539 uint16_t rx_host_drop;
540 uint16_t tx_ack_cnt;
541};
542
543/**
544 * struct hdd_tcp_stats_s - tcp debug stats count
545 * @tx_tcp_syn_count: no. of tcp syn received from network stack
546 * @@tx_tcp_ack_count: no. of tcp ack received from network stack
547 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW
548 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer
549 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer
550 * @rx_delivered: no. of tcp syn ack delivered to network stack
551 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack
552 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA
553 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA
554 * @rx_host_drop: no of tcp syn ack dropped by host
555 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW
556 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW
557 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not
558 * @is_tcp_ack_sent: flag to check tcp ack sent or not
559 */
560struct hdd_tcp_stats_s {
561 uint16_t tx_tcp_syn_count;
562 uint16_t tx_tcp_ack_count;
563 uint16_t rx_tcp_syn_ack_count;
564 uint16_t tx_tcp_syn_dropped;
565 uint16_t tx_tcp_ack_dropped;
566 uint16_t rx_delivered;
567 uint16_t rx_refused;
568 uint16_t tx_tcp_syn_host_fw_sent;
569 uint16_t tx_tcp_ack_host_fw_sent;
570 uint16_t rx_host_drop;
571 uint16_t rx_fw_cnt;
572 uint16_t tx_tcp_syn_ack_cnt;
573 uint16_t tx_tcp_ack_ack_cnt;
574 bool is_tcp_syn_ack_rcv;
575 bool is_tcp_ack_sent;
576
577};
578
579/**
580 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count
581 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack
582 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW
583 * @tx_dropped: no. of icmpv4 req dropped at hdd layer
584 * @rx_delivered: no. of icmpv4 res delivered to network stack
585 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack
586 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA
587 * @rx_host_drop: no of icmpv4 res dropped by host
588 * @rx_fw_cnt: no of icmpv4 res received by FW
589 * @tx_ack_cnt: no of icmpv4 req acked by FW
590 */
591struct hdd_icmpv4_stats_s {
592 uint16_t tx_icmpv4_req_count;
593 uint16_t rx_icmpv4_rsp_count;
594 uint16_t tx_dropped;
595 uint16_t rx_delivered;
596 uint16_t rx_refused;
597 uint16_t tx_host_fw_sent;
598 uint16_t rx_host_drop;
599 uint16_t rx_fw_cnt;
600 uint16_t tx_ack_cnt;
601};
602
Sourav Mohapatra9c398f02018-09-03 11:10:37 +0530603/**
604 * struct hdd_peer_stats - Peer stats at HDD level
605 * @rx_count: RX count
606 * @rx_bytes: RX bytes
607 * @fcs_count: FCS err count
608 */
609struct hdd_peer_stats {
610 uint32_t rx_count;
611 uint64_t rx_bytes;
612 uint32_t fcs_count;
613};
614
Jeff Johnson07f94742017-08-14 15:55:40 -0700615struct hdd_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800616 tCsrSummaryStatsInfo summary_stat;
Jeff Johnson861dd4f2017-10-24 10:10:40 -0700617 tCsrGlobalClassAStatsInfo class_a_stat;
Jeff Johnsonf8cadec2017-10-24 10:21:25 -0700618 tCsrGlobalClassDStatsInfo class_d_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530619 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700620 struct hdd_tx_rx_stats tx_rx_stats;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530621 struct hdd_arp_stats_s hdd_arp_stats;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530622 struct hdd_dns_stats_s hdd_dns_stats;
623 struct hdd_tcp_stats_s hdd_tcp_stats;
624 struct hdd_icmpv4_stats_s hdd_icmpv4_stats;
Sourav Mohapatra9c398f02018-09-03 11:10:37 +0530625 struct hdd_peer_stats peer_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800626#ifdef WLAN_FEATURE_11W
Jeff Johnsondc179f42017-10-21 11:27:26 -0700627 struct hdd_pmf_stats hdd_pmf_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800628#endif
Jeff Johnson07f94742017-08-14 15:55:40 -0700629};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800630
Jeff Johnson41a64962017-08-14 15:29:42 -0700631/**
632 * struct hdd_roaming_info - HDD Internal Roaming Information
Jeff Johnson41a64962017-08-14 15:29:42 -0700633 * @bssid: BSSID to which we are connected
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700634 * @peer_mac: Peer MAC address for IBSS connection
635 * @roam_id: Unique identifier for a roaming instance
636 * @roam_status: Current roam command status
637 * @defer_key_complete: Should key complete be deferred?
Jeff Johnson41a64962017-08-14 15:29:42 -0700638 *
639 */
640struct hdd_roaming_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800641 tSirMacAddr bssid;
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700642 tSirMacAddr peer_mac;
643 uint32_t roam_id;
644 eRoamCmdStatus roam_status;
645 bool defer_key_complete;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646
Jeff Johnson41a64962017-08-14 15:29:42 -0700647};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800648
649#ifdef FEATURE_WLAN_WAPI
650/* Define WAPI macros for Length, BKID count etc*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800651#define MAX_NUM_AKM_SUITES 16
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800652
653/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700654enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800655 WAPI_AUTH_MODE_OPEN = 0,
656 WAPI_AUTH_MODE_PSK = 1,
657 WAPI_AUTH_MODE_CERT
658} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800659
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
661#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800662#define WAPI_PSK_AKM_SUITE 0x02721400
663#define WAPI_CERT_AKM_SUITE 0x01721400
664
Jeff Johnson89798aa2017-08-16 11:00:56 -0700665/**
666 * struct hdd_wapi_info - WAPI Information structure definition
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700667 * @wapi_mode: Is WAPI enabled on this adapter?
668 * @is_wapi_sta: Is the STA associated with WAPI?
669 * @wapi_auth_mode: WAPI authentication mode used by this adapter
Jeff Johnson89798aa2017-08-16 11:00:56 -0700670 */
671struct hdd_wapi_info {
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700672 bool wapi_mode;
673 bool is_wapi_sta;
674 enum wapi_auth_mode wapi_auth_mode;
Jeff Johnson89798aa2017-08-16 11:00:56 -0700675};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800676#endif /* FEATURE_WLAN_WAPI */
677
Jeff Johnson44e52172017-09-30 16:39:16 -0700678struct hdd_beacon_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800679 u8 *head;
680 u8 *tail;
681 u8 *proberesp_ies;
682 u8 *assocresp_ies;
683 int head_len;
684 int tail_len;
685 int proberesp_ies_len;
686 int assocresp_ies_len;
687 int dtim_period;
Jeff Johnson44e52172017-09-30 16:39:16 -0700688};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690/**
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700691 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
wadesong59e727c2019-07-25 13:52:06 +0800692 * @freq: Channel frequency.
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700693 * @cb_mode: Channel bonding
694 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
695 * @phy_mode: PHY mode
696 */
697struct hdd_mon_set_ch_info {
wadesong59e727c2019-07-25 13:52:06 +0800698 uint32_t freq;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700699 uint8_t cb_mode;
700 uint32_t channel_width;
701 eCsrPhyMode phy_mode;
702};
703
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700704/**
705 * struct hdd_station_ctx -- STA-specific information
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700706 * @roam_profile: current roaming profile
707 * @security_ie: WPA or RSN IE used by the @roam_profile
708 * @assoc_additional_ie: association additional IE used by the @roam_profile
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700709 * @wpa_versions: bitmap of supported WPA versions
Jeff Johnson37ecea42018-03-18 17:54:40 -0700710 * @auth_key_mgmt: bitmap of supported auth key mgmt protocols
Jeff Johnson731bc322017-10-14 19:53:44 -0700711 * @requested_bssid: Specific BSSID to which to connect
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700712 * @conn_info: current connection information
713 * @roam_info: current roaming information
714 * @ft_carrier_on: is carrier on
715 * @ibss_sta_generation: current ibss generation. Incremented whenever
716 * ibss New peer joins and departs the network
717 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key
718 * installed?
719 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if
720 * @ibss_enc_key_installed is %true)
721 * @ibss_peer_info: information about the ibss peer
Jeff Johnson690fe952017-10-25 11:48:39 -0700722 * @hdd_reassoc_scenario: is station in the middle of reassociation?
Jeff Johnson8380f232017-10-25 12:39:44 -0700723 * @sta_debug_state: STA context debug variable
Jeff Johnson0a082d92019-03-04 12:25:49 -0800724 * @broadcast_sta_id: STA ID assigned for broadcast frames
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700725 * @ch_info: monitor mode channel information
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700726 * @ap_supports_immediate_power_save: Does the current AP allow our STA
727 * to immediately go into power save?
728 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800729struct hdd_station_ctx {
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700730 struct csr_roam_profile roam_profile;
Srinivas Girigowdacf161402019-03-14 11:37:33 -0700731 uint8_t security_ie[WLAN_MAX_IE_LEN];
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700732 tSirAddie assoc_additional_ie;
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700733 enum nl80211_wpa_versions wpa_versions;
Jeff Johnson37ecea42018-03-18 17:54:40 -0700734 enum hdd_auth_key_mgmt auth_key_mgmt;
Jeff Johnson731bc322017-10-14 19:53:44 -0700735 struct qdf_mac_addr requested_bssid;
Jeff Johnsone4bad252017-08-14 14:09:28 -0700736 struct hdd_connection_info conn_info;
Ashish Kumar Dhanotiya36d19b02018-02-22 00:59:49 +0530737 struct hdd_connection_info cache_conn_info;
Jeff Johnson41a64962017-08-14 15:29:42 -0700738 struct hdd_roaming_info roam_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800739 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800740 int ibss_sta_generation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800741 bool ibss_enc_key_installed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800742 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700743 tSirPeerInfoRspParams ibss_peer_info;
Jeff Johnson690fe952017-10-25 11:48:39 -0700744 bool hdd_reassoc_scenario;
Jeff Johnson8380f232017-10-25 12:39:44 -0700745 int sta_debug_state;
Jeff Johnson0a082d92019-03-04 12:25:49 -0800746 uint8_t broadcast_sta_id;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700747 struct hdd_mon_set_ch_info ch_info;
Krunal Soni364e0872017-05-10 21:24:34 -0700748 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800749};
750
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700751/**
752 * enum bss_state - current state of the BSS
753 * @BSS_STOP: BSS is stopped
754 * @BSS_START: BSS is started
755 */
756enum bss_state {
757 BSS_STOP,
758 BSS_START,
759};
760
761/**
762 * struct hdd_hostapd_state - hostapd-related state information
763 * @bss_state: Current state of the BSS
764 * @qdf_event: Event to synchronize actions between hostapd thread and
765 * internal callback threads
766 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS
767 * is issued userspace thread can wait on this event. The event will
768 * be set when the Stop BSS processing in UMAC has completed.
Jeff Johnsonb9424862017-10-30 08:49:35 -0700769 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation.
770 * When a STA is disassociated userspace thread can wait on this
771 * event. The event will be set when the STA Disassociation
772 * processing in UMAC has completed.
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700773 * @qdf_status: Used to communicate state from other threads to the
774 * userspace thread.
775 */
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700776struct hdd_hostapd_state {
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700777 enum bss_state bss_state;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530778 qdf_event_t qdf_event;
779 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800780 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530781 QDF_STATUS qdf_status;
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700782};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800783
wadesong9b819072017-02-07 16:42:09 +0800784/**
785 * enum bss_stop_reason - reasons why a BSS is stopped.
786 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
787 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
788 * driver is trying to switch AP role to a different channel
789 * to maintain SCC mode with the STA role on the same card.
790 * this usually happens when STA is connected to an external
791 * AP that runs on a different channel
hqu73bccf22017-10-28 15:34:17 +0800792 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to
793 * vendor subcmd set sap config channel
wadesong9b819072017-02-07 16:42:09 +0800794 */
795enum bss_stop_reason {
796 BSS_STOP_REASON_INVALID = 0,
797 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
hqu73bccf22017-10-28 15:34:17 +0800798 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2,
wadesong9b819072017-02-07 16:42:09 +0800799};
800
Will Huang496b36c2017-07-11 16:38:50 +0800801/**
802 * struct hdd_rate_info - rate_info in HDD
803 * @rate: tx/rx rate (kbps)
804 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode)
805 * @nss: number of streams
806 * @mcs: mcs index for HT/VHT mode
807 * @rate_flags: rate flags for last tx/rx
808 *
809 * rate info in HDD
810 */
811struct hdd_rate_info {
812 uint32_t rate;
813 uint8_t mode;
814 uint8_t nss;
815 uint8_t mcs;
816 uint8_t rate_flags;
817};
818
819/**
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +0530820 * struct hdd_mic_info - mic error info in HDD
821 * @ta_mac_addr: transmitter mac address
822 * @multicast: Flag for multicast
823 * @key_id: Key ID
824 * @tsc: Sequence number
825 * @vdev_id: vdev id
826 *
827 */
828struct hdd_mic_error_info {
829 struct qdf_mac_addr ta_mac_addr;
830 bool multicast;
831 uint8_t key_id;
832 uint8_t tsc[SIR_CIPHER_SEQ_CTR_SIZE];
833 uint16_t vdev_id;
834};
835
836enum hdd_mic_work_status {
837 MIC_UNINITIALIZED,
838 MIC_INITIALIZED,
839 MIC_SCHEDULED,
840 MIC_DISABLED
841};
842
843/**
844 * struct hdd_mic_work - mic work info in HDD
845 * @mic_error_work: mic error work
846 * @status: sattus of mic error work
847 * @info: Pointer to mic error information
848 * @lock: lock to synchronixe mic error work
849 *
850 */
851struct hdd_mic_work {
852 qdf_work_t work;
853 enum hdd_mic_work_status status;
854 struct hdd_mic_error_info *info;
855 qdf_spinlock_t lock;
856};
857
858/**
Will Huang496b36c2017-07-11 16:38:50 +0800859 * struct hdd_fw_txrx_stats - fw txrx status in HDD
860 * (refer to station_info struct in Kernel)
861 * @tx_packets: packets transmitted to this station
862 * @tx_bytes: bytes transmitted to this station
863 * @rx_packets: packets received from this station
864 * @rx_bytes: bytes received from this station
865 * @rx_retries: cumulative retry counts
866 * @tx_failed: number of failed transmissions
867 * @rssi: The signal strength (dbm)
868 * @tx_rate: last used tx rate info
869 * @rx_rate: last used rx rate info
870 *
871 * fw txrx status in HDD
872 */
873struct hdd_fw_txrx_stats {
874 uint32_t tx_packets;
875 uint64_t tx_bytes;
876 uint32_t rx_packets;
877 uint64_t rx_bytes;
878 uint32_t tx_retries;
879 uint32_t tx_failed;
880 int8_t rssi;
881 struct hdd_rate_info tx_rate;
882 struct hdd_rate_info rx_rate;
883};
884
885/**
Jeff Johnsonf283c972017-10-26 12:30:49 -0700886 * struct hdd_ap_ctx - SAP/P2PGO specific information
887 * @hostapd_state: state control information
Jeff Johnson01206862017-10-27 20:55:59 -0700888 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC?
Jeff Johnson136c51b2017-10-27 20:02:41 -0700889 * @ap_active: Are any stations active?
Jeff Johnson82ceb082017-10-27 14:52:42 -0700890 * @disable_intrabss_fwd: Prevent forwarding between stations
Jeff Johnson42518cf2017-10-26 13:33:29 -0700891 * @broadcast_sta_id: Station ID assigned after BSS starts
Jeff Johnsonc8d94a12017-10-27 14:02:53 -0700892 * @privacy: The privacy bits of configuration
Jeff Johnsona8e686b2017-10-27 15:05:18 -0700893 * @encryption_type: The encryption being used
Jeff Johnson413c15f2017-10-27 18:56:35 -0700894 * @group_key: Group Encryption Key
Jeff Johnson3d731362017-10-27 19:06:41 -0700895 * @wep_key: WEP key array
896 * @wep_def_key_idx: WEP default key index
Jeff Johnson0bbe66f2017-10-27 19:23:49 -0700897 * @sap_context: Pointer to context maintained by SAP (opaque to HDD)
Jeff Johnson91df29d2017-10-27 19:29:50 -0700898 * @sap_config: SAP configuration
Jeff Johnson01206862017-10-27 20:55:59 -0700899 * @operating_channel: channel upon which the SAP is operating
900 * @beacon: Beacon information
901 * @vendor_acs_timer: Timer for ACS
902 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
903 * @bss_stop_reason: Reason why the BSS was stopped
Abhinav Kumarb638b5d2018-03-26 12:25:41 +0530904 * @acs_in_progress: In progress acs flag for an adapter
Jeff Johnsonf283c972017-10-26 12:30:49 -0700905 */
Jeff Johnsone962b192017-08-11 15:37:08 -0700906struct hdd_ap_ctx {
Jeff Johnsonf283c972017-10-26 12:30:49 -0700907 struct hdd_hostapd_state hostapd_state;
Jeff Johnson01206862017-10-27 20:55:59 -0700908 bool dfs_cac_block_tx;
Jeff Johnson136c51b2017-10-27 20:02:41 -0700909 bool ap_active;
Jeff Johnson82ceb082017-10-27 14:52:42 -0700910 bool disable_intrabss_fwd;
Jeff Johnson42518cf2017-10-26 13:33:29 -0700911 uint8_t broadcast_sta_id;
Jeff Johnsonc8d94a12017-10-27 14:02:53 -0700912 uint8_t privacy;
Jeff Johnsona8e686b2017-10-27 15:05:18 -0700913 eCsrEncryptionType encryption_type;
Jeff Johnson413c15f2017-10-27 18:56:35 -0700914 tCsrRoamSetKey group_key;
Jeff Johnson3d731362017-10-27 19:06:41 -0700915 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY];
916 uint8_t wep_def_key_idx;
Jeff Johnson0bbe66f2017-10-27 19:23:49 -0700917 struct sap_context *sap_context;
Jeff Johnson8f8ceb92019-03-24 08:16:55 -0700918 struct sap_config sap_config;
Jeff Johnson01206862017-10-27 20:55:59 -0700919 uint8_t operating_channel;
920 struct hdd_beacon_data *beacon;
921 qdf_mc_timer_t vendor_acs_timer;
922 bool vendor_acs_timer_initialized;
923 enum bss_stop_reason bss_stop_reason;
Abhinav Kumarb638b5d2018-03-26 12:25:41 +0530924 qdf_atomic_t acs_in_progress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800925};
926
Jeff Johnson37588942017-08-15 16:11:41 -0700927/**
928 * struct hdd_scan_info - Per-adapter scan information
Jeff Johnson37fa0402017-10-28 12:42:29 -0700929 * @scan_add_ie: Additional IE for scan
Jeff Johnson37588942017-08-15 16:11:41 -0700930 * @default_scan_ies: Default scan IEs
931 * @default_scan_ies_len: Length of @default_scan_ies
932 * @scan_mode: Scan mode
Jeff Johnson37588942017-08-15 16:11:41 -0700933 */
934struct hdd_scan_info {
Jeff Johnson37fa0402017-10-28 12:42:29 -0700935 tSirAddie scan_add_ie;
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530936 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +0530937 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800938 tSirScanType scan_mode;
Jeff Johnson37588942017-08-15 16:11:41 -0700939};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800940
Dustin Brown61269462016-09-19 13:25:45 -0700941#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800942
Jeff Johnson673fd5b2017-09-30 16:44:56 -0700943struct hdd_multicast_addr_list {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800944 uint8_t mc_cnt;
945 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
Jeff Johnson673fd5b2017-09-30 16:44:56 -0700946};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800947
Mohit Khannaf7e7b342019-04-08 11:54:21 -0700948#define WLAN_HDD_MAX_HISTORY_ENTRY 25
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800949
950/**
951 * struct hdd_netif_queue_stats - netif queue operation statistics
952 * @pause_count - pause counter
953 * @unpause_count - unpause counter
954 */
955struct hdd_netif_queue_stats {
Mohit Khannaca4173b2017-09-12 21:52:19 -0700956 u32 pause_count;
957 u32 unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530958 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800959};
960
961/**
962 * struct hdd_netif_queue_history - netif queue operation history
963 * @time: timestamp
964 * @netif_action: action type
965 * @netif_reason: reason type
966 * @pause_map: pause map
Mohit Khannaf7e7b342019-04-08 11:54:21 -0700967 * @tx_q_state: state of the netdev TX queues
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800968 */
969struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530970 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800971 uint16_t netif_action;
972 uint16_t netif_reason;
973 uint32_t pause_map;
Mohit Khannaf7e7b342019-04-08 11:54:21 -0700974 unsigned long tx_q_state[NUM_TX_QUEUES];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800975};
976
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530977/**
978 * struct hdd_chan_change_params - channel related information
Paul Zhang427962d2019-07-25 15:22:55 +0800979 * @chan_freq: operating channel frequency
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530980 * @chan_params: channel parameters
981 */
982struct hdd_chan_change_params {
Paul Zhang427962d2019-07-25 15:22:55 +0800983 uint32_t chan_freq;
Amar Singhal5cccafe2017-02-15 12:42:58 -0800984 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530985};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800986
Komal Seelama89be8d2016-09-29 11:09:26 +0530987/**
Komal Seelam8634b772016-09-29 12:12:24 +0530988 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
Jeff Johnsonb9424862017-10-30 08:49:35 -0700989 * @dfs: dfs context to prevent/allow runtime pm
Jingxiang Geb49aa302018-01-17 20:54:15 +0800990 * @connect: connect context to prevent/allow runtime pm
Alan Chendf858ef2019-10-10 15:44:29 -0700991 * @user: user context to prevent/allow runtime pm
Komal Seelam8634b772016-09-29 12:12:24 +0530992 *
Jeff Johnsonb9424862017-10-30 08:49:35 -0700993 * Runtime PM control for underlying activities
Komal Seelam8634b772016-09-29 12:12:24 +0530994 */
995struct hdd_runtime_pm_context {
Komal Seelam81cb1662016-09-29 12:39:08 +0530996 qdf_runtime_lock_t dfs;
Jingxiang Geb49aa302018-01-17 20:54:15 +0800997 qdf_runtime_lock_t connect;
Alan Chendf858ef2019-10-10 15:44:29 -0700998 qdf_runtime_lock_t user;
999 bool is_user_wakelock_acquired;
Komal Seelam8634b772016-09-29 12:12:24 +05301000};
1001
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301002/*
1003 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
1004 * belonging to this driver from net devices belonging to other devices.
1005 * Therefore, the magic number must be unique relative to the numbers for
1006 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
1007 * (e.g. by compiler argument), then use that. If it's not already defined,
1008 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
1009 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
1010 */
1011#ifndef WLAN_HDD_ADAPTER_MAGIC
1012#ifdef MULTI_IF_NAME
1013#define WLAN_HDD_ADAPTER_MAGIC \
1014 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
1015 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
1016 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
1017 (MULTI_IF_NAME[1] << 16) : \
1018 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
1019 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
1020#else
Komal Seelama89be8d2016-09-29 11:09:26 +05301021#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301022#endif
1023#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001024
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301025/**
1026 * struct rcpi_info - rcpi info
1027 * @rcpi: computed value in dB
1028 * @mac_addr: peer mac addr for which rcpi is computed
1029 */
1030struct rcpi_info {
1031 int32_t rcpi;
1032 struct qdf_mac_addr mac_addr;
1033};
1034
Jeff Johnsondba0db62017-08-30 11:12:39 -07001035struct hdd_context;
1036
Dustin Brown20f9fc42018-08-30 15:19:12 -07001037/**
1038 * struct hdd_adapter - hdd vdev/net_device context
Dustin Brown89fa06e2018-09-07 10:47:27 -07001039 * @vdev: object manager vdev context
Min Liu8c5d99e2018-09-10 17:18:44 +08001040 * @vdev_lock: lock to protect vdev context access
Jeff Johnson19f4af52019-02-01 12:51:01 -08001041 * @vdev_id: Unique identifier assigned to the vdev
Dustin Brown20f9fc42018-08-30 15:19:12 -07001042 * @event_flags: a bitmap of hdd_adapter_flags
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301043 * @mic_work: mic work information
Subrat Dashb1e61b22019-07-22 14:09:34 +05301044 * @gpio_tsf_sync_work: work to sync send TSF CAP WMI command
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301045 *
Dustin Brown20f9fc42018-08-30 15:19:12 -07001046 */
Jeff Johnson85b5c112017-08-11 15:15:23 -07001047struct hdd_adapter {
Jeff Johnsond399e902015-12-17 15:17:02 -08001048 /* Magic cookie for adapter sanity verification. Note that this
1049 * needs to be at the beginning of the private data structure so
Jeff Johnsonb9424862017-10-30 08:49:35 -07001050 * that it will exist at the beginning of dev->priv and hence
Jeff Johnsond399e902015-12-17 15:17:02 -08001051 * will always be in mapped memory
1052 */
1053 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001054
Dustin Brown920397d2017-12-13 16:27:50 -08001055 /* list node for membership in the adapter list */
1056 qdf_list_node_t node;
1057
Jeff Johnsondba0db62017-08-30 11:12:39 -07001058 struct hdd_context *hdd_ctx;
Dustin Brown89fa06e2018-09-07 10:47:27 -07001059 struct wlan_objmgr_vdev *vdev;
Min Liu8c5d99e2018-09-10 17:18:44 +08001060 qdf_spinlock_t vdev_lock;
Jeff Johnson19f4af52019-02-01 12:51:01 -08001061 uint8_t vdev_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001062
hqu28f68df2019-07-02 23:10:08 +08001063 struct cdp_vdev *txrx_vdev;
Leo Changfdb45c32016-10-28 11:09:23 -07001064
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 /** Handle to the network device */
1066 struct net_device *dev;
1067
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001068 enum QDF_OPMODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -08001069
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001070 /** IPv4 notifier callback for handling ARP offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001071 struct work_struct ipv4_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001072#ifdef WLAN_NS_OFFLOAD
1073 /** IPv6 notifier callback for handling NS offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001074 struct work_struct ipv6_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001075#endif
1076
1077 /* TODO Move this to sta Ctx */
1078 struct wireless_dev wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001079
1080 /** ops checks if Opportunistic Power Save is Enable or Not
Jeff Johnsoncc9c7bb2019-03-23 09:28:41 -07001081 * ctw stores CT Window value once we receive Opps command from
1082 * wpa_supplicant then using CT Window value we need to Enable
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001083 * Opportunistic Power Save
1084 */
1085 uint8_t ops;
1086 uint32_t ctw;
1087
1088 /** Current MAC Address for the adapter */
Jeff Johnson1e851a12017-10-28 14:36:12 -07001089 struct qdf_mac_addr mac_addr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001090
Alok Kumarb64650c2018-03-23 17:05:11 +05301091#ifdef WLAN_NUD_TRACKING
1092 struct hdd_nud_tracking_info nud_tracking;
1093#endif
Rakshith Suresh Patkardb53c8f2019-06-07 17:11:31 +05301094
1095 struct hdd_mic_work mic_work;
Alok Kumarb64650c2018-03-23 17:05:11 +05301096 bool disconnection_in_progress;
1097 qdf_mutex_t disconnection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001098 unsigned long event_flags;
1099
1100 /**Device TX/RX statistics*/
1101 struct net_device_stats stats;
1102 /** HDD statistics*/
Jeff Johnson07f94742017-08-14 15:55:40 -07001103 struct hdd_stats hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -08001104
1105 /* estimated link speed */
1106 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001107
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301108 /* QDF event for session close */
1109 qdf_event_t qdf_session_close_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001110
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301111 /* QDF event for session open */
1112 qdf_event_t qdf_session_open_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001113
1114 /* TODO: move these to sta ctx. These may not be used in AP */
1115 /** completion variable for disconnect callback */
1116 struct completion disconnect_comp_var;
1117
Abhishek Singh533c9da2017-05-04 10:23:34 +05301118 struct completion roaming_comp_var;
1119
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001120 /* completion variable for Linkup Event */
1121 struct completion linkup_event_var;
1122
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001123 /* completion variable for off channel remain on channel Event */
1124 struct completion offchannel_tx_event;
1125 /* Completion variable for action frame */
1126 struct completion tx_action_cnf_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001127
1128 struct completion sta_authorized_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001129
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001130 struct completion ibss_peer_info_comp;
1131
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001132 /* Track whether the linkup handling is needed */
Jeff Johnsonc72c5732017-10-28 12:49:37 -07001133 bool is_link_up_service_needed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001134
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001135 /* WMM Status */
Jeff Johnson02d14ce2017-10-31 09:08:30 -07001136 struct hdd_wmm_status hdd_wmm_status;
Jeff Johnson18e86622017-10-28 12:55:36 -07001137
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001138 /** Multiple station supports */
1139 /** Per-station structure */
Sourav Mohapatra43e6dea2019-08-18 11:39:23 +05301140
1141 /* TODO: Will be removed as a part of next phase of clean up */
Jeff Johnsonbb8b56a2017-10-23 07:02:36 -07001142 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT];
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301143 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001144
Sourav Mohapatra43e6dea2019-08-18 11:39:23 +05301145 /* TODO: _list from name will be removed after clean up */
1146 struct hdd_sta_info_obj sta_info_list;
1147 struct hdd_sta_info_obj cache_sta_info_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001148
1149#ifdef FEATURE_WLAN_WAPI
Jeff Johnson89798aa2017-08-16 11:00:56 -07001150 struct hdd_wapi_info wapi_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001151#endif
1152
1153 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301154 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001155#ifdef WLAN_FEATURE_LPSS
1156 bool rssi_send;
1157#endif
1158
1159 uint8_t snr;
1160
Krunal Soni22208392017-09-29 18:10:34 -07001161 struct work_struct sap_stop_bss_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001162
1163 union {
Jeff Johnson40dae4e2017-08-29 14:00:25 -07001164 struct hdd_station_ctx station;
Jeff Johnson87251032017-08-29 13:31:11 -07001165 struct hdd_ap_ctx ap;
Jeff Johnsonb9424862017-10-30 08:49:35 -07001166 } session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167
Abhinav Kumar338e57d2019-02-04 17:30:10 +05301168 qdf_atomic_t ch_switch_in_progress;
Min Liu2fef5792018-01-19 17:59:42 +08001169
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001170#ifdef WLAN_FEATURE_TSF
1171 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001172 uint64_t cur_target_time;
yuanl69575bb2019-01-24 19:16:28 +08001173 uint64_t cur_tsf_sync_soc_time;
1174 uint64_t last_tsf_sync_soc_time;
Jiani Liua8fd1702019-05-01 10:07:10 +08001175 uint64_t cur_target_global_tsf_time;
1176 uint64_t last_target_global_tsf_time;
yuanl2746f072018-09-21 19:19:16 +08001177 qdf_mc_timer_t host_capture_req_timer;
Yu Wang000dc2f2017-05-26 17:38:48 +08001178#ifdef WLAN_FEATURE_TSF_PLUS
1179 /* spin lock for read/write timestamps */
1180 qdf_spinlock_t host_target_sync_lock;
1181 qdf_mc_timer_t host_target_sync_timer;
1182 uint64_t cur_host_time;
1183 uint64_t last_host_time;
1184 uint64_t last_target_time;
1185 /* to store the count of continuous invalid tstamp-pair */
1186 int continuous_error_count;
1187 /* to indicate whether tsf_sync has been initialized */
1188 qdf_atomic_t tsf_sync_ready_flag;
Subrat Dashb1e61b22019-07-22 14:09:34 +05301189#ifdef WLAN_FEATURE_TSF_PLUS_EXT_GPIO_SYNC
1190 qdf_work_t gpio_tsf_sync_work;
1191#endif
Yu Wang000dc2f2017-05-26 17:38:48 +08001192#endif /* WLAN_FEATURE_TSF_PLUS */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001193#endif
1194
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001195 struct hdd_multicast_addr_list mc_addr_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001196 uint8_t addr_filter_pattern;
1197
Jeff Johnson37588942017-08-15 16:11:41 -07001198 struct hdd_scan_info scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001199
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001200 /* Flag to ensure PSB is configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001201 uint8_t psb_changed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001202 /* UAPSD psb value configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001203 uint8_t configured_psb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001204 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1205 * since CSR (PMAC Struct) Config is same for both AP
1206 */
1207 struct delayed_work acs_pending_work;
1208
1209 struct work_struct scan_block_work;
Min Liu9be5d4a2018-05-17 11:51:53 +08001210 qdf_list_t blocked_scan_request_q;
1211 qdf_mutex_t blocked_scan_request_q_lock;
Tiger Yu8b119e92019-04-09 13:55:07 +08001212
1213#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001214 unsigned long prev_rx_packets;
1215 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301216 uint64_t prev_fwd_tx_packets;
1217 uint64_t prev_fwd_rx_packets;
Tiger Yu8b119e92019-04-09 13:55:07 +08001218#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
1219
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301220#if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
1221 defined(QCA_HL_NETDEV_FLOW_CONTROL)
Anurag Chouhan210db072016-02-22 18:42:15 +05301222 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001223 bool tx_flow_timer_initialized;
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301224#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL || QCA_HL_NETDEV_FLOW_CONTROL */
1225#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001226 unsigned int tx_flow_low_watermark;
jitiphil869b9f72018-09-25 17:14:01 +05301227 unsigned int tx_flow_hi_watermark_offset;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001228#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001230 bool offloads_configured;
1231
1232 /* DSCP to UP QoS Mapping */
Jeff Johnson6b51b6a2017-11-02 20:31:25 -07001233 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234
1235#ifdef WLAN_FEATURE_LINK_LAYER_STATS
Jeff Johnsond30ee4b2017-10-28 15:38:32 -07001236 bool is_link_layer_stats_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001237#endif
Jeff Johnsonbd4c4f02017-10-30 20:33:01 -07001238 uint8_t link_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001239
1240 /* variable for temperature in Celsius */
1241 int temperature;
1242
Agrawal Ashishb141b092016-09-02 19:59:26 +05301243#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001244 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301245 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001246 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301247#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001248
1249 /* BITMAP indicating pause reason */
1250 uint32_t pause_map;
1251 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301252 qdf_time_t start_time;
1253 qdf_time_t last_time;
1254 qdf_time_t total_pause_time;
1255 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001256 uint8_t history_index;
1257 struct hdd_netif_queue_history
1258 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1259 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001260 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001261 /* debugfs entry */
1262 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301263 /*
Paul Zhang9d117c82019-07-25 15:55:11 +08001264 * The pre cac channel frequency is saved here and will be used when
1265 * the SAP's channel needs to be moved from the existing 2.4GHz channel.
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301266 */
Paul Zhang9d117c82019-07-25 15:55:11 +08001267 uint32_t pre_cac_freq;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001268
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001269 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301270 * Indicate if HO fails during disconnect so that
1271 * disconnect is not initiated by HDD as its already
1272 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001273 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301274 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301275 struct lfr_firmware_status lfr_fw_status;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301276 bool con_status;
1277 bool dad;
Ganesh Kondabattini1a2aed82017-09-28 12:21:58 +05301278 uint8_t active_ac;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +05301279 uint32_t pkt_type_bitmap;
1280 uint32_t track_arp_ip;
1281 uint8_t dns_payload[256];
1282 uint32_t track_dns_domain_len;
1283 uint32_t track_src_port;
1284 uint32_t track_dest_port;
1285 uint32_t track_dest_ipv4;
Paul Zhang9d117c82019-07-25 15:55:11 +08001286 uint32_t mon_chan_freq;
Arunk Khandavalli062fb032017-10-04 12:18:15 +05301287 uint32_t mon_bandwidth;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301288
1289 /* rcpi information */
1290 struct rcpi_info rcpi;
Yeshwanth Sriram Guntuka4fe30bd2018-06-13 11:41:42 +05301291 bool send_mode_change;
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301292#ifdef FEATURE_WLAN_APF
1293 struct hdd_apf_context apf_context;
1294#endif /* FEATURE_WLAN_APF */
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +05301295
1296#ifdef WLAN_DEBUGFS
1297 struct hdd_debugfs_file_info csr_file[HDD_DEBUGFS_FILE_ID_MAX];
1298#endif /* WLAN_DEBUGFS */
Visweswara Tanuku633976b2019-01-07 16:13:12 +05301299
1300#ifdef WLAN_FEATURE_MOTION_DETECTION
1301 bool motion_detection_mode;
1302#endif /* WLAN_FEATURE_MOTION_DETECTION */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001303};
1304
Jeff Johnsonb9424862017-10-30 08:49:35 -07001305#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
1306#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
Jeff Johnsondba0db62017-08-30 11:12:39 -07001307#define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001308#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001309 (&(adapter)->session.ap.hostapd_state)
1310#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001311
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +05301312#ifdef WLAN_FEATURE_NAN
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001313#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001314#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001315/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1316 * intentionally so that all references to these must be within NDP code.
1317 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1318 * invoke NDP code to do all work.
1319 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001320#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001321#endif
1322
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001323/* Set mac address locally administered bit */
1324#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1325
1326#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1327#define HDD_RESET_MCC_P2P_QUOTA 50
1328
Jeff Johnson353cd292017-08-17 06:47:26 -07001329/*
1330 * struct hdd_priv_data - driver ioctl private data payload
1331 * @buf: pointer to command buffer (may be in userspace)
1332 * @used_len: length of the command/data currently in @buf
1333 * @total_len: total length of the @buf memory allocation
1334 */
1335struct hdd_priv_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001336 uint8_t *buf;
1337 int used_len;
1338 int total_len;
Jeff Johnson353cd292017-08-17 06:47:26 -07001339};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001340
1341#define MAX_MOD_LOGLEVEL 10
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001342struct fw_log_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001343 uint8_t enable;
1344 uint8_t dl_type;
1345 uint8_t dl_report;
1346 uint8_t dl_loglevel;
1347 uint8_t index;
1348 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1349
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001350};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001351
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001352/**
1353 * enum antenna_mode - number of TX/RX chains
1354 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1355 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1356 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1357 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1358 */
1359enum antenna_mode {
1360 HDD_ANTENNA_MODE_INVALID,
1361 HDD_ANTENNA_MODE_1X1,
1362 HDD_ANTENNA_MODE_2X2,
1363 HDD_ANTENNA_MODE_MAX
1364};
1365
1366/**
1367 * enum smps_mode - SM power save mode
1368 * @HDD_SMPS_MODE_STATIC: Static power save
1369 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1370 * @HDD_SMPS_MODE_RESERVED: Reserved
1371 * @HDD_SMPS_MODE_DISABLED: Disable power save
1372 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1373 */
1374enum smps_mode {
1375 HDD_SMPS_MODE_STATIC,
1376 HDD_SMPS_MODE_DYNAMIC,
1377 HDD_SMPS_MODE_RESERVED,
1378 HDD_SMPS_MODE_DISABLED,
1379 HDD_SMPS_MODE_MAX
1380};
1381
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001382#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1383/**
1384 * struct hdd_offloaded_packets - request id to pattern id mapping
1385 * @request_id: request id
1386 * @pattern_id: pattern id
1387 *
1388 */
1389struct hdd_offloaded_packets {
1390 uint32_t request_id;
1391 uint8_t pattern_id;
1392};
1393
1394/**
1395 * struct hdd_offloaded_packets_ctx - offloaded packets context
1396 * @op_table: request id to pattern id table
1397 * @op_lock: mutex lock
1398 */
1399struct hdd_offloaded_packets_ctx {
1400 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1401 struct mutex op_lock;
1402};
1403#endif
1404
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301405/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301406 * enum driver_status: Driver Modules status
1407 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
Arun Khandavallifae92942016-08-01 13:31:08 +05301408 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1409 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1410 */
1411enum driver_modules_status {
1412 DRIVER_MODULES_UNINITIALIZED,
Arun Khandavallifae92942016-08-01 13:31:08 +05301413 DRIVER_MODULES_ENABLED,
1414 DRIVER_MODULES_CLOSED
1415};
1416
Agrawal Ashish65634612016-08-18 13:24:32 +05301417/**
1418 * struct acs_dfs_policy - Define ACS policies
1419 * @acs_dfs_mode: Dfs mode enabled/disabled.
1420 * @acs_channel: pre defined channel to avoid ACS.
1421 */
1422struct acs_dfs_policy {
1423 enum dfs_mode acs_dfs_mode;
1424 uint8_t acs_channel;
1425};
1426
Dustin Brown105d7902016-10-03 16:27:59 -07001427/**
1428 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1429 * SUSPEND_FAIL_IPA: IPA in progress
1430 * SUSPEND_FAIL_RADAR: radar scan in progress
1431 * SUSPEND_FAIL_ROAM: roaming in progress
1432 * SUSPEND_FAIL_SCAN: scan in progress
1433 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1434 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1435 */
1436enum suspend_fail_reason {
1437 SUSPEND_FAIL_IPA,
1438 SUSPEND_FAIL_RADAR,
1439 SUSPEND_FAIL_ROAM,
1440 SUSPEND_FAIL_SCAN,
1441 SUSPEND_FAIL_INITIAL_WAKEUP,
1442 SUSPEND_FAIL_MAX_COUNT
1443};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001444
Dustin Brownd9322482017-01-09 12:46:03 -08001445/**
1446 * suspend_resume_stats - Collection of counters for suspend/resume events
1447 * @suspends: number of suspends completed
1448 * @resumes: number of resumes completed
1449 * @suspend_fail: counters for failed suspend reasons
1450 */
1451struct suspend_resume_stats {
1452 uint32_t suspends;
1453 uint32_t resumes;
1454 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1455};
1456
Ashish Kumar Dhanotiyab28338c2017-07-21 20:12:34 +05301457/**
1458 * hdd_sta_smps_param - SMPS parameters to configure from hdd
1459 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS
1460 * mode from inactive mode
1461 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter
1462 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from
1463 * Stalled-D-SMPS mode
1464 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes
1465 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI.
1466 * Used to reduce RX chainmask.
1467 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI.
1468 * Used to increase RX chainmask.
1469 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature
1470 */
1471enum hdd_sta_smps_param {
1472 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0,
1473 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1,
1474 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2,
1475 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3,
1476 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4,
1477 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
1478};
1479
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301480/**
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001481 * enum RX_OFFLOAD - Receive offload modes
1482 * @CFG_LRO_ENABLED: Large Rx offload
1483 * @CFG_GRO_ENABLED: Generic Rx Offload
1484 */
1485enum RX_OFFLOAD {
1486 CFG_LRO_ENABLED = 1,
1487 CFG_GRO_ENABLED,
1488};
1489
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001490/* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1491 * 1 for WDS_STAID
1492 */
1493#define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2)
1494
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301495#ifdef DISABLE_CHANNEL_LIST
1496
1497/**
1498 * struct hdd_cache_channel_info - Structure of the channel info
1499 * which needs to be cached
1500 * @channel_num: channel number
1501 * @reg_status: Current regulatory status of the channel
1502 * Enable
1503 * Disable
1504 * DFS
1505 * Invalid
1506 * @wiphy_status: Current wiphy status
1507 */
1508struct hdd_cache_channel_info {
1509 uint32_t channel_num;
1510 enum channel_state reg_status;
1511 uint32_t wiphy_status;
1512};
1513
1514/**
1515 * struct hdd_cache_channels - Structure of the channels to be cached
1516 * @num_channels: Number of channels to be cached
1517 * @channel_info: Structure of the channel info
1518 */
1519struct hdd_cache_channels {
1520 uint32_t num_channels;
1521 struct hdd_cache_channel_info *channel_info;
1522};
1523#endif
1524
Dustin Brown20f9fc42018-08-30 15:19:12 -07001525/**
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301526 * struct hdd_dynamic_mac - hdd structure to handle dynamic mac address changes
1527 * @dynamic_mac: Dynamicaly configured mac, this contains the mac on which
1528 * current interface is up
1529 * @is_provisioned_mac: is this mac from provisioned list
1530 * @bit_position: holds the bit mask position from where this mac is assigned,
1531 * if mac is assigned from provisioned this field contains the position from
1532 * provisioned_intf_addr_mask else contains the position from
1533 * derived_intf_addr_mask
1534 */
1535struct hdd_dynamic_mac {
1536 struct qdf_mac_addr dynamic_mac;
1537 bool is_provisioned_mac;
1538 uint8_t bit_position;
1539};
1540
1541/**
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05301542 * hdd_fw_ver_info - FW version info structure
1543 * @major_spid: FW version - major spid.
1544 * @minor_spid: FW version - minor spid
1545 * @siid: FW version - siid
1546 * @sub_id: FW version - sub id
1547 * @rel_id: FW version - release id
1548 * @crmid: FW version - crmid
1549 */
1550
1551struct hdd_fw_ver_info {
1552 uint32_t major_spid;
1553 uint32_t minor_spid;
1554 uint32_t siid;
1555 uint32_t sub_id;
1556 uint32_t rel_id;
1557 uint32_t crmid;
1558};
1559
1560/**
Dustin Brown20f9fc42018-08-30 15:19:12 -07001561 * struct hdd_context - hdd shared driver and psoc/device context
Dustin Brown76cd2932018-09-11 16:03:05 -07001562 * @psoc: object manager psoc context
Dustin Brown07901ec2018-09-07 11:02:41 -07001563 * @pdev: object manager pdev context
gaurank kathpaliaccfca4a2019-08-13 11:51:27 +05301564 * @iftype_data_2g: Interface data for 2g band
1565 * @iftype_data_5g: Interface data for 5g band
Dustin Browna20bad52019-03-05 12:03:30 -08001566 * @bus_bw_work: work for periodically computing DDR bus bandwidth requirements
Dustin Brown20f9fc42018-08-30 15:19:12 -07001567 * @g_event_flags: a bitmap of hdd_driver_flags
Dustin Brown4c663222018-10-23 14:19:36 -07001568 * @psoc_idle_timeout_work: delayed work for psoc idle shutdown
gaurank kathpalia5fcefa92018-10-24 15:03:15 +05301569 * @dynamic_nss_chains_support: Per vdev dynamic nss chains update capability
Sourav Mohapatra9036f652019-04-02 15:02:59 +05301570 * @sar_cmd_params: SAR command params to be configured to the FW
Dustin Brown20f9fc42018-08-30 15:19:12 -07001571 */
Jeff Johnson82797b62017-08-11 15:31:27 -07001572struct hdd_context {
Dustin Brown05d81302018-09-11 16:49:22 -07001573 struct wlan_objmgr_psoc *psoc;
Dustin Brown07901ec2018-09-07 11:02:41 -07001574 struct wlan_objmgr_pdev *pdev;
Jeff Johnson16528362018-06-14 12:34:16 -07001575 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001576 struct wiphy *wiphy;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301577 qdf_spinlock_t hdd_adapter_lock;
Jeff Johnson19fc8e42017-10-30 19:53:49 -07001578 qdf_list_t hdd_adapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001579
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001580 /** Pointer for firmware image data */
1581 const struct firmware *fw;
1582
1583 /** Pointer for configuration data */
1584 const struct firmware *cfg;
1585
1586 /** Pointer to the parent device */
1587 struct device *parent_dev;
1588
1589 /** Config values read from qcom_cfg.ini file */
1590 struct hdd_config *config;
1591
Qun Zhang043635a2019-02-27 15:19:29 +08001592 /* Pointer for wiphy 2G/5G band channels */
1593 struct ieee80211_channel *channels_2ghz;
1594 struct ieee80211_channel *channels_5ghz;
1595
gaurank kathpaliaccfca4a2019-08-13 11:51:27 +05301596#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
1597 struct ieee80211_sband_iftype_data *iftype_data_2g;
1598 struct ieee80211_sband_iftype_data *iftype_data_5g;
1599#endif
1600
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001601 /* Completion variable to indicate Mc Thread Suspended */
1602 struct completion mc_sus_event_var;
1603
Rajeev Kumareada0d02016-12-08 17:44:17 -08001604 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605
1606#ifdef QCA_CONFIG_SMP
1607 bool is_ol_rx_thread_suspended;
1608#endif
1609
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610 bool hdd_wlan_suspended;
1611 bool suspended;
Poddar, Siddarth61fbc932017-12-19 14:27:55 +05301612 /* flag to start pktlog after SSR/PDR if previously enabled */
1613 bool is_pktlog_enabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001614
1615 /* Lock to avoid race condition during start/stop bss */
1616 struct mutex sap_lock;
1617
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001618#ifdef FEATURE_OEM_DATA_SUPPORT
1619 /* OEM App registered or not */
1620 bool oem_app_registered;
1621
1622 /* OEM App Process ID */
1623 int32_t oem_pid;
1624#endif
1625
1626 /** Concurrency Parameters*/
1627 uint32_t concurrency_mode;
1628
Anurag Chouhan6d760662016-02-20 16:05:43 +05301629 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1630 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001631
1632 /** P2P Device MAC Address for the adapter */
Jeff Johnsonacbdb1c2017-11-02 20:42:02 -07001633 struct qdf_mac_addr p2p_device_address;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001634
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301635 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301636 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001637
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001638 /* Flag keeps track of wiphy suspend/resume */
Jeff Johnson214671b2017-10-30 19:45:23 -07001639 bool is_wiphy_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001640
Tiger Yu8b119e92019-04-09 13:55:07 +08001641#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Browna20bad52019-03-05 12:03:30 -08001642 struct qdf_periodic_work bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001643 int cur_vote_level;
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05301644 qdf_spinlock_t bus_bw_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001645 int cur_rx_level;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001646 uint64_t prev_no_rx_offload_pkts;
1647 uint64_t prev_rx_offload_pkts;
Manjunathappa Prakash35af2e22019-07-30 20:23:34 -07001648 /* Count of non TSO packets in previous bus bw delta time */
1649 uint64_t prev_no_tx_offload_pkts;
1650 /* Count of TSO packets in previous bus bw delta time */
1651 uint64_t prev_tx_offload_pkts;
Mohit Khannae71e2262015-11-10 09:37:24 -08001652 int cur_tx_level;
1653 uint64_t prev_tx;
Jinwei Chen0dc383e2019-08-23 00:43:04 +08001654 qdf_atomic_t low_tput_gro_enable;
1655 uint32_t bus_low_vote_cnt;
Tiger Yu8b119e92019-04-09 13:55:07 +08001656#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001657
1658 struct completion ready_to_suspend;
1659 /* defining the solution type */
1660 uint32_t target_type;
1661
1662 /* defining the firmware version */
1663 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001664 uint32_t target_fw_vers_ext;
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05301665 struct hdd_fw_ver_info fw_version_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001666
1667 /* defining the chip/rom version */
1668 uint32_t target_hw_version;
1669 /* defining the chip/rom revision */
1670 uint32_t target_hw_revision;
1671 /* chip/rom name */
Dustin Brown6f17a022017-07-19 13:40:55 -07001672 char *target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001673 struct regulatory reg;
1674#ifdef FEATURE_WLAN_CH_AVOID
1675 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001676 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001677#endif /* FEATURE_WLAN_CH_AVOID */
1678
1679 uint8_t max_intf_count;
1680 uint8_t current_intf_count;
1681#ifdef WLAN_FEATURE_LPSS
1682 uint8_t lpss_support;
1683#endif
1684 uint8_t ap_arpns_support;
1685 tSirScanType ioctl_scan_mode;
1686
1687#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301688 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001689#endif
1690
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001691 uint8_t dev_dfs_cac_status;
1692
Jeff Johnson59b19312017-11-02 21:14:33 -07001693 bool bt_coex_mode_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001694#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301695 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001696 uint8_t skip_acs_scan_status;
Min Liu00956e82019-07-26 14:49:30 +08001697 uint32_t *last_acs_freq_list;
Liangwei Dongaef84342016-10-21 05:28:00 -04001698 uint8_t num_of_channels;
1699 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001700#endif
1701
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301702 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001703 atomic_t sap_dfs_ref_cnt;
1704
1705#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1706 bool is_extwow_app_type1_param_set;
1707 bool is_extwow_app_type2_param_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001708#endif
1709
1710 /* Time since boot up to extscan start (in micro seconds) */
1711 uint64_t ext_scan_start_since_boot;
1712 unsigned long g_event_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301714
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001715#ifdef WLAN_NS_OFFLOAD
1716 /* IPv6 notifier callback for handling NS offload on change in IP */
1717 struct notifier_block ipv6_notifier;
1718#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301719 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001720 /* IPv4 notifier callback for handling ARP offload on change in IP */
1721 struct notifier_block ipv4_notifier;
1722
1723 /* number of rf chains supported by target */
1724 uint32_t num_rf_chains;
1725 /* Is htTxSTBC supported by target */
1726 uint8_t ht_tx_stbc_supported;
1727#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1728 struct hdd_offloaded_packets_ctx op_ctx;
1729#endif
1730 bool mcc_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001731 struct mutex memdump_lock;
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301732 uint16_t driver_dump_size;
1733 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001734
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001735 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301736 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001737
1738 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301739 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001740
Krunal Sonie3531942016-04-12 17:43:53 -07001741 /*
1742 * place to store FTM capab of target. This allows changing of FTM capab
1743 * at runtime and intersecting it with target capab before updating.
1744 */
1745 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001746 uint32_t rx_high_ind_cnt;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001747 /* For Rx thread non GRO/LRO packet accounting */
1748 uint64_t no_rx_offload_pkt_cnt;
Manjunathappa Prakash35af2e22019-07-30 20:23:34 -07001749 uint64_t no_tx_offload_pkt_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001750 /* Current number of TX X RX chains being used */
1751 enum antenna_mode current_antenna_mode;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001752
1753 /* the radio index assigned by cnss_logger */
1754 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301755 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301756 bool hbw_requested;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001757 enum RX_OFFLOAD ol_enable;
Nachiket Kukade2fb1fdb2019-01-08 15:35:27 +05301758#ifdef WLAN_FEATURE_NAN
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001759 bool nan_datapath_enabled;
1760#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301761 /* Present state of driver cds modules */
1762 enum driver_modules_status driver_status;
Dustin Brown8d8ab302019-03-05 16:19:36 -08001763 struct qdf_delayed_work psoc_idle_timeout_work;
Nirav Shahbd36b062016-07-18 11:12:59 +05301764 bool rps;
Tang Yingying5a4ccf22018-03-30 15:58:27 +08001765 bool dynamic_rps;
Jeff Johnsone2ba3cd2017-10-30 20:02:09 -07001766 bool enable_rxthread;
Mohit Khanna70322002018-05-15 19:21:32 -07001767 /* support for DP RX threads */
1768 bool enable_dp_rx_threads;
Nirav Shahbd36b062016-07-18 11:12:59 +05301769 bool napi_enable;
Agrawal Ashish65634612016-08-18 13:24:32 +05301770 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301771 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001772 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301773 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301774 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301775 struct scan_chan_info *chan_info;
1776 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301777 /* bit map to set/reset TDLS by different sources */
1778 unsigned long tdls_source_bitmap;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001779 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001780 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301781 uint8_t beacon_probe_rsp_cnt_per_scan;
Jeff Johnson995fd512019-03-06 08:45:10 -08001782 uint8_t last_scan_reject_vdev_id;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301783 enum scan_reject_states last_scan_reject_reason;
1784 unsigned long last_scan_reject_timestamp;
Abhishek Singh00130682017-07-14 10:46:17 +05301785 uint8_t scan_reject_cnt;
Arif Hussain759a0232017-03-20 13:17:18 -07001786 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001787 bool reg_offload;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301788 bool rcpi_enabled;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301789#ifdef FEATURE_WLAN_CH_AVOID
Kiran Kumar Lokere48795792017-07-07 15:34:29 -07001790 struct ch_avoid_ind_type coex_avoid_freq_list;
1791 struct ch_avoid_ind_type dnbs_avoid_freq_list;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301792 /* Lock to control access to dnbs and coex avoid freq list */
1793 struct mutex avoid_freq_lock;
1794#endif
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001795#ifdef WLAN_FEATURE_TSF
1796 /* indicate whether tsf has been initialized */
1797 qdf_atomic_t tsf_ready_flag;
1798 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1799 qdf_atomic_t cap_tsf_flag;
1800 /* the context that is capturing tsf */
Jeff Johnson9d295242017-08-29 14:39:48 -07001801 struct hdd_adapter *cap_tsf_context;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001802#endif
Subrat Dash5f36fbe2019-02-12 16:28:14 +05301803#ifdef WLAN_FEATURE_TSF_PTP
1804 struct ptp_clock_info ptp_cinfo;
1805 struct ptp_clock *ptp_clock;
1806#endif
Vidyullatha Kanchanapallybe0ebb32017-03-23 14:36:21 +05301807 uint8_t bt_a2dp_active:1;
1808 uint8_t bt_vo_active:1;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08001809 enum band_info curr_band;
Arunk Khandavalli847969d2017-09-25 15:15:36 +05301810 bool imps_enabled;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001811#ifdef WLAN_FEATURE_PACKET_FILTERING
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05301812 int user_configured_pkt_filter_rules;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001813#endif
Vignesh Viswanathan731186f2017-09-18 13:47:37 +05301814 bool is_fils_roaming_supported;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001815 QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *,
1816 struct sk_buff *);
Poddar, Siddarth4b3f7312017-11-02 17:00:20 +05301817 qdf_atomic_t vendor_disable_lro_flag;
Mohit Khanna81418772018-10-30 14:14:46 -07001818
1819 /* disable RX offload (GRO/LRO) in concurrency scenarios */
1820 qdf_atomic_t disable_rx_ol_in_concurrency;
1821 /* disable RX offload (GRO/LRO) in low throughput scenarios */
1822 qdf_atomic_t disable_rx_ol_in_low_tput;
Manjunathappa Prakash81ca3a52017-10-09 01:41:58 -07001823 bool en_tcp_delack_no_lro;
Abhishek Singh6454ad32017-12-20 10:42:21 +05301824 bool force_rsne_override;
Arunk Khandavalliebd1e372017-11-06 15:00:24 +05301825 qdf_wake_lock_t monitor_mode_wakelock;
Naveen Rawat269b4ed2017-12-07 06:47:32 -08001826 bool lte_coex_ant_share;
Liangwei Dong0da14262018-07-03 03:30:23 -04001827 bool obss_scan_offload;
Sandeep Puligilla019a1bd2018-02-04 22:57:44 -08001828 int sscan_pid;
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +05301829 uint32_t track_arp_ip;
Ryan Hsuc6918552018-05-16 13:29:59 -07001830
1831 /* defining the board related information */
1832 uint32_t hw_bd_id;
1833 struct board_info hw_bd_info;
Varun Reddy Yeturud33033f2018-06-11 10:58:30 -07001834#ifdef WLAN_SUPPORT_TWT
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -07001835 enum twt_status twt_state;
Kiran Kumar Lokere54819a32019-10-04 18:30:43 -07001836 qdf_event_t twt_disable_comp_evt;
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -07001837#endif
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301838#ifdef FEATURE_WLAN_APF
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301839 uint32_t apf_version;
Rajeev Kumar Sirasanagandla85f8b022018-03-12 12:52:59 +05301840 bool apf_enabled_v2;
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301841#endif
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301842
1843#ifdef DISABLE_CHANNEL_LIST
1844 struct hdd_cache_channels *original_channels;
1845 qdf_mutex_t cache_channel_lock;
1846#endif
Jeff Johnsonf9176382018-07-17 19:15:58 -07001847 enum sar_version sar_version;
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301848 struct hdd_dynamic_mac dynamic_mac_list[QDF_MAX_CONCURRENCY_PERSONA];
gaurank kathpalia5fcefa92018-10-24 15:03:15 +05301849 bool dynamic_nss_chains_support;
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05301850 struct qdf_mac_addr hw_macaddr;
1851 struct qdf_mac_addr provisioned_mac_addr[QDF_MAX_CONCURRENCY_PERSONA];
1852 struct qdf_mac_addr derived_mac_addr[QDF_MAX_CONCURRENCY_PERSONA];
1853 uint32_t num_provisioned_addr;
1854 uint32_t num_derived_addr;
1855 unsigned long provisioned_intf_addr_mask;
1856 unsigned long derived_intf_addr_mask;
Sourav Mohapatra9036f652019-04-02 15:02:59 +05301857
1858 struct sar_limit_cmd_params *sar_cmd_params;
Alan Chenabd19472019-08-30 12:07:03 -07001859
1860 qdf_time_t runtime_resume_start_time_stamp;
1861 qdf_time_t runtime_suspend_done_time_stamp;
Manjunathappa Prakasheb1ec862019-07-28 00:01:18 -07001862#ifdef CLD_PM_QOS
1863 struct pm_qos_request pm_qos_req;
1864#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001865};
1866
Kapil Gupta086c6202016-12-11 18:17:06 +05301867/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301868 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1869 * @channel_count: channel count
1870 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301871 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301872 * @vendor_pcl_list: pointer to pcl list
1873 * @vendor_weight_list: pointer to pcl weight list
1874 */
1875struct hdd_vendor_acs_chan_params {
1876 uint32_t channel_count;
1877 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301878 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301879 uint8_t *vendor_pcl_list;
1880 uint8_t *vendor_weight_list;
1881};
1882
1883/**
1884 * struct hdd_external_acs_timer_context - acs timer context
1885 * @reason: reason for acs trigger
1886 * @adapter: hdd adapter for acs
1887 */
1888struct hdd_external_acs_timer_context {
1889 int8_t reason;
Jeff Johnson9d295242017-08-29 14:39:48 -07001890 struct hdd_adapter *adapter;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301891};
1892
1893/**
1894 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301895 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301896 * @pri_ch: primary channel
1897 * @ht_sec_ch: secondary channel
1898 * @vht_seg0_center_ch: segment0 for vht
1899 * @vht_seg1_center_ch: vht segment 1
1900 * @chan_width: channel width
1901 */
1902struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05301903 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301904 uint8_t pri_ch;
1905 uint8_t ht_sec_ch;
1906 uint8_t vht_seg0_center_ch;
1907 uint8_t vht_seg1_center_ch;
1908 uint8_t chan_width;
1909};
1910
1911/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301912 * struct hdd_channel_info - standard channel info
1913 * @freq: Freq in Mhz
1914 * @flags: channel info flags
1915 * @flagext: extended channel info flags
1916 * @ieee_chan_number: channel number
1917 * @max_reg_power: max tx power according to regulatory
1918 * @max_radio_power: max radio power
1919 * @min_radio_power: min radio power
1920 * @reg_class_id: regulatory class
1921 * @max_antenna_gain: max antenna gain allowed on channel
1922 * @vht_center_freq_seg0: vht center freq segment 0
1923 * @vht_center_freq_seg1: vht center freq segment 1
1924 */
1925struct hdd_channel_info {
1926 u_int16_t freq;
1927 u_int32_t flags;
1928 u_int16_t flagext;
1929 u_int8_t ieee_chan_number;
1930 int8_t max_reg_power;
1931 int8_t max_radio_power;
1932 int8_t min_radio_power;
1933 u_int8_t reg_class_id;
1934 u_int8_t max_antenna_gain;
1935 u_int8_t vht_center_freq_seg0;
1936 u_int8_t vht_center_freq_seg1;
1937};
1938
Jeff Johnsonef926352017-01-12 10:41:02 -08001939/*
1940 * Function declarations and documentation
1941 */
Himanshu Agarwal813b2bf2018-01-22 16:32:15 +05301942
Jeff Johnson9d295242017-08-29 14:39:48 -07001943int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301944 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001945 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001946
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001947QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001948 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001949
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001950QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001951 struct hdd_adapter *current_adapter,
1952 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001953
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001954QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001955 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001956
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001957QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001958 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001959
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001960QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001961 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001962
Jeff Johnson58adbcf2017-09-03 08:53:31 -07001963QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08001964 struct hdd_adapter *adapter);
1965
1966/**
1967 * hdd_for_each_adapter - adapter iterator macro
1968 * @hdd_ctx: the global HDD context
1969 * @adapter: an hdd_adapter pointer to use as a cursor
1970 */
1971#define hdd_for_each_adapter(hdd_ctx, adapter) \
1972 for (hdd_get_front_adapter(hdd_ctx, &adapter); \
1973 adapter; \
1974 hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001975
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001976struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
1977 uint8_t session_type,
Jeff Johnsonaa6cbb82019-03-10 19:31:35 -07001978 const char *name, tSirMacAddr mac_addr,
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001979 unsigned char name_assign_type,
1980 bool rtnl_held);
Dustin Brown728d65a2018-10-02 16:27:52 -07001981
1982/**
1983 * hdd_close_adapter() - remove and free @adapter from the adapter list
1984 * @hdd_ctx: The Hdd context containing the adapter list
1985 * @adapter: the adapter to remove and free
1986 * @rtnl_held: if the caller is already holding the RTNL lock
1987 *
1988 * Return: None
1989 */
1990void hdd_close_adapter(struct hdd_context *hdd_ctx,
1991 struct hdd_adapter *adapter,
1992 bool rtnl_held);
1993
1994/**
1995 * hdd_close_all_adapters() - remove and free all adapters from the adapter list
1996 * @hdd_ctx: The Hdd context containing the adapter list
1997 * @rtnl_held: if the caller is already holding the RTNL lock
1998 *
1999 * Return: None
2000 */
2001void hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
2002
Dustin Browndb2a8be2017-12-20 11:49:56 -08002003QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002004void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002005QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx);
2006QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002007
2008/**
2009 * hdd_get_adapter_by_vdev() - Return adapter with the given vdev id
2010 * @hdd_ctx: hdd context.
2011 * @vdev_id: vdev id for the adapter to get.
2012 *
2013 * This function is used to get the adapter with provided vdev id
2014 *
2015 * Return: adapter pointer if found
2016 *
2017 */
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002018struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx,
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002019 uint32_t vdev_id);
2020
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002021struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx,
Jeff Johnsonaa6cbb82019-03-10 19:31:35 -07002022 tSirMacAddr mac_addr);
Dustin Brownd28772b2017-03-17 14:16:07 -07002023
Will Huang79af29f2019-04-11 15:46:26 +08002024/**
2025 * hdd_get_adapter_home_channel() - return home channel of adapter
2026 * @adapter: hdd adapter of vdev
2027 *
2028 * This function returns operation channel of station/p2p-cli if
2029 * connected, returns opration channel of sap/p2p-go if started.
2030 *
2031 * Return: home channel if connected/started or invalid channel 0
2032 */
2033uint8_t hdd_get_adapter_home_channel(struct hdd_adapter *adapter);
2034
Liangwei Dong3abfe8f2018-09-20 02:25:44 -04002035/*
2036 * hdd_get_adapter_by_rand_macaddr() - find Random mac adapter
2037 * @hdd_ctx: hdd context
2038 * @mac_addr: random mac addr
2039 *
2040 * Find the Adapter based on random mac addr. Adapter's vdev
2041 * have active random mac list.
2042 *
2043 * Return: adapter ptr or null
2044 */
2045struct hdd_adapter *
2046hdd_get_adapter_by_rand_macaddr(struct hdd_context *hdd_ctx,
2047 tSirMacAddr mac_addr);
2048
gaurank kathpalia6982d472018-10-31 21:54:15 +05302049/**
2050 * hdd_is_vdev_in_conn_state() - Check whether the vdev is in
2051 * connected/started state.
2052 * @adapter: hdd adapter of the vdev
2053 *
2054 * This function will give whether the vdev in the adapter is in
2055 * connected/started state.
2056 *
2057 * Return: True/false
2058 */
2059bool hdd_is_vdev_in_conn_state(struct hdd_adapter *adapter);
2060
Krunal Sonib51eec72017-11-20 21:53:01 -08002061int hdd_vdev_create(struct hdd_adapter *adapter,
Jeff Johnson6a18c962018-07-01 09:09:37 -07002062 csr_roam_complete_cb callback, void *ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002063int hdd_vdev_destroy(struct hdd_adapter *adapter);
2064int hdd_vdev_ready(struct hdd_adapter *adapter);
Dustin Brownd28772b2017-03-17 14:16:07 -07002065
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002066QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002067struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002068 enum QDF_OPMODE mode);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002069
2070/**
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302071 * hdd_get_device_mode() - Get device mode
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002072 * @vdev_id: vdev id
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302073 *
2074 * Return: Device mode
2075 */
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002076enum QDF_OPMODE hdd_get_device_mode(uint32_t vdev_id);
2077
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002078void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
2079 struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002080 bool rtnl_held);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002081QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
Dustin Browndb2a8be2017-12-20 11:49:56 -08002082 struct hdd_adapter *adapter);
Liangwei Dongad89c762018-06-01 01:56:23 -04002083
Jeff Johnson5505db82017-11-02 21:19:23 -07002084void hdd_set_station_ops(struct net_device *dev);
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05302085
2086/**
2087 * wlan_hdd_get_intf_addr() - Get address for the interface
2088 * @hdd_ctx: Pointer to hdd context
2089 * @interface_type: type of the interface for which address is queried
2090 *
2091 * This function is used to get mac address for every new interface
2092 *
2093 * Return: If addr is present then return pointer to MAC address
2094 * else NULL
2095 */
2096
2097uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx,
2098 enum QDF_OPMODE interface_type);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002099void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx,
2100 uint8_t *releaseAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002101uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002102 enum QDF_OPMODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002103
Dustin Brownf0f70562018-09-14 10:29:38 -07002104void hdd_set_conparam(int32_t con_param);
Jeff Johnson876c1a62017-12-12 10:43:07 -08002105enum QDF_GLOBAL_MODE hdd_get_conparam(void);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002106void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002107void hdd_prevent_suspend(uint32_t reason);
Sourav Mohapatra92ea8d62018-02-05 10:03:10 +05302108
2109/*
2110 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list
2111 *
2112 * This function is used to fetch the first valid adapter from the adapter
2113 * list. If there is no valid adapter then it returns NULL
2114 *
2115 * @hdd_ctx: HDD context handler
2116 *
2117 * Return: NULL if no valid adapter found in the adapter list
2118 *
2119 */
2120struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx);
2121
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002122void hdd_allow_suspend(uint32_t reason);
2123void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002124
Abhishek Ambure68677462019-09-13 12:44:26 +05302125#ifdef QCA_IBSS_SUPPORT
2126/**
2127 * hdd_set_ibss_power_save_params() - update IBSS Power Save params to WMA.
2128 * @struct hdd_adapter Hdd adapter.
2129 *
2130 * This function sets the IBSS power save config parameters to WMA
2131 * which will send it to firmware if FW supports IBSS power save
2132 * before vdev start.
2133 *
2134 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE
2135 * on failure.
2136 */
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002137QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter);
Abhishek Ambure68677462019-09-13 12:44:26 +05302138#else
2139static inline QDF_STATUS
2140hdd_set_ibss_power_save_params(struct hdd_adapter *adapter)
2141{
2142 return QDF_STATUS_SUCCESS;
2143}
2144#endif
Dustin Brownda351e32018-07-23 15:48:22 -07002145
2146/**
2147 * wlan_hdd_validate_context() - check the HDD context
2148 * @hdd_ctx: Global HDD context pointer
2149 *
2150 * Return: 0 if the context is valid. Error code otherwise
2151 */
2152#define wlan_hdd_validate_context(hdd_ctx) \
2153 __wlan_hdd_validate_context(hdd_ctx, __func__)
2154
2155int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002156
2157/**
2158 * hdd_validate_adapter() - Validate the given adapter
2159 * @adapter: the adapter to validate
2160 *
2161 * This function validates the given adapter, and ensures that it is open.
2162 *
2163 * Return: Errno
2164 */
Dustin Browna8700cc2018-08-07 12:04:47 -07002165#define hdd_validate_adapter(adapter) \
2166 __hdd_validate_adapter(adapter, __func__)
2167
2168int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002169
Dustin Brown63500612018-08-07 11:36:09 -07002170/**
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002171 * wlan_hdd_validate_vdev_id() - ensure the given vdev Id is valid
2172 * @vdev_id: the vdev Id to validate
Dustin Brown63500612018-08-07 11:36:09 -07002173 *
2174 * Return: Errno
2175 */
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002176#define wlan_hdd_validate_vdev_id(vdev_id) \
2177 __wlan_hdd_validate_vdev_id(vdev_id, __func__)
Dustin Brown63500612018-08-07 11:36:09 -07002178
Jeff Johnson7eb6e842019-02-23 14:33:34 -08002179int __wlan_hdd_validate_vdev_id(uint8_t vdev_id, const char *func);
2180
Jeff Johnson030cd902018-11-11 10:19:40 -08002181/**
2182 * hdd_is_valid_mac_address() - validate MAC address
2183 * @mac_addr: Pointer to the input MAC address
2184 *
2185 * This function validates whether the given MAC address is valid or not
2186 * Expected MAC address is of the format XX:XX:XX:XX:XX:XX
2187 * where X is the hexa decimal digit character and separated by ':'
2188 * This algorithm works even if MAC address is not separated by ':'
2189 *
2190 * This code checks given input string mac contains exactly 12 hexadecimal
2191 * digits and a separator colon : appears in the input string only after
2192 * an even number of hex digits.
2193 *
2194 * Return: true for valid and false for invalid
2195 */
2196bool hdd_is_valid_mac_address(const uint8_t *mac_addr);
2197
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002198bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002199
Pragaspathi Thilagaraj84b72842018-09-19 22:06:57 +05302200/**
2201 * wlan_hdd_validate_mac_address() - Function to validate mac address
2202 * @mac_addr: input mac address
2203 *
2204 * Return QDF_STATUS
2205 */
2206#define wlan_hdd_validate_mac_address(mac_addr) \
2207 __wlan_hdd_validate_mac_address(mac_addr, __func__)
2208
2209QDF_STATUS __wlan_hdd_validate_mac_address(struct qdf_mac_addr *mac_addr,
2210 const char *func);
Tiger Yu8b119e92019-04-09 13:55:07 +08002211
2212#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Dustin Brown5ec6b552017-03-31 12:11:40 -07002213/**
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05302214 * hdd_bus_bw_compute_prev_txrx_stats() - get tx and rx stats
2215 * @adapter: hdd adapter reference
2216 *
2217 * This function get the collected tx and rx stats before starting
2218 * the bus bandwidth timer.
2219 *
2220 * Return: None
2221 */
2222void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter);
2223
2224/**
2225 * hdd_bus_bw_compute_reset_prev_txrx_stats() - reset previous tx and rx stats
2226 * @adapter: hdd adapter reference
2227 *
2228 * This function resets the adapter previous tx rx stats.
2229 *
2230 * Return: None
2231 */
2232void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter);
2233
2234/**
Dustin Brown5ec6b552017-03-31 12:11:40 -07002235 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
2236 * @hdd_ctx: the global hdd context
2237 *
2238 * Return: None
2239 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002240void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002241
2242/**
2243 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
2244 * @hdd_ctx: the global hdd context
2245 *
2246 * This function ensures there is at least one adapter in the associated state
2247 * before starting the bandwidth timer.
2248 *
2249 * Return: None
2250 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002251void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002252
2253/**
2254 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
2255 * @hdd_ctx: the global hdd context
2256 *
2257 * Return: None
2258 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002259void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002260
2261/**
2262 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
2263 * @hdd_ctx: the global hdd context
2264 *
2265 * This function ensures there are no adapters in the associated state before
2266 * stopping the bandwidth timer.
2267 *
2268 * Return: None
2269 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002270void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002271
2272/**
2273 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002274 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002275 *
2276 * Initialize bus bandwidth related data structures like spinlock and timer.
2277 *
2278 * Return: None.
2279 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002280int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002281
2282/**
Dustin Brown86d196b2018-08-02 11:51:49 -07002283 * hdd_bus_bandwidth_deinit() - De-initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002284 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002285 *
Dustin Brown86d196b2018-08-02 11:51:49 -07002286 * De-initialize bus bandwidth related data structures like timer.
Prashanth Bhattaab004382016-10-11 16:08:11 -07002287 *
2288 * Return: None.
2289 */
Dustin Brown86d196b2018-08-02 11:51:49 -07002290void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx);
Lin Baic5c06882017-09-21 13:58:43 +08002291
Jinwei Chenb681a482019-08-14 15:24:06 +08002292static inline enum pld_bus_width_type
2293hdd_get_current_throughput_level(struct hdd_context *hdd_ctx)
2294{
2295 return hdd_ctx->cur_vote_level;
2296}
2297
Jinwei Chen0dc383e2019-08-23 00:43:04 +08002298static inline bool
2299hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx)
2300{
2301 return (qdf_atomic_read(&hdd_ctx->low_tput_gro_enable)) ? true : false;
2302}
2303
Lin Bai556a1922017-11-10 20:32:04 +08002304#define GET_CUR_RX_LVL(config) ((config)->cur_rx_level)
jitiphil869b9f72018-09-25 17:14:01 +05302305#define GET_BW_COMPUTE_INTV(config) ((config)->bus_bw_compute_interval)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002306#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07002307
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002308static inline
Sravan Kumar Kairam777a7dd2019-08-01 21:46:30 +05302309void hdd_bus_bw_compute_prev_txrx_stats(struct hdd_adapter *adapter)
2310{
2311}
2312
2313static inline
2314void hdd_bus_bw_compute_reset_prev_txrx_stats(struct hdd_adapter *adapter)
2315{
2316}
2317
2318static inline
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002319void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002320{
Dustin Brown5ec6b552017-03-31 12:11:40 -07002321}
2322
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002323static inline
2324void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002325{
2326}
2327
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002328static inline
2329void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002330{
2331}
2332
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002333static inline
2334void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002335{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002336}
2337
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002338static inline
2339int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002340{
2341 return 0;
2342}
2343
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002344static inline
Dustin Brown86d196b2018-08-02 11:51:49 -07002345void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002346{
Prashanth Bhattaab004382016-10-11 16:08:11 -07002347}
Lin Baic5c06882017-09-21 13:58:43 +08002348
Jinwei Chenb681a482019-08-14 15:24:06 +08002349static inline enum pld_bus_width_type
2350hdd_get_current_throughput_level(struct hdd_context *hdd_ctx)
2351{
2352 return PLD_BUS_WIDTH_NONE;
2353}
2354
Jinwei Chen0dc383e2019-08-23 00:43:04 +08002355static inline bool
2356hdd_is_low_tput_gro_enable(struct hdd_context *hdd_ctx)
2357{
2358 return false;
2359}
2360
Lin Bai556a1922017-11-10 20:32:04 +08002361#define GET_CUR_RX_LVL(config) 0
Lin Baiaa7f8d72017-10-18 17:23:45 +08002362#define GET_BW_COMPUTE_INTV(config) 0
2363
Tiger Yu8b119e92019-04-09 13:55:07 +08002364#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002365
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05302366int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
2367
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08002368int hdd_init(void);
2369void hdd_deinit(void);
2370
Dustin Brown92bd8382018-10-31 15:49:46 -07002371/**
2372 * hdd_wlan_startup() - HDD init function
Dustin Brown623e7e32018-09-05 14:27:50 -07002373 * hdd_ctx: the HDD context corresponding to the psoc to startup
Dustin Brown92bd8382018-10-31 15:49:46 -07002374 *
2375 * Return: Errno
2376 */
Dustin Brown623e7e32018-09-05 14:27:50 -07002377int hdd_wlan_startup(struct hdd_context *hdd_ctx);
Dustin Brown92bd8382018-10-31 15:49:46 -07002378
2379/**
2380 * hdd_wlan_exit() - HDD WLAN exit function
2381 * @hdd_ctx: pointer to the HDD Context
2382 *
2383 * Return: None
2384 */
2385void hdd_wlan_exit(struct hdd_context *hdd_ctx);
2386
2387/**
2388 * hdd_psoc_create_vdevs() - create the default vdevs for a psoc
2389 * @hdd_ctx: the HDD context for the psoc to operate against
2390 *
2391 * Return: QDF_STATUS
2392 */
2393QDF_STATUS hdd_psoc_create_vdevs(struct hdd_context *hdd_ctx);
2394
Dustin Brown623e7e32018-09-05 14:27:50 -07002395/*
2396 * hdd_context_create() - Allocate and inialize HDD context.
2397 * @dev: Device Pointer to the underlying device
2398 *
2399 * Allocate and initialize HDD context. HDD context is allocated as part of
2400 * wiphy allocation and then context is initialized.
2401 *
2402 * Return: HDD context on success and ERR_PTR on failure
2403 */
2404struct hdd_context *hdd_context_create(struct device *dev);
2405
2406/**
2407 * hdd_context_destroy() - Destroy HDD context
2408 * @hdd_ctx: HDD context to be destroyed.
2409 *
2410 * Free config and HDD context as well as destroy all the resources.
2411 *
2412 * Return: None
2413 */
2414void hdd_context_destroy(struct hdd_context *hdd_ctx);
2415
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002416int hdd_wlan_notify_modem_power_state(int state);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002417
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05302418void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002419#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002420void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002421#endif
2422
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002423struct hdd_adapter *
2424hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
2425 bool check_start_bss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002426
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002427bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002428
Ashish Kumar Dhanotiya34507e02019-06-12 12:53:59 +05302429/**
2430 * hdd_is_2g_supported() - check if 2GHz channels are supported
2431 * @hdd_ctx: Pointer to the hdd context
2432 *
2433 * HDD function to know if 2GHz channels are supported
2434 *
2435 * Return: true if 2GHz channels are supported
2436 */
2437
2438bool hdd_is_2g_supported(struct hdd_context *hdd_ctx);
2439
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002440int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002441
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002442#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002443static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002444{
Wu Gaoca416ff2018-09-17 11:05:07 +08002445 bool is_roam_offload;
2446
Dustin Brown05d81302018-09-11 16:49:22 -07002447 ucfg_mlme_get_roaming_offload(hdd_ctx->psoc, &is_roam_offload);
Wu Gaoca416ff2018-09-17 11:05:07 +08002448
2449 return is_roam_offload;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002450}
2451#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002452static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002453{
2454 return false;
2455}
2456#endif
2457
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002458#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002459static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002460{
Wu Gao1ab05582018-11-08 16:22:49 +08002461 bool lfr_enabled;
2462
2463 ucfg_mlme_is_lfr_enabled(hdd_ctx->psoc, &lfr_enabled);
2464
2465 return lfr_enabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002466}
2467#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002468static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002469{
2470 return false;
2471}
2472#endif
2473
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002474static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002475{
2476 bool val;
2477
2478 val = hdd_driver_roaming_supported(hdd_ctx) ||
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002479 roaming_offload_enabled(hdd_ctx);
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002480
2481 return val;
2482}
2483
2484#ifdef CFG80211_SCAN_RANDOM_MAC_ADDR
2485static inline bool hdd_scan_random_mac_addr_supported(void)
2486{
2487 return true;
2488}
2489#else
2490static inline bool hdd_scan_random_mac_addr_supported(void)
2491{
2492 return false;
2493}
2494#endif
2495
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302496/**
2497 * hdd_start_vendor_acs(): Start vendor ACS procedure
2498 * @adapter: pointer to SAP adapter struct
2499 *
2500 * This function sends the ACS config to the ACS daemon and
2501 * starts the vendor ACS timer to wait for the next command.
2502 *
2503 * Return: Status of vendor ACS procedure
2504 */
2505int hdd_start_vendor_acs(struct hdd_adapter *adapter);
2506
Kapil Gupta8878ad92017-02-13 11:56:04 +05302507/**
2508 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
Ashish Kumar Dhanotiyaeadb28b2019-06-28 14:34:19 +05302509 * @context: timeout handler context
Kapil Gupta8878ad92017-02-13 11:56:04 +05302510 *
2511 * Return: None
2512 */
2513void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002514
Kapil Gupta8878ad92017-02-13 11:56:04 +05302515/**
2516 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
2517 * @adapter: pointer to SAP adapter struct
2518 *
2519 * This function starts the ACS procedure if there are no
2520 * constraints like MBSSID DFS restrictions.
2521 *
2522 * Return: Status of ACS Start procedure
2523 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002524int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302525
2526/**
2527 * hdd_cfg80211_update_acs_config() - update acs config to application
2528 * @adapter: hdd adapter
2529 * @reason: channel change reason
2530 *
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302531 * Return: 0 for success else error code
Kapil Gupta8878ad92017-02-13 11:56:04 +05302532 */
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302533int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
2534 uint8_t reason);
Nirav Shaheb017be2018-02-15 11:20:58 +05302535
Kapil Gupta8878ad92017-02-13 11:56:04 +05302536/**
2537 * hdd_update_acs_timer_reason() - update acs timer start reason
2538 * @adapter: hdd adapter
2539 * @reason: channel change reason
2540 *
2541 * Return: 0 for success
2542 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002543int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302544
2545/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002546 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05302547 * @adapter: AP adapter
2548 * @channel: Channel
Min Liu2fef5792018-01-19 17:59:42 +08002549 * @forced: Force to switch channel, ignore SCC/MCC check
Kapil Gupta8878ad92017-02-13 11:56:04 +05302550 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002551 * Moves the SAP interface by invoking the function which
2552 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05302553 *
2554 * Return: None
2555 */
Min Liu2fef5792018-01-19 17:59:42 +08002556void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
2557 bool forced);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002558
Nirav Shaheb017be2018-02-15 11:20:58 +05302559#if defined(FEATURE_WLAN_CH_AVOID)
2560void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
2561
2562void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2563 struct unsafe_ch_list *unsafe_chan_list,
2564 struct ch_avoid_ind_type *avoid_freq_list);
2565#else
2566static inline
2567void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
2568{
2569}
2570
2571static inline
2572void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2573 struct unsafe_ch_list *unsafe_chan_list,
2574 struct ch_avoid_ind_type *avoid_freq_list)
2575{
2576}
2577#endif
2578
Ashish Kumar Dhanotiya7a11e272018-11-28 13:16:55 +05302579/**
2580 * hdd_free_mac_address_lists() - Free both the MAC address lists
2581 * @hdd_ctx: HDD context
2582 *
2583 * This API clears/memset provisioned address list and
2584 * derived address list
2585 *
2586 */
2587void hdd_free_mac_address_lists(struct hdd_context *hdd_ctx);
2588
2589/**
2590 * hdd_update_macaddr() - update mac address
2591 * @hdd_ctx: hdd contxt
2592 * @hw_macaddr: mac address
2593 * @generate_mac_auto: Indicates whether the first address is
2594 * provisioned address or derived address.
2595 *
2596 * Mac address for multiple virtual interface is found as following
2597 * i) The mac address of the first interface is just the actual hw mac address.
2598 * ii) MSM 3 or 4 bits of byte5 of the actual mac address are used to
2599 * define the mac address for the remaining interfaces and locally
2600 * admistered bit is set. INTF_MACADDR_MASK is based on the number of
2601 * supported virtual interfaces, right now this is 0x07 (meaning 8
2602 * interface).
2603 * Byte[3] of second interface will be hw_macaddr[3](bit5..7) + 1,
2604 * for third interface it will be hw_macaddr[3](bit5..7) + 2, etc.
2605 *
2606 * Return: None
2607 */
2608void hdd_update_macaddr(struct hdd_context *hdd_ctx,
2609 struct qdf_mac_addr hw_macaddr, bool generate_mac_auto);
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302610
2611/**
gaurank kathpalia6c4b50c2019-02-28 14:07:48 +05302612 * hdd_store_nss_chains_cfg_in_vdev() - Store the per vdev ini cfg in vdev_obj
2613 * @adapter: Current HDD adapter passed from caller
2614 *
2615 * This function will store the per vdev nss params to the particular mlme
2616 * vdev obj.
2617 *
2618 * Return: None
2619 */
2620void
2621hdd_store_nss_chains_cfg_in_vdev(struct hdd_adapter *adapter);
2622
2623/**
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302624 * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
2625 * @cur_adapter: Current HDD adapter passed from caller
Abhinav Kumar523ca372019-08-30 16:28:19 +05302626 * @mlme_operation_requestor: roam disable requestor
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302627 *
2628 * This function loops through all adapters and disables roaming on each STA
2629 * mode adapter except the current adapter passed from the caller
2630 *
2631 * Return: None
2632 */
Abhinav Kumar523ca372019-08-30 16:28:19 +05302633void wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter,
2634 uint32_t mlme_operation_requestor);
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302635
2636/**
2637 * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one
2638 * @cur_adapter: Current HDD adapter passed from caller
Abhinav Kumar523ca372019-08-30 16:28:19 +05302639 * @mlme_operation_requestor: roam disable requestor
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302640 *
2641 * This function loops through all adapters and enables roaming on each STA
2642 * mode adapter except the current adapter passed from the caller
2643 *
2644 * Return: None
2645 */
Abhinav Kumar523ca372019-08-30 16:28:19 +05302646void wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter,
2647 uint32_t mlme_operation_requestor);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002648
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002649QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002650
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002651QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002652
Jeff Johnson9d295242017-08-29 14:39:48 -07002653void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
2654void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002655
2656#ifdef QCA_CONFIG_SMP
2657int wlan_hdd_get_cpu(void);
2658#else
2659static inline int wlan_hdd_get_cpu(void)
2660{
2661 return 0;
2662}
2663#endif
2664
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302665void wlan_hdd_sap_pre_cac_failure(void *data);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002666void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302667
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002668void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2669 enum netif_action_type action, enum netif_reason_type reason);
2670
Ajit Pal Singh106c1412018-04-18 18:08:49 +05302671#ifdef QCA_HL_NETDEV_FLOW_CONTROL
2672void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2673 enum netif_action_type action);
2674#else
2675static inline void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2676 enum netif_action_type action)
2677{
2678}
2679#endif /* QCA_HL_NETDEV_FLOW_CONTROL */
2680
Jeff Johnson9d295242017-08-29 14:39:48 -07002681int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002682void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002683void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
2684void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
Mohit Khanna70322002018-05-15 19:21:32 -07002685
Mohit Khannaca4173b2017-09-12 21:52:19 -07002686void
2687wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
2688 enum qdf_stats_verbosity_level verb_lvl);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002689void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002690const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302691void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002692
Naveen Rawat4edb6822017-04-12 10:09:17 -07002693/**
2694 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2695 * @hdd_ctx: hdd context.
2696 * @iface_name: interface name
2697 *
2698 * This function is used to get the adapter with given interface name
2699 *
2700 * Return: adapter pointer if found, NULL otherwise
2701 *
2702 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002703struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx,
Naveen Rawat4edb6822017-04-12 10:09:17 -07002704 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002705enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Jeff Johnson16528362018-06-14 12:34:16 -07002706
2707/**
Dustin Brown56377e12018-10-10 17:04:04 -07002708 * hdd_nl_to_qdf_iface_type() - map nl80211_iftype to QDF_OPMODE
2709 * @nl_type: the input NL80211 interface type to map
2710 * @out_qdf_type: the output, equivalent QDF operating mode
2711 *
2712 * Return: QDF_STATUS
2713 */
2714QDF_STATUS hdd_nl_to_qdf_iface_type(enum nl80211_iftype nl_type,
2715 enum QDF_OPMODE *out_qdf_type);
2716
2717/**
Jeff Johnson16528362018-06-14 12:34:16 -07002718 * wlan_hdd_find_opclass() - Find operating class for a channel
2719 * @mac_handle: global MAC handle
2720 * @channel: channel id
2721 * @bw_offset: bandwidth offset
2722 *
2723 * Function invokes sme api to find the operating class
2724 *
2725 * Return: operating class
2726 */
2727uint8_t wlan_hdd_find_opclass(mac_handle_t mac_handle, uint8_t channel,
2728 uint8_t bw_offset);
2729
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002730int hdd_update_config(struct hdd_context *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002731
Mukul Sharma9d797a02017-01-05 20:26:03 +05302732/**
2733 * hdd_update_components_config() - Initialize driver per module ini parameters
2734 * @hdd_ctx: HDD Context
2735 *
2736 * API is used to initialize components configuration parameters
2737 * Return: 0 for success, errno for failure
2738 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002739int hdd_update_components_config(struct hdd_context *hdd_ctx);
Mukul Sharma9d797a02017-01-05 20:26:03 +05302740
Jeff Johnson9d295242017-08-29 14:39:48 -07002741QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302742 struct net_device *dev,
bings58ce8622017-07-10 15:55:36 +08002743 struct hdd_chan_change_params chan_change,
2744 bool legacy_phymode);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302745int wlan_hdd_set_channel(struct wiphy *wiphy,
2746 struct net_device *dev,
2747 struct cfg80211_chan_def *chandef,
2748 enum nl80211_channel_type channel_type);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002749int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302750 struct cfg80211_beacon_data *params,
2751 const u8 *ssid, size_t ssid_len,
2752 enum nl80211_hidden_ssid hidden_ssid,
Mahesh Kumar Kalikot Veetilc637fc92017-09-27 16:06:21 -07002753 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302754
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002755#if !defined(REMOVE_PKT_LOG)
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002756int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302757 int set_value2);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002758int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302759 uint8_t user_triggered, int size);
2760
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002761#else
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002762static inline
2763int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
2764 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002765{
2766 return 0;
2767}
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002768
2769static inline
2770int hdd_process_pktlog_command(struct hdd_context *hdd_ctx,
2771 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002772{
2773 return 0;
2774}
2775#endif /* REMOVE_PKT_LOG */
2776
Tiger Yu83795752019-01-16 19:48:01 +08002777#if defined(FEATURE_SG) && !defined(CONFIG_HL_SUPPORT)
Tiger Yu24ca3362018-11-05 16:49:11 +08002778/**
2779 * hdd_set_sg_flags() - enable SG flag in the network device
2780 * @hdd_ctx: HDD context
2781 * @wlan_dev: network device structure
2782 *
2783 * This function enables the SG feature flag in the
2784 * given network device.
2785 *
2786 * Return: none
2787 */
2788static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx,
2789 struct net_device *wlan_dev)
2790{
2791 hdd_debug("SG Enabled");
2792 wlan_dev->features |= NETIF_F_SG;
2793}
2794#else
2795static inline void hdd_set_sg_flags(struct hdd_context *hdd_ctx,
2796 struct net_device *wlan_dev){}
2797#endif
2798
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002799#ifdef FEATURE_TSO
2800/**
2801 * hdd_set_tso_flags() - enable TSO flags in the network device
2802 * @hdd_ctx: HDD context
2803 * @wlan_dev: network device structure
2804 *
2805 * This function enables the TSO related feature flags in the
2806 * given network device.
2807 *
2808 * Return: none
2809 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002810static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002811 struct net_device *wlan_dev)
2812{
jitiphil377bcc12018-10-05 19:46:08 +05302813 if (cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC),
2814 cfg_dp_tso_enable) &&
2815 cdp_cfg_get(cds_get_context(QDF_MODULE_ID_SOC),
2816 cfg_dp_enable_ip_tcp_udp_checksum_offload)){
Mohit Khanna816e6532016-12-09 15:28:21 -08002817 /*
2818 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2819 * enabled.
2820 */
Dustin Brown7e761c72018-07-31 13:50:17 -07002821 hdd_debug("TSO Enabled");
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002822 wlan_dev->features |=
2823 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2824 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2825 }
2826}
2827#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002828static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Tiger Yu24ca3362018-11-05 16:49:11 +08002829 struct net_device *wlan_dev)
2830{
2831 hdd_set_sg_flags(hdd_ctx, wlan_dev);
2832}
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002833#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002834
Hangtian Zhua053d2a2019-09-27 15:02:23 +08002835/**
2836 * wlan_hdd_get_host_log_nl_proto() - Get host log netlink protocol
2837 * @hdd_ctx: HDD context
2838 *
2839 * This function returns with host log netlink protocol settings
2840 *
2841 * Return: none
2842 */
2843#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
2844static inline int wlan_hdd_get_host_log_nl_proto(struct hdd_context *hdd_ctx)
2845{
2846 return hdd_ctx->config->host_log_custom_nl_proto;
2847}
2848#else
2849static inline int wlan_hdd_get_host_log_nl_proto(struct hdd_context *hdd_ctx)
2850{
2851 return NETLINK_USERSOCK;
2852}
2853#endif
2854
Ryan Hsuceddceb2016-04-28 10:20:14 -07002855#ifdef CONFIG_CNSS_LOGGER
2856/**
2857 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2858 * @hdd_ctx: the hdd context pointer
2859 *
2860 * The nl_srv_init() will call to cnss_logger_device_register() and
2861 * expect to get a radio_index from cnss_logger module and assign to
2862 * hdd_ctx->radio_index, then to maintain the consistency to original
2863 * design, adding the radio_index check here, then return the error
2864 * code if radio_index is not assigned correctly, which means the nl_init
2865 * from cnss_logger is failed.
2866 *
2867 * Return: 0 if successfully, otherwise error code
2868 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002869static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002870{
Hangtian Zhuc7642602019-09-11 17:47:43 +08002871 int proto;
2872
Hangtian Zhua053d2a2019-09-27 15:02:23 +08002873 proto = wlan_hdd_get_host_log_nl_proto(hdd_ctx);
Hangtian Zhuc7642602019-09-11 17:47:43 +08002874 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy, proto);
Ryan Hsuceddceb2016-04-28 10:20:14 -07002875
2876 /* radio_index is assigned from 0, so only >=0 will be valid index */
2877 if (hdd_ctx->radio_index >= 0)
2878 return 0;
2879 else
2880 return -EINVAL;
2881}
2882#else
2883/**
2884 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2885 * @hdd_ctx: the hdd context pointer
2886 *
2887 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2888 * the netlink socket and return the success or not.
2889 *
2890 * Return: the return value from nl_srv_init()
2891 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002892static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002893{
Hangtian Zhuc7642602019-09-11 17:47:43 +08002894 int proto;
2895
Hangtian Zhua053d2a2019-09-27 15:02:23 +08002896 proto = wlan_hdd_get_host_log_nl_proto(hdd_ctx);
Hangtian Zhuc7642602019-09-11 17:47:43 +08002897 return nl_srv_init(hdd_ctx->wiphy, proto);
Ryan Hsuceddceb2016-04-28 10:20:14 -07002898}
2899#endif
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002900QDF_STATUS hdd_sme_open_session_callback(uint8_t vdev_id,
Pragaspathi Thilagaraj3551caa2018-09-26 15:52:56 +05302901 QDF_STATUS qdf_status);
Jeff Johnson55d2ab42019-03-06 11:43:49 -08002902QDF_STATUS hdd_sme_close_session_callback(uint8_t vdev_id);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002903
Jeff Johnson9d295242017-08-29 14:39:48 -07002904int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002905 uint8_t channel, const handoff_src src);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002906int hdd_register_cb(struct hdd_context *hdd_ctx);
2907void hdd_deregister_cb(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002908int hdd_start_station_adapter(struct hdd_adapter *adapter);
2909int hdd_start_ap_adapter(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002910int hdd_configure_cds(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002911int hdd_set_fw_params(struct hdd_adapter *adapter);
Dustin Brown3ecc8782018-09-19 16:37:13 -07002912
2913/**
2914 * hdd_wlan_start_modules() - Single driver state machine for starting modules
2915 * @hdd_ctx: HDD context
2916 * @reinit: flag to indicate from SSR or normal path
2917 *
2918 * This function maintains the driver state machine it will be invoked from
2919 * startup, reinit and change interface. Depending on the driver state shall
2920 * perform the opening of the modules.
2921 *
2922 * Return: Errno
2923 */
Dustin Browne7e71d32018-05-11 16:00:08 -07002924int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit);
Dustin Brown3ecc8782018-09-19 16:37:13 -07002925
2926/**
2927 * hdd_wlan_stop_modules - Single driver state machine for stoping modules
2928 * @hdd_ctx: HDD context
2929 * @ftm_mode: ftm mode
2930 *
2931 * This function maintains the driver state machine it will be invoked from
2932 * exit, shutdown and con_mode change handler. Depending on the driver state
2933 * shall perform the stopping/closing of the modules.
2934 *
2935 * Return: Errno
2936 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002937int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
Dustin Brown4c663222018-10-23 14:19:36 -07002938
2939/**
2940 * hdd_psoc_idle_timer_start() - start the idle psoc detection timer
2941 * @hdd_ctx: the hdd context for which the timer should be started
2942 *
2943 * Return: None
2944 */
2945void hdd_psoc_idle_timer_start(struct hdd_context *hdd_ctx);
2946
2947/**
2948 * hdd_psoc_idle_timer_stop() - stop the idle psoc detection timer
2949 * @hdd_ctx: the hdd context for which the timer should be stopped
2950 *
2951 * Return: None
2952 */
2953void hdd_psoc_idle_timer_stop(struct hdd_context *hdd_ctx);
2954
Dustin Brown3ecc8782018-09-19 16:37:13 -07002955/**
Rajeev Kumar473f9af2019-04-05 14:25:56 -07002956 * hdd_trigger_psoc_idle_restart() - trigger restart of a previously shutdown
2957 * idle psoc, if needed
Dustin Brown3ecc8782018-09-19 16:37:13 -07002958 * @hdd_ctx: the hdd context which should be restarted
2959 *
2960 * This API does nothing if the given psoc is already active.
2961 *
2962 * Return: Errno
2963 */
Rajeev Kumar473f9af2019-04-05 14:25:56 -07002964int hdd_trigger_psoc_idle_restart(struct hdd_context *hdd_ctx);
Dustin Brown3ecc8782018-09-19 16:37:13 -07002965
Jeff Johnson9d295242017-08-29 14:39:48 -07002966int hdd_start_adapter(struct hdd_adapter *adapter);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002967void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);
yeshwanth sriram guntukaea63f632017-08-30 19:31:56 +05302968/**
2969 * hdd_is_interface_up()- Checkfor interface up before ssr
2970 * @hdd_ctx: HDD context
2971 *
2972 * check if there are any wlan interfaces before SSR accordingly start
2973 * the interface.
2974 *
2975 * Return: 0 if interface was opened else false
2976 */
2977bool hdd_is_interface_up(struct hdd_adapter *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302978
Anurag Chouhanc4092922016-09-08 15:56:11 +05302979void hdd_connect_result(struct net_device *dev, const u8 *bssid,
Jeff Johnson172237b2017-11-07 15:32:59 -08002980 struct csr_roam_info *roam_info, const u8 *req_ie,
Anurag Chouhanc4092922016-09-08 15:56:11 +05302981 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302982 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302983 bool connect_timeout,
2984 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302985
Arun Khandavallifae92942016-08-01 13:31:08 +05302986#ifdef WLAN_FEATURE_FASTPATH
jitiphil377bcc12018-10-05 19:46:08 +05302987void hdd_enable_fastpath(struct hdd_context *hdd_ctx,
Arun Khandavallifae92942016-08-01 13:31:08 +05302988 void *context);
2989#else
jitiphil377bcc12018-10-05 19:46:08 +05302990static inline void hdd_enable_fastpath(struct hdd_context *hdd_ctx,
Arun Khandavallifae92942016-08-01 13:31:08 +05302991 void *context)
2992{
2993}
2994#endif
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002995void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context);
Nirav Shaheb017be2018-02-15 11:20:58 +05302996
Agrawal Ashish65634612016-08-18 13:24:32 +05302997enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002998void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
Liangwei Dong6e1a2092017-08-30 16:29:06 +08002999/**
3000 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list
3001 * @hdd_ctx: hdd context pointer
3002 * @local_unsafe_list: copied unsafe chan list array
3003 * @local_unsafe_list_count: channel number in returned local_unsafe_list
3004 *
3005 * The function will allocate memory and make a copy the current unsafe
3006 * channels from hdd ctx. The caller need to free the local_unsafe_list
3007 * memory after use.
3008 *
3009 * Return: 0 if successfully clone unsafe chan list.
3010 */
3011int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
3012 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count);
3013
3014/**
3015 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not
3016 * @hdd_ctx: hdd context pointer
3017 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list
3018 * @local_unsafe_list_count: channel number in local_unsafe_list
3019 *
3020 * The function checked the input channel is same as current unsafe chan
3021 * list in hdd_ctx.
3022 *
3023 * Return: true if input channel list is same as the list in hdd_ctx
3024 */
3025bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx,
3026 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count);
3027
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003028int hdd_enable_disable_ca_event(struct hdd_context *hddctx,
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05303029 uint8_t set_value);
Jeff Johnson9d295242017-08-29 14:39:48 -07003030void wlan_hdd_undo_acs(struct hdd_adapter *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07003031
3032#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
3033static inline int
3034hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
3035{
3036 return nla_put_u64(skb, attrtype, value);
3037}
3038#else
3039static inline int
3040hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
3041{
3042 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
3043}
3044#endif
3045
Jeff Johnson57e07512018-03-13 09:16:33 -07003046/**
3047 * hdd_roam_profile() - Get adapter's roam profile
3048 * @adapter: The adapter being queried
3049 *
3050 * Given an adapter this function returns a pointer to its roam profile.
3051 *
3052 * NOTE WELL: Caller is responsible for ensuring this interface is only
3053 * invoked for STA-type interfaces
3054 *
3055 * Return: pointer to the adapter's roam profile
3056 */
3057static inline
3058struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter)
3059{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003060 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003061
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003062 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003063
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003064 return &sta_ctx->roam_profile;
Jeff Johnson57e07512018-03-13 09:16:33 -07003065}
3066
3067/**
3068 * hdd_security_ie() - Get adapter's security IE
3069 * @adapter: The adapter being queried
3070 *
3071 * Given an adapter this function returns a pointer to its security IE
3072 * buffer. Note that this buffer is maintained outside the roam
3073 * profile but, when in use, is referenced by a pointer within the
3074 * roam profile.
3075 *
3076 * NOTE WELL: Caller is responsible for ensuring this interface is only
3077 * invoked for STA-type interfaces
3078 *
3079 * Return: pointer to the adapter's roam profile security IE buffer
3080 */
3081static inline
3082uint8_t *hdd_security_ie(struct hdd_adapter *adapter)
3083{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003084 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003085
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003086 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003087
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003088 return sta_ctx->security_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07003089}
3090
3091/**
3092 * hdd_assoc_additional_ie() - Get adapter's assoc additional IE
3093 * @adapter: The adapter being queried
3094 *
3095 * Given an adapter this function returns a pointer to its assoc
3096 * additional IE buffer. Note that this buffer is maintained outside
3097 * the roam profile but, when in use, is referenced by a pointer
3098 * within the roam profile.
3099 *
3100 * NOTE WELL: Caller is responsible for ensuring this interface is only
3101 * invoked for STA-type interfaces
3102 *
3103 * Return: pointer to the adapter's assoc additional IE buffer
3104 */
3105static inline
3106tSirAddie *hdd_assoc_additional_ie(struct hdd_adapter *adapter)
3107{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003108 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07003109
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003110 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07003111
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07003112 return &sta_ctx->assoc_additional_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07003113}
3114
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05303115/**
3116 * hdd_is_roaming_in_progress() - check if roaming is in progress
3117 * @hdd_ctx - Global HDD context
3118 *
3119 * Checks if roaming is in progress on any of the adapters
3120 *
3121 * Return: true if roaming is in progress else false
3122 */
3123bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08003124void hdd_set_roaming_in_progress(bool value);
Jeff Johnsona2ac4e72019-03-06 08:35:29 -08003125
3126/**
3127 * hdd_is_connection_in_progress() - check if connection is in progress
3128 * @out_vdev_id: id of vdev where connection is occurring
3129 * @out_reason: scan reject reason
3130 *
3131 * Go through each adapter and check if connection is in progress.
3132 * Output parameters @out_vdev_id and @out_reason will only be written
3133 * when a connection is in progress.
3134 *
3135 * Return: true if connection is in progress else false
3136 */
3137bool hdd_is_connection_in_progress(uint8_t *out_vdev_id,
3138 enum scan_reject_states *out_reason);
3139
Jeff Johnson9d295242017-08-29 14:39:48 -07003140void hdd_restart_sap(struct hdd_adapter *ap_adapter);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08003141void hdd_check_and_restart_sap_with_non_dfs_acs(void);
3142bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08003143
Kapil Gupta94ca6f62016-12-11 18:43:12 +05303144/**
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05303145 * wlan_hdd_init_chan_info() - initialize channel info variables
3146 * @hdd_ctx: hdd ctx
3147 *
3148 * This API initialize channel info variables
3149 *
3150 * Return: None
3151 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003152void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07003153
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05303154/**
3155 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
3156 * @hdd_ctx: hdd ctx
3157 *
3158 * This API deinitialize channel info variables
3159 *
3160 * Return: None
3161 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003162void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07003163void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08003164
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303165/**
Dustin Brown4c663222018-10-23 14:19:36 -07003166 * hdd_is_any_interface_open() - Check for interface up
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303167 * @hdd_ctx: HDD context
3168 *
Dustin Brown4c663222018-10-23 14:19:36 -07003169 * Return: true if any interface is open
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05303170 */
Dustin Brown4c663222018-10-23 14:19:36 -07003171bool hdd_is_any_interface_open(struct hdd_context *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08003172
3173#ifdef WIFI_POS_CONVERGED
3174/**
3175 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
3176 * function to send peer status to a registered application
3177 * @peer_mac: MAC address of peer
3178 * @peer_status: ePeerConnected or ePeerDisconnected
3179 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
Jeff Johnson8c76d602019-02-23 11:38:59 -08003180 * @vdev_id: ID of the underlying vdev
Naveen Rawat910726a2017-03-06 11:42:51 -08003181 * @chan_info: operating channel information
3182 * @dev_mode: dev mode for which indication is sent
3183 *
3184 * Return: none
3185 */
3186static inline void hdd_send_peer_status_ind_to_app(
3187 struct qdf_mac_addr *peer_mac,
3188 uint8_t peer_status,
3189 uint8_t peer_timing_meas_cap,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003190 uint8_t vdev_id,
Jeff Johnsona7d5b542019-02-03 10:15:46 -08003191 struct oem_channel_info *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08003192 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08003193{
3194 struct wifi_pos_ch_info ch_info;
3195
Naveen Rawat6877a242017-03-23 17:15:38 -07003196 if (!chan_info) {
3197 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003198 peer_timing_meas_cap, vdev_id,
3199 NULL, dev_mode);
Naveen Rawat6877a242017-03-23 17:15:38 -07003200 return;
3201 }
3202
Naveen Rawat910726a2017-03-06 11:42:51 -08003203 ch_info.mhz = chan_info->mhz;
3204 ch_info.band_center_freq1 = chan_info->band_center_freq1;
3205 ch_info.band_center_freq2 = chan_info->band_center_freq2;
3206 ch_info.info = chan_info->info;
3207 ch_info.reg_info_1 = chan_info->reg_info_1;
3208 ch_info.reg_info_2 = chan_info->reg_info_2;
3209 ch_info.nss = chan_info->nss;
3210 ch_info.rate_flags = chan_info->rate_flags;
3211 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
3212 ch_info.ch_width = chan_info->ch_width;
3213 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003214 peer_timing_meas_cap, vdev_id,
Naveen Rawat910726a2017-03-06 11:42:51 -08003215 &ch_info, dev_mode);
3216}
3217#else
3218static inline void hdd_send_peer_status_ind_to_app(
3219 struct qdf_mac_addr *peer_mac,
3220 uint8_t peer_status,
3221 uint8_t peer_timing_meas_cap,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003222 uint8_t vdev_id,
Jeff Johnsona7d5b542019-02-03 10:15:46 -08003223 struct oem_channel_info *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08003224 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08003225{
3226 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
Jeff Johnson8c76d602019-02-23 11:38:59 -08003227 peer_timing_meas_cap, vdev_id, chan_info, dev_mode);
Naveen Rawat910726a2017-03-06 11:42:51 -08003228}
3229#endif /* WIFI_POS_CONVERGENCE */
3230
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003231/**
3232 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
3233 * @adapter: Adapter data
3234 * @sval: P2P quota value
3235 *
3236 * Send P2P quota value to FW
3237 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003238 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003239 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003240int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003241
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003242/**
3243 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
3244 * @adapter: Adapter data
3245 * @sval: MCC latency value
3246 *
3247 * Send MCC latency value to FW
3248 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003249 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003250 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003251int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003252
3253/**
3254 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
3255 * and PSOC object data
3256 * @psoc: Psoc object data
3257 * @vdev_id: vdev id
3258 *
3259 * Get adapter from vdev id and PSOC object data
3260 *
3261 * Return: adapter pointer
3262 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003263struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003264 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05303265/**
3266 * hdd_unregister_notifiers()- unregister kernel notifiers
3267 * @hdd_ctx: Hdd Context
3268 *
3269 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
3270 *
3271 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003272void hdd_unregister_notifiers(struct hdd_context *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05303273
3274/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303275 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
3276 * @hdd_ctx: HDD context
3277 *
3278 * This function sends the DBS scan selection config configuration to the
3279 * firmware via WMA
3280 *
3281 * Return: 0 - success, < 0 - failure
3282 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003283int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303284
3285/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05303286 * hdd_start_complete()- complete the start event
3287 * @ret: return value for complete event.
3288 *
3289 * complete the startup event and set the return in
3290 * global variable
3291 *
3292 * Return: void
3293 */
3294
3295void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303296
3297/**
3298 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
3299 * callback
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003300 * @hdd_handle: HDD handle
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303301 * @data: chip power save failure detected data
3302 *
3303 * This function reads the chip power save failure detected data and fill in
3304 * the skb with NL attributes and send up the NL event.
3305 * This callback execute in atomic context and must not invoke any
3306 * blocking calls.
3307 *
3308 * Return: none
3309 */
3310
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003311void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle,
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303312 struct chip_pwr_save_fail_detected_params
3313 *data);
3314
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303315/**
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303316 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg
3317 * @ie_whitelist: output parameter
Dundi Raviteja85a240a2018-09-10 15:03:07 +05303318 * @hdd_ctx: pointer to hdd context
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303319 *
3320 * Return: None
3321 */
3322void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
Dundi Raviteja85a240a2018-09-10 15:03:07 +05303323 struct hdd_context *hdd_ctx);
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303324
3325/**
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303326 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache
3327 * @adapter: adapter handle
3328 * @bssid: bssid to look for in scan cache
3329 * @rssi: rssi value found
3330 * @snr: snr value found
3331 *
3332 * Return: QDF_STATUS
3333 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003334int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303335 int8_t *rssi, int8_t *snr);
3336
Ganesh Kondabattini479a8ae2017-10-03 16:49:24 +05303337/**
3338 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters
3339 * @adapter - HDD adapter
3340 *
3341 * Return: 0 on success and non zero value on failure
3342 */
3343int hdd_reset_limit_off_chan(struct hdd_adapter *adapter);
3344
Vignesh Viswanathan3fa1d382017-08-02 19:36:43 +05303345#if defined(WLAN_FEATURE_FILS_SK) && \
3346 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
3347 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303348/**
3349 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and
3350 * free allocated memory
3351 * @adapter: pointer to hdd adapter
3352 *
3353 * Return: None
3354 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003355void hdd_clear_fils_connection_info(struct hdd_adapter *adapter);
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303356
3357/**
3358 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp
3359 * @dev: net device
3360 * @roam_fils_params: Fils join rsp params
3361 *
3362 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM)
3363 * to the network layer.
3364 *
3365 * Return: None
3366 */
Jeff Johnson172237b2017-11-07 15:32:59 -08003367void hdd_update_hlp_info(struct net_device *dev,
3368 struct csr_roam_info *roam_info);
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303369#else
Jeff Johnson9d295242017-08-29 14:39:48 -07003370static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303371{ }
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303372static inline void hdd_update_hlp_info(struct net_device *dev,
Jeff Johnson172237b2017-11-07 15:32:59 -08003373 struct csr_roam_info *roam_info)
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303374{}
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303375#endif
Dustin Brown3fb15042017-08-15 15:54:49 -07003376
3377#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownc81dd412017-08-15 16:26:28 -07003378static inline void hdd_dev_setup_destructor(struct net_device *dev)
3379{
3380 dev->destructor = free_netdev;
3381}
Dustin Brown3fb15042017-08-15 15:54:49 -07003382#else
Dustin Brownc81dd412017-08-15 16:26:28 -07003383static inline void hdd_dev_setup_destructor(struct net_device *dev)
3384{
3385 dev->needs_free_netdev = true;
3386}
Dustin Brownc81dd412017-08-15 16:26:28 -07003387#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brown3fb15042017-08-15 15:54:49 -07003388
Mohit Khannaf8f96822017-05-17 17:11:59 -07003389/**
3390 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API
3391 * @config: hdd config
3392 *
3393 * Return: NONE
3394 */
Nirav Shahd21a2e32018-04-20 16:34:43 +05303395#ifdef CONFIG_DP_TRACE
Mohit Khannaf8f96822017-05-17 17:11:59 -07003396void hdd_dp_trace_init(struct hdd_config *config);
Nirav Shahd21a2e32018-04-20 16:34:43 +05303397#else
3398static inline
3399void hdd_dp_trace_init(struct hdd_config *config) {}
3400#endif
3401
Jeff Johnsona1382382019-03-31 11:08:27 -07003402/**
3403 * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode
3404 * @enable: Set true to enable RPS in SAP mode
3405 *
3406 * Callback function registered with datapath
3407 *
3408 * Return: none
3409 */
Yun Parkff6a16a2017-09-26 16:38:18 -07003410void hdd_set_rx_mode_rps(bool enable);
Mohit Khannaf8f96822017-05-17 17:11:59 -07003411
Ganesh Kondabattini35739572017-06-21 16:26:39 +05303412/**
Jeff Johnson33142e62018-05-06 17:58:36 -07003413 * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100%
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303414 * (0x64). If it exceed make it 100%
3415 *
3416 * @per_index_score: per_index_score as input
3417 *
3418 * Return: per_index_score within the max limit
3419 */
3420uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score);
Abhinav Kumarb074f2f2018-09-15 15:32:11 +05303421
3422/**
3423 * hdd_update_score_config - API to update candidate scoring related params
3424 * configuration parameters
3425 * @score_config: score config to update
3426 * @cfg: config params
3427 *
3428 * Return: QDF_STATUS
3429 */
3430QDF_STATUS hdd_update_score_config(
3431 struct scoring_config *score_config, struct hdd_context *hdd_ctx);
3432
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05303433/**
3434 * hdd_get_stainfo() - get stainfo for the specified peer
3435 * @astainfo: array of the station info in which the sta info
3436 * corresponding to mac_addr needs to be searched
3437 * @mac_addr: mac address of requested peer
3438 *
3439 * This function find the stainfo for the peer with mac_addr
3440 *
3441 * Return: stainfo if found, NULL if not found
3442 */
3443struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo,
3444 struct qdf_mac_addr mac_addr);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303445
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303446/**
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303447 * hdd_component_psoc_open() - Open the legacy components
3448 * @psoc: Pointer to psoc object
3449 *
3450 * This function opens the legacy components and initializes the
3451 * component's private objects.
3452 *
3453 * Return: QDF_STATUS
3454 */
3455QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc);
3456
3457/**
3458 * hdd_component_psoc_close() - Close the legacy components
3459 * @psoc: Pointer to psoc object
3460 *
3461 * This function closes the legacy components and resets the
3462 * component's private objects.
3463 *
3464 * Return: None
3465 */
3466void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc);
3467
3468/**
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303469 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components
3470 *
3471 * Return: None
3472 */
3473void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc);
3474
3475/**
3476 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components
3477 *
3478 * Return: None
3479 */
3480void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc);
3481
Sandeep Puligillab7beb472018-08-13 22:54:20 -07003482/**
3483 * hdd_component_pdev_open() - Trigger pdev open for CLD Components
3484 *
3485 * Return: QDF_STATUS
3486 */
3487QDF_STATUS hdd_component_pdev_open(struct wlan_objmgr_pdev *pdev);
3488
3489/**
3490 * hdd_component_pdev_close() - Trigger pdev close for CLD Components
3491 *
3492 * Return: None
3493 */
3494void hdd_component_pdev_close(struct wlan_objmgr_pdev *pdev);
3495
Wen Gong3f003382018-05-14 14:26:37 +08003496#ifdef WLAN_FEATURE_MEMDUMP_ENABLE
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +05303497int hdd_driver_memdump_init(void);
3498void hdd_driver_memdump_deinit(void);
Ashish Kumar Dhanotiya64b3fa92019-07-23 15:50:10 +05303499
3500/**
3501 * hdd_driver_mem_cleanup() - Frees memory allocated for
3502 * driver dump
3503 *
3504 * This function frees driver dump memory.
3505 *
3506 * Return: None
3507 */
3508void hdd_driver_mem_cleanup(void);
3509
Wen Gong3f003382018-05-14 14:26:37 +08003510#else /* WLAN_FEATURE_MEMDUMP_ENABLE */
Wen Gongaa6d55d2018-04-26 16:33:21 +08003511static inline int hdd_driver_memdump_init(void)
3512{
3513 return 0;
3514}
3515static inline void hdd_driver_memdump_deinit(void)
3516{
3517}
Ashish Kumar Dhanotiya64b3fa92019-07-23 15:50:10 +05303518
3519static inline void hdd_driver_mem_cleanup(void)
3520{
3521}
Wen Gong3f003382018-05-14 14:26:37 +08003522#endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
Himanshu Agarwalb229a142017-12-21 10:16:45 +05303523/**
Alok Kumarb64650c2018-03-23 17:05:11 +05303524 * hdd_set_disconnect_status() - set adapter disconnection status
3525 * @hdd_adapter: Pointer to hdd adapter
3526 * @disconnecting: Disconnect status to set
3527 *
3528 * Return: None
3529 */
3530void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting);
3531
Nirav Shah73713f72018-05-17 14:50:41 +05303532#ifdef FEATURE_MONITOR_MODE_SUPPORT
Jeff Johnsond9952752018-04-18 12:15:35 -07003533/**
3534 * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface.
3535 * @adapter: Handle to adapter
3536 * @chan: Monitor mode channel
3537 * @bandwidth: Capture channel bandwidth
3538 *
3539 * Return: 0 on success else error code.
3540 */
3541int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3542 uint32_t bandwidth);
Nirav Shah73713f72018-05-17 14:50:41 +05303543#else
3544static inline
3545int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3546 uint32_t bandwidth)
3547{
3548 return 0;
3549}
3550#endif
Jeff Johnsond9952752018-04-18 12:15:35 -07003551
Ryan Hsuaadba072018-04-20 13:01:53 -07003552/**
3553 * hdd_wlan_get_version() - Get version information
3554 * @hdd_ctx: Global HDD context
3555 * @version_len: length of the version buffer size
3556 * @version: the buffer to the version string
3557 *
3558 * This function is used to get Wlan Driver, Firmware, Hardware Version
3559 * & the Board related information.
3560 *
3561 * Return: the length of the version string
3562 */
3563uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
3564 const size_t version_len, uint8_t *version);
Rachit Kankane0dc3e852018-05-07 17:33:42 +05303565/**
3566 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
3567 * @preamble: rate preamble
3568 * @nss: number of streams
3569 * @rate: rate index
3570 *
3571 * Rate code assembling is different for targets which are 11ax capable.
3572 * Check for the target support and assemble the rate code accordingly.
3573 *
3574 * Return: assembled rate code
3575 */
3576int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
3577
3578/**
3579 * hdd_set_11ax_rate() - set 11ax rate
3580 * @adapter: adapter being modified
3581 * @value: new 11ax rate code
3582 * @sap_config: pointer to SAP config to check HW mode
3583 * this will be NULL for call from STA persona
3584 *
3585 * Return: 0 on success, negative errno on failure
3586 */
3587int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
3588 struct sap_config *sap_config);
Ryan Hsuaadba072018-04-20 13:01:53 -07003589
3590/**
3591 * hdd_update_hw_sw_info() - API to update the HW/SW information
3592 * @hdd_ctx: Global HDD context
3593 *
3594 * API to update the HW and SW information in the driver
3595 *
3596 * Note:
3597 * All the version/revision information would only be retrieved after
3598 * firmware download
3599 *
3600 * Return: None
3601 */
3602void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx);
3603
Dundi Raviteja3bcf3a82018-05-22 13:24:18 +05303604/**
3605 * hdd_get_nud_stats_cb() - callback api to update the stats received from FW
3606 * @data: pointer to hdd context.
3607 * @rsp: pointer to data received from FW.
3608 * @context: callback context
3609 *
3610 * This is called when wlan driver received response event for
3611 * get arp stats to firmware.
3612 *
3613 * Return: None
3614 */
3615void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context);
3616
Jeff Johnsonb81b2e02018-06-11 19:13:11 -07003617/**
3618 * hdd_context_get_mac_handle() - get mac handle from hdd context
3619 * @hdd_ctx: Global HDD context pointer
3620 *
3621 * Retrieves the global MAC handle from the HDD context
3622 *
3623 * Return: The global MAC handle (which may be NULL)
3624 */
3625static inline
3626mac_handle_t hdd_context_get_mac_handle(struct hdd_context *hdd_ctx)
3627{
3628 return hdd_ctx ? hdd_ctx->mac_handle : NULL;
3629}
3630
3631/**
3632 * hdd_adapter_get_mac_handle() - get mac handle from hdd adapter
3633 * @adapter: HDD adapter pointer
3634 *
3635 * Retrieves the global MAC handle given an HDD adapter
3636 *
3637 * Return: The global MAC handle (which may be NULL)
3638 */
3639static inline
3640mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter)
3641{
3642 return adapter ?
3643 hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL;
3644}
3645
Jeff Johnsonea70b942018-07-02 09:42:31 -07003646/**
3647 * hdd_handle_to_context() - turn an HDD handle into an HDD context
3648 * @hdd_handle: HDD handle to be converted
3649 *
3650 * Return: HDD context referenced by @hdd_handle
3651 */
3652static inline
3653struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle)
3654{
3655 return (struct hdd_context *)hdd_handle;
3656}
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05303657
3658/**
3659 * wlan_hdd_free_cache_channels() - Free the cache channels list
3660 * @hdd_ctx: Pointer to HDD context
3661 *
3662 * Return: None
3663 */
3664void wlan_hdd_free_cache_channels(struct hdd_context *hdd_ctx);
3665
Ashish Kumar Dhanotiya6784b502018-10-17 12:51:10 +05303666/**
3667 * hdd_update_dynamic_mac() - Updates the dynamic MAC list
3668 * @hdd_ctx: Pointer to HDD context
3669 * @curr_mac_addr: Current interface mac address
3670 * @new_mac_addr: New mac address which needs to be updated
3671 *
3672 * This function updates newly configured MAC address to the
3673 * dynamic MAC address list corresponding to the current
3674 * adapter MAC address
3675 *
3676 * Return: None
3677 */
3678void hdd_update_dynamic_mac(struct hdd_context *hdd_ctx,
3679 struct qdf_mac_addr *curr_mac_addr,
3680 struct qdf_mac_addr *new_mac_addr);
3681
Tiger Yu8b119e92019-04-09 13:55:07 +08003682#ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH
Alok Kumar2fad6442018-11-08 19:19:28 +05303683/**
3684 * wlan_hdd_send_tcp_param_update_event() - Send vendor event to update
3685 * TCP parameter through Wi-Fi HAL
3686 * @hdd_ctx: Pointer to HDD context
3687 * @data: Parameters to update
3688 * @dir: Direction(tx/rx) to update
3689 *
3690 * Return: None
3691 */
3692void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx,
3693 void *data,
3694 uint8_t dir);
3695
3696/**
3697 * wlan_hdd_update_tcp_rx_param() - update TCP param in RX dir
3698 * @hdd_ctx: Pointer to HDD context
3699 * @data: Parameters to update
3700 *
3701 * Return: None
3702 */
3703void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data);
3704
3705/**
3706 * wlan_hdd_update_tcp_tx_param() - update TCP param in TX dir
3707 * @hdd_ctx: Pointer to HDD context
3708 * @data: Parameters to update
3709 *
3710 * Return: None
3711 */
3712void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data);
3713#else
3714static inline
3715void wlan_hdd_update_tcp_rx_param(struct hdd_context *hdd_ctx, void *data)
3716{
3717}
3718
3719static inline
3720void wlan_hdd_update_tcp_tx_param(struct hdd_context *hdd_ctx, void *data)
3721{
3722}
3723
3724static inline
3725void wlan_hdd_send_tcp_param_update_event(struct hdd_context *hdd_ctx,
3726 void *data,
3727 uint8_t dir)
3728{
3729}
Tiger Yu8b119e92019-04-09 13:55:07 +08003730#endif /*WLAN_FEATURE_DP_BUS_BANDWIDTH*/
Visweswara Tanuku633976b2019-01-07 16:13:12 +05303731
3732#ifdef WLAN_FEATURE_MOTION_DETECTION
3733/**
3734 * hdd_md_host_evt_cb - Callback for Motion Detection Event
3735 * @ctx: HDD context
3736 * @sir_md_evt: motion detect event
3737 *
3738 * Callback for Motion Detection Event. Re-enables Motion
3739 * Detection again upon event
3740 *
3741 * Return: QDF_STATUS QDF_STATUS_SUCCESS on Success and
3742 * QDF_STATUS_E_FAILURE on failure
3743 */
3744QDF_STATUS hdd_md_host_evt_cb(void *ctx, struct sir_md_evt *event);
3745#endif /* WLAN_FEATURE_MOTION_DETECTION */
3746
Abhinav Kumar338e57d2019-02-04 17:30:10 +05303747/**
3748 * hdd_hidden_ssid_enable_roaming() - enable roaming after hidden ssid rsp
3749 * @hdd_handle: Hdd handler
3750 * @vdev_id: Vdev Id
3751 *
3752 * This is a wrapper function to enable roaming after getting hidden
3753 * ssid rsp
3754 */
3755void hdd_hidden_ssid_enable_roaming(hdd_handle_t hdd_handle, uint8_t vdev_id);
3756
Min Liue34708a2019-02-01 15:00:34 +08003757/**
3758 * hdd_send_update_owe_info_event - Send update OWE info event
3759 * @adapter: Pointer to adapter
3760 * @sta_addr: MAC address of peer STA
3761 * @owe_ie: OWE IE
3762 * @owe_ie_len: Length of OWE IE
3763 *
3764 * Send update OWE info event to hostapd
3765 *
3766 * Return: none
3767 */
3768#ifdef CFG80211_EXTERNAL_DH_UPDATE_SUPPORT
3769void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
3770 uint8_t sta_addr[],
3771 uint8_t *owe_ie,
3772 uint32_t owe_ie_len);
3773#else
3774static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
3775 uint8_t sta_addr[],
3776 uint8_t *owe_ie,
3777 uint32_t owe_ie_len)
3778{
3779}
3780#endif
3781
Rajeev Kumar473f9af2019-04-05 14:25:56 -07003782/**
3783 * hdd_psoc_idle_shutdown - perform idle shutdown after interface inactivity
3784 * timeout
3785 * @device: pointer to struct device
3786 *
3787 * Return: 0 for success non-zero error code for failure
3788 */
3789int hdd_psoc_idle_shutdown(struct device *dev);
3790
3791/**
3792 * hdd_psoc_idle_restart - perform idle restart after idle shutdown
3793 * @device: pointer to struct device
3794 *
3795 * Return: 0 for success non-zero error code for failure
3796 */
3797int hdd_psoc_idle_restart(struct device *dev);
3798
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003799#endif /* end #if !defined(WLAN_HDD_MAIN_H) */