dev.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. /** sleep_params */
  12. struct sleep_params {
  13. uint16_t sp_error;
  14. uint16_t sp_offset;
  15. uint16_t sp_stabletime;
  16. uint8_t sp_calcontrol;
  17. uint8_t sp_extsleepclk;
  18. uint16_t sp_reserved;
  19. };
  20. /** Private structure for the MV device */
  21. struct lbs_private {
  22. /* Basic networking */
  23. struct net_device *dev;
  24. u32 connect_status;
  25. int infra_open;
  26. struct work_struct mcast_work;
  27. u32 nr_of_multicastmacaddr;
  28. u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  29. /* CFG80211 */
  30. struct wireless_dev *wdev;
  31. /* Mesh */
  32. struct net_device *mesh_dev; /* Virtual device */
  33. #ifdef CONFIG_LIBERTAS_MESH
  34. u32 mesh_connect_status;
  35. struct lbs_mesh_stats mstats;
  36. int mesh_open;
  37. uint16_t mesh_tlv;
  38. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  39. u8 mesh_ssid_len;
  40. #endif
  41. /* Monitor mode */
  42. struct net_device *rtap_net_dev;
  43. u32 monitormode;
  44. /* Debugfs */
  45. struct dentry *debugfs_dir;
  46. struct dentry *debugfs_debug;
  47. struct dentry *debugfs_files[6];
  48. struct dentry *events_dir;
  49. struct dentry *debugfs_events_files[6];
  50. struct dentry *regs_dir;
  51. struct dentry *debugfs_regs_files[6];
  52. /* Hardware debugging */
  53. u32 mac_offset;
  54. u32 bbp_offset;
  55. u32 rf_offset;
  56. struct lbs_offset_value offsetvalue;
  57. /* Power management */
  58. u16 psmode;
  59. u32 psstate;
  60. u8 needtowakeup;
  61. /* Deep sleep */
  62. int is_deep_sleep;
  63. int is_auto_deep_sleep_enabled;
  64. int wakeup_dev_required;
  65. int is_activity_detected;
  66. int auto_deep_sleep_timeout; /* in ms */
  67. wait_queue_head_t ds_awake_q;
  68. struct timer_list auto_deepsleep_timer;
  69. /* Hardware access */
  70. void *card;
  71. u8 fw_ready;
  72. u8 surpriseremoved;
  73. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  74. void (*reset_card) (struct lbs_private *priv);
  75. int (*enter_deep_sleep) (struct lbs_private *priv);
  76. int (*exit_deep_sleep) (struct lbs_private *priv);
  77. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  78. /* Adapter info (from EEPROM) */
  79. u32 fwrelease;
  80. u32 fwcapinfo;
  81. u16 regioncode;
  82. u8 current_addr[ETH_ALEN];
  83. /* Command download */
  84. u8 dnld_sent;
  85. /* bit0 1/0=data_sent/data_tx_done,
  86. bit1 1/0=cmd_sent/cmd_tx_done,
  87. all other bits reserved 0 */
  88. u16 seqnum;
  89. struct cmd_ctrl_node *cmd_array;
  90. struct cmd_ctrl_node *cur_cmd;
  91. struct list_head cmdfreeq; /* free command buffers */
  92. struct list_head cmdpendingq; /* pending command buffers */
  93. wait_queue_head_t cmd_pending;
  94. struct timer_list command_timer;
  95. int nr_retries;
  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