staging: wilc1000: replace WILC_WFIDrvHandle by tstrWILC_WFIDrv
[deliverable/linux.git] / drivers / staging / wilc1000 / wilc_wfi_netdevice.h
1 /*!
2 * @file wilc_wfi_netdevice.h
3 * @brief Definitions for the network module
4 * @author mdaftedar
5 * @date 01 MAR 2012
6 * @version 1.0
7 */
8 #ifndef WILC_WFI_NETDEVICE
9 #define WILC_WFI_NETDEVICE
10
11 /* These are the flags in the statusword */
12 #define WILC_WFI_RX_INTR 0x0001
13 #define WILC_WFI_TX_INTR 0x0002
14
15 /* Default timeout period */
16 #define WILC_WFI_TIMEOUT 5 /* In jiffies */
17 #define WILC_MAX_NUM_PMKIDS 16
18 #define PMKID_LEN 16
19 #define PMKID_FOUND 1
20 #define NUM_STA_ASSOCIATED 8
21
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>
32 #include <linux/in.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 */
49
50 #define FLOW_CONTROL_LOWER_THRESHOLD 128
51 #define FLOW_CONTROL_UPPER_THRESHOLD 256
52
53 /*iftype*/
54 enum stats_flags {
55 WILC_WFI_RX_PKT = 1 << 0,
56 WILC_WFI_TX_PKT = 1 << 1,
57 };
58
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;
64 u64 rx_time;
65 u64 tx_time;
66
67 };
68
69 /*
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
72 */
73
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
78 /*
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
81 * inside linux_wlan_firmware_download() which blocks mac_open().
82 */
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
87 #else
88 #define RX_BH_TYPE RX_BH_KTHREAD
89 #endif
90
91 struct wilc_wfi_key {
92 u8 *key;
93 u8 *seq;
94 int key_len;
95 int seq_len;
96 u32 cipher;
97 };
98
99 struct wilc_wfi_wep_key {
100 u8 *key;
101 u8 key_len;
102 u8 key_idx;
103 };
104
105 struct sta_info {
106 u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
107 };
108
109 #ifdef WILC_P2P
110 /*Parameters needed for host interface for remaining on channel*/
111 struct wilc_wfi_p2pListenParams {
112 struct ieee80211_channel *pstrListenChan;
113 enum nl80211_channel_type tenuChannelType;
114 u32 u32ListenDuration;
115 u64 u64ListenCookie;
116 u32 u32ListenSessionID;
117 };
118
119 #endif /*WILC_P2P*/
120
121 struct WILC_WFI_priv {
122 struct wireless_dev *wdev;
123 struct cfg80211_scan_request *pstrScanReq;
124
125 #ifdef WILC_P2P
126 struct wilc_wfi_p2pListenParams strRemainOnChanParams;
127 u64 u64tx_cookie;
128 #endif
129
130 bool bCfgScanning;
131 u32 u32RcvdChCount;
132
133 u8 au8AssociatedBss[ETH_ALEN];
134 struct sta_info assoc_stainfo;
135 struct net_device_stats stats;
136 u8 monitor_flag;
137 int status;
138 struct WILC_WFI_packet *ppool;
139 struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
140 int rx_int_enabled;
141 int tx_packetlen;
142 u8 *tx_packetdata;
143 struct sk_buff *skb;
144 spinlock_t lock;
145 struct net_device *dev;
146 struct napi_struct napi;
147 tstrWILC_WFIDrv *hWILCWFIDrv;
148 WILC_WFIDrvHandle hWILCWFIDrv_2;
149 tstrHostIFpmkidAttr pmkid_list;
150 struct WILC_WFI_stats netstats;
151 u8 WILC_WFI_wep_default;
152 u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
153 u8 WILC_WFI_wep_key_len[4];
154 /* The real interface that the monitor is on */
155 struct net_device *real_ndev;
156 struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
157 struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
158 u8 wilc_groupkey;
159 /* semaphores */
160 struct semaphore SemHandleUpdateStats;
161 struct semaphore hSemScanReq;
162 /* */
163 bool gbAutoRateAdjusted;
164
165 bool bInP2PlistenState;
166
167 };
168
169 typedef struct {
170 u16 frame_type;
171 bool reg;
172
173 } struct_frame_reg;
174
175 #define NUM_CONCURRENT_IFC 2
176 typedef struct {
177 uint8_t aSrcAddress[ETH_ALEN];
178 uint8_t aBSSID[ETH_ALEN];
179 tstrWILC_WFIDrv *drvHandler;
180 struct net_device *wilc_netdev;
181 } tstrInterfaceInfo;
182 typedef struct {
183 int mac_status;
184 int wilc1000_initialized;
185 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
186 unsigned short dev_irq_num;
187 #endif
188 wilc_wlan_oup_t oup;
189 int close;
190 uint8_t u8NoIfcs;
191 tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
192 uint8_t open_ifcs;
193 struct mutex txq_cs;
194
195 /*Added by Amr - BugID_4720*/
196 struct mutex txq_add_to_head_cs;
197 spinlock_t txq_spinlock;
198
199 struct mutex rxq_cs;
200 struct mutex hif_cs;
201
202 /* struct mutex txq_event; */
203 struct semaphore rxq_event;
204 struct semaphore cfg_event;
205 struct semaphore sync_event;
206
207 struct semaphore txq_event;
208 /* struct completion txq_event; */
209
210 #if (RX_BH_TYPE == RX_BH_WORK_QUEUE)
211 struct work_struct rx_work_queue;
212 #elif (RX_BH_TYPE == RX_BH_KTHREAD)
213 struct task_struct *rx_bh_thread;
214 struct semaphore rx_sem;
215 #endif
216 struct semaphore rxq_thread_started;
217 struct semaphore txq_thread_started;
218
219 struct task_struct *rxq_thread;
220 struct task_struct *txq_thread;
221
222 unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
223 /* unsigned char eth_dst_address[6]; */
224
225 const struct firmware *wilc_firmware; /* Bug 4703 */
226
227 struct net_device *real_ndev;
228 #ifdef WILC_SDIO
229 int already_claim;
230 struct sdio_func *wilc_sdio_func;
231 #else
232 struct spi_device *wilc_spidev;
233 #endif
234
235 } linux_wlan_t;
236
237 typedef struct {
238 uint8_t u8IfIdx;
239 u8 iftype;
240 int monitor_flag;
241 int mac_opened;
242 #ifdef WILC_P2P
243 struct_frame_reg g_struct_frame_reg[num_reg_frame];
244 #endif
245 struct net_device *wilc_netdev;
246 struct net_device_stats netstats;
247
248 } perInterface_wlan_t;
249
250 struct WILC_WFI_mon_priv {
251 struct net_device *real_ndev;
252 };
253
254 extern struct net_device *WILC_WFI_devs[];
255
256 #endif
This page took 0.037083 seconds and 5 git commands to generate.