orinoco.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /* orinoco.h
  2. *
  3. * Common definitions to all pieces of the various orinoco
  4. * drivers
  5. */
  6. #ifndef _ORINOCO_H
  7. #define _ORINOCO_H
  8. #define DRIVER_VERSION "0.15"
  9. #include <linux/interrupt.h>
  10. #include <linux/suspend.h>
  11. #include <linux/netdevice.h>
  12. #include <linux/wireless.h>
  13. #include <net/iw_handler.h>
  14. #include "hermes.h"
  15. /* To enable debug messages */
  16. //#define ORINOCO_DEBUG 3
  17. #define WIRELESS_SPY // enable iwspy support
  18. #define MAX_SCAN_LEN 4096
  19. #define ORINOCO_MAX_KEY_SIZE 14
  20. #define ORINOCO_MAX_KEYS 4
  21. struct orinoco_key {
  22. __le16 len; /* always stored as little-endian */
  23. char data[ORINOCO_MAX_KEY_SIZE];
  24. } __attribute__ ((packed));
  25. #define TKIP_KEYLEN 16
  26. #define MIC_KEYLEN 8
  27. struct orinoco_tkip_key {
  28. u8 tkip[TKIP_KEYLEN];
  29. u8 tx_mic[MIC_KEYLEN];
  30. u8 rx_mic[MIC_KEYLEN];
  31. };
  32. typedef enum {
  33. FIRMWARE_TYPE_AGERE,
  34. FIRMWARE_TYPE_INTERSIL,
  35. FIRMWARE_TYPE_SYMBOL
  36. } fwtype_t;
  37. struct bss_element {
  38. union hermes_scan_info bss;
  39. unsigned long last_scanned;
  40. struct list_head list;
  41. };
  42. struct xbss_element {
  43. struct agere_ext_scan_info bss;
  44. unsigned long last_scanned;
  45. struct list_head list;
  46. };
  47. struct hermes_rx_descriptor;
  48. struct orinoco_rx_data {
  49. struct hermes_rx_descriptor *desc;
  50. struct sk_buff *skb;
  51. struct list_head list;
  52. };
  53. struct firmware;
  54. struct orinoco_private {
  55. void *card; /* Pointer to card dependent structure */
  56. struct device *dev;
  57. int (*hard_reset)(struct orinoco_private *);
  58. int (*stop_fw)(struct orinoco_private *, int);
  59. /* Synchronisation stuff */
  60. spinlock_t lock;
  61. int hw_unavailable;
  62. struct work_struct reset_work;
  63. /* Interrupt tasklets */
  64. struct tasklet_struct rx_tasklet;
  65. struct list_head rx_list;
  66. struct orinoco_rx_data *rx_data;
  67. /* driver state */
  68. int open;
  69. u16 last_linkstatus;
  70. struct work_struct join_work;
  71. struct work_struct wevent_work;
  72. /* Net device stuff */
  73. struct net_device *ndev;
  74. struct net_device_stats stats;
  75. struct iw_statistics wstats;
  76. /* Hardware control variables */
  77. hermes_t hw;
  78. u16 txfid;
  79. /* Capabilities of the hardware/firmware */
  80. fwtype_t firmware_type;
  81. char fw_name[32];
  82. int ibss_port;
  83. int nicbuf_size;
  84. u16 channel_mask;
  85. /* Boolean capabilities */
  86. unsigned int has_ibss:1;
  87. unsigned int has_port3:1;
  88. unsigned int has_wep:1;
  89. unsigned int has_big_wep:1;
  90. unsigned int has_mwo:1;
  91. unsigned int has_pm:1;
  92. unsigned int has_preamble:1;
  93. unsigned int has_sensitivity:1;
  94. unsigned int has_hostscan:1;
  95. unsigned int has_alt_txcntl:1;
  96. unsigned int has_ext_scan:1;
  97. unsigned int has_wpa:1;
  98. unsigned int do_fw_download:1;
  99. unsigned int broken_disableport:1;
  100. unsigned int broken_monitor:1;
  101. /* Configuration paramaters */
  102. u32 iw_mode;
  103. int prefer_port3;
  104. u16 encode_alg, wep_restrict, tx_key;
  105. struct orinoco_key keys[ORINOCO_MAX_KEYS];
  106. int bitratemode;
  107. char nick[IW_ESSID_MAX_SIZE+1];
  108. char desired_essid[IW_ESSID_MAX_SIZE+1];
  109. char desired_bssid[ETH_ALEN];
  110. int bssid_fixed;
  111. u16 frag_thresh, mwo_robust;
  112. u16 channel;
  113. u16 ap_density, rts_thresh;
  114. u16 pm_on, pm_mcast, pm_period, pm_timeout;
  115. u16 preamble;
  116. #ifdef WIRELESS_SPY
  117. struct iw_spy_data spy_data; /* iwspy support */
  118. struct iw_public_data wireless_data;
  119. #endif
  120. /* Configuration dependent variables */
  121. int port_type, createibss;
  122. int promiscuous, mc_count;
  123. /* Scanning support */
  124. struct list_head bss_list;
  125. struct list_head bss_free_list;
  126. void *bss_xbss_data;
  127. int scan_inprogress; /* Scan pending... */
  128. u32 scan_mode; /* Type of scan done */
  129. /* WPA support */
  130. u8 *wpa_ie;
  131. int wpa_ie_len;
  132. struct orinoco_tkip_key tkip_key[ORINOCO_MAX_KEYS];
  133. struct crypto_hash *rx_tfm_mic;
  134. struct crypto_hash *tx_tfm_mic;
  135. unsigned int wpa_enabled:1;
  136. unsigned int tkip_cm_active:1;
  137. unsigned int key_mgmt:3;
  138. /* Cached in memory firmware to use during ->resume. */
  139. const struct firmware *cached_pri_fw;
  140. const struct firmware *cached_fw;
  141. struct notifier_block pm_notifier;
  142. };
  143. #ifdef ORINOCO_DEBUG
  144. extern int orinoco_debug;
  145. #define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
  146. #else
  147. #define DEBUG(n, args...) do { } while (0)
  148. #endif /* ORINOCO_DEBUG */
  149. /********************************************************************/
  150. /* Exported prototypes */
  151. /********************************************************************/
  152. extern struct net_device *alloc_orinocodev(
  153. int sizeof_card, struct device *device,
  154. int (*hard_reset)(struct orinoco_private *),
  155. int (*stop_fw)(struct orinoco_private *, int));
  156. extern void free_orinocodev(struct net_device *dev);
  157. extern int __orinoco_up(struct net_device *dev);
  158. extern int __orinoco_down(struct net_device *dev);
  159. extern int orinoco_reinit_firmware(struct net_device *dev);
  160. extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
  161. /********************************************************************/
  162. /* Locking and synchronization functions */
  163. /********************************************************************/
  164. static inline int orinoco_lock(struct orinoco_private *priv,
  165. unsigned long *flags)
  166. {
  167. spin_lock_irqsave(&priv->lock, *flags);
  168. if (priv->hw_unavailable) {
  169. DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",
  170. priv->ndev);
  171. spin_unlock_irqrestore(&priv->lock, *flags);
  172. return -EBUSY;
  173. }
  174. return 0;
  175. }
  176. static inline void orinoco_unlock(struct orinoco_private *priv,
  177. unsigned long *flags)
  178. {
  179. spin_unlock_irqrestore(&priv->lock, *flags);
  180. }
  181. #endif /* _ORINOCO_H */