Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 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 | */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 6 | #ifndef _LBS_DEV_H_ |
| 7 | #define _LBS_DEV_H_ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 8 | |
Kiran Divekar | e86dc1c | 2010-06-14 22:01:26 +0530 | [diff] [blame] | 9 | #include "defs.h" |
| 10 | #include "host.h" |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 11 | |
Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame] | 12 | #include <linux/kfifo.h> |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 13 | |
Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 14 | /* sleep_params */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 15 | struct sleep_params { |
David Woodhouse | 3fbe104 | 2007-12-17 23:48:31 -0500 | [diff] [blame] | 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; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 22 | }; |
| 23 | |
Daniel Drake | 49fee69 | 2011-07-21 20:43:17 +0100 | [diff] [blame^] | 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 | }; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 35 | |
Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 36 | /* Private structure for the MV device */ |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 37 | struct lbs_private { |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 38 | |
| 39 | /* Basic networking */ |
| 40 | struct net_device *dev; |
| 41 | u32 connect_status; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 42 | struct work_struct mcast_work; |
| 43 | u32 nr_of_multicastmacaddr; |
| 44 | u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; |
| 45 | |
| 46 | /* CFG80211 */ |
Holger Schurig | ff9fc79 | 2009-10-06 16:31:54 +0200 | [diff] [blame] | 47 | struct wireless_dev *wdev; |
Daniel Mack | 7371400 | 2010-03-29 17:14:18 +0200 | [diff] [blame] | 48 | bool wiphy_registered; |
Daniel Drake | 2e30168 | 2010-11-04 21:21:52 +0000 | [diff] [blame] | 49 | bool stopping; |
Kiran Divekar | e86dc1c | 2010-06-14 22:01:26 +0530 | [diff] [blame] | 50 | struct cfg80211_scan_request *scan_req; |
| 51 | u8 assoc_bss[ETH_ALEN]; |
| 52 | u8 disassoc_reason; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 53 | |
| 54 | /* Mesh */ |
| 55 | struct net_device *mesh_dev; /* Virtual device */ |
Holger Schurig | 4143a23 | 2009-12-02 15:26:02 +0100 | [diff] [blame] | 56 | #ifdef CONFIG_LIBERTAS_MESH |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 57 | struct lbs_mesh_stats mstats; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 58 | uint16_t mesh_tlv; |
| 59 | u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 60 | u8 mesh_ssid_len; |
Holger Schurig | 4143a23 | 2009-12-02 15:26:02 +0100 | [diff] [blame] | 61 | #endif |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 62 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 63 | /* Debugfs */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 64 | struct dentry *debugfs_dir; |
| 65 | struct dentry *debugfs_debug; |
| 66 | struct dentry *debugfs_files[6]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 67 | struct dentry *events_dir; |
| 68 | struct dentry *debugfs_events_files[6]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 69 | struct dentry *regs_dir; |
| 70 | struct dentry *debugfs_regs_files[6]; |
| 71 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 72 | /* Hardware debugging */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 73 | u32 mac_offset; |
| 74 | u32 bbp_offset; |
| 75 | u32 rf_offset; |
| 76 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 77 | /* Power management */ |
| 78 | u16 psmode; |
| 79 | u32 psstate; |
| 80 | u8 needtowakeup; |
| 81 | |
| 82 | /* Deep sleep */ |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 83 | int is_deep_sleep; |
Amitkumar Karwar | 66fceb6 | 2010-05-19 03:24:38 -0700 | [diff] [blame] | 84 | int deep_sleep_required; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 85 | int is_auto_deep_sleep_enabled; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 86 | int wakeup_dev_required; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 87 | int is_activity_detected; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 88 | int auto_deep_sleep_timeout; /* in ms */ |
| 89 | wait_queue_head_t ds_awake_q; |
| 90 | struct timer_list auto_deepsleep_timer; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 91 | |
Amitkumar Karwar | 66fceb6 | 2010-05-19 03:24:38 -0700 | [diff] [blame] | 92 | /* Host sleep*/ |
| 93 | int is_host_sleep_configured; |
| 94 | int is_host_sleep_activated; |
| 95 | wait_queue_head_t host_sleep_q; |
| 96 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 97 | /* Hardware access */ |
| 98 | void *card; |
| 99 | u8 fw_ready; |
| 100 | u8 surpriseremoved; |
Vasily Khoruzhick | 75abde4 | 2011-01-21 22:44:49 +0200 | [diff] [blame] | 101 | u8 setup_fw_on_resume; |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 102 | int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); |
David Woodhouse | edf5dab | 2008-05-20 16:43:31 +0100 | [diff] [blame] | 103 | void (*reset_card) (struct lbs_private *priv); |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 104 | int (*enter_deep_sleep) (struct lbs_private *priv); |
| 105 | int (*exit_deep_sleep) (struct lbs_private *priv); |
| 106 | int (*reset_deep_sleep_wakeup) (struct lbs_private *priv); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 107 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 108 | /* Adapter info (from EEPROM) */ |
Holger Schurig | dac10a9 | 2008-01-16 15:55:22 +0100 | [diff] [blame] | 109 | u32 fwrelease; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 110 | u32 fwcapinfo; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 111 | u16 regioncode; |
| 112 | u8 current_addr[ETH_ALEN]; |
Vasily Khoruzhick | 75abde4 | 2011-01-21 22:44:49 +0200 | [diff] [blame] | 113 | u8 copied_hwaddr; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 114 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 115 | /* Command download */ |
| 116 | u8 dnld_sent; |
| 117 | /* bit0 1/0=data_sent/data_tx_done, |
| 118 | bit1 1/0=cmd_sent/cmd_tx_done, |
| 119 | all other bits reserved 0 */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 120 | u16 seqnum; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 121 | struct cmd_ctrl_node *cmd_array; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 122 | struct cmd_ctrl_node *cur_cmd; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 123 | struct list_head cmdfreeq; /* free command buffers */ |
| 124 | struct list_head cmdpendingq; /* pending command buffers */ |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 125 | struct timer_list command_timer; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 126 | int cmd_timed_out; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 127 | |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 128 | /* Command responses sent from the hardware to the driver */ |
| 129 | u8 resp_idx; |
| 130 | u8 resp_buf[2][LBS_UPLD_SIZE]; |
| 131 | u32 resp_len[2]; |
| 132 | |
| 133 | /* Events sent from hardware to driver */ |
Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame] | 134 | struct kfifo event_fifo; |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 135 | |
Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 136 | /* thread to service interrupts */ |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 137 | struct task_struct *main_thread; |
| 138 | wait_queue_head_t waitq; |
| 139 | struct workqueue_struct *work_thread; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 140 | |
Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 141 | /* Encryption stuff */ |
Amitkumar Karwar | 921ca03 | 2010-02-25 17:16:36 -0800 | [diff] [blame] | 142 | u8 authtype_auto; |
Kiran Divekar | e86dc1c | 2010-06-14 22:01:26 +0530 | [diff] [blame] | 143 | u8 wep_tx_key; |
| 144 | u8 wep_key[4][WLAN_KEY_LEN_WEP104]; |
| 145 | u8 wep_key_len[4]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 146 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 147 | /* Wake On LAN */ |
| 148 | uint32_t wol_criteria; |
| 149 | uint8_t wol_gpio; |
| 150 | uint8_t wol_gap; |
Deepak Saxena | ae63a33 | 2010-10-31 13:40:33 +0000 | [diff] [blame] | 151 | bool ehs_remove_supported; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 152 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 153 | /* Transmitting */ |
| 154 | int tx_pending_len; /* -1 while building packet */ |
| 155 | u8 tx_pending_buf[LBS_UPLD_SIZE]; |
| 156 | /* protected by hard_start_xmit serialization */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 157 | u8 txretrycount; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 158 | struct sk_buff *currenttxskb; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 159 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 160 | /* Locks */ |
| 161 | struct mutex lock; |
| 162 | spinlock_t driver_lock; |
| 163 | |
| 164 | /* NIC/link operation characteristics */ |
Holger Schurig | d9e9778 | 2008-03-12 16:06:43 +0100 | [diff] [blame] | 165 | u16 mac_control; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 166 | u8 radio_on; |
Kiran Divekar | e86dc1c | 2010-06-14 22:01:26 +0530 | [diff] [blame] | 167 | u8 cur_rate; |
Holger Schurig | c14951f | 2009-10-22 15:30:50 +0200 | [diff] [blame] | 168 | u8 channel; |
Dan Williams | 87c8c72 | 2008-08-19 15:15:35 -0400 | [diff] [blame] | 169 | s16 txpower_cur; |
| 170 | s16 txpower_min; |
| 171 | s16 txpower_max; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 172 | |
Randy Dunlap | 8973a6e | 2011-04-26 15:25:29 -0700 | [diff] [blame] | 173 | /* Scanning */ |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 174 | struct delayed_work scan_work; |
| 175 | int scan_channel; |
Dan Williams | cc02681 | 2010-08-04 00:43:47 -0500 | [diff] [blame] | 176 | /* Queue of things waiting for scan completion */ |
| 177 | wait_queue_head_t scan_q; |
| 178 | /* Whether the scan was initiated internally and not by cfg80211 */ |
| 179 | bool internal_scan; |
| 180 | unsigned long last_scan; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 181 | }; |
| 182 | |
Holger Schurig | f539f2e | 2008-03-26 13:22:11 +0100 | [diff] [blame] | 183 | extern struct cmd_confirm_sleep confirm_sleep; |
| 184 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 185 | #endif |