]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/wilc1000/wilc_wfi_netdevice.h
staging: wilc1000: remove WILC_Uint64
[karo-tx-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
39 #include <linux/ieee80211.h>
40 #include <net/cfg80211.h>
41
42 #include <linux/ieee80211.h>
43 #include <net/cfg80211.h>
44 #include <net/ieee80211_radiotap.h>
45 #include <linux/if_arp.h>
46
47
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 */
53
54 #define FLOW_CONTROL_LOWER_THRESHOLD    128
55 #define FLOW_CONTROL_UPPER_THRESHOLD    256
56
57 /*iftype*/
58
59
60 enum stats_flags {
61         WILC_WFI_RX_PKT = 1 << 0,
62         WILC_WFI_TX_PKT = 1 << 1,
63 };
64
65 struct WILC_WFI_stats {
66
67         unsigned long rx_packets;
68         unsigned long tx_packets;
69         unsigned long rx_bytes;
70         unsigned long tx_bytes;
71         u64 rx_time;
72         u64 tx_time;
73
74 };
75
76 /*
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
79  */
80
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
85 /*
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().
89  */
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
94 #else
95  #define RX_BH_TYPE  RX_BH_KTHREAD
96 #endif
97
98 struct wilc_wfi_key {
99         u8 *key;
100         u8 *seq;
101         int key_len;
102         int seq_len;
103         u32 cipher;
104 };
105 struct wilc_wfi_wep_key {
106         u8 *key;
107         u8 key_len;
108         u8 key_idx;
109 };
110
111 struct sta_info {
112         u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
113 };
114
115 #ifdef WILC_P2P
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         u32 u32ListenDuration;
121         u64 u64ListenCookie;
122         u32 u32ListenSessionID;
123 };
124
125 #endif  /*WILC_P2P*/
126
127 struct WILC_WFI_priv {
128         struct wireless_dev *wdev;
129         struct cfg80211_scan_request *pstrScanReq;
130
131         #ifdef WILC_P2P
132         struct wilc_wfi_p2pListenParams strRemainOnChanParams;
133         u64 u64tx_cookie;
134
135         #endif
136
137         WILC_Bool bCfgScanning;
138         u32 u32RcvdChCount;
139
140
141
142         u8 au8AssociatedBss[ETH_ALEN];
143         struct sta_info assoc_stainfo;
144         struct net_device_stats stats;
145         u8 monitor_flag;
146         int status;
147         struct WILC_WFI_packet *ppool;
148         struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
149         int rx_int_enabled;
150         int tx_packetlen;
151         u8 *tx_packetdata;
152         struct sk_buff *skb;
153         spinlock_t lock;
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];
166         u8 wilc_groupkey;
167         /* semaphores */
168         struct semaphore SemHandleUpdateStats;
169         struct semaphore hSemScanReq;
170         /*  */
171         WILC_Bool gbAutoRateAdjusted;
172
173         WILC_Bool bInP2PlistenState;
174
175 };
176
177 typedef struct {
178         u16 frame_type;
179         WILC_Bool reg;
180
181 } struct_frame_reg;
182
183
184 #define NUM_CONCURRENT_IFC 2
185 typedef struct {
186         uint8_t aSrcAddress[ETH_ALEN];
187         uint8_t aBSSID[ETH_ALEN];
188         uint32_t drvHandler;
189         struct net_device *wilc_netdev;
190 } tstrInterfaceInfo;
191 typedef struct {
192         int mac_status;
193         int wilc1000_initialized;
194
195
196         #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
197         unsigned short dev_irq_num;
198         #endif
199         wilc_wlan_oup_t oup;
200         int close;
201         uint8_t u8NoIfcs;
202         tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
203         uint8_t open_ifcs;
204         struct mutex txq_cs;
205
206         /*Added by Amr - BugID_4720*/
207         struct mutex txq_add_to_head_cs;
208         spinlock_t txq_spinlock;
209
210         struct mutex rxq_cs;
211         struct mutex hif_cs;
212
213         /* struct mutex txq_event; */
214         struct semaphore rxq_event;
215         struct semaphore cfg_event;
216         struct semaphore sync_event;
217
218         struct semaphore txq_event;
219         /* struct completion txq_event; */
220
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;
226 #endif
227
228
229
230         struct semaphore rxq_thread_started;
231         struct semaphore txq_thread_started;
232
233         struct task_struct *rxq_thread;
234         struct task_struct *txq_thread;
235
236         unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
237         /* unsigned char eth_dst_address[6]; */
238
239         const struct firmware *wilc_firmware; /* Bug 4703 */
240
241         struct net_device *real_ndev;
242 #ifdef WILC_SDIO
243         int already_claim;
244         struct sdio_func *wilc_sdio_func;
245 #else
246         struct spi_device *wilc_spidev;
247 #endif
248
249 } linux_wlan_t;
250
251 typedef struct {
252         uint8_t u8IfIdx;
253         u8 iftype;
254         int monitor_flag;
255         int mac_opened;
256         #ifdef WILC_P2P
257         struct_frame_reg g_struct_frame_reg[num_reg_frame];
258         #endif
259         struct net_device *wilc_netdev;
260         struct net_device_stats netstats;
261
262 } perInterface_wlan_t;
263
264 struct WILC_WFI_mon_priv {
265         struct net_device *real_ndev;
266 };
267 extern struct net_device *WILC_WFI_devs[];
268
269 #endif