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..
13 #include <linux/kfifo.h>
19 uint16_t sp_stabletime;
20 uint8_t sp_calcontrol;
21 uint8_t sp_extsleepclk;
26 struct 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 */
37 /* Private structure for the MV device */
40 /* Basic networking */
41 struct net_device *dev;
43 struct work_struct mcast_work;
44 u32 nr_of_multicastmacaddr;
45 u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
48 struct wireless_dev *wdev;
49 bool wiphy_registered;
50 struct cfg80211_scan_request *scan_req;
51 u8 assoc_bss[ETH_ALEN];
55 struct net_device *mesh_dev; /* Virtual device */
56 #ifdef CONFIG_LIBERTAS_MESH
57 struct lbs_mesh_stats mstats;
59 u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
64 struct dentry *debugfs_dir;
65 struct dentry *debugfs_debug;
66 struct dentry *debugfs_files[6];
67 struct dentry *events_dir;
68 struct dentry *debugfs_events_files[6];
69 struct dentry *regs_dir;
70 struct dentry *debugfs_regs_files[6];
72 /* Hardware debugging */
77 /* Power management */
84 int deep_sleep_required;
85 int is_auto_deep_sleep_enabled;
86 int wakeup_dev_required;
87 int is_activity_detected;
88 int auto_deep_sleep_timeout; /* in ms */
89 wait_queue_head_t ds_awake_q;
90 struct timer_list auto_deepsleep_timer;
93 int is_host_sleep_configured;
94 int is_host_sleep_activated;
95 wait_queue_head_t host_sleep_q;
102 u8 setup_fw_on_resume;
103 int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
104 void (*reset_card) (struct lbs_private *priv);
105 int (*power_save) (struct lbs_private *priv);
106 int (*power_restore) (struct lbs_private *priv);
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);
111 /* Adapter info (from EEPROM) */
115 u8 current_addr[ETH_ALEN];
118 /* Command download */
120 /* bit0 1/0=data_sent/data_tx_done,
121 bit1 1/0=cmd_sent/cmd_tx_done,
122 all other bits reserved 0 */
124 struct cmd_ctrl_node *cmd_array;
125 struct cmd_ctrl_node *cur_cmd;
126 struct list_head cmdfreeq; /* free command buffers */
127 struct list_head cmdpendingq; /* pending command buffers */
128 struct timer_list command_timer;
131 /* Command responses sent from the hardware to the driver */
133 u8 resp_buf[2][LBS_UPLD_SIZE];
136 /* Events sent from hardware to driver */
137 struct kfifo event_fifo;
139 /* thread to service interrupts */
140 struct task_struct *main_thread;
141 wait_queue_head_t waitq;
142 struct workqueue_struct *work_thread;
144 /* Encryption stuff */
147 u8 wep_key[4][WLAN_KEY_LEN_WEP104];
151 uint32_t wol_criteria;
154 bool ehs_remove_supported;
157 int tx_pending_len; /* -1 while building packet */
158 u8 tx_pending_buf[LBS_UPLD_SIZE];
159 /* protected by hard_start_xmit serialization */
161 struct sk_buff *currenttxskb;
162 struct timer_list tx_lockup_timer;
166 spinlock_t driver_lock;
168 /* NIC/link operation characteristics */
178 struct delayed_work scan_work;
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 */
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;
195 extern struct cmd_confirm_sleep confirm_sleep;
197 /* Check if there is an interface active. */
198 static inline int lbs_iface_active(struct lbs_private *priv)
202 r = netif_running(priv->dev);
204 r |= netif_running(priv->mesh_dev);