dev.h 4.9 KB

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