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>
39 #include <linux/ieee80211.h>
40 #include <net/cfg80211.h>
42 #include <linux/ieee80211.h>
43 #include <net/cfg80211.h>
44 #include <net/ieee80211_radiotap.h>
45 #include <linux/if_arp.h>
48 #include <linux/in6.h>
49 #include <asm/checksum.h>
50 #include "host_interface.h"
51 #include "wilc_wlan.h"
52 #include <linux/wireless.h> /* tony, 2013-06-12 */
54 #define FLOW_CONTROL_LOWER_THRESHOLD 128
55 #define FLOW_CONTROL_UPPER_THRESHOLD 256
61 WILC_WFI_RX_PKT = 1 << 0,
62 WILC_WFI_TX_PKT = 1 << 1,
65 struct WILC_WFI_stats {
67 unsigned long rx_packets;
68 unsigned long tx_packets;
69 unsigned long rx_bytes;
70 unsigned long tx_bytes;
77 * This structure is private to each device. It is used to pass
78 * packets in and out, so there is place for a packet
81 #define RX_BH_KTHREAD 0
82 #define RX_BH_WORK_QUEUE 1
83 #define RX_BH_THREADED_IRQ 2
84 #define num_reg_frame 2
86 * If you use RX_BH_WORK_QUEUE on LPC3131: You may lose the first interrupt on
87 * LPC3131 which is important to get the MAC start status when you are blocked inside
88 * linux_wlan_firmware_download() which blocks mac_open().
90 #if defined (NM73131_0_BOARD)
91 #define RX_BH_TYPE RX_BH_KTHREAD
92 #elif defined (PANDA_BOARD)
93 #define RX_BH_TYPE RX_BH_THREADED_IRQ
95 #define RX_BH_TYPE RX_BH_KTHREAD
105 struct wilc_wfi_wep_key {
112 u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
116 /*Parameters needed for host interface for remaining on channel*/
117 struct wilc_wfi_p2pListenParams {
118 struct ieee80211_channel *pstrListenChan;
119 enum nl80211_channel_type tenuChannelType;
120 WILC_Uint32 u32ListenDuration;
121 WILC_Uint64 u64ListenCookie;
122 WILC_Uint32 u32ListenSessionID;
127 struct WILC_WFI_priv {
128 struct wireless_dev *wdev;
129 struct cfg80211_scan_request *pstrScanReq;
132 struct wilc_wfi_p2pListenParams strRemainOnChanParams;
133 WILC_Uint64 u64tx_cookie;
137 WILC_Bool bCfgScanning;
138 WILC_Uint32 u32RcvdChCount;
142 u8 au8AssociatedBss[ETH_ALEN];
143 struct sta_info assoc_stainfo;
144 struct net_device_stats stats;
147 struct WILC_WFI_packet *ppool;
148 struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
154 struct net_device *dev;
155 struct napi_struct napi;
156 WILC_WFIDrvHandle hWILCWFIDrv;
157 WILC_WFIDrvHandle hWILCWFIDrv_2;
158 tstrHostIFpmkidAttr pmkid_list;
159 struct WILC_WFI_stats netstats;
160 u8 WILC_WFI_wep_default;
161 u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
162 u8 WILC_WFI_wep_key_len[4];
163 struct net_device *real_ndev; /* The real interface that the monitor is on */
164 struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
165 struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
168 struct semaphore SemHandleUpdateStats;
169 struct semaphore hSemScanReq;
171 WILC_Bool gbAutoRateAdjusted;
173 WILC_Bool bInP2PlistenState;
184 #define NUM_CONCURRENT_IFC 2
186 uint8_t aSrcAddress[ETH_ALEN];
187 uint8_t aBSSID[ETH_ALEN];
189 struct net_device *wilc_netdev;
193 int wilc1000_initialized;
196 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
197 unsigned short dev_irq_num;
202 tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
206 /*Added by Amr - BugID_4720*/
207 struct mutex txq_add_to_head_cs;
208 spinlock_t txq_spinlock;
213 /* struct mutex txq_event; */
214 struct semaphore rxq_event;
215 struct semaphore cfg_event;
216 struct semaphore sync_event;
218 struct semaphore txq_event;
219 /* struct completion txq_event; */
221 #if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
222 struct work_struct rx_work_queue;
223 #elif (RX_BH_TYPE == RX_BH_KTHREAD)
224 struct task_struct *rx_bh_thread;
225 struct semaphore rx_sem;
230 struct semaphore rxq_thread_started;
231 struct semaphore txq_thread_started;
233 struct task_struct *rxq_thread;
234 struct task_struct *txq_thread;
236 unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
237 /* unsigned char eth_dst_address[6]; */
239 const struct firmware *wilc_firmware; /* Bug 4703 */
241 struct net_device *real_ndev;
244 struct sdio_func *wilc_sdio_func;
246 struct spi_device *wilc_spidev;
257 struct_frame_reg g_struct_frame_reg[num_reg_frame];
259 struct net_device *wilc_netdev;
260 struct net_device_stats netstats;
262 } perInterface_wlan_t;
264 struct WILC_WFI_mon_priv {
265 struct net_device *real_ndev;
267 extern struct net_device *WILC_WFI_devs[];