dev.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 "defs.h"
  10. #include "host.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. 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. bool wiphy_registered;
  32. bool stopping;
  33. struct cfg80211_scan_request *scan_req;
  34. u8 assoc_bss[ETH_ALEN];
  35. u8 disassoc_reason;
  36. /* Mesh */
  37. struct net_device *mesh_dev; /* Virtual device */
  38. #ifdef CONFIG_LIBERTAS_MESH
  39. u32 mesh_connect_status;
  40. struct lbs_mesh_stats mstats;
  41. int mesh_open;
  42. uint16_t mesh_tlv;
  43. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  44. u8 mesh_ssid_len;
  45. #endif
  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. /* Power management */
  59. u16 psmode;
  60. u32 psstate;
  61. u8 needtowakeup;
  62. /* Deep sleep */
  63. int is_deep_sleep;
  64. int deep_sleep_required;
  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. /* Host sleep*/
  72. int is_host_sleep_configured;
  73. int is_host_sleep_activated;
  74. wait_queue_head_t host_sleep_q;
  75. /* Hardware access */
  76. void *card;
  77. u8 fw_ready;
  78. u8 surpriseremoved;
  79. u8 setup_fw_on_resume;
  80. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  81. void (*reset_card) (struct lbs_private *priv);
  82. int (*enter_deep_sleep) (struct lbs_private *priv);
  83. int (*exit_deep_sleep) (struct lbs_private *priv);
  84. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  85. /* Adapter info (from EEPROM) */
  86. u32 fwrelease;
  87. u32 fwcapinfo;
  88. u16 regioncode;
  89. u8 current_addr[ETH_ALEN];
  90. u8 copied_hwaddr;
  91. /* Command download */
  92. u8 dnld_sent;
  93. /* bit0 1/0=data_sent/data_tx_done,
  94. bit1 1/0=cmd_sent/cmd_tx_done,
  95. all other bits reserved 0 */
  96. u16 seqnum;
  97. struct cmd_ctrl_node *cmd_array;
  98. struct cmd_ctrl_node *cur_cmd;
  99. struct list_head cmdfreeq; /* free command buffers */
  100. struct list_head cmdpendingq; /* pending command buffers */
  101. struct timer_list command_timer;
  102. int cmd_timed_out;
  103. /* Command responses sent from the hardware to the driver */
  104. u8 resp_idx;
  105. u8 resp_buf[2][LBS_UPLD_SIZE];
  106. u32 resp_len[2];
  107. /* Events sent from hardware to driver */
  108. struct kfifo event_fifo;
  109. /* thread to service interrupts */
  110. struct task_struct *main_thread;
  111. wait_queue_head_t waitq;
  112. struct workqueue_struct *work_thread;
  113. /* Encryption stuff */
  114. u8 authtype_auto;
  115. u8 wep_tx_key;
  116. u8 wep_key[4][WLAN_KEY_LEN_WEP104];
  117. u8 wep_key_len[4];
  118. /* Wake On LAN */
  119. uint32_t wol_criteria;
  120. uint8_t wol_gpio;
  121. uint8_t wol_gap;
  122. bool ehs_remove_supported;
  123. /* Transmitting */
  124. int tx_pending_len; /* -1 while building packet */
  125. u8 tx_pending_buf[LBS_UPLD_SIZE];
  126. /* protected by hard_start_xmit serialization */
  127. u8 txretrycount;
  128. struct sk_buff *currenttxskb;
  129. /* Locks */
  130. struct mutex lock;
  131. spinlock_t driver_lock;
  132. /* NIC/link operation characteristics */
  133. u16 mac_control;
  134. u8 radio_on;
  135. u8 cur_rate;
  136. u8 channel;
  137. s16 txpower_cur;
  138. s16 txpower_min;
  139. s16 txpower_max;
  140. /* Scanning */
  141. struct delayed_work scan_work;
  142. int scan_channel;
  143. /* Queue of things waiting for scan completion */
  144. wait_queue_head_t scan_q;
  145. /* Whether the scan was initiated internally and not by cfg80211 */
  146. bool internal_scan;
  147. unsigned long last_scan;
  148. };
  149. extern struct cmd_confirm_sleep confirm_sleep;
  150. #endif