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