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