blob: c94c2ae7dac9cc51493d22834d4ce1aea8ca0384 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Prashanth Bhatta9e143052015-12-04 11:56:47 -08002 * Copyright (c) 2012-2016 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>
57#ifdef FEATURE_WLAN_TDLS
58#include "wlan_hdd_tdls.h"
59#endif
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070060#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053062#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080063#ifdef WLAN_FEATURE_MBSSID
64#include "sap_api.h"
65#endif
66#include "ol_txrx_osif_api.h"
67#include "ol_txrx_ctrl_api.h"
68#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080069#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070070#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070071#include "wlan_hdd_nan_datapath.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070072
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080073/*---------------------------------------------------------------------------
74 Preprocessor definitions and constants
75 -------------------------------------------------------------------------*/
76/** Number of Tx Queues */
77#ifdef QCA_LL_TX_FLOW_CONTROL_V2
78#define NUM_TX_QUEUES 5
79#else
80#define NUM_TX_QUEUES 4
81#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -080082
83/** Length of the TX queue for the netdev */
84#define HDD_NETDEV_TX_QUEUE_LEN (3000)
85
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080086/** Hdd Tx Time out value */
87#ifdef LIBRA_LINUX_PC
88#define HDD_TX_TIMEOUT (8000)
89#else
90#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
91#endif
92/** Hdd Default MTU */
93#define HDD_DEFAULT_MTU (1500)
94
95#ifdef QCA_CONFIG_SMP
96#define NUM_CPUS NR_CPUS
97#else
98#define NUM_CPUS 1
99#endif
100
101/**event flags registered net device*/
102#define NET_DEVICE_REGISTERED (0)
103#define SME_SESSION_OPENED (1)
104#define INIT_TX_RX_SUCCESS (2)
105#define WMM_INIT_DONE (3)
106#define SOFTAP_BSS_STARTED (4)
107#define DEVICE_IFACE_OPENED (5)
108#define TDLS_INIT_DONE (6)
109#define ACS_PENDING (7)
110
111/* HDD global event flags */
112#define ACS_IN_PROGRESS (0)
113
114/** Maximum time(ms)to wait for disconnect to complete **/
115#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530116#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530118#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800119#endif
120#define WLAN_WAIT_TIME_STATS 800
121#define WLAN_WAIT_TIME_POWER 800
122#define WLAN_WAIT_TIME_COUNTRY 1000
123#define WLAN_WAIT_TIME_LINK_STATUS 800
124/* Amount of time to wait for sme close session callback.
125 This value should be larger than the timeout used by WDI to wait for
126 a response from WCNSS */
127#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
128#define WLAN_WAIT_TIME_ABORTSCAN 2000
129
130/** Maximum time(ms) to wait for mc thread suspend **/
131#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
132
133/** Maximum time(ms) to wait for target to be ready for suspend **/
134#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
135
136/** Maximum time(ms) to wait for tdls add sta to complete **/
137#define WAIT_TIME_TDLS_ADD_STA 1500
138
139/** Maximum time(ms) to wait for tdls del sta to complete **/
140#define WAIT_TIME_TDLS_DEL_STA 1500
141
142/** Maximum time(ms) to wait for Link Establish Req to complete **/
143#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
144
145/** Maximum time(ms) to wait for tdls mgmt to complete **/
146#define WAIT_TIME_TDLS_MGMT 11000
147
148/* Scan Req Timeout */
149#define WLAN_WAIT_TIME_SCAN_REQ 100
150
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800151#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
152#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
153
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530154#define WLAN_WAIT_TIME_BPF 1000
155
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800156#define MAX_NUMBER_OF_ADAPTERS 4
157
158#define MAX_CFG_STRING_LEN 255
159
160#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
161/** Mac Address string **/
162#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
163#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
164#define MAX_GENIE_LEN 255
165
166#define WLAN_CHIP_VERSION "WCNSS"
167
Jeff Johnson32ad1742015-12-09 13:26:44 -0800168#ifndef HDD_DISALLOW_LEGACY_HDDLOG
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530169#define hddLog(level, args ...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Jeff Johnson32ad1742015-12-09 13:26:44 -0800170#endif
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530171#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800172#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
173
174#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530175 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530177 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530179 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180#define hdd_notice(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530181 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800182#define hdd_info(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530183 hdd_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800184#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530185 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530187#define ENTER() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter")
Jeff Johnson398b3d62016-02-10 17:19:39 -0800188#define ENTER_DEV(dev) \
189 hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter(%s)", (dev)->name)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530190#define EXIT() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "exit")
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191
192#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t *)(netdev_priv((__dev__)))
193
194#define MAX_NO_OF_2_4_CHANNELS 14
195
196#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
197#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
198#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
199#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
200#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
201#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
202#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
203#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
204#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
205#define WLAN_HDD_WFA_OUI 0x506F9A
206#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
207#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
208#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
209#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
210
211#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
212 (((center_freq) == 2412) || ((center_freq) == 2437) || ((center_freq) == 2462))
213
214#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
215 (((center_freq) == 5180) || ((center_freq) == 5200) \
216 || ((center_freq) == 5220) || ((center_freq) == 5240))
217
218#ifdef WLAN_FEATURE_11W
219#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
220#endif
221
222#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
223#define WLAN_HDD_TDLS_ACTION_FRAME 12
224#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
225#define HDD_WAKE_LOCK_DURATION 50 /* in msecs */
226#endif
227
228#define WLAN_HDD_QOS_ACTION_FRAME 1
229#define WLAN_HDD_QOS_MAP_CONFIGURE 4
230#define HDD_SAP_WAKE_LOCK_DURATION 10000 /* in msecs */
231
Mukul Sharma974ca652016-09-03 16:24:48 +0530232#if defined(CONFIG_HL_SUPPORT)
233#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
234#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800235#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530236#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237
238#ifdef WLAN_FEATURE_GTK_OFFLOAD
239#define GTK_OFFLOAD_ENABLE 0
240#define GTK_OFFLOAD_DISABLE 1
241#endif
242
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800243#define MAX_USER_COMMAND_SIZE 4096
244
245#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
246#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
247
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530248/* FW expects burst duration in 1020*ms */
249#define SIFS_BURST_DUR_MULTIPLIER 1020
250#define SIFS_BURST_DUR_MAX 12240
251
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800252/* If IPA UC data path is enabled, target should reserve extra tx descriptors
253 * for IPA data path.
254 * Then host data path should allow less TX packet pumping in case
255 * IPA data path enabled
256 */
257#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
258
Ryan Hsu07495ea2016-01-21 15:25:39 -0800259/*
260 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
261 * here if the Kernel version is less than 3.17 to avoid the interleave
262 * conditional compilation.
263 */
264#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS))
265#define NET_NAME_UNKNOWN 0
266#endif
267
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800268#define BSS_WAIT_TIMEOUT 10000
269
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530270#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530271
272/* session ID invalid */
273#define HDD_SESSION_ID_INVALID 0xFF
274
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800275/*
276 * Generic asynchronous request/response support
277 *
278 * Many of the APIs supported by HDD require a call to SME to
279 * perform an action or to retrieve some data. In most cases SME
280 * performs the operation asynchronously, and will execute a provided
281 * callback function when the request has completed. In order to
282 * synchronize this the HDD API allocates a context which is then
283 * passed to SME, and which is then, in turn, passed back to the
284 * callback function when the operation completes. The callback
285 * function then sets a completion variable inside the context which
286 * the HDD API is waiting on. In an ideal world the HDD API would
287 * wait forever (or at least for a long time) for the response to be
288 * received and for the completion variable to be set. However in
289 * most cases these HDD APIs are being invoked in the context of a
290 * user space thread which has invoked either a cfg80211 API or a
291 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
292 * Since this lock is used to synchronize many of the kernel tasks, we
293 * do not want to hold it for a long time. In addition we do not want
294 * to block user space threads (such as the wpa supplicant's main
295 * thread) for an extended time. Therefore we only block for a short
296 * time waiting for the response before we timeout. This means that
297 * it is possible for the HDD API to timeout, and for the callback to
298 * be invoked afterwards. In order for the callback function to
299 * determine if the HDD API is still waiting, a magic value is also
300 * stored in the shared context. Only if the context has a valid
301 * magic will the callback routine do any work. In order to further
302 * synchronize these activities a spinlock is used so that if any HDD
303 * API timeout coincides with its callback, the operations of the two
304 * threads will be serialized.
305 */
306
307struct statsContext {
308 struct completion completion;
309 hdd_adapter_t *pAdapter;
310 unsigned int magic;
311};
312
313struct linkspeedContext {
314 struct completion completion;
315 hdd_adapter_t *pAdapter;
316 unsigned int magic;
317};
318
319extern spinlock_t hdd_context_lock;
320
321#define STATS_CONTEXT_MAGIC 0x53544154 /* STAT */
322#define RSSI_CONTEXT_MAGIC 0x52535349 /* RSSI */
323#define POWER_CONTEXT_MAGIC 0x504F5752 /* POWR */
324#define SNR_CONTEXT_MAGIC 0x534E5200 /* SNR */
325#define LINK_CONTEXT_MAGIC 0x4C494E4B /* LINKSPEED */
326#define LINK_STATUS_MAGIC 0x4C4B5354 /* LINKSTATUS(LNST) */
327#define TEMP_CONTEXT_MAGIC 0x74656d70 /* TEMP (temperature) */
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530328#define BPF_CONTEXT_MAGIC 0x4575354 /* BPF */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800329
330/* MAX OS Q block time value in msec
331 * Prevent from permanent stall, resume OS Q if timer expired */
332#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
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800336#define NUM_TX_RX_HISTOGRAM 1024
337#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
344 * @total_rx: # of total rx packets received on interface
345 * @total_tx: # of total tx packets received on interface
Yuanyuan Liu13738502016-04-06 17:41:37 -0700346 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800347 * determined on the basis of total tx and rx packets
348 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700349 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800350 * determined on the basis of rx packets received in the
351 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700352 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800353 * determined on the basis of tx packets received in the
354 * last 100ms interval
355 *
356 * The structure keeps track of throughput requirements of wlan driver in 100ms
357 * intervals for later analysis.
358 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800359struct hdd_tx_rx_histogram {
360 uint64_t interval_rx;
361 uint64_t interval_tx;
362 uint64_t total_rx;
363 uint64_t total_tx;
364 uint32_t next_vote_level;
365 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800366 uint32_t next_tx_level;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800367};
368
369typedef struct hdd_tx_rx_stats_s {
370 /* start_xmit stats */
371 __u32 txXmitCalled;
372 __u32 txXmitDropped;
373 __u32 txXmitClassifiedAC[NUM_TX_QUEUES];
374 __u32 txXmitDroppedAC[NUM_TX_QUEUES];
375 /* complete_cbk_stats */
376 __u32 txCompleted;
377 /* rx stats */
378 __u32 rxPackets[NUM_CPUS];
379 __u32 rxDropped[NUM_CPUS];
380 __u32 rxDelivered[NUM_CPUS];
381 __u32 rxRefused[NUM_CPUS];
382
383 /* txflow stats */
384 bool is_txflow_paused;
385 __u32 txflow_pause_cnt;
386 __u32 txflow_unpause_cnt;
387 __u32 txflow_timer_cnt;
388} hdd_tx_rx_stats_t;
389
390#ifdef WLAN_FEATURE_11W
391typedef struct hdd_pmf_stats_s {
392 uint8_t numUnprotDeauthRx;
393 uint8_t numUnprotDisassocRx;
394} hdd_pmf_stats_t;
395#endif
396
397typedef struct hdd_stats_s {
398 tCsrSummaryStatsInfo summary_stat;
399 tCsrGlobalClassAStatsInfo ClassA_stat;
400 tCsrGlobalClassBStatsInfo ClassB_stat;
401 tCsrGlobalClassCStatsInfo ClassC_stat;
402 tCsrGlobalClassDStatsInfo ClassD_stat;
403 tCsrPerStaStatsInfo perStaStats;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530404 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800405 hdd_tx_rx_stats_t hddTxRxStats;
406#ifdef WLAN_FEATURE_11W
407 hdd_pmf_stats_t hddPmfStats;
408#endif
409} hdd_stats_t;
410
411typedef enum {
412 HDD_ROAM_STATE_NONE,
413
414 /* Issuing a disconnect due to transition into low power states. */
415 HDD_ROAM_STATE_DISCONNECTING_POWER,
416
417 /* move to this state when HDD sets a key with SME/CSR. Note this is */
418 /* an important state to get right because we will get calls into our SME */
419 /* callback routine for SetKey activity that we did not initiate! */
420 HDD_ROAM_STATE_SETTING_KEY,
421} HDD_ROAM_STATE;
422
423typedef struct roaming_info_s {
424 HDD_ROAM_STATE roamingState;
Anurag Chouhance0dc992016-02-16 18:18:03 +0530425 qdf_event_t roamingEvent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800426
427 tSirMacAddr bssid;
428 tSirMacAddr peerMac;
429 uint32_t roamId;
430 eRoamCmdStatus roamStatus;
431 bool deferKeyComplete;
432
433} roaming_info_t;
434
435#ifdef FEATURE_WLAN_WAPI
436/* Define WAPI macros for Length, BKID count etc*/
437#define MAX_WPI_KEY_LENGTH 16
438#define MAX_NUM_PN 16
439#define MAC_ADDR_LEN 6
440#define MAX_ADDR_INDEX 12
441#define MAX_NUM_AKM_SUITES 16
442#define MAX_NUM_UNI_SUITES 16
443#define MAX_NUM_BKIDS 16
444
445/** WAPI AUTH mode definition */
446enum _WAPIAuthMode {
447 WAPI_AUTH_MODE_OPEN = 0,
448 WAPI_AUTH_MODE_PSK = 1,
449 WAPI_AUTH_MODE_CERT
450} __packed;
451typedef enum _WAPIAuthMode WAPIAuthMode;
452
453/** WAPI Work mode structure definition */
454#define WZC_ORIGINAL 0
455#define WAPI_EXTENTION 1
456
457struct _WAPI_FUNCTION_MODE {
458 unsigned char wapiMode;
459} __packed;
460
461typedef struct _WAPI_FUNCTION_MODE WAPI_FUNCTION_MODE;
462
463typedef struct _WAPI_BKID {
464 uint8_t bkid[16];
465} WAPI_BKID, *pWAPI_BKID;
466
467/** WAPI Association information structure definition */
468struct _WAPI_AssocInfo {
469 uint8_t elementID;
470 uint8_t length;
471 uint16_t version;
472 uint16_t akmSuiteCount;
473 uint32_t akmSuite[MAX_NUM_AKM_SUITES];
474 uint16_t unicastSuiteCount;
475 uint32_t unicastSuite[MAX_NUM_UNI_SUITES];
476 uint32_t multicastSuite;
477 uint16_t wapiCability;
478 uint16_t bkidCount;
479 WAPI_BKID bkidList[MAX_NUM_BKIDS];
480} __packed;
481
482typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
483typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
484
485/** WAPI KEY Type definition */
486enum _WAPIKeyType {
487 PAIRWISE_KEY, /* 0 */
488 GROUP_KEY /* 1 */
489} __packed;
490typedef enum _WAPIKeyType WAPIKeyType;
491
492/** WAPI KEY Direction definition */
493enum _KEY_DIRECTION {
494 None,
495 Rx,
496 Tx,
497 Rx_Tx
498} __packed;
499
500typedef enum _KEY_DIRECTION WAPI_KEY_DIRECTION;
501
502/* WAPI KEY structure definition */
503struct WLAN_WAPI_KEY {
504 WAPIKeyType keyType;
505 WAPI_KEY_DIRECTION keyDirection; /*reserved for future use */
506 uint8_t keyId;
507 uint8_t addrIndex[MAX_ADDR_INDEX]; /*reserved for future use */
508 int wpiekLen;
509 uint8_t wpiek[MAX_WPI_KEY_LENGTH];
510 int wpickLen;
511 uint8_t wpick[MAX_WPI_KEY_LENGTH];
512 uint8_t pn[MAX_NUM_PN]; /*reserved for future use */
513} __packed;
514
515typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
516typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
517
518#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
519#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
520#define WLAN_EID_WAPI 68
521#define WAPI_PSK_AKM_SUITE 0x02721400
522#define WAPI_CERT_AKM_SUITE 0x01721400
523
524/* WAPI BKID List structure definition */
525struct _WLAN_BKID_LIST {
526 uint32_t length;
527 uint32_t BKIDCount;
528 WAPI_BKID BKID[1];
529} __packed;
530
531typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
532typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
533
534/* WAPI Information structure definition */
535struct hdd_wapi_info_s {
536 uint32_t nWapiMode;
537 bool fIsWapiSta;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530538 struct qdf_mac_addr cachedMacAddr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800539 uint8_t wapiAuthMode;
540} __packed;
541typedef struct hdd_wapi_info_s hdd_wapi_info_t;
542#endif /* FEATURE_WLAN_WAPI */
543
544typedef struct beacon_data_s {
545 u8 *head;
546 u8 *tail;
547 u8 *proberesp_ies;
548 u8 *assocresp_ies;
549 int head_len;
550 int tail_len;
551 int proberesp_ies_len;
552 int assocresp_ies_len;
553 int dtim_period;
554} beacon_data_t;
555
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800556typedef enum rem_on_channel_request_type {
557 REMAIN_ON_CHANNEL_REQUEST,
558 OFF_CHANNEL_ACTION_TX,
559} rem_on_channel_request_type_t;
560
561typedef struct action_pkt_buffer {
562 uint8_t *frame_ptr;
563 uint32_t frame_length;
564 uint16_t freq;
565} action_pkt_buffer_t;
566
567typedef struct hdd_remain_on_chan_ctx {
568 struct net_device *dev;
569 struct ieee80211_channel chan;
570 enum nl80211_channel_type chan_type;
571 unsigned int duration;
572 u64 cookie;
573 rem_on_channel_request_type_t rem_on_chan_request;
Anurag Chouhan210db072016-02-22 18:42:15 +0530574 qdf_mc_timer_t hdd_remain_on_chan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800575 action_pkt_buffer_t action_pkt_buff;
576 bool hdd_remain_on_chan_cancel_in_progress;
577 uint32_t scan_id;
578} hdd_remain_on_chan_ctx_t;
579
580/* RoC Request entry */
581typedef struct hdd_roc_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530582 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583 hdd_adapter_t *pAdapter;
584 hdd_remain_on_chan_ctx_t *pRemainChanCtx;
585} hdd_roc_req_t;
586
587/**
588 * struct hdd_scan_req - Scan Request entry
589 * @node : List entry element
590 * @adapter: Adapter address
591 * @scan_request: scan request holder
592 * @scan_id: scan identifier used across host layers which is generated at WMI
593 * @cookie: scan request identifier sent to userspace
594 * @source: scan request originator (NL/Vendor scan)
595 * @timestamp: scan request timestamp
596 *
597 * Scan request linked list element
598 */
599struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530600 qdf_list_node_t node;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800601 hdd_adapter_t *adapter;
602 struct cfg80211_scan_request *scan_request;
603 uint32_t scan_id;
604 uint8_t source;
605 uint32_t timestamp;
606};
607
608typedef enum {
609 HDD_IDLE,
610 HDD_PD_REQ_ACK_PENDING,
611 HDD_GO_NEG_REQ_ACK_PENDING,
612 HDD_INVALID_STATE,
613} eP2PActionFrameState;
614
615typedef enum {
616 WLAN_HDD_GO_NEG_REQ,
617 WLAN_HDD_GO_NEG_RESP,
618 WLAN_HDD_GO_NEG_CNF,
619 WLAN_HDD_INVITATION_REQ,
620 WLAN_HDD_INVITATION_RESP,
621 WLAN_HDD_DEV_DIS_REQ,
622 WLAN_HDD_DEV_DIS_RESP,
623 WLAN_HDD_PROV_DIS_REQ,
624 WLAN_HDD_PROV_DIS_RESP,
625} tActionFrmType;
626
627typedef struct hdd_cfg80211_state_s {
628 uint16_t current_freq;
629 u64 action_cookie;
630 uint8_t *buf;
631 size_t len;
632 hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
633 struct mutex remain_on_chan_ctx_lock;
634 eP2PActionFrameState actionFrmState;
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530635 /* is_go_neg_ack_received flag is set to 1 when
636 * the pending ack for GO negotiation req is
637 * received.
638 */
639 bool is_go_neg_ack_received;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800640} hdd_cfg80211_state_t;
641
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700642/**
643 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
644 * @channel: Channel number.
645 * @cb_mode: Channel bonding
646 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
647 * @phy_mode: PHY mode
648 */
649struct hdd_mon_set_ch_info {
650 uint8_t channel;
651 uint8_t cb_mode;
652 uint32_t channel_width;
653 eCsrPhyMode phy_mode;
654};
655
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656struct hdd_station_ctx {
657 /** Handle to the Wireless Extension State */
658 hdd_wext_state_t WextState;
659
660#ifdef FEATURE_WLAN_TDLS
661 tdlsCtx_t *pHddTdlsCtx;
662#endif
663
664 /**Connection information*/
665 connection_info_t conn_info;
666
667 roaming_info_t roam_info;
668
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800669 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800670
671#ifdef WLAN_FEATURE_GTK_OFFLOAD
672 tSirGtkOffloadParams gtkOffloadReqParams;
673#endif
674 /*Increment whenever ibss New peer joins and departs the network */
675 int ibss_sta_generation;
676
677 /* Indication of wep/wpa-none keys installation */
678 bool ibss_enc_key_installed;
679
680 /*Save the wep/wpa-none keys */
681 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700682 tSirPeerInfoRspParams ibss_peer_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800683
684 bool hdd_ReassocScenario;
685
686 /* STA ctx debug variables */
687 int staDebugState;
Chandrasekaran, Manishekar34e325a2015-12-18 12:07:22 +0530688
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700689 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700690
691 struct hdd_mon_set_ch_info ch_info;
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -0700692#ifdef WLAN_FEATURE_NAN_DATAPATH
693 struct nan_datapath_ctx ndp_ctx;
694#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800695};
696
697#define BSS_STOP 0
698#define BSS_START 1
699typedef struct hdd_hostapd_state_s {
700 int bssState;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530701 qdf_event_t qdf_event;
702 qdf_event_t qdf_stop_bss_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530703 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800704 bool bCommit;
705
706} hdd_hostapd_state_t;
707
708/*
709 * Per station structure kept in HDD for multiple station support for SoftAP
710 */
711typedef struct {
712 /** The station entry is used or not */
713 bool isUsed;
714
715 /** Station ID reported back from HAL (through SAP). Broadcast
716 * uses station ID zero by default in both libra and volans. */
717 uint8_t ucSTAId;
718
719 /** MAC address of the station */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530720 struct qdf_mac_addr macAddrSTA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800721
722 /** Current Station state so HDD knows how to deal with packet
723 * queue. Most recent states used to change TLSHIM STA state */
724 enum ol_txrx_peer_state tlSTAState;
725
726 /** Track QoS status of station */
727 bool isQosEnabled;
728
729 /** The station entry for which Deauth is in progress */
730 bool isDeauthInProgress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530731
732 /** Number of spatial streams supported */
733 uint8_t nss;
734
735 /** Rate Flags for this connection */
736 uint32_t rate_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800737} hdd_station_info_t;
738
739struct hdd_ap_ctx_s {
740 hdd_hostapd_state_t HostapdState;
741
742 /* Memory differentiation mode is enabled */
743 /* uint16_t uMemoryDiffThreshold; */
744 /* uint8_t uNumActiveAC; */
745 /* uint8_t uActiveACMask; */
746
747 /** Packet Count to update uNumActiveAC and uActiveACMask */
748 /* uint16_t uUpdatePktCount; */
749
750 /** Station ID assigned after BSS starts */
751 uint8_t uBCStaId;
752
753 uint8_t uPrivacy; /* The privacy bits of configuration */
754
755 tSirWPSPBCProbeReq WPSPBCProbeReq;
756
757 tsap_Config_t sapConfig;
758
759 struct semaphore semWpsPBCOverlapInd;
760
761 bool apDisableIntraBssFwd;
762
Anurag Chouhan210db072016-02-22 18:42:15 +0530763 qdf_mc_timer_t hdd_ap_inactivity_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800764
765 uint8_t operatingChannel;
766
767 bool uIsAuthenticated;
768
769 eCsrEncryptionType ucEncryptType;
770
771 /* This will point to group key data, if it is received before start bss. */
772 tCsrRoamSetKey groupKey;
773 /* This will have WEP key data, if it is received before start bss */
774 tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
775
Kondabattini, Ganesh702d90e2016-09-03 01:54:22 +0530776 /* WEP default key index */
777 uint8_t wep_def_key_idx;
778
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800779 beacon_data_t *beacon;
780
781 bool bApActive;
782#ifdef WLAN_FEATURE_MBSSID
783 /* SAP Context */
784 void *sapContext;
785#endif
786 bool dfs_cac_block_tx;
787};
788
789typedef struct hdd_scaninfo_s {
790 /* The scan pending */
791 uint32_t mScanPending;
792
793 /* Counter for mScanPending so that the scan pending
794 error log is not printed for more than 5 times */
795 uint32_t mScanPendingCounter;
796
797 /* Additional IE for scan */
798 tSirAddie scanAddIE;
799
800 /* Scan mode */
801 tSirScanType scan_mode;
802
803 /* completion variable for abortscan */
804 struct completion abortscan_event_var;
805
806} hdd_scaninfo_t;
807
808#define WLAN_HDD_MAX_MC_ADDR_LIST 10
809
810#ifdef WLAN_FEATURE_PACKET_FILTERING
811typedef struct multicast_addr_list {
812 uint8_t isFilterApplied;
813 uint8_t mc_cnt;
814 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
815} t_multicast_add_list;
816#endif
817
818#define WLAN_HDD_MAX_HISTORY_ENTRY 10
819
820/**
821 * struct hdd_netif_queue_stats - netif queue operation statistics
822 * @pause_count - pause counter
823 * @unpause_count - unpause counter
824 */
825struct hdd_netif_queue_stats {
826 uint16_t pause_count;
827 uint16_t unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530828 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800829};
830
831/**
832 * struct hdd_netif_queue_history - netif queue operation history
833 * @time: timestamp
834 * @netif_action: action type
835 * @netif_reason: reason type
836 * @pause_map: pause map
837 */
838struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530839 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800840 uint16_t netif_action;
841 uint16_t netif_reason;
842 uint32_t pause_map;
843};
844
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530845/**
846 * struct hdd_chan_change_params - channel related information
847 * @chan: operating channel
848 * @chan_params: channel parameters
849 */
850struct hdd_chan_change_params {
851 uint8_t chan;
852 struct ch_params_s chan_params;
853};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800854
855#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
856
857
858struct hdd_adapter_s {
Jeff Johnsond399e902015-12-17 15:17:02 -0800859 /* Magic cookie for adapter sanity verification. Note that this
860 * needs to be at the beginning of the private data structure so
861 * that it will exists at the beginning of dev->priv and hence
862 * will always be in mapped memory
863 */
864 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800865
Jeff Johnsond399e902015-12-17 15:17:02 -0800866 void *pHddCtx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800867
868 /** Handle to the network device */
869 struct net_device *dev;
870
Krunal Soni276241e2016-03-10 12:58:11 -0800871 enum tQDF_ADAPTER_MODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -0800872
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800873 /** IPv4 notifier callback for handling ARP offload on change in IP */
874 struct work_struct ipv4NotifierWorkQueue;
875#ifdef WLAN_NS_OFFLOAD
876 /** IPv6 notifier callback for handling NS offload on change in IP */
877 struct work_struct ipv6NotifierWorkQueue;
878#endif
879
880 /* TODO Move this to sta Ctx */
881 struct wireless_dev wdev;
882 struct cfg80211_scan_request *request;
883
884 /** ops checks if Opportunistic Power Save is Enable or Not
885 * ctw stores ctWindow value once we receive Opps command from
886 * wpa_supplicant then using ctWindow value we need to Enable
887 * Opportunistic Power Save
888 */
889 uint8_t ops;
890 uint32_t ctw;
891
892 /** Current MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530893 struct qdf_mac_addr macAddressCurrent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800894
895 /**Event Flags*/
896 unsigned long event_flags;
897
898 /**Device TX/RX statistics*/
899 struct net_device_stats stats;
900 /** HDD statistics*/
901 hdd_stats_t hdd_stats;
902 /** linkspeed statistics */
903 tSirLinkSpeedInfo ls_stats;
904 /**Mib information*/
905 sHddMib_t hdd_mib;
906
907 uint8_t sessionId;
908
909 /* Completion variable for session close */
910 struct completion session_close_comp_var;
911
912 /* Completion variable for session open */
913 struct completion session_open_comp_var;
914
915 /* TODO: move these to sta ctx. These may not be used in AP */
916 /** completion variable for disconnect callback */
917 struct completion disconnect_comp_var;
918
919 /** Completion of change country code */
920 struct completion change_country_code;
921
922 /* completion variable for Linkup Event */
923 struct completion linkup_event_var;
924
925 /* completion variable for cancel remain on channel Event */
926 struct completion cancel_rem_on_chan_var;
927
928 /* completion variable for off channel remain on channel Event */
929 struct completion offchannel_tx_event;
930 /* Completion variable for action frame */
931 struct completion tx_action_cnf_event;
932 /* Completion variable for remain on channel ready */
933 struct completion rem_on_chan_ready_event;
934
935 struct completion sta_authorized_event;
936#ifdef FEATURE_WLAN_TDLS
937 struct completion tdls_add_station_comp;
938 struct completion tdls_del_station_comp;
939 struct completion tdls_mgmt_comp;
940 struct completion tdls_link_establish_req_comp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530941 QDF_STATUS tdlsAddStaStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800942#endif
943
Rajeev Kumar8e3e2832015-11-06 16:02:54 -0800944 struct completion ibss_peer_info_comp;
945
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800946 /* Track whether the linkup handling is needed */
947 bool isLinkUpSvcNeeded;
948
949 /* Mgmt Frames TX completion status code */
950 uint32_t mgmtTxCompletionStatus;
951
952 /* WMM Status */
953 hdd_wmm_status_t hddWmmStatus;
954/*************************************************************
955 */
956/*************************************************************
957 * TODO - Remove it later
958 */
959 /** Multiple station supports */
960 /** Per-station structure */
961 spinlock_t staInfo_lock; /* To protect access to station Info */
962 hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
963 /* uint8_t uNumActiveStation; */
964
965/*************************************************************
966 */
967
968#ifdef FEATURE_WLAN_WAPI
969 hdd_wapi_info_t wapi_info;
970#endif
971
972 int8_t rssi;
973#ifdef WLAN_FEATURE_LPSS
974 bool rssi_send;
975#endif
976
977 uint8_t snr;
978
979 struct work_struct monTxWorkQueue;
980 struct sk_buff *skb_to_tx;
981
982 union {
983 hdd_station_ctx_t station;
984 hdd_ap_ctx_t ap;
985 } sessionCtx;
986
Manikandan Mohandcc21ba2016-03-15 14:31:56 -0700987#ifdef WLAN_FEATURE_TSF
988 /* tsf value received from firmware */
989 uint32_t tsf_low;
990 uint32_t tsf_high;
991 /* TSF capture state */
992 enum hdd_tsf_capture_state tsf_state;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -0700993 uint64_t tsf_sync_soc_timer;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -0700994#endif
995
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800996 hdd_cfg80211_state_t cfg80211State;
997
998#ifdef WLAN_FEATURE_PACKET_FILTERING
999 t_multicast_add_list mc_addr_list;
1000#endif
1001 uint8_t addr_filter_pattern;
1002
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001003 bool higherDtimTransition;
1004 bool survey_idx;
1005
1006 hdd_scaninfo_t scan_info;
Srinivas Girigowda515a9ef2015-12-11 11:00:48 -08001007#ifdef FEATURE_WLAN_ESE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001008 tAniTrafStrmMetrics tsmStats;
1009#endif
1010 /* Flag to ensure PSB is configured through framework */
1011 uint8_t psbChanged;
1012 /* UAPSD psb value configured through framework */
1013 uint8_t configuredPsb;
1014#ifdef IPA_OFFLOAD
1015 void *ipa_context;
1016#endif
1017 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1018 * since CSR (PMAC Struct) Config is same for both AP
1019 */
1020 struct delayed_work acs_pending_work;
1021
1022 struct work_struct scan_block_work;
1023#ifdef MSM_PLATFORM
1024 unsigned long prev_rx_packets;
1025 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301026 uint64_t prev_fwd_tx_packets;
1027 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001028 int connection;
1029#endif
1030 bool is_roc_inprogress;
1031
1032#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301033 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001034 bool tx_flow_timer_initialized;
1035 unsigned int tx_flow_low_watermark;
1036 unsigned int tx_flow_high_watermark_offset;
1037#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1038 bool offloads_configured;
1039
1040 /* DSCP to UP QoS Mapping */
1041 sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP + 1];
1042
1043#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1044 bool isLinkLayerStatsSet;
1045#endif
1046 uint8_t linkStatus;
1047
1048 /* variable for temperature in Celsius */
1049 int temperature;
1050
1051 /* Time stamp for last completed RoC request */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301052 unsigned long last_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001053
1054 /* Time stamp for start RoC request */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301055 unsigned long start_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001056
1057 /* State for synchronous OCB requests to WMI */
1058 struct sir_ocb_set_config_response ocb_set_config_resp;
1059 struct sir_ocb_get_tsf_timer_response ocb_get_tsf_timer_resp;
1060 struct sir_dcc_get_stats_response *dcc_get_stats_resp;
1061 struct sir_dcc_update_ndl_response dcc_update_ndl_resp;
1062
1063 /* MAC addresses used for OCB interfaces */
Agrawal Ashishb141b092016-09-02 19:59:26 +05301064#ifdef WLAN_FEATURE_DSRC
Anurag Chouhan6d760662016-02-20 16:05:43 +05301065 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001066 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301067#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001068
1069 /* BITMAP indicating pause reason */
1070 uint32_t pause_map;
1071 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301072 qdf_time_t start_time;
1073 qdf_time_t last_time;
1074 qdf_time_t total_pause_time;
1075 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001076 uint8_t history_index;
1077 struct hdd_netif_queue_history
1078 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1079 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
1080 struct hdd_lro_s lro_info;
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001081 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001082 /* debugfs entry */
1083 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301084 /*
1085 * The pre cac channel is saved here and will be used when the SAP's
1086 * channel needs to be moved from the existing 2.4GHz channel.
1087 */
1088 uint8_t pre_cac_chan;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001089};
1090
1091#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
1092#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
1093#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.station.WextState)
1094#define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t *)pAdapter->pHddCtx)
1095#define WLAN_HDD_GET_HAL_CTX(pAdapter) (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
1096#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
1097#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State)
1098#ifdef WLAN_FEATURE_MBSSID
1099#define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
1100#endif
1101#ifdef FEATURE_WLAN_TDLS
1102#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
Krunal Soni276241e2016-03-10 12:58:11 -08001103 (((QDF_STA_MODE != pAdapter->device_mode) && \
1104 (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001105#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \
1106 ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \
1107 (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
1108#endif
1109
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001110#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001111#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \
1112 (&(adapter)->sessionCtx.station.ndp_ctx)
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001113#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001114#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001115/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1116 * intentionally so that all references to these must be within NDP code.
1117 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1118 * invoke NDP code to do all work.
1119 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001120#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001121#endif
1122
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001123/* Set mac address locally administered bit */
1124#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1125
1126#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1127#define HDD_RESET_MCC_P2P_QUOTA 50
1128
1129typedef struct hdd_adapter_list_node {
Anurag Chouhanffb21542016-02-17 14:33:03 +05301130 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001131 hdd_adapter_t *pAdapter;
1132} hdd_adapter_list_node_t;
1133
1134typedef struct hdd_priv_data_s {
1135 uint8_t *buf;
1136 int used_len;
1137 int total_len;
1138} hdd_priv_data_t;
1139
1140#define MAX_MOD_LOGLEVEL 10
1141typedef struct {
1142 uint8_t enable;
1143 uint8_t dl_type;
1144 uint8_t dl_report;
1145 uint8_t dl_loglevel;
1146 uint8_t index;
1147 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1148
1149} fw_log_info;
1150
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001151/**
1152 * enum antenna_mode - number of TX/RX chains
1153 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1154 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1155 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1156 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1157 */
1158enum antenna_mode {
1159 HDD_ANTENNA_MODE_INVALID,
1160 HDD_ANTENNA_MODE_1X1,
1161 HDD_ANTENNA_MODE_2X2,
1162 HDD_ANTENNA_MODE_MAX
1163};
1164
1165/**
1166 * enum smps_mode - SM power save mode
1167 * @HDD_SMPS_MODE_STATIC: Static power save
1168 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1169 * @HDD_SMPS_MODE_RESERVED: Reserved
1170 * @HDD_SMPS_MODE_DISABLED: Disable power save
1171 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1172 */
1173enum smps_mode {
1174 HDD_SMPS_MODE_STATIC,
1175 HDD_SMPS_MODE_DYNAMIC,
1176 HDD_SMPS_MODE_RESERVED,
1177 HDD_SMPS_MODE_DISABLED,
1178 HDD_SMPS_MODE_MAX
1179};
1180
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001181#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1182/**
1183 * struct hdd_offloaded_packets - request id to pattern id mapping
1184 * @request_id: request id
1185 * @pattern_id: pattern id
1186 *
1187 */
1188struct hdd_offloaded_packets {
1189 uint32_t request_id;
1190 uint8_t pattern_id;
1191};
1192
1193/**
1194 * struct hdd_offloaded_packets_ctx - offloaded packets context
1195 * @op_table: request id to pattern id table
1196 * @op_lock: mutex lock
1197 */
1198struct hdd_offloaded_packets_ctx {
1199 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1200 struct mutex op_lock;
1201};
1202#endif
1203
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301204/**
1205 * struct hdd_bpf_context - hdd Context for bpf
1206 * @magic: magic number
1207 * @completion: Completion variable for BPF Get Capability
1208 * @capability_response: capabilities response received from fw
1209 */
1210struct hdd_bpf_context {
1211 unsigned int magic;
1212 struct completion completion;
1213 struct sir_bpf_get_offload capability_response;
1214};
1215
Arun Khandavallifae92942016-08-01 13:31:08 +05301216/**
1217 * enum driver_status: Driver Modules status
1218 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1219 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1220 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1221 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1222 */
1223enum driver_modules_status {
1224 DRIVER_MODULES_UNINITIALIZED,
1225 DRIVER_MODULES_OPENED,
1226 DRIVER_MODULES_ENABLED,
1227 DRIVER_MODULES_CLOSED
1228};
1229
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001230/** Adapter structure definition */
1231
1232struct hdd_context_s {
1233 /** Global CDS context */
1234 v_CONTEXT_t pcds_context;
1235
1236 /** HAL handle...*/
1237 tHalHandle hHal;
1238
1239 struct wiphy *wiphy;
1240 /* TODO Remove this from here. */
1241
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301242 qdf_spinlock_t hdd_adapter_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301243 qdf_list_t hddAdapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001244
1245 /* 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 +05301246 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 -08001247
1248 /** Pointer for firmware image data */
1249 const struct firmware *fw;
1250
1251 /** Pointer for configuration data */
1252 const struct firmware *cfg;
1253
1254 /** Pointer to the parent device */
1255 struct device *parent_dev;
1256
1257 /** Config values read from qcom_cfg.ini file */
1258 struct hdd_config *config;
1259
1260 struct wlan_hdd_ftm_status ftm;
1261
1262 /* Completion variable to indicate Mc Thread Suspended */
1263 struct completion mc_sus_event_var;
1264
1265 struct completion reg_init;
1266
1267 bool isMcThreadSuspended;
1268
1269#ifdef QCA_CONFIG_SMP
1270 bool is_ol_rx_thread_suspended;
1271#endif
1272
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001273 /* Track whether Mcast/Bcast Filter is enabled. */
1274 bool hdd_mcastbcast_filter_set;
1275
1276 bool hdd_wlan_suspended;
1277 bool suspended;
1278
1279 /* Lock to avoid race condition during start/stop bss */
1280 struct mutex sap_lock;
1281
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001282#ifdef FEATURE_OEM_DATA_SUPPORT
1283 /* OEM App registered or not */
1284 bool oem_app_registered;
1285
1286 /* OEM App Process ID */
1287 int32_t oem_pid;
1288#endif
1289
1290 /** Concurrency Parameters*/
1291 uint32_t concurrency_mode;
1292
Anurag Chouhan6d760662016-02-20 16:05:43 +05301293 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1294 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001295
1296 /** P2P Device MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301297 struct qdf_mac_addr p2pDeviceAddress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001298
1299#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301300 qdf_wake_lock_t rx_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001301#endif
1302
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301303 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001304
1305#ifdef FEATURE_WLAN_TDLS
1306 eTDLSSupportMode tdls_mode;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001307 bool concurrency_marked;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001308 eTDLSSupportMode tdls_mode_last;
1309 tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
1310 /* maximum TDLS station number allowed upon runtime condition */
1311 uint16_t max_num_tdls_sta;
1312 /* TDLS peer connected count */
1313 uint16_t connected_peer_count;
1314 tdls_scan_context_t tdls_scan_ctxt;
1315 /* Lock to avoid race condition during TDLS operations */
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001316 qdf_spinlock_t tdls_ct_spinlock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001317 struct mutex tdls_lock;
1318 uint8_t tdls_off_channel;
1319 uint16_t tdls_channel_offset;
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301320 int32_t tdls_fw_off_chan_mode;
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001321 bool enable_tdls_connection_tracker;
1322 uint8_t tdls_external_peer_count;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001323 bool tdls_nss_switch_in_progress;
Kabilan Kannanff89f742016-08-15 18:14:10 -07001324 bool tdls_nss_teardown_complete;
1325 enum tdls_nss_transition_type tdls_nss_transition_mode;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001326 int32_t tdls_teardown_peers_cnt;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001327 struct tdls_set_state_info set_state_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001328#endif
1329
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001331
1332 /* MC/BC Filter state variable
1333 * This always contains the value that is currently
1334 * configured
1335 * */
1336 uint8_t configuredMcastBcastFilter;
1337
1338 uint8_t sus_res_mcastbcast_filter;
1339
1340 bool sus_res_mcastbcast_filter_valid;
1341
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001342 /* Use below lock to protect access to isSchedScanUpdatePending
1343 * since it will be accessed in two different contexts.
1344 */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301345 qdf_spinlock_t sched_scan_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001346
1347 /* Flag keeps track of wiphy suspend/resume */
1348 bool isWiphySuspended;
1349
1350 /* Indicates about pending sched_scan results */
1351 bool isSchedScanUpdatePending;
1352
1353#ifdef MSM_PLATFORM
1354 /* DDR bus bandwidth compute timer
1355 */
Anurag Chouhan210db072016-02-22 18:42:15 +05301356 qdf_mc_timer_t bus_bw_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001357 int cur_vote_level;
1358 spinlock_t bus_bw_lock;
1359 int cur_rx_level;
1360 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001361 int cur_tx_level;
1362 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001363#endif
1364 /* VHT80 allowed */
1365 bool isVHT80Allowed;
1366
1367 struct completion ready_to_suspend;
1368 /* defining the solution type */
1369 uint32_t target_type;
1370
1371 /* defining the firmware version */
1372 uint32_t target_fw_version;
Arif Hussain1969ec82016-07-08 10:37:01 -07001373 qdf_atomic_t dfs_radar_found;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001374
1375 /* defining the chip/rom version */
1376 uint32_t target_hw_version;
1377 /* defining the chip/rom revision */
1378 uint32_t target_hw_revision;
1379 /* chip/rom name */
1380 const char *target_hw_name;
1381 struct regulatory reg;
1382#ifdef FEATURE_WLAN_CH_AVOID
1383 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001384 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001385#endif /* FEATURE_WLAN_CH_AVOID */
1386
1387 uint8_t max_intf_count;
1388 uint8_t current_intf_count;
1389#ifdef WLAN_FEATURE_LPSS
1390 uint8_t lpss_support;
1391#endif
1392 uint8_t ap_arpns_support;
1393 tSirScanType ioctl_scan_mode;
1394
1395#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301396 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001397#endif
1398
1399 struct work_struct sap_start_work;
1400 bool is_sap_restart_required;
1401 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301402 qdf_spinlock_t sap_update_info_lock;
1403 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001404
1405 uint8_t dev_dfs_cac_status;
1406
1407 bool btCoexModeSet;
1408#ifdef FEATURE_GREEN_AP
1409 struct hdd_green_ap_ctx *green_ap_ctx;
1410#endif
1411 fw_log_info fw_log_settings;
1412#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301413 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001414 uint8_t skip_acs_scan_status;
1415#endif
1416
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301417 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001418 atomic_t sap_dfs_ref_cnt;
1419
1420#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1421 bool is_extwow_app_type1_param_set;
1422 bool is_extwow_app_type2_param_set;
1423 bool ext_wow_should_suspend;
1424 struct completion ready_to_extwow;
1425#endif
1426
1427 /* Time since boot up to extscan start (in micro seconds) */
1428 uint64_t ext_scan_start_since_boot;
1429 unsigned long g_event_flags;
1430 /* RoC request queue and work */
1431 struct delayed_work roc_req_work;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301432 qdf_spinlock_t hdd_roc_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301433 qdf_list_t hdd_roc_req_q;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301434 qdf_spinlock_t hdd_scan_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301435 qdf_list_t hdd_scan_req_q;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001436 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301437
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001438#ifdef WLAN_NS_OFFLOAD
1439 /* IPv6 notifier callback for handling NS offload on change in IP */
1440 struct notifier_block ipv6_notifier;
1441#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301442 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001443 /* IPv4 notifier callback for handling ARP offload on change in IP */
1444 struct notifier_block ipv4_notifier;
1445
1446 /* number of rf chains supported by target */
1447 uint32_t num_rf_chains;
1448 /* Is htTxSTBC supported by target */
1449 uint8_t ht_tx_stbc_supported;
1450#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1451 struct hdd_offloaded_packets_ctx op_ctx;
1452#endif
1453 bool mcc_mode;
1454#ifdef WLAN_FEATURE_MEMDUMP
1455 uint8_t *fw_dump_loc;
1456 uint32_t dump_loc_paddr;
Anurag Chouhan210db072016-02-22 18:42:15 +05301457 qdf_mc_timer_t memdump_cleanup_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001458 struct mutex memdump_lock;
1459 bool memdump_in_progress;
Sachin Ahuja02dd2e72016-09-03 16:17:51 +05301460 bool memdump_init_done;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001461#endif /* WLAN_FEATURE_MEMDUMP */
1462
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001463 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301464 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001465
1466 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301467 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001468
Krunal Sonie3531942016-04-12 17:43:53 -07001469 /*
1470 * place to store FTM capab of target. This allows changing of FTM capab
1471 * at runtime and intersecting it with target capab before updating.
1472 */
1473 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001474 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001475 /* completion variable to indicate set antenna mode complete*/
1476 struct completion set_antenna_mode_cmpl;
1477 /* Current number of TX X RX chains being used */
1478 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301479 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001480
1481 /* the radio index assigned by cnss_logger */
1482 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301483 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301484 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301485 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001486#ifdef WLAN_FEATURE_NAN_DATAPATH
1487 bool nan_datapath_enabled;
1488#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301489 /* Present state of driver cds modules */
1490 enum driver_modules_status driver_status;
1491 /* MC timer interface change */
1492 qdf_mc_timer_t iface_change_timer;
1493 /* Interface change lock */
1494 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301495 bool rps;
1496 bool enableRxThread;
1497 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301498 bool stop_modules_in_progress;
1499 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001500 bool update_mac_addr_to_fw;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001501};
1502
1503/*---------------------------------------------------------------------------
1504 Function declarations and documentation
1505 -------------------------------------------------------------------------*/
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301506int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter,
1507 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001508 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001509#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1510void wlan_hdd_check_sta_ap_concurrent_ch_intf(void *sta_pAdapter);
1511#endif
1512
1513const char *hdd_device_mode_to_string(uint8_t device_mode);
1514
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301515QDF_STATUS hdd_get_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001516 hdd_adapter_list_node_t **ppAdapterNode);
1517
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301518QDF_STATUS hdd_get_next_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001519 hdd_adapter_list_node_t *pAdapterNode,
1520 hdd_adapter_list_node_t **pNextAdapterNode);
1521
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301522QDF_STATUS hdd_remove_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001523 hdd_adapter_list_node_t *pAdapterNode);
1524
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301525QDF_STATUS hdd_remove_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001526 hdd_adapter_list_node_t **ppAdapterNode);
1527
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301528QDF_STATUS hdd_add_adapter_back(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001529 hdd_adapter_list_node_t *pAdapterNode);
1530
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301531QDF_STATUS hdd_add_adapter_front(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001532 hdd_adapter_list_node_t *pAdapterNode);
1533
1534hdd_adapter_t *hdd_open_adapter(hdd_context_t *pHddCtx, uint8_t session_type,
1535 const char *name, tSirMacAddr macAddr,
Ryan Hsu07495ea2016-01-21 15:25:39 -08001536 unsigned char name_assign_type,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001537 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301538QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001539 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301540QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
1541QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
1542QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
1543QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001544hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
1545 uint32_t vdev_id);
1546hdd_adapter_t *hdd_get_adapter_by_macaddr(hdd_context_t *pHddCtx,
1547 tSirMacAddr macAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301548QDF_STATUS hdd_init_station_mode(hdd_adapter_t *pAdapter);
Krunal Soni276241e2016-03-10 12:58:11 -08001549hdd_adapter_t *hdd_get_adapter(hdd_context_t *pHddCtx,
1550 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001551void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
1552 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301553QDF_STATUS hdd_stop_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001554 const bool bCloseSession);
1555void hdd_set_station_ops(struct net_device *pWlanDev);
1556uint8_t *wlan_hdd_get_intf_addr(hdd_context_t *pHddCtx);
1557void wlan_hdd_release_intf_addr(hdd_context_t *pHddCtx, uint8_t *releaseAddr);
Krunal Soni276241e2016-03-10 12:58:11 -08001558uint8_t hdd_get_operating_channel(hdd_context_t *pHddCtx,
1559 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001560
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001561void hdd_set_conparam(uint32_t con_param);
Anurag Chouhan6d760662016-02-20 16:05:43 +05301562enum tQDF_GLOBAL_CON_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001563
1564void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
1565 eCsrAbortReason reason);
1566void hdd_cleanup_actionframe(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
1567
1568void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
1569void wlan_hdd_reset_prob_rspies(hdd_adapter_t *pHostapdAdapter);
1570void hdd_prevent_suspend(uint32_t reason);
1571void hdd_allow_suspend(uint32_t reason);
1572void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001573
1574void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301575QDF_STATUS hdd_set_ibss_power_save_params(hdd_adapter_t *pAdapter);
1576QDF_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001577void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
1578int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
1579bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301580QDF_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001581
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001582struct qdf_mac_addr *
1583hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
1584 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001585void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001586#ifdef MSM_PLATFORM
1587void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
1588void hdd_stop_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
1589#else
1590static inline void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter)
1591{
1592 return;
1593}
1594
1595static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
1596{
1597 return;
1598}
1599#endif
1600
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08001601int hdd_init(void);
1602void hdd_deinit(void);
1603
Arun Khandavallifae92942016-08-01 13:31:08 +05301604int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001605void __hdd_wlan_exit(void);
1606int hdd_wlan_notify_modem_power_state(int state);
1607#ifdef QCA_HT_2040_COEX
1608int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301609 struct qdf_mac_addr macAddrSTA, int width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001610#endif
1611
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05301612void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001613#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1614void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
1615#endif
1616
1617hdd_adapter_t *hdd_get_con_sap_adapter(hdd_adapter_t *this_sap_adapter,
1618 bool check_start_bss);
1619
1620bool hdd_is_5g_supported(hdd_context_t *pHddCtx);
1621
1622int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter);
1623
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001624void hdd_get_fw_version(hdd_context_t *hdd_ctx,
1625 uint32_t *major_spid, uint32_t *minor_spid,
1626 uint32_t *siid, uint32_t *crmid);
1627
1628#ifdef WLAN_FEATURE_MEMDUMP
1629/**
1630 * hdd_is_memdump_supported() - to check if memdump feature support
1631 *
1632 * This function is used to check if memdump feature is supported in
1633 * the host driver
1634 *
1635 * Return: true if supported and false otherwise
1636 */
1637static inline bool hdd_is_memdump_supported(void)
1638{
1639 return true;
1640}
1641#else
1642static inline bool hdd_is_memdump_supported(void)
1643{
1644 return false;
1645}
1646#endif /* WLAN_FEATURE_MEMDUMP */
1647
1648void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301649 struct qdf_mac_addr hw_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001650void wlan_hdd_disable_roaming(hdd_adapter_t *pAdapter);
1651void wlan_hdd_enable_roaming(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001652
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301653QDF_STATUS hdd_post_cds_enable_config(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001654
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301655QDF_STATUS hdd_abort_mac_scan_all_adapters(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001656
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301657QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001658 hdd_adapter_t *ap_adapter,
1659 tCsrRoamProfile *roam_profile,
1660 tScanResultHandle *scan_cache,
1661 bool *concurrent_chnl_same);
1662#ifdef WLAN_FEATURE_MBSSID
1663void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
1664void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter);
1665#else
1666static inline void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter) {}
1667static inline void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) {}
1668#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001669
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001670void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
1671
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001672#ifdef QCA_CONFIG_SMP
1673int wlan_hdd_get_cpu(void);
1674#else
1675static inline int wlan_hdd_get_cpu(void)
1676{
1677 return 0;
1678}
1679#endif
1680
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301681void wlan_hdd_sap_pre_cac_failure(void *data);
1682void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
1683
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001684void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
1685 enum netif_action_type action, enum netif_reason_type reason);
1686
1687void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
Nirav Shahed34b212016-04-25 10:59:16 +05301688int wlan_hdd_init_tx_rx_histogram(hdd_context_t *hdd_ctx);
1689void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001690void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
1691void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
1692void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx);
1693void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx);
1694const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05301695void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
1696hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
1697 uint32_t sme_session_id);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001698enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301699uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
1700 uint8_t bw_offset);
Arun Khandavallic811dcc2016-06-26 07:37:21 +05301701int hdd_update_config(hdd_context_t *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001702
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05301703QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301704 struct net_device *dev,
1705 struct hdd_chan_change_params chan_change);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301706int wlan_hdd_set_channel(struct wiphy *wiphy,
1707 struct net_device *dev,
1708 struct cfg80211_chan_def *chandef,
1709 enum nl80211_channel_type channel_type);
1710int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
1711 struct cfg80211_beacon_data *params,
1712 const u8 *ssid, size_t ssid_len,
1713 enum nl80211_hidden_ssid hidden_ssid,
1714 bool check_for_concurrency);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301715#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1716QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void);
1717#else
1718static inline QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
1719{
Krunal Soni276241e2016-03-10 12:58:11 -08001720 return QDF_STATUS_SUCCESS;
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301721}
1722#endif
1723
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001724#if !defined(REMOVE_PKT_LOG)
1725int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value);
1726int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable, uint8_t);
1727#else
1728int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable, uint8_t)
1729{
1730 return 0;
1731}
1732int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value)
1733{
1734 return 0;
1735}
1736#endif /* REMOVE_PKT_LOG */
1737
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001738#ifdef FEATURE_TSO
1739/**
1740 * hdd_set_tso_flags() - enable TSO flags in the network device
1741 * @hdd_ctx: HDD context
1742 * @wlan_dev: network device structure
1743 *
1744 * This function enables the TSO related feature flags in the
1745 * given network device.
1746 *
1747 * Return: none
1748 */
1749static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
1750 struct net_device *wlan_dev)
1751{
1752 if (hdd_ctx->config->tso_enable) {
1753 hdd_info("TSO Enabled");
1754 wlan_dev->features |=
1755 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
1756 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
1757 }
1758}
1759#else
1760static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
1761 struct net_device *wlan_dev){}
1762#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001763
Agrawal Ashishc9ddbab2016-05-25 12:04:47 +05301764#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
1765 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
1766void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
1767#else
1768static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
1769{
1770}
1771#endif
1772
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001773#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07001774static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001775{
1776 return hdd_ctx->config->isRoamOffloadEnabled;
1777}
1778#else
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07001779static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08001780{
1781 return false;
1782}
1783#endif
1784
Rajeev Kumar94c9b452016-03-24 12:58:47 -07001785void hdd_get_ibss_peer_info_cb(void *pUserData,
1786 tSirPeerInfoRspParams *pPeerInfo);
1787
Ryan Hsuceddceb2016-04-28 10:20:14 -07001788#ifdef CONFIG_CNSS_LOGGER
1789/**
1790 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
1791 * @hdd_ctx: the hdd context pointer
1792 *
1793 * The nl_srv_init() will call to cnss_logger_device_register() and
1794 * expect to get a radio_index from cnss_logger module and assign to
1795 * hdd_ctx->radio_index, then to maintain the consistency to original
1796 * design, adding the radio_index check here, then return the error
1797 * code if radio_index is not assigned correctly, which means the nl_init
1798 * from cnss_logger is failed.
1799 *
1800 * Return: 0 if successfully, otherwise error code
1801 */
1802static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
1803{
1804 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
1805
1806 /* radio_index is assigned from 0, so only >=0 will be valid index */
1807 if (hdd_ctx->radio_index >= 0)
1808 return 0;
1809 else
1810 return -EINVAL;
1811}
1812#else
1813/**
1814 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
1815 * @hdd_ctx: the hdd context pointer
1816 *
1817 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
1818 * the netlink socket and return the success or not.
1819 *
1820 * Return: the return value from nl_srv_init()
1821 */
1822static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
1823{
1824 return nl_srv_init(hdd_ctx->wiphy);
1825}
1826#endif
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001827QDF_STATUS hdd_sme_close_session_callback(void *pContext);
1828
Varun Reddy Yeturu3e91dad2016-07-18 15:58:47 -07001829int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
1830 const uint8_t channel, const handoff_src src);
1831
Arun Khandavalli4b55da72016-07-19 19:55:01 +05301832int hdd_register_cb(hdd_context_t *hdd_ctx);
1833void hdd_deregister_cb(hdd_context_t *hdd_ctx);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05301834int hdd_start_station_adapter(hdd_adapter_t *adapter);
1835int hdd_start_ap_adapter(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05301836int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05301837int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
Arun Khandavalli2358d522016-05-16 18:05:37 +05301838int hdd_set_fw_params(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05301839int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
1840 bool reinit);
1841int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown);
1842int hdd_start_adapter(hdd_adapter_t *adapter);
Anurag Chouhanc4092922016-09-08 15:56:11 +05301843void hdd_connect_result(struct net_device *dev, const u8 *bssid,
1844 tCsrRoamInfo *roam_info, const u8 *req_ie,
1845 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05301846 size_t resp_ie_len, u16 status, gfp_t gfp,
1847 bool connect_timeout);
Anurag Chouhanc4092922016-09-08 15:56:11 +05301848
Arun Khandavallifae92942016-08-01 13:31:08 +05301849#ifdef WLAN_FEATURE_FASTPATH
1850void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
1851 void *context);
1852#else
1853static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
1854 void *context)
1855{
1856}
1857#endif
1858void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
Srinivas Girigowdad9e6f7b2016-02-01 19:37:52 -08001859
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001860#endif /* end #if !defined(WLAN_HDD_MAIN_H) */