orinoco.h 5.2 KB

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