blob: dfea090d6f73308d97b5bb00eed70bc93190b733 [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"
Naveen Rawat910726a2017-03-06 11:42:51 -080072#ifdef WIFI_POS_CONVERGED
73#include "os_if_wifi_pos.h"
74#include "wifi_pos_api.h"
75#else
76#include "wlan_hdd_oemdata.h"
77#endif
Krishna Kumaar Natarajan4f1d7722017-03-03 21:12:51 -080078#include "wlan_hdd_he.h"
79
Jeff Johnsonef926352017-01-12 10:41:02 -080080/*
81 * Preprocessor definitions and constants
82 */
83
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084/** Number of Tx Queues */
85#ifdef QCA_LL_TX_FLOW_CONTROL_V2
86#define NUM_TX_QUEUES 5
87#else
88#define NUM_TX_QUEUES 4
89#endif
Mohit Khannaee9e80f2015-11-10 11:32:49 -080090
91/** Length of the TX queue for the netdev */
92#define HDD_NETDEV_TX_QUEUE_LEN (3000)
93
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080094/** Hdd Tx Time out value */
95#ifdef LIBRA_LINUX_PC
96#define HDD_TX_TIMEOUT (8000)
97#else
98#define HDD_TX_TIMEOUT msecs_to_jiffies(5000)
99#endif
100/** Hdd Default MTU */
101#define HDD_DEFAULT_MTU (1500)
102
103#ifdef QCA_CONFIG_SMP
104#define NUM_CPUS NR_CPUS
105#else
106#define NUM_CPUS 1
107#endif
108
109/**event flags registered net device*/
110#define NET_DEVICE_REGISTERED (0)
111#define SME_SESSION_OPENED (1)
112#define INIT_TX_RX_SUCCESS (2)
113#define WMM_INIT_DONE (3)
114#define SOFTAP_BSS_STARTED (4)
115#define DEVICE_IFACE_OPENED (5)
116#define TDLS_INIT_DONE (6)
117#define ACS_PENDING (7)
Manikandan Mohan0a0ac952017-02-16 15:49:31 -0800118#define SOFTAP_INIT_DONE (8)
119
Kapil Gupta8878ad92017-02-13 11:56:04 +0530120/* Waiting for event for vendor acs */
121#define VENDOR_ACS_RESPONSE_PENDING (8)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122
123/* HDD global event flags */
124#define ACS_IN_PROGRESS (0)
125
126/** Maximum time(ms)to wait for disconnect to complete **/
127#ifdef QCA_WIFI_3_0_EMU
Abhishek Singh5a331712016-08-08 18:10:20 +0530128#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129#else
Abhishek Singh5a331712016-08-08 18:10:20 +0530130#define WLAN_WAIT_TIME_DISCONNECT 5000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131#endif
Abhishek Singh533c9da2017-05-04 10:23:34 +0530132#define WLAN_WAIT_TIME_STOP_ROAM 4000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133#define WLAN_WAIT_TIME_STATS 800
134#define WLAN_WAIT_TIME_POWER 800
135#define WLAN_WAIT_TIME_COUNTRY 1000
136#define WLAN_WAIT_TIME_LINK_STATUS 800
Sridhar Selvarajdc400d22016-10-18 17:18:03 +0530137#define WLAN_WAIT_TIME_POWER_STATS 800
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138/* Amount of time to wait for sme close session callback.
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700139 * This value should be larger than the timeout used by WDI to wait for
Jeff Johnsonef926352017-01-12 10:41:02 -0800140 * a response from WCNSS
141 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800142#define WLAN_WAIT_TIME_SESSIONOPENCLOSE 15000
143#define WLAN_WAIT_TIME_ABORTSCAN 2000
144
145/** Maximum time(ms) to wait for mc thread suspend **/
146#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
147
148/** Maximum time(ms) to wait for target to be ready for suspend **/
149#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
150
151/** Maximum time(ms) to wait for tdls add sta to complete **/
152#define WAIT_TIME_TDLS_ADD_STA 1500
153
154/** Maximum time(ms) to wait for tdls del sta to complete **/
155#define WAIT_TIME_TDLS_DEL_STA 1500
156
157/** Maximum time(ms) to wait for Link Establish Req to complete **/
158#define WAIT_TIME_TDLS_LINK_ESTABLISH_REQ 1500
159
160/** Maximum time(ms) to wait for tdls mgmt to complete **/
161#define WAIT_TIME_TDLS_MGMT 11000
162
163/* Scan Req Timeout */
164#define WLAN_WAIT_TIME_SCAN_REQ 100
165
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -0800166#define WLAN_WAIT_TIME_ANTENNA_MODE_REQ 3000
167#define WLAN_WAIT_TIME_SET_DUAL_MAC_CFG 1500
168
Arun Khandavalli2476ef52016-04-26 20:19:43 +0530169#define WLAN_WAIT_TIME_BPF 1000
170
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +0530171/* Maximum time(ms) to wait for RSO CMD status event */
172#define WAIT_TIME_RSO_CMD_STATUS 2000
173
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174#define MAX_NUMBER_OF_ADAPTERS 4
175
176#define MAX_CFG_STRING_LEN 255
177
Kapil Gupta8878ad92017-02-13 11:56:04 +0530178/* Maximum time(ms) to wait for external acs response */
179#define WLAN_VENDOR_ACS_WAIT_TIME 1000
180
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181#define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
182/** Mac Address string **/
183#define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x"
184#define MAC_ADDRESS_STR_LEN 18 /* Including null terminator */
Rajeev Kumar67f5b872017-06-06 13:26:57 -0700185/* Max and min IEs length in bytes */
186#define MAX_GENIE_LEN (512)
187#define MIN_GENIE_LEN (2)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800188
189#define WLAN_CHIP_VERSION "WCNSS"
190
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530191#define hdd_log(level, args...) QDF_TRACE(QDF_MODULE_ID_HDD, level, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800192#define hdd_logfl(level, format, args...) hdd_log(level, FL(format), ## args)
193
194#define hdd_alert(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530195 hdd_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196#define hdd_err(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530197 hdd_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800198#define hdd_warn(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530199 hdd_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800200#define hdd_notice(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530201 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800202#define hdd_info(format, args...) \
Srinivas Girigowda67044ad2017-03-30 21:23:51 -0700203 hdd_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204#define hdd_debug(format, args...) \
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530205 hdd_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800206
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530207#define ENTER() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter")
Jeff Johnson398b3d62016-02-10 17:19:39 -0800208#define ENTER_DEV(dev) \
209 hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "enter(%s)", (dev)->name)
Anurag Chouhanb2dc16f2016-02-25 11:47:37 +0530210#define EXIT() hdd_logfl(QDF_TRACE_LEVEL_INFO_LOW, "exit")
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800211
212#define WLAN_HDD_GET_PRIV_PTR(__dev__) (hdd_adapter_t *)(netdev_priv((__dev__)))
213
214#define MAX_NO_OF_2_4_CHANNELS 14
215
216#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
217#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
218#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
219#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
220#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
221#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
222#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
223#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
224#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
225#define WLAN_HDD_WFA_OUI 0x506F9A
226#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
227#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
228#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
229#define WLAN_HDD_PUBLIC_ACTION_FRAME_SUB_TYPE_OFFSET 6
230
231#define WLAN_HDD_IS_SOCIAL_CHANNEL(center_freq) \
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700232 (((center_freq) == 2412) || ((center_freq) == 2437) || \
233 ((center_freq) == 2462))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800234
235#define WLAN_HDD_CHANNEL_IN_UNII_1_BAND(center_freq) \
236 (((center_freq) == 5180) || ((center_freq) == 5200) \
237 || ((center_freq) == 5220) || ((center_freq) == 5240))
238
239#ifdef WLAN_FEATURE_11W
240#define WLAN_HDD_SA_QUERY_ACTION_FRAME 8
241#endif
242
243#define WLAN_HDD_PUBLIC_ACTION_TDLS_DISC_RESP 14
244#define WLAN_HDD_TDLS_ACTION_FRAME 12
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800245
246#define WLAN_HDD_QOS_ACTION_FRAME 1
247#define WLAN_HDD_QOS_MAP_CONFIGURE 4
248#define HDD_SAP_WAKE_LOCK_DURATION 10000 /* in msecs */
249
Mukul Sharma974ca652016-09-03 16:24:48 +0530250#if defined(CONFIG_HL_SUPPORT)
251#define HDD_MOD_EXIT_SSR_MAX_RETRIES 200
252#else
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800253#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75
Mukul Sharma974ca652016-09-03 16:24:48 +0530254#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800255
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800256#define MAX_USER_COMMAND_SIZE 4096
257
258#define HDD_MIN_TX_POWER (-100) /* minimum tx power */
259#define HDD_MAX_TX_POWER (+100) /* maximum tx power */
260
Manjeet Singhe7ecb7c2016-09-03 12:34:53 +0530261/* FW expects burst duration in 1020*ms */
262#define SIFS_BURST_DUR_MULTIPLIER 1020
263#define SIFS_BURST_DUR_MAX 12240
264
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800265/* If IPA UC data path is enabled, target should reserve extra tx descriptors
266 * for IPA data path.
267 * Then host data path should allow less TX packet pumping in case
268 * IPA data path enabled
269 */
270#define WLAN_TFC_IPAUC_TX_DESC_RESERVE 100
271
Ryan Hsu07495ea2016-01-21 15:25:39 -0800272/*
273 * NET_NAME_UNKNOWN is only introduced after Kernel 3.17, to have a macro
274 * here if the Kernel version is less than 3.17 to avoid the interleave
275 * conditional compilation.
276 */
277#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS))
278#define NET_NAME_UNKNOWN 0
279#endif
280
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +0530281#define PRE_CAC_SSID "pre_cac_ssid"
Arun Khandavallib2f6c262016-08-18 19:07:19 +0530282
283/* session ID invalid */
284#define HDD_SESSION_ID_INVALID 0xFF
285
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +0530286#define SCAN_REJECT_THRESHOLD_TIME 300000 /* Time is in msec, equal to 5 mins */
287
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530288/* Default Psoc id */
289#define DEFAULT_PSOC_ID 1
290
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800291/*
292 * Generic asynchronous request/response support
293 *
294 * Many of the APIs supported by HDD require a call to SME to
295 * perform an action or to retrieve some data. In most cases SME
296 * performs the operation asynchronously, and will execute a provided
297 * callback function when the request has completed. In order to
298 * synchronize this the HDD API allocates a context which is then
299 * passed to SME, and which is then, in turn, passed back to the
300 * callback function when the operation completes. The callback
301 * function then sets a completion variable inside the context which
302 * the HDD API is waiting on. In an ideal world the HDD API would
303 * wait forever (or at least for a long time) for the response to be
304 * received and for the completion variable to be set. However in
305 * most cases these HDD APIs are being invoked in the context of a
306 * user space thread which has invoked either a cfg80211 API or a
307 * wireless extensions ioctl and which has taken the kernel rtnl_lock.
308 * Since this lock is used to synchronize many of the kernel tasks, we
309 * do not want to hold it for a long time. In addition we do not want
310 * to block user space threads (such as the wpa supplicant's main
311 * thread) for an extended time. Therefore we only block for a short
312 * time waiting for the response before we timeout. This means that
313 * it is possible for the HDD API to timeout, and for the callback to
314 * be invoked afterwards. In order for the callback function to
315 * determine if the HDD API is still waiting, a magic value is also
316 * stored in the shared context. Only if the context has a valid
317 * magic will the callback routine do any work. In order to further
318 * synchronize these activities a spinlock is used so that if any HDD
319 * API timeout coincides with its callback, the operations of the two
320 * threads will be serialized.
321 */
322
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323extern spinlock_t hdd_context_lock;
324
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800325/* MAX OS Q block time value in msec
Jeff Johnsonef926352017-01-12 10:41:02 -0800326 * Prevent from permanent stall, resume OS Q if timer expired
327 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800328#define WLAN_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 1000
329#define WLAN_SAP_HDD_TX_FLOW_CONTROL_OS_Q_BLOCK_TIME 100
330#define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14
331
Mohit Khanna3e2115b2016-10-11 13:18:29 -0700332#define NUM_TX_RX_HISTOGRAM 128
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800333#define NUM_TX_RX_HISTOGRAM_MASK (NUM_TX_RX_HISTOGRAM - 1)
334
Mohit Khannae71e2262015-11-10 09:37:24 -0800335/**
336 * struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
337 * received over 100ms intervals
338 * @interval_rx: # of rx packets received in the last 100ms interval
339 * @interval_tx: # of tx packets received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700340 * @next_vote_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800341 * determined on the basis of total tx and rx packets
342 * received in the last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700343 * @next_rx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800344 * determined on the basis of rx packets received in the
345 * last 100ms interval
Yuanyuan Liu13738502016-04-06 17:41:37 -0700346 * @next_tx_level: pld_bus_width_type voting level (high or low)
Mohit Khannae71e2262015-11-10 09:37:24 -0800347 * determined on the basis of tx packets received in the
348 * last 100ms interval
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800349 * @qtime timestamp when the record is added
Mohit Khannae71e2262015-11-10 09:37:24 -0800350 *
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800351 * The structure keeps track of throughput requirements of wlan driver.
352 * An entry is added if either of next_vote_level, next_rx_level or
353 * next_tx_level changes. An entry is not added for every 100ms interval.
Mohit Khannae71e2262015-11-10 09:37:24 -0800354 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800355struct hdd_tx_rx_histogram {
356 uint64_t interval_rx;
357 uint64_t interval_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800358 uint32_t next_vote_level;
359 uint32_t next_rx_level;
Mohit Khannae71e2262015-11-10 09:37:24 -0800360 uint32_t next_tx_level;
Mohit Khannaafff9fb2016-11-16 20:22:03 -0800361 uint64_t qtime;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362};
363
364typedef struct hdd_tx_rx_stats_s {
365 /* start_xmit stats */
366 __u32 txXmitCalled;
367 __u32 txXmitDropped;
Mohit Khannad0b63f52017-02-18 18:05:52 -0800368 __u32 txXmitOrphaned;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800369 __u32 txXmitClassifiedAC[NUM_TX_QUEUES];
370 __u32 txXmitDroppedAC[NUM_TX_QUEUES];
Mohit Khannad0b63f52017-02-18 18:05:52 -0800371
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800372 /* rx stats */
373 __u32 rxPackets[NUM_CPUS];
374 __u32 rxDropped[NUM_CPUS];
375 __u32 rxDelivered[NUM_CPUS];
376 __u32 rxRefused[NUM_CPUS];
377
378 /* txflow stats */
379 bool is_txflow_paused;
380 __u32 txflow_pause_cnt;
381 __u32 txflow_unpause_cnt;
382 __u32 txflow_timer_cnt;
383} hdd_tx_rx_stats_t;
384
385#ifdef WLAN_FEATURE_11W
386typedef struct hdd_pmf_stats_s {
387 uint8_t numUnprotDeauthRx;
388 uint8_t numUnprotDisassocRx;
389} hdd_pmf_stats_t;
390#endif
391
392typedef struct hdd_stats_s {
393 tCsrSummaryStatsInfo summary_stat;
394 tCsrGlobalClassAStatsInfo ClassA_stat;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800395 tCsrGlobalClassDStatsInfo ClassD_stat;
Himanshu Agarwal37e42412016-07-21 14:35:09 +0530396 struct csr_per_chain_rssi_stats_info per_chain_rssi_stats;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800397 hdd_tx_rx_stats_t hddTxRxStats;
398#ifdef WLAN_FEATURE_11W
399 hdd_pmf_stats_t hddPmfStats;
400#endif
401} hdd_stats_t;
402
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700403enum hdd_roam_state {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800404 HDD_ROAM_STATE_NONE,
405
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700406 /* Issuing a disconnect due to transition into low power states */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800407 HDD_ROAM_STATE_DISCONNECTING_POWER,
408
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700409 /* Move to this state when HDD sets a key with SME/CSR. Note this is
410 * an important state to get right because we will get calls into our
411 * SME callback routine for SetKey activity that we did not initiate!
412 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800413 HDD_ROAM_STATE_SETTING_KEY,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700414};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800415
416typedef struct roaming_info_s {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700417 enum hdd_roam_state roamingState;
Anurag Chouhance0dc992016-02-16 18:18:03 +0530418 qdf_event_t roamingEvent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800419
420 tSirMacAddr bssid;
421 tSirMacAddr peerMac;
422 uint32_t roamId;
423 eRoamCmdStatus roamStatus;
424 bool deferKeyComplete;
425
426} roaming_info_t;
427
428#ifdef FEATURE_WLAN_WAPI
429/* Define WAPI macros for Length, BKID count etc*/
430#define MAX_WPI_KEY_LENGTH 16
431#define MAX_NUM_PN 16
432#define MAC_ADDR_LEN 6
433#define MAX_ADDR_INDEX 12
434#define MAX_NUM_AKM_SUITES 16
435#define MAX_NUM_UNI_SUITES 16
436#define MAX_NUM_BKIDS 16
437
438/** WAPI AUTH mode definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700439enum wapi_auth_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800440 WAPI_AUTH_MODE_OPEN = 0,
441 WAPI_AUTH_MODE_PSK = 1,
442 WAPI_AUTH_MODE_CERT
443} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800444
445/** WAPI Work mode structure definition */
446#define WZC_ORIGINAL 0
447#define WAPI_EXTENTION 1
448
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700449struct wapi_function_mode {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450 unsigned char wapiMode;
451} __packed;
452
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800453typedef struct _WAPI_BKID {
454 uint8_t bkid[16];
455} WAPI_BKID, *pWAPI_BKID;
456
457/** WAPI Association information structure definition */
458struct _WAPI_AssocInfo {
459 uint8_t elementID;
460 uint8_t length;
461 uint16_t version;
462 uint16_t akmSuiteCount;
463 uint32_t akmSuite[MAX_NUM_AKM_SUITES];
464 uint16_t unicastSuiteCount;
465 uint32_t unicastSuite[MAX_NUM_UNI_SUITES];
466 uint32_t multicastSuite;
467 uint16_t wapiCability;
468 uint16_t bkidCount;
469 WAPI_BKID bkidList[MAX_NUM_BKIDS];
470} __packed;
471
472typedef struct _WAPI_AssocInfo WAPI_AssocInfo;
473typedef struct _WAPI_AssocInfo *pWAPI_IEAssocInfo;
474
475/** WAPI KEY Type definition */
476enum _WAPIKeyType {
477 PAIRWISE_KEY, /* 0 */
478 GROUP_KEY /* 1 */
479} __packed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800480
481/** WAPI KEY Direction definition */
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700482enum key_direction {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800483 None,
484 Rx,
485 Tx,
486 Rx_Tx
487} __packed;
488
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800489/* WAPI KEY structure definition */
490struct WLAN_WAPI_KEY {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700491 enum _WAPIKeyType keyType;
492 enum key_direction keyDirection; /*reserved for future use */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800493 uint8_t keyId;
494 uint8_t addrIndex[MAX_ADDR_INDEX]; /*reserved for future use */
495 int wpiekLen;
496 uint8_t wpiek[MAX_WPI_KEY_LENGTH];
497 int wpickLen;
498 uint8_t wpick[MAX_WPI_KEY_LENGTH];
499 uint8_t pn[MAX_NUM_PN]; /*reserved for future use */
500} __packed;
501
502typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
503typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
504
505#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
506#define WPA_GET_BE24(a) ((u32) ((a[0] << 16) | (a[1] << 8) | a[2]))
507#define WLAN_EID_WAPI 68
508#define WAPI_PSK_AKM_SUITE 0x02721400
509#define WAPI_CERT_AKM_SUITE 0x01721400
510
511/* WAPI BKID List structure definition */
512struct _WLAN_BKID_LIST {
513 uint32_t length;
514 uint32_t BKIDCount;
515 WAPI_BKID BKID[1];
516} __packed;
517
518typedef struct _WLAN_BKID_LIST WLAN_BKID_LIST;
519typedef struct _WLAN_BKID_LIST *pWLAN_BKID_LIST;
520
521/* WAPI Information structure definition */
522struct hdd_wapi_info_s {
523 uint32_t nWapiMode;
524 bool fIsWapiSta;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530525 struct qdf_mac_addr cachedMacAddr;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800526 uint8_t wapiAuthMode;
527} __packed;
528typedef struct hdd_wapi_info_s hdd_wapi_info_t;
529#endif /* FEATURE_WLAN_WAPI */
530
531typedef struct beacon_data_s {
532 u8 *head;
533 u8 *tail;
534 u8 *proberesp_ies;
535 u8 *assocresp_ies;
536 int head_len;
537 int tail_len;
538 int proberesp_ies_len;
539 int assocresp_ies_len;
540 int dtim_period;
541} beacon_data_t;
542
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700543enum rem_on_channel_request_type {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800544 REMAIN_ON_CHANNEL_REQUEST,
545 OFF_CHANNEL_ACTION_TX,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700546};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800547
548typedef struct action_pkt_buffer {
549 uint8_t *frame_ptr;
550 uint32_t frame_length;
551 uint16_t freq;
552} action_pkt_buffer_t;
553
554typedef struct hdd_remain_on_chan_ctx {
555 struct net_device *dev;
556 struct ieee80211_channel chan;
557 enum nl80211_channel_type chan_type;
558 unsigned int duration;
559 u64 cookie;
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700560 enum rem_on_channel_request_type rem_on_chan_request;
Anurag Chouhan210db072016-02-22 18:42:15 +0530561 qdf_mc_timer_t hdd_remain_on_chan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800562 action_pkt_buffer_t action_pkt_buff;
563 bool hdd_remain_on_chan_cancel_in_progress;
564 uint32_t scan_id;
565} hdd_remain_on_chan_ctx_t;
566
567/* RoC Request entry */
568typedef struct hdd_roc_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530569 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800570 hdd_adapter_t *pAdapter;
571 hdd_remain_on_chan_ctx_t *pRemainChanCtx;
572} hdd_roc_req_t;
573
574/**
575 * struct hdd_scan_req - Scan Request entry
576 * @node : List entry element
577 * @adapter: Adapter address
578 * @scan_request: scan request holder
579 * @scan_id: scan identifier used across host layers which is generated at WMI
580 * @cookie: scan request identifier sent to userspace
581 * @source: scan request originator (NL/Vendor scan)
582 * @timestamp: scan request timestamp
583 *
584 * Scan request linked list element
585 */
586struct hdd_scan_req {
Anurag Chouhanffb21542016-02-17 14:33:03 +0530587 qdf_list_node_t node;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800588 hdd_adapter_t *adapter;
589 struct cfg80211_scan_request *scan_request;
590 uint32_t scan_id;
591 uint8_t source;
592 uint32_t timestamp;
593};
594
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700595enum p2p_action_frame_state {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800596 HDD_IDLE,
597 HDD_PD_REQ_ACK_PENDING,
598 HDD_GO_NEG_REQ_ACK_PENDING,
599 HDD_INVALID_STATE,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700600};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800601
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700602enum action_frm_type {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800603 WLAN_HDD_GO_NEG_REQ,
604 WLAN_HDD_GO_NEG_RESP,
605 WLAN_HDD_GO_NEG_CNF,
606 WLAN_HDD_INVITATION_REQ,
607 WLAN_HDD_INVITATION_RESP,
608 WLAN_HDD_DEV_DIS_REQ,
609 WLAN_HDD_DEV_DIS_RESP,
610 WLAN_HDD_PROV_DIS_REQ,
611 WLAN_HDD_PROV_DIS_RESP,
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700612};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800613
614typedef struct hdd_cfg80211_state_s {
615 uint16_t current_freq;
616 u64 action_cookie;
617 uint8_t *buf;
618 size_t len;
619 hdd_remain_on_chan_ctx_t *remain_on_chan_ctx;
620 struct mutex remain_on_chan_ctx_lock;
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700621 enum p2p_action_frame_state actionFrmState;
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530622 /* is_go_neg_ack_received flag is set to 1 when
Jeff Johnsonef926352017-01-12 10:41:02 -0800623 * the pending ack for GO negotiation req is
624 * received.
625 */
Gowri, Deepthi62da33e2016-09-02 16:01:26 +0530626 bool is_go_neg_ack_received;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800627} hdd_cfg80211_state_t;
628
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700629/**
630 * struct hdd_mon_set_ch_info - Holds monitor mode channel switch params
631 * @channel: Channel number.
632 * @cb_mode: Channel bonding
633 * @channel_width: Channel width 0/1/2 for 20/40/80MHz respectively.
634 * @phy_mode: PHY mode
635 */
636struct hdd_mon_set_ch_info {
637 uint8_t channel;
638 uint8_t cb_mode;
639 uint32_t channel_width;
640 eCsrPhyMode phy_mode;
641};
642
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643struct hdd_station_ctx {
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700644 /* Handle to the Wireless Extension State */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800645 hdd_wext_state_t WextState;
646
647#ifdef FEATURE_WLAN_TDLS
648 tdlsCtx_t *pHddTdlsCtx;
649#endif
650
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700651 /* Connection information*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800652 connection_info_t conn_info;
653
654 roaming_info_t roam_info;
655
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800656 int ft_carrier_on;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800657
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700658 /* Increment whenever ibss New peer joins and departs the network */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800659 int ibss_sta_generation;
660
661 /* Indication of wep/wpa-none keys installation */
662 bool ibss_enc_key_installed;
663
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700664 /* Save the wep/wpa-none keys */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800665 tCsrRoamSetKey ibss_enc_key;
Rajeev Kumar94c9b452016-03-24 12:58:47 -0700666 tSirPeerInfoRspParams ibss_peer_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800667
668 bool hdd_ReassocScenario;
669
670 /* STA ctx debug variables */
671 int staDebugState;
Chandrasekaran, Manishekar34e325a2015-12-18 12:07:22 +0530672
Rakesh Sunkicf1c9ab2016-08-25 14:11:25 -0700673 uint8_t broadcast_staid;
Manjunathappa Prakash59f861d2016-04-21 10:33:31 -0700674
675 struct hdd_mon_set_ch_info ch_info;
Naveen Rawat97500352017-03-22 10:07:58 -0700676#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -0700677 struct nan_datapath_ctx ndp_ctx;
678#endif
Krunal Soni364e0872017-05-10 21:24:34 -0700679 bool ap_supports_immediate_power_save;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800680};
681
682#define BSS_STOP 0
683#define BSS_START 1
684typedef struct hdd_hostapd_state_s {
685 int bssState;
Anurag Chouhanf04e84f2016-03-03 10:12:12 +0530686 qdf_event_t qdf_event;
687 qdf_event_t qdf_stop_bss_event;
Wei Song2f76f642016-11-18 16:32:53 +0800688 qdf_event_t qdf_sta_disassoc_event;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530689 QDF_STATUS qdf_status;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690 bool bCommit;
691
692} hdd_hostapd_state_t;
693
wadesong9b819072017-02-07 16:42:09 +0800694/**
695 * enum bss_stop_reason - reasons why a BSS is stopped.
696 * @BSS_STOP_REASON_INVALID: no reason specified explicitly.
697 * @BSS_STOP_DUE_TO_MCC_SCC_SWITCH: BSS stopped due to host
698 * driver is trying to switch AP role to a different channel
699 * to maintain SCC mode with the STA role on the same card.
700 * this usually happens when STA is connected to an external
701 * AP that runs on a different channel
702 */
703enum bss_stop_reason {
704 BSS_STOP_REASON_INVALID = 0,
705 BSS_STOP_DUE_TO_MCC_SCC_SWITCH = 1,
706};
707
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800708/*
709 * Per station structure kept in HDD for multiple station support for SoftAP
710 */
711typedef struct {
712 /** The station entry is used or not */
713 bool isUsed;
714
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700715 /* Station ID reported back from HAL (through SAP).
716 * Broadcast uses station ID zero by default
Jeff Johnsonef926352017-01-12 10:41:02 -0800717 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800718 uint8_t ucSTAId;
719
Rachit Kankane2487f8f2017-04-19 14:30:19 +0530720 /* type of station i.e. p2p client or infrastructure station */
721 eStationType staType;
722
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800723 /** MAC address of the station */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530724 struct qdf_mac_addr macAddrSTA;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725
726 /** Current Station state so HDD knows how to deal with packet
Jeff Johnsonef926352017-01-12 10:41:02 -0800727 * queue. Most recent states used to change TLSHIM STA state
728 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800729 enum ol_txrx_peer_state tlSTAState;
730
731 /** Track QoS status of station */
732 bool isQosEnabled;
733
734 /** The station entry for which Deauth is in progress */
735 bool isDeauthInProgress;
Kanchanapally, Vidyullathae3062812015-05-22 17:28:57 +0530736
737 /** Number of spatial streams supported */
738 uint8_t nss;
739
740 /** Rate Flags for this connection */
741 uint32_t rate_flags;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800742} hdd_station_info_t;
743
744struct hdd_ap_ctx_s {
745 hdd_hostapd_state_t HostapdState;
746
747 /* Memory differentiation mode is enabled */
748 /* uint16_t uMemoryDiffThreshold; */
749 /* uint8_t uNumActiveAC; */
750 /* uint8_t uActiveACMask; */
751
752 /** Packet Count to update uNumActiveAC and uActiveACMask */
753 /* uint16_t uUpdatePktCount; */
754
755 /** Station ID assigned after BSS starts */
756 uint8_t uBCStaId;
757
758 uint8_t uPrivacy; /* The privacy bits of configuration */
759
760 tSirWPSPBCProbeReq WPSPBCProbeReq;
761
762 tsap_Config_t sapConfig;
763
764 struct semaphore semWpsPBCOverlapInd;
765
766 bool apDisableIntraBssFwd;
767
Anurag Chouhan210db072016-02-22 18:42:15 +0530768 qdf_mc_timer_t hdd_ap_inactivity_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800769
770 uint8_t operatingChannel;
771
772 bool uIsAuthenticated;
773
774 eCsrEncryptionType ucEncryptType;
775
Srinivas Girigowda85218af2017-03-25 13:21:40 -0700776 /* This will point to group key data,
777 * if it is received before start bss
778 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800779 tCsrRoamSetKey groupKey;
780 /* This will have WEP key data, if it is received before start bss */
781 tCsrRoamSetKey wepKey[CSR_MAX_NUM_KEY];
782
Kondabattini, Ganesh702d90e2016-09-03 01:54:22 +0530783 /* WEP default key index */
784 uint8_t wep_def_key_idx;
785
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800786 beacon_data_t *beacon;
787
788 bool bApActive;
Dustin Brown5e79c102016-09-21 11:29:39 -0700789
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800790 /* SAP Context */
791 void *sapContext;
Dustin Brown5e79c102016-09-21 11:29:39 -0700792
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800793 bool dfs_cac_block_tx;
Kapil Gupta8878ad92017-02-13 11:56:04 +0530794 qdf_mc_timer_t vendor_acs_timer;
795 bool vendor_acs_timer_initialized;
wadesong9b819072017-02-07 16:42:09 +0800796
797 enum bss_stop_reason bss_stop_reason;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800798};
799
800typedef struct hdd_scaninfo_s {
801 /* The scan pending */
802 uint32_t mScanPending;
803
804 /* Counter for mScanPending so that the scan pending
Jeff Johnsonef926352017-01-12 10:41:02 -0800805 * error log is not printed for more than 5 times
806 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800807 uint32_t mScanPendingCounter;
808
809 /* Additional IE for scan */
810 tSirAddie scanAddIE;
811
Selvaraj, Sridhar4ea106e2016-08-05 20:34:46 +0530812 uint8_t *default_scan_ies;
Selvaraj, Sridhar021ee0a2017-04-07 16:53:31 +0530813 uint16_t default_scan_ies_len;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800814 /* Scan mode */
815 tSirScanType scan_mode;
816
817 /* completion variable for abortscan */
818 struct completion abortscan_event_var;
819
820} hdd_scaninfo_t;
821
Dustin Brown61269462016-09-19 13:25:45 -0700822#define WLAN_HDD_MAX_MC_ADDR_LIST CFG_TGT_MAX_MULTICAST_FILTER_ENTRIES
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800823
824#ifdef WLAN_FEATURE_PACKET_FILTERING
825typedef struct multicast_addr_list {
826 uint8_t isFilterApplied;
827 uint8_t mc_cnt;
828 uint8_t addr[WLAN_HDD_MAX_MC_ADDR_LIST][ETH_ALEN];
829} t_multicast_add_list;
830#endif
831
832#define WLAN_HDD_MAX_HISTORY_ENTRY 10
833
834/**
835 * struct hdd_netif_queue_stats - netif queue operation statistics
836 * @pause_count - pause counter
837 * @unpause_count - unpause counter
838 */
839struct hdd_netif_queue_stats {
840 uint16_t pause_count;
841 uint16_t unpause_count;
Nirav Shahda008342016-05-17 18:50:40 +0530842 qdf_time_t total_pause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800843};
844
845/**
846 * struct hdd_netif_queue_history - netif queue operation history
847 * @time: timestamp
848 * @netif_action: action type
849 * @netif_reason: reason type
850 * @pause_map: pause map
851 */
852struct hdd_netif_queue_history {
Anurag Chouhan50220ce2016-02-18 20:11:33 +0530853 qdf_time_t time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800854 uint16_t netif_action;
855 uint16_t netif_reason;
856 uint32_t pause_map;
857};
858
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530859/**
860 * struct hdd_chan_change_params - channel related information
861 * @chan: operating channel
862 * @chan_params: channel parameters
863 */
864struct hdd_chan_change_params {
865 uint8_t chan;
Amar Singhal5cccafe2017-02-15 12:42:58 -0800866 struct ch_params chan_params;
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +0530867};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800868
Komal Seelama89be8d2016-09-29 11:09:26 +0530869/**
Komal Seelam8634b772016-09-29 12:12:24 +0530870 * struct hdd_runtime_pm_context - context to prevent/allow runtime pm
871 * @scan: scan context to prvent/allow runtime pm
872 *
873 * Prevent Runtime PM for scan
874 */
875struct hdd_runtime_pm_context {
Komal Seelamaa75f262016-09-29 12:32:13 +0530876 qdf_runtime_lock_t roc;
Komal Seelam81cb1662016-09-29 12:39:08 +0530877 qdf_runtime_lock_t dfs;
Komal Seelam8634b772016-09-29 12:12:24 +0530878};
879
880/**
Komal Seelama89be8d2016-09-29 11:09:26 +0530881 * struct hdd_connect_pm_context - Runtime PM connect context per adapter
882 * @connect: Runtime Connect Context
883 *
884 * Structure to hold runtime pm connect context for each adapter.
885 */
886struct hdd_connect_pm_context {
887 qdf_runtime_lock_t connect;
888};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800889
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530890/*
891 * WLAN_HDD_ADAPTER_MAGIC is a magic number used to identify net devices
892 * belonging to this driver from net devices belonging to other devices.
893 * Therefore, the magic number must be unique relative to the numbers for
894 * other drivers in the system. If WLAN_HDD_ADAPTER_MAGIC is already defined
895 * (e.g. by compiler argument), then use that. If it's not already defined,
896 * then use the first 4 characters of MULTI_IF_NAME to construct the magic
897 * number. If MULTI_IF_NAME is not defined, then use a default magic number.
898 */
899#ifndef WLAN_HDD_ADAPTER_MAGIC
900#ifdef MULTI_IF_NAME
901#define WLAN_HDD_ADAPTER_MAGIC \
902 (MULTI_IF_NAME[0] == 0 ? 0x574c414e : \
903 (MULTI_IF_NAME[1] == 0 ? (MULTI_IF_NAME[0] << 24) : \
904 (MULTI_IF_NAME[2] == 0 ? (MULTI_IF_NAME[0] << 24) | \
905 (MULTI_IF_NAME[1] << 16) : \
906 (MULTI_IF_NAME[0] << 24) | (MULTI_IF_NAME[1] << 16) | \
907 (MULTI_IF_NAME[2] << 8) | MULTI_IF_NAME[3])))
908#else
Komal Seelama89be8d2016-09-29 11:09:26 +0530909#define WLAN_HDD_ADAPTER_MAGIC 0x574c414e /* ASCII "WLAN" */
Samuel Ahnc9c48ca2016-09-19 15:46:36 +0530910#endif
911#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800912
913struct hdd_adapter_s {
Jeff Johnsond399e902015-12-17 15:17:02 -0800914 /* Magic cookie for adapter sanity verification. Note that this
915 * needs to be at the beginning of the private data structure so
916 * that it will exists at the beginning of dev->priv and hence
917 * will always be in mapped memory
918 */
919 uint32_t magic;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800920
Jeff Johnsond399e902015-12-17 15:17:02 -0800921 void *pHddCtx;
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +0530922 struct wlan_objmgr_vdev *hdd_vdev;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800923
Leo Changfdb45c32016-10-28 11:09:23 -0700924 void *txrx_vdev;
925
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800926 /** Handle to the network device */
927 struct net_device *dev;
928
Krunal Soni276241e2016-03-10 12:58:11 -0800929 enum tQDF_ADAPTER_MODE device_mode;
Jeff Johnsond399e902015-12-17 15:17:02 -0800930
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800931 /** IPv4 notifier callback for handling ARP offload on change in IP */
932 struct work_struct ipv4NotifierWorkQueue;
933#ifdef WLAN_NS_OFFLOAD
934 /** IPv6 notifier callback for handling NS offload on change in IP */
935 struct work_struct ipv6NotifierWorkQueue;
936#endif
937
938 /* TODO Move this to sta Ctx */
939 struct wireless_dev wdev;
940 struct cfg80211_scan_request *request;
bings4c6cecf2017-04-05 08:24:29 +0800941 uint8_t scan_source;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800942
943 /** ops checks if Opportunistic Power Save is Enable or Not
944 * ctw stores ctWindow value once we receive Opps command from
945 * wpa_supplicant then using ctWindow value we need to Enable
946 * Opportunistic Power Save
947 */
948 uint8_t ops;
949 uint32_t ctw;
950
951 /** Current MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +0530952 struct qdf_mac_addr macAddressCurrent;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800953
954 /**Event Flags*/
955 unsigned long event_flags;
956
957 /**Device TX/RX statistics*/
958 struct net_device_stats stats;
959 /** HDD statistics*/
960 hdd_stats_t hdd_stats;
Jeff Johnsone50427c2017-01-26 10:54:49 -0800961
962 /* estimated link speed */
963 uint32_t estimated_linkspeed;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800964
965 uint8_t sessionId;
966
967 /* Completion variable for session close */
968 struct completion session_close_comp_var;
969
970 /* Completion variable for session open */
971 struct completion session_open_comp_var;
972
973 /* TODO: move these to sta ctx. These may not be used in AP */
974 /** completion variable for disconnect callback */
975 struct completion disconnect_comp_var;
976
Abhishek Singh533c9da2017-05-04 10:23:34 +0530977 struct completion roaming_comp_var;
978
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800979 /** Completion of change country code */
980 struct completion change_country_code;
981
982 /* completion variable for Linkup Event */
983 struct completion linkup_event_var;
984
985 /* completion variable for cancel remain on channel Event */
986 struct completion cancel_rem_on_chan_var;
987
988 /* completion variable for off channel remain on channel Event */
989 struct completion offchannel_tx_event;
990 /* Completion variable for action frame */
991 struct completion tx_action_cnf_event;
992 /* Completion variable for remain on channel ready */
993 struct completion rem_on_chan_ready_event;
994
995 struct completion sta_authorized_event;
996#ifdef FEATURE_WLAN_TDLS
997 struct completion tdls_add_station_comp;
998 struct completion tdls_del_station_comp;
999 struct completion tdls_mgmt_comp;
1000 struct completion tdls_link_establish_req_comp;
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301001 QDF_STATUS tdlsAddStaStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001002#endif
1003
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001004 struct completion ibss_peer_info_comp;
1005
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001006 /* Track whether the linkup handling is needed */
1007 bool isLinkUpSvcNeeded;
1008
1009 /* Mgmt Frames TX completion status code */
1010 uint32_t mgmtTxCompletionStatus;
1011
1012 /* WMM Status */
Srinivas Girigowdaea32d6a2017-03-25 00:03:12 -07001013 struct hdd_wmm_status hddWmmStatus;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001014/*************************************************************
1015 */
1016/*************************************************************
1017 * TODO - Remove it later
1018 */
1019 /** Multiple station supports */
1020 /** Per-station structure */
1021 spinlock_t staInfo_lock; /* To protect access to station Info */
1022 hdd_station_info_t aStaInfo[WLAN_MAX_STA_COUNT];
1023 /* uint8_t uNumActiveStation; */
1024
1025/*************************************************************
1026 */
1027
1028#ifdef FEATURE_WLAN_WAPI
1029 hdd_wapi_info_t wapi_info;
1030#endif
1031
1032 int8_t rssi;
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +05301033 int32_t rssi_on_disconnect;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001034#ifdef WLAN_FEATURE_LPSS
1035 bool rssi_send;
1036#endif
1037
1038 uint8_t snr;
1039
1040 struct work_struct monTxWorkQueue;
1041 struct sk_buff *skb_to_tx;
1042
1043 union {
1044 hdd_station_ctx_t station;
1045 hdd_ap_ctx_t ap;
1046 } sessionCtx;
1047
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001048#ifdef WLAN_FEATURE_TSF
1049 /* tsf value received from firmware */
1050 uint32_t tsf_low;
1051 uint32_t tsf_high;
1052 /* TSF capture state */
1053 enum hdd_tsf_capture_state tsf_state;
Manikandan Mohan5356c2b2016-04-03 15:51:35 -07001054 uint64_t tsf_sync_soc_timer;
Manikandan Mohandcc21ba2016-03-15 14:31:56 -07001055#endif
1056
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001057 hdd_cfg80211_state_t cfg80211State;
1058
1059#ifdef WLAN_FEATURE_PACKET_FILTERING
1060 t_multicast_add_list mc_addr_list;
1061#endif
1062 uint8_t addr_filter_pattern;
1063
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001064 bool higherDtimTransition;
1065 bool survey_idx;
1066
1067 hdd_scaninfo_t scan_info;
Jeff Johnsonc13bdf12017-01-25 16:28:19 -08001068
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001069 /* Flag to ensure PSB is configured through framework */
1070 uint8_t psbChanged;
1071 /* UAPSD psb value configured through framework */
1072 uint8_t configuredPsb;
1073#ifdef IPA_OFFLOAD
1074 void *ipa_context;
1075#endif
1076 /* Use delayed work for Sec AP ACS as Pri AP Startup need to complete
1077 * since CSR (PMAC Struct) Config is same for both AP
1078 */
1079 struct delayed_work acs_pending_work;
1080
1081 struct work_struct scan_block_work;
1082#ifdef MSM_PLATFORM
1083 unsigned long prev_rx_packets;
1084 unsigned long prev_tx_packets;
Himanshu Agarwala6cedee2016-06-08 14:50:00 +05301085 uint64_t prev_fwd_tx_packets;
1086 uint64_t prev_fwd_rx_packets;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001087 int connection;
1088#endif
1089 bool is_roc_inprogress;
1090
1091#ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
Anurag Chouhan210db072016-02-22 18:42:15 +05301092 qdf_mc_timer_t tx_flow_control_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001093 bool tx_flow_timer_initialized;
1094 unsigned int tx_flow_low_watermark;
1095 unsigned int tx_flow_high_watermark_offset;
1096#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
1097 bool offloads_configured;
1098
1099 /* DSCP to UP QoS Mapping */
1100 sme_QosWmmUpType hddWmmDscpToUpMap[WLAN_HDD_MAX_DSCP + 1];
1101
1102#ifdef WLAN_FEATURE_LINK_LAYER_STATS
1103 bool isLinkLayerStatsSet;
1104#endif
1105 uint8_t linkStatus;
1106
1107 /* variable for temperature in Celsius */
1108 int temperature;
1109
1110 /* Time stamp for last completed RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301111 uint64_t last_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001112
1113 /* Time stamp for start RoC request */
Deepthi Gowri6acee342016-10-28 15:00:38 +05301114 uint64_t start_roc_ts;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001115
Agrawal Ashishb141b092016-09-02 19:59:26 +05301116#ifdef WLAN_FEATURE_DSRC
Jeff Johnson7af334b2017-02-01 13:03:43 -08001117 /* MAC addresses used for OCB interfaces */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301118 struct qdf_mac_addr ocb_mac_address[QDF_MAX_CONCURRENCY_PERSONA];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001119 int ocb_mac_addr_count;
Agrawal Ashishb141b092016-09-02 19:59:26 +05301120#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001121
1122 /* BITMAP indicating pause reason */
1123 uint32_t pause_map;
1124 spinlock_t pause_map_lock;
Nirav Shah617cff92016-04-25 10:24:24 +05301125 qdf_time_t start_time;
1126 qdf_time_t last_time;
1127 qdf_time_t total_pause_time;
1128 qdf_time_t total_unpause_time;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001129 uint8_t history_index;
1130 struct hdd_netif_queue_history
1131 queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];
1132 struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX];
Dhanashri Atre168d2b42016-02-22 14:43:06 -08001133 ol_txrx_tx_fp tx_fn;
Rajeev Kumardca5f812016-02-04 17:28:06 -08001134 /* debugfs entry */
1135 struct dentry *debugfs_phy;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301136 /*
1137 * The pre cac channel is saved here and will be used when the SAP's
1138 * channel needs to be moved from the existing 2.4GHz channel.
1139 */
1140 uint8_t pre_cac_chan;
Komal Seelama89be8d2016-09-29 11:09:26 +05301141 struct hdd_connect_pm_context connect_rpm_ctx;
Deepak Dhamdherea2785822016-11-17 01:17:45 -08001142
1143 bool fast_roaming_allowed;
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001144 /*
Abhishek Singh533c9da2017-05-04 10:23:34 +05301145 * Indicate if HO fails during disconnect so that
1146 * disconnect is not initiated by HDD as its already
1147 * initiated by CSR
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08001148 */
Abhishek Singh533c9da2017-05-04 10:23:34 +05301149 bool roam_ho_fail;
Sreelakshmi Konamki88a2a412017-04-14 15:11:55 +05301150 struct lfr_firmware_status lfr_fw_status;
Ajit Pal Singh747b6802017-05-24 15:42:03 +05301151 /*
1152 * Store the restrict_offchannel count
1153 * to cater to multiple application.
1154 */
1155 u8 restrict_offchannel_cnt;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001156};
1157
1158#define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station)
1159#define WLAN_HDD_GET_AP_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap)
1160#define WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.station.WextState)
1161#define WLAN_HDD_GET_CTX(pAdapter) ((hdd_context_t *)pAdapter->pHddCtx)
1162#define WLAN_HDD_GET_HAL_CTX(pAdapter) (((hdd_context_t *)(pAdapter->pHddCtx))->hHal)
1163#define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState)
1164#define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001165#define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001166#ifdef FEATURE_WLAN_TDLS
1167#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \
Krunal Soni276241e2016-03-10 12:58:11 -08001168 (((QDF_STA_MODE != pAdapter->device_mode) && \
1169 (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001170#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \
1171 ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \
1172 (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL)
1173#endif
1174
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001175#ifdef WLAN_FEATURE_NAN_DATAPATH
Naveen Rawat97500352017-03-22 10:07:58 -07001176#ifndef WLAN_FEATURE_NAN_CONVERGENCE
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001177#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \
1178 (&(adapter)->sessionCtx.station.ndp_ctx)
Naveen Rawat97500352017-03-22 10:07:58 -07001179#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001180#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001181#else
Deepak Dhamdhere8360d4c2016-06-01 13:24:31 -07001182/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined
1183 * intentionally so that all references to these must be within NDP code.
1184 * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled,
1185 * invoke NDP code to do all work.
1186 */
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001187#define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false)
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07001188#endif
1189
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001190/* Set mac address locally administered bit */
1191#define WLAN_HDD_RESET_LOCALLY_ADMINISTERED_BIT(macaddr) (macaddr[0] &= 0xFD)
1192
1193#define HDD_DEFAULT_MCC_P2P_QUOTA 70
1194#define HDD_RESET_MCC_P2P_QUOTA 50
1195
1196typedef struct hdd_adapter_list_node {
Anurag Chouhanffb21542016-02-17 14:33:03 +05301197 qdf_list_node_t node; /* MUST be first element */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001198 hdd_adapter_t *pAdapter;
1199} hdd_adapter_list_node_t;
1200
1201typedef struct hdd_priv_data_s {
1202 uint8_t *buf;
1203 int used_len;
1204 int total_len;
1205} hdd_priv_data_t;
1206
1207#define MAX_MOD_LOGLEVEL 10
1208typedef struct {
1209 uint8_t enable;
1210 uint8_t dl_type;
1211 uint8_t dl_report;
1212 uint8_t dl_loglevel;
1213 uint8_t index;
1214 uint32_t dl_mod_loglevel[MAX_MOD_LOGLEVEL];
1215
1216} fw_log_info;
1217
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001218/**
1219 * enum antenna_mode - number of TX/RX chains
1220 * @HDD_ANTENNA_MODE_INVALID: Invalid mode place holder
1221 * @HDD_ANTENNA_MODE_1X1: Number of TX/RX chains equals 1
1222 * @HDD_ANTENNA_MODE_2X2: Number of TX/RX chains equals 2
1223 * @HDD_ANTENNA_MODE_MAX: Place holder for max mode
1224 */
1225enum antenna_mode {
1226 HDD_ANTENNA_MODE_INVALID,
1227 HDD_ANTENNA_MODE_1X1,
1228 HDD_ANTENNA_MODE_2X2,
1229 HDD_ANTENNA_MODE_MAX
1230};
1231
1232/**
1233 * enum smps_mode - SM power save mode
1234 * @HDD_SMPS_MODE_STATIC: Static power save
1235 * @HDD_SMPS_MODE_DYNAMIC: Dynamic power save
1236 * @HDD_SMPS_MODE_RESERVED: Reserved
1237 * @HDD_SMPS_MODE_DISABLED: Disable power save
1238 * @HDD_SMPS_MODE_MAX: Place holder for max mode
1239 */
1240enum smps_mode {
1241 HDD_SMPS_MODE_STATIC,
1242 HDD_SMPS_MODE_DYNAMIC,
1243 HDD_SMPS_MODE_RESERVED,
1244 HDD_SMPS_MODE_DISABLED,
1245 HDD_SMPS_MODE_MAX
1246};
1247
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001248#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1249/**
1250 * struct hdd_offloaded_packets - request id to pattern id mapping
1251 * @request_id: request id
1252 * @pattern_id: pattern id
1253 *
1254 */
1255struct hdd_offloaded_packets {
1256 uint32_t request_id;
1257 uint8_t pattern_id;
1258};
1259
1260/**
1261 * struct hdd_offloaded_packets_ctx - offloaded packets context
1262 * @op_table: request id to pattern id table
1263 * @op_lock: mutex lock
1264 */
1265struct hdd_offloaded_packets_ctx {
1266 struct hdd_offloaded_packets op_table[MAXNUM_PERIODIC_TX_PTRNS];
1267 struct mutex op_lock;
1268};
1269#endif
1270
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301271/**
Arun Khandavallifae92942016-08-01 13:31:08 +05301272 * enum driver_status: Driver Modules status
1273 * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized
1274 * @DRIVER_MODULES_OPENED: Driver CDS modules opened
1275 * @DRIVER_MODULES_ENABLED: Driver CDS modules opened
1276 * @DRIVER_MODULES_CLOSED: Driver CDS modules closed
1277 */
1278enum driver_modules_status {
1279 DRIVER_MODULES_UNINITIALIZED,
1280 DRIVER_MODULES_OPENED,
1281 DRIVER_MODULES_ENABLED,
1282 DRIVER_MODULES_CLOSED
1283};
1284
Agrawal Ashish65634612016-08-18 13:24:32 +05301285/**
1286 * struct acs_dfs_policy - Define ACS policies
1287 * @acs_dfs_mode: Dfs mode enabled/disabled.
1288 * @acs_channel: pre defined channel to avoid ACS.
1289 */
1290struct acs_dfs_policy {
1291 enum dfs_mode acs_dfs_mode;
1292 uint8_t acs_channel;
1293};
1294
Dustin Brown105d7902016-10-03 16:27:59 -07001295/**
1296 * enum suspend_fail_reason: Reasons a WLAN suspend might fail
1297 * SUSPEND_FAIL_IPA: IPA in progress
1298 * SUSPEND_FAIL_RADAR: radar scan in progress
1299 * SUSPEND_FAIL_ROAM: roaming in progress
1300 * SUSPEND_FAIL_SCAN: scan in progress
1301 * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware
1302 * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end
1303 */
1304enum suspend_fail_reason {
1305 SUSPEND_FAIL_IPA,
1306 SUSPEND_FAIL_RADAR,
1307 SUSPEND_FAIL_ROAM,
1308 SUSPEND_FAIL_SCAN,
1309 SUSPEND_FAIL_INITIAL_WAKEUP,
1310 SUSPEND_FAIL_MAX_COUNT
1311};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001312
Dustin Brownd9322482017-01-09 12:46:03 -08001313/**
1314 * suspend_resume_stats - Collection of counters for suspend/resume events
1315 * @suspends: number of suspends completed
1316 * @resumes: number of resumes completed
1317 * @suspend_fail: counters for failed suspend reasons
1318 */
1319struct suspend_resume_stats {
1320 uint32_t suspends;
1321 uint32_t resumes;
1322 uint32_t suspend_fail[SUSPEND_FAIL_MAX_COUNT];
1323};
1324
Dustin Brown105d7902016-10-03 16:27:59 -07001325/** Adapter structure definition */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001326struct hdd_context_s {
1327 /** Global CDS context */
1328 v_CONTEXT_t pcds_context;
1329
Selvaraj, Sridhar0672a122016-12-29 16:11:48 +05301330 struct wlan_objmgr_psoc *hdd_psoc;
1331 struct wlan_objmgr_pdev *hdd_pdev;
1332
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001333 /** HAL handle...*/
1334 tHalHandle hHal;
1335
1336 struct wiphy *wiphy;
1337 /* TODO Remove this from here. */
1338
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301339 qdf_spinlock_t hdd_adapter_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301340 qdf_list_t hddAdapters; /* List of adapters */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001341
Srinivas Girigowda85218af2017-03-25 13:21:40 -07001342 /* One per STA: 1 for BCMC_STA_ID, 1 for each SAP_SELF_STA_ID,
1343 * 1 for WDS_STAID
1344 */
1345 hdd_adapter_t *sta_to_adapter[WLAN_MAX_STA_COUNT + QDF_MAX_NO_OF_SAP_MODE + 2];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001346
1347 /** Pointer for firmware image data */
1348 const struct firmware *fw;
1349
1350 /** Pointer for configuration data */
1351 const struct firmware *cfg;
1352
1353 /** Pointer to the parent device */
1354 struct device *parent_dev;
1355
1356 /** Config values read from qcom_cfg.ini file */
1357 struct hdd_config *config;
1358
1359 struct wlan_hdd_ftm_status ftm;
1360
1361 /* Completion variable to indicate Mc Thread Suspended */
1362 struct completion mc_sus_event_var;
1363
Rajeev Kumareada0d02016-12-08 17:44:17 -08001364 bool is_scheduler_suspended;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001365
1366#ifdef QCA_CONFIG_SMP
1367 bool is_ol_rx_thread_suspended;
1368#endif
1369
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001370 bool hdd_wlan_suspended;
1371 bool suspended;
1372
1373 /* Lock to avoid race condition during start/stop bss */
1374 struct mutex sap_lock;
1375
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001376#ifdef FEATURE_OEM_DATA_SUPPORT
1377 /* OEM App registered or not */
1378 bool oem_app_registered;
1379
1380 /* OEM App Process ID */
1381 int32_t oem_pid;
1382#endif
1383
1384 /** Concurrency Parameters*/
1385 uint32_t concurrency_mode;
1386
Anurag Chouhan6d760662016-02-20 16:05:43 +05301387 uint8_t no_of_open_sessions[QDF_MAX_NO_OF_MODE];
1388 uint8_t no_of_active_sessions[QDF_MAX_NO_OF_MODE];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001389
1390 /** P2P Device MAC Address for the adapter */
Anurag Chouhan6d760662016-02-20 16:05:43 +05301391 struct qdf_mac_addr p2pDeviceAddress;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001392
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301393 qdf_wake_lock_t rx_wake_lock;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301394 qdf_wake_lock_t sap_wake_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001395
1396#ifdef FEATURE_WLAN_TDLS
Srinivas Girigowda17d35172017-03-25 15:56:25 -07001397 enum tdls_support_mode tdls_mode;
1398 enum tdls_support_mode tdls_mode_last;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001399 tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA];
1400 /* maximum TDLS station number allowed upon runtime condition */
1401 uint16_t max_num_tdls_sta;
1402 /* TDLS peer connected count */
1403 uint16_t connected_peer_count;
1404 tdls_scan_context_t tdls_scan_ctxt;
1405 /* Lock to avoid race condition during TDLS operations */
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001406 qdf_spinlock_t tdls_ct_spinlock;
Ganesh Kondabattini5159c432016-12-26 20:07:33 +05301407 /* linear mac address table for counting the packets */
1408 struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE];
1409 /* number of valid mac entry in @ct_peer_mac_table */
1410 uint8_t valid_mac_entries;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001411 struct mutex tdls_lock;
1412 uint8_t tdls_off_channel;
1413 uint16_t tdls_channel_offset;
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05301414 int32_t tdls_fw_off_chan_mode;
Kabilan Kannan36090ce2016-05-03 19:28:44 -07001415 bool enable_tdls_connection_tracker;
1416 uint8_t tdls_external_peer_count;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001417 bool tdls_nss_switch_in_progress;
Kabilan Kannanff89f742016-08-15 18:14:10 -07001418 bool tdls_nss_teardown_complete;
1419 enum tdls_nss_transition_type tdls_nss_transition_mode;
Archana Ramachandrand5d2e922016-04-20 16:57:35 -07001420 int32_t tdls_teardown_peers_cnt;
Kabilan Kannan163fd0b2016-06-08 15:21:51 -07001421 struct tdls_set_state_info set_state_info;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001422#endif
1423
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001424 void *hdd_ipa;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001425
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001426 /* Use below lock to protect access to isSchedScanUpdatePending
1427 * since it will be accessed in two different contexts.
1428 */
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301429 qdf_spinlock_t sched_scan_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001430
1431 /* Flag keeps track of wiphy suspend/resume */
1432 bool isWiphySuspended;
1433
1434 /* Indicates about pending sched_scan results */
1435 bool isSchedScanUpdatePending;
1436
1437#ifdef MSM_PLATFORM
1438 /* DDR bus bandwidth compute timer
1439 */
Poddar, Siddarth2333acb2017-01-09 16:45:39 +05301440 qdf_timer_t bus_bw_timer;
Dustin Brownfce08d12017-01-17 16:29:38 -08001441 bool bus_bw_timer_running;
1442 qdf_spinlock_t bus_bw_timer_lock;
1443 struct work_struct bus_bw_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001444 int cur_vote_level;
1445 spinlock_t bus_bw_lock;
1446 int cur_rx_level;
1447 uint64_t prev_rx;
Mohit Khannae71e2262015-11-10 09:37:24 -08001448 int cur_tx_level;
1449 uint64_t prev_tx;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001450#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001451
1452 struct completion ready_to_suspend;
1453 /* defining the solution type */
1454 uint32_t target_type;
1455
1456 /* defining the firmware version */
1457 uint32_t target_fw_version;
Sandeep Puligilla3d6a8e22016-10-11 18:57:14 -07001458 uint32_t target_fw_vers_ext;
Arif Hussain1969ec82016-07-08 10:37:01 -07001459 qdf_atomic_t dfs_radar_found;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001460
1461 /* defining the chip/rom version */
1462 uint32_t target_hw_version;
1463 /* defining the chip/rom revision */
1464 uint32_t target_hw_revision;
1465 /* chip/rom name */
1466 const char *target_hw_name;
1467 struct regulatory reg;
1468#ifdef FEATURE_WLAN_CH_AVOID
1469 uint16_t unsafe_channel_count;
Amar Singhalb8d4f152016-02-10 10:21:43 -08001470 uint16_t unsafe_channel_list[NUM_CHANNELS];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001471#endif /* FEATURE_WLAN_CH_AVOID */
1472
1473 uint8_t max_intf_count;
1474 uint8_t current_intf_count;
1475#ifdef WLAN_FEATURE_LPSS
1476 uint8_t lpss_support;
1477#endif
1478 uint8_t ap_arpns_support;
1479 tSirScanType ioctl_scan_mode;
1480
1481#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
Anurag Chouhan42958bb2016-02-19 15:43:11 +05301482 qdf_work_t sta_ap_intf_check_work;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001483#endif
1484
1485 struct work_struct sap_start_work;
1486 bool is_sap_restart_required;
1487 bool is_sta_connection_pending;
Manishekar Chandrasekaran7f63d052016-05-07 09:54:00 +05301488 qdf_spinlock_t sap_update_info_lock;
1489 qdf_spinlock_t sta_update_info_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001490
1491 uint8_t dev_dfs_cac_status;
1492
1493 bool btCoexModeSet;
1494#ifdef FEATURE_GREEN_AP
1495 struct hdd_green_ap_ctx *green_ap_ctx;
1496#endif
1497 fw_log_info fw_log_settings;
1498#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
Anurag Chouhan210db072016-02-22 18:42:15 +05301499 qdf_mc_timer_t skip_acs_scan_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001500 uint8_t skip_acs_scan_status;
Liangwei Dongaef84342016-10-21 05:28:00 -04001501 uint8_t *last_acs_channel_list;
1502 uint8_t num_of_channels;
1503 qdf_spinlock_t acs_skip_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001504#endif
1505
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301506 qdf_wake_lock_t sap_dfs_wakelock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001507 atomic_t sap_dfs_ref_cnt;
1508
1509#ifdef WLAN_FEATURE_EXTWOW_SUPPORT
1510 bool is_extwow_app_type1_param_set;
1511 bool is_extwow_app_type2_param_set;
1512 bool ext_wow_should_suspend;
1513 struct completion ready_to_extwow;
1514#endif
1515
1516 /* Time since boot up to extscan start (in micro seconds) */
1517 uint64_t ext_scan_start_since_boot;
1518 unsigned long g_event_flags;
1519 /* RoC request queue and work */
1520 struct delayed_work roc_req_work;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301521 qdf_spinlock_t hdd_roc_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301522 qdf_list_t hdd_roc_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001523#ifndef NAPIER_SCAN
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301524 qdf_spinlock_t hdd_scan_req_q_lock;
Anurag Chouhanffb21542016-02-17 14:33:03 +05301525 qdf_list_t hdd_scan_req_q;
Sandeep Puligillad0004212017-02-26 18:34:56 -08001526#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001527 uint8_t miracast_value;
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301528
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001529#ifdef WLAN_NS_OFFLOAD
1530 /* IPv6 notifier callback for handling NS offload on change in IP */
1531 struct notifier_block ipv6_notifier;
1532#endif
Sravan Kumar Kairamfece87f2016-07-26 14:58:28 +05301533 bool ns_offload_enable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001534 /* IPv4 notifier callback for handling ARP offload on change in IP */
1535 struct notifier_block ipv4_notifier;
1536
1537 /* number of rf chains supported by target */
1538 uint32_t num_rf_chains;
1539 /* Is htTxSTBC supported by target */
1540 uint8_t ht_tx_stbc_supported;
1541#ifdef WLAN_FEATURE_OFFLOAD_PACKETS
1542 struct hdd_offloaded_packets_ctx op_ctx;
1543#endif
1544 bool mcc_mode;
1545#ifdef WLAN_FEATURE_MEMDUMP
1546 uint8_t *fw_dump_loc;
1547 uint32_t dump_loc_paddr;
Anurag Chouhan210db072016-02-22 18:42:15 +05301548 qdf_mc_timer_t memdump_cleanup_timer;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001549 struct mutex memdump_lock;
1550 bool memdump_in_progress;
Sachin Ahuja02dd2e72016-09-03 16:17:51 +05301551 bool memdump_init_done;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001552#endif /* WLAN_FEATURE_MEMDUMP */
Padma, Santhosh Kumar9aba02f2016-08-11 16:30:25 +05301553 uint16_t driver_dump_size;
1554 uint8_t *driver_dump_mem;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001555
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001556 bool connection_in_progress;
Anurag Chouhana37b5b72016-02-21 14:53:42 +05301557 qdf_spinlock_t connection_status_lock;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001558
1559 uint16_t hdd_txrx_hist_idx;
Nirav Shahed34b212016-04-25 10:59:16 +05301560 struct hdd_tx_rx_histogram *hdd_txrx_hist;
Arif Hussain1969ec82016-07-08 10:37:01 -07001561
Krunal Sonie3531942016-04-12 17:43:53 -07001562 /*
1563 * place to store FTM capab of target. This allows changing of FTM capab
1564 * at runtime and intersecting it with target capab before updating.
1565 */
1566 uint32_t fine_time_meas_cap_target;
Ravi Joshib89e7f72016-09-07 13:43:15 -07001567 uint32_t rx_high_ind_cnt;
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001568 /* completion variable to indicate set antenna mode complete*/
1569 struct completion set_antenna_mode_cmpl;
1570 /* Current number of TX X RX chains being used */
1571 enum antenna_mode current_antenna_mode;
Arun Khandavalli2476ef52016-04-26 20:19:43 +05301572 bool bpf_enabled;
Ryan Hsuceddceb2016-04-28 10:20:14 -07001573
1574 /* the radio index assigned by cnss_logger */
1575 int radio_index;
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05301576 qdf_work_t sap_pre_cac_work;
Nirav Shahffc6a092016-06-09 16:09:08 +05301577 bool hbw_requested;
Kapil Gupta0ed58dc2016-04-22 15:35:26 +05301578 uint32_t last_nil_scan_bug_report_timestamp;
Deepak Dhamdhere7e6016f2016-06-01 09:37:37 -07001579#ifdef WLAN_FEATURE_NAN_DATAPATH
1580 bool nan_datapath_enabled;
1581#endif
Arun Khandavallifae92942016-08-01 13:31:08 +05301582 /* Present state of driver cds modules */
1583 enum driver_modules_status driver_status;
1584 /* MC timer interface change */
1585 qdf_mc_timer_t iface_change_timer;
1586 /* Interface change lock */
1587 struct mutex iface_change_lock;
Nirav Shahbd36b062016-07-18 11:12:59 +05301588 bool rps;
1589 bool enableRxThread;
1590 bool napi_enable;
Arun Khandavallia172c3e2016-08-26 17:33:13 +05301591 bool stop_modules_in_progress;
1592 bool start_modules_in_progress;
Yuanyuan Liu245a3e42016-09-14 12:15:16 -07001593 bool update_mac_addr_to_fw;
Agrawal Ashish65634612016-08-18 13:24:32 +05301594 struct acs_dfs_policy acs_policy;
Rajeev Kumar Sirasanagandla47873002016-09-09 13:46:09 +05301595 uint16_t wmi_max_len;
Dustin Brownd9322482017-01-09 12:46:03 -08001596 struct suspend_resume_stats suspend_resume_stats;
Komal Seelam8634b772016-09-29 12:12:24 +05301597 struct hdd_runtime_pm_context runtime_context;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301598 bool roaming_in_progress;
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05301599 struct scan_chan_info *chan_info;
1600 struct mutex chan_info_lock;
Nitesh Shah2b946fa2016-10-19 17:05:09 +05301601 /* bit map to set/reset TDLS by different sources */
1602 unsigned long tdls_source_bitmap;
Nitesh Shah61c10d92016-10-19 19:29:15 +05301603 /* tdls source timer to enable/disable TDLS on p2p listen */
1604 qdf_mc_timer_t tdls_source_timer;
Kabilan Kannan1c1c4022017-04-06 22:49:26 -07001605 bool tdls_umac_comp_active;
Kabilan Kannan256e3182017-05-02 16:02:37 -07001606 bool tdls_nap_active;
Padma, Santhosh Kumar31bac742017-01-16 19:34:45 +05301607 uint8_t beacon_probe_rsp_cnt_per_scan;
Sreelakshmi Konamkib53c6292017-03-01 13:13:23 +05301608 uint8_t last_scan_reject_session_id;
1609 enum scan_reject_states last_scan_reject_reason;
1610 unsigned long last_scan_reject_timestamp;
Arif Hussain759a0232017-03-20 13:17:18 -07001611 bool dfs_cac_offload;
Amar Singhal5cccafe2017-02-15 12:42:58 -08001612 bool reg_offload;
Ajit Pal Singh2c7aecd2017-05-19 15:09:23 +05301613#ifdef FEATURE_WLAN_CH_AVOID
1614 tHddAvoidFreqList coex_avoid_freq_list;
1615 tHddAvoidFreqList dnbs_avoid_freq_list;
1616 /* Lock to control access to dnbs and coex avoid freq list */
1617 struct mutex avoid_freq_lock;
1618#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001619};
1620
Kapil Gupta086c6202016-12-11 18:17:06 +05301621/**
Kapil Gupta8878ad92017-02-13 11:56:04 +05301622 * struct hdd_vendor_acs_chan_params - vendor acs channel parameters
1623 * @channel_count: channel count
1624 * @channel_list: pointer to channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301625 * @pcl_count: pcl list count
Kapil Gupta8878ad92017-02-13 11:56:04 +05301626 * @vendor_pcl_list: pointer to pcl list
1627 * @vendor_weight_list: pointer to pcl weight list
1628 */
1629struct hdd_vendor_acs_chan_params {
1630 uint32_t channel_count;
1631 uint8_t *channel_list;
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05301632 uint32_t pcl_count;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301633 uint8_t *vendor_pcl_list;
1634 uint8_t *vendor_weight_list;
1635};
1636
1637/**
1638 * struct hdd_external_acs_timer_context - acs timer context
1639 * @reason: reason for acs trigger
1640 * @adapter: hdd adapter for acs
1641 */
1642struct hdd_external_acs_timer_context {
1643 int8_t reason;
1644 hdd_adapter_t *adapter;
1645};
1646
1647/**
1648 * struct hdd_vendor_chan_info - vendor channel info
Kapil Gupta63e75282017-05-18 20:55:10 +05301649 * @band: channel operating band
Kapil Gupta8878ad92017-02-13 11:56:04 +05301650 * @pri_ch: primary channel
1651 * @ht_sec_ch: secondary channel
1652 * @vht_seg0_center_ch: segment0 for vht
1653 * @vht_seg1_center_ch: vht segment 1
1654 * @chan_width: channel width
1655 */
1656struct hdd_vendor_chan_info {
Kapil Gupta63e75282017-05-18 20:55:10 +05301657 uint8_t band;
Kapil Gupta8878ad92017-02-13 11:56:04 +05301658 uint8_t pri_ch;
1659 uint8_t ht_sec_ch;
1660 uint8_t vht_seg0_center_ch;
1661 uint8_t vht_seg1_center_ch;
1662 uint8_t chan_width;
1663};
1664
1665/**
Kapil Gupta086c6202016-12-11 18:17:06 +05301666 * struct hdd_channel_info - standard channel info
1667 * @freq: Freq in Mhz
1668 * @flags: channel info flags
1669 * @flagext: extended channel info flags
1670 * @ieee_chan_number: channel number
1671 * @max_reg_power: max tx power according to regulatory
1672 * @max_radio_power: max radio power
1673 * @min_radio_power: min radio power
1674 * @reg_class_id: regulatory class
1675 * @max_antenna_gain: max antenna gain allowed on channel
1676 * @vht_center_freq_seg0: vht center freq segment 0
1677 * @vht_center_freq_seg1: vht center freq segment 1
1678 */
1679struct hdd_channel_info {
1680 u_int16_t freq;
1681 u_int32_t flags;
1682 u_int16_t flagext;
1683 u_int8_t ieee_chan_number;
1684 int8_t max_reg_power;
1685 int8_t max_radio_power;
1686 int8_t min_radio_power;
1687 u_int8_t reg_class_id;
1688 u_int8_t max_antenna_gain;
1689 u_int8_t vht_center_freq_seg0;
1690 u_int8_t vht_center_freq_seg1;
1691};
1692
Jeff Johnsonef926352017-01-12 10:41:02 -08001693/*
1694 * Function declarations and documentation
1695 */
Chandrasekaran, Manishekar794a0982016-01-12 19:42:20 +05301696int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter,
1697 uint32_t chan_number,
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08001698 enum phy_ch_width chan_bw);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001699#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
1700void wlan_hdd_check_sta_ap_concurrent_ch_intf(void *sta_pAdapter);
1701#endif
1702
1703const char *hdd_device_mode_to_string(uint8_t device_mode);
1704
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301705QDF_STATUS hdd_get_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001706 hdd_adapter_list_node_t **ppAdapterNode);
1707
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301708QDF_STATUS hdd_get_next_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001709 hdd_adapter_list_node_t *pAdapterNode,
1710 hdd_adapter_list_node_t **pNextAdapterNode);
1711
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301712QDF_STATUS hdd_remove_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001713 hdd_adapter_list_node_t *pAdapterNode);
1714
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301715QDF_STATUS hdd_remove_front_adapter(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001716 hdd_adapter_list_node_t **ppAdapterNode);
1717
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301718QDF_STATUS hdd_add_adapter_back(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001719 hdd_adapter_list_node_t *pAdapterNode);
1720
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301721QDF_STATUS hdd_add_adapter_front(hdd_context_t *pHddCtx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001722 hdd_adapter_list_node_t *pAdapterNode);
1723
1724hdd_adapter_t *hdd_open_adapter(hdd_context_t *pHddCtx, uint8_t session_type,
1725 const char *name, tSirMacAddr macAddr,
Ryan Hsu07495ea2016-01-21 15:25:39 -08001726 unsigned char name_assign_type,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001727 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301728QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prashanth Bhatta98f04d22016-01-08 16:46:21 -08001729 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301730QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held);
1731QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx);
Hanumanth Reddy Pothula9f4048f2016-09-30 15:06:57 +05301732void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301733QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx);
1734QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001735hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx,
1736 uint32_t vdev_id);
1737hdd_adapter_t *hdd_get_adapter_by_macaddr(hdd_context_t *pHddCtx,
1738 tSirMacAddr macAddr);
Dustin Brownd28772b2017-03-17 14:16:07 -07001739
1740int hdd_vdev_create(hdd_adapter_t *adapter);
1741int hdd_vdev_destroy(hdd_adapter_t *adapter);
1742int hdd_vdev_ready(hdd_adapter_t *adapter);
1743
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301744QDF_STATUS hdd_init_station_mode(hdd_adapter_t *pAdapter);
Krunal Soni276241e2016-03-10 12:58:11 -08001745hdd_adapter_t *hdd_get_adapter(hdd_context_t *pHddCtx,
1746 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001747void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
1748 bool rtnl_held);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301749QDF_STATUS hdd_stop_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001750 const bool bCloseSession);
1751void hdd_set_station_ops(struct net_device *pWlanDev);
1752uint8_t *wlan_hdd_get_intf_addr(hdd_context_t *pHddCtx);
1753void wlan_hdd_release_intf_addr(hdd_context_t *pHddCtx, uint8_t *releaseAddr);
Krunal Soni276241e2016-03-10 12:58:11 -08001754uint8_t hdd_get_operating_channel(hdd_context_t *pHddCtx,
1755 enum tQDF_ADAPTER_MODE mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001756
Prashanth Bhatta05aaf012015-12-10 17:34:24 -08001757void hdd_set_conparam(uint32_t con_param);
Anurag Chouhan6d760662016-02-20 16:05:43 +05301758enum tQDF_GLOBAL_CON_MODE hdd_get_conparam(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001759
1760void hdd_abort_mac_scan(hdd_context_t *pHddCtx, uint8_t sessionId,
yeshwanth sriram guntuka310b3ac2016-11-15 23:25:26 +05301761 uint32_t scan_id, eCsrAbortReason reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001762void hdd_cleanup_actionframe(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter);
1763
1764void crda_regulatory_entry_default(uint8_t *countryCode, int domain_id);
1765void wlan_hdd_reset_prob_rspies(hdd_adapter_t *pHostapdAdapter);
1766void hdd_prevent_suspend(uint32_t reason);
1767void hdd_allow_suspend(uint32_t reason);
1768void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001769
1770void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301771QDF_STATUS hdd_set_ibss_power_save_params(hdd_adapter_t *pAdapter);
1772QDF_STATUS wlan_hdd_restart_driver(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001773void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
1774int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
Dustin Brownf13b8c32017-05-19 17:23:08 -07001775
1776/**
1777 * hdd_validate_adapter() - Validate the given adapter
1778 * @adapter: the adapter to validate
1779 *
1780 * This function validates the given adapter, and ensures that it is open.
1781 *
1782 * Return: Errno
1783 */
1784int hdd_validate_adapter(hdd_adapter_t *adapter);
1785
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001786bool hdd_is_valid_mac_address(const uint8_t *pMacAddr);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301787QDF_STATUS hdd_issta_p2p_clientconnected(hdd_context_t *pHddCtx);
Arun Khandavallica892f62017-05-26 14:25:50 +05301788bool wlan_hdd_validate_modules_state(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001789
Rajeev Kumar8e3e2832015-11-06 16:02:54 -08001790struct qdf_mac_addr *
1791hdd_wlan_get_ibss_mac_addr_from_staid(hdd_adapter_t *pAdapter,
1792 uint8_t staIdx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001793void hdd_checkandupdate_phymode(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001794#ifdef MSM_PLATFORM
Dustin Brown5ec6b552017-03-31 12:11:40 -07001795/**
1796 * hdd_bus_bw_compute_timer_start() - start the bandwidth timer
1797 * @hdd_ctx: the global hdd context
1798 *
1799 * Return: None
1800 */
1801void hdd_bus_bw_compute_timer_start(hdd_context_t *hdd_ctx);
1802
1803/**
1804 * hdd_bus_bw_compute_timer_try_start() - try to start the bandwidth timer
1805 * @hdd_ctx: the global hdd context
1806 *
1807 * This function ensures there is at least one adapter in the associated state
1808 * before starting the bandwidth timer.
1809 *
1810 * Return: None
1811 */
1812void hdd_bus_bw_compute_timer_try_start(hdd_context_t *hdd_ctx);
1813
1814/**
1815 * hdd_bus_bw_compute_timer_stop() - stop the bandwidth timer
1816 * @hdd_ctx: the global hdd context
1817 *
1818 * Return: None
1819 */
1820void hdd_bus_bw_compute_timer_stop(hdd_context_t *hdd_ctx);
1821
1822/**
1823 * hdd_bus_bw_compute_timer_try_stop() - try to stop the bandwidth timer
1824 * @hdd_ctx: the global hdd context
1825 *
1826 * This function ensures there are no adapters in the associated state before
1827 * stopping the bandwidth timer.
1828 *
1829 * Return: None
1830 */
1831void hdd_bus_bw_compute_timer_try_stop(hdd_context_t *hdd_ctx);
Prashanth Bhattaab004382016-10-11 16:08:11 -07001832
1833/**
1834 * hdd_bus_bandwidth_init() - Initialize bus bandwidth data structures.
1835 * hdd_ctx: HDD context
1836 *
1837 * Initialize bus bandwidth related data structures like spinlock and timer.
1838 *
1839 * Return: None.
1840 */
1841int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx);
1842
1843/**
1844 * hdd_bus_bandwidth_destroy() - Destroy bus bandwidth data structures.
1845 * hdd_ctx: HDD context
1846 *
1847 * Destroy bus bandwidth related data structures like timer.
1848 *
1849 * Return: None.
1850 */
1851void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001852#else
Dustin Brown5ec6b552017-03-31 12:11:40 -07001853
1854static inline void hdd_bus_bw_compute_timer_start(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001855{
Dustin Brown5ec6b552017-03-31 12:11:40 -07001856}
1857
1858static inline void hdd_bus_bw_compute_timer_try_start(hdd_context_t *hdd_ctx)
1859{
1860}
1861
1862static inline void hdd_bus_bw_compute_timer_stop(hdd_context_t *hdd_ctx)
1863{
1864}
1865
1866static inline void hdd_bus_bw_compute_timer_try_stop(hdd_context_t *hdd_ctx)
1867{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001868}
1869
1870static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter)
1871{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001872}
Prashanth Bhattaab004382016-10-11 16:08:11 -07001873
Leo Changfdb45c32016-10-28 11:09:23 -07001874static inline int hdd_bus_bandwidth_init(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001875{
1876 return 0;
1877}
1878
Leo Changfdb45c32016-10-28 11:09:23 -07001879static inline void hdd_bus_bandwidth_destroy(hdd_context_t *hdd_ctx)
Prashanth Bhattaab004382016-10-11 16:08:11 -07001880{
Prashanth Bhattaab004382016-10-11 16:08:11 -07001881}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001882#endif
1883
Ashish Kumar Dhanotiya53c2f692017-02-08 00:25:11 +05301884int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask);
1885
Prashanth Bhatta5da711e2015-11-30 14:28:52 -08001886int hdd_init(void);
1887void hdd_deinit(void);
1888
Arun Khandavallifae92942016-08-01 13:31:08 +05301889int hdd_wlan_startup(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001890void __hdd_wlan_exit(void);
1891int hdd_wlan_notify_modem_power_state(int state);
1892#ifdef QCA_HT_2040_COEX
1893int hdd_wlan_set_ht2040_mode(hdd_adapter_t *pAdapter, uint16_t staId,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301894 struct qdf_mac_addr macAddrSTA, int width);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001895#endif
1896
Kondabattini, Ganesh96ac37b2016-09-02 23:12:15 +05301897void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001898#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
1899void wlan_hdd_auto_shutdown_enable(hdd_context_t *hdd_ctx, bool enable);
1900#endif
1901
1902hdd_adapter_t *hdd_get_con_sap_adapter(hdd_adapter_t *this_sap_adapter,
1903 bool check_start_bss);
1904
1905bool hdd_is_5g_supported(hdd_context_t *pHddCtx);
1906
1907int wlan_hdd_scan_abort(hdd_adapter_t *pAdapter);
1908
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001909void hdd_get_fw_version(hdd_context_t *hdd_ctx,
1910 uint32_t *major_spid, uint32_t *minor_spid,
1911 uint32_t *siid, uint32_t *crmid);
Kapil Gupta8878ad92017-02-13 11:56:04 +05301912/**
1913 * hdd_acs_response_timeout_handler() - timeout handler for acs_timer
1914 * @context : timeout handler context
1915 *
1916 * Return: None
1917 */
1918void hdd_acs_response_timeout_handler(void *context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001919
Kapil Gupta8878ad92017-02-13 11:56:04 +05301920/**
1921 * wlan_hdd_cfg80211_start_acs(): Start ACS Procedure for SAP
1922 * @adapter: pointer to SAP adapter struct
1923 *
1924 * This function starts the ACS procedure if there are no
1925 * constraints like MBSSID DFS restrictions.
1926 *
1927 * Return: Status of ACS Start procedure
1928 */
1929int wlan_hdd_cfg80211_start_acs(hdd_adapter_t *adapter);
1930
1931/**
1932 * hdd_cfg80211_update_acs_config() - update acs config to application
1933 * @adapter: hdd adapter
1934 * @reason: channel change reason
1935 *
1936 * Return: none
1937 */
1938void hdd_cfg80211_update_acs_config(hdd_adapter_t *adapter,
1939 uint8_t reason);
1940/**
1941 * hdd_update_acs_timer_reason() - update acs timer start reason
1942 * @adapter: hdd adapter
1943 * @reason: channel change reason
1944 *
1945 * Return: 0 for success
1946 */
1947int hdd_update_acs_timer_reason(hdd_adapter_t *adapter, uint8_t reason);
1948
1949/**
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001950 * hdd_switch_sap_channel() - Move SAP to the given channel
Kapil Gupta8878ad92017-02-13 11:56:04 +05301951 * @adapter: AP adapter
1952 * @channel: Channel
1953 *
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001954 * Moves the SAP interface by invoking the function which
1955 * executes the callback to perform channel switch using (E)CSA.
Kapil Gupta8878ad92017-02-13 11:56:04 +05301956 *
1957 * Return: None
1958 */
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08001959void hdd_switch_sap_channel(hdd_adapter_t *adapter, uint8_t channel);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001960#ifdef WLAN_FEATURE_MEMDUMP
1961/**
1962 * hdd_is_memdump_supported() - to check if memdump feature support
1963 *
1964 * This function is used to check if memdump feature is supported in
1965 * the host driver
1966 *
1967 * Return: true if supported and false otherwise
1968 */
1969static inline bool hdd_is_memdump_supported(void)
1970{
1971 return true;
1972}
1973#else
1974static inline bool hdd_is_memdump_supported(void)
1975{
1976 return false;
1977}
1978#endif /* WLAN_FEATURE_MEMDUMP */
1979
1980void hdd_update_macaddr(struct hdd_config *config,
Anurag Chouhan6d760662016-02-20 16:05:43 +05301981 struct qdf_mac_addr hw_macaddr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001982void wlan_hdd_disable_roaming(hdd_adapter_t *pAdapter);
1983void wlan_hdd_enable_roaming(hdd_adapter_t *pAdapter);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001984
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301985QDF_STATUS hdd_post_cds_enable_config(hdd_context_t *pHddCtx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001986
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301987QDF_STATUS hdd_abort_mac_scan_all_adapters(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001988
Anurag Chouhanfb54ab02016-02-18 18:00:46 +05301989QDF_STATUS wlan_hdd_check_custom_con_channel_rules(hdd_adapter_t *sta_adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001990 hdd_adapter_t *ap_adapter,
1991 tCsrRoamProfile *roam_profile,
1992 tScanResultHandle *scan_cache,
1993 bool *concurrent_chnl_same);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001994void wlan_hdd_stop_sap(hdd_adapter_t *ap_adapter);
Arun Khandavallicc544b32017-01-30 19:52:16 +05301995void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001996
Archana Ramachandrand41c3ed2016-02-10 15:48:06 -08001997void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
1998
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001999#ifdef QCA_CONFIG_SMP
2000int wlan_hdd_get_cpu(void);
2001#else
2002static inline int wlan_hdd_get_cpu(void)
2003{
2004 return 0;
2005}
2006#endif
2007
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302008void wlan_hdd_sap_pre_cac_failure(void *data);
2009void hdd_clean_up_pre_cac_interface(hdd_context_t *hdd_ctx);
2010
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002011void wlan_hdd_txrx_pause_cb(uint8_t vdev_id,
2012 enum netif_action_type action, enum netif_reason_type reason);
2013
Mohit Khanna3e2115b2016-10-11 13:18:29 -07002014int hdd_wlan_dump_stats(hdd_adapter_t *adapter, int value);
Nirav Shahed34b212016-04-25 10:59:16 +05302015void wlan_hdd_deinit_tx_rx_histogram(hdd_context_t *hdd_ctx);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002016void wlan_hdd_display_tx_rx_histogram(hdd_context_t *pHddCtx);
2017void wlan_hdd_clear_tx_rx_histogram(hdd_context_t *pHddCtx);
2018void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx);
2019void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx);
2020const char *hdd_get_fwpath(void);
Abhishek Singh7996eb72015-12-30 17:24:02 +05302021void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind);
2022hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx,
2023 uint32_t sme_session_id);
Naveen Rawat4edb6822017-04-12 10:09:17 -07002024/**
2025 * hdd_get_adapter_by_iface_name() - Return adapter with given interface name
2026 * @hdd_ctx: hdd context.
2027 * @iface_name: interface name
2028 *
2029 * This function is used to get the adapter with given interface name
2030 *
2031 * Return: adapter pointer if found, NULL otherwise
2032 *
2033 */
2034hdd_adapter_t *hdd_get_adapter_by_iface_name(hdd_context_t *hdd_ctx,
2035 const char *iface_name);
Kiran Kumar Lokere13644672016-02-29 15:40:10 -08002036enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width);
Masti, Narayanraddic4a7ab82015-11-25 15:41:10 +05302037uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
2038 uint8_t bw_offset);
Arun Khandavallic811dcc2016-06-26 07:37:21 +05302039int hdd_update_config(hdd_context_t *hdd_ctx);
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002040
Mukul Sharma9d797a02017-01-05 20:26:03 +05302041/**
2042 * hdd_update_components_config() - Initialize driver per module ini parameters
2043 * @hdd_ctx: HDD Context
2044 *
2045 * API is used to initialize components configuration parameters
2046 * Return: 0 for success, errno for failure
2047 */
2048int hdd_update_components_config(hdd_context_t *hdd_ctx);
2049
Manishekar Chandrasekarancb052172016-04-22 12:19:04 +05302050QDF_STATUS hdd_chan_change_notify(hdd_adapter_t *adapter,
Manishekar Chandrasekaranec267592016-05-26 19:10:04 +05302051 struct net_device *dev,
2052 struct hdd_chan_change_params chan_change);
Manishekar Chandrasekaran9e8c7be2016-08-03 14:57:14 +05302053int wlan_hdd_set_channel(struct wiphy *wiphy,
2054 struct net_device *dev,
2055 struct cfg80211_chan_def *chandef,
2056 enum nl80211_channel_type channel_type);
2057int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter,
2058 struct cfg80211_beacon_data *params,
2059 const u8 *ssid, size_t ssid_len,
2060 enum nl80211_hidden_ssid hidden_ssid,
Archana Ramachandran1a5b6042016-11-08 16:36:50 -08002061 bool check_for_concurrency,
2062 bool update_beacon);
Chandrasekaran Manishekarcde33d72016-04-14 19:03:39 +05302063
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002064#if !defined(REMOVE_PKT_LOG)
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302065int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
2066 int set_value2);
2067int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
2068 uint8_t user_triggered, int size);
2069
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002070#else
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302071static inline int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
2072 uint8_t user_triggered, int size)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002073{
2074 return 0;
2075}
Poddar, Siddarth176c4362016-10-03 12:25:00 +05302076static inline int hdd_process_pktlog_command(hdd_context_t *hdd_ctx,
2077 uint32_t set_value, int set_value2)
Srinivas Girigowdac34f11d2016-02-25 16:02:42 -08002078{
2079 return 0;
2080}
2081#endif /* REMOVE_PKT_LOG */
2082
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002083#ifdef FEATURE_TSO
2084/**
2085 * hdd_set_tso_flags() - enable TSO flags in the network device
2086 * @hdd_ctx: HDD context
2087 * @wlan_dev: network device structure
2088 *
2089 * This function enables the TSO related feature flags in the
2090 * given network device.
2091 *
2092 * Return: none
2093 */
2094static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2095 struct net_device *wlan_dev)
2096{
Mohit Khanna816e6532016-12-09 15:28:21 -08002097 if (hdd_ctx->config->tso_enable &&
2098 hdd_ctx->config->enable_ip_tcp_udp_checksum_offload) {
2099 /*
2100 * We want to enable TSO only if IP/UDP/TCP TX checksum flag is
2101 * enabled.
2102 */
Dhanashri Atre83d373d2015-07-28 16:45:59 -07002103 hdd_info("TSO Enabled");
2104 wlan_dev->features |=
2105 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
2106 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG;
2107 }
2108}
2109#else
2110static inline void hdd_set_tso_flags(hdd_context_t *hdd_ctx,
2111 struct net_device *wlan_dev){}
2112#endif /* FEATURE_TSO */
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002113
Agrawal Ashishc9ddbab2016-05-25 12:04:47 +05302114#if defined(FEATURE_WLAN_MCC_TO_SCC_SWITCH) || \
2115 defined(FEATURE_WLAN_STA_AP_MODE_DFS_DISABLE)
2116void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter);
2117#else
2118static inline void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter)
2119{
2120}
2121#endif
2122
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002123#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002124static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002125{
2126 return hdd_ctx->config->isRoamOffloadEnabled;
2127}
2128#else
Varun Reddy Yeturud351a6c2016-03-16 14:01:00 -07002129static inline bool roaming_offload_enabled(hdd_context_t *hdd_ctx)
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -08002130{
2131 return false;
2132}
2133#endif
2134
Rajeev Kumar94c9b452016-03-24 12:58:47 -07002135void hdd_get_ibss_peer_info_cb(void *pUserData,
2136 tSirPeerInfoRspParams *pPeerInfo);
2137
Ryan Hsuceddceb2016-04-28 10:20:14 -07002138#ifdef CONFIG_CNSS_LOGGER
2139/**
2140 * wlan_hdd_nl_init() - wrapper function to CNSS_LOGGER case
2141 * @hdd_ctx: the hdd context pointer
2142 *
2143 * The nl_srv_init() will call to cnss_logger_device_register() and
2144 * expect to get a radio_index from cnss_logger module and assign to
2145 * hdd_ctx->radio_index, then to maintain the consistency to original
2146 * design, adding the radio_index check here, then return the error
2147 * code if radio_index is not assigned correctly, which means the nl_init
2148 * from cnss_logger is failed.
2149 *
2150 * Return: 0 if successfully, otherwise error code
2151 */
2152static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2153{
2154 hdd_ctx->radio_index = nl_srv_init(hdd_ctx->wiphy);
2155
2156 /* radio_index is assigned from 0, so only >=0 will be valid index */
2157 if (hdd_ctx->radio_index >= 0)
2158 return 0;
2159 else
2160 return -EINVAL;
2161}
2162#else
2163/**
2164 * wlan_hdd_nl_init() - wrapper function to non CNSS_LOGGER case
2165 * @hdd_ctx: the hdd context pointer
2166 *
2167 * In case of non CNSS_LOGGER case, the nl_srv_init() will initialize
2168 * the netlink socket and return the success or not.
2169 *
2170 * Return: the return value from nl_srv_init()
2171 */
2172static inline int wlan_hdd_nl_init(hdd_context_t *hdd_ctx)
2173{
2174 return nl_srv_init(hdd_ctx->wiphy);
2175}
2176#endif
Deepak Dhamdhere5cdce842016-05-31 10:39:12 -07002177QDF_STATUS hdd_sme_close_session_callback(void *pContext);
2178
Varun Reddy Yeturu3e91dad2016-07-18 15:58:47 -07002179int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid,
Deepak Dhamdhere5a36a4a2016-11-12 15:08:22 -08002180 uint8_t channel, const handoff_src src);
Komal Seelam78ff65a2016-08-18 15:25:24 +05302181void hdd_svc_fw_shutdown_ind(struct device *dev);
Arun Khandavalli4b55da72016-07-19 19:55:01 +05302182int hdd_register_cb(hdd_context_t *hdd_ctx);
2183void hdd_deregister_cb(hdd_context_t *hdd_ctx);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302184int hdd_start_station_adapter(hdd_adapter_t *adapter);
2185int hdd_start_ap_adapter(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302186int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter);
Arun Khandavalli7e857c32016-06-26 12:07:16 +05302187int hdd_start_ftm_adapter(hdd_adapter_t *adapter);
Arun Khandavalli2358d522016-05-16 18:05:37 +05302188int hdd_set_fw_params(hdd_adapter_t *adapter);
Arun Khandavallifae92942016-08-01 13:31:08 +05302189int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
2190 bool reinit);
Rajeev Kumar3fef4e82017-03-31 20:25:23 -07002191int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool ftm_mode);
Arun Khandavallifae92942016-08-01 13:31:08 +05302192int hdd_start_adapter(hdd_adapter_t *adapter);
Abhishek Singhb5e38ef2017-01-02 12:09:34 +05302193
2194/**
2195 * hdd_get_bss_entry() - Get the bss entry matching the chan, bssid and ssid
2196 * @wiphy: wiphy
2197 * @channel: channel of the BSS to find
2198 * @bssid: bssid of the BSS to find
2199 * @ssid: ssid of the BSS to find
2200 * @ssid_len: ssid len of of the BSS to find
2201 *
2202 * The API is a wrapper to get bss from kernel matching the chan,
2203 * bssid and ssid
2204 *
2205 * Return: bss structure if found else NULL
2206 */
2207struct cfg80211_bss *hdd_cfg80211_get_bss(struct wiphy *wiphy,
2208 struct ieee80211_channel *channel,
2209 const u8 *bssid,
2210 const u8 *ssid, size_t ssid_len);
2211
Anurag Chouhanc4092922016-09-08 15:56:11 +05302212void hdd_connect_result(struct net_device *dev, const u8 *bssid,
2213 tCsrRoamInfo *roam_info, const u8 *req_ie,
2214 size_t req_ie_len, const u8 *resp_ie,
Abhishek Singha84d3952016-09-13 13:45:05 +05302215 size_t resp_ie_len, u16 status, gfp_t gfp,
yeshwanth sriram guntukaaf7b73f2017-02-22 17:35:32 +05302216 bool connect_timeout,
2217 tSirResultCodes timeout_reason);
Anurag Chouhanc4092922016-09-08 15:56:11 +05302218
Arun Khandavallifae92942016-08-01 13:31:08 +05302219#ifdef WLAN_FEATURE_FASTPATH
2220void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2221 void *context);
2222#else
2223static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg,
2224 void *context)
2225{
2226}
2227#endif
2228void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context);
Agrawal Ashish65634612016-08-18 13:24:32 +05302229enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode);
Agrawal Ashish467dde42016-09-08 18:44:22 +05302230void hdd_ch_avoid_cb(void *hdd_context, void *indi_param);
2231void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx);
Selvaraj, Sridharebda0f22016-08-29 16:05:23 +05302232int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
2233 uint8_t set_value);
Liangwei Dong8baf7c82016-10-11 01:26:59 -04002234void wlan_hdd_undo_acs(hdd_adapter_t *adapter);
Dustin Brownbb7e2f52016-10-17 12:16:35 -07002235
2236#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
2237static inline int
2238hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2239{
2240 return nla_put_u64(skb, attrtype, value);
2241}
2242#else
2243static inline int
2244hdd_wlan_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
2245{
2246 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD);
2247}
2248#endif
2249
Hanumanth Reddy Pothulad9491f42016-10-24 19:08:38 +05302250static inline int wlan_hdd_validate_session_id(u8 session_id)
2251{
2252 if (session_id != HDD_SESSION_ID_INVALID)
2253 return 0;
2254
2255 return -EINVAL;
2256}
2257
Varun Reddy Yeturua5784142017-03-10 12:11:44 -08002258bool hdd_is_roaming_in_progress(hdd_adapter_t *adapter);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002259void hdd_set_roaming_in_progress(bool value);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -08002260bool hdd_is_connection_in_progress(uint8_t *session_id,
2261 enum scan_reject_states *reason);
2262void hdd_restart_sap(hdd_adapter_t *ap_adapter);
2263void hdd_check_and_restart_sap_with_non_dfs_acs(void);
2264bool hdd_set_connection_in_progress(bool value);
Varun Reddy Yeturudce1c562016-11-18 10:00:45 -08002265
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302266/**
2267 * wlan_hdd_sap_get_valid_channellist() - Get SAPs valid channel list
2268 * @ap_adapter: adapter
2269 * @channel_count: valid channel count
2270 * @channel_list: valid channel list
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302271 * @band: frequency band
Kapil Gupta94ca6f62016-12-11 18:43:12 +05302272 *
2273 * This API returns valid channel list for SAP after removing nol and
2274 * channel which lies outside of configuration.
2275 *
2276 * Return: Zero on success, non-zero on failure
2277 */
2278int wlan_hdd_sap_get_valid_channellist(hdd_adapter_t *adapter,
2279 uint32_t *channel_count,
Jayachandran Sreekumaran68c952c2017-04-24 12:42:03 +05302280 uint8_t *channel_list,
2281 eCsrBand band);
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302282/**
2283 * wlan_hdd_init_chan_info() - initialize channel info variables
2284 * @hdd_ctx: hdd ctx
2285 *
2286 * This API initialize channel info variables
2287 *
2288 * Return: None
2289 */
2290void wlan_hdd_init_chan_info(hdd_context_t *hdd_ctx);
Srinivas Girigowda85218af2017-03-25 13:21:40 -07002291
Kapil Gupta4f0c0c12017-02-07 15:21:15 +05302292/**
2293 * wlan_hdd_deinit_chan_info() - deinitialize channel info variables
2294 * @hdd_ctx: hdd ctx
2295 *
2296 * This API deinitialize channel info variables
2297 *
2298 * Return: None
2299 */
2300void wlan_hdd_deinit_chan_info(hdd_context_t *hdd_ctx);
Arun Khandavallicc544b32017-01-30 19:52:16 +05302301void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
Naveen Rawat910726a2017-03-06 11:42:51 -08002302
Ashish Kumar Dhanotiya486c13a2017-03-03 12:57:56 +05302303/**
2304 * hdd_check_for_opened_interfaces()- Check for interface up
2305 * @hdd_ctx: HDD context
2306 *
2307 * check if there are any wlan interfaces before starting the timer
2308 * to close the modules
2309 *
2310 * Return: 0 if interface was opened else false
2311 */
2312bool hdd_check_for_opened_interfaces(hdd_context_t *hdd_ctx);
Naveen Rawat910726a2017-03-06 11:42:51 -08002313
2314#ifdef WIFI_POS_CONVERGED
2315/**
2316 * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
2317 * function to send peer status to a registered application
2318 * @peer_mac: MAC address of peer
2319 * @peer_status: ePeerConnected or ePeerDisconnected
2320 * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
2321 * @sessionId: SME session id, i.e. vdev_id
2322 * @chan_info: operating channel information
2323 * @dev_mode: dev mode for which indication is sent
2324 *
2325 * Return: none
2326 */
2327static inline void hdd_send_peer_status_ind_to_app(
2328 struct qdf_mac_addr *peer_mac,
2329 uint8_t peer_status,
2330 uint8_t peer_timing_meas_cap,
2331 uint8_t sessionId,
2332 tSirSmeChanInfo *chan_info,
2333 enum tQDF_ADAPTER_MODE dev_mode)
2334{
2335 struct wifi_pos_ch_info ch_info;
2336
Naveen Rawat6877a242017-03-23 17:15:38 -07002337 if (!chan_info) {
2338 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2339 peer_timing_meas_cap, sessionId,
2340 NULL, dev_mode);
2341 return;
2342 }
2343
Naveen Rawat910726a2017-03-06 11:42:51 -08002344 ch_info.chan_id = chan_info->chan_id;
2345 ch_info.mhz = chan_info->mhz;
2346 ch_info.band_center_freq1 = chan_info->band_center_freq1;
2347 ch_info.band_center_freq2 = chan_info->band_center_freq2;
2348 ch_info.info = chan_info->info;
2349 ch_info.reg_info_1 = chan_info->reg_info_1;
2350 ch_info.reg_info_2 = chan_info->reg_info_2;
2351 ch_info.nss = chan_info->nss;
2352 ch_info.rate_flags = chan_info->rate_flags;
2353 ch_info.sec_ch_offset = chan_info->sec_ch_offset;
2354 ch_info.ch_width = chan_info->ch_width;
2355 os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
2356 peer_timing_meas_cap, sessionId,
2357 &ch_info, dev_mode);
2358}
2359#else
2360static inline void hdd_send_peer_status_ind_to_app(
2361 struct qdf_mac_addr *peer_mac,
2362 uint8_t peer_status,
2363 uint8_t peer_timing_meas_cap,
2364 uint8_t sessionId,
2365 tSirSmeChanInfo *chan_info,
2366 enum tQDF_ADAPTER_MODE dev_mode)
2367{
2368 hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
2369 peer_timing_meas_cap, sessionId, chan_info, dev_mode);
2370}
2371#endif /* WIFI_POS_CONVERGENCE */
2372
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002373/**
2374 * wlan_hdd_send_p2p_quota()- Send P2P Quota value to FW
2375 * @adapter: Adapter data
2376 * @sval: P2P quota value
2377 *
2378 * Send P2P quota value to FW
2379 *
2380 * Return: 0 sucess else failure
2381 */
2382int wlan_hdd_send_p2p_quota(hdd_adapter_t *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002383
Archana Ramachandranb8c04f92017-03-17 20:05:47 -07002384/**
2385 * wlan_hdd_send_p2p_quota()- Send MCC latency to FW
2386 * @adapter: Adapter data
2387 * @sval: MCC latency value
2388 *
2389 * Send MCC latency value to FW
2390 *
2391 * Return: 0 sucess else failure
2392 */
2393int wlan_hdd_send_mcc_latency(hdd_adapter_t *adapter, int sval);
Archana Ramachandranea34c4f2017-03-19 18:56:18 -07002394
2395/**
2396 * wlan_hdd_get_adapter_from_vdev()- Get adapter from vdev id
2397 * and PSOC object data
2398 * @psoc: Psoc object data
2399 * @vdev_id: vdev id
2400 *
2401 * Get adapter from vdev id and PSOC object data
2402 *
2403 * Return: adapter pointer
2404 */
2405hdd_adapter_t *wlan_hdd_get_adapter_from_vdev(struct wlan_objmgr_psoc
2406 *psoc, uint8_t vdev_id);
Ashish Kumar Dhanotiyaaa2b17c2017-03-29 00:41:32 +05302407/**
2408 * hdd_unregister_notifiers()- unregister kernel notifiers
2409 * @hdd_ctx: Hdd Context
2410 *
2411 * Unregister netdev notifiers like Netdevice,IPv4 and IPv6.
2412 *
2413 */
2414void hdd_unregister_notifiers(hdd_context_t *hdd_ctx);
Sachin Ahujadddd2632017-03-07 19:07:24 +05302415
2416/**
Nitesh Shahf9a09ff2017-05-22 15:46:25 +05302417 * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config
2418 * @hdd_ctx: HDD context
2419 *
2420 * This function sends the DBS scan selection config configuration to the
2421 * firmware via WMA
2422 *
2423 * Return: 0 - success, < 0 - failure
2424 */
2425int hdd_dbs_scan_selection_init(hdd_context_t *hdd_ctx);
2426
2427/**
Sachin Ahujadddd2632017-03-07 19:07:24 +05302428 * hdd_start_complete()- complete the start event
2429 * @ret: return value for complete event.
2430 *
2431 * complete the startup event and set the return in
2432 * global variable
2433 *
2434 * Return: void
2435 */
2436
2437void hdd_start_complete(int ret);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08002438#endif /* end #if !defined(WLAN_HDD_MAIN_H) */