islpci_mgt.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. *
  3. * Copyright (C) 2002 Intersil Americas Inc.
  4. * Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. */
  20. #ifndef _ISLPCI_MGT_H
  21. #define _ISLPCI_MGT_H
  22. #include <linux/wireless.h>
  23. #include <linux/skbuff.h>
  24. /*
  25. * Function definitions
  26. */
  27. #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
  28. #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
  29. extern int pc_debug;
  30. #define init_wds 0 /* help compiler optimize away dead code */
  31. /* General driver definitions */
  32. #define PCIDEVICE_LATENCY_TIMER_MIN 0x40
  33. #define PCIDEVICE_LATENCY_TIMER_VAL 0x50
  34. /* Debugging verbose definitions */
  35. #define SHOW_NOTHING 0x00 /* overrules everything */
  36. #define SHOW_ANYTHING 0xFF
  37. #define SHOW_ERROR_MESSAGES 0x01
  38. #define SHOW_TRAPS 0x02
  39. #define SHOW_FUNCTION_CALLS 0x04
  40. #define SHOW_TRACING 0x08
  41. #define SHOW_QUEUE_INDEXES 0x10
  42. #define SHOW_PIMFOR_FRAMES 0x20
  43. #define SHOW_BUFFER_CONTENTS 0x40
  44. #define VERBOSE 0x01
  45. /* Default card definitions */
  46. #define CARD_DEFAULT_CHANNEL 6
  47. #define CARD_DEFAULT_MODE INL_MODE_CLIENT
  48. #define CARD_DEFAULT_IW_MODE IW_MODE_INFRA
  49. #define CARD_DEFAULT_BSSTYPE DOT11_BSSTYPE_INFRA
  50. #define CARD_DEFAULT_CLIENT_SSID ""
  51. #define CARD_DEFAULT_AP_SSID "default"
  52. #define CARD_DEFAULT_KEY1 "default_key_1"
  53. #define CARD_DEFAULT_KEY2 "default_key_2"
  54. #define CARD_DEFAULT_KEY3 "default_key_3"
  55. #define CARD_DEFAULT_KEY4 "default_key_4"
  56. #define CARD_DEFAULT_WEP 0
  57. #define CARD_DEFAULT_FILTER 0
  58. #define CARD_DEFAULT_WDS 0
  59. #define CARD_DEFAULT_AUTHEN DOT11_AUTH_OS
  60. #define CARD_DEFAULT_DOT1X 0
  61. #define CARD_DEFAULT_MLME_MODE DOT11_MLME_AUTO
  62. #define CARD_DEFAULT_CONFORMANCE OID_INL_CONFORMANCE_NONE
  63. #define CARD_DEFAULT_PROFILE DOT11_PROFILE_MIXED_G_WIFI
  64. #define CARD_DEFAULT_MAXFRAMEBURST DOT11_MAXFRAMEBURST_MIXED_SAFE
  65. /* PIMFOR package definitions */
  66. #define PIMFOR_ETHERTYPE 0x8828
  67. #define PIMFOR_HEADER_SIZE 12
  68. #define PIMFOR_VERSION 1
  69. #define PIMFOR_OP_GET 0
  70. #define PIMFOR_OP_SET 1
  71. #define PIMFOR_OP_RESPONSE 2
  72. #define PIMFOR_OP_ERROR 3
  73. #define PIMFOR_OP_TRAP 4
  74. #define PIMFOR_OP_RESERVED 5 /* till 255 */
  75. #define PIMFOR_DEV_ID_MHLI_MIB 0
  76. #define PIMFOR_FLAG_APPLIC_ORIGIN 0x01
  77. #define PIMFOR_FLAG_LITTLE_ENDIAN 0x02
  78. static inline void
  79. add_le32p(u32 * le_number, u32 add)
  80. {
  81. *le_number = cpu_to_le32(le32_to_cpup(le_number) + add);
  82. }
  83. void display_buffer(char *, int);
  84. /*
  85. * Type definition section
  86. *
  87. * the structure defines only the header allowing copyless
  88. * frame handling
  89. */
  90. typedef struct {
  91. u8 version;
  92. u8 operation;
  93. u32 oid;
  94. u8 device_id;
  95. u8 flags;
  96. u32 length;
  97. } __attribute__ ((packed))
  98. pimfor_header_t;
  99. /* A received and interrupt-processed management frame, either for
  100. * schedule_work(prism54_process_trap) or for priv->mgmt_received,
  101. * processed by islpci_mgt_transaction(). */
  102. struct islpci_mgmtframe {
  103. struct net_device *ndev; /* pointer to network device */
  104. pimfor_header_t *header; /* payload header, points into buf */
  105. void *data; /* payload ex header, points into buf */
  106. struct work_struct ws; /* argument for schedule_work() */
  107. char buf[0]; /* fragment buffer */
  108. };
  109. int
  110. islpci_mgt_receive(struct net_device *ndev);
  111. int
  112. islpci_mgmt_rx_fill(struct net_device *ndev);
  113. void
  114. islpci_mgt_cleanup_transmit(struct net_device *ndev);
  115. int
  116. islpci_mgt_transaction(struct net_device *ndev,
  117. int operation, unsigned long oid,
  118. void *senddata, int sendlen,
  119. struct islpci_mgmtframe **recvframe);
  120. static inline void
  121. islpci_mgt_release(struct islpci_mgmtframe *frame)
  122. {
  123. kfree(frame);
  124. }
  125. #endif /* _ISLPCI_MGT_H */