blob: c02df39ae32b84616af54f77a18fd721f4832953 [file] [log] [blame]
Jeff Johnson153f0262018-02-28 12:51:58 -08001/*
Dustin Browndb2a8be2017-12-20 11:49:56 -08002 * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#if !defined(WLAN_HDD_MAIN_H)
20#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080021/**
22 * DOC: wlan_hdd_main.h
23 *
24 * Linux HDD Adapter Type
25 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080026
Jeff Johnsonef926352017-01-12 10:41:02 -080027/*
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070028 * The following terms were in use in prior versions of the driver but
29 * have now been replaced with terms that are aligned with the Linux
30 * Coding style. Macros are defined to hopefully prevent new instances
31 * from being introduced, primarily by code propagation.
32 */
33#define pHddCtx
Jeff Johnson7b92c0f2017-10-02 13:31:35 -070034#define pAdapter
Jeff Johnson9c4f93d2017-10-04 08:56:22 -070035#define pHostapdAdapter
Jeff Johnson9bf24972017-10-04 09:26:58 -070036#define pHddApCtx
Jeff Johnsond377dce2017-10-04 10:32:42 -070037#define pHddStaCtx
Jeff Johnson5c19ade2017-10-04 09:52:12 -070038#define pHostapdState
Jeff Johnsonfd060852017-10-04 10:50:51 -070039#define pRoamInfo
Jeff Johnson5287de52017-10-28 12:23:06 -070040#define pScanInfo
Jeff Johnson04e00082017-10-04 12:15:58 -070041#define pBeaconIes
Jeff Johnsonf8d455c2017-09-28 08:59:06 -070042
43/*
Jeff Johnsonef926352017-01-12 10:41:02 -080044 * Include files
45 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046
47#include <linux/netdevice.h>
48#include <linux/skbuff.h>
49#include <net/cfg80211.h>
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +053050#include <linux/ieee80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053051#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053052#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080053#include "sir_mac_prot_def.h"
54#include "csr_api.h"
55#include <wlan_hdd_assoc.h>
56#include <wlan_hdd_wmm.h>
57#include <wlan_hdd_cfg.h>
58#include <linux/spinlock.h>
59#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
60#include <linux/wakelock.h>
61#endif
62#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070064#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065#include "wlan_hdd_cfg80211.h"
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +053066#include "wlan_hdd_debugfs.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053067#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080069#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080070#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070071#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070072#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080073#if defined(CONFIG_HL_SUPPORT)
74#include "wlan_tgt_def_config_hl.h"
75#else
Dustin Brown61269462016-09-19 13:25:45 -070076#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080077#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053078#include <wlan_objmgr_cmn.h>
79#include <wlan_objmgr_global_obj.h>
80#include <wlan_objmgr_psoc_obj.h>
81#include <wlan_objmgr_pdev_obj.h>
82#include <wlan_objmgr_vdev_obj.h>
83#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053084#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080085#ifdef WIFI_POS_CONVERGED
86#include "os_if_wifi_pos.h"
87#include "wifi_pos_api.h"
88#else
89#include "wlan_hdd_oemdata.h"
90#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080091#include "wlan_hdd_he.h"
92
Alok Kumarb64650c2018-03-23 17:05:11 +053093#include <net/neighbour.h>
94#include <net/netevent.h>
95#include "wlan_hdd_nud_tracking.h"
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -070096#include "wlan_hdd_twt.h"
Jeff Johnsonf9176382018-07-17 19:15:58 -070097#include "wma_sar_public_structs.h"
Alok Kumarb64650c2018-03-23 17:05:11 +053098
Jeff Johnsonef926352017-01-12 10:41:02 -080099/*
100 * Preprocessor definitions and constants
101 */
102
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +0530103#ifdef FEATURE_WLAN_APF
104/**
105 * struct hdd_apf_context - hdd Context for apf
106 * @magic: magic number
107 * @qdf_apf_event: Completion variable for APF get operations
108 * @capability_response: capabilities response received from fw
109 * @apf_enabled: True: APF Interpreter enabled, False: Disabled
110 * @cmd_in_progress: Flag that indicates an APF command is in progress
111 * @buf: Buffer to accumulate read memory chunks
112 * @buf_len: Length of the read memory requested
113 * @offset: APF work memory offset to fetch from
114 * @lock: APF Context lock
115 */
116struct hdd_apf_context {
117 unsigned int magic;
118 qdf_event_t qdf_apf_event;
119 bool apf_enabled;
120 bool cmd_in_progress;
121 uint8_t *buf;
122 uint32_t buf_len;
123 uint32_t offset;
124 qdf_spinlock_t lock;
125};
126#endif /* FEATURE_WLAN_APF */
127
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800128/** Number of Tx Queues */
Ajit Pal Singh5d269612018-04-19 16:29:12 +0530129#if defined(QCA_LL_TX_FLOW_CONTROL_V2) || defined(QCA_HL_NETDEV_FLOW_CONTROL)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130#define NUM_TX_QUEUES 5
131#else
132#define NUM_TX_QUEUES 4
133#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800134
Mahesh Kumar Kalikot Veetil885a77b2018-03-26 14:46:59 -0700135/*
136 * API in_compat_syscall() is introduced in 4.6 kernel to check whether we're
137 * in a compat syscall or not. It is a new way to query the syscall type, which
138 * works properly on all architectures.
139 *
140 */
141#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0))
142static inline bool in_compat_syscall(void) { return is_compat_task(); }
143#endif
144
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700145#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) || \
146 defined(CFG80211_REMOVE_IEEE80211_BACKPORT)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700147#define HDD_NL80211_BAND_2GHZ NL80211_BAND_2GHZ
148#define HDD_NL80211_BAND_5GHZ NL80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700149#define HDD_NUM_NL80211_BANDS NUM_NL80211_BANDS
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700150#else
151#define HDD_NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
152#define HDD_NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
Srinivas Girigowda5da651b2017-08-04 11:22:54 -0700153#define HDD_NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
Srinivas Girigowda38f1ded2017-06-12 23:00:38 -0700154#endif
155
Mohit Khannaee9e80f2015-11-10 11:32:49 -0800156/** Length of the TX queue for the netdev */
157#define HDD_NETDEV_TX_QUEUE_LEN (3000)
158
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800159/** Hdd Tx Time out value */
160#ifdef LIBRA_LINUX_PC
161#define HDD_TX_TIMEOUT (8000)
162#else
163#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
164#endif
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530165
166#define HDD_TX_STALL_THRESHOLD 4
167
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800168/** Hdd Default MTU */
169#define HDD_DEFAULT_MTU (1500)
170
171#ifdef QCA_CONFIG_SMP
172#define NUM_CPUS NR_CPUS
173#else
174#define NUM_CPUS 1
175#endif
176
Dustin Brown20f9fc42018-08-30 15:19:12 -0700177/**
178 * enum hdd_adapter_flags - event bitmap flags registered net device
179 * @NET_DEVICE_REGISTERED: Adapter is registered with the kernel
180 * @SME_SESSION_OPENED: Firmware vdev has been created
181 * @INIT_TX_RX_SUCCESS: Adapter datapath is initialized
182 * @WMM_INIT_DONE: Adapter is initialized
183 * @SOFTAP_BSS_STARTED: Software Access Point (SAP) is running
184 * @DEVICE_IFACE_OPENED: Adapter has been "opened" via the kernel
185 * @ACS_PENDING: Auto Channel Selection (ACS) is pending
186 * @SOFTAP_INIT_DONE: Software Access Point (SAP) is initialized
187 * @VENDOR_ACS_RESPONSE_PENDING: Waiting for event for vendor acs
188 */
189enum hdd_adapter_flags {
190 NET_DEVICE_REGISTERED,
191 SME_SESSION_OPENED,
192 INIT_TX_RX_SUCCESS,
193 WMM_INIT_DONE,
194 SOFTAP_BSS_STARTED,
195 DEVICE_IFACE_OPENED,
196 ACS_PENDING,
197 SOFTAP_INIT_DONE,
198 VENDOR_ACS_RESPONSE_PENDING,
199};
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800200
Dustin Brown20f9fc42018-08-30 15:19:12 -0700201/**
202 * enum hdd_driver_flags - HDD global event bitmap flags
203 * @ACS_IN_PROGRESS: Auto Channel Selection (ACS) in progress
204 */
205enum hdd_driver_flags {
206 ACS_IN_PROGRESS,
207};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208
209/** Maximum time(ms)to wait for disconnect to complete **/
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800210/* This value should be larger than the timeout used by WMA to wait for
211 * stop vdev response from FW
212 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213#ifdef QCA_WIFI_3_0_EMU
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800214#define WLAN_WAIT_TIME_DISCONNECT 7000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215#else
Jiachao Wu7bf72b42018-03-22 19:15:10 +0800216#define WLAN_WAIT_TIME_DISCONNECT 7000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800217#endif
Abhishek Singhe9706cc2017-10-12 17:25:06 +0530218#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
Abhishek Singh533c9da2017-05-04 10:23:34 +0530219#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800220#define WLAN_WAIT_TIME_STATS 800
221#define WLAN_WAIT_TIME_POWER 800
222#define WLAN_WAIT_TIME_COUNTRY 1000
223#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530224#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225/* Amount of time to wait for sme close session callback.
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700226 * This value should be larger than the timeout used by WDI to wait for
Jeff Johnsonef926352017-01-12 10:41:02 -0800227 * a response from WCNSS
228 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
230#define WLAN_WAIT_TIME_ABORTSCAN 2000
231
232/** Maximum time(ms) to wait for mc thread suspend **/
233#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
234
235/** Maximum time(ms) to wait for target to be ready for suspend **/
236#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
237
238/** Maximum time(ms) to wait for tdls add sta to complete **/
239#define WAIT_TIME_TDLS_ADD_STA 1500
240
241/** Maximum time(ms) to wait for tdls del sta to complete **/
242#define WAIT_TIME_TDLS_DEL_STA 1500
243
244/** Maximum time(ms) to wait for Link Establish Req to complete **/
245#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
246
247/** Maximum time(ms) to wait for tdls mgmt to complete **/
248#define WAIT_TIME_TDLS_MGMT 11000
249
250/* Scan Req Timeout */
251#define WLAN_WAIT_TIME_SCAN_REQ 100
252
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800253#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
254#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
255
Nachiket Kukadee547a482018-05-22 16:43:30 +0530256#define WLAN_WAIT_TIME_APF 1000
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530257
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +0530258#define WLAN_WAIT_TIME_FW_ROAM_STATS 1000
259
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530260/* Maximum time(ms) to wait for RSO CMD status event */
261#define WAIT_TIME_RSO_CMD_STATUS 2000
262
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +0530263/* rcpi request timeout in milli seconds */
264#define WLAN_WAIT_TIME_RCPI 500
265
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800266#define MAX_CFG_STRING_LEN 255
267
Kapil Gupta8878ad92017-02-13 11:56:04 +0530268/* Maximum time(ms) to wait for external acs response */
269#define WLAN_VENDOR_ACS_WAIT_TIME 1000
270
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800271#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
272/** Mac Address string **/
273#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
274#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700275/* Max and min IEs length in bytes */
276#define MAX_GENIE_LEN (512)
277#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800278
Jeff Johnsonfc8c3532018-04-18 14:12:23 -0700279/** Maximum Length of WPA/RSN IE */
280#define MAX_WPA_RSN_IE_LEN 255
281
282#define WPS_OUI_TYPE "\x00\x50\xf2\x04"
283#define WPS_OUI_TYPE_SIZE 4
284
285#define SS_OUI_TYPE "\x00\x16\x32"
286#define SS_OUI_TYPE_SIZE 3
287
288#define P2P_OUI_TYPE "\x50\x6f\x9a\x09"
289#define P2P_OUI_TYPE_SIZE 4
290
291#define HS20_OUI_TYPE "\x50\x6f\x9a\x10"
292#define HS20_OUI_TYPE_SIZE 4
293
294#define OSEN_OUI_TYPE "\x50\x6f\x9a\x12"
295#define OSEN_OUI_TYPE_SIZE 4
296
297#ifdef WLAN_FEATURE_WFD
298#define WFD_OUI_TYPE "\x50\x6f\x9a\x0a"
299#define WFD_OUI_TYPE_SIZE 4
300#endif
301
302#define MBO_OUI_TYPE "\x50\x6f\x9a\x16"
303#define MBO_OUI_TYPE_SIZE 4
304
305#define QCN_OUI_TYPE "\x8c\xfd\xf0\x01"
306#define QCN_OUI_TYPE_SIZE 4
307
308#define wlan_hdd_get_wps_ie_ptr(ie, ie_len) \
309 wlan_get_vendor_ie_ptr_from_oui(WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE, \
310 ie, ie_len)
311
312#define wlan_hdd_get_p2p_ie_ptr(ie, ie_len) \
313 wlan_get_vendor_ie_ptr_from_oui(P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE, \
314 ie, ie_len)
315
316#ifdef WLAN_FEATURE_WFD
317#define wlan_hdd_get_wfd_ie_ptr(ie, ie_len) \
318 wlan_get_vendor_ie_ptr_from_oui(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, \
319 ie, ie_len)
320#endif
321
322#define wlan_hdd_get_mbo_ie_ptr(ie, ie_len) \
323 wlan_get_vendor_ie_ptr_from_oui(MBO_OUI_TYPE, MBO_OUI_TYPE_SIZE, \
324 ie, ie_len)
325
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800326#define WLAN_CHIP_VERSION "WCNSS"
327
Dustin Brown632af712018-03-14 15:03:55 -0700328#define hdd_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_HDD, params)
329#define hdd_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_HDD, params)
330#define hdd_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_HDD, params)
331#define hdd_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_HDD, params)
332#define hdd_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_HDD, params)
333
Nirav Shah790d9432018-07-12 19:42:48 +0530334#define hdd_nofl_alert(params...) \
335 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_HDD, params)
336#define hdd_nofl_err(params...) \
337 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_HDD, params)
338#define hdd_nofl_warn(params...) \
339 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_HDD, params)
340#define hdd_nofl_info(params...) \
341 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_HDD, params)
342#define hdd_nofl_debug(params...) \
343 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_HDD, params)
344
Dustin Brown500ae3d2018-03-19 12:47:33 -0700345#define hdd_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HDD, params)
346#define hdd_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HDD, params)
347#define hdd_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HDD, params)
348#define hdd_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HDD, params)
349#define hdd_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HDD, params)
Rajeev Kumar5cb007f2017-07-27 16:19:31 -0700350
Nirav Shahd6fa0f82018-07-06 15:52:25 +0530351#define hdd_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter")
352#define hdd_enter_dev(dev) \
353 QDF_TRACE_ENTER(QDF_MODULE_ID_HDD, "enter(%s)", (dev)->name)
354#define hdd_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_HDD, "exit")
Dustin Brown32a61182018-03-14 12:14:00 -0700355
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700356#define WLAN_HDD_GET_PRIV_PTR(__dev__) \
357 (struct hdd_adapter *)(netdev_priv((__dev__)))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800358
359#define MAX_NO_OF_2_4_CHANNELS 14
360
361#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
362#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
363#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
364#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
365#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
366#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
367#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
368#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
369#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
370#define WLAN_HDD_WFA_OUI 0x506F9A
371#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
372#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
373#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
374#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
375
376#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700377 (((center_freq) == 2412) || ((center_freq) == 2437) || \
378 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800379
380#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
381 (((center_freq) == 5180) || ((center_freq) == 5200) \
382 || ((center_freq) == 5220) || ((center_freq) == 5240))
383
384#ifdef WLAN_FEATURE_11W
385#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
386#endif
387
388#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
389#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800390
391#define WLAN_HDD_QOS_ACTION_FRAME 1
392#define WLAN_HDD_QOS_MAP_CONFIGURE 4
Dustin Brownd0a76562017-10-13 14:48:37 -0700393#define HDD_SAP_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800394
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700395/* SAP client disconnect wake lock duration in milli seconds */
Dustin Brownd0a76562017-10-13 14:48:37 -0700396#define HDD_SAP_CLIENT_DISCONNECT_WAKE_LOCK_DURATION \
397 WAKELOCK_DURATION_RECOMMENDED
Rajeev Kumarf98a5cc2017-07-28 08:42:46 -0700398
Mukul Sharma974ca652016-09-03 16:24:48 +0530399#if defined(CONFIG_HL_SUPPORT)
400#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
401#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800402#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530403#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800404
Paul Zhang8bbbcdf2018-06-01 11:14:57 +0800405#define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3)
406#define HDD_CFG_REQUEST_FIRMWARE_DELAY (20)
407
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408#define MAX_USER_COMMAND_SIZE 4096
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530409#define DNS_DOMAIN_NAME_MAX_LEN 255
410#define ICMPv6_ADDR_LEN 16
411
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800412
413#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
414#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
415
Dundi Ravitejabb06d022018-05-31 15:54:15 +0530416#define HDD_ENABLE_SIFS_BURST_DEFAULT (1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800417/* If IPA UC data path is enabled, target should reserve extra tx descriptors
418 * for IPA data path.
419 * Then host data path should allow less TX packet pumping in case
420 * IPA data path enabled
421 */
422#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
423
Ryan Hsu07495ea2016-01-21 15:25:39 -0800424/*
425 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
426 * here if the Kernel version is less than 3.17 to avoid the interleave
427 * conditional compilation.
428 */
Jeff Johnson6dff3ee2017-10-06 14:58:57 -0700429#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) ||\
430 defined(WITH_BACKPORTS))
Ryan Hsu07495ea2016-01-21 15:25:39 -0800431#define NET_NAME_UNKNOWN 0
432#endif
433
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530434#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530435
436/* session ID invalid */
437#define HDD_SESSION_ID_INVALID 0xFF
438
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530439#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
Abhishek Singh00130682017-07-14 10:46:17 +0530440#define SCAN_REJECT_THRESHOLD 15
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530441
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530442/* Default Psoc id */
443#define DEFAULT_PSOC_ID 1
444
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530445/* wait time for nud stats in milliseconds */
446#define WLAN_WAIT_TIME_NUD_STATS 800
447/* nud stats skb max length */
448#define WLAN_NUD_STATS_LEN 800
449/* ARP packet type for NUD debug stats */
450#define WLAN_NUD_STATS_ARP_PKT_TYPE 1
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +0530451/* Assigned size of driver memory dump is 4096 bytes */
452#define DRIVER_MEM_DUMP_SIZE 4096
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530453
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800454/*
455 * Generic asynchronous request/response support
456 *
457 * Many of the APIs supported by HDD require a call to SME to
458 * perform an action or to retrieve some data. In most cases SME
459 * performs the operation asynchronously, and will execute a provided
460 * callback function when the request has completed. In order to
461 * synchronize this the HDD API allocates a context which is then
462 * passed to SME, and which is then, in turn, passed back to the
463 * callback function when the operation completes. The callback
464 * function then sets a completion variable inside the context which
465 * the HDD API is waiting on. In an ideal world the HDD API would
466 * wait forever (or at least for a long time) for the response to be
467 * received and for the completion variable to be set. However in
468 * most cases these HDD APIs are being invoked in the context of a
469 * user space thread which has invoked either a cfg80211 API or a
470 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
471 * Since this lock is used to synchronize many of the kernel tasks, we
472 * do not want to hold it for a long time. In addition we do not want
473 * to block user space threads (such as the wpa supplicant's main
474 * thread) for an extended time. Therefore we only block for a short
475 * time waiting for the response before we timeout. This means that
476 * it is possible for the HDD API to timeout, and for the callback to
477 * be invoked afterwards. In order for the callback function to
478 * determine if the HDD API is still waiting, a magic value is also
479 * stored in the shared context. Only if the context has a valid
480 * magic will the callback routine do any work. In order to further
481 * synchronize these activities a spinlock is used so that if any HDD
482 * API timeout coincides with its callback, the operations of the two
483 * threads will be serialized.
484 */
485
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800486extern spinlock_t hdd_context_lock;
Arunk Khandavalli16d84252017-06-21 15:26:29 +0530487extern struct mutex hdd_init_deinit_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800488
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800490 * Prevent from permanent stall, resume OS Q if timer expired
491 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800492#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
493#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
494#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
495
Nirav Shah997e0832018-06-06 17:49:12 +0530496#ifndef NUM_TX_RX_HISTOGRAM
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700497#define NUM_TX_RX_HISTOGRAM 128
Nirav Shah997e0832018-06-06 17:49:12 +0530498#endif
499
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800500#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
501
Mohit Khannae71e2262015-11-10 09:37:24 -0800502/**
Jeff Johnson37ecea42018-03-18 17:54:40 -0700503 * enum hdd_auth_key_mgmt - auth key mgmt protocols
504 * @HDD_AUTH_KEY_MGMT_802_1X: 802.1x
505 * @HDD_AUTH_KEY_MGMT_PSK: PSK
506 * @HDD_AUTH_KEY_MGMT_CCKM: CCKM
507 */
508enum hdd_auth_key_mgmt {
509 HDD_AUTH_KEY_MGMT_802_1X = BIT(0),
510 HDD_AUTH_KEY_MGMT_PSK = BIT(1),
511 HDD_AUTH_KEY_MGMT_CCKM = BIT(2)
512};
513
514/**
Mohit Khannae71e2262015-11-10 09:37:24 -0800515 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
516 * received over 100ms intervals
517 * @interval_rx: # of rx packets received in the last 100ms interval
518 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700519 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800520 * determined on the basis of total tx and rx packets
521 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700522 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800523 * determined on the basis of rx packets received in the
524 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700525 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800526 * determined on the basis of tx packets received in the
527 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800528 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800529 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800530 * The structure keeps track of throughput requirements of wlan driver.
531 * An entry is added if either of next_vote_level, next_rx_level or
532 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800533 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800534struct hdd_tx_rx_histogram {
535 uint64_t interval_rx;
536 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800537 uint32_t next_vote_level;
538 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800539 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800540 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800541};
542
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700543struct hdd_tx_rx_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800544 /* start_xmit stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700545 __u32 tx_called;
546 __u32 tx_dropped;
547 __u32 tx_orphaned;
548 __u32 tx_classified_ac[NUM_TX_QUEUES];
549 __u32 tx_dropped_ac[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800550
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551 /* rx stats */
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700552 __u32 rx_packets[NUM_CPUS];
553 __u32 rx_dropped[NUM_CPUS];
554 __u32 rx_delivered[NUM_CPUS];
555 __u32 rx_refused[NUM_CPUS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800556
557 /* txflow stats */
558 bool is_txflow_paused;
559 __u32 txflow_pause_cnt;
560 __u32 txflow_unpause_cnt;
561 __u32 txflow_timer_cnt;
Sravan Kumar Kairam3a698312017-10-16 14:16:16 +0530562
563 /*tx timeout stats*/
564 __u32 tx_timeout_cnt;
565 __u32 cont_txtimeout_cnt;
566 u64 jiffies_last_txtimeout;
Jeff Johnsonba1d0ca2017-09-30 16:24:31 -0700567};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800568
569#ifdef WLAN_FEATURE_11W
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700570/**
571 * struct hdd_pmf_stats - Protected Management Frame statistics
Jeff Johnsondc179f42017-10-21 11:27:26 -0700572 * @num_unprot_deauth_rx: Number of unprotected deauth frames received
573 * @num_unprot_disassoc_rx: Number of unprotected disassoc frames received
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700574 */
575struct hdd_pmf_stats {
Jeff Johnsondc179f42017-10-21 11:27:26 -0700576 uint8_t num_unprot_deauth_rx;
577 uint8_t num_unprot_disassoc_rx;
Jeff Johnsona49c0ac2017-08-15 13:52:08 -0700578};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800579#endif
580
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530581/**
582 * struct hdd_arp_stats_s - arp debug stats count
583 * @tx_arp_req_count: no. of arp req received from network stack
584 * @rx_arp_rsp_count: no. of arp res received from FW
585 * @tx_dropped: no. of arp req dropped at hdd layer
586 * @rx_dropped: no. of arp res dropped
587 * @rx_delivered: no. of arp res delivered to network stack
588 * @rx_refused: no of arp rsp refused (not delivered) to network stack
589 * @tx_host_fw_sent: no of arp req sent by FW OTA
590 * @rx_host_drop_reorder: no of arp res dropped by host
591 * @rx_fw_cnt: no of arp res received by FW
592 * @tx_ack_cnt: no of arp req acked by FW
593 */
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530594struct hdd_arp_stats_s {
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +0530595 uint16_t tx_arp_req_count;
596 uint16_t rx_arp_rsp_count;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530597 uint16_t tx_dropped;
598 uint16_t rx_dropped;
599 uint16_t rx_delivered;
600 uint16_t rx_refused;
601 uint16_t tx_host_fw_sent;
602 uint16_t rx_host_drop_reorder;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530603 uint16_t rx_fw_cnt;
604 uint16_t tx_ack_cnt;
605};
606
Jeff Johnson07f94742017-08-14 15:55:40 -0700607/**
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530608 * struct hdd_dns_stats_s - dns debug stats count
609 * @tx_dns_req_count: no. of dns query received from network stack
610 * @rx_dns_rsp_count: no. of dns res received from FW
611 * @tx_dropped: no. of dns query dropped at hdd layer
612 * @rx_delivered: no. of dns res delivered to network stack
613 * @rx_refused: no of dns res refused (not delivered) to network stack
614 * @tx_host_fw_sent: no of dns query sent by FW OTA
615 * @rx_host_drop: no of dns res dropped by host
616 * @tx_ack_cnt: no of dns req acked by FW
Jeff Johnson07f94742017-08-14 15:55:40 -0700617 */
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530618struct hdd_dns_stats_s {
619 uint16_t tx_dns_req_count;
620 uint16_t rx_dns_rsp_count;
621 uint16_t tx_dropped;
622 uint16_t rx_delivered;
623 uint16_t rx_refused;
624 uint16_t tx_host_fw_sent;
625 uint16_t rx_host_drop;
626 uint16_t tx_ack_cnt;
627};
628
629/**
630 * struct hdd_tcp_stats_s - tcp debug stats count
631 * @tx_tcp_syn_count: no. of tcp syn received from network stack
632 * @@tx_tcp_ack_count: no. of tcp ack received from network stack
633 * @rx_tcp_syn_ack_count: no. of tcp syn ack received from FW
634 * @tx_tcp_syn_dropped: no. of tcp syn dropped at hdd layer
635 * @tx_tcp_ack_dropped: no. of tcp ack dropped at hdd layer
636 * @rx_delivered: no. of tcp syn ack delivered to network stack
637 * @rx_refused: no of tcp syn ack refused (not delivered) to network stack
638 * @tx_tcp_syn_host_fw_sent: no of tcp syn sent by FW OTA
639 * @@tx_tcp_ack_host_fw_sent: no of tcp ack sent by FW OTA
640 * @rx_host_drop: no of tcp syn ack dropped by host
641 * @tx_tcp_syn_ack_cnt: no of tcp syn acked by FW
642 * @tx_tcp_syn_ack_cnt: no of tcp ack acked by FW
643 * @is_tcp_syn_ack_rcv: flag to check tcp syn ack received or not
644 * @is_tcp_ack_sent: flag to check tcp ack sent or not
645 */
646struct hdd_tcp_stats_s {
647 uint16_t tx_tcp_syn_count;
648 uint16_t tx_tcp_ack_count;
649 uint16_t rx_tcp_syn_ack_count;
650 uint16_t tx_tcp_syn_dropped;
651 uint16_t tx_tcp_ack_dropped;
652 uint16_t rx_delivered;
653 uint16_t rx_refused;
654 uint16_t tx_tcp_syn_host_fw_sent;
655 uint16_t tx_tcp_ack_host_fw_sent;
656 uint16_t rx_host_drop;
657 uint16_t rx_fw_cnt;
658 uint16_t tx_tcp_syn_ack_cnt;
659 uint16_t tx_tcp_ack_ack_cnt;
660 bool is_tcp_syn_ack_rcv;
661 bool is_tcp_ack_sent;
662
663};
664
665/**
666 * struct hdd_icmpv4_stats_s - icmpv4 debug stats count
667 * @tx_icmpv4_req_count: no. of icmpv4 req received from network stack
668 * @rx_icmpv4_rsp_count: no. of icmpv4 res received from FW
669 * @tx_dropped: no. of icmpv4 req dropped at hdd layer
670 * @rx_delivered: no. of icmpv4 res delivered to network stack
671 * @rx_refused: no of icmpv4 res refused (not delivered) to network stack
672 * @tx_host_fw_sent: no of icmpv4 req sent by FW OTA
673 * @rx_host_drop: no of icmpv4 res dropped by host
674 * @rx_fw_cnt: no of icmpv4 res received by FW
675 * @tx_ack_cnt: no of icmpv4 req acked by FW
676 */
677struct hdd_icmpv4_stats_s {
678 uint16_t tx_icmpv4_req_count;
679 uint16_t rx_icmpv4_rsp_count;
680 uint16_t tx_dropped;
681 uint16_t rx_delivered;
682 uint16_t rx_refused;
683 uint16_t tx_host_fw_sent;
684 uint16_t rx_host_drop;
685 uint16_t rx_fw_cnt;
686 uint16_t tx_ack_cnt;
687};
688
Jeff Johnson07f94742017-08-14 15:55:40 -0700689struct hdd_stats {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690 tCsrSummaryStatsInfo summary_stat;
Jeff Johnson861dd4f2017-10-24 10:10:40 -0700691 tCsrGlobalClassAStatsInfo class_a_stat;
Jeff Johnsonf8cadec2017-10-24 10:21:25 -0700692 tCsrGlobalClassDStatsInfo class_d_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530693 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Jeff Johnson6ced42c2017-10-20 12:48:11 -0700694 struct hdd_tx_rx_stats tx_rx_stats;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +0530695 struct hdd_arp_stats_s hdd_arp_stats;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +0530696 struct hdd_dns_stats_s hdd_dns_stats;
697 struct hdd_tcp_stats_s hdd_tcp_stats;
698 struct hdd_icmpv4_stats_s hdd_icmpv4_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699#ifdef WLAN_FEATURE_11W
Jeff Johnsondc179f42017-10-21 11:27:26 -0700700 struct hdd_pmf_stats hdd_pmf_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800701#endif
Jeff Johnson07f94742017-08-14 15:55:40 -0700702};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800703
Jeff Johnson41a64962017-08-14 15:29:42 -0700704/**
705 * struct hdd_roaming_info - HDD Internal Roaming Information
Jeff Johnson41a64962017-08-14 15:29:42 -0700706 * @bssid: BSSID to which we are connected
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700707 * @peer_mac: Peer MAC address for IBSS connection
708 * @roam_id: Unique identifier for a roaming instance
709 * @roam_status: Current roam command status
710 * @defer_key_complete: Should key complete be deferred?
Jeff Johnson41a64962017-08-14 15:29:42 -0700711 *
712 */
713struct hdd_roaming_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800714 tSirMacAddr bssid;
Jeff Johnsonaf2ae4b2017-11-01 11:38:50 -0700715 tSirMacAddr peer_mac;
716 uint32_t roam_id;
717 eRoamCmdStatus roam_status;
718 bool defer_key_complete;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800719
Jeff Johnson41a64962017-08-14 15:29:42 -0700720};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800721
722#ifdef FEATURE_WLAN_WAPI
723/* Define WAPI macros for Length, BKID count etc*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800724#define MAC_ADDR_LEN 6
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725#define MAX_NUM_AKM_SUITES 16
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800726
727/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700728enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800729 WAPI_AUTH_MODE_OPEN = 0,
730 WAPI_AUTH_MODE_PSK = 1,
731 WAPI_AUTH_MODE_CERT
732} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800733
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800734#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
735#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
736#define WLAN_EID_WAPI 68
737#define WAPI_PSK_AKM_SUITE 0x02721400
738#define WAPI_CERT_AKM_SUITE 0x01721400
739
Jeff Johnson89798aa2017-08-16 11:00:56 -0700740/**
741 * struct hdd_wapi_info - WAPI Information structure definition
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700742 * @wapi_mode: Is WAPI enabled on this adapter?
743 * @is_wapi_sta: Is the STA associated with WAPI?
744 * @wapi_auth_mode: WAPI authentication mode used by this adapter
Jeff Johnson89798aa2017-08-16 11:00:56 -0700745 */
746struct hdd_wapi_info {
Jeff Johnson7d2f4c62017-11-02 09:25:45 -0700747 bool wapi_mode;
748 bool is_wapi_sta;
749 enum wapi_auth_mode wapi_auth_mode;
Jeff Johnson89798aa2017-08-16 11:00:56 -0700750};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800751#endif /* FEATURE_WLAN_WAPI */
752
Jeff Johnson44e52172017-09-30 16:39:16 -0700753struct hdd_beacon_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800754 u8 *head;
755 u8 *tail;
756 u8 *proberesp_ies;
757 u8 *assocresp_ies;
758 int head_len;
759 int tail_len;
760 int proberesp_ies_len;
761 int assocresp_ies_len;
762 int dtim_period;
Jeff Johnson44e52172017-09-30 16:39:16 -0700763};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800764
Jeff Johnsonc945f562017-09-29 16:15:58 -0700765struct action_pkt_buffer {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800766 uint8_t *frame_ptr;
767 uint32_t frame_length;
768 uint16_t freq;
Jeff Johnsonc945f562017-09-29 16:15:58 -0700769};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800770
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800771/**
772 * struct hdd_scan_req - Scan Request entry
773 * @node : List entry element
774 * @adapter: Adapter address
775 * @scan_request: scan request holder
776 * @scan_id: scan identifier used across host layers which is generated at WMI
777 * @cookie: scan request identifier sent to userspace
778 * @source: scan request originator (NL/Vendor scan)
779 * @timestamp: scan request timestamp
780 *
781 * Scan request linked list element
782 */
783struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530784 qdf_list_node_t node;
Jeff Johnson9d295242017-08-29 14:39:48 -0700785 struct hdd_adapter *adapter;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800786 struct cfg80211_scan_request *scan_request;
787 uint32_t scan_id;
788 uint8_t source;
789 uint32_t timestamp;
Nachiket Kukadec34d4a32017-07-12 16:20:27 +0530790 qdf_timer_t hdd_scan_inactivity_timer;
791 uint32_t scan_req_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800792};
793
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700794/**
795 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
796 * @channel: Channel number.
797 * @cb_mode: Channel bonding
798 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
799 * @phy_mode: PHY mode
800 */
801struct hdd_mon_set_ch_info {
802 uint8_t channel;
803 uint8_t cb_mode;
804 uint32_t channel_width;
805 eCsrPhyMode phy_mode;
806};
807
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700808/**
809 * struct hdd_station_ctx -- STA-specific information
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700810 * @roam_profile: current roaming profile
811 * @security_ie: WPA or RSN IE used by the @roam_profile
812 * @assoc_additional_ie: association additional IE used by the @roam_profile
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700813 * @wpa_versions: bitmap of supported WPA versions
Jeff Johnson37ecea42018-03-18 17:54:40 -0700814 * @auth_key_mgmt: bitmap of supported auth key mgmt protocols
Jeff Johnson731bc322017-10-14 19:53:44 -0700815 * @requested_bssid: Specific BSSID to which to connect
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700816 * @conn_info: current connection information
817 * @roam_info: current roaming information
818 * @ft_carrier_on: is carrier on
819 * @ibss_sta_generation: current ibss generation. Incremented whenever
820 * ibss New peer joins and departs the network
821 * @ibss_enc_key_installed: is the ibss wep/wpa-none encryptions key
822 * installed?
823 * @ibss_enc_key: current ibss wep/wpa-none encryption key (if
824 * @ibss_enc_key_installed is %true)
825 * @ibss_peer_info: information about the ibss peer
Jeff Johnson690fe952017-10-25 11:48:39 -0700826 * @hdd_reassoc_scenario: is station in the middle of reassociation?
Jeff Johnson8380f232017-10-25 12:39:44 -0700827 * @sta_debug_state: STA context debug variable
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700828 * @broadcast_staid: STA ID assigned for broadcast frames
829 * @ch_info: monitor mode channel information
830 * @ndp_ctx: NAN data path context
831 * @ap_supports_immediate_power_save: Does the current AP allow our STA
832 * to immediately go into power save?
833 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800834struct hdd_station_ctx {
Jeff Johnsonfd9928a2018-03-19 15:17:29 -0700835 struct csr_roam_profile roam_profile;
836 uint8_t security_ie[MAX_WPA_RSN_IE_LEN];
837 tSirAddie assoc_additional_ie;
Jeff Johnsonce4a8342017-10-14 13:12:22 -0700838 enum nl80211_wpa_versions wpa_versions;
Jeff Johnson37ecea42018-03-18 17:54:40 -0700839 enum hdd_auth_key_mgmt auth_key_mgmt;
Jeff Johnson731bc322017-10-14 19:53:44 -0700840 struct qdf_mac_addr requested_bssid;
Jeff Johnsone4bad252017-08-14 14:09:28 -0700841 struct hdd_connection_info conn_info;
Ashish Kumar Dhanotiya36d19b02018-02-22 00:59:49 +0530842 struct hdd_connection_info cache_conn_info;
Jeff Johnson41a64962017-08-14 15:29:42 -0700843 struct hdd_roaming_info roam_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800844 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800845 int ibss_sta_generation;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800846 bool ibss_enc_key_installed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800847 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700848 tSirPeerInfoRspParams ibss_peer_info;
Jeff Johnson690fe952017-10-25 11:48:39 -0700849 bool hdd_reassoc_scenario;
Jeff Johnson8380f232017-10-25 12:39:44 -0700850 int sta_debug_state;
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700851 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700852 struct hdd_mon_set_ch_info ch_info;
Krunal Soni364e0872017-05-10 21:24:34 -0700853 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800854};
855
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700856/**
857 * enum bss_state - current state of the BSS
858 * @BSS_STOP: BSS is stopped
859 * @BSS_START: BSS is started
860 */
861enum bss_state {
862 BSS_STOP,
863 BSS_START,
864};
865
866/**
867 * struct hdd_hostapd_state - hostapd-related state information
868 * @bss_state: Current state of the BSS
869 * @qdf_event: Event to synchronize actions between hostapd thread and
870 * internal callback threads
871 * @qdf_stop_bss_event: Event to synchronize Stop BSS. When Stop BSS
872 * is issued userspace thread can wait on this event. The event will
873 * be set when the Stop BSS processing in UMAC has completed.
Jeff Johnsonb9424862017-10-30 08:49:35 -0700874 * @qdf_sta_disassoc_event: Event to synchronize STA Disassociation.
875 * When a STA is disassociated userspace thread can wait on this
876 * event. The event will be set when the STA Disassociation
877 * processing in UMAC has completed.
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700878 * @qdf_status: Used to communicate state from other threads to the
879 * userspace thread.
880 */
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700881struct hdd_hostapd_state {
Jeff Johnson0f9f87b2017-10-28 09:21:06 -0700882 enum bss_state bss_state;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530883 qdf_event_t qdf_event;
884 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800885 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530886 QDF_STATUS qdf_status;
Jeff Johnsonca2530c2017-09-30 18:25:40 -0700887};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800888
wadesong9b819072017-02-07 16:42:09 +0800889/**
890 * enum bss_stop_reason - reasons why a BSS is stopped.
891 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
892 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
893 * driver is trying to switch AP role to a different channel
894 * to maintain SCC mode with the STA role on the same card.
895 * this usually happens when STA is connected to an external
896 * AP that runs on a different channel
hqu73bccf22017-10-28 15:34:17 +0800897 * @BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN: BSS stopped due to
898 * vendor subcmd set sap config channel
wadesong9b819072017-02-07 16:42:09 +0800899 */
900enum bss_stop_reason {
901 BSS_STOP_REASON_INVALID = 0,
902 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
hqu73bccf22017-10-28 15:34:17 +0800903 BSS_STOP_DUE_TO_VENDOR_CONFIG_CHAN = 2,
wadesong9b819072017-02-07 16:42:09 +0800904};
905
Will Huang496b36c2017-07-11 16:38:50 +0800906/**
907 * struct hdd_rate_info - rate_info in HDD
908 * @rate: tx/rx rate (kbps)
909 * @mode: 0->11abg legacy, 1->HT, 2->VHT (refer to sir_sme_phy_mode)
910 * @nss: number of streams
911 * @mcs: mcs index for HT/VHT mode
912 * @rate_flags: rate flags for last tx/rx
913 *
914 * rate info in HDD
915 */
916struct hdd_rate_info {
917 uint32_t rate;
918 uint8_t mode;
919 uint8_t nss;
920 uint8_t mcs;
921 uint8_t rate_flags;
922};
923
924/**
925 * struct hdd_fw_txrx_stats - fw txrx status in HDD
926 * (refer to station_info struct in Kernel)
927 * @tx_packets: packets transmitted to this station
928 * @tx_bytes: bytes transmitted to this station
929 * @rx_packets: packets received from this station
930 * @rx_bytes: bytes received from this station
931 * @rx_retries: cumulative retry counts
932 * @tx_failed: number of failed transmissions
933 * @rssi: The signal strength (dbm)
934 * @tx_rate: last used tx rate info
935 * @rx_rate: last used rx rate info
936 *
937 * fw txrx status in HDD
938 */
939struct hdd_fw_txrx_stats {
940 uint32_t tx_packets;
941 uint64_t tx_bytes;
942 uint32_t rx_packets;
943 uint64_t rx_bytes;
944 uint32_t tx_retries;
945 uint32_t tx_failed;
946 int8_t rssi;
947 struct hdd_rate_info tx_rate;
948 struct hdd_rate_info rx_rate;
949};
950
951/**
Yun Parkc3e35562018-03-08 12:05:52 -0800952 * struct dhcp_phase - Per Peer DHCP Phases
953 * @DHCP_PHASE_ACK: upon receiving DHCP_ACK/NAK message in REQUEST phase or
954 * DHCP_DELINE message in OFFER phase
955 * @DHCP_PHASE_DISCOVER: upon receiving DHCP_DISCOVER message in ACK phase
956 * @DHCP_PHASE_OFFER: upon receiving DHCP_OFFER message in DISCOVER phase
957 * @DHCP_PHASE_REQUEST: upon receiving DHCP_REQUEST message in OFFER phase or
958 * ACK phase (Renewal process)
959 */
960enum dhcp_phase {
961 DHCP_PHASE_ACK,
962 DHCP_PHASE_DISCOVER,
963 DHCP_PHASE_OFFER,
964 DHCP_PHASE_REQUEST
965};
966
967/**
968 * struct dhcp_nego_status - Per Peer DHCP Negotiation Status
969 * @DHCP_NEGO_STOP: when the peer is in ACK phase or client disassociated
970 * @DHCP_NEGO_IN_PROGRESS: when the peer is in DISCOVER or REQUEST
971 * (Renewal process) phase
972 */
973enum dhcp_nego_status {
974 DHCP_NEGO_STOP,
975 DHCP_NEGO_IN_PROGRESS
976};
977
978/**
Jeff Johnson82155922017-09-30 16:54:14 -0700979 * struct hdd_station_info - Per station structure kept in HDD for
Will Huang496b36c2017-07-11 16:38:50 +0800980 * multiple station support for SoftAP
Jeff Johnsonb105d052017-10-21 12:07:29 -0700981 * @in_use: Is the station entry in use?
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -0700982 * @sta_id: Station ID reported back from HAL (through SAP).
Will Huang496b36c2017-07-11 16:38:50 +0800983 * Broadcast uses station ID zero by default.
Jeff Johnsone7cc44c2017-10-21 16:27:41 -0700984 * @sta_type: Type of station i.e. p2p client or infrastructure station
Jeff Johnsonf2356512017-10-21 16:04:12 -0700985 * @sta_mac: MAC address of the station
Jeff Johnson9a5863f2017-10-21 13:39:57 -0700986 * @peer_state: Current Station state so HDD knows how to deal with packet
Will Huang496b36c2017-07-11 16:38:50 +0800987 * queue. Most recent states used to change TLSHIM STA state.
Jeff Johnson65fda112017-10-21 13:46:10 -0700988 * @is_qos_enabled: Track QoS status of station
Jeff Johnsone4f5d932017-10-21 13:21:15 -0700989 * @is_deauth_in_progress: The station entry for which Deauth is in progress
Will Huang496b36c2017-07-11 16:38:50 +0800990 * @nss: Number of spatial streams supported
991 * @rate_flags: Rate Flags for this connection
992 * @ecsa_capable: Extended CSA capabilities
993 * @max_phy_rate: Calcuated maximum phy rate based on mode, nss, mcs etc.
994 * @tx_packets: Packets send to current station
995 * @tx_bytes: Bytes send to current station
996 * @rx_packets: Packets received from current station
997 * @rx_bytes: Bytes received from current station
998 * @last_tx_rx_ts: Last tx/rx timestamp with current station
999 * @assoc_ts: Current station association timestamp
1000 * @tx_rate: Tx rate with current station reported from F/W
1001 * @rx_rate: Rx rate with current station reported from F/W
1002 * @ampdu: Ampdu enable or not of the station
1003 * @sgi_enable: Short GI enable or not of the station
1004 * @tx_stbc: Tx Space-time block coding enable/disable
1005 * @rx_stbc: Rx Space-time block coding enable/disable
1006 * @ch_width: Channel Width of the connection
1007 * @mode: Mode of the connection
1008 * @max_supp_idx: Max supported rate index of the station
1009 * @max_ext_idx: Max extended supported rate index of the station
1010 * @max_mcs_idx: Max supported mcs index of the station
1011 * @rx_mcs_map: VHT Rx mcs map
1012 * @tx_mcs_map: VHT Tx mcs map
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +05301013 * @freq : Frequency of the current station
1014 * @dot11_mode: 802.11 Mode of the connection
1015 * @ht_present: HT caps present or not in the current station
1016 * @vht_present: VHT caps present or not in the current station
1017 * @ht_caps: HT capabilities of current station
1018 * @vht_caps: VHT capabilities of current station
1019 * @reason_code: Disconnection reason code for current station
1020 * @rssi: RSSI of the current station reported from F/W
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001021 */
Jeff Johnson82155922017-09-30 16:54:14 -07001022struct hdd_station_info {
Jeff Johnsonb105d052017-10-21 12:07:29 -07001023 bool in_use;
Jeff Johnson4c0ab7b2017-10-21 16:13:09 -07001024 uint8_t sta_id;
Jeff Johnsone7cc44c2017-10-21 16:27:41 -07001025 eStationType sta_type;
Jeff Johnsonf2356512017-10-21 16:04:12 -07001026 struct qdf_mac_addr sta_mac;
Jeff Johnson9a5863f2017-10-21 13:39:57 -07001027 enum ol_txrx_peer_state peer_state;
Jeff Johnson65fda112017-10-21 13:46:10 -07001028 bool is_qos_enabled;
Jeff Johnsone4f5d932017-10-21 13:21:15 -07001029 bool is_deauth_in_progress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +05301030 uint8_t nss;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +05301031 uint32_t rate_flags;
gaolez7bb1e742017-03-21 16:37:38 +08001032 uint8_t ecsa_capable;
Will Huang496b36c2017-07-11 16:38:50 +08001033 uint32_t max_phy_rate;
1034 uint32_t tx_packets;
1035 uint64_t tx_bytes;
1036 uint32_t rx_packets;
1037 uint64_t rx_bytes;
1038 qdf_time_t last_tx_rx_ts;
1039 qdf_time_t assoc_ts;
1040 uint32_t tx_rate;
1041 uint32_t rx_rate;
1042 bool ampdu;
1043 bool sgi_enable;
1044 bool tx_stbc;
1045 bool rx_stbc;
Hanumanth Reddy Pothulaf79fbdf2017-10-23 20:10:46 +05301046 tSirMacHTChannelWidth ch_width;
Will Huang496b36c2017-07-11 16:38:50 +08001047 uint8_t mode;
1048 uint8_t max_supp_idx;
1049 uint8_t max_ext_idx;
1050 uint8_t max_mcs_idx;
1051 uint8_t rx_mcs_map;
1052 uint8_t tx_mcs_map;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301053 uint32_t freq;
Ashish Kumar Dhanotiyad523f0d2017-10-26 14:15:48 +05301054 uint8_t dot11_mode;
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301055 bool ht_present;
1056 bool vht_present;
1057 struct ieee80211_ht_cap ht_caps;
1058 struct ieee80211_vht_cap vht_caps;
1059 uint32_t reason_code;
1060 int8_t rssi;
Yun Parkc3e35562018-03-08 12:05:52 -08001061 enum dhcp_phase dhcp_phase;
1062 enum dhcp_nego_status dhcp_nego_status;
Jeff Johnson82155922017-09-30 16:54:14 -07001063};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001064
Jeff Johnsonf283c972017-10-26 12:30:49 -07001065/**
1066 * struct hdd_ap_ctx - SAP/P2PGO specific information
1067 * @hostapd_state: state control information
Jeff Johnson01206862017-10-27 20:55:59 -07001068 * @dfs_cac_block_tx: Is data tramsmission blocked due to DFS CAC?
Jeff Johnson136c51b2017-10-27 20:02:41 -07001069 * @ap_active: Are any stations active?
Jeff Johnson82ceb082017-10-27 14:52:42 -07001070 * @disable_intrabss_fwd: Prevent forwarding between stations
Jeff Johnson42518cf2017-10-26 13:33:29 -07001071 * @broadcast_sta_id: Station ID assigned after BSS starts
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001072 * @privacy: The privacy bits of configuration
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001073 * @encryption_type: The encryption being used
Jeff Johnson413c15f2017-10-27 18:56:35 -07001074 * @group_key: Group Encryption Key
Jeff Johnson3d731362017-10-27 19:06:41 -07001075 * @wep_key: WEP key array
1076 * @wep_def_key_idx: WEP default key index
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001077 * @sap_context: Pointer to context maintained by SAP (opaque to HDD)
Jeff Johnson91df29d2017-10-27 19:29:50 -07001078 * @sap_config: SAP configuration
Jeff Johnson01206862017-10-27 20:55:59 -07001079 * @operating_channel: channel upon which the SAP is operating
1080 * @beacon: Beacon information
1081 * @vendor_acs_timer: Timer for ACS
1082 * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
1083 * @bss_stop_reason: Reason why the BSS was stopped
1084 * @txrx_stats: TX RX statistics from firmware
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301085 * @acs_in_progress: In progress acs flag for an adapter
Jeff Johnsonf283c972017-10-26 12:30:49 -07001086 */
Jeff Johnsone962b192017-08-11 15:37:08 -07001087struct hdd_ap_ctx {
Jeff Johnsonf283c972017-10-26 12:30:49 -07001088 struct hdd_hostapd_state hostapd_state;
Jeff Johnson01206862017-10-27 20:55:59 -07001089 bool dfs_cac_block_tx;
Jeff Johnson136c51b2017-10-27 20:02:41 -07001090 bool ap_active;
Jeff Johnson82ceb082017-10-27 14:52:42 -07001091 bool disable_intrabss_fwd;
Jeff Johnson42518cf2017-10-26 13:33:29 -07001092 uint8_t broadcast_sta_id;
Jeff Johnsonc8d94a12017-10-27 14:02:53 -07001093 uint8_t privacy;
Jeff Johnsona8e686b2017-10-27 15:05:18 -07001094 eCsrEncryptionType encryption_type;
Jeff Johnson413c15f2017-10-27 18:56:35 -07001095 tCsrRoamSetKey group_key;
Jeff Johnson3d731362017-10-27 19:06:41 -07001096 tCsrRoamSetKey wep_key[CSR_MAX_NUM_KEY];
1097 uint8_t wep_def_key_idx;
Jeff Johnson0bbe66f2017-10-27 19:23:49 -07001098 struct sap_context *sap_context;
Jeff Johnsone4c11db2018-05-05 23:22:32 -07001099 tsap_config_t sap_config;
Jeff Johnson01206862017-10-27 20:55:59 -07001100 uint8_t operating_channel;
1101 struct hdd_beacon_data *beacon;
1102 qdf_mc_timer_t vendor_acs_timer;
1103 bool vendor_acs_timer_initialized;
1104 enum bss_stop_reason bss_stop_reason;
1105 struct hdd_fw_txrx_stats txrx_stats;
Abhinav Kumarb638b5d2018-03-26 12:25:41 +05301106 qdf_atomic_t acs_in_progress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001107};
1108
Jeff Johnson37588942017-08-15 16:11:41 -07001109/**
1110 * struct hdd_scan_info - Per-adapter scan information
Jeff Johnson37fa0402017-10-28 12:42:29 -07001111 * @scan_add_ie: Additional IE for scan
Jeff Johnson37588942017-08-15 16:11:41 -07001112 * @default_scan_ies: Default scan IEs
1113 * @default_scan_ies_len: Length of @default_scan_ies
1114 * @scan_mode: Scan mode
Jeff Johnson37588942017-08-15 16:11:41 -07001115 */
1116struct hdd_scan_info {
Jeff Johnson37fa0402017-10-28 12:42:29 -07001117 tSirAddie scan_add_ie;
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +05301118 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +05301119 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001120 tSirScanType scan_mode;
Jeff Johnson37588942017-08-15 16:11:41 -07001121};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001122
Dustin Brown61269462016-09-19 13:25:45 -07001123#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001124
1125#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001126struct hdd_multicast_addr_list {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001127 uint8_t mc_cnt;
1128 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001129};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001130#endif
1131
1132#define WLAN_HDD_MAX_HISTORY_ENTRY 10
1133
1134/**
1135 * struct hdd_netif_queue_stats - netif queue operation statistics
1136 * @pause_count - pause counter
1137 * @unpause_count - unpause counter
1138 */
1139struct hdd_netif_queue_stats {
Mohit Khannaca4173b2017-09-12 21:52:19 -07001140 u32 pause_count;
1141 u32 unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +05301142 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001143};
1144
1145/**
1146 * struct hdd_netif_queue_history - netif queue operation history
1147 * @time: timestamp
1148 * @netif_action: action type
1149 * @netif_reason: reason type
1150 * @pause_map: pause map
1151 */
1152struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +05301153 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001154 uint16_t netif_action;
1155 uint16_t netif_reason;
1156 uint32_t pause_map;
1157};
1158
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301159/**
1160 * struct hdd_chan_change_params - channel related information
1161 * @chan: operating channel
1162 * @chan_params: channel parameters
1163 */
1164struct hdd_chan_change_params {
1165 uint8_t chan;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001166 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301167};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001168
Komal Seelama89be8d2016-09-29 11:09:26 +05301169/**
Komal Seelam8634b772016-09-29 12:12:24 +05301170 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
Jeff Johnsonb9424862017-10-30 08:49:35 -07001171 * @dfs: dfs context to prevent/allow runtime pm
Jingxiang Geb49aa302018-01-17 20:54:15 +08001172 * @connect: connect context to prevent/allow runtime pm
Komal Seelam8634b772016-09-29 12:12:24 +05301173 *
Jeff Johnsonb9424862017-10-30 08:49:35 -07001174 * Runtime PM control for underlying activities
Komal Seelam8634b772016-09-29 12:12:24 +05301175 */
1176struct hdd_runtime_pm_context {
Komal Seelam81cb1662016-09-29 12:39:08 +05301177 qdf_runtime_lock_t dfs;
Jingxiang Geb49aa302018-01-17 20:54:15 +08001178 qdf_runtime_lock_t connect;
Komal Seelam8634b772016-09-29 12:12:24 +05301179};
1180
1181/**
Komal Seelama89be8d2016-09-29 11:09:26 +05301182 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
1183 * @connect: Runtime Connect Context
1184 *
1185 * Structure to hold runtime pm connect context for each adapter.
1186 */
1187struct hdd_connect_pm_context {
1188 qdf_runtime_lock_t connect;
1189};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001190
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301191/*
1192 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
1193 * belonging to this driver from net devices belonging to other devices.
1194 * Therefore, the magic number must be unique relative to the numbers for
1195 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
1196 * (e.g. by compiler argument), then use that. If it's not already defined,
1197 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
1198 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
1199 */
1200#ifndef WLAN_HDD_ADAPTER_MAGIC
1201#ifdef MULTI_IF_NAME
1202#define WLAN_HDD_ADAPTER_MAGIC \
1203 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
1204 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
1205 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
1206 (MULTI_IF_NAME[1] << 16) : \
1207 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
1208 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
1209#else
Komal Seelama89be8d2016-09-29 11:09:26 +05301210#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +05301211#endif
1212#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001213
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301214/**
1215 * struct rcpi_info - rcpi info
1216 * @rcpi: computed value in dB
1217 * @mac_addr: peer mac addr for which rcpi is computed
1218 */
1219struct rcpi_info {
1220 int32_t rcpi;
1221 struct qdf_mac_addr mac_addr;
1222};
1223
Jeff Johnsondba0db62017-08-30 11:12:39 -07001224struct hdd_context;
1225
Dustin Brown20f9fc42018-08-30 15:19:12 -07001226/**
1227 * struct hdd_adapter - hdd vdev/net_device context
1228 * @event_flags: a bitmap of hdd_adapter_flags
1229 */
Jeff Johnson85b5c112017-08-11 15:15:23 -07001230struct hdd_adapter {
Jeff Johnsond399e902015-12-17 15:17:02 -08001231 /* Magic cookie for adapter sanity verification. Note that this
1232 * needs to be at the beginning of the private data structure so
Jeff Johnsonb9424862017-10-30 08:49:35 -07001233 * that it will exist at the beginning of dev->priv and hence
Jeff Johnsond399e902015-12-17 15:17:02 -08001234 * will always be in mapped memory
1235 */
1236 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001237
Dustin Brown920397d2017-12-13 16:27:50 -08001238 /* list node for membership in the adapter list */
1239 qdf_list_node_t node;
1240
Jeff Johnsondba0db62017-08-30 11:12:39 -07001241 struct hdd_context *hdd_ctx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301242 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001243
Leo Changfdb45c32016-10-28 11:09:23 -07001244 void *txrx_vdev;
1245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001246 /** Handle to the network device */
1247 struct net_device *dev;
1248
Jeff Johnsonc1e62782017-11-09 09:50:17 -08001249 enum QDF_OPMODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -08001250
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001251 /** IPv4 notifier callback for handling ARP offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001252 struct work_struct ipv4_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001253#ifdef WLAN_NS_OFFLOAD
1254 /** IPv6 notifier callback for handling NS offload on change in IP */
Jeff Johnsonb527ebe2017-10-28 13:14:03 -07001255 struct work_struct ipv6_notifier_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001256#endif
1257
1258 /* TODO Move this to sta Ctx */
1259 struct wireless_dev wdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001260
1261 /** ops checks if Opportunistic Power Save is Enable or Not
1262 * ctw stores ctWindow value once we receive Opps command from
1263 * wpa_supplicant then using ctWindow value we need to Enable
1264 * Opportunistic Power Save
1265 */
1266 uint8_t ops;
1267 uint32_t ctw;
1268
1269 /** Current MAC Address for the adapter */
Jeff Johnson1e851a12017-10-28 14:36:12 -07001270 struct qdf_mac_addr mac_addr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001271
Alok Kumarb64650c2018-03-23 17:05:11 +05301272#ifdef WLAN_NUD_TRACKING
1273 struct hdd_nud_tracking_info nud_tracking;
1274#endif
1275 bool disconnection_in_progress;
1276 qdf_mutex_t disconnection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001277 unsigned long event_flags;
1278
1279 /**Device TX/RX statistics*/
1280 struct net_device_stats stats;
1281 /** HDD statistics*/
Jeff Johnson07f94742017-08-14 15:55:40 -07001282 struct hdd_stats hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -08001283
1284 /* estimated link speed */
1285 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001286
Jeff Johnson1b780e42017-10-31 14:11:45 -07001287 uint8_t session_id;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001288
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301289 /* QDF event for session close */
1290 qdf_event_t qdf_session_close_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001291
Nachiket Kukade08b9f292017-11-17 18:27:37 +05301292 /* QDF event for session open */
1293 qdf_event_t qdf_session_open_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001294
1295 /* TODO: move these to sta ctx. These may not be used in AP */
1296 /** completion variable for disconnect callback */
1297 struct completion disconnect_comp_var;
1298
Abhishek Singh533c9da2017-05-04 10:23:34 +05301299 struct completion roaming_comp_var;
1300
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001301 /* completion variable for Linkup Event */
1302 struct completion linkup_event_var;
1303
1304 /* completion variable for cancel remain on channel Event */
1305 struct completion cancel_rem_on_chan_var;
1306
1307 /* completion variable for off channel remain on channel Event */
1308 struct completion offchannel_tx_event;
1309 /* Completion variable for action frame */
1310 struct completion tx_action_cnf_event;
1311 /* Completion variable for remain on channel ready */
1312 struct completion rem_on_chan_ready_event;
1313
1314 struct completion sta_authorized_event;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001315
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001316 struct completion ibss_peer_info_comp;
1317
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001318 /* Track whether the linkup handling is needed */
Jeff Johnsonc72c5732017-10-28 12:49:37 -07001319 bool is_link_up_service_needed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001320
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001321 /* WMM Status */
Jeff Johnson02d14ce2017-10-31 09:08:30 -07001322 struct hdd_wmm_status hdd_wmm_status;
Jeff Johnson18e86622017-10-28 12:55:36 -07001323
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001324 /** Multiple station supports */
1325 /** Per-station structure */
Jeff Johnsonbb8b56a2017-10-23 07:02:36 -07001326 spinlock_t sta_info_lock; /* To protect access to station Info */
1327 struct hdd_station_info sta_info[WLAN_MAX_STA_COUNT];
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05301328 struct hdd_station_info cache_sta_info[WLAN_MAX_STA_COUNT];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001329
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330
1331#ifdef FEATURE_WLAN_WAPI
Jeff Johnson89798aa2017-08-16 11:00:56 -07001332 struct hdd_wapi_info wapi_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001333#endif
1334
1335 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301336 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001337#ifdef WLAN_FEATURE_LPSS
1338 bool rssi_send;
1339#endif
1340
1341 uint8_t snr;
1342
Krunal Soni22208392017-09-29 18:10:34 -07001343 struct work_struct sap_stop_bss_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001344
1345 union {
Jeff Johnson40dae4e2017-08-29 14:00:25 -07001346 struct hdd_station_ctx station;
Jeff Johnson87251032017-08-29 13:31:11 -07001347 struct hdd_ap_ctx ap;
Jeff Johnsonb9424862017-10-30 08:49:35 -07001348 } session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001349
Min Liu2fef5792018-01-19 17:59:42 +08001350 qdf_atomic_t dfs_radar_found;
1351
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001352#ifdef WLAN_FEATURE_TSF
1353 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001354 uint64_t cur_target_time;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001355 uint64_t tsf_sync_soc_timer;
Yu Wang000dc2f2017-05-26 17:38:48 +08001356#ifdef WLAN_FEATURE_TSF_PLUS
1357 /* spin lock for read/write timestamps */
1358 qdf_spinlock_t host_target_sync_lock;
1359 qdf_mc_timer_t host_target_sync_timer;
1360 uint64_t cur_host_time;
1361 uint64_t last_host_time;
1362 uint64_t last_target_time;
1363 /* to store the count of continuous invalid tstamp-pair */
1364 int continuous_error_count;
1365 /* to indicate whether tsf_sync has been initialized */
1366 qdf_atomic_t tsf_sync_ready_flag;
1367#endif /* WLAN_FEATURE_TSF_PLUS */
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001368#endif
1369
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370#ifdef WLAN_FEATURE_PACKET_FILTERING
Jeff Johnson673fd5b2017-09-30 16:44:56 -07001371 struct hdd_multicast_addr_list mc_addr_list;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001372#endif
1373 uint8_t addr_filter_pattern;
1374
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001375 bool survey_idx;
1376
Jeff Johnson37588942017-08-15 16:11:41 -07001377 struct hdd_scan_info scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001378
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001379 /* Flag to ensure PSB is configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001380 uint8_t psb_changed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001381 /* UAPSD psb value configured through framework */
Jeff Johnson137c8ee2017-10-28 13:06:48 -07001382 uint8_t configured_psb;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001383#ifdef IPA_OFFLOAD
1384 void *ipa_context;
1385#endif
1386 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1387 * since CSR (PMAC Struct) Config is same for both AP
1388 */
1389 struct delayed_work acs_pending_work;
1390
1391 struct work_struct scan_block_work;
Min Liu9be5d4a2018-05-17 11:51:53 +08001392 qdf_list_t blocked_scan_request_q;
1393 qdf_mutex_t blocked_scan_request_q_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001394#ifdef MSM_PLATFORM
1395 unsigned long prev_rx_packets;
1396 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301397 uint64_t prev_fwd_tx_packets;
1398 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001399 int connection;
1400#endif
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301401#if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || \
1402 defined(QCA_HL_NETDEV_FLOW_CONTROL)
Anurag Chouhan210db072016-02-22 18:42:15 +05301403 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001404 bool tx_flow_timer_initialized;
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301405#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL || QCA_HL_NETDEV_FLOW_CONTROL */
1406#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001407 unsigned int tx_flow_low_watermark;
1408 unsigned int tx_flow_high_watermark_offset;
1409#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
Ajit Pal Singh106c1412018-04-18 18:08:49 +05301410
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001411 bool offloads_configured;
1412
1413 /* DSCP to UP QoS Mapping */
Jeff Johnson6b51b6a2017-11-02 20:31:25 -07001414 enum sme_qos_wmmuptype dscp_to_up_map[WLAN_HDD_MAX_DSCP + 1];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001415
1416#ifdef WLAN_FEATURE_LINK_LAYER_STATS
Jeff Johnsond30ee4b2017-10-28 15:38:32 -07001417 bool is_link_layer_stats_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001418#endif
Jeff Johnsonbd4c4f02017-10-30 20:33:01 -07001419 uint8_t link_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001420
1421 /* variable for temperature in Celsius */
1422 int temperature;
1423
Agrawal Ashishb141b092016-09-02 19:59:26 +05301424#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001425 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301426 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001427 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301428#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001429
1430 /* BITMAP indicating pause reason */
1431 uint32_t pause_map;
1432 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301433 qdf_time_t start_time;
1434 qdf_time_t last_time;
1435 qdf_time_t total_pause_time;
1436 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001437 uint8_t history_index;
1438 struct hdd_netif_queue_history
1439 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1440 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001441 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001442 /* debugfs entry */
1443 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301444 /*
1445 * The pre cac channel is saved here and will be used when the SAP's
1446 * channel needs to be moved from the existing 2.4GHz channel.
1447 */
1448 uint8_t pre_cac_chan;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001449
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001450 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301451 * Indicate if HO fails during disconnect so that
1452 * disconnect is not initiated by HDD as its already
1453 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001454 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301455 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301456 struct lfr_firmware_status lfr_fw_status;
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301457 bool con_status;
1458 bool dad;
Ganesh Kondabattini1a2aed82017-09-28 12:21:58 +05301459 uint8_t active_ac;
Poddar, Siddarth31797fa2018-01-22 17:24:15 +05301460 uint32_t pkt_type_bitmap;
1461 uint32_t track_arp_ip;
1462 uint8_t dns_payload[256];
1463 uint32_t track_dns_domain_len;
1464 uint32_t track_src_port;
1465 uint32_t track_dest_port;
1466 uint32_t track_dest_ipv4;
Arunk Khandavalli062fb032017-10-04 12:18:15 +05301467 uint32_t mon_chan;
1468 uint32_t mon_bandwidth;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301469
1470 /* rcpi information */
1471 struct rcpi_info rcpi;
Yeshwanth Sriram Guntuka4fe30bd2018-06-13 11:41:42 +05301472 bool send_mode_change;
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301473#ifdef FEATURE_WLAN_APF
1474 struct hdd_apf_context apf_context;
1475#endif /* FEATURE_WLAN_APF */
Rajeev Kumar Sirasanagandla197d4172018-02-15 19:03:29 +05301476
1477#ifdef WLAN_DEBUGFS
1478 struct hdd_debugfs_file_info csr_file[HDD_DEBUGFS_FILE_ID_MAX];
1479#endif /* WLAN_DEBUGFS */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001480};
1481
Jeff Johnsonb9424862017-10-30 08:49:35 -07001482#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
1483#define WLAN_HDD_GET_AP_CTX_PTR(adapter) (&(adapter)->session.ap)
Jeff Johnsondba0db62017-08-30 11:12:39 -07001484#define WLAN_HDD_GET_CTX(adapter) ((adapter)->hdd_ctx)
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07001485#define WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter) \
Jeff Johnsonb9424862017-10-30 08:49:35 -07001486 (&(adapter)->session.ap.hostapd_state)
1487#define WLAN_HDD_GET_SAP_CTX_PTR(adapter) ((adapter)->session.ap.sap_context)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001488
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001489#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001490#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001491#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001492/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1493 * intentionally so that all references to these must be within NDP code.
1494 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1495 * invoke NDP code to do all work.
1496 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001497#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001498#endif
1499
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001500/* Set mac address locally administered bit */
1501#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1502
1503#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1504#define HDD_RESET_MCC_P2P_QUOTA 50
1505
Jeff Johnson353cd292017-08-17 06:47:26 -07001506/*
1507 * struct hdd_priv_data - driver ioctl private data payload
1508 * @buf: pointer to command buffer (may be in userspace)
1509 * @used_len: length of the command/data currently in @buf
1510 * @total_len: total length of the @buf memory allocation
1511 */
1512struct hdd_priv_data {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001513 uint8_t *buf;
1514 int used_len;
1515 int total_len;
Jeff Johnson353cd292017-08-17 06:47:26 -07001516};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001517
1518#define MAX_MOD_LOGLEVEL 10
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001519struct fw_log_info {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001520 uint8_t enable;
1521 uint8_t dl_type;
1522 uint8_t dl_report;
1523 uint8_t dl_loglevel;
1524 uint8_t index;
1525 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1526
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001527};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001528
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001529/**
1530 * enum antenna_mode - number of TX/RX chains
1531 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1532 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1533 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1534 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1535 */
1536enum antenna_mode {
1537 HDD_ANTENNA_MODE_INVALID,
1538 HDD_ANTENNA_MODE_1X1,
1539 HDD_ANTENNA_MODE_2X2,
1540 HDD_ANTENNA_MODE_MAX
1541};
1542
1543/**
1544 * enum smps_mode - SM power save mode
1545 * @HDD_SMPS_MODE_STATIC: Static power save
1546 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1547 * @HDD_SMPS_MODE_RESERVED: Reserved
1548 * @HDD_SMPS_MODE_DISABLED: Disable power save
1549 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1550 */
1551enum smps_mode {
1552 HDD_SMPS_MODE_STATIC,
1553 HDD_SMPS_MODE_DYNAMIC,
1554 HDD_SMPS_MODE_RESERVED,
1555 HDD_SMPS_MODE_DISABLED,
1556 HDD_SMPS_MODE_MAX
1557};
1558
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001559#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1560/**
1561 * struct hdd_offloaded_packets - request id to pattern id mapping
1562 * @request_id: request id
1563 * @pattern_id: pattern id
1564 *
1565 */
1566struct hdd_offloaded_packets {
1567 uint32_t request_id;
1568 uint8_t pattern_id;
1569};
1570
1571/**
1572 * struct hdd_offloaded_packets_ctx - offloaded packets context
1573 * @op_table: request id to pattern id table
1574 * @op_lock: mutex lock
1575 */
1576struct hdd_offloaded_packets_ctx {
1577 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1578 struct mutex op_lock;
1579};
1580#endif
1581
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301582/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301583 * enum driver_status: Driver Modules status
1584 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1585 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1586 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1587 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1588 */
1589enum driver_modules_status {
1590 DRIVER_MODULES_UNINITIALIZED,
1591 DRIVER_MODULES_OPENED,
1592 DRIVER_MODULES_ENABLED,
1593 DRIVER_MODULES_CLOSED
1594};
1595
Agrawal Ashish65634612016-08-18 13:24:32 +05301596/**
1597 * struct acs_dfs_policy - Define ACS policies
1598 * @acs_dfs_mode: Dfs mode enabled/disabled.
1599 * @acs_channel: pre defined channel to avoid ACS.
1600 */
1601struct acs_dfs_policy {
1602 enum dfs_mode acs_dfs_mode;
1603 uint8_t acs_channel;
1604};
1605
Dustin Brown105d7902016-10-03 16:27:59 -07001606/**
1607 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1608 * SUSPEND_FAIL_IPA: IPA in progress
1609 * SUSPEND_FAIL_RADAR: radar scan in progress
1610 * SUSPEND_FAIL_ROAM: roaming in progress
1611 * SUSPEND_FAIL_SCAN: scan in progress
1612 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1613 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1614 */
1615enum suspend_fail_reason {
1616 SUSPEND_FAIL_IPA,
1617 SUSPEND_FAIL_RADAR,
1618 SUSPEND_FAIL_ROAM,
1619 SUSPEND_FAIL_SCAN,
1620 SUSPEND_FAIL_INITIAL_WAKEUP,
1621 SUSPEND_FAIL_MAX_COUNT
1622};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001623
Dustin Brownd9322482017-01-09 12:46:03 -08001624/**
1625 * suspend_resume_stats - Collection of counters for suspend/resume events
1626 * @suspends: number of suspends completed
1627 * @resumes: number of resumes completed
1628 * @suspend_fail: counters for failed suspend reasons
1629 */
1630struct suspend_resume_stats {
1631 uint32_t suspends;
1632 uint32_t resumes;
1633 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1634};
1635
Ashish Kumar Dhanotiyab28338c2017-07-21 20:12:34 +05301636/**
1637 * hdd_sta_smps_param - SMPS parameters to configure from hdd
1638 * HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH: RSSI threshold to enter Dynamic SMPS
1639 * mode from inactive mode
1640 * HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH: RSSI threshold to enter
1641 * Stalled-D-SMPS mode from D-SMPS mode or to enter D-SMPS mode from
1642 * Stalled-D-SMPS mode
1643 * HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH: RSSI threshold to disable SMPS modes
1644 * HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH: Upper threshold for beacon-RSSI.
1645 * Used to reduce RX chainmask.
1646 * HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH: Lower threshold for beacon-RSSI.
1647 * Used to increase RX chainmask.
1648 * HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE: Enable/Disable DTIM 1chRx feature
1649 */
1650enum hdd_sta_smps_param {
1651 HDD_STA_SMPS_PARAM_UPPER_RSSI_THRESH = 0,
1652 HDD_STA_SMPS_PARAM_STALL_RSSI_THRESH = 1,
1653 HDD_STA_SMPS_PARAM_LOWER_RSSI_THRESH = 2,
1654 HDD_STA_SMPS_PARAM_UPPER_BRSSI_THRESH = 3,
1655 HDD_STA_SMPS_PARAM_LOWER_BRSSI_THRESH = 4,
1656 HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
1657};
1658
Anurag Chouhan3920c0f2017-09-11 17:10:56 +05301659/**
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001660 * enum RX_OFFLOAD - Receive offload modes
1661 * @CFG_LRO_ENABLED: Large Rx offload
1662 * @CFG_GRO_ENABLED: Generic Rx Offload
1663 */
1664enum RX_OFFLOAD {
1665 CFG_LRO_ENABLED = 1,
1666 CFG_GRO_ENABLED,
1667};
1668
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001669/* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1670 * 1 for WDS_STAID
1671 */
1672#define HDD_MAX_ADAPTERS (WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2)
1673
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301674#ifdef DISABLE_CHANNEL_LIST
1675
1676/**
1677 * struct hdd_cache_channel_info - Structure of the channel info
1678 * which needs to be cached
1679 * @channel_num: channel number
1680 * @reg_status: Current regulatory status of the channel
1681 * Enable
1682 * Disable
1683 * DFS
1684 * Invalid
1685 * @wiphy_status: Current wiphy status
1686 */
1687struct hdd_cache_channel_info {
1688 uint32_t channel_num;
1689 enum channel_state reg_status;
1690 uint32_t wiphy_status;
1691};
1692
1693/**
1694 * struct hdd_cache_channels - Structure of the channels to be cached
1695 * @num_channels: Number of channels to be cached
1696 * @channel_info: Structure of the channel info
1697 */
1698struct hdd_cache_channels {
1699 uint32_t num_channels;
1700 struct hdd_cache_channel_info *channel_info;
1701};
1702#endif
1703
Dustin Brown20f9fc42018-08-30 15:19:12 -07001704/**
1705 * struct hdd_context - hdd shared driver and psoc/device context
1706 * @g_event_flags: a bitmap of hdd_driver_flags
1707 */
Jeff Johnson82797b62017-08-11 15:31:27 -07001708struct hdd_context {
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301709 struct wlan_objmgr_psoc *hdd_psoc;
1710 struct wlan_objmgr_pdev *hdd_pdev;
Jeff Johnson16528362018-06-14 12:34:16 -07001711 mac_handle_t mac_handle;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001712 struct wiphy *wiphy;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301713 qdf_spinlock_t hdd_adapter_lock;
Jeff Johnson19fc8e42017-10-30 19:53:49 -07001714 qdf_list_t hdd_adapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001715
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07001716 struct hdd_adapter *sta_to_adapter[HDD_MAX_ADAPTERS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001717
1718 /** Pointer for firmware image data */
1719 const struct firmware *fw;
1720
1721 /** Pointer for configuration data */
1722 const struct firmware *cfg;
1723
1724 /** Pointer to the parent device */
1725 struct device *parent_dev;
1726
1727 /** Config values read from qcom_cfg.ini file */
1728 struct hdd_config *config;
1729
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001730 /* Completion variable to indicate Mc Thread Suspended */
1731 struct completion mc_sus_event_var;
1732
Rajeev Kumareada0d02016-12-08 17:44:17 -08001733 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001734
1735#ifdef QCA_CONFIG_SMP
1736 bool is_ol_rx_thread_suspended;
1737#endif
1738
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001739 bool hdd_wlan_suspended;
1740 bool suspended;
Poddar, Siddarth61fbc932017-12-19 14:27:55 +05301741 /* flag to start pktlog after SSR/PDR if previously enabled */
1742 bool is_pktlog_enabled;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001743
1744 /* Lock to avoid race condition during start/stop bss */
1745 struct mutex sap_lock;
1746
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001747#ifdef FEATURE_OEM_DATA_SUPPORT
1748 /* OEM App registered or not */
1749 bool oem_app_registered;
1750
1751 /* OEM App Process ID */
1752 int32_t oem_pid;
1753#endif
1754
1755 /** Concurrency Parameters*/
1756 uint32_t concurrency_mode;
1757
Anurag Chouhan6d760662016-02-20 16:05:43 +05301758 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1759 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001760
1761 /** P2P Device MAC Address for the adapter */
Jeff Johnsonacbdb1c2017-11-02 20:42:02 -07001762 struct qdf_mac_addr p2p_device_address;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001763
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301764 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301765 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001766
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001767 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001768
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001769 /* Flag keeps track of wiphy suspend/resume */
Jeff Johnson214671b2017-10-30 19:45:23 -07001770 bool is_wiphy_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001771
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001772#ifdef MSM_PLATFORM
1773 /* DDR bus bandwidth compute timer
1774 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301775 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001776 bool bus_bw_timer_running;
1777 qdf_spinlock_t bus_bw_timer_lock;
1778 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001779 int cur_vote_level;
1780 spinlock_t bus_bw_lock;
1781 int cur_rx_level;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001782 uint64_t prev_no_rx_offload_pkts;
1783 uint64_t prev_rx_offload_pkts;
Mohit Khannae71e2262015-11-10 09:37:24 -08001784 int cur_tx_level;
1785 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001786#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001787
1788 struct completion ready_to_suspend;
1789 /* defining the solution type */
1790 uint32_t target_type;
1791
Sourav Mohapatra421d42b2017-12-29 16:33:23 +05301792 qdf_atomic_t con_mode_flag;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001793 /* defining the firmware version */
1794 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001795 uint32_t target_fw_vers_ext;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001796
1797 /* defining the chip/rom version */
1798 uint32_t target_hw_version;
1799 /* defining the chip/rom revision */
1800 uint32_t target_hw_revision;
1801 /* chip/rom name */
Dustin Brown6f17a022017-07-19 13:40:55 -07001802 char *target_hw_name;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001803 struct regulatory reg;
1804#ifdef FEATURE_WLAN_CH_AVOID
1805 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001806 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001807#endif /* FEATURE_WLAN_CH_AVOID */
1808
1809 uint8_t max_intf_count;
1810 uint8_t current_intf_count;
1811#ifdef WLAN_FEATURE_LPSS
1812 uint8_t lpss_support;
1813#endif
1814 uint8_t ap_arpns_support;
1815 tSirScanType ioctl_scan_mode;
1816
1817#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301818 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001819#endif
1820
1821 struct work_struct sap_start_work;
1822 bool is_sap_restart_required;
1823 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301824 qdf_spinlock_t sap_update_info_lock;
1825 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001826
1827 uint8_t dev_dfs_cac_status;
1828
Jeff Johnson59b19312017-11-02 21:14:33 -07001829 bool bt_coex_mode_set;
Jeff Johnsondadef1a2017-09-30 16:14:02 -07001830 struct fw_log_info fw_log_settings;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001831#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301832 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001833 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001834 uint8_t *last_acs_channel_list;
1835 uint8_t num_of_channels;
1836 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001837#endif
1838
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301839 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001840 atomic_t sap_dfs_ref_cnt;
1841
1842#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1843 bool is_extwow_app_type1_param_set;
1844 bool is_extwow_app_type2_param_set;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001845#endif
1846
1847 /* Time since boot up to extscan start (in micro seconds) */
1848 uint64_t ext_scan_start_since_boot;
1849 unsigned long g_event_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001850 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301851
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001852#ifdef WLAN_NS_OFFLOAD
1853 /* IPv6 notifier callback for handling NS offload on change in IP */
1854 struct notifier_block ipv6_notifier;
1855#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301856 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001857 /* IPv4 notifier callback for handling ARP offload on change in IP */
1858 struct notifier_block ipv4_notifier;
1859
1860 /* number of rf chains supported by target */
1861 uint32_t num_rf_chains;
1862 /* Is htTxSTBC supported by target */
1863 uint8_t ht_tx_stbc_supported;
1864#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1865 struct hdd_offloaded_packets_ctx op_ctx;
1866#endif
1867 bool mcc_mode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001868 struct mutex memdump_lock;
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301869 uint16_t driver_dump_size;
1870 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001871
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001872 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301873 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001874
1875 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301876 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001877
Krunal Sonie3531942016-04-12 17:43:53 -07001878 /*
1879 * place to store FTM capab of target. This allows changing of FTM capab
1880 * at runtime and intersecting it with target capab before updating.
1881 */
1882 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001883 uint32_t rx_high_ind_cnt;
Manjunathappa Prakash3a21bea2018-05-29 20:41:12 -07001884 /* For Rx thread non GRO/LRO packet accounting */
1885 uint64_t no_rx_offload_pkt_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001886 /* Current number of TX X RX chains being used */
1887 enum antenna_mode current_antenna_mode;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001888
1889 /* the radio index assigned by cnss_logger */
1890 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301891 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301892 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301893 uint32_t last_nil_scan_bug_report_timestamp;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001894 enum RX_OFFLOAD ol_enable;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001895#ifdef WLAN_FEATURE_NAN_DATAPATH
1896 bool nan_datapath_enabled;
1897#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301898 /* Present state of driver cds modules */
1899 enum driver_modules_status driver_status;
Dustin Brown6f427922017-09-19 12:19:00 -07001900 /* interface idle work */
1901 qdf_delayed_work_t iface_idle_work;
Arun Khandavallifae92942016-08-01 13:31:08 +05301902 /* Interface change lock */
1903 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301904 bool rps;
Tang Yingying5a4ccf22018-03-30 15:58:27 +08001905 bool dynamic_rps;
Jeff Johnsone2ba3cd2017-10-30 20:02:09 -07001906 bool enable_rxthread;
Mohit Khanna70322002018-05-15 19:21:32 -07001907 /* support for DP RX threads */
1908 bool enable_dp_rx_threads;
Nirav Shahbd36b062016-07-18 11:12:59 +05301909 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301910 bool stop_modules_in_progress;
1911 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001912 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301913 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301914 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001915 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301916 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301917 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301918 struct scan_chan_info *chan_info;
1919 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301920 /* bit map to set/reset TDLS by different sources */
1921 unsigned long tdls_source_bitmap;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001922 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001923 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301924 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301925 uint8_t last_scan_reject_session_id;
1926 enum scan_reject_states last_scan_reject_reason;
1927 unsigned long last_scan_reject_timestamp;
Abhishek Singh00130682017-07-14 10:46:17 +05301928 uint8_t scan_reject_cnt;
Arif Hussain759a0232017-03-20 13:17:18 -07001929 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001930 bool reg_offload;
Rajeev Kumar Sirasanagandla996e5292016-11-22 21:20:33 +05301931 bool rcpi_enabled;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301932#ifdef FEATURE_WLAN_CH_AVOID
Kiran Kumar Lokere48795792017-07-07 15:34:29 -07001933 struct ch_avoid_ind_type coex_avoid_freq_list;
1934 struct ch_avoid_ind_type dnbs_avoid_freq_list;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301935 /* Lock to control access to dnbs and coex avoid freq list */
1936 struct mutex avoid_freq_lock;
1937#endif
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001938#ifdef WLAN_FEATURE_TSF
1939 /* indicate whether tsf has been initialized */
1940 qdf_atomic_t tsf_ready_flag;
1941 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1942 qdf_atomic_t cap_tsf_flag;
1943 /* the context that is capturing tsf */
Jeff Johnson9d295242017-08-29 14:39:48 -07001944 struct hdd_adapter *cap_tsf_context;
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001945#endif
Vidyullatha Kanchanapallybe0ebb32017-03-23 14:36:21 +05301946 uint8_t bt_a2dp_active:1;
1947 uint8_t bt_vo_active:1;
Varun Reddy Yeturua48bc412017-11-17 15:33:35 -08001948 enum band_info curr_band;
Arunk Khandavalli847969d2017-09-25 15:15:36 +05301949 bool imps_enabled;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001950#ifdef WLAN_FEATURE_PACKET_FILTERING
Hanumanth Reddy Pothula3def8942017-10-05 16:19:36 +05301951 int user_configured_pkt_filter_rules;
Qiwei Cai4505fc62018-05-17 18:35:19 +08001952#endif
Vignesh Viswanathan731186f2017-09-18 13:47:37 +05301953 bool is_fils_roaming_supported;
Manjunathappa Prakash7b0ad462018-04-15 00:37:16 -07001954 QDF_STATUS (*receive_offload_cb)(struct hdd_adapter *,
1955 struct sk_buff *);
Poddar, Siddarth4b3f7312017-11-02 17:00:20 +05301956 qdf_atomic_t vendor_disable_lro_flag;
Manjunathappa Prakash7b6cb002017-10-09 00:40:24 -07001957 qdf_atomic_t disable_lro_in_concurrency;
Poddar, Siddarth47c23402017-10-25 12:17:39 +05301958 qdf_atomic_t disable_lro_in_low_tput;
Manjunathappa Prakash81ca3a52017-10-09 01:41:58 -07001959 bool en_tcp_delack_no_lro;
Abhishek Singh6454ad32017-12-20 10:42:21 +05301960 bool force_rsne_override;
Arunk Khandavalliebd1e372017-11-06 15:00:24 +05301961 qdf_wake_lock_t monitor_mode_wakelock;
Naveen Rawat269b4ed2017-12-07 06:47:32 -08001962 bool lte_coex_ant_share;
Liangwei Dong0da14262018-07-03 03:30:23 -04001963 bool obss_scan_offload;
Sandeep Puligilla019a1bd2018-02-04 22:57:44 -08001964 int sscan_pid;
Sravan Kumar Kairamc1ae71c2017-02-24 12:27:27 +05301965 uint32_t track_arp_ip;
Ryan Hsuc6918552018-05-16 13:29:59 -07001966
1967 /* defining the board related information */
1968 uint32_t hw_bd_id;
1969 struct board_info hw_bd_info;
Varun Reddy Yeturud33033f2018-06-11 10:58:30 -07001970#ifdef WLAN_SUPPORT_TWT
Varun Reddy Yeturu3c9f89c2018-04-18 19:10:34 -07001971 enum twt_status twt_state;
1972#endif
Nachiket Kukade5f0ce4f2018-06-15 19:47:37 +05301973#ifdef FEATURE_WLAN_APF
1974 bool apf_supported;
1975 uint32_t apf_version;
1976#endif
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05301977
1978#ifdef DISABLE_CHANNEL_LIST
1979 struct hdd_cache_channels *original_channels;
1980 qdf_mutex_t cache_channel_lock;
1981#endif
Jeff Johnsonf9176382018-07-17 19:15:58 -07001982 enum sar_version sar_version;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001983};
1984
Kapil Gupta086c6202016-12-11 18:17:06 +05301985/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301986 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1987 * @channel_count: channel count
1988 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301989 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301990 * @vendor_pcl_list: pointer to pcl list
1991 * @vendor_weight_list: pointer to pcl weight list
1992 */
1993struct hdd_vendor_acs_chan_params {
1994 uint32_t channel_count;
1995 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301996 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301997 uint8_t *vendor_pcl_list;
1998 uint8_t *vendor_weight_list;
1999};
2000
2001/**
2002 * struct hdd_external_acs_timer_context - acs timer context
2003 * @reason: reason for acs trigger
2004 * @adapter: hdd adapter for acs
2005 */
2006struct hdd_external_acs_timer_context {
2007 int8_t reason;
Jeff Johnson9d295242017-08-29 14:39:48 -07002008 struct hdd_adapter *adapter;
Kapil Gupta8878ad92017-02-13 11:56:04 +05302009};
2010
2011/**
2012 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05302013 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05302014 * @pri_ch: primary channel
2015 * @ht_sec_ch: secondary channel
2016 * @vht_seg0_center_ch: segment0 for vht
2017 * @vht_seg1_center_ch: vht segment 1
2018 * @chan_width: channel width
2019 */
2020struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05302021 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05302022 uint8_t pri_ch;
2023 uint8_t ht_sec_ch;
2024 uint8_t vht_seg0_center_ch;
2025 uint8_t vht_seg1_center_ch;
2026 uint8_t chan_width;
2027};
2028
2029/**
Kapil Gupta086c6202016-12-11 18:17:06 +05302030 * struct hdd_channel_info - standard channel info
2031 * @freq: Freq in Mhz
2032 * @flags: channel info flags
2033 * @flagext: extended channel info flags
2034 * @ieee_chan_number: channel number
2035 * @max_reg_power: max tx power according to regulatory
2036 * @max_radio_power: max radio power
2037 * @min_radio_power: min radio power
2038 * @reg_class_id: regulatory class
2039 * @max_antenna_gain: max antenna gain allowed on channel
2040 * @vht_center_freq_seg0: vht center freq segment 0
2041 * @vht_center_freq_seg1: vht center freq segment 1
2042 */
2043struct hdd_channel_info {
2044 u_int16_t freq;
2045 u_int32_t flags;
2046 u_int16_t flagext;
2047 u_int8_t ieee_chan_number;
2048 int8_t max_reg_power;
2049 int8_t max_radio_power;
2050 int8_t min_radio_power;
2051 u_int8_t reg_class_id;
2052 u_int8_t max_antenna_gain;
2053 u_int8_t vht_center_freq_seg0;
2054 u_int8_t vht_center_freq_seg1;
2055};
2056
Jeff Johnsonef926352017-01-12 10:41:02 -08002057/*
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05302058 * @eHDD_DRV_OP_PROBE: Refers to .probe operation
2059 * @eHDD_DRV_OP_REMOVE: Refers to .remove operation
2060 * @eHDD_DRV_OP_SHUTDOWN: Refers to .shutdown operation
2061 * @eHDD_DRV_OP_REINIT: Refers to .reinit operation
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05302062 * @eHDD_DRV_OP_IFF_UP: Refers to IFF_UP operation
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05302063 */
2064enum {
2065 eHDD_DRV_OP_PROBE = 0,
2066 eHDD_DRV_OP_REMOVE,
2067 eHDD_DRV_OP_SHUTDOWN,
Arunk Khandavallie9ef42a2017-10-04 14:49:51 +05302068 eHDD_DRV_OP_REINIT,
2069 eHDD_DRV_OP_IFF_UP
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05302070};
2071
2072/*
Jeff Johnsonef926352017-01-12 10:41:02 -08002073 * Function declarations and documentation
2074 */
Himanshu Agarwal813b2bf2018-01-22 16:32:15 +05302075
Jeff Johnson9d295242017-08-29 14:39:48 -07002076int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter,
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05302077 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002078 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002079
2080const char *hdd_device_mode_to_string(uint8_t device_mode);
2081
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002082QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002083 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002084
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002085QDF_STATUS hdd_get_next_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002086 struct hdd_adapter *current_adapter,
2087 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002088
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002089QDF_STATUS hdd_remove_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002090 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002091
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002092QDF_STATUS hdd_remove_front_adapter(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002093 struct hdd_adapter **out_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002094
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002095QDF_STATUS hdd_add_adapter_back(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002096 struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002097
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002098QDF_STATUS hdd_add_adapter_front(struct hdd_context *hdd_ctx,
Dustin Brown920397d2017-12-13 16:27:50 -08002099 struct hdd_adapter *adapter);
2100
2101/**
2102 * hdd_for_each_adapter - adapter iterator macro
2103 * @hdd_ctx: the global HDD context
2104 * @adapter: an hdd_adapter pointer to use as a cursor
2105 */
2106#define hdd_for_each_adapter(hdd_ctx, adapter) \
2107 for (hdd_get_front_adapter(hdd_ctx, &adapter); \
2108 adapter; \
2109 hdd_get_next_adapter(hdd_ctx, adapter, &adapter))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002110
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002111struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx,
2112 uint8_t session_type,
2113 const char *name, tSirMacAddr macAddr,
2114 unsigned char name_assign_type,
2115 bool rtnl_held);
2116QDF_STATUS hdd_close_adapter(struct hdd_context *hdd_ctx,
2117 struct hdd_adapter *adapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08002118 bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002119QDF_STATUS hdd_close_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Dustin Browndb2a8be2017-12-20 11:49:56 -08002120QDF_STATUS hdd_stop_all_adapters(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002121void hdd_deinit_all_adapters(struct hdd_context *hdd_ctx, bool rtnl_held);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002122QDF_STATUS hdd_reset_all_adapters(struct hdd_context *hdd_ctx);
2123QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx);
2124struct hdd_adapter *hdd_get_adapter_by_vdev(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002125 uint32_t vdev_id);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002126struct hdd_adapter *hdd_get_adapter_by_macaddr(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002127 tSirMacAddr macAddr);
Dustin Brownd28772b2017-03-17 14:16:07 -07002128
Krunal Sonib51eec72017-11-20 21:53:01 -08002129int hdd_vdev_create(struct hdd_adapter *adapter,
Jeff Johnson6a18c962018-07-01 09:09:37 -07002130 csr_roam_complete_cb callback, void *ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002131int hdd_vdev_destroy(struct hdd_adapter *adapter);
2132int hdd_vdev_ready(struct hdd_adapter *adapter);
Dustin Brownd28772b2017-03-17 14:16:07 -07002133
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002134QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002135struct hdd_adapter *hdd_get_adapter(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002136 enum QDF_OPMODE mode);
Yeshwanth Sriram Guntuka469f9572018-02-12 13:28:22 +05302137/*
2138 * hdd_get_device_mode() - Get device mode
2139 * @session_id: Session id
2140 *
2141 * Return: Device mode
2142 */
Jeff Johnson36a0abf2018-05-20 11:24:25 -07002143enum QDF_OPMODE hdd_get_device_mode(uint32_t session_id);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002144void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
2145 struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002146 bool rtnl_held);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002147QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
Dustin Browndb2a8be2017-12-20 11:49:56 -08002148 struct hdd_adapter *adapter);
Liangwei Dongad89c762018-06-01 01:56:23 -04002149
2150enum hdd_adapter_stop_flag_t {
2151 HDD_IN_CAC_WORK_TH_CONTEXT = 0x00000001,
2152};
2153
2154QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
2155 struct hdd_adapter *adapter,
2156 enum hdd_adapter_stop_flag_t flag);
2157
Jeff Johnson5505db82017-11-02 21:19:23 -07002158void hdd_set_station_ops(struct net_device *dev);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002159uint8_t *wlan_hdd_get_intf_addr(struct hdd_context *hdd_ctx);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002160void wlan_hdd_release_intf_addr(struct hdd_context *hdd_ctx,
2161 uint8_t *releaseAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002162uint8_t hdd_get_operating_channel(struct hdd_context *hdd_ctx,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002163 enum QDF_OPMODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002164
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08002165void hdd_set_conparam(uint32_t con_param);
Jeff Johnson876c1a62017-12-12 10:43:07 -08002166enum QDF_GLOBAL_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002167void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002168void wlan_hdd_reset_prob_rspies(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002169void hdd_prevent_suspend(uint32_t reason);
Sourav Mohapatra92ea8d62018-02-05 10:03:10 +05302170
2171/*
2172 * hdd_get_first_valid_adapter() - Get the first valid adapter from adapter list
2173 *
2174 * This function is used to fetch the first valid adapter from the adapter
2175 * list. If there is no valid adapter then it returns NULL
2176 *
2177 * @hdd_ctx: HDD context handler
2178 *
2179 * Return: NULL if no valid adapter found in the adapter list
2180 *
2181 */
2182struct hdd_adapter *hdd_get_first_valid_adapter(struct hdd_context *hdd_ctx);
2183
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002184void hdd_allow_suspend(uint32_t reason);
2185void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002186
2187void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002188QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter);
Dustin Brownda351e32018-07-23 15:48:22 -07002189
2190/**
2191 * wlan_hdd_validate_context() - check the HDD context
2192 * @hdd_ctx: Global HDD context pointer
2193 *
2194 * Return: 0 if the context is valid. Error code otherwise
2195 */
2196#define wlan_hdd_validate_context(hdd_ctx) \
2197 __wlan_hdd_validate_context(hdd_ctx, __func__)
2198
2199int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002200
2201/**
2202 * hdd_validate_adapter() - Validate the given adapter
2203 * @adapter: the adapter to validate
2204 *
2205 * This function validates the given adapter, and ensures that it is open.
2206 *
2207 * Return: Errno
2208 */
Dustin Browna8700cc2018-08-07 12:04:47 -07002209#define hdd_validate_adapter(adapter) \
2210 __hdd_validate_adapter(adapter, __func__)
2211
2212int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func);
Dustin Brownf13b8c32017-05-19 17:23:08 -07002213
Dustin Brown63500612018-08-07 11:36:09 -07002214/**
2215 * wlan_hdd_validate_session_id() - ensure the given session Id is valid
2216 * @session_id: the session Id to validate
2217 *
2218 * Return: Errno
2219 */
2220#define wlan_hdd_validate_session_id(session_id) \
2221 __wlan_hdd_validate_session_id(session_id, __func__)
2222
2223int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func);
2224
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002225bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002226QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002227bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002228
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002229#ifdef MSM_PLATFORM
Dustin Brown5ec6b552017-03-31 12:11:40 -07002230/**
2231 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
2232 * @hdd_ctx: the global hdd context
2233 *
2234 * Return: None
2235 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002236void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002237
2238/**
2239 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
2240 * @hdd_ctx: the global hdd context
2241 *
2242 * This function ensures there is at least one adapter in the associated state
2243 * before starting the bandwidth timer.
2244 *
2245 * Return: None
2246 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002247void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002248
2249/**
2250 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
2251 * @hdd_ctx: the global hdd context
2252 *
2253 * Return: None
2254 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002255void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx);
Dustin Brown5ec6b552017-03-31 12:11:40 -07002256
2257/**
2258 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
2259 * @hdd_ctx: the global hdd context
2260 *
2261 * This function ensures there are no adapters in the associated state before
2262 * stopping the bandwidth timer.
2263 *
2264 * Return: None
2265 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002266void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002267
2268/**
2269 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002270 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002271 *
2272 * Initialize bus bandwidth related data structures like spinlock and timer.
2273 *
2274 * Return: None.
2275 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002276int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07002277
2278/**
Dustin Brown86d196b2018-08-02 11:51:49 -07002279 * hdd_bus_bandwidth_deinit() - De-initialize bus bandwidth data structures.
Lin Baic5c06882017-09-21 13:58:43 +08002280 * @hdd_ctx: HDD context
Prashanth Bhattaab004382016-10-11 16:08:11 -07002281 *
Dustin Brown86d196b2018-08-02 11:51:49 -07002282 * De-initialize bus bandwidth related data structures like timer.
Prashanth Bhattaab004382016-10-11 16:08:11 -07002283 *
2284 * Return: None.
2285 */
Dustin Brown86d196b2018-08-02 11:51:49 -07002286void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx);
Lin Baic5c06882017-09-21 13:58:43 +08002287
Lin Bai556a1922017-11-10 20:32:04 +08002288#define GET_CUR_RX_LVL(config) ((config)->cur_rx_level)
Lin Baiaa7f8d72017-10-18 17:23:45 +08002289#define GET_BW_COMPUTE_INTV(config) ((config)->busBandwidthComputeInterval)
2290
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002291#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07002292
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002293static inline
2294void hdd_bus_bw_compute_timer_start(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002295{
Dustin Brown5ec6b552017-03-31 12:11:40 -07002296}
2297
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002298static inline
2299void hdd_bus_bw_compute_timer_try_start(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002300{
2301}
2302
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002303static inline
2304void hdd_bus_bw_compute_timer_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002305{
2306}
2307
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002308static inline
2309void hdd_bus_bw_compute_timer_try_stop(struct hdd_context *hdd_ctx)
Dustin Brown5ec6b552017-03-31 12:11:40 -07002310{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002311}
2312
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002313static inline
2314int hdd_bus_bandwidth_init(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002315{
2316 return 0;
2317}
2318
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002319static inline
Dustin Brown86d196b2018-08-02 11:51:49 -07002320void hdd_bus_bandwidth_deinit(struct hdd_context *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07002321{
Prashanth Bhattaab004382016-10-11 16:08:11 -07002322}
Lin Baic5c06882017-09-21 13:58:43 +08002323
Lin Bai556a1922017-11-10 20:32:04 +08002324#define GET_CUR_RX_LVL(config) 0
Lin Baiaa7f8d72017-10-18 17:23:45 +08002325#define GET_BW_COMPUTE_INTV(config) 0
2326
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002327#endif
2328
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05302329int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
2330
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08002331int hdd_init(void);
2332void hdd_deinit(void);
2333
Arun Khandavallifae92942016-08-01 13:31:08 +05302334int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002335void __hdd_wlan_exit(void);
2336int hdd_wlan_notify_modem_power_state(int state);
2337#ifdef QCA_HT_2040_COEX
Jeff Johnsone7672e72017-10-21 15:10:04 -07002338/**
2339 * hdd_wlan_set_ht2040_mode() - notify FW with HT20/HT40 mode
2340 * @adapter: pointer to adapter
2341 * @sta_id: station id
2342 * @sta_mac: station MAC address
2343 * @channel_type: channel type
2344 *
2345 * This function notifies FW with HT20/HT40 mode
2346 *
2347 * Return: 0 if successful, error number otherwise
2348 */
2349int hdd_wlan_set_ht2040_mode(struct hdd_adapter *adapter, uint16_t sta_id,
2350 struct qdf_mac_addr sta_mac, int channel_type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002351#endif
2352
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05302353void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002354#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002355void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002356#endif
2357
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002358struct hdd_adapter *
2359hdd_get_con_sap_adapter(struct hdd_adapter *this_sap_adapter,
2360 bool check_start_bss);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002361
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002362bool hdd_is_5g_supported(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002363
Jeff Johnson7b92c0f2017-10-02 13:31:35 -07002364int wlan_hdd_scan_abort(struct hdd_adapter *adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002365
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002366#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002367static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002368{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002369 return hdd_ctx->config->isRoamOffloadEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002370}
2371#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002372static inline bool roaming_offload_enabled(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002373{
2374 return false;
2375}
2376#endif
2377
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002378#ifdef WLAN_FEATURE_HOST_ROAM
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002379static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002380{
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002381 return hdd_ctx->config->isFastRoamIniFeatureEnabled;
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002382}
2383#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002384static inline bool hdd_driver_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002385{
2386 return false;
2387}
2388#endif
2389
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002390static inline bool hdd_roaming_supported(struct hdd_context *hdd_ctx)
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002391{
2392 bool val;
2393
2394 val = hdd_driver_roaming_supported(hdd_ctx) ||
Srinivas Girigowdaa8f66582017-06-26 23:02:30 -07002395 roaming_offload_enabled(hdd_ctx);
Srinivas Girigowda8df27ea2017-01-06 12:42:16 -08002396
2397 return val;
2398}
2399
2400#ifdef CFG80211_SCAN_RANDOM_MAC_ADDR
2401static inline bool hdd_scan_random_mac_addr_supported(void)
2402{
2403 return true;
2404}
2405#else
2406static inline bool hdd_scan_random_mac_addr_supported(void)
2407{
2408 return false;
2409}
2410#endif
2411
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302412/**
2413 * hdd_start_vendor_acs(): Start vendor ACS procedure
2414 * @adapter: pointer to SAP adapter struct
2415 *
2416 * This function sends the ACS config to the ACS daemon and
2417 * starts the vendor ACS timer to wait for the next command.
2418 *
2419 * Return: Status of vendor ACS procedure
2420 */
2421int hdd_start_vendor_acs(struct hdd_adapter *adapter);
2422
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002423void hdd_get_fw_version(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002424 uint32_t *major_spid, uint32_t *minor_spid,
2425 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302426/**
2427 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
2428 * @context : timeout handler context
2429 *
2430 * Return: None
2431 */
2432void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002433
Kapil Gupta8878ad92017-02-13 11:56:04 +05302434/**
2435 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
2436 * @adapter: pointer to SAP adapter struct
2437 *
2438 * This function starts the ACS procedure if there are no
2439 * constraints like MBSSID DFS restrictions.
2440 *
2441 * Return: Status of ACS Start procedure
2442 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002443int wlan_hdd_cfg80211_start_acs(struct hdd_adapter *adapter);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302444
2445/**
2446 * hdd_cfg80211_update_acs_config() - update acs config to application
2447 * @adapter: hdd adapter
2448 * @reason: channel change reason
2449 *
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302450 * Return: 0 for success else error code
Kapil Gupta8878ad92017-02-13 11:56:04 +05302451 */
Himanshu Agarwaldfc4dca2017-08-29 19:49:05 +05302452int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
2453 uint8_t reason);
Nirav Shaheb017be2018-02-15 11:20:58 +05302454
Kapil Gupta8878ad92017-02-13 11:56:04 +05302455/**
2456 * hdd_update_acs_timer_reason() - update acs timer start reason
2457 * @adapter: hdd adapter
2458 * @reason: channel change reason
2459 *
2460 * Return: 0 for success
2461 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002462int hdd_update_acs_timer_reason(struct hdd_adapter *adapter, uint8_t reason);
Kapil Gupta8878ad92017-02-13 11:56:04 +05302463
2464/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002465 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05302466 * @adapter: AP adapter
2467 * @channel: Channel
Min Liu2fef5792018-01-19 17:59:42 +08002468 * @forced: Force to switch channel, ignore SCC/MCC check
Kapil Gupta8878ad92017-02-13 11:56:04 +05302469 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002470 * Moves the SAP interface by invoking the function which
2471 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05302472 *
2473 * Return: None
2474 */
Min Liu2fef5792018-01-19 17:59:42 +08002475void hdd_switch_sap_channel(struct hdd_adapter *adapter, uint8_t channel,
2476 bool forced);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002477
Nirav Shaheb017be2018-02-15 11:20:58 +05302478#if defined(FEATURE_WLAN_CH_AVOID)
2479void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
2480
2481void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2482 struct unsafe_ch_list *unsafe_chan_list,
2483 struct ch_avoid_ind_type *avoid_freq_list);
2484#else
2485static inline
2486void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx)
2487{
2488}
2489
2490static inline
2491void hdd_ch_avoid_ind(struct hdd_context *hdd_ctxt,
2492 struct unsafe_ch_list *unsafe_chan_list,
2493 struct ch_avoid_ind_type *avoid_freq_list)
2494{
2495}
2496#endif
2497
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002498void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05302499 struct qdf_mac_addr hw_macaddr);
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302500
2501/**
2502 * wlan_hdd_disable_roaming() - disable roaming on all STAs except the input one
2503 * @cur_adapter: Current HDD adapter passed from caller
2504 *
2505 * This function loops through all adapters and disables roaming on each STA
2506 * mode adapter except the current adapter passed from the caller
2507 *
2508 * Return: None
2509 */
2510void wlan_hdd_disable_roaming(struct hdd_adapter *cur_adapter);
2511
2512/**
2513 * wlan_hdd_enable_roaming() - enable roaming on all STAs except the input one
2514 * @cur_adapter: Current HDD adapter passed from caller
2515 *
2516 * This function loops through all adapters and enables roaming on each STA
2517 * mode adapter except the current adapter passed from the caller
2518 *
2519 * Return: None
2520 */
2521void wlan_hdd_enable_roaming(struct hdd_adapter *cur_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002522
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002523QDF_STATUS hdd_post_cds_enable_config(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002524
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002525QDF_STATUS hdd_abort_mac_scan_all_adapters(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002526
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002527QDF_STATUS
2528wlan_hdd_check_custom_con_channel_rules(struct hdd_adapter *sta_adapter,
2529 struct hdd_adapter *ap_adapter,
Jeff Johnson61b5e982018-03-15 11:33:31 -07002530 struct csr_roam_profile *roam_profile,
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002531 tScanResultHandle *scan_cache,
2532 bool *concurrent_chnl_same);
2533
Jeff Johnson9d295242017-08-29 14:39:48 -07002534void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
2535void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002536
2537#ifdef QCA_CONFIG_SMP
2538int wlan_hdd_get_cpu(void);
2539#else
2540static inline int wlan_hdd_get_cpu(void)
2541{
2542 return 0;
2543}
2544#endif
2545
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302546void wlan_hdd_sap_pre_cac_failure(void *data);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002547void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302548
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002549void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2550 enum netif_action_type action, enum netif_reason_type reason);
2551
Ajit Pal Singh106c1412018-04-18 18:08:49 +05302552#ifdef QCA_HL_NETDEV_FLOW_CONTROL
2553void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2554 enum netif_action_type action);
2555#else
2556static inline void wlan_hdd_mod_fc_timer(struct hdd_adapter *adapter,
2557 enum netif_action_type action)
2558{
2559}
2560#endif /* QCA_HL_NETDEV_FLOW_CONTROL */
2561
Jeff Johnson9d295242017-08-29 14:39:48 -07002562int hdd_wlan_dump_stats(struct hdd_adapter *adapter, int value);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002563void wlan_hdd_deinit_tx_rx_histogram(struct hdd_context *hdd_ctx);
Jeff Johnson58adbcf2017-09-03 08:53:31 -07002564void wlan_hdd_display_tx_rx_histogram(struct hdd_context *hdd_ctx);
2565void wlan_hdd_clear_tx_rx_histogram(struct hdd_context *hdd_ctx);
Mohit Khanna70322002018-05-15 19:21:32 -07002566
Mohit Khannaca4173b2017-09-12 21:52:19 -07002567void
2568wlan_hdd_display_netif_queue_history(struct hdd_context *hdd_ctx,
2569 enum qdf_stats_verbosity_level verb_lvl);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002570void wlan_hdd_clear_netif_queue_history(struct hdd_context *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002571const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302572void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002573
2574struct hdd_adapter *
2575hdd_get_adapter_by_sme_session_id(struct hdd_context *hdd_ctx,
2576 uint32_t sme_session_id);
2577
Naveen Rawat4edb6822017-04-12 10:09:17 -07002578/**
2579 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2580 * @hdd_ctx: hdd context.
2581 * @iface_name: interface name
2582 *
2583 * This function is used to get the adapter with given interface name
2584 *
2585 * Return: adapter pointer if found, NULL otherwise
2586 *
2587 */
Jeff Johnson9d295242017-08-29 14:39:48 -07002588struct hdd_adapter *hdd_get_adapter_by_iface_name(struct hdd_context *hdd_ctx,
Naveen Rawat4edb6822017-04-12 10:09:17 -07002589 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002590enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Jeff Johnson16528362018-06-14 12:34:16 -07002591
2592/**
2593 * wlan_hdd_find_opclass() - Find operating class for a channel
2594 * @mac_handle: global MAC handle
2595 * @channel: channel id
2596 * @bw_offset: bandwidth offset
2597 *
2598 * Function invokes sme api to find the operating class
2599 *
2600 * Return: operating class
2601 */
2602uint8_t wlan_hdd_find_opclass(mac_handle_t mac_handle, uint8_t channel,
2603 uint8_t bw_offset);
2604
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002605int hdd_update_config(struct hdd_context *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002606
Mukul Sharma9d797a02017-01-05 20:26:03 +05302607/**
2608 * hdd_update_components_config() - Initialize driver per module ini parameters
2609 * @hdd_ctx: HDD Context
2610 *
2611 * API is used to initialize components configuration parameters
2612 * Return: 0 for success, errno for failure
2613 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002614int hdd_update_components_config(struct hdd_context *hdd_ctx);
Mukul Sharma9d797a02017-01-05 20:26:03 +05302615
Jeff Johnson9d295242017-08-29 14:39:48 -07002616QDF_STATUS hdd_chan_change_notify(struct hdd_adapter *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302617 struct net_device *dev,
bings58ce8622017-07-10 15:55:36 +08002618 struct hdd_chan_change_params chan_change,
2619 bool legacy_phymode);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302620int wlan_hdd_set_channel(struct wiphy *wiphy,
2621 struct net_device *dev,
2622 struct cfg80211_chan_def *chandef,
2623 enum nl80211_channel_type channel_type);
Jeff Johnson9c4f93d2017-10-04 08:56:22 -07002624int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter,
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302625 struct cfg80211_beacon_data *params,
2626 const u8 *ssid, size_t ssid_len,
2627 enum nl80211_hidden_ssid hidden_ssid,
Mahesh Kumar Kalikot Veetilc637fc92017-09-27 16:06:21 -07002628 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302629
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002630#if !defined(REMOVE_PKT_LOG)
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002631int hdd_process_pktlog_command(struct hdd_context *hdd_ctx, uint32_t set_value,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302632 int set_value2);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002633int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302634 uint8_t user_triggered, int size);
2635
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002636#else
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002637static inline
2638int hdd_pktlog_enable_disable(struct hdd_context *hdd_ctx, bool enable,
2639 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002640{
2641 return 0;
2642}
Jeff Johnson6dff3ee2017-10-06 14:58:57 -07002643
2644static inline
2645int hdd_process_pktlog_command(struct hdd_context *hdd_ctx,
2646 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002647{
2648 return 0;
2649}
2650#endif /* REMOVE_PKT_LOG */
2651
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002652#ifdef FEATURE_TSO
2653/**
2654 * hdd_set_tso_flags() - enable TSO flags in the network device
2655 * @hdd_ctx: HDD context
2656 * @wlan_dev: network device structure
2657 *
2658 * This function enables the TSO related feature flags in the
2659 * given network device.
2660 *
2661 * Return: none
2662 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002663static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002664 struct net_device *wlan_dev)
2665{
Mohit Khanna816e6532016-12-09 15:28:21 -08002666 if (hdd_ctx->config->tso_enable &&
2667 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2668 /*
2669 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2670 * enabled.
2671 */
Dustin Brown7e761c72018-07-31 13:50:17 -07002672 hdd_debug("TSO Enabled");
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002673 wlan_dev->features |=
2674 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2675 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2676 }
2677}
2678#else
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002679static inline void hdd_set_tso_flags(struct hdd_context *hdd_ctx,
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002680 struct net_device *wlan_dev){}
2681#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002682
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002683void hdd_get_ibss_peer_info_cb(void *pUserData,
2684 tSirPeerInfoRspParams *pPeerInfo);
2685
Ryan Hsuceddceb2016-04-28 10:20:14 -07002686#ifdef CONFIG_CNSS_LOGGER
2687/**
2688 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2689 * @hdd_ctx: the hdd context pointer
2690 *
2691 * The nl_srv_init() will call to cnss_logger_device_register() and
2692 * expect to get a radio_index from cnss_logger module and assign to
2693 * hdd_ctx->radio_index, then to maintain the consistency to original
2694 * design, adding the radio_index check here, then return the error
2695 * code if radio_index is not assigned correctly, which means the nl_init
2696 * from cnss_logger is failed.
2697 *
2698 * Return: 0 if successfully, otherwise error code
2699 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002700static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002701{
2702 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2703
2704 /* radio_index is assigned from 0, so only >=0 will be valid index */
2705 if (hdd_ctx->radio_index >= 0)
2706 return 0;
2707 else
2708 return -EINVAL;
2709}
2710#else
2711/**
2712 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2713 * @hdd_ctx: the hdd context pointer
2714 *
2715 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2716 * the netlink socket and return the success or not.
2717 *
2718 * Return: the return value from nl_srv_init()
2719 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002720static inline int wlan_hdd_nl_init(struct hdd_context *hdd_ctx)
Ryan Hsuceddceb2016-04-28 10:20:14 -07002721{
2722 return nl_srv_init(hdd_ctx->wiphy);
2723}
2724#endif
Krunal Sonib51eec72017-11-20 21:53:01 -08002725QDF_STATUS hdd_sme_open_session_callback(uint8_t session_id);
2726QDF_STATUS hdd_sme_close_session_callback(uint8_t session_id);
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002727
Jeff Johnson9d295242017-08-29 14:39:48 -07002728int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002729 uint8_t channel, const handoff_src src);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002730int hdd_register_cb(struct hdd_context *hdd_ctx);
2731void hdd_deregister_cb(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002732int hdd_start_station_adapter(struct hdd_adapter *adapter);
2733int hdd_start_ap_adapter(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002734int hdd_configure_cds(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002735int hdd_set_fw_params(struct hdd_adapter *adapter);
Dustin Browne7e71d32018-05-11 16:00:08 -07002736int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002737int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode);
Jeff Johnson9d295242017-08-29 14:39:48 -07002738int hdd_start_adapter(struct hdd_adapter *adapter);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002739void hdd_populate_random_mac_addr(struct hdd_context *hdd_ctx, uint32_t num);
yeshwanth sriram guntukaea63f632017-08-30 19:31:56 +05302740/**
2741 * hdd_is_interface_up()- Checkfor interface up before ssr
2742 * @hdd_ctx: HDD context
2743 *
2744 * check if there are any wlan interfaces before SSR accordingly start
2745 * the interface.
2746 *
2747 * Return: 0 if interface was opened else false
2748 */
2749bool hdd_is_interface_up(struct hdd_adapter *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302750/**
2751 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2752 * @wiphy: wiphy
2753 * @channel: channel of the BSS to find
2754 * @bssid: bssid of the BSS to find
2755 * @ssid: ssid of the BSS to find
2756 * @ssid_len: ssid len of of the BSS to find
2757 *
2758 * The API is a wrapper to get bss from kernel matching the chan,
2759 * bssid and ssid
2760 *
2761 * Return: bss structure if found else NULL
2762 */
2763struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2764 struct ieee80211_channel *channel,
2765 const u8 *bssid,
2766 const u8 *ssid, size_t ssid_len);
2767
Anurag Chouhanc4092922016-09-08 15:56:11 +05302768void hdd_connect_result(struct net_device *dev, const u8 *bssid,
Jeff Johnson172237b2017-11-07 15:32:59 -08002769 struct csr_roam_info *roam_info, const u8 *req_ie,
Anurag Chouhanc4092922016-09-08 15:56:11 +05302770 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302771 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302772 bool connect_timeout,
2773 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302774
Arun Khandavallifae92942016-08-01 13:31:08 +05302775#ifdef WLAN_FEATURE_FASTPATH
2776void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2777 void *context);
2778#else
2779static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2780 void *context)
2781{
2782}
2783#endif
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002784void hdd_wlan_update_target_info(struct hdd_context *hdd_ctx, void *context);
Nirav Shaheb017be2018-02-15 11:20:58 +05302785
Agrawal Ashish65634612016-08-18 13:24:32 +05302786enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002787void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctx);
Liangwei Dong6e1a2092017-08-30 16:29:06 +08002788/**
2789 * hdd_clone_local_unsafe_chan() - clone hdd ctx unsafe chan list
2790 * @hdd_ctx: hdd context pointer
2791 * @local_unsafe_list: copied unsafe chan list array
2792 * @local_unsafe_list_count: channel number in returned local_unsafe_list
2793 *
2794 * The function will allocate memory and make a copy the current unsafe
2795 * channels from hdd ctx. The caller need to free the local_unsafe_list
2796 * memory after use.
2797 *
2798 * Return: 0 if successfully clone unsafe chan list.
2799 */
2800int hdd_clone_local_unsafe_chan(struct hdd_context *hdd_ctx,
2801 uint16_t **local_unsafe_list, uint16_t *local_unsafe_list_count);
2802
2803/**
2804 * hdd_local_unsafe_channel_updated() - check unsafe chan list same or not
2805 * @hdd_ctx: hdd context pointer
2806 * @local_unsafe_list: unsafe chan list to be compared with hdd_ctx's list
2807 * @local_unsafe_list_count: channel number in local_unsafe_list
2808 *
2809 * The function checked the input channel is same as current unsafe chan
2810 * list in hdd_ctx.
2811 *
2812 * Return: true if input channel list is same as the list in hdd_ctx
2813 */
2814bool hdd_local_unsafe_channel_updated(struct hdd_context *hdd_ctx,
2815 uint16_t *local_unsafe_list, uint16_t local_unsafe_list_count);
2816
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002817int hdd_enable_disable_ca_event(struct hdd_context *hddctx,
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302818 uint8_t set_value);
Jeff Johnson9d295242017-08-29 14:39:48 -07002819void wlan_hdd_undo_acs(struct hdd_adapter *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002820
2821#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2822static inline int
2823hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2824{
2825 return nla_put_u64(skb, attrtype, value);
2826}
2827#else
2828static inline int
2829hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2830{
2831 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2832}
2833#endif
2834
Jeff Johnson57e07512018-03-13 09:16:33 -07002835/**
2836 * hdd_roam_profile() - Get adapter's roam profile
2837 * @adapter: The adapter being queried
2838 *
2839 * Given an adapter this function returns a pointer to its roam profile.
2840 *
2841 * NOTE WELL: Caller is responsible for ensuring this interface is only
2842 * invoked for STA-type interfaces
2843 *
2844 * Return: pointer to the adapter's roam profile
2845 */
2846static inline
2847struct csr_roam_profile *hdd_roam_profile(struct hdd_adapter *adapter)
2848{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002849 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002850
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002851 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002852
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002853 return &sta_ctx->roam_profile;
Jeff Johnson57e07512018-03-13 09:16:33 -07002854}
2855
2856/**
2857 * hdd_security_ie() - Get adapter's security IE
2858 * @adapter: The adapter being queried
2859 *
2860 * Given an adapter this function returns a pointer to its security IE
2861 * buffer. Note that this buffer is maintained outside the roam
2862 * profile but, when in use, is referenced by a pointer within the
2863 * roam profile.
2864 *
2865 * NOTE WELL: Caller is responsible for ensuring this interface is only
2866 * invoked for STA-type interfaces
2867 *
2868 * Return: pointer to the adapter's roam profile security IE buffer
2869 */
2870static inline
2871uint8_t *hdd_security_ie(struct hdd_adapter *adapter)
2872{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002873 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002874
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002875 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002876
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002877 return sta_ctx->security_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07002878}
2879
2880/**
2881 * hdd_assoc_additional_ie() - Get adapter's assoc additional IE
2882 * @adapter: The adapter being queried
2883 *
2884 * Given an adapter this function returns a pointer to its assoc
2885 * additional IE buffer. Note that this buffer is maintained outside
2886 * the roam profile but, when in use, is referenced by a pointer
2887 * within the roam profile.
2888 *
2889 * NOTE WELL: Caller is responsible for ensuring this interface is only
2890 * invoked for STA-type interfaces
2891 *
2892 * Return: pointer to the adapter's assoc additional IE buffer
2893 */
2894static inline
2895tSirAddie *hdd_assoc_additional_ie(struct hdd_adapter *adapter)
2896{
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002897 struct hdd_station_ctx *sta_ctx;
Jeff Johnson57e07512018-03-13 09:16:33 -07002898
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002899 sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
Jeff Johnson57e07512018-03-13 09:16:33 -07002900
Jeff Johnsonfd9928a2018-03-19 15:17:29 -07002901 return &sta_ctx->assoc_additional_ie;
Jeff Johnson57e07512018-03-13 09:16:33 -07002902}
2903
Padma, Santhosh Kumar86747ec2018-05-29 18:28:29 +05302904/**
2905 * hdd_is_roaming_in_progress() - check if roaming is in progress
2906 * @hdd_ctx - Global HDD context
2907 *
2908 * Checks if roaming is in progress on any of the adapters
2909 *
2910 * Return: true if roaming is in progress else false
2911 */
2912bool hdd_is_roaming_in_progress(struct hdd_context *hdd_ctx);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002913void hdd_set_roaming_in_progress(bool value);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002914bool hdd_is_connection_in_progress(uint8_t *session_id,
2915 enum scan_reject_states *reason);
Jeff Johnson9d295242017-08-29 14:39:48 -07002916void hdd_restart_sap(struct hdd_adapter *ap_adapter);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002917void hdd_check_and_restart_sap_with_non_dfs_acs(void);
2918bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002919
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302920/**
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302921 * wlan_hdd_init_chan_info() - initialize channel info variables
2922 * @hdd_ctx: hdd ctx
2923 *
2924 * This API initialize channel info variables
2925 *
2926 * Return: None
2927 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002928void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07002929
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302930/**
2931 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2932 * @hdd_ctx: hdd ctx
2933 *
2934 * This API deinitialize channel info variables
2935 *
2936 * Return: None
2937 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002938void wlan_hdd_deinit_chan_info(struct hdd_context *hdd_ctx);
Jeff Johnson9d295242017-08-29 14:39:48 -07002939void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08002940
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05302941/**
2942 * hdd_check_for_opened_interfaces()- Check for interface up
2943 * @hdd_ctx: HDD context
2944 *
2945 * check if there are any wlan interfaces before starting the timer
2946 * to close the modules
2947 *
2948 * Return: 0 if interface was opened else false
2949 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07002950bool hdd_check_for_opened_interfaces(struct hdd_context *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08002951
2952#ifdef WIFI_POS_CONVERGED
2953/**
2954 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
2955 * function to send peer status to a registered application
2956 * @peer_mac: MAC address of peer
2957 * @peer_status: ePeerConnected or ePeerDisconnected
2958 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
2959 * @sessionId: SME session id, i.e. vdev_id
2960 * @chan_info: operating channel information
2961 * @dev_mode: dev mode for which indication is sent
2962 *
2963 * Return: none
2964 */
2965static inline void hdd_send_peer_status_ind_to_app(
2966 struct qdf_mac_addr *peer_mac,
2967 uint8_t peer_status,
2968 uint8_t peer_timing_meas_cap,
2969 uint8_t sessionId,
2970 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08002971 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08002972{
2973 struct wifi_pos_ch_info ch_info;
2974
Naveen Rawat6877a242017-03-23 17:15:38 -07002975 if (!chan_info) {
2976 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2977 peer_timing_meas_cap, sessionId,
2978 NULL, dev_mode);
2979 return;
2980 }
2981
Naveen Rawat910726a2017-03-06 11:42:51 -08002982 ch_info.chan_id = chan_info->chan_id;
2983 ch_info.mhz = chan_info->mhz;
2984 ch_info.band_center_freq1 = chan_info->band_center_freq1;
2985 ch_info.band_center_freq2 = chan_info->band_center_freq2;
2986 ch_info.info = chan_info->info;
2987 ch_info.reg_info_1 = chan_info->reg_info_1;
2988 ch_info.reg_info_2 = chan_info->reg_info_2;
2989 ch_info.nss = chan_info->nss;
2990 ch_info.rate_flags = chan_info->rate_flags;
2991 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
2992 ch_info.ch_width = chan_info->ch_width;
2993 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2994 peer_timing_meas_cap, sessionId,
2995 &ch_info, dev_mode);
2996}
2997#else
2998static inline void hdd_send_peer_status_ind_to_app(
2999 struct qdf_mac_addr *peer_mac,
3000 uint8_t peer_status,
3001 uint8_t peer_timing_meas_cap,
3002 uint8_t sessionId,
3003 tSirSmeChanInfo *chan_info,
Jeff Johnsonc1e62782017-11-09 09:50:17 -08003004 enum QDF_OPMODE dev_mode)
Naveen Rawat910726a2017-03-06 11:42:51 -08003005{
3006 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
3007 peer_timing_meas_cap, sessionId, chan_info, dev_mode);
3008}
3009#endif /* WIFI_POS_CONVERGENCE */
3010
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003011/**
3012 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
3013 * @adapter: Adapter data
3014 * @sval: P2P quota value
3015 *
3016 * Send P2P quota value to FW
3017 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003018 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003019 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003020int wlan_hdd_send_p2p_quota(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003021
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003022/**
3023 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
3024 * @adapter: Adapter data
3025 * @sval: MCC latency value
3026 *
3027 * Send MCC latency value to FW
3028 *
Jeff Johnson5ead5ab2018-05-06 00:11:08 -07003029 * Return: 0 success else failure
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07003030 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003031int wlan_hdd_send_mcc_latency(struct hdd_adapter *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003032
3033/**
3034 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
3035 * and PSOC object data
3036 * @psoc: Psoc object data
3037 * @vdev_id: vdev id
3038 *
3039 * Get adapter from vdev id and PSOC object data
3040 *
3041 * Return: adapter pointer
3042 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003043struct hdd_adapter *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07003044 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05303045/**
3046 * hdd_unregister_notifiers()- unregister kernel notifiers
3047 * @hdd_ctx: Hdd Context
3048 *
3049 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
3050 *
3051 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003052void hdd_unregister_notifiers(struct hdd_context *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05303053
3054/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303055 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
3056 * @hdd_ctx: HDD context
3057 *
3058 * This function sends the DBS scan selection config configuration to the
3059 * firmware via WMA
3060 *
3061 * Return: 0 - success, < 0 - failure
3062 */
Jeff Johnsond49c4a12017-08-28 12:08:05 -07003063int hdd_dbs_scan_selection_init(struct hdd_context *hdd_ctx);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05303064
3065/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05303066 * hdd_start_complete()- complete the start event
3067 * @ret: return value for complete event.
3068 *
3069 * complete the startup event and set the return in
3070 * global variable
3071 *
3072 * Return: void
3073 */
3074
3075void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303076
3077/**
3078 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
3079 * callback
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003080 * @hdd_handle: HDD handle
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303081 * @data: chip power save failure detected data
3082 *
3083 * This function reads the chip power save failure detected data and fill in
3084 * the skb with NL attributes and send up the NL event.
3085 * This callback execute in atomic context and must not invoke any
3086 * blocking calls.
3087 *
3088 * Return: none
3089 */
3090
Jeff Johnsonb7fa2562018-07-02 08:36:17 -07003091void hdd_chip_pwr_save_fail_detected_cb(hdd_handle_t hdd_handle,
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05303092 struct chip_pwr_save_fail_detected_params
3093 *data);
3094
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303095/**
Rajeev Kumar Sirasanagandlaaec0b082017-06-21 11:59:41 +05303096 * hdd_update_ie_whitelist_attr() - Copy probe req ie whitelist attrs from cfg
3097 * @ie_whitelist: output parameter
3098 * @cfg: pointer to hdd config
3099 *
3100 * Return: None
3101 */
3102void hdd_update_ie_whitelist_attr(struct probe_req_whitelist_attr *ie_whitelist,
3103 struct hdd_config *cfg);
3104
3105/**
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303106 * hdd_get_rssi_snr_by_bssid() - gets the rssi and snr by bssid from scan cache
3107 * @adapter: adapter handle
3108 * @bssid: bssid to look for in scan cache
3109 * @rssi: rssi value found
3110 * @snr: snr value found
3111 *
3112 * Return: QDF_STATUS
3113 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003114int hdd_get_rssi_snr_by_bssid(struct hdd_adapter *adapter, const uint8_t *bssid,
Hanumanth Reddy Pothula90051782017-05-04 22:14:43 +05303115 int8_t *rssi, int8_t *snr);
3116
Ganesh Kondabattini479a8ae2017-10-03 16:49:24 +05303117/**
3118 * hdd_reset_limit_off_chan() - reset limit off-channel command parameters
3119 * @adapter - HDD adapter
3120 *
3121 * Return: 0 on success and non zero value on failure
3122 */
3123int hdd_reset_limit_off_chan(struct hdd_adapter *adapter);
3124
Vignesh Viswanathan3fa1d382017-08-02 19:36:43 +05303125#if defined(WLAN_FEATURE_FILS_SK) && \
3126 (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \
3127 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)))
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303128/**
3129 * hdd_clear_fils_connection_info: API to clear fils info from roam profile and
3130 * free allocated memory
3131 * @adapter: pointer to hdd adapter
3132 *
3133 * Return: None
3134 */
Jeff Johnson9d295242017-08-29 14:39:48 -07003135void hdd_clear_fils_connection_info(struct hdd_adapter *adapter);
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303136
3137/**
3138 * hdd_update_hlp_info() - Update HLP packet received in FILS (re)assoc rsp
3139 * @dev: net device
3140 * @roam_fils_params: Fils join rsp params
3141 *
3142 * This API is used to send the received HLP packet in Assoc rsp(FILS AKM)
3143 * to the network layer.
3144 *
3145 * Return: None
3146 */
Jeff Johnson172237b2017-11-07 15:32:59 -08003147void hdd_update_hlp_info(struct net_device *dev,
3148 struct csr_roam_info *roam_info);
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303149#else
Jeff Johnson9d295242017-08-29 14:39:48 -07003150static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303151{ }
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303152static inline void hdd_update_hlp_info(struct net_device *dev,
Jeff Johnson172237b2017-11-07 15:32:59 -08003153 struct csr_roam_info *roam_info)
Vignesh Viswanathanc6d1e1c2017-09-18 12:32:49 +05303154{}
Sridhar Selvaraj8c6f5e82017-08-21 14:53:46 +05303155#endif
Dustin Brown3fb15042017-08-15 15:54:49 -07003156
3157#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
Dustin Brownc81dd412017-08-15 16:26:28 -07003158static inline void hdd_dev_setup_destructor(struct net_device *dev)
3159{
3160 dev->destructor = free_netdev;
3161}
Dustin Brown3fb15042017-08-15 15:54:49 -07003162#else
Dustin Brownc81dd412017-08-15 16:26:28 -07003163static inline void hdd_dev_setup_destructor(struct net_device *dev)
3164{
3165 dev->needs_free_netdev = true;
3166}
Dustin Brownc81dd412017-08-15 16:26:28 -07003167#endif /* KERNEL_VERSION(4, 12, 0) */
Dustin Brown3fb15042017-08-15 15:54:49 -07003168
Mohit Khannaf8f96822017-05-17 17:11:59 -07003169/**
3170 * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API
3171 * @config: hdd config
3172 *
3173 * Return: NONE
3174 */
Nirav Shahd21a2e32018-04-20 16:34:43 +05303175#ifdef CONFIG_DP_TRACE
Mohit Khannaf8f96822017-05-17 17:11:59 -07003176void hdd_dp_trace_init(struct hdd_config *config);
Nirav Shahd21a2e32018-04-20 16:34:43 +05303177#else
3178static inline
3179void hdd_dp_trace_init(struct hdd_config *config) {}
3180#endif
3181
Yun Parkff6a16a2017-09-26 16:38:18 -07003182void hdd_set_rx_mode_rps(bool enable);
Mohit Khannaf8f96822017-05-17 17:11:59 -07003183
Ganesh Kondabattini35739572017-06-21 16:26:39 +05303184/**
Nachiket Kukadebe8850b2017-09-18 15:37:00 +05303185 * hdd_drv_ops_inactivity_handler() - Timeout handler for driver ops
3186 * inactivity timer
3187 *
3188 * Return: None
3189 */
3190void hdd_drv_ops_inactivity_handler(void);
3191
3192/**
3193 * hdd_start_driver_ops_timer() - Starts driver ops inactivity timer
3194 * @drv_op: Enum indicating driver op
3195 *
3196 * Return: none
3197 */
3198void hdd_start_driver_ops_timer(int drv_op);
3199
3200/**
3201 * hdd_stop_driver_ops_timer() - Stops driver ops inactivity timer
3202 *
3203 * Return: none
3204 */
3205void hdd_stop_driver_ops_timer(void);
3206
Sravan Kumar Kairamd80c7662017-10-03 16:11:05 +05303207/**
3208 * hdd_pld_ipa_uc_shutdown_pipes() - Disconnect IPA WDI pipes during PDR
3209 *
3210 * Return: None
3211 */
3212void hdd_pld_ipa_uc_shutdown_pipes(void);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303213
3214/**
Jeff Johnson33142e62018-05-06 17:58:36 -07003215 * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100%
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303216 * (0x64). If it exceed make it 100%
3217 *
3218 * @per_index_score: per_index_score as input
3219 *
3220 * Return: per_index_score within the max limit
3221 */
3222uint32_t hdd_limit_max_per_index_score(uint32_t per_index_score);
Ashish Kumar Dhanotiya443d31f2017-10-13 12:41:19 +05303223/**
3224 * hdd_get_stainfo() - get stainfo for the specified peer
3225 * @astainfo: array of the station info in which the sta info
3226 * corresponding to mac_addr needs to be searched
3227 * @mac_addr: mac address of requested peer
3228 *
3229 * This function find the stainfo for the peer with mac_addr
3230 *
3231 * Return: stainfo if found, NULL if not found
3232 */
3233struct hdd_station_info *hdd_get_stainfo(struct hdd_station_info *astainfo,
3234 struct qdf_mac_addr mac_addr);
Abhishek Singhb6cdaf12017-11-10 14:43:39 +05303235
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303236/**
Vignesh Viswanathan21c58cb2018-05-24 15:53:58 +05303237 * hdd_component_psoc_open() - Open the legacy components
3238 * @psoc: Pointer to psoc object
3239 *
3240 * This function opens the legacy components and initializes the
3241 * component's private objects.
3242 *
3243 * Return: QDF_STATUS
3244 */
3245QDF_STATUS hdd_component_psoc_open(struct wlan_objmgr_psoc *psoc);
3246
3247/**
3248 * hdd_component_psoc_close() - Close the legacy components
3249 * @psoc: Pointer to psoc object
3250 *
3251 * This function closes the legacy components and resets the
3252 * component's private objects.
3253 *
3254 * Return: None
3255 */
3256void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc);
3257
3258/**
Nachiket Kukade98f562a2017-12-15 12:18:07 +05303259 * hdd_component_psoc_enable() - Trigger psoc enable for CLD Components
3260 *
3261 * Return: None
3262 */
3263void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc);
3264
3265/**
3266 * hdd_component_psoc_disable() - Trigger psoc disable for CLD Components
3267 *
3268 * Return: None
3269 */
3270void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc);
3271
Wen Gong3f003382018-05-14 14:26:37 +08003272#ifdef WLAN_FEATURE_MEMDUMP_ENABLE
Hanumanth Reddy Pothula07e5f992017-11-08 19:35:19 +05303273int hdd_driver_memdump_init(void);
3274void hdd_driver_memdump_deinit(void);
Wen Gong3f003382018-05-14 14:26:37 +08003275#else /* WLAN_FEATURE_MEMDUMP_ENABLE */
Wen Gongaa6d55d2018-04-26 16:33:21 +08003276static inline int hdd_driver_memdump_init(void)
3277{
3278 return 0;
3279}
3280static inline void hdd_driver_memdump_deinit(void)
3281{
3282}
Wen Gong3f003382018-05-14 14:26:37 +08003283#endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
Himanshu Agarwalb229a142017-12-21 10:16:45 +05303284/**
Hanumanth Reddy Pothula3862ca92018-01-12 16:44:10 +05303285 * hdd_is_cli_iface_up() - check if there is any cli iface up
3286 * @hdd_ctx: HDD context
3287 *
3288 * Return: return true if there is any cli iface(STA/P2P_CLI) is up
3289 * else return false
3290 */
3291bool hdd_is_cli_iface_up(struct hdd_context *hdd_ctx);
3292
Alok Kumarb64650c2018-03-23 17:05:11 +05303293/**
3294 * hdd_set_disconnect_status() - set adapter disconnection status
3295 * @hdd_adapter: Pointer to hdd adapter
3296 * @disconnecting: Disconnect status to set
3297 *
3298 * Return: None
3299 */
3300void hdd_set_disconnect_status(struct hdd_adapter *adapter, bool disconnecting);
3301
Nirav Shah73713f72018-05-17 14:50:41 +05303302#ifdef FEATURE_MONITOR_MODE_SUPPORT
Jeff Johnsond9952752018-04-18 12:15:35 -07003303/**
3304 * wlan_hdd_set_mon_chan() - Set capture channel on the monitor mode interface.
3305 * @adapter: Handle to adapter
3306 * @chan: Monitor mode channel
3307 * @bandwidth: Capture channel bandwidth
3308 *
3309 * Return: 0 on success else error code.
3310 */
3311int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3312 uint32_t bandwidth);
Nirav Shah73713f72018-05-17 14:50:41 +05303313#else
3314static inline
3315int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan,
3316 uint32_t bandwidth)
3317{
3318 return 0;
3319}
3320#endif
Jeff Johnsond9952752018-04-18 12:15:35 -07003321
Ryan Hsuaadba072018-04-20 13:01:53 -07003322/**
3323 * hdd_wlan_get_version() - Get version information
3324 * @hdd_ctx: Global HDD context
3325 * @version_len: length of the version buffer size
3326 * @version: the buffer to the version string
3327 *
3328 * This function is used to get Wlan Driver, Firmware, Hardware Version
3329 * & the Board related information.
3330 *
3331 * Return: the length of the version string
3332 */
3333uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
3334 const size_t version_len, uint8_t *version);
Rachit Kankane0dc3e852018-05-07 17:33:42 +05303335/**
3336 * hdd_assemble_rate_code() - assemble rate code to be sent to FW
3337 * @preamble: rate preamble
3338 * @nss: number of streams
3339 * @rate: rate index
3340 *
3341 * Rate code assembling is different for targets which are 11ax capable.
3342 * Check for the target support and assemble the rate code accordingly.
3343 *
3344 * Return: assembled rate code
3345 */
3346int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
3347
3348/**
3349 * hdd_set_11ax_rate() - set 11ax rate
3350 * @adapter: adapter being modified
3351 * @value: new 11ax rate code
3352 * @sap_config: pointer to SAP config to check HW mode
3353 * this will be NULL for call from STA persona
3354 *
3355 * Return: 0 on success, negative errno on failure
3356 */
3357int hdd_set_11ax_rate(struct hdd_adapter *adapter, int value,
3358 struct sap_config *sap_config);
Ryan Hsuaadba072018-04-20 13:01:53 -07003359
3360/**
3361 * hdd_update_hw_sw_info() - API to update the HW/SW information
3362 * @hdd_ctx: Global HDD context
3363 *
3364 * API to update the HW and SW information in the driver
3365 *
3366 * Note:
3367 * All the version/revision information would only be retrieved after
3368 * firmware download
3369 *
3370 * Return: None
3371 */
3372void hdd_update_hw_sw_info(struct hdd_context *hdd_ctx);
3373
Dundi Raviteja3bcf3a82018-05-22 13:24:18 +05303374/**
3375 * hdd_get_nud_stats_cb() - callback api to update the stats received from FW
3376 * @data: pointer to hdd context.
3377 * @rsp: pointer to data received from FW.
3378 * @context: callback context
3379 *
3380 * This is called when wlan driver received response event for
3381 * get arp stats to firmware.
3382 *
3383 * Return: None
3384 */
3385void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context);
3386
Jeff Johnsonb81b2e02018-06-11 19:13:11 -07003387/**
3388 * hdd_context_get_mac_handle() - get mac handle from hdd context
3389 * @hdd_ctx: Global HDD context pointer
3390 *
3391 * Retrieves the global MAC handle from the HDD context
3392 *
3393 * Return: The global MAC handle (which may be NULL)
3394 */
3395static inline
3396mac_handle_t hdd_context_get_mac_handle(struct hdd_context *hdd_ctx)
3397{
3398 return hdd_ctx ? hdd_ctx->mac_handle : NULL;
3399}
3400
3401/**
3402 * hdd_adapter_get_mac_handle() - get mac handle from hdd adapter
3403 * @adapter: HDD adapter pointer
3404 *
3405 * Retrieves the global MAC handle given an HDD adapter
3406 *
3407 * Return: The global MAC handle (which may be NULL)
3408 */
3409static inline
3410mac_handle_t hdd_adapter_get_mac_handle(struct hdd_adapter *adapter)
3411{
3412 return adapter ?
3413 hdd_context_get_mac_handle(adapter->hdd_ctx) : NULL;
3414}
3415
Jeff Johnsonea70b942018-07-02 09:42:31 -07003416/**
3417 * hdd_handle_to_context() - turn an HDD handle into an HDD context
3418 * @hdd_handle: HDD handle to be converted
3419 *
3420 * Return: HDD context referenced by @hdd_handle
3421 */
3422static inline
3423struct hdd_context *hdd_handle_to_context(hdd_handle_t hdd_handle)
3424{
3425 return (struct hdd_context *)hdd_handle;
3426}
Ashish Kumar Dhanotiya3f78e682018-03-14 11:19:27 +05303427
3428/**
3429 * wlan_hdd_free_cache_channels() - Free the cache channels list
3430 * @hdd_ctx: Pointer to HDD context
3431 *
3432 * Return: None
3433 */
3434void wlan_hdd_free_cache_channels(struct hdd_context *hdd_ctx);
3435
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003436#endif /* end #if !defined(WLAN_HDD_MAIN_H) */