blob: 27cba2868ac4b57ce65b4c6e316ad1afbdfcce57 [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
30/**===========================================================================
31
32 \file WLAN_HDD_MAIN_H.h
33
34 \brief Linux HDD Adapter Type
35
36 ==========================================================================*/
37
38/*---------------------------------------------------------------------------
39 Include files
40 -------------------------------------------------------------------------*/
41
42#include <linux/netdevice.h>
43#include <linux/skbuff.h>
44#include <net/cfg80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053045#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053046#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047#include "sir_mac_prot_def.h"
48#include "csr_api.h"
49#include <wlan_hdd_assoc.h>
50#include <wlan_hdd_wmm.h>
51#include <wlan_hdd_cfg.h>
52#include <linux/spinlock.h>
53#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
54#include <linux/wakelock.h>
55#endif
56#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080057#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070058#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053060#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080062#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080063#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070064#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070065#include "wlan_hdd_nan_datapath.h"
Dustin Brown61269462016-09-19 13:25:45 -070066#include "wlan_tgt_def_config.h"
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053067#include <wlan_objmgr_cmn.h>
68#include <wlan_objmgr_global_obj.h>
69#include <wlan_objmgr_psoc_obj.h>
70#include <wlan_objmgr_pdev_obj.h>
71#include <wlan_objmgr_vdev_obj.h>
72#include <wlan_objmgr_peer_obj.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070073
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080074/*---------------------------------------------------------------------------
75 Preprocessor definitions and constants
76 -------------------------------------------------------------------------*/
77/** Number of Tx Queues */
78#ifdef QCA_LL_TX_FLOW_CONTROL_V2
79#define NUM_TX_QUEUES 5
80#else
81#define NUM_TX_QUEUES 4
82#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -080083
84/** Length of the TX queue for the netdev */
85#define HDD_NETDEV_TX_QUEUE_LEN (3000)
86
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080087/** Hdd Tx Time out value */
88#ifdef LIBRA_LINUX_PC
89#define HDD_TX_TIMEOUT (8000)
90#else
91#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
92#endif
93/** Hdd Default MTU */
94#define HDD_DEFAULT_MTU (1500)
95
96#ifdef QCA_CONFIG_SMP
97#define NUM_CPUS NR_CPUS
98#else
99#define NUM_CPUS 1
100#endif
101
102/**event flags registered net device*/
103#define NET_DEVICE_REGISTERED (0)
104#define SME_SESSION_OPENED (1)
105#define INIT_TX_RX_SUCCESS (2)
106#define WMM_INIT_DONE (3)
107#define SOFTAP_BSS_STARTED (4)
108#define DEVICE_IFACE_OPENED (5)
109#define TDLS_INIT_DONE (6)
110#define ACS_PENDING (7)
111
112/* HDD global event flags */
113#define ACS_IN_PROGRESS (0)
114
115/** Maximum time(ms)to wait for disconnect to complete **/
116#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530117#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800118#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530119#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800120#endif
121#define WLAN_WAIT_TIME_STATS 800
122#define WLAN_WAIT_TIME_POWER 800
123#define WLAN_WAIT_TIME_COUNTRY 1000
124#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530125#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800126/* Amount of time to wait for sme close session callback.
127 This value should be larger than the timeout used by WDI to wait for
128 a response from WCNSS */
129#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
130#define WLAN_WAIT_TIME_ABORTSCAN 2000
131
132/** Maximum time(ms) to wait for mc thread suspend **/
133#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
134
135/** Maximum time(ms) to wait for target to be ready for suspend **/
136#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
137
138/** Maximum time(ms) to wait for tdls add sta to complete **/
139#define WAIT_TIME_TDLS_ADD_STA 1500
140
141/** Maximum time(ms) to wait for tdls del sta to complete **/
142#define WAIT_TIME_TDLS_DEL_STA 1500
143
144/** Maximum time(ms) to wait for Link Establish Req to complete **/
145#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
146
147/** Maximum time(ms) to wait for tdls mgmt to complete **/
148#define WAIT_TIME_TDLS_MGMT 11000
149
150/* Scan Req Timeout */
151#define WLAN_WAIT_TIME_SCAN_REQ 100
152
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800153#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
154#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
155
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530156#define WLAN_WAIT_TIME_BPF 1000
157
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158#define MAX_NUMBER_OF_ADAPTERS 4
159
160#define MAX_CFG_STRING_LEN 255
161
Arunk Khandavalli07ec8f62016-09-27 21:51:01 +0530162/* SSR Retry Count */
163#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
164
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800165#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
166/** Mac Address string **/
167#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
168#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Hong Shiab2dfcf2016-11-07 14:09:39 +0800169#define MAX_GENIE_LEN 512
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170
171#define WLAN_CHIP_VERSION "WCNSS"
172
Jeff Johnson32ad1742015-12-09 13:26:44 -0800173#ifndef HDD_DISALLOW_LEGACY_HDDLOG
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530174#define hddLog(level, args ...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Jeff Johnson32ad1742015-12-09 13:26:44 -0800175#endif
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530176#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
178
179#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530180 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530182 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800183#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530184 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185#define hdd_notice(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530186 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187#define hdd_info(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530188 hdd_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800189#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530190 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530192#define ENTER() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter")
Jeff Johnson398b3d62016-02-10 17:19:39 -0800193#define ENTER_DEV(dev) \
194 hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter(%s)", (dev)->name)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530195#define EXIT() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "exit")
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196
197#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t *)(netdev_priv((__dev__)))
198
199#define MAX_NO_OF_2_4_CHANNELS 14
200
201#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
202#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
203#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
204#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
205#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
206#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
207#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
208#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
209#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
210#define WLAN_HDD_WFA_OUI 0x506F9A
211#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
212#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
213#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
214#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
215
216#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
217 (((center_freq) == 2412) || ((center_freq) == 2437) || ((center_freq) == 2462))
218
219#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
220 (((center_freq) == 5180) || ((center_freq) == 5200) \
221 || ((center_freq) == 5220) || ((center_freq) == 5240))
222
223#ifdef WLAN_FEATURE_11W
224#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
225#endif
226
227#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
228#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229
230#define WLAN_HDD_QOS_ACTION_FRAME 1
231#define WLAN_HDD_QOS_MAP_CONFIGURE 4
232#define HDD_SAP_WAKE_LOCK_DURATION 10000 /* in msecs */
233
Mukul Sharma974ca652016-09-03 16:24:48 +0530234#if defined(CONFIG_HL_SUPPORT)
235#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
236#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530238#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239
240#ifdef WLAN_FEATURE_GTK_OFFLOAD
241#define GTK_OFFLOAD_ENABLE 0
242#define GTK_OFFLOAD_DISABLE 1
243#endif
244
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245#define MAX_USER_COMMAND_SIZE 4096
246
247#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
248#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
249
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530250/* FW expects burst duration in 1020*ms */
251#define SIFS_BURST_DUR_MULTIPLIER 1020
252#define SIFS_BURST_DUR_MAX 12240
253
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800254/* If IPA UC data path is enabled, target should reserve extra tx descriptors
255 * for IPA data path.
256 * Then host data path should allow less TX packet pumping in case
257 * IPA data path enabled
258 */
259#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
260
Ryan Hsu07495ea2016-01-21 15:25:39 -0800261/*
262 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
263 * here if the Kernel version is less than 3.17 to avoid the interleave
264 * conditional compilation.
265 */
266#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS))
267#define NET_NAME_UNKNOWN 0
268#endif
269
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800270#define BSS_WAIT_TIMEOUT 10000
271
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530272#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530273
274/* session ID invalid */
275#define HDD_SESSION_ID_INVALID 0xFF
276
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530277/* Default Psoc id */
278#define DEFAULT_PSOC_ID 1
279
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800280/*
281 * Generic asynchronous request/response support
282 *
283 * Many of the APIs supported by HDD require a call to SME to
284 * perform an action or to retrieve some data. In most cases SME
285 * performs the operation asynchronously, and will execute a provided
286 * callback function when the request has completed. In order to
287 * synchronize this the HDD API allocates a context which is then
288 * passed to SME, and which is then, in turn, passed back to the
289 * callback function when the operation completes. The callback
290 * function then sets a completion variable inside the context which
291 * the HDD API is waiting on. In an ideal world the HDD API would
292 * wait forever (or at least for a long time) for the response to be
293 * received and for the completion variable to be set. However in
294 * most cases these HDD APIs are being invoked in the context of a
295 * user space thread which has invoked either a cfg80211 API or a
296 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
297 * Since this lock is used to synchronize many of the kernel tasks, we
298 * do not want to hold it for a long time. In addition we do not want
299 * to block user space threads (such as the wpa supplicant's main
300 * thread) for an extended time. Therefore we only block for a short
301 * time waiting for the response before we timeout. This means that
302 * it is possible for the HDD API to timeout, and for the callback to
303 * be invoked afterwards. In order for the callback function to
304 * determine if the HDD API is still waiting, a magic value is also
305 * stored in the shared context. Only if the context has a valid
306 * magic will the callback routine do any work. In order to further
307 * synchronize these activities a spinlock is used so that if any HDD
308 * API timeout coincides with its callback, the operations of the two
309 * threads will be serialized.
310 */
311
312struct statsContext {
313 struct completion completion;
314 hdd_adapter_t *pAdapter;
315 unsigned int magic;
316};
317
318struct linkspeedContext {
319 struct completion completion;
320 hdd_adapter_t *pAdapter;
321 unsigned int magic;
322};
323
324extern spinlock_t hdd_context_lock;
325
326#define STATS_CONTEXT_MAGIC 0x53544154 /* STAT */
327#define RSSI_CONTEXT_MAGIC 0x52535349 /* RSSI */
328#define POWER_CONTEXT_MAGIC 0x504F5752 /* POWR */
329#define SNR_CONTEXT_MAGIC 0x534E5200 /* SNR */
330#define LINK_CONTEXT_MAGIC 0x4C494E4B /* LINKSPEED */
331#define LINK_STATUS_MAGIC 0x4C4B5354 /* LINKSTATUS(LNST) */
332#define TEMP_CONTEXT_MAGIC 0x74656d70 /* TEMP (temperature) */
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530333#define BPF_CONTEXT_MAGIC 0x4575354 /* BPF */
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530334#define POWER_STATS_MAGIC 0x14111990
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800335
336/* MAX OS Q block time value in msec
337 * Prevent from permanent stall, resume OS Q if timer expired */
338#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
339#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
340#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
341
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800342#define NUM_TX_RX_HISTOGRAM 1024
343#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
344
Mohit Khannae71e2262015-11-10 09:37:24 -0800345/**
346 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
347 * received over 100ms intervals
348 * @interval_rx: # of rx packets received in the last 100ms interval
349 * @interval_tx: # of tx packets received in the last 100ms interval
350 * @total_rx: # of total rx packets received on interface
351 * @total_tx: # of total tx packets received on interface
Yuanyuan Liu13738502016-04-06 17:41:37 -0700352 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800353 * determined on the basis of total tx and rx packets
354 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700355 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800356 * determined on the basis of rx packets received in the
357 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700358 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800359 * determined on the basis of tx packets received in the
360 * last 100ms interval
361 *
362 * The structure keeps track of throughput requirements of wlan driver in 100ms
363 * intervals for later analysis.
364 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365struct hdd_tx_rx_histogram {
366 uint64_t interval_rx;
367 uint64_t interval_tx;
368 uint64_t total_rx;
369 uint64_t total_tx;
370 uint32_t next_vote_level;
371 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800372 uint32_t next_tx_level;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800373};
374
375typedef struct hdd_tx_rx_stats_s {
376 /* start_xmit stats */
377 __u32 txXmitCalled;
378 __u32 txXmitDropped;
379 __u32 txXmitClassifiedAC[NUM_TX_QUEUES];
380 __u32 txXmitDroppedAC[NUM_TX_QUEUES];
381 /* complete_cbk_stats */
382 __u32 txCompleted;
383 /* rx stats */
384 __u32 rxPackets[NUM_CPUS];
385 __u32 rxDropped[NUM_CPUS];
386 __u32 rxDelivered[NUM_CPUS];
387 __u32 rxRefused[NUM_CPUS];
388
389 /* txflow stats */
390 bool is_txflow_paused;
391 __u32 txflow_pause_cnt;
392 __u32 txflow_unpause_cnt;
393 __u32 txflow_timer_cnt;
394} hdd_tx_rx_stats_t;
395
396#ifdef WLAN_FEATURE_11W
397typedef struct hdd_pmf_stats_s {
398 uint8_t numUnprotDeauthRx;
399 uint8_t numUnprotDisassocRx;
400} hdd_pmf_stats_t;
401#endif
402
403typedef struct hdd_stats_s {
404 tCsrSummaryStatsInfo summary_stat;
405 tCsrGlobalClassAStatsInfo ClassA_stat;
406 tCsrGlobalClassBStatsInfo ClassB_stat;
407 tCsrGlobalClassCStatsInfo ClassC_stat;
408 tCsrGlobalClassDStatsInfo ClassD_stat;
409 tCsrPerStaStatsInfo perStaStats;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530410 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800411 hdd_tx_rx_stats_t hddTxRxStats;
412#ifdef WLAN_FEATURE_11W
413 hdd_pmf_stats_t hddPmfStats;
414#endif
415} hdd_stats_t;
416
417typedef enum {
418 HDD_ROAM_STATE_NONE,
419
420 /* Issuing a disconnect due to transition into low power states. */
421 HDD_ROAM_STATE_DISCONNECTING_POWER,
422
423 /* move to this state when HDD sets a key with SME/CSR. Note this is */
424 /* an important state to get right because we will get calls into our SME */
425 /* callback routine for SetKey activity that we did not initiate! */
426 HDD_ROAM_STATE_SETTING_KEY,
427} HDD_ROAM_STATE;
428
429typedef struct roaming_info_s {
430 HDD_ROAM_STATE roamingState;
Anurag Chouhance0dc992016-02-16 18:18:03 +0530431 qdf_event_t roamingEvent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800432
433 tSirMacAddr bssid;
434 tSirMacAddr peerMac;
435 uint32_t roamId;
436 eRoamCmdStatus roamStatus;
437 bool deferKeyComplete;
438
439} roaming_info_t;
440
441#ifdef FEATURE_WLAN_WAPI
442/* Define WAPI macros for Length, BKID count etc*/
443#define MAX_WPI_KEY_LENGTH 16
444#define MAX_NUM_PN 16
445#define MAC_ADDR_LEN 6
446#define MAX_ADDR_INDEX 12
447#define MAX_NUM_AKM_SUITES 16
448#define MAX_NUM_UNI_SUITES 16
449#define MAX_NUM_BKIDS 16
450
451/** WAPI AUTH mode definition */
452enum _WAPIAuthMode {
453 WAPI_AUTH_MODE_OPEN = 0,
454 WAPI_AUTH_MODE_PSK = 1,
455 WAPI_AUTH_MODE_CERT
456} __packed;
457typedef enum _WAPIAuthMode WAPIAuthMode;
458
459/** WAPI Work mode structure definition */
460#define WZC_ORIGINAL 0
461#define WAPI_EXTENTION 1
462
463struct _WAPI_FUNCTION_MODE {
464 unsigned char wapiMode;
465} __packed;
466
467typedef struct _WAPI_FUNCTION_MODE WAPI_FUNCTION_MODE;
468
469typedef struct _WAPI_BKID {
470 uint8_t bkid[16];
471} WAPI_BKID, *pWAPI_BKID;
472
473/** WAPI Association information structure definition */
474struct _WAPI_AssocInfo {
475 uint8_t elementID;
476 uint8_t length;
477 uint16_t version;
478 uint16_t akmSuiteCount;
479 uint32_t akmSuite[MAX_NUM_AKM_SUITES];
480 uint16_t unicastSuiteCount;
481 uint32_t unicastSuite[MAX_NUM_UNI_SUITES];
482 uint32_t multicastSuite;
483 uint16_t wapiCability;
484 uint16_t bkidCount;
485 WAPI_BKID bkidList[MAX_NUM_BKIDS];
486} __packed;
487
488typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
489typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
490
491/** WAPI KEY Type definition */
492enum _WAPIKeyType {
493 PAIRWISE_KEY, /* 0 */
494 GROUP_KEY /* 1 */
495} __packed;
496typedef enum _WAPIKeyType WAPIKeyType;
497
498/** WAPI KEY Direction definition */
499enum _KEY_DIRECTION {
500 None,
501 Rx,
502 Tx,
503 Rx_Tx
504} __packed;
505
506typedef enum _KEY_DIRECTION WAPI_KEY_DIRECTION;
507
508/* WAPI KEY structure definition */
509struct WLAN_WAPI_KEY {
510 WAPIKeyType keyType;
511 WAPI_KEY_DIRECTION keyDirection; /*reserved for future use */
512 uint8_t keyId;
513 uint8_t addrIndex[MAX_ADDR_INDEX]; /*reserved for future use */
514 int wpiekLen;
515 uint8_t wpiek[MAX_WPI_KEY_LENGTH];
516 int wpickLen;
517 uint8_t wpick[MAX_WPI_KEY_LENGTH];
518 uint8_t pn[MAX_NUM_PN]; /*reserved for future use */
519} __packed;
520
521typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
522typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
523
524#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
525#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
526#define WLAN_EID_WAPI 68
527#define WAPI_PSK_AKM_SUITE 0x02721400
528#define WAPI_CERT_AKM_SUITE 0x01721400
529
530/* WAPI BKID List structure definition */
531struct _WLAN_BKID_LIST {
532 uint32_t length;
533 uint32_t BKIDCount;
534 WAPI_BKID BKID[1];
535} __packed;
536
537typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
538typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
539
540/* WAPI Information structure definition */
541struct hdd_wapi_info_s {
542 uint32_t nWapiMode;
543 bool fIsWapiSta;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530544 struct qdf_mac_addr cachedMacAddr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800545 uint8_t wapiAuthMode;
546} __packed;
547typedef struct hdd_wapi_info_s hdd_wapi_info_t;
548#endif /* FEATURE_WLAN_WAPI */
549
550typedef struct beacon_data_s {
551 u8 *head;
552 u8 *tail;
553 u8 *proberesp_ies;
554 u8 *assocresp_ies;
555 int head_len;
556 int tail_len;
557 int proberesp_ies_len;
558 int assocresp_ies_len;
559 int dtim_period;
560} beacon_data_t;
561
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800562typedef enum rem_on_channel_request_type {
563 REMAIN_ON_CHANNEL_REQUEST,
564 OFF_CHANNEL_ACTION_TX,
565} rem_on_channel_request_type_t;
566
567typedef struct action_pkt_buffer {
568 uint8_t *frame_ptr;
569 uint32_t frame_length;
570 uint16_t freq;
571} action_pkt_buffer_t;
572
573typedef struct hdd_remain_on_chan_ctx {
574 struct net_device *dev;
575 struct ieee80211_channel chan;
576 enum nl80211_channel_type chan_type;
577 unsigned int duration;
578 u64 cookie;
579 rem_on_channel_request_type_t rem_on_chan_request;
Anurag Chouhan210db072016-02-22 18:42:15 +0530580 qdf_mc_timer_t hdd_remain_on_chan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800581 action_pkt_buffer_t action_pkt_buff;
582 bool hdd_remain_on_chan_cancel_in_progress;
583 uint32_t scan_id;
584} hdd_remain_on_chan_ctx_t;
585
586/* RoC Request entry */
587typedef struct hdd_roc_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530588 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800589 hdd_adapter_t *pAdapter;
590 hdd_remain_on_chan_ctx_t *pRemainChanCtx;
591} hdd_roc_req_t;
592
593/**
594 * struct hdd_scan_req - Scan Request entry
595 * @node : List entry element
596 * @adapter: Adapter address
597 * @scan_request: scan request holder
598 * @scan_id: scan identifier used across host layers which is generated at WMI
599 * @cookie: scan request identifier sent to userspace
600 * @source: scan request originator (NL/Vendor scan)
601 * @timestamp: scan request timestamp
602 *
603 * Scan request linked list element
604 */
605struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530606 qdf_list_node_t node;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800607 hdd_adapter_t *adapter;
608 struct cfg80211_scan_request *scan_request;
609 uint32_t scan_id;
610 uint8_t source;
611 uint32_t timestamp;
612};
613
614typedef enum {
615 HDD_IDLE,
616 HDD_PD_REQ_ACK_PENDING,
617 HDD_GO_NEG_REQ_ACK_PENDING,
618 HDD_INVALID_STATE,
619} eP2PActionFrameState;
620
621typedef enum {
622 WLAN_HDD_GO_NEG_REQ,
623 WLAN_HDD_GO_NEG_RESP,
624 WLAN_HDD_GO_NEG_CNF,
625 WLAN_HDD_INVITATION_REQ,
626 WLAN_HDD_INVITATION_RESP,
627 WLAN_HDD_DEV_DIS_REQ,
628 WLAN_HDD_DEV_DIS_RESP,
629 WLAN_HDD_PROV_DIS_REQ,
630 WLAN_HDD_PROV_DIS_RESP,
631} tActionFrmType;
632
633typedef struct hdd_cfg80211_state_s {
634 uint16_t current_freq;
635 u64 action_cookie;
636 uint8_t *buf;
637 size_t len;
638 hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
639 struct mutex remain_on_chan_ctx_lock;
640 eP2PActionFrameState actionFrmState;
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530641 /* is_go_neg_ack_received flag is set to 1 when
642 * the pending ack for GO negotiation req is
643 * received.
644 */
645 bool is_go_neg_ack_received;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800646} hdd_cfg80211_state_t;
647
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700648/**
649 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
650 * @channel: Channel number.
651 * @cb_mode: Channel bonding
652 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
653 * @phy_mode: PHY mode
654 */
655struct hdd_mon_set_ch_info {
656 uint8_t channel;
657 uint8_t cb_mode;
658 uint32_t channel_width;
659 eCsrPhyMode phy_mode;
660};
661
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800662struct hdd_station_ctx {
663 /** Handle to the Wireless Extension State */
664 hdd_wext_state_t WextState;
665
666#ifdef FEATURE_WLAN_TDLS
667 tdlsCtx_t *pHddTdlsCtx;
668#endif
669
670 /**Connection information*/
671 connection_info_t conn_info;
672
673 roaming_info_t roam_info;
674
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800675 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800676
677#ifdef WLAN_FEATURE_GTK_OFFLOAD
678 tSirGtkOffloadParams gtkOffloadReqParams;
679#endif
680 /*Increment whenever ibss New peer joins and departs the network */
681 int ibss_sta_generation;
682
683 /* Indication of wep/wpa-none keys installation */
684 bool ibss_enc_key_installed;
685
686 /*Save the wep/wpa-none keys */
687 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700688 tSirPeerInfoRspParams ibss_peer_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689
690 bool hdd_ReassocScenario;
691
692 /* STA ctx debug variables */
693 int staDebugState;
Chandrasekaran, Manishekar34e325a2015-12-18 12:07:22 +0530694
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700695 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700696
697 struct hdd_mon_set_ch_info ch_info;
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -0700698#ifdef WLAN_FEATURE_NAN_DATAPATH
699 struct nan_datapath_ctx ndp_ctx;
700#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800701};
702
703#define BSS_STOP 0
704#define BSS_START 1
705typedef struct hdd_hostapd_state_s {
706 int bssState;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530707 qdf_event_t qdf_event;
708 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800709 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530710 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800711 bool bCommit;
712
713} hdd_hostapd_state_t;
714
715/*
716 * Per station structure kept in HDD for multiple station support for SoftAP
717 */
718typedef struct {
719 /** The station entry is used or not */
720 bool isUsed;
721
722 /** Station ID reported back from HAL (through SAP). Broadcast
723 * uses station ID zero by default in both libra and volans. */
724 uint8_t ucSTAId;
725
726 /** MAC address of the station */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530727 struct qdf_mac_addr macAddrSTA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800728
729 /** Current Station state so HDD knows how to deal with packet
730 * queue. Most recent states used to change TLSHIM STA state */
731 enum ol_txrx_peer_state tlSTAState;
732
733 /** Track QoS status of station */
734 bool isQosEnabled;
735
736 /** The station entry for which Deauth is in progress */
737 bool isDeauthInProgress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530738
739 /** Number of spatial streams supported */
740 uint8_t nss;
741
742 /** Rate Flags for this connection */
743 uint32_t rate_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800744} hdd_station_info_t;
745
746struct hdd_ap_ctx_s {
747 hdd_hostapd_state_t HostapdState;
748
749 /* Memory differentiation mode is enabled */
750 /* uint16_t uMemoryDiffThreshold; */
751 /* uint8_t uNumActiveAC; */
752 /* uint8_t uActiveACMask; */
753
754 /** Packet Count to update uNumActiveAC and uActiveACMask */
755 /* uint16_t uUpdatePktCount; */
756
757 /** Station ID assigned after BSS starts */
758 uint8_t uBCStaId;
759
760 uint8_t uPrivacy; /* The privacy bits of configuration */
761
762 tSirWPSPBCProbeReq WPSPBCProbeReq;
763
764 tsap_Config_t sapConfig;
765
766 struct semaphore semWpsPBCOverlapInd;
767
768 bool apDisableIntraBssFwd;
769
Anurag Chouhan210db072016-02-22 18:42:15 +0530770 qdf_mc_timer_t hdd_ap_inactivity_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800771
772 uint8_t operatingChannel;
773
774 bool uIsAuthenticated;
775
776 eCsrEncryptionType ucEncryptType;
777
778 /* This will point to group key data, if it is received before start bss. */
779 tCsrRoamSetKey groupKey;
780 /* This will have WEP key data, if it is received before start bss */
781 tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
782
Kondabattini, Ganesh702d90e2016-09-03 01:54:22 +0530783 /* WEP default key index */
784 uint8_t wep_def_key_idx;
785
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800786 beacon_data_t *beacon;
787
788 bool bApActive;
Dustin Brown5e79c102016-09-21 11:29:39 -0700789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800790 /* SAP Context */
791 void *sapContext;
Dustin Brown5e79c102016-09-21 11:29:39 -0700792
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800793 bool dfs_cac_block_tx;
794};
795
796typedef struct hdd_scaninfo_s {
797 /* The scan pending */
798 uint32_t mScanPending;
799
800 /* Counter for mScanPending so that the scan pending
801 error log is not printed for more than 5 times */
802 uint32_t mScanPendingCounter;
803
804 /* Additional IE for scan */
805 tSirAddie scanAddIE;
806
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530807 uint8_t *default_scan_ies;
808 uint8_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800809 /* Scan mode */
810 tSirScanType scan_mode;
811
812 /* completion variable for abortscan */
813 struct completion abortscan_event_var;
814
815} hdd_scaninfo_t;
816
Dustin Brown61269462016-09-19 13:25:45 -0700817#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800818
819#ifdef WLAN_FEATURE_PACKET_FILTERING
820typedef struct multicast_addr_list {
821 uint8_t isFilterApplied;
822 uint8_t mc_cnt;
823 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
824} t_multicast_add_list;
825#endif
826
827#define WLAN_HDD_MAX_HISTORY_ENTRY 10
828
829/**
830 * struct hdd_netif_queue_stats - netif queue operation statistics
831 * @pause_count - pause counter
832 * @unpause_count - unpause counter
833 */
834struct hdd_netif_queue_stats {
835 uint16_t pause_count;
836 uint16_t unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530837 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800838};
839
840/**
841 * struct hdd_netif_queue_history - netif queue operation history
842 * @time: timestamp
843 * @netif_action: action type
844 * @netif_reason: reason type
845 * @pause_map: pause map
846 */
847struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530848 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800849 uint16_t netif_action;
850 uint16_t netif_reason;
851 uint32_t pause_map;
852};
853
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530854/**
855 * struct hdd_chan_change_params - channel related information
856 * @chan: operating channel
857 * @chan_params: channel parameters
858 */
859struct hdd_chan_change_params {
860 uint8_t chan;
861 struct ch_params_s chan_params;
862};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800863
Komal Seelama89be8d2016-09-29 11:09:26 +0530864/**
Komal Seelam8634b772016-09-29 12:12:24 +0530865 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
866 * @scan: scan context to prvent/allow runtime pm
867 *
868 * Prevent Runtime PM for scan
869 */
870struct hdd_runtime_pm_context {
871 qdf_runtime_lock_t scan;
Komal Seelamaa75f262016-09-29 12:32:13 +0530872 qdf_runtime_lock_t roc;
Komal Seelam81cb1662016-09-29 12:39:08 +0530873 qdf_runtime_lock_t dfs;
Komal Seelam8634b772016-09-29 12:12:24 +0530874};
875
876/**
Komal Seelama89be8d2016-09-29 11:09:26 +0530877 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
878 * @connect: Runtime Connect Context
879 *
880 * Structure to hold runtime pm connect context for each adapter.
881 */
882struct hdd_connect_pm_context {
883 qdf_runtime_lock_t connect;
884};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800885
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530886/*
887 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
888 * belonging to this driver from net devices belonging to other devices.
889 * Therefore, the magic number must be unique relative to the numbers for
890 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
891 * (e.g. by compiler argument), then use that. If it's not already defined,
892 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
893 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
894 */
895#ifndef WLAN_HDD_ADAPTER_MAGIC
896#ifdef MULTI_IF_NAME
897#define WLAN_HDD_ADAPTER_MAGIC \
898 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
899 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
900 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
901 (MULTI_IF_NAME[1] << 16) : \
902 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
903 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
904#else
Komal Seelama89be8d2016-09-29 11:09:26 +0530905#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530906#endif
907#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800908
909struct hdd_adapter_s {
Jeff Johnsond399e902015-12-17 15:17:02 -0800910 /* Magic cookie for adapter sanity verification. Note that this
911 * needs to be at the beginning of the private data structure so
912 * that it will exists at the beginning of dev->priv and hence
913 * will always be in mapped memory
914 */
915 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800916
Jeff Johnsond399e902015-12-17 15:17:02 -0800917 void *pHddCtx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530918 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800919
Leo Changfdb45c32016-10-28 11:09:23 -0700920 void *txrx_vdev;
921
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800922 /** Handle to the network device */
923 struct net_device *dev;
924
Krunal Soni276241e2016-03-10 12:58:11 -0800925 enum tQDF_ADAPTER_MODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -0800926
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800927 /** IPv4 notifier callback for handling ARP offload on change in IP */
928 struct work_struct ipv4NotifierWorkQueue;
929#ifdef WLAN_NS_OFFLOAD
930 /** IPv6 notifier callback for handling NS offload on change in IP */
931 struct work_struct ipv6NotifierWorkQueue;
932#endif
933
934 /* TODO Move this to sta Ctx */
935 struct wireless_dev wdev;
936 struct cfg80211_scan_request *request;
937
938 /** ops checks if Opportunistic Power Save is Enable or Not
939 * ctw stores ctWindow value once we receive Opps command from
940 * wpa_supplicant then using ctWindow value we need to Enable
941 * Opportunistic Power Save
942 */
943 uint8_t ops;
944 uint32_t ctw;
945
946 /** Current MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530947 struct qdf_mac_addr macAddressCurrent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800948
949 /**Event Flags*/
950 unsigned long event_flags;
951
952 /**Device TX/RX statistics*/
953 struct net_device_stats stats;
954 /** HDD statistics*/
955 hdd_stats_t hdd_stats;
956 /** linkspeed statistics */
957 tSirLinkSpeedInfo ls_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800958
959 uint8_t sessionId;
960
961 /* Completion variable for session close */
962 struct completion session_close_comp_var;
963
964 /* Completion variable for session open */
965 struct completion session_open_comp_var;
966
967 /* TODO: move these to sta ctx. These may not be used in AP */
968 /** completion variable for disconnect callback */
969 struct completion disconnect_comp_var;
970
971 /** Completion of change country code */
972 struct completion change_country_code;
973
974 /* completion variable for Linkup Event */
975 struct completion linkup_event_var;
976
977 /* completion variable for cancel remain on channel Event */
978 struct completion cancel_rem_on_chan_var;
979
980 /* completion variable for off channel remain on channel Event */
981 struct completion offchannel_tx_event;
982 /* Completion variable for action frame */
983 struct completion tx_action_cnf_event;
984 /* Completion variable for remain on channel ready */
985 struct completion rem_on_chan_ready_event;
986
987 struct completion sta_authorized_event;
988#ifdef FEATURE_WLAN_TDLS
989 struct completion tdls_add_station_comp;
990 struct completion tdls_del_station_comp;
991 struct completion tdls_mgmt_comp;
992 struct completion tdls_link_establish_req_comp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530993 QDF_STATUS tdlsAddStaStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800994#endif
995
Rajeev Kumar8e3e2832015-11-06 16:02:54 -0800996 struct completion ibss_peer_info_comp;
997
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800998 /* Track whether the linkup handling is needed */
999 bool isLinkUpSvcNeeded;
1000
1001 /* Mgmt Frames TX completion status code */
1002 uint32_t mgmtTxCompletionStatus;
1003
1004 /* WMM Status */
1005 hdd_wmm_status_t hddWmmStatus;
1006/*************************************************************
1007 */
1008/*************************************************************
1009 * TODO - Remove it later
1010 */
1011 /** Multiple station supports */
1012 /** Per-station structure */
1013 spinlock_t staInfo_lock; /* To protect access to station Info */
1014 hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
1015 /* uint8_t uNumActiveStation; */
1016
1017/*************************************************************
1018 */
1019
1020#ifdef FEATURE_WLAN_WAPI
1021 hdd_wapi_info_t wapi_info;
1022#endif
1023
1024 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301025 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001026#ifdef WLAN_FEATURE_LPSS
1027 bool rssi_send;
1028#endif
1029
1030 uint8_t snr;
1031
1032 struct work_struct monTxWorkQueue;
1033 struct sk_buff *skb_to_tx;
1034
1035 union {
1036 hdd_station_ctx_t station;
1037 hdd_ap_ctx_t ap;
1038 } sessionCtx;
1039
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001040#ifdef WLAN_FEATURE_TSF
1041 /* tsf value received from firmware */
1042 uint32_t tsf_low;
1043 uint32_t tsf_high;
1044 /* TSF capture state */
1045 enum hdd_tsf_capture_state tsf_state;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001046 uint64_t tsf_sync_soc_timer;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001047#endif
1048
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001049 hdd_cfg80211_state_t cfg80211State;
1050
1051#ifdef WLAN_FEATURE_PACKET_FILTERING
1052 t_multicast_add_list mc_addr_list;
1053#endif
1054 uint8_t addr_filter_pattern;
1055
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001056 bool higherDtimTransition;
1057 bool survey_idx;
1058
1059 hdd_scaninfo_t scan_info;
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001060#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001061 tAniTrafStrmMetrics tsmStats;
1062#endif
1063 /* Flag to ensure PSB is configured through framework */
1064 uint8_t psbChanged;
1065 /* UAPSD psb value configured through framework */
1066 uint8_t configuredPsb;
1067#ifdef IPA_OFFLOAD
1068 void *ipa_context;
1069#endif
1070 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1071 * since CSR (PMAC Struct) Config is same for both AP
1072 */
1073 struct delayed_work acs_pending_work;
1074
1075 struct work_struct scan_block_work;
1076#ifdef MSM_PLATFORM
1077 unsigned long prev_rx_packets;
1078 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301079 uint64_t prev_fwd_tx_packets;
1080 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001081 int connection;
1082#endif
1083 bool is_roc_inprogress;
1084
1085#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301086 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001087 bool tx_flow_timer_initialized;
1088 unsigned int tx_flow_low_watermark;
1089 unsigned int tx_flow_high_watermark_offset;
1090#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1091 bool offloads_configured;
1092
1093 /* DSCP to UP QoS Mapping */
1094 sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP + 1];
1095
1096#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1097 bool isLinkLayerStatsSet;
1098#endif
1099 uint8_t linkStatus;
1100
1101 /* variable for temperature in Celsius */
1102 int temperature;
1103
1104 /* Time stamp for last completed RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301105 uint64_t last_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001106
1107 /* Time stamp for start RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301108 uint64_t start_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001109
1110 /* State for synchronous OCB requests to WMI */
1111 struct sir_ocb_set_config_response ocb_set_config_resp;
1112 struct sir_ocb_get_tsf_timer_response ocb_get_tsf_timer_resp;
1113 struct sir_dcc_get_stats_response *dcc_get_stats_resp;
1114 struct sir_dcc_update_ndl_response dcc_update_ndl_resp;
1115
1116 /* MAC addresses used for OCB interfaces */
Agrawal Ashishb141b092016-09-02 19:59:26 +05301117#ifdef WLAN_FEATURE_DSRC
Anurag Chouhan6d760662016-02-20 16:05:43 +05301118 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301120#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001121
1122 /* BITMAP indicating pause reason */
1123 uint32_t pause_map;
1124 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301125 qdf_time_t start_time;
1126 qdf_time_t last_time;
1127 qdf_time_t total_pause_time;
1128 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001129 uint8_t history_index;
1130 struct hdd_netif_queue_history
1131 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1132 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
1133 struct hdd_lro_s lro_info;
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;
Sridhar Selvarajdc400d22016-10-18 17:18:03 +05301143 struct power_stats_response *chip_power_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001144};
1145
1146#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
1147#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
1148#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.station.WextState)
1149#define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t *)pAdapter->pHddCtx)
1150#define WLAN_HDD_GET_HAL_CTX(pAdapter) (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
1151#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
1152#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001153#define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001154#ifdef FEATURE_WLAN_TDLS
1155#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
Krunal Soni276241e2016-03-10 12:58:11 -08001156 (((QDF_STA_MODE != pAdapter->device_mode) && \
1157 (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001158#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \
1159 ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \
1160 (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
1161#endif
1162
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001163#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001164#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \
1165 (&(adapter)->sessionCtx.station.ndp_ctx)
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001166#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001167#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001168/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1169 * intentionally so that all references to these must be within NDP code.
1170 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1171 * invoke NDP code to do all work.
1172 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001173#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001174#endif
1175
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001176/* Set mac address locally administered bit */
1177#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1178
1179#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1180#define HDD_RESET_MCC_P2P_QUOTA 50
1181
1182typedef struct hdd_adapter_list_node {
Anurag Chouhanffb21542016-02-17 14:33:03 +05301183 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001184 hdd_adapter_t *pAdapter;
1185} hdd_adapter_list_node_t;
1186
1187typedef struct hdd_priv_data_s {
1188 uint8_t *buf;
1189 int used_len;
1190 int total_len;
1191} hdd_priv_data_t;
1192
1193#define MAX_MOD_LOGLEVEL 10
1194typedef struct {
1195 uint8_t enable;
1196 uint8_t dl_type;
1197 uint8_t dl_report;
1198 uint8_t dl_loglevel;
1199 uint8_t index;
1200 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1201
1202} fw_log_info;
1203
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001204/**
1205 * enum antenna_mode - number of TX/RX chains
1206 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1207 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1208 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1209 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1210 */
1211enum antenna_mode {
1212 HDD_ANTENNA_MODE_INVALID,
1213 HDD_ANTENNA_MODE_1X1,
1214 HDD_ANTENNA_MODE_2X2,
1215 HDD_ANTENNA_MODE_MAX
1216};
1217
1218/**
1219 * enum smps_mode - SM power save mode
1220 * @HDD_SMPS_MODE_STATIC: Static power save
1221 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1222 * @HDD_SMPS_MODE_RESERVED: Reserved
1223 * @HDD_SMPS_MODE_DISABLED: Disable power save
1224 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1225 */
1226enum smps_mode {
1227 HDD_SMPS_MODE_STATIC,
1228 HDD_SMPS_MODE_DYNAMIC,
1229 HDD_SMPS_MODE_RESERVED,
1230 HDD_SMPS_MODE_DISABLED,
1231 HDD_SMPS_MODE_MAX
1232};
1233
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001234#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1235/**
1236 * struct hdd_offloaded_packets - request id to pattern id mapping
1237 * @request_id: request id
1238 * @pattern_id: pattern id
1239 *
1240 */
1241struct hdd_offloaded_packets {
1242 uint32_t request_id;
1243 uint8_t pattern_id;
1244};
1245
1246/**
1247 * struct hdd_offloaded_packets_ctx - offloaded packets context
1248 * @op_table: request id to pattern id table
1249 * @op_lock: mutex lock
1250 */
1251struct hdd_offloaded_packets_ctx {
1252 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1253 struct mutex op_lock;
1254};
1255#endif
1256
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301257/**
1258 * struct hdd_bpf_context - hdd Context for bpf
1259 * @magic: magic number
1260 * @completion: Completion variable for BPF Get Capability
1261 * @capability_response: capabilities response received from fw
1262 */
1263struct hdd_bpf_context {
1264 unsigned int magic;
1265 struct completion completion;
1266 struct sir_bpf_get_offload capability_response;
1267};
1268
Arun Khandavallifae92942016-08-01 13:31:08 +05301269/**
1270 * enum driver_status: Driver Modules status
1271 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1272 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1273 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1274 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1275 */
1276enum driver_modules_status {
1277 DRIVER_MODULES_UNINITIALIZED,
1278 DRIVER_MODULES_OPENED,
1279 DRIVER_MODULES_ENABLED,
1280 DRIVER_MODULES_CLOSED
1281};
1282
Agrawal Ashish65634612016-08-18 13:24:32 +05301283/**
1284 * struct acs_dfs_policy - Define ACS policies
1285 * @acs_dfs_mode: Dfs mode enabled/disabled.
1286 * @acs_channel: pre defined channel to avoid ACS.
1287 */
1288struct acs_dfs_policy {
1289 enum dfs_mode acs_dfs_mode;
1290 uint8_t acs_channel;
1291};
1292
Dustin Brown105d7902016-10-03 16:27:59 -07001293/**
1294 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1295 * SUSPEND_FAIL_IPA: IPA in progress
1296 * SUSPEND_FAIL_RADAR: radar scan in progress
1297 * SUSPEND_FAIL_ROAM: roaming in progress
1298 * SUSPEND_FAIL_SCAN: scan in progress
1299 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1300 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1301 */
1302enum suspend_fail_reason {
1303 SUSPEND_FAIL_IPA,
1304 SUSPEND_FAIL_RADAR,
1305 SUSPEND_FAIL_ROAM,
1306 SUSPEND_FAIL_SCAN,
1307 SUSPEND_FAIL_INITIAL_WAKEUP,
1308 SUSPEND_FAIL_MAX_COUNT
1309};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001310
Dustin Brown105d7902016-10-03 16:27:59 -07001311/** Adapter structure definition */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001312struct hdd_context_s {
1313 /** Global CDS context */
1314 v_CONTEXT_t pcds_context;
1315
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301316 struct wlan_objmgr_psoc *hdd_psoc;
1317 struct wlan_objmgr_pdev *hdd_pdev;
1318
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001319 /** HAL handle...*/
1320 tHalHandle hHal;
1321
1322 struct wiphy *wiphy;
1323 /* TODO Remove this from here. */
1324
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301325 qdf_spinlock_t hdd_adapter_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301326 qdf_list_t hddAdapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001327
1328 /* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID, 1 for WDS_STAID */
Anurag Chouhanf04e84f2016-03-03 10:12:12 +05301329 hdd_adapter_t *sta_to_adapter[WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2]; /* One per sta. For quick reference. */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330
1331 /** Pointer for firmware image data */
1332 const struct firmware *fw;
1333
1334 /** Pointer for configuration data */
1335 const struct firmware *cfg;
1336
1337 /** Pointer to the parent device */
1338 struct device *parent_dev;
1339
1340 /** Config values read from qcom_cfg.ini file */
1341 struct hdd_config *config;
1342
1343 struct wlan_hdd_ftm_status ftm;
1344
1345 /* Completion variable to indicate Mc Thread Suspended */
1346 struct completion mc_sus_event_var;
1347
Rajeev Kumareada0d02016-12-08 17:44:17 -08001348 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001349
1350#ifdef QCA_CONFIG_SMP
1351 bool is_ol_rx_thread_suspended;
1352#endif
1353
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001354 /* Track whether Mcast/Bcast Filter is enabled. */
1355 bool hdd_mcastbcast_filter_set;
1356
1357 bool hdd_wlan_suspended;
1358 bool suspended;
1359
1360 /* Lock to avoid race condition during start/stop bss */
1361 struct mutex sap_lock;
1362
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001363#ifdef FEATURE_OEM_DATA_SUPPORT
1364 /* OEM App registered or not */
1365 bool oem_app_registered;
1366
1367 /* OEM App Process ID */
1368 int32_t oem_pid;
1369#endif
1370
1371 /** Concurrency Parameters*/
1372 uint32_t concurrency_mode;
1373
Anurag Chouhan6d760662016-02-20 16:05:43 +05301374 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1375 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001376
1377 /** P2P Device MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301378 struct qdf_mac_addr p2pDeviceAddress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001379
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301380 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301381 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001382
1383#ifdef FEATURE_WLAN_TDLS
1384 eTDLSSupportMode tdls_mode;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001385 bool concurrency_marked;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001386 eTDLSSupportMode tdls_mode_last;
1387 tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
1388 /* maximum TDLS station number allowed upon runtime condition */
1389 uint16_t max_num_tdls_sta;
1390 /* TDLS peer connected count */
1391 uint16_t connected_peer_count;
1392 tdls_scan_context_t tdls_scan_ctxt;
1393 /* Lock to avoid race condition during TDLS operations */
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001394 qdf_spinlock_t tdls_ct_spinlock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001395 struct mutex tdls_lock;
1396 uint8_t tdls_off_channel;
1397 uint16_t tdls_channel_offset;
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301398 int32_t tdls_fw_off_chan_mode;
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001399 bool enable_tdls_connection_tracker;
1400 uint8_t tdls_external_peer_count;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001401 bool tdls_nss_switch_in_progress;
Kabilan Kannanff89f742016-08-15 18:14:10 -07001402 bool tdls_nss_teardown_complete;
1403 enum tdls_nss_transition_type tdls_nss_transition_mode;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001404 int32_t tdls_teardown_peers_cnt;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001405 struct tdls_set_state_info set_state_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001406#endif
1407
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001408 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001409
1410 /* MC/BC Filter state variable
1411 * This always contains the value that is currently
1412 * configured
1413 * */
1414 uint8_t configuredMcastBcastFilter;
1415
1416 uint8_t sus_res_mcastbcast_filter;
1417
1418 bool sus_res_mcastbcast_filter_valid;
1419
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001420 /* Use below lock to protect access to isSchedScanUpdatePending
1421 * since it will be accessed in two different contexts.
1422 */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301423 qdf_spinlock_t sched_scan_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001424
1425 /* Flag keeps track of wiphy suspend/resume */
1426 bool isWiphySuspended;
1427
1428 /* Indicates about pending sched_scan results */
1429 bool isSchedScanUpdatePending;
1430
1431#ifdef MSM_PLATFORM
1432 /* DDR bus bandwidth compute timer
1433 */
Anurag Chouhan210db072016-02-22 18:42:15 +05301434 qdf_mc_timer_t bus_bw_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001435 int cur_vote_level;
1436 spinlock_t bus_bw_lock;
1437 int cur_rx_level;
1438 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001439 int cur_tx_level;
1440 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001441#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001442
1443 struct completion ready_to_suspend;
1444 /* defining the solution type */
1445 uint32_t target_type;
1446
1447 /* defining the firmware version */
1448 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001449 uint32_t target_fw_vers_ext;
Arif Hussain1969ec82016-07-08 10:37:01 -07001450 qdf_atomic_t dfs_radar_found;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451
1452 /* defining the chip/rom version */
1453 uint32_t target_hw_version;
1454 /* defining the chip/rom revision */
1455 uint32_t target_hw_revision;
1456 /* chip/rom name */
1457 const char *target_hw_name;
1458 struct regulatory reg;
1459#ifdef FEATURE_WLAN_CH_AVOID
1460 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001461 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001462#endif /* FEATURE_WLAN_CH_AVOID */
1463
1464 uint8_t max_intf_count;
1465 uint8_t current_intf_count;
1466#ifdef WLAN_FEATURE_LPSS
1467 uint8_t lpss_support;
1468#endif
1469 uint8_t ap_arpns_support;
1470 tSirScanType ioctl_scan_mode;
1471
1472#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301473 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001474#endif
1475
1476 struct work_struct sap_start_work;
1477 bool is_sap_restart_required;
1478 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301479 qdf_spinlock_t sap_update_info_lock;
1480 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001481
1482 uint8_t dev_dfs_cac_status;
1483
1484 bool btCoexModeSet;
1485#ifdef FEATURE_GREEN_AP
1486 struct hdd_green_ap_ctx *green_ap_ctx;
1487#endif
1488 fw_log_info fw_log_settings;
1489#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301490 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001491 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001492 uint8_t *last_acs_channel_list;
1493 uint8_t num_of_channels;
1494 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001495#endif
1496
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301497 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001498 atomic_t sap_dfs_ref_cnt;
1499
1500#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1501 bool is_extwow_app_type1_param_set;
1502 bool is_extwow_app_type2_param_set;
1503 bool ext_wow_should_suspend;
1504 struct completion ready_to_extwow;
1505#endif
1506
1507 /* Time since boot up to extscan start (in micro seconds) */
1508 uint64_t ext_scan_start_since_boot;
1509 unsigned long g_event_flags;
1510 /* RoC request queue and work */
1511 struct delayed_work roc_req_work;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301512 qdf_spinlock_t hdd_roc_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301513 qdf_list_t hdd_roc_req_q;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301514 qdf_spinlock_t hdd_scan_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301515 qdf_list_t hdd_scan_req_q;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001516 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301517
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001518#ifdef WLAN_NS_OFFLOAD
1519 /* IPv6 notifier callback for handling NS offload on change in IP */
1520 struct notifier_block ipv6_notifier;
1521#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301522 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001523 /* IPv4 notifier callback for handling ARP offload on change in IP */
1524 struct notifier_block ipv4_notifier;
1525
1526 /* number of rf chains supported by target */
1527 uint32_t num_rf_chains;
1528 /* Is htTxSTBC supported by target */
1529 uint8_t ht_tx_stbc_supported;
1530#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1531 struct hdd_offloaded_packets_ctx op_ctx;
1532#endif
1533 bool mcc_mode;
1534#ifdef WLAN_FEATURE_MEMDUMP
1535 uint8_t *fw_dump_loc;
1536 uint32_t dump_loc_paddr;
Anurag Chouhan210db072016-02-22 18:42:15 +05301537 qdf_mc_timer_t memdump_cleanup_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001538 struct mutex memdump_lock;
1539 bool memdump_in_progress;
Sachin Ahuja02dd2e72016-09-03 16:17:51 +05301540 bool memdump_init_done;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001541#endif /* WLAN_FEATURE_MEMDUMP */
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301542 uint16_t driver_dump_size;
1543 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001544
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001545 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301546 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001547
1548 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301549 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001550
Krunal Sonie3531942016-04-12 17:43:53 -07001551 /*
1552 * place to store FTM capab of target. This allows changing of FTM capab
1553 * at runtime and intersecting it with target capab before updating.
1554 */
1555 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001556 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001557 /* completion variable to indicate set antenna mode complete*/
1558 struct completion set_antenna_mode_cmpl;
1559 /* Current number of TX X RX chains being used */
1560 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301561 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001562
1563 /* the radio index assigned by cnss_logger */
1564 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301565 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301566 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301567 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001568#ifdef WLAN_FEATURE_NAN_DATAPATH
1569 bool nan_datapath_enabled;
1570#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301571 /* Present state of driver cds modules */
1572 enum driver_modules_status driver_status;
1573 /* MC timer interface change */
1574 qdf_mc_timer_t iface_change_timer;
1575 /* Interface change lock */
1576 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301577 bool rps;
1578 bool enableRxThread;
1579 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301580 bool stop_modules_in_progress;
1581 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001582 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301583 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301584 uint16_t wmi_max_len;
Dustin Brown105d7902016-10-03 16:27:59 -07001585 /* counters for failed suspend reasons */
1586 uint32_t suspend_fail_stats[SUSPEND_FAIL_MAX_COUNT];
Komal Seelam8634b772016-09-29 12:12:24 +05301587 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301588 bool roaming_in_progress;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301589 /* bit map to set/reset TDLS by different sources */
1590 unsigned long tdls_source_bitmap;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301591 /* tdls source timer to enable/disable TDLS on p2p listen */
1592 qdf_mc_timer_t tdls_source_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001593};
1594
1595/*---------------------------------------------------------------------------
1596 Function declarations and documentation
1597 -------------------------------------------------------------------------*/
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301598int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter,
1599 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001600 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001601#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1602void wlan_hdd_check_sta_ap_concurrent_ch_intf(void *sta_pAdapter);
1603#endif
1604
1605const char *hdd_device_mode_to_string(uint8_t device_mode);
1606
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301607QDF_STATUS hdd_get_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001608 hdd_adapter_list_node_t **ppAdapterNode);
1609
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301610QDF_STATUS hdd_get_next_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001611 hdd_adapter_list_node_t *pAdapterNode,
1612 hdd_adapter_list_node_t **pNextAdapterNode);
1613
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301614QDF_STATUS hdd_remove_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001615 hdd_adapter_list_node_t *pAdapterNode);
1616
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301617QDF_STATUS hdd_remove_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001618 hdd_adapter_list_node_t **ppAdapterNode);
1619
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301620QDF_STATUS hdd_add_adapter_back(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001621 hdd_adapter_list_node_t *pAdapterNode);
1622
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301623QDF_STATUS hdd_add_adapter_front(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001624 hdd_adapter_list_node_t *pAdapterNode);
1625
1626hdd_adapter_t *hdd_open_adapter(hdd_context_t *pHddCtx, uint8_t session_type,
1627 const char *name, tSirMacAddr macAddr,
Ryan Hsu07495ea2016-01-21 15:25:39 -08001628 unsigned char name_assign_type,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001629 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301630QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001631 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301632QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
1633QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
Hanumanth Reddy Pothula9f4048f2016-09-30 15:06:57 +05301634void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301635QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
1636QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001637hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
1638 uint32_t vdev_id);
1639hdd_adapter_t *hdd_get_adapter_by_macaddr(hdd_context_t *pHddCtx,
1640 tSirMacAddr macAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301641QDF_STATUS hdd_init_station_mode(hdd_adapter_t *pAdapter);
Krunal Soni276241e2016-03-10 12:58:11 -08001642hdd_adapter_t *hdd_get_adapter(hdd_context_t *pHddCtx,
1643 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001644void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
1645 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301646QDF_STATUS hdd_stop_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001647 const bool bCloseSession);
1648void hdd_set_station_ops(struct net_device *pWlanDev);
1649uint8_t *wlan_hdd_get_intf_addr(hdd_context_t *pHddCtx);
1650void wlan_hdd_release_intf_addr(hdd_context_t *pHddCtx, uint8_t *releaseAddr);
Krunal Soni276241e2016-03-10 12:58:11 -08001651uint8_t hdd_get_operating_channel(hdd_context_t *pHddCtx,
1652 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001653
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001654void hdd_set_conparam(uint32_t con_param);
Anurag Chouhan6d760662016-02-20 16:05:43 +05301655enum tQDF_GLOBAL_CON_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001656
1657void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
1658 eCsrAbortReason reason);
1659void hdd_cleanup_actionframe(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
1660
1661void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
1662void wlan_hdd_reset_prob_rspies(hdd_adapter_t *pHostapdAdapter);
1663void hdd_prevent_suspend(uint32_t reason);
1664void hdd_allow_suspend(uint32_t reason);
1665void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001666
1667void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301668QDF_STATUS hdd_set_ibss_power_save_params(hdd_adapter_t *pAdapter);
1669QDF_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001670void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
1671int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
1672bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301673QDF_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001674
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001675struct qdf_mac_addr *
1676hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
1677 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001678void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001679#ifdef MSM_PLATFORM
1680void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
1681void hdd_stop_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
Prashanth Bhattaab004382016-10-11 16:08:11 -07001682
1683/**
1684 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
1685 * hdd_ctx: HDD context
1686 *
1687 * Initialize bus bandwidth related data structures like spinlock and timer.
1688 *
1689 * Return: None.
1690 */
1691int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx);
1692
1693/**
1694 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
1695 * hdd_ctx: HDD context
1696 *
1697 * Destroy bus bandwidth related data structures like timer.
1698 *
1699 * Return: None.
1700 */
1701void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001702#else
1703static inline void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter)
1704{
1705 return;
1706}
1707
1708static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
1709{
1710 return;
1711}
Prashanth Bhattaab004382016-10-11 16:08:11 -07001712
Leo Changfdb45c32016-10-28 11:09:23 -07001713static inline int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001714{
1715 return 0;
1716}
1717
Leo Changfdb45c32016-10-28 11:09:23 -07001718static inline void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001719{
1720 return;
1721}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722#endif
1723
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08001724int hdd_init(void);
1725void hdd_deinit(void);
1726
Arun Khandavallifae92942016-08-01 13:31:08 +05301727int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001728void __hdd_wlan_exit(void);
1729int hdd_wlan_notify_modem_power_state(int state);
1730#ifdef QCA_HT_2040_COEX
1731int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301732 struct qdf_mac_addr macAddrSTA, int width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001733#endif
1734
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05301735void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001736#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1737void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
1738#endif
1739
1740hdd_adapter_t *hdd_get_con_sap_adapter(hdd_adapter_t *this_sap_adapter,
1741 bool check_start_bss);
1742
1743bool hdd_is_5g_supported(hdd_context_t *pHddCtx);
1744
1745int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter);
1746
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001747void hdd_get_fw_version(hdd_context_t *hdd_ctx,
1748 uint32_t *major_spid, uint32_t *minor_spid,
1749 uint32_t *siid, uint32_t *crmid);
1750
1751#ifdef WLAN_FEATURE_MEMDUMP
1752/**
1753 * hdd_is_memdump_supported() - to check if memdump feature support
1754 *
1755 * This function is used to check if memdump feature is supported in
1756 * the host driver
1757 *
1758 * Return: true if supported and false otherwise
1759 */
1760static inline bool hdd_is_memdump_supported(void)
1761{
1762 return true;
1763}
1764#else
1765static inline bool hdd_is_memdump_supported(void)
1766{
1767 return false;
1768}
1769#endif /* WLAN_FEATURE_MEMDUMP */
1770
1771void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301772 struct qdf_mac_addr hw_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001773void wlan_hdd_disable_roaming(hdd_adapter_t *pAdapter);
1774void wlan_hdd_enable_roaming(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001775
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301776QDF_STATUS hdd_post_cds_enable_config(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001777
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301778QDF_STATUS hdd_abort_mac_scan_all_adapters(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001779
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301780QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001781 hdd_adapter_t *ap_adapter,
1782 tCsrRoamProfile *roam_profile,
1783 tScanResultHandle *scan_cache,
1784 bool *concurrent_chnl_same);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001785void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
1786void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001787
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001788void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
1789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001790#ifdef QCA_CONFIG_SMP
1791int wlan_hdd_get_cpu(void);
1792#else
1793static inline int wlan_hdd_get_cpu(void)
1794{
1795 return 0;
1796}
1797#endif
1798
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301799void wlan_hdd_sap_pre_cac_failure(void *data);
1800void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
1801
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001802void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
1803 enum netif_action_type action, enum netif_reason_type reason);
1804
1805void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
Nirav Shahed34b212016-04-25 10:59:16 +05301806void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001807void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
1808void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
1809void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx);
1810void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx);
1811const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05301812void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
1813hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
1814 uint32_t sme_session_id);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001815enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301816uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
1817 uint8_t bw_offset);
Arun Khandavallic811dcc2016-06-26 07:37:21 +05301818int hdd_update_config(hdd_context_t *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001819
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05301820QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301821 struct net_device *dev,
1822 struct hdd_chan_change_params chan_change);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301823int wlan_hdd_set_channel(struct wiphy *wiphy,
1824 struct net_device *dev,
1825 struct cfg80211_chan_def *chandef,
1826 enum nl80211_channel_type channel_type);
1827int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
1828 struct cfg80211_beacon_data *params,
1829 const u8 *ssid, size_t ssid_len,
1830 enum nl80211_hidden_ssid hidden_ssid,
Archana Ramachandran1a5b6042016-11-08 16:36:50 -08001831 bool check_for_concurrency,
1832 bool update_beacon);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301833#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1834QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void);
1835#else
1836static inline QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
1837{
Krunal Soni276241e2016-03-10 12:58:11 -08001838 return QDF_STATUS_SUCCESS;
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301839}
1840#endif
1841
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001842#if !defined(REMOVE_PKT_LOG)
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301843int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
1844 int set_value2);
1845int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
1846 uint8_t user_triggered, int size);
1847
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001848#else
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301849static inline int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
1850 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001851{
1852 return 0;
1853}
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301854static inline int hdd_process_pktlog_command(hdd_context_t *hdd_ctx,
1855 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001856{
1857 return 0;
1858}
1859#endif /* REMOVE_PKT_LOG */
1860
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001861#ifdef FEATURE_TSO
1862/**
1863 * hdd_set_tso_flags() - enable TSO flags in the network device
1864 * @hdd_ctx: HDD context
1865 * @wlan_dev: network device structure
1866 *
1867 * This function enables the TSO related feature flags in the
1868 * given network device.
1869 *
1870 * Return: none
1871 */
1872static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
1873 struct net_device *wlan_dev)
1874{
1875 if (hdd_ctx->config->tso_enable) {
1876 hdd_info("TSO Enabled");
1877 wlan_dev->features |=
1878 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1879 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
1880 }
1881}
1882#else
1883static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
1884 struct net_device *wlan_dev){}
1885#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001886
Agrawal Ashishc9ddbab2016-05-25 12:04:47 +05301887#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
1888 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
1889void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
1890#else
1891static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
1892{
1893}
1894#endif
1895
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001896#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07001897static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001898{
1899 return hdd_ctx->config->isRoamOffloadEnabled;
1900}
1901#else
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07001902static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001903{
1904 return false;
1905}
1906#endif
1907
Rajeev Kumar94c9b452016-03-24 12:58:47 -07001908void hdd_get_ibss_peer_info_cb(void *pUserData,
1909 tSirPeerInfoRspParams *pPeerInfo);
1910
Ryan Hsuceddceb2016-04-28 10:20:14 -07001911#ifdef CONFIG_CNSS_LOGGER
1912/**
1913 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
1914 * @hdd_ctx: the hdd context pointer
1915 *
1916 * The nl_srv_init() will call to cnss_logger_device_register() and
1917 * expect to get a radio_index from cnss_logger module and assign to
1918 * hdd_ctx->radio_index, then to maintain the consistency to original
1919 * design, adding the radio_index check here, then return the error
1920 * code if radio_index is not assigned correctly, which means the nl_init
1921 * from cnss_logger is failed.
1922 *
1923 * Return: 0 if successfully, otherwise error code
1924 */
1925static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
1926{
1927 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
1928
1929 /* radio_index is assigned from 0, so only >=0 will be valid index */
1930 if (hdd_ctx->radio_index >= 0)
1931 return 0;
1932 else
1933 return -EINVAL;
1934}
1935#else
1936/**
1937 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
1938 * @hdd_ctx: the hdd context pointer
1939 *
1940 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
1941 * the netlink socket and return the success or not.
1942 *
1943 * Return: the return value from nl_srv_init()
1944 */
1945static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
1946{
1947 return nl_srv_init(hdd_ctx->wiphy);
1948}
1949#endif
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001950QDF_STATUS hdd_sme_close_session_callback(void *pContext);
1951
Varun Reddy Yeturu3e91dad2016-07-18 15:58:47 -07001952int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08001953 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05301954void hdd_svc_fw_shutdown_ind(struct device *dev);
Arun Khandavalli4b55da72016-07-19 19:55:01 +05301955int hdd_register_cb(hdd_context_t *hdd_ctx);
1956void hdd_deregister_cb(hdd_context_t *hdd_ctx);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05301957int hdd_start_station_adapter(hdd_adapter_t *adapter);
1958int hdd_start_ap_adapter(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05301959int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05301960int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
Arun Khandavalli2358d522016-05-16 18:05:37 +05301961int hdd_set_fw_params(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05301962int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
1963 bool reinit);
Prashanth Bhatta2ac92bd2016-10-11 16:08:00 -07001964int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx);
Arun Khandavallifae92942016-08-01 13:31:08 +05301965int hdd_start_adapter(hdd_adapter_t *adapter);
Anurag Chouhanc4092922016-09-08 15:56:11 +05301966void hdd_connect_result(struct net_device *dev, const u8 *bssid,
1967 tCsrRoamInfo *roam_info, const u8 *req_ie,
1968 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05301969 size_t resp_ie_len, u16 status, gfp_t gfp,
1970 bool connect_timeout);
Anurag Chouhanc4092922016-09-08 15:56:11 +05301971
Arun Khandavallifae92942016-08-01 13:31:08 +05301972#ifdef WLAN_FEATURE_FASTPATH
1973void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
1974 void *context);
1975#else
1976static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
1977 void *context)
1978{
1979}
1980#endif
1981void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
Agrawal Ashish65634612016-08-18 13:24:32 +05301982enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Agrawal Ashish467dde42016-09-08 18:44:22 +05301983void hdd_ch_avoid_cb(void *hdd_context, void *indi_param);
1984void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx);
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05301985int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
1986 uint8_t set_value);
Liangwei Dong8baf7c82016-10-11 01:26:59 -04001987void wlan_hdd_undo_acs(hdd_adapter_t *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07001988
1989#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
1990static inline int
1991hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
1992{
1993 return nla_put_u64(skb, attrtype, value);
1994}
1995#else
1996static inline int
1997hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
1998{
1999 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2000}
2001#endif
2002
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302003static inline int wlan_hdd_validate_session_id(u8 session_id)
2004{
2005 if (session_id != HDD_SESSION_ID_INVALID)
2006 return 0;
2007
2008 return -EINVAL;
2009}
2010
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002011bool hdd_is_roaming_in_progress(void);
2012void hdd_set_roaming_in_progress(bool value);
2013
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05302014/**
2015 * hdd_create_and_store_psoc() - Create psoc object and store in hdd context
2016 * @hdd_ctx: Hdd context
2017 * @psoc_id: Psoc Id
2018 *
2019 * This API creates Psoc object with given @psoc_id and store the psoc reference
2020 * to hdd context
2021 *
2022 * Return: QDF_STATUS
2023 */
2024QDF_STATUS hdd_create_and_store_psoc(hdd_context_t *hdd_ctx, uint8_t psoc_id);
2025
2026/**
2027 * hdd_destroy_and_release_psoc() - Deletes the psoc object
2028 * @hdd_ctx: Hdd context
2029 *
2030 * This API deletes psoc object and release its reference from hdd context
2031 *
2032 * Return: QDF_STATUS
2033 */
2034QDF_STATUS hdd_destroy_and_release_psoc(hdd_context_t *hdd_ctx);
2035
2036/**
2037 * hdd_create_and_store_pdev() - Create pdev object and store in hdd context
2038 * @hdd_ctx: Hdd context
2039 *
2040 * This API creates the pdev object and store the pdev reference to hdd context
2041 *
2042 * Return: QDF_STATUS
2043 */
2044QDF_STATUS hdd_create_and_store_pdev(hdd_context_t *hdd_ctx);
2045
2046/**
2047 * hdd_destroy_and_release_pdev() - Deletes the pdev object
2048 * @hdd_ctx: Hdd context
2049 *
2050 * This API deletes pdev object and release its reference from hdd context
2051 *
2052 * Return: QDF_STATUS
2053 */
2054QDF_STATUS hdd_destroy_and_release_pdev(hdd_context_t *hdd_ctx);
2055
2056/**
2057 * hdd_create_and_store_vdev() - Create vdev object and store in hdd adapter
2058 * @pdev: pdev pointer
2059 * @adapter: hdd adapter
2060 *
2061 * This API creates the vdev object and store the vdev reference to the
2062 * given @adapter. Also, creates a self peer for the vdev. If the adapter
2063 * session id and vdev id of the new vdev object doesnot match, destroys the
2064 * created vdev object and returns failure
2065 *
2066 * Return: QDF_STATUS
2067 */
2068QDF_STATUS hdd_create_and_store_vdev(struct wlan_objmgr_pdev *pdev,
2069 hdd_adapter_t *adapter);
2070
2071/**
2072 * hdd_destroy_and_release_vdev() - Delete the vdev object
2073 * @hdd_ctx: Hdd context
2074 *
2075 * This API deletes vdev object and release its reference from hdd adapter
2076 *
2077 * Return: QDF_STATUS
2078 */
2079QDF_STATUS hdd_destroy_and_release_vdev(hdd_adapter_t *adapter);
2080
2081/**
2082 * hdd_add_peer_object() - Create and add the peer object to the vdev
2083 * @vdev: vdev pointer
2084 * @adapter_mode: adapter mode
2085 * @mac_addr: Peer mac address
2086 *
2087 * This API creates and adds the peer object to the given @vdev. The peer type
2088 * (STA, AP or IBSS) is assigned based on adapter mode. For example, if adapter
2089 * mode is STA, peer is AP.
2090 *
2091 * Return: QDF_STATUS
2092 */
2093QDF_STATUS hdd_add_peer_object(struct wlan_objmgr_vdev *vdev,
2094 enum tQDF_ADAPTER_MODE adapter_mode,
2095 uint8_t *mac_addr);
2096
2097/**
2098 * hdd_remove_peer_object() - Delete and remove the peer from vdev
2099 * @vdev: vdev pointer
2100 * @mac_addr: Peer Mac address
2101 *
2102 * This API finds the peer object from given @mac_addr and deletes the same.
2103 *
2104 * Return: QDF_STATUS
2105 */
2106QDF_STATUS hdd_remove_peer_object(struct wlan_objmgr_vdev *vdev,
2107 uint8_t *mac_addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002108#endif /* end #if !defined(WLAN_HDD_MAIN_H) */