patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / net / wireless / prism54 / islpci_mgt.h
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
21 #ifndef _ISLPCI_MGT_H
22 #define _ISLPCI_MGT_H
23
24 #include <linux/wireless.h>
25 #include <linux/skbuff.h>
26
27 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
28 # include <linux/workqueue.h>
29 #else
30 # include <linux/tqueue.h>
31 # define work_struct tq_struct
32 # define INIT_WORK INIT_TQUEUE
33 # define schedule_work schedule_task
34 #endif
35
36 /*
37  *  Function definitions
38  */
39
40 #define K_DEBUG(f, m, args...) do { if(f & m) printk(KERN_DEBUG args); } while(0)
41 #define DEBUG(f, args...) K_DEBUG(f, pc_debug, args)
42
43 #define TRACE(devname)   K_DEBUG(SHOW_TRACING, VERBOSE, "%s:  -> " __FUNCTION__ "()\n", devname)
44
45 extern int pc_debug;
46 static const int init_wds = 0;  /* help compiler optimize away dead code */
47
48
49 /* General driver definitions */
50 #define PCIVENDOR_INTERSIL                      0x1260UL
51 #define PCIVENDOR_3COM                          0x10b7UL
52 #define PCIVENDOR_DLINK                         0x1186UL
53 #define PCIVENDOR_I4                            0x17cfUL
54 #define PCIVENDOR_IODATA                        0x10fcUL
55 #define PCIVENDOR_NETGEAR                       0x1385UL
56 #define PCIVENDOR_SMC                           0x10b8UL
57 #define PCIVENDOR_ACCTON                        0x1113UL
58
59 #define PCIDEVICE_ISL3877                       0x3877UL
60 #define PCIDEVICE_ISL3890                       0x3890UL
61 #define PCIDEVICE_3COM6001                      0x6001UL
62 #define PCIDEVICE_LATENCY_TIMER_MIN             0x40
63 #define PCIDEVICE_LATENCY_TIMER_VAL             0x50
64
65 /* Debugging verbose definitions */
66 #define SHOW_NOTHING                            0x00    /* overrules everything */
67 #define SHOW_ANYTHING                           0xFF
68 #define SHOW_ERROR_MESSAGES                     0x01
69 #define SHOW_TRAPS                              0x02
70 #define SHOW_FUNCTION_CALLS                     0x04
71 #define SHOW_TRACING                            0x08
72 #define SHOW_QUEUE_INDEXES                      0x10
73 #define SHOW_PIMFOR_FRAMES                      0x20
74 #define SHOW_BUFFER_CONTENTS                    0x40
75 #define VERBOSE                                 0x01
76
77 /* Default card definitions */
78 #define CARD_DEFAULT_CHANNEL                    6
79 #define CARD_DEFAULT_MODE                       INL_MODE_CLIENT
80 #define CARD_DEFAULT_IW_MODE                    IW_MODE_INFRA
81 #define CARD_DEFAULT_BSSTYPE                    DOT11_BSSTYPE_INFRA
82 #define CARD_DEFAULT_CLIENT_SSID                ""
83 #define CARD_DEFAULT_AP_SSID                    "default"
84 #define CARD_DEFAULT_KEY1                       "default_key_1"
85 #define CARD_DEFAULT_KEY2                       "default_key_2"
86 #define CARD_DEFAULT_KEY3                       "default_key_3"
87 #define CARD_DEFAULT_KEY4                       "default_key_4"
88 #define CARD_DEFAULT_WEP                        0
89 #define CARD_DEFAULT_FILTER                     0
90 #define CARD_DEFAULT_WDS                        0
91 #define CARD_DEFAULT_AUTHEN                     DOT11_AUTH_OS
92 #define CARD_DEFAULT_DOT1X                      0
93 #define CARD_DEFAULT_MLME_MODE                  DOT11_MLME_AUTO
94 #define CARD_DEFAULT_CONFORMANCE                OID_INL_CONFORMANCE_NONE
95 #define CARD_DEFAULT_PROFILE                    DOT11_PROFILE_MIXED_G_WIFI
96 #define CARD_DEFAULT_MAXFRAMEBURST              DOT11_MAXFRAMEBURST_MIXED_SAFE
97
98 /* PIMFOR package definitions */
99 #define PIMFOR_ETHERTYPE                        0x8828
100 #define PIMFOR_HEADER_SIZE                      12
101 #define PIMFOR_VERSION                          1
102 #define PIMFOR_OP_GET                           0
103 #define PIMFOR_OP_SET                           1
104 #define PIMFOR_OP_RESPONSE                      2
105 #define PIMFOR_OP_ERROR                         3
106 #define PIMFOR_OP_TRAP                          4
107 #define PIMFOR_OP_RESERVED                      5       /* till 255 */
108 #define PIMFOR_DEV_ID_MHLI_MIB                  0
109 #define PIMFOR_FLAG_APPLIC_ORIGIN               0x01
110 #define PIMFOR_FLAG_LITTLE_ENDIAN               0x02
111
112 static inline void
113 add_le32p(u32 * le_number, u32 add)
114 {
115         *le_number = cpu_to_le32(le32_to_cpup(le_number) + add);
116 }
117
118 void display_buffer(char *, int);
119
120 /*
121  *  Type definition section
122  *
123  *  the structure defines only the header allowing copyless
124  *  frame handling
125  */
126 typedef struct {
127         u8 version;
128         u8 operation;
129         u32 oid;
130         u8 device_id;
131         u8 flags;
132         u32 length;
133 } __attribute__ ((packed))
134 pimfor_header_t;
135
136 /* A received and interrupt-processed management frame, either for
137  * schedule_work(prism54_process_trap) or for priv->mgmt_received,
138  * processed by islpci_mgt_transaction(). */
139 struct islpci_mgmtframe {
140         struct net_device *ndev;      /* pointer to network device */
141         pimfor_header_t *header;      /* payload header, points into buf */
142         void *data;                   /* payload ex header, points into buf */
143         struct work_struct ws;        /* argument for schedule_work() */
144         char buf[0];                  /* fragment buffer */
145 };
146
147 int
148 islpci_mgt_receive(struct net_device *ndev);
149
150 int
151 islpci_mgmt_rx_fill(struct net_device *ndev);
152
153 void
154 islpci_mgt_cleanup_transmit(struct net_device *ndev);
155
156 int
157 islpci_mgt_transaction(struct net_device *ndev,
158                        int operation, unsigned long oid,
159                        void *senddata, int sendlen,
160                        struct islpci_mgmtframe **recvframe);
161
162 static inline void
163 islpci_mgt_release(struct islpci_mgmtframe *frame)
164 {
165         kfree(frame);
166 }
167
168 #endif                          /* _ISLPCI_MGT_H */