dev.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. /**
  2. * This file contains definitions and data structures specific
  3. * to Marvell 802.11 NIC. It contains the Device Information
  4. * structure wlan_adapter.
  5. */
  6. #ifndef _WLAN_DEV_H_
  7. #define _WLAN_DEV_H_
  8. #include <linux/netdevice.h>
  9. #include <linux/wireless.h>
  10. #include <linux/ethtool.h>
  11. #include <linux/debugfs.h>
  12. #include "defs.h"
  13. #include "scan.h"
  14. #include "thread.h"
  15. extern struct ethtool_ops libertas_ethtool_ops;
  16. #define MAX_BSSID_PER_CHANNEL 16
  17. #define NR_TX_QUEUE 3
  18. /* For the extended Scan */
  19. #define MAX_EXTENDED_SCAN_BSSID_LIST MAX_BSSID_PER_CHANNEL * \
  20. MRVDRV_MAX_CHANNEL_SIZE + 1
  21. #define MAX_REGION_CHANNEL_NUM 2
  22. /** Chan-freq-TxPower mapping table*/
  23. struct chan_freq_power {
  24. /** channel Number */
  25. u16 channel;
  26. /** frequency of this channel */
  27. u32 freq;
  28. /** Max allowed Tx power level */
  29. u16 maxtxpower;
  30. /** TRUE:channel unsupported; FLASE:supported*/
  31. u8 unsupported;
  32. };
  33. /** region-band mapping table*/
  34. struct region_channel {
  35. /** TRUE if this entry is valid */
  36. u8 valid;
  37. /** region code for US, Japan ... */
  38. u8 region;
  39. /** band B/G/A, used for BAND_CONFIG cmd */
  40. u8 band;
  41. /** Actual No. of elements in the array below */
  42. u8 nrcfp;
  43. /** chan-freq-txpower mapping table*/
  44. struct chan_freq_power *CFP;
  45. };
  46. struct wlan_802_11_security {
  47. u8 WPAenabled;
  48. u8 WPA2enabled;
  49. enum WLAN_802_11_WEP_STATUS WEPstatus;
  50. enum WLAN_802_11_AUTHENTICATION_MODE authmode;
  51. enum WLAN_802_1X_AUTH_ALG auth1xalg;
  52. enum WLAN_802_11_ENCRYPTION_MODE Encryptionmode;
  53. };
  54. /** Current Basic Service Set State Structure */
  55. struct current_bss_params {
  56. struct bss_descriptor bssdescriptor;
  57. /** bssid */
  58. u8 bssid[ETH_ALEN];
  59. /** ssid */
  60. struct WLAN_802_11_SSID ssid;
  61. /** band */
  62. u8 band;
  63. /** channel */
  64. u8 channel;
  65. /** number of rates supported */
  66. int numofrates;
  67. /** supported rates*/
  68. u8 datarates[WLAN_SUPPORTED_RATES];
  69. };
  70. /** sleep_params */
  71. struct sleep_params {
  72. u16 sp_error;
  73. u16 sp_offset;
  74. u16 sp_stabletime;
  75. u8 sp_calcontrol;
  76. u8 sp_extsleepclk;
  77. u16 sp_reserved;
  78. };
  79. /** Data structure for the Marvell WLAN device */
  80. typedef struct _wlan_dev {
  81. /** device name */
  82. char name[DEV_NAME_LEN];
  83. /** card pointer */
  84. void *card;
  85. /** IO port */
  86. u32 ioport;
  87. /** Upload received */
  88. u32 upld_rcv;
  89. /** Upload type */
  90. u32 upld_typ;
  91. /** Upload length */
  92. u32 upld_len;
  93. /** netdev pointer */
  94. struct net_device *netdev;
  95. /* Upload buffer */
  96. u8 upld_buf[WLAN_UPLD_SIZE];
  97. /* Download sent:
  98. bit0 1/0=data_sent/data_tx_done,
  99. bit1 1/0=cmd_sent/cmd_tx_done,
  100. all other bits reserved 0 */
  101. u8 dnld_sent;
  102. } wlan_dev_t, *pwlan_dev_t;
  103. /* Mesh statistics */
  104. struct wlan_mesh_stats {
  105. u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
  106. u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
  107. u32 fwd_drop_ttl; /* Fwd: TTL zero */
  108. u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
  109. u32 fwd_drop_noroute; /* Fwd: No route to Destination */
  110. u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
  111. u32 drop_blind; /* Rx: Dropped by blinding table */
  112. };
  113. /** Private structure for the MV device */
  114. struct _wlan_private {
  115. int open;
  116. int mesh_open;
  117. int infra_open;
  118. wlan_adapter *adapter;
  119. wlan_dev_t wlan_dev;
  120. struct net_device_stats stats;
  121. struct net_device *mesh_dev ; /* Virtual device */
  122. struct iw_statistics wstats;
  123. struct wlan_mesh_stats mstats;
  124. struct dentry *debugfs_dir;
  125. struct dentry *debugfs_debug;
  126. struct dentry *debugfs_files[6];
  127. struct dentry *events_dir;
  128. struct dentry *debugfs_events_files[6];
  129. struct dentry *regs_dir;
  130. struct dentry *debugfs_regs_files[6];
  131. u32 mac_offset;
  132. u32 bbp_offset;
  133. u32 rf_offset;
  134. const struct firmware *firmware;
  135. struct device *hotplug_device;
  136. /** thread to service interrupts */
  137. struct wlan_thread mainthread;
  138. struct delayed_work assoc_work;
  139. struct workqueue_struct *assoc_thread;
  140. };
  141. /** Association request
  142. *
  143. * Encapsulates all the options that describe a specific assocation request
  144. * or configuration of the wireless card's radio, mode, and security settings.
  145. */
  146. struct assoc_request {
  147. #define ASSOC_FLAG_SSID 1
  148. #define ASSOC_FLAG_CHANNEL 2
  149. #define ASSOC_FLAG_MODE 3
  150. #define ASSOC_FLAG_BSSID 4
  151. #define ASSOC_FLAG_WEP_KEYS 5
  152. #define ASSOC_FLAG_WEP_TX_KEYIDX 6
  153. #define ASSOC_FLAG_WPA_MCAST_KEY 7
  154. #define ASSOC_FLAG_WPA_UCAST_KEY 8
  155. #define ASSOC_FLAG_SECINFO 9
  156. #define ASSOC_FLAG_WPA_IE 10
  157. unsigned long flags;
  158. struct WLAN_802_11_SSID ssid;
  159. u8 channel;
  160. enum WLAN_802_11_NETWORK_INFRASTRUCTURE mode;
  161. u8 bssid[ETH_ALEN];
  162. /** WEP keys */
  163. struct WLAN_802_11_KEY wep_keys[4];
  164. u16 wep_tx_keyidx;
  165. /** WPA keys */
  166. struct WLAN_802_11_KEY wpa_mcast_key;
  167. struct WLAN_802_11_KEY wpa_unicast_key;
  168. struct wlan_802_11_security secinfo;
  169. /** WPA Information Elements*/
  170. #define MAX_WPA_IE_LEN 64
  171. u8 wpa_ie[MAX_WPA_IE_LEN];
  172. u8 wpa_ie_len;
  173. };
  174. /** Wlan adapter data structure*/
  175. struct _wlan_adapter {
  176. /** STATUS variables */
  177. u32 fwreleasenumber;
  178. u32 fwcapinfo;
  179. /* protected with big lock */
  180. struct mutex lock;
  181. u8 tmptxbuf[WLAN_UPLD_SIZE];
  182. /* protected by hard_start_xmit serialization */
  183. /** command-related variables */
  184. u16 seqnum;
  185. /* protected by big lock */
  186. struct cmd_ctrl_node *cmd_array;
  187. /** Current command */
  188. struct cmd_ctrl_node *cur_cmd;
  189. int cur_cmd_retcode;
  190. /** command Queues */
  191. /** Free command buffers */
  192. struct list_head cmdfreeq;
  193. /** Pending command buffers */
  194. struct list_head cmdpendingq;
  195. wait_queue_head_t cmd_pending;
  196. u8 nr_cmd_pending;
  197. /* command related variables protected by adapter->driver_lock */
  198. /** Async and Sync Event variables */
  199. u32 intcounter;
  200. u32 eventcause;
  201. u8 nodename[16]; /* nickname */
  202. /** spin locks */
  203. spinlock_t driver_lock;
  204. /** Timers */
  205. struct timer_list command_timer;
  206. /* TX queue used in PS mode */
  207. spinlock_t txqueue_lock;
  208. struct sk_buff *tx_queue_ps[NR_TX_QUEUE];
  209. unsigned int tx_queue_idx;
  210. u8 hisregcpy;
  211. /** current ssid/bssid related parameters*/
  212. struct current_bss_params curbssparams;
  213. enum WLAN_802_11_NETWORK_INFRASTRUCTURE inframode;
  214. struct bss_descriptor *pattemptedbssdesc;
  215. struct WLAN_802_11_SSID previousssid;
  216. u8 previousbssid[ETH_ALEN];
  217. struct bss_descriptor *scantable;
  218. u32 numinscantable;
  219. u8 scantype;
  220. u32 scanmode;
  221. u16 beaconperiod;
  222. u8 adhoccreate;
  223. /** capability Info used in Association, start, join */
  224. struct ieeetypes_capinfo capinfo;
  225. /** MAC address information */
  226. u8 current_addr[ETH_ALEN];
  227. u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  228. u32 nr_of_multicastmacaddr;
  229. /** 802.11 statistics */
  230. // struct cmd_DS_802_11_GET_STAT wlan802_11Stat;
  231. u16 enablehwauto;
  232. u16 ratebitmap;
  233. /** control G rates */
  234. u8 adhoc_grate_enabled;
  235. u32 txantenna;
  236. u32 rxantenna;
  237. u8 adhocchannel;
  238. u32 fragthsd;
  239. u32 rtsthsd;
  240. u32 datarate;
  241. u8 is_datarate_auto;
  242. u16 listeninterval;
  243. u16 prescan;
  244. u8 txretrycount;
  245. /** Tx-related variables (for single packet tx) */
  246. struct sk_buff *currenttxskb;
  247. u16 TxLockFlag;
  248. /** NIC Operation characteristics */
  249. u16 currentpacketfilter;
  250. u32 connect_status;
  251. u16 regioncode;
  252. u16 regiontableindex;
  253. u16 txpowerlevel;
  254. /** POWER MANAGEMENT AND PnP SUPPORT */
  255. u8 surpriseremoved;
  256. u16 atimwindow;
  257. u16 psmode; /* Wlan802_11PowermodeCAM=disable
  258. Wlan802_11PowermodeMAX_PSP=enable */
  259. u16 multipledtim;
  260. u32 psstate;
  261. u8 needtowakeup;
  262. struct PS_CMD_ConfirmSleep libertas_ps_confirm_sleep;
  263. u16 locallisteninterval;
  264. u16 nullpktinterval;
  265. struct assoc_request * assoc_req;
  266. /** Encryption parameter */
  267. struct wlan_802_11_security secinfo;
  268. /** WEP keys */
  269. struct WLAN_802_11_KEY wep_keys[4];
  270. u16 wep_tx_keyidx;
  271. /** WPA keys */
  272. struct WLAN_802_11_KEY wpa_mcast_key;
  273. struct WLAN_802_11_KEY wpa_unicast_key;
  274. /** WPA Information Elements*/
  275. #define MAX_WPA_IE_LEN 64
  276. u8 wpa_ie[MAX_WPA_IE_LEN];
  277. u8 wpa_ie_len;
  278. u16 rxantennamode;
  279. u16 txantennamode;
  280. /** Requested Signal Strength*/
  281. u16 bcn_avg_factor;
  282. u16 data_avg_factor;
  283. u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
  284. u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
  285. u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
  286. u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
  287. u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
  288. u16 nextSNRNF;
  289. u16 numSNRNF;
  290. u16 rxpd_rate;
  291. u8 radioon;
  292. u32 preamble;
  293. /** Multi bands Parameter*/
  294. u8 libertas_supported_rates[G_SUPPORTED_RATES];
  295. /** Blue Tooth Co-existence Arbitration */
  296. /** sleep_params */
  297. struct sleep_params sp;
  298. /** RF calibration data */
  299. #define MAX_REGION_CHANNEL_NUM 2
  300. /** region channel data */
  301. struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
  302. struct region_channel universal_channel[MAX_REGION_CHANNEL_NUM];
  303. /** 11D and Domain Regulatory Data */
  304. struct wlan_802_11d_domain_reg domainreg;
  305. struct parsed_region_chan_11d parsed_region_chan;
  306. /** FSM variable for 11d support */
  307. u32 enable11d;
  308. /** MISCELLANEOUS */
  309. u8 *prdeeprom;
  310. struct wlan_offset_value offsetvalue;
  311. struct cmd_ds_802_11_get_log logmsg;
  312. u16 scanprobes;
  313. u32 pkttxctrl;
  314. u16 txrate;
  315. u32 linkmode;
  316. u32 radiomode;
  317. u32 debugmode;
  318. u8 fw_ready;
  319. };
  320. #endif /* _WLAN_DEV_H_ */