2 * @file wilc_wfi_netdevice.h
3 * @brief Definitions for the network module
8 #ifndef WILC_WFI_NETDEVICE
9 #define WILC_WFI_NETDEVICE
11 #define WILC_WFI_RX_INTR 0x0001
12 #define WILC_WFI_TX_INTR 0x0002
14 #define WILC_WFI_TIMEOUT 5
15 #define WILC_MAX_NUM_PMKIDS 16
18 #define NUM_STA_ASSOCIATED 8
20 #include <linux/module.h>
21 #include <linux/init.h>
22 #include <linux/moduleparam.h>
23 #include <linux/sched.h>
24 #include <linux/kernel.h>
25 #include <linux/slab.h>
26 #include <linux/errno.h>
27 #include <linux/types.h>
28 #include <linux/interrupt.h>
29 #include <linux/time.h>
31 #include <linux/netdevice.h>
32 #include <linux/etherdevice.h>
34 #include <linux/tcp.h>
35 #include <linux/skbuff.h>
36 #include <linux/ieee80211.h>
37 #include <net/cfg80211.h>
38 #include <net/ieee80211_radiotap.h>
39 #include <linux/if_arp.h>
40 #include <linux/in6.h>
41 #include <asm/checksum.h>
42 #include "host_interface.h"
43 #include "wilc_wlan.h"
44 #include <linux/wireless.h>
45 #include <linux/completion.h>
46 #include <linux/mutex.h>
48 #define FLOW_CONTROL_LOWER_THRESHOLD 128
49 #define FLOW_CONTROL_UPPER_THRESHOLD 256
52 WILC_WFI_RX_PKT = BIT(0),
53 WILC_WFI_TX_PKT = BIT(1),
56 struct WILC_WFI_stats {
57 unsigned long rx_packets;
58 unsigned long tx_packets;
59 unsigned long rx_bytes;
60 unsigned long tx_bytes;
67 * This structure is private to each device. It is used to pass
68 * packets in and out, so there is place for a packet
71 #define num_reg_frame 2
81 struct wilc_wfi_wep_key {
88 u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
91 /*Parameters needed for host interface for remaining on channel*/
92 struct wilc_wfi_p2pListenParams {
93 struct ieee80211_channel *pstrListenChan;
94 enum nl80211_channel_type tenuChannelType;
95 u32 u32ListenDuration;
97 u32 u32ListenSessionID;
101 struct wireless_dev *wdev;
102 struct cfg80211_scan_request *pstrScanReq;
104 struct wilc_wfi_p2pListenParams strRemainOnChanParams;
110 u8 au8AssociatedBss[ETH_ALEN];
111 struct sta_info assoc_stainfo;
112 struct net_device_stats stats;
115 struct WILC_WFI_packet *ppool;
116 struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
122 struct net_device *dev;
123 struct napi_struct napi;
124 struct host_if_drv *hif_drv;
125 struct host_if_pmkid_attr pmkid_list;
126 struct WILC_WFI_stats netstats;
127 u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
128 u8 WILC_WFI_wep_key_len[4];
129 /* The real interface that the monitor is on */
130 struct net_device *real_ndev;
131 struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
132 struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
135 struct mutex scan_req_lock;
137 bool gbAutoRateAdjusted;
139 bool bInP2PlistenState;
153 struct frame_reg frame_reg[num_reg_frame];
154 struct net_device_stats netstats;
156 u8 src_addr[ETH_ALEN];
158 struct host_if_drv *hif_drv;
159 struct net_device *ndev;
164 const struct wilc_hif_func *hif_func;
172 struct wilc_vif *vif[NUM_CONCURRENT_IFC];
175 struct mutex txq_add_to_head_cs;
176 spinlock_t txq_spinlock;
181 struct completion cfg_event;
182 struct completion sync_event;
183 struct completion txq_event;
184 struct completion txq_thread_started;
186 struct task_struct *txq_thread;
189 int cfg_frame_in_use;
190 struct wilc_cfg_frame cfg_frame;
191 u32 cfg_frame_offset;
195 u32 rx_buffer_offset;
198 unsigned long txq_spinlock_flags;
200 struct txq_entry_t *txq_head;
201 struct txq_entry_t *txq_tail;
205 struct rxq_entry_t *rxq_head;
206 struct rxq_entry_t *rxq_tail;
210 unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
212 const struct firmware *firmware;
217 struct rf_info dummy_statistics;
220 struct WILC_WFI_mon_priv {
221 struct net_device *real_ndev;
224 int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif);
226 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
227 void wilc_mac_indicate(struct wilc *wilc, int flag);
228 int wilc_lock_timeout(struct wilc *wilc, void *, u32 timeout);
229 void wilc_netdev_cleanup(struct wilc *wilc);
230 int wilc_netdev_init(struct wilc **wilc, struct device *, int io_type, int gpio,
231 const struct wilc_hif_func *ops);
232 void wilc1000_wlan_deinit(struct net_device *dev);
233 void WILC_WFI_mgmt_rx(struct wilc *wilc, u8 *buff, u32 size);
234 int wilc_wlan_get_firmware(struct net_device *dev);
235 int wilc_wlan_set_bssid(struct net_device *wilc_netdev, u8 *bssid, u8 mode);