blob: c83346e71eeaca0904df2e89be2f24d08a6d47a9 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined(WLAN_HDD_MAIN_H)
29#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080030/**
31 * DOC: wlan_hdd_main.h
32 *
33 * Linux HDD Adapter Type
34 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035
Jeff Johnsonef926352017-01-12 10:41:02 -080036/*
37 * Include files
38 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080039
40#include <linux/netdevice.h>
41#include <linux/skbuff.h>
42#include <net/cfg80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053043#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053044#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045#include "sir_mac_prot_def.h"
46#include "csr_api.h"
47#include <wlan_hdd_assoc.h>
48#include <wlan_hdd_wmm.h>
49#include <wlan_hdd_cfg.h>
50#include <linux/spinlock.h>
51#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
52#include <linux/wakelock.h>
53#endif
54#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070056#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080057#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053058#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080061#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070062#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070063#include "wlan_hdd_nan_datapath.h"
hqu61533822017-06-20 15:04:05 +080064#if defined(CONFIG_HL_SUPPORT)
65#include "wlan_tgt_def_config_hl.h"
66#else
Dustin Brown61269462016-09-19 13:25:45 -070067#include "wlan_tgt_def_config.h"
hqu61533822017-06-20 15:04:05 +080068#endif
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053069#include <wlan_objmgr_cmn.h>
70#include <wlan_objmgr_global_obj.h>
71#include <wlan_objmgr_psoc_obj.h>
72#include <wlan_objmgr_pdev_obj.h>
73#include <wlan_objmgr_vdev_obj.h>
74#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053075#include "wlan_pmo_ucfg_api.h"
Naveen Rawat910726a2017-03-06 11:42:51 -080076#ifdef WIFI_POS_CONVERGED
77#include "os_if_wifi_pos.h"
78#include "wifi_pos_api.h"
79#else
80#include "wlan_hdd_oemdata.h"
81#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080082#include "wlan_hdd_he.h"
83
Jeff Johnsonef926352017-01-12 10:41:02 -080084/*
85 * Preprocessor definitions and constants
86 */
87
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080088/** Number of Tx Queues */
89#ifdef QCA_LL_TX_FLOW_CONTROL_V2
90#define NUM_TX_QUEUES 5
91#else
92#define NUM_TX_QUEUES 4
93#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -080094
95/** Length of the TX queue for the netdev */
96#define HDD_NETDEV_TX_QUEUE_LEN (3000)
97
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080098/** Hdd Tx Time out value */
99#ifdef LIBRA_LINUX_PC
100#define HDD_TX_TIMEOUT (8000)
101#else
102#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
103#endif
104/** Hdd Default MTU */
105#define HDD_DEFAULT_MTU (1500)
106
107#ifdef QCA_CONFIG_SMP
108#define NUM_CPUS NR_CPUS
109#else
110#define NUM_CPUS 1
111#endif
112
113/**event flags registered net device*/
114#define NET_DEVICE_REGISTERED (0)
115#define SME_SESSION_OPENED (1)
116#define INIT_TX_RX_SUCCESS (2)
117#define WMM_INIT_DONE (3)
118#define SOFTAP_BSS_STARTED (4)
119#define DEVICE_IFACE_OPENED (5)
120#define TDLS_INIT_DONE (6)
121#define ACS_PENDING (7)
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800122#define SOFTAP_INIT_DONE (8)
123
Kapil Gupta8878ad92017-02-13 11:56:04 +0530124/* Waiting for event for vendor acs */
125#define VENDOR_ACS_RESPONSE_PENDING (8)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126
127/* HDD global event flags */
128#define ACS_IN_PROGRESS (0)
129
130/** Maximum time(ms)to wait for disconnect to complete **/
131#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530132#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530134#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800135#endif
Abhishek Singh533c9da2017-05-04 10:23:34 +0530136#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800137#define WLAN_WAIT_TIME_STATS 800
138#define WLAN_WAIT_TIME_POWER 800
139#define WLAN_WAIT_TIME_COUNTRY 1000
140#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530141#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142/* Amount of time to wait for sme close session callback.
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700143 * This value should be larger than the timeout used by WDI to wait for
Jeff Johnsonef926352017-01-12 10:41:02 -0800144 * a response from WCNSS
145 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
147#define WLAN_WAIT_TIME_ABORTSCAN 2000
148
149/** Maximum time(ms) to wait for mc thread suspend **/
150#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
151
152/** Maximum time(ms) to wait for target to be ready for suspend **/
153#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
154
155/** Maximum time(ms) to wait for tdls add sta to complete **/
156#define WAIT_TIME_TDLS_ADD_STA 1500
157
158/** Maximum time(ms) to wait for tdls del sta to complete **/
159#define WAIT_TIME_TDLS_DEL_STA 1500
160
161/** Maximum time(ms) to wait for Link Establish Req to complete **/
162#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
163
164/** Maximum time(ms) to wait for tdls mgmt to complete **/
165#define WAIT_TIME_TDLS_MGMT 11000
166
167/* Scan Req Timeout */
168#define WLAN_WAIT_TIME_SCAN_REQ 100
169
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800170#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
171#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
172
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530173#define WLAN_WAIT_TIME_BPF 1000
174
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530175/* Maximum time(ms) to wait for RSO CMD status event */
176#define WAIT_TIME_RSO_CMD_STATUS 2000
177
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178#define MAX_NUMBER_OF_ADAPTERS 4
179
180#define MAX_CFG_STRING_LEN 255
181
Kapil Gupta8878ad92017-02-13 11:56:04 +0530182/* Maximum time(ms) to wait for external acs response */
183#define WLAN_VENDOR_ACS_WAIT_TIME 1000
184
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
186/** Mac Address string **/
187#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
188#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700189/* Max and min IEs length in bytes */
190#define MAX_GENIE_LEN (512)
191#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800192
193#define WLAN_CHIP_VERSION "WCNSS"
194
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530195#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
197
198#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530199 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800200#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530201 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800202#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530203 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204#define hdd_notice(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530205 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800206#define hdd_info(format, args...) \
Srinivas Girigowda67044ad2017-03-30 21:23:51 -0700207 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530209 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530211#define ENTER() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter")
Jeff Johnson398b3d62016-02-10 17:19:39 -0800212#define ENTER_DEV(dev) \
213 hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter(%s)", (dev)->name)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530214#define EXIT() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "exit")
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215
216#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t *)(netdev_priv((__dev__)))
217
218#define MAX_NO_OF_2_4_CHANNELS 14
219
220#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
221#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
222#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
223#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
224#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
225#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
226#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
227#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
228#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
229#define WLAN_HDD_WFA_OUI 0x506F9A
230#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
231#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
232#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
233#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
234
235#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700236 (((center_freq) == 2412) || ((center_freq) == 2437) || \
237 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800238
239#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
240 (((center_freq) == 5180) || ((center_freq) == 5200) \
241 || ((center_freq) == 5220) || ((center_freq) == 5240))
242
243#ifdef WLAN_FEATURE_11W
244#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
245#endif
246
247#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
248#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800249
250#define WLAN_HDD_QOS_ACTION_FRAME 1
251#define WLAN_HDD_QOS_MAP_CONFIGURE 4
252#define HDD_SAP_WAKE_LOCK_DURATION 10000 /* in msecs */
253
Mukul Sharma974ca652016-09-03 16:24:48 +0530254#if defined(CONFIG_HL_SUPPORT)
255#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
256#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800257#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530258#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800259
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800260#define MAX_USER_COMMAND_SIZE 4096
261
262#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
263#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
264
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530265/* FW expects burst duration in 1020*ms */
266#define SIFS_BURST_DUR_MULTIPLIER 1020
267#define SIFS_BURST_DUR_MAX 12240
268
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800269/* If IPA UC data path is enabled, target should reserve extra tx descriptors
270 * for IPA data path.
271 * Then host data path should allow less TX packet pumping in case
272 * IPA data path enabled
273 */
274#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
275
Ryan Hsu07495ea2016-01-21 15:25:39 -0800276/*
277 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
278 * here if the Kernel version is less than 3.17 to avoid the interleave
279 * conditional compilation.
280 */
281#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS))
282#define NET_NAME_UNKNOWN 0
283#endif
284
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530285#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530286
287/* session ID invalid */
288#define HDD_SESSION_ID_INVALID 0xFF
289
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530290#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
291
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530292/* Default Psoc id */
293#define DEFAULT_PSOC_ID 1
294
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800295/*
296 * Generic asynchronous request/response support
297 *
298 * Many of the APIs supported by HDD require a call to SME to
299 * perform an action or to retrieve some data. In most cases SME
300 * performs the operation asynchronously, and will execute a provided
301 * callback function when the request has completed. In order to
302 * synchronize this the HDD API allocates a context which is then
303 * passed to SME, and which is then, in turn, passed back to the
304 * callback function when the operation completes. The callback
305 * function then sets a completion variable inside the context which
306 * the HDD API is waiting on. In an ideal world the HDD API would
307 * wait forever (or at least for a long time) for the response to be
308 * received and for the completion variable to be set. However in
309 * most cases these HDD APIs are being invoked in the context of a
310 * user space thread which has invoked either a cfg80211 API or a
311 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
312 * Since this lock is used to synchronize many of the kernel tasks, we
313 * do not want to hold it for a long time. In addition we do not want
314 * to block user space threads (such as the wpa supplicant's main
315 * thread) for an extended time. Therefore we only block for a short
316 * time waiting for the response before we timeout. This means that
317 * it is possible for the HDD API to timeout, and for the callback to
318 * be invoked afterwards. In order for the callback function to
319 * determine if the HDD API is still waiting, a magic value is also
320 * stored in the shared context. Only if the context has a valid
321 * magic will the callback routine do any work. In order to further
322 * synchronize these activities a spinlock is used so that if any HDD
323 * API timeout coincides with its callback, the operations of the two
324 * threads will be serialized.
325 */
326
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800327extern spinlock_t hdd_context_lock;
328
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800329/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800330 * Prevent from permanent stall, resume OS Q if timer expired
331 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800332#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
333#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
334#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
335
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700336#define NUM_TX_RX_HISTOGRAM 128
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800337#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
338
Mohit Khannae71e2262015-11-10 09:37:24 -0800339/**
340 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
341 * received over 100ms intervals
342 * @interval_rx: # of rx packets received in the last 100ms interval
343 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700344 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800345 * determined on the basis of total tx and rx packets
346 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700347 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800348 * determined on the basis of rx packets received in the
349 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700350 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800351 * determined on the basis of tx packets received in the
352 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800353 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800354 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800355 * The structure keeps track of throughput requirements of wlan driver.
356 * An entry is added if either of next_vote_level, next_rx_level or
357 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800358 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800359struct hdd_tx_rx_histogram {
360 uint64_t interval_rx;
361 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362 uint32_t next_vote_level;
363 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800364 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800365 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800366};
367
368typedef struct hdd_tx_rx_stats_s {
369 /* start_xmit stats */
370 __u32 txXmitCalled;
371 __u32 txXmitDropped;
Mohit Khannad0b63f52017-02-18 18:05:52 -0800372 __u32 txXmitOrphaned;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800373 __u32 txXmitClassifiedAC[NUM_TX_QUEUES];
374 __u32 txXmitDroppedAC[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800375
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800376 /* rx stats */
377 __u32 rxPackets[NUM_CPUS];
378 __u32 rxDropped[NUM_CPUS];
379 __u32 rxDelivered[NUM_CPUS];
380 __u32 rxRefused[NUM_CPUS];
381
382 /* txflow stats */
383 bool is_txflow_paused;
384 __u32 txflow_pause_cnt;
385 __u32 txflow_unpause_cnt;
386 __u32 txflow_timer_cnt;
387} hdd_tx_rx_stats_t;
388
389#ifdef WLAN_FEATURE_11W
390typedef struct hdd_pmf_stats_s {
391 uint8_t numUnprotDeauthRx;
392 uint8_t numUnprotDisassocRx;
393} hdd_pmf_stats_t;
394#endif
395
396typedef struct hdd_stats_s {
397 tCsrSummaryStatsInfo summary_stat;
398 tCsrGlobalClassAStatsInfo ClassA_stat;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800399 tCsrGlobalClassDStatsInfo ClassD_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530400 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800401 hdd_tx_rx_stats_t hddTxRxStats;
402#ifdef WLAN_FEATURE_11W
403 hdd_pmf_stats_t hddPmfStats;
404#endif
405} hdd_stats_t;
406
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700407enum hdd_roam_state {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800408 HDD_ROAM_STATE_NONE,
409
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700410 /* Issuing a disconnect due to transition into low power states */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800411 HDD_ROAM_STATE_DISCONNECTING_POWER,
412
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700413 /* Move to this state when HDD sets a key with SME/CSR. Note this is
414 * an important state to get right because we will get calls into our
415 * SME callback routine for SetKey activity that we did not initiate!
416 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800417 HDD_ROAM_STATE_SETTING_KEY,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700418};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800419
420typedef struct roaming_info_s {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700421 enum hdd_roam_state roamingState;
Anurag Chouhance0dc992016-02-16 18:18:03 +0530422 qdf_event_t roamingEvent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423
424 tSirMacAddr bssid;
425 tSirMacAddr peerMac;
426 uint32_t roamId;
427 eRoamCmdStatus roamStatus;
428 bool deferKeyComplete;
429
430} roaming_info_t;
431
432#ifdef FEATURE_WLAN_WAPI
433/* Define WAPI macros for Length, BKID count etc*/
434#define MAX_WPI_KEY_LENGTH 16
435#define MAX_NUM_PN 16
436#define MAC_ADDR_LEN 6
437#define MAX_ADDR_INDEX 12
438#define MAX_NUM_AKM_SUITES 16
439#define MAX_NUM_UNI_SUITES 16
440#define MAX_NUM_BKIDS 16
441
442/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700443enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800444 WAPI_AUTH_MODE_OPEN = 0,
445 WAPI_AUTH_MODE_PSK = 1,
446 WAPI_AUTH_MODE_CERT
447} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800448
449/** WAPI Work mode structure definition */
450#define WZC_ORIGINAL 0
451#define WAPI_EXTENTION 1
452
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700453struct wapi_function_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800454 unsigned char wapiMode;
455} __packed;
456
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800457typedef struct _WAPI_BKID {
458 uint8_t bkid[16];
459} WAPI_BKID, *pWAPI_BKID;
460
461/** WAPI Association information structure definition */
462struct _WAPI_AssocInfo {
463 uint8_t elementID;
464 uint8_t length;
465 uint16_t version;
466 uint16_t akmSuiteCount;
467 uint32_t akmSuite[MAX_NUM_AKM_SUITES];
468 uint16_t unicastSuiteCount;
469 uint32_t unicastSuite[MAX_NUM_UNI_SUITES];
470 uint32_t multicastSuite;
471 uint16_t wapiCability;
472 uint16_t bkidCount;
473 WAPI_BKID bkidList[MAX_NUM_BKIDS];
474} __packed;
475
476typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
477typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
478
479/** WAPI KEY Type definition */
480enum _WAPIKeyType {
481 PAIRWISE_KEY, /* 0 */
482 GROUP_KEY /* 1 */
483} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800484
485/** WAPI KEY Direction definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700486enum key_direction {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800487 None,
488 Rx,
489 Tx,
490 Rx_Tx
491} __packed;
492
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493/* WAPI KEY structure definition */
494struct WLAN_WAPI_KEY {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700495 enum _WAPIKeyType keyType;
496 enum key_direction keyDirection; /*reserved for future use */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800497 uint8_t keyId;
498 uint8_t addrIndex[MAX_ADDR_INDEX]; /*reserved for future use */
499 int wpiekLen;
500 uint8_t wpiek[MAX_WPI_KEY_LENGTH];
501 int wpickLen;
502 uint8_t wpick[MAX_WPI_KEY_LENGTH];
503 uint8_t pn[MAX_NUM_PN]; /*reserved for future use */
504} __packed;
505
506typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
507typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
508
509#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
510#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
511#define WLAN_EID_WAPI 68
512#define WAPI_PSK_AKM_SUITE 0x02721400
513#define WAPI_CERT_AKM_SUITE 0x01721400
514
515/* WAPI BKID List structure definition */
516struct _WLAN_BKID_LIST {
517 uint32_t length;
518 uint32_t BKIDCount;
519 WAPI_BKID BKID[1];
520} __packed;
521
522typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
523typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
524
525/* WAPI Information structure definition */
526struct hdd_wapi_info_s {
527 uint32_t nWapiMode;
528 bool fIsWapiSta;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530529 struct qdf_mac_addr cachedMacAddr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800530 uint8_t wapiAuthMode;
531} __packed;
532typedef struct hdd_wapi_info_s hdd_wapi_info_t;
533#endif /* FEATURE_WLAN_WAPI */
534
535typedef struct beacon_data_s {
536 u8 *head;
537 u8 *tail;
538 u8 *proberesp_ies;
539 u8 *assocresp_ies;
540 int head_len;
541 int tail_len;
542 int proberesp_ies_len;
543 int assocresp_ies_len;
544 int dtim_period;
545} beacon_data_t;
546
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700547enum rem_on_channel_request_type {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800548 REMAIN_ON_CHANNEL_REQUEST,
549 OFF_CHANNEL_ACTION_TX,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700550};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800551
552typedef struct action_pkt_buffer {
553 uint8_t *frame_ptr;
554 uint32_t frame_length;
555 uint16_t freq;
556} action_pkt_buffer_t;
557
558typedef struct hdd_remain_on_chan_ctx {
559 struct net_device *dev;
560 struct ieee80211_channel chan;
561 enum nl80211_channel_type chan_type;
562 unsigned int duration;
563 u64 cookie;
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700564 enum rem_on_channel_request_type rem_on_chan_request;
Anurag Chouhan210db072016-02-22 18:42:15 +0530565 qdf_mc_timer_t hdd_remain_on_chan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800566 action_pkt_buffer_t action_pkt_buff;
567 bool hdd_remain_on_chan_cancel_in_progress;
568 uint32_t scan_id;
569} hdd_remain_on_chan_ctx_t;
570
571/* RoC Request entry */
572typedef struct hdd_roc_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530573 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800574 hdd_adapter_t *pAdapter;
575 hdd_remain_on_chan_ctx_t *pRemainChanCtx;
576} hdd_roc_req_t;
577
578/**
579 * struct hdd_scan_req - Scan Request entry
580 * @node : List entry element
581 * @adapter: Adapter address
582 * @scan_request: scan request holder
583 * @scan_id: scan identifier used across host layers which is generated at WMI
584 * @cookie: scan request identifier sent to userspace
585 * @source: scan request originator (NL/Vendor scan)
586 * @timestamp: scan request timestamp
587 *
588 * Scan request linked list element
589 */
590struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530591 qdf_list_node_t node;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800592 hdd_adapter_t *adapter;
593 struct cfg80211_scan_request *scan_request;
594 uint32_t scan_id;
595 uint8_t source;
596 uint32_t timestamp;
597};
598
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700599enum p2p_action_frame_state {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800600 HDD_IDLE,
601 HDD_PD_REQ_ACK_PENDING,
602 HDD_GO_NEG_REQ_ACK_PENDING,
603 HDD_INVALID_STATE,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700604};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800605
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700606enum action_frm_type {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800607 WLAN_HDD_GO_NEG_REQ,
608 WLAN_HDD_GO_NEG_RESP,
609 WLAN_HDD_GO_NEG_CNF,
610 WLAN_HDD_INVITATION_REQ,
611 WLAN_HDD_INVITATION_RESP,
612 WLAN_HDD_DEV_DIS_REQ,
613 WLAN_HDD_DEV_DIS_RESP,
614 WLAN_HDD_PROV_DIS_REQ,
615 WLAN_HDD_PROV_DIS_RESP,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700616};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800617
618typedef struct hdd_cfg80211_state_s {
619 uint16_t current_freq;
620 u64 action_cookie;
621 uint8_t *buf;
622 size_t len;
623 hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
624 struct mutex remain_on_chan_ctx_lock;
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700625 enum p2p_action_frame_state actionFrmState;
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530626 /* is_go_neg_ack_received flag is set to 1 when
Jeff Johnsonef926352017-01-12 10:41:02 -0800627 * the pending ack for GO negotiation req is
628 * received.
629 */
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530630 bool is_go_neg_ack_received;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800631} hdd_cfg80211_state_t;
632
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700633/**
634 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
635 * @channel: Channel number.
636 * @cb_mode: Channel bonding
637 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
638 * @phy_mode: PHY mode
639 */
640struct hdd_mon_set_ch_info {
641 uint8_t channel;
642 uint8_t cb_mode;
643 uint32_t channel_width;
644 eCsrPhyMode phy_mode;
645};
646
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647struct hdd_station_ctx {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700648 /* Handle to the Wireless Extension State */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800649 hdd_wext_state_t WextState;
650
651#ifdef FEATURE_WLAN_TDLS
652 tdlsCtx_t *pHddTdlsCtx;
653#endif
654
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700655 /* Connection information*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656 connection_info_t conn_info;
657
658 roaming_info_t roam_info;
659
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800661
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700662 /* Increment whenever ibss New peer joins and departs the network */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800663 int ibss_sta_generation;
664
665 /* Indication of wep/wpa-none keys installation */
666 bool ibss_enc_key_installed;
667
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700668 /* Save the wep/wpa-none keys */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800669 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700670 tSirPeerInfoRspParams ibss_peer_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671
672 bool hdd_ReassocScenario;
673
674 /* STA ctx debug variables */
675 int staDebugState;
Chandrasekaran, Manishekar34e325a2015-12-18 12:07:22 +0530676
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700677 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700678
679 struct hdd_mon_set_ch_info ch_info;
Naveen Rawat97500352017-03-22 10:07:58 -0700680#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -0700681 struct nan_datapath_ctx ndp_ctx;
682#endif
Krunal Soni364e0872017-05-10 21:24:34 -0700683 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800684};
685
686#define BSS_STOP 0
687#define BSS_START 1
688typedef struct hdd_hostapd_state_s {
689 int bssState;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530690 qdf_event_t qdf_event;
691 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800692 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530693 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800694 bool bCommit;
695
696} hdd_hostapd_state_t;
697
wadesong9b819072017-02-07 16:42:09 +0800698/**
699 * enum bss_stop_reason - reasons why a BSS is stopped.
700 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
701 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
702 * driver is trying to switch AP role to a different channel
703 * to maintain SCC mode with the STA role on the same card.
704 * this usually happens when STA is connected to an external
705 * AP that runs on a different channel
706 */
707enum bss_stop_reason {
708 BSS_STOP_REASON_INVALID = 0,
709 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
710};
711
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800712/*
713 * Per station structure kept in HDD for multiple station support for SoftAP
714 */
715typedef struct {
716 /** The station entry is used or not */
717 bool isUsed;
718
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700719 /* Station ID reported back from HAL (through SAP).
720 * Broadcast uses station ID zero by default
Jeff Johnsonef926352017-01-12 10:41:02 -0800721 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800722 uint8_t ucSTAId;
723
Rachit Kankane2487f8f2017-04-19 14:30:19 +0530724 /* type of station i.e. p2p client or infrastructure station */
725 eStationType staType;
726
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727 /** MAC address of the station */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530728 struct qdf_mac_addr macAddrSTA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800729
730 /** Current Station state so HDD knows how to deal with packet
Jeff Johnsonef926352017-01-12 10:41:02 -0800731 * queue. Most recent states used to change TLSHIM STA state
732 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800733 enum ol_txrx_peer_state tlSTAState;
734
735 /** Track QoS status of station */
736 bool isQosEnabled;
737
738 /** The station entry for which Deauth is in progress */
739 bool isDeauthInProgress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530740
741 /** Number of spatial streams supported */
742 uint8_t nss;
743
744 /** Rate Flags for this connection */
745 uint32_t rate_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800746} hdd_station_info_t;
747
748struct hdd_ap_ctx_s {
749 hdd_hostapd_state_t HostapdState;
750
751 /* Memory differentiation mode is enabled */
752 /* uint16_t uMemoryDiffThreshold; */
753 /* uint8_t uNumActiveAC; */
754 /* uint8_t uActiveACMask; */
755
756 /** Packet Count to update uNumActiveAC and uActiveACMask */
757 /* uint16_t uUpdatePktCount; */
758
759 /** Station ID assigned after BSS starts */
760 uint8_t uBCStaId;
761
762 uint8_t uPrivacy; /* The privacy bits of configuration */
763
764 tSirWPSPBCProbeReq WPSPBCProbeReq;
765
766 tsap_Config_t sapConfig;
767
768 struct semaphore semWpsPBCOverlapInd;
769
770 bool apDisableIntraBssFwd;
771
Anurag Chouhan210db072016-02-22 18:42:15 +0530772 qdf_mc_timer_t hdd_ap_inactivity_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800773
774 uint8_t operatingChannel;
775
776 bool uIsAuthenticated;
777
778 eCsrEncryptionType ucEncryptType;
779
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700780 /* This will point to group key data,
781 * if it is received before start bss
782 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800783 tCsrRoamSetKey groupKey;
784 /* This will have WEP key data, if it is received before start bss */
785 tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
786
Kondabattini, Ganesh702d90e2016-09-03 01:54:22 +0530787 /* WEP default key index */
788 uint8_t wep_def_key_idx;
789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800790 beacon_data_t *beacon;
791
792 bool bApActive;
Dustin Brown5e79c102016-09-21 11:29:39 -0700793
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800794 /* SAP Context */
795 void *sapContext;
Dustin Brown5e79c102016-09-21 11:29:39 -0700796
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800797 bool dfs_cac_block_tx;
Kapil Gupta8878ad92017-02-13 11:56:04 +0530798 qdf_mc_timer_t vendor_acs_timer;
799 bool vendor_acs_timer_initialized;
wadesong9b819072017-02-07 16:42:09 +0800800
801 enum bss_stop_reason bss_stop_reason;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800802};
803
804typedef struct hdd_scaninfo_s {
805 /* The scan pending */
806 uint32_t mScanPending;
807
808 /* Counter for mScanPending so that the scan pending
Jeff Johnsonef926352017-01-12 10:41:02 -0800809 * error log is not printed for more than 5 times
810 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800811 uint32_t mScanPendingCounter;
812
813 /* Additional IE for scan */
814 tSirAddie scanAddIE;
815
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530816 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +0530817 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800818 /* Scan mode */
819 tSirScanType scan_mode;
820
821 /* completion variable for abortscan */
822 struct completion abortscan_event_var;
823
824} hdd_scaninfo_t;
825
Dustin Brown61269462016-09-19 13:25:45 -0700826#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800827
828#ifdef WLAN_FEATURE_PACKET_FILTERING
829typedef struct multicast_addr_list {
830 uint8_t isFilterApplied;
831 uint8_t mc_cnt;
832 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
833} t_multicast_add_list;
834#endif
835
836#define WLAN_HDD_MAX_HISTORY_ENTRY 10
837
838/**
839 * struct hdd_netif_queue_stats - netif queue operation statistics
840 * @pause_count - pause counter
841 * @unpause_count - unpause counter
842 */
843struct hdd_netif_queue_stats {
844 uint16_t pause_count;
845 uint16_t unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530846 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800847};
848
849/**
850 * struct hdd_netif_queue_history - netif queue operation history
851 * @time: timestamp
852 * @netif_action: action type
853 * @netif_reason: reason type
854 * @pause_map: pause map
855 */
856struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530857 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800858 uint16_t netif_action;
859 uint16_t netif_reason;
860 uint32_t pause_map;
861};
862
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530863/**
864 * struct hdd_chan_change_params - channel related information
865 * @chan: operating channel
866 * @chan_params: channel parameters
867 */
868struct hdd_chan_change_params {
869 uint8_t chan;
Amar Singhal5cccafe2017-02-15 12:42:58 -0800870 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530871};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800872
Komal Seelama89be8d2016-09-29 11:09:26 +0530873/**
Komal Seelam8634b772016-09-29 12:12:24 +0530874 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
875 * @scan: scan context to prvent/allow runtime pm
876 *
877 * Prevent Runtime PM for scan
878 */
879struct hdd_runtime_pm_context {
Komal Seelamaa75f262016-09-29 12:32:13 +0530880 qdf_runtime_lock_t roc;
Komal Seelam81cb1662016-09-29 12:39:08 +0530881 qdf_runtime_lock_t dfs;
Komal Seelam8634b772016-09-29 12:12:24 +0530882};
883
884/**
Komal Seelama89be8d2016-09-29 11:09:26 +0530885 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
886 * @connect: Runtime Connect Context
887 *
888 * Structure to hold runtime pm connect context for each adapter.
889 */
890struct hdd_connect_pm_context {
891 qdf_runtime_lock_t connect;
892};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530894/*
895 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
896 * belonging to this driver from net devices belonging to other devices.
897 * Therefore, the magic number must be unique relative to the numbers for
898 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
899 * (e.g. by compiler argument), then use that. If it's not already defined,
900 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
901 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
902 */
903#ifndef WLAN_HDD_ADAPTER_MAGIC
904#ifdef MULTI_IF_NAME
905#define WLAN_HDD_ADAPTER_MAGIC \
906 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
907 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
908 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
909 (MULTI_IF_NAME[1] << 16) : \
910 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
911 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
912#else
Komal Seelama89be8d2016-09-29 11:09:26 +0530913#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530914#endif
915#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800916
917struct hdd_adapter_s {
Jeff Johnsond399e902015-12-17 15:17:02 -0800918 /* Magic cookie for adapter sanity verification. Note that this
919 * needs to be at the beginning of the private data structure so
920 * that it will exists at the beginning of dev->priv and hence
921 * will always be in mapped memory
922 */
923 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800924
Jeff Johnsond399e902015-12-17 15:17:02 -0800925 void *pHddCtx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530926 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800927
Leo Changfdb45c32016-10-28 11:09:23 -0700928 void *txrx_vdev;
929
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800930 /** Handle to the network device */
931 struct net_device *dev;
932
Krunal Soni276241e2016-03-10 12:58:11 -0800933 enum tQDF_ADAPTER_MODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -0800934
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800935 /** IPv4 notifier callback for handling ARP offload on change in IP */
936 struct work_struct ipv4NotifierWorkQueue;
937#ifdef WLAN_NS_OFFLOAD
938 /** IPv6 notifier callback for handling NS offload on change in IP */
939 struct work_struct ipv6NotifierWorkQueue;
940#endif
941
942 /* TODO Move this to sta Ctx */
943 struct wireless_dev wdev;
944 struct cfg80211_scan_request *request;
bings4c6cecf2017-04-05 08:24:29 +0800945 uint8_t scan_source;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800946
947 /** ops checks if Opportunistic Power Save is Enable or Not
948 * ctw stores ctWindow value once we receive Opps command from
949 * wpa_supplicant then using ctWindow value we need to Enable
950 * Opportunistic Power Save
951 */
952 uint8_t ops;
953 uint32_t ctw;
954
955 /** Current MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530956 struct qdf_mac_addr macAddressCurrent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800957
958 /**Event Flags*/
959 unsigned long event_flags;
960
961 /**Device TX/RX statistics*/
962 struct net_device_stats stats;
963 /** HDD statistics*/
964 hdd_stats_t hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -0800965
966 /* estimated link speed */
967 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800968
969 uint8_t sessionId;
970
971 /* Completion variable for session close */
972 struct completion session_close_comp_var;
973
974 /* Completion variable for session open */
975 struct completion session_open_comp_var;
976
977 /* TODO: move these to sta ctx. These may not be used in AP */
978 /** completion variable for disconnect callback */
979 struct completion disconnect_comp_var;
980
Abhishek Singh533c9da2017-05-04 10:23:34 +0530981 struct completion roaming_comp_var;
982
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800983 /** Completion of change country code */
984 struct completion change_country_code;
985
986 /* completion variable for Linkup Event */
987 struct completion linkup_event_var;
988
989 /* completion variable for cancel remain on channel Event */
990 struct completion cancel_rem_on_chan_var;
991
992 /* completion variable for off channel remain on channel Event */
993 struct completion offchannel_tx_event;
994 /* Completion variable for action frame */
995 struct completion tx_action_cnf_event;
996 /* Completion variable for remain on channel ready */
997 struct completion rem_on_chan_ready_event;
998
999 struct completion sta_authorized_event;
1000#ifdef FEATURE_WLAN_TDLS
1001 struct completion tdls_add_station_comp;
1002 struct completion tdls_del_station_comp;
1003 struct completion tdls_mgmt_comp;
1004 struct completion tdls_link_establish_req_comp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301005 QDF_STATUS tdlsAddStaStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001006#endif
1007
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001008 struct completion ibss_peer_info_comp;
1009
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001010 /* Track whether the linkup handling is needed */
1011 bool isLinkUpSvcNeeded;
1012
1013 /* Mgmt Frames TX completion status code */
1014 uint32_t mgmtTxCompletionStatus;
1015
1016 /* WMM Status */
Srinivas Girigowdaea32d6a2017-03-25 00:03:12 -07001017 struct hdd_wmm_status hddWmmStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001018/*************************************************************
1019 */
1020/*************************************************************
1021 * TODO - Remove it later
1022 */
1023 /** Multiple station supports */
1024 /** Per-station structure */
1025 spinlock_t staInfo_lock; /* To protect access to station Info */
1026 hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
1027 /* uint8_t uNumActiveStation; */
1028
1029/*************************************************************
1030 */
1031
1032#ifdef FEATURE_WLAN_WAPI
1033 hdd_wapi_info_t wapi_info;
1034#endif
1035
1036 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301037 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001038#ifdef WLAN_FEATURE_LPSS
1039 bool rssi_send;
1040#endif
1041
1042 uint8_t snr;
1043
1044 struct work_struct monTxWorkQueue;
1045 struct sk_buff *skb_to_tx;
1046
1047 union {
1048 hdd_station_ctx_t station;
1049 hdd_ap_ctx_t ap;
1050 } sessionCtx;
1051
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001052#ifdef WLAN_FEATURE_TSF
1053 /* tsf value received from firmware */
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001054 uint64_t cur_target_time;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001055 uint64_t tsf_sync_soc_timer;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001056#endif
1057
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001058 hdd_cfg80211_state_t cfg80211State;
1059
1060#ifdef WLAN_FEATURE_PACKET_FILTERING
1061 t_multicast_add_list mc_addr_list;
1062#endif
1063 uint8_t addr_filter_pattern;
1064
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001065 bool higherDtimTransition;
1066 bool survey_idx;
1067
1068 hdd_scaninfo_t scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001069
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001070 /* Flag to ensure PSB is configured through framework */
1071 uint8_t psbChanged;
1072 /* UAPSD psb value configured through framework */
1073 uint8_t configuredPsb;
1074#ifdef IPA_OFFLOAD
1075 void *ipa_context;
1076#endif
1077 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1078 * since CSR (PMAC Struct) Config is same for both AP
1079 */
1080 struct delayed_work acs_pending_work;
1081
1082 struct work_struct scan_block_work;
1083#ifdef MSM_PLATFORM
1084 unsigned long prev_rx_packets;
1085 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301086 uint64_t prev_fwd_tx_packets;
1087 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001088 int connection;
1089#endif
1090 bool is_roc_inprogress;
1091
1092#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301093 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001094 bool tx_flow_timer_initialized;
1095 unsigned int tx_flow_low_watermark;
1096 unsigned int tx_flow_high_watermark_offset;
1097#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1098 bool offloads_configured;
1099
1100 /* DSCP to UP QoS Mapping */
1101 sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP + 1];
1102
1103#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1104 bool isLinkLayerStatsSet;
1105#endif
1106 uint8_t linkStatus;
1107
1108 /* variable for temperature in Celsius */
1109 int temperature;
1110
1111 /* Time stamp for last completed RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301112 uint64_t last_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001113
1114 /* Time stamp for start RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301115 uint64_t start_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001116
Agrawal Ashishb141b092016-09-02 19:59:26 +05301117#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001118 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301119 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001120 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301121#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001122
1123 /* BITMAP indicating pause reason */
1124 uint32_t pause_map;
1125 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301126 qdf_time_t start_time;
1127 qdf_time_t last_time;
1128 qdf_time_t total_pause_time;
1129 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001130 uint8_t history_index;
1131 struct hdd_netif_queue_history
1132 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1133 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001134 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001135 /* debugfs entry */
1136 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301137 /*
1138 * The pre cac channel is saved here and will be used when the SAP's
1139 * channel needs to be moved from the existing 2.4GHz channel.
1140 */
1141 uint8_t pre_cac_chan;
Komal Seelama89be8d2016-09-29 11:09:26 +05301142 struct hdd_connect_pm_context connect_rpm_ctx;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001143
1144 bool fast_roaming_allowed;
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001145 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301146 * Indicate if HO fails during disconnect so that
1147 * disconnect is not initiated by HDD as its already
1148 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001149 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301150 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301151 struct lfr_firmware_status lfr_fw_status;
Ajit Pal Singh747b6802017-05-24 15:42:03 +05301152 /*
1153 * Store the restrict_offchannel count
1154 * to cater to multiple application.
1155 */
1156 u8 restrict_offchannel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001157};
1158
1159#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
1160#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
1161#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.station.WextState)
1162#define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t *)pAdapter->pHddCtx)
1163#define WLAN_HDD_GET_HAL_CTX(pAdapter) (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
1164#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
1165#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001166#define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001167#ifdef FEATURE_WLAN_TDLS
1168#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
Krunal Soni276241e2016-03-10 12:58:11 -08001169 (((QDF_STA_MODE != pAdapter->device_mode) && \
1170 (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001171#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \
1172 ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \
1173 (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
1174#endif
1175
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001176#ifdef WLAN_FEATURE_NAN_DATAPATH
Naveen Rawat97500352017-03-22 10:07:58 -07001177#ifndef WLAN_FEATURE_NAN_CONVERGENCE
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001178#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \
1179 (&(adapter)->sessionCtx.station.ndp_ctx)
Naveen Rawat97500352017-03-22 10:07:58 -07001180#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001181#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001182#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001183/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1184 * intentionally so that all references to these must be within NDP code.
1185 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1186 * invoke NDP code to do all work.
1187 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001188#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001189#endif
1190
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001191/* Set mac address locally administered bit */
1192#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1193
1194#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1195#define HDD_RESET_MCC_P2P_QUOTA 50
1196
1197typedef struct hdd_adapter_list_node {
Anurag Chouhanffb21542016-02-17 14:33:03 +05301198 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001199 hdd_adapter_t *pAdapter;
1200} hdd_adapter_list_node_t;
1201
1202typedef struct hdd_priv_data_s {
1203 uint8_t *buf;
1204 int used_len;
1205 int total_len;
1206} hdd_priv_data_t;
1207
1208#define MAX_MOD_LOGLEVEL 10
1209typedef struct {
1210 uint8_t enable;
1211 uint8_t dl_type;
1212 uint8_t dl_report;
1213 uint8_t dl_loglevel;
1214 uint8_t index;
1215 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1216
1217} fw_log_info;
1218
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001219/**
1220 * enum antenna_mode - number of TX/RX chains
1221 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1222 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1223 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1224 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1225 */
1226enum antenna_mode {
1227 HDD_ANTENNA_MODE_INVALID,
1228 HDD_ANTENNA_MODE_1X1,
1229 HDD_ANTENNA_MODE_2X2,
1230 HDD_ANTENNA_MODE_MAX
1231};
1232
1233/**
1234 * enum smps_mode - SM power save mode
1235 * @HDD_SMPS_MODE_STATIC: Static power save
1236 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1237 * @HDD_SMPS_MODE_RESERVED: Reserved
1238 * @HDD_SMPS_MODE_DISABLED: Disable power save
1239 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1240 */
1241enum smps_mode {
1242 HDD_SMPS_MODE_STATIC,
1243 HDD_SMPS_MODE_DYNAMIC,
1244 HDD_SMPS_MODE_RESERVED,
1245 HDD_SMPS_MODE_DISABLED,
1246 HDD_SMPS_MODE_MAX
1247};
1248
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001249#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1250/**
1251 * struct hdd_offloaded_packets - request id to pattern id mapping
1252 * @request_id: request id
1253 * @pattern_id: pattern id
1254 *
1255 */
1256struct hdd_offloaded_packets {
1257 uint32_t request_id;
1258 uint8_t pattern_id;
1259};
1260
1261/**
1262 * struct hdd_offloaded_packets_ctx - offloaded packets context
1263 * @op_table: request id to pattern id table
1264 * @op_lock: mutex lock
1265 */
1266struct hdd_offloaded_packets_ctx {
1267 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1268 struct mutex op_lock;
1269};
1270#endif
1271
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301272/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301273 * enum driver_status: Driver Modules status
1274 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1275 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1276 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1277 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1278 */
1279enum driver_modules_status {
1280 DRIVER_MODULES_UNINITIALIZED,
1281 DRIVER_MODULES_OPENED,
1282 DRIVER_MODULES_ENABLED,
1283 DRIVER_MODULES_CLOSED
1284};
1285
Agrawal Ashish65634612016-08-18 13:24:32 +05301286/**
1287 * struct acs_dfs_policy - Define ACS policies
1288 * @acs_dfs_mode: Dfs mode enabled/disabled.
1289 * @acs_channel: pre defined channel to avoid ACS.
1290 */
1291struct acs_dfs_policy {
1292 enum dfs_mode acs_dfs_mode;
1293 uint8_t acs_channel;
1294};
1295
Dustin Brown105d7902016-10-03 16:27:59 -07001296/**
1297 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1298 * SUSPEND_FAIL_IPA: IPA in progress
1299 * SUSPEND_FAIL_RADAR: radar scan in progress
1300 * SUSPEND_FAIL_ROAM: roaming in progress
1301 * SUSPEND_FAIL_SCAN: scan in progress
1302 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1303 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1304 */
1305enum suspend_fail_reason {
1306 SUSPEND_FAIL_IPA,
1307 SUSPEND_FAIL_RADAR,
1308 SUSPEND_FAIL_ROAM,
1309 SUSPEND_FAIL_SCAN,
1310 SUSPEND_FAIL_INITIAL_WAKEUP,
1311 SUSPEND_FAIL_MAX_COUNT
1312};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001313
Dustin Brownd9322482017-01-09 12:46:03 -08001314/**
1315 * suspend_resume_stats - Collection of counters for suspend/resume events
1316 * @suspends: number of suspends completed
1317 * @resumes: number of resumes completed
1318 * @suspend_fail: counters for failed suspend reasons
1319 */
1320struct suspend_resume_stats {
1321 uint32_t suspends;
1322 uint32_t resumes;
1323 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1324};
1325
Dustin Brown105d7902016-10-03 16:27:59 -07001326/** Adapter structure definition */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001327struct hdd_context_s {
1328 /** Global CDS context */
1329 v_CONTEXT_t pcds_context;
1330
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301331 struct wlan_objmgr_psoc *hdd_psoc;
1332 struct wlan_objmgr_pdev *hdd_pdev;
1333
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001334 /** HAL handle...*/
1335 tHalHandle hHal;
1336
1337 struct wiphy *wiphy;
1338 /* TODO Remove this from here. */
1339
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301340 qdf_spinlock_t hdd_adapter_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301341 qdf_list_t hddAdapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342
Srinivas Girigowda85218af2017-03-25 13:21:40 -07001343 /* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1344 * 1 for WDS_STAID
1345 */
1346 hdd_adapter_t *sta_to_adapter[WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001347
1348 /** Pointer for firmware image data */
1349 const struct firmware *fw;
1350
1351 /** Pointer for configuration data */
1352 const struct firmware *cfg;
1353
1354 /** Pointer to the parent device */
1355 struct device *parent_dev;
1356
1357 /** Config values read from qcom_cfg.ini file */
1358 struct hdd_config *config;
1359
1360 struct wlan_hdd_ftm_status ftm;
1361
1362 /* Completion variable to indicate Mc Thread Suspended */
1363 struct completion mc_sus_event_var;
1364
Rajeev Kumareada0d02016-12-08 17:44:17 -08001365 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001366
1367#ifdef QCA_CONFIG_SMP
1368 bool is_ol_rx_thread_suspended;
1369#endif
1370
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001371 bool hdd_wlan_suspended;
1372 bool suspended;
1373
1374 /* Lock to avoid race condition during start/stop bss */
1375 struct mutex sap_lock;
1376
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001377#ifdef FEATURE_OEM_DATA_SUPPORT
1378 /* OEM App registered or not */
1379 bool oem_app_registered;
1380
1381 /* OEM App Process ID */
1382 int32_t oem_pid;
1383#endif
1384
1385 /** Concurrency Parameters*/
1386 uint32_t concurrency_mode;
1387
Anurag Chouhan6d760662016-02-20 16:05:43 +05301388 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1389 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001390
1391 /** P2P Device MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301392 struct qdf_mac_addr p2pDeviceAddress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001393
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301394 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301395 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001396
1397#ifdef FEATURE_WLAN_TDLS
Srinivas Girigowda17d35172017-03-25 15:56:25 -07001398 enum tdls_support_mode tdls_mode;
1399 enum tdls_support_mode tdls_mode_last;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001400 tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
1401 /* maximum TDLS station number allowed upon runtime condition */
1402 uint16_t max_num_tdls_sta;
1403 /* TDLS peer connected count */
1404 uint16_t connected_peer_count;
1405 tdls_scan_context_t tdls_scan_ctxt;
1406 /* Lock to avoid race condition during TDLS operations */
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001407 qdf_spinlock_t tdls_ct_spinlock;
Ganesh Kondabattini5159c432016-12-26 20:07:33 +05301408 /* linear mac address table for counting the packets */
1409 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
1410 /* number of valid mac entry in @ct_peer_mac_table */
1411 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001412 struct mutex tdls_lock;
1413 uint8_t tdls_off_channel;
1414 uint16_t tdls_channel_offset;
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301415 int32_t tdls_fw_off_chan_mode;
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001416 bool enable_tdls_connection_tracker;
1417 uint8_t tdls_external_peer_count;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001418 bool tdls_nss_switch_in_progress;
Kabilan Kannanff89f742016-08-15 18:14:10 -07001419 bool tdls_nss_teardown_complete;
1420 enum tdls_nss_transition_type tdls_nss_transition_mode;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001421 int32_t tdls_teardown_peers_cnt;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001422 struct tdls_set_state_info set_state_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001423#endif
1424
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001425 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001426
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001427 /* Use below lock to protect access to isSchedScanUpdatePending
1428 * since it will be accessed in two different contexts.
1429 */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301430 qdf_spinlock_t sched_scan_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001431
1432 /* Flag keeps track of wiphy suspend/resume */
1433 bool isWiphySuspended;
1434
1435 /* Indicates about pending sched_scan results */
1436 bool isSchedScanUpdatePending;
1437
1438#ifdef MSM_PLATFORM
1439 /* DDR bus bandwidth compute timer
1440 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301441 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001442 bool bus_bw_timer_running;
1443 qdf_spinlock_t bus_bw_timer_lock;
1444 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001445 int cur_vote_level;
1446 spinlock_t bus_bw_lock;
1447 int cur_rx_level;
1448 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001449 int cur_tx_level;
1450 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001452
1453 struct completion ready_to_suspend;
1454 /* defining the solution type */
1455 uint32_t target_type;
1456
1457 /* defining the firmware version */
1458 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001459 uint32_t target_fw_vers_ext;
Arif Hussain1969ec82016-07-08 10:37:01 -07001460 qdf_atomic_t dfs_radar_found;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001461
1462 /* defining the chip/rom version */
1463 uint32_t target_hw_version;
1464 /* defining the chip/rom revision */
1465 uint32_t target_hw_revision;
1466 /* chip/rom name */
1467 const char *target_hw_name;
1468 struct regulatory reg;
1469#ifdef FEATURE_WLAN_CH_AVOID
1470 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001471 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001472#endif /* FEATURE_WLAN_CH_AVOID */
1473
1474 uint8_t max_intf_count;
1475 uint8_t current_intf_count;
1476#ifdef WLAN_FEATURE_LPSS
1477 uint8_t lpss_support;
1478#endif
1479 uint8_t ap_arpns_support;
1480 tSirScanType ioctl_scan_mode;
1481
1482#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301483 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001484#endif
1485
1486 struct work_struct sap_start_work;
1487 bool is_sap_restart_required;
1488 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301489 qdf_spinlock_t sap_update_info_lock;
1490 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001491
1492 uint8_t dev_dfs_cac_status;
1493
1494 bool btCoexModeSet;
1495#ifdef FEATURE_GREEN_AP
1496 struct hdd_green_ap_ctx *green_ap_ctx;
1497#endif
1498 fw_log_info fw_log_settings;
1499#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301500 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001501 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001502 uint8_t *last_acs_channel_list;
1503 uint8_t num_of_channels;
1504 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001505#endif
1506
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301507 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001508 atomic_t sap_dfs_ref_cnt;
1509
1510#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1511 bool is_extwow_app_type1_param_set;
1512 bool is_extwow_app_type2_param_set;
1513 bool ext_wow_should_suspend;
1514 struct completion ready_to_extwow;
1515#endif
1516
1517 /* Time since boot up to extscan start (in micro seconds) */
1518 uint64_t ext_scan_start_since_boot;
1519 unsigned long g_event_flags;
1520 /* RoC request queue and work */
1521 struct delayed_work roc_req_work;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301522 qdf_spinlock_t hdd_roc_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301523 qdf_list_t hdd_roc_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001524#ifndef NAPIER_SCAN
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301525 qdf_spinlock_t hdd_scan_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301526 qdf_list_t hdd_scan_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001527#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001528 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301529
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001530#ifdef WLAN_NS_OFFLOAD
1531 /* IPv6 notifier callback for handling NS offload on change in IP */
1532 struct notifier_block ipv6_notifier;
1533#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301534 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001535 /* IPv4 notifier callback for handling ARP offload on change in IP */
1536 struct notifier_block ipv4_notifier;
1537
1538 /* number of rf chains supported by target */
1539 uint32_t num_rf_chains;
1540 /* Is htTxSTBC supported by target */
1541 uint8_t ht_tx_stbc_supported;
1542#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1543 struct hdd_offloaded_packets_ctx op_ctx;
1544#endif
1545 bool mcc_mode;
1546#ifdef WLAN_FEATURE_MEMDUMP
1547 uint8_t *fw_dump_loc;
1548 uint32_t dump_loc_paddr;
Anurag Chouhan210db072016-02-22 18:42:15 +05301549 qdf_mc_timer_t memdump_cleanup_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001550 struct mutex memdump_lock;
1551 bool memdump_in_progress;
Sachin Ahuja02dd2e72016-09-03 16:17:51 +05301552 bool memdump_init_done;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001553#endif /* WLAN_FEATURE_MEMDUMP */
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301554 uint16_t driver_dump_size;
1555 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001556
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001557 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301558 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001559
1560 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301561 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001562
Krunal Sonie3531942016-04-12 17:43:53 -07001563 /*
1564 * place to store FTM capab of target. This allows changing of FTM capab
1565 * at runtime and intersecting it with target capab before updating.
1566 */
1567 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001568 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001569 /* completion variable to indicate set antenna mode complete*/
1570 struct completion set_antenna_mode_cmpl;
1571 /* Current number of TX X RX chains being used */
1572 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301573 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001574
1575 /* the radio index assigned by cnss_logger */
1576 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301577 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301578 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301579 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001580#ifdef WLAN_FEATURE_NAN_DATAPATH
1581 bool nan_datapath_enabled;
1582#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301583 /* Present state of driver cds modules */
1584 enum driver_modules_status driver_status;
1585 /* MC timer interface change */
1586 qdf_mc_timer_t iface_change_timer;
1587 /* Interface change lock */
1588 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301589 bool rps;
1590 bool enableRxThread;
1591 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301592 bool stop_modules_in_progress;
1593 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001594 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301595 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301596 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001597 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301598 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301599 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301600 struct scan_chan_info *chan_info;
1601 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301602 /* bit map to set/reset TDLS by different sources */
1603 unsigned long tdls_source_bitmap;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301604 /* tdls source timer to enable/disable TDLS on p2p listen */
1605 qdf_mc_timer_t tdls_source_timer;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001606 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001607 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301608 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301609 uint8_t last_scan_reject_session_id;
1610 enum scan_reject_states last_scan_reject_reason;
1611 unsigned long last_scan_reject_timestamp;
Arif Hussain759a0232017-03-20 13:17:18 -07001612 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001613 bool reg_offload;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301614#ifdef FEATURE_WLAN_CH_AVOID
1615 tHddAvoidFreqList coex_avoid_freq_list;
1616 tHddAvoidFreqList dnbs_avoid_freq_list;
1617 /* Lock to control access to dnbs and coex avoid freq list */
1618 struct mutex avoid_freq_lock;
1619#endif
Yu Wangf5d5b5f2017-05-25 22:38:32 +08001620#ifdef WLAN_FEATURE_TSF
1621 /* indicate whether tsf has been initialized */
1622 qdf_atomic_t tsf_ready_flag;
1623 /* indicate whether it's now capturing tsf(updating tstamp-pair) */
1624 qdf_atomic_t cap_tsf_flag;
1625 /* the context that is capturing tsf */
1626 hdd_adapter_t *cap_tsf_context;
1627#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001628};
1629
Kapil Gupta086c6202016-12-11 18:17:06 +05301630/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301631 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1632 * @channel_count: channel count
1633 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301634 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301635 * @vendor_pcl_list: pointer to pcl list
1636 * @vendor_weight_list: pointer to pcl weight list
1637 */
1638struct hdd_vendor_acs_chan_params {
1639 uint32_t channel_count;
1640 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301641 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301642 uint8_t *vendor_pcl_list;
1643 uint8_t *vendor_weight_list;
1644};
1645
1646/**
1647 * struct hdd_external_acs_timer_context - acs timer context
1648 * @reason: reason for acs trigger
1649 * @adapter: hdd adapter for acs
1650 */
1651struct hdd_external_acs_timer_context {
1652 int8_t reason;
1653 hdd_adapter_t *adapter;
1654};
1655
1656/**
1657 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301658 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301659 * @pri_ch: primary channel
1660 * @ht_sec_ch: secondary channel
1661 * @vht_seg0_center_ch: segment0 for vht
1662 * @vht_seg1_center_ch: vht segment 1
1663 * @chan_width: channel width
1664 */
1665struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05301666 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301667 uint8_t pri_ch;
1668 uint8_t ht_sec_ch;
1669 uint8_t vht_seg0_center_ch;
1670 uint8_t vht_seg1_center_ch;
1671 uint8_t chan_width;
1672};
1673
1674/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301675 * struct hdd_channel_info - standard channel info
1676 * @freq: Freq in Mhz
1677 * @flags: channel info flags
1678 * @flagext: extended channel info flags
1679 * @ieee_chan_number: channel number
1680 * @max_reg_power: max tx power according to regulatory
1681 * @max_radio_power: max radio power
1682 * @min_radio_power: min radio power
1683 * @reg_class_id: regulatory class
1684 * @max_antenna_gain: max antenna gain allowed on channel
1685 * @vht_center_freq_seg0: vht center freq segment 0
1686 * @vht_center_freq_seg1: vht center freq segment 1
1687 */
1688struct hdd_channel_info {
1689 u_int16_t freq;
1690 u_int32_t flags;
1691 u_int16_t flagext;
1692 u_int8_t ieee_chan_number;
1693 int8_t max_reg_power;
1694 int8_t max_radio_power;
1695 int8_t min_radio_power;
1696 u_int8_t reg_class_id;
1697 u_int8_t max_antenna_gain;
1698 u_int8_t vht_center_freq_seg0;
1699 u_int8_t vht_center_freq_seg1;
1700};
1701
Jeff Johnsonef926352017-01-12 10:41:02 -08001702/*
1703 * Function declarations and documentation
1704 */
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301705int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter,
1706 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001707 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001708#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1709void wlan_hdd_check_sta_ap_concurrent_ch_intf(void *sta_pAdapter);
1710#endif
1711
1712const char *hdd_device_mode_to_string(uint8_t device_mode);
1713
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301714QDF_STATUS hdd_get_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001715 hdd_adapter_list_node_t **ppAdapterNode);
1716
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301717QDF_STATUS hdd_get_next_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001718 hdd_adapter_list_node_t *pAdapterNode,
1719 hdd_adapter_list_node_t **pNextAdapterNode);
1720
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301721QDF_STATUS hdd_remove_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722 hdd_adapter_list_node_t *pAdapterNode);
1723
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301724QDF_STATUS hdd_remove_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001725 hdd_adapter_list_node_t **ppAdapterNode);
1726
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301727QDF_STATUS hdd_add_adapter_back(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001728 hdd_adapter_list_node_t *pAdapterNode);
1729
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301730QDF_STATUS hdd_add_adapter_front(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001731 hdd_adapter_list_node_t *pAdapterNode);
1732
1733hdd_adapter_t *hdd_open_adapter(hdd_context_t *pHddCtx, uint8_t session_type,
1734 const char *name, tSirMacAddr macAddr,
Ryan Hsu07495ea2016-01-21 15:25:39 -08001735 unsigned char name_assign_type,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001736 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301737QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001738 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301739QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
1740QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
Hanumanth Reddy Pothula9f4048f2016-09-30 15:06:57 +05301741void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301742QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
1743QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001744hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
1745 uint32_t vdev_id);
1746hdd_adapter_t *hdd_get_adapter_by_macaddr(hdd_context_t *pHddCtx,
1747 tSirMacAddr macAddr);
Dustin Brownd28772b2017-03-17 14:16:07 -07001748
1749int hdd_vdev_create(hdd_adapter_t *adapter);
1750int hdd_vdev_destroy(hdd_adapter_t *adapter);
1751int hdd_vdev_ready(hdd_adapter_t *adapter);
1752
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301753QDF_STATUS hdd_init_station_mode(hdd_adapter_t *pAdapter);
Krunal Soni276241e2016-03-10 12:58:11 -08001754hdd_adapter_t *hdd_get_adapter(hdd_context_t *pHddCtx,
1755 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001756void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
1757 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301758QDF_STATUS hdd_stop_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001759 const bool bCloseSession);
1760void hdd_set_station_ops(struct net_device *pWlanDev);
1761uint8_t *wlan_hdd_get_intf_addr(hdd_context_t *pHddCtx);
1762void wlan_hdd_release_intf_addr(hdd_context_t *pHddCtx, uint8_t *releaseAddr);
Krunal Soni276241e2016-03-10 12:58:11 -08001763uint8_t hdd_get_operating_channel(hdd_context_t *pHddCtx,
1764 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001765
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001766void hdd_set_conparam(uint32_t con_param);
Anurag Chouhan6d760662016-02-20 16:05:43 +05301767enum tQDF_GLOBAL_CON_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001768
1769void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +05301770 uint32_t scan_id, eCsrAbortReason reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001771void hdd_cleanup_actionframe(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
1772
1773void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
1774void wlan_hdd_reset_prob_rspies(hdd_adapter_t *pHostapdAdapter);
1775void hdd_prevent_suspend(uint32_t reason);
1776void hdd_allow_suspend(uint32_t reason);
1777void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001778
1779void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301780QDF_STATUS hdd_set_ibss_power_save_params(hdd_adapter_t *pAdapter);
1781QDF_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001782void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
1783int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
Dustin Brownf13b8c32017-05-19 17:23:08 -07001784
1785/**
1786 * hdd_validate_adapter() - Validate the given adapter
1787 * @adapter: the adapter to validate
1788 *
1789 * This function validates the given adapter, and ensures that it is open.
1790 *
1791 * Return: Errno
1792 */
1793int hdd_validate_adapter(hdd_adapter_t *adapter);
1794
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001795bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301796QDF_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
Arun Khandavallica892f62017-05-26 14:25:50 +05301797bool wlan_hdd_validate_modules_state(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001798
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001799struct qdf_mac_addr *
1800hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
1801 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001802void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001803#ifdef MSM_PLATFORM
Dustin Brown5ec6b552017-03-31 12:11:40 -07001804/**
1805 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
1806 * @hdd_ctx: the global hdd context
1807 *
1808 * Return: None
1809 */
1810void hdd_bus_bw_compute_timer_start(hdd_context_t *hdd_ctx);
1811
1812/**
1813 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
1814 * @hdd_ctx: the global hdd context
1815 *
1816 * This function ensures there is at least one adapter in the associated state
1817 * before starting the bandwidth timer.
1818 *
1819 * Return: None
1820 */
1821void hdd_bus_bw_compute_timer_try_start(hdd_context_t *hdd_ctx);
1822
1823/**
1824 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
1825 * @hdd_ctx: the global hdd context
1826 *
1827 * Return: None
1828 */
1829void hdd_bus_bw_compute_timer_stop(hdd_context_t *hdd_ctx);
1830
1831/**
1832 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
1833 * @hdd_ctx: the global hdd context
1834 *
1835 * This function ensures there are no adapters in the associated state before
1836 * stopping the bandwidth timer.
1837 *
1838 * Return: None
1839 */
1840void hdd_bus_bw_compute_timer_try_stop(hdd_context_t *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07001841
1842/**
1843 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
1844 * hdd_ctx: HDD context
1845 *
1846 * Initialize bus bandwidth related data structures like spinlock and timer.
1847 *
1848 * Return: None.
1849 */
1850int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx);
1851
1852/**
1853 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
1854 * hdd_ctx: HDD context
1855 *
1856 * Destroy bus bandwidth related data structures like timer.
1857 *
1858 * Return: None.
1859 */
1860void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001861#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07001862
1863static inline void hdd_bus_bw_compute_timer_start(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001864{
Dustin Brown5ec6b552017-03-31 12:11:40 -07001865}
1866
1867static inline void hdd_bus_bw_compute_timer_try_start(hdd_context_t *hdd_ctx)
1868{
1869}
1870
1871static inline void hdd_bus_bw_compute_timer_stop(hdd_context_t *hdd_ctx)
1872{
1873}
1874
1875static inline void hdd_bus_bw_compute_timer_try_stop(hdd_context_t *hdd_ctx)
1876{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001877}
1878
1879static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
1880{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001881}
Prashanth Bhattaab004382016-10-11 16:08:11 -07001882
Leo Changfdb45c32016-10-28 11:09:23 -07001883static inline int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001884{
1885 return 0;
1886}
1887
Leo Changfdb45c32016-10-28 11:09:23 -07001888static inline void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001889{
Prashanth Bhattaab004382016-10-11 16:08:11 -07001890}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001891#endif
1892
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05301893int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
1894
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08001895int hdd_init(void);
1896void hdd_deinit(void);
1897
Arun Khandavallifae92942016-08-01 13:31:08 +05301898int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001899void __hdd_wlan_exit(void);
1900int hdd_wlan_notify_modem_power_state(int state);
1901#ifdef QCA_HT_2040_COEX
1902int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301903 struct qdf_mac_addr macAddrSTA, int width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001904#endif
1905
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05301906void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001907#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1908void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
1909#endif
1910
1911hdd_adapter_t *hdd_get_con_sap_adapter(hdd_adapter_t *this_sap_adapter,
1912 bool check_start_bss);
1913
1914bool hdd_is_5g_supported(hdd_context_t *pHddCtx);
1915
1916int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter);
1917
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001918void hdd_get_fw_version(hdd_context_t *hdd_ctx,
1919 uint32_t *major_spid, uint32_t *minor_spid,
1920 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05301921/**
1922 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
1923 * @context : timeout handler context
1924 *
1925 * Return: None
1926 */
1927void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001928
Kapil Gupta8878ad92017-02-13 11:56:04 +05301929/**
1930 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
1931 * @adapter: pointer to SAP adapter struct
1932 *
1933 * This function starts the ACS procedure if there are no
1934 * constraints like MBSSID DFS restrictions.
1935 *
1936 * Return: Status of ACS Start procedure
1937 */
1938int wlan_hdd_cfg80211_start_acs(hdd_adapter_t *adapter);
1939
1940/**
1941 * hdd_cfg80211_update_acs_config() - update acs config to application
1942 * @adapter: hdd adapter
1943 * @reason: channel change reason
1944 *
1945 * Return: none
1946 */
1947void hdd_cfg80211_update_acs_config(hdd_adapter_t *adapter,
1948 uint8_t reason);
1949/**
1950 * hdd_update_acs_timer_reason() - update acs timer start reason
1951 * @adapter: hdd adapter
1952 * @reason: channel change reason
1953 *
1954 * Return: 0 for success
1955 */
1956int hdd_update_acs_timer_reason(hdd_adapter_t *adapter, uint8_t reason);
1957
1958/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001959 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05301960 * @adapter: AP adapter
1961 * @channel: Channel
1962 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001963 * Moves the SAP interface by invoking the function which
1964 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05301965 *
1966 * Return: None
1967 */
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001968void hdd_switch_sap_channel(hdd_adapter_t *adapter, uint8_t channel);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001969#ifdef WLAN_FEATURE_MEMDUMP
1970/**
1971 * hdd_is_memdump_supported() - to check if memdump feature support
1972 *
1973 * This function is used to check if memdump feature is supported in
1974 * the host driver
1975 *
1976 * Return: true if supported and false otherwise
1977 */
1978static inline bool hdd_is_memdump_supported(void)
1979{
1980 return true;
1981}
1982#else
1983static inline bool hdd_is_memdump_supported(void)
1984{
1985 return false;
1986}
1987#endif /* WLAN_FEATURE_MEMDUMP */
1988
1989void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301990 struct qdf_mac_addr hw_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001991void wlan_hdd_disable_roaming(hdd_adapter_t *pAdapter);
1992void wlan_hdd_enable_roaming(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001993
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301994QDF_STATUS hdd_post_cds_enable_config(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001995
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301996QDF_STATUS hdd_abort_mac_scan_all_adapters(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001997
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301998QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001999 hdd_adapter_t *ap_adapter,
2000 tCsrRoamProfile *roam_profile,
2001 tScanResultHandle *scan_cache,
2002 bool *concurrent_chnl_same);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002003void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
Arun Khandavallicc544b32017-01-30 19:52:16 +05302004void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002005
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08002006void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
2007
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002008#ifdef QCA_CONFIG_SMP
2009int wlan_hdd_get_cpu(void);
2010#else
2011static inline int wlan_hdd_get_cpu(void)
2012{
2013 return 0;
2014}
2015#endif
2016
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302017void wlan_hdd_sap_pre_cac_failure(void *data);
2018void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
2019
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002020void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2021 enum netif_action_type action, enum netif_reason_type reason);
2022
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002023int hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
Nirav Shahed34b212016-04-25 10:59:16 +05302024void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002025void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
2026void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
2027void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx);
2028void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx);
2029const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302030void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
2031hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
2032 uint32_t sme_session_id);
Naveen Rawat4edb6822017-04-12 10:09:17 -07002033/**
2034 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2035 * @hdd_ctx: hdd context.
2036 * @iface_name: interface name
2037 *
2038 * This function is used to get the adapter with given interface name
2039 *
2040 * Return: adapter pointer if found, NULL otherwise
2041 *
2042 */
2043hdd_adapter_t *hdd_get_adapter_by_iface_name(hdd_context_t *hdd_ctx,
2044 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002045enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05302046uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
2047 uint8_t bw_offset);
Arun Khandavallic811dcc2016-06-26 07:37:21 +05302048int hdd_update_config(hdd_context_t *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002049
Mukul Sharma9d797a02017-01-05 20:26:03 +05302050/**
2051 * hdd_update_components_config() - Initialize driver per module ini parameters
2052 * @hdd_ctx: HDD Context
2053 *
2054 * API is used to initialize components configuration parameters
2055 * Return: 0 for success, errno for failure
2056 */
2057int hdd_update_components_config(hdd_context_t *hdd_ctx);
2058
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05302059QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302060 struct net_device *dev,
2061 struct hdd_chan_change_params chan_change);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302062int wlan_hdd_set_channel(struct wiphy *wiphy,
2063 struct net_device *dev,
2064 struct cfg80211_chan_def *chandef,
2065 enum nl80211_channel_type channel_type);
2066int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
2067 struct cfg80211_beacon_data *params,
2068 const u8 *ssid, size_t ssid_len,
2069 enum nl80211_hidden_ssid hidden_ssid,
Archana Ramachandran1a5b6042016-11-08 16:36:50 -08002070 bool check_for_concurrency,
2071 bool update_beacon);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302072
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002073#if !defined(REMOVE_PKT_LOG)
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302074int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
2075 int set_value2);
2076int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
2077 uint8_t user_triggered, int size);
2078
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002079#else
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302080static inline int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
2081 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002082{
2083 return 0;
2084}
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302085static inline int hdd_process_pktlog_command(hdd_context_t *hdd_ctx,
2086 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002087{
2088 return 0;
2089}
2090#endif /* REMOVE_PKT_LOG */
2091
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002092#ifdef FEATURE_TSO
2093/**
2094 * hdd_set_tso_flags() - enable TSO flags in the network device
2095 * @hdd_ctx: HDD context
2096 * @wlan_dev: network device structure
2097 *
2098 * This function enables the TSO related feature flags in the
2099 * given network device.
2100 *
2101 * Return: none
2102 */
2103static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2104 struct net_device *wlan_dev)
2105{
Mohit Khanna816e6532016-12-09 15:28:21 -08002106 if (hdd_ctx->config->tso_enable &&
2107 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2108 /*
2109 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2110 * enabled.
2111 */
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002112 hdd_info("TSO Enabled");
2113 wlan_dev->features |=
2114 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2115 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2116 }
2117}
2118#else
2119static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2120 struct net_device *wlan_dev){}
2121#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002122
Agrawal Ashishc9ddbab2016-05-25 12:04:47 +05302123#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
2124 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
2125void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
2126#else
2127static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
2128{
2129}
2130#endif
2131
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002132#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002133static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002134{
2135 return hdd_ctx->config->isRoamOffloadEnabled;
2136}
2137#else
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002138static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002139{
2140 return false;
2141}
2142#endif
2143
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002144void hdd_get_ibss_peer_info_cb(void *pUserData,
2145 tSirPeerInfoRspParams *pPeerInfo);
2146
Ryan Hsuceddceb2016-04-28 10:20:14 -07002147#ifdef CONFIG_CNSS_LOGGER
2148/**
2149 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2150 * @hdd_ctx: the hdd context pointer
2151 *
2152 * The nl_srv_init() will call to cnss_logger_device_register() and
2153 * expect to get a radio_index from cnss_logger module and assign to
2154 * hdd_ctx->radio_index, then to maintain the consistency to original
2155 * design, adding the radio_index check here, then return the error
2156 * code if radio_index is not assigned correctly, which means the nl_init
2157 * from cnss_logger is failed.
2158 *
2159 * Return: 0 if successfully, otherwise error code
2160 */
2161static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2162{
2163 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2164
2165 /* radio_index is assigned from 0, so only >=0 will be valid index */
2166 if (hdd_ctx->radio_index >= 0)
2167 return 0;
2168 else
2169 return -EINVAL;
2170}
2171#else
2172/**
2173 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2174 * @hdd_ctx: the hdd context pointer
2175 *
2176 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2177 * the netlink socket and return the success or not.
2178 *
2179 * Return: the return value from nl_srv_init()
2180 */
2181static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2182{
2183 return nl_srv_init(hdd_ctx->wiphy);
2184}
2185#endif
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002186QDF_STATUS hdd_sme_close_session_callback(void *pContext);
2187
Varun Reddy Yeturu3e91dad2016-07-18 15:58:47 -07002188int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002189 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05302190void hdd_svc_fw_shutdown_ind(struct device *dev);
Arun Khandavalli4b55da72016-07-19 19:55:01 +05302191int hdd_register_cb(hdd_context_t *hdd_ctx);
2192void hdd_deregister_cb(hdd_context_t *hdd_ctx);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302193int hdd_start_station_adapter(hdd_adapter_t *adapter);
2194int hdd_start_ap_adapter(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302195int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302196int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
Arun Khandavalli2358d522016-05-16 18:05:37 +05302197int hdd_set_fw_params(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302198int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
2199 bool reinit);
Rajeev Kumar3fef4e82017-03-31 20:25:23 -07002200int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode);
Arun Khandavallifae92942016-08-01 13:31:08 +05302201int hdd_start_adapter(hdd_adapter_t *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302202
2203/**
2204 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2205 * @wiphy: wiphy
2206 * @channel: channel of the BSS to find
2207 * @bssid: bssid of the BSS to find
2208 * @ssid: ssid of the BSS to find
2209 * @ssid_len: ssid len of of the BSS to find
2210 *
2211 * The API is a wrapper to get bss from kernel matching the chan,
2212 * bssid and ssid
2213 *
2214 * Return: bss structure if found else NULL
2215 */
2216struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2217 struct ieee80211_channel *channel,
2218 const u8 *bssid,
2219 const u8 *ssid, size_t ssid_len);
2220
Anurag Chouhanc4092922016-09-08 15:56:11 +05302221void hdd_connect_result(struct net_device *dev, const u8 *bssid,
2222 tCsrRoamInfo *roam_info, const u8 *req_ie,
2223 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302224 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302225 bool connect_timeout,
2226 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302227
Arun Khandavallifae92942016-08-01 13:31:08 +05302228#ifdef WLAN_FEATURE_FASTPATH
2229void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2230 void *context);
2231#else
2232static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2233 void *context)
2234{
2235}
2236#endif
2237void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
Agrawal Ashish65634612016-08-18 13:24:32 +05302238enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Agrawal Ashish467dde42016-09-08 18:44:22 +05302239void hdd_ch_avoid_cb(void *hdd_context, void *indi_param);
2240void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx);
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302241int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
2242 uint8_t set_value);
Liangwei Dong8baf7c82016-10-11 01:26:59 -04002243void wlan_hdd_undo_acs(hdd_adapter_t *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002244
2245#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2246static inline int
2247hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2248{
2249 return nla_put_u64(skb, attrtype, value);
2250}
2251#else
2252static inline int
2253hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2254{
2255 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2256}
2257#endif
2258
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302259static inline int wlan_hdd_validate_session_id(u8 session_id)
2260{
2261 if (session_id != HDD_SESSION_ID_INVALID)
2262 return 0;
2263
2264 return -EINVAL;
2265}
2266
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08002267bool hdd_is_roaming_in_progress(hdd_adapter_t *adapter);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002268void hdd_set_roaming_in_progress(bool value);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002269bool hdd_is_connection_in_progress(uint8_t *session_id,
2270 enum scan_reject_states *reason);
2271void hdd_restart_sap(hdd_adapter_t *ap_adapter);
2272void hdd_check_and_restart_sap_with_non_dfs_acs(void);
2273bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002274
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302275/**
2276 * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
2277 * @ap_adapter: adapter
2278 * @channel_count: valid channel count
2279 * @channel_list: valid channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302280 * @band: frequency band
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302281 *
2282 * This API returns valid channel list for SAP after removing nol and
2283 * channel which lies outside of configuration.
2284 *
2285 * Return: Zero on success, non-zero on failure
2286 */
2287int wlan_hdd_sap_get_valid_channellist(hdd_adapter_t *adapter,
2288 uint32_t *channel_count,
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302289 uint8_t *channel_list,
2290 eCsrBand band);
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302291/**
2292 * wlan_hdd_init_chan_info() - initialize channel info variables
2293 * @hdd_ctx: hdd ctx
2294 *
2295 * This API initialize channel info variables
2296 *
2297 * Return: None
2298 */
2299void wlan_hdd_init_chan_info(hdd_context_t *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07002300
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302301/**
2302 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2303 * @hdd_ctx: hdd ctx
2304 *
2305 * This API deinitialize channel info variables
2306 *
2307 * Return: None
2308 */
2309void wlan_hdd_deinit_chan_info(hdd_context_t *hdd_ctx);
Arun Khandavallicc544b32017-01-30 19:52:16 +05302310void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08002311
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05302312/**
2313 * hdd_check_for_opened_interfaces()- Check for interface up
2314 * @hdd_ctx: HDD context
2315 *
2316 * check if there are any wlan interfaces before starting the timer
2317 * to close the modules
2318 *
2319 * Return: 0 if interface was opened else false
2320 */
2321bool hdd_check_for_opened_interfaces(hdd_context_t *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08002322
2323#ifdef WIFI_POS_CONVERGED
2324/**
2325 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
2326 * function to send peer status to a registered application
2327 * @peer_mac: MAC address of peer
2328 * @peer_status: ePeerConnected or ePeerDisconnected
2329 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
2330 * @sessionId: SME session id, i.e. vdev_id
2331 * @chan_info: operating channel information
2332 * @dev_mode: dev mode for which indication is sent
2333 *
2334 * Return: none
2335 */
2336static inline void hdd_send_peer_status_ind_to_app(
2337 struct qdf_mac_addr *peer_mac,
2338 uint8_t peer_status,
2339 uint8_t peer_timing_meas_cap,
2340 uint8_t sessionId,
2341 tSirSmeChanInfo *chan_info,
2342 enum tQDF_ADAPTER_MODE dev_mode)
2343{
2344 struct wifi_pos_ch_info ch_info;
2345
Naveen Rawat6877a242017-03-23 17:15:38 -07002346 if (!chan_info) {
2347 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2348 peer_timing_meas_cap, sessionId,
2349 NULL, dev_mode);
2350 return;
2351 }
2352
Naveen Rawat910726a2017-03-06 11:42:51 -08002353 ch_info.chan_id = chan_info->chan_id;
2354 ch_info.mhz = chan_info->mhz;
2355 ch_info.band_center_freq1 = chan_info->band_center_freq1;
2356 ch_info.band_center_freq2 = chan_info->band_center_freq2;
2357 ch_info.info = chan_info->info;
2358 ch_info.reg_info_1 = chan_info->reg_info_1;
2359 ch_info.reg_info_2 = chan_info->reg_info_2;
2360 ch_info.nss = chan_info->nss;
2361 ch_info.rate_flags = chan_info->rate_flags;
2362 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
2363 ch_info.ch_width = chan_info->ch_width;
2364 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2365 peer_timing_meas_cap, sessionId,
2366 &ch_info, dev_mode);
2367}
2368#else
2369static inline void hdd_send_peer_status_ind_to_app(
2370 struct qdf_mac_addr *peer_mac,
2371 uint8_t peer_status,
2372 uint8_t peer_timing_meas_cap,
2373 uint8_t sessionId,
2374 tSirSmeChanInfo *chan_info,
2375 enum tQDF_ADAPTER_MODE dev_mode)
2376{
2377 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
2378 peer_timing_meas_cap, sessionId, chan_info, dev_mode);
2379}
2380#endif /* WIFI_POS_CONVERGENCE */
2381
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002382/**
2383 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
2384 * @adapter: Adapter data
2385 * @sval: P2P quota value
2386 *
2387 * Send P2P quota value to FW
2388 *
2389 * Return: 0 sucess else failure
2390 */
2391int wlan_hdd_send_p2p_quota(hdd_adapter_t *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002392
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002393/**
2394 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
2395 * @adapter: Adapter data
2396 * @sval: MCC latency value
2397 *
2398 * Send MCC latency value to FW
2399 *
2400 * Return: 0 sucess else failure
2401 */
2402int wlan_hdd_send_mcc_latency(hdd_adapter_t *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002403
2404/**
2405 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
2406 * and PSOC object data
2407 * @psoc: Psoc object data
2408 * @vdev_id: vdev id
2409 *
2410 * Get adapter from vdev id and PSOC object data
2411 *
2412 * Return: adapter pointer
2413 */
2414hdd_adapter_t *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
2415 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05302416/**
2417 * hdd_unregister_notifiers()- unregister kernel notifiers
2418 * @hdd_ctx: Hdd Context
2419 *
2420 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
2421 *
2422 */
2423void hdd_unregister_notifiers(hdd_context_t *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05302424
2425/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05302426 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
2427 * @hdd_ctx: HDD context
2428 *
2429 * This function sends the DBS scan selection config configuration to the
2430 * firmware via WMA
2431 *
2432 * Return: 0 - success, < 0 - failure
2433 */
2434int hdd_dbs_scan_selection_init(hdd_context_t *hdd_ctx);
2435
2436/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05302437 * hdd_start_complete()- complete the start event
2438 * @ret: return value for complete event.
2439 *
2440 * complete the startup event and set the return in
2441 * global variable
2442 *
2443 * Return: void
2444 */
2445
2446void hdd_start_complete(int ret);
Ravi Kumar Bokka05c14e52017-03-27 14:48:23 +05302447
2448/**
2449 * hdd_chip_pwr_save_fail_detected_cb() - chip power save failure detected
2450 * callback
2451 * @hddctx: HDD context
2452 * @data: chip power save failure detected data
2453 *
2454 * This function reads the chip power save failure detected data and fill in
2455 * the skb with NL attributes and send up the NL event.
2456 * This callback execute in atomic context and must not invoke any
2457 * blocking calls.
2458 *
2459 * Return: none
2460 */
2461
2462void hdd_chip_pwr_save_fail_detected_cb(void *hddctx,
2463 struct chip_pwr_save_fail_detected_params
2464 *data);
2465
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002466#endif /* end #if !defined(WLAN_HDD_MAIN_H) */