blob: d9a127d80137ea86da614c59fabeff1144745030 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined(WLAN_HDD_MAIN_H)
29#define WLAN_HDD_MAIN_H
Jeff Johnsonef926352017-01-12 10:41:02 -080030/**
31 * DOC: wlan_hdd_main.h
32 *
33 * Linux HDD Adapter Type
34 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035
Jeff Johnsonef926352017-01-12 10:41:02 -080036/*
37 * Include files
38 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080039
40#include <linux/netdevice.h>
41#include <linux/skbuff.h>
42#include <net/cfg80211.h>
Anurag Chouhanffb21542016-02-17 14:33:03 +053043#include <qdf_list.h>
Anurag Chouhan6d760662016-02-20 16:05:43 +053044#include <qdf_types.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045#include "sir_mac_prot_def.h"
46#include "csr_api.h"
47#include <wlan_hdd_assoc.h>
48#include <wlan_hdd_wmm.h>
49#include <wlan_hdd_cfg.h>
50#include <linux/spinlock.h>
51#if defined(WLAN_OPEN_SOURCE) && defined(CONFIG_HAS_WAKELOCK)
52#include <linux/wakelock.h>
53#endif
54#include <wlan_hdd_ftm.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055#include "wlan_hdd_tdls.h"
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070056#include "wlan_hdd_tsf.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080057#include "wlan_hdd_cfg80211.h"
Anurag Chouhan42958bb2016-02-19 15:43:11 +053058#include <qdf_defer.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059#include "sap_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060#include <wlan_hdd_lro.h>
Dhanashri Atreb08959a2016-03-01 17:28:03 -080061#include "cdp_txrx_flow_ctrl_legacy.h"
Manjunathappa Prakash3454fd62016-04-01 08:52:06 -070062#include <cdp_txrx_peer_ops.h>
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070063#include "wlan_hdd_nan_datapath.h"
Dustin Brown61269462016-09-19 13:25:45 -070064#include "wlan_tgt_def_config.h"
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +053065#include <wlan_objmgr_cmn.h>
66#include <wlan_objmgr_global_obj.h>
67#include <wlan_objmgr_psoc_obj.h>
68#include <wlan_objmgr_pdev_obj.h>
69#include <wlan_objmgr_vdev_obj.h>
70#include <wlan_objmgr_peer_obj.h>
Mukul Sharma9d797a02017-01-05 20:26:03 +053071#include "wlan_pmo_ucfg_api.h"
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -070072
Jeff Johnsonef926352017-01-12 10:41:02 -080073/*
74 * Preprocessor definitions and constants
75 */
76
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077/** 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)
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800111#define SOFTAP_INIT_DONE (8)
112
Kapil Gupta8878ad92017-02-13 11:56:04 +0530113/* Waiting for event for vendor acs */
114#define VENDOR_ACS_RESPONSE_PENDING (8)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800115
116/* HDD global event flags */
117#define ACS_IN_PROGRESS (0)
118
119/** Maximum time(ms)to wait for disconnect to complete **/
120#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530121#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530123#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800124#endif
125#define WLAN_WAIT_TIME_STATS 800
126#define WLAN_WAIT_TIME_POWER 800
127#define WLAN_WAIT_TIME_COUNTRY 1000
128#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530129#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800130/* Amount of time to wait for sme close session callback.
Jeff Johnsonef926352017-01-12 10:41:02 -0800131 * This value should be larger than the timeout used by WDI to wait for
132 * a response from WCNSS
133 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800134#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
135#define WLAN_WAIT_TIME_ABORTSCAN 2000
136
137/** Maximum time(ms) to wait for mc thread suspend **/
138#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
139
140/** Maximum time(ms) to wait for target to be ready for suspend **/
141#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
142
143/** Maximum time(ms) to wait for tdls add sta to complete **/
144#define WAIT_TIME_TDLS_ADD_STA 1500
145
146/** Maximum time(ms) to wait for tdls del sta to complete **/
147#define WAIT_TIME_TDLS_DEL_STA 1500
148
149/** Maximum time(ms) to wait for Link Establish Req to complete **/
150#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
151
152/** Maximum time(ms) to wait for tdls mgmt to complete **/
153#define WAIT_TIME_TDLS_MGMT 11000
154
155/* Scan Req Timeout */
156#define WLAN_WAIT_TIME_SCAN_REQ 100
157
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800158#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
159#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
160
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530161#define WLAN_WAIT_TIME_BPF 1000
162
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800163#define MAX_NUMBER_OF_ADAPTERS 4
164
165#define MAX_CFG_STRING_LEN 255
166
Kapil Gupta8878ad92017-02-13 11:56:04 +0530167/* Maximum time(ms) to wait for external acs response */
168#define WLAN_VENDOR_ACS_WAIT_TIME 1000
169
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
171/** Mac Address string **/
172#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
173#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Hong Shiab2dfcf2016-11-07 14:09:39 +0800174#define MAX_GENIE_LEN 512
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800175
176#define WLAN_CHIP_VERSION "WCNSS"
177
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530178#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
180
181#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530182 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800183#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530184 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530186 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187#define hdd_notice(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530188 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800189#define hdd_info(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530190 hdd_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530192 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800193
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530194#define ENTER() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter")
Jeff Johnson398b3d62016-02-10 17:19:39 -0800195#define ENTER_DEV(dev) \
196 hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter(%s)", (dev)->name)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530197#define EXIT() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "exit")
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800198
199#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t *)(netdev_priv((__dev__)))
200
201#define MAX_NO_OF_2_4_CHANNELS 14
202
203#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
204#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
205#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
206#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
207#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
208#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
209#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
210#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
211#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
212#define WLAN_HDD_WFA_OUI 0x506F9A
213#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
214#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
215#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
216#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
217
218#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
219 (((center_freq) == 2412) || ((center_freq) == 2437) || ((center_freq) == 2462))
220
221#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
222 (((center_freq) == 5180) || ((center_freq) == 5200) \
223 || ((center_freq) == 5220) || ((center_freq) == 5240))
224
225#ifdef WLAN_FEATURE_11W
226#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
227#endif
228
229#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
230#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800231
232#define WLAN_HDD_QOS_ACTION_FRAME 1
233#define WLAN_HDD_QOS_MAP_CONFIGURE 4
234#define HDD_SAP_WAKE_LOCK_DURATION 10000 /* in msecs */
235
Mukul Sharma974ca652016-09-03 16:24:48 +0530236#if defined(CONFIG_HL_SUPPORT)
237#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
238#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530240#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800241
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800242#define MAX_USER_COMMAND_SIZE 4096
243
244#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
245#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
246
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530247/* FW expects burst duration in 1020*ms */
248#define SIFS_BURST_DUR_MULTIPLIER 1020
249#define SIFS_BURST_DUR_MAX 12240
250
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251/* If IPA UC data path is enabled, target should reserve extra tx descriptors
252 * for IPA data path.
253 * Then host data path should allow less TX packet pumping in case
254 * IPA data path enabled
255 */
256#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
257
Ryan Hsu07495ea2016-01-21 15:25:39 -0800258/*
259 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
260 * here if the Kernel version is less than 3.17 to avoid the interleave
261 * conditional compilation.
262 */
263#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS))
264#define NET_NAME_UNKNOWN 0
265#endif
266
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530267#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530268
269/* session ID invalid */
270#define HDD_SESSION_ID_INVALID 0xFF
271
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530272#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
273
274/*
275 * @eHDD_SCAN_REJECT_DEFAULT: default value
276 * @eHDD_CONNECTION_IN_PROGRESS: connection is in progress
277 * @eHDD_REASSOC_IN_PROGRESS: reassociation is in progress
278 * @eHDD_EAPOL_IN_PROGRESS: STA/P2P-CLI is in middle of EAPOL/WPS exchange
279 * @eHDD_SAP_EAPOL_IN_PROGRESS: SAP/P2P-GO is in middle of EAPOL/WPS exchange
280 */
281enum scan_reject_states {
282 eHDD_SCAN_REJECT_DEFAULT = 0,
283 eHDD_CONNECTION_IN_PROGRESS,
284 eHDD_REASSOC_IN_PROGRESS,
285 eHDD_EAPOL_IN_PROGRESS,
286 eHDD_SAP_EAPOL_IN_PROGRESS,
287};
288
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530289/* Default Psoc id */
290#define DEFAULT_PSOC_ID 1
291
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800292/*
293 * Generic asynchronous request/response support
294 *
295 * Many of the APIs supported by HDD require a call to SME to
296 * perform an action or to retrieve some data. In most cases SME
297 * performs the operation asynchronously, and will execute a provided
298 * callback function when the request has completed. In order to
299 * synchronize this the HDD API allocates a context which is then
300 * passed to SME, and which is then, in turn, passed back to the
301 * callback function when the operation completes. The callback
302 * function then sets a completion variable inside the context which
303 * the HDD API is waiting on. In an ideal world the HDD API would
304 * wait forever (or at least for a long time) for the response to be
305 * received and for the completion variable to be set. However in
306 * most cases these HDD APIs are being invoked in the context of a
307 * user space thread which has invoked either a cfg80211 API or a
308 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
309 * Since this lock is used to synchronize many of the kernel tasks, we
310 * do not want to hold it for a long time. In addition we do not want
311 * to block user space threads (such as the wpa supplicant's main
312 * thread) for an extended time. Therefore we only block for a short
313 * time waiting for the response before we timeout. This means that
314 * it is possible for the HDD API to timeout, and for the callback to
315 * be invoked afterwards. In order for the callback function to
316 * determine if the HDD API is still waiting, a magic value is also
317 * stored in the shared context. Only if the context has a valid
318 * magic will the callback routine do any work. In order to further
319 * synchronize these activities a spinlock is used so that if any HDD
320 * API timeout coincides with its callback, the operations of the two
321 * threads will be serialized.
322 */
323
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800324extern spinlock_t hdd_context_lock;
325
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800326/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800327 * Prevent from permanent stall, resume OS Q if timer expired
328 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800329#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
330#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
331#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
332
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800333#define NUM_TX_RX_HISTOGRAM 1024
334#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
335
Mohit Khannae71e2262015-11-10 09:37:24 -0800336/**
337 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
338 * received over 100ms intervals
339 * @interval_rx: # of rx packets received in the last 100ms interval
340 * @interval_tx: # of tx packets received in the last 100ms interval
341 * @total_rx: # of total rx packets received on interface
342 * @total_tx: # of total tx packets received on interface
Yuanyuan Liu13738502016-04-06 17:41:37 -0700343 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800344 * determined on the basis of total tx and rx packets
345 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700346 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800347 * determined on the basis of rx packets received in the
348 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700349 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800350 * determined on the basis of tx packets received in the
351 * last 100ms interval
352 *
353 * The structure keeps track of throughput requirements of wlan driver in 100ms
354 * intervals for later analysis.
355 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800356struct hdd_tx_rx_histogram {
357 uint64_t interval_rx;
358 uint64_t interval_tx;
359 uint64_t total_rx;
360 uint64_t total_tx;
361 uint32_t next_vote_level;
362 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800363 uint32_t next_tx_level;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800364};
365
366typedef struct hdd_tx_rx_stats_s {
367 /* start_xmit stats */
368 __u32 txXmitCalled;
369 __u32 txXmitDropped;
370 __u32 txXmitClassifiedAC[NUM_TX_QUEUES];
371 __u32 txXmitDroppedAC[NUM_TX_QUEUES];
372 /* complete_cbk_stats */
373 __u32 txCompleted;
374 /* rx stats */
375 __u32 rxPackets[NUM_CPUS];
376 __u32 rxDropped[NUM_CPUS];
377 __u32 rxDelivered[NUM_CPUS];
378 __u32 rxRefused[NUM_CPUS];
379
380 /* txflow stats */
381 bool is_txflow_paused;
382 __u32 txflow_pause_cnt;
383 __u32 txflow_unpause_cnt;
384 __u32 txflow_timer_cnt;
385} hdd_tx_rx_stats_t;
386
387#ifdef WLAN_FEATURE_11W
388typedef struct hdd_pmf_stats_s {
389 uint8_t numUnprotDeauthRx;
390 uint8_t numUnprotDisassocRx;
391} hdd_pmf_stats_t;
392#endif
393
394typedef struct hdd_stats_s {
395 tCsrSummaryStatsInfo summary_stat;
396 tCsrGlobalClassAStatsInfo ClassA_stat;
397 tCsrGlobalClassBStatsInfo ClassB_stat;
398 tCsrGlobalClassCStatsInfo ClassC_stat;
399 tCsrGlobalClassDStatsInfo ClassD_stat;
400 tCsrPerStaStatsInfo perStaStats;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530401 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800402 hdd_tx_rx_stats_t hddTxRxStats;
403#ifdef WLAN_FEATURE_11W
404 hdd_pmf_stats_t hddPmfStats;
405#endif
406} hdd_stats_t;
407
408typedef enum {
409 HDD_ROAM_STATE_NONE,
410
411 /* Issuing a disconnect due to transition into low power states. */
412 HDD_ROAM_STATE_DISCONNECTING_POWER,
413
414 /* move to this state when HDD sets a key with SME/CSR. Note this is */
415 /* an important state to get right because we will get calls into our SME */
416 /* callback routine for SetKey activity that we did not initiate! */
417 HDD_ROAM_STATE_SETTING_KEY,
418} HDD_ROAM_STATE;
419
420typedef struct roaming_info_s {
421 HDD_ROAM_STATE roamingState;
Anurag Chouhance0dc992016-02-16 18:18:03 +0530422 qdf_event_t roamingEvent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800423
424 tSirMacAddr bssid;
425 tSirMacAddr peerMac;
426 uint32_t roamId;
427 eRoamCmdStatus roamStatus;
428 bool deferKeyComplete;
429
430} roaming_info_t;
431
432#ifdef FEATURE_WLAN_WAPI
433/* Define WAPI macros for Length, BKID count etc*/
434#define MAX_WPI_KEY_LENGTH 16
435#define MAX_NUM_PN 16
436#define MAC_ADDR_LEN 6
437#define MAX_ADDR_INDEX 12
438#define MAX_NUM_AKM_SUITES 16
439#define MAX_NUM_UNI_SUITES 16
440#define MAX_NUM_BKIDS 16
441
442/** WAPI AUTH mode definition */
443enum _WAPIAuthMode {
444 WAPI_AUTH_MODE_OPEN = 0,
445 WAPI_AUTH_MODE_PSK = 1,
446 WAPI_AUTH_MODE_CERT
447} __packed;
448typedef enum _WAPIAuthMode WAPIAuthMode;
449
450/** WAPI Work mode structure definition */
451#define WZC_ORIGINAL 0
452#define WAPI_EXTENTION 1
453
454struct _WAPI_FUNCTION_MODE {
455 unsigned char wapiMode;
456} __packed;
457
458typedef struct _WAPI_FUNCTION_MODE WAPI_FUNCTION_MODE;
459
460typedef struct _WAPI_BKID {
461 uint8_t bkid[16];
462} WAPI_BKID, *pWAPI_BKID;
463
464/** WAPI Association information structure definition */
465struct _WAPI_AssocInfo {
466 uint8_t elementID;
467 uint8_t length;
468 uint16_t version;
469 uint16_t akmSuiteCount;
470 uint32_t akmSuite[MAX_NUM_AKM_SUITES];
471 uint16_t unicastSuiteCount;
472 uint32_t unicastSuite[MAX_NUM_UNI_SUITES];
473 uint32_t multicastSuite;
474 uint16_t wapiCability;
475 uint16_t bkidCount;
476 WAPI_BKID bkidList[MAX_NUM_BKIDS];
477} __packed;
478
479typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
480typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
481
482/** WAPI KEY Type definition */
483enum _WAPIKeyType {
484 PAIRWISE_KEY, /* 0 */
485 GROUP_KEY /* 1 */
486} __packed;
487typedef enum _WAPIKeyType WAPIKeyType;
488
489/** WAPI KEY Direction definition */
490enum _KEY_DIRECTION {
491 None,
492 Rx,
493 Tx,
494 Rx_Tx
495} __packed;
496
497typedef enum _KEY_DIRECTION WAPI_KEY_DIRECTION;
498
499/* WAPI KEY structure definition */
500struct WLAN_WAPI_KEY {
501 WAPIKeyType keyType;
502 WAPI_KEY_DIRECTION keyDirection; /*reserved for future use */
503 uint8_t keyId;
504 uint8_t addrIndex[MAX_ADDR_INDEX]; /*reserved for future use */
505 int wpiekLen;
506 uint8_t wpiek[MAX_WPI_KEY_LENGTH];
507 int wpickLen;
508 uint8_t wpick[MAX_WPI_KEY_LENGTH];
509 uint8_t pn[MAX_NUM_PN]; /*reserved for future use */
510} __packed;
511
512typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
513typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
514
515#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
516#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
517#define WLAN_EID_WAPI 68
518#define WAPI_PSK_AKM_SUITE 0x02721400
519#define WAPI_CERT_AKM_SUITE 0x01721400
520
521/* WAPI BKID List structure definition */
522struct _WLAN_BKID_LIST {
523 uint32_t length;
524 uint32_t BKIDCount;
525 WAPI_BKID BKID[1];
526} __packed;
527
528typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
529typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
530
531/* WAPI Information structure definition */
532struct hdd_wapi_info_s {
533 uint32_t nWapiMode;
534 bool fIsWapiSta;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530535 struct qdf_mac_addr cachedMacAddr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536 uint8_t wapiAuthMode;
537} __packed;
538typedef struct hdd_wapi_info_s hdd_wapi_info_t;
539#endif /* FEATURE_WLAN_WAPI */
540
541typedef struct beacon_data_s {
542 u8 *head;
543 u8 *tail;
544 u8 *proberesp_ies;
545 u8 *assocresp_ies;
546 int head_len;
547 int tail_len;
548 int proberesp_ies_len;
549 int assocresp_ies_len;
550 int dtim_period;
551} beacon_data_t;
552
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800553typedef enum rem_on_channel_request_type {
554 REMAIN_ON_CHANNEL_REQUEST,
555 OFF_CHANNEL_ACTION_TX,
556} rem_on_channel_request_type_t;
557
558typedef struct action_pkt_buffer {
559 uint8_t *frame_ptr;
560 uint32_t frame_length;
561 uint16_t freq;
562} action_pkt_buffer_t;
563
564typedef struct hdd_remain_on_chan_ctx {
565 struct net_device *dev;
566 struct ieee80211_channel chan;
567 enum nl80211_channel_type chan_type;
568 unsigned int duration;
569 u64 cookie;
570 rem_on_channel_request_type_t rem_on_chan_request;
Anurag Chouhan210db072016-02-22 18:42:15 +0530571 qdf_mc_timer_t hdd_remain_on_chan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800572 action_pkt_buffer_t action_pkt_buff;
573 bool hdd_remain_on_chan_cancel_in_progress;
574 uint32_t scan_id;
575} hdd_remain_on_chan_ctx_t;
576
577/* RoC Request entry */
578typedef struct hdd_roc_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530579 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800580 hdd_adapter_t *pAdapter;
581 hdd_remain_on_chan_ctx_t *pRemainChanCtx;
582} hdd_roc_req_t;
583
584/**
585 * struct hdd_scan_req - Scan Request entry
586 * @node : List entry element
587 * @adapter: Adapter address
588 * @scan_request: scan request holder
589 * @scan_id: scan identifier used across host layers which is generated at WMI
590 * @cookie: scan request identifier sent to userspace
591 * @source: scan request originator (NL/Vendor scan)
592 * @timestamp: scan request timestamp
593 *
594 * Scan request linked list element
595 */
596struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530597 qdf_list_node_t node;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800598 hdd_adapter_t *adapter;
599 struct cfg80211_scan_request *scan_request;
600 uint32_t scan_id;
601 uint8_t source;
602 uint32_t timestamp;
603};
604
605typedef enum {
606 HDD_IDLE,
607 HDD_PD_REQ_ACK_PENDING,
608 HDD_GO_NEG_REQ_ACK_PENDING,
609 HDD_INVALID_STATE,
610} eP2PActionFrameState;
611
612typedef enum {
613 WLAN_HDD_GO_NEG_REQ,
614 WLAN_HDD_GO_NEG_RESP,
615 WLAN_HDD_GO_NEG_CNF,
616 WLAN_HDD_INVITATION_REQ,
617 WLAN_HDD_INVITATION_RESP,
618 WLAN_HDD_DEV_DIS_REQ,
619 WLAN_HDD_DEV_DIS_RESP,
620 WLAN_HDD_PROV_DIS_REQ,
621 WLAN_HDD_PROV_DIS_RESP,
622} tActionFrmType;
623
624typedef struct hdd_cfg80211_state_s {
625 uint16_t current_freq;
626 u64 action_cookie;
627 uint8_t *buf;
628 size_t len;
629 hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
630 struct mutex remain_on_chan_ctx_lock;
631 eP2PActionFrameState actionFrmState;
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530632 /* is_go_neg_ack_received flag is set to 1 when
Jeff Johnsonef926352017-01-12 10:41:02 -0800633 * the pending ack for GO negotiation req is
634 * received.
635 */
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530636 bool is_go_neg_ack_received;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800637} hdd_cfg80211_state_t;
638
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700639/**
640 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
641 * @channel: Channel number.
642 * @cb_mode: Channel bonding
643 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
644 * @phy_mode: PHY mode
645 */
646struct hdd_mon_set_ch_info {
647 uint8_t channel;
648 uint8_t cb_mode;
649 uint32_t channel_width;
650 eCsrPhyMode phy_mode;
651};
652
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800653struct hdd_station_ctx {
654 /** Handle to the Wireless Extension State */
655 hdd_wext_state_t WextState;
656
657#ifdef FEATURE_WLAN_TDLS
658 tdlsCtx_t *pHddTdlsCtx;
659#endif
660
661 /**Connection information*/
662 connection_info_t conn_info;
663
664 roaming_info_t roam_info;
665
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800667
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800668 /*Increment whenever ibss New peer joins and departs the network */
669 int ibss_sta_generation;
670
671 /* Indication of wep/wpa-none keys installation */
672 bool ibss_enc_key_installed;
673
674 /*Save the wep/wpa-none keys */
675 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700676 tSirPeerInfoRspParams ibss_peer_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800677
678 bool hdd_ReassocScenario;
679
680 /* STA ctx debug variables */
681 int staDebugState;
Chandrasekaran, Manishekar34e325a2015-12-18 12:07:22 +0530682
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700683 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700684
685 struct hdd_mon_set_ch_info ch_info;
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -0700686#ifdef WLAN_FEATURE_NAN_DATAPATH
687 struct nan_datapath_ctx ndp_ctx;
688#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800689};
690
691#define BSS_STOP 0
692#define BSS_START 1
693typedef struct hdd_hostapd_state_s {
694 int bssState;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530695 qdf_event_t qdf_event;
696 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800697 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530698 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800699 bool bCommit;
700
701} hdd_hostapd_state_t;
702
wadesong9b819072017-02-07 16:42:09 +0800703/**
704 * enum bss_stop_reason - reasons why a BSS is stopped.
705 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
706 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
707 * driver is trying to switch AP role to a different channel
708 * to maintain SCC mode with the STA role on the same card.
709 * this usually happens when STA is connected to an external
710 * AP that runs on a different channel
711 */
712enum bss_stop_reason {
713 BSS_STOP_REASON_INVALID = 0,
714 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
715};
716
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800717/*
718 * Per station structure kept in HDD for multiple station support for SoftAP
719 */
720typedef struct {
721 /** The station entry is used or not */
722 bool isUsed;
723
724 /** Station ID reported back from HAL (through SAP). Broadcast
Jeff Johnsonef926352017-01-12 10:41:02 -0800725 * uses station ID zero by default in both libra and volans.
726 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800727 uint8_t ucSTAId;
728
729 /** MAC address of the station */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530730 struct qdf_mac_addr macAddrSTA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800731
732 /** Current Station state so HDD knows how to deal with packet
Jeff Johnsonef926352017-01-12 10:41:02 -0800733 * queue. Most recent states used to change TLSHIM STA state
734 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800735 enum ol_txrx_peer_state tlSTAState;
736
737 /** Track QoS status of station */
738 bool isQosEnabled;
739
740 /** The station entry for which Deauth is in progress */
741 bool isDeauthInProgress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530742
743 /** Number of spatial streams supported */
744 uint8_t nss;
745
746 /** Rate Flags for this connection */
747 uint32_t rate_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800748} hdd_station_info_t;
749
750struct hdd_ap_ctx_s {
751 hdd_hostapd_state_t HostapdState;
752
753 /* Memory differentiation mode is enabled */
754 /* uint16_t uMemoryDiffThreshold; */
755 /* uint8_t uNumActiveAC; */
756 /* uint8_t uActiveACMask; */
757
758 /** Packet Count to update uNumActiveAC and uActiveACMask */
759 /* uint16_t uUpdatePktCount; */
760
761 /** Station ID assigned after BSS starts */
762 uint8_t uBCStaId;
763
764 uint8_t uPrivacy; /* The privacy bits of configuration */
765
766 tSirWPSPBCProbeReq WPSPBCProbeReq;
767
768 tsap_Config_t sapConfig;
769
770 struct semaphore semWpsPBCOverlapInd;
771
772 bool apDisableIntraBssFwd;
773
Anurag Chouhan210db072016-02-22 18:42:15 +0530774 qdf_mc_timer_t hdd_ap_inactivity_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800775
776 uint8_t operatingChannel;
777
778 bool uIsAuthenticated;
779
780 eCsrEncryptionType ucEncryptType;
781
782 /* This will point to group key data, if it is received before start bss. */
783 tCsrRoamSetKey groupKey;
784 /* This will have WEP key data, if it is received before start bss */
785 tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
786
Kondabattini, Ganesh702d90e2016-09-03 01:54:22 +0530787 /* WEP default key index */
788 uint8_t wep_def_key_idx;
789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800790 beacon_data_t *beacon;
791
792 bool bApActive;
Dustin Brown5e79c102016-09-21 11:29:39 -0700793
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800794 /* SAP Context */
795 void *sapContext;
Dustin Brown5e79c102016-09-21 11:29:39 -0700796
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800797 bool dfs_cac_block_tx;
Kapil Gupta8878ad92017-02-13 11:56:04 +0530798 qdf_mc_timer_t vendor_acs_timer;
799 bool vendor_acs_timer_initialized;
wadesong9b819072017-02-07 16:42:09 +0800800
801 enum bss_stop_reason bss_stop_reason;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800802};
803
804typedef struct hdd_scaninfo_s {
805 /* The scan pending */
806 uint32_t mScanPending;
807
808 /* Counter for mScanPending so that the scan pending
Jeff Johnsonef926352017-01-12 10:41:02 -0800809 * error log is not printed for more than 5 times
810 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800811 uint32_t mScanPendingCounter;
812
813 /* Additional IE for scan */
814 tSirAddie scanAddIE;
815
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530816 uint8_t *default_scan_ies;
817 uint8_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800818 /* Scan mode */
819 tSirScanType scan_mode;
820
821 /* completion variable for abortscan */
822 struct completion abortscan_event_var;
823
824} hdd_scaninfo_t;
825
Dustin Brown61269462016-09-19 13:25:45 -0700826#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800827
828#ifdef WLAN_FEATURE_PACKET_FILTERING
829typedef struct multicast_addr_list {
830 uint8_t isFilterApplied;
831 uint8_t mc_cnt;
832 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
833} t_multicast_add_list;
834#endif
835
836#define WLAN_HDD_MAX_HISTORY_ENTRY 10
837
838/**
839 * struct hdd_netif_queue_stats - netif queue operation statistics
840 * @pause_count - pause counter
841 * @unpause_count - unpause counter
842 */
843struct hdd_netif_queue_stats {
844 uint16_t pause_count;
845 uint16_t unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530846 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800847};
848
849/**
850 * struct hdd_netif_queue_history - netif queue operation history
851 * @time: timestamp
852 * @netif_action: action type
853 * @netif_reason: reason type
854 * @pause_map: pause map
855 */
856struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530857 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800858 uint16_t netif_action;
859 uint16_t netif_reason;
860 uint32_t pause_map;
861};
862
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530863/**
864 * struct hdd_chan_change_params - channel related information
865 * @chan: operating channel
866 * @chan_params: channel parameters
867 */
868struct hdd_chan_change_params {
869 uint8_t chan;
870 struct ch_params_s chan_params;
871};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800872
Komal Seelama89be8d2016-09-29 11:09:26 +0530873/**
Komal Seelam8634b772016-09-29 12:12:24 +0530874 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
875 * @scan: scan context to prvent/allow runtime pm
876 *
877 * Prevent Runtime PM for scan
878 */
879struct hdd_runtime_pm_context {
880 qdf_runtime_lock_t scan;
Komal Seelamaa75f262016-09-29 12:32:13 +0530881 qdf_runtime_lock_t roc;
Komal Seelam81cb1662016-09-29 12:39:08 +0530882 qdf_runtime_lock_t dfs;
Komal Seelam8634b772016-09-29 12:12:24 +0530883};
884
885/**
Komal Seelama89be8d2016-09-29 11:09:26 +0530886 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
887 * @connect: Runtime Connect Context
888 *
889 * Structure to hold runtime pm connect context for each adapter.
890 */
891struct hdd_connect_pm_context {
892 qdf_runtime_lock_t connect;
893};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800894
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530895/*
896 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
897 * belonging to this driver from net devices belonging to other devices.
898 * Therefore, the magic number must be unique relative to the numbers for
899 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
900 * (e.g. by compiler argument), then use that. If it's not already defined,
901 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
902 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
903 */
904#ifndef WLAN_HDD_ADAPTER_MAGIC
905#ifdef MULTI_IF_NAME
906#define WLAN_HDD_ADAPTER_MAGIC \
907 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
908 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
909 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
910 (MULTI_IF_NAME[1] << 16) : \
911 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
912 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
913#else
Komal Seelama89be8d2016-09-29 11:09:26 +0530914#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530915#endif
916#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800917
918struct hdd_adapter_s {
Jeff Johnsond399e902015-12-17 15:17:02 -0800919 /* Magic cookie for adapter sanity verification. Note that this
920 * needs to be at the beginning of the private data structure so
921 * that it will exists at the beginning of dev->priv and hence
922 * will always be in mapped memory
923 */
924 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800925
Jeff Johnsond399e902015-12-17 15:17:02 -0800926 void *pHddCtx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530927 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800928
Leo Changfdb45c32016-10-28 11:09:23 -0700929 void *txrx_vdev;
930
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800931 /** Handle to the network device */
932 struct net_device *dev;
933
Krunal Soni276241e2016-03-10 12:58:11 -0800934 enum tQDF_ADAPTER_MODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -0800935
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800936 /** IPv4 notifier callback for handling ARP offload on change in IP */
937 struct work_struct ipv4NotifierWorkQueue;
938#ifdef WLAN_NS_OFFLOAD
939 /** IPv6 notifier callback for handling NS offload on change in IP */
940 struct work_struct ipv6NotifierWorkQueue;
941#endif
942
943 /* TODO Move this to sta Ctx */
944 struct wireless_dev wdev;
945 struct cfg80211_scan_request *request;
946
947 /** ops checks if Opportunistic Power Save is Enable or Not
948 * ctw stores ctWindow value once we receive Opps command from
949 * wpa_supplicant then using ctWindow value we need to Enable
950 * Opportunistic Power Save
951 */
952 uint8_t ops;
953 uint32_t ctw;
954
955 /** Current MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530956 struct qdf_mac_addr macAddressCurrent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800957
958 /**Event Flags*/
959 unsigned long event_flags;
960
961 /**Device TX/RX statistics*/
962 struct net_device_stats stats;
963 /** HDD statistics*/
964 hdd_stats_t hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -0800965
966 /* estimated link speed */
967 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800968
969 uint8_t sessionId;
970
971 /* Completion variable for session close */
972 struct completion session_close_comp_var;
973
974 /* Completion variable for session open */
975 struct completion session_open_comp_var;
976
977 /* TODO: move these to sta ctx. These may not be used in AP */
978 /** completion variable for disconnect callback */
979 struct completion disconnect_comp_var;
980
981 /** Completion of change country code */
982 struct completion change_country_code;
983
984 /* completion variable for Linkup Event */
985 struct completion linkup_event_var;
986
987 /* completion variable for cancel remain on channel Event */
988 struct completion cancel_rem_on_chan_var;
989
990 /* completion variable for off channel remain on channel Event */
991 struct completion offchannel_tx_event;
992 /* Completion variable for action frame */
993 struct completion tx_action_cnf_event;
994 /* Completion variable for remain on channel ready */
995 struct completion rem_on_chan_ready_event;
996
997 struct completion sta_authorized_event;
998#ifdef FEATURE_WLAN_TDLS
999 struct completion tdls_add_station_comp;
1000 struct completion tdls_del_station_comp;
1001 struct completion tdls_mgmt_comp;
1002 struct completion tdls_link_establish_req_comp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301003 QDF_STATUS tdlsAddStaStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001004#endif
1005
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001006 struct completion ibss_peer_info_comp;
1007
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001008 /* Track whether the linkup handling is needed */
1009 bool isLinkUpSvcNeeded;
1010
1011 /* Mgmt Frames TX completion status code */
1012 uint32_t mgmtTxCompletionStatus;
1013
1014 /* WMM Status */
1015 hdd_wmm_status_t hddWmmStatus;
1016/*************************************************************
1017 */
1018/*************************************************************
1019 * TODO - Remove it later
1020 */
1021 /** Multiple station supports */
1022 /** Per-station structure */
1023 spinlock_t staInfo_lock; /* To protect access to station Info */
1024 hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
1025 /* uint8_t uNumActiveStation; */
1026
1027/*************************************************************
1028 */
1029
1030#ifdef FEATURE_WLAN_WAPI
1031 hdd_wapi_info_t wapi_info;
1032#endif
1033
1034 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301035 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001036#ifdef WLAN_FEATURE_LPSS
1037 bool rssi_send;
1038#endif
1039
1040 uint8_t snr;
1041
1042 struct work_struct monTxWorkQueue;
1043 struct sk_buff *skb_to_tx;
1044
1045 union {
1046 hdd_station_ctx_t station;
1047 hdd_ap_ctx_t ap;
1048 } sessionCtx;
1049
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001050#ifdef WLAN_FEATURE_TSF
1051 /* tsf value received from firmware */
1052 uint32_t tsf_low;
1053 uint32_t tsf_high;
1054 /* TSF capture state */
1055 enum hdd_tsf_capture_state tsf_state;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001056 uint64_t tsf_sync_soc_timer;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001057#endif
1058
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001059 hdd_cfg80211_state_t cfg80211State;
1060
1061#ifdef WLAN_FEATURE_PACKET_FILTERING
1062 t_multicast_add_list mc_addr_list;
1063#endif
1064 uint8_t addr_filter_pattern;
1065
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001066 bool higherDtimTransition;
1067 bool survey_idx;
1068
1069 hdd_scaninfo_t scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001070
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001071 /* Flag to ensure PSB is configured through framework */
1072 uint8_t psbChanged;
1073 /* UAPSD psb value configured through framework */
1074 uint8_t configuredPsb;
1075#ifdef IPA_OFFLOAD
1076 void *ipa_context;
1077#endif
1078 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1079 * since CSR (PMAC Struct) Config is same for both AP
1080 */
1081 struct delayed_work acs_pending_work;
1082
1083 struct work_struct scan_block_work;
1084#ifdef MSM_PLATFORM
1085 unsigned long prev_rx_packets;
1086 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301087 uint64_t prev_fwd_tx_packets;
1088 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001089 int connection;
1090#endif
1091 bool is_roc_inprogress;
1092
1093#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301094 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001095 bool tx_flow_timer_initialized;
1096 unsigned int tx_flow_low_watermark;
1097 unsigned int tx_flow_high_watermark_offset;
1098#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1099 bool offloads_configured;
1100
1101 /* DSCP to UP QoS Mapping */
1102 sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP + 1];
1103
1104#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1105 bool isLinkLayerStatsSet;
1106#endif
1107 uint8_t linkStatus;
1108
1109 /* variable for temperature in Celsius */
1110 int temperature;
1111
1112 /* Time stamp for last completed RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301113 uint64_t last_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001114
1115 /* Time stamp for start RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301116 uint64_t start_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001117
Agrawal Ashishb141b092016-09-02 19:59:26 +05301118#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001119 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301120 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001121 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301122#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001123
1124 /* BITMAP indicating pause reason */
1125 uint32_t pause_map;
1126 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301127 qdf_time_t start_time;
1128 qdf_time_t last_time;
1129 qdf_time_t total_pause_time;
1130 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001131 uint8_t history_index;
1132 struct hdd_netif_queue_history
1133 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1134 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
1135 struct hdd_lro_s lro_info;
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001136 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001137 /* debugfs entry */
1138 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301139 /*
1140 * The pre cac channel is saved here and will be used when the SAP's
1141 * channel needs to be moved from the existing 2.4GHz channel.
1142 */
1143 uint8_t pre_cac_chan;
Komal Seelama89be8d2016-09-29 11:09:26 +05301144 struct hdd_connect_pm_context connect_rpm_ctx;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001145
1146 bool fast_roaming_allowed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001147};
1148
1149#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
1150#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
1151#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.station.WextState)
1152#define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t *)pAdapter->pHddCtx)
1153#define WLAN_HDD_GET_HAL_CTX(pAdapter) (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
1154#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
1155#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001156#define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001157#ifdef FEATURE_WLAN_TDLS
1158#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
Krunal Soni276241e2016-03-10 12:58:11 -08001159 (((QDF_STA_MODE != pAdapter->device_mode) && \
1160 (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001161#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \
1162 ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \
1163 (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
1164#endif
1165
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001166#ifdef WLAN_FEATURE_NAN_DATAPATH
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001167#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \
1168 (&(adapter)->sessionCtx.station.ndp_ctx)
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001169#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001170#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001171/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1172 * intentionally so that all references to these must be within NDP code.
1173 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1174 * invoke NDP code to do all work.
1175 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001176#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001177#endif
1178
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001179/* Set mac address locally administered bit */
1180#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1181
1182#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1183#define HDD_RESET_MCC_P2P_QUOTA 50
1184
1185typedef struct hdd_adapter_list_node {
Anurag Chouhanffb21542016-02-17 14:33:03 +05301186 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001187 hdd_adapter_t *pAdapter;
1188} hdd_adapter_list_node_t;
1189
1190typedef struct hdd_priv_data_s {
1191 uint8_t *buf;
1192 int used_len;
1193 int total_len;
1194} hdd_priv_data_t;
1195
1196#define MAX_MOD_LOGLEVEL 10
1197typedef struct {
1198 uint8_t enable;
1199 uint8_t dl_type;
1200 uint8_t dl_report;
1201 uint8_t dl_loglevel;
1202 uint8_t index;
1203 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1204
1205} fw_log_info;
1206
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001207/**
1208 * enum antenna_mode - number of TX/RX chains
1209 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1210 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1211 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1212 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1213 */
1214enum antenna_mode {
1215 HDD_ANTENNA_MODE_INVALID,
1216 HDD_ANTENNA_MODE_1X1,
1217 HDD_ANTENNA_MODE_2X2,
1218 HDD_ANTENNA_MODE_MAX
1219};
1220
1221/**
1222 * enum smps_mode - SM power save mode
1223 * @HDD_SMPS_MODE_STATIC: Static power save
1224 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1225 * @HDD_SMPS_MODE_RESERVED: Reserved
1226 * @HDD_SMPS_MODE_DISABLED: Disable power save
1227 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1228 */
1229enum smps_mode {
1230 HDD_SMPS_MODE_STATIC,
1231 HDD_SMPS_MODE_DYNAMIC,
1232 HDD_SMPS_MODE_RESERVED,
1233 HDD_SMPS_MODE_DISABLED,
1234 HDD_SMPS_MODE_MAX
1235};
1236
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001237#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1238/**
1239 * struct hdd_offloaded_packets - request id to pattern id mapping
1240 * @request_id: request id
1241 * @pattern_id: pattern id
1242 *
1243 */
1244struct hdd_offloaded_packets {
1245 uint32_t request_id;
1246 uint8_t pattern_id;
1247};
1248
1249/**
1250 * struct hdd_offloaded_packets_ctx - offloaded packets context
1251 * @op_table: request id to pattern id table
1252 * @op_lock: mutex lock
1253 */
1254struct hdd_offloaded_packets_ctx {
1255 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1256 struct mutex op_lock;
1257};
1258#endif
1259
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301260/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301261 * enum driver_status: Driver Modules status
1262 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1263 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1264 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1265 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1266 */
1267enum driver_modules_status {
1268 DRIVER_MODULES_UNINITIALIZED,
1269 DRIVER_MODULES_OPENED,
1270 DRIVER_MODULES_ENABLED,
1271 DRIVER_MODULES_CLOSED
1272};
1273
Agrawal Ashish65634612016-08-18 13:24:32 +05301274/**
1275 * struct acs_dfs_policy - Define ACS policies
1276 * @acs_dfs_mode: Dfs mode enabled/disabled.
1277 * @acs_channel: pre defined channel to avoid ACS.
1278 */
1279struct acs_dfs_policy {
1280 enum dfs_mode acs_dfs_mode;
1281 uint8_t acs_channel;
1282};
1283
Dustin Brown105d7902016-10-03 16:27:59 -07001284/**
1285 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1286 * SUSPEND_FAIL_IPA: IPA in progress
1287 * SUSPEND_FAIL_RADAR: radar scan in progress
1288 * SUSPEND_FAIL_ROAM: roaming in progress
1289 * SUSPEND_FAIL_SCAN: scan in progress
1290 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1291 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1292 */
1293enum suspend_fail_reason {
1294 SUSPEND_FAIL_IPA,
1295 SUSPEND_FAIL_RADAR,
1296 SUSPEND_FAIL_ROAM,
1297 SUSPEND_FAIL_SCAN,
1298 SUSPEND_FAIL_INITIAL_WAKEUP,
1299 SUSPEND_FAIL_MAX_COUNT
1300};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001301
Dustin Brownd9322482017-01-09 12:46:03 -08001302/**
1303 * suspend_resume_stats - Collection of counters for suspend/resume events
1304 * @suspends: number of suspends completed
1305 * @resumes: number of resumes completed
1306 * @suspend_fail: counters for failed suspend reasons
1307 */
1308struct suspend_resume_stats {
1309 uint32_t suspends;
1310 uint32_t resumes;
1311 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1312};
1313
Dustin Brown105d7902016-10-03 16:27:59 -07001314/** Adapter structure definition */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001315struct hdd_context_s {
1316 /** Global CDS context */
1317 v_CONTEXT_t pcds_context;
1318
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301319 struct wlan_objmgr_psoc *hdd_psoc;
1320 struct wlan_objmgr_pdev *hdd_pdev;
1321
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001322 /** HAL handle...*/
1323 tHalHandle hHal;
1324
1325 struct wiphy *wiphy;
1326 /* TODO Remove this from here. */
1327
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301328 qdf_spinlock_t hdd_adapter_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301329 qdf_list_t hddAdapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001330
1331 /* 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 +05301332 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 -08001333
1334 /** Pointer for firmware image data */
1335 const struct firmware *fw;
1336
1337 /** Pointer for configuration data */
1338 const struct firmware *cfg;
1339
1340 /** Pointer to the parent device */
1341 struct device *parent_dev;
1342
1343 /** Config values read from qcom_cfg.ini file */
1344 struct hdd_config *config;
1345
1346 struct wlan_hdd_ftm_status ftm;
1347
1348 /* Completion variable to indicate Mc Thread Suspended */
1349 struct completion mc_sus_event_var;
1350
Rajeev Kumareada0d02016-12-08 17:44:17 -08001351 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001352
1353#ifdef QCA_CONFIG_SMP
1354 bool is_ol_rx_thread_suspended;
1355#endif
1356
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001357 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;
Ganesh Kondabattini5159c432016-12-26 20:07:33 +05301395 /* linear mac address table for counting the packets */
1396 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
1397 /* number of valid mac entry in @ct_peer_mac_table */
1398 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001399 struct mutex tdls_lock;
1400 uint8_t tdls_off_channel;
1401 uint16_t tdls_channel_offset;
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301402 int32_t tdls_fw_off_chan_mode;
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001403 bool enable_tdls_connection_tracker;
1404 uint8_t tdls_external_peer_count;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001405 bool tdls_nss_switch_in_progress;
Kabilan Kannanff89f742016-08-15 18:14:10 -07001406 bool tdls_nss_teardown_complete;
1407 enum tdls_nss_transition_type tdls_nss_transition_mode;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001408 int32_t tdls_teardown_peers_cnt;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001409 struct tdls_set_state_info set_state_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001410#endif
1411
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001412 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001413
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001414 /* Use below lock to protect access to isSchedScanUpdatePending
1415 * since it will be accessed in two different contexts.
1416 */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301417 qdf_spinlock_t sched_scan_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001418
1419 /* Flag keeps track of wiphy suspend/resume */
1420 bool isWiphySuspended;
1421
1422 /* Indicates about pending sched_scan results */
1423 bool isSchedScanUpdatePending;
1424
1425#ifdef MSM_PLATFORM
1426 /* DDR bus bandwidth compute timer
1427 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301428 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001429 bool bus_bw_timer_running;
1430 qdf_spinlock_t bus_bw_timer_lock;
1431 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001432 int cur_vote_level;
1433 spinlock_t bus_bw_lock;
1434 int cur_rx_level;
1435 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001436 int cur_tx_level;
1437 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001438#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001439
1440 struct completion ready_to_suspend;
1441 /* defining the solution type */
1442 uint32_t target_type;
1443
1444 /* defining the firmware version */
1445 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001446 uint32_t target_fw_vers_ext;
Arif Hussain1969ec82016-07-08 10:37:01 -07001447 qdf_atomic_t dfs_radar_found;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001448
1449 /* defining the chip/rom version */
1450 uint32_t target_hw_version;
1451 /* defining the chip/rom revision */
1452 uint32_t target_hw_revision;
1453 /* chip/rom name */
1454 const char *target_hw_name;
1455 struct regulatory reg;
1456#ifdef FEATURE_WLAN_CH_AVOID
1457 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001458 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001459#endif /* FEATURE_WLAN_CH_AVOID */
1460
1461 uint8_t max_intf_count;
1462 uint8_t current_intf_count;
1463#ifdef WLAN_FEATURE_LPSS
1464 uint8_t lpss_support;
1465#endif
1466 uint8_t ap_arpns_support;
1467 tSirScanType ioctl_scan_mode;
1468
1469#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301470 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001471#endif
1472
1473 struct work_struct sap_start_work;
1474 bool is_sap_restart_required;
1475 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301476 qdf_spinlock_t sap_update_info_lock;
1477 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001478
1479 uint8_t dev_dfs_cac_status;
1480
1481 bool btCoexModeSet;
1482#ifdef FEATURE_GREEN_AP
1483 struct hdd_green_ap_ctx *green_ap_ctx;
1484#endif
1485 fw_log_info fw_log_settings;
1486#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301487 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001488 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001489 uint8_t *last_acs_channel_list;
1490 uint8_t num_of_channels;
1491 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001492#endif
1493
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301494 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001495 atomic_t sap_dfs_ref_cnt;
1496
1497#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1498 bool is_extwow_app_type1_param_set;
1499 bool is_extwow_app_type2_param_set;
1500 bool ext_wow_should_suspend;
1501 struct completion ready_to_extwow;
1502#endif
1503
1504 /* Time since boot up to extscan start (in micro seconds) */
1505 uint64_t ext_scan_start_since_boot;
1506 unsigned long g_event_flags;
1507 /* RoC request queue and work */
1508 struct delayed_work roc_req_work;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301509 qdf_spinlock_t hdd_roc_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301510 qdf_list_t hdd_roc_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001511#ifndef NAPIER_SCAN
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301512 qdf_spinlock_t hdd_scan_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301513 qdf_list_t hdd_scan_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001514#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001515 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301516
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001517#ifdef WLAN_NS_OFFLOAD
1518 /* IPv6 notifier callback for handling NS offload on change in IP */
1519 struct notifier_block ipv6_notifier;
1520#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301521 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001522 /* IPv4 notifier callback for handling ARP offload on change in IP */
1523 struct notifier_block ipv4_notifier;
1524
1525 /* number of rf chains supported by target */
1526 uint32_t num_rf_chains;
1527 /* Is htTxSTBC supported by target */
1528 uint8_t ht_tx_stbc_supported;
1529#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1530 struct hdd_offloaded_packets_ctx op_ctx;
1531#endif
1532 bool mcc_mode;
1533#ifdef WLAN_FEATURE_MEMDUMP
1534 uint8_t *fw_dump_loc;
1535 uint32_t dump_loc_paddr;
Anurag Chouhan210db072016-02-22 18:42:15 +05301536 qdf_mc_timer_t memdump_cleanup_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001537 struct mutex memdump_lock;
1538 bool memdump_in_progress;
Sachin Ahuja02dd2e72016-09-03 16:17:51 +05301539 bool memdump_init_done;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001540#endif /* WLAN_FEATURE_MEMDUMP */
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301541 uint16_t driver_dump_size;
1542 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001543
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001544 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301545 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001546
1547 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301548 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001549
Krunal Sonie3531942016-04-12 17:43:53 -07001550 /*
1551 * place to store FTM capab of target. This allows changing of FTM capab
1552 * at runtime and intersecting it with target capab before updating.
1553 */
1554 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001555 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001556 /* completion variable to indicate set antenna mode complete*/
1557 struct completion set_antenna_mode_cmpl;
1558 /* Current number of TX X RX chains being used */
1559 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301560 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001561
1562 /* the radio index assigned by cnss_logger */
1563 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301564 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301565 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301566 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001567#ifdef WLAN_FEATURE_NAN_DATAPATH
1568 bool nan_datapath_enabled;
1569#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301570 /* Present state of driver cds modules */
1571 enum driver_modules_status driver_status;
1572 /* MC timer interface change */
1573 qdf_mc_timer_t iface_change_timer;
1574 /* Interface change lock */
1575 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301576 bool rps;
1577 bool enableRxThread;
1578 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301579 bool stop_modules_in_progress;
1580 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001581 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301582 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301583 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001584 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301585 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301586 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301587 struct scan_chan_info *chan_info;
1588 struct mutex chan_info_lock;
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;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301593 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301594 uint8_t last_scan_reject_session_id;
1595 enum scan_reject_states last_scan_reject_reason;
1596 unsigned long last_scan_reject_timestamp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001597};
1598
Kapil Gupta086c6202016-12-11 18:17:06 +05301599/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301600 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1601 * @channel_count: channel count
1602 * @channel_list: pointer to channel list
1603 * @vendor_pcl_list: pointer to pcl list
1604 * @vendor_weight_list: pointer to pcl weight list
1605 */
1606struct hdd_vendor_acs_chan_params {
1607 uint32_t channel_count;
1608 uint8_t *channel_list;
1609 uint8_t *vendor_pcl_list;
1610 uint8_t *vendor_weight_list;
1611};
1612
1613/**
1614 * struct hdd_external_acs_timer_context - acs timer context
1615 * @reason: reason for acs trigger
1616 * @adapter: hdd adapter for acs
1617 */
1618struct hdd_external_acs_timer_context {
1619 int8_t reason;
1620 hdd_adapter_t *adapter;
1621};
1622
1623/**
1624 * struct hdd_vendor_chan_info - vendor channel info
1625 * @pri_ch: primary channel
1626 * @ht_sec_ch: secondary channel
1627 * @vht_seg0_center_ch: segment0 for vht
1628 * @vht_seg1_center_ch: vht segment 1
1629 * @chan_width: channel width
1630 */
1631struct hdd_vendor_chan_info {
1632 uint8_t pri_ch;
1633 uint8_t ht_sec_ch;
1634 uint8_t vht_seg0_center_ch;
1635 uint8_t vht_seg1_center_ch;
1636 uint8_t chan_width;
1637};
1638
1639/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301640 * struct hdd_channel_info - standard channel info
1641 * @freq: Freq in Mhz
1642 * @flags: channel info flags
1643 * @flagext: extended channel info flags
1644 * @ieee_chan_number: channel number
1645 * @max_reg_power: max tx power according to regulatory
1646 * @max_radio_power: max radio power
1647 * @min_radio_power: min radio power
1648 * @reg_class_id: regulatory class
1649 * @max_antenna_gain: max antenna gain allowed on channel
1650 * @vht_center_freq_seg0: vht center freq segment 0
1651 * @vht_center_freq_seg1: vht center freq segment 1
1652 */
1653struct hdd_channel_info {
1654 u_int16_t freq;
1655 u_int32_t flags;
1656 u_int16_t flagext;
1657 u_int8_t ieee_chan_number;
1658 int8_t max_reg_power;
1659 int8_t max_radio_power;
1660 int8_t min_radio_power;
1661 u_int8_t reg_class_id;
1662 u_int8_t max_antenna_gain;
1663 u_int8_t vht_center_freq_seg0;
1664 u_int8_t vht_center_freq_seg1;
1665};
1666
Jeff Johnsonef926352017-01-12 10:41:02 -08001667/*
1668 * Function declarations and documentation
1669 */
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301670int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter,
1671 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001672 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001673#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1674void wlan_hdd_check_sta_ap_concurrent_ch_intf(void *sta_pAdapter);
1675#endif
1676
1677const char *hdd_device_mode_to_string(uint8_t device_mode);
1678
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301679QDF_STATUS hdd_get_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001680 hdd_adapter_list_node_t **ppAdapterNode);
1681
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301682QDF_STATUS hdd_get_next_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001683 hdd_adapter_list_node_t *pAdapterNode,
1684 hdd_adapter_list_node_t **pNextAdapterNode);
1685
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301686QDF_STATUS hdd_remove_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001687 hdd_adapter_list_node_t *pAdapterNode);
1688
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301689QDF_STATUS hdd_remove_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001690 hdd_adapter_list_node_t **ppAdapterNode);
1691
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301692QDF_STATUS hdd_add_adapter_back(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001693 hdd_adapter_list_node_t *pAdapterNode);
1694
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301695QDF_STATUS hdd_add_adapter_front(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001696 hdd_adapter_list_node_t *pAdapterNode);
1697
1698hdd_adapter_t *hdd_open_adapter(hdd_context_t *pHddCtx, uint8_t session_type,
1699 const char *name, tSirMacAddr macAddr,
Ryan Hsu07495ea2016-01-21 15:25:39 -08001700 unsigned char name_assign_type,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001701 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301702QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001703 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301704QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
1705QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
Hanumanth Reddy Pothula9f4048f2016-09-30 15:06:57 +05301706void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301707QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
1708QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001709hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
1710 uint32_t vdev_id);
1711hdd_adapter_t *hdd_get_adapter_by_macaddr(hdd_context_t *pHddCtx,
1712 tSirMacAddr macAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301713QDF_STATUS hdd_init_station_mode(hdd_adapter_t *pAdapter);
Krunal Soni276241e2016-03-10 12:58:11 -08001714hdd_adapter_t *hdd_get_adapter(hdd_context_t *pHddCtx,
1715 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001716void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
1717 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301718QDF_STATUS hdd_stop_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001719 const bool bCloseSession);
1720void hdd_set_station_ops(struct net_device *pWlanDev);
1721uint8_t *wlan_hdd_get_intf_addr(hdd_context_t *pHddCtx);
1722void wlan_hdd_release_intf_addr(hdd_context_t *pHddCtx, uint8_t *releaseAddr);
Krunal Soni276241e2016-03-10 12:58:11 -08001723uint8_t hdd_get_operating_channel(hdd_context_t *pHddCtx,
1724 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001725
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001726void hdd_set_conparam(uint32_t con_param);
Anurag Chouhan6d760662016-02-20 16:05:43 +05301727enum tQDF_GLOBAL_CON_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001728
1729void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +05301730 uint32_t scan_id, eCsrAbortReason reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001731void hdd_cleanup_actionframe(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
1732
1733void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
1734void wlan_hdd_reset_prob_rspies(hdd_adapter_t *pHostapdAdapter);
1735void hdd_prevent_suspend(uint32_t reason);
1736void hdd_allow_suspend(uint32_t reason);
1737void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001738
1739void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301740QDF_STATUS hdd_set_ibss_power_save_params(hdd_adapter_t *pAdapter);
1741QDF_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001742void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
1743int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
1744bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301745QDF_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001746
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001747struct qdf_mac_addr *
1748hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
1749 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001750void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001751#ifdef MSM_PLATFORM
1752void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
1753void hdd_stop_bus_bw_compute_timer(hdd_adapter_t *pAdapter);
Prashanth Bhattaab004382016-10-11 16:08:11 -07001754
1755/**
1756 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
1757 * hdd_ctx: HDD context
1758 *
1759 * Initialize bus bandwidth related data structures like spinlock and timer.
1760 *
1761 * Return: None.
1762 */
1763int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx);
1764
1765/**
1766 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
1767 * hdd_ctx: HDD context
1768 *
1769 * Destroy bus bandwidth related data structures like timer.
1770 *
1771 * Return: None.
1772 */
1773void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001774#else
1775static inline void hdd_start_bus_bw_compute_timer(hdd_adapter_t *pAdapter)
1776{
1777 return;
1778}
1779
1780static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
1781{
1782 return;
1783}
Prashanth Bhattaab004382016-10-11 16:08:11 -07001784
Leo Changfdb45c32016-10-28 11:09:23 -07001785static inline int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001786{
1787 return 0;
1788}
1789
Leo Changfdb45c32016-10-28 11:09:23 -07001790static inline void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001791{
1792 return;
1793}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794#endif
1795
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05301796int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
1797
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08001798int hdd_init(void);
1799void hdd_deinit(void);
1800
Arun Khandavallifae92942016-08-01 13:31:08 +05301801int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001802void __hdd_wlan_exit(void);
1803int hdd_wlan_notify_modem_power_state(int state);
1804#ifdef QCA_HT_2040_COEX
1805int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301806 struct qdf_mac_addr macAddrSTA, int width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001807#endif
1808
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05301809void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001810#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1811void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
1812#endif
1813
1814hdd_adapter_t *hdd_get_con_sap_adapter(hdd_adapter_t *this_sap_adapter,
1815 bool check_start_bss);
1816
1817bool hdd_is_5g_supported(hdd_context_t *pHddCtx);
1818
1819int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter);
1820
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001821void hdd_get_fw_version(hdd_context_t *hdd_ctx,
1822 uint32_t *major_spid, uint32_t *minor_spid,
1823 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05301824/**
1825 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
1826 * @context : timeout handler context
1827 *
1828 * Return: None
1829 */
1830void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001831
Kapil Gupta8878ad92017-02-13 11:56:04 +05301832/**
1833 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
1834 * @adapter: pointer to SAP adapter struct
1835 *
1836 * This function starts the ACS procedure if there are no
1837 * constraints like MBSSID DFS restrictions.
1838 *
1839 * Return: Status of ACS Start procedure
1840 */
1841int wlan_hdd_cfg80211_start_acs(hdd_adapter_t *adapter);
1842
1843/**
1844 * hdd_cfg80211_update_acs_config() - update acs config to application
1845 * @adapter: hdd adapter
1846 * @reason: channel change reason
1847 *
1848 * Return: none
1849 */
1850void hdd_cfg80211_update_acs_config(hdd_adapter_t *adapter,
1851 uint8_t reason);
1852/**
1853 * hdd_update_acs_timer_reason() - update acs timer start reason
1854 * @adapter: hdd adapter
1855 * @reason: channel change reason
1856 *
1857 * Return: 0 for success
1858 */
1859int hdd_update_acs_timer_reason(hdd_adapter_t *adapter, uint8_t reason);
1860
1861/**
1862 * hdd_restart_sap() - Restarts SAP on the given channel
1863 * @adapter: AP adapter
1864 * @channel: Channel
1865 *
1866 * Restarts the SAP interface by invoking the function which executes the
1867 * callback to perform channel switch using (E)CSA.
1868 *
1869 * Return: None
1870 */
1871void hdd_restart_sap(hdd_adapter_t *adapter, uint8_t channel);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001872#ifdef WLAN_FEATURE_MEMDUMP
1873/**
1874 * hdd_is_memdump_supported() - to check if memdump feature support
1875 *
1876 * This function is used to check if memdump feature is supported in
1877 * the host driver
1878 *
1879 * Return: true if supported and false otherwise
1880 */
1881static inline bool hdd_is_memdump_supported(void)
1882{
1883 return true;
1884}
1885#else
1886static inline bool hdd_is_memdump_supported(void)
1887{
1888 return false;
1889}
1890#endif /* WLAN_FEATURE_MEMDUMP */
1891
1892void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301893 struct qdf_mac_addr hw_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001894void wlan_hdd_disable_roaming(hdd_adapter_t *pAdapter);
1895void wlan_hdd_enable_roaming(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001896
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301897QDF_STATUS hdd_post_cds_enable_config(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001898
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301899QDF_STATUS hdd_abort_mac_scan_all_adapters(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001900
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301901QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001902 hdd_adapter_t *ap_adapter,
1903 tCsrRoamProfile *roam_profile,
1904 tScanResultHandle *scan_cache,
1905 bool *concurrent_chnl_same);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001906void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
Arun Khandavallicc544b32017-01-30 19:52:16 +05301907void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001908
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001909void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
1910
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001911#ifdef QCA_CONFIG_SMP
1912int wlan_hdd_get_cpu(void);
1913#else
1914static inline int wlan_hdd_get_cpu(void)
1915{
1916 return 0;
1917}
1918#endif
1919
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301920void wlan_hdd_sap_pre_cac_failure(void *data);
1921void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
1922
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001923void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
1924 enum netif_action_type action, enum netif_reason_type reason);
1925
1926void hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
Nirav Shahed34b212016-04-25 10:59:16 +05301927void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001928void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
1929void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
1930void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx);
1931void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx);
1932const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05301933void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
1934hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
1935 uint32_t sme_session_id);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001936enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301937uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
1938 uint8_t bw_offset);
Arun Khandavallic811dcc2016-06-26 07:37:21 +05301939int hdd_update_config(hdd_context_t *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001940
Mukul Sharma9d797a02017-01-05 20:26:03 +05301941/**
1942 * hdd_update_components_config() - Initialize driver per module ini parameters
1943 * @hdd_ctx: HDD Context
1944 *
1945 * API is used to initialize components configuration parameters
1946 * Return: 0 for success, errno for failure
1947 */
1948int hdd_update_components_config(hdd_context_t *hdd_ctx);
1949
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05301950QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05301951 struct net_device *dev,
1952 struct hdd_chan_change_params chan_change);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301953int wlan_hdd_set_channel(struct wiphy *wiphy,
1954 struct net_device *dev,
1955 struct cfg80211_chan_def *chandef,
1956 enum nl80211_channel_type channel_type);
1957int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
1958 struct cfg80211_beacon_data *params,
1959 const u8 *ssid, size_t ssid_len,
1960 enum nl80211_hidden_ssid hidden_ssid,
Archana Ramachandran1a5b6042016-11-08 16:36:50 -08001961 bool check_for_concurrency,
1962 bool update_beacon);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301963#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1964QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void);
1965#else
1966static inline QDF_STATUS hdd_register_for_sap_restart_with_channel_switch(void)
1967{
Krunal Soni276241e2016-03-10 12:58:11 -08001968 return QDF_STATUS_SUCCESS;
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05301969}
1970#endif
1971
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001972#if !defined(REMOVE_PKT_LOG)
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301973int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
1974 int set_value2);
1975int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
1976 uint8_t user_triggered, int size);
1977
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001978#else
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301979static inline int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
1980 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001981{
1982 return 0;
1983}
Poddar, Siddarth176c4362016-10-03 12:25:00 +05301984static inline int hdd_process_pktlog_command(hdd_context_t *hdd_ctx,
1985 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08001986{
1987 return 0;
1988}
1989#endif /* REMOVE_PKT_LOG */
1990
Dhanashri Atre83d373d2015-07-28 16:45:59 -07001991#ifdef FEATURE_TSO
1992/**
1993 * hdd_set_tso_flags() - enable TSO flags in the network device
1994 * @hdd_ctx: HDD context
1995 * @wlan_dev: network device structure
1996 *
1997 * This function enables the TSO related feature flags in the
1998 * given network device.
1999 *
2000 * Return: none
2001 */
2002static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2003 struct net_device *wlan_dev)
2004{
Mohit Khanna816e6532016-12-09 15:28:21 -08002005 if (hdd_ctx->config->tso_enable &&
2006 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2007 /*
2008 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2009 * enabled.
2010 */
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002011 hdd_info("TSO Enabled");
2012 wlan_dev->features |=
2013 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2014 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2015 }
2016}
2017#else
2018static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2019 struct net_device *wlan_dev){}
2020#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002021
Agrawal Ashishc9ddbab2016-05-25 12:04:47 +05302022#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
2023 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
2024void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
2025#else
2026static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
2027{
2028}
2029#endif
2030
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002031#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002032static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002033{
2034 return hdd_ctx->config->isRoamOffloadEnabled;
2035}
2036#else
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002037static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002038{
2039 return false;
2040}
2041#endif
2042
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002043void hdd_get_ibss_peer_info_cb(void *pUserData,
2044 tSirPeerInfoRspParams *pPeerInfo);
2045
Ryan Hsuceddceb2016-04-28 10:20:14 -07002046#ifdef CONFIG_CNSS_LOGGER
2047/**
2048 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2049 * @hdd_ctx: the hdd context pointer
2050 *
2051 * The nl_srv_init() will call to cnss_logger_device_register() and
2052 * expect to get a radio_index from cnss_logger module and assign to
2053 * hdd_ctx->radio_index, then to maintain the consistency to original
2054 * design, adding the radio_index check here, then return the error
2055 * code if radio_index is not assigned correctly, which means the nl_init
2056 * from cnss_logger is failed.
2057 *
2058 * Return: 0 if successfully, otherwise error code
2059 */
2060static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2061{
2062 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2063
2064 /* radio_index is assigned from 0, so only >=0 will be valid index */
2065 if (hdd_ctx->radio_index >= 0)
2066 return 0;
2067 else
2068 return -EINVAL;
2069}
2070#else
2071/**
2072 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2073 * @hdd_ctx: the hdd context pointer
2074 *
2075 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2076 * the netlink socket and return the success or not.
2077 *
2078 * Return: the return value from nl_srv_init()
2079 */
2080static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2081{
2082 return nl_srv_init(hdd_ctx->wiphy);
2083}
2084#endif
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002085QDF_STATUS hdd_sme_close_session_callback(void *pContext);
2086
Varun Reddy Yeturu3e91dad2016-07-18 15:58:47 -07002087int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002088 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05302089void hdd_svc_fw_shutdown_ind(struct device *dev);
Arun Khandavalli4b55da72016-07-19 19:55:01 +05302090int hdd_register_cb(hdd_context_t *hdd_ctx);
2091void hdd_deregister_cb(hdd_context_t *hdd_ctx);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302092int hdd_start_station_adapter(hdd_adapter_t *adapter);
2093int hdd_start_ap_adapter(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302094int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302095int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
Arun Khandavalli2358d522016-05-16 18:05:37 +05302096int hdd_set_fw_params(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302097int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
2098 bool reinit);
Prashanth Bhatta2ac92bd2016-10-11 16:08:00 -07002099int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx);
Arun Khandavallifae92942016-08-01 13:31:08 +05302100int hdd_start_adapter(hdd_adapter_t *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302101
2102/**
2103 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2104 * @wiphy: wiphy
2105 * @channel: channel of the BSS to find
2106 * @bssid: bssid of the BSS to find
2107 * @ssid: ssid of the BSS to find
2108 * @ssid_len: ssid len of of the BSS to find
2109 *
2110 * The API is a wrapper to get bss from kernel matching the chan,
2111 * bssid and ssid
2112 *
2113 * Return: bss structure if found else NULL
2114 */
2115struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2116 struct ieee80211_channel *channel,
2117 const u8 *bssid,
2118 const u8 *ssid, size_t ssid_len);
2119
Anurag Chouhanc4092922016-09-08 15:56:11 +05302120void hdd_connect_result(struct net_device *dev, const u8 *bssid,
2121 tCsrRoamInfo *roam_info, const u8 *req_ie,
2122 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302123 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302124 bool connect_timeout,
2125 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302126
Arun Khandavallifae92942016-08-01 13:31:08 +05302127#ifdef WLAN_FEATURE_FASTPATH
2128void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2129 void *context);
2130#else
2131static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2132 void *context)
2133{
2134}
2135#endif
2136void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
Agrawal Ashish65634612016-08-18 13:24:32 +05302137enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Agrawal Ashish467dde42016-09-08 18:44:22 +05302138void hdd_ch_avoid_cb(void *hdd_context, void *indi_param);
2139void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx);
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302140int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
2141 uint8_t set_value);
Liangwei Dong8baf7c82016-10-11 01:26:59 -04002142void wlan_hdd_undo_acs(hdd_adapter_t *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002143
2144#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2145static inline int
2146hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2147{
2148 return nla_put_u64(skb, attrtype, value);
2149}
2150#else
2151static inline int
2152hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2153{
2154 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2155}
2156#endif
2157
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302158static inline int wlan_hdd_validate_session_id(u8 session_id)
2159{
2160 if (session_id != HDD_SESSION_ID_INVALID)
2161 return 0;
2162
2163 return -EINVAL;
2164}
2165
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002166bool hdd_is_roaming_in_progress(void);
2167void hdd_set_roaming_in_progress(bool value);
2168
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302169/**
2170 * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
2171 * @ap_adapter: adapter
2172 * @channel_count: valid channel count
2173 * @channel_list: valid channel list
2174 *
2175 * This API returns valid channel list for SAP after removing nol and
2176 * channel which lies outside of configuration.
2177 *
2178 * Return: Zero on success, non-zero on failure
2179 */
2180int wlan_hdd_sap_get_valid_channellist(hdd_adapter_t *adapter,
2181 uint32_t *channel_count,
2182 uint8_t *channel_list);
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302183/**
2184 * wlan_hdd_init_chan_info() - initialize channel info variables
2185 * @hdd_ctx: hdd ctx
2186 *
2187 * This API initialize channel info variables
2188 *
2189 * Return: None
2190 */
2191void wlan_hdd_init_chan_info(hdd_context_t *hdd_ctx);
2192/**
2193 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2194 * @hdd_ctx: hdd ctx
2195 *
2196 * This API deinitialize channel info variables
2197 *
2198 * Return: None
2199 */
2200void wlan_hdd_deinit_chan_info(hdd_context_t *hdd_ctx);
Arun Khandavallicc544b32017-01-30 19:52:16 +05302201void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002202#endif /* end #if !defined(WLAN_HDD_MAIN_H) */