dev.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 "defs.h"
  9. #include "host.h"
  10. #include <linux/kfifo.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. /* Mesh statistics */
  21. struct lbs_mesh_stats {
  22. u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
  23. u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
  24. u32 fwd_drop_ttl; /* Fwd: TTL zero */
  25. u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
  26. u32 fwd_drop_noroute; /* Fwd: No route to Destination */
  27. u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
  28. u32 drop_blind; /* Rx: Dropped by blinding table */
  29. u32 tx_failed_cnt; /* Tx: Failed transmissions */
  30. };
  31. /* Private structure for the MV device */
  32. struct lbs_private {
  33. /* Basic networking */
  34. struct net_device *dev;
  35. u32 connect_status;
  36. struct work_struct mcast_work;
  37. u32 nr_of_multicastmacaddr;
  38. u8 multicastlist[MRVDRV_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
  39. /* CFG80211 */
  40. struct wireless_dev *wdev;
  41. bool wiphy_registered;
  42. bool stopping;
  43. struct cfg80211_scan_request *scan_req;
  44. u8 assoc_bss[ETH_ALEN];
  45. u8 disassoc_reason;
  46. /* Mesh */
  47. struct net_device *mesh_dev; /* Virtual device */
  48. #ifdef CONFIG_LIBERTAS_MESH
  49. struct lbs_mesh_stats mstats;
  50. uint16_t mesh_tlv;
  51. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  52. u8 mesh_ssid_len;
  53. #endif
  54. /* Debugfs */
  55. struct dentry *debugfs_dir;
  56. struct dentry *debugfs_debug;
  57. struct dentry *debugfs_files[6];
  58. struct dentry *events_dir;
  59. struct dentry *debugfs_events_files[6];
  60. struct dentry *regs_dir;
  61. struct dentry *debugfs_regs_files[6];
  62. /* Hardware debugging */
  63. u32 mac_offset;
  64. u32 bbp_offset;
  65. u32 rf_offset;
  66. /* Power management */
  67. u16 psmode;
  68. u32 psstate;
  69. u8 needtowakeup;
  70. /* Deep sleep */
  71. int is_deep_sleep;
  72. int deep_sleep_required;
  73. int is_auto_deep_sleep_enabled;
  74. int wakeup_dev_required;
  75. int is_activity_detected;
  76. int auto_deep_sleep_timeout; /* in ms */
  77. wait_queue_head_t ds_awake_q;
  78. struct timer_list auto_deepsleep_timer;
  79. /* Host sleep*/
  80. int is_host_sleep_configured;
  81. int is_host_sleep_activated;
  82. wait_queue_head_t host_sleep_q;
  83. /* Hardware access */
  84. void *card;
  85. u8 fw_ready;
  86. u8 surpriseremoved;
  87. u8 setup_fw_on_resume;
  88. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  89. void (*reset_card) (struct lbs_private *priv);
  90. int (*enter_deep_sleep) (struct lbs_private *priv);
  91. int (*exit_deep_sleep) (struct lbs_private *priv);
  92. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  93. /* Adapter info (from EEPROM) */
  94. u32 fwrelease;
  95. u32 fwcapinfo;
  96. u16 regioncode;
  97. u8 current_addr[ETH_ALEN];
  98. u8 copied_hwaddr;
  99. /* Command download */
  100. u8 dnld_sent;
  101. /* bit0 1/0=data_sent/data_tx_done,
  102. bit1 1/0=cmd_sent/cmd_tx_done,
  103. all other bits reserved 0 */
  104. u16 seqnum;
  105. struct cmd_ctrl_node *cmd_array;
  106. struct cmd_ctrl_node *cur_cmd;
  107. struct list_head cmdfreeq; /* free command buffers */
  108. struct list_head cmdpendingq; /* pending command buffers */
  109. struct timer_list command_timer;
  110. int cmd_timed_out;
  111. /* Command responses sent from the hardware to the driver */
  112. u8 resp_idx;
  113. u8 resp_buf[2][LBS_UPLD_SIZE];
  114. u32 resp_len[2];
  115. /* Events sent from hardware to driver */
  116. struct kfifo event_fifo;
  117. /* thread to service interrupts */
  118. struct task_struct *main_thread;
  119. wait_queue_head_t waitq;
  120. struct workqueue_struct *work_thread;
  121. /* Encryption stuff */
  122. u8 authtype_auto;
  123. u8 wep_tx_key;
  124. u8 wep_key[4][WLAN_KEY_LEN_WEP104];
  125. u8 wep_key_len[4];
  126. /* Wake On LAN */
  127. uint32_t wol_criteria;
  128. uint8_t wol_gpio;
  129. uint8_t wol_gap;
  130. bool ehs_remove_supported;
  131. /* Transmitting */
  132. int tx_pending_len; /* -1 while building packet */
  133. u8 tx_pending_buf[LBS_UPLD_SIZE];
  134. /* protected by hard_start_xmit serialization */
  135. u8 txretrycount;
  136. struct sk_buff *currenttxskb;
  137. /* Locks */
  138. struct mutex lock;
  139. spinlock_t driver_lock;
  140. /* NIC/link operation characteristics */
  141. u16 mac_control;
  142. u8 radio_on;
  143. u8 cur_rate;
  144. u8 channel;
  145. s16 txpower_cur;
  146. s16 txpower_min;
  147. s16 txpower_max;
  148. /* Scanning */
  149. struct delayed_work scan_work;
  150. int scan_channel;
  151. /* Queue of things waiting for scan completion */
  152. wait_queue_head_t scan_q;
  153. /* Whether the scan was initiated internally and not by cfg80211 */
  154. bool internal_scan;
  155. unsigned long last_scan;
  156. };
  157. extern struct cmd_confirm_sleep confirm_sleep;
  158. #endif