blob: cc245820d3f2616dc2f1c38fe6150bd643bf85d9 [file] [log] [blame]
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02001/**
2 * This file contains definitions and data structures specific
3 * to Marvell 802.11 NIC. It contains the Device Information
David Woodhouseaa21c002007-12-08 20:04:36 +00004 * structure struct lbs_private..
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02005 */
Holger Schurig10078322007-11-15 18:05:47 -05006#ifndef _LBS_DEV_H_
7#define _LBS_DEV_H_
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02008
Holger Schurig2d465022009-10-22 15:30:48 +02009#include "scan.h"
10#include "assoc.h"
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020011
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020012
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020013
14/** sleep_params */
15struct sleep_params {
David Woodhouse3fbe1042007-12-17 23:48:31 -050016 uint16_t sp_error;
17 uint16_t sp_offset;
18 uint16_t sp_stabletime;
19 uint8_t sp_calcontrol;
20 uint8_t sp_extsleepclk;
21 uint16_t sp_reserved;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020022};
23
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020024/* Mesh statistics */
Holger Schurig10078322007-11-15 18:05:47 -050025struct lbs_mesh_stats {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020026 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
27 u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
28 u32 fwd_drop_ttl; /* Fwd: TTL zero */
29 u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
30 u32 fwd_drop_noroute; /* Fwd: No route to Destination */
31 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
32 u32 drop_blind; /* Rx: Dropped by blinding table */
Javier Cardona0601e7e2007-05-25 12:12:06 -040033 u32 tx_failed_cnt; /* Tx: Failed transmissions */
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020034};
35
36/** Private structure for the MV device */
Holger Schurig69f90322007-11-23 15:43:44 +010037struct lbs_private {
Holger Schurigff9fc792009-10-06 16:31:54 +020038 struct wireless_dev *wdev;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020039 int mesh_open;
Bing Zhao684d6b32009-03-25 09:51:16 -070040 int mesh_fw_ver;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020041 int infra_open;
Luis Carlos Cobod21b31f2007-08-02 13:16:02 -040042 int mesh_autostart_enabled;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020043
Holger Schurig634b8f42007-05-25 13:05:16 -040044 char name[DEV_NAME_LEN];
45
46 void *card;
Holger Schurig634b8f42007-05-25 13:05:16 -040047 struct net_device *dev;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020048
Luis Carlos Cobo965f8bbc2007-08-02 13:16:55 -040049 struct net_device *mesh_dev; /* Virtual device */
50 struct net_device *rtap_net_dev;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020051
52 struct iw_statistics wstats;
Holger Schurig10078322007-11-15 18:05:47 -050053 struct lbs_mesh_stats mstats;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020054 struct dentry *debugfs_dir;
55 struct dentry *debugfs_debug;
56 struct dentry *debugfs_files[6];
57
58 struct dentry *events_dir;
59 struct dentry *debugfs_events_files[6];
60
61 struct dentry *regs_dir;
62 struct dentry *debugfs_regs_files[6];
63
64 u32 mac_offset;
65 u32 bbp_offset;
66 u32 rf_offset;
67
Amitkumar Karwar49125452009-09-30 20:04:38 -070068 /** Deep sleep flag */
69 int is_deep_sleep;
70 /** Auto deep sleep enabled flag */
71 int is_auto_deep_sleep_enabled;
72 /** Device wakeup required flag */
73 int wakeup_dev_required;
74 /** Auto deep sleep flag*/
75 int is_activity_detected;
76 /** Auto deep sleep timeout (in miliseconds) */
77 int auto_deep_sleep_timeout;
78
79 /** Deep sleep wait queue */
80 wait_queue_head_t ds_awake_q;
81
Holger Schurig634b8f42007-05-25 13:05:16 -040082 /* Download sent:
83 bit0 1/0=data_sent/data_tx_done,
84 bit1 1/0=cmd_sent/cmd_tx_done,
85 all other bits reserved 0 */
86 u8 dnld_sent;
87
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020088 /** thread to service interrupts */
Dan Williamsfe336152007-08-02 11:32:25 -040089 struct task_struct *main_thread;
90 wait_queue_head_t waitq;
Dan Williams2afc0c52007-08-02 13:19:04 -040091 struct workqueue_struct *work_thread;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020092
David Woodhouse75bf45a2008-05-20 13:32:45 +010093 struct work_struct mcast_work;
94
Holger Schurig8816edc2008-01-28 17:28:05 +010095 /** Scanning */
Dan Williams2afc0c52007-08-02 13:19:04 -040096 struct delayed_work scan_work;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020097 struct delayed_work assoc_work;
Luis Carlos Cobo Rusb8bedef2007-05-30 12:14:34 -040098 struct work_struct sync_channel;
Holger Schurig8816edc2008-01-28 17:28:05 +010099 /* remember which channel was scanned last, != 0 if currently scanning */
100 int scan_channel;
Holger Schurig243e84e2009-10-22 15:30:47 +0200101 u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
Holger Schurig52933d82008-03-05 07:05:32 +0100102 u8 scan_ssid_len;
Holger Schurig208fdd22007-05-25 12:17:06 -0400103
104 /** Hardware access */
Holger Schurig69f90322007-11-23 15:43:44 +0100105 int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
David Woodhouseedf5dab2008-05-20 16:43:31 +0100106 void (*reset_card) (struct lbs_private *priv);
Amitkumar Karwar49125452009-09-30 20:04:38 -0700107 int (*enter_deep_sleep) (struct lbs_private *priv);
108 int (*exit_deep_sleep) (struct lbs_private *priv);
109 int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200110
David Woodhouse506e9022007-12-12 20:06:06 -0500111 /* Wake On LAN */
112 uint32_t wol_criteria;
113 uint8_t wol_gpio;
114 uint8_t wol_gap;
115
David Woodhouseaa21c002007-12-08 20:04:36 +0000116 /** Wlan adapter data structure*/
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200117 /** STATUS variables */
Holger Schurigdac10a92008-01-16 15:55:22 +0100118 u32 fwrelease;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200119 u32 fwcapinfo;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200120
121 struct mutex lock;
122
David Woodhouse2eb188a2007-12-09 23:54:27 -0500123 /* TX packet ready to be sent... */
124 int tx_pending_len; /* -1 while building packet */
125
126 u8 tx_pending_buf[LBS_UPLD_SIZE];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200127 /* protected by hard_start_xmit serialization */
128
129 /** command-related variables */
130 u16 seqnum;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200131
132 struct cmd_ctrl_node *cmd_array;
133 /** Current command */
134 struct cmd_ctrl_node *cur_cmd;
135 int cur_cmd_retcode;
136 /** command Queues */
137 /** Free command buffers */
138 struct list_head cmdfreeq;
139 /** Pending command buffers */
140 struct list_head cmdpendingq;
141
142 wait_queue_head_t cmd_pending;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200143
Holger Schurig7919b892008-04-01 14:50:43 +0200144 /* Command responses sent from the hardware to the driver */
145 u8 resp_idx;
146 u8 resp_buf[2][LBS_UPLD_SIZE];
147 u32 resp_len[2];
148
149 /* Events sent from hardware to driver */
150 struct kfifo *event_fifo;
151
152 /* nickname */
153 u8 nodename[16];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200154
155 /** spin locks */
156 spinlock_t driver_lock;
157
158 /** Timers */
159 struct timer_list command_timer;
Amitkumar Karwar49125452009-09-30 20:04:38 -0700160 struct timer_list auto_deepsleep_timer;
David Woodhouse2a345092007-12-15 19:33:43 -0500161 int nr_retries;
162 int cmd_timed_out;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200163
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200164 /** current ssid/bssid related parameters*/
165 struct current_bss_params curbssparams;
David Woodhouse020f3d02007-12-12 23:29:13 -0500166
167 uint16_t mesh_tlv;
Holger Schurig243e84e2009-10-22 15:30:47 +0200168 u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
David Woodhouse23a397a2007-12-11 18:56:42 -0500169 u8 mesh_ssid_len;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200170
Dan Williams0dc5a292007-05-10 22:58:02 -0400171 /* IW_MODE_* */
172 u8 mode;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200173
Dan Williamsfcdb53d2007-05-25 16:15:56 -0400174 /* Scan results list */
175 struct list_head network_list;
176 struct list_head network_free_list;
177 struct bss_descriptor *networks;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200178
Brajesh Dave96287ac2007-11-20 17:44:28 -0500179 u16 beacon_period;
180 u8 beacon_enable;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200181 u8 adhoccreate;
182
183 /** capability Info used in Association, start, join */
Dan Williams0c9ca6902007-08-02 10:43:44 -0400184 u16 capability;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200185
186 /** MAC address information */
187 u8 current_addr[ETH_ALEN];
188 u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
189 u32 nr_of_multicastmacaddr;
190
191 /** 802.11 statistics */
192// struct cmd_DS_802_11_GET_STAT wlan802_11Stat;
193
Javier Cardona85319f92008-05-24 10:59:49 +0100194 uint16_t enablehwauto;
195 uint16_t ratebitmap;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200196
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200197 u8 txretrycount;
198
199 /** Tx-related variables (for single packet tx) */
200 struct sk_buff *currenttxskb;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200201
202 /** NIC Operation characteristics */
Holger Schurigd9e97782008-03-12 16:06:43 +0100203 u16 mac_control;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200204 u32 connect_status;
Brajesh Dave01d77d82007-11-20 17:44:14 -0500205 u32 mesh_connect_status;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200206 u16 regioncode;
Dan Williams87c8c722008-08-19 15:15:35 -0400207 s16 txpower_cur;
208 s16 txpower_min;
209 s16 txpower_max;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200210
211 /** POWER MANAGEMENT AND PnP SUPPORT */
212 u8 surpriseremoved;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200213
214 u16 psmode; /* Wlan802_11PowermodeCAM=disable
215 Wlan802_11PowermodeMAX_PSP=enable */
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200216 u32 psstate;
217 u8 needtowakeup;
218
Dan Williamse76850d2007-05-25 17:09:41 -0400219 struct assoc_request * pending_assoc_req;
220 struct assoc_request * in_progress_assoc_req;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200221
222 /** Encryption parameter */
Holger Schurig10078322007-11-15 18:05:47 -0500223 struct lbs_802_11_security secinfo;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200224
225 /** WEP keys */
Dan Williams1443b652007-08-02 10:45:55 -0400226 struct enc_key wep_keys[4];
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200227 u16 wep_tx_keyidx;
228
229 /** WPA keys */
Dan Williams1443b652007-08-02 10:45:55 -0400230 struct enc_key wpa_mcast_key;
231 struct enc_key wpa_unicast_key;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200232
233 /** WPA Information Elements*/
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200234 u8 wpa_ie[MAX_WPA_IE_LEN];
235 u8 wpa_ie_len;
236
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200237 /** Requested Signal Strength*/
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200238 u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
239 u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
240 u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
241 u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
242 u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
243 u16 nextSNRNF;
244 u16 numSNRNF;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200245
Dan Williamsd5db2df2008-08-21 17:51:07 -0400246 u8 radio_on;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200247
Dan Williams8c512762007-08-02 11:40:45 -0400248 /** data rate stuff */
249 u8 cur_rate;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200250
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200251 /** RF calibration data */
252
253#define MAX_REGION_CHANNEL_NUM 2
254 /** region channel data */
255 struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
256
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200257 /** MISCELLANEOUS */
Holger Schurig10078322007-11-15 18:05:47 -0500258 struct lbs_offset_value offsetvalue;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200259
Luis Carlos Cobo965f8bbc2007-08-02 13:16:55 -0400260 u32 monitormode;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200261 u8 fw_ready;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200262};
263
Holger Schurigf539f2e2008-03-26 13:22:11 +0100264extern struct cmd_confirm_sleep confirm_sleep;
265
Holger Schurig10078322007-11-15 18:05:47 -0500266#endif