dev.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. */
  6. #ifndef _LBS_DEV_H_
  7. #define _LBS_DEV_H_
  8. #include "mesh.h"
  9. #include "scan.h"
  10. #include "assoc.h"
  11. #include <linux/kfifo.h>
  12. /** sleep_params */
  13. struct sleep_params {
  14. uint16_t sp_error;
  15. uint16_t sp_offset;
  16. uint16_t sp_stabletime;
  17. uint8_t sp_calcontrol;
  18. uint8_t sp_extsleepclk;
  19. uint16_t sp_reserved;
  20. };
  21. /** Private structure for the MV device */
  22. struct lbs_private {
  23. /* Basic networking */
  24. struct net_device *dev;
  25. u32 connect_status;
  26. int infra_open;
  27. struct work_struct mcast_work;
  28. u32 nr_of_multicastmacaddr;
  29. u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  30. /* CFG80211 */
  31. struct wireless_dev *wdev;
  32. /* Mesh */
  33. struct net_device *mesh_dev; /* Virtual device */
  34. #ifdef CONFIG_LIBERTAS_MESH
  35. u32 mesh_connect_status;
  36. struct lbs_mesh_stats mstats;
  37. int mesh_open;
  38. uint16_t mesh_tlv;
  39. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  40. u8 mesh_ssid_len;
  41. #endif
  42. /* Monitor mode */
  43. struct net_device *rtap_net_dev;
  44. u32 monitormode;
  45. /* Debugfs */
  46. struct dentry *debugfs_dir;
  47. struct dentry *debugfs_debug;
  48. struct dentry *debugfs_files[6];
  49. struct dentry *events_dir;
  50. struct dentry *debugfs_events_files[6];
  51. struct dentry *regs_dir;
  52. struct dentry *debugfs_regs_files[6];
  53. /* Hardware debugging */
  54. u32 mac_offset;
  55. u32 bbp_offset;
  56. u32 rf_offset;
  57. struct lbs_offset_value offsetvalue;
  58. /* Power management */
  59. u16 psmode;
  60. u32 psstate;
  61. u8 needtowakeup;
  62. /* Deep sleep */
  63. int is_deep_sleep;
  64. int is_auto_deep_sleep_enabled;
  65. int wakeup_dev_required;
  66. int is_activity_detected;
  67. int auto_deep_sleep_timeout; /* in ms */
  68. wait_queue_head_t ds_awake_q;
  69. struct timer_list auto_deepsleep_timer;
  70. /* Hardware access */
  71. void *card;
  72. u8 fw_ready;
  73. u8 surpriseremoved;
  74. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  75. void (*reset_card) (struct lbs_private *priv);
  76. int (*enter_deep_sleep) (struct lbs_private *priv);
  77. int (*exit_deep_sleep) (struct lbs_private *priv);
  78. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  79. /* Adapter info (from EEPROM) */
  80. u32 fwrelease;
  81. u32 fwcapinfo;
  82. u16 regioncode;
  83. u8 current_addr[ETH_ALEN];
  84. /* Command download */
  85. u8 dnld_sent;
  86. /* bit0 1/0=data_sent/data_tx_done,
  87. bit1 1/0=cmd_sent/cmd_tx_done,
  88. all other bits reserved 0 */
  89. u16 seqnum;
  90. struct cmd_ctrl_node *cmd_array;
  91. struct cmd_ctrl_node *cur_cmd;
  92. struct list_head cmdfreeq; /* free command buffers */
  93. struct list_head cmdpendingq; /* pending command buffers */
  94. wait_queue_head_t cmd_pending;
  95. struct timer_list command_timer;
  96. int cmd_timed_out;
  97. /* Command responses sent from the hardware to the driver */
  98. int cur_cmd_retcode;
  99. u8 resp_idx;
  100. u8 resp_buf[2][LBS_UPLD_SIZE];
  101. u32 resp_len[2];
  102. /* Events sent from hardware to driver */
  103. struct kfifo event_fifo;
  104. /** thread to service interrupts */
  105. struct task_struct *main_thread;
  106. wait_queue_head_t waitq;
  107. struct workqueue_struct *work_thread;
  108. /** Encryption stuff */
  109. struct lbs_802_11_security secinfo;
  110. struct enc_key wpa_mcast_key;
  111. struct enc_key wpa_unicast_key;
  112. u8 wpa_ie[MAX_WPA_IE_LEN];
  113. u8 wpa_ie_len;
  114. u16 wep_tx_keyidx;
  115. struct enc_key wep_keys[4];
  116. /* Wake On LAN */
  117. uint32_t wol_criteria;
  118. uint8_t wol_gpio;
  119. uint8_t wol_gap;
  120. /* Transmitting */
  121. int tx_pending_len; /* -1 while building packet */
  122. u8 tx_pending_buf[LBS_UPLD_SIZE];
  123. /* protected by hard_start_xmit serialization */
  124. u8 txretrycount;
  125. struct sk_buff *currenttxskb;
  126. /* Locks */
  127. struct mutex lock;
  128. spinlock_t driver_lock;
  129. /* NIC/link operation characteristics */
  130. u16 mac_control;
  131. u8 radio_on;
  132. u8 channel;
  133. s16 txpower_cur;
  134. s16 txpower_min;
  135. s16 txpower_max;
  136. /** Scanning */
  137. struct delayed_work scan_work;
  138. int scan_channel;
  139. /* remember which channel was scanned last, != 0 if currently scanning */
  140. u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
  141. u8 scan_ssid_len;
  142. /* Associating */
  143. struct delayed_work assoc_work;
  144. struct current_bss_params curbssparams;
  145. u8 mode;
  146. struct list_head network_list;
  147. struct list_head network_free_list;
  148. struct bss_descriptor *networks;
  149. struct assoc_request * pending_assoc_req;
  150. struct assoc_request * in_progress_assoc_req;
  151. uint16_t enablehwauto;
  152. /* ADHOC */
  153. u16 beacon_period;
  154. u8 beacon_enable;
  155. u8 adhoccreate;
  156. /* WEXT */
  157. char name[DEV_NAME_LEN];
  158. u8 nodename[16];
  159. struct iw_statistics wstats;
  160. u8 cur_rate;
  161. #define MAX_REGION_CHANNEL_NUM 2
  162. struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
  163. /** Requested Signal Strength*/
  164. u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
  165. u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
  166. u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
  167. u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
  168. u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
  169. u16 nextSNRNF;
  170. u16 numSNRNF;
  171. };
  172. extern struct cmd_confirm_sleep confirm_sleep;
  173. #endif