Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 1 | /** |
| 2 | * This file contains definitions and data structures specific |
| 3 | * to Marvell 802.11 NIC. It contains the Device Information |
David Woodhouse | aa21c00 | 2007-12-08 20:04:36 +0000 | [diff] [blame] | 4 | * structure struct lbs_private.. |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 | |
Holger Schurig | 5e8e8b5 | 2009-11-25 13:09:32 +0100 | [diff] [blame] | 9 | #include "mesh.h" |
Holger Schurig | 2d46502 | 2009-10-22 15:30:48 +0200 | [diff] [blame] | 10 | #include "scan.h" |
| 11 | #include "assoc.h" |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 12 | |
Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame^] | 13 | #include <linux/kfifo.h> |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 14 | |
| 15 | /** sleep_params */ |
| 16 | struct sleep_params { |
David Woodhouse | 3fbe104 | 2007-12-17 23:48:31 -0500 | [diff] [blame] | 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; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 23 | }; |
| 24 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 25 | |
| 26 | /** Private structure for the MV device */ |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 27 | struct lbs_private { |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 28 | |
| 29 | /* Basic networking */ |
| 30 | struct net_device *dev; |
| 31 | u32 connect_status; |
| 32 | int infra_open; |
| 33 | struct work_struct mcast_work; |
| 34 | u32 nr_of_multicastmacaddr; |
| 35 | u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; |
| 36 | |
| 37 | /* CFG80211 */ |
Holger Schurig | ff9fc79 | 2009-10-06 16:31:54 +0200 | [diff] [blame] | 38 | struct wireless_dev *wdev; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 39 | |
| 40 | /* Mesh */ |
| 41 | struct net_device *mesh_dev; /* Virtual device */ |
| 42 | u32 mesh_connect_status; |
| 43 | struct lbs_mesh_stats mstats; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 44 | int mesh_open; |
Bing Zhao | 684d6b3 | 2009-03-25 09:51:16 -0700 | [diff] [blame] | 45 | int mesh_fw_ver; |
Luis Carlos Cobo | d21b31f | 2007-08-02 13:16:02 -0400 | [diff] [blame] | 46 | int mesh_autostart_enabled; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 47 | uint16_t mesh_tlv; |
| 48 | u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 49 | u8 mesh_ssid_len; |
| 50 | struct work_struct sync_channel; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 51 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 52 | /* Monitor mode */ |
Luis Carlos Cobo | 965f8bbc | 2007-08-02 13:16:55 -0400 | [diff] [blame] | 53 | struct net_device *rtap_net_dev; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 54 | u32 monitormode; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 55 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 56 | /* Debugfs */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 57 | struct dentry *debugfs_dir; |
| 58 | struct dentry *debugfs_debug; |
| 59 | struct dentry *debugfs_files[6]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 60 | struct dentry *events_dir; |
| 61 | struct dentry *debugfs_events_files[6]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 62 | struct dentry *regs_dir; |
| 63 | struct dentry *debugfs_regs_files[6]; |
| 64 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 65 | /* Hardware debugging */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 66 | u32 mac_offset; |
| 67 | u32 bbp_offset; |
| 68 | u32 rf_offset; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 69 | struct lbs_offset_value offsetvalue; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 70 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 71 | /* Power management */ |
| 72 | u16 psmode; |
| 73 | u32 psstate; |
| 74 | u8 needtowakeup; |
| 75 | |
| 76 | /* Deep sleep */ |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 77 | int is_deep_sleep; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 78 | int is_auto_deep_sleep_enabled; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 79 | int wakeup_dev_required; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 80 | int is_activity_detected; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 81 | int auto_deep_sleep_timeout; /* in ms */ |
| 82 | wait_queue_head_t ds_awake_q; |
| 83 | struct timer_list auto_deepsleep_timer; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 84 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 85 | /* Hardware access */ |
| 86 | void *card; |
| 87 | u8 fw_ready; |
| 88 | u8 surpriseremoved; |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 89 | 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] | 90 | void (*reset_card) (struct lbs_private *priv); |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 91 | int (*enter_deep_sleep) (struct lbs_private *priv); |
| 92 | int (*exit_deep_sleep) (struct lbs_private *priv); |
| 93 | int (*reset_deep_sleep_wakeup) (struct lbs_private *priv); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 94 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 95 | /* Adapter info (from EEPROM) */ |
Holger Schurig | dac10a9 | 2008-01-16 15:55:22 +0100 | [diff] [blame] | 96 | u32 fwrelease; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 97 | u32 fwcapinfo; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 98 | u16 regioncode; |
| 99 | u8 current_addr[ETH_ALEN]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 100 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 101 | /* Command download */ |
| 102 | u8 dnld_sent; |
| 103 | /* bit0 1/0=data_sent/data_tx_done, |
| 104 | bit1 1/0=cmd_sent/cmd_tx_done, |
| 105 | all other bits reserved 0 */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 106 | u16 seqnum; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 107 | struct cmd_ctrl_node *cmd_array; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 108 | struct cmd_ctrl_node *cur_cmd; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 109 | struct list_head cmdfreeq; /* free command buffers */ |
| 110 | struct list_head cmdpendingq; /* pending command buffers */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 111 | wait_queue_head_t cmd_pending; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 112 | struct timer_list command_timer; |
| 113 | int nr_retries; |
| 114 | int cmd_timed_out; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 115 | |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 116 | /* Command responses sent from the hardware to the driver */ |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 117 | int cur_cmd_retcode; |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 118 | u8 resp_idx; |
| 119 | u8 resp_buf[2][LBS_UPLD_SIZE]; |
| 120 | u32 resp_len[2]; |
| 121 | |
| 122 | /* Events sent from hardware to driver */ |
Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame^] | 123 | struct kfifo event_fifo; |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 124 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 125 | /** thread to service interrupts */ |
| 126 | struct task_struct *main_thread; |
| 127 | wait_queue_head_t waitq; |
| 128 | struct workqueue_struct *work_thread; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 129 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 130 | /** Encryption stuff */ |
| 131 | struct lbs_802_11_security secinfo; |
| 132 | struct enc_key wpa_mcast_key; |
| 133 | struct enc_key wpa_unicast_key; |
| 134 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 135 | u8 wpa_ie_len; |
| 136 | u16 wep_tx_keyidx; |
| 137 | struct enc_key wep_keys[4]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 138 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 139 | /* Wake On LAN */ |
| 140 | uint32_t wol_criteria; |
| 141 | uint8_t wol_gpio; |
| 142 | uint8_t wol_gap; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 143 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 144 | /* Transmitting */ |
| 145 | int tx_pending_len; /* -1 while building packet */ |
| 146 | u8 tx_pending_buf[LBS_UPLD_SIZE]; |
| 147 | /* protected by hard_start_xmit serialization */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 148 | u8 txretrycount; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 149 | struct sk_buff *currenttxskb; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 150 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 151 | /* Locks */ |
| 152 | struct mutex lock; |
| 153 | spinlock_t driver_lock; |
| 154 | |
| 155 | /* NIC/link operation characteristics */ |
Holger Schurig | d9e9778 | 2008-03-12 16:06:43 +0100 | [diff] [blame] | 156 | u16 mac_control; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 157 | u8 radio_on; |
Holger Schurig | c14951f | 2009-10-22 15:30:50 +0200 | [diff] [blame] | 158 | u8 channel; |
Dan Williams | 87c8c72 | 2008-08-19 15:15:35 -0400 | [diff] [blame] | 159 | s16 txpower_cur; |
| 160 | s16 txpower_min; |
| 161 | s16 txpower_max; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 162 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 163 | /** Scanning */ |
| 164 | struct delayed_work scan_work; |
| 165 | int scan_channel; |
| 166 | /* remember which channel was scanned last, != 0 if currently scanning */ |
| 167 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 168 | u8 scan_ssid_len; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 169 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 170 | /* Associating */ |
| 171 | struct delayed_work assoc_work; |
| 172 | struct current_bss_params curbssparams; |
| 173 | u8 mode; |
| 174 | struct list_head network_list; |
| 175 | struct list_head network_free_list; |
| 176 | struct bss_descriptor *networks; |
Dan Williams | e76850d | 2007-05-25 17:09:41 -0400 | [diff] [blame] | 177 | struct assoc_request * pending_assoc_req; |
| 178 | struct assoc_request * in_progress_assoc_req; |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 179 | u16 capability; |
| 180 | uint16_t enablehwauto; |
| 181 | uint16_t ratebitmap; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 182 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 183 | /* ADHOC */ |
| 184 | u16 beacon_period; |
| 185 | u8 beacon_enable; |
| 186 | u8 adhoccreate; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 187 | |
Holger Schurig | 5e04769 | 2009-10-22 15:30:49 +0200 | [diff] [blame] | 188 | /* WEXT */ |
| 189 | char name[DEV_NAME_LEN]; |
| 190 | u8 nodename[16]; |
| 191 | struct iw_statistics wstats; |
| 192 | u8 cur_rate; |
| 193 | #define MAX_REGION_CHANNEL_NUM 2 |
| 194 | struct region_channel region_channel[MAX_REGION_CHANNEL_NUM]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 195 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 196 | /** Requested Signal Strength*/ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 197 | u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 198 | u16 NF[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 199 | u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 200 | u8 rawSNR[DEFAULT_DATA_AVG_FACTOR]; |
| 201 | u8 rawNF[DEFAULT_DATA_AVG_FACTOR]; |
| 202 | u16 nextSNRNF; |
| 203 | u16 numSNRNF; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 204 | }; |
| 205 | |
Holger Schurig | f539f2e | 2008-03-26 13:22:11 +0100 | [diff] [blame] | 206 | extern struct cmd_confirm_sleep confirm_sleep; |
| 207 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 208 | #endif |