dev.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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 "scan.h"
  9. #include "assoc.h"
  10. /** sleep_params */
  11. struct sleep_params {
  12. uint16_t sp_error;
  13. uint16_t sp_offset;
  14. uint16_t sp_stabletime;
  15. uint8_t sp_calcontrol;
  16. uint8_t sp_extsleepclk;
  17. uint16_t sp_reserved;
  18. };
  19. /* Mesh statistics */
  20. struct lbs_mesh_stats {
  21. u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
  22. u32 fwd_unicast_cnt; /* Fwd: Unicast counter */
  23. u32 fwd_drop_ttl; /* Fwd: TTL zero */
  24. u32 fwd_drop_rbt; /* Fwd: Recently Broadcasted */
  25. u32 fwd_drop_noroute; /* Fwd: No route to Destination */
  26. u32 fwd_drop_nobuf; /* Fwd: Run out of internal buffers */
  27. u32 drop_blind; /* Rx: Dropped by blinding table */
  28. u32 tx_failed_cnt; /* Tx: Failed transmissions */
  29. };
  30. /** Private structure for the MV device */
  31. struct lbs_private {
  32. /* Basic networking */
  33. struct net_device *dev;
  34. u32 connect_status;
  35. int infra_open;
  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. /* Mesh */
  42. struct net_device *mesh_dev; /* Virtual device */
  43. u32 mesh_connect_status;
  44. struct lbs_mesh_stats mstats;
  45. int mesh_open;
  46. int mesh_fw_ver;
  47. int mesh_autostart_enabled;
  48. uint16_t mesh_tlv;
  49. u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
  50. u8 mesh_ssid_len;
  51. struct work_struct sync_channel;
  52. /* Monitor mode */
  53. struct net_device *rtap_net_dev;
  54. u32 monitormode;
  55. /* Debugfs */
  56. struct dentry *debugfs_dir;
  57. struct dentry *debugfs_debug;
  58. struct dentry *debugfs_files[6];
  59. struct dentry *events_dir;
  60. struct dentry *debugfs_events_files[6];
  61. struct dentry *regs_dir;
  62. struct dentry *debugfs_regs_files[6];
  63. /* Hardware debugging */
  64. u32 mac_offset;
  65. u32 bbp_offset;
  66. u32 rf_offset;
  67. struct lbs_offset_value offsetvalue;
  68. /* Power management */
  69. u16 psmode;
  70. u32 psstate;
  71. u8 needtowakeup;
  72. /* Deep sleep */
  73. int is_deep_sleep;
  74. int is_auto_deep_sleep_enabled;
  75. int wakeup_dev_required;
  76. int is_activity_detected;
  77. int auto_deep_sleep_timeout; /* in ms */
  78. wait_queue_head_t ds_awake_q;
  79. struct timer_list auto_deepsleep_timer;
  80. /* Hardware access */
  81. void *card;
  82. u8 fw_ready;
  83. u8 surpriseremoved;
  84. int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
  85. void (*reset_card) (struct lbs_private *priv);
  86. int (*enter_deep_sleep) (struct lbs_private *priv);
  87. int (*exit_deep_sleep) (struct lbs_private *priv);
  88. int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
  89. /* Adapter info (from EEPROM) */
  90. u32 fwrelease;
  91. u32 fwcapinfo;
  92. u16 regioncode;
  93. u8 current_addr[ETH_ALEN];
  94. /* Command download */
  95. u8 dnld_sent;
  96. /* bit0 1/0=data_sent/data_tx_done,
  97. bit1 1/0=cmd_sent/cmd_tx_done,
  98. all other bits reserved 0 */
  99. u16 seqnum;
  100. struct cmd_ctrl_node *cmd_array;
  101. struct cmd_ctrl_node *cur_cmd;
  102. struct list_head cmdfreeq; /* free command buffers */
  103. struct list_head cmdpendingq; /* pending command buffers */
  104. wait_queue_head_t cmd_pending;
  105. struct timer_list command_timer;
  106. int nr_retries;
  107. int cmd_timed_out;
  108. /* Command responses sent from the hardware to the driver */
  109. int cur_cmd_retcode;
  110. u8 resp_idx;
  111. u8 resp_buf[2][LBS_UPLD_SIZE];
  112. u32 resp_len[2];
  113. /* Events sent from hardware to driver */
  114. struct kfifo *event_fifo;
  115. /** thread to service interrupts */
  116. struct task_struct *main_thread;
  117. wait_queue_head_t waitq;
  118. struct workqueue_struct *work_thread;
  119. /** Encryption stuff */
  120. struct lbs_802_11_security secinfo;
  121. struct enc_key wpa_mcast_key;
  122. struct enc_key wpa_unicast_key;
  123. u8 wpa_ie[MAX_WPA_IE_LEN];
  124. u8 wpa_ie_len;
  125. u16 wep_tx_keyidx;
  126. struct enc_key wep_keys[4];
  127. /* Wake On LAN */
  128. uint32_t wol_criteria;
  129. uint8_t wol_gpio;
  130. uint8_t wol_gap;
  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 channel;
  144. s16 txpower_cur;
  145. s16 txpower_min;
  146. s16 txpower_max;
  147. /** Scanning */
  148. struct delayed_work scan_work;
  149. int scan_channel;
  150. /* remember which channel was scanned last, != 0 if currently scanning */
  151. u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
  152. u8 scan_ssid_len;
  153. /* Associating */
  154. struct delayed_work assoc_work;
  155. struct current_bss_params curbssparams;
  156. u8 mode;
  157. struct list_head network_list;
  158. struct list_head network_free_list;
  159. struct bss_descriptor *networks;
  160. struct assoc_request * pending_assoc_req;
  161. struct assoc_request * in_progress_assoc_req;
  162. u16 capability;
  163. uint16_t enablehwauto;
  164. uint16_t ratebitmap;
  165. /* ADHOC */
  166. u16 beacon_period;
  167. u8 beacon_enable;
  168. u8 adhoccreate;
  169. /* WEXT */
  170. char name[DEV_NAME_LEN];
  171. u8 nodename[16];
  172. struct iw_statistics wstats;
  173. u8 cur_rate;
  174. #define MAX_REGION_CHANNEL_NUM 2
  175. struct region_channel region_channel[MAX_REGION_CHANNEL_NUM];
  176. /** Requested Signal Strength*/
  177. u16 SNR[MAX_TYPE_B][MAX_TYPE_AVG];
  178. u16 NF[MAX_TYPE_B][MAX_TYPE_AVG];
  179. u8 RSSI[MAX_TYPE_B][MAX_TYPE_AVG];
  180. u8 rawSNR[DEFAULT_DATA_AVG_FACTOR];
  181. u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
  182. u16 nextSNRNF;
  183. u16 numSNRNF;
  184. };
  185. extern struct cmd_confirm_sleep confirm_sleep;
  186. #endif