Libertas: Added 11d support using cfg80211
[sfrench/cifs-2.6.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 "defs.h"
11 #include "host.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         struct work_struct mcast_work;
33         u32 nr_of_multicastmacaddr;
34         u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
35
36         /* CFG80211 */
37         struct wireless_dev *wdev;
38         bool wiphy_registered;
39         struct cfg80211_scan_request *scan_req;
40         u8 assoc_bss[ETH_ALEN];
41         u8 disassoc_reason;
42
43         /* Mesh */
44         struct net_device *mesh_dev; /* Virtual device */
45 #ifdef CONFIG_LIBERTAS_MESH
46         u32 mesh_connect_status;
47         struct lbs_mesh_stats mstats;
48         int mesh_open;
49         uint16_t mesh_tlv;
50         u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
51         u8 mesh_ssid_len;
52 #endif
53
54         /* Debugfs */
55         struct dentry *debugfs_dir;
56         struct dentry *debugfs_debug;
57         struct dentry *debugfs_files[6];
58         struct dentry *events_dir;
59         struct dentry *debugfs_events_files[6];
60         struct dentry *regs_dir;
61         struct dentry *debugfs_regs_files[6];
62
63         /** 11D and domain regulatory data */
64         struct lbs_802_11d_domain_reg domain_reg;
65
66         /* Hardware debugging */
67         u32 mac_offset;
68         u32 bbp_offset;
69         u32 rf_offset;
70         struct lbs_offset_value offsetvalue;
71
72         /* Power management */
73         u16 psmode;
74         u32 psstate;
75         u8 needtowakeup;
76
77         /* Deep sleep */
78         int is_deep_sleep;
79         int deep_sleep_required;
80         int is_auto_deep_sleep_enabled;
81         int wakeup_dev_required;
82         int is_activity_detected;
83         int auto_deep_sleep_timeout; /* in ms */
84         wait_queue_head_t ds_awake_q;
85         struct timer_list auto_deepsleep_timer;
86
87         /* Host sleep*/
88         int is_host_sleep_configured;
89         int is_host_sleep_activated;
90         wait_queue_head_t host_sleep_q;
91
92         /* Hardware access */
93         void *card;
94         u8 fw_ready;
95         u8 surpriseremoved;
96         int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
97         void (*reset_card) (struct lbs_private *priv);
98         int (*enter_deep_sleep) (struct lbs_private *priv);
99         int (*exit_deep_sleep) (struct lbs_private *priv);
100         int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
101
102         /* Adapter info (from EEPROM) */
103         u32 fwrelease;
104         u32 fwcapinfo;
105         u16 regioncode;
106         u8 current_addr[ETH_ALEN];
107
108         /* Command download */
109         u8 dnld_sent;
110         /* bit0 1/0=data_sent/data_tx_done,
111            bit1 1/0=cmd_sent/cmd_tx_done,
112            all other bits reserved 0 */
113         u16 seqnum;
114         struct cmd_ctrl_node *cmd_array;
115         struct cmd_ctrl_node *cur_cmd;
116         struct list_head cmdfreeq;    /* free command buffers */
117         struct list_head cmdpendingq; /* pending command buffers */
118         wait_queue_head_t cmd_pending;
119         struct timer_list command_timer;
120         int cmd_timed_out;
121
122         /* Command responses sent from the hardware to the driver */
123         int cur_cmd_retcode;
124         u8 resp_idx;
125         u8 resp_buf[2][LBS_UPLD_SIZE];
126         u32 resp_len[2];
127
128         /* Events sent from hardware to driver */
129         struct kfifo event_fifo;
130
131         /** thread to service interrupts */
132         struct task_struct *main_thread;
133         wait_queue_head_t waitq;
134         struct workqueue_struct *work_thread;
135
136         /** Encryption stuff */
137         u8 authtype_auto;
138         u8 wep_tx_key;
139         u8 wep_key[4][WLAN_KEY_LEN_WEP104];
140         u8 wep_key_len[4];
141
142         /* Wake On LAN */
143         uint32_t wol_criteria;
144         uint8_t wol_gpio;
145         uint8_t wol_gap;
146
147         /* Transmitting */
148         int tx_pending_len;             /* -1 while building packet */
149         u8 tx_pending_buf[LBS_UPLD_SIZE];
150         /* protected by hard_start_xmit serialization */
151         u8 txretrycount;
152         struct sk_buff *currenttxskb;
153
154         /* Locks */
155         struct mutex lock;
156         spinlock_t driver_lock;
157
158         /* NIC/link operation characteristics */
159         u16 mac_control;
160         u8 radio_on;
161         u8 cur_rate;
162         u8 channel;
163         s16 txpower_cur;
164         s16 txpower_min;
165         s16 txpower_max;
166
167         /** Scanning */
168         struct delayed_work scan_work;
169         int scan_channel;
170 };
171
172 extern struct cmd_confirm_sleep confirm_sleep;
173
174 #endif