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 | 2d46502 | 2009-10-22 15:30:48 +0200 | [diff] [blame^] | 9 | #include "scan.h" |
| 10 | #include "assoc.h" |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 11 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 12 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 13 | |
| 14 | /** sleep_params */ |
| 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 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 24 | /* Mesh statistics */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 25 | struct lbs_mesh_stats { |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 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 */ |
Javier Cardona | 0601e7e | 2007-05-25 12:12:06 -0400 | [diff] [blame] | 33 | u32 tx_failed_cnt; /* Tx: Failed transmissions */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 34 | }; |
| 35 | |
| 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 | ff9fc79 | 2009-10-06 16:31:54 +0200 | [diff] [blame] | 38 | struct wireless_dev *wdev; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 39 | int mesh_open; |
Bing Zhao | 684d6b3 | 2009-03-25 09:51:16 -0700 | [diff] [blame] | 40 | int mesh_fw_ver; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 41 | int infra_open; |
Luis Carlos Cobo | d21b31f | 2007-08-02 13:16:02 -0400 | [diff] [blame] | 42 | int mesh_autostart_enabled; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 43 | |
Holger Schurig | 634b8f4 | 2007-05-25 13:05:16 -0400 | [diff] [blame] | 44 | char name[DEV_NAME_LEN]; |
| 45 | |
| 46 | void *card; |
Holger Schurig | 634b8f4 | 2007-05-25 13:05:16 -0400 | [diff] [blame] | 47 | struct net_device *dev; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 48 | |
Luis Carlos Cobo | 965f8bbc | 2007-08-02 13:16:55 -0400 | [diff] [blame] | 49 | struct net_device *mesh_dev; /* Virtual device */ |
| 50 | struct net_device *rtap_net_dev; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 51 | |
| 52 | struct iw_statistics wstats; |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 53 | struct lbs_mesh_stats mstats; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 54 | struct dentry *debugfs_dir; |
| 55 | struct dentry *debugfs_debug; |
| 56 | struct dentry *debugfs_files[6]; |
| 57 | |
| 58 | struct dentry *events_dir; |
| 59 | struct dentry *debugfs_events_files[6]; |
| 60 | |
| 61 | struct dentry *regs_dir; |
| 62 | struct dentry *debugfs_regs_files[6]; |
| 63 | |
| 64 | u32 mac_offset; |
| 65 | u32 bbp_offset; |
| 66 | u32 rf_offset; |
| 67 | |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 68 | /** Deep sleep flag */ |
| 69 | int is_deep_sleep; |
| 70 | /** Auto deep sleep enabled flag */ |
| 71 | int is_auto_deep_sleep_enabled; |
| 72 | /** Device wakeup required flag */ |
| 73 | int wakeup_dev_required; |
| 74 | /** Auto deep sleep flag*/ |
| 75 | int is_activity_detected; |
| 76 | /** Auto deep sleep timeout (in miliseconds) */ |
| 77 | int auto_deep_sleep_timeout; |
| 78 | |
| 79 | /** Deep sleep wait queue */ |
| 80 | wait_queue_head_t ds_awake_q; |
| 81 | |
Holger Schurig | 634b8f4 | 2007-05-25 13:05:16 -0400 | [diff] [blame] | 82 | /* Download sent: |
| 83 | bit0 1/0=data_sent/data_tx_done, |
| 84 | bit1 1/0=cmd_sent/cmd_tx_done, |
| 85 | all other bits reserved 0 */ |
| 86 | u8 dnld_sent; |
| 87 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 88 | /** thread to service interrupts */ |
Dan Williams | fe33615 | 2007-08-02 11:32:25 -0400 | [diff] [blame] | 89 | struct task_struct *main_thread; |
| 90 | wait_queue_head_t waitq; |
Dan Williams | 2afc0c5 | 2007-08-02 13:19:04 -0400 | [diff] [blame] | 91 | struct workqueue_struct *work_thread; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 92 | |
David Woodhouse | 75bf45a | 2008-05-20 13:32:45 +0100 | [diff] [blame] | 93 | struct work_struct mcast_work; |
| 94 | |
Holger Schurig | 8816edc | 2008-01-28 17:28:05 +0100 | [diff] [blame] | 95 | /** Scanning */ |
Dan Williams | 2afc0c5 | 2007-08-02 13:19:04 -0400 | [diff] [blame] | 96 | struct delayed_work scan_work; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 97 | struct delayed_work assoc_work; |
Luis Carlos Cobo Rus | b8bedef | 2007-05-30 12:14:34 -0400 | [diff] [blame] | 98 | struct work_struct sync_channel; |
Holger Schurig | 8816edc | 2008-01-28 17:28:05 +0100 | [diff] [blame] | 99 | /* remember which channel was scanned last, != 0 if currently scanning */ |
| 100 | int scan_channel; |
Holger Schurig | 243e84e | 2009-10-22 15:30:47 +0200 | [diff] [blame] | 101 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
Holger Schurig | 52933d8 | 2008-03-05 07:05:32 +0100 | [diff] [blame] | 102 | u8 scan_ssid_len; |
Holger Schurig | 208fdd2 | 2007-05-25 12:17:06 -0400 | [diff] [blame] | 103 | |
| 104 | /** Hardware access */ |
Holger Schurig | 69f9032 | 2007-11-23 15:43:44 +0100 | [diff] [blame] | 105 | 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] | 106 | void (*reset_card) (struct lbs_private *priv); |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 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); |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 110 | |
David Woodhouse | 506e902 | 2007-12-12 20:06:06 -0500 | [diff] [blame] | 111 | /* Wake On LAN */ |
| 112 | uint32_t wol_criteria; |
| 113 | uint8_t wol_gpio; |
| 114 | uint8_t wol_gap; |
| 115 | |
David Woodhouse | aa21c00 | 2007-12-08 20:04:36 +0000 | [diff] [blame] | 116 | /** Wlan adapter data structure*/ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 117 | /** STATUS variables */ |
Holger Schurig | dac10a9 | 2008-01-16 15:55:22 +0100 | [diff] [blame] | 118 | u32 fwrelease; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 119 | u32 fwcapinfo; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 120 | |
| 121 | struct mutex lock; |
| 122 | |
David Woodhouse | 2eb188a | 2007-12-09 23:54:27 -0500 | [diff] [blame] | 123 | /* TX packet ready to be sent... */ |
| 124 | int tx_pending_len; /* -1 while building packet */ |
| 125 | |
| 126 | u8 tx_pending_buf[LBS_UPLD_SIZE]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 127 | /* protected by hard_start_xmit serialization */ |
| 128 | |
| 129 | /** command-related variables */ |
| 130 | u16 seqnum; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 131 | |
| 132 | struct cmd_ctrl_node *cmd_array; |
| 133 | /** Current command */ |
| 134 | struct cmd_ctrl_node *cur_cmd; |
| 135 | int cur_cmd_retcode; |
| 136 | /** command Queues */ |
| 137 | /** Free command buffers */ |
| 138 | struct list_head cmdfreeq; |
| 139 | /** Pending command buffers */ |
| 140 | struct list_head cmdpendingq; |
| 141 | |
| 142 | wait_queue_head_t cmd_pending; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 143 | |
Holger Schurig | 7919b89 | 2008-04-01 14:50:43 +0200 | [diff] [blame] | 144 | /* Command responses sent from the hardware to the driver */ |
| 145 | u8 resp_idx; |
| 146 | u8 resp_buf[2][LBS_UPLD_SIZE]; |
| 147 | u32 resp_len[2]; |
| 148 | |
| 149 | /* Events sent from hardware to driver */ |
| 150 | struct kfifo *event_fifo; |
| 151 | |
| 152 | /* nickname */ |
| 153 | u8 nodename[16]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 154 | |
| 155 | /** spin locks */ |
| 156 | spinlock_t driver_lock; |
| 157 | |
| 158 | /** Timers */ |
| 159 | struct timer_list command_timer; |
Amitkumar Karwar | 4912545 | 2009-09-30 20:04:38 -0700 | [diff] [blame] | 160 | struct timer_list auto_deepsleep_timer; |
David Woodhouse | 2a34509 | 2007-12-15 19:33:43 -0500 | [diff] [blame] | 161 | int nr_retries; |
| 162 | int cmd_timed_out; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 163 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 164 | /** current ssid/bssid related parameters*/ |
| 165 | struct current_bss_params curbssparams; |
David Woodhouse | 020f3d0 | 2007-12-12 23:29:13 -0500 | [diff] [blame] | 166 | |
| 167 | uint16_t mesh_tlv; |
Holger Schurig | 243e84e | 2009-10-22 15:30:47 +0200 | [diff] [blame] | 168 | u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
David Woodhouse | 23a397a | 2007-12-11 18:56:42 -0500 | [diff] [blame] | 169 | u8 mesh_ssid_len; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 170 | |
Dan Williams | 0dc5a29 | 2007-05-10 22:58:02 -0400 | [diff] [blame] | 171 | /* IW_MODE_* */ |
| 172 | u8 mode; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 173 | |
Dan Williams | fcdb53d | 2007-05-25 16:15:56 -0400 | [diff] [blame] | 174 | /* Scan results list */ |
| 175 | struct list_head network_list; |
| 176 | struct list_head network_free_list; |
| 177 | struct bss_descriptor *networks; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 178 | |
Brajesh Dave | 96287ac | 2007-11-20 17:44:28 -0500 | [diff] [blame] | 179 | u16 beacon_period; |
| 180 | u8 beacon_enable; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 181 | u8 adhoccreate; |
| 182 | |
| 183 | /** capability Info used in Association, start, join */ |
Dan Williams | 0c9ca690 | 2007-08-02 10:43:44 -0400 | [diff] [blame] | 184 | u16 capability; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 185 | |
| 186 | /** MAC address information */ |
| 187 | u8 current_addr[ETH_ALEN]; |
| 188 | u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN]; |
| 189 | u32 nr_of_multicastmacaddr; |
| 190 | |
| 191 | /** 802.11 statistics */ |
| 192 | // struct cmd_DS_802_11_GET_STAT wlan802_11Stat; |
| 193 | |
Javier Cardona | 85319f9 | 2008-05-24 10:59:49 +0100 | [diff] [blame] | 194 | uint16_t enablehwauto; |
| 195 | uint16_t ratebitmap; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 196 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 197 | u8 txretrycount; |
| 198 | |
| 199 | /** Tx-related variables (for single packet tx) */ |
| 200 | struct sk_buff *currenttxskb; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 201 | |
| 202 | /** NIC Operation characteristics */ |
Holger Schurig | d9e9778 | 2008-03-12 16:06:43 +0100 | [diff] [blame] | 203 | u16 mac_control; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 204 | u32 connect_status; |
Brajesh Dave | 01d77d8 | 2007-11-20 17:44:14 -0500 | [diff] [blame] | 205 | u32 mesh_connect_status; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 206 | u16 regioncode; |
Dan Williams | 87c8c72 | 2008-08-19 15:15:35 -0400 | [diff] [blame] | 207 | s16 txpower_cur; |
| 208 | s16 txpower_min; |
| 209 | s16 txpower_max; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 210 | |
| 211 | /** POWER MANAGEMENT AND PnP SUPPORT */ |
| 212 | u8 surpriseremoved; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 213 | |
| 214 | u16 psmode; /* Wlan802_11PowermodeCAM=disable |
| 215 | Wlan802_11PowermodeMAX_PSP=enable */ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 216 | u32 psstate; |
| 217 | u8 needtowakeup; |
| 218 | |
Dan Williams | e76850d | 2007-05-25 17:09:41 -0400 | [diff] [blame] | 219 | struct assoc_request * pending_assoc_req; |
| 220 | struct assoc_request * in_progress_assoc_req; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 221 | |
| 222 | /** Encryption parameter */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 223 | struct lbs_802_11_security secinfo; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 224 | |
| 225 | /** WEP keys */ |
Dan Williams | 1443b65 | 2007-08-02 10:45:55 -0400 | [diff] [blame] | 226 | struct enc_key wep_keys[4]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 227 | u16 wep_tx_keyidx; |
| 228 | |
| 229 | /** WPA keys */ |
Dan Williams | 1443b65 | 2007-08-02 10:45:55 -0400 | [diff] [blame] | 230 | struct enc_key wpa_mcast_key; |
| 231 | struct enc_key wpa_unicast_key; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 232 | |
| 233 | /** WPA Information Elements*/ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 234 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 235 | u8 wpa_ie_len; |
| 236 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 237 | /** Requested Signal Strength*/ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 238 | u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 239 | u16 NF[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 240 | u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG]; |
| 241 | u8 rawSNR[DEFAULT_DATA_AVG_FACTOR]; |
| 242 | u8 rawNF[DEFAULT_DATA_AVG_FACTOR]; |
| 243 | u16 nextSNRNF; |
| 244 | u16 numSNRNF; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 245 | |
Dan Williams | d5db2df | 2008-08-21 17:51:07 -0400 | [diff] [blame] | 246 | u8 radio_on; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 247 | |
Dan Williams | 8c51276 | 2007-08-02 11:40:45 -0400 | [diff] [blame] | 248 | /** data rate stuff */ |
| 249 | u8 cur_rate; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 250 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 251 | /** RF calibration data */ |
| 252 | |
| 253 | #define MAX_REGION_CHANNEL_NUM 2 |
| 254 | /** region channel data */ |
| 255 | struct region_channel region_channel[MAX_REGION_CHANNEL_NUM]; |
| 256 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 257 | /** MISCELLANEOUS */ |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 258 | struct lbs_offset_value offsetvalue; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 259 | |
Luis Carlos Cobo | 965f8bbc | 2007-08-02 13:16:55 -0400 | [diff] [blame] | 260 | u32 monitormode; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 261 | u8 fw_ready; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 262 | }; |
| 263 | |
Holger Schurig | f539f2e | 2008-03-26 13:22:11 +0100 | [diff] [blame] | 264 | extern struct cmd_confirm_sleep confirm_sleep; |
| 265 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 266 | #endif |