]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/wireless/libertas/dev.h
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/linville...
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / libertas / dev.h
1 /**
2 * This file contains definitions and data structures specific
3 * to Marvell 802.11 NIC. It contains the Device Information
4 * structure struct lbs_private..
5 */
6 #ifndef _LBS_DEV_H_
7 #define _LBS_DEV_H_
8
9 #include "mesh.h"
10 #include "scan.h"
11 #include "assoc.h"
12
13 #include <linux/kfifo.h>
14
15 /** sleep_params */
16 struct sleep_params {
17 uint16_t sp_error;
18 uint16_t sp_offset;
19 uint16_t sp_stabletime;
20 uint8_t sp_calcontrol;
21 uint8_t sp_extsleepclk;
22 uint16_t sp_reserved;
23 };
24
25
26 /** Private structure for the MV device */
27 struct lbs_private {
28
29 /* Basic networking */
30 struct net_device *dev;
31 u32 connect_status;
32 int infra_open;
33 struct work_struct mcast_work;
34 u32 nr_of_multicastmacaddr;
35 u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
36
37 /* CFG80211 */
38 struct wireless_dev *wdev;
39
40 /* Mesh */
41 struct net_device *mesh_dev; /* Virtual device */
42 #ifdef CONFIG_LIBERTAS_MESH
43 u32 mesh_connect_status;
44 struct lbs_mesh_stats mstats;
45 int mesh_open;
46 uint16_t mesh_tlv;
47 u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
48 u8 mesh_ssid_len;
49 #endif
50
51 /* Monitor mode */
52 struct net_device *rtap_net_dev;
53 u32 monitormode;
54
55 /* Debugfs */
56 struct dentry *debugfs_dir;
57 struct dentry *debugfs_debug;
58 struct dentry *debugfs_files[6];
59 struct dentry *events_dir;
60 struct dentry *debugfs_events_files[6];
61 struct dentry *regs_dir;
62 struct dentry *debugfs_regs_files[6];
63
64 /* Hardware debugging */
65 u32 mac_offset;
66 u32 bbp_offset;
67 u32 rf_offset;
68 struct lbs_offset_value offsetvalue;
69
70 /* Power management */
71 u16 psmode;
72 u32 psstate;
73 u8 needtowakeup;
74
75 /* Deep sleep */
76 int is_deep_sleep;
77 int is_auto_deep_sleep_enabled;
78 int wakeup_dev_required;
79 int is_activity_detected;
80 int auto_deep_sleep_timeout; /* in ms */
81 wait_queue_head_t ds_awake_q;
82 struct timer_list auto_deepsleep_timer;
83
84 /* Hardware access */
85 void *card;
86 u8 fw_ready;
87 u8 surpriseremoved;
88 int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
89 void (*reset_card) (struct lbs_private *priv);
90 int (*enter_deep_sleep) (struct lbs_private *priv);
91 int (*exit_deep_sleep) (struct lbs_private *priv);
92 int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
93
94 /* Adapter info (from EEPROM) */
95 u32 fwrelease;
96 u32 fwcapinfo;
97 u16 regioncode;
98 u8 current_addr[ETH_ALEN];
99
100 /* Command download */
101 u8 dnld_sent;
102 /* bit0 1/0=data_sent/data_tx_done,
103 bit1 1/0=cmd_sent/cmd_tx_done,
104 all other bits reserved 0 */
105 u16 seqnum;
106 struct cmd_ctrl_node *cmd_array;
107 struct cmd_ctrl_node *cur_cmd;
108 struct list_head cmdfreeq; /* free command buffers */
109 struct list_head cmdpendingq; /* pending command buffers */
110 wait_queue_head_t cmd_pending;
111 struct timer_list command_timer;
112 int cmd_timed_out;
113
114 /* Command responses sent from the hardware to the driver */
115 int cur_cmd_retcode;
116 u8 resp_idx;
117 u8 resp_buf[2][LBS_UPLD_SIZE];
118 u32 resp_len[2];
119
120 /* Events sent from hardware to driver */
121 struct kfifo event_fifo;
122
123 /** thread to service interrupts */
124 struct task_struct *main_thread;
125 wait_queue_head_t waitq;
126 struct workqueue_struct *work_thread;
127
128 /** Encryption stuff */
129 struct lbs_802_11_security secinfo;
130 struct enc_key wpa_mcast_key;
131 struct enc_key wpa_unicast_key;
132 u8 wpa_ie[MAX_WPA_IE_LEN];
133 u8 wpa_ie_len;
134 u16 wep_tx_keyidx;
135 struct enc_key wep_keys[4];
136
137 /* Wake On LAN */
138 uint32_t wol_criteria;
139 uint8_t wol_gpio;
140 uint8_t wol_gap;
141
142 /* Transmitting */
143 int tx_pending_len; /* -1 while building packet */
144 u8 tx_pending_buf[LBS_UPLD_SIZE];
145 /* protected by hard_start_xmit serialization */
146 u8 txretrycount;
147 struct sk_buff *currenttxskb;
148
149 /* Locks */
150 struct mutex lock;
151 spinlock_t driver_lock;
152
153 /* NIC/link operation characteristics */
154 u16 mac_control;
155 u8 radio_on;
156 u8 channel;
157 s16 txpower_cur;
158 s16 txpower_min;
159 s16 txpower_max;
160
161 /** Scanning */
162 struct delayed_work scan_work;
163 int scan_channel;
164 /* remember which channel was scanned last, != 0 if currently scanning */
165 u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
166 u8 scan_ssid_len;
167
168 /* Associating */
169 struct delayed_work assoc_work;
170 struct current_bss_params curbssparams;
171 u8 mode;
172 struct list_head network_list;
173 struct list_head network_free_list;
174 struct bss_descriptor *networks;
175 struct assoc_request * pending_assoc_req;
176 struct assoc_request * in_progress_assoc_req;
177 uint16_t enablehwauto;
178
179 /* ADHOC */
180 u16 beacon_period;
181 u8 beacon_enable;
182 u8 adhoccreate;
183
184 /* WEXT */
185 char name[DEV_NAME_LEN];
186 u8 nodename[16];
187 struct iw_statistics wstats;
188 u8 cur_rate;
189 #define MAX_REGION_CHANNEL_NUM 2
190 struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
191
192 /** Requested Signal Strength*/
193 u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
194 u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
195 u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
196 u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
197 u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
198 u16 nextSNRNF;
199 u16 numSNRNF;
200 };
201
202 extern struct cmd_confirm_sleep confirm_sleep;
203
204 #endif