Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
[deliverable/linux.git] / drivers / net / wireless / libertas / dev.h
CommitLineData
8973a6e7
RD
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 */
10078321
HS
6#ifndef _LBS_DEV_H_
7#define _LBS_DEV_H_
876c9d3a 8
e86dc1ca 9#include "defs.h"
534111c7 10#include "decl.h"
e86dc1ca 11#include "host.h"
876c9d3a 12
45465487 13#include <linux/kfifo.h>
876c9d3a 14
8973a6e7 15/* sleep_params */
876c9d3a 16struct sleep_params {
3fbe104c
DW
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;
876c9d3a
MT
23};
24
49fee692
DD
25/* Mesh statistics */
26struct lbs_mesh_stats {
27 u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
28 u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
29 u32 fwd_drop_ttl; /* Fwd: TTL zero */
30 u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
31 u32 fwd_drop_noroute; /* Fwd: No route to Destination */
32 u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
33 u32 drop_blind; /* Rx: Dropped by blinding table */
34 u32 tx_failed_cnt; /* Tx: Failed transmissions */
35};
876c9d3a 36
8973a6e7 37/* Private structure for the MV device */
69f9032d 38struct lbs_private {
5e047692
HS
39
40 /* Basic networking */
41 struct net_device *dev;
42 u32 connect_status;
5e047692
HS
43 struct work_struct mcast_work;
44 u32 nr_of_multicastmacaddr;
45 u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
46
47 /* CFG80211 */
ff9fc791 48 struct wireless_dev *wdev;
73714004 49 bool wiphy_registered;
e86dc1ca
KD
50 struct cfg80211_scan_request *scan_req;
51 u8 assoc_bss[ETH_ALEN];
52 u8 disassoc_reason;
5e047692
HS
53
54 /* Mesh */
55 struct net_device *mesh_dev; /* Virtual device */
4143a23d 56#ifdef CONFIG_LIBERTAS_MESH
5e047692 57 struct lbs_mesh_stats mstats;
5e047692
HS
58 uint16_t mesh_tlv;
59 u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
60 u8 mesh_ssid_len;
4143a23d 61#endif
876c9d3a 62
5e047692 63 /* Debugfs */
876c9d3a
MT
64 struct dentry *debugfs_dir;
65 struct dentry *debugfs_debug;
66 struct dentry *debugfs_files[6];
876c9d3a
MT
67 struct dentry *events_dir;
68 struct dentry *debugfs_events_files[6];
876c9d3a
MT
69 struct dentry *regs_dir;
70 struct dentry *debugfs_regs_files[6];
71
5e047692 72 /* Hardware debugging */
876c9d3a
MT
73 u32 mac_offset;
74 u32 bbp_offset;
75 u32 rf_offset;
5e047692
HS
76
77 /* Power management */
78 u16 psmode;
79 u32 psstate;
80 u8 needtowakeup;
876c9d3a 81
5e047692 82 /* Deep sleep */
49125454 83 int is_deep_sleep;
66fceb69 84 int deep_sleep_required;
49125454 85 int is_auto_deep_sleep_enabled;
49125454 86 int wakeup_dev_required;
49125454 87 int is_activity_detected;
5e047692
HS
88 int auto_deep_sleep_timeout; /* in ms */
89 wait_queue_head_t ds_awake_q;
90 struct timer_list auto_deepsleep_timer;
208fdd2f 91
66fceb69
AK
92 /* Host sleep*/
93 int is_host_sleep_configured;
94 int is_host_sleep_activated;
95 wait_queue_head_t host_sleep_q;
96
5e047692
HS
97 /* Hardware access */
98 void *card;
d2e7b342 99 bool iface_running;
5e047692
HS
100 u8 fw_ready;
101 u8 surpriseremoved;
75abde4d 102 u8 setup_fw_on_resume;
69f9032d 103 int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
edf5dabf 104 void (*reset_card) (struct lbs_private *priv);
d2e7b342
DD
105 int (*power_save) (struct lbs_private *priv);
106 int (*power_restore) (struct lbs_private *priv);
49125454
AK
107 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);
876c9d3a 110
5e047692 111 /* Adapter info (from EEPROM) */
dac10a9f 112 u32 fwrelease;
876c9d3a 113 u32 fwcapinfo;
5e047692
HS
114 u16 regioncode;
115 u8 current_addr[ETH_ALEN];
75abde4d 116 u8 copied_hwaddr;
876c9d3a 117
5e047692
HS
118 /* Command download */
119 u8 dnld_sent;
120 /* bit0 1/0=data_sent/data_tx_done,
121 bit1 1/0=cmd_sent/cmd_tx_done,
122 all other bits reserved 0 */
876c9d3a 123 u16 seqnum;
876c9d3a 124 struct cmd_ctrl_node *cmd_array;
876c9d3a 125 struct cmd_ctrl_node *cur_cmd;
5e047692
HS
126 struct list_head cmdfreeq; /* free command buffers */
127 struct list_head cmdpendingq; /* pending command buffers */
5e047692 128 struct timer_list command_timer;
5e047692 129 int cmd_timed_out;
876c9d3a 130
7919b89c
HS
131 /* Command responses sent from the hardware to the driver */
132 u8 resp_idx;
133 u8 resp_buf[2][LBS_UPLD_SIZE];
134 u32 resp_len[2];
135
136 /* Events sent from hardware to driver */
45465487 137 struct kfifo event_fifo;
7919b89c 138
8973a6e7 139 /* thread to service interrupts */
5e047692
HS
140 struct task_struct *main_thread;
141 wait_queue_head_t waitq;
142 struct workqueue_struct *work_thread;
876c9d3a 143
8973a6e7 144 /* Encryption stuff */
921ca03c 145 u8 authtype_auto;
e86dc1ca
KD
146 u8 wep_tx_key;
147 u8 wep_key[4][WLAN_KEY_LEN_WEP104];
148 u8 wep_key_len[4];
876c9d3a 149
5e047692
HS
150 /* Wake On LAN */
151 uint32_t wol_criteria;
152 uint8_t wol_gpio;
153 uint8_t wol_gap;
ae63a33e 154 bool ehs_remove_supported;
876c9d3a 155
5e047692
HS
156 /* Transmitting */
157 int tx_pending_len; /* -1 while building packet */
158 u8 tx_pending_buf[LBS_UPLD_SIZE];
159 /* protected by hard_start_xmit serialization */
876c9d3a 160 u8 txretrycount;
876c9d3a 161 struct sk_buff *currenttxskb;
8f641d93 162 struct timer_list tx_lockup_timer;
876c9d3a 163
5e047692
HS
164 /* Locks */
165 struct mutex lock;
166 spinlock_t driver_lock;
167
168 /* NIC/link operation characteristics */
d9e9778c 169 u16 mac_control;
5e047692 170 u8 radio_on;
e86dc1ca 171 u8 cur_rate;
c14951fe 172 u8 channel;
87c8c72d
DW
173 s16 txpower_cur;
174 s16 txpower_min;
175 s16 txpower_max;
876c9d3a 176
8973a6e7 177 /* Scanning */
5e047692
HS
178 struct delayed_work scan_work;
179 int scan_channel;
cc026819
DW
180 /* Queue of things waiting for scan completion */
181 wait_queue_head_t scan_q;
182 /* Whether the scan was initiated internally and not by cfg80211 */
183 bool internal_scan;
534111c7
DD
184
185 /* Firmware load */
186 u32 fw_model;
187 wait_queue_head_t fw_waitq;
188 struct device *fw_device;
189 const struct firmware *helper_fw;
190 const struct lbs_fw_table *fw_table;
191 const struct lbs_fw_table *fw_iter;
192 lbs_fw_cb fw_callback;
876c9d3a
MT
193};
194
f539f2ef
HS
195extern struct cmd_confirm_sleep confirm_sleep;
196
d2e7b342
DD
197/* Check if there is an interface active. */
198static inline int lbs_iface_active(struct lbs_private *priv)
199{
200 int r;
201
202 r = netif_running(priv->dev);
bfe2ed8f
DC
203 if (priv->mesh_dev)
204 r |= netif_running(priv->mesh_dev);
d2e7b342
DD
205
206 return r;
207}
208
10078321 209#endif
This page took 0.749684 seconds and 5 git commands to generate.