2 * Header file describing the internal (inter-module) DHD interfaces.
4 * Provides type definitions and function prototypes used to link the
5 * DHD OS, bus, and protocol modules.
7 * Copyright (C) 1999-2016, Broadcom Corporation
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:
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.
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.
28 * <<Broadcom-WL-IPTag/Open:>>
30 * $Id: dhd.h 610267 2016-01-06 16:03:53Z $
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 <asm/uaccess.h>
50 #include <asm/unaligned.h>
51 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_HAS_WAKELOCK)
52 #include <linux/wakelock.h>
53 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined (CONFIG_HAS_WAKELOCK) */
54 #include <dhd_buzzz.h>
55 /* The kernel threading is sdio-specific */
58 int setScheduler(struct task_struct
*p
, int policy
, struct sched_param
*param
);
59 int get_scheduler_policy(struct task_struct
*p
);
62 #define ALL_INTERFACES 0xff
65 #include <wlfc_proto.h>
70 #include <WdfMiniport.h>
73 #ifdef DEBUG_DPC_THREAD_WATCHDOG
74 #define MAX_RESCHED_CNT 600
75 #endif /* DEBUG_DPC_THREAD_WATCHDOG */
77 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) && LINUX_VERSION_CODE < \
78 KERNEL_VERSION(3, 18, 0) || defined(CONFIG_BCMDHD_VENDOR_EXT))
79 //#define WL_VENDOR_EXT_SUPPORT
80 #endif /* 3.13.0 <= LINUX_KERNEL_VERSION < 3.18.0 || CONFIG_BCMDHD_VENDOR_EXT */
81 #if defined(CONFIG_ANDROID) && defined(WL_VENDOR_EXT_SUPPORT)
82 #if !defined(GSCAN_SUPPORT)
85 #endif /* CONFIG_ANDROID && WL_VENDOR_EXT_SUPPORT */
87 #if defined(KEEP_ALIVE)
88 /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
89 #define KEEP_ALIVE_PERIOD 55000
90 #define NULL_PKT_STR "null_pkt"
91 #endif /* KEEP_ALIVE */
99 /* The level of bus communication with the dongle */
101 DHD_BUS_DOWN
, /* Not ready for frame transfers */
102 DHD_BUS_LOAD
, /* Download access only (CPU reset) */
103 DHD_BUS_DATA
, /* Ready for frame transfers */
104 DHD_BUS_SUSPEND
, /* Bus has been suspended */
105 DHD_BUS_DOWN_IN_PROGRESS
, /* Bus going Down */
109 * Bit fields to Indicate clean up process that wait till they are finished.
110 * Future synchronizable processes can add their bit filed below and update
111 * their functionalities accordingly
113 #define DHD_BUS_BUSY_IN_TX 0x01
114 #define DHD_BUS_BUSY_IN_SEND_PKT 0x02
115 #define DHD_BUS_BUSY_IN_DPC 0x04
116 #define DHD_BUS_BUSY_IN_WD 0x08
117 #define DHD_BUS_BUSY_IN_IOVAR 0x10
118 #define DHD_BUS_BUSY_IN_DHD_IOVAR 0x20
119 #define DHD_BUS_BUSY_IN_SUSPEND 0x40
120 #define DHD_BUS_BUSY_IN_RESUME 0x80
121 #define DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS 0x100
122 #define DHD_BUS_BUSY_RPM_SUSPEND_DONE 0x200
123 #define DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS 0x400
124 #define DHD_BUS_BUSY_RPM_ALL (DHD_BUS_BUSY_RPM_SUSPEND_DONE | \
125 DHD_BUS_BUSY_RPM_SUSPEND_IN_PROGRESS | \
126 DHD_BUS_BUSY_RPM_RESUME_IN_PROGRESS)
129 typedef enum download_type
{
137 /* For supporting multiple interfaces */
138 #define DHD_MAX_IFS 16
139 #define DHD_DEL_IF -0xE
140 #define DHD_BAD_IF -0xF
143 /* Firmware requested operation mode */
144 DHD_FLAG_STA_MODE
= (1 << (0)), /* STA only */
145 DHD_FLAG_HOSTAP_MODE
= (1 << (1)), /* SOFTAP only */
146 DHD_FLAG_P2P_MODE
= (1 << (2)), /* P2P Only */
148 DHD_FLAG_CONCURR_SINGLE_CHAN_MODE
= (DHD_FLAG_STA_MODE
| DHD_FLAG_P2P_MODE
),
149 DHD_FLAG_CONCURR_MULTI_CHAN_MODE
= (1 << (4)), /* STA + P2P */
150 /* Current P2P mode for P2P connection */
151 DHD_FLAG_P2P_GC_MODE
= (1 << (5)),
152 DHD_FLAG_P2P_GO_MODE
= (1 << (6)),
153 DHD_FLAG_MBSS_MODE
= (1 << (7)), /* MBSS in future */
154 DHD_FLAG_IBSS_MODE
= (1 << (8)),
155 DHD_FLAG_MFG_MODE
= (1 << (9)),
156 DHD_FLAG_RSDB_MODE
= (1 << (10)),
157 DHD_FLAG_MP2P_MODE
= (1 << (11))
160 #define DHD_OPMODE_SUPPORTED(dhd, opmode_flag) \
161 (dhd ? ((((dhd_pub_t *)dhd)->op_mode) & opmode_flag) : -1)
163 /* Max sequential TX/RX Control timeouts to set HANG event */
164 #ifndef MAX_CNTL_TX_TIMEOUT
165 #define MAX_CNTL_TX_TIMEOUT 2
166 #endif /* MAX_CNTL_TX_TIMEOUT */
167 #ifndef MAX_CNTL_RX_TIMEOUT
168 #define MAX_CNTL_RX_TIMEOUT 1
169 #endif /* MAX_CNTL_RX_TIMEOUT */
171 #define DHD_SCAN_ASSOC_ACTIVE_TIME 40 /* ms: Embedded default Active setting from DHD */
172 #define DHD_SCAN_UNASSOC_ACTIVE_TIME 80 /* ms: Embedded def. Unassoc Active setting from DHD */
173 #define DHD_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD */
175 #ifndef POWERUP_MAX_RETRY
176 #define POWERUP_MAX_RETRY 3 /* how many times we retry to power up the chip */
178 #ifndef POWERUP_WAIT_MS
179 #define POWERUP_WAIT_MS 2000 /* ms: time out in waiting wifi to come up */
181 #define MAX_NVRAMBUF_SIZE (16 * 1024) /* max nvram buf size */
182 #define MAX_CLMINFO_BUF_SIZE (4 * 1024) /* max clminfo buf size */
183 #define MAX_CLM_BUF_SIZE (48 * 1024) /* max clm blob size */
185 #define DHD_JOIN_MAX_TIME_DEFAULT 10000 /* ms: Max time out for joining AP */
186 #define DHD_SCAN_DEF_TIMEOUT 10000 /* ms: Max time out for scan in progress */
189 #ifndef CONFIG_BCMDHD_CLM_PATH
190 #define CONFIG_BCMDHD_CLM_PATH "/system/etc/wifi/bcmdhd_clm.blob"
191 #endif /* CONFIG_BCMDHD_CLM_PATH */
192 #define WL_CCODE_NULL_COUNTRY "#n"
194 #define FW_VER_STR_LEN 128
195 #define CLM_VER_STR_LEN 128
197 enum dhd_bus_wake_state
{
205 WAKE_LOCK_LINK_DOWN_TMOUT
,
206 WAKE_LOCK_PNO_FIND_TMOUT
,
207 WAKE_LOCK_SOFTAP_SET
,
208 WAKE_LOCK_SOFTAP_STOP
,
209 WAKE_LOCK_SOFTAP_START
,
210 WAKE_LOCK_SOFTAP_THREAD
213 enum dhd_prealloc_index
{
214 DHD_PREALLOC_PROT
= 0,
216 DHD_PREALLOC_DATABUF
,
217 DHD_PREALLOC_OSL_BUF
,
218 DHD_PREALLOC_SKB_BUF
,
219 #if defined(STATIC_WL_PRIV_STRUCT)
220 DHD_PREALLOC_WIPHY_ESCAN0
= 5,
221 #endif /* STATIC_WL_PRIV_STRUCT */
222 DHD_PREALLOC_DHD_INFO
= 7,
223 DHD_PREALLOC_DHD_WLFC_INFO
= 8,
224 DHD_PREALLOC_IF_FLOW_LKUP
= 9,
225 DHD_PREALLOC_MEMDUMP_BUF
= 10,
226 DHD_PREALLOC_MEMDUMP_RAM
= 11,
227 DHD_PREALLOC_DHD_WLFC_HANGER
= 12,
228 DHD_PREALLOC_PKTID_MAP
= 13,
229 DHD_PREALLOC_PKTID_MAP_IOCTL
= 14,
230 DHD_PREALLOC_DHD_LOG_DUMP_BUF
= 15
233 enum dhd_dongledump_mode
{
241 enum dhd_dongledump_type
{
242 DUMP_TYPE_RESUMED_ON_TIMEOUT
= 1,
243 DUMP_TYPE_D3_ACK_TIMEOUT
,
244 DUMP_TYPE_DONGLE_TRAP
,
245 DUMP_TYPE_MEMORY_CORRUPTION
,
246 DUMP_TYPE_PKTID_AUDIT_FAILURE
,
247 DUMP_TYPE_SCAN_TIMEOUT
,
249 DUMP_TYPE_BY_SYSDUMP
,
250 DUMP_TYPE_BY_LIVELOCK
,
251 DUMP_TYPE_AP_LINKUP_FAILURE
254 enum dhd_hang_reason
{
255 HANG_REASON_MASK
= 0x8000,
256 HANG_REASON_IOCTL_RESP_TIMEOUT
= 0x8001,
257 HANG_REASON_DONGLE_TRAP
= 0x8002,
258 HANG_REASON_D3_ACK_TIMEOUT
= 0x8003,
259 HANG_REASON_BUS_DOWN
= 0x8004,
260 HANG_REASON_PCIE_LINK_DOWN
= 0x8005,
261 HANG_REASON_MSGBUF_LIVELOCK
= 0x8006,
262 HANG_REASON_P2P_IFACE_DEL_FAILURE
= 0x8007,
263 HANG_REASON_HT_AVAIL_ERROR
= 0x8008,
264 HANG_REASON_PCIE_RC_LINK_UP_FAIL
= 0x8009,
265 HANG_REASON_MAX
= 0x800a
268 enum dhd_rsdb_scan_features
{
269 /* Downgraded scan feature for AP active */
270 RSDB_SCAN_DOWNGRADED_AP_SCAN
= 0x01,
271 /* Downgraded scan feature for P2P Discovery */
272 RSDB_SCAN_DOWNGRADED_P2P_DISC_SCAN
= 0x02,
273 /* Enable channel pruning for ROAM SCAN */
274 RSDB_SCAN_DOWNGRADED_CH_PRUNE_ROAM
= 0x10,
275 /* Enable channel pruning for any SCAN */
276 RSDB_SCAN_DOWNGRADED_CH_PRUNE_ALL
= 0x20
279 /* Packet alignment for most efficient SDIO (can change based on platform) */
281 #ifdef CUSTOM_SDIO_F2_BLKSIZE
282 #define DHD_SDALIGN CUSTOM_SDIO_F2_BLKSIZE
284 #define DHD_SDALIGN 32
289 * DMA-able buffer parameters
290 * - dmaaddr_t is 32bits on a 32bit host.
291 * dhd_dma_buf::pa may not be used as a sh_addr_t, bcm_addr64_t or uintptr
292 * - dhd_dma_buf::_alloced is ONLY for freeing a DMA-able buffer.
294 typedef struct dhd_dma_buf
{
295 void *va
; /* virtual address of buffer */
296 uint32 len
; /* user requested buffer length */
297 dmaaddr_t pa
; /* physical address of buffer */
298 void *dmah
; /* dma mapper handle */
299 void *secdma
; /* secure dma sec_cma_info handle */
300 uint32 _alloced
; /* actual size of buffer allocated with align and pad */
303 /* host reordering packts logic */
304 /* followed the structure to hold the reorder buffers (void **p) */
305 typedef struct reorder_info
{
314 #ifdef DHDTCPACK_SUPPRESS
317 /* TCPACK suppress off */
319 /* Replace TCPACK in txq when new coming one has higher ACK number. */
321 /* TCPACK_SUP_REPLACE + delayed TCPACK TX unless ACK to PSH DATA.
322 * This will give benefits to Half-Duplex bus interface(e.g. SDIO) that
323 * 1. we are able to read TCP DATA packets first from the bus
324 * 2. TCPACKs that don't need to hurry delivered remains longer in TXQ so can be suppressed.
330 #endif /* DHDTCPACK_SUPPRESS */
334 * Accumulating the queue lengths of all flowring queues in a parent object,
335 * to assert flow control, when the cummulative queue length crosses an upper
336 * threshold defined on a parent object. Upper threshold may be maintained
337 * at a station level, at an interface level, or at a dhd instance.
339 * cumm_ctr_t abstraction:
340 * cumm_ctr_t abstraction may be enhanced to use an object with a hysterisis
341 * pause on/off threshold callback.
342 * All macros use the address of the cummulative length in the parent objects.
344 * BCM_GMAC3 builds use a single perimeter lock, as opposed to a per queue lock.
345 * Cummulative counters in parent objects may be updated without spinlocks.
347 * In non BCM_GMAC3, if a cummulative queue length is desired across all flows
348 * belonging to either of (a station, or an interface or a dhd instance), then
349 * an atomic operation is required using an atomic_t cummulative counters or
350 * using a spinlock. BCM_ROUTER_DHD uses the Linux atomic_t construct.
353 /* Cummulative length not supported. */
354 typedef uint32 cumm_ctr_t
;
355 #define DHD_CUMM_CTR_PTR(clen) ((cumm_ctr_t*)(clen))
356 #define DHD_CUMM_CTR(clen) *(DHD_CUMM_CTR_PTR(clen)) /* accessor */
357 #define DHD_CUMM_CTR_READ(clen) DHD_CUMM_CTR(clen) /* read access */
358 #define DHD_CUMM_CTR_INIT(clen) \
359 ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL));
360 #define DHD_CUMM_CTR_INCR(clen) \
361 ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL));
362 #define DHD_CUMM_CTR_DECR(clen) \
363 ASSERT(DHD_CUMM_CTR_PTR(clen) != DHD_CUMM_CTR_PTR(NULL));
365 /* DMA'ing r/w indices for rings supported */
366 #ifdef BCM_INDX_TCM /* FW gets r/w indices in TCM */
367 #define DMA_INDX_ENAB(dma_indxsup) 0
368 #elif defined BCM_INDX_DMA /* FW gets r/w indices from Host memory */
369 #define DMA_INDX_ENAB(dma_indxsup) 1
370 #else /* r/w indices in TCM or host memory based on FW/Host agreement */
371 #define DMA_INDX_ENAB(dma_indxsup) dma_indxsup
372 #endif /* BCM_INDX_TCM */
374 #if defined(WLTDLS) && defined(PCIE_FULL_DONGLE)
375 struct tdls_peer_node
{
376 uint8 addr
[ETHER_ADDR_LEN
];
377 struct tdls_peer_node
*next
;
379 typedef struct tdls_peer_node tdls_peer_node_t
;
381 tdls_peer_node_t
*node
;
382 uint8 tdls_peer_count
;
384 #endif /* defined(WLTDLS) && defined(PCIE_FULL_DONGLE) */
387 /* below structure describe ring buffer. */
388 struct dhd_log_dump_buf
391 unsigned int wraparound
;
399 #define DHD_LOG_DUMP_BUFFER_SIZE (1024 * 1024)
400 #define DHD_LOG_DUMP_MAX_TEMP_BUFFER_SIZE 256
402 extern void dhd_log_dump_print(const char *fmt
, ...);
403 extern char *dhd_log_dump_get_timestamp(void);
404 #endif /* DHD_LOG_DUMP */
405 #define DHD_COMMON_DUMP_PATH "/data/misc/wifi/log/"
407 /* Common structure for module and instance linkage */
408 typedef struct dhd_pub
{
409 /* Linkage ponters */
410 osl_t
*osh
; /* OSL handle */
411 struct dhd_bus
*bus
; /* Bus module handle */
412 struct dhd_prot
*prot
; /* Protocol module handle */
413 struct dhd_info
*info
; /* Info module handle */
415 /* to NDIS developer, the structure dhd_common is redundant,
416 * please do NOT merge it back from other branches !!!
420 /* Internal dhd items */
421 bool up
; /* Driver up/down (to OS) */
422 bool txoff
; /* Transmit flow-controlled */
423 bool dongle_reset
; /* TRUE = DEVRESET put dongle into reset */
424 enum dhd_bus_state busstate
;
425 uint dhd_bus_busy_state
; /* Bus busy state */
426 uint hdrlen
; /* Total DHD header length (proto + bus) */
427 uint maxctl
; /* Max size rxctl request from proto to bus */
428 uint rxsz
; /* Rx buffer size bus module should use */
429 uint8 wme_dp
; /* wme discard priority */
431 /* Dongle media info */
432 bool iswl
; /* Dongle-resident driver is wl */
433 ulong drv_version
; /* Version of dongle-resident driver */
434 struct ether_addr mac
; /* MAC address obtained from dongle */
435 dngl_stats_t dstats
; /* Stats for dongle-based data */
437 /* Additional stats for the bus level */
438 ulong tx_packets
; /* Data packets sent to dongle */
439 ulong tx_dropped
; /* Data packets dropped in dhd */
440 ulong tx_multicast
; /* Multicast data packets sent to dongle */
441 ulong tx_errors
; /* Errors in sending data to dongle */
442 ulong tx_ctlpkts
; /* Control packets sent to dongle */
443 ulong tx_ctlerrs
; /* Errors sending control frames to dongle */
444 ulong rx_packets
; /* Packets sent up the network interface */
445 ulong rx_multicast
; /* Multicast packets sent up the network interface */
446 ulong rx_errors
; /* Errors processing rx data packets */
447 ulong rx_ctlpkts
; /* Control frames processed from dongle */
448 ulong rx_ctlerrs
; /* Errors in processing rx control frames */
449 ulong rx_dropped
; /* Packets dropped locally (no memory) */
450 ulong rx_flushed
; /* Packets flushed due to unscheduled sendup thread */
451 ulong wd_dpc_sched
; /* Number of times dhd dpc scheduled by watchdog timer */
452 ulong rx_pktgetfail
; /* Number of PKTGET failures in DHD on RX */
453 ulong tx_pktgetfail
; /* Number of PKTGET failures in DHD on TX */
454 ulong rx_readahead_cnt
; /* Number of packets where header read-ahead was used. */
455 ulong tx_realloc
; /* Number of tx packets we had to realloc for headroom */
456 ulong fc_packets
; /* Number of flow control pkts recvd */
458 /* Last error return */
462 /* Last error from dongle */
465 uint8 country_code
[WLC_CNTRY_BUF_SZ
];
467 /* Suspend disable flag and "in suspend" flag */
468 int suspend_disable_flag
; /* "1" to disable all extra powersaving during suspend */
469 int in_suspend
; /* flag set to 1 when early suspend called */
471 int pno_enable
; /* pno status : "1" is pno enable */
472 int pno_suspend
; /* pno suspend status : "1" is pno suspended */
473 #endif /* PNO_SUPPORT */
474 /* DTIM skip value, default 0(or 1) means wake each DTIM
475 * 3 means skip 2 DTIMs and wake up 3rd DTIM(9th beacon when AP DTIM is 3)
477 int suspend_bcn_li_dtim
; /* bcn_li_dtim value in suspend mode */
478 #ifdef PKT_FILTER_SUPPORT
479 int early_suspended
; /* Early suspend status */
480 int dhcp_in_progress
; /* DHCP period */
483 /* Pkt filter defination */
484 char * pktfilter
[100];
487 wl_country_t dhd_cspec
; /* Current Locale info */
488 #ifdef CUSTOM_COUNTRY_CODE
490 #endif /* CUSTOM_COUNTRY_CODE */
491 bool force_country_change
;
492 char eventmask
[WL_EVENTING_MASK_LEN
];
493 int op_mode
; /* STA, HostAPD, WFD, SoftAP */
495 /* Set this to 1 to use a seperate interface (p2p0) for p2p operations.
496 * For ICS MR1 releases it should be disable to be compatable with ICS MR1 Framework
497 * see target dhd-cdc-sdmmc-panda-cfg80211-icsmr1-gpl-debug in Makefile
499 /* #define WL_ENABLE_P2P_IF 1 */
501 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
502 struct mutex wl_start_stop_lock
; /* lock/unlock for Android start/stop */
503 struct mutex wl_softap_lock
; /* lock/unlock for any SoftAP/STA settings */
511 Mode in which the dhd flow control shall operate. Must be set before
512 traffic starts to the device.
513 0 - Do not do any proptxtstatus flow control
514 1 - Use implied credit from a packet status
515 2 - Use explicit credit
516 3 - Only AMPDU hostreorder used. no wlfc.
518 uint8 proptxstatus_mode
;
519 bool proptxstatus_txoff
;
520 bool proptxstatus_module_ignore
;
521 bool proptxstatus_credit_ignore
;
522 bool proptxstatus_txstatus_ignore
;
526 * implement below functions in each platform if needed.
528 /* platform specific function whether to skip flow control */
529 bool (*skip_fc
)(void);
530 /* platform specific function for wlfc_enable and wlfc_deinit */
531 void (*plat_init
)(void *dhd
);
532 void (*plat_deinit
)(void *dhd
);
533 #ifdef DHD_WLFC_THREAD
535 struct task_struct
* wlfc_thread
;
536 wait_queue_head_t wlfc_wqhead
;
537 #endif /* DHD_WLFC_THREAD */
538 #endif /* PROP_TXSTATUS */
545 bool dongle_isolation
;
546 bool dongle_trap_occured
; /* flag for sending HANG event to upper layer */
548 int rxcnt_timeout
; /* counter rxcnt timeout to send HANG */
549 int txcnt_timeout
; /* counter txcnt timeout to send HANG */
551 int d3ackcnt_timeout
; /* counter d3ack timeout to send HANG */
553 bool hang_report
; /* enable hang report by default */
554 uint16 hang_reason
; /* reason codes for HANG event */
556 uint8 htsfdlystat_sz
; /* Size of delay stats, max 255B */
561 struct reorder_info
*reorder_bufs
[WLHOST_REORDERDATA_MAXFLOWS
];
562 #define WLC_IOCTL_MAXBUF_FWCAP 512
563 char fw_capabilities
[WLC_IOCTL_MAXBUF_FWCAP
];
564 #define MAXSKBPEND 1024
565 void *skbbuf
[MAXSKBPEND
];
568 #ifdef DHDTCPACK_SUPPRESS
569 uint8 tcpack_sup_mode
; /* TCPACK suppress mode */
570 void *tcpack_sup_module
; /* TCPACK suppress module */
571 uint32 tcpack_sup_ratio
;
572 uint32 tcpack_sup_delay
;
573 #endif /* DHDTCPACK_SUPPRESS */
574 #if defined(ARP_OFFLOAD_SUPPORT)
577 #ifdef DEBUG_DPC_THREAD_WATCHDOG
579 #endif /* DEBUG_DPC_THREAD_WATCHDOG */
580 #ifdef CUSTOM_SET_CPUCORE
581 struct task_struct
* current_dpc
;
582 struct task_struct
* current_rxf
;
584 #endif /* CUSTOM_SET_CPUCORE */
587 void *sta_pool
; /* pre-allocated pool of sta objects */
588 void *staid_allocator
; /* allocator of sta indexes */
589 #ifdef PCIE_FULL_DONGLE
590 bool flow_rings_inited
; /* set this flag after initializing flow rings */
591 #endif /* PCIE_FULL_DONGLE */
592 void *flowid_allocator
; /* unique flowid allocator */
593 void *flow_ring_table
; /* flow ring table, include prot and bus info */
594 void *if_flow_lkup
; /* per interface flowid lkup hash table */
595 void *flowid_lock
; /* per os lock for flowid info protection */
596 void *flowring_list_lock
; /* per os lock for flowring list protection */
597 uint32 num_flow_rings
;
598 cumm_ctr_t cumm_ctr
; /* cumm queue length placeholder */
599 uint32 d2h_sync_mode
; /* D2H DMA completion sync mode */
600 uint8 flow_prio_map
[NUMPRIO
];
601 uint8 flow_prio_map_type
;
602 char enable_log
[MAX_EVENT
];
603 bool dma_d2h_ring_upd_support
;
604 bool dma_h2d_ring_upd_support
;
608 #ifdef DHD_IGMP_UCQUERY
609 bool wmf_ucast_igmp_query
;
611 #ifdef DHD_UCAST_UPNP
616 unsigned long l2_filter_cnt
; /* for L2_FILTER ARP table timeout */
617 #endif /* DHD_L2_FILTER */
619 uint32 soc_ram_length
;
621 #ifdef DHD_FW_COREDUMP
622 uint32 memdump_enabled
;
623 #endif /* DHD_FW_COREDUMP */
624 #ifdef PCIE_FULL_DONGLE
626 tdls_peer_tbl_t peer_tbl
;
628 #endif /* PCIE_FULL_DONGLE */
629 #ifdef CACHE_FW_IMAGES
631 int cached_fw_length
;
633 int cached_nvram_length
;
638 #ifdef DHD_LOSSLESS_ROAMING
639 uint8 dequeue_prec_map
;
641 struct mutex wl_up_lock
;
642 bool is_fw_download_done
;
644 struct dhd_log_dump_buf dld_buf
;
645 unsigned int dld_enable
;
646 #endif /* DHD_LOG_DUMP */
647 char *clm_path
; /* module_param: path to clm vars file */
648 char *conf_path
; /* module_param: path to config vars file */
649 struct dhd_conf
*conf
; /* Bus module handle */
652 #if defined(PCIE_FULL_DONGLE)
654 /* Packet Tag for PCIE Full Dongle DHD */
655 typedef struct dhd_pkttag_fd
{
656 uint16 flowid
; /* Flowring Id */
657 uint16 dataoff
; /* start of packet */
658 uint16 dma_len
; /* pkt len for DMA_MAP/UNMAP */
659 dmaaddr_t pa
; /* physical address */
660 void *dmah
; /* dma mapper handle */
661 void *secdma
; /* secure dma sec_cma_info handle */
664 /* Packet Tag for DHD PCIE Full Dongle */
665 #define DHD_PKTTAG_FD(pkt) ((dhd_pkttag_fd_t *)(PKTTAG(pkt)))
667 #define DHD_PKT_GET_FLOWID(pkt) ((DHD_PKTTAG_FD(pkt))->flowid)
668 #define DHD_PKT_SET_FLOWID(pkt, pkt_flowid) \
669 DHD_PKTTAG_FD(pkt)->flowid = (uint16)(pkt_flowid)
671 #define DHD_PKT_GET_DATAOFF(pkt) ((DHD_PKTTAG_FD(pkt))->dataoff)
672 #define DHD_PKT_SET_DATAOFF(pkt, pkt_dataoff) \
673 DHD_PKTTAG_FD(pkt)->dataoff = (uint16)(pkt_dataoff)
675 #define DHD_PKT_GET_DMA_LEN(pkt) ((DHD_PKTTAG_FD(pkt))->dma_len)
676 #define DHD_PKT_SET_DMA_LEN(pkt, pkt_dma_len) \
677 DHD_PKTTAG_FD(pkt)->dma_len = (uint16)(pkt_dma_len)
679 #define DHD_PKT_GET_PA(pkt) ((DHD_PKTTAG_FD(pkt))->pa)
680 #define DHD_PKT_SET_PA(pkt, pkt_pa) \
681 DHD_PKTTAG_FD(pkt)->pa = (dmaaddr_t)(pkt_pa)
683 #define DHD_PKT_GET_DMAH(pkt) ((DHD_PKTTAG_FD(pkt))->dmah)
684 #define DHD_PKT_SET_DMAH(pkt, pkt_dmah) \
685 DHD_PKTTAG_FD(pkt)->dmah = (void *)(pkt_dmah)
687 #define DHD_PKT_GET_SECDMA(pkt) ((DHD_PKTTAG_FD(pkt))->secdma)
688 #define DHD_PKT_SET_SECDMA(pkt, pkt_secdma) \
689 DHD_PKTTAG_FD(pkt)->secdma = (void *)(pkt_secdma)
690 #endif /* PCIE_FULL_DONGLE */
695 } dhd_workitem_context_t
;
697 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(dhd_workitem_context_t
, dhd_get_dhd_workitem_context
)
698 #endif /* (BCMWDF) */
700 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
702 #define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
703 #define _DHD_PM_RESUME_WAIT(a, b) do {\
705 SMP_RD_BARRIER_DEPENDS(); \
706 while (dhd_mmc_suspend && retry++ != b) { \
707 SMP_RD_BARRIER_DEPENDS(); \
708 wait_event_interruptible_timeout(a, !dhd_mmc_suspend, 1); \
711 #define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 200)
712 #define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0)
713 #define DHD_PM_RESUME_RETURN_ERROR(a) do { \
714 if (dhd_mmc_suspend) { \
715 printf("%s[%d]: mmc is still in suspend state!!!\n", \
716 __FUNCTION__, __LINE__); \
720 #define DHD_PM_RESUME_RETURN do { if (dhd_mmc_suspend) return; } while (0)
722 #define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
723 #define SPINWAIT_SLEEP(a, exp, us) do { \
724 uint countdown = (us) + 9999; \
725 while ((exp) && (countdown >= 10000)) { \
726 wait_event_interruptible_timeout(a, FALSE, 1); \
727 countdown -= 10000; \
733 #define DHD_PM_RESUME_WAIT_INIT(a)
734 #define DHD_PM_RESUME_WAIT(a)
735 #define DHD_PM_RESUME_WAIT_FOREVER(a)
736 #define DHD_PM_RESUME_RETURN_ERROR(a)
737 #define DHD_PM_RESUME_RETURN
739 #define DHD_SPINWAIT_SLEEP_INIT(a)
740 #define SPINWAIT_SLEEP(a, exp, us) do { \
741 uint countdown = (us) + 9; \
742 while ((exp) && (countdown >= 10)) { \
748 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP) */
751 #define OSL_SLEEP(ms) OSL_DELAY(ms*1000)
752 #endif /* OSL_SLEEP */
754 #define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */
757 int dhd_pno_clean(dhd_pub_t
*dhd
);
758 #endif /* PNO_SUPPORT */
760 * Wake locks are an Android power management concept. They are used by applications and services
761 * to request CPU resources.
763 extern int dhd_os_wake_lock(dhd_pub_t
*pub
);
764 extern int dhd_os_wake_unlock(dhd_pub_t
*pub
);
765 extern int dhd_event_wake_lock(dhd_pub_t
*pub
);
766 extern int dhd_event_wake_unlock(dhd_pub_t
*pub
);
767 extern int dhd_os_wake_lock_waive(dhd_pub_t
*pub
);
768 extern int dhd_os_wake_lock_restore(dhd_pub_t
*pub
);
769 extern int dhd_os_wake_lock_timeout(dhd_pub_t
*pub
);
770 extern int dhd_os_wake_lock_rx_timeout_enable(dhd_pub_t
*pub
, int val
);
771 extern int dhd_os_wake_lock_ctrl_timeout_enable(dhd_pub_t
*pub
, int val
);
772 extern int dhd_os_wake_lock_ctrl_timeout_cancel(dhd_pub_t
*pub
);
773 extern int dhd_os_wd_wake_lock(dhd_pub_t
*pub
);
774 extern int dhd_os_wd_wake_unlock(dhd_pub_t
*pub
);
775 extern void dhd_os_wake_lock_init(struct dhd_info
*dhd
);
776 extern void dhd_os_wake_lock_destroy(struct dhd_info
*dhd
);
777 #ifdef BCMPCIE_OOB_HOST_WAKE
778 extern void dhd_os_oob_irq_wake_lock_timeout(dhd_pub_t
*pub
, int val
);
779 extern void dhd_os_oob_irq_wake_unlock(dhd_pub_t
*pub
);
780 #endif /* BCMPCIE_OOB_HOST_WAKE */
781 #ifdef DHD_USE_SCAN_WAKELOCK
782 extern void dhd_os_scan_wake_lock_timeout(dhd_pub_t
*pub
, int val
);
783 extern void dhd_os_scan_wake_unlock(dhd_pub_t
*pub
);
784 #endif /* BCMPCIE_SCAN_WAKELOCK */
786 inline static void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t
* dhdp
)
788 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
789 mutex_init(&dhdp
->wl_softap_lock
);
790 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
793 inline static void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t
* dhdp
)
795 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
796 mutex_lock(&dhdp
->wl_softap_lock
);
797 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
800 inline static void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t
* dhdp
)
802 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25))
803 mutex_unlock(&dhdp
->wl_softap_lock
);
804 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) */
807 #define DHD_OS_WAKE_LOCK(pub) dhd_os_wake_lock(pub)
808 #define DHD_OS_WAKE_UNLOCK(pub) dhd_os_wake_unlock(pub)
809 #define DHD_EVENT_WAKE_LOCK(pub) dhd_event_wake_lock(pub)
810 #define DHD_EVENT_WAKE_UNLOCK(pub) dhd_event_wake_unlock(pub)
811 #define DHD_OS_WAKE_LOCK_TIMEOUT(pub) dhd_os_wake_lock_timeout(pub)
812 #define DHD_OS_WAKE_LOCK_RX_TIMEOUT_ENABLE(pub, val) \
813 dhd_os_wake_lock_rx_timeout_enable(pub, val)
814 #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_ENABLE(pub, val) \
815 dhd_os_wake_lock_ctrl_timeout_enable(pub, val)
816 #define DHD_OS_WAKE_LOCK_CTRL_TIMEOUT_CANCEL(pub) \
817 dhd_os_wake_lock_ctrl_timeout_cancel(pub)
818 #define DHD_OS_WAKE_LOCK_WAIVE(pub) dhd_os_wake_lock_waive(pub)
819 #define DHD_OS_WAKE_LOCK_RESTORE(pub) dhd_os_wake_lock_restore(pub)
820 #define DHD_OS_WAKE_LOCK_INIT(dhd) dhd_os_wake_lock_init(dhd);
821 #define DHD_OS_WAKE_LOCK_DESTROY(dhd) dhd_os_wake_lock_destroy(dhd);
823 #define DHD_OS_WD_WAKE_LOCK(pub) dhd_os_wd_wake_lock(pub)
824 #define DHD_OS_WD_WAKE_UNLOCK(pub) dhd_os_wd_wake_unlock(pub)
826 #ifdef BCMPCIE_OOB_HOST_WAKE
827 #define OOB_WAKE_LOCK_TIMEOUT 500
828 #define DHD_OS_OOB_IRQ_WAKE_LOCK_TIMEOUT(pub, val) dhd_os_oob_irq_wake_lock_timeout(pub, val)
829 #define DHD_OS_OOB_IRQ_WAKE_UNLOCK(pub) dhd_os_oob_irq_wake_unlock(pub)
830 #endif /* BCMPCIE_OOB_HOST_WAKE */
831 #ifdef DHD_USE_SCAN_WAKELOCK
832 #ifdef DHD_DEBUG_SCAN_WAKELOCK
833 #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val) \
835 printf("call wake_lock_scan: %s %d\n", \
836 __FUNCTION__, __LINE__); \
837 dhd_os_scan_wake_lock_timeout(pub, val); \
839 #define DHD_OS_SCAN_WAKE_UNLOCK(pub) \
841 printf("call wake_unlock_scan: %s %d\n", \
842 __FUNCTION__, __LINE__); \
843 dhd_os_scan_wake_unlock(pub); \
846 #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val) dhd_os_scan_wake_lock_timeout(pub, val)
847 #define DHD_OS_SCAN_WAKE_UNLOCK(pub) dhd_os_scan_wake_unlock(pub)
848 #endif /* DHD_DEBUG_SCAN_WAKELOCK */
850 #define DHD_OS_SCAN_WAKE_LOCK_TIMEOUT(pub, val)
851 #define DHD_OS_SCAN_WAKE_UNLOCK(pub)
852 #endif /* DHD_USE_SCAN_WAKELOCK */
853 #define DHD_PACKET_TIMEOUT_MS 500
854 #define DHD_EVENT_TIMEOUT_MS 1500
855 #define SCAN_WAKE_LOCK_TIMEOUT 10000
857 /* Enum for IOCTL recieved status */
858 typedef enum dhd_ioctl_recieved_status
861 IOCTL_RETURN_ON_SUCCESS
,
862 IOCTL_RETURN_ON_TRAP
,
863 IOCTL_RETURN_ON_BUS_STOP
864 } dhd_ioctl_recieved_status_t
;
866 /* interface operations (register, remove) should be atomic, use this lock to prevent race
867 * condition among wifi on/off and interface operation functions
869 void dhd_net_if_lock(struct net_device
*dev
);
870 void dhd_net_if_unlock(struct net_device
*dev
);
872 #if defined(MULTIPLE_SUPPLICANT)
873 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) && 1
874 extern struct mutex _dhd_sdio_mutex_lock_
;
876 #endif /* MULTIPLE_SUPPLICANT */
878 typedef enum dhd_attach_states
880 DHD_ATTACH_STATE_INIT
= 0x0,
881 DHD_ATTACH_STATE_NET_ALLOC
= 0x1,
882 DHD_ATTACH_STATE_DHD_ALLOC
= 0x2,
883 DHD_ATTACH_STATE_ADD_IF
= 0x4,
884 DHD_ATTACH_STATE_PROT_ATTACH
= 0x8,
885 DHD_ATTACH_STATE_WL_ATTACH
= 0x10,
886 DHD_ATTACH_STATE_THREADS_CREATED
= 0x20,
887 DHD_ATTACH_STATE_WAKELOCKS_INIT
= 0x40,
888 DHD_ATTACH_STATE_CFG80211
= 0x80,
889 DHD_ATTACH_STATE_EARLYSUSPEND_DONE
= 0x100,
890 DHD_ATTACH_STATE_DONE
= 0x200
891 } dhd_attach_states_t
;
893 /* Value -1 means we are unsuccessful in creating the kthread. */
894 #define DHD_PID_KT_INVALID -1
895 /* Value -2 means we are unsuccessful in both creating the kthread and tasklet */
896 #define DHD_PID_KT_TL_INVALID -2
899 * Exported from dhd OS modules (dhd_linux/dhd_ndis)
902 /* Indication from bus module regarding presence/insertion of dongle.
903 * Return dhd_pub_t pointer, used as handle to OS module in later calls.
904 * Returned structure should have bus and prot pointers filled in.
905 * bus_hdrlen specifies required headroom for bus module header.
907 extern dhd_pub_t
*dhd_attach(osl_t
*osh
, struct dhd_bus
*bus
, uint bus_hdrlen
);
908 #if defined(WLP2P) && defined(WL_CFG80211)
909 /* To allow attach/detach calls corresponding to p2p0 interface */
910 extern int dhd_attach_p2p(dhd_pub_t
*);
911 extern int dhd_detach_p2p(dhd_pub_t
*);
912 #endif /* WLP2P && WL_CFG80211 */
913 extern int dhd_register_if(dhd_pub_t
*dhdp
, int idx
, bool need_rtnl_lock
);
915 /* Indication from bus module regarding removal/absence of dongle */
916 extern void dhd_detach(dhd_pub_t
*dhdp
);
917 extern void dhd_free(dhd_pub_t
*dhdp
);
918 extern void dhd_clear(dhd_pub_t
*dhdp
);
920 /* Indication from bus module to change flow-control state */
921 extern void dhd_txflowcontrol(dhd_pub_t
*dhdp
, int ifidx
, bool on
);
923 /* Store the status of a connection attempt for later retrieval by an iovar */
924 extern void dhd_store_conn_status(uint32 event
, uint32 status
, uint32 reason
);
926 extern bool dhd_prec_enq(dhd_pub_t
*dhdp
, struct pktq
*q
, void *pkt
, int prec
);
928 /* Receive frame for delivery to OS. Callee disposes of rxp. */
929 extern void dhd_rx_frame(dhd_pub_t
*dhdp
, int ifidx
, void *rxp
, int numpkt
, uint8 chan
);
931 /* Return pointer to interface name */
932 extern char *dhd_ifname(dhd_pub_t
*dhdp
, int idx
);
934 /* Request scheduling of the bus dpc */
935 extern void dhd_sched_dpc(dhd_pub_t
*dhdp
);
937 /* Notify tx completion */
938 extern void dhd_txcomplete(dhd_pub_t
*dhdp
, void *txp
, bool success
);
939 extern void dhd_dpc_enable(dhd_pub_t
*dhdp
);
941 #define WIFI_FEATURE_INFRA 0x0001 /* Basic infrastructure mode */
942 #define WIFI_FEATURE_INFRA_5G 0x0002 /* Support for 5 GHz Band */
943 #define WIFI_FEATURE_HOTSPOT 0x0004 /* Support for GAS/ANQP */
944 #define WIFI_FEATURE_P2P 0x0008 /* Wifi-Direct */
945 #define WIFI_FEATURE_SOFT_AP 0x0010 /* Soft AP */
946 #define WIFI_FEATURE_GSCAN 0x0020 /* Google-Scan APIs */
947 #define WIFI_FEATURE_NAN 0x0040 /* Neighbor Awareness Networking */
948 #define WIFI_FEATURE_D2D_RTT 0x0080 /* Device-to-device RTT */
949 #define WIFI_FEATURE_D2AP_RTT 0x0100 /* Device-to-AP RTT */
950 #define WIFI_FEATURE_BATCH_SCAN 0x0200 /* Batched Scan (legacy) */
951 #define WIFI_FEATURE_PNO 0x0400 /* Preferred network offload */
952 #define WIFI_FEATURE_ADDITIONAL_STA 0x0800 /* Support for two STAs */
953 #define WIFI_FEATURE_TDLS 0x1000 /* Tunnel directed link setup */
954 #define WIFI_FEATURE_TDLS_OFFCHANNEL 0x2000 /* Support for TDLS off channel */
955 #define WIFI_FEATURE_EPR 0x4000 /* Enhanced power reporting */
956 #define WIFI_FEATURE_AP_STA 0x8000 /* Support for AP STA Concurrency */
957 #define WIFI_FEATURE_LINKSTAT 0x10000 /* Support for Linkstats */
959 #define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3
961 extern int dhd_dev_get_feature_set(struct net_device
*dev
);
962 extern int *dhd_dev_get_feature_set_matrix(struct net_device
*dev
, int *num
);
963 #ifdef CUSTOM_FORCE_NODFS_FLAG
964 extern int dhd_dev_set_nodfs(struct net_device
*dev
, uint nodfs
);
965 #endif /* CUSTOM_FORCE_NODFS_FLAG */
966 /* OS independent layer functions */
967 extern void dhd_os_dhdiovar_lock(dhd_pub_t
*pub
);
968 extern void dhd_os_dhdiovar_unlock(dhd_pub_t
*pub
);
969 extern int dhd_os_proto_block(dhd_pub_t
* pub
);
970 extern int dhd_os_proto_unblock(dhd_pub_t
* pub
);
971 extern int dhd_os_ioctl_resp_wait(dhd_pub_t
* pub
, uint
* condition
);
972 extern int dhd_os_ioctl_resp_wake(dhd_pub_t
* pub
);
973 extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
974 extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec
);
975 extern void dhd_os_ioctl_resp_lock(dhd_pub_t
* pub
);
976 extern void dhd_os_ioctl_resp_unlock(dhd_pub_t
* pub
);
977 extern int dhd_wakeup_ioctl_event(dhd_pub_t
*pub
, dhd_ioctl_recieved_status_t reason
);
979 #define DHD_OS_IOCTL_RESP_LOCK(x)
980 #define DHD_OS_IOCTL_RESP_UNLOCK(x)
983 extern int dhd_os_get_image_block(char * buf
, int len
, void * image
);
984 extern int dhd_os_get_image_size(void * image
);
985 extern void * dhd_os_open_image(char * filename
);
986 extern void dhd_os_close_image(void * image
);
987 extern void dhd_os_wd_timer(void *bus
, uint wdtick
);
988 #ifdef DHD_PCIE_RUNTIMEPM
989 extern void dhd_os_runtimepm_timer(void *bus
, uint tick
);
990 #endif /* DHD_PCIE_RUNTIMEPM */
991 extern void dhd_os_sdlock(dhd_pub_t
* pub
);
992 extern void dhd_os_sdunlock(dhd_pub_t
* pub
);
993 extern void dhd_os_sdlock_txq(dhd_pub_t
* pub
);
994 extern void dhd_os_sdunlock_txq(dhd_pub_t
* pub
);
995 extern void dhd_os_sdlock_rxq(dhd_pub_t
* pub
);
996 extern void dhd_os_sdunlock_rxq(dhd_pub_t
* pub
);
997 extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t
* pub
);
998 #ifdef DHDTCPACK_SUPPRESS
999 extern unsigned long dhd_os_tcpacklock(dhd_pub_t
*pub
);
1000 extern void dhd_os_tcpackunlock(dhd_pub_t
*pub
, unsigned long flags
);
1001 #endif /* DHDTCPACK_SUPPRESS */
1003 extern int dhd_customer_oob_irq_map(void *adapter
, unsigned long *irq_flags_ptr
);
1004 extern int dhd_customer_gpio_wlan_ctrl(void *adapter
, int onoff
);
1005 extern int dhd_custom_get_mac_address(void *adapter
, unsigned char *buf
);
1006 #ifdef CUSTOM_COUNTRY_CODE
1007 extern void get_customized_country_code(void *adapter
, char *country_iso_code
,
1008 wl_country_t
*cspec
, u32 flags
);
1010 extern void get_customized_country_code(void *adapter
, char *country_iso_code
, wl_country_t
*cspec
);
1011 #endif /* CUSTOM_COUNTRY_CODE */
1012 extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t
* pub
);
1013 extern void dhd_os_sdlock_eventq(dhd_pub_t
* pub
);
1014 extern void dhd_os_sdunlock_eventq(dhd_pub_t
* pub
);
1015 extern bool dhd_os_check_hang(dhd_pub_t
*dhdp
, int ifidx
, int ret
);
1016 extern int dhd_os_send_hang_message(dhd_pub_t
*dhdp
);
1017 extern void dhd_set_version_info(dhd_pub_t
*pub
, char *fw
);
1018 extern bool dhd_os_check_if_up(dhd_pub_t
*pub
);
1019 extern int dhd_os_check_wakelock(dhd_pub_t
*pub
);
1020 extern int dhd_os_check_wakelock_all(dhd_pub_t
*pub
);
1021 extern int dhd_get_instance(dhd_pub_t
*pub
);
1022 #ifdef CUSTOM_SET_CPUCORE
1023 extern void dhd_set_cpucore(dhd_pub_t
*dhd
, int set
);
1024 #endif /* CUSTOM_SET_CPUCORE */
1026 #if defined(KEEP_ALIVE)
1027 extern int dhd_keep_alive_onoff(dhd_pub_t
*dhd
);
1028 #endif /* KEEP_ALIVE */
1030 #ifdef SUPPORT_AP_POWERSAVE
1031 extern int dhd_set_ap_powersave(dhd_pub_t
*dhdp
, int ifidx
, int enable
);
1034 #if defined(DHD_FW_COREDUMP)
1035 void dhd_schedule_memdump(dhd_pub_t
*dhdp
, uint8
*buf
, uint32 size
);
1036 #endif /* DHD_FW_COREDUMP */
1038 #ifdef SUPPORT_AP_POWERSAVE
1039 extern int dhd_set_ap_powersave(dhd_pub_t
*dhdp
, int ifidx
, int enable
);
1040 #endif /* SUPPORT_AP_POWERSAVE */
1043 #ifdef PKT_FILTER_SUPPORT
1044 #define DHD_UNICAST_FILTER_NUM 0
1045 #define DHD_BROADCAST_FILTER_NUM 1
1046 #define DHD_MULTICAST4_FILTER_NUM 2
1047 #define DHD_MULTICAST6_FILTER_NUM 3
1048 #define DHD_MDNS_FILTER_NUM 4
1049 #define DHD_ARP_FILTER_NUM 5
1050 extern int dhd_os_enable_packet_filter(dhd_pub_t
*dhdp
, int val
);
1051 extern void dhd_enable_packet_filter(int value
, dhd_pub_t
*dhd
);
1052 extern int net_os_enable_packet_filter(struct net_device
*dev
, int val
);
1053 extern int net_os_rxfilter_add_remove(struct net_device
*dev
, int val
, int num
);
1054 extern int net_os_set_suspend_bcn_li_dtim(struct net_device
*dev
, int val
);
1055 #endif /* PKT_FILTER_SUPPORT */
1057 extern int dhd_get_suspend_bcn_li_dtim(dhd_pub_t
*dhd
);
1058 extern bool dhd_support_sta_mode(dhd_pub_t
*dhd
);
1060 extern int write_to_file(dhd_pub_t
*dhd
, uint8
*buf
, int size
);
1063 uint32 limit
; /* Expiration time (usec) */
1064 uint32 increment
; /* Current expiration increment (usec) */
1065 uint32 elapsed
; /* Current elapsed time (usec) */
1066 uint32 tick
; /* O/S tick time (usec) */
1069 #ifdef SHOW_LOGTRACE
1076 uint32 rodata_start
;
1079 uint32 rom_ramstart
;
1080 uint32 rom_rodata_start
;
1081 uint32 rom_rodata_end
;
1083 #endif /* SHOW_LOGTRACE */
1085 extern void dhd_timeout_start(dhd_timeout_t
*tmo
, uint usec
);
1086 extern int dhd_timeout_expired(dhd_timeout_t
*tmo
);
1088 extern int dhd_ifname2idx(struct dhd_info
*dhd
, char *name
);
1089 extern int dhd_net2idx(struct dhd_info
*dhd
, struct net_device
*net
);
1090 extern struct net_device
* dhd_idx2net(void *pub
, int ifidx
);
1091 extern int net_os_send_hang_message(struct net_device
*dev
);
1092 extern int net_os_send_hang_message_reason(struct net_device
*dev
, const char *string_num
);
1093 extern bool dhd_wowl_cap(void *bus
);
1095 extern int wl_host_event(dhd_pub_t
*dhd_pub
, int *idx
, void *pktdata
,
1096 wl_event_msg_t
*, void **data_ptr
, void *);
1097 extern void wl_event_to_host_order(wl_event_msg_t
* evt
);
1098 extern int wl_host_event_get_data(void *pktdata
, wl_event_msg_t
*event
, void **data_ptr
);
1100 extern int dhd_wl_ioctl(dhd_pub_t
*dhd_pub
, int ifindex
, wl_ioctl_t
*ioc
, void *buf
, int len
);
1101 extern int dhd_wl_ioctl_cmd(dhd_pub_t
*dhd_pub
, int cmd
, void *arg
, int len
, uint8 set
,
1103 extern int dhd_wl_ioctl_get_intiovar(dhd_pub_t
*dhd_pub
, char *name
, uint
*pval
,
1104 int cmd
, uint8 set
, int ifidx
);
1105 extern int dhd_wl_ioctl_set_intiovar(dhd_pub_t
*dhd_pub
, char *name
, uint val
,
1106 int cmd
, uint8 set
, int ifidx
);
1107 extern void dhd_common_init(osl_t
*osh
);
1109 extern int dhd_do_driver_init(struct net_device
*net
);
1110 extern int dhd_event_ifadd(struct dhd_info
*dhd
, struct wl_event_data_if
*ifevent
,
1111 char *name
, uint8
*mac
);
1112 extern int dhd_event_ifdel(struct dhd_info
*dhd
, struct wl_event_data_if
*ifevent
,
1113 char *name
, uint8
*mac
);
1114 extern struct net_device
* dhd_allocate_if(dhd_pub_t
*dhdpub
, int ifidx
, char *name
,
1115 uint8
*mac
, uint8 bssidx
, bool need_rtnl_lock
, char *dngl_name
);
1116 extern int dhd_remove_if(dhd_pub_t
*dhdpub
, int ifidx
, bool need_rtnl_lock
);
1117 extern void dhd_vif_add(struct dhd_info
*dhd
, int ifidx
, char * name
);
1118 extern void dhd_vif_del(struct dhd_info
*dhd
, int ifidx
);
1119 extern void dhd_event(struct dhd_info
*dhd
, char *evpkt
, int evlen
, int ifidx
);
1120 extern void dhd_vif_sendup(struct dhd_info
*dhd
, int ifidx
, uchar
*cp
, int len
);
1122 /* Send packet to dongle via data channel */
1123 extern int dhd_sendpkt(dhd_pub_t
*dhdp
, int ifidx
, void *pkt
);
1125 /* send up locally generated event */
1126 extern void dhd_sendup_event_common(dhd_pub_t
*dhdp
, wl_event_msg_t
*event
, void *data
);
1127 /* Send event to host */
1128 extern void dhd_sendup_event(dhd_pub_t
*dhdp
, wl_event_msg_t
*event
, void *data
);
1129 #ifdef LOG_INTO_TCPDUMP
1130 extern void dhd_sendup_log(dhd_pub_t
*dhdp
, void *data
, int len
);
1131 #endif /* LOG_INTO_TCPDUMP */
1132 extern int dhd_bus_devreset(dhd_pub_t
*dhdp
, uint8 flag
);
1133 extern uint
dhd_bus_status(dhd_pub_t
*dhdp
);
1134 extern int dhd_bus_start(dhd_pub_t
*dhdp
);
1135 extern int dhd_bus_suspend(dhd_pub_t
*dhdpub
);
1136 extern int dhd_bus_resume(dhd_pub_t
*dhdpub
, int stage
);
1137 extern int dhd_bus_membytes(dhd_pub_t
*dhdp
, bool set
, uint32 address
, uint8
*data
, uint size
);
1138 extern void dhd_print_buf(void *pbuf
, int len
, int bytes_per_line
);
1139 extern bool dhd_is_associated(dhd_pub_t
*dhd
, uint8 ifidx
, int *retval
);
1140 #if defined(BCMSDIO) || defined(BCMPCIE)
1141 extern uint
dhd_bus_chip_id(dhd_pub_t
*dhdp
);
1142 extern uint
dhd_bus_chiprev_id(dhd_pub_t
*dhdp
);
1143 extern uint
dhd_bus_chippkg_id(dhd_pub_t
*dhdp
);
1144 #endif /* defined(BCMSDIO) || defined(BCMPCIE) */
1146 #if defined(KEEP_ALIVE)
1147 extern int dhd_keep_alive_onoff(dhd_pub_t
*dhd
);
1148 #endif /* KEEP_ALIVE */
1150 /* OS spin lock API */
1151 extern void *dhd_os_spin_lock_init(osl_t
*osh
);
1152 extern void dhd_os_spin_lock_deinit(osl_t
*osh
, void *lock
);
1153 extern unsigned long dhd_os_spin_lock(void *lock
);
1154 void dhd_os_spin_unlock(void *lock
, unsigned long flags
);
1157 * Manage sta objects in an interface. Interface is identified by an ifindex and
1158 * sta(s) within an interfaces are managed using a MacAddress of the sta.
1161 extern struct dhd_sta
*dhd_findadd_sta(void *pub
, int ifidx
, void *ea
);
1162 extern void dhd_del_sta(void *pub
, int ifidx
, void *ea
);
1163 extern int dhd_get_ap_isolate(dhd_pub_t
*dhdp
, uint32 idx
);
1164 extern int dhd_set_ap_isolate(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1165 #if defined(BCM_GMAC3)
1166 extern int dhd_set_dev_def(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1168 extern int dhd_bssidx2idx(dhd_pub_t
*dhdp
, uint32 bssidx
);
1169 extern int dhd_os_d3ack_wait(dhd_pub_t
* pub
, uint
* condition
);
1170 extern int dhd_os_d3ack_wake(dhd_pub_t
* pub
);
1171 extern int dhd_os_busbusy_wait_negation(dhd_pub_t
* pub
, uint
* condition
);
1172 extern int dhd_os_busbusy_wake(dhd_pub_t
* pub
);
1174 extern bool dhd_is_concurrent_mode(dhd_pub_t
*dhd
);
1175 extern int dhd_iovar(dhd_pub_t
*pub
, int ifidx
, char *name
, char *cmd_buf
, uint cmd_len
, int set
);
1176 typedef enum cust_gpio_modes
{
1181 } cust_gpio_modes_t
;
1183 extern int wl_iw_iscan_set_scan_broadcast_prep(struct net_device
*dev
, uint flag
);
1184 extern int wl_iw_send_priv_event(struct net_device
*dev
, char *flag
);
1186 * Insmod parameters for debug/test
1189 /* Watchdog timer interval */
1190 extern uint dhd_watchdog_ms
;
1191 extern bool dhd_os_wd_timer_enabled(void *bus
);
1193 #ifdef DHD_PCIE_RUNTIMEPM
1194 extern uint dhd_runtimepm_ms
;
1195 #endif /* DHD_PCIE_RUNTIMEPM */
1197 #if defined(DHD_DEBUG)
1198 /* Console output poll interval */
1199 extern uint dhd_console_ms
;
1200 #endif /* defined(DHD_DEBUG) */
1201 extern uint android_msg_level
;
1202 extern uint config_msg_level
;
1203 extern uint sd_msglevel
;
1204 #ifdef WL_WIRELESS_EXT
1205 extern uint iw_msg_level
;
1208 extern uint wl_dbg_level
;
1211 extern uint dhd_slpauto
;
1213 /* Use interrupts */
1214 extern uint dhd_intr
;
1217 extern uint dhd_poll
;
1219 /* ARP offload agent mode */
1220 extern uint dhd_arp_mode
;
1222 /* ARP offload enable */
1223 extern uint dhd_arp_enable
;
1225 /* Pkt filte enable control */
1226 extern uint dhd_pkt_filter_enable
;
1228 /* Pkt filter init setup */
1229 extern uint dhd_pkt_filter_init
;
1231 /* Pkt filter mode control */
1232 extern uint dhd_master_mode
;
1234 /* Roaming mode control */
1235 extern uint dhd_roam_disable
;
1237 /* Roaming mode control */
1238 extern uint dhd_radio_up
;
1240 /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */
1241 extern int dhd_idletime
;
1242 #ifdef DHD_USE_IDLECOUNT
1243 #define DHD_IDLETIME_TICKS 5
1245 #define DHD_IDLETIME_TICKS 1
1246 #endif /* DHD_USE_IDLECOUNT */
1248 /* SDIO Drive Strength */
1249 extern uint dhd_sdiod_drive_strength
;
1251 /* triggers bcm_bprintf to print to kernel log */
1252 extern bool bcm_bprintf_bypass
;
1254 /* Override to force tx queueing all the time */
1255 extern uint dhd_force_tx_queueing
;
1256 /* Default KEEP_ALIVE Period is 55 sec to prevent AP from sending Keep Alive probe frame */
1257 #define DEFAULT_KEEP_ALIVE_VALUE 55000 /* msec */
1258 #ifndef CUSTOM_KEEP_ALIVE_SETTING
1259 #define CUSTOM_KEEP_ALIVE_SETTING DEFAULT_KEEP_ALIVE_VALUE
1260 #endif /* DEFAULT_KEEP_ALIVE_VALUE */
1262 #define NULL_PKT_STR "null_pkt"
1264 /* hooks for custom glom setting option via Makefile */
1265 #define DEFAULT_GLOM_VALUE -1
1266 #ifndef CUSTOM_GLOM_SETTING
1267 #define CUSTOM_GLOM_SETTING DEFAULT_GLOM_VALUE
1269 #define WL_AUTO_ROAM_TRIGGER -75
1270 /* hooks for custom Roaming Trigger setting via Makefile */
1271 #define DEFAULT_ROAM_TRIGGER_VALUE -75 /* dBm default roam trigger all band */
1272 #define DEFAULT_ROAM_TRIGGER_SETTING -1
1273 #ifndef CUSTOM_ROAM_TRIGGER_SETTING
1274 #define CUSTOM_ROAM_TRIGGER_SETTING DEFAULT_ROAM_TRIGGER_VALUE
1277 /* hooks for custom Roaming Romaing setting via Makefile */
1278 #define DEFAULT_ROAM_DELTA_VALUE 10 /* dBm default roam delta all band */
1279 #define DEFAULT_ROAM_DELTA_SETTING -1
1280 #ifndef CUSTOM_ROAM_DELTA_SETTING
1281 #define CUSTOM_ROAM_DELTA_SETTING DEFAULT_ROAM_DELTA_VALUE
1284 /* hooks for custom PNO Event wake lock to guarantee enough time
1285 for the Platform to detect Event before system suspended
1287 #define DEFAULT_PNO_EVENT_LOCK_xTIME 2 /* multiplay of DHD_PACKET_TIMEOUT_MS */
1288 #ifndef CUSTOM_PNO_EVENT_LOCK_xTIME
1289 #define CUSTOM_PNO_EVENT_LOCK_xTIME DEFAULT_PNO_EVENT_LOCK_xTIME
1291 /* hooks for custom dhd_dpc_prio setting option via Makefile */
1292 #define DEFAULT_DHP_DPC_PRIO 1
1293 #ifndef CUSTOM_DPC_PRIO_SETTING
1294 #define CUSTOM_DPC_PRIO_SETTING DEFAULT_DHP_DPC_PRIO
1297 #ifndef CUSTOM_LISTEN_INTERVAL
1298 #define CUSTOM_LISTEN_INTERVAL LISTEN_INTERVAL
1299 #endif /* CUSTOM_LISTEN_INTERVAL */
1301 #define DEFAULT_SUSPEND_BCN_LI_DTIM 3
1302 #ifndef CUSTOM_SUSPEND_BCN_LI_DTIM
1303 #define CUSTOM_SUSPEND_BCN_LI_DTIM DEFAULT_SUSPEND_BCN_LI_DTIM
1306 #ifndef CUSTOM_RXF_PRIO_SETTING
1307 #define CUSTOM_RXF_PRIO_SETTING MAX((CUSTOM_DPC_PRIO_SETTING - 1), 1)
1310 #define DEFAULT_WIFI_TURNOFF_DELAY 0
1311 #define WIFI_TURNOFF_DELAY DEFAULT_WIFI_TURNOFF_DELAY
1313 #define DEFAULT_WIFI_TURNON_DELAY 200
1314 #ifndef WIFI_TURNON_DELAY
1315 #define WIFI_TURNON_DELAY DEFAULT_WIFI_TURNON_DELAY
1316 #endif /* WIFI_TURNON_DELAY */
1319 #define DEFAULT_DHD_WATCHDOG_INTERVAL_MS 10 /* msec */
1321 #define DEFAULT_DHD_WATCHDOG_INTERVAL_MS 0 /* msec */
1323 #ifndef CUSTOM_DHD_WATCHDOG_MS
1324 #define CUSTOM_DHD_WATCHDOG_MS DEFAULT_DHD_WATCHDOG_INTERVAL_MS
1325 #endif /* DEFAULT_DHD_WATCHDOG_INTERVAL_MS */
1327 #define DEFAULT_ASSOC_RETRY_MAX 3
1328 #ifndef CUSTOM_ASSOC_RETRY_MAX
1329 #define CUSTOM_ASSOC_RETRY_MAX DEFAULT_ASSOC_RETRY_MAX
1330 #endif /* DEFAULT_ASSOC_RETRY_MAX */
1334 #ifndef CUSTOM_TDLS_IDLE_MODE_SETTING
1335 #define CUSTOM_TDLS_IDLE_MODE_SETTING 60000 /* 60sec to tear down TDLS of not active */
1337 #ifndef CUSTOM_TDLS_RSSI_THRESHOLD_HIGH
1338 #define CUSTOM_TDLS_RSSI_THRESHOLD_HIGH -70 /* rssi threshold for establishing TDLS link */
1340 #ifndef CUSTOM_TDLS_RSSI_THRESHOLD_LOW
1341 #define CUSTOM_TDLS_RSSI_THRESHOLD_LOW -80 /* rssi threshold for tearing down TDLS link */
1345 #define DEFAULT_BCN_TIMEOUT 8
1346 #ifndef CUSTOM_BCN_TIMEOUT
1347 #define CUSTOM_BCN_TIMEOUT DEFAULT_BCN_TIMEOUT
1350 #define MAX_DTIM_SKIP_BEACON_INTERVAL 100 /* max allowed associated AP beacon for DTIM skip */
1351 #ifndef MAX_DTIM_ALLOWED_INTERVAL
1352 #define MAX_DTIM_ALLOWED_INTERVAL 600 /* max allowed total beacon interval for DTIM skip */
1354 #define NO_DTIM_SKIP 1
1356 /* Echo packet generator (SDIO), pkts/s */
1357 extern uint dhd_pktgen
;
1359 /* Echo packet len (0 => sawtooth, max 1800) */
1360 extern uint dhd_pktgen_len
;
1361 #define MAX_PKTGEN_LEN 1800
1365 /* optionally set by a module_param_string() */
1366 #define MOD_PARAM_PATHLEN 2048
1367 #define MOD_PARAM_INFOLEN 512
1370 extern char fw_path2
[MOD_PARAM_PATHLEN
];
1373 /* Flag to indicate if we should download firmware on driver load */
1374 extern uint dhd_download_fw_on_driverload
;
1375 extern int allow_delay_fwdl
;
1378 extern void dhd_wait_for_event(dhd_pub_t
*dhd
, bool *lockvar
);
1379 extern void dhd_wait_event_wakeup(dhd_pub_t
*dhd
);
1381 #define IFLOCK_INIT(lock) *lock = 0
1382 #define IFLOCK(lock) while (InterlockedCompareExchange((lock), 1, 0)) \
1383 NdisStallExecution(1);
1384 #define IFUNLOCK(lock) InterlockedExchange((lock), 0)
1385 #define IFLOCK_FREE(lock)
1386 #define FW_SUPPORTED(dhd, capa) ((strstr(dhd->fw_capabilities, " " #capa " ") != NULL))
1387 #ifdef ARP_OFFLOAD_SUPPORT
1388 #define MAX_IPV4_ENTRIES 8
1389 void dhd_arp_offload_set(dhd_pub_t
* dhd
, int arp_mode
);
1390 void dhd_arp_offload_enable(dhd_pub_t
* dhd
, int arp_enable
);
1392 /* dhd_commn arp offload wrapers */
1393 void dhd_aoe_hostip_clr(dhd_pub_t
*dhd
, int idx
);
1394 void dhd_aoe_arp_clr(dhd_pub_t
*dhd
, int idx
);
1395 int dhd_arp_get_arp_hostip_table(dhd_pub_t
*dhd
, void *buf
, int buflen
, int idx
);
1396 void dhd_arp_offload_add_ip(dhd_pub_t
*dhd
, uint32 ipaddr
, int idx
);
1397 #endif /* ARP_OFFLOAD_SUPPORT */
1399 int dhd_tdls_enable(struct net_device
*dev
, bool tdls_on
, bool auto_on
, struct ether_addr
*mac
);
1400 int dhd_tdls_set_mode(dhd_pub_t
*dhd
, bool wfd_mode
);
1401 #ifdef PCIE_FULL_DONGLE
1402 void dhd_tdls_update_peer_info(struct net_device
*dev
, bool connect_disconnect
, uint8
*addr
);
1403 #endif /* PCIE_FULL_DONGLE */
1405 /* Neighbor Discovery Offload Support */
1406 extern int dhd_ndo_enable(dhd_pub_t
* dhd
, int ndo_enable
);
1407 int dhd_ndo_add_ip(dhd_pub_t
*dhd
, char* ipaddr
, int idx
);
1408 int dhd_ndo_remove_ip(dhd_pub_t
*dhd
, int idx
);
1409 /* ioctl processing for nl80211 */
1410 int dhd_ioctl_process(dhd_pub_t
*pub
, int ifidx
, struct dhd_ioctl
*ioc
, void *data_buf
);
1412 void dhd_bus_update_fw_nv_path(struct dhd_bus
*bus
, char *pfw_path
, char *pnv_path
,
1413 char *pclm_path
, char *pconf_path
);
1414 void dhd_set_bus_state(void *bus
, uint32 state
);
1416 /* Remove proper pkts(either one no-frag pkt or whole fragmented pkts) */
1417 typedef int (*f_droppkt_t
)(dhd_pub_t
*dhdp
, int prec
, void* p
, bool bPktInQ
);
1418 extern bool dhd_prec_drop_pkts(dhd_pub_t
*dhdp
, struct pktq
*pq
, int prec
, f_droppkt_t fn
);
1420 #ifdef PROP_TXSTATUS
1421 int dhd_os_wlfc_block(dhd_pub_t
*pub
);
1422 int dhd_os_wlfc_unblock(dhd_pub_t
*pub
);
1423 extern const uint8 prio2fifo
[];
1424 #endif /* PROP_TXSTATUS */
1426 uint8
* dhd_os_prealloc(dhd_pub_t
*dhdpub
, int section
, uint size
, bool kmalloc_if_fail
);
1427 void dhd_os_prefree(dhd_pub_t
*dhdpub
, void *addr
, uint size
);
1429 int dhd_process_cid_mac(dhd_pub_t
*dhdp
, bool prepost
);
1431 #if defined(CONFIG_DHD_USE_STATIC_BUF)
1432 #define DHD_OS_PREALLOC(dhdpub, section, size) dhd_os_prealloc(dhdpub, section, size, FALSE)
1433 #define DHD_OS_PREFREE(dhdpub, addr, size) dhd_os_prefree(dhdpub, addr, size)
1435 #define DHD_OS_PREALLOC(dhdpub, section, size) MALLOC(dhdpub->osh, size)
1436 #define DHD_OS_PREFREE(dhdpub, addr, size) MFREE(dhdpub->osh, addr, size)
1437 #endif /* defined(CONFIG_DHD_USE_STATIC_BUF) */
1439 #ifdef USE_WFA_CERT_CONF
1441 SET_PARAM_BUS_TXGLOM_MODE
,
1443 #ifdef USE_WL_FRAMEBURST
1444 SET_PARAM_FRAMEBURST
,
1445 #endif /* USE_WL_FRAMEBURST */
1448 #endif /* USE_WL_TXBF */
1449 #ifdef PROP_TXSTATUS
1451 SET_PARAM_PROPTXMODE
,
1452 #endif /* PROP_TXSTATUS */
1455 extern int sec_get_param_wfa_cert(dhd_pub_t
*dhd
, int mode
, uint
* read_val
);
1456 #endif /* USE_WFA_CERT_CONF */
1458 #define dhd_add_flowid(pub, ifidx, ac_prio, ea, flowid) do {} while (0)
1459 #define dhd_del_flowid(pub, ifidx, flowid) do {} while (0)
1461 extern unsigned long dhd_os_general_spin_lock(dhd_pub_t
*pub
);
1462 extern void dhd_os_general_spin_unlock(dhd_pub_t
*pub
, unsigned long flags
);
1464 /** Miscellaenous DHD Spin Locks */
1466 /* Disable router 3GMAC bypass path perimeter lock */
1467 #define DHD_PERIM_LOCK(dhdp) do {} while (0)
1468 #define DHD_PERIM_UNLOCK(dhdp) do {} while (0)
1469 #define DHD_PERIM_LOCK_ALL(processor_id) do {} while (0)
1470 #define DHD_PERIM_UNLOCK_ALL(processor_id) do {} while (0)
1472 /* Enable DHD general spin lock/unlock */
1473 #define DHD_GENERAL_LOCK(dhdp, flags) \
1474 (flags) = dhd_os_general_spin_lock(dhdp)
1475 #define DHD_GENERAL_UNLOCK(dhdp, flags) \
1476 dhd_os_general_spin_unlock((dhdp), (flags))
1478 /* Enable DHD flowring spin lock/unlock */
1479 #define DHD_FLOWRING_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock)
1480 #define DHD_FLOWRING_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags))
1482 /* Enable DHD common flowring info spin lock/unlock */
1483 #define DHD_FLOWID_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock)
1484 #define DHD_FLOWID_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags))
1486 /* Enable DHD common flowring list spin lock/unlock */
1487 #define DHD_FLOWRING_LIST_LOCK(lock, flags) (flags) = dhd_os_spin_lock(lock)
1488 #define DHD_FLOWRING_LIST_UNLOCK(lock, flags) dhd_os_spin_unlock((lock), (flags))
1490 extern void dhd_dump_to_kernelog(dhd_pub_t
*dhdp
);
1493 #ifdef DHD_L2_FILTER
1494 extern int dhd_get_parp_status(dhd_pub_t
*dhdp
, uint32 idx
);
1495 extern int dhd_set_parp_status(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1496 extern int dhd_get_dhcp_unicast_status(dhd_pub_t
*dhdp
, uint32 idx
);
1497 extern int dhd_set_dhcp_unicast_status(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1498 extern int dhd_get_block_ping_status(dhd_pub_t
*dhdp
, uint32 idx
);
1499 extern int dhd_set_block_ping_status(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1500 extern int dhd_get_grat_arp_status(dhd_pub_t
*dhdp
, uint32 idx
);
1501 extern int dhd_set_grat_arp_status(dhd_pub_t
*dhdp
, uint32 idx
, int val
);
1502 #endif /* DHD_L2_FILTER */
1504 typedef struct wl_io_pport
{
1509 typedef struct wl_evt_pport
{
1517 extern void *dhd_pub_shim(dhd_pub_t
*dhd_pub
);
1518 #ifdef DHD_FW_COREDUMP
1519 void dhd_save_fwdump(dhd_pub_t
*dhd_pub
, void * buffer
, uint32 length
);
1520 #endif /* DHD_FW_COREDUMP */
1522 #if defined(SET_RPS_CPUS)
1523 int dhd_rps_cpus_enable(struct net_device
*net
, int enable
);
1524 int custom_rps_map_set(struct netdev_rx_queue
*queue
, char *buf
, size_t len
);
1525 void custom_rps_map_clear(struct netdev_rx_queue
*queue
);
1526 #define PRIMARY_INF 0
1527 #define VIRTUAL_INF 1
1528 #if defined(CONFIG_MACH_UNIVERSAL5433) || defined(CONFIG_MACH_UNIVERSAL7420) || \
1529 defined(CONFIG_SOC_EXYNOS8890)
1530 #define RPS_CPUS_MASK "10"
1531 #define RPS_CPUS_MASK_P2P "10"
1532 #define RPS_CPUS_MASK_IBSS "10"
1533 #define RPS_CPUS_WLAN_CORE_ID 4
1535 #define RPS_CPUS_MASK "6"
1536 #define RPS_CPUS_MASK_P2P "6"
1537 #define RPS_CPUS_MASK_IBSS "6"
1538 #endif /* CONFIG_MACH_UNIVERSAL5433 || CONFIG_MACH_UNIVERSAL7420 || CONFIG_SOC_EXYNOS8890 */
1541 int dhd_get_download_buffer(dhd_pub_t
*dhd
, char *file_path
, download_type_t component
,
1542 char ** buffer
, int *length
);
1544 void dhd_free_download_buffer(dhd_pub_t
*dhd
, void *buffer
, int length
);
1546 int dhd_download_clm_blob(dhd_pub_t
*dhd
, unsigned char *image
, uint32 len
);
1548 int dhd_apply_default_clm(dhd_pub_t
*dhd
, char *clm_path
);
1549 #define dhd_is_device_removed(x) FALSE
1550 #define dhd_os_ind_firmware_stall(x)
1552 #ifdef DHD_FW_COREDUMP
1553 extern void dhd_get_memdump_info(dhd_pub_t
*dhd
);
1554 #endif /* DHD_FW_COREDUMP */
1555 #ifdef BCMASSERT_LOG
1556 extern void dhd_get_assert_info(dhd_pub_t
*dhd
);
1557 #endif /* BCMASSERT_LOG */
1560 #if defined(DHD_LB_STATS)
1561 #include <bcmutils.h>
1562 extern void dhd_lb_stats_init(dhd_pub_t
*dhd
);
1563 extern void dhd_lb_stats_dump(dhd_pub_t
*dhdp
, struct bcmstrbuf
*strbuf
);
1564 extern void dhd_lb_stats_update_napi_histo(dhd_pub_t
*dhdp
, uint32 count
);
1565 extern void dhd_lb_stats_update_txc_histo(dhd_pub_t
*dhdp
, uint32 count
);
1566 extern void dhd_lb_stats_update_rxc_histo(dhd_pub_t
*dhdp
, uint32 count
);
1567 extern void dhd_lb_stats_txc_percpu_cnt_incr(dhd_pub_t
*dhdp
);
1568 extern void dhd_lb_stats_rxc_percpu_cnt_incr(dhd_pub_t
*dhdp
);
1569 #define DHD_LB_STATS_INIT(dhdp) dhd_lb_stats_init(dhdp)
1570 /* Reset is called from common layer so it takes dhd_pub_t as argument */
1571 #define DHD_LB_STATS_RESET(dhdp) dhd_lb_stats_init(dhdp)
1572 #define DHD_LB_STATS_CLR(x) (x) = 0U
1573 #define DHD_LB_STATS_INCR(x) (x) = (x) + 1
1574 #define DHD_LB_STATS_ADD(x, c) (x) = (x) + (c)
1575 #define DHD_LB_STATS_PERCPU_ARR_INCR(x) \
1577 int cpu = get_cpu(); put_cpu(); \
1578 DHD_LB_STATS_INCR(x[cpu]); \
1580 #define DHD_LB_STATS_UPDATE_NAPI_HISTO(dhdp, x) dhd_lb_stats_update_napi_histo(dhdp, x)
1581 #define DHD_LB_STATS_UPDATE_TXC_HISTO(dhdp, x) dhd_lb_stats_update_txc_histo(dhdp, x)
1582 #define DHD_LB_STATS_UPDATE_RXC_HISTO(dhdp, x) dhd_lb_stats_update_rxc_histo(dhdp, x)
1583 #define DHD_LB_STATS_TXC_PERCPU_CNT_INCR(dhdp) dhd_lb_stats_txc_percpu_cnt_incr(dhdp)
1584 #define DHD_LB_STATS_RXC_PERCPU_CNT_INCR(dhdp) dhd_lb_stats_rxc_percpu_cnt_incr(dhdp)
1585 #else /* !DHD_LB_STATS */
1586 #define DHD_LB_STATS_NOOP do { /* noop */ } while (0)
1587 #define DHD_LB_STATS_INIT(dhdp) DHD_LB_STATS_NOOP
1588 #define DHD_LB_STATS_RESET(dhdp) DHD_LB_STATS_NOOP
1589 #define DHD_LB_STATS_CLR(x) DHD_LB_STATS_NOOP
1590 #define DHD_LB_STATS_INCR(x) DHD_LB_STATS_NOOP
1591 #define DHD_LB_STATS_ADD(x, c) DHD_LB_STATS_NOOP
1592 #define DHD_LB_STATS_PERCPU_ARR_INCR(x) DHD_LB_STATS_NOOP
1593 #define DHD_LB_STATS_UPDATE_NAPI_HISTO(dhd, x) DHD_LB_STATS_NOOP
1594 #define DHD_LB_STATS_UPDATE_TXC_HISTO(dhd, x) DHD_LB_STATS_NOOP
1595 #define DHD_LB_STATS_UPDATE_RXC_HISTO(dhd, x) DHD_LB_STATS_NOOP
1596 #define DHD_LB_STATS_TXC_PERCPU_CNT_INCR(dhdp) DHD_LB_STATS_NOOP
1597 #define DHD_LB_STATS_RXC_PERCPU_CNT_INCR(dhdp) DHD_LB_STATS_NOOP
1598 #endif /* !DHD_LB_STATS */
1600 #ifdef DHD_PCIE_RUNTIMEPM
1601 extern bool dhd_runtimepm_state(dhd_pub_t
*dhd
);
1602 extern bool dhd_runtime_bus_wake(struct dhd_bus
*bus
, bool wait
, void *func_addr
);
1603 extern bool dhdpcie_runtime_bus_wake(dhd_pub_t
*dhdp
, bool wait
, void *func_addr
);
1604 extern void dhdpcie_block_runtime_pm(dhd_pub_t
*dhdp
);
1605 extern bool dhdpcie_is_resume_done(dhd_pub_t
*dhdp
);
1606 extern void dhd_runtime_pm_disable(dhd_pub_t
*dhdp
);
1607 extern void dhd_runtime_pm_enable(dhd_pub_t
*dhdp
);
1608 /* Disable the Runtime PM and wake up if the bus is already in suspend */
1609 #define DHD_DISABLE_RUNTIME_PM(dhdp) \
1611 dhd_runtime_pm_disable(dhdp); \
1614 /* Enable the Runtime PM */
1615 #define DHD_ENABLE_RUNTIME_PM(dhdp) \
1617 dhd_runtime_pm_enable(dhdp); \
1620 #define DHD_DISABLE_RUNTIME_PM(dhdp)
1621 #define DHD_ENABLE_RUNTIME_PM(dhdp)
1622 #endif /* DHD_PCIE_RUNTIMEPM */
1624 extern void dhd_memdump_work_schedule(dhd_pub_t
*dhdp
, unsigned long msecs
);
1627 * Enable this macro if you want to track the calls to wake lock
1628 * This records can be printed using the following command
1629 * cat /sys/bcm-dhd/wklock_trace
1630 * DHD_TRACE_WAKE_LOCK supports over linux 2.6.0 version
1632 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0))
1633 #undef DHD_TRACE_WAKE_LOCK
1634 #endif /* KERNEL_VER < KERNEL_VERSION(2, 6, 0) */
1636 #if defined(DHD_TRACE_WAKE_LOCK)
1637 void dhd_wk_lock_stats_dump(dhd_pub_t
*dhdp
);
1640 extern int dhd_prot_debug_info_print(dhd_pub_t
*dhd
);
1642 #ifdef ENABLE_TEMP_THROTTLING
1643 #define TEMP_THROTTLE_CONTROL_BIT 0xf //Enable all feature.
1644 #endif /* ENABLE_TEMP_THROTTLING */
1646 #ifdef DHD_PKTID_AUDIT_ENABLED
1647 void dhd_pktid_audit_fail_cb(dhd_pub_t
*dhdp
);
1648 #endif /* DHD_PKTID_AUDIT_ENABLED */
1650 #endif /* _dhd_h_ */