Commit | Line | Data |
---|---|---|
1cac41cb MB |
1 | /* |
2 | * Header file describing the internal (inter-module) DHD interfaces. | |
3 | * | |
4 | * Provides type definitions and function prototypes used to link the | |
5 | * DHD OS, bus, and protocol modules. | |
6 | * | |
7 | * Copyright (C) 1999-2019, Broadcom. | |
8 | * | |
9 | * Unless you and Broadcom execute a separate written software license | |
10 | * agreement governing use of this software, this software is licensed to you | |
11 | * under the terms of the GNU General Public License version 2 (the "GPL"), | |
12 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the | |
13 | * following added to such license: | |
14 | * | |
15 | * As a special exception, the copyright holders of this software give you | |
16 | * permission to link this software with independent modules, and to copy and | |
17 | * distribute the resulting executable under terms of your choice, provided that | |
18 | * you also meet, for each linked independent module, the terms and conditions of | |
19 | * the license of that module. An independent module is a module which is not | |
20 | * derived from this software. The special exception does not apply to any | |
21 | * modifications of the software. | |
22 | * | |
23 | * Notwithstanding the above, under no circumstances may you combine this | |
24 | * software in any way with any other Broadcom software provided under a license | |
25 | * other than the GPL, without Broadcom's express prior written consent. | |
26 | * | |
27 | * | |
28 | * <<Broadcom-WL-IPTag/Open:>> | |
29 | * | |
5a068558 | 30 | * $Id: dhd.h 815855 2019-04-22 05:16:49Z $ |
1cac41cb MB |
31 | */ |
32 | ||
33 | /**************** | |
34 | * Common types * | |
35 | */ | |
36 | ||
37 | #ifndef _dhd_h_ | |
38 | #define _dhd_h_ | |
39 | ||
40 | #include <linux/init.h> | |
41 | #include <linux/kernel.h> | |
42 | #include <linux/slab.h> | |
43 | #include <linux/skbuff.h> | |
44 | #include <linux/netdevice.h> | |
45 | #include <linux/etherdevice.h> | |
46 | #include <linux/random.h> | |
47 | #include <linux/spinlock.h> | |
48 | #include <linux/ethtool.h> | |
49 | #include <linux/fs.h> | |
50 | #include <linux/proc_fs.h> | |
51 | #include <asm/uaccess.h> | |
52 | #include <asm/unaligned.h> | |
53 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK) | |
54 | #include <linux/wakelock.h> | |
55 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */ | |
56 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) | |
57 | #include <linux/sched/types.h> | |
58 | #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) */ | |
59 | /* The kernel threading is sdio-specific */ | |
60 | struct task_struct; | |
61 | struct sched_param; | |
62 | #if defined(BT_OVER_SDIO) | |
63 | #include <dhd_bt_interface.h> | |
64 | #endif /* defined (BT_OVER_SDIO) */ | |
65 | int setScheduler(struct task_struct *p, int policy, struct sched_param *param); | |
66 | int get_scheduler_policy(struct task_struct *p); | |
67 | #define MAX_EVENT 16 | |
68 | ||
69 | #define ALL_INTERFACES 0xff | |
70 | ||
71 | #include <wlioctl.h> | |
72 | #include <dhdioctl.h> | |
73 | #include <wlfc_proto.h> | |
74 | #include <hnd_armtrap.h> | |
75 | #if defined(DUMP_IOCTL_IOV_LIST) || defined(DHD_DEBUG) | |
76 | #include <bcmutils.h> | |
77 | #endif /* DUMP_IOCTL_IOV_LIST || DHD_DEBUG */ | |
78 | ||
79 | #if defined(BCMWDF) | |
80 | #include <wdf.h> | |
81 | #include <WdfMiniport.h> | |
82 | #endif /* (BCMWDF) */ | |
83 | ||
84 | #ifdef WL_CFGVENDOR_SEND_HANG_EVENT | |
85 | #include <rte_ioctl.h> | |
86 | #endif /* WL_CFGVENDOR_SEND_HANG_EVENT */ | |
87 | ||
88 | #ifdef DHD_ERPOM | |
89 | #include <pom.h> | |
90 | #endif /* DHD_ERPOM */ | |
91 | ||
92 | #include <dngl_stats.h> | |
93 | ||
94 | #ifdef DEBUG_DPC_THREAD_WATCHDOG | |
95 | #define MAX_RESCHED_CNT 600 | |
96 | #endif /* DEBUG_DPC_THREAD_WATCHDOG */ | |
97 | ||
98 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) && LINUX_VERSION_CODE < \ | |
99 | KERNEL_VERSION(3, 18, 0) || defined(CONFIG_BCMDHD_VENDOR_EXT)) | |
100 | #define WL_VENDOR_EXT_SUPPORT | |
101 | #endif /* 3.18 > KERNEL_VER >= 3.14 || defined(CONFIG_BCMDHD_VENDOR_EXT) */ | |
102 | ||
103 | #if defined(KEEP_ALIVE) | |
104 | /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */ | |
105 | #define KEEP_ALIVE_PERIOD 55000 | |
106 | #define NULL_PKT_STR "null_pkt" | |
107 | #endif /* KEEP_ALIVE */ | |
108 | ||
109 | /* Forward decls */ | |
110 | struct dhd_bus; | |
111 | struct dhd_prot; | |
112 | struct dhd_info; | |
113 | struct dhd_ioctl; | |
114 | struct dhd_dbg; | |
115 | struct dhd_ts; | |
116 | ||
117 | /* The level of bus communication with the dongle */ | |
118 | enum dhd_bus_state { | |
119 | DHD_BUS_DOWN, /* Not ready for frame transfers */ | |
120 | DHD_BUS_LOAD, /* Download access only (CPU reset) */ | |
121 | DHD_BUS_DATA, /* Ready for frame transfers */ | |
122 | DHD_BUS_SUSPEND, /* Bus has been suspended */ | |
123 | DHD_BUS_DOWN_IN_PROGRESS, /* Bus going Down */ | |
124 | }; | |
125 | ||
126 | /* The level of bus communication with the dongle */ | |
127 | enum dhd_bus_devreset_type { | |
128 | DHD_BUS_DEVRESET_ON = 0, /* ON */ | |
129 | DHD_BUS_DEVRESET_OFF = 1, /* OFF */ | |
130 | DHD_BUS_DEVRESET_FLR = 2, /* FLR */ | |
131 | DHD_BUS_DEVRESET_FLR_FORCE_FAIL = 3, /* FLR FORCE FAIL */ | |
132 | DHD_BUS_DEVRESET_QUIESCE = 4, /* FLR */ | |
133 | }; | |
134 | ||
135 | /* | |
136 | * Bit fields to Indicate clean up process that wait till they are finished. | |
137 | * Future synchronizable processes can add their bit filed below and update | |
138 | * their functionalities accordingly | |
139 | */ | |
140 | #define DHD_BUS_BUSY_IN_TX 0x01 | |
141 | #define DHD_BUS_BUSY_IN_SEND_PKT 0x02 | |
142 | #define DHD_BUS_BUSY_IN_DPC 0x04 | |
143 | #define DHD_BUS_BUSY_IN_WD 0x08 | |
144 | #define DHD_BUS_BUSY_IN_IOVAR 0x10 | |
145 | #define DHD_BUS_BUSY_IN_DHD_IOVAR 0x20 | |
146 | #define DHD_BUS_BUSY_SUSPEND_IN_PROGRESS 0x40 | |
147 | #define DHD_BUS_BUSY_RESUME_IN_PROGRESS 0x80 | |
148 | #define DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS 0x100 | |
149 | #define DHD_BUS_BUSY_RPM_SUSPEND_DONE 0x200 | |
150 | #define DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS 0x400 | |
151 | #define DHD_BUS_BUSY_RPM_ALL (DHD_BUS_BUSY_RPM_SUSPEND_DONE | \ | |
152 | DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS | \ | |
153 | DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS) | |
154 | #define DHD_BUS_BUSY_IN_CHECKDIED 0x800 | |
155 | #define DHD_BUS_BUSY_IN_MEMDUMP 0x1000 | |
156 | #define DHD_BUS_BUSY_IN_SSSRDUMP 0x2000 | |
157 | #define DHD_BUS_BUSY_IN_LOGDUMP 0x4000 | |
158 | ||
159 | #define DHD_BUS_BUSY_SET_IN_TX(dhdp) \ | |
160 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_TX | |
161 | #define DHD_BUS_BUSY_SET_IN_SEND_PKT(dhdp) \ | |
162 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_SEND_PKT | |
163 | #define DHD_BUS_BUSY_SET_IN_DPC(dhdp) \ | |
164 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_DPC | |
165 | #define DHD_BUS_BUSY_SET_IN_WD(dhdp) \ | |
166 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_WD | |
167 | #define DHD_BUS_BUSY_SET_IN_IOVAR(dhdp) \ | |
168 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_IOVAR | |
169 | #define DHD_BUS_BUSY_SET_IN_DHD_IOVAR(dhdp) \ | |
170 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_DHD_IOVAR | |
171 | #define DHD_BUS_BUSY_SET_SUSPEND_IN_PROGRESS(dhdp) \ | |
172 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_SUSPEND_IN_PROGRESS | |
173 | #define DHD_BUS_BUSY_SET_RESUME_IN_PROGRESS(dhdp) \ | |
174 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_RESUME_IN_PROGRESS | |
175 | #define DHD_BUS_BUSY_SET_RPM_SUSPEND_IN_PROGRESS(dhdp) \ | |
176 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS | |
177 | #define DHD_BUS_BUSY_SET_RPM_SUSPEND_DONE(dhdp) \ | |
178 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_RPM_SUSPEND_DONE | |
179 | #define DHD_BUS_BUSY_SET_RPM_RESUME_IN_PROGRESS(dhdp) \ | |
180 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS | |
181 | #define DHD_BUS_BUSY_SET_IN_CHECKDIED(dhdp) \ | |
182 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_CHECKDIED | |
183 | #define DHD_BUS_BUSY_SET_IN_MEMDUMP(dhdp) \ | |
184 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_MEMDUMP | |
185 | #define DHD_BUS_BUSY_SET_IN_SSSRDUMP(dhdp) \ | |
186 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_SSSRDUMP | |
187 | #define DHD_BUS_BUSY_SET_IN_LOGDUMP(dhdp) \ | |
188 | (dhdp)->dhd_bus_busy_state |= DHD_BUS_BUSY_IN_LOGDUMP | |
189 | ||
190 | #define DHD_BUS_BUSY_CLEAR_IN_TX(dhdp) \ | |
191 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_TX | |
192 | #define DHD_BUS_BUSY_CLEAR_IN_SEND_PKT(dhdp) \ | |
193 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_SEND_PKT | |
194 | #define DHD_BUS_BUSY_CLEAR_IN_DPC(dhdp) \ | |
195 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_DPC | |
196 | #define DHD_BUS_BUSY_CLEAR_IN_WD(dhdp) \ | |
197 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_WD | |
198 | #define DHD_BUS_BUSY_CLEAR_IN_IOVAR(dhdp) \ | |
199 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_IOVAR | |
200 | #define DHD_BUS_BUSY_CLEAR_IN_DHD_IOVAR(dhdp) \ | |
201 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_DHD_IOVAR | |
202 | #define DHD_BUS_BUSY_CLEAR_SUSPEND_IN_PROGRESS(dhdp) \ | |
203 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_SUSPEND_IN_PROGRESS | |
204 | #define DHD_BUS_BUSY_CLEAR_RESUME_IN_PROGRESS(dhdp) \ | |
205 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_RESUME_IN_PROGRESS | |
206 | #define DHD_BUS_BUSY_CLEAR_RPM_SUSPEND_IN_PROGRESS(dhdp) \ | |
207 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS | |
208 | #define DHD_BUS_BUSY_CLEAR_RPM_SUSPEND_DONE(dhdp) \ | |
209 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_RPM_SUSPEND_DONE | |
210 | #define DHD_BUS_BUSY_CLEAR_RPM_RESUME_IN_PROGRESS(dhdp) \ | |
211 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS | |
212 | #define DHD_BUS_BUSY_CLEAR_IN_CHECKDIED(dhdp) \ | |
213 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_CHECKDIED | |
214 | #define DHD_BUS_BUSY_CLEAR_IN_MEMDUMP(dhdp) \ | |
215 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_MEMDUMP | |
216 | #define DHD_BUS_BUSY_CLEAR_IN_SSSRDUMP(dhdp) \ | |
217 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_SSSRDUMP | |
218 | #define DHD_BUS_BUSY_CLEAR_IN_LOGDUMP(dhdp) \ | |
219 | (dhdp)->dhd_bus_busy_state &= ~DHD_BUS_BUSY_IN_LOGDUMP | |
220 | ||
221 | #define DHD_BUS_BUSY_CHECK_IN_TX(dhdp) \ | |
222 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_TX) | |
223 | #define DHD_BUS_BUSY_CHECK_IN_SEND_PKT(dhdp) \ | |
224 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_SEND_PKT) | |
225 | #define DHD_BUS_BUSY_CHECK_IN_DPC(dhdp) \ | |
226 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_DPC) | |
227 | #define DHD_BUS_BUSY_CHECK_IN_WD(dhdp) \ | |
228 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_WD) | |
229 | #define DHD_BUS_BUSY_CHECK_IN_IOVAR(dhdp) \ | |
230 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_IOVAR) | |
231 | #define DHD_BUS_BUSY_CHECK_IN_DHD_IOVAR(dhdp) \ | |
232 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_DHD_IOVAR) | |
233 | #define DHD_BUS_BUSY_CHECK_SUSPEND_IN_PROGRESS(dhdp) \ | |
234 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_SUSPEND_IN_PROGRESS) | |
235 | #define DHD_BUS_BUSY_CHECK_RESUME_IN_PROGRESS(dhdp) \ | |
236 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_RESUME_IN_PROGRESS) | |
237 | #define DHD_BUS_BUSY_CHECK_RPM_SUSPEND_IN_PROGRESS(dhdp) \ | |
238 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS) | |
239 | #define DHD_BUS_BUSY_CHECK_RPM_SUSPEND_DONE(dhdp) \ | |
240 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_RPM_SUSPEND_DONE) | |
241 | #define DHD_BUS_BUSY_CHECK_RPM_RESUME_IN_PROGRESS(dhdp) \ | |
242 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS) | |
243 | #define DHD_BUS_BUSY_CHECK_RPM_ALL(dhdp) \ | |
244 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_RPM_ALL) | |
245 | #define DHD_BUS_BUSY_CHECK_IN_CHECKDIED(dhdp) \ | |
246 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_CHECKDIED) | |
247 | #define DHD_BUS_BUSY_CHECK_IN_MEMDUMP(dhdp) \ | |
248 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_MEMDUMP) | |
249 | #define DHD_BUS_BUSY_CHECK_IN_SSSRDUMP(dhdp) \ | |
250 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_SSSRDUMP) | |
251 | #define DHD_BUS_BUSY_CHECK_IN_LOGDUMP(dhdp) \ | |
252 | ((dhdp)->dhd_bus_busy_state & DHD_BUS_BUSY_IN_LOGDUMP) | |
253 | #define DHD_BUS_BUSY_CHECK_IDLE(dhdp) \ | |
254 | ((dhdp)->dhd_bus_busy_state == 0) | |
255 | ||
256 | #define DHD_BUS_CHECK_SUSPEND_OR_SUSPEND_IN_PROGRESS(dhdp) \ | |
257 | ((dhdp)->busstate == DHD_BUS_SUSPEND || DHD_BUS_BUSY_CHECK_SUSPEND_IN_PROGRESS(dhdp)) | |
258 | ||
259 | #define DHD_BUS_CHECK_ANY_SUSPEND_IN_PROGRESS(dhdp) \ | |
260 | (DHD_BUS_BUSY_CHECK_SUSPEND_IN_PROGRESS(dhdp) || \ | |
261 | DHD_BUS_BUSY_CHECK_RPM_SUSPEND_IN_PROGRESS(dhdp)) | |
262 | ||
263 | #define DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(dhdp) \ | |
264 | ((dhdp)->busstate == DHD_BUS_DOWN || (dhdp)->busstate == DHD_BUS_DOWN_IN_PROGRESS) | |
265 | ||
266 | #define MAX_MTU_SZ (1600u) | |
267 | ||
268 | /* (u64)result = (u64)dividend / (u64)divisor */ | |
269 | #define DIV_U64_BY_U64(dividend, divisor) div64_u64(dividend, divisor) | |
270 | ||
271 | /* (u64)result = (u64)dividend / (u32)divisor */ | |
272 | #define DIV_U64_BY_U32(dividend, divisor) div_u64(dividend, divisor) | |
273 | ||
274 | /* Be careful while using this, as it divides dividend also | |
275 | * (u32)remainder = (u64)dividend % (u32)divisor | |
276 | * (u64)dividend = (u64)dividend / (u32)divisor | |
277 | */ | |
278 | #define DIV_AND_MOD_U64_BY_U32(dividend, divisor) do_div(dividend, divisor) | |
279 | ||
280 | /* (u32)remainder = (u64)dividend % (u32)divisor */ | |
281 | #define MOD_U64_BY_U32(dividend, divisor) ({ \ | |
282 | uint64 temp_dividend = (dividend); \ | |
283 | uint32 rem = DIV_AND_MOD_U64_BY_U32(temp_dividend, (divisor)); \ | |
284 | rem; \ | |
285 | }) | |
286 | ||
287 | #define SEC_USEC_FMT \ | |
288 | "%5llu.%06u" | |
289 | ||
290 | /* t: time in nano second */ | |
291 | #define GET_SEC_USEC(t) \ | |
292 | DIV_U64_BY_U32(t, NSEC_PER_SEC), \ | |
293 | ((uint32)(MOD_U64_BY_U32(t, NSEC_PER_SEC) / (uint32)NSEC_PER_USEC)) | |
294 | ||
295 | /* Download Types */ | |
296 | typedef enum download_type { | |
297 | FW, | |
298 | NVRAM, | |
299 | CLM_BLOB, | |
300 | TXCAP_BLOB, | |
301 | #if defined(DHD_USE_CLMINFO_PARSER) | |
302 | CLMINFO, | |
303 | #endif /* DHD_USE_CLMINFO_PARSER */ | |
304 | DOWNLOAD_TYPE_LAST | |
305 | } download_type_t; | |
306 | ||
307 | /* For supporting multiple interfaces */ | |
308 | #define DHD_MAX_IFS 16 | |
309 | #define DHD_MAX_STATIC_IFS 1 | |
310 | #define DHD_DEL_IF -0xE | |
311 | #define DHD_BAD_IF -0xF | |
312 | #define DHD_DUMMY_INFO_IF 0xDEAF /* Hack i/f to handle events from INFO Ring */ | |
313 | #define DHD_EVENT_IF DHD_DUMMY_INFO_IF | |
314 | ||
315 | enum dhd_op_flags { | |
316 | /* Firmware requested operation mode */ | |
317 | DHD_FLAG_STA_MODE = (1 << (0)), /* STA only */ | |
318 | DHD_FLAG_HOSTAP_MODE = (1 << (1)), /* SOFTAP only */ | |
319 | DHD_FLAG_P2P_MODE = (1 << (2)), /* P2P Only */ | |
320 | /* STA + P2P */ | |
321 | DHD_FLAG_CONCURR_SINGLE_CHAN_MODE = (DHD_FLAG_STA_MODE | DHD_FLAG_P2P_MODE), | |
322 | /* STA + SoftAP */ | |
323 | DHD_FLAG_CONCURR_STA_HOSTAP_MODE = (DHD_FLAG_STA_MODE | DHD_FLAG_HOSTAP_MODE), | |
324 | DHD_FLAG_CONCURR_MULTI_CHAN_MODE = (1 << (4)), /* STA + P2P */ | |
325 | /* Current P2P mode for P2P connection */ | |
326 | DHD_FLAG_P2P_GC_MODE = (1 << (5)), | |
327 | DHD_FLAG_P2P_GO_MODE = (1 << (6)), | |
328 | DHD_FLAG_MBSS_MODE = (1 << (7)), /* MBSS in future */ | |
329 | DHD_FLAG_IBSS_MODE = (1 << (8)), | |
330 | DHD_FLAG_MFG_MODE = (1 << (9)), | |
331 | DHD_FLAG_RSDB_MODE = (1 << (10)), | |
332 | DHD_FLAG_MP2P_MODE = (1 << (11)) | |
333 | }; | |
334 | ||
335 | #define DHD_OPMODE_SUPPORTED(dhd, opmode_flag) \ | |
336 | (dhd ? ((((dhd_pub_t *)dhd)->op_mode) & opmode_flag) : -1) | |
337 | #define DHD_OPMODE_STA_SOFTAP_CONCURR(dhd) \ | |
338 | (dhd ? (((((dhd_pub_t *)dhd)->op_mode) & DHD_FLAG_CONCURR_STA_HOSTAP_MODE) == \ | |
339 | DHD_FLAG_CONCURR_STA_HOSTAP_MODE) : 0) | |
340 | ||
341 | /* Max sequential TX/RX Control timeouts to set HANG event */ | |
342 | #ifndef MAX_CNTL_TX_TIMEOUT | |
343 | #define MAX_CNTL_TX_TIMEOUT 2 | |
344 | #endif /* MAX_CNTL_TX_TIMEOUT */ | |
345 | #ifndef MAX_CNTL_RX_TIMEOUT | |
346 | #define MAX_CNTL_RX_TIMEOUT 1 | |
347 | #endif /* MAX_CNTL_RX_TIMEOUT */ | |
348 | ||
349 | #define DHD_SCAN_ASSOC_ACTIVE_TIME 40 /* ms: Embedded default Active setting from DHD */ | |
350 | #define DHD_SCAN_UNASSOC_ACTIVE_TIME 80 /* ms: Embedded def. Unassoc Active setting from DHD */ | |
351 | #define DHD_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD */ | |
352 | #define DHD_SCAN_HOME_TIME 45 /* ms: Embedded default Home time setting from DHD */ | |
353 | #define DHD_SCAN_HOME_AWAY_TIME 100 /* ms: Embedded default Home Away time setting from DHD */ | |
354 | ||
355 | #ifndef POWERUP_MAX_RETRY | |
356 | #define POWERUP_MAX_RETRY 3 /* how many times we retry to power up the chip */ | |
357 | #endif // endif | |
358 | #ifndef POWERUP_WAIT_MS | |
359 | #define POWERUP_WAIT_MS 2000 /* ms: time out in waiting wifi to come up */ | |
360 | #endif // endif | |
361 | /* | |
362 | * MAX_NVRAMBUF_SIZE determines the size of the Buffer in the DHD that holds | |
363 | * the NVRAM data. That is the size of the buffer pointed by bus->vars | |
364 | * This also needs to be increased to 16K to support NVRAM size higher than 8K | |
365 | */ | |
366 | #define MAX_NVRAMBUF_SIZE (16 * 1024) /* max nvram buf size */ | |
367 | #define MAX_CLM_BUF_SIZE (48 * 1024) /* max clm blob size */ | |
368 | #define MAX_TXCAP_BUF_SIZE (16 * 1024) /* max txcap blob size */ | |
369 | #define MAX_CLMINFO_BUF_SIZE (4 * 1024) /* max clminfo buf size */ | |
370 | #ifdef DHD_DEBUG | |
371 | #define DHD_JOIN_MAX_TIME_DEFAULT 10000 /* ms: Max time out for joining AP */ | |
372 | #define DHD_SCAN_DEF_TIMEOUT 10000 /* ms: Max time out for scan in progress */ | |
373 | #endif // endif | |
374 | ||
375 | #ifndef CONFIG_BCMDHD_CLM_PATH | |
376 | #if defined(CUSTOMER_HW4) && defined(PLATFORM_SLP) | |
377 | #define CONFIG_BCMDHD_CLM_PATH "/lib/firmware/bcmdhd_clm.blob" | |
378 | #else | |
379 | #define CONFIG_BCMDHD_CLM_PATH "/etc/wifi/bcmdhd_clm.blob" | |
380 | #endif /* CUSTOMER_HW4 && PLATFORM_SLP */ | |
381 | #endif /* CONFIG_BCMDHD_CLM_PATH */ | |
382 | #define WL_CCODE_NULL_COUNTRY "#n" | |
383 | ||
384 | #define FW_VER_STR_LEN 128 | |
385 | #define CLM_VER_STR_LEN 128 | |
386 | #define BUS_API_REV_STR_LEN 128 | |
387 | extern char bus_api_revision[]; | |
388 | ||
389 | enum dhd_bus_wake_state { | |
390 | WAKE_LOCK_OFF, | |
391 | WAKE_LOCK_PRIV, | |
392 | WAKE_LOCK_DPC, | |
393 | WAKE_LOCK_IOCTL, | |
394 | WAKE_LOCK_DOWNLOAD, | |
395 | WAKE_LOCK_TMOUT, | |
396 | WAKE_LOCK_WATCHDOG, | |
397 | WAKE_LOCK_LINK_DOWN_TMOUT, | |
398 | WAKE_LOCK_PNO_FIND_TMOUT, | |
399 | WAKE_LOCK_SOFTAP_SET, | |
400 | WAKE_LOCK_SOFTAP_STOP, | |
401 | WAKE_LOCK_SOFTAP_START, | |
402 | WAKE_LOCK_SOFTAP_THREAD | |
403 | }; | |
404 | ||
405 | enum dhd_prealloc_index { | |
406 | DHD_PREALLOC_PROT = 0, | |
407 | DHD_PREALLOC_RXBUF, | |
408 | DHD_PREALLOC_DATABUF, | |
409 | DHD_PREALLOC_OSL_BUF, | |
410 | #if defined(STATIC_WL_PRIV_STRUCT) | |
411 | DHD_PREALLOC_WIPHY_ESCAN0 = 5, | |
412 | #ifdef DUAL_ESCAN_RESULT_BUFFER | |
413 | DHD_PREALLOC_WIPHY_ESCAN1, | |
414 | #endif /* DUAL_ESCAN_RESULT_BUFFER */ | |
415 | #endif /* STATIC_WL_PRIV_STRUCT */ | |
416 | DHD_PREALLOC_DHD_INFO = 7, | |
417 | DHD_PREALLOC_DHD_WLFC_INFO = 8, | |
418 | DHD_PREALLOC_IF_FLOW_LKUP = 9, | |
419 | /* 10 */ | |
420 | DHD_PREALLOC_MEMDUMP_RAM = 11, | |
421 | DHD_PREALLOC_DHD_WLFC_HANGER = 12, | |
422 | DHD_PREALLOC_PKTID_MAP = 13, | |
423 | DHD_PREALLOC_PKTID_MAP_IOCTL = 14, | |
424 | DHD_PREALLOC_DHD_LOG_DUMP_BUF = 15, | |
425 | DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16, | |
426 | DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17 | |
427 | }; | |
428 | ||
429 | enum dhd_dongledump_mode { | |
5a068558 MB |
430 | DUMP_DISABLED = 0, |
431 | DUMP_MEMONLY = 1, | |
432 | DUMP_MEMFILE = 2, | |
433 | DUMP_MEMFILE_BUGON = 3, | |
434 | DUMP_MEMFILE_MAX = 4 | |
1cac41cb MB |
435 | }; |
436 | ||
437 | enum dhd_dongledump_type { | |
5a068558 MB |
438 | DUMP_TYPE_RESUMED_ON_TIMEOUT = 1, |
439 | DUMP_TYPE_D3_ACK_TIMEOUT = 2, | |
440 | DUMP_TYPE_DONGLE_TRAP = 3, | |
441 | DUMP_TYPE_MEMORY_CORRUPTION = 4, | |
442 | DUMP_TYPE_PKTID_AUDIT_FAILURE = 5, | |
443 | DUMP_TYPE_PKTID_INVALID = 6, | |
444 | DUMP_TYPE_SCAN_TIMEOUT = 7, | |
445 | DUMP_TYPE_SCAN_BUSY = 8, | |
446 | DUMP_TYPE_BY_SYSDUMP = 9, | |
447 | DUMP_TYPE_BY_LIVELOCK = 10, | |
448 | DUMP_TYPE_AP_LINKUP_FAILURE = 11, | |
449 | DUMP_TYPE_AP_ABNORMAL_ACCESS = 12, | |
450 | DUMP_TYPE_CFG_VENDOR_TRIGGERED = 13, | |
451 | DUMP_TYPE_RESUMED_ON_TIMEOUT_TX = 14, | |
452 | DUMP_TYPE_RESUMED_ON_TIMEOUT_RX = 15, | |
453 | DUMP_TYPE_RESUMED_ON_INVALID_RING_RDWR = 16, | |
454 | DUMP_TYPE_TRANS_ID_MISMATCH = 17, | |
455 | DUMP_TYPE_IFACE_OP_FAILURE = 18, | |
456 | DUMP_TYPE_DONGLE_INIT_FAILURE = 19, | |
457 | DUMP_TYPE_READ_SHM_FAIL = 20, | |
458 | DUMP_TYPE_DONGLE_HOST_EVENT = 21, | |
459 | DUMP_TYPE_SMMU_FAULT = 22, | |
460 | DUMP_TYPE_RESUMED_UNKNOWN = 23, | |
461 | DUMP_TYPE_DUE_TO_BT = 24, | |
462 | DUMP_TYPE_LOGSET_BEYOND_RANGE = 25, | |
463 | DUMP_TYPE_BY_USER = 26, | |
464 | DUMP_TYPE_CTO_RECOVERY = 27, | |
465 | DUMP_TYPE_SEQUENTIAL_PRIVCMD_ERROR = 28 | |
1cac41cb MB |
466 | }; |
467 | ||
468 | enum dhd_hang_reason { | |
5a068558 MB |
469 | HANG_REASON_MASK = 0x8000, |
470 | HANG_REASON_IOCTL_RESP_TIMEOUT = 0x8001, | |
471 | HANG_REASON_DONGLE_TRAP = 0x8002, | |
472 | HANG_REASON_D3_ACK_TIMEOUT = 0x8003, | |
473 | HANG_REASON_BUS_DOWN = 0x8004, | |
474 | HANG_REASON_MSGBUF_LIVELOCK = 0x8006, | |
475 | HANG_REASON_IFACE_DEL_FAILURE = 0x8007, | |
476 | HANG_REASON_HT_AVAIL_ERROR = 0x8008, | |
477 | HANG_REASON_PCIE_RC_LINK_UP_FAIL = 0x8009, | |
478 | HANG_REASON_PCIE_PKTID_ERROR = 0x800A, | |
479 | HANG_REASON_IFACE_ADD_FAILURE = 0x800B, | |
480 | HANG_REASON_IOCTL_RESP_TIMEOUT_SCHED_ERROR = 0x800C, | |
481 | HANG_REASON_D3_ACK_TIMEOUT_SCHED_ERROR = 0x800D, | |
482 | HANG_REASON_SEQUENTIAL_PRIVCMD_ERROR = 0x800E, | |
483 | HANG_REASON_PCIE_LINK_DOWN = 0x8805, | |
484 | HANG_REASON_INVALID_EVENT_OR_DATA = 0x8806, | |
485 | HANG_REASON_UNKNOWN = 0x8807, | |
486 | HANG_REASON_MAX = 0x8808 | |
1cac41cb MB |
487 | }; |
488 | ||
489 | #define WLC_E_DEAUTH_MAX_REASON 0x0FFF | |
490 | ||
491 | enum dhd_rsdb_scan_features { | |
492 | /* Downgraded scan feature for AP active */ | |
493 | RSDB_SCAN_DOWNGRADED_AP_SCAN = 0x01, | |
494 | /* Downgraded scan feature for P2P Discovery */ | |
495 | RSDB_SCAN_DOWNGRADED_P2P_DISC_SCAN = 0x02, | |
496 | /* Enable channel pruning for ROAM SCAN */ | |
497 | RSDB_SCAN_DOWNGRADED_CH_PRUNE_ROAM = 0x10, | |
498 | /* Enable channel pruning for any SCAN */ | |
499 | RSDB_SCAN_DOWNGRADED_CH_PRUNE_ALL = 0x20 | |
500 | }; | |
501 | ||
502 | #define VENDOR_SEND_HANG_EXT_INFO_LEN (800 + 1) | |
503 | #define VENDOR_SEND_HANG_EXT_INFO_VER 20170905 | |
504 | #define HANG_INFO_TRAP_T_NAME_MAX 6 | |
505 | #define HANG_INFO_TRAP_T_REASON_IDX 0 | |
506 | #define HANG_INFO_TRAP_T_SUBTYPE_IDX 2 | |
507 | #define HANG_INFO_TRAP_T_OFFSET_IDX 3 | |
508 | #define HANG_INFO_TRAP_T_EPC_IDX 4 | |
509 | #define HANG_FIELD_STR_MAX_LEN 9 | |
510 | #define HANG_FIELD_CNT_MAX 69 | |
511 | #define HANG_FIELD_IF_FAILURE_CNT 10 | |
512 | #define HANG_FIELD_IOCTL_RESP_TIMEOUT_CNT 8 | |
513 | #define HANG_FIELD_TRAP_T_STACK_CNT_MAX 16 | |
514 | #define HANG_FIELD_MISMATCH_CNT 10 | |
515 | #define HANG_INFO_BIGDATA_KEY_STACK_CNT 4 | |
516 | ||
517 | #define DEBUG_DUMP_TIME_BUF_LEN (16 + 1) | |
518 | /* delimiter between values */ | |
519 | #define HANG_KEY_DEL ' ' | |
520 | #define HANG_RAW_DEL '_' | |
521 | ||
522 | enum dhd_eapol_message_type { | |
523 | EAPOL_4WAY_M1 = 1, | |
524 | EAPOL_4WAY_M2, | |
525 | EAPOL_4WAY_M3, | |
526 | EAPOL_4WAY_M4 | |
527 | }; | |
528 | ||
529 | /* Packet alignment for most efficient SDIO (can change based on platform) */ | |
530 | #ifndef DHD_SDALIGN | |
531 | #define DHD_SDALIGN 32 | |
532 | #endif // endif | |
533 | ||
534 | #define DHD_TX_CONTEXT_MASK 0xff | |
535 | #define DHD_TX_START_XMIT 0x01 | |
536 | #define DHD_TX_SEND_PKT 0x02 | |
537 | #define DHD_IF_SET_TX_ACTIVE(ifp, context) \ | |
538 | ifp->tx_paths_active |= context; | |
539 | #define DHD_IF_CLR_TX_ACTIVE(ifp, context) \ | |
540 | ifp->tx_paths_active &= ~context; | |
541 | #define DHD_IF_IS_TX_ACTIVE(ifp) \ | |
542 | (ifp->tx_paths_active) | |
543 | /** | |
544 | * DMA-able buffer parameters | |
545 | * - dmaaddr_t is 32bits on a 32bit host. | |
546 | * dhd_dma_buf::pa may not be used as a sh_addr_t, bcm_addr64_t or uintptr | |
547 | * - dhd_dma_buf::_alloced is ONLY for freeing a DMA-able buffer. | |
548 | */ | |
549 | typedef struct dhd_dma_buf { | |
550 | void *va; /* virtual address of buffer */ | |
551 | uint32 len; /* user requested buffer length */ | |
552 | dmaaddr_t pa; /* physical address of buffer */ | |
553 | void *dmah; /* dma mapper handle */ | |
554 | void *secdma; /* secure dma sec_cma_info handle */ | |
555 | uint32 _alloced; /* actual size of buffer allocated with align and pad */ | |
556 | } dhd_dma_buf_t; | |
557 | ||
558 | /* host reordering packts logic */ | |
559 | /* followed the structure to hold the reorder buffers (void **p) */ | |
560 | typedef struct reorder_info { | |
561 | void **p; | |
562 | uint8 flow_id; | |
563 | uint8 cur_idx; | |
564 | uint8 exp_idx; | |
565 | uint8 max_idx; | |
566 | uint8 pend_pkts; | |
567 | } reorder_info_t; | |
568 | ||
569 | /* throughput test packet format */ | |
570 | typedef struct tput_pkt { | |
571 | /* header */ | |
572 | uint8 mac_sta[ETHER_ADDR_LEN]; | |
573 | uint8 mac_ap[ETHER_ADDR_LEN]; | |
574 | uint16 pkt_type; | |
575 | uint8 PAD[2]; | |
576 | /* data */ | |
577 | uint32 crc32; | |
578 | uint32 pkt_id; | |
579 | uint32 num_pkts; | |
580 | } tput_pkt_t; | |
581 | ||
582 | typedef enum { | |
583 | TPUT_PKT_TYPE_NORMAL, | |
584 | TPUT_PKT_TYPE_STOP | |
585 | } tput_pkt_type_t; | |
586 | ||
587 | #define TPUT_TEST_MAX_PAYLOAD 1500 | |
588 | #define TPUT_TEST_WAIT_TIMEOUT_DEFAULT 5000 | |
589 | ||
590 | #ifdef DHDTCPACK_SUPPRESS | |
591 | ||
592 | enum { | |
593 | /* TCPACK suppress off */ | |
594 | TCPACK_SUP_OFF, | |
595 | /* Replace TCPACK in txq when new coming one has higher ACK number. */ | |
596 | TCPACK_SUP_REPLACE, | |
597 | /* TCPACK_SUP_REPLACE + delayed TCPACK TX unless ACK to PSH DATA. | |
598 | * This will give benefits to Half-Duplex bus interface(e.g. SDIO) that | |
599 | * 1. we are able to read TCP DATA packets first from the bus | |
600 | * 2. TCPACKs that don't need to hurry delivered remains longer in TXQ so can be suppressed. | |
601 | */ | |
602 | TCPACK_SUP_DELAYTX, | |
603 | TCPACK_SUP_HOLD, | |
604 | TCPACK_SUP_LAST_MODE | |
605 | }; | |
606 | #endif /* DHDTCPACK_SUPPRESS */ | |
607 | ||
608 | #define DHD_NULL_CHK_AND_RET(cond) \ | |
609 | if (!cond) { \ | |
610 | DHD_ERROR(("%s " #cond " is NULL\n", __FUNCTION__)); \ | |
611 | return; \ | |
612 | } | |
613 | ||
614 | #define DHD_NULL_CHK_AND_RET_VAL(cond, value) \ | |
615 | if (!cond) { \ | |
616 | DHD_ERROR(("%s " #cond " is NULL\n", __FUNCTION__)); \ | |
617 | return value; \ | |
618 | } | |
619 | ||
620 | #define DHD_NULL_CHK_AND_GOTO(cond, label) \ | |
621 | if (!cond) { \ | |
622 | DHD_ERROR(("%s " #cond " is NULL\n", __FUNCTION__)); \ | |
623 | goto label; \ | |
624 | } | |
625 | ||
626 | /* | |
627 | * Accumulating the queue lengths of all flowring queues in a parent object, | |
628 | * to assert flow control, when the cummulative queue length crosses an upper | |
629 | * threshold defined on a parent object. Upper threshold may be maintained | |
630 | * at a station level, at an interface level, or at a dhd instance. | |
631 | * | |
632 | * cumm_ctr_t abstraction: | |
633 | * cumm_ctr_t abstraction may be enhanced to use an object with a hysterisis | |
634 | * pause on/off threshold callback. | |
635 | * All macros use the address of the cummulative length in the parent objects. | |
636 | * | |
637 | * BCM_GMAC3 builds use a single perimeter lock, as opposed to a per queue lock. | |
638 | * Cummulative counters in parent objects may be updated without spinlocks. | |
639 | * | |
640 | * In non BCM_GMAC3, if a cummulative queue length is desired across all flows | |
641 | * belonging to either of (a station, or an interface or a dhd instance), then | |
642 | * an atomic operation is required using an atomic_t cummulative counters or | |
643 | * using a spinlock. BCM_ROUTER_DHD uses the Linux atomic_t construct. | |
644 | */ | |
645 | ||
646 | /* Cummulative length not supported. */ | |
647 | typedef uint32 cumm_ctr_t; | |
648 | #define DHD_CUMM_CTR_PTR(clen) ((cumm_ctr_t*)(clen)) | |
649 | #define DHD_CUMM_CTR(clen) *(DHD_CUMM_CTR_PTR(clen)) /* accessor */ | |
650 | #define DHD_CUMM_CTR_READ(clen) DHD_CUMM_CTR(clen) /* read access */ | |
651 | #define DHD_CUMM_CTR_INIT(clen) \ | |
652 | ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL)); | |
653 | #define DHD_CUMM_CTR_INCR(clen) \ | |
654 | ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL)); | |
655 | #define DHD_CUMM_CTR_DECR(clen) \ | |
656 | ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL)); | |
657 | ||
658 | #if defined(WLTDLS) && defined(PCIE_FULL_DONGLE) | |
659 | struct tdls_peer_node { | |
660 | uint8 addr[ETHER_ADDR_LEN]; | |
661 | struct tdls_peer_node *next; | |
662 | }; | |
663 | typedef struct tdls_peer_node tdls_peer_node_t; | |
664 | typedef struct { | |
665 | tdls_peer_node_t *node; | |
666 | uint8 tdls_peer_count; | |
667 | } tdls_peer_tbl_t; | |
668 | #endif /* defined(WLTDLS) && defined(PCIE_FULL_DONGLE) */ | |
669 | ||
670 | #ifdef DHD_LOG_DUMP | |
671 | #define LOG_DUMP_MAGIC 0xDEB3DEB3 | |
672 | #define HEALTH_CHK_BUF_SIZE 256 | |
673 | ||
674 | #ifdef DEBUGABILITY_ECNTRS_LOGGING | |
675 | #define ECNTR_RING_ID 0xECDB | |
676 | #define ECNTR_RING_NAME "ewp_ecntr_ring" | |
677 | #endif /* DEBUGABILITY_ECNTRS_LOGGING */ | |
678 | ||
679 | #if defined(DEBUGABILITY) && defined(DEBUGABILITY_ECNTRS_LOGGING) | |
680 | #error "Duplicate rings will be created since both the features are enabled" | |
681 | #endif /* DEBUGABILITY && DEBUGABILITY_ECNTRS_LOGGING */ | |
682 | ||
683 | typedef enum { | |
684 | LOG_DUMP_SECTION_GENERAL = 0, | |
685 | LOG_DUMP_SECTION_ECNTRS, | |
686 | LOG_DUMP_SECTION_SPECIAL, | |
687 | LOG_DUMP_SECTION_DHD_DUMP, | |
688 | LOG_DUMP_SECTION_EXT_TRAP, | |
689 | LOG_DUMP_SECTION_HEALTH_CHK, | |
690 | LOG_DUMP_SECTION_PRESERVE, | |
691 | LOG_DUMP_SECTION_COOKIE, | |
692 | LOG_DUMP_SECTION_FLOWRING | |
693 | } log_dump_section_type_t; | |
694 | ||
695 | /* Each section in the debug_dump log file shall begin with a header */ | |
696 | typedef struct { | |
697 | uint32 magic; /* 0xDEB3DEB3 */ | |
698 | uint32 type; /* of type log_dump_section_type_t */ | |
699 | uint64 timestamp; | |
700 | uint32 length; /* length of the section that follows */ | |
701 | uint32 pad; | |
702 | } log_dump_section_hdr_t; | |
703 | ||
704 | /* below structure describe ring buffer. */ | |
705 | struct dhd_log_dump_buf | |
706 | { | |
707 | spinlock_t lock; | |
708 | void *dhd_pub; | |
709 | unsigned int enable; | |
710 | unsigned int wraparound; | |
711 | unsigned long max; | |
712 | unsigned int remain; | |
713 | char* present; | |
714 | char* front; | |
715 | char* buffer; | |
716 | }; | |
717 | ||
718 | #define DHD_LOG_DUMP_MAX_TEMP_BUFFER_SIZE 256 | |
719 | #define DHD_LOG_DUMP_MAX_TAIL_FLUSH_SIZE (80 * 1024) | |
720 | ||
721 | extern void dhd_log_dump_write(int type, char *binary_data, | |
722 | int binary_len, const char *fmt, ...); | |
723 | extern char *dhd_log_dump_get_timestamp(void); | |
724 | bool dhd_log_dump_ecntr_enabled(void); | |
725 | #endif /* DHD_LOG_DUMP */ | |
726 | ||
727 | /* DEBUG_DUMP SUB COMMAND */ | |
728 | enum { | |
729 | CMD_DEFAULT, | |
730 | CMD_UNWANTED, | |
731 | CMD_DISCONNECTED, | |
732 | CMD_MAX | |
733 | }; | |
734 | ||
735 | #define DHD_LOG_DUMP_TS_MULTIPLIER_VALUE 60 | |
736 | #define DHD_LOG_DUMP_TS_FMT_YYMMDDHHMMSSMSMS "%02d%02d%02d%02d%02d%02d%04d" | |
737 | #define DHD_DEBUG_DUMP_TYPE "debug_dump_FORUSER" | |
738 | #define DHD_DUMP_SUBSTR_UNWANTED "_unwanted" | |
739 | #define DHD_DUMP_SUBSTR_DISCONNECTED "_disconnected" | |
740 | ||
741 | extern void get_debug_dump_time(char *str); | |
742 | extern void clear_debug_dump_time(char *str); | |
743 | #if defined(WL_CFGVENDOR_SEND_HANG_EVENT) || defined(DHD_PKT_LOGGING) | |
744 | extern void copy_debug_dump_time(char *dest, char *src); | |
745 | #endif /* WL_CFGVENDOR_SEND_HANG_EVENT || DHD_PKT_LOGGING */ | |
746 | ||
747 | #define WL_MAX_PRESERVE_BUFFER 8 | |
748 | #define FW_LOGSET_MASK_ALL 0xFF | |
749 | ||
750 | #ifdef WL_MONITOR | |
751 | #define MONPKT_EXTRA_LEN 48u | |
752 | #endif /* WL_MONITOR */ | |
753 | ||
754 | #define DHDIF_FWDER(dhdif) FALSE | |
755 | ||
756 | #if defined(CUSTOMER_HW4) | |
757 | #if defined(ANDROID_PLATFORM_VERSION) | |
758 | #if (ANDROID_PLATFORM_VERSION >= 9) | |
759 | #ifdef DHD_COMMON_DUMP_PATH | |
760 | #undef DHD_COMMON_DUMP_PATH | |
761 | #endif /* DHD_COMMON_DUMP_PATH */ | |
762 | #if defined(BCM4361_CHIP) || defined(BCM4359_CHIP) || defined(BCM43456_CHIP) | |
763 | #define DHD_COMMON_DUMP_PATH "/data/log/wifi/" | |
764 | #else | |
765 | #define DHD_COMMON_DUMP_PATH "/data/vendor/log/wifi/" | |
766 | #endif /* BCM4361_CHIP || BCM4359_CHIP || BCM43456_CHIP */ | |
767 | #endif /* ANDROID_PLATFORM_VERSION >= 9 */ | |
768 | #endif /* ANDROID_PLATFORM_VERSION */ | |
769 | #ifndef DHD_COMMON_DUMP_PATH | |
770 | #define DHD_COMMON_DUMP_PATH "/data/media/wifi/log/" | |
771 | #endif /* !DHD_COMMON_DUMP_PATH */ | |
772 | #else | |
773 | #define DHD_COMMON_DUMP_PATH "/installmedia/" | |
774 | #endif /* CUSTOMER_HW4 */ | |
775 | ||
776 | struct cntry_locales_custom { | |
777 | char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */ | |
778 | char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */ | |
779 | int32 custom_locale_rev; /* Custom local revisin default -1 */ | |
780 | }; | |
781 | ||
782 | int dhd_send_msg_to_daemon(struct sk_buff *skb, void *data, int size); | |
783 | ||
784 | #ifdef DMAMAP_STATS | |
785 | typedef struct dmamap_stats { | |
786 | uint64 txdata; | |
787 | uint64 txdata_sz; | |
788 | uint64 rxdata; | |
789 | uint64 rxdata_sz; | |
790 | uint64 ioctl_rx; | |
791 | uint64 ioctl_rx_sz; | |
792 | uint64 event_rx; | |
793 | uint64 event_rx_sz; | |
794 | uint64 info_rx; | |
795 | uint64 info_rx_sz; | |
796 | uint64 tsbuf_rx; | |
797 | uint64 tsbuf_rx_sz; | |
798 | } dma_stats_t; | |
799 | #endif /* DMAMAP_STATS */ | |
800 | ||
801 | /* see wlfc_proto.h for tx status details */ | |
802 | #define DHD_MAX_TX_STATUS_MSGS 9u | |
803 | ||
804 | #ifdef TX_STATUS_LATENCY_STATS | |
805 | typedef struct dhd_if_tx_status_latency { | |
806 | /* total number of tx_status received on this interface */ | |
807 | uint64 num_tx_status; | |
808 | /* cumulative tx_status latency for this interface */ | |
809 | uint64 cum_tx_status_latency; | |
810 | } dhd_if_tx_status_latency_t; | |
811 | #endif /* TX_STATUS_LATENCY_STATS */ | |
812 | ||
813 | /** | |
814 | * Common structure for module and instance linkage. | |
815 | * Instantiated once per hardware (dongle) instance that this DHD manages. | |
816 | */ | |
817 | typedef struct dhd_pub { | |
818 | /* Linkage ponters */ | |
819 | osl_t *osh; /* OSL handle */ | |
820 | struct dhd_bus *bus; /* Bus module handle */ | |
821 | struct dhd_prot *prot; /* Protocol module handle */ | |
822 | struct dhd_info *info; /* Info module handle */ | |
823 | struct dhd_dbg *dbg; /* Debugability module handle */ | |
824 | ||
825 | /* to NDIS developer, the structure dhd_common is redundant, | |
826 | * please do NOT merge it back from other branches !!! | |
827 | */ | |
828 | ||
829 | /* Internal dhd items */ | |
830 | bool up; /* Driver up/down (to OS) */ | |
831 | #ifdef WL_CFG80211 | |
832 | spinlock_t up_lock; /* Synchronization with CFG80211 down */ | |
833 | #endif /* WL_CFG80211 */ | |
834 | bool txoff; /* Transmit flow-controlled */ | |
835 | bool dongle_reset; /* TRUE = DEVRESET put dongle into reset */ | |
836 | enum dhd_bus_state busstate; | |
837 | uint dhd_bus_busy_state; /* Bus busy state */ | |
838 | uint hdrlen; /* Total DHD header length (proto + bus) */ | |
839 | uint maxctl; /* Max size rxctl request from proto to bus */ | |
840 | uint rxsz; /* Rx buffer size bus module should use */ | |
841 | uint8 wme_dp; /* wme discard priority */ | |
842 | ||
843 | /* Dongle media info */ | |
844 | bool iswl; /* Dongle-resident driver is wl */ | |
845 | ulong drv_version; /* Version of dongle-resident driver */ | |
846 | struct ether_addr mac; /* MAC address obtained from dongle */ | |
847 | dngl_stats_t dstats; /* Stats for dongle-based data */ | |
848 | ||
849 | /* Additional stats for the bus level */ | |
850 | ulong tx_packets; /* Data packets sent to dongle */ | |
851 | ulong tx_dropped; /* Data packets dropped in dhd */ | |
852 | ulong tx_multicast; /* Multicast data packets sent to dongle */ | |
853 | ulong tx_errors; /* Errors in sending data to dongle */ | |
854 | ulong tx_ctlpkts; /* Control packets sent to dongle */ | |
855 | ulong tx_ctlerrs; /* Errors sending control frames to dongle */ | |
856 | ulong rx_packets; /* Packets sent up the network interface */ | |
857 | ulong rx_multicast; /* Multicast packets sent up the network interface */ | |
858 | ulong rx_errors; /* Errors processing rx data packets */ | |
859 | ulong rx_ctlpkts; /* Control frames processed from dongle */ | |
860 | ulong rx_ctlerrs; /* Errors in processing rx control frames */ | |
861 | ulong rx_dropped; /* Packets dropped locally (no memory) */ | |
862 | ulong rx_flushed; /* Packets flushed due to unscheduled sendup thread */ | |
863 | ulong wd_dpc_sched; /* Number of times dhd dpc scheduled by watchdog timer */ | |
864 | ulong rx_pktgetfail; /* Number of PKTGET failures in DHD on RX */ | |
865 | ulong tx_pktgetfail; /* Number of PKTGET failures in DHD on TX */ | |
866 | ulong rx_readahead_cnt; /* Number of packets where header read-ahead was used. */ | |
867 | ulong tx_realloc; /* Number of tx packets we had to realloc for headroom */ | |
868 | ulong fc_packets; /* Number of flow control pkts recvd */ | |
869 | ulong tx_big_packets; /* Dropped data packets that are larger than MAX_MTU_SZ */ | |
870 | #ifdef DMAMAP_STATS | |
871 | /* DMA Mapping statistics */ | |
872 | dma_stats_t dma_stats; | |
873 | #endif /* DMAMAP_STATS */ | |
874 | ||
875 | /* Last error return */ | |
876 | int bcmerror; | |
877 | uint tickcnt; | |
878 | ||
879 | /* Last error from dongle */ | |
880 | int dongle_error; | |
881 | ||
882 | uint8 country_code[WLC_CNTRY_BUF_SZ]; | |
883 | ||
884 | /* Suspend disable flag and "in suspend" flag */ | |
885 | int suspend_disable_flag; /* "1" to disable all extra powersaving during suspend */ | |
886 | int in_suspend; /* flag set to 1 when early suspend called */ | |
887 | #ifdef PNO_SUPPORT | |
888 | int pno_enable; /* pno status : "1" is pno enable */ | |
889 | int pno_suspend; /* pno suspend status : "1" is pno suspended */ | |
890 | #endif /* PNO_SUPPORT */ | |
891 | /* DTIM skip value, default 0(or 1) means wake each DTIM | |
892 | * 3 means skip 2 DTIMs and wake up 3rd DTIM(9th beacon when AP DTIM is 3) | |
893 | */ | |
894 | int suspend_bcn_li_dtim; /* bcn_li_dtim value in suspend mode */ | |
895 | #ifdef PKT_FILTER_SUPPORT | |
896 | int early_suspended; /* Early suspend status */ | |
897 | int dhcp_in_progress; /* DHCP period */ | |
898 | #endif // endif | |
899 | ||
900 | /* Pkt filter defination */ | |
901 | char * pktfilter[100]; | |
902 | int pktfilter_count; | |
903 | ||
904 | wl_country_t dhd_cspec; /* Current Locale info */ | |
905 | #ifdef CUSTOM_COUNTRY_CODE | |
906 | uint dhd_cflags; | |
907 | #endif /* CUSTOM_COUNTRY_CODE */ | |
908 | #if defined(DHD_BLOB_EXISTENCE_CHECK) | |
909 | bool is_blob; /* Checking for existance of Blob file */ | |
910 | #endif /* DHD_BLOB_EXISTENCE_CHECK */ | |
911 | bool force_country_change; | |
912 | char eventmask[WL_EVENTING_MASK_LEN]; | |
913 | int op_mode; /* STA, HostAPD, WFD, SoftAP */ | |
914 | ||
915 | /* Set this to 1 to use a seperate interface (p2p0) for p2p operations. | |
916 | * For ICS MR1 releases it should be disable to be compatable with ICS MR1 Framework | |
917 | * see target dhd-cdc-sdmmc-panda-cfg80211-icsmr1-gpl-debug in Makefile | |
918 | */ | |
919 | /* #define WL_ENABLE_P2P_IF 1 */ | |
920 | ||
921 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
922 | struct mutex wl_start_stop_lock; /* lock/unlock for Android start/stop */ | |
923 | struct mutex wl_softap_lock; /* lock/unlock for any SoftAP/STA settings */ | |
924 | #endif // endif | |
925 | ||
926 | #ifdef PROP_TXSTATUS | |
927 | bool wlfc_enabled; | |
928 | int wlfc_mode; | |
929 | void* wlfc_state; | |
930 | /* | |
931 | Mode in which the dhd flow control shall operate. Must be set before | |
932 | traffic starts to the device. | |
933 | 0 - Do not do any proptxtstatus flow control | |
934 | 1 - Use implied credit from a packet status | |
935 | 2 - Use explicit credit | |
936 | 3 - Only AMPDU hostreorder used. no wlfc. | |
937 | */ | |
938 | uint8 proptxstatus_mode; | |
939 | bool proptxstatus_txoff; | |
940 | bool proptxstatus_module_ignore; | |
941 | bool proptxstatus_credit_ignore; | |
942 | bool proptxstatus_txstatus_ignore; | |
943 | ||
944 | bool wlfc_rxpkt_chk; | |
945 | #ifdef LIMIT_BORROW | |
946 | bool wlfc_borrow_allowed; | |
947 | #endif /* LIMIT_BORROW */ | |
948 | /* | |
949 | * implement below functions in each platform if needed. | |
950 | */ | |
951 | /* platform specific function whether to skip flow control */ | |
952 | bool (*skip_fc)(void * dhdp, uint8 ifx); | |
953 | /* platform specific function for wlfc_enable and wlfc_deinit */ | |
954 | void (*plat_init)(void *dhd); | |
955 | void (*plat_deinit)(void *dhd); | |
956 | #ifdef DHD_WLFC_THREAD | |
957 | bool wlfc_thread_go; | |
958 | struct task_struct* wlfc_thread; | |
959 | wait_queue_head_t wlfc_wqhead; | |
960 | #endif /* DHD_WLFC_THREAD */ | |
961 | #endif /* PROP_TXSTATUS */ | |
962 | #ifdef PNO_SUPPORT | |
963 | void *pno_state; | |
964 | #endif // endif | |
965 | #ifdef RTT_SUPPORT | |
966 | void *rtt_state; | |
967 | #endif // endif | |
968 | #ifdef ROAM_AP_ENV_DETECTION | |
969 | bool roam_env_detection; | |
970 | #endif // endif | |
971 | bool dongle_isolation; | |
972 | bool is_pcie_watchdog_reset; | |
973 | bool dongle_trap_occured; /* flag for sending HANG event to upper layer */ | |
974 | bool iovar_timeout_occured; /* flag to indicate iovar resumed on timeout */ | |
975 | bool is_sched_error; /* flag to indicate timeout due to scheduling issue */ | |
976 | #ifdef PCIE_FULL_DONGLE | |
977 | bool d3ack_timeout_occured; /* flag to indicate d3ack resumed on timeout */ | |
978 | #endif /* PCIE_FULL_DONGLE */ | |
979 | #ifdef BT_OVER_SDIO | |
980 | bool is_bt_recovery_required; | |
981 | #endif // endif | |
982 | #ifdef DHD_MAP_LOGGING | |
983 | bool smmu_fault_occurred; /* flag to indicate SMMU Fault */ | |
984 | #endif /* DHD_MAP_LOGGING */ | |
985 | int hang_was_sent; | |
986 | int rxcnt_timeout; /* counter rxcnt timeout to send HANG */ | |
987 | int txcnt_timeout; /* counter txcnt timeout to send HANG */ | |
988 | #ifdef BCMPCIE | |
989 | int d3ackcnt_timeout; /* counter d3ack timeout to send HANG */ | |
990 | #endif /* BCMPCIE */ | |
991 | bool hang_report; /* enable hang report by default */ | |
992 | uint16 hang_reason; /* reason codes for HANG event */ | |
993 | #if defined(DHD_HANG_SEND_UP_TEST) | |
994 | uint req_hang_type; | |
995 | #endif /* DHD_HANG_SEND_UP_TEST */ | |
996 | #if defined(CONFIG_BCM_DETECT_CONSECUTIVE_HANG) | |
997 | uint hang_counts; | |
998 | #endif /* CONFIG_BCM_DETECT_CONSECUTIVE_HANG */ | |
999 | #ifdef WLTDLS | |
1000 | bool tdls_enable; | |
1001 | #endif // endif | |
1002 | struct reorder_info *reorder_bufs[WLHOST_REORDERDATA_MAXFLOWS]; | |
1003 | #define WLC_IOCTL_MAXBUF_FWCAP 1024 | |
1004 | char fw_capabilities[WLC_IOCTL_MAXBUF_FWCAP]; | |
1005 | #define MAXSKBPEND 1024 | |
1006 | void *skbbuf[MAXSKBPEND]; | |
1007 | uint32 store_idx; | |
1008 | uint32 sent_idx; | |
1009 | #ifdef DHDTCPACK_SUPPRESS | |
1010 | uint8 tcpack_sup_mode; /* TCPACK suppress mode */ | |
1011 | void *tcpack_sup_module; /* TCPACK suppress module */ | |
1012 | uint32 tcpack_sup_ratio; | |
1013 | uint32 tcpack_sup_delay; | |
1014 | #endif /* DHDTCPACK_SUPPRESS */ | |
1015 | #if defined(ARP_OFFLOAD_SUPPORT) | |
1016 | uint32 arp_version; | |
1017 | #endif // endif | |
1018 | #if defined(BCMSUP_4WAY_HANDSHAKE) | |
1019 | bool fw_4way_handshake; /* Whether firmware will to do the 4way handshake. */ | |
1020 | #endif // endif | |
1021 | #ifdef DEBUG_DPC_THREAD_WATCHDOG | |
1022 | bool dhd_bug_on; | |
1023 | #endif /* DEBUG_DPC_THREAD_WATCHDOG */ | |
1024 | #ifdef CUSTOM_SET_CPUCORE | |
1025 | struct task_struct * current_dpc; | |
1026 | struct task_struct * current_rxf; | |
1027 | int chan_isvht80; | |
1028 | #endif /* CUSTOM_SET_CPUCORE */ | |
1029 | #ifdef ARGOS_CPU_SCHEDULER | |
1030 | cpumask_var_t default_cpu_mask; | |
1031 | cpumask_var_t dpc_affinity_cpu_mask; | |
1032 | cpumask_var_t rxf_affinity_cpu_mask; | |
1033 | bool affinity_isdpc; | |
1034 | bool affinity_isrxf; | |
1035 | #endif /* ARGOS_CPU_SCHEDULER */ | |
1036 | ||
1037 | void *sta_pool; /* pre-allocated pool of sta objects */ | |
1038 | void *staid_allocator; /* allocator of sta indexes */ | |
1039 | #ifdef PCIE_FULL_DONGLE | |
1040 | bool flow_rings_inited; /* set this flag after initializing flow rings */ | |
1041 | #endif /* PCIE_FULL_DONGLE */ | |
1042 | void *flowid_allocator; /* unique flowid allocator */ | |
1043 | void *flow_ring_table; /* flow ring table, include prot and bus info */ | |
1044 | void *if_flow_lkup; /* per interface flowid lkup hash table */ | |
1045 | void *flowid_lock; /* per os lock for flowid info protection */ | |
1046 | void *flowring_list_lock; /* per os lock for flowring list protection */ | |
1047 | uint32 num_flow_rings; | |
1048 | cumm_ctr_t cumm_ctr; /* cumm queue length placeholder */ | |
1049 | cumm_ctr_t l2cumm_ctr; /* level 2 cumm queue length placeholder */ | |
1050 | uint32 d2h_sync_mode; /* D2H DMA completion sync mode */ | |
1051 | uint8 flow_prio_map[NUMPRIO]; | |
1052 | uint8 flow_prio_map_type; | |
1053 | char enable_log[MAX_EVENT]; | |
1054 | bool dma_d2h_ring_upd_support; | |
1055 | bool dma_h2d_ring_upd_support; | |
1056 | bool dma_ring_upd_overwrite; /* host overwrites support setting */ | |
1057 | ||
1058 | bool idma_enable; | |
1059 | uint idma_inited; | |
1060 | ||
1061 | bool ifrm_enable; /* implicit frm enable */ | |
1062 | uint ifrm_inited; /* implicit frm init */ | |
1063 | ||
1064 | bool dar_enable; /* use DAR registers */ | |
1065 | uint dar_inited; | |
1066 | ||
1067 | bool fast_delete_ring_support; /* fast delete ring supported */ | |
1068 | ||
1069 | #ifdef DHD_L2_FILTER | |
1070 | unsigned long l2_filter_cnt; /* for L2_FILTER ARP table timeout */ | |
1071 | #endif /* DHD_L2_FILTER */ | |
1072 | #ifdef DHD_SSSR_DUMP | |
1073 | bool sssr_inited; | |
1074 | sssr_reg_info_v1_t sssr_reg_info; | |
1075 | uint8 *sssr_mempool; | |
1076 | uint *sssr_d11_before[MAX_NUM_D11CORES]; | |
1077 | uint *sssr_d11_after[MAX_NUM_D11CORES]; | |
1078 | bool sssr_d11_outofreset[MAX_NUM_D11CORES]; | |
1079 | uint *sssr_dig_buf_before; | |
1080 | uint *sssr_dig_buf_after; | |
1081 | #endif /* DHD_SSSR_DUMP */ | |
1082 | uint8 *soc_ram; | |
1083 | uint32 soc_ram_length; | |
1084 | uint32 memdump_type; | |
1085 | #ifdef DHD_FW_COREDUMP | |
1086 | uint32 memdump_enabled; | |
1087 | #ifdef DHD_DEBUG_UART | |
1088 | bool memdump_success; | |
1089 | #endif /* DHD_DEBUG_UART */ | |
1090 | #endif /* DHD_FW_COREDUMP */ | |
1091 | #ifdef PCIE_FULL_DONGLE | |
1092 | #ifdef WLTDLS | |
1093 | tdls_peer_tbl_t peer_tbl; | |
1094 | #endif /* WLTDLS */ | |
1095 | uint8 tx_in_progress; | |
1096 | #endif /* PCIE_FULL_DONGLE */ | |
1097 | #ifdef DHD_ULP | |
1098 | void *dhd_ulp; | |
1099 | #endif // endif | |
1100 | #if defined(KEEP_KR_REGREV) || defined(KEEP_JP_REGREV) | |
1101 | char vars_ccode[WLC_CNTRY_BUF_SZ]; | |
1102 | uint vars_regrev; | |
1103 | #endif /* KEEP_KR_REGREV || KEEP_JP_REGREV */ | |
1104 | #ifdef WLTDLS | |
1105 | uint32 tdls_mode; | |
1106 | #endif // endif | |
1107 | #ifdef GSCAN_SUPPORT | |
1108 | bool lazy_roam_enable; | |
1109 | #endif // endif | |
1110 | #if defined(PKT_FILTER_SUPPORT) && defined(APF) | |
1111 | bool apf_set; | |
1112 | #endif /* PKT_FILTER_SUPPORT && APF */ | |
1113 | void *macdbg_info; | |
1114 | #ifdef DHD_WET | |
1115 | void *wet_info; | |
1116 | #endif // endif | |
1117 | bool h2d_phase_supported; | |
1118 | bool force_dongletrap_on_bad_h2d_phase; | |
1119 | uint32 dongle_trap_data; | |
1120 | bool fw_download_done; | |
1121 | trap_t last_trap_info; /* trap info from the last trap */ | |
1122 | uint8 rand_mac_oui[DOT11_OUI_LEN]; | |
1123 | #ifdef DHD_LOSSLESS_ROAMING | |
1124 | uint8 dequeue_prec_map; | |
1125 | uint8 prio_8021x; | |
1126 | #endif // endif | |
1127 | #ifdef WL_NATOE | |
1128 | struct dhd_nfct_info *nfct; | |
1129 | spinlock_t nfct_lock; | |
1130 | #endif /* WL_NATOE */ | |
1131 | /* timesync link */ | |
1132 | struct dhd_ts *ts; | |
1133 | bool d2h_hostrdy_supported; | |
1134 | #ifdef DHD_PCIE_NATIVE_RUNTIMEPM | |
1135 | atomic_t block_bus; | |
1136 | #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ | |
1137 | #if defined(DBG_PKT_MON) || defined(DHD_PKT_LOGGING) | |
1138 | bool d11_tx_status; | |
1139 | #endif /* DBG_PKT_MON || DHD_PKT_LOGGING */ | |
1140 | uint16 ndo_version; /* ND offload version supported */ | |
1141 | #ifdef NDO_CONFIG_SUPPORT | |
1142 | bool ndo_enable; /* ND offload feature enable */ | |
1143 | bool ndo_host_ip_overflow; /* # of host ip addr exceed FW capacity */ | |
1144 | uint32 ndo_max_host_ip; /* # of host ip addr supported by FW */ | |
1145 | #endif /* NDO_CONFIG_SUPPORT */ | |
1146 | #if defined(DHD_LOG_DUMP) | |
1147 | /* buffer to hold 'dhd dump' data before dumping to file */ | |
1148 | uint8 *concise_dbg_buf; | |
1149 | uint64 last_file_posn; | |
1150 | int logdump_periodic_flush; | |
1151 | /* ecounter debug ring */ | |
1152 | #ifdef DEBUGABILITY_ECNTRS_LOGGING | |
1153 | void *ecntr_dbg_ring; | |
1154 | #endif // endif | |
1155 | #ifdef DNGL_EVENT_SUPPORT | |
1156 | uint8 health_chk_event_data[HEALTH_CHK_BUF_SIZE]; | |
1157 | #endif // endif | |
1158 | void *logdump_cookie; | |
1159 | #endif /* DHD_LOG_DUMP */ | |
1160 | uint32 dhd_console_ms; /** interval for polling the dongle for console (log) messages */ | |
1161 | bool ext_trap_data_supported; | |
1162 | uint32 *extended_trap_data; | |
1163 | #ifdef DUMP_IOCTL_IOV_LIST | |
1164 | /* dump iovar list */ | |
1165 | dll_t dump_iovlist_head; | |
1166 | uint8 dump_iovlist_len; | |
1167 | #endif /* DUMP_IOCTL_IOV_LIST */ | |
1168 | #ifdef CUSTOM_SET_ANTNPM | |
1169 | uint32 mimo_ant_set; | |
1170 | #endif /* CUSTOM_SET_ANTNPM */ | |
1171 | #ifdef CUSTOM_SET_OCLOFF | |
1172 | bool ocl_off; | |
1173 | #endif /* CUSTOM_SET_OCLOFF */ | |
1174 | #ifdef DHD_DEBUG | |
1175 | /* memwaste feature */ | |
1176 | dll_t mw_list_head; /* memwaste list head */ | |
1177 | uint32 mw_id; /* memwaste list unique id */ | |
1178 | #endif /* DHD_DEBUG */ | |
1179 | #ifdef WLTDLS | |
1180 | spinlock_t tdls_lock; | |
1181 | #endif /* WLTDLS */ | |
1182 | uint pcie_txs_metadata_enable; | |
1183 | uint wbtext_policy; /* wbtext policy of dongle */ | |
1184 | bool wbtext_support; /* for product policy only */ | |
1185 | #ifdef SHOW_LOGTRACE | |
1186 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
1187 | struct mutex dhd_trace_lock; | |
1188 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ | |
1189 | #endif /* SHOW_LOGTRACE */ | |
1190 | ||
1191 | bool max_dtim_enable; /* use MAX bcn_li_dtim value in suspend mode */ | |
1192 | tput_test_t tput_data; | |
1193 | uint64 tput_start_ts; | |
1194 | uint64 tput_stop_ts; | |
1195 | #ifdef WL_MONITOR | |
1196 | bool monitor_enable; | |
1197 | #endif // endif | |
1198 | #ifdef DHD_PKT_LOGGING | |
1199 | struct dhd_pktlog *pktlog; | |
1200 | char debug_dump_time_pktlog_str[DEBUG_DUMP_TIME_BUF_LEN]; | |
1201 | #endif /* DHD_PKT_LOGGING */ | |
1202 | uint dhd_watchdog_ms_backup; | |
1203 | void *event_log_filter; | |
1204 | #ifdef WL_CFGVENDOR_SEND_HANG_EVENT | |
1205 | char *hang_info; | |
1206 | int hang_info_cnt; | |
1207 | char debug_dump_time_hang_str[DEBUG_DUMP_TIME_BUF_LEN]; | |
1208 | #endif /* WL_CFGVENDOR_SEND_HANG_EVENT */ | |
1209 | char debug_dump_time_str[DEBUG_DUMP_TIME_BUF_LEN]; | |
1210 | uint32 logset_prsrv_mask; | |
1211 | bool wl_event_enabled; | |
1212 | bool logtrace_pkt_sendup; | |
1213 | #ifdef DHD_DUMP_MNGR | |
1214 | struct _dhd_dump_file_manage *dump_file_manage; | |
1215 | #endif /* DHD_DUMP_MNGR */ | |
1216 | int debug_dump_subcmd; | |
1217 | wait_queue_head_t tx_completion_wait; | |
1218 | uint32 batch_tx_pkts_cmpl; | |
1219 | uint32 batch_tx_num_pkts; | |
1220 | #ifdef DHD_ERPOM | |
1221 | bool enable_erpom; | |
1222 | pom_func_handler_t pom_wlan_handler; | |
1223 | int (*pom_func_register)(pom_func_handler_t *func); | |
1224 | int (*pom_func_deregister)(pom_func_handler_t *func); | |
1225 | int (*pom_toggle_reg_on)(uchar func_id, uchar reason); | |
1226 | #endif /* DHD_ERPOM */ | |
1227 | #ifdef SUPPORT_SET_TID | |
1228 | uint8 tid_mode; | |
1229 | uint32 target_uid; | |
1230 | uint8 target_tid; | |
1231 | #endif /* SUPPORT_SET_TID */ | |
1232 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
1233 | struct mutex ndev_op_sync; | |
1234 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) */ | |
1235 | #ifdef DYNAMIC_MUMIMO_CONTROL | |
1236 | uint8 reassoc_mumimo_sw; | |
1237 | uint8 murx_block_eapol; | |
1238 | #endif /* DYNAMIC_MUMIMO_CONTROL */ | |
1239 | #ifdef DHD_USE_CLMINFO_PARSER | |
1240 | bool is_clm_mult_regrev; /* Checking for CLM single/multiple regrev */ | |
1241 | #endif /* DHD_USE_CLMINFO_PARSER */ | |
5a068558 | 1242 | bool disable_dtim_in_suspend; /* Disable set bcn_li_dtim in suspend */ |
1cac41cb MB |
1243 | } dhd_pub_t; |
1244 | ||
1245 | typedef struct { | |
1246 | uint rxwake; | |
1247 | uint rcwake; | |
1248 | #ifdef DHD_WAKE_RX_STATUS | |
1249 | uint rx_bcast; | |
1250 | uint rx_arp; | |
1251 | uint rx_mcast; | |
1252 | uint rx_multi_ipv6; | |
1253 | uint rx_icmpv6; | |
1254 | uint rx_icmpv6_ra; | |
1255 | uint rx_icmpv6_na; | |
1256 | uint rx_icmpv6_ns; | |
1257 | uint rx_multi_ipv4; | |
1258 | uint rx_multi_other; | |
1259 | uint rx_ucast; | |
1260 | #endif /* DHD_WAKE_RX_STATUS */ | |
1261 | #ifdef DHD_WAKE_EVENT_STATUS | |
1262 | uint rc_event[WLC_E_LAST]; | |
1263 | #endif /* DHD_WAKE_EVENT_STATUS */ | |
1264 | } wake_counts_t; | |
1265 | ||
1266 | #if defined(PCIE_FULL_DONGLE) | |
1267 | ||
1268 | /* Packet Tag for PCIE Full Dongle DHD */ | |
1269 | typedef struct dhd_pkttag_fd { | |
1270 | uint16 flowid; /* Flowring Id */ | |
1271 | uint16 ifid; | |
1272 | #ifndef DHD_PCIE_PKTID | |
1273 | uint16 dma_len; /* pkt len for DMA_MAP/UNMAP */ | |
1274 | dmaaddr_t pa; /* physical address */ | |
1275 | void *dmah; /* dma mapper handle */ | |
1276 | void *secdma; /* secure dma sec_cma_info handle */ | |
1277 | #endif /* !DHD_PCIE_PKTID */ | |
1278 | #ifdef TX_STATUS_LATENCY_STATS | |
1279 | uint64 q_time_us; /* time when tx pkt queued to flowring */ | |
1280 | #endif /* TX_STATUS_LATENCY_STATS */ | |
1281 | } dhd_pkttag_fd_t; | |
1282 | ||
1283 | /* Packet Tag for DHD PCIE Full Dongle */ | |
1284 | #define DHD_PKTTAG_FD(pkt) ((dhd_pkttag_fd_t *)(PKTTAG(pkt))) | |
1285 | ||
1286 | #define DHD_PKT_GET_FLOWID(pkt) ((DHD_PKTTAG_FD(pkt))->flowid) | |
1287 | #define DHD_PKT_SET_FLOWID(pkt, pkt_flowid) \ | |
1288 | DHD_PKTTAG_FD(pkt)->flowid = (uint16)(pkt_flowid) | |
1289 | ||
1290 | #define DHD_PKT_GET_DATAOFF(pkt) ((DHD_PKTTAG_FD(pkt))->dataoff) | |
1291 | #define DHD_PKT_SET_DATAOFF(pkt, pkt_dataoff) \ | |
1292 | DHD_PKTTAG_FD(pkt)->dataoff = (uint16)(pkt_dataoff) | |
1293 | ||
1294 | #define DHD_PKT_GET_DMA_LEN(pkt) ((DHD_PKTTAG_FD(pkt))->dma_len) | |
1295 | #define DHD_PKT_SET_DMA_LEN(pkt, pkt_dma_len) \ | |
1296 | DHD_PKTTAG_FD(pkt)->dma_len = (uint16)(pkt_dma_len) | |
1297 | ||
1298 | #define DHD_PKT_GET_PA(pkt) ((DHD_PKTTAG_FD(pkt))->pa) | |
1299 | #define DHD_PKT_SET_PA(pkt, pkt_pa) \ | |
1300 | DHD_PKTTAG_FD(pkt)->pa = (dmaaddr_t)(pkt_pa) | |
1301 | ||
1302 | #define DHD_PKT_GET_DMAH(pkt) ((DHD_PKTTAG_FD(pkt))->dmah) | |
1303 | #define DHD_PKT_SET_DMAH(pkt, pkt_dmah) \ | |
1304 | DHD_PKTTAG_FD(pkt)->dmah = (void *)(pkt_dmah) | |
1305 | ||
1306 | #define DHD_PKT_GET_SECDMA(pkt) ((DHD_PKTTAG_FD(pkt))->secdma) | |
1307 | #define DHD_PKT_SET_SECDMA(pkt, pkt_secdma) \ | |
1308 | DHD_PKTTAG_FD(pkt)->secdma = (void *)(pkt_secdma) | |
1309 | ||
1310 | #ifdef TX_STATUS_LATENCY_STATS | |
1311 | #define DHD_PKT_GET_QTIME(pkt) ((DHD_PKTTAG_FD(pkt))->q_time_us) | |
1312 | #define DHD_PKT_SET_QTIME(pkt, pkt_q_time_us) \ | |
1313 | DHD_PKTTAG_FD(pkt)->q_time_us = (uint64)(pkt_q_time_us) | |
1314 | #endif /* TX_STATUS_LATENCY_STATS */ | |
1315 | #endif /* PCIE_FULL_DONGLE */ | |
1316 | ||
1317 | #if defined(BCMWDF) | |
1318 | typedef struct { | |
1319 | dhd_pub_t *dhd_pub; | |
1320 | } dhd_workitem_context_t; | |
1321 | ||
1322 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(dhd_workitem_context_t, dhd_get_dhd_workitem_context) | |
1323 | #endif /* (BCMWDF) */ | |
1324 | ||
1325 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) | |
1326 | ||
1327 | #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
1328 | #define _DHD_PM_RESUME_WAIT(a, b) do {\ | |
1329 | int retry = 0; \ | |
1330 | SMP_RD_BARRIER_DEPENDS(); \ | |
1331 | while (dhd_mmc_suspend && retry++ != b) { \ | |
1332 | SMP_RD_BARRIER_DEPENDS(); \ | |
1333 | wait_event_interruptible_timeout(a, !dhd_mmc_suspend, 1); \ | |
1334 | } \ | |
1335 | } while (0) | |
1336 | #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200) | |
1337 | #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0) | |
1338 | #define DHD_PM_RESUME_RETURN_ERROR(a) do { \ | |
1339 | if (dhd_mmc_suspend) { \ | |
1340 | printf("%s[%d]: mmc is still in suspend state!!!\n", \ | |
1341 | __FUNCTION__, __LINE__); \ | |
1342 | return a; \ | |
1343 | } \ | |
1344 | } while (0) | |
1345 | #define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0) | |
1346 | ||
1347 | #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
1348 | #define SPINWAIT_SLEEP(a, exp, us) do { \ | |
1349 | uint countdown = (us) + 9999; \ | |
1350 | while ((exp) && (countdown >= 10000)) { \ | |
1351 | wait_event_interruptible_timeout(a, FALSE, 1); \ | |
1352 | countdown -= 10000; \ | |
1353 | } \ | |
1354 | } while (0) | |
1355 | ||
1356 | #else | |
1357 | ||
1358 | #define DHD_PM_RESUME_WAIT_INIT(a) | |
1359 | #define DHD_PM_RESUME_WAIT(a) | |
1360 | #define DHD_PM_RESUME_WAIT_FOREVER(a) | |
1361 | #define DHD_PM_RESUME_RETURN_ERROR(a) | |
1362 | #define DHD_PM_RESUME_RETURN | |
1363 | ||
1364 | #define DHD_SPINWAIT_SLEEP_INIT(a) | |
1365 | #define SPINWAIT_SLEEP(a, exp, us) do { \ | |
1366 | uint countdown = (us) + 9; \ | |
1367 | while ((exp) && (countdown >= 10)) { \ | |
1368 | OSL_DELAY(10); \ | |
1369 | countdown -= 10; \ | |
1370 | } \ | |
1371 | } while (0) | |
1372 | ||
1373 | #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */ | |
1374 | ||
1375 | #ifndef OSL_SLEEP | |
1376 | #define OSL_SLEEP(ms) OSL_DELAY(ms*1000) | |
1377 | #endif /* OSL_SLEEP */ | |
1378 | ||
1379 | #define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */ | |
1380 | ||
1381 | #ifdef PNO_SUPPORT | |
1382 | int dhd_pno_clean(dhd_pub_t *dhd); | |
1383 | #endif /* PNO_SUPPORT */ | |
1384 | ||
1385 | /* | |
1386 | * Wake locks are an Android power management concept. They are used by applications and services | |
1387 | * to request CPU resources. | |
1388 | */ | |
1389 | extern int dhd_os_wake_lock(dhd_pub_t *pub); | |
1390 | extern int dhd_os_wake_unlock(dhd_pub_t *pub); | |
1391 | extern int dhd_os_wake_lock_waive(dhd_pub_t *pub); | |
1392 | extern int dhd_os_wake_lock_restore(dhd_pub_t *pub); | |
1393 | extern void dhd_event_wake_lock(dhd_pub_t *pub); | |
1394 | extern void dhd_event_wake_unlock(dhd_pub_t *pub); | |
1395 | extern void dhd_pm_wake_lock_timeout(dhd_pub_t *pub, int val); | |
1396 | extern void dhd_pm_wake_unlock(dhd_pub_t *pub); | |
1397 | extern void dhd_txfl_wake_lock_timeout(dhd_pub_t *pub, int val); | |
1398 | extern void dhd_txfl_wake_unlock(dhd_pub_t *pub); | |
1399 | extern int dhd_os_wake_lock_timeout(dhd_pub_t *pub); | |
1400 | extern int dhd_os_wake_lock_rx_timeout_enable(dhd_pub_t *pub, int val); | |
1401 | extern int dhd_os_wake_lock_ctrl_timeout_enable(dhd_pub_t *pub, int val); | |
1402 | extern int dhd_os_wake_lock_ctrl_timeout_cancel(dhd_pub_t *pub); | |
1403 | extern int dhd_os_wd_wake_lock(dhd_pub_t *pub); | |
1404 | extern int dhd_os_wd_wake_unlock(dhd_pub_t *pub); | |
1405 | extern void dhd_os_wake_lock_init(struct dhd_info *dhd); | |
1406 | extern void dhd_os_wake_lock_destroy(struct dhd_info *dhd); | |
1407 | #ifdef DHD_USE_SCAN_WAKELOCK | |
1408 | extern void dhd_os_scan_wake_lock_timeout(dhd_pub_t *pub, int val); | |
1409 | extern void dhd_os_scan_wake_unlock(dhd_pub_t *pub); | |
1410 | #endif /* BCMPCIE_SCAN_WAKELOCK */ | |
1411 | ||
1412 | inline static void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t * dhdp) | |
1413 | { | |
1414 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
1415 | mutex_init(&dhdp->wl_softap_lock); | |
1416 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ | |
1417 | } | |
1418 | ||
1419 | inline static void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t * dhdp) | |
1420 | { | |
1421 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
1422 | mutex_lock(&dhdp->wl_softap_lock); | |
1423 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ | |
1424 | } | |
1425 | ||
1426 | inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t * dhdp) | |
1427 | { | |
1428 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) | |
1429 | mutex_unlock(&dhdp->wl_softap_lock); | |
1430 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */ | |
1431 | } | |
1432 | ||
1433 | #ifdef DHD_DEBUG_WAKE_LOCK | |
1434 | #define DHD_OS_WAKE_LOCK(pub) \ | |
1435 | do { \ | |
1436 | printf("call wake_lock: %s %d\n", \ | |
1437 | __FUNCTION__, __LINE__); \ | |
1438 | dhd_os_wake_lock(pub); \ | |
1439 | } while (0) | |
1440 | #define DHD_OS_WAKE_UNLOCK(pub) \ | |
1441 | do { \ | |
1442 | printf("call wake_unlock: %s %d\n", \ | |
1443 | __FUNCTION__, __LINE__); \ | |
1444 | dhd_os_wake_unlock(pub); \ | |
1445 | } while (0) | |
1446 | #define DHD_EVENT_WAKE_LOCK(pub) \ | |
1447 | do { \ | |
1448 | printf("call event wake_lock: %s %d\n", \ | |
1449 | __FUNCTION__, __LINE__); \ | |
1450 | dhd_event_wake_lock(pub); \ | |
1451 | } while (0) | |
1452 | #define DHD_EVENT_WAKE_UNLOCK(pub) \ | |
1453 | do { \ | |
1454 | printf("call event wake_unlock: %s %d\n", \ | |
1455 | __FUNCTION__, __LINE__); \ | |
1456 | dhd_event_wake_unlock(pub); \ | |
1457 | } while (0) | |
1458 | #define DHD_PM_WAKE_LOCK_TIMEOUT(pub, val) \ | |
1459 | do { \ | |
1460 | printf("call pm_wake_timeout enable\n"); \ | |
1461 | dhd_pm_wake_lock_timeout(pub, val); \ | |
1462 | } while (0) | |
1463 | #define DHD_PM_WAKE_UNLOCK(pub) \ | |
1464 | do { \ | |
1465 | printf("call pm_wake unlock\n"); \ | |
1466 | dhd_pm_wake_unlock(pub); \ | |
1467 | } while (0) | |
1468 | #define DHD_TXFL_WAKE_LOCK_TIMEOUT(pub, val) \ | |
1469 | do { \ | |
1470 | printf("call pm_wake_timeout enable\n"); \ | |
1471 | dhd_txfl_wake_lock_timeout(pub, val); \ | |
1472 | } while (0) | |
1473 | #define DHD_TXFL_WAKE_UNLOCK(pub) \ | |
1474 | do { \ | |
1475 | printf("call pm_wake unlock\n"); \ | |
1476 | dhd_txfl_wake_unlock(pub); \ | |
1477 | } while (0) | |
1478 | #define DHD_OS_WAKE_LOCK_TIMEOUT(pub) \ | |
1479 | do { \ | |
1480 | printf("call wake_lock_timeout: %s %d\n", \ | |
1481 | __FUNCTION__, __LINE__); \ | |
1482 | dhd_os_wake_lock_timeout(pub); \ | |
1483 | } while (0) | |
1484 | #define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \ | |
1485 | do { \ | |
1486 | printf("call wake_lock_rx_timeout_enable[%d]: %s %d\n", \ | |
1487 | val, __FUNCTION__, __LINE__); \ | |
1488 | dhd_os_wake_lock_rx_timeout_enable(pub, val); \ | |
1489 | } while (0) | |
1490 | #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \ | |
1491 | do { \ | |
1492 | printf("call wake_lock_ctrl_timeout_enable[%d]: %s %d\n", \ | |
1493 | val, __FUNCTION__, __LINE__); \ | |
1494 | dhd_os_wake_lock_ctrl_timeout_enable(pub, val); \ | |
1495 | } while (0) | |
1496 | #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_CANCEL(pub) \ | |
1497 | do { \ | |
1498 | printf("call wake_lock_ctrl_timeout_cancel: %s %d\n", \ | |
1499 | __FUNCTION__, __LINE__); \ | |
1500 | dhd_os_wake_lock_ctrl_timeout_cancel(pub); \ | |
1501 | } while (0) | |
1502 | #define DHD_OS_WAKE_LOCK_WAIVE(pub) \ | |
1503 | do { \ | |
1504 | printf("call wake_lock_waive: %s %d\n", \ | |
1505 | __FUNCTION__, __LINE__); \ | |
1506 | dhd_os_wake_lock_waive(pub); \ | |
1507 | } while (0) | |
1508 | #define DHD_OS_WAKE_LOCK_RESTORE(pub) \ | |
1509 | do { \ | |
1510 | printf("call wake_lock_restore: %s %d\n", \ | |
1511 | __FUNCTION__, __LINE__); \ | |
1512 | dhd_os_wake_lock_restore(pub); \ | |
1513 | } while (0) | |
1514 | #define DHD_OS_WAKE_LOCK_INIT(dhd) \ | |
1515 | do { \ | |
1516 | printf("call wake_lock_init: %s %d\n", \ | |
1517 | __FUNCTION__, __LINE__); \ | |
1518 | dhd_os_wake_lock_init(dhd); \ | |
1519 | } while (0) | |
1520 | #define DHD_OS_WAKE_LOCK_DESTROY(dhd) \ | |
1521 | do { \ | |
1522 | printf("call wake_lock_destroy: %s %d\n", \ | |
1523 | __FUNCTION__, __LINE__); \ | |
1524 | dhd_os_wake_lock_destroy(dhd); \ | |
1525 | } while (0) | |
1526 | #else | |
1527 | #define DHD_OS_WAKE_LOCK(pub) dhd_os_wake_lock(pub) | |
1528 | #define DHD_OS_WAKE_UNLOCK(pub) dhd_os_wake_unlock(pub) | |
1529 | #define DHD_EVENT_WAKE_LOCK(pub) dhd_event_wake_lock(pub) | |
1530 | #define DHD_EVENT_WAKE_UNLOCK(pub) dhd_event_wake_unlock(pub) | |
1531 | #define DHD_PM_WAKE_LOCK_TIMEOUT(pub, val) dhd_pm_wake_lock_timeout(pub, val) | |
1532 | #define DHD_PM_WAKE_UNLOCK(pub) dhd_pm_wake_unlock(pub) | |
1533 | #define DHD_TXFL_WAKE_LOCK_TIMEOUT(pub, val) dhd_txfl_wake_lock_timeout(pub, val) | |
1534 | #define DHD_TXFL_WAKE_UNLOCK(pub) dhd_txfl_wake_unlock(pub) | |
1535 | #define DHD_OS_WAKE_LOCK_TIMEOUT(pub) dhd_os_wake_lock_timeout(pub) | |
1536 | #define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \ | |
1537 | dhd_os_wake_lock_rx_timeout_enable(pub, val) | |
1538 | #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \ | |
1539 | dhd_os_wake_lock_ctrl_timeout_enable(pub, val) | |
1540 | #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_CANCEL(pub) \ | |
1541 | dhd_os_wake_lock_ctrl_timeout_cancel(pub) | |
1542 | #define DHD_OS_WAKE_LOCK_WAIVE(pub) dhd_os_wake_lock_waive(pub) | |
1543 | #define DHD_OS_WAKE_LOCK_RESTORE(pub) dhd_os_wake_lock_restore(pub) | |
1544 | #define DHD_OS_WAKE_LOCK_INIT(dhd) dhd_os_wake_lock_init(dhd); | |
1545 | #define DHD_OS_WAKE_LOCK_DESTROY(dhd) dhd_os_wake_lock_destroy(dhd); | |
1546 | #endif /* DHD_DEBUG_WAKE_LOCK */ | |
1547 | ||
1548 | #define DHD_OS_WD_WAKE_LOCK(pub) dhd_os_wd_wake_lock(pub) | |
1549 | #define DHD_OS_WD_WAKE_UNLOCK(pub) dhd_os_wd_wake_unlock(pub) | |
1550 | ||
1551 | #ifdef DHD_USE_SCAN_WAKELOCK | |
1552 | #ifdef DHD_DEBUG_SCAN_WAKELOCK | |
1553 | #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val) \ | |
1554 | do { \ | |
1555 | printf("call wake_lock_scan: %s %d\n", \ | |
1556 | __FUNCTION__, __LINE__); \ | |
1557 | dhd_os_scan_wake_lock_timeout(pub, val); \ | |
1558 | } while (0) | |
1559 | #define DHD_OS_SCAN_WAKE_UNLOCK(pub) \ | |
1560 | do { \ | |
1561 | printf("call wake_unlock_scan: %s %d\n", \ | |
1562 | __FUNCTION__, __LINE__); \ | |
1563 | dhd_os_scan_wake_unlock(pub); \ | |
1564 | } while (0) | |
1565 | #else | |
1566 | #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val) dhd_os_scan_wake_lock_timeout(pub, val) | |
1567 | #define DHD_OS_SCAN_WAKE_UNLOCK(pub) dhd_os_scan_wake_unlock(pub) | |
1568 | #endif /* DHD_DEBUG_SCAN_WAKELOCK */ | |
1569 | #else | |
1570 | #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val) | |
1571 | #define DHD_OS_SCAN_WAKE_UNLOCK(pub) | |
1572 | #endif /* DHD_USE_SCAN_WAKELOCK */ | |
1573 | ||
1574 | #ifdef BCMPCIE_OOB_HOST_WAKE | |
1575 | #define OOB_WAKE_LOCK_TIMEOUT 500 | |
1576 | extern void dhd_os_oob_irq_wake_lock_timeout(dhd_pub_t *pub, int val); | |
1577 | extern void dhd_os_oob_irq_wake_unlock(dhd_pub_t *pub); | |
1578 | extern int dhdpcie_get_oob_irq_num(struct dhd_bus *bus); | |
1579 | #define DHD_OS_OOB_IRQ_WAKE_LOCK_TIMEOUT(pub, val) dhd_os_oob_irq_wake_lock_timeout(pub, val) | |
1580 | #define DHD_OS_OOB_IRQ_WAKE_UNLOCK(pub) dhd_os_oob_irq_wake_unlock(pub) | |
1581 | #endif /* BCMPCIE_OOB_HOST_WAKE */ | |
1582 | ||
1583 | #define DHD_PACKET_TIMEOUT_MS 500 | |
1584 | #define DHD_EVENT_TIMEOUT_MS 1500 | |
1585 | #define SCAN_WAKE_LOCK_TIMEOUT 10000 | |
1586 | #define MAX_TX_TIMEOUT 500 | |
1587 | ||
1588 | /* Enum for IOCTL recieved status */ | |
1589 | typedef enum dhd_ioctl_recieved_status | |
1590 | { | |
1591 | IOCTL_WAIT = 0, | |
1592 | IOCTL_RETURN_ON_SUCCESS, | |
1593 | IOCTL_RETURN_ON_TRAP, | |
1594 | IOCTL_RETURN_ON_BUS_STOP, | |
1595 | IOCTL_RETURN_ON_ERROR | |
1596 | } dhd_ioctl_recieved_status_t; | |
1597 | ||
1598 | /* interface operations (register, remove) should be atomic, use this lock to prevent race | |
1599 | * condition among wifi on/off and interface operation functions | |
1600 | */ | |
1601 | void dhd_net_if_lock(struct net_device *dev); | |
1602 | void dhd_net_if_unlock(struct net_device *dev); | |
1603 | ||
1604 | #if defined(MULTIPLE_SUPPLICANT) | |
1605 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && defined(BCMSDIO) | |
1606 | extern struct mutex _dhd_sdio_mutex_lock_; | |
1607 | #endif // endif | |
1608 | #endif /* MULTIPLE_SUPPLICANT */ | |
1609 | ||
1610 | typedef enum dhd_attach_states | |
1611 | { | |
1612 | DHD_ATTACH_STATE_INIT = 0x0, | |
1613 | DHD_ATTACH_STATE_NET_ALLOC = 0x1, | |
1614 | DHD_ATTACH_STATE_DHD_ALLOC = 0x2, | |
1615 | DHD_ATTACH_STATE_ADD_IF = 0x4, | |
1616 | DHD_ATTACH_STATE_PROT_ATTACH = 0x8, | |
1617 | DHD_ATTACH_STATE_WL_ATTACH = 0x10, | |
1618 | DHD_ATTACH_STATE_THREADS_CREATED = 0x20, | |
1619 | DHD_ATTACH_STATE_WAKELOCKS_INIT = 0x40, | |
1620 | DHD_ATTACH_STATE_CFG80211 = 0x80, | |
1621 | DHD_ATTACH_STATE_EARLYSUSPEND_DONE = 0x100, | |
1622 | DHD_ATTACH_TIMESYNC_ATTACH_DONE = 0x200, | |
1623 | DHD_ATTACH_LOGTRACE_INIT = 0x400, | |
1624 | DHD_ATTACH_STATE_LB_ATTACH_DONE = 0x800, | |
1625 | DHD_ATTACH_STATE_DONE = 0x1000 | |
1626 | } dhd_attach_states_t; | |
1627 | ||
1628 | /* Value -1 means we are unsuccessful in creating the kthread. */ | |
1629 | #define DHD_PID_KT_INVALID -1 | |
1630 | /* Value -2 means we are unsuccessful in both creating the kthread and tasklet */ | |
1631 | #define DHD_PID_KT_TL_INVALID -2 | |
1632 | ||
1633 | /* default reporting period */ | |
1634 | #define ECOUNTERS_DEFAULT_PERIOD 0 | |
1635 | ||
1636 | /* default number of reports. '0' indicates forever */ | |
1637 | #define ECOUNTERS_NUM_REPORTS 0 | |
1638 | ||
1639 | typedef struct ecounters_cfg { | |
1640 | uint16 type; | |
1641 | uint16 if_slice_idx; | |
1642 | uint16 stats_rep; | |
1643 | } ecounters_cfg_t; | |
1644 | ||
1645 | typedef struct event_ecounters_cfg { | |
1646 | uint16 event_id; | |
1647 | uint16 type; | |
1648 | uint16 if_slice_idx; | |
1649 | uint16 stats_rep; | |
1650 | } event_ecounters_cfg_t; | |
1651 | ||
1652 | typedef struct ecountersv2_xtlv_list_elt { | |
1653 | /* Not quite the exact bcm_xtlv_t type as data could be pointing to other pieces in | |
1654 | * memory at the time of parsing arguments. | |
1655 | */ | |
1656 | uint16 id; | |
1657 | uint16 len; | |
1658 | uint8 *data; | |
1659 | struct ecountersv2_xtlv_list_elt *next; | |
1660 | } ecountersv2_xtlv_list_elt_t; | |
1661 | ||
1662 | typedef struct ecountersv2_processed_xtlv_list_elt { | |
1663 | uint8 *data; | |
1664 | struct ecountersv2_processed_xtlv_list_elt *next; | |
1665 | } ecountersv2_processed_xtlv_list_elt; | |
1666 | ||
1667 | /* | |
1668 | * Exported from dhd OS modules (dhd_linux/dhd_ndis) | |
1669 | */ | |
1670 | ||
1671 | /* Indication from bus module regarding presence/insertion of dongle. | |
1672 | * Return dhd_pub_t pointer, used as handle to OS module in later calls. | |
1673 | * Returned structure should have bus and prot pointers filled in. | |
1674 | * bus_hdrlen specifies required headroom for bus module header. | |
1675 | */ | |
1676 | extern dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen); | |
1677 | extern int dhd_attach_net(dhd_pub_t *dhdp, bool need_rtnl_lock); | |
1678 | #if defined(WLP2P) && defined(WL_CFG80211) | |
1679 | /* To allow attach/detach calls corresponding to p2p0 interface */ | |
1680 | extern int dhd_attach_p2p(dhd_pub_t *); | |
1681 | extern int dhd_detach_p2p(dhd_pub_t *); | |
1682 | #endif /* WLP2P && WL_CFG80211 */ | |
1683 | extern int dhd_register_if(dhd_pub_t *dhdp, int idx, bool need_rtnl_lock); | |
1684 | ||
1685 | /* Indication from bus module regarding removal/absence of dongle */ | |
1686 | extern void dhd_detach(dhd_pub_t *dhdp); | |
1687 | extern void dhd_free(dhd_pub_t *dhdp); | |
1688 | extern void dhd_clear(dhd_pub_t *dhdp); | |
1689 | ||
1690 | /* Indication from bus module to change flow-control state */ | |
1691 | extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on); | |
1692 | ||
1693 | /* Store the status of a connection attempt for later retrieval by an iovar */ | |
1694 | extern void dhd_store_conn_status(uint32 event, uint32 status, uint32 reason); | |
1695 | ||
1696 | extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec); | |
1697 | ||
1698 | extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, void *rxp, int numpkt, uint8 chan); | |
1699 | ||
1700 | /* Return pointer to interface name */ | |
1701 | extern char *dhd_ifname(dhd_pub_t *dhdp, int idx); | |
1702 | ||
1703 | #ifdef DHD_UCODE_DOWNLOAD | |
1704 | /* Returns the ucode path */ | |
1705 | extern char *dhd_get_ucode_path(dhd_pub_t *dhdp); | |
1706 | #endif /* DHD_UCODE_DOWNLOAD */ | |
1707 | ||
1708 | /* Request scheduling of the bus dpc */ | |
1709 | extern void dhd_sched_dpc(dhd_pub_t *dhdp); | |
1710 | ||
1711 | /* Notify tx completion */ | |
1712 | extern void dhd_txcomplete(dhd_pub_t *dhdp, void *txp, bool success); | |
1713 | ||
1714 | #ifdef DHD_PCIE_NATIVE_RUNTIMEPM | |
1715 | extern void dhd_bus_wakeup_work(dhd_pub_t *dhdp); | |
1716 | #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ | |
1717 | ||
1718 | #define WIFI_FEATURE_INFRA 0x0001 /* Basic infrastructure mode */ | |
1719 | #define WIFI_FEATURE_INFRA_5G 0x0002 /* Support for 5 GHz Band */ | |
1720 | #define WIFI_FEATURE_HOTSPOT 0x0004 /* Support for GAS/ANQP */ | |
1721 | #define WIFI_FEATURE_P2P 0x0008 /* Wifi-Direct */ | |
1722 | #define WIFI_FEATURE_SOFT_AP 0x0010 /* Soft AP */ | |
1723 | #define WIFI_FEATURE_GSCAN 0x0020 /* Google-Scan APIs */ | |
1724 | #define WIFI_FEATURE_NAN 0x0040 /* Neighbor Awareness Networking */ | |
1725 | #define WIFI_FEATURE_D2D_RTT 0x0080 /* Device-to-device RTT */ | |
1726 | #define WIFI_FEATURE_D2AP_RTT 0x0100 /* Device-to-AP RTT */ | |
1727 | #define WIFI_FEATURE_BATCH_SCAN 0x0200 /* Batched Scan (legacy) */ | |
1728 | #define WIFI_FEATURE_PNO 0x0400 /* Preferred network offload */ | |
1729 | #define WIFI_FEATURE_ADDITIONAL_STA 0x0800 /* Support for two STAs */ | |
1730 | #define WIFI_FEATURE_TDLS 0x1000 /* Tunnel directed link setup */ | |
1731 | #define WIFI_FEATURE_TDLS_OFFCHANNEL 0x2000 /* Support for TDLS off channel */ | |
1732 | #define WIFI_FEATURE_EPR 0x4000 /* Enhanced power reporting */ | |
1733 | #define WIFI_FEATURE_AP_STA 0x8000 /* Support for AP STA Concurrency */ | |
1734 | #define WIFI_FEATURE_LINKSTAT 0x10000 /* Support for Linkstats */ | |
1735 | #define WIFI_FEATURE_LOGGER 0x20000 /* WiFi Logger */ | |
1736 | #define WIFI_FEATURE_HAL_EPNO 0x40000 /* WiFi PNO enhanced */ | |
1737 | #define WIFI_FEATURE_RSSI_MONITOR 0x80000 /* RSSI Monitor */ | |
1738 | #define WIFI_FEATURE_MKEEP_ALIVE 0x100000 /* WiFi mkeep_alive */ | |
1739 | #define WIFI_FEATURE_CONFIG_NDO 0x200000 /* ND offload configure */ | |
1740 | #define WIFI_FEATURE_TX_TRANSMIT_POWER 0x400000 /* Capture Tx transmit power levels */ | |
1741 | #define WIFI_FEATURE_CONTROL_ROAMING 0x800000 /* Enable/Disable firmware roaming */ | |
1742 | #define WIFI_FEATURE_FILTER_IE 0x1000000 /* Probe req ie filter */ | |
1743 | #define WIFI_FEATURE_SCAN_RAND 0x2000000 /* Support MAC & Prb SN randomization */ | |
1744 | #define WIFI_FEATURE_INVALID 0xFFFFFFFF /* Invalid Feature */ | |
1745 | ||
1746 | #define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3 | |
1747 | ||
1748 | extern int dhd_dev_get_feature_set(struct net_device *dev); | |
1749 | extern int dhd_dev_get_feature_set_matrix(struct net_device *dev, int num); | |
1750 | extern int dhd_dev_cfg_rand_mac_oui(struct net_device *dev, uint8 *oui); | |
1751 | #ifdef CUSTOM_FORCE_NODFS_FLAG | |
1752 | extern int dhd_dev_set_nodfs(struct net_device *dev, uint nodfs); | |
1753 | #endif /* CUSTOM_FORCE_NODFS_FLAG */ | |
1754 | #ifdef NDO_CONFIG_SUPPORT | |
1755 | #ifndef NDO_MAX_HOST_IP_ENTRIES | |
1756 | #define NDO_MAX_HOST_IP_ENTRIES 10 | |
1757 | #endif /* NDO_MAX_HOST_IP_ENTRIES */ | |
1758 | ||
1759 | extern int dhd_dev_ndo_cfg(struct net_device *dev, u8 enable); | |
1760 | extern int dhd_dev_ndo_update_inet6addr(struct net_device * dev); | |
1761 | #endif /* NDO_CONFIG_SUPPORT */ | |
1762 | extern int dhd_set_rand_mac_oui(dhd_pub_t *dhd); | |
1763 | #ifdef GSCAN_SUPPORT | |
1764 | extern int dhd_dev_set_lazy_roam_cfg(struct net_device *dev, | |
1765 | wlc_roam_exp_params_t *roam_param); | |
1766 | extern int dhd_dev_lazy_roam_enable(struct net_device *dev, uint32 enable); | |
1767 | extern int dhd_dev_set_lazy_roam_bssid_pref(struct net_device *dev, | |
1768 | wl_bssid_pref_cfg_t *bssid_pref, uint32 flush); | |
1769 | #endif /* GSCAN_SUPPORT */ | |
1770 | #if defined(GSCAN_SUPPORT) || defined(ROAMEXP_SUPPORT) | |
1771 | extern int dhd_dev_set_blacklist_bssid(struct net_device *dev, maclist_t *blacklist, | |
1772 | uint32 len, uint32 flush); | |
1773 | extern int dhd_dev_set_whitelist_ssid(struct net_device *dev, wl_ssid_whitelist_t *whitelist, | |
1774 | uint32 len, uint32 flush); | |
1775 | #endif /* GSCAN_SUPPORT || ROAMEXP_SUPPORT */ | |
1776 | ||
1777 | /* OS independent layer functions */ | |
1778 | extern void dhd_os_dhdiovar_lock(dhd_pub_t *pub); | |
1779 | extern void dhd_os_dhdiovar_unlock(dhd_pub_t *pub); | |
1780 | void dhd_os_logdump_lock(dhd_pub_t *pub); | |
1781 | void dhd_os_logdump_unlock(dhd_pub_t *pub); | |
1782 | extern int dhd_os_proto_block(dhd_pub_t * pub); | |
1783 | extern int dhd_os_proto_unblock(dhd_pub_t * pub); | |
1784 | extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition); | |
1785 | extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub); | |
1786 | extern unsigned int dhd_os_get_ioctl_resp_timeout(void); | |
1787 | extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); | |
1788 | extern void dhd_os_ioctl_resp_lock(dhd_pub_t * pub); | |
1789 | extern void dhd_os_ioctl_resp_unlock(dhd_pub_t * pub); | |
1790 | #ifdef PCIE_FULL_DONGLE | |
1791 | extern void dhd_wakeup_ioctl_event(dhd_pub_t *pub, dhd_ioctl_recieved_status_t reason); | |
1792 | #else | |
1793 | static INLINE void dhd_wakeup_ioctl_event(dhd_pub_t *pub, dhd_ioctl_recieved_status_t reason) | |
1794 | { printf("%s is NOT implemented for SDIO", __FUNCTION__); return; } | |
1795 | #endif // endif | |
1796 | #ifdef SHOW_LOGTRACE | |
1797 | extern int dhd_os_read_file(void *file, char *buf, uint32 size); | |
1798 | extern int dhd_os_seek_file(void *file, int64 offset); | |
1799 | #endif /* SHOW_LOGTRACE */ | |
1800 | int dhd_os_write_file_posn(void *fp, unsigned long *posn, | |
1801 | void *buf, unsigned long buflen); | |
1802 | ||
1803 | extern void | |
1804 | dhd_pcie_dump_core_regs(dhd_pub_t * pub, uint32 index, uint32 first_addr, uint32 last_addr); | |
1805 | extern void wl_dhdpcie_dump_regs(void * context); | |
1806 | ||
1807 | extern int dhd_os_get_image_block(char * buf, int len, void * image); | |
1808 | extern int dhd_os_get_image_size(void * image); | |
1809 | #if defined(BT_OVER_SDIO) | |
1810 | extern int dhd_os_gets_image(dhd_pub_t *pub, char *str, int len, void *image); | |
1811 | extern void dhdsdio_bus_usr_cnt_inc(dhd_pub_t *pub); | |
1812 | extern void dhdsdio_bus_usr_cnt_dec(dhd_pub_t *pub); | |
1813 | #endif /* (BT_OVER_SDIO) */ | |
1814 | extern void *dhd_os_open_image1(dhd_pub_t *pub, char *filename); /* rev1 function signature */ | |
1815 | extern void dhd_os_close_image1(dhd_pub_t *pub, void *image); | |
1816 | extern void dhd_os_wd_timer(void *bus, uint wdtick); | |
1817 | #ifdef DHD_PCIE_RUNTIMEPM | |
1818 | extern void dhd_os_runtimepm_timer(void *bus, uint tick); | |
1819 | #endif /* DHD_PCIE_RUNTIMEPM */ | |
1820 | extern void dhd_os_sdlock(dhd_pub_t * pub); | |
1821 | extern void dhd_os_sdunlock(dhd_pub_t * pub); | |
1822 | extern void dhd_os_sdlock_txq(dhd_pub_t * pub); | |
1823 | extern void dhd_os_sdunlock_txq(dhd_pub_t * pub); | |
1824 | extern void dhd_os_sdlock_rxq(dhd_pub_t * pub); | |
1825 | extern void dhd_os_sdunlock_rxq(dhd_pub_t * pub); | |
1826 | extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t * pub); | |
1827 | extern void dhd_os_tracelog(const char *format, ...); | |
1828 | #ifdef DHDTCPACK_SUPPRESS | |
1829 | extern unsigned long dhd_os_tcpacklock(dhd_pub_t *pub); | |
1830 | extern void dhd_os_tcpackunlock(dhd_pub_t *pub, unsigned long flags); | |
1831 | #endif /* DHDTCPACK_SUPPRESS */ | |
1832 | ||
1833 | extern int dhd_customer_oob_irq_map(void *adapter, unsigned long *irq_flags_ptr); | |
1834 | extern int dhd_customer_gpio_wlan_ctrl(void *adapter, int onoff); | |
1835 | extern int dhd_custom_get_mac_address(void *adapter, unsigned char *buf); | |
1836 | #if defined(CUSTOM_COUNTRY_CODE) | |
1837 | extern void get_customized_country_code(void *adapter, char *country_iso_code, | |
1838 | wl_country_t *cspec, u32 flags); | |
1839 | #else | |
1840 | extern void get_customized_country_code(void *adapter, char *country_iso_code, wl_country_t *cspec); | |
1841 | #endif /* CUSTOM_COUNTRY_CODE */ | |
1842 | extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t * pub); | |
1843 | extern void dhd_os_sdlock_eventq(dhd_pub_t * pub); | |
1844 | extern void dhd_os_sdunlock_eventq(dhd_pub_t * pub); | |
1845 | extern bool dhd_os_check_hang(dhd_pub_t *dhdp, int ifidx, int ret); | |
1846 | extern int dhd_os_send_hang_message(dhd_pub_t *dhdp); | |
1847 | extern void dhd_set_version_info(dhd_pub_t *pub, char *fw); | |
1848 | extern bool dhd_os_check_if_up(dhd_pub_t *pub); | |
1849 | extern int dhd_os_check_wakelock(dhd_pub_t *pub); | |
1850 | extern int dhd_os_check_wakelock_all(dhd_pub_t *pub); | |
1851 | extern int dhd_get_instance(dhd_pub_t *pub); | |
1852 | #ifdef CUSTOM_SET_CPUCORE | |
1853 | extern void dhd_set_cpucore(dhd_pub_t *dhd, int set); | |
1854 | #endif /* CUSTOM_SET_CPUCORE */ | |
1855 | ||
1856 | #if defined(KEEP_ALIVE) | |
1857 | extern int dhd_keep_alive_onoff(dhd_pub_t *dhd); | |
1858 | #endif /* KEEP_ALIVE */ | |
1859 | ||
1860 | #if defined(DHD_FW_COREDUMP) | |
1861 | void dhd_schedule_memdump(dhd_pub_t *dhdp, uint8 *buf, uint32 size); | |
1862 | #endif /* DHD_FW_COREDUMP */ | |
1863 | ||
1864 | void dhd_schedule_sssr_dump(dhd_pub_t *dhdp); | |
1865 | ||
1866 | #ifdef PKT_FILTER_SUPPORT | |
1867 | #define DHD_UNICAST_FILTER_NUM 0 | |
1868 | #define DHD_BROADCAST_FILTER_NUM 1 | |
1869 | #define DHD_MULTICAST4_FILTER_NUM 2 | |
1870 | #define DHD_MULTICAST6_FILTER_NUM 3 | |
1871 | #define DHD_MDNS_FILTER_NUM 4 | |
1872 | #define DHD_ARP_FILTER_NUM 5 | |
1873 | #define DHD_BROADCAST_ARP_FILTER_NUM 6 | |
1874 | #define DHD_IP4BCAST_DROP_FILTER_NUM 7 | |
1875 | #define DHD_LLC_STP_DROP_FILTER_NUM 8 | |
1876 | #define DHD_LLC_XID_DROP_FILTER_NUM 9 | |
1877 | #define DISCARD_IPV4_MCAST "102 1 6 IP4_H:16 0xf0 0xe0" | |
1878 | #define DISCARD_IPV6_MCAST "103 1 6 IP6_H:24 0xff 0xff" | |
1879 | #define DISCARD_IPV4_BCAST "107 1 6 IP4_H:16 0xffffffff 0xffffffff" | |
1880 | #define DISCARD_LLC_STP "108 1 6 ETH_H:14 0xFFFFFFFFFFFF 0xAAAA0300000C" | |
1881 | #define DISCARD_LLC_XID "109 1 6 ETH_H:14 0xFFFFFF 0x0001AF" | |
1882 | extern int dhd_os_enable_packet_filter(dhd_pub_t *dhdp, int val); | |
1883 | extern void dhd_enable_packet_filter(int value, dhd_pub_t *dhd); | |
1884 | extern int dhd_packet_filter_add_remove(dhd_pub_t *dhdp, int add_remove, int num); | |
1885 | extern int net_os_enable_packet_filter(struct net_device *dev, int val); | |
1886 | extern int net_os_rxfilter_add_remove(struct net_device *dev, int val, int num); | |
1887 | ||
1888 | #define MAX_PKTFLT_BUF_SIZE 2048 | |
1889 | #define MAX_PKTFLT_FIXED_PATTERN_SIZE 32 | |
1890 | #define MAX_PKTFLT_FIXED_BUF_SIZE \ | |
1891 | (WL_PKT_FILTER_FIXED_LEN + MAX_PKTFLT_FIXED_PATTERN_SIZE * 2) | |
5a068558 | 1892 | #define MAXPKT_ARG 16 |
1cac41cb MB |
1893 | #endif /* PKT_FILTER_SUPPORT */ |
1894 | ||
1895 | #if defined(BCMPCIE) | |
1896 | extern int dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd, int *dtim_period, int *bcn_interval); | |
1897 | #else | |
1898 | extern int dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd); | |
1899 | #endif /* OEM_ANDROID && BCMPCIE */ | |
1900 | ||
1901 | extern bool dhd_support_sta_mode(dhd_pub_t *dhd); | |
1902 | extern int write_to_file(dhd_pub_t *dhd, uint8 *buf, int size); | |
1903 | ||
1904 | #ifdef RSSI_MONITOR_SUPPORT | |
1905 | extern int dhd_dev_set_rssi_monitor_cfg(struct net_device *dev, int start, | |
1906 | int8 max_rssi, int8 min_rssi); | |
1907 | #endif /* RSSI_MONITOR_SUPPORT */ | |
1908 | ||
1909 | #ifdef DHDTCPACK_SUPPRESS | |
1910 | int dhd_dev_set_tcpack_sup_mode_cfg(struct net_device *dev, uint8 enable); | |
1911 | #endif /* DHDTCPACK_SUPPRESS */ | |
1912 | ||
1913 | #define DHD_RSSI_MONITOR_EVT_VERSION 1 | |
1914 | typedef struct { | |
1915 | uint8 version; | |
1916 | int8 cur_rssi; | |
1917 | struct ether_addr BSSID; | |
1918 | } dhd_rssi_monitor_evt_t; | |
1919 | ||
1920 | typedef struct { | |
1921 | uint32 limit; /* Expiration time (usec) */ | |
1922 | uint32 increment; /* Current expiration increment (usec) */ | |
1923 | uint32 elapsed; /* Current elapsed time (usec) */ | |
1924 | uint32 tick; /* O/S tick time (usec) */ | |
1925 | } dhd_timeout_t; | |
1926 | ||
1927 | #ifdef SHOW_LOGTRACE | |
1928 | typedef struct { | |
1929 | int num_fmts; | |
1930 | char **fmts; | |
1931 | char *raw_fmts; | |
1932 | char *raw_sstr; | |
1933 | uint32 fmts_size; | |
1934 | uint32 raw_fmts_size; | |
1935 | uint32 raw_sstr_size; | |
1936 | uint32 ramstart; | |
1937 | uint32 rodata_start; | |
1938 | uint32 rodata_end; | |
1939 | char *rom_raw_sstr; | |
1940 | uint32 rom_raw_sstr_size; | |
1941 | uint32 rom_ramstart; | |
1942 | uint32 rom_rodata_start; | |
1943 | uint32 rom_rodata_end; | |
1944 | } dhd_event_log_t; | |
1945 | #endif /* SHOW_LOGTRACE */ | |
1946 | ||
1947 | #if defined(DHD_NON_DMA_M2M_CORRUPTION) | |
1948 | #define PCIE_DMAXFER_LPBK_LENGTH 4096 | |
1949 | typedef struct dhd_pcie_dmaxfer_lpbk { | |
1950 | union { | |
1951 | uint32 length; | |
1952 | uint32 status; | |
1953 | } u; | |
1954 | uint32 srcdelay; | |
1955 | uint32 destdelay; | |
1956 | uint32 lpbkmode; | |
1957 | uint32 wait; | |
1958 | uint32 core; | |
1959 | } dhd_pcie_dmaxfer_lpbk_t; | |
1960 | #endif /* DHD_NON_DMA_M2M_CORRUPTION */ | |
1961 | enum d11_lpbk_type { | |
1962 | M2M_DMA_LPBK = 0, | |
1963 | D11_LPBK = 1, | |
1964 | BMC_LPBK = 2, | |
1965 | M2M_NON_DMA_LPBK = 3, | |
1966 | D11_HOST_MEM_LPBK = 4, | |
1967 | BMC_HOST_MEM_LPBK = 5, | |
1968 | MAX_LPBK = 6 | |
1969 | }; | |
1970 | ||
1971 | #ifdef KEEP_ALIVE | |
1972 | extern int dhd_dev_start_mkeep_alive(dhd_pub_t *dhd_pub, uint8 mkeep_alive_id, uint8 *ip_pkt, | |
1973 | uint16 ip_pkt_len, uint8* src_mac_addr, uint8* dst_mac_addr, uint32 period_msec); | |
1974 | extern int dhd_dev_stop_mkeep_alive(dhd_pub_t *dhd_pub, uint8 mkeep_alive_id); | |
1975 | #endif /* KEEP_ALIVE */ | |
1976 | ||
1977 | #if defined(PKT_FILTER_SUPPORT) && defined(APF) | |
1978 | /* | |
1979 | * As per Google's current implementation, there will be only one APF filter. | |
1980 | * Therefore, userspace doesn't bother about filter id and because of that | |
1981 | * DHD has to manage the filter id. | |
1982 | */ | |
1983 | #define PKT_FILTER_APF_ID 200 | |
1984 | #define DHD_APF_LOCK(ndev) dhd_apf_lock(ndev) | |
1985 | #define DHD_APF_UNLOCK(ndev) dhd_apf_unlock(ndev) | |
1986 | ||
1987 | extern void dhd_apf_lock(struct net_device *dev); | |
1988 | extern void dhd_apf_unlock(struct net_device *dev); | |
1989 | extern int dhd_dev_apf_get_version(struct net_device *ndev, uint32 *version); | |
1990 | extern int dhd_dev_apf_get_max_len(struct net_device *ndev, uint32 *max_len); | |
1991 | extern int dhd_dev_apf_add_filter(struct net_device *ndev, u8* program, | |
1992 | uint32 program_len); | |
1993 | extern int dhd_dev_apf_enable_filter(struct net_device *ndev); | |
1994 | extern int dhd_dev_apf_disable_filter(struct net_device *ndev); | |
1995 | extern int dhd_dev_apf_delete_filter(struct net_device *ndev); | |
1996 | #endif /* PKT_FILTER_SUPPORT && APF */ | |
1997 | ||
1998 | extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec); | |
1999 | extern int dhd_timeout_expired(dhd_timeout_t *tmo); | |
2000 | ||
2001 | extern int dhd_ifname2idx(struct dhd_info *dhd, char *name); | |
2002 | extern int dhd_net2idx(struct dhd_info *dhd, struct net_device *net); | |
2003 | extern struct net_device * dhd_idx2net(void *pub, int ifidx); | |
2004 | extern int net_os_send_hang_message(struct net_device *dev); | |
2005 | extern int net_os_send_hang_message_reason(struct net_device *dev, const char *string_num); | |
2006 | extern bool dhd_wowl_cap(void *bus); | |
2007 | extern int wl_host_event(dhd_pub_t *dhd_pub, int *idx, void *pktdata, uint pktlen, | |
2008 | wl_event_msg_t *, void **data_ptr, void *); | |
2009 | extern int wl_process_host_event(dhd_pub_t *dhd_pub, int *idx, void *pktdata, uint pktlen, | |
2010 | wl_event_msg_t *, void **data_ptr, void *); | |
2011 | extern void wl_event_to_host_order(wl_event_msg_t * evt); | |
2012 | extern int wl_host_event_get_data(void *pktdata, uint pktlen, bcm_event_msg_u_t *evu); | |
2013 | extern int dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifindex, wl_ioctl_t *ioc, void *buf, int len); | |
2014 | extern int dhd_wl_ioctl_cmd(dhd_pub_t *dhd_pub, int cmd, void *arg, int len, uint8 set, | |
2015 | int ifindex); | |
2016 | extern int dhd_wl_ioctl_get_intiovar(dhd_pub_t *dhd_pub, char *name, uint *pval, | |
2017 | int cmd, uint8 set, int ifidx); | |
2018 | extern int dhd_wl_ioctl_set_intiovar(dhd_pub_t *dhd_pub, char *name, uint val, | |
2019 | int cmd, uint8 set, int ifidx); | |
2020 | extern void dhd_common_init(osl_t *osh); | |
2021 | ||
2022 | extern int dhd_do_driver_init(struct net_device *net); | |
2023 | extern int dhd_event_ifadd(struct dhd_info *dhd, struct wl_event_data_if *ifevent, | |
2024 | char *name, uint8 *mac); | |
2025 | extern int dhd_event_ifdel(struct dhd_info *dhd, struct wl_event_data_if *ifevent, | |
2026 | char *name, uint8 *mac); | |
2027 | extern int dhd_event_ifchange(struct dhd_info *dhd, struct wl_event_data_if *ifevent, | |
2028 | char *name, uint8 *mac); | |
2029 | extern struct net_device* dhd_allocate_if(dhd_pub_t *dhdpub, int ifidx, const char *name, | |
2030 | uint8 *mac, uint8 bssidx, bool need_rtnl_lock, const char *dngl_name); | |
2031 | extern int dhd_remove_if(dhd_pub_t *dhdpub, int ifidx, bool need_rtnl_lock); | |
2032 | #ifdef WL_STATIC_IF | |
2033 | extern s32 dhd_update_iflist_info(dhd_pub_t *dhdp, struct net_device *ndev, int ifidx, | |
2034 | uint8 *mac, uint8 bssidx, const char *dngl_name, int if_state); | |
2035 | #endif /* WL_STATIC_IF */ | |
2036 | extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char * name); | |
2037 | extern void dhd_vif_del(struct dhd_info *dhd, int ifidx); | |
2038 | extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx); | |
2039 | extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, uchar *cp, int len); | |
2040 | ||
2041 | #ifdef WL_NATOE | |
2042 | extern int dhd_natoe_ct_event(dhd_pub_t *dhd, char *data); | |
2043 | #endif /* WL_NATOE */ | |
2044 | ||
2045 | /* Send packet to dongle via data channel */ | |
2046 | extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, void *pkt); | |
2047 | ||
2048 | /* send up locally generated event */ | |
2049 | extern void dhd_sendup_event_common(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data); | |
2050 | /* Send event to host */ | |
2051 | extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data); | |
2052 | #ifdef LOG_INTO_TCPDUMP | |
2053 | extern void dhd_sendup_log(dhd_pub_t *dhdp, void *data, int len); | |
2054 | #endif /* LOG_INTO_TCPDUMP */ | |
2055 | extern int dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag); | |
2056 | extern uint dhd_bus_status(dhd_pub_t *dhdp); | |
2057 | extern int dhd_bus_start(dhd_pub_t *dhdp); | |
2058 | extern int dhd_bus_suspend(dhd_pub_t *dhdpub); | |
2059 | extern int dhd_bus_resume(dhd_pub_t *dhdpub, int stage); | |
2060 | extern int dhd_bus_membytes(dhd_pub_t *dhdp, bool set, uint32 address, uint8 *data, uint size); | |
2061 | extern void dhd_print_buf(void *pbuf, int len, int bytes_per_line); | |
2062 | extern bool dhd_is_associated(dhd_pub_t *dhd, uint8 ifidx, int *retval); | |
2063 | #if defined(BCMSDIO) || defined(BCMPCIE) | |
2064 | extern uint dhd_bus_chip_id(dhd_pub_t *dhdp); | |
2065 | extern uint dhd_bus_chiprev_id(dhd_pub_t *dhdp); | |
2066 | extern uint dhd_bus_chippkg_id(dhd_pub_t *dhdp); | |
2067 | #endif /* defined(BCMSDIO) || defined(BCMPCIE) */ | |
2068 | int dhd_bus_get_fw_mode(dhd_pub_t *dhdp); | |
2069 | ||
2070 | #if defined(KEEP_ALIVE) | |
2071 | extern int dhd_keep_alive_onoff(dhd_pub_t *dhd); | |
2072 | #endif /* KEEP_ALIVE */ | |
2073 | ||
2074 | /* OS spin lock API */ | |
2075 | extern void *dhd_os_spin_lock_init(osl_t *osh); | |
2076 | extern void dhd_os_spin_lock_deinit(osl_t *osh, void *lock); | |
2077 | extern unsigned long dhd_os_spin_lock(void *lock); | |
2078 | void dhd_os_spin_unlock(void *lock, unsigned long flags); | |
2079 | ||
2080 | /* linux is defined for DHD EFI builds also, | |
2081 | * since its cross-compiled for EFI from linux. | |
2082 | * dbgring_lock apis are meant only for linux | |
2083 | * to use mutexes, other OSes will continue to | |
2084 | * use dhd_os_spin_lock | |
2085 | */ | |
2086 | void *dhd_os_dbgring_lock_init(osl_t *osh); | |
2087 | void dhd_os_dbgring_lock_deinit(osl_t *osh, void *mtx); | |
2088 | unsigned long dhd_os_dbgring_lock(void *lock); | |
2089 | void dhd_os_dbgring_unlock(void *lock, unsigned long flags); | |
2090 | ||
2091 | static INLINE int dhd_os_tput_test_wait(dhd_pub_t *pub, uint *condition, | |
2092 | uint timeout_ms) | |
2093 | { return 0; } | |
2094 | static INLINE int dhd_os_tput_test_wake(dhd_pub_t * pub) | |
2095 | { return 0; } | |
2096 | ||
2097 | extern int dhd_os_busbusy_wait_negation(dhd_pub_t * pub, uint * condition); | |
2098 | extern int dhd_os_busbusy_wake(dhd_pub_t * pub); | |
2099 | extern void dhd_os_tx_completion_wake(dhd_pub_t *dhd); | |
2100 | extern int dhd_os_busbusy_wait_condition(dhd_pub_t *pub, uint *var, uint condition); | |
2101 | int dhd_os_busbusy_wait_bitmask(dhd_pub_t *pub, uint *var, | |
2102 | uint bitmask, uint condition); | |
2103 | extern int dhd_os_d3ack_wait(dhd_pub_t * pub, uint * condition); | |
2104 | extern int dhd_os_d3ack_wake(dhd_pub_t * pub); | |
2105 | extern int dhd_os_dmaxfer_wait(dhd_pub_t *pub, uint *condition); | |
2106 | extern int dhd_os_dmaxfer_wake(dhd_pub_t *pub); | |
2107 | ||
2108 | /* | |
2109 | * Manage sta objects in an interface. Interface is identified by an ifindex and | |
2110 | * sta(s) within an interfaces are managed using a MacAddress of the sta. | |
2111 | */ | |
2112 | struct dhd_sta; | |
2113 | extern bool dhd_sta_associated(dhd_pub_t *dhdp, uint32 bssidx, uint8 *mac); | |
2114 | extern struct dhd_sta *dhd_find_sta(void *pub, int ifidx, void *ea); | |
2115 | extern struct dhd_sta *dhd_findadd_sta(void *pub, int ifidx, void *ea); | |
2116 | extern void dhd_del_all_sta(void *pub, int ifidx); | |
2117 | extern void dhd_del_sta(void *pub, int ifidx, void *ea); | |
2118 | extern int dhd_get_ap_isolate(dhd_pub_t *dhdp, uint32 idx); | |
2119 | extern int dhd_set_ap_isolate(dhd_pub_t *dhdp, uint32 idx, int val); | |
2120 | extern int dhd_bssidx2idx(dhd_pub_t *dhdp, uint32 bssidx); | |
2121 | extern struct net_device *dhd_linux_get_primary_netdev(dhd_pub_t *dhdp); | |
2122 | ||
2123 | extern bool dhd_is_concurrent_mode(dhd_pub_t *dhd); | |
2124 | int dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *param_buf, uint param_len, | |
2125 | char *res_buf, uint res_len, int set); | |
2126 | extern int dhd_getiovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, | |
2127 | uint cmd_len, char **resptr, uint resp_len); | |
2128 | ||
2129 | #ifdef DHD_MCAST_REGEN | |
2130 | extern int dhd_get_mcast_regen_bss_enable(dhd_pub_t *dhdp, uint32 idx); | |
2131 | extern int dhd_set_mcast_regen_bss_enable(dhd_pub_t *dhdp, uint32 idx, int val); | |
2132 | #endif // endif | |
2133 | typedef enum cust_gpio_modes { | |
2134 | WLAN_RESET_ON, | |
2135 | WLAN_RESET_OFF, | |
2136 | WLAN_POWER_ON, | |
2137 | WLAN_POWER_OFF | |
2138 | } cust_gpio_modes_t; | |
2139 | ||
2140 | typedef struct dmaxref_mem_map { | |
2141 | dhd_dma_buf_t *srcmem; | |
2142 | dhd_dma_buf_t *dstmem; | |
2143 | } dmaxref_mem_map_t; | |
2144 | ||
2145 | extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device *dev, uint flag); | |
2146 | extern int wl_iw_send_priv_event(struct net_device *dev, char *flag); | |
2147 | ||
2148 | #ifdef DHD_PCIE_NATIVE_RUNTIMEPM | |
2149 | extern void dhd_flush_rx_tx_wq(dhd_pub_t *dhdp); | |
2150 | #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ | |
2151 | ||
2152 | /* | |
2153 | * Insmod parameters for debug/test | |
2154 | */ | |
2155 | ||
2156 | /* Watchdog timer interval */ | |
2157 | extern uint dhd_watchdog_ms; | |
2158 | #ifdef DHD_PCIE_RUNTIMEPM | |
2159 | extern uint dhd_runtimepm_ms; | |
2160 | #endif /* DHD_PCIE_RUNTIMEPM */ | |
2161 | ||
2162 | /** Default console output poll interval */ | |
2163 | extern uint dhd_console_ms; | |
2164 | ||
2165 | #if defined(DHD_DEBUG) | |
2166 | extern uint wl_msg_level; | |
2167 | #endif /* defined(DHD_DEBUG) */ | |
2168 | ||
2169 | extern uint dhd_slpauto; | |
2170 | ||
2171 | /* Use interrupts */ | |
2172 | extern uint dhd_intr; | |
2173 | ||
2174 | /* Use polling */ | |
2175 | extern uint dhd_poll; | |
2176 | ||
2177 | /* ARP offload agent mode */ | |
2178 | extern uint dhd_arp_mode; | |
2179 | ||
2180 | /* ARP offload enable */ | |
2181 | extern uint dhd_arp_enable; | |
2182 | ||
2183 | /* Pkt filte enable control */ | |
2184 | extern uint dhd_pkt_filter_enable; | |
2185 | ||
2186 | /* Pkt filter init setup */ | |
2187 | extern uint dhd_pkt_filter_init; | |
2188 | ||
2189 | /* Pkt filter mode control */ | |
2190 | extern uint dhd_master_mode; | |
2191 | ||
2192 | /* Roaming mode control */ | |
2193 | extern uint dhd_roam_disable; | |
2194 | ||
2195 | /* Roaming mode control */ | |
2196 | extern uint dhd_radio_up; | |
2197 | ||
2198 | /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ | |
2199 | extern int dhd_idletime; | |
2200 | #ifdef DHD_USE_IDLECOUNT | |
2201 | #define DHD_IDLETIME_TICKS 5 | |
2202 | #else | |
2203 | #define DHD_IDLETIME_TICKS 1 | |
2204 | #endif /* DHD_USE_IDLECOUNT */ | |
2205 | ||
2206 | /* SDIO Drive Strength */ | |
2207 | extern uint dhd_sdiod_drive_strength; | |
2208 | ||
2209 | /* triggers bcm_bprintf to print to kernel log */ | |
2210 | extern bool bcm_bprintf_bypass; | |
2211 | ||
2212 | /* Override to force tx queueing all the time */ | |
2213 | extern uint dhd_force_tx_queueing; | |
2214 | ||
2215 | /* Default bcn_timeout value is 4 */ | |
2216 | #define DEFAULT_BCN_TIMEOUT_VALUE 4 | |
2217 | #ifndef CUSTOM_BCN_TIMEOUT_SETTING | |
2218 | #define CUSTOM_BCN_TIMEOUT_SETTING DEFAULT_BCN_TIMEOUT_VALUE | |
2219 | #endif // endif | |
2220 | ||
2221 | /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */ | |
2222 | #define DEFAULT_KEEP_ALIVE_VALUE 55000 /* msec */ | |
2223 | #ifndef CUSTOM_KEEP_ALIVE_SETTING | |
2224 | #define CUSTOM_KEEP_ALIVE_SETTING DEFAULT_KEEP_ALIVE_VALUE | |
2225 | #endif /* DEFAULT_KEEP_ALIVE_VALUE */ | |
2226 | ||
2227 | #define NULL_PKT_STR "null_pkt" | |
2228 | ||
2229 | /* hooks for custom glom setting option via Makefile */ | |
2230 | #define DEFAULT_GLOM_VALUE -1 | |
2231 | #ifndef CUSTOM_GLOM_SETTING | |
2232 | #define CUSTOM_GLOM_SETTING DEFAULT_GLOM_VALUE | |
2233 | #endif // endif | |
2234 | #define WL_AUTO_ROAM_TRIGGER -75 | |
2235 | /* hooks for custom Roaming Trigger setting via Makefile */ | |
2236 | #define DEFAULT_ROAM_TRIGGER_VALUE -75 /* dBm default roam trigger all band */ | |
2237 | #define DEFAULT_ROAM_TRIGGER_SETTING -1 | |
2238 | #ifndef CUSTOM_ROAM_TRIGGER_SETTING | |
2239 | #define CUSTOM_ROAM_TRIGGER_SETTING DEFAULT_ROAM_TRIGGER_VALUE | |
2240 | #endif // endif | |
2241 | ||
2242 | /* hooks for custom Roaming Romaing setting via Makefile */ | |
2243 | #define DEFAULT_ROAM_DELTA_VALUE 10 /* dBm default roam delta all band */ | |
2244 | #define DEFAULT_ROAM_DELTA_SETTING -1 | |
2245 | #ifndef CUSTOM_ROAM_DELTA_SETTING | |
2246 | #define CUSTOM_ROAM_DELTA_SETTING DEFAULT_ROAM_DELTA_VALUE | |
2247 | #endif // endif | |
2248 | ||
2249 | /* hooks for custom PNO Event wake lock to guarantee enough time | |
2250 | for the Platform to detect Event before system suspended | |
2251 | */ | |
2252 | #define DEFAULT_PNO_EVENT_LOCK_xTIME 2 /* multiplay of DHD_PACKET_TIMEOUT_MS */ | |
2253 | #ifndef CUSTOM_PNO_EVENT_LOCK_xTIME | |
2254 | #define CUSTOM_PNO_EVENT_LOCK_xTIME DEFAULT_PNO_EVENT_LOCK_xTIME | |
2255 | #endif // endif | |
2256 | /* hooks for custom dhd_dpc_prio setting option via Makefile */ | |
2257 | #define DEFAULT_DHP_DPC_PRIO 1 | |
2258 | #ifndef CUSTOM_DPC_PRIO_SETTING | |
2259 | #define CUSTOM_DPC_PRIO_SETTING DEFAULT_DHP_DPC_PRIO | |
2260 | #endif // endif | |
2261 | ||
2262 | #ifndef CUSTOM_LISTEN_INTERVAL | |
2263 | #define CUSTOM_LISTEN_INTERVAL LISTEN_INTERVAL | |
2264 | #endif /* CUSTOM_LISTEN_INTERVAL */ | |
2265 | ||
2266 | #define DEFAULT_SUSPEND_BCN_LI_DTIM 3 | |
2267 | #ifndef CUSTOM_SUSPEND_BCN_LI_DTIM | |
2268 | #define CUSTOM_SUSPEND_BCN_LI_DTIM DEFAULT_SUSPEND_BCN_LI_DTIM | |
2269 | #endif // endif | |
2270 | ||
2271 | #ifndef BCN_TIMEOUT_IN_SUSPEND | |
2272 | #define BCN_TIMEOUT_IN_SUSPEND 6 /* bcn timeout value in suspend mode */ | |
2273 | #endif // endif | |
2274 | ||
2275 | #ifndef CUSTOM_RXF_PRIO_SETTING | |
2276 | #define CUSTOM_RXF_PRIO_SETTING MAX((CUSTOM_DPC_PRIO_SETTING - 1), 1) | |
2277 | #endif // endif | |
2278 | ||
2279 | #define DEFAULT_WIFI_TURNOFF_DELAY 0 | |
2280 | #ifndef WIFI_TURNOFF_DELAY | |
2281 | #define WIFI_TURNOFF_DELAY DEFAULT_WIFI_TURNOFF_DELAY | |
2282 | #endif /* WIFI_TURNOFF_DELAY */ | |
2283 | ||
2284 | #define DEFAULT_WIFI_TURNON_DELAY 200 | |
2285 | #ifndef WIFI_TURNON_DELAY | |
2286 | #define WIFI_TURNON_DELAY DEFAULT_WIFI_TURNON_DELAY | |
2287 | #endif /* WIFI_TURNON_DELAY */ | |
2288 | ||
2289 | #define DEFAULT_DHD_WATCHDOG_INTERVAL_MS 10 /* msec */ | |
2290 | #ifndef CUSTOM_DHD_WATCHDOG_MS | |
2291 | #define CUSTOM_DHD_WATCHDOG_MS DEFAULT_DHD_WATCHDOG_INTERVAL_MS | |
2292 | #endif /* DEFAULT_DHD_WATCHDOG_INTERVAL_MS */ | |
2293 | ||
2294 | #define DEFAULT_ASSOC_RETRY_MAX 3 | |
2295 | #ifndef CUSTOM_ASSOC_RETRY_MAX | |
2296 | #define CUSTOM_ASSOC_RETRY_MAX DEFAULT_ASSOC_RETRY_MAX | |
2297 | #endif /* DEFAULT_ASSOC_RETRY_MAX */ | |
2298 | ||
2299 | #if defined(BCMSDIO) || defined(DISABLE_FRAMEBURST) | |
2300 | #define DEFAULT_FRAMEBURST_SET 0 | |
2301 | #else | |
2302 | #define DEFAULT_FRAMEBURST_SET 1 | |
2303 | #endif /* BCMSDIO */ | |
2304 | ||
2305 | #ifndef CUSTOM_FRAMEBURST_SET | |
2306 | #define CUSTOM_FRAMEBURST_SET DEFAULT_FRAMEBURST_SET | |
2307 | #endif /* CUSTOM_FRAMEBURST_SET */ | |
2308 | ||
2309 | #ifdef WLTDLS | |
2310 | #ifndef CUSTOM_TDLS_IDLE_MODE_SETTING | |
2311 | #define CUSTOM_TDLS_IDLE_MODE_SETTING 60000 /* 60sec to tear down TDLS of not active */ | |
2312 | #endif // endif | |
2313 | #ifndef CUSTOM_TDLS_RSSI_THRESHOLD_HIGH | |
2314 | #define CUSTOM_TDLS_RSSI_THRESHOLD_HIGH -70 /* rssi threshold for establishing TDLS link */ | |
2315 | #endif // endif | |
2316 | #ifndef CUSTOM_TDLS_RSSI_THRESHOLD_LOW | |
2317 | #define CUSTOM_TDLS_RSSI_THRESHOLD_LOW -80 /* rssi threshold for tearing down TDLS link */ | |
2318 | #endif // endif | |
2319 | #ifndef CUSTOM_TDLS_PCKTCNT_THRESHOLD_HIGH | |
2320 | #define CUSTOM_TDLS_PCKTCNT_THRESHOLD_HIGH 100 /* pkt/sec threshold for establishing TDLS link */ | |
2321 | #endif // endif | |
2322 | #ifndef CUSTOM_TDLS_PCKTCNT_THRESHOLD_LOW | |
2323 | #define CUSTOM_TDLS_PCKTCNT_THRESHOLD_LOW 10 /* pkt/sec threshold for tearing down TDLS link */ | |
2324 | #endif // endif | |
2325 | #endif /* WLTDLS */ | |
2326 | ||
2327 | #if defined(VSDB) || defined(ROAM_ENABLE) | |
2328 | #define DEFAULT_BCN_TIMEOUT 8 | |
2329 | #else | |
2330 | #define DEFAULT_BCN_TIMEOUT 4 | |
2331 | #endif /* CUSTOMER_HW4 && (VSDB || ROAM_ENABLE) */ | |
2332 | ||
2333 | #ifndef CUSTOM_BCN_TIMEOUT | |
2334 | #define CUSTOM_BCN_TIMEOUT DEFAULT_BCN_TIMEOUT | |
2335 | #endif // endif | |
2336 | ||
2337 | #define MAX_DTIM_SKIP_BEACON_INTERVAL 100 /* max allowed associated AP beacon for DTIM skip */ | |
2338 | #ifndef MAX_DTIM_ALLOWED_INTERVAL | |
2339 | #define MAX_DTIM_ALLOWED_INTERVAL 600 /* max allowed total beacon interval for DTIM skip */ | |
2340 | #endif // endif | |
2341 | ||
2342 | #ifndef MIN_DTIM_FOR_ROAM_THRES_EXTEND | |
2343 | #define MIN_DTIM_FOR_ROAM_THRES_EXTEND 600 /* minimum dtim interval to extend roam threshold */ | |
2344 | #endif // endif | |
2345 | ||
2346 | #define NO_DTIM_SKIP 1 | |
2347 | #ifdef SDTEST | |
2348 | /* Echo packet generator (SDIO), pkts/s */ | |
2349 | extern uint dhd_pktgen; | |
2350 | ||
2351 | /* Echo packet len (0 => sawtooth, max 1800) */ | |
2352 | extern uint dhd_pktgen_len; | |
2353 | #define MAX_PKTGEN_LEN 1800 | |
2354 | #endif // endif | |
2355 | ||
2356 | /* optionally set by a module_param_string() */ | |
2357 | #define MOD_PARAM_PATHLEN 2048 | |
2358 | #define MOD_PARAM_INFOLEN 512 | |
2359 | #define MOD_PARAM_SRLEN 64 | |
2360 | ||
2361 | #ifdef SOFTAP | |
2362 | extern char fw_path2[MOD_PARAM_PATHLEN]; | |
2363 | #endif // endif | |
2364 | ||
2365 | #if defined(ANDROID_PLATFORM_VERSION) | |
2366 | #if (ANDROID_PLATFORM_VERSION < 7) | |
2367 | #define DHD_LEGACY_FILE_PATH | |
2368 | #define VENDOR_PATH "/system" | |
2369 | #elif (ANDROID_PLATFORM_VERSION == 7) | |
2370 | #define VENDOR_PATH "/system" | |
2371 | #elif (ANDROID_PLATFORM_VERSION >= 8) | |
2372 | #define VENDOR_PATH "/vendor" | |
2373 | #endif /* ANDROID_PLATFORM_VERSION < 7 */ | |
2374 | #else | |
2375 | #define VENDOR_PATH "" | |
2376 | #endif /* ANDROID_PLATFORM_VERSION */ | |
2377 | ||
2378 | #if defined(ANDROID_PLATFORM_VERSION) | |
2379 | #if (ANDROID_PLATFORM_VERSION < 9) | |
2380 | #ifdef WL_STATIC_IF | |
2381 | #undef WL_STATIC_IF | |
2382 | #endif /* WL_STATIC_IF */ | |
2383 | #ifdef WL_STATIC_IFNAME_PREFIX | |
2384 | #undef WL_STATIC_IFNAME_PREFIX | |
2385 | #endif /* WL_STATIC_IFNAME_PREFIX */ | |
5a068558 MB |
2386 | #ifdef IFACE_HANG_FORCE_DEV_CLOSE |
2387 | #undef IFACE_HANG_FORCE_DEV_CLOSE | |
2388 | #endif /* IFACE_HANG_FORCE_DEV_CLOSE */ | |
1cac41cb MB |
2389 | #endif /* ANDROID_PLATFORM_VERSION < 9 */ |
2390 | #endif /* ANDROID_PLATFORM_VERSION */ | |
2391 | ||
2392 | #if defined(DHD_LEGACY_FILE_PATH) | |
2393 | #define PLATFORM_PATH "/data/" | |
2394 | #elif defined(PLATFORM_SLP) | |
2395 | #define PLATFORM_PATH "/opt/etc/" | |
2396 | #else | |
2397 | #if defined(ANDROID_PLATFORM_VERSION) | |
2398 | #if (ANDROID_PLATFORM_VERSION >= 9) | |
2399 | #define PLATFORM_PATH "/data/vendor/conn/" | |
2400 | #define DHD_MAC_ADDR_EXPORT | |
5a068558 | 2401 | #if defined(WL_BAM) |
1cac41cb | 2402 | #define DHD_ADPS_BAM_EXPORT |
5a068558 | 2403 | #endif /* WL_BAM */ |
1cac41cb MB |
2404 | #define DHD_EXPORT_CNTL_FILE |
2405 | #define DHD_SOFTAP_DUAL_IF_INFO | |
5a068558 | 2406 | #define DHD_SEND_HANG_PRIVCMD_ERRORS |
1cac41cb MB |
2407 | /* ANDROID P(9.0) and later, always use single nvram file */ |
2408 | #ifndef DHD_USE_SINGLE_NVRAM_FILE | |
2409 | #define DHD_USE_SINGLE_NVRAM_FILE | |
2410 | #endif /* !DHD_USE_SINGLE_NVRAM_FILE */ | |
2411 | #else | |
2412 | #define PLATFORM_PATH "/data/misc/conn/" | |
2413 | #endif /* ANDROID_PLATFORM_VERSION >= 9 */ | |
2414 | #else | |
2415 | #define PLATFORM_PATH "/data/misc/conn/" | |
2416 | #endif /* ANDROID_PLATFORM_VERSION */ | |
2417 | #endif /* DHD_LEGACY_FILE_PATH */ | |
2418 | ||
2419 | #ifdef DHD_MAC_ADDR_EXPORT | |
2420 | extern struct ether_addr sysfs_mac_addr; | |
2421 | #endif /* DHD_MAC_ADDR_EXPORT */ | |
2422 | ||
2423 | /* Flag to indicate if we should download firmware on driver load */ | |
2424 | extern uint dhd_download_fw_on_driverload; | |
2425 | extern int allow_delay_fwdl; | |
2426 | ||
2427 | extern int dhd_process_cid_mac(dhd_pub_t *dhdp, bool prepost); | |
2428 | extern int dhd_write_file(const char *filepath, char *buf, int buf_len); | |
2429 | extern int dhd_read_file(const char *filepath, char *buf, int buf_len); | |
2430 | extern int dhd_write_file_and_check(const char *filepath, char *buf, int buf_len); | |
2431 | ||
2432 | #ifdef READ_MACADDR | |
2433 | extern int dhd_set_macaddr_from_file(dhd_pub_t *dhdp); | |
2434 | #else | |
2435 | static INLINE int dhd_set_macaddr_from_file(dhd_pub_t *dhdp) { return 0; } | |
2436 | #endif /* READ_MACADDR */ | |
2437 | #ifdef WRITE_MACADDR | |
2438 | extern int dhd_write_macaddr(struct ether_addr *mac); | |
2439 | #else | |
2440 | static INLINE int dhd_write_macaddr(struct ether_addr *mac) { return 0; } | |
2441 | #endif /* WRITE_MACADDR */ | |
2442 | #ifdef USE_CID_CHECK | |
2443 | #define MAX_VNAME_LEN 64 | |
2444 | #ifdef DHD_EXPORT_CNTL_FILE | |
2445 | extern char cidinfostr[MAX_VNAME_LEN]; | |
2446 | #endif /* DHD_EXPORT_CNTL_FILE */ | |
2447 | extern int dhd_check_module_cid(dhd_pub_t *dhdp); | |
2448 | extern char *dhd_get_cid_info(unsigned char *vid, int vid_length); | |
2449 | #else | |
2450 | static INLINE int dhd_check_module_cid(dhd_pub_t *dhdp) { return 0; } | |
2451 | #endif /* USE_CID_CHECK */ | |
2452 | #ifdef GET_MAC_FROM_OTP | |
2453 | extern int dhd_check_module_mac(dhd_pub_t *dhdp); | |
2454 | #else | |
2455 | static INLINE int dhd_check_module_mac(dhd_pub_t *dhdp) { return 0; } | |
2456 | #endif /* GET_MAC_FROM_OTP */ | |
2457 | ||
2458 | #if defined(READ_MACADDR) || defined(WRITE_MACADDR) || defined(USE_CID_CHECK) || \ | |
2459 | defined(GET_MAC_FROM_OTP) | |
2460 | #define DHD_USE_CISINFO | |
2461 | #endif /* READ_MACADDR || WRITE_MACADDR || USE_CID_CHECK || GET_MAC_FROM_OTP */ | |
2462 | ||
2463 | #ifdef DHD_USE_CISINFO | |
2464 | int dhd_read_cis(dhd_pub_t *dhdp); | |
2465 | void dhd_clear_cis(dhd_pub_t *dhdp); | |
2466 | #if defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) | |
2467 | bool dhd_check_module(char *module_name); | |
2468 | extern int dhd_check_module_b85a(void); | |
2469 | extern int dhd_check_module_b90(void); | |
2470 | #define BCM4359_MODULE_TYPE_B90B 1 | |
2471 | #define BCM4359_MODULE_TYPE_B90S 2 | |
2472 | #endif /* defined(SUPPORT_MULTIPLE_MODULE_CIS) && defined(USE_CID_CHECK) */ | |
2473 | #if defined(SUPPORT_BCM4361_MIXED_MODULES) && defined(USE_CID_CHECK) | |
2474 | extern int dhd_check_module_bcm4361(char *module_type, int index, bool *is_murata_fem); | |
2475 | #endif /* defined(SUPPORT_BCM4361_MIXED_MODULES) && defined(USE_CID_CHECK) */ | |
2476 | #else | |
2477 | static INLINE int dhd_read_cis(dhd_pub_t *dhdp) { return 0; } | |
2478 | static INLINE void dhd_clear_cis(dhd_pub_t *dhdp) { } | |
2479 | #endif /* DHD_USE_CISINFO */ | |
2480 | ||
2481 | #if defined(WL_CFG80211) && defined(SUPPORT_DEEP_SLEEP) | |
2482 | /* Flags to indicate if we distingish power off policy when | |
2483 | * user set the memu "Keep Wi-Fi on during sleep" to "Never" | |
2484 | */ | |
2485 | extern int trigger_deep_sleep; | |
2486 | int dhd_deepsleep(struct net_device *dev, int flag); | |
2487 | #endif /* WL_CFG80211 && SUPPORT_DEEP_SLEEP */ | |
2488 | ||
2489 | extern void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar); | |
2490 | extern void dhd_wait_event_wakeup(dhd_pub_t*dhd); | |
2491 | ||
2492 | #define IFLOCK_INIT(lock) *lock = 0 | |
2493 | #define IFLOCK(lock) while (InterlockedCompareExchange((lock), 1, 0)) \ | |
2494 | NdisStallExecution(1); | |
2495 | #define IFUNLOCK(lock) InterlockedExchange((lock), 0) | |
2496 | #define IFLOCK_FREE(lock) | |
2497 | #define FW_SUPPORTED(dhd, capa) ((strstr(dhd->fw_capabilities, " " #capa " ") != NULL)) | |
2498 | #ifdef ARP_OFFLOAD_SUPPORT | |
2499 | #define MAX_IPV4_ENTRIES 8 | |
2500 | void dhd_arp_offload_set(dhd_pub_t * dhd, int arp_mode); | |
2501 | void dhd_arp_offload_enable(dhd_pub_t * dhd, int arp_enable); | |
2502 | ||
2503 | /* dhd_commn arp offload wrapers */ | |
2504 | void dhd_aoe_hostip_clr(dhd_pub_t *dhd, int idx); | |
2505 | void dhd_aoe_arp_clr(dhd_pub_t *dhd, int idx); | |
2506 | int dhd_arp_get_arp_hostip_table(dhd_pub_t *dhd, void *buf, int buflen, int idx); | |
2507 | void dhd_arp_offload_add_ip(dhd_pub_t *dhd, uint32 ipaddr, int idx); | |
2508 | #endif /* ARP_OFFLOAD_SUPPORT */ | |
2509 | #ifdef WLTDLS | |
2510 | int dhd_tdls_enable(struct net_device *dev, bool tdls_on, bool auto_on, struct ether_addr *mac); | |
2511 | int dhd_tdls_set_mode(dhd_pub_t *dhd, bool wfd_mode); | |
2512 | #ifdef PCIE_FULL_DONGLE | |
2513 | int dhd_tdls_update_peer_info(dhd_pub_t *dhdp, wl_event_msg_t *event); | |
2514 | int dhd_tdls_event_handler(dhd_pub_t *dhd_pub, wl_event_msg_t *event); | |
2515 | int dhd_free_tdls_peer_list(dhd_pub_t *dhd_pub); | |
2516 | #endif /* PCIE_FULL_DONGLE */ | |
2517 | #endif /* WLTDLS */ | |
2518 | ||
2519 | /* Neighbor Discovery Offload Support */ | |
2520 | extern int dhd_ndo_enable(dhd_pub_t * dhd, int ndo_enable); | |
2521 | int dhd_ndo_add_ip(dhd_pub_t *dhd, char* ipaddr, int idx); | |
2522 | int dhd_ndo_remove_ip(dhd_pub_t *dhd, int idx); | |
2523 | ||
2524 | /* Enhanced ND offload support */ | |
2525 | uint16 dhd_ndo_get_version(dhd_pub_t *dhdp); | |
2526 | int dhd_ndo_add_ip_with_type(dhd_pub_t *dhdp, char *ipv6addr, uint8 type, int idx); | |
2527 | int dhd_ndo_remove_ip_by_addr(dhd_pub_t *dhdp, char *ipv6addr, int idx); | |
2528 | int dhd_ndo_remove_ip_by_type(dhd_pub_t *dhdp, uint8 type, int idx); | |
2529 | int dhd_ndo_unsolicited_na_filter_enable(dhd_pub_t *dhdp, int enable); | |
2530 | ||
2531 | /* ioctl processing for nl80211 */ | |
2532 | int dhd_ioctl_process(dhd_pub_t *pub, int ifidx, struct dhd_ioctl *ioc, void *data_buf); | |
2533 | ||
2534 | #if defined(SUPPORT_MULTIPLE_REVISION) | |
2535 | extern int | |
2536 | concate_revision(struct dhd_bus *bus, char *fwpath, char *nvpath); | |
2537 | #endif /* SUPPORT_MULTIPLE_REVISION */ | |
2538 | void dhd_bus_update_fw_nv_path(struct dhd_bus *bus, char *pfw_path, char *pnv_path); | |
2539 | void dhd_set_bus_state(void *bus, uint32 state); | |
2540 | ||
2541 | /* Remove proper pkts(either one no-frag pkt or whole fragmented pkts) */ | |
2542 | typedef int (*f_droppkt_t)(dhd_pub_t *dhdp, int prec, void* p, bool bPktInQ); | |
2543 | extern bool dhd_prec_drop_pkts(dhd_pub_t *dhdp, struct pktq *pq, int prec, f_droppkt_t fn); | |
2544 | ||
2545 | #ifdef PROP_TXSTATUS | |
2546 | int dhd_os_wlfc_block(dhd_pub_t *pub); | |
2547 | int dhd_os_wlfc_unblock(dhd_pub_t *pub); | |
2548 | extern const uint8 prio2fifo[]; | |
2549 | #endif /* PROP_TXSTATUS */ | |
2550 | ||
2551 | int dhd_os_socram_dump(struct net_device *dev, uint32 *dump_size); | |
2552 | int dhd_os_get_socram_dump(struct net_device *dev, char **buf, uint32 *size); | |
2553 | int dhd_common_socram_dump(dhd_pub_t *dhdp); | |
2554 | ||
2555 | int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen); | |
2556 | ||
2557 | int dhd_os_get_version(struct net_device *dev, bool dhd_ver, char **buf, uint32 size); | |
2558 | ||
2559 | uint8* dhd_os_prealloc(dhd_pub_t *dhdpub, int section, uint size, bool kmalloc_if_fail); | |
2560 | void dhd_os_prefree(dhd_pub_t *dhdpub, void *addr, uint size); | |
2561 | ||
2562 | #if defined(CONFIG_DHD_USE_STATIC_BUF) | |
2563 | #define DHD_OS_PREALLOC(dhdpub, section, size) dhd_os_prealloc(dhdpub, section, size, FALSE) | |
2564 | #define DHD_OS_PREFREE(dhdpub, addr, size) dhd_os_prefree(dhdpub, addr, size) | |
2565 | #else | |
2566 | #define DHD_OS_PREALLOC(dhdpub, section, size) MALLOC(dhdpub->osh, size) | |
2567 | #define DHD_OS_PREFREE(dhdpub, addr, size) MFREE(dhdpub->osh, addr, size) | |
2568 | #endif /* defined(CONFIG_DHD_USE_STATIC_BUF) */ | |
2569 | ||
2570 | #ifdef USE_WFA_CERT_CONF | |
2571 | enum { | |
2572 | SET_PARAM_BUS_TXGLOM_MODE, | |
2573 | SET_PARAM_ROAMOFF, | |
2574 | #ifdef USE_WL_FRAMEBURST | |
2575 | SET_PARAM_FRAMEBURST, | |
2576 | #endif /* USE_WL_FRAMEBURST */ | |
2577 | #ifdef USE_WL_TXBF | |
2578 | SET_PARAM_TXBF, | |
2579 | #endif /* USE_WL_TXBF */ | |
2580 | #ifdef PROP_TXSTATUS | |
2581 | SET_PARAM_PROPTX, | |
2582 | SET_PARAM_PROPTXMODE, | |
2583 | #endif /* PROP_TXSTATUS */ | |
2584 | PARAM_LAST_VALUE | |
2585 | }; | |
2586 | extern int sec_get_param_wfa_cert(dhd_pub_t *dhd, int mode, uint* read_val); | |
2587 | #ifdef DHD_EXPORT_CNTL_FILE | |
2588 | #define VALUENOTSET 0xFFFFFFFFu | |
2589 | extern uint32 bus_txglom; | |
2590 | extern uint32 roam_off; | |
2591 | #ifdef USE_WL_FRAMEBURST | |
2592 | extern uint32 frameburst; | |
2593 | #endif /* USE_WL_FRAMEBURST */ | |
2594 | #ifdef USE_WL_TXBF | |
2595 | extern uint32 txbf; | |
2596 | #endif /* USE_WL_TXBF */ | |
2597 | #ifdef PROP_TXSTATUS | |
2598 | extern uint32 proptx; | |
2599 | #endif /* PROP_TXSTATUS */ | |
2600 | #endif /* DHD_EXPORT_CNTL_FILE */ | |
2601 | #endif /* USE_WFA_CERT_CONF */ | |
2602 | ||
2603 | #define dhd_add_flowid(pub, ifidx, ac_prio, ea, flowid) do {} while (0) | |
2604 | #define dhd_del_flowid(pub, ifidx, flowid) do {} while (0) | |
2605 | bool dhd_wet_chainable(dhd_pub_t *dhdp); | |
2606 | ||
2607 | extern unsigned long dhd_os_general_spin_lock(dhd_pub_t *pub); | |
2608 | extern void dhd_os_general_spin_unlock(dhd_pub_t *pub, unsigned long flags); | |
2609 | ||
2610 | /** Miscellaenous DHD Spin Locks */ | |
2611 | ||
2612 | /* Disable router 3GMAC bypass path perimeter lock */ | |
2613 | #define DHD_PERIM_LOCK(dhdp) do {} while (0) | |
2614 | #define DHD_PERIM_UNLOCK(dhdp) do {} while (0) | |
2615 | #define DHD_PERIM_LOCK_ALL(processor_id) do {} while (0) | |
2616 | #define DHD_PERIM_UNLOCK_ALL(processor_id) do {} while (0) | |
2617 | ||
2618 | /* Enable DHD general spin lock/unlock */ | |
2619 | #define DHD_GENERAL_LOCK(dhdp, flags) \ | |
2620 | (flags) = dhd_os_general_spin_lock(dhdp) | |
2621 | #define DHD_GENERAL_UNLOCK(dhdp, flags) \ | |
2622 | dhd_os_general_spin_unlock((dhdp), (flags)) | |
2623 | ||
2624 | /* Enable DHD timer spin lock/unlock */ | |
2625 | #define DHD_TIMER_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2626 | #define DHD_TIMER_UNLOCK(lock, flags) dhd_os_spin_unlock(lock, (flags)) | |
2627 | ||
2628 | /* Enable DHD flowring spin lock/unlock */ | |
2629 | #define DHD_FLOWRING_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2630 | #define DHD_FLOWRING_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2631 | ||
2632 | /* Enable DHD common flowring info spin lock/unlock */ | |
2633 | #define DHD_FLOWID_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2634 | #define DHD_FLOWID_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2635 | ||
2636 | /* Enable DHD common flowring list spin lock/unlock */ | |
2637 | #define DHD_FLOWRING_LIST_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2638 | #define DHD_FLOWRING_LIST_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2639 | ||
2640 | #define DHD_SPIN_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2641 | #define DHD_SPIN_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2642 | ||
2643 | #define DHD_RING_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2644 | #define DHD_RING_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2645 | ||
2646 | #define DHD_BUS_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2647 | #define DHD_BUS_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2648 | ||
2649 | #define DHD_BUS_INB_DW_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2650 | #define DHD_BUS_INB_DW_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2651 | ||
2652 | /* Enable DHD TDLS peer list spin lock/unlock */ | |
2653 | #ifdef WLTDLS | |
2654 | #define DHD_TDLS_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2655 | #define DHD_TDLS_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2656 | #endif /* WLTDLS */ | |
2657 | ||
2658 | #define DHD_BUS_INB_DW_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2659 | #define DHD_BUS_INB_DW_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags)) | |
2660 | ||
2661 | #ifdef DBG_PKT_MON | |
2662 | /* Enable DHD PKT MON spin lock/unlock */ | |
2663 | #define DHD_PKT_MON_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock) | |
2664 | #define DHD_PKT_MON_UNLOCK(lock, flags) dhd_os_spin_unlock(lock, (flags)) | |
2665 | #endif /* DBG_PKT_MON */ | |
2666 | ||
2667 | #define DHD_LINUX_GENERAL_LOCK(dhdp, flags) DHD_GENERAL_LOCK(dhdp, flags) | |
2668 | #define DHD_LINUX_GENERAL_UNLOCK(dhdp, flags) DHD_GENERAL_UNLOCK(dhdp, flags) | |
2669 | ||
2670 | /* linux is defined for DHD EFI builds also, | |
2671 | * since its cross-compiled for EFI from linux | |
2672 | */ | |
2673 | #define DHD_DBG_RING_LOCK_INIT(osh) dhd_os_dbgring_lock_init(osh) | |
2674 | #define DHD_DBG_RING_LOCK_DEINIT(osh, lock) dhd_os_dbgring_lock_deinit(osh, (lock)) | |
2675 | #define DHD_DBG_RING_LOCK(lock, flags) (flags) = dhd_os_dbgring_lock(lock) | |
2676 | #define DHD_DBG_RING_UNLOCK(lock, flags) dhd_os_dbgring_unlock((lock), flags) | |
2677 | ||
2678 | extern void dhd_dump_to_kernelog(dhd_pub_t *dhdp); | |
2679 | ||
2680 | extern void dhd_print_tasklet_status(dhd_pub_t *dhd); | |
2681 | ||
2682 | #ifdef DHD_L2_FILTER | |
2683 | extern int dhd_get_parp_status(dhd_pub_t *dhdp, uint32 idx); | |
2684 | extern int dhd_set_parp_status(dhd_pub_t *dhdp, uint32 idx, int val); | |
2685 | extern int dhd_get_dhcp_unicast_status(dhd_pub_t *dhdp, uint32 idx); | |
2686 | extern int dhd_set_dhcp_unicast_status(dhd_pub_t *dhdp, uint32 idx, int val); | |
2687 | extern int dhd_get_block_ping_status(dhd_pub_t *dhdp, uint32 idx); | |
2688 | extern int dhd_set_block_ping_status(dhd_pub_t *dhdp, uint32 idx, int val); | |
2689 | extern int dhd_get_grat_arp_status(dhd_pub_t *dhdp, uint32 idx); | |
2690 | extern int dhd_set_grat_arp_status(dhd_pub_t *dhdp, uint32 idx, int val); | |
2691 | extern int dhd_get_block_tdls_status(dhd_pub_t *dhdp, uint32 idx); | |
2692 | extern int dhd_set_block_tdls_status(dhd_pub_t *dhdp, uint32 idx, int val); | |
2693 | #endif /* DHD_L2_FILTER */ | |
2694 | ||
2695 | typedef struct wl_io_pport { | |
2696 | dhd_pub_t *dhd_pub; | |
2697 | uint ifidx; | |
2698 | } wl_io_pport_t; | |
2699 | ||
2700 | typedef struct wl_evt_pport { | |
2701 | dhd_pub_t *dhd_pub; | |
2702 | int *ifidx; | |
2703 | void *pktdata; | |
2704 | uint data_len; | |
2705 | void **data_ptr; | |
2706 | void *raw_event; | |
2707 | } wl_evt_pport_t; | |
2708 | ||
2709 | extern void *dhd_pub_shim(dhd_pub_t *dhd_pub); | |
2710 | #ifdef DHD_FW_COREDUMP | |
2711 | void* dhd_get_fwdump_buf(dhd_pub_t *dhd_pub, uint32 length); | |
2712 | #endif /* DHD_FW_COREDUMP */ | |
2713 | ||
2714 | #if defined(SET_RPS_CPUS) || defined(ARGOS_RPS_CPU_CTL) | |
2715 | int dhd_rps_cpus_enable(struct net_device *net, int enable); | |
2716 | int custom_rps_map_set(struct netdev_rx_queue *queue, char *buf, size_t len); | |
2717 | void custom_rps_map_clear(struct netdev_rx_queue *queue); | |
2718 | #define PRIMARY_INF 0 | |
2719 | #define VIRTUAL_INF 1 | |
2720 | #if defined(CONFIG_MACH_UNIVERSAL5433) || defined(CONFIG_MACH_UNIVERSAL7420) || \ | |
2721 | defined(CONFIG_SOC_EXYNOS8890) | |
2722 | #define RPS_CPUS_MASK "10" | |
2723 | #define RPS_CPUS_MASK_P2P "10" | |
2724 | #define RPS_CPUS_MASK_IBSS "10" | |
2725 | #define RPS_CPUS_WLAN_CORE_ID 4 | |
2726 | #else | |
2727 | #define RPS_CPUS_MASK "6" | |
2728 | #define RPS_CPUS_MASK_P2P "6" | |
2729 | #define RPS_CPUS_MASK_IBSS "6" | |
2730 | #endif /* CONFIG_MACH_UNIVERSAL5433 || CONFIG_MACH_UNIVERSAL7420 || CONFIG_SOC_EXYNOS8890 */ | |
2731 | #endif /* SET_RPS_CPUS || ARGOS_RPS_CPU_CTL */ | |
2732 | ||
2733 | int dhd_get_download_buffer(dhd_pub_t *dhd, char *file_path, download_type_t component, | |
2734 | char ** buffer, int *length); | |
2735 | ||
2736 | void dhd_free_download_buffer(dhd_pub_t *dhd, void *buffer, int length); | |
2737 | ||
2738 | int dhd_download_blob(dhd_pub_t *dhd, unsigned char *buf, | |
2739 | uint32 len, char *iovar); | |
2740 | ||
2741 | int dhd_download_blob_cached(dhd_pub_t *dhd, char *file_path, | |
2742 | uint32 len, char *iovar); | |
2743 | ||
2744 | int dhd_apply_default_txcap(dhd_pub_t *dhd, char *txcap_path); | |
2745 | int dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path); | |
2746 | #ifdef DHD_USE_CLMINFO_PARSER | |
2747 | int dhd_get_clminfo(dhd_pub_t *dhd, char *clm_path); | |
2748 | #define NUM_OF_COUNTRYS 150 | |
2749 | #endif /* DHD_USE_CLMINFO_PARSER */ | |
2750 | ||
2751 | #ifdef SHOW_LOGTRACE | |
2752 | int dhd_parse_logstrs_file(osl_t *osh, char *raw_fmts, int logstrs_size, | |
2753 | dhd_event_log_t *event_log); | |
2754 | int dhd_parse_map_file(osl_t *osh, void *file, uint32 *ramstart, | |
2755 | uint32 *rodata_start, uint32 *rodata_end); | |
2756 | #ifdef PCIE_FULL_DONGLE | |
2757 | int dhd_event_logtrace_infobuf_pkt_process(dhd_pub_t *dhdp, void *pktbuf, | |
2758 | dhd_event_log_t *event_data); | |
2759 | #endif /* PCIE_FULL_DONGLE */ | |
2760 | #endif /* SHOW_LOGTRACE */ | |
2761 | ||
2762 | #define dhd_is_device_removed(x) FALSE | |
2763 | #define dhd_os_ind_firmware_stall(x) | |
2764 | ||
2765 | #if defined(DHD_FW_COREDUMP) | |
2766 | extern void dhd_get_memdump_info(dhd_pub_t *dhd); | |
2767 | #endif /* defined(DHD_FW_COREDUMP) */ | |
2768 | #ifdef BCMASSERT_LOG | |
2769 | extern void dhd_get_assert_info(dhd_pub_t *dhd); | |
2770 | #else | |
2771 | static INLINE void dhd_get_assert_info(dhd_pub_t *dhd) { } | |
2772 | #endif /* BCMASSERT_LOG */ | |
2773 | ||
2774 | #define DMAXFER_FREE(dhdp, dmap) dhd_schedule_dmaxfer_free(dhdp, dmap); | |
2775 | ||
2776 | #if defined(PCIE_FULL_DONGLE) | |
2777 | extern void dmaxfer_free_prev_dmaaddr(dhd_pub_t *dhdp, dmaxref_mem_map_t *dmmap); | |
2778 | void dhd_schedule_dmaxfer_free(dhd_pub_t *dhdp, dmaxref_mem_map_t *dmmap); | |
2779 | #endif /* PCIE_FULL_DONGLE */ | |
2780 | ||
2781 | #define DHD_LB_STATS_NOOP do { /* noop */ } while (0) | |
2782 | #if defined(DHD_LB_STATS) | |
2783 | #include <bcmutils.h> | |
2784 | extern void dhd_lb_stats_init(dhd_pub_t *dhd); | |
2785 | extern void dhd_lb_stats_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); | |
2786 | extern void dhd_lb_stats_update_napi_histo(dhd_pub_t *dhdp, uint32 count); | |
2787 | extern void dhd_lb_stats_update_txc_histo(dhd_pub_t *dhdp, uint32 count); | |
2788 | extern void dhd_lb_stats_update_rxc_histo(dhd_pub_t *dhdp, uint32 count); | |
2789 | extern void dhd_lb_stats_txc_percpu_cnt_incr(dhd_pub_t *dhdp); | |
2790 | extern void dhd_lb_stats_rxc_percpu_cnt_incr(dhd_pub_t *dhdp); | |
2791 | #define DHD_LB_STATS_INIT(dhdp) dhd_lb_stats_init(dhdp) | |
2792 | #define DHD_LB_STATS_DEINIT(dhdp) dhd_lb_stats_deinit(dhdp) | |
2793 | /* Reset is called from common layer so it takes dhd_pub_t as argument */ | |
2794 | #define DHD_LB_STATS_RESET(dhdp) dhd_lb_stats_init(dhdp) | |
2795 | #define DHD_LB_STATS_CLR(x) (x) = 0U | |
2796 | #define DHD_LB_STATS_INCR(x) (x) = (x) + 1 | |
2797 | #define DHD_LB_STATS_ADD(x, c) (x) = (x) + (c) | |
2798 | #define DHD_LB_STATS_PERCPU_ARR_INCR(x) \ | |
2799 | { \ | |
2800 | int cpu = get_cpu(); put_cpu(); \ | |
2801 | DHD_LB_STATS_INCR(x[cpu]); \ | |
2802 | } | |
2803 | #define DHD_LB_STATS_UPDATE_NAPI_HISTO(dhdp, x) dhd_lb_stats_update_napi_histo(dhdp, x) | |
2804 | #define DHD_LB_STATS_UPDATE_TXC_HISTO(dhdp, x) dhd_lb_stats_update_txc_histo(dhdp, x) | |
2805 | #define DHD_LB_STATS_UPDATE_RXC_HISTO(dhdp, x) dhd_lb_stats_update_rxc_histo(dhdp, x) | |
2806 | #define DHD_LB_STATS_TXC_PERCPU_CNT_INCR(dhdp) dhd_lb_stats_txc_percpu_cnt_incr(dhdp) | |
2807 | #define DHD_LB_STATS_RXC_PERCPU_CNT_INCR(dhdp) dhd_lb_stats_rxc_percpu_cnt_incr(dhdp) | |
2808 | #else /* !DHD_LB_STATS */ | |
2809 | #define DHD_LB_STATS_INIT(dhdp) DHD_LB_STATS_NOOP | |
2810 | #define DHD_LB_STATS_DEINIT(dhdp) DHD_LB_STATS_NOOP | |
2811 | #define DHD_LB_STATS_RESET(dhdp) DHD_LB_STATS_NOOP | |
2812 | #define DHD_LB_STATS_CLR(x) DHD_LB_STATS_NOOP | |
2813 | #define DHD_LB_STATS_INCR(x) DHD_LB_STATS_NOOP | |
2814 | #define DHD_LB_STATS_ADD(x, c) DHD_LB_STATS_NOOP | |
2815 | #define DHD_LB_STATS_PERCPU_ARR_INCR(x) DHD_LB_STATS_NOOP | |
2816 | #define DHD_LB_STATS_UPDATE_NAPI_HISTO(dhd, x) DHD_LB_STATS_NOOP | |
2817 | #define DHD_LB_STATS_UPDATE_TXC_HISTO(dhd, x) DHD_LB_STATS_NOOP | |
2818 | #define DHD_LB_STATS_UPDATE_RXC_HISTO(dhd, x) DHD_LB_STATS_NOOP | |
2819 | #define DHD_LB_STATS_TXC_PERCPU_CNT_INCR(dhdp) DHD_LB_STATS_NOOP | |
2820 | #define DHD_LB_STATS_RXC_PERCPU_CNT_INCR(dhdp) DHD_LB_STATS_NOOP | |
2821 | #endif /* !DHD_LB_STATS */ | |
2822 | #ifdef DHD_LB_IRQSET | |
2823 | extern void dhd_irq_set_affinity(dhd_pub_t *dhdp); | |
2824 | #endif /* DHD_LB_IRQSET */ | |
2825 | ||
2826 | #ifdef DHD_SSSR_DUMP | |
2827 | #define DHD_SSSR_MEMPOOL_SIZE (1024 * 1024) /* 1MB size */ | |
2828 | extern int dhd_sssr_mempool_init(dhd_pub_t *dhd); | |
2829 | extern void dhd_sssr_mempool_deinit(dhd_pub_t *dhd); | |
2830 | extern int dhd_sssr_dump_init(dhd_pub_t *dhd); | |
2831 | extern void dhd_sssr_dump_deinit(dhd_pub_t *dhd); | |
2832 | #define DHD_SSSR_MEMPOOL_INIT(dhdp) dhd_sssr_mempool_init(dhdp) | |
2833 | #define DHD_SSSR_MEMPOOL_DEINIT(dhdp) dhd_sssr_mempool_deinit(dhdp) | |
2834 | #define DHD_SSSR_DUMP_INIT(dhdp) dhd_sssr_dump_init(dhdp) | |
2835 | #define DHD_SSSR_DUMP_DEINIT(dhdp) dhd_sssr_dump_deinit(dhdp) | |
2836 | #else | |
2837 | #define DHD_SSSR_MEMPOOL_INIT(dhdp) do { /* noop */ } while (0) | |
2838 | #define DHD_SSSR_MEMPOOL_DEINIT(dhdp) do { /* noop */ } while (0) | |
2839 | #define DHD_SSSR_DUMP_INIT(dhdp) do { /* noop */ } while (0) | |
2840 | #define DHD_SSSR_DUMP_DEINIT(dhdp) do { /* noop */ } while (0) | |
2841 | #endif /* DHD_SSSR_DUMP */ | |
2842 | ||
2843 | #ifdef SHOW_LOGTRACE | |
2844 | void dhd_get_read_buf_ptr(dhd_pub_t *dhd_pub, trace_buf_info_t *read_buf_info); | |
2845 | #endif /* SHOW_LOGTRACE */ | |
2846 | ||
2847 | #ifdef BCMPCIE | |
2848 | extern int dhd_prot_debug_info_print(dhd_pub_t *dhd); | |
2849 | extern bool dhd_bus_skip_clm(dhd_pub_t *dhdp); | |
2850 | extern void dhd_pcie_dump_rc_conf_space_cap(dhd_pub_t *dhd); | |
2851 | extern bool dhd_pcie_dump_int_regs(dhd_pub_t *dhd); | |
2852 | #else | |
2853 | #define dhd_prot_debug_info_print(x) | |
2854 | static INLINE bool dhd_bus_skip_clm(dhd_pub_t *dhd_pub) | |
2855 | { return 0; } | |
2856 | #endif /* BCMPCIE */ | |
2857 | ||
2858 | bool dhd_fw_download_status(dhd_pub_t * dhd_pub); | |
2859 | void dhd_show_kirqstats(dhd_pub_t *dhd); | |
2860 | ||
2861 | /* Bitmask used for Join Timeout */ | |
2862 | #define WLC_SSID_MASK 0x01 | |
2863 | #define WLC_WPA_MASK 0x02 | |
2864 | ||
2865 | extern int dhd_start_join_timer(dhd_pub_t *pub); | |
2866 | extern int dhd_stop_join_timer(dhd_pub_t *pub); | |
2867 | extern int dhd_start_scan_timer(dhd_pub_t *pub, bool is_escan); | |
2868 | extern int dhd_stop_scan_timer(dhd_pub_t *pub, bool is_escan, uint16 sync_id); | |
2869 | extern int dhd_start_cmd_timer(dhd_pub_t *pub); | |
2870 | extern int dhd_stop_cmd_timer(dhd_pub_t *pub); | |
2871 | extern int dhd_start_bus_timer(dhd_pub_t *pub); | |
2872 | extern int dhd_stop_bus_timer(dhd_pub_t *pub); | |
2873 | extern uint16 dhd_get_request_id(dhd_pub_t *pub); | |
2874 | extern int dhd_set_request_id(dhd_pub_t *pub, uint16 id, uint32 cmd); | |
2875 | extern void dhd_set_join_error(dhd_pub_t *pub, uint32 mask); | |
2876 | extern void dhd_clear_join_error(dhd_pub_t *pub, uint32 mask); | |
2877 | extern void dhd_get_scan_to_val(dhd_pub_t *pub, uint32 *to_val); | |
2878 | extern void dhd_set_scan_to_val(dhd_pub_t *pub, uint32 to_val); | |
2879 | extern void dhd_get_join_to_val(dhd_pub_t *pub, uint32 *to_val); | |
2880 | extern void dhd_set_join_to_val(dhd_pub_t *pub, uint32 to_val); | |
2881 | extern void dhd_get_cmd_to_val(dhd_pub_t *pub, uint32 *to_val); | |
2882 | extern void dhd_set_cmd_to_val(dhd_pub_t *pub, uint32 to_val); | |
2883 | extern void dhd_get_bus_to_val(dhd_pub_t *pub, uint32 *to_val); | |
2884 | extern void dhd_set_bus_to_val(dhd_pub_t *pub, uint32 to_val); | |
2885 | extern int dhd_start_timesync_timer(dhd_pub_t *pub); | |
2886 | extern int dhd_stop_timesync_timer(dhd_pub_t *pub); | |
2887 | ||
2888 | #ifdef DHD_PKTID_AUDIT_ENABLED | |
2889 | void dhd_pktid_error_handler(dhd_pub_t *dhdp); | |
2890 | #endif /* DHD_PKTID_AUDIT_ENABLED */ | |
2891 | ||
2892 | #ifdef DHD_MAP_PKTID_LOGGING | |
2893 | extern void dhd_pktid_logging_dump(dhd_pub_t *dhdp); | |
2894 | #endif /* DHD_MAP_PKTID_LOGGING */ | |
2895 | ||
2896 | #ifdef DHD_PCIE_RUNTIMEPM | |
2897 | extern bool dhd_runtimepm_state(dhd_pub_t *dhd); | |
2898 | extern bool dhd_runtime_bus_wake(struct dhd_bus *bus, bool wait, void *func_addr); | |
2899 | extern bool dhdpcie_runtime_bus_wake(dhd_pub_t *dhdp, bool wait, void *func_addr); | |
2900 | extern void dhdpcie_block_runtime_pm(dhd_pub_t *dhdp); | |
2901 | extern bool dhdpcie_is_resume_done(dhd_pub_t *dhdp); | |
2902 | extern void dhd_runtime_pm_disable(dhd_pub_t *dhdp); | |
2903 | extern void dhd_runtime_pm_enable(dhd_pub_t *dhdp); | |
2904 | /* Disable the Runtime PM and wake up if the bus is already in suspend */ | |
2905 | #define DHD_DISABLE_RUNTIME_PM(dhdp) \ | |
2906 | do { \ | |
2907 | dhd_runtime_pm_disable(dhdp); \ | |
2908 | } while (0); | |
2909 | ||
2910 | /* Enable the Runtime PM */ | |
2911 | #define DHD_ENABLE_RUNTIME_PM(dhdp) \ | |
2912 | do { \ | |
2913 | dhd_runtime_pm_enable(dhdp); \ | |
2914 | } while (0); | |
2915 | #else | |
2916 | #define DHD_DISABLE_RUNTIME_PM(dhdp) | |
2917 | #define DHD_ENABLE_RUNTIME_PM(dhdp) | |
2918 | #endif /* DHD_PCIE_RUNTIMEPM */ | |
2919 | ||
2920 | extern bool dhd_prot_is_cmpl_ring_empty(dhd_pub_t *dhd, void *prot_info); | |
2921 | extern void dhd_prot_dump_ring_ptrs(void *prot_info); | |
2922 | ||
2923 | /* | |
2924 | * Enable this macro if you want to track the calls to wake lock | |
2925 | * This records can be printed using the following command | |
2926 | * cat /sys/bcm-dhd/wklock_trace | |
2927 | * DHD_TRACE_WAKE_LOCK supports over linux 2.6.0 version | |
2928 | */ | |
2929 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)) | |
2930 | #undef DHD_TRACE_WAKE_LOCK | |
2931 | #endif /* KERNEL_VER < KERNEL_VERSION(2, 6, 0) */ | |
2932 | ||
2933 | #if defined(DHD_TRACE_WAKE_LOCK) | |
2934 | void dhd_wk_lock_stats_dump(dhd_pub_t *dhdp); | |
2935 | #endif // endif | |
2936 | ||
2937 | extern bool dhd_query_bus_erros(dhd_pub_t *dhdp); | |
2938 | ||
2939 | #if defined(CONFIG_64BIT) | |
2940 | #define DHD_SUPPORT_64BIT | |
2941 | #endif /* (linux || LINUX) && CONFIG_64BIT */ | |
2942 | ||
2943 | #if defined(DHD_ERPOM) | |
2944 | extern void dhd_schedule_reset(dhd_pub_t *dhdp); | |
2945 | #else | |
2946 | static INLINE void dhd_schedule_reset(dhd_pub_t *dhdp) {;} | |
2947 | #endif // endif | |
2948 | ||
2949 | extern void init_dhd_timeouts(dhd_pub_t *pub); | |
2950 | extern void deinit_dhd_timeouts(dhd_pub_t *pub); | |
2951 | ||
2952 | typedef enum timeout_resons { | |
2953 | DHD_REASON_COMMAND_TO, | |
2954 | DHD_REASON_JOIN_TO, | |
2955 | DHD_REASON_SCAN_TO, | |
2956 | DHD_REASON_OQS_TO | |
2957 | } timeout_reasons_t; | |
2958 | ||
2959 | extern void dhd_prhex(const char *msg, volatile uchar *buf, uint nbytes, uint8 dbg_level); | |
2960 | int dhd_tput_test(dhd_pub_t *dhd, tput_test_t *tput_data); | |
2961 | void dhd_tput_test_rx(dhd_pub_t *dhd, void *pkt); | |
2962 | static INLINE int dhd_get_max_txbufs(dhd_pub_t *dhdp) | |
2963 | { return -1; } | |
2964 | ||
2965 | #ifdef FILTER_IE | |
2966 | int dhd_read_from_file(dhd_pub_t *dhd); | |
2967 | int dhd_parse_filter_ie(dhd_pub_t *dhd, uint8 *buf); | |
2968 | int dhd_get_filter_ie_count(dhd_pub_t *dhd, uint8 *buf); | |
2969 | int dhd_parse_oui(dhd_pub_t *dhd, uint8 *inbuf, uint8 *oui, int len); | |
2970 | int dhd_check_valid_ie(dhd_pub_t *dhdp, uint8 *buf, int len); | |
2971 | #endif /* FILTER_IE */ | |
2972 | ||
2973 | uint16 dhd_prot_get_ioctl_trans_id(dhd_pub_t *dhdp); | |
2974 | ||
2975 | #ifdef SET_PCIE_IRQ_CPU_CORE | |
2976 | enum { | |
2977 | PCIE_IRQ_AFFINITY_OFF = 0, | |
2978 | PCIE_IRQ_AFFINITY_BIG_CORE_ANY, | |
2979 | PCIE_IRQ_AFFINITY_BIG_CORE_EXYNOS, | |
2980 | PCIE_IRQ_AFFINITY_LAST | |
2981 | }; | |
2982 | extern void dhd_set_irq_cpucore(dhd_pub_t *dhdp, int affinity_cmd); | |
2983 | #endif /* SET_PCIE_IRQ_CPU_CORE */ | |
2984 | #if defined(DHD_HANG_SEND_UP_TEST) | |
2985 | extern void dhd_make_hang_with_reason(struct net_device *dev, const char *string_num); | |
2986 | #endif /* DHD_HANG_SEND_UP_TEST */ | |
2987 | ||
2988 | #ifdef DHD_WAKE_STATUS | |
2989 | wake_counts_t* dhd_get_wakecount(dhd_pub_t *dhdp); | |
2990 | #endif /* DHD_WAKE_STATUS */ | |
2991 | extern int dhd_get_random_bytes(uint8 *buf, uint len); | |
2992 | #if defined(DHD_BLOB_EXISTENCE_CHECK) | |
2993 | extern void dhd_set_blob_support(dhd_pub_t *dhdp, char *fw_path); | |
2994 | #endif /* DHD_BLOB_EXISTENCE_CHECK */ | |
2995 | ||
2996 | /* configuration of ecounters. API's tp start/stop. currently supported only for linux */ | |
2997 | extern int dhd_start_ecounters(dhd_pub_t *dhd); | |
2998 | extern int dhd_stop_ecounters(dhd_pub_t *dhd); | |
2999 | extern int dhd_start_event_ecounters(dhd_pub_t *dhd); | |
3000 | extern int dhd_stop_event_ecounters(dhd_pub_t *dhd); | |
3001 | ||
3002 | int dhd_get_preserve_log_numbers(dhd_pub_t *dhd, uint32 *logset_mask); | |
3003 | ||
3004 | #ifdef DHD_LOG_DUMP | |
3005 | void dhd_schedule_log_dump(dhd_pub_t *dhdp, void *type); | |
3006 | void dhd_log_dump_trigger(dhd_pub_t *dhdp, int subcmd); | |
3007 | int dhd_log_dump_ring_to_file(dhd_pub_t *dhdp, void *ring_ptr, void *file, | |
3008 | unsigned long *file_posn, log_dump_section_hdr_t *sec_hdr); | |
3009 | int dhd_log_dump_cookie_to_file(dhd_pub_t *dhdp, void *fp, unsigned long *f_pos); | |
3010 | int dhd_logdump_cookie_init(dhd_pub_t *dhdp, uint8 *buf, uint32 buf_size); | |
3011 | void dhd_logdump_cookie_deinit(dhd_pub_t *dhdp); | |
3012 | void dhd_logdump_cookie_save(dhd_pub_t *dhdp, char *cookie, char *type); | |
3013 | int dhd_logdump_cookie_get(dhd_pub_t *dhdp, char *ret_cookie, uint32 buf_size); | |
3014 | int dhd_logdump_cookie_count(dhd_pub_t *dhdp); | |
3015 | #endif /* DHD_LOG_DUMP */ | |
3016 | ||
3017 | #define DHD_PCIE_CONFIG_SAVE(bus) pci_save_state(bus->dev) | |
3018 | #define DHD_PCIE_CONFIG_RESTORE(bus) pci_restore_state(bus->dev) | |
3019 | ||
3020 | #ifdef BIGDATA_SOFTAP | |
3021 | void dhd_schedule_gather_ap_stadata(void *bcm_cfg, void *ndev, const wl_event_msg_t *e); | |
3022 | #endif /* BIGDATA_SOFTAP */ | |
3023 | ||
3024 | typedef struct dhd_pkt_parse { | |
3025 | uint32 proto; /* Network layer protocol */ | |
3026 | uint32 t1; /* n-tuple */ | |
3027 | uint32 t2; | |
3028 | } dhd_pkt_parse_t; | |
3029 | ||
3030 | /* ========= RING API functions : exposed to others ============= */ | |
3031 | #define DHD_RING_TYPE_FIXED 1 | |
3032 | uint32 dhd_ring_get_hdr_size(void); | |
3033 | void *dhd_ring_init(uint8 *buf, uint32 buf_size, uint32 elem_size, uint32 elem_cnt); | |
3034 | void dhd_ring_deinit(void *_ring); | |
3035 | void *dhd_ring_get_first(void *_ring); | |
3036 | void dhd_ring_free_first(void *_ring); | |
3037 | void *dhd_ring_get_last(void *_ring); | |
3038 | void *dhd_ring_get_next(void *_ring, void *cur); | |
3039 | void *dhd_ring_get_prev(void *_ring, void *cur); | |
3040 | void *dhd_ring_get_empty(void *_ring); | |
3041 | int dhd_ring_get_cur_size(void *_ring); | |
3042 | void dhd_ring_lock(void *ring, void *fist_ptr, void *last_ptr); | |
3043 | void dhd_ring_lock_free(void *ring); | |
3044 | void *dhd_ring_lock_get_first(void *_ring); | |
3045 | void *dhd_ring_lock_get_last(void *_ring); | |
3046 | int dhd_ring_lock_get_count(void *_ring); | |
3047 | void dhd_ring_lock_free_first(void *ring); | |
3048 | ||
3049 | #define DHD_DUMP_TYPE_NAME_SIZE 32 | |
3050 | #define DHD_DUMP_FILE_PATH_SIZE 256 | |
3051 | #define DHD_DUMP_FILE_COUNT_MAX 5 | |
3052 | #define DHD_DUMP_TYPE_COUNT_MAX 10 | |
3053 | ||
3054 | #ifdef DHD_DUMP_MNGR | |
3055 | typedef struct _DFM_elem { | |
3056 | char type_name[DHD_DUMP_TYPE_NAME_SIZE]; | |
3057 | char file_path[DHD_DUMP_FILE_COUNT_MAX][DHD_DUMP_FILE_PATH_SIZE]; | |
3058 | int file_idx; | |
3059 | } DFM_elem_t; | |
3060 | ||
3061 | typedef struct _dhd_dump_file_manage { | |
3062 | DFM_elem_t elems[DHD_DUMP_TYPE_COUNT_MAX]; | |
3063 | } dhd_dump_file_manage_t; | |
3064 | ||
3065 | extern void dhd_dump_file_manage_enqueue(dhd_pub_t *dhd, char *dump_path, char *fname); | |
3066 | #endif /* DHD_DUMP_MNGR */ | |
3067 | #ifdef DHD_8021X_DUMP | |
3068 | extern void dhd_dump_eapol_4way_message(char *ifname, unsigned char *dump_data, bool direction); | |
3069 | #endif /* DHD_8021X_DUMP */ | |
3070 | ||
3071 | #ifdef PKT_FILTER_SUPPORT | |
3072 | extern void dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg); | |
3073 | extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable, int master_mode); | |
3074 | extern void dhd_pktfilter_offload_delete(dhd_pub_t *dhd, int id); | |
3075 | #endif // endif | |
3076 | ||
3077 | extern uint32 wlreg_l; | |
3078 | extern uint32 wlreg_h; | |
3079 | ||
3080 | extern uint32 wlreg_len_l; | |
3081 | extern uint32 wlreg_len_h; | |
3082 | ||
3083 | extern int dhd_get_host_whitelist_region(void *buf, uint len); | |
3084 | #ifdef DHD_DUMP_PCIE_RINGS | |
3085 | extern int dhd_d2h_h2d_ring_dump(dhd_pub_t *dhd, void *file, unsigned long *file_posn); | |
3086 | #endif /* DHD_DUMP_PCIE_RINGS */ | |
3087 | #define HD_PREFIX_SIZE 2 /* hexadecimal prefix size */ | |
3088 | #define HD_BYTE_SIZE 2 /* hexadecimal byte size */ | |
3089 | extern void dhd_cleanup_if(struct net_device *net); | |
3090 | ||
3091 | #ifdef SUPPORT_SET_TID | |
3092 | enum dhd_set_tid_mode { | |
3093 | /* Disalbe changing TID */ | |
3094 | SET_TID_OFF = 0, | |
3095 | /* Change TID for all UDP frames */ | |
3096 | SET_TID_ALL_UDP, | |
3097 | /* Change TID for UDP frames based on UID */ | |
3098 | SET_TID_BASED_ON_UID | |
3099 | }; | |
3100 | extern void dhd_set_tid_based_on_uid(dhd_pub_t *dhdp, void *pkt); | |
3101 | #endif /* SUPPORT_SET_TID */ | |
3102 | ||
3103 | int dhd_check_eapol_4way_message(char *dump_data); | |
3104 | #ifdef DYNAMIC_MUMIMO_CONTROL | |
3105 | #ifdef ARGOS_CPU_SCHEDULER | |
3106 | void argos_config_mumimo_reset(void); | |
3107 | #endif /* ARGOS_CPU_SCHEDULER */ | |
3108 | #endif /* DYNAMIC_MUMIMO_CONTROL */ | |
3109 | ||
3110 | #if defined(DHD_BLOB_EXISTENCE_CHECK) && defined(DHD_USE_CLMINFO_PARSER) | |
3111 | #define CHECK_IS_BLOB(dhdp) (dhdp)->is_blob | |
3112 | #define CHECK_IS_MULT_REGREV(dhdp) (dhdp)->is_clm_mult_regrev | |
3113 | #elif defined(DHD_BLOB_EXISTENCE_CHECK) && !defined(DHD_USE_CLMINFO_PARSER) | |
3114 | #define CHECK_IS_BLOB(dhdp) (dhdp)->is_blob | |
3115 | #define CHECK_IS_MULT_REGREV(dhdp) FALSE | |
3116 | #elif !defined(DHD_BLOB_EXISTENCE_CHECK) && defined(DHD_USE_CLMINFO_PARSER) | |
3117 | #define CHECK_IS_BLOB(dhdp) TRUE | |
3118 | #define CHECK_IS_MULT_REGREV(dhdp) (dhdp)->is_clm_mult_regrev | |
3119 | #else /* !DHD_BLOB_EXISTENCE_CHECK && !DHD_USE_CLMINFO_PARSER */ | |
3120 | #define CHECK_IS_BLOB(dhdp) FALSE | |
3121 | #define CHECK_IS_MULT_REGREV(dhdp) TRUE | |
3122 | #endif /* DHD_BLOB_EXISTENCE_CHECK && DHD_USE_CLMINFO_PARSER */ | |
3123 | ||
3124 | #endif /* _dhd_h_ */ |