2 * @file wilc_wfi_netdevice.h
3 * @brief Definitions for the network module
8 #ifndef WILC_WFI_NETDEVICE
9 #define WILC_WFI_NETDEVICE
11 /* These are the flags in the statusword */
12 #define WILC_WFI_RX_INTR 0x0001
13 #define WILC_WFI_TX_INTR 0x0002
15 /* Default timeout period */
16 #define WILC_WFI_TIMEOUT 5 /* In jiffies */
17 #define WILC_MAX_NUM_PMKIDS 16
20 #define NUM_STA_ASSOCIATED 8
22 #include <linux/module.h>
23 #include <linux/init.h>
24 #include <linux/moduleparam.h>
25 #include <linux/sched.h>
26 #include <linux/kernel.h>
27 #include <linux/slab.h> /* kmalloc() */
28 #include <linux/errno.h> /* error codes */
29 #include <linux/types.h> /* size_t */
30 #include <linux/interrupt.h> /* mark_bh */
31 #include <linux/time.h>
33 #include <linux/netdevice.h> /* struct device, and other headers */
34 #include <linux/etherdevice.h> /* eth_type_trans */
35 #include <linux/ip.h> /* struct iphdr */
36 #include <linux/tcp.h> /* struct tcphdr */
37 #include <linux/skbuff.h>
38 #include <linux/ieee80211.h>
39 #include <net/cfg80211.h>
40 #include <linux/ieee80211.h>
41 #include <net/cfg80211.h>
42 #include <net/ieee80211_radiotap.h>
43 #include <linux/if_arp.h>
44 #include <linux/in6.h>
45 #include <asm/checksum.h>
46 #include "host_interface.h"
47 #include "wilc_wlan.h"
48 #include <linux/wireless.h> /* tony, 2013-06-12 */
50 #define FLOW_CONTROL_LOWER_THRESHOLD 128
51 #define FLOW_CONTROL_UPPER_THRESHOLD 256
55 WILC_WFI_RX_PKT = 1 << 0,
56 WILC_WFI_TX_PKT = 1 << 1,
59 struct WILC_WFI_stats {
60 unsigned long rx_packets;
61 unsigned long tx_packets;
62 unsigned long rx_bytes;
63 unsigned long tx_bytes;
70 * This structure is private to each device. It is used to pass
71 * packets in and out, so there is place for a packet
74 #define RX_BH_KTHREAD 0
75 #define RX_BH_WORK_QUEUE 1
76 #define RX_BH_THREADED_IRQ 2
77 #define num_reg_frame 2
79 * If you use RX_BH_WORK_QUEUE on LPC3131: You may lose the first interrupt on
80 * LPC3131 which is important to get the MAC start status when you are blocked inside
81 * linux_wlan_firmware_download() which blocks mac_open().
83 #if defined (NM73131_0_BOARD)
84 #define RX_BH_TYPE RX_BH_KTHREAD
85 #elif defined (PANDA_BOARD)
86 #define RX_BH_TYPE RX_BH_THREADED_IRQ
88 #define RX_BH_TYPE RX_BH_KTHREAD
98 struct wilc_wfi_wep_key {
105 u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
109 /*Parameters needed for host interface for remaining on channel*/
110 struct wilc_wfi_p2pListenParams {
111 struct ieee80211_channel *pstrListenChan;
112 enum nl80211_channel_type tenuChannelType;
113 u32 u32ListenDuration;
115 u32 u32ListenSessionID;
120 struct WILC_WFI_priv {
121 struct wireless_dev *wdev;
122 struct cfg80211_scan_request *pstrScanReq;
125 struct wilc_wfi_p2pListenParams strRemainOnChanParams;
132 u8 au8AssociatedBss[ETH_ALEN];
133 struct sta_info assoc_stainfo;
134 struct net_device_stats stats;
137 struct WILC_WFI_packet *ppool;
138 struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
144 struct net_device *dev;
145 struct napi_struct napi;
146 WILC_WFIDrvHandle hWILCWFIDrv;
147 WILC_WFIDrvHandle hWILCWFIDrv_2;
148 tstrHostIFpmkidAttr pmkid_list;
149 struct WILC_WFI_stats netstats;
150 u8 WILC_WFI_wep_default;
151 u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
152 u8 WILC_WFI_wep_key_len[4];
153 struct net_device *real_ndev; /* The real interface that the monitor is on */
154 struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
155 struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
158 struct semaphore SemHandleUpdateStats;
159 struct semaphore hSemScanReq;
161 bool gbAutoRateAdjusted;
163 bool bInP2PlistenState;
173 #define NUM_CONCURRENT_IFC 2
175 uint8_t aSrcAddress[ETH_ALEN];
176 uint8_t aBSSID[ETH_ALEN];
178 struct net_device *wilc_netdev;
182 int wilc1000_initialized;
183 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
184 unsigned short dev_irq_num;
189 tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
193 /*Added by Amr - BugID_4720*/
194 struct mutex txq_add_to_head_cs;
195 spinlock_t txq_spinlock;
200 /* struct mutex txq_event; */
201 struct semaphore rxq_event;
202 struct semaphore cfg_event;
203 struct semaphore sync_event;
205 struct semaphore txq_event;
206 /* struct completion txq_event; */
208 #if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
209 struct work_struct rx_work_queue;
210 #elif (RX_BH_TYPE == RX_BH_KTHREAD)
211 struct task_struct *rx_bh_thread;
212 struct semaphore rx_sem;
214 struct semaphore rxq_thread_started;
215 struct semaphore txq_thread_started;
217 struct task_struct *rxq_thread;
218 struct task_struct *txq_thread;
220 unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
221 /* unsigned char eth_dst_address[6]; */
223 const struct firmware *wilc_firmware; /* Bug 4703 */
225 struct net_device *real_ndev;
228 struct sdio_func *wilc_sdio_func;
230 struct spi_device *wilc_spidev;
241 struct_frame_reg g_struct_frame_reg[num_reg_frame];
243 struct net_device *wilc_netdev;
244 struct net_device_stats netstats;
246 } perInterface_wlan_t;
248 struct WILC_WFI_mon_priv {
249 struct net_device *real_ndev;
252 extern struct net_device *WILC_WFI_devs[];