2015-05-10 23:30:56 -06:00
|
|
|
/*!
|
|
|
|
* @file wilc_wfi_netdevice.h
|
|
|
|
* @brief Definitions for the network module
|
|
|
|
* @author mdaftedar
|
|
|
|
* @date 01 MAR 2012
|
|
|
|
* @version 1.0
|
|
|
|
*/
|
|
|
|
#ifndef WILC_WFI_NETDEVICE
|
|
|
|
#define WILC_WFI_NETDEVICE
|
|
|
|
|
|
|
|
#define WILC_WFI_RX_INTR 0x0001
|
|
|
|
#define WILC_WFI_TX_INTR 0x0002
|
|
|
|
|
2015-10-02 01:41:15 -06:00
|
|
|
#define WILC_WFI_TIMEOUT 5
|
2015-05-10 23:30:56 -06:00
|
|
|
#define WILC_MAX_NUM_PMKIDS 16
|
|
|
|
#define PMKID_LEN 16
|
|
|
|
#define PMKID_FOUND 1
|
|
|
|
#define NUM_STA_ASSOCIATED 8
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/kernel.h>
|
2015-10-02 01:41:15 -06:00
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/interrupt.h>
|
2015-05-10 23:30:56 -06:00
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/in.h>
|
2015-10-02 01:41:15 -06:00
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include <linux/ip.h>
|
|
|
|
#include <linux/tcp.h>
|
2015-05-10 23:30:56 -06:00
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/ieee80211.h>
|
|
|
|
#include <net/cfg80211.h>
|
|
|
|
#include <linux/ieee80211.h>
|
|
|
|
#include <net/cfg80211.h>
|
|
|
|
#include <net/ieee80211_radiotap.h>
|
|
|
|
#include <linux/if_arp.h>
|
|
|
|
#include <linux/in6.h>
|
|
|
|
#include <asm/checksum.h>
|
|
|
|
#include "host_interface.h"
|
|
|
|
#include "wilc_wlan.h"
|
2015-10-02 01:41:15 -06:00
|
|
|
#include <linux/wireless.h>
|
2015-05-10 23:30:56 -06:00
|
|
|
|
|
|
|
#define FLOW_CONTROL_LOWER_THRESHOLD 128
|
|
|
|
#define FLOW_CONTROL_UPPER_THRESHOLD 256
|
|
|
|
|
|
|
|
enum stats_flags {
|
2015-09-29 13:15:49 -06:00
|
|
|
WILC_WFI_RX_PKT = BIT(0),
|
|
|
|
WILC_WFI_TX_PKT = BIT(1),
|
2015-05-10 23:30:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct WILC_WFI_stats {
|
|
|
|
unsigned long rx_packets;
|
|
|
|
unsigned long tx_packets;
|
|
|
|
unsigned long rx_bytes;
|
|
|
|
unsigned long tx_bytes;
|
|
|
|
u64 rx_time;
|
|
|
|
u64 tx_time;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure is private to each device. It is used to pass
|
|
|
|
* packets in and out, so there is place for a packet
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define num_reg_frame 2
|
|
|
|
|
|
|
|
struct wilc_wfi_key {
|
|
|
|
u8 *key;
|
|
|
|
u8 *seq;
|
|
|
|
int key_len;
|
|
|
|
int seq_len;
|
|
|
|
u32 cipher;
|
|
|
|
};
|
2015-06-26 00:48:15 -06:00
|
|
|
|
2015-05-10 23:30:56 -06:00
|
|
|
struct wilc_wfi_wep_key {
|
|
|
|
u8 *key;
|
|
|
|
u8 key_len;
|
|
|
|
u8 key_idx;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sta_info {
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
|
2015-05-10 23:30:56 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
/*Parameters needed for host interface for remaining on channel*/
|
|
|
|
struct wilc_wfi_p2pListenParams {
|
|
|
|
struct ieee80211_channel *pstrListenChan;
|
|
|
|
enum nl80211_channel_type tenuChannelType;
|
2015-06-10 23:35:55 -06:00
|
|
|
u32 u32ListenDuration;
|
2015-06-10 23:35:56 -06:00
|
|
|
u64 u64ListenCookie;
|
2015-06-10 23:35:55 -06:00
|
|
|
u32 u32ListenSessionID;
|
2015-05-10 23:30:56 -06:00
|
|
|
};
|
|
|
|
|
2015-09-14 23:06:13 -06:00
|
|
|
struct wilc_priv {
|
2015-05-10 23:30:56 -06:00
|
|
|
struct wireless_dev *wdev;
|
|
|
|
struct cfg80211_scan_request *pstrScanReq;
|
|
|
|
|
|
|
|
struct wilc_wfi_p2pListenParams strRemainOnChanParams;
|
2015-06-10 23:35:56 -06:00
|
|
|
u64 u64tx_cookie;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
2015-06-11 23:11:44 -06:00
|
|
|
bool bCfgScanning;
|
2015-06-10 23:35:55 -06:00
|
|
|
u32 u32RcvdChCount;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 au8AssociatedBss[ETH_ALEN];
|
2015-05-10 23:30:56 -06:00
|
|
|
struct sta_info assoc_stainfo;
|
|
|
|
struct net_device_stats stats;
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 monitor_flag;
|
2015-05-10 23:30:56 -06:00
|
|
|
int status;
|
|
|
|
struct WILC_WFI_packet *ppool;
|
|
|
|
struct WILC_WFI_packet *rx_queue; /* List of incoming packets */
|
|
|
|
int rx_int_enabled;
|
|
|
|
int tx_packetlen;
|
|
|
|
u8 *tx_packetdata;
|
|
|
|
struct sk_buff *skb;
|
|
|
|
spinlock_t lock;
|
|
|
|
struct net_device *dev;
|
|
|
|
struct napi_struct napi;
|
2015-10-12 01:55:35 -06:00
|
|
|
struct host_if_drv *hWILCWFIDrv;
|
2015-10-05 00:25:44 -06:00
|
|
|
struct host_if_pmkid_attr pmkid_list;
|
2015-05-10 23:30:56 -06:00
|
|
|
struct WILC_WFI_stats netstats;
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 WILC_WFI_wep_default;
|
|
|
|
u8 WILC_WFI_wep_key[4][WLAN_KEY_LEN_WEP104];
|
|
|
|
u8 WILC_WFI_wep_key_len[4];
|
2015-06-26 00:48:16 -06:00
|
|
|
/* The real interface that the monitor is on */
|
|
|
|
struct net_device *real_ndev;
|
2015-05-10 23:30:56 -06:00
|
|
|
struct wilc_wfi_key *wilc_gtk[MAX_NUM_STA];
|
|
|
|
struct wilc_wfi_key *wilc_ptk[MAX_NUM_STA];
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 wilc_groupkey;
|
2015-05-10 23:30:56 -06:00
|
|
|
/* semaphores */
|
2015-06-01 13:06:43 -06:00
|
|
|
struct semaphore SemHandleUpdateStats;
|
|
|
|
struct semaphore hSemScanReq;
|
2015-05-10 23:30:56 -06:00
|
|
|
/* */
|
2015-06-11 23:11:44 -06:00
|
|
|
bool gbAutoRateAdjusted;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
2015-06-11 23:11:44 -06:00
|
|
|
bool bInP2PlistenState;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
2015-06-10 23:35:54 -06:00
|
|
|
u16 frame_type;
|
2015-06-11 23:11:44 -06:00
|
|
|
bool reg;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
|
|
|
} struct_frame_reg;
|
|
|
|
|
|
|
|
typedef struct {
|
2015-09-14 23:06:14 -06:00
|
|
|
u8 aSrcAddress[ETH_ALEN];
|
|
|
|
u8 aBSSID[ETH_ALEN];
|
2015-10-12 01:55:35 -06:00
|
|
|
struct host_if_drv *drvHandler;
|
2015-05-10 23:30:56 -06:00
|
|
|
struct net_device *wilc_netdev;
|
|
|
|
} tstrInterfaceInfo;
|
|
|
|
typedef struct {
|
|
|
|
int mac_status;
|
|
|
|
int wilc1000_initialized;
|
|
|
|
#if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
|
|
|
|
unsigned short dev_irq_num;
|
|
|
|
#endif
|
|
|
|
int close;
|
2015-09-14 23:06:14 -06:00
|
|
|
u8 u8NoIfcs;
|
2015-05-10 23:30:56 -06:00
|
|
|
tstrInterfaceInfo strInterfaceInfo[NUM_CONCURRENT_IFC];
|
2015-09-14 23:06:14 -06:00
|
|
|
u8 open_ifcs;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
2015-09-03 20:56:21 -06:00
|
|
|
struct semaphore txq_add_to_head_cs;
|
2015-05-10 23:30:56 -06:00
|
|
|
spinlock_t txq_spinlock;
|
|
|
|
|
|
|
|
struct mutex rxq_cs;
|
|
|
|
struct mutex hif_cs;
|
|
|
|
|
|
|
|
struct semaphore cfg_event;
|
|
|
|
struct semaphore sync_event;
|
|
|
|
struct semaphore txq_event;
|
|
|
|
|
|
|
|
struct semaphore txq_thread_started;
|
|
|
|
|
|
|
|
struct task_struct *txq_thread;
|
|
|
|
|
|
|
|
unsigned char eth_src_address[NUM_CONCURRENT_IFC][6];
|
|
|
|
|
2015-09-20 00:51:19 -06:00
|
|
|
const struct firmware *wilc_firmware;
|
2015-05-10 23:30:56 -06:00
|
|
|
|
|
|
|
#ifdef WILC_SDIO
|
|
|
|
struct sdio_func *wilc_sdio_func;
|
|
|
|
#else
|
|
|
|
struct spi_device *wilc_spidev;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} linux_wlan_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2015-09-14 23:06:14 -06:00
|
|
|
u8 u8IfIdx;
|
2015-06-01 23:16:04 -06:00
|
|
|
u8 iftype;
|
2015-05-10 23:30:56 -06:00
|
|
|
int monitor_flag;
|
|
|
|
int mac_opened;
|
|
|
|
struct_frame_reg g_struct_frame_reg[num_reg_frame];
|
|
|
|
struct net_device *wilc_netdev;
|
|
|
|
struct net_device_stats netstats;
|
|
|
|
|
|
|
|
} perInterface_wlan_t;
|
|
|
|
|
|
|
|
struct WILC_WFI_mon_priv {
|
|
|
|
struct net_device *real_ndev;
|
|
|
|
};
|
2015-06-16 23:42:36 -06:00
|
|
|
|
2015-09-24 03:14:56 -06:00
|
|
|
extern linux_wlan_t *g_linux_wlan;
|
2015-05-10 23:30:56 -06:00
|
|
|
extern struct net_device *WILC_WFI_devs[];
|
2015-09-24 03:14:52 -06:00
|
|
|
void frmw_to_linux(u8 *buff, u32 size, u32 pkt_offset);
|
2015-09-24 03:14:53 -06:00
|
|
|
void linux_wlan_mac_indicate(int flag);
|
2015-09-24 03:14:54 -06:00
|
|
|
void linux_wlan_rx_complete(void);
|
2015-09-24 03:14:55 -06:00
|
|
|
void linux_wlan_dbg(u8 *buff);
|
2015-09-24 03:15:05 -06:00
|
|
|
int linux_wlan_lock_timeout(void *vp, u32 timeout);
|
2015-05-10 23:30:56 -06:00
|
|
|
|
|
|
|
#endif
|